polkadot-api 1.17.2 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +1 -1
- package/dist/esm/reexports/ws-provider.mjs +2 -0
- package/dist/esm/reexports/ws-provider.mjs.map +1 -0
- package/dist/reexports/chains.d.ts +1 -0
- package/dist/reexports/ws-provider.d.ts +1 -0
- package/dist/reexports/ws-provider.js +13 -0
- package/dist/reexports/ws-provider.js.map +1 -0
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/ws-provider.min.js +1 -0
- package/dist/umd/ws-provider_web.min.js +1 -1
- package/package.json +23 -11
- package/ws-provider/package.json +9 -0
package/bin/cli.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-provider.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -37,5 +37,6 @@ import '@polkadot-api/smoldot/from-worker';
|
|
|
37
37
|
import '@polkadot-api/smoldot/node-worker';
|
|
38
38
|
import '@polkadot-api/smoldot/worker';
|
|
39
39
|
import '@polkadot-api/utils';
|
|
40
|
+
import '@polkadot-api/ws-provider';
|
|
40
41
|
import '@polkadot-api/ws-provider/node';
|
|
41
42
|
import '@polkadot-api/ws-provider/web';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@polkadot-api/ws-provider';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var wsProvider = require('@polkadot-api/ws-provider');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(wsProvider).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return wsProvider[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=ws-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-provider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/umd/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function(ce,Yt){typeof exports=="object"&&typeof module<"u"?Yt(exports):typeof define=="function"&&define.amd?define(["exports"],Yt):(ce=typeof globalThis<"u"?globalThis:ce||self,Yt(ce.papi={}))})(this,(function(ce){"use strict";var Yt=Object.defineProperty,Ra=(e,t,n)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hs=(e,t,n)=>(Ra(e,typeof t!="symbol"?t+"":t,n),n),ir={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function Pa(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|ir[e[2]]);for(let o=0;o<r;){const i=n+o*2,a=ir[e[i]],u=ir[e[i+1]];s[t+o++]=a<<4|u}return s}var ds=class extends Uint8Array{constructor(e){super(e),hs(this,"i",0),hs(this,"v"),this.v=new DataView(e)}},Ce=e=>t=>e(t instanceof ds?t:new ds(t instanceof Uint8Array?t.buffer:typeof t=="string"?Pa(t).buffer:t)),qe=e=>{const t=e.length;let n=0;for(let s=0;s<t;s++)n+=e[s].length;const r=new Uint8Array(n);for(let s=0,o=0;s<t;s++){const i=e[s];r.set(i,o),o+=i.byteLength}return r};function bn(e,t){const n=Object.keys(e),r=n.length,s={};for(let o=0;o<r;o++){const i=n[o];s[i]=t(e[i],i)}return s}var Je=Ce,W=(e,t)=>{const n=[e,t];return n.enc=e,n.dec=t,n},gn=(e,t)=>n=>e(t(n)),wn=(e,t)=>n=>t(e(n)),Ke=([e,t],n,r)=>W(gn(e,n),wn(t,r));function Ua(e,t){return Ce(n=>{const r=n.v[t](n.i,!0);return n.i+=e,r})}function Ma(e,t){return n=>{const r=new Uint8Array(e);return new DataView(r.buffer)[t](0,n,!0),r}}function it(e,t,n){return W(Ma(e,n),Ua(e,t))}var D=it(1,"getUint8","setUint8"),Ne=it(2,"getUint16","setUint16"),Ve=it(4,"getUint32","setUint32"),Gt=it(8,"getBigUint64","setBigUint64"),La=it(1,"getInt8","setInt8"),Da=it(2,"getInt16","setInt16"),Va=it(4,"getInt32","setInt32"),Ha=it(8,"getBigInt64","setBigInt64"),ps=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),t},vs=e=>Ce(t=>{const{v:n,i:r}=t,s=n.getBigUint64(r,!0),o=n[e](r+8,!0);return t.i+=16,o<<64n|s}),ms=W(ps,vs("getBigUint64")),Fa=W(ps,vs("getBigInt64")),ys=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigInt64(0,e,!0),n.setBigInt64(8,e>>64n,!0),n.setBigInt64(16,e>>128n,!0),n.setBigInt64(24,e>>192n,!0),t},bs=e=>Ce(t=>{let n=t.v.getBigUint64(t.i,!0);return t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<64n,t.i+=8,n|=t.v.getBigUint64(t.i,!0)<<128n,t.i+=8,n|=t.v[e](t.i,!0)<<192n,t.i+=8,n}),ja=W(ys,bs("getBigUint64")),za=W(ys,bs("getBigInt64")),Wa=Ke(D,e=>e?1:0,Boolean),qa=[D[1],Ne[1],Ve[1]],Ka=Ce(e=>{const t=e[e.i],n=t&3;if(n<3)return qa[n](e)>>>2;const r=(t>>>2)+4;e.i++;let s=0n;const o=r/8|0;let i=0n;for(let u=0;u<o;u++)s=Gt[1](e)<<i|s,i+=64n;let a=r%8;return a>3&&(s=BigInt(Ve[1](e))<<i|s,i+=32n,a-=4),a>1&&(s=BigInt(Ne[1](e))<<i|s,i+=16n,a-=2),a&&(s=BigInt(D[1](e))<<i|s),s}),Na=1n<<56n,Xa=1<<24,Ya=256,Ga=4294967295n,Qa=64,Za=16384,Ja=1<<30,ec=e=>{if(e<0)throw new Error(`Wrong compact input (${e})`);const t=Number(e)<<2;if(e<Qa)return D[0](t);if(e<Za)return Ne[0](t|1);if(e<Ja)return Ve[0](t|2);let n=[new Uint8Array(1)],r=BigInt(e);for(;r>=Na;)n.push(Gt[0](r)),r>>=64n;r>=Xa&&(n.push(Ve[0](Number(r&Ga))),r>>=32n);let s=Number(r);s>=Ya&&(n.push(Ne[0](s)),s>>=16),s&&n.push(D[0](s));const o=qe(n);return o[0]=o.length-5<<2|3,o},he=W(ec,Ka),tc=new TextEncoder,nc=e=>{const t=tc.encode(e);return qe([he.enc(t.length),t])},rc=new TextDecoder,sc=Ce(e=>{let t=he.dec(e);const n=new DataView(e.buffer,e.i,t);return e.i+=t,rc.decode(n)}),H=W(nc,sc),oc=()=>{},ic=new Uint8Array(0),O=W(()=>ic,oc),gs=e=>e===void 0?t=>qe([he.enc(t.length),t]):t=>t.length===e?t:t.slice(0,e),ws=e=>Ce(t=>{const n=e===void 0?he.dec(t):e!==1/0?e:t.byteLength-t.i,r=new Uint8Array(t.buffer.slice(t.i,t.i+n));return t.i+=n,r}),Y=e=>W(gs(e),ws(e));Y.enc=gs,Y.dec=ws;var xs=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((o,i)=>[n[i],o])??n.map((o,i)=>[o,i])),s=o=>r.get(o);return({tag:o,value:i})=>qe([D.enc(s(o)),e[o](i)])},Es=(e,t)=>{const n=Object.keys(e),r=new Map(t?.map((s,o)=>[s,n[o]])??n.map((s,o)=>[o,s]));return Ce(s=>{const o=D.dec(s),i=r.get(o),a=e[i];return{tag:i,value:a(s)}})},be=(e,...t)=>W(xs(bn(e,([n])=>n),...t),Es(bn(e,([,n])=>n),...t));be.enc=xs,be.dec=Es;var ks=e=>Ce(t=>D[1](t)>0?e(t):void 0),As=e=>t=>{const n=new Uint8Array(1);return t===void 0?n:(n[0]=1,qe([n,e(t)]))},ge=e=>W(As(e[0]),ks(e[1]));ge.enc=As,ge.dec=ks;var Ss=(e,t)=>Ce(n=>{const r=D[1](n)===0,o=(r?e:t)(n);return{success:r,value:o}}),$s=(e,t)=>({success:n,value:r})=>qe([D[0](n?0:1),(n?e:t)(r)]),Qt=(e,t)=>W($s(e[0],t[0]),Ss(e[1],t[1]));Qt.dec=Ss,Qt.enc=$s;var Is=(...e)=>Ce(t=>e.map(n=>n(t))),Bs=(...e)=>t=>qe(e.map((n,r)=>n(t[r]))),_e=(...e)=>W(Bs(...e.map(([t])=>t)),Is(...e.map(([,t])=>t)));_e.enc=Bs,_e.dec=Is;var Cs=e=>{const t=Object.keys(e);return gn(_e.enc(...Object.values(e)),n=>t.map(r=>n[r]))},_s=e=>{const t=Object.keys(e);return wn(_e.dec(...Object.values(e)),n=>Object.fromEntries(n.map((r,s)=>[t[s],r])))},R=e=>W(Cs(bn(e,t=>t[0])),_s(bn(e,t=>t[1])));R.enc=Cs,R.dec=_s;var Os=(e,t)=>t>=0?n=>qe(n.map(e)):n=>qe([he.enc(n.length),qe(n.map(e))]),Ts=(e,t)=>Ce(n=>{const r=t>=0?t:he.dec(n),s=new Array(r);for(let o=0;o<r;o++)s[o]=e(n);return s}),L=(e,t)=>W(Os(e[0],t),Ts(e[1],t));L.enc=Os,L.dec=Ts;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ac(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Rs(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function ar(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Ps(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function cr(e){if(!Array.isArray(e))throw new Error("array expected")}function Us(e,t){if(!Rs(!0,t))throw new Error(`${e}: array of strings expected`)}function cc(e,t){if(!Rs(!1,t))throw new Error(`${e}: array of numbers expected`)}function uc(...e){const t=o=>o,n=(o,i)=>a=>o(i(a)),r=e.map(o=>o.encode).reduceRight(n,t),s=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:s}}function lc(e){const t=typeof e=="string"?e.split(""):e,n=t.length;Us("alphabet",t);const r=new Map(t.map((s,o)=>[s,o]));return{encode:s=>(cr(s),s.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:s=>(cr(s),s.map(o=>{ar("alphabet.decode",o);const i=r.get(o);if(i===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return i}))}}function fc(e=""){return ar("join",e),{encode:t=>(Us("join.decode",t),t.join(e)),decode:t=>(ar("join.decode",t),t.split(e))}}function Ms(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(cr(e),!e.length)return[];let r=0;const s=[],o=Array.from(e,a=>{if(Ps(a),a<0||a>=t)throw new Error(`invalid integer: ${a}`);return a}),i=o.length;for(;;){let a=0,u=!0;for(let c=r;c<i;c++){const l=o[c],v=t*a,f=v+l;if(!Number.isSafeInteger(f)||v/t!==a||f-l!==v)throw new Error("convertRadix: carry overflow");const d=f/n;a=f%n;const p=Math.floor(d);if(o[c]=p,!Number.isSafeInteger(p)||p*n+a!==f)throw new Error("convertRadix: carry overflow");if(u)p?u=!1:r=c;else continue}if(s.push(a),u)break}for(let a=0;a<e.length-1&&e[a]===0;a++)s.push(0);return s.reverse()}function hc(e){Ps(e);const t=2**8;return{encode:n=>{if(!ac(n))throw new Error("radix.encode input should be Uint8Array");return Ms(Array.from(n),t,e)},decode:n=>(cc("radix.decode",n),Uint8Array.from(Ms(n,e,t)))}}const Ls=(e=>uc(hc(58),lc(e),fc("")))("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function dc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Pt(e,t=""){if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new Error(`${n}expected integer >0, got ${e}`)}}function Oe(e,t,n=""){const r=dc(e),s=e?.length,o=t!==void 0;if(!r||o&&s!==t){const i=n&&`"${n}" `,a=o?` of length ${t}`:"",u=r?`length=${s}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+a+", got "+u)}return e}function Zt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ur(e,t){Oe(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function pc(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Et(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function at(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function xn(e,t){return e<<32-t|e>>>t}const Ds=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Vs(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const et=Ds?e=>e:e=>Vs(e);function vc(e){for(let t=0;t<e.length;t++)e[t]=Vs(e[t]);return e}const de=Ds?e=>e:vc;function lr(e,t={}){const n=(s,o)=>e(o).update(s).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=s=>e(s),Object.assign(n,t),Object.freeze(n)}const mc=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);function ct(e,t,n,r,s){return e=e+t+s|0,r=xn(r^e,16),n=n+r|0,t=xn(t^n,12),{a:e,b:t,c:n,d:r}}function ut(e,t,n,r,s){return e=e+t+s|0,r=xn(r^e,8),n=n+r|0,t=xn(t^n,7),{a:e,b:t,c:n,d:r}}const yc=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),En=BigInt(2**32-1),Hs=BigInt(32);function kn(e,t=!1){return t?{h:Number(e&En),l:Number(e>>Hs&En)}:{h:Number(e>>Hs&En)|0,l:Number(e&En)|0}}function bc(e,t=!1){const n=e.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let o=0;o<n;o++){const{h:i,l:a}=kn(e[o],t);[r[o],s[o]]=[i,a]}return[r,s]}const Fs=(e,t,n)=>e>>>n|t<<32-n,js=(e,t,n)=>e<<32-n|t>>>n,gc=(e,t,n)=>e<<64-n|t>>>n-32,wc=(e,t,n)=>e>>>n-32|t<<64-n,xc=(e,t)=>t,Ec=(e,t)=>e,kc=(e,t,n)=>e<<n|t>>>32-n,Ac=(e,t,n)=>t<<n|e>>>32-n,Sc=(e,t,n)=>t<<n-32|e>>>64-n,$c=(e,t,n)=>e<<n-32|t>>>64-n;function zs(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const Ws=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),qs=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,J=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),$=new Uint32Array(32);function lt(e,t,n,r,s,o){const i=s[o],a=s[o+1];let u=$[2*e],c=$[2*e+1],l=$[2*t],v=$[2*t+1],f=$[2*n],d=$[2*n+1],p=$[2*r],h=$[2*r+1],m=Ws(u,l,i);c=qs(m,c,v,a),u=m|0,{Dh:h,Dl:p}={Dh:h^c,Dl:p^u},{Dh:h,Dl:p}={Dh:xc(h,p),Dl:Ec(h)},{h:d,l:f}=zs(d,f,h,p),{Bh:v,Bl:l}={Bh:v^d,Bl:l^f},{Bh:v,Bl:l}={Bh:Fs(v,l,24),Bl:js(v,l,24)},$[2*e]=u,$[2*e+1]=c,$[2*t]=l,$[2*t+1]=v,$[2*n]=f,$[2*n+1]=d,$[2*r]=p,$[2*r+1]=h}function ft(e,t,n,r,s,o){const i=s[o],a=s[o+1];let u=$[2*e],c=$[2*e+1],l=$[2*t],v=$[2*t+1],f=$[2*n],d=$[2*n+1],p=$[2*r],h=$[2*r+1],m=Ws(u,l,i);c=qs(m,c,v,a),u=m|0,{Dh:h,Dl:p}={Dh:h^c,Dl:p^u},{Dh:h,Dl:p}={Dh:Fs(h,p,16),Dl:js(h,p,16)},{h:d,l:f}=zs(d,f,h,p),{Bh:v,Bl:l}={Bh:v^d,Bl:l^f},{Bh:v,Bl:l}={Bh:gc(v,l,63),Bl:wc(v,l,63)},$[2*e]=u,$[2*e+1]=c,$[2*t]=l,$[2*t+1]=v,$[2*n]=f,$[2*n+1]=d,$[2*r]=p,$[2*r+1]=h}function Ic(e,t={},n,r,s){if(Pt(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:o,salt:i,personalization:a}=t;if(o!==void 0&&(o.length<1||o.length>n))throw new Error('"key" expected to be undefined or of length=1..'+n);i!==void 0&&Oe(i,r,"salt"),a!==void 0&&Oe(a,s,"personalization")}class Ks{buffer;buffer32;finished=!1;destroyed=!1;length=0;pos=0;blockLen;outputLen;constructor(t,n){Pt(t),Pt(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=Et(this.buffer)}update(t){Zt(this),Oe(t);const{blockLen:n,buffer:r,buffer32:s}=this,o=t.length,i=t.byteOffset,a=t.buffer;for(let u=0;u<o;){this.pos===n&&(de(s),this.compress(s,0,!1),de(s),this.pos=0);const c=Math.min(n-this.pos,o-u),l=i+u;if(c===n&&!(l%4)&&u+c<o){const v=new Uint32Array(a,l,Math.floor((o-u)/4));de(v);for(let f=0;u+n<o;f+=s.length,u+=n)this.length+=n,this.compress(v,f,!1);de(v);continue}r.set(t.subarray(u,u+c),this.pos),this.pos+=c,this.length+=c,u+=c}return this}digestInto(t){Zt(this),ur(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,at(this.buffer.subarray(n)),de(r),this.compress(r,0,!0),de(r);const s=Et(t);this.get().forEach((o,i)=>s[i]=et(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:o,outputLen:i,pos:a}=this;return t||=new this.constructor({dkLen:i}),t.set(...this.get()),t.buffer.set(n),t.destroyed=o,t.finished=s,t.length=r,t.pos=a,t.outputLen=i,t}clone(){return this._cloneInto()}}class Bc extends Ks{v0l=J[0]|0;v0h=J[1]|0;v1l=J[2]|0;v1h=J[3]|0;v2l=J[4]|0;v2h=J[5]|0;v3l=J[6]|0;v3h=J[7]|0;v4l=J[8]|0;v4h=J[9]|0;v5l=J[10]|0;v5h=J[11]|0;v6l=J[12]|0;v6h=J[13]|0;v7l=J[14]|0;v7h=J[15]|0;constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),Ic(n,t,64,16,16);let{key:r,personalization:s,salt:o}=t,i=0;if(r!==void 0&&(Oe(r,void 0,"key"),i=r.length),this.v0l^=this.outputLen|i<<8|65536|1<<24,o!==void 0){Oe(o,void 0,"salt");const a=Et(o);this.v4l^=et(a[0]),this.v4h^=et(a[1]),this.v5l^=et(a[2]),this.v5h^=et(a[3])}if(s!==void 0){Oe(s,void 0,"personalization");const a=Et(s);this.v6l^=et(a[0]),this.v6h^=et(a[1]),this.v7l^=et(a[2]),this.v7h^=et(a[3])}if(r!==void 0){const a=new Uint8Array(this.blockLen);a.set(r),this.update(a)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:o,v2h:i,v3l:a,v3h:u,v4l:c,v4h:l,v5l:v,v5h:f,v6l:d,v6h:p,v7l:h,v7h:m}=this;return[t,n,r,s,o,i,a,u,c,l,v,f,d,p,h,m]}set(t,n,r,s,o,i,a,u,c,l,v,f,d,p,h,m){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=o|0,this.v2h=i|0,this.v3l=a|0,this.v3h=u|0,this.v4l=c|0,this.v4h=l|0,this.v5l=v|0,this.v5h=f|0,this.v6l=d|0,this.v6h=p|0,this.v7l=h|0,this.v7h=m|0}compress(t,n,r){this.get().forEach((u,c)=>$[c]=u),$.set(J,16);let{h:s,l:o}=kn(BigInt(this.length));$[24]=J[8]^o,$[25]=J[9]^s,r&&($[28]=~$[28],$[29]=~$[29]);let i=0;const a=mc;for(let u=0;u<12;u++)lt(0,4,8,12,t,n+2*a[i++]),ft(0,4,8,12,t,n+2*a[i++]),lt(1,5,9,13,t,n+2*a[i++]),ft(1,5,9,13,t,n+2*a[i++]),lt(2,6,10,14,t,n+2*a[i++]),ft(2,6,10,14,t,n+2*a[i++]),lt(3,7,11,15,t,n+2*a[i++]),ft(3,7,11,15,t,n+2*a[i++]),lt(0,5,10,15,t,n+2*a[i++]),ft(0,5,10,15,t,n+2*a[i++]),lt(1,6,11,12,t,n+2*a[i++]),ft(1,6,11,12,t,n+2*a[i++]),lt(2,7,8,13,t,n+2*a[i++]),ft(2,7,8,13,t,n+2*a[i++]),lt(3,4,9,14,t,n+2*a[i++]),ft(3,4,9,14,t,n+2*a[i++]);this.v0l^=$[0]^$[16],this.v0h^=$[1]^$[17],this.v1l^=$[2]^$[18],this.v1h^=$[3]^$[19],this.v2l^=$[4]^$[20],this.v2h^=$[5]^$[21],this.v3l^=$[6]^$[22],this.v3h^=$[7]^$[23],this.v4l^=$[8]^$[24],this.v4h^=$[9]^$[25],this.v5l^=$[10]^$[26],this.v5h^=$[11]^$[27],this.v6l^=$[12]^$[28],this.v6h^=$[13]^$[29],this.v7l^=$[14]^$[30],this.v7h^=$[15]^$[31],at($)}destroy(){this.destroyed=!0,at(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const An=lr(e=>new Bc(e));function Ns(e,t,n,r,s,o,i,a,u,c,l,v,f,d,p,h,m,y,b,g){let w=0;for(let k=0;k<r;k++)({a:s,b:u,c:f,d:m}=ct(s,u,f,m,n[t+e[w++]])),{a:s,b:u,c:f,d:m}=ut(s,u,f,m,n[t+e[w++]]),{a:o,b:c,c:d,d:y}=ct(o,c,d,y,n[t+e[w++]]),{a:o,b:c,c:d,d:y}=ut(o,c,d,y,n[t+e[w++]]),{a:i,b:l,c:p,d:b}=ct(i,l,p,b,n[t+e[w++]]),{a:i,b:l,c:p,d:b}=ut(i,l,p,b,n[t+e[w++]]),{a,b:v,c:h,d:g}=ct(a,v,h,g,n[t+e[w++]]),{a,b:v,c:h,d:g}=ut(a,v,h,g,n[t+e[w++]]),{a:s,b:c,c:p,d:g}=ct(s,c,p,g,n[t+e[w++]]),{a:s,b:c,c:p,d:g}=ut(s,c,p,g,n[t+e[w++]]),{a:o,b:l,c:h,d:m}=ct(o,l,h,m,n[t+e[w++]]),{a:o,b:l,c:h,d:m}=ut(o,l,h,m,n[t+e[w++]]),{a:i,b:v,c:f,d:y}=ct(i,v,f,y,n[t+e[w++]]),{a:i,b:v,c:f,d:y}=ut(i,v,f,y,n[t+e[w++]]),{a,b:u,c:d,d:b}=ct(a,u,d,b,n[t+e[w++]]),{a,b:u,c:d,d:b}=ut(a,u,d,b,n[t+e[w++]]);return{v0:s,v1:o,v2:i,v3:a,v4:u,v5:c,v6:l,v7:v,v8:f,v9:d,v10:p,v11:h,v12:m,v13:y,v14:b,v15:g}}const Xs=new TextEncoder().encode("SS58PRE"),fr=2,hr=e=>{try{const t=Ls.decode(e),n=t.subarray(0,t[0]&64?2:1),r=t.subarray(n.length,t.length-fr),s=t.subarray(n.length+r.length),o=An(Uint8Array.of(...Xs,...n,...r),{dkLen:64}).subarray(0,fr);return s[0]===o[0]&&s[1]===o[1]?{isValid:!0,ss58Format:Cc(n),publicKey:r.slice()}:{isValid:!1}}catch{return{isValid:!1}}},Cc=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.byteLength===1?t.getUint8(0):t.getUint16(0)},Ys=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((e&252)>>2|64,e>>8|(e&3)<<6);return n=>{const r=An(Uint8Array.of(...Xs,...t,...n),{dkLen:64}).subarray(0,fr);return Ls.encode(Uint8Array.of(...t,...n,...r))}};function _c(e,t){return n=>{const r=hr(n);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:s}=r;if(s.length!==e)throw new Error("Invalid public key length");return s}}const kt=(e=42,t=32)=>Ke(Y(t),_c(t),Ys(e)),Gs="0123456789abcdef";function Z(e){const t=new Array(e.length+1);t[0]="0x";for(let n=0;n<e.length;){const r=e[n++];t[n]=Gs[r>>4]+Gs[r&15]}return t.join("")}const dr={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function ue(e){const t=e.length%2,n=(e[1]==="x"?2:0)+t,r=(e.length-n)/2+t,s=new Uint8Array(r);t&&(s[0]=0|dr[e[2]]);for(let o=0;o<r;){const i=n+o*2,a=dr[e[i]],u=dr[e[i+1]];s[t+o++]=a<<4|u}return s}function Ut(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,t(r,n)]))}const re=(...e)=>{const t=Array.isArray(e[0])?e[0]:e,n=t.reduce((s,o)=>s+o.byteLength,0),r=new Uint8Array(n);for(let s=0,o=0;s<t.length;s++){const i=t[s];r.set(i,o),o+=i.byteLength}return r},At=Function.prototype;class Qs extends Error{constructor(){super("Abort Error"),this.name="AbortError"}}var Oc=Object.defineProperty,Zs=e=>{throw TypeError(e)},Tc=(e,t,n)=>t in e?Oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jt=(e,t,n)=>Tc(e,typeof t!="symbol"?t+"":t,n),Js=(e,t,n)=>t.has(e)||Zs("Cannot "+n),tt=(e,t,n)=>(Js(e,t,"read from private field"),n?n.call(e):t.get(e)),en=(e,t,n)=>t.has(e)?Zs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),St=(e,t,n,r)=>(Js(e,t,"write to private field"),t.set(e,n),n),nt,tn,Sn,$n,In;const Rc=new TextEncoder,Pc=new TextDecoder,Uc=_e(he,Y(1/0))[1];class He{constructor(t,n=!1){if(en(this,nt),en(this,tn,null),en(this,Sn,null),en(this,$n,null),en(this,In,null),Jt(this,"asText",()=>tt(this,In)??St(this,In,Pc.decode(tt(this,nt)))),Jt(this,"asHex",()=>tt(this,Sn)||St(this,Sn,Z(tt(this,nt)))),Jt(this,"asOpaqueHex",()=>tt(this,$n)||St(this,$n,Z(this.asBytes()))),Jt(this,"asBytes",()=>tt(this,nt)),Jt(this,"asOpaqueBytes",()=>tt(this,tn)||St(this,tn,re([tt(this,nt),he[0](tt(this,nt).length)]))),n){try{const[r,s]=Uc(t);if(r===s.length){St(this,nt,s),St(this,tn,t);return}}catch{}throw new Error("Invalid opaque bytes")}else St(this,nt,t)}static fromText(t){return new this(Rc.encode(t))}static fromHex(t){return new this(ue(t))}static fromOpaqueHex(t){return new this(ue(t),!0)}static fromBytes(t){return new this(t)}static fromOpaqueBytes(t){return new this(t,!0)}}nt=new WeakMap,tn=new WeakMap,Sn=new WeakMap,$n=new WeakMap,In=new WeakMap;const[Mc]=kt();class Bn extends He{constructor(t){super(t)}static fromArray(t){return new this(new Uint8Array(t))}static fromAccountId32(t){return new this(Mc(t))}}const eo=e=>{const t=Y.enc(e);return n=>t(n.asBytes())},to=e=>{const t=Y.dec(e),n=e==null?He:Bn;return r=>n.fromBytes(t(r))},nn=e=>W(eo(e),to(e));nn.enc=eo,nn.dec=to;const C=Ke(he,e=>e,Number),Cn=Ke(he,e=>e,BigInt),Lc=Je(e=>{const t=C.dec(e),n=Math.ceil(t/8);return{bytes:Y(n).dec(e),bitsLen:t}}),Dc=W(e=>{if(e.bitsLen>e.bytes.length*8)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=C.enc(e.bitsLen),n=new Uint8Array(e.bytes.length+t.length);return n.set(t,0),n.set(e.bytes,t.length),n},Lc),Vc=Ke(D,e=>e.charCodeAt(0),String.fromCharCode),no=e=>{const t=Y.enc(e);return n=>t(ue(n))},ro=e=>{const t=Y.dec(e);return n=>Z(t(n))},pe=e=>W(no(e),ro(e));pe.enc=no,pe.dec=ro;const so=new TextEncoder,Hc=new TextDecoder,Fc=e=>Ke(Y(e),t=>so.encode(t),t=>Hc.decode(t)),oo=e=>{let t=n=>{const r=e();return t=r,r(n)};return n=>t(n)},io=e=>{let t=n=>{const r=e(),s=r;return t=r,s(n)};return n=>t(n)},pr=e=>W(oo(()=>e().enc),io(()=>e().dec)),$t=Object.assign((e,t)=>({type:e,value:t}),{is(e,t){return e.type===t},as(e,t){if(t!==e.type)throw new Error(`Enum.as(enum, ${t}) used with actual type ${e.type}`);return e}}),ao=new Proxy({},{get(e,t){return n=>$t(t,n)}}),G=(e,t)=>{const n=e;return n.inner=t,n},co=(...e)=>{const t=be.enc(...e);return G(n=>t({tag:n.type,value:n.value}),e[0])},uo=(...e)=>{const t=be.dec(...e);return G(n=>{const{tag:r,value:s}=t(n);return $t(r,s)},e[0])},we=(e,...t)=>G(W(co(Ut(e,([n])=>n),...t),uo(Ut(e,([,n])=>n),...t)),e);we.enc=co,we.dec=uo;const vr=(e,...t)=>G(be(e,...t),e);vr.enc=(e,...t)=>G(be.enc(e,...t),e),vr.dec=(e,...t)=>G(be.dec(e,...t),e);const Xe={CHUNK_START:1,CHUNK_END:2,PARENT:4,ROOT:8,KEYED_HASH:16,DERIVE_KEY_CONTEXT:32,DERIVE_KEY_MATERIAL:64},rt=yc.slice(),lo=(()=>{const e=Array.from({length:16},(r,s)=>s),t=r=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map(s=>r[s]),n=[];for(let r=0,s=e;r<7;r++,s=t(s))n.push(...s);return Uint8Array.from(n)})();class mr extends Ks{chunkPos=0;chunksDone=0;flags=0;IV;state;stack=[];posOut=0;bufferOut32=new Uint32Array(16);bufferOut;chunkOut=0;enableXOF=!0;constructor(t={},n=0){super(64,t.dkLen===void 0?32:t.dkLen);const{key:r,context:s}=t,o=s!==void 0;if(r!==void 0){if(o)throw new Error('Only "key" or "context" can be specified at same time');Oe(r,32,"key");const i=r.slice();this.IV=Et(i),de(this.IV),this.flags=n|Xe.KEYED_HASH}else if(o){Oe(s,void 0,"context");const i=s,a=new mr({dkLen:32},Xe.DERIVE_KEY_CONTEXT).update(i).digest();this.IV=Et(a),de(this.IV),this.flags=n|Xe.DERIVE_KEY_MATERIAL}else this.IV=rt.slice(),this.flags=n;this.state=this.IV.slice(),this.bufferOut=pc(this.bufferOut32)}get(){return[]}set(){}b2Compress(t,n,r,s=0){const{state:o,pos:i}=this,{h:a,l:u}=kn(BigInt(t),!0),{v0:c,v1:l,v2:v,v3:f,v4:d,v5:p,v6:h,v7:m,v8:y,v9:b,v10:g,v11:w,v12:k,v13:E,v14:S,v15:x}=Ns(lo,s,r,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],rt[0],rt[1],rt[2],rt[3],a,u,i,n);o[0]=c^y,o[1]=l^b,o[2]=v^g,o[3]=f^w,o[4]=d^k,o[5]=p^E,o[6]=h^S,o[7]=m^x}compress(t,n=0,r=!1){let s=this.flags;if(this.chunkPos||(s|=Xe.CHUNK_START),(this.chunkPos===15||r)&&(s|=Xe.CHUNK_END),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,s,t,n),this.chunkPos+=1,this.chunkPos===16||r){let o=this.state;this.state=this.IV.slice();for(let i,a=this.chunksDone+1;(r||!(a&1))&&(i=this.stack.pop());a>>=1)this.buffer32.set(i,0),this.buffer32.set(o,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|Xe.PARENT,this.buffer32,0),o=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(o)}this.pos=0}_cloneInto(t){t=super._cloneInto(t);const{IV:n,flags:r,state:s,chunkPos:o,posOut:i,chunkOut:a,stack:u,chunksDone:c}=this;return t.state.set(s.slice()),t.stack=u.map(l=>Uint32Array.from(l)),t.IV.set(n),t.flags=r,t.chunkPos=o,t.chunksDone=c,t.posOut=i,t.chunkOut=a,t.enableXOF=this.enableXOF,t.bufferOut32.set(this.bufferOut32),t}destroy(){this.destroyed=!0,at(this.state,this.buffer32,this.IV,this.bufferOut32),at(...this.stack)}b2CompressOut(){const{state:t,pos:n,flags:r,buffer32:s,bufferOut32:o}=this,{h:i,l:a}=kn(BigInt(this.chunkOut++));de(s);const{v0:u,v1:c,v2:l,v3:v,v4:f,v5:d,v6:p,v7:h,v8:m,v9:y,v10:b,v11:g,v12:w,v13:k,v14:E,v15:S}=Ns(lo,0,s,7,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],rt[0],rt[1],rt[2],rt[3],a,i,n,r);o[0]=u^m,o[1]=c^y,o[2]=l^b,o[3]=v^g,o[4]=f^w,o[5]=d^k,o[6]=p^E,o[7]=h^S,o[8]=t[0]^m,o[9]=t[1]^y,o[10]=t[2]^b,o[11]=t[3]^g,o[12]=t[4]^w,o[13]=t[5]^k,o[14]=t[6]^E,o[15]=t[7]^S,de(s),de(o),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,at(this.buffer.subarray(this.pos));let t=this.flags|Xe.ROOT;this.stack.length?(t|=Xe.PARENT,de(this.buffer32),this.compress(this.buffer32,0,!0),de(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):t|=(this.chunkPos?0:Xe.CHUNK_START)|Xe.CHUNK_END,this.flags=t,this.b2CompressOut()}writeInto(t){Zt(this,!1),Oe(t),this.finish();const{blockLen:n,bufferOut:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=n&&this.b2CompressOut();const i=Math.min(n-this.posOut,o-s);t.set(r.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(t)}xof(t){return Pt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ur(t,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const jc=lr((e={})=>new mr(e)),zc=BigInt(0),rn=BigInt(1),Wc=BigInt(2),qc=BigInt(7),Kc=BigInt(256),Nc=BigInt(113),fo=[],ho=[],po=[];for(let e=0,t=rn,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],fo.push(2*(5*r+n)),ho.push((e+1)*(e+2)/2%64);let s=zc;for(let o=0;o<7;o++)t=(t<<rn^(t>>qc)*Nc)%Kc,t&Wc&&(s^=rn<<(rn<<BigInt(o))-rn);po.push(s)}const vo=bc(po,!0),Xc=vo[0],Yc=vo[1],mo=(e,t,n)=>n>32?Sc(e,t,n):kc(e,t,n),yo=(e,t,n)=>n>32?$c(e,t,n):Ac(e,t,n);function Gc(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const a=(i+8)%10,u=(i+2)%10,c=n[u],l=n[u+1],v=mo(c,l,1)^n[a],f=yo(c,l,1)^n[a+1];for(let d=0;d<50;d+=10)e[i+d]^=v,e[i+d+1]^=f}let s=e[2],o=e[3];for(let i=0;i<24;i++){const a=ho[i],u=mo(s,o,a),c=yo(s,o,a),l=fo[i];s=e[l],o=e[l+1],e[l]=u,e[l+1]=c}for(let i=0;i<50;i+=10){for(let a=0;a<10;a++)n[a]=e[i+a];for(let a=0;a<10;a++)e[i+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=Xc[r],e[1]^=Yc[r]}at(n)}class yr{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(t,n,r,s=!1,o=24){if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=o,Pt(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Et(this.state)}clone(){return this._cloneInto()}keccak(){de(this.state32),Gc(this.state32,this.rounds),de(this.state32),this.posOut=0,this.pos=0}update(t){Zt(this),Oe(t);const{blockLen:n,state:r}=this,s=t.length;for(let o=0;o<s;){const i=Math.min(n-this.pos,s-o);for(let a=0;a<i;a++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Zt(this,!1),Oe(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,o=t.length;s<o;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,o-s);t.set(n.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Pt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ur(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,at(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:o,enableXOF:i}=this;return t||=new yr(n,r,s,i,o),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=s,t.enableXOF=i,t.destroyed=this.destroyed,t}}const br=((e,t,n,r={})=>lr(()=>new yr(t,e,n),r))(1,136,32),bo=e=>{const t=e.slice(2),n=Z(br(so.encode(t))).slice(2),r=new Array(40);for(let s=0;s<40;s++){const o=parseInt(n[s],16),i=t[s];r[s]=o>7?i.toUpperCase():i}return`0x${r.join("")}`},Qc=Y(20)[1],go=W(e=>{const t=ue(e);if(t.length!==20)throw new Error(`Invalid length found on EthAddress(${e})`);const n=Z(t);if(e===n||e===n.toUpperCase())return t;if(bo(n)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t},Je(e=>bo(Z(Qc(e))))),se=e=>G(R(e),e);se.enc=e=>G(R.enc(e),e),se.dec=e=>G(R.dec(e),e);const Fe=(...e)=>G(_e(...e),e);Fe.enc=(...e)=>G(_e.enc(...e),e),Fe.dec=(...e)=>G(_e.dec(...e),e);const Ee=(e,...t)=>G(L(e,...t),e);Ee.enc=(e,...t)=>G(L.enc(e,...t),e),Ee.dec=(e,...t)=>G(L.dec(e,...t),e);const _n=(e,t)=>G(Qt(e,t),{ok:e,ko:t});_n.enc=(e,t)=>G(Qt.enc(e,t),{ok:e,ko:t}),_n.dec=(e,t)=>G(Qt.dec(e,t),{ok:e,ko:t});const ht=e=>G(ge(e),e);ht.enc=e=>G(ge.enc(e),e),ht.dec=e=>G(ge.dec(e),e);const wo=(e=!0)=>Je(t=>{const n=C.dec(t),r=Math.ceil(n/8),s=Y(r).dec(t),o=new Array(n);let i=0;return s.forEach(a=>{for(let u=0;u<8&&i<n;u++){const c=e?u:7-u;o[i++]=a>>c&1}}),o}),xo=(e=!0)=>t=>{const n=C.enc(t.length),r=Math.ceil(t.length/8),s=new Uint8Array(r);for(let o=0;o<r;o++){let i=o*8,a=0;for(let u=0;u<8&&i<t.length;u++,i++)a|=t[i]<<(e?u:7-u);s[o]=a}return re([n,s])},On=e=>W(xo(e),wo(e));On.enc=xo,On.dec=wo;const Eo=new TextEncoder,ko=new TextDecoder,Zc=Ke(Y(4),Eo.encode.bind(Eo),ko.decode.bind(ko)),gr=se({engine:Zc,payload:pe()}),Jc=we({other:Y(),consensus:gr,seal:gr,preRuntime:gr,runtimeUpdated:O},[0,4,5,6,8]),wr=pe(32),Tn=se({parentHash:wr,number:C,stateRoot:wr,extrinsicRoot:wr,digests:Ee(Jc)}),ke=L(H),Ao=ge(H),eu=be({bool:O,char:O,str:O,u8:O,u16:O,u32:O,u64:O,u128:O,u256:O,i8:O,i16:O,i32:O,i64:O,i128:O,i256:O}),So=L(R({name:Ao,type:C,typeName:Ao,docs:ke})),tu=R({len:Ve,type:C}),nu=R({bitStoreType:C,bitOrderType:C}),ru=L(R({name:H,fields:So,index:D,docs:ke})),su=be({composite:So,variant:ru,sequence:C,array:tu,tuple:L(C),primitive:eu,compact:C,bitSequence:nu}),ou=R({name:H,type:ge(C)}),iu=L(ou),au=R({id:C,path:ke,params:iu,def:su,docs:ke}),Rn=L(au),Mt=be({NotDeprecated:O,DeprecatedWithoutNote:O,Deprecated:R({note:H,since:ge(H)})}),cu=L(R({index:D,deprecation:be({DeprecatedWithoutNote:O,Deprecated:R({note:H,since:ge(H)})},[1,2])})),xr={name:H,inputs:L(R({name:H,type:C})),output:C,docs:ke},uu=R({name:H,methods:L(R(xr)),docs:ke}),lu=R({name:H,methods:L(R({...xr,deprecationInfo:Mt})),docs:ke,version:C,deprecationInfo:Mt}),fu=R({id:pe(32),...xr,deprecationInfo:Mt}),hu=be({Blake2128:O,Blake2256:O,Blake2128Concat:O,Twox128:O,Twox256:O,Twox64Concat:O,Identity:O}),du=L(hu),pu=R({hashers:du,key:C,value:C}),$o={name:H,modifier:D,type:be({plain:C,map:pu}),fallback:pe(),docs:ke},Er=ge(C),Io={name:H,storage:ge(R({prefix:H,items:L(R($o))})),calls:Er,events:Er,constants:L(R({name:H,type:C,value:pe(),docs:ke})),errors:Er,index:D},vu={...Io,docs:ke},kr=ge(R({type:C,deprecationInfo:cu})),mu={name:H,storage:ge(R({prefix:H,items:L(R({...$o,deprecationInfo:Mt}))})),calls:kr,events:kr,constants:L(R({name:H,type:C,value:pe(),docs:ke,deprecationInfo:Mt})),errors:kr,associatedTypes:L(R({name:H,type:C,docs:ke})),viewFns:L(fu),index:D,docs:ke,deprecationInfo:Mt},yu=new Uint8Array,Bo=e=>W(()=>yu,()=>e),bu=R({type:C,version:D,signedExtensions:L(R({identifier:H,type:C,additionalSigned:C}))}),Co=R({lookup:Rn,pallets:L(R({...Io,docs:Bo([])})),extrinsic:bu,type:C,apis:Bo([])}),gu=R({version:D,address:C,call:C,signature:C,extra:C,signedExtensions:L(R({identifier:H,type:C,additionalSigned:C}))}),_o=R({lookup:Rn,pallets:L(R(vu)),extrinsic:gu,type:C,apis:L(uu),outerEnums:R({call:C,event:C,error:C}),custom:L(_e(H,R({type:C,value:pe()})))}),wu=R({version:L(D),address:C,call:C,signature:C,signedExtensionsByVersion:L(_e(D,L(C))),signedExtensions:L(R({identifier:H,type:C,additionalSigned:C}))}),Oo=R({lookup:Rn,pallets:L(R(mu)),extrinsic:wu,apis:L(lu),outerEnums:R({call:C,event:C,error:C}),custom:L(_e(H,R({type:C,value:pe()})))}),To=()=>{throw new Error("Unsupported metadata version!")},xe=W(To,To),dt=R({magicNumber:Ve,metadata:be({v0:xe,v1:xe,v2:xe,v3:xe,v4:xe,v5:xe,v6:xe,v7:xe,v8:xe,v9:xe,v10:xe,v11:xe,v12:xe,v13:xe,v14:Co,v15:_o,v16:Oo})}),Ar=Y(),xu=ge(Ar),Eu=_e(he,Ar),Sr=e=>{try{return dt.dec(e)}catch{}try{return dt.dec(xu.dec(e))}catch{}try{return dt.dec(Ar.dec(e))}catch{}try{return dt.dec(Eu.dec(e)[1])}catch{}throw null},Lt=e=>{if("magicNumber"in e&&(e=e.metadata),"tag"in e){if(e.tag!=="v14"&&e.tag!=="v15"&&e.tag!=="v16")throw new Error("Only metadata 14, 15, and 16 are supported");e=e.value}if("signedExtensionsByVersion"in e.extrinsic)return{version:16,...e};if("custom"in e){const{lookup:s,extrinsic:o,custom:i,apis:a,pallets:u,outerEnums:c}=e;return{version:15,lookup:s,pallets:u.map(l=>({...l,calls:l.calls!=null?{type:l.calls}:void 0,events:l.events!=null?{type:l.events}:void 0,errors:l.errors!=null?{type:l.errors}:void 0,viewFns:[],associatedTypes:[]})),extrinsic:{...o,version:[o.version]},apis:a,outerEnums:c,custom:i}}const{lookup:t,extrinsic:n,pallets:r}=e;return{version:14,lookup:t,pallets:r.map(s=>({...s,calls:s.calls!=null?{type:s.calls}:void 0,events:s.events!=null?{type:s.events}:void 0,errors:s.errors!=null?{type:s.errors}:void 0,viewFns:[],associatedTypes:[]})),extrinsic:{...n,version:[n.version]},apis:[]}},It={bare:0,0:"bare",general:1,1:"general",signed:2,2:"signed"},$r=Ke(D,({version:e,type:t})=>e+(It[t]<<6),e=>{const t=e&63,n=e>>6;if(t===4&&(n===It.bare||n===It.signed))return{version:t,type:It[n]};if(t===5&&(n===It.bare||n===It.general))return{version:t,type:It[n]};throw new Error(`ExtrinsicFormat ${e} not valid`)}),ku={dkLen:32},Dt=e=>An(e,ku),Au={dkLen:16},Ir=e=>An(e,Au),Ro=e=>re([Ir(e),e]),Su={dkLen:32},Po=e=>jc(e,Su),$u=e=>re([Po(e),e]),Uo=e=>e,Bt=(e,t,n,r)=>new DataView(new Uint16Array([e,t,n,r]).buffer).getBigUint64(0,!0),Br=2n**64n-1n,le=(e,t)=>e<<t&Br|e>>64n-t,V=(e,t)=>e*t&Br,ee=(e,t)=>e+t&Br,te=11400714785074694791n,Ae=14029467366897019727n,Mo=1609587929392839161n,sn=9650029242287828579n,Lo=2870177450012600261n;function pt(e,t=0n){let n=ee(ee(t,te),Ae),r=ee(t,Ae),s=t,o=t-te,i=e.length,a=0,u=null;(function(){let d=0,p=d+i;if(i){if(u=new Uint8Array(32),i<32){u.set(e.subarray(0,i),a),a+=i;return}if(d<=p-32){const h=p-32;do{let m;m=Bt(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],e[d+5]<<8|e[d+4],e[d+7]<<8|e[d+6]),n=V(le(ee(n,V(m,Ae)),31n),te),d+=8,m=Bt(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],e[d+5]<<8|e[d+4],e[d+7]<<8|e[d+6]),r=V(le(ee(r,V(m,Ae)),31n),te),d+=8,m=Bt(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],e[d+5]<<8|e[d+4],e[d+7]<<8|e[d+6]),s=V(le(ee(s,V(m,Ae)),31n),te),d+=8,m=Bt(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],e[d+5]<<8|e[d+4],e[d+7]<<8|e[d+6]),o=V(le(ee(o,V(m,Ae)),31n),te),d+=8}while(d<=h)}d<p&&(u.set(e.subarray(d,p),a),a=p-d)}})(),e=u||e;let c,l=0;for(i>=32?(c=le(n,1n),c=ee(c,le(r,7n)),c=ee(c,le(s,12n)),c=ee(c,le(o,18n)),n=V(le(V(n,Ae),31n),te),c=c^n,c=ee(V(c,te),sn),r=V(le(V(r,Ae),31n),te),c=c^r,c=ee(V(c,te),sn),s=V(le(V(s,Ae),31n),te),c=c^s,c=ee(V(c,te),sn),o=V(le(V(o,Ae),31n),te),c=c^o,c=ee(V(c,te),sn)):c=ee(t,Lo),c=ee(c,BigInt(i));l<=a-8;){let f=Bt(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],e[l+5]<<8|e[l+4],e[l+7]<<8|e[l+6]);f=V(le(V(f,Ae),31n),te),c=ee(V(le(c^f,27n),te),sn),l+=8}if(l+4<=a){let f=V(Bt(e[l+1]<<8|e[l],e[l+3]<<8|e[l+2],0,0),te);c=ee(V(le(c^f,23n),Ae),Mo),l+=4}for(;l<a;){const f=V(Bt(e[l++],0,0,0),Lo);c=V(le(c^f,11n),te)}let v=c>>33n;return c=V(c^v,Ae),v=c>>29n,c=V(c^v,Mo),v=c>>32n,c^=v,c}const Pn=e=>{const t=new Uint8Array(16),n=new DataView(t.buffer);return n.setBigUint64(0,pt(e),!0),n.setBigUint64(8,pt(e,1n),!0),t},Do=e=>{const t=new Uint8Array(32),n=new DataView(t.buffer);return n.setBigUint64(0,pt(e),!0),n.setBigUint64(8,pt(e,1n),!0),n.setBigUint64(16,pt(e,2n),!0),n.setBigUint64(24,pt(e,3n),!0),t},Vo=e=>re([Gt.enc(pt(e)),e]),Ho=new TextEncoder,Iu=new Map([[Uo,0],[Vo,8],[Ro,16],[Ir,-16],[Dt,-32],[Pn,-16],[Do,-32]]),Fo=e=>{const t=Pn(Ho.encode(e));return(n,...r)=>{const s=re([t,Pn(Ho.encode(n))]),o=Z(s),i=c=>{if(!c.startsWith(o))throw new Error(`key does not match this storage (${e}.${n})`);if(r.length===0)return[];const l=ue(c.slice(o.length)),v=new Array(r.length);for(let f=0,d=0;f<r.length;f++){const[p,h]=r[f],m=Iu.get(h);if(m==null)throw new Error("Unknown hasher");if(m<0){const y=m*-1;v[f]=Z(l.slice(d,d+y)),d+=y}else d+=m,v[f]=p.dec(l.slice(d)),d+=p.enc(v[f]).length}return v},a=r.map(([{enc:c},l])=>v=>l(c(v)));return{enc:(...c)=>Z(re([s,...c.map((l,v)=>a[v](l))])),dec:i}}},Bu=He.fromText("modlpy/utilisuba").asBytes(),Cu=({threshold:e,signatories:t})=>{const n=jo(t),r=re([Bu,he.enc(n.length),...n,Ne.enc(e)]);return Dt(r)},jo=e=>e.slice().sort((t,n)=>{for(let r=0;;r++){const s=r>=t.length,o=r>=n.length;if(s&&o)return 0;if(s)return-1;if(o)return 1;if(t[r]!==n[r])return t[r]>n[r]?1:-1}}),vt={Leaf:"Leaf",Branch:"Branch",BranchWithVal:"BranchWithVal",LeafWithHash:"LeafWithHash",BranchWithHash:"BranchWithHash",Empty:"Empty",Reserved:"Reserved"},zo=pe().dec,_u=pe(1/0).dec,Ou=pe(32).dec,Wo=D.dec,Tu=e=>{const t=Wo(e);let n=6;const r=t>>n,s=r?r===1?vt.Leaf:r===2?vt.Branch:vt.BranchWithVal:t>>--n?vt.LeafWithHash:t>>--n?vt.BranchWithHash:t?vt.Reserved:vt.Empty;let o=t&255>>8-n;if(o===2**n-1){let i;do o+=i=Wo(e);while(i===255)}return{type:s,partialKey:pe(Math.ceil(o/2)).dec(e).slice(o%2?3:2)}},qo=Je(e=>{const t=Tu(e),{type:n}=t;if(n==="Empty"||n==="Reserved")return t;if(n==="Leaf"||n==="LeafWithHash")return{...t,value:_u(e)};const r=Ne.dec(e),s=[];for(let a=0;a<16;a++)r>>a&1&&s.push(a.toString(16));let o=null;n==="BranchWithVal"&&(o=zo(e)),n==="BranchWithHash"&&(o=Ou(e));const i={...t,children:Object.fromEntries(s.map(a=>[a,zo(e)]))};return o!==null&&(i.value=o),i}),Ko=e=>Je(t=>{const n=Z(e(new Uint8Array(t.buffer)));try{return{hash:n,...qo(t)}}catch{return{type:"Raw",hash:n,value:""}}});var No=Object.freeze({__proto__:null,AccountId:kt,Bin:nn,Binary:He,BitSeq:On,Blake2128:Ir,Blake2128Concat:Ro,Blake2256:Dt,Blake3256:Po,Blake3256Concat:$u,Bytes:Y,Enum:$t,FixedSizeBinary:Bn,Hex:pe,Identity:Uo,Keccak256:br,Option:ht,Result:_n,ScaleEnum:vr,Self:pr,Storage:Fo,Struct:se,TrieNodeHeaders:vt,TrieNodeWithHash:Ko,Tuple:Fe,Twox128:Pn,Twox256:Do,Twox64Concat:Vo,Variant:we,Vector:Ee,_Enum:ao,_void:O,bitSequence:Dc,blockHeader:Tn,bool:Wa,char:Vc,compact:he,compactBn:Cn,compactNumber:C,createCodec:W,createDecoder:Je,decAnyMetadata:Sr,enhanceCodec:Ke,enhanceDecoder:wn,enhanceEncoder:gn,ethAccount:go,extrinsicFormat:$r,fixedStr:Fc,fromBufferToBase58:Ys,getMultisigAccountId:Cu,getSs58AddressInfo:hr,h64:pt,i128:Fa,i16:Da,i256:za,i32:Va,i64:Ha,i8:La,metadata:dt,selfDecoder:io,selfEncoder:oo,sortMultisigSignatories:jo,str:H,trieNodeDec:qo,u128:ms,u16:Ne,u256:ja,u32:Ve,u64:Gt,u8:D,unifyMetadata:Lt,v14:Co,v14Lookup:Rn,v15:_o,v16:Oo,validateProofs:(e,t=Dt)=>{const n=e.map(Ko(t)),r=Object.fromEntries(n.map(a=>[a.hash,a])),s=n.map(a=>a.hash),o=new Set(s),i=a=>{if(a.value)return;const u=e[s.indexOf(a.hash)];a.value=typeof u=="string"?u:Z(u)};return n.forEach(a=>{if("children"in a&&Object.values(a.children).forEach(u=>{const c=r[u];c&&(c.parent=a.hash,o.delete(u))}),a.type==="BranchWithHash"||a.type==="LeafWithHash"){const u=a.value,c=r[u];if(!c)return;o.delete(u),c.type!=="Raw"&&(Object.keys(c).forEach(l=>delete c[l]),c.type="Raw",c.hash=u),c.parent=a.hash,i(c)}a.type==="Raw"&&i(a)}),o.size===1?{rootHash:o.values().next().value,proofs:r}:null}});const st=C,Ru=Ee(Fe(H,st)),F={bool:"boolean",str:"string",num:"number",big:"bigint",bits:"bitseq",void:"void"},Pu=we(Object.fromEntries(Object.values(F).map(e=>[e,O]))),Uu=Ee(Fe(H,we({inline:pr(()=>Cr),lookup:st}))),Mu=Ee(st),Lu=se({typeRef:st,length:ht(st)}),Du=ht(st),Vu=st,Hu=se({ok:st,ko:st}),Cr=we({struct:Ru,terminal:Pu,enum:Uu,tuple:Mu,array:Lu,binary:Du,option:Vu,result:Hu}),Fu={i256:F.big,i128:F.big,i64:F.big,i32:F.num,i16:F.num,i8:F.num,u256:F.big,u128:F.big,u64:F.big,u32:F.num,u16:F.num,u8:F.num,bool:F.bool,char:F.str,str:F.str},on=e=>({type:"terminal",value:{type:e}});function Un(e,t=()=>{}){switch(e.type){case"AccountId20":case"AccountId32":return on(F.str);case"array":return e.value.type==="primitive"&&e.value.value==="u8"?{type:"binary",value:e.len}:(t(e.value.id),{type:"array",value:{typeRef:e.value.id,length:e.len}});case"bitSequence":return on(F.bits);case"compact":return on(e.isBig?F.big:F.num);case"enum":return{type:"enum",value:Object.entries(e.value).map(([n,r])=>r.type!=="lookupEntry"?[n,{type:"inline",value:Un(r,t)}]:(t(r.value.id),[n,{type:"lookup",value:r.value.id}]))};case"struct":{const n=Object.entries(e.value).map(([r,s])=>[r,s.id]);return n.forEach(([,r])=>t(r)),{type:"struct",value:n}}case"tuple":{const n=e.value.map(r=>r.id);return n.forEach(t),{type:"tuple",value:n}}case"option":return t(e.value.id),{type:"option",value:e.value.id};case"primitive":return on(Fu[e.value]);case"result":return t(e.value.ok.id),t(e.value.ko.id),{type:"result",value:{ok:e.value.ok.id,ko:e.value.ko.id}};case"sequence":return e.value.type==="primitive"&&e.value.value==="u8"?{type:"binary",value:void 0}:(t(e.value.id),{type:"array",value:{typeRef:e.value.id}});case"void":return on(F.void)}}function _r(e,t,n){if(t.type==="option"&&e==null)return!0;const r=(o,i)=>_r(o,i,n),s=o=>{switch(o.value.type){case F.str:case F.big:case F.bool:case F.num:return typeof e===o.value.type;case F.bits:return typeof e=="object"&&e!=null&&typeof e.bitsLen=="number"&&e.bytes instanceof Uint8Array;case F.void:return!0}};switch(t.type){case"terminal":return s(t);case"binary":return e instanceof He&&(t.value==null||e.asBytes().length>=t.value);case"array":if(!Array.isArray(e))return!1;const o=e;return t.value.length!=null&&o.length<t.value.length?!1:o.slice(0,t.value.length).every(c=>r(c,n(t.value.typeRef)));case"enum":if(!e)return!1;const i=e,a=Object.fromEntries(t.value);if(!(i.type in a))return!1;const u=a[i.type];return u==null?!0:r(i.value,u.type==="inline"?u.value:n(u.value));case"option":return e==null?!0:r(e,n(t.value));case"struct":return e?t.value.every(([c,l])=>r(e[c],n(l))):!1;case"tuple":return e?t.value.every((c,l)=>r(e[l],n(c))):!1;case"result":return"success"in e&&"value"in e?r(e.value,n(e.success?t.value.ok:t.value.ko)):!1}}var ju=Object.defineProperty,zu=(e,t,n)=>t in e?ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wu=(e,t,n)=>zu(e,t+"",n);class Xo{constructor(t=[]){Wu(this,"value",new Map),t.forEach(([n,r])=>this.add(n,r))}has(t,n){return this.value.get(t)?.has(n)??!1}add(t,n){this.value.has(t)||this.value.set(t,new Set),this.value.get(t).add(n)}addAll(t){t.forEach(([n,r])=>this.add(n,r))}delete(t,n){if(!this.value.has(t))return;const r=this.value.get(t);r.delete(n),r.size||this.value.delete(t)}isEmpty(){return!this.value.size}get values(){return Array.from(this.value).flatMap(([t,n])=>Array.from(n).map(r=>[t,r]))}}var Te=(e=>(e[e.Incompatible=0]="Incompatible",e[e.Partial=1]="Partial",e[e.BackwardsCompatible=2]="BackwardsCompatible",e[e.Identical=3]="Identical",e))(Te||{});function Or(e,t,n,r,s,o=!1){if(!n&&!e)return je(3,[]);if(!n)return je(2,[]);if(!e)return je(n.type==="option"?2:0,[]);s.has(n)||s.set(n,new Map);const i=s.get(n);if(i.has(e)){const u=i.get(e);return u==null?{level:3,changes:[],assumptions:new Xo([[e,n]])}:je(u.level,u.changes)}i.set(e,null);const a=qu(e,n,(u,c)=>Or(typeof u=="number"?t(u):u,t,typeof c=="number"?r(c):c,r,s),o);return a.assumptions.delete(e,n),a.assumptions.isEmpty()||a.level===0?i.set(e,a):i.delete(e),a}function qu(e,t,n,r){const s=(o,i,a)=>{const u=n(o,i);return{...u,changes:u.level<3?[{id:[typeof o=="number"?o:null,typeof i=="number"?i:null],level:u.level,path:a}]:[]}};if(e.type!==t.type)return t.type==="option"?Mn(s(e,t.value,"some"),2):e.type==="option"?Mn(s(e.value,t,"some"),1):je(0,[]);switch(t.type){case"terminal":return je(t.value.type===e.value.type?3:0,[]);case"binary":return Rr(Qo(e.value,t.value));case"array":const i=e,a=Rr(Qo(i.value.length,t.value.length));return Tr([a,()=>s(i.value.typeRef,t.value.typeRef,"value")],r);case"enum":{const f=e,d=Object.fromEntries(t.value.map(([m,y])=>[m,y.value]));let p=Go(f.value.map(([m,y])=>()=>m in d?s(y.value,d[m],m):je(0,[{id:[typeof y.value=="number"?y.value:null,null],level:0,path:m}])));if(f.value.length===t.value.length)return p;p=Mn(p,2);const h=new Set(f.value.map(([m])=>m));return p.changes=[...p.changes,...t.value.filter(([m])=>!h.has(m)).map(([m,y])=>({id:[null,typeof y=="number"?y:null],level:0,path:m}))],p}case"option":return Ku(s(e.value,t.value,"some"),1);case"struct":const u=e,c=Object.fromEntries(u.value),l=u.value.length===t.value.length?3:2;return Mn(Tr(t.value.map(([f,d])=>()=>s(c[f],d,f)),r),l);case"tuple":{const f=e,d=Rr(Nu(f.value,t.value));return Tr([d,...t.value.map((p,h)=>()=>s(f.value[h],p,String(h)))],r)}case"result":const v=e;return Go([s(v.value.ok,t.value.ok,"ok"),s(v.value.ko,t.value.ko,"ko")])}}const Mn=(e,t)=>({...e,level:Math.min(e.level,t)}),Ku=(e,t)=>({...e,level:Math.max(e.level,t)}),Yo=new Xo,je=(e,t)=>({level:e,changes:t,assumptions:Yo}),Tr=(e,t)=>{let n=je(3,[]);for(const r of e){const s=typeof r=="function"?r():r;if(!t&&s.level===0)return s;s.level!==3&&(n.changes=[...n.changes,...s.changes]),n.assumptions.addAll(s.assumptions.values),n.level=Math.min(n.level,s.level)}return n},Go=e=>{if(!e.length)return je(3,[]);let t=!1,n=je(3,[]);for(const r of e){const s=typeof r=="function"?r():r;if(s.level!==3&&(n.changes=[...n.changes,...s.changes]),s.level===0){n.level=Math.min(n.level,1);continue}t=!0,n.assumptions.addAll(s.assumptions.values),n.level=Math.min(n.level,s.level)}return t?n:je(0,n.changes)},Rr=e=>({assumptions:Yo,changes:e===3?[]:[{id:[null,null],level:e,path:"length"}],level:e}),Nu=(e,t)=>t.length===e.length?3:e.length>=t.length?2:0,Qo=(e,t)=>t===e?3:t==null||e>=t?2:e==null?1:0,Zo=we({lookup:C,typedef:Cr}),Vt=e=>({type:"lookup",value:e}),Pr=e=>({type:"typedef",value:e}),Ln=Pr({type:"terminal",value:{type:F.void}}),Xu=se({args:Zo,values:Zo});function Yu(e){if(e.type.tag==="plain")return{args:Ln,values:Vt(e.type.value)};const{key:t,value:n}=e.type.value;return{args:Vt(t),values:Vt(n)}}function Jo(e){return{args:Pr({type:"tuple",value:e.inputs.map(t=>t.type)}),values:Vt(e.output)}}function Gu(e){return e.type==="lookupEntry"?Vt(e.value.id):Pr(Un(e))}function Qu(e){return{args:Ln,values:Vt(e)}}function Zu(e,t,n,r,s,o){const i=(a,u)=>a.type==="lookup"?u(a.value):a.value;return{args:Or(i(e.args,t),t,i(n.args,r),r,s,o),values:Or(i(n.values,r),r,i(e.values,t),t,s,o)}}function ei(e,t,n){const r=e.type==="lookup"?t(e.value):e.value;return _r(n,r,t)}var Ur=function(e,t){return Ur=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},Ur(e,t)};function Ye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ur(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Ju(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(l){try{c(r.next(l))}catch(v){i(v)}}function u(l){try{c(r.throw(l))}catch(v){i(v)}}function c(l){l.done?o(l.value):s(l.value).then(a,u)}c((r=r.apply(e,t||[])).next())})}function ti(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(c){return function(l){return u([c,l])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(n=0)),n;)try{if(r=1,s&&(o=c[0]&2?s.return:c[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,c[1])).done)return o;switch(s=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,s=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],s=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Ht(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Re(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,o=[],i;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return o}function Pe(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function Ft(e){return this instanceof Ft?(this.v=e,this):new Ft(e)}function el(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),s[Symbol.asyncIterator]=function(){return this},s;function i(d){return function(p){return Promise.resolve(p).then(d,v)}}function a(d,p){r[d]&&(s[d]=function(h){return new Promise(function(m,y){o.push([d,h,m,y])>1||u(d,h)})},p&&(s[d]=p(s[d])))}function u(d,p){try{c(r[d](p))}catch(h){f(o[0][3],h)}}function c(d){d.value instanceof Ft?Promise.resolve(d.value.v).then(l,v):f(o[0][2],d)}function l(d){u("next",d)}function v(d){u("throw",d)}function f(d,p){d(p),o.shift(),o.length&&u(o[0][0],o[0][1])}}function tl(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Ht=="function"?Ht(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(i){return new Promise(function(a,u){i=e[o](i),s(a,u,i.done,i.value)})}}function s(o,i,a,u){Promise.resolve(u).then(function(c){o({value:c,done:a})},i)}}typeof SuppressedError=="function"&&SuppressedError;function N(e){return typeof e=="function"}function Mr(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Lr=Mr(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
2
2
|
`+n.map(function(r,s){return s+1+") "+r.toString()}).join(`
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function Dn(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ct=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,s,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=Ht(i),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this)}}catch(h){t={error:h}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else i.remove(this);var l=this.initialTeardown;if(N(l))try{l()}catch(h){o=h instanceof Lr?h.errors:[h]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var f=Ht(v),d=f.next();!d.done;d=f.next()){var p=d.value;try{si(p)}catch(h){o=o??[],h instanceof Lr?o=Pe(Pe([],Re(o)),Re(h.errors)):o.push(h)}}}catch(h){r={error:h}}finally{try{d&&!d.done&&(s=f.return)&&s.call(f)}finally{if(r)throw r.error}}}if(o)throw new Lr(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)si(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Dn(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Dn(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),ni=Ct.EMPTY;function ri(e){return e instanceof Ct||e&&"closed"in e&&N(e.remove)&&N(e.add)&&N(e.unsubscribe)}function si(e){N(e)?e():e.unsubscribe()}var nl={Promise:void 0},rl={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Pe([e,t],Re(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function oi(e){rl.setTimeout(function(){throw e})}function Se(){}function Vn(e){e()}var an=(function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ri(n)&&n.add(r)):r.destination=il,r}return t.create=function(n,r,s){return new jt(n,r,s)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(Ct),sl=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){Hn(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){Hn(r)}else Hn(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){Hn(n)}},e})(),jt=(function(e){Ye(t,e);function t(n,r,s){var o=e.call(this)||this,i;return N(n)||!n?i={next:n??void 0,error:r??void 0,complete:s??void 0}:i=n,o.destination=new sl(i),o}return t})(an);function Hn(e){oi(e)}function ol(e){throw e}var il={closed:!0,next:Se,error:ol,complete:Se},Dr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ge(e){return e}function ii(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ai(e)}function ai(e){return e.length===0?Ge:e.length===1?e[0]:function(n){return e.reduce(function(r,s){return s(r)},n)}}var U=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var s=this,o=cl(t)?t:new jt(t,n,r);return Vn(function(){var i=s,a=i.operator,u=i.source;o.add(a?a.call(o,u):u?s._subscribe(o):s._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=ci(n),new n(function(s,o){var i=new jt({next:function(a){try{t(a)}catch(u){o(u),i.unsubscribe()}},error:o,complete:s});r.subscribe(i)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[Dr]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return ai(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=ci(t),new t(function(r,s){var o;n.subscribe(function(i){return o=i},function(i){return s(i)},function(){return r(o)})})},e.create=function(t){return new e(t)},e})();function ci(e){var t;return(t=e??nl.Promise)!==null&&t!==void 0?t:Promise}function al(e){return e&&N(e.next)&&N(e.error)&&N(e.complete)}function cl(e){return e&&e instanceof an||al(e)&&ri(e)}function ul(e){return N(e?.lift)}function Q(e){return function(t){if(ul(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function K(e,t,n,r,s){return new ll(e,t,n,r,s)}var ll=(function(e){Ye(t,e);function t(n,r,s,o,i,a){var u=e.call(this,n)||this;return u.onFinalize=i,u.shouldUnsubscribe=a,u._next=r?function(c){try{r(c)}catch(l){n.error(l)}}:e.prototype._next,u._error=o?function(c){try{o(c)}catch(l){n.error(l)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=s?function(){try{s()}catch(c){n.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t})(an),fl=Mr(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ze=(function(e){Ye(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new ui(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new fl},t.prototype.next=function(n){var r=this;Vn(function(){var s,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=Ht(r.currentObservers),a=i.next();!a.done;a=i.next()){var u=a.value;u.next(n)}}catch(c){s={error:c}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(s)throw s.error}}}})},t.prototype.error=function(n){var r=this;Vn(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var s=r.observers;s.length;)s.shift().error(n)}})},t.prototype.complete=function(){var n=this;Vn(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,s=this,o=s.hasError,i=s.isStopped,a=s.observers;return o||i?ni:(this.currentObservers=null,a.push(n),new Ct(function(){r.currentObservers=null,Dn(a,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,s=r.hasError,o=r.thrownError,i=r.isStopped;s?n.error(o):i&&n.complete()},t.prototype.asObservable=function(){var n=new U;return n.source=this,n},t.create=function(n,r){return new ui(n,r)},t})(U),ui=(function(e){Ye(t,e);function t(n,r){var s=e.call(this)||this;return s.destination=n,s.source=r,s}return t.prototype.next=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,n)},t.prototype.error=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&s!==void 0?s:ni},t})(ze),hl=(function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return r._value=n,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(n){var r=e.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},t.prototype.getValue=function(){var n=this,r=n.hasError,s=n.thrownError,o=n._value;if(r)throw s;return this._throwIfClosed(),o},t.prototype.next=function(n){e.prototype.next.call(this,this._value=n)},t})(ze),Vr={now:function(){return(Vr.delegate||Date).now()},delegate:void 0},cn=(function(e){Ye(t,e);function t(n,r,s){n===void 0&&(n=1/0),r===void 0&&(r=1/0),s===void 0&&(s=Vr);var o=e.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=s,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return t.prototype.next=function(n){var r=this,s=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,a=r._timestampProvider,u=r._windowTime;s||(o.push(n),!i&&o.push(a.now()+u)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),s=this,o=s._infiniteTimeWindow,i=s._buffer,a=i.slice(),u=0;u<a.length&&!n.closed;u+=o?1:2)n.next(a[u]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,s=n._timestampProvider,o=n._buffer,i=n._infiniteTimeWindow,a=(i?1:2)*r;if(r<1/0&&a<o.length&&o.splice(0,o.length-a),!i){for(var u=s.now(),c=0,l=1;l<o.length&&o[l]<=u;l+=2)c=l;c&&o.splice(0,c+1)}},t})(ze),dl=(function(e){Ye(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t})(Ct),li={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,Pe([e,t],Re(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},pl=(function(e){Ye(t,e);function t(n,r){var s=e.call(this,n,r)||this;return s.scheduler=n,s.work=r,s.pending=!1,s}return t.prototype.schedule=function(n,r){var s;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var o=this.id,i=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(i,o,r)),this.pending=!0,this.delay=r,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(i,this.id,r),this},t.prototype.requestAsyncId=function(n,r,s){return s===void 0&&(s=0),li.setInterval(n.flush.bind(n,this),s)},t.prototype.recycleAsyncId=function(n,r,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return r;r!=null&&li.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(n,r);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var s=!1,o;try{this.work(n)}catch(i){s=!0,o=i||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),o},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,s=n.scheduler,o=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Dn(o,this),r!=null&&(this.id=this.recycleAsyncId(s,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t})(dl),fi=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=Vr.now,e})(),vl=(function(e){Ye(t,e);function t(n,r){r===void 0&&(r=fi.now);var s=e.call(this,n,r)||this;return s.actions=[],s._active=!1,s}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var s;this._active=!0;do if(s=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,s){for(;n=r.shift();)n.unsubscribe();throw s}},t})(fi),hi=new vl(pl),ml=hi,mt=new U(function(e){return e.complete()});function di(e){return e&&N(e.schedule)}function Hr(e){return e[e.length-1]}function Fr(e){return N(Hr(e))?e.pop():void 0}function un(e){return di(Hr(e))?e.pop():void 0}function yl(e,t){return typeof Hr(e)=="number"?e.pop():t}var pi=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function vi(e){return N(e?.then)}function mi(e){return N(e[Dr])}function yi(e){return Symbol.asyncIterator&&N(e?.[Symbol.asyncIterator])}function bi(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function bl(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var gi=bl();function wi(e){return N(e?.[gi])}function xi(e){return el(this,arguments,function(){var n,r,s,o;return ti(this,function(i){switch(i.label){case 0:n=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Ft(n.read())];case 3:return r=i.sent(),s=r.value,o=r.done,o?[4,Ft(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Ft(s)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Ei(e){return N(e?.getReader)}function ne(e){if(e instanceof U)return e;if(e!=null){if(mi(e))return gl(e);if(pi(e))return wl(e);if(vi(e))return xl(e);if(yi(e))return ki(e);if(wi(e))return El(e);if(Ei(e))return kl(e)}throw bi(e)}function gl(e){return new U(function(t){var n=e[Dr]();if(N(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function wl(e){return new U(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function xl(e){return new U(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,oi)})}function El(e){return new U(function(t){var n,r;try{for(var s=Ht(e),o=s.next();!o.done;o=s.next()){var i=o.value;if(t.next(i),t.closed)return}}catch(a){n={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}t.complete()})}function ki(e){return new U(function(t){Al(e,t).catch(function(n){return t.error(n)})})}function kl(e){return ki(xi(e))}function Al(e,t){var n,r,s,o;return Ju(this,void 0,void 0,function(){var i,a;return ti(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=tl(e),u.label=1;case 1:return[4,n.next()];case 2:if(r=u.sent(),!!r.done)return[3,4];if(i=r.value,t.next(i),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),s={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function yt(e,t,n,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){n(),s?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!s)return o}function Ai(e,t){return t===void 0&&(t=0),Q(function(n,r){n.subscribe(K(r,function(s){return yt(r,e,function(){return r.next(s)},t)},function(){return yt(r,e,function(){return r.complete()},t)},function(s){return yt(r,e,function(){return r.error(s)},t)}))})}function Si(e,t){return t===void 0&&(t=0),Q(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function Sl(e,t){return ne(e).pipe(Si(t),Ai(t))}function $l(e,t){return ne(e).pipe(Si(t),Ai(t))}function Il(e,t){return new U(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function Bl(e,t){return new U(function(n){var r;return yt(n,t,function(){r=e[gi](),yt(n,t,function(){var s,o,i;try{s=r.next(),o=s.value,i=s.done}catch(a){n.error(a);return}i?n.complete():n.next(o)},0,!0)}),function(){return N(r?.return)&&r.return()}})}function $i(e,t){if(!e)throw new Error("Iterable cannot be null");return new U(function(n){yt(n,t,function(){var r=e[Symbol.asyncIterator]();yt(n,t,function(){r.next().then(function(s){s.done?n.complete():n.next(s.value)})},0,!0)})})}function Cl(e,t){return $i(xi(e),t)}function _l(e,t){if(e!=null){if(mi(e))return Sl(e,t);if(pi(e))return Il(e,t);if(vi(e))return $l(e,t);if(yi(e))return $i(e,t);if(wi(e))return Bl(e,t);if(Ei(e))return Cl(e,t)}throw bi(e)}function bt(e,t){return t?_l(e,t):ne(e)}function oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e);return bt(e,n)}function Fn(e,t){var n=N(e)?e:function(){return e},r=function(s){return s.error(n())};return new U(r)}var Ii=Mr(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Ol(e,t){return new Promise(function(n,r){var s=!1,o;e.subscribe({next:function(i){o=i,s=!0},error:r,complete:function(){s?n(o):r(new Ii)}})})}function We(e,t){return new Promise(function(n,r){var s=new jt({next:function(o){n(o),s.unsubscribe()},error:r,complete:function(){r(new Ii)}});e.subscribe(s)})}function Tl(e){return e instanceof Date&&!isNaN(e)}function I(e,t){return Q(function(n,r){var s=0;n.subscribe(K(r,function(o){r.next(e.call(t,o,s++))}))})}var Rl=Array.isArray;function Pl(e,t){return Rl(t)?e.apply(void 0,Pe([],Re(t))):e(t)}function Bi(e){return I(function(t){return Pl(e,t)})}var Ul=Array.isArray,Ml=Object.getPrototypeOf,Ll=Object.prototype,Dl=Object.keys;function Vl(e){if(e.length===1){var t=e[0];if(Ul(t))return{args:t,keys:null};if(Hl(t)){var n=Dl(t);return{args:n.map(function(r){return t[r]}),keys:n}}}return{args:e,keys:null}}function Hl(e){return e&&typeof e=="object"&&Ml(e)===Ll}function Fl(e,t){return e.reduce(function(n,r,s){return n[r]=t[s],n},{})}function zt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e),r=Fr(e),s=Vl(e),o=s.args,i=s.keys;if(o.length===0)return bt([],n);var a=new U(Ci(o,n,i?function(u){return Fl(i,u)}:Ge));return r?a.pipe(Bi(r)):a}function Ci(e,t,n){return n===void 0&&(n=Ge),function(r){_i(t,function(){for(var s=e.length,o=new Array(s),i=s,a=s,u=function(l){_i(t,function(){var v=bt(e[l],t),f=!1;v.subscribe(K(r,function(d){o[l]=d,f||(f=!0,a--),a||r.next(n(o.slice()))},function(){--i||r.complete()}))},r)},c=0;c<s;c++)u(c)},r)}}function _i(e,t,n){e?yt(n,e,t):t()}function jl(e,t,n,r,s,o,i,a){var u=[],c=0,l=0,v=!1,f=function(){v&&!u.length&&!c&&t.complete()},d=function(h){return c<r?p(h):u.push(h)},p=function(h){c++;var m=!1;ne(n(h,l++)).subscribe(K(t,function(y){t.next(y)},function(){m=!0},void 0,function(){if(m)try{c--;for(var y=function(){var b=u.shift();i||p(b)};u.length&&c<r;)y();f()}catch(b){t.error(b)}}))};return e.subscribe(K(t,d,function(){v=!0,f()})),function(){}}function M(e,t,n){return n===void 0&&(n=1/0),N(t)?M(function(r,s){return I(function(o,i){return t(r,o,s,i)})(ne(e(r,s)))},n):(typeof t=="number"&&(n=t),Q(function(r,s){return jl(r,s,e,n)}))}function jn(e){return e===void 0&&(e=1/0),M(Ge,e)}function zl(){return jn(1)}function zn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return zl()(bt(e,un(e)))}function Wn(e){return new U(function(t){ne(e()).subscribe(t)})}function qn(e,t,n){e===void 0&&(e=0),n===void 0&&(n=ml);var r=-1;return t!=null&&(di(t)?n=t:r=t),new U(function(s){var o=Tl(e)?+e-n.now():e;o<0&&(o=0);var i=0;return n.schedule(function(){s.closed||(s.next(i++),0<=r?this.schedule(void 0,r):s.complete())},o)})}function ln(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e),r=yl(e,1/0),s=e;return s.length?s.length===1?ne(s[0]):jn(r)(bt(s,n)):mt}var Wl=Array.isArray;function Oi(e){return e.length===1&&Wl(e[0])?e[0]:e}function Ue(e,t){return Q(function(n,r){var s=0;n.subscribe(K(r,function(o){return e.call(t,o,s++)&&r.next(o)}))})}function ql(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e=Oi(e),e.length===1?ne(e[0]):new U(Kl(e))}function Kl(e){return function(t){for(var n=[],r=function(o){n.push(ne(e[o]).subscribe(K(t,function(i){if(n){for(var a=0;a<n.length;a++)a!==o&&n[a].unsubscribe();n=null}t.next(i)})))},s=0;n&&!t.closed&&s<e.length;s++)r(s)}}function $e(e){return Q(function(t,n){var r=null,s=!1,o;r=t.subscribe(K(n,void 0,void 0,function(i){o=ne(e(i,$e(e)(t))),r?(r.unsubscribe(),r=null,o.subscribe(n)):s=!0})),s&&(r.unsubscribe(),r=null,o.subscribe(n))})}function Nl(e,t,n,r,s){return function(o,i){var a=n,u=t,c=0;o.subscribe(K(i,function(l){var v=c++;u=a?e(u,l,v):(a=!0,l),i.next(u)},s))}}function Ti(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fr(e);return n?ii(Ti.apply(void 0,Pe([],Re(e))),Bi(n)):Q(function(r,s){Ci(Pe([r],Re(Oi(e))))(s)})}function Xl(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ti.apply(void 0,Pe([],Re(e)))}function Yl(e,t){return N(t)?M(e,t,1):M(e,1)}function fe(e){return e<=0?function(){return mt}:Q(function(t,n){var r=0;t.subscribe(K(n,function(s){++r<=e&&(n.next(s),e<=r&&n.complete())}))})}function Ri(){return Q(function(e,t){e.subscribe(K(t,Se))})}function Gl(e){return I(function(){return e})}function Ql(e,t){return M(function(n,r){return ne(e(n,r)).pipe(fe(1),Gl(n))})}function Zl(e,t){t===void 0&&(t=hi);var n=qn(e,t);return Ql(function(){return n})}function Jl(e,t){return Q(function(n,r){var s=new Set;n.subscribe(K(r,function(o){var i=e?e(o):o;s.has(i)||(s.add(i),r.next(o))})),t&&ne(t).subscribe(K(r,function(){return s.clear()},Se))})}function ve(e,t){return t===void 0&&(t=Ge),e=e??ef,Q(function(n,r){var s,o=!0;n.subscribe(K(r,function(i){var a=t(i);(o||!e(s,a))&&(o=!1,s=a,r.next(i))}))})}function ef(e,t){return e===t}function Pi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(n){return zn(n,oe.apply(void 0,Pe([],Re(e))))}}function tf(e,t){return Q(function(n,r){var s=0,o=null,i=!1;n.subscribe(K(r,function(a){o||(o=K(r,void 0,function(){o=null,i&&r.complete()}),ne(e(a,s++)).subscribe(o))},function(){i=!0,!o&&r.complete()}))})}function nf(){return Q(function(e,t){var n,r=!1;e.subscribe(K(t,function(s){var o=n;n=s,r&&t.next([o,s]),r=!0}))})}function Kn(e,t){return Q(Nl(e,t,arguments.length>=2,!0))}function fn(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new ze}:t,r=e.resetOnError,s=r===void 0?!0:r,o=e.resetOnComplete,i=o===void 0?!0:o,a=e.resetOnRefCountZero,u=a===void 0?!0:a;return function(c){var l,v,f,d=0,p=!1,h=!1,m=function(){v?.unsubscribe(),v=void 0},y=function(){m(),l=f=void 0,p=h=!1},b=function(){var g=l;y(),g?.unsubscribe()};return Q(function(g,w){d++,!h&&!p&&m();var k=f=f??n();w.add(function(){d--,d===0&&!h&&!p&&(v=jr(b,u))}),k.subscribe(w),!l&&d>0&&(l=new jt({next:function(E){return k.next(E)},error:function(E){h=!0,m(),v=jr(y,s,E),k.error(E)},complete:function(){p=!0,m(),v=jr(y,i),k.complete()}}),ne(g).subscribe(l))})(c)}}function jr(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var s=new jt({next:function(){s.unsubscribe(),e()}});return ne(t.apply(void 0,Pe([],Re(n)))).subscribe(s)}}function hn(e,t,n){var r,s,o,i,a=!1;return e&&typeof e=="object"?(r=e.bufferSize,i=r===void 0?1/0:r,s=e.windowTime,t=s===void 0?1/0:s,o=e.refCount,a=o===void 0?!1:o,n=e.scheduler):i=e??1/0,fn({connector:function(){return new cn(i,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function Ui(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e);return Q(function(r,s){(n?zn(e,r,n):zn(e,r)).subscribe(s)})}function Nn(e,t){return Q(function(n,r){var s=null,o=0,i=!1,a=function(){return i&&!s&&r.complete()};n.subscribe(K(r,function(u){s?.unsubscribe();var c=0,l=o++;ne(e(u,l)).subscribe(s=K(r,function(v){return r.next(t?t(u,v,l,c++):v)},function(){s=null,a()}))},function(){i=!0,a()}))})}function rf(){return Nn(Ge)}function Mi(e){return Q(function(t,n){ne(e).subscribe(K(n,function(){return n.complete()},Se)),!n.closed&&t.subscribe(n)})}function Xn(e,t){return t===void 0&&(t=!1),Q(function(n,r){var s=0;n.subscribe(K(r,function(o){var i=e(o,s++);(i||t)&&r.next(o),!i&&r.complete()}))})}function dn(e,t,n){var r=N(e)||t||n?{next:e,error:t,complete:n}:e;return r?Q(function(s,o){var i;(i=r.subscribe)===null||i===void 0||i.call(r);var a=!0;s.subscribe(K(o,function(u){var c;(c=r.next)===null||c===void 0||c.call(r,u),o.next(u)},function(){var u;a=!1,(u=r.complete)===null||u===void 0||u.call(r),o.complete()},function(u){var c;a=!1,(c=r.error)===null||c===void 0||c.call(r,u),o.error(u)},function(){var u,c;a&&((u=r.unsubscribe)===null||u===void 0||u.call(r)),(c=r.finalize)===null||c===void 0||c.call(r)}))}):Ge}function zr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fr(e);return Q(function(r,s){for(var o=e.length,i=new Array(o),a=e.map(function(){return!1}),u=!1,c=function(v){ne(e[v]).subscribe(K(s,function(f){i[v]=f,!u&&!a[v]&&(a[v]=!0,(u=a.every(Ge))&&(a=null))},Se))},l=0;l<o;l++)c(l);r.subscribe(K(s,function(v){if(u){var f=Pe([v],Re(i));s.next(n?n.apply(void 0,Pe([],Re(f))):f)}}))})}var sf=Object.defineProperty,of=(e,t,n)=>t in e?sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t,n)=>of(e,typeof t!="symbol"?t+"":t,n);class Di extends Error{constructor(t){super(t.message),Li(this,"code"),Li(this,"data"),this.code=t.code,this.data=t.data,this.name="RpcError"}}const Vi=()=>{const e=new Map;return{has:e.has.bind(e),subscribe(t,n){e.set(t,n)},unsubscribe(t){e.delete(t)},next(t,n){e.get(t)?.next(n)},error(t,n){const r=e.get(t);r&&(e.delete(t),r.error(n))},errorAll(t){const n=[...e.values()];e.clear(),n.forEach(r=>{r.error(t)})}}};class Wr extends Error{constructor(){super("Client destroyed"),this.name="DestroyedError"}}let af=1;const cf=e=>{let t=af++;const n=new Map,r=Vi();let s=null;const o=(l,v,f)=>{s.send(JSON.stringify({jsonrpc:"2.0",id:l,method:v,params:f}))};function i(l){try{let v,f,d,p,h;if({id:v,result:f,error:d,params:p}=JSON.parse(l),v===null)throw new Error(p?.error?.message??"id null");if(v!=null){const b=n.get(v);return b?(n.delete(v),d?b.onError(new Di(d)):b.onSuccess(f,(g,w)=>{const k=g;return r.subscribe(k,w),()=>{r.unsubscribe(k)}})):void 0}if({subscription:h,result:f,error:d}=p,!h||!d&&!Object.hasOwn(p,"result"))throw 0;const y=h;d?r.error(y,new Di(d)):r.next(y,f)}catch(v){console.warn("Error parsing incomming message: "+l),console.error(v)}}s=e(i);const a=()=>{s?.disconnect(),s=null,r.errorAll(new Wr),n.forEach(l=>l.onError(new Wr)),n.clear()};let u=1;return{request:(l,v,f)=>{if(!s)throw new Error("Not connected");const d=`${t}-${u++}`;return f&&n.set(d,f),o(d,l,v),()=>{n.delete(d)}},disconnect:a}};class Hi extends Error{constructor(){super("ChainHead stopped"),this.name="StopError"}}class Yn extends Error{constructor(){super("ChainHead disjointed"),this.name="DisjointError"}}class Gn extends Error{constructor(){super("ChainHead operations limit reached"),this.name="OperationLimitError"}}class Fi extends Error{constructor(t){super(t),this.name="OperationError"}}class Qn extends Error{constructor(){super("ChainHead operation inaccessible"),this.name="OperationInaccessibleError"}}const Me={body:"",call:"",continue:"",follow:"",header:"",stopOperation:"",storage:"",unfollow:"",unpin:"",followEvent:""},Zn={chainName:"",genesisHash:"",properties:""},qr={broadcast:"",stop:""};Object.entries({chainHead:Me,chainSpec:Zn,transaction:qr}).forEach(([e,t])=>{Object.keys(t).forEach(n=>{t[n]=`${e}_v1_${n}`})});class ji extends Error{constructor(t){super(`Invalid BlockHash: ${t}`),this.name="BlockHashNotFoundError"}}class uf extends Error{constructor(t){super(`Storage Error: ${t}`),this.name="StorageError"}}class lf extends Error{constructor(t){super(`Call Error: ${t}`),this.name="CallError"}}const Wt=()=>{},ff=e=>(t,n)=>{let r=!1,s=()=>{r=!0};return e(qr.broadcast,[t],{onSuccess:o=>{o!==null?(s=()=>{e(qr.stop,[o]),s=Wt},r&&s()):r||n(new Error("Max # of broadcasted transactions has been reached"))},onError:n}),()=>{s()}};function hf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),res:e,rej:t}}const qt=e=>(...t)=>new Promise((n,r)=>{let s=At;const[o,i]=t[t.length-1]instanceof AbortSignal?[t.slice(0,t.length-1),t[t.length-1]]:[t],a=()=>{s(),r(new Qs)};i?.addEventListener("abort",a,{once:!0});const u=c=>l=>{s=At,i?.removeEventListener("abort",a),c(l)};s=e(u(n),u(r),...o)}),zi=(e,t)=>n=>qt((r,s,...o)=>{let i=!0,a=()=>{i=!1};const[u,c]=t(...o);return n(e,u,{onSuccess:(l,v)=>{if(l.result==="limitReached")return s(new Gn);const{operationId:f}=l,d=()=>{n(Me.stopOperation,[f])};if(!i)return d();let p=Wt;const h=y=>{i=!1,p(),r(y)},m=y=>{i=!1,p(),s(y)};p=v(f,{next:y=>{const b=y;b.event==="operationError"?s(new Fi(b.error)):b.event==="operationInaccessible"?s(new Qn):c(y,h,m)},error:m}),a=()=>{i&&(p(),d())}},onError:s}),()=>{a()}}),df=zi(Me.body,e=>[[e],(t,n)=>{n(t.value)}]),pf=zi(Me.call,(e,t,n)=>[[e,t,n],(r,s)=>{s(r.output)}]),vf=e=>t=>new Promise((n,r)=>{e(Me.header,[t],{onSuccess:n,onError:r})}),Wi=e=>(t,n,r,s,o,i,a)=>{if(n.length===0)return i(),At;let u=!0,c=()=>{u=!1};return e(Me.storage,[t,n,r],{onSuccess:(l,v)=>{if(l.result==="limitReached"||l.discardedItems===n.length)return o(new Gn);const{operationId:f}=l,d=()=>{e(Me.stopOperation,[f])};if(!u)return d();const p=v(l.operationId,{next:y=>{switch(y.event){case"operationStorageItems":{s(y.items);break}case"operationStorageDone":{m();break}case"operationError":{h(new Fi(y.error));break}case"operationInaccessible":{h(new Qn);break}default:e(Me.continue,[y.operationId])}},error:o});c=()=>{p(),e(Me.stopOperation,[l.operationId])};const h=y=>{c=At,p(),o(y)},m=()=>{c=At,p(),i()};a(l.discardedItems)},onError:o}),()=>{c()}},mf=e=>{const t=Wi(e);return qt((n,r,s,o,i,a)=>{const u=o.startsWith("descendants");let c=u?[]:null;const v=t(s,[{key:i,type:o}],a??null,u?f=>{c.push(f)}:f=>{c=f[0]?.[o]},r,()=>{try{n(u?c.flat():c)}catch(f){r(f)}},f=>{f>0&&(v(),r(new Gn))});return v})},yf=e=>t=>t.length>0?new Promise((n,r)=>{e(Me.unpin,[t],{onSuccess(){n()},onError:r})}):Promise.resolve();function bf(e){return e.operationId!==void 0}function gf(e){return(t,n,r)=>{const s=Vi(),o=new Set,i=hf();let a=i.promise,u=Wt;const c=p=>{e(Me.unfollow,[p])},l=p=>{u(),a!==null&&(p&&(a instanceof Promise?a.then(h=>{typeof h=="string"&&c(h)}):c(a)),a=null,o.forEach(h=>{h()}),o.clear(),s.errorAll(new Yn))},v=p=>{if(bf(p))return s.has(p.operationId)||console.warn("Uknown operationId on",p),s.next(p.operationId,p);switch(p.event){case"stop":return r(new Hi),l(!1);case"initialized":case"newBlock":case"bestBlockChanged":case"finalized":const{event:h,...m}=p;return n({type:h,...m})}console.warn("Invalid event",p)},f=p=>{r(p),l(!(p instanceof Wr))};e(Me.follow,[t],{onSuccess:(p,h)=>{a instanceof Promise&&(a=p,u=h(p,{next:v,error:f})),i.res(p)},onError:p=>{a=null,i.res(p),r(p)}});const d=(p,h,m)=>{const y=()=>{m?.onError(new Yn)};if(a===null)return y(),Wt;const b=w=>{if(!m)return e(p,[w,...h]);o.add(y);const k=(S,x)=>a===null?(x.error(new Yn),Wt):(s.subscribe(S,x),()=>{s.unsubscribe(S)}),E=e(p,[w,...h],{onSuccess:S=>{o.delete(y),m.onSuccess(S,k)},onError:S=>{o.delete(y),m.onError(S)}});return()=>{o.delete(y),E()}};if(typeof a=="string")return b(a);let g=Wt;return a.then(w=>{if(w instanceof Error)return y();a&&(g=b(w))}),()=>{g()}};return{unfollow(){l(!0)},body:df(d),call:pf(d),header:vf(d),storage:mf(d),storageSubscription:Wi(d),unpin:yf(d),_request:d}}}const wf=e=>{const t=qt((r,s,o,i)=>e(o,i,{onSuccess:r,onError:s}));let n=null;return async()=>n||(n=Promise.all([t(Zn.chainName,[]),t(Zn.genesisHash,[]),t(Zn.properties,[])]).then(([r,s,o])=>({name:r,genesisHash:s,properties:o})))},xf=e=>(t,n,r,s,o,i)=>{if(n.length===0)return i(),At;let a=!0,u=()=>{a=!1};return e("storage",[t,n,r],{onSuccess:(c,l)=>{const v=()=>{e("stopStorage",[c])};if(!a)return v();const f=l(c,{next:m=>{const{event:y}=m;if(y==="storage"){const{event:b,...g}=m;s(g)}else y==="storageDone"?h():p(new uf(m.error))},error:o}),d=()=>{u=At,f()};u=()=>{d(),v()};const p=m=>{d(),o(m)},h=()=>{d(),i()}},onError:o}),()=>{u()}},Ef=e=>qt((t,n,r,s,o,i)=>{const a=s.startsWith("descendants");let u=a?[]:null;const c=a?u.push.bind(u):({[s]:l})=>{u=l};return e(r,[{key:o,type:s}],i,c,l=>{n(l),u=null},()=>{t(u),u=null})}),qi=()=>e=>e,Ki=()=>(e,t)=>{if(e===null)throw new ji(t);return e},kf=e=>{const t=(l,...v)=>e(`archive_v1_${l}`,...v),n=l=>v=>qt((f,d,...p)=>t(l,p,{onSuccess:h=>{try{f(v(h,...p))}catch(m){d(m)}},onError:d})),r=n("header")(Ki()),s=n("body")(Ki()),o=xf(t),i=Ef(o),a=n("call")((l,v)=>{if(!l)throw new ji(v);if(!l.success)throw new lf(l.error);return l.value}),u=n("finalizedHeight")(qi()),c=n("hashByHeight")(qi());return{header:r,body:s,storageSubscription:o,storage:i,call:a,finalizedHeight:u,hashByHeight:c}},Af=e=>{const{request:t,disconnect:n}=cf(e);return{archive:kf(t),chainHead:gf(t),transaction:ff(t),getChainSpecData:wf(t),destroy:n,request:qt((r,s,o,i)=>t(o,i,{onSuccess:r,onError:s})),_request:t}};var Sf=Object.defineProperty,$f=(e,t,n)=>t in e?Sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ni=(e,t,n)=>$f(e,typeof t!="symbol"?t+"":t,n);class If{constructor(){Ni(this,"first"),Ni(this,"last")}getRemoveFn(t){return()=>{t.prev?t.prev.next=t.next:this.first=t.next,t.next?t.next.prev=t.prev:this.last=t.prev,delete t.prev,delete t.next}}push(t){const n={value:t};return this.last===void 0?this.last=this.first=n:(this.last.next=n,n.prev=this.last,this.last=n),this.getRemoveFn(n)}unshift(t){return this.first={value:t,next:this.first},this.first.next&&(this.first.next.prev=this.first),this.last||(this.last=this.first),this.getRemoveFn(this.first)}pop(){const t=this.first?.value;return this.first&&(this.first=this.first.next,this.first?(delete this.first.prev?.next,delete this.first.prev):this.last=void 0),t}isEmpty(){return!this.first}}const Bf=()=>{const e=new Map,t=(f,d)=>{e.set(f,()=>{e.delete(f),d()})},n=f=>{e.get(f)?.()},r=new If,s=r.unshift.bind(r),o=r.push.bind(r),i=(f,d)=>{const p=d?s:o;t(f.source$,p(f))},a=()=>{const f=r.pop();f&&(e.delete(f.source$),u(f))},u=f=>{const{source$:d,observer:p}=f;let h=!1;const m=d.subscribe({next(y){p.next(y)},error(y){(h=y instanceof Gn)?i(f,!0):p.error(y)},complete(){p.complete()}});m.closed?h||a():t(d,()=>{m.unsubscribe(),a()})},c=(f=!1)=>d=>new U(p=>{const h={observer:p,source$:d};return r.isEmpty()?u(h):i(h,f),()=>{n(d)}}),l=c();return{withRecovery:c,withRecoveryFn:f=>(...d)=>l(f(...d))}};class Qe extends Error{constructor(t,n){super(`Block ${t} is not pinned (${n})`),this.name="BlockNotPinnedError"}}const Kr=e=>{const t=e.pipe($e(n=>n instanceof Qn?qn(750).pipe(Yl(()=>t)):Fn(()=>n)));return t},Cf=new Set(["best","finalized",null]),_f=(e,t,n)=>r=>(s,...o)=>{if(!Cf.has(s))return Kr(r(s,...o)).pipe(n(s));const a=(s==="best"?t:e).pipe(fe(1),M(u=>r(u,...o).pipe(n(u))),$e(u=>u instanceof Qe?a:Fn(()=>u)));return Kr(a)},_t=e=>(...t)=>new U(n=>{let r=new AbortController;return e(...t,r.signal).then(s=>{n.next(s),n.complete()},s=>{n.error(s)}),()=>{n.unsubscribe(),r.abort(),r=void 0}}),Of=e=>t=>(...n)=>e()[t](...n);function pn(e,t,n){return(r,...s)=>{const o=t(r,...s);return new U(i=>{let a=null,u=!1;const c=()=>{u||(u=!0,a=o.subscribe({next:f=>i.next(f),error:f=>i.error(f),complete:()=>i.complete()}),a.add(()=>{u=!1,a=null}))};let l=!1;const v=e.subscribe({next:f=>{const d=f.blocks.get(r);d?d.recovering?a?.unsubscribe():c():l&&i.error(new Qe(r,n)),l=f.recovering},error:f=>i.error(f)});return()=>{v.unsubscribe(),a?.unsubscribe()}})}}const Tf=(e,t)=>{const n=(r,s,o,i)=>new U(a=>e().storageSubscription(r,s,o??null,u=>{a.next(u)},u=>{a.error(u)},()=>{a.complete()},u=>{u>0&&a.next(n(r,s.slice(-u),o,!0))})).pipe(jn(),t(i));return n},Rf=[Dt,br],Pf=(e,t)=>Rf.find(n=>Z(n(ue(e)))===t)||(()=>{throw new Error("Unsupported hasher")}),Uf=e=>{const t=async(n,r,s)=>{const o=n[r.idx],i=n[s.idx];if(n.length===2)return[o,i];const a=r.idx+Math.floor((s.idx-r.idx)/2),u={idx:a,id:await e(n[a])};if(u.id===r.id)return t(n,u,s);if(u.id===s.id)return t(n,r,u);const[c,[l,...v]]=await Promise.all([t(n,r,u),t(n,u,s)]);return[...c,...v]};return async n=>{if(n.length<2)return n;const r=n.length-1,[s]=n,o=n[r],[i,a]=await Promise.all([s,o].map(e));return i===a?[n[0]]:t(n,{idx:0,id:i},{idx:r,id:a})}},Mf=(e,t)=>{const n=Uf(t),r=i=>e().header(i),s=new cn(1),o=i=>new U(a=>{let u=null;return i.subscribe({next(c){if(c.type==="initialized"){u=[];const[l]=c.finalizedBlockHashes;Promise.all([r(l),n(c.finalizedBlockHashes)]).then(([v,f])=>{s.closed||(s.next(Pf(v,l)),s.complete());const d=Tn.dec(v);a.closed||(a.next({type:"initialized",finalizedBlockHashes:c.finalizedBlockHashes,runtimeChanges:new Set(f),number:d.number,parentHash:d.parentHash,hasNewRuntime:d.digests.some(p=>p.type==="runtimeUpdated")}),u.forEach(p=>{a.next(p)}),u=null)}).catch(v=>{a.closed||a.error(v)})}else u?u.push(c):a.next(c)},error(c){a.error(c)},complete(){a.complete()}})});return{getHeader:i=>r(i).then(Tn[1]),hasher$:s.asObservable(),operator:o}},Lf=e=>{let t=null,n=Se;const r=()=>{if(!t)throw new Error("Missing chainHead subscription");return t},s=async c=>r().storage(c,"hash","0x3a636f6465",null),{hasher$:o,operator:i,getHeader:a}=Mf(r,s),u=new U(c=>{t=e(!0,l=>{c.next(l)},l=>{t=null,c.error(l)}),n=()=>{c.complete(),t?.unfollow()}}).pipe(i,Df(),fn());return{getHeader:a,hasher$:o,getFollower:r,follow$:u,unfollow:()=>{n()}}},Df=()=>e=>new U(t=>{const n=new Ct,r=()=>e.subscribe({next:s=>t.next(s),error:s=>{n.add(r()),s instanceof Hi?t.next({type:"stop-error"}):console.warn("ChainHead follow request failed, retrying\u2026",s)},complete:()=>t.complete()});return n.add(r()),n}),Vf=e=>Z(Ve.enc(e)),Xi=Y(),Hf=ht(Xi),Ff=Ee(Ve).dec,Yi=e=>{const t=e("Metadata_metadata_versions","").pipe(I(Ff),$e(()=>oe([14]))),n=r=>{const[s]=r.filter(o=>o>13&&o<17).sort((o,i)=>i-o);return s===14?e("Metadata_metadata","").pipe(I(Xi.dec)):e("Metadata_metadata_at_version",Vf(s)).pipe(I(o=>Hf.dec(o)))};return t.pipe(M(n))},Gi=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",gt={type:"void"},jf=(e,t=()=>null)=>{const n=new Map,r=new Set,s=l=>v=>{let f=n.get(v);if(f)return f;if(r.has(v)){const p={id:v};return n.set(v,p),p}r.add(v);const d=l(v);return f=n.get(v),f?Object.assign(f,d):(f={id:v,...d},n.set(v,f)),r.delete(v),f};let o=!0,i=!0;const a=s(l=>{const v=t(e[l]);if(v)return v;const{def:f,path:d,params:p}=e[l];if(f.tag==="composite"){if(f.value.length===0)return gt;if(f.value.length===1){const h=a(f.value[0].type);return o&&d.at(-1)==="AccountId32"&&Gi(h,32)?(o=!1,{type:"AccountId32"}):i&&d.at(-1)==="AccountId20"&&Gi(h,20)?(i=!1,{type:"AccountId20"}):h}return u(f.value)}if(f.tag==="variant"){if(d.length===1&&d[0]==="Option"&&p.length===1&&p[0].name==="T"){const y=a(p[0].type);return y.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:y}}if(d.length===1&&d[0]==="Result"&&p.length===2&&p[0].name==="T"&&p[1].name==="E")return{type:"result",value:{ok:a(p[0].type),ko:a(p[1].type)}};if(f.value.length===0)return gt;const h={},m={};return f.value.forEach(y=>{const b=y.name;if(m[b]=y.docs,y.fields.length===0){h[b]={...gt,idx:y.index};return}if(y.fields.length===1&&!y.fields[0].name){h[b]={type:"lookupEntry",value:a(y.fields[0].type),idx:y.index};return}h[b]={...u(y.fields),idx:y.index}}),{type:"enum",value:h,innerDocs:m}}if(f.tag==="sequence")return{type:"sequence",value:a(f.value)};if(f.tag==="array"){const{len:h}=f.value,m=a(f.value.type);return!h||m.type==="void"?gt:h>1?{type:"array",value:m,len:f.value.len}:m}if(f.tag==="tuple")return f.value.length===0?gt:f.value.length>1?c(f.value.map(h=>a(h)),f.value.map(h=>e[h].docs)):a(f.value[0]);if(f.tag==="primitive")return{type:"primitive",value:f.value.tag};if(f.tag==="compact"){const h=a(f.value);return h.type==="void"?gt:{type:"compact",isBig:Number(h.value.slice(1))>32,size:h.value}}return{type:f.tag,isLSB:(e[f.value.bitOrderType].path.at(-1)??"LSB").toUpperCase().startsWith("LSB")}}),u=l=>{let v=!0;const f={},d={};return l.forEach((p,h)=>{v=v&&!!p.name;const m=p.name||h,y=a(p.type);y.type!=="void"&&(f[m]=y,d[m]=p.docs)}),v?{type:"struct",value:f,innerDocs:d}:c(Object.values(f),Object.values(d))},c=(l,v)=>{if(l.every(f=>f.id===l[0].id)&&v.every(f=>!f.length)){const[f]=l;return f.type==="void"?gt:{type:"array",value:l[0],len:l.length}}return{type:"tuple",value:l,innerDocs:v}};return a},Jn=e=>{const t=jf(e.lookup,({def:s})=>{if(s.tag==="composite"){const o=n(s);if(o)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(i=>[i.name,i.errors==null?{...gt,idx:i.index}:{type:"lookupEntry",value:t(i.errors.type),idx:i.index}])),byteLength:o}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const i=t(s.value[0].type),a=t(s.value[1].type);return i.type==="primitive"&&i.value==="u8"&&a.type==="array"&&a.value.type==="primitive"&&a.value.value==="u8"?1+a.len:null}return Object.assign(t,{metadata:e,call:"call"in e.extrinsic?e.extrinsic.call:e.lookup[e.extrinsic.type]?.params.find(i=>i.name==="Call")?.type??null})},zf=(e,t,n)=>(r,s,o,...i)=>{const{id:a}=r;if(s.has(a))return s.get(a);if(o.has(a)){const c=t(()=>s.get(a),r,...i);return s.set(a,c),c}o.add(a);let u=e(r,s,o,...i);return o.delete(a),s.has(a)&&(u=n(u,s.get(a),r,...i)),s.set(a,u),u},Wf=nn(),Qi=zf((e,t,n,r)=>{if(e.type==="primitive")return No[e.value];if(e.type==="void")return O;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return go;if(e.type==="compact")return e.isBig?Cn:C;if(e.type==="bitSequence")return On(e.isLSB);const s=d=>Qi(d,t,n,r),o=(d,p)=>{const h=s(d);return p?Ee(h,p):Ee(h)},i=d=>Fe(...d.map(s)),a=d=>{const p=Object.fromEntries(Object.entries(d).map(([h,m])=>[h,s(m)]));return se(p)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return Wf;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?nn(e.len):o(e.value,e.len);if(e.type==="sequence")return o(e.value);if(e.type==="tuple")return i(e.value);if(e.type==="struct")return a(e.value);if(e.type==="option")return ht(s(e.value));if(e.type==="result")return _n(s(e.value.ok),s(e.value.ko));const u=Object.values(e.value).map(d=>{switch(d.type){case"void":return O;case"lookupEntry":return s(d.value);case"tuple":return i(d.value);case"struct":return a(d.value);case"array":return o(d.value,d.len)}}),c=Object.fromEntries(Object.keys(e.value).map((d,p)=>[d,u[p]])),l=Object.values(e.value).map(d=>d.idx),f=l.every((d,p)=>d===p)?we(c):we(c,l);return e.byteLength?qf(f,e.byteLength):f},pr,e=>e),Zi=(e,t=kt())=>{const n=new Map,r=s=>Qi(e(s),n,new Set,t);return s=>r(s)},qf=(e,t)=>{const n=Y(t);return W(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},Kf=Ke(O,()=>{},()=>null),Nr=e=>{const{metadata:t}=e;let n=Zi(e);const r=t.pallets.find(f=>f.name==="System")?.constants.find(f=>f.name==="SS58Prefix");let s;if(r)try{const f=n(r.type).dec(r.value);typeof f=="number"&&(s=f,n=Zi(e,kt(f)))}catch{}const o=new Map,i=(f,d)=>{let p=o.get(f);p||o.set(f,p=Fo(f));const h=t.pallets.find(x=>x.name===f).storage.items.find(x=>x.name===d),m=x=>x===O?Kf:x,y=(x,_,...P)=>{const X=p(...P),[,...q]=P;return{args:Fe(...q.map(([ie])=>ie)),keys:X,value:_,len:x,fallback:h.modifier===1?_.dec(h.fallback):void 0}};if(h.type.tag==="plain")return y(0,m(n(h.type.value)),d);const{key:b,value:g,hashers:w}=h.type.value,k=m(n(g)),E=w.map(x=>No[x.tag]),S=(()=>{if(E.length===1)return[[n(b),E[0]]];const x=e(b);switch(x.type){case"array":return E.map(_=>[n(x.value.id),_]);case"tuple":return x.value.map((_,P)=>[n(_.id),E[P]]);default:throw new Error("Invalid key type")}})();return y(E.length,k,d,...S)},a=f=>{switch(f.type){case"void":return O;case"lookupEntry":return n(f.value.id);case"tuple":return Fe(...Object.values(f.value).map(d=>n(d.id)));case"struct":return se(Ut(f.value,d=>n(d.id)));case"array":return Ee(n(f.value.id),f.len)}},u=(f,d)=>{const p=t.pallets.find(h=>h.name===f).constants.find(h=>h.name===d);return n(p.type)},c=f=>(d,p)=>{const h=t.pallets.find(b=>b.name===d),m=e(h[f].type);if(m.type!=="enum")throw null;const y=m.value[p];return{location:[h.index,y.idx],codec:a(m.value[p])}},l=(f,d)=>{const p=t.pallets.find(h=>h.name===f)?.viewFns.find(h=>h.name===d);if(!p)throw null;return{args:Fe(...p.inputs.map(h=>n(h.type))),value:n(p.output)}},v=(f,d)=>{const p=t.apis.find(h=>h.name===f)?.methods.find(h=>h.name===d);if(!p)throw null;return{args:Fe(...p.inputs.map(h=>n(h.type))),value:n(p.output)}};return{buildDefinition:n,buildStorage:i,buildEvent:c("events"),buildError:c("errors"),buildViewFn:l,buildRuntimeCall:v,buildCall:c("calls"),buildConstant:u,ss58Prefix:s}},Ji="CheckMortality",ea=(e,t,n)=>{const r=Jn(e),s=Nr(r),o=s.buildStorage("System","Events"),i=e.extrinsic.signedExtensions.find(l=>l.identifier==="ChargeAssetTxPayment");let a=null;if(i){const l=r(i.type);if(l.type==="struct"){const v=l.value.asset_id;v.type==="option"&&(a=v.value.id)}}const u=Yf(r.metadata,s),c=l=>{const v=u(l);return"extra"in v&&v.extra[Ji]||{mortal:!1}};return{assetId:a,metadataRaw:t,codeHash:n,lookup:r,dynamicBuilder:s,events:{key:o.keys.enc(),dec:o.value.dec},accountId:kt(s.ss58Prefix),getMortalityFromTx:c}},Xr=Y(1/0).dec,Nf=wn(Ne[1],e=>{const t=2<<e%16,n=Math.max(t>>12,1),r=(e>>4)*n;return{mortal:!0,period:t,phase:r}}),Xf=Je(e=>{const t=D.dec(e);if(t===0)return{mortal:!1};const n=D.dec(e);return Nf(Uint8Array.from([t,n]))}),Yf=(e,t)=>{const n=Object.fromEntries(e.extrinsic.signedExtensions.map(a=>[a.identifier,a.identifier===Ji?Xf:t.buildDefinition(a.type)[1]]));let r,s;const{extrinsic:o}=e;if("address"in o)r=t.buildDefinition(o.address)[1],s=t.buildDefinition(o.signature)[1];else{const a=e.lookup[o.type]?.params,u=a?.find(v=>v.name==="Call")?.type,c=a?.find(v=>v.name==="Address")?.type,l=a?.find(v=>v.name==="Signature")?.type;if(u==null||c==null||l==null)throw new Error("Call, Address and/or signature not found");r=t.buildDefinition(c)[1],s=t.buildDefinition(l)[1]}const i=se.dec({address:r,signature:s,extra:se.dec(n),callData:Xr});return Je(a=>{const u=C.dec(a),{type:c,version:l}=$r[1](a);if(c==="bare")return{len:u,version:l,type:c,callData:Xr(a)};if(c==="signed")return{len:u,version:l,type:c,...i(a)};const v=D.dec(a);let f;if(e.version===16){const p=e.extrinsic.signedExtensionsByVersion.find(([h])=>h===v);if(!p)throw new Error("Unexpected extension version");f=se.dec(Object.fromEntries(Object.entries(n).filter((h,m)=>p[1].includes(m))))}else f=se.dec(n);const d=f(a);return{len:u,type:c,version:l,extensionVersion:v,extra:d,callData:Xr(a)}})},Gf=e=>t=>{const n=(...r)=>{const s=e();return s?t(s,...r).pipe($e(o=>{if(o instanceof Qe)return n(...r);if(o instanceof Qn)return qn(750).pipe(M(()=>n(...r)));throw o})):mt};return n},Qf=(e,t,n,r)=>{const s=(o,i)=>o.pipe(M(a=>n(a).pipe($e(()=>oe(null)),M(u=>u?oe(u):i.pipe(dn(c=>{r(a,c)}))),I(u=>({codeHash:a,metadataRaw:u,metadata:Lt(dt.dec(u))})))));return o=>{const i=Gf(o),a=o(),u=new Set([a]),c=i(t)().pipe(hn(1)),l=s(c,Yi(i(e))).pipe(I(({metadata:f,metadataRaw:d,codeHash:p})=>ea(f,d,p)),hn(1)),v={at:a,runtime:l,codeHash$:c,addBlock:f=>(u.add(f),v),deleteBlocks:f=>(f.forEach(d=>{u.delete(d)}),u.size),usages:u};return l.subscribe({error(){}}),v}},vn=fn({connector:()=>new cn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0}),er=({hash:e,number:t,parent:n,hasNewRuntime:r})=>({hash:e,number:t,parent:n,hasNewRuntime:r}),ta=(e,t)=>()=>{const n=e.runtimes[t];return n?[...n.usages].at(-1)??null:e.blocks.has(t)?t:null},na=(e,t)=>{e.get(e.get(t).parent)?.children.delete(t),e.delete(t)},Zf=(e,t)=>{t.forEach(n=>{na(e.blocks,n)}),Object.entries(e.runtimes).map(([n,r])=>({key:n,usages:r.deleteBlocks(t)})).filter(n=>n.usages===0).map(n=>n.key).forEach(n=>{delete e.runtimes[n]})},Jf=(e,t,n,r,s,o,i,a,u)=>{const c=h=>{i.next(er(h))},l=new ze,v=l.pipe(tf(()=>qn(0)),I(()=>({type:"cleanup"}))),f=ra(),d=ln(o,v,e).pipe(Kn((h,m)=>{const y=b=>{Zf(h,b),a(b)};switch(m.type){case"initialized":h.recovering&&!m.finalizedBlockHashes.some(E=>h.blocks.has(E))&&(h=Object.assign(h,ra()),i.next(null));const b=h.blocks.get(h.finalized)?.number??-1,g=m.finalizedBlockHashes.length-1;h.finalized=h.best=m.finalizedBlockHashes[g];let w=h.finalizedRuntime.at;const k=[];return m.finalizedBlockHashes.forEach((E,S)=>{const x=S!==g,_=h.blocks.get(E);if(_)_.recovering=!1,_.unpinnable=x;else{const P=m.number+S,X=P>b,q=m.runtimeChanges.has(E)&&!h.runtimes[E]&&X;q&&(w=E);const ie=S===0?m.parentHash:m.finalizedBlockHashes[S-1],j={hash:E,hasNewRuntime:S?m.runtimeChanges.has(E):m.hasNewRuntime,parent:ie,children:new Set(S===g?[]:[m.finalizedBlockHashes[S+1]]),unpinnable:x,runtime:w,refCount:0,number:P,recovering:!1};h.blocks.set(E,j),q&&(h.finalizedRuntime=h.runtimes[E]=p(ta(h,E))),h.runtimes[w].usages.add(E),X&&k.push(j)}}),k.forEach(c),h;case"stop-error":for(const E of h.blocks.values())E.recovering=!0;return h.recovering=!0,h;case"newBlock":{const{parentBlockHash:E,blockHash:S}=m;if(h.blocks.has(S))h.blocks.get(S).recovering=!1;else{const x=h.blocks.get(E);x.children.add(S);const _=x.number+1,P={hash:S,number:_,parent:E,children:new Set,runtime:m.newRuntime?S:x.runtime,unpinnable:!1,refCount:0,recovering:!1,hasNewRuntime:!!m.newRuntime};h.blocks.set(S,P),m.newRuntime&&(h.runtimes[S]=p(ta(h,S))),h.runtimes[P.runtime].addBlock(S),c(P)}return h}case"bestBlockChanged":{if(h.recovering){for(const[E,S]of h.blocks)S.recovering&&(na(h.blocks,E),u(E));h.recovering=!1}return h.best=m.bestBlockHash,h}case"finalized":{h.finalized=m.finalizedBlockHashes.slice(-1)[0];const{blocks:E}=h;E.get(h.best).number<E.get(h.finalized).number&&(h.best=h.finalized),h.finalizedRuntime=h.runtimes[E.get(h.finalized).runtime],m.prunedBlockHashes.forEach(x=>{const _=h.blocks.get(x);_&&(_.unpinnable=!0)});let S=E.get(E.get(h.finalized).parent);for(;S&&!S.unpinnable;)S.unpinnable=!0,S=E.get(S.parent);return l.next(),h}case"cleanup":{const E=[...h.blocks.values()].filter(({unpinnable:S,refCount:x})=>S&&!x).map(({hash:S})=>S);return y(E),h}case"blockUsage":{if(!h.blocks.has(m.value.hash))return h;const E=h.blocks.get(m.value.hash);if(E.refCount+=m.value.type==="hold"?1:-1,E.refCount===0&&!E.recovering&&E.unpinnable){const S=[E.hash];y(S)}return h}}},f),Ue(h=>!!h.finalizedRuntime.runtime),I(h=>({...h})),dn({error(h){i.error(h)}}),vn),p=Qf(pn(d,t,"pinned-blocks"),pn(d,n,"pinned-blocks"),r,s);return Object.assign(d,{state:f})},ra=()=>({best:"",finalized:"",runtimes:{},blocks:new Map,finalizedRuntime:{},recovering:!1}),sa=(e,t,n,r)=>{const s=a=>Mi(e.pipe(Ue(({blocks:u})=>!u.has(a)))),o=(a,u,c)=>{if(c)return oe({hash:a,found:{type:!1,validity:null}});const l=s(a);return t(a).pipe(M(v=>{const f=v.indexOf(u);return f>-1?l(r(a)).pipe(I(d=>({hash:a,found:{type:!0,index:f,events:d}}))):n(a,u).pipe(I(d=>({hash:a,found:{type:!1,validity:d}})))}),l)},i=(a,u,c)=>o(a,u,c.has(a)).pipe(M(l=>{const{found:v}=l;return v.type||v.validity?.success===!1?oe(l):e.pipe(s(a),M(f=>f.blocks.get(a).children),Jl(),M(f=>i(f,u,c)))}));return a=>e.pipe(fe(1),M(u=>i(u.finalized,a,new Set(u.blocks.keys()))))},eh=new Uint8Array([2]),th=(e,t)=>Z(re([eh,ue(e),ue(t)])),oa="TaggedTransactionQueue",ia="validate_transaction",[,nh]=we({InvalidTransaction:we({Call:O,Payment:O,Future:O,Stale:O,BadProof:O,AncientBirthBlock:O,ExhaustsResources:O,Custom:D,BadMandatory:O,MandatoryValidation:O,BadSigner:O}),UnknownTransaction:we({CannotLookup:O,NoUnsignedValidator:O,Custom:D})}),rh=Je(e=>{const t=D.dec(e);if(t>1)throw new Error("Unable to decode validateTransaction result");if(!t)return{success:!0,value:void 0};let n;try{n=nh(e)}catch{n={type:"UnknownInvalidTx"}}return{success:!1,value:n}}),sh=(e,t)=>(n,r)=>{const s=t(n).pipe(I(o=>{try{return o.dynamicBuilder.buildRuntimeCall(oa,ia).value[1]}catch{return rh}}));return e(n,`${oa}_${ia}`,th(r,n)).pipe(zr(s),I(([o,i])=>i(o)))},oh=e=>t=>new U(n=>{let r=!1;const s=t.subscribe({next(o){r=!0,n.next(o)},error(o){n.error(o)},complete(){n.complete()}});return r||n.next(e),s}),ih=e=>t=>new U(n=>{const r=t.subscribe({next(o){n.next(o)},error(o){n.error(o)},complete(){n.complete()}}),s=()=>r.unsubscribe();return()=>{Promise.resolve().then(s)}}),aa=(e,t=1/0)=>n=>new U(r=>{let s;const o=new Map,i=new Map,a=new Map;let u=0,c=0,l=0;const v=()=>{const f=o.get(c);if(!f){i.size===0&&(typeof s>"u"||s.closed)&&r.complete();return}const d=c++;o.delete(d),l!==d&&a.set(d,[]);let p=!1,h=f.subscribe({next(m){l===d?r.next(m):a.get(d).push(m)},complete(){if(p=!0,i.delete(d),d===l)for(l++;a.has(l)&&(a.get(l).forEach(m=>r.next(m)),a.delete(l),!i.has(l));)l++;v()},error(m){r.error(m)}});p||i.set(d,h)};return s=new Ct,s.add(n.subscribe({next(f){const d=u++;o.set(d,Wn(()=>e(f,d))),i.size<t&&v()},error(f){r.error(f)},complete(){i.size===0&&r.complete()}})),()=>{i.forEach(f=>f.unsubscribe()),s.unsubscribe(),o.clear(),a.clear()}}),ah=(e,t,n)=>{const{getFollower:r,unfollow:s,follow$:o,getHeader:i,hasher$:a}=Lf(e),u=Of(r),{withRecovery:c,withRecoveryFn:l}=Bf(),v=new ze,f=A=>B=>new U(T=>{v.next({type:"blockUsage",value:{type:"hold",hash:A}});const z=B.subscribe(T);return z.add(()=>{setTimeout(()=>{v.next({type:"blockUsage",value:{type:"release",hash:A}})},0)}),z}),d=A=>(B,...T)=>A(B,...T).pipe(f(B)),p=(A,B)=>(T,...z)=>new U(Be=>k.state.blocks.has(T)?A(T,...z).subscribe(Be):Be.error(new Qe(T,B))),h=A=>r().unpin(A).catch(B=>{if(!(B instanceof Yn))throw B}),m=(A,B)=>p(d(pn(k,l(_t(A)),`stop-${B}`)),B),y=new Map,b=d(l(_t(u("storage")))),g=A=>b(A,"hash","0x3a636f6465",null).pipe(I(B=>B)),w=new ze,k=Jf(o,d(l(_t(u("call")))),g,t,n,v,w,A=>{h(A).catch(B=>{console.error("unpin",B)}),A.forEach(B=>{y.delete(B)})},A=>{y.delete(A)}),E=p(d(A=>k.state.runtimes[k.state.blocks.get(A).runtime].runtime),"getRuntimeCtx"),S=A=>B=>B.pipe(aa(T=>E(A(T)).pipe(I(z=>[T,z])))),x=(A,B,T)=>{const z=y.get(A)??new Map,Be=z.get(B);if(Be)return Be;y.set(A,z);let xt;const ot=T.pipe(fn({connector:()=>xt=new cn}),dn({complete(){z.set(B,xt)}}),ih());return z.set(B,ot),ot},_=k.pipe(Ue(A=>!A.recovering),ve((A,B)=>A.finalized===B.finalized),Kn((A,B)=>{let T=B.blocks.get(B.finalized);const z=[T],Be=A.at(-1);if(!Be)return z;for(;T.number>Be.number+1&&(T=B.blocks.get(T.parent),!!T);)z.unshift(T);return z},[]),jn(),I(er),vn),P=k.pipe(ve((A,B)=>A.best===B.best),I(A=>er(A.blocks.get(A.best))),vn),X=k.pipe(Ue(A=>!A.recovering),ve((A,B)=>A.finalized===B.finalized&&A.best===B.best),Kn((A,B)=>{const T=De=>A.get(De)||er(B.blocks.get(De)),z=T(B.best),Be=T(B.finalized),xt=z.number-Be.number+1,ot=new Array(xt);for(let De=0,Ta=z.hash;De<xt;De++)ot[De]=T(Ta),Ta=ot[De].parent;return new Map(ot.map(De=>[De.hash,De]))},new Map),I(A=>[...A.values()]),vn),q=k.pipe(ve((A,B)=>A.finalizedRuntime===B.finalizedRuntime),Nn(({finalizedRuntime:{runtime:A}})=>A.pipe(oh(null))),vn),ie=q.pipe(I(A=>A?.lookup.metadata??null)),j=_f(_.pipe(I(A=>A.hash)),P.pipe(I(A=>A.hash)),f),ae=m(u("body"),"body"),me=A=>Kr(x(A,"body",ae(A))),ye=m(u("storage"),"storage"),Le=j(p((A,B,T,z=null,Be)=>k.state.runtimes[k.state.blocks.get(A).runtime].runtime.pipe(M(xt=>{const ot=T(xt);return x(A,`storage-${B}-${ot}-${z??""}`,ye(A,B,ot,z)).pipe(Be?I(De=>Be(De,xt)):Ge)})),"storage")),or=Tf(r,c),yn=j(p(pn(k,(A,B,T)=>or(A,B,T??null,!1),"storageQueries"),"storageQueries")),ls=j(p(pn(k,A=>Wn(()=>i(A)),"header"),"header")),Ba=A=>Le(A,"value",B=>B.events.key,null,(B,T)=>T.events.dec(B)),cd=m(u("call"),"call"),Ca=j((A,B,T)=>x(A,`call-${B}-${T}`,cd(A,B,T))),fs=sh(Ca,E),_a=A=>x(A,"body",ae(A)),ud=sa(k,_a,fs,Ba),ld=sa(k,_a,fs,()=>oe()),fd=q.pipe(Ue(Boolean),fe(1),M(A=>{const{enc:B}=A.dynamicBuilder.buildStorage("System","BlockHash").keys;let T;try{T=B(0)}catch{T=B(0n)}return Le(null,"value",()=>T,null)}),hn(1));ln(q,X).subscribe({error(){}});const hd=A=>ln(...Object.values(k.state.runtimes).map(B=>B.codeHash$.pipe(M(T=>A===T?B.runtime:mt)))).pipe(Pi(null),fe(1)),Oa=(A,B=!1)=>{let T=A||"finalized";if(T=k.state[T]||T,!k.state.blocks.has(T)){if(B)throw new Qe(T,"holdBlock");return Se}v.next({type:"blockUsage",value:{type:"hold",hash:T}});let z=()=>{v.next({type:"blockUsage",value:{type:"release",hash:T}}),z=Se};return()=>{z()}},dd=A=>B=>new U(T=>{const z=B.subscribe(T);return z.closed||z.add(Oa(A)),z});return{follow$:o,unfollow:s,finalized$:_,best$:P,bestBlocks$:X,newBlocks$:w.pipe(Xn(Boolean)),runtime$:q,metadata$:ie,genesis$:fd,hasher$:a,getRuntime$:hd,header$:ls,body$:me,call$:Ca,storage$:Le,storageQueries$:yn,eventsAt$:Ba,withHodl:dd,holdBlock:Oa,trackTx$:ud,trackTxWithoutEvents$:ld,validateTx$:fs,pinnedBlocks$:k,withRuntime:S,getRuntimeContext$:j(E)}};var ch=e=>t=>new U(n=>e(t,r=>{n.error(r)}));const uh=({storageSubscription:e,...t})=>n=>{const r={},s=_t(t.storage),o=_t(t.call),i=_t(t.header),a=_t(t.body),u=h=>i(h).pipe(I(Tn[1])),c=h=>s(h,"hash","0x3a636f6465",null).pipe(I(m=>m)),l=(h,m)=>n(h).pipe($e(()=>oe(null)),M(y=>y?oe(y):Yi((...b)=>o(m,...b)).pipe(I(b=>ea(Lt(dt.dec(b)),b,h)))),dn(y=>{r[h]=y})),v=h=>c(h).pipe(M(m=>{const y=r[m];return y?oe(y):l(m,h)})),f=(h,m,y,b=null,g)=>v(h).pipe(M(w=>s(h,m,y(w),b).pipe(I(k=>g?g(k,w):k))));return{body$:a,header$:u,storage$:f,storageQueries$:(h,m,y)=>new U(b=>e(h,m,y||null,g=>b.next(g),g=>b.error(g),()=>{b.complete()})),call$:o,eventsAt$:h=>f(h,"value",m=>m.events.key,null,(m,y)=>y.events.dec(m)),getRuntimeContext$:v}},lh=()=>oe(null),fh=(e,{getMetadata:t,setMetadata:n}={})=>({chainHead$:()=>ah(e.chainHead,t||lh,n||Se),archive:uh(e.archive),broadcastTx$:ch(e.transaction),destroy:e.destroy}),hh=(e,t)=>e.pipe(Xn(n=>n.blocks.has(t)),ve((n,r)=>n.finalized===r.finalized&&n.best===r.best),I(n=>{if(n.blocks.get(t).number>n.blocks.get(n.best).number)return null;const{number:r}=n.blocks.get(t);let s=n.blocks.get(n.best),o=n.finalized===s.hash;for(;s.number>r;)s=n.blocks.get(s.parent),o=o||n.finalized===s.hash;return o?"finalized":s.hash===t?"best":null}),ve(),Xn(n=>n!=="finalized",!0)),Ot=(e,t)=>(n,...r)=>e(n,...r).pipe($e(s=>{if(!(s instanceof Qe))throw s;return t(n,...r).pipe($e(o=>{throw console.warn(o),s}))}));class Tt{constructor(){}_runtime(t){}}class Yr{constructor(){}_compatibility(t){}}const tr=new WeakMap,ca=new WeakMap,nr=e=>e instanceof Tt?ca.get(e):tr.get(e);var wt=(e=>(e.Storage="storage",e.Tx="tx",e.Event="events",e.Const="constants",e.ViewFns="viewFns",e.Api="apis",e))(wt||{});const dh=Ee(Xu),ph=Ee(Cr),vh=Fe(dh,ph),mh=(e,t)=>{const n=new Promise(async r=>{const s=t.runtime$.pipe(Ue(i=>i!=null));let o=await We(s);s.subscribe(i=>o=i),r(()=>o)});return Promise.all([e.metadataTypes.then(vh.dec),e.descriptors,n]).then(([[r,s],o,i])=>{const a=new Yr;return tr.set(a,{runtime:i,getEntryPoint(u,c,l){const v=o[u]?.[c]?.[l];if(v==null)throw new Error(`Descriptor for ${u} ${c}.${l} does not exist`);return r[v]},typedefNodes:s}),a})},yh=e=>new Promise(async t=>{const n=e.runtime$.pipe(Ue(s=>s!=null));let r=await We(n);n.subscribe(s=>r=s),t(()=>r)}).then(t=>{const n=new Tt;return ca.set(n,{runtime:t}),n}),Gr=new WeakMap,ua=e=>(Gr.has(e.metadataRaw)||Gr.set(e.metadataRaw,{compat:new Map,lookup:e.lookup,typeNodes:[]}),Gr.get(e.metadataRaw)),Rt=(e,t,n)=>{const r=(i,a)=>{var u;const c=ua(i);return(u=c.typeNodes)[a]||(u[a]=Un(c.lookup(a)))};function s(i,a){if(i instanceof Tt)return{args:Te.Identical,values:Te.Identical};const u=tr.get(i);a||(a=u.runtime());const c=n(a);if(c==null)return{args:Te.Incompatible,values:Te.Incompatible};const l=u.typedefNodes,v=ua(a),f=t(u),d=Zu(f,p=>l[p],c,p=>r(a,p),v.compat);return{args:d.args.level,values:d.values.level}}const o=fa(e,i=>la(s(i)));return{isCompatible:fa(e,(i,a)=>o(a)>=i),getCompatibilityLevel:o,getCompatibilityLevels:s,descriptors:e,withCompatibleRuntime:(i,a)=>u=>zt([u.pipe(i.withRuntime(a)),e]).pipe(I(([[c,l],v])=>[c,v,l])),compatibleRuntime$:(i,a)=>zt([e,i.getRuntimeContext$(a)]),argsAreCompatible:(i,a,u)=>{if(i instanceof Tt)return!0;const c=s(i,a);if(c.args===Te.Incompatible)return!1;if(c.args>Te.Partial)return!0;if(c.values===Te.Incompatible)return!1;const l=n(a);return l==null?!1:ei(l.args,v=>r(a,v),u)},valuesAreCompatible:(i,a,u)=>{if(i instanceof Tt)return!0;const c=s(i,a).values;if(c===Te.Incompatible)return!1;if(c>Te.Partial)return!0;const l=tr.get(i),v=t(l);return ei(v.values,f=>l.typedefNodes[f],u)},getRuntimeTypedef:r}},la=e=>Math.min(e.args,e.values),fa=(e,t)=>(...n)=>{const r=n.at(-1);return r instanceof Yr||r instanceof Tt?t(...n):e.then(s=>t(...n,s))},bh=(e,t,{valuesAreCompatible:n,descriptors:r,isCompatible:s,getCompatibilityLevel:o})=>{const i=new WeakMap,a=c=>{if(i.has(c))return i.get(c);const l=c.lookup.metadata.pallets.find(f=>f.name===e)?.constants.find(f=>f.name===t);if(l==null)throw new Error(`Runtime entry Constant(${e}.${t}) not found`);const v=c.dynamicBuilder.buildConstant(e,t).dec(l.value);return i.set(c,v),v},u=c=>{if(c){const l=nr(c).runtime(),v=a(l);if(!n(c,l,v))throw new Error(`Incompatible runtime entry Constant(${e}.${t})`);return v}return r.then(u)};return Object.assign(u,{isCompatible:s,getCompatibilityLevel:o})},gh=fn({connector:()=>new cn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0});function Kt(e,t){return new Promise((n,r)=>{let s=null,o=!1;const i=t?()=>{s?.unsubscribe(),r(new Qs)}:Se;s=e.subscribe({next:a=>{n(a),s?.unsubscribe(),o=!0},error:a=>{t?.removeEventListener("abort",i),r(a),o=!0},complete:()=>{t?.removeEventListener("abort",i),r(new Error("Observable completed without emitting")),o=!0}}),o||t?.addEventListener("abort",i)})}const Qr=Symbol("EMPTY_VALUE"),Zr=e=>t=>new U(n=>{let r=0,s=null,o=Qr,i=!1;const a=()=>{const c=e(o,r++);o=Qr,s=c.subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){o!==Qr?a():(s=null,i&&n.complete())}})},u=t.subscribe({next(c){o=c,s||a()},error(c){n.error(c)},complete(){s||n.complete(),i=!0}});return()=>{s?.unsubscribe(),u.unsubscribe()}});let ha={};const wh=e=>t=>new U(n=>{let r=ha,s=t.subscribe({next(o){n.next(r=o)},error(o){n.error(o)},complete(){r===ha?n.complete():s=e(r).subscribe(n)}});return()=>{s.unsubscribe()}}),Nt=e=>typeof e=="object"&&e!==null&&Object.entries(e).every(([t,n])=>t==="at"&&(n===void 0||typeof n=="string")||t==="signal"&&(n===void 0||n instanceof AbortSignal)),xh=()=>{const e=new hl(new ze);return[e.pipe(rf()),()=>dn({next:t=>e.value.next(t),error:t=>{e.value.error(t),e.next(new ze)},complete:()=>{e.value.complete(),e.next(new ze)}})]},Eh=(e,t,n,{isCompatible:r,getCompatibilityLevel:s,withCompatibleRuntime:o,argsAreCompatible:i,valuesAreCompatible:a})=>{const u=()=>new Error(`Incompatible runtime entry Event(${e}.${t})`),c=n.finalized$.pipe(o(n,l=>l.hash),I(([l,v,f])=>{const d=f.lookup.metadata.pallets.find(p=>p.name===e)?.events?.type;if(d==null||f.lookup.metadata.lookup[d].def.tag!=="variant"||f.lookup.metadata.lookup[d].def.value.find(p=>p.name===t)==null)throw new Error(`Runtime entry Event(${e}.${t}) not found`);if(!i(v,f,null))throw u();return[l,v,f]}),aa(([l,v,f])=>n.eventsAt$(l.hash).pipe(I(d=>d.filter(p=>p.event.type===e&&p.event.value.type===t).map(p=>{if(!a(v,f,p.event.value.value))throw u();return{meta:{phase:p.phase,block:l},payload:p.event.value.value}})))),gh);return{watch:l=>c.pipe(M(v=>l?v.filter(f=>l(f.payload)):v)),pull:()=>We(c),filter:l=>l.filter(v=>v.type===e&&v.value.type===t).map(v=>v.value.value),getCompatibilityLevel:s,isCompatible:r}},kh=(e,t,n,{isCompatible:r,getCompatibilityLevel:s,compatibleRuntime$:o,argsAreCompatible:i,valuesAreCompatible:a})=>{const u=`${e}_${t}`,c=()=>new Error(`Incompatible runtime entry RuntimeCall(${u})`);return Object.assign((...l)=>{const v=l[l.length-1],f=Nt(v),{signal:d,at:p}=f?v:{},h=p??null,m=o(n,h).pipe(M(([y,b])=>{let g;try{g=b.dynamicBuilder.buildRuntimeCall(e,t)}catch{throw new Error(`Runtime entry RuntimeCall(${u}) not found`)}if(!i(y,b,l))throw c();return n.call$(h,u,Z(g.args.enc(l))).pipe(I(g.value.dec),I(w=>{if(!a(y,b,w))throw c();return w}))}),n.withHodl(h));return Kt(m,d)},{getCompatibilityLevel:s,isCompatible:r})},da=I(e=>e.mapped),Ah=(e,t,n,r,{isCompatible:s,getCompatibilityLevel:o,getCompatibilityLevels:i,descriptors:a,argsAreCompatible:u,valuesAreCompatible:c})=>{const l=e==="System"&&t==="Number",v=e==="System"&&t==="BlockHash",f=n.runtime$.pipe(Ue(Boolean),fe(1),I(({dynamicBuilder:x})=>typeof x.buildStorage("System","Number").value.dec(new Uint8Array(32))=="bigint"?BigInt:Ge),hn()),d=ii(Xl(f),I(([x,_])=>_(x))),p=()=>new Error(`Incompatible runtime entry Storage(${e}.${t})`),h=x=>new Error(`Invalid Arguments calling ${e}.${t}(${x})`),m=x=>{try{return x.dynamicBuilder.buildStorage(e,t)}catch{throw new Error(`Runtime entry Storage(${e}.${t}) not found`)}},y=(...x)=>{const _=x[x.length-1],P=_==="best",X=P||_==="finalized"?x.slice(0,-1):x;return n[P?"best$":"finalized$"].pipe(Zr(()=>b(...X,P?{at:"best"}:{})),ve((q,ie)=>q.raw===ie.raw),da)},b=(...x)=>{const _=x[x.length-1],P=Nt(_),{at:X}=P?_:{},q=X??null,ie=bt(a).pipe(M(j=>n.storage$(q,"value",ae=>{const me=m(ae),ye=x.length===me.len?x:x.slice(0,-1);if(x!==ye&&!P)throw h(x);if(!u(j,ae,ye))throw p();return me.keys.enc(...ye)},null,(ae,me)=>{const ye=m(me),Le=ae===null?ye.fallback:ye.value.dec(ae);if(!c(j,me,Le))throw p();return{raw:ae,mapped:Le}})),n.withHodl(q));return l?n.pinnedBlocks$.pipe(I(j=>{const ae=q==="finalized"||!q?j.finalized:q==="best"?j.best:q,me=j.blocks.get(ae);if(!me)throw new Qe(ae,"System.Number");return me.number}),ve(),d,I(j=>({raw:j.toString(),mapped:j})),$e(j=>{if(j instanceof Qe)return ie;throw j})):v&&Number(x[0])===0?n.genesis$.pipe(I(j=>({raw:j,mapped:Bn.fromHex(j)}))):ie},g=async(...x)=>{const _=x[x.length-1],P=Nt(_),{signal:X}=P?_:{};return Kt(b(...x).pipe(da),X)},w=async(...x)=>{const _=x[x.length-1],P=Nt(_),{signal:X,at:q}=P?_:{},ie=q??null,j=bt(a).pipe(M(ae=>n.storage$(ie,"descendantsValues",me=>{const ye=m(me);if(la(i(ae,me))===Te.Incompatible)throw p();if(x.length>ye.len)throw h(x);const Le=x.length>0&&P?x.slice(0,-1):x;if(x.length===ye.len&&Le===x)throw h(x);return ye.keys.enc(...Le)},null,(me,ye)=>{const Le=m(ye),or=me.map(({key:yn,value:ls})=>({keyArgs:Le.keys.dec(yn),value:Le.value.dec(ls)}));if(or.some(({value:yn})=>!c(ae,ye,yn)))throw p();return or})),n.withHodl(ie));return Kt(j,X)},k=(x,_)=>Promise.all(x.map(P=>g(..._?[...P,_]:P))),E=(...x)=>{const _=x.at(-1),P=Nt(_);return r(e,t,P?x.slice(0,-1):x,P&&_.at==="best")},S=(...x)=>{const _=x.at(-1);if(_ instanceof Yr||_ instanceof Tt){const P=x.slice(0,-1),X=nr(_).runtime();if(!u(_,X,P))throw p();return m(X).keys.enc(...P)}return a.then(P=>S(...x,P))};return{isCompatible:s,getCompatibilityLevel:o,getKey:S,getValue:g,getValues:k,getEntries:w,watchValue:y,watchEntries:E}},Jr=()=>new Error("Unkown signer"),Sh=e=>{const{extrinsic:t}=e,n=Jn(e);let r,s;if("address"in t)r=n(t.address),s=n(t.signature);else{const o=Object.fromEntries(e.lookup[t.type].params.filter(i=>i.type!=null).map(i=>[i.name,n(i.type)]));if(r=o.Address,s=o.Signature,!r||!s)throw Jr()}if(r.type==="AccountId20"&&s.type==="array"&&s.len===65&&s.value.type==="primitive"&&s.value.value==="u8")return[1,[]];if(s.type!=="enum"||["Ecdsa","Ed25519","Sr25519"].some(o=>!(o in s.value)))throw Jr();if(r.type==="enum"){const o=r.value.Id;if(o.type==="lookupEntry"&&o.value.type==="AccountId32")return[0,[o.idx]]}else if(r.type==="AccountId32")return[0,[]];throw Jr()},$h={Ed25519:0,Sr25519:1,Ecdsa:2},Ih=(e,t,n,r,s,o)=>{const[i,a]=Sh(e),u=re([$r.enc({version:4,type:"signed"}),i===1?t:new Uint8Array([...a,...t]),i===1||!o?n:new Uint8Array([$h[o],...n]),...r,s]);return re([he.enc(u.length),u])},[rr,mn]=["<Bytes>","</Bytes>"].map(e=>He.fromText(e).asBytes()),Bh=e=>async t=>{let n=!0,r;for(r=0;n&&r<rr.length;r++)n=rr[r]===t[r];n=n&&r===rr.length;const s=t.length-mn.length;for(r=0;n&&r<mn.length;r++)n=mn[r]===t[s+r];return n=n&&r===mn.length,e(n?t:re([rr,t,mn]))};function Ch(e,t,n){return{publicKey:e,signTx:async(s,o,i,a,u=Dt)=>{const c=Lt(Sr(i)),l=[],v=[];c.extrinsic.signedExtensions.map(({identifier:p})=>{const h=o[p];if(!h)throw new Error(`Missing ${p} signed extension`);l.push(h.value),v.push(h.additionalSigned)});const f=re([s,...l,...v]),d=await n(f.length>256?u(f):f);return Ih(c,e,d,l,s,t)},signBytes:Bh(n)}}Uint8Array.from([1]);const _h=(e,t)=>{const n=e.metadata.pallets.find(o=>o.name==="System").constants.find(o=>o.name==="Version"),r=e(n.type),s=t.buildDefinition(n.type).dec;if(r.type!=="struct")throw new Error("not a struct");return s(n.value)};function Oh(e){let t=0;for(;!(e&1);)t++,e>>=1;return t}const Th=e=>1<<Math.ceil(Math.log2(e)),Rh=gn(Y(2)[0],e=>{const t=Math.min(Math.max(Th(e.period),4),65536),n=e.startAtBlock%t,r=Math.max(t>>12,1),s=Math.min(Math.max(Oh(t)-1,1),15),o=n/r<<4;return Ne[0](s|o)}),[Ph]=se({tip:he,asset:ht(Y(1/0))}),pa=new Uint8Array,es=Uint8Array.from([0]),ts=e=>({value:e,additionalSigned:pa}),ns=e=>({value:pa,additionalSigned:e}),rs=(e,t)=>({value:e,additionalSigned:t}),va=(e,t,n)=>{const r={};return t.metadata.extrinsic.signedExtensions.forEach(({identifier:s,type:o,additionalSigned:i})=>{r[s]=[o,i].map(a=>n.buildDefinition(a)[0])}),({mortality:s,tip:o=0n,nonce:i,customSignedExtensions:a={},...u})=>{const c=[],l=_h(t,n),v=d=>{const[p,h]=r[d],m=a[d];try{return Ut({value:p,additionalSigned:h},(y,b)=>{const g=m?.[b];return g instanceof Uint8Array?g:y(g)})}catch{return c.push(d),null}},f=Ut(r,([d,p],h)=>{if(a[h])return v(h);switch(h){case"CheckNonce":return ts(d(i));case"CheckMortality":return s.mortal?rs(Rh({period:s.period,startAtBlock:s.startAtBlock.height}),ue(s.startAtBlock.hash)):rs(es,e);case"ChargeTransactionPayment":return ts(d(o));case"ChargeAssetTxPayment":return ts(Ph({tip:o,asset:u.asset}));case"CheckGenesis":return ns(e);case"CheckMetadataHash":return rs(es,es);case"CheckSpecVersion":return ns(p(l.spec_version));case"CheckTxVersion":return ns(p(l.transaction_version));default:return v(h)}});return c.forEach(d=>{delete f[d]}),Ut(f,(d,p)=>({...d,identifier:p}))}},ma="AccountNonceApi_account_nonce",Uh={1:D.dec,2:Ne.dec,4:Ve.dec,8:Gt.dec},Mh=(e,t,n)=>e(n,ma,t).pipe(I(r=>{const s=ue(r),o=Uh[s.length];if(!o)throw new Error(`${ma} retrieved wrong data`);return o(s)})),Lh=(e,t,n,r,s,o={})=>zt([o.nonce?oe(o.nonce):Dh(e,Z(t.publicKey)),e.getRuntimeContext$(r.hash),e.genesis$]).pipe(fe(1),M(([i,a,u])=>{const c=va(ue(u),a.lookup,a.dynamicBuilder),l=o.mortality??{period:64,mortal:!0},v=c({nonce:i,tip:o.tip??0n,mortality:l.mortal?{mortal:!0,period:l.period,startAtBlock:{height:r.number,hash:r.hash}}:{mortal:!1},customSignedExtensions:s,asset:o.asset});return t.signTx(n,v,a.metadataRaw,r.number)})),Dh=(e,t)=>{const n=o=>e.newBlocks$.pipe(Kn((i,a)=>a.parent===i?a.hash:i,o),Ui(o),ve()),r=o=>n(o).pipe(fe(2),Nn(i=>Mh(e.call$,t,i))),s=o=>zt(o.map(i=>r(i).pipe(I(a=>({success:!0,value:a})),$e(a=>oe({success:!1,value:a}))))).pipe(fe(1));return e.pinnedBlocks$.pipe(Ue(o=>!o.recovering&&o.blocks.size>0),fe(1),I(({blocks:o,best:i})=>{const a=o.get(i);return[...o.values()].filter(u=>!u.unpinnable&&u.children.size===0&&u.number>=a.number).map(u=>u.hash)}),Nn(s),I(o=>{const i=o.reduce((a,u)=>u.success&&u.value>=(a??0)?u.value:a,null);if(i==null)throw o[0].value;return i}))};var Vh=Object.defineProperty,Hh=(e,t,n)=>t in e?Vh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fh=(e,t,n)=>Hh(e,t+"",n);const jh=(e,t)=>new U(n=>{const r=new Map;let s,o;const i=()=>{let u=s.best,c=r.get(u),l=s.blocks.get(u).number;for(;!c;){const d=s.blocks.get(u);if(!d)break;c=r.get(u=d.parent),l--}if(!c)return;const v=l<=s.blocks.get(s.finalized).number,f=c.found.type;if(f&&o?.found&&o.hash===c.hash){v&&n.complete();return}n.next(o=c.found.type?{found:f,hash:c.hash,number:l,index:c.found.index,events:c.found.events}:{found:f,validity:c.found.validity}),v&&(f?n.complete():c.found.validity?.success===!1&&n.error(new ss(c.found.validity.value)))},a=t.pipe(ve((u,c)=>u.finalized===c.finalized&&u.best===c.best)).subscribe({next:u=>{s=u,r.size!==0&&i()},error(u){n.error(u)}});return a.add(e.subscribe({next:u=>{r.set(u.hash,u),i()},error(u){n.error(u)}})),a}).pipe(ve((n,r)=>n===r)),zh=(e,t)=>{const n=e.filter(s=>s.phase.type==="ApplyExtrinsic"&&s.phase.value===t).map(s=>({...s.event,topics:s.topics})),r=n[n.length-1];return r.type==="System"&&r.value.type==="ExtrinsicFailed"?{ok:!1,events:n,dispatchError:r.value.value.dispatch_error}:{ok:!0,events:n}};class ss extends Error{constructor(t){super(JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r instanceof He?r.asHex():r,2)),Fh(this,"error"),this.name="InvalidTxError",this.error=t}}const os=(e,t,n,r=!1)=>e.hasher$.pipe(M(s=>{const o=s(ue(n)),i=(p,h)=>({type:p,txHash:o,...h}),a=e.pinnedBlocks$.state,u=p=>{if(!p.mortal)return 0;const{phase:h,period:m}=p,y=a.blocks.get(a.best).number;return Math.floor((Math.max(y,h)-h)/m)*m+h},c=p=>{let h=[...a.blocks.values()].filter(b=>!b.unpinnable&&!b.children.size);const m=Math.max(...h.map(({number:b})=>b));h=h.filter(({number:b})=>b>=m-1);const y=a.blocks.get(a.finalized);return h=y.children?[y,...h]:h,h.filter(b=>b.number>=p)},l=({hash:p})=>e.validateTx$(p,n),v=Wn(()=>a.finalizedRuntime.runtime.pipe(I(p=>p.getMortalityFromTx(n)),I(u),I(c),M(p=>{let h;return ln(...p.map(m=>ql(l(m),e.finalized$.pipe(Xn(y=>{if(y.number<m.number)return!0;let b=y;for(;b.number>m.number;){const g=a.blocks.get(b.parent);if(!g)return!1;b=g}return b.hash===y.hash}),Ri(),Pi({success:null}))))).pipe(Ue((m,y)=>{if(m.success===!1&&(h??(h=new ss(m.value))),m.success)return!0;if(y===p.length-1&&h)throw h;return!1}),fe(1))}),Ri())),f=new U(p=>{const h=e.trackTx$(n).subscribe(p);return h.add(t(n).subscribe({error(m){p.error(m)}})),h}),d=jh(f,e.pinnedBlocks$).pipe(I(p=>p.found?i("txBestBlocksState",{found:!0,block:{index:p.index,number:p.number,hash:p.hash},...zh(p.events,p.index)}):i("txBestBlocksState",{found:!1,isValid:p.validity?.success!==!1})));return zn(r?oe(i("signed",{})):mt,v,oe(i("broadcasted",{})),d.pipe(wh(({found:p,type:h,...m})=>p?oe(i("finalized",m)):mt)))})),ya=async(e,t,n,r)=>Ol(os(e,t,n)).then(s=>{if(s.type!=="finalized")throw null;const o={...s};return delete o.type,o}),Wh=kt().enc,qh=new Uint8Array(64),Kh=new Uint8Array(65),Nh=e=>()=>e?Kh:qh,[,Xh]=se({weight:se({ref_time:Cn,proof_size:Cn}),class:we({Normal:O,Operational:O,Mandatory:O}),partial_fee:ms}),ba=(e,t,n,r,{isCompatible:s,getCompatibilityLevel:o,compatibleRuntime$:i,argsAreCompatible:a,getRuntimeTypedef:u},c)=>Object.assign(l=>{const v=(w,k,E={})=>{const S=nr(w).runtime(),{dynamicBuilder:x,assetId:_,lookup:P}=S;let X;try{X=x.buildCall(e,t)}catch{throw new Error(`Runtime entry Tx(${e}.${t}) not found`)}if(c&&!a(w,S,k))throw new Error(`Incompatible runtime entry Tx(${e}.${t})`);let q=E;if(E.asset){if(_==null||!_r(E.asset,Un(P(_)),ae=>u(S,ae)))throw new Error("Incompatible runtime asset");q={...E,asset:x.buildDefinition(_).enc(E.asset)}}const{location:ie,codec:j}=X;return{callData:He.fromBytes(re([new Uint8Array(ie),j.enc(k)])),options:q}},f=(w,k={})=>i(n,null).pipe(I(([E])=>v(E,w,k))),d=w=>w?v(w,l).callData:We(f(l).pipe(I(k=>k.callData))),p=(w,{...k},E)=>f(l,k).pipe(M(({callData:S,options:x})=>Lh(n,w,S.asBytes(),E,k.customSignedExtensions||{},x))),h=(w,{at:k,...E}={})=>(!k||k==="finalized"?n.finalized$:k==="best"?n.best$:n.bestBlocks$.pipe(I(S=>S.find(x=>x.hash===k)))).pipe(fe(1),M(S=>S?p(w,E,S).pipe(I(x=>({tx:Z(x),block:S}))):Fn(()=>new Error(`Uknown block ${k}`)))),m=(w,k)=>We(h(w,k)).then(E=>E.tx),y=(w,k)=>We(h(w,k)).then(({tx:E,block:S})=>ya(n,r,E,S.hash)),b=(w,k)=>h(w,k).pipe(M(({tx:E})=>os(n,r,E,!0))),g=async(w,k)=>{typeof w=="string"&&(w=w.startsWith("0x")?ue(w):Wh(w));const E=w.length===20,S=Ch(w,E?"Ecdsa":"Sr25519",Nh(E)),x=ue(await m(S,k)),_=Z(re([x,Ve.enc(x.length)])),P=n.getRuntimeContext$(null).pipe(I(q=>{try{return q.dynamicBuilder.buildRuntimeCall("TransactionPaymentApi","query_info").value[1]}catch{return Xh}})),X=n.call$(null,"TransactionPaymentApi_query_info",_);return We(zt([X,P]).pipe(I(([q,ie])=>ie(q))))};return{getPaymentInfo:g,getEstimatedFees:async(w,k)=>(await g(w,k)).partial_fee,decodedCall:{type:e,value:$t(t,l)},getEncodedData:d,sign:m,signSubmitAndWatch:b,signAndSubmit:y}},{getCompatibilityLevel:o,isCompatible:s});var Yh=Object.defineProperty,Gh=(e,t,n)=>t in e?Yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ze=(e,t,n)=>(Gh(e,typeof t!="symbol"?t+"":t,n),n),is=Symbol("SUSPENSE"),Qh=class extends Promise{constructor(e){super(e)}},ga=class extends Error{constructor(){super(),this.name="NoSubscribersError"}},wa=class extends Error{constructor(){super(),this.name="EmptyObservableError"}},Ie={},sr=class extends U{constructor(e,t,n=Se){super(r=>{const s=new an({next:r.next.bind(r),error:r.error.bind(r),complete:Se});this.refCount++;let o;r.add(()=>{var i;this.refCount--,o.unsubscribe(),this.refCount===0&&(this.currentValue=Ie,this.subscription&&this.subscription.unsubscribe(),n(),(i=this.subject)==null||i.complete(),this.subject=null,this.subscription=null,this.promise&&(this.promise.rej(new ga),this.promise=null))}),this.subject?(o=this.subject.subscribe(s),this.currentValue!==Ie&&r.next(this.currentValue)):(this.subject=new ze,o=this.subject.subscribe(s),this.subscription=null,this.subscription=new an({next:i=>{this.promise&&i!==is&&(this.promise.res(i),this.promise=null),this.subject.next(this.currentValue=i)},error:i=>{var a;this.subscription=null;const u=this.subject;this.subject=null,this.currentValue=Ie;const c=(a=this.promise)==null?void 0:a.rej;c&&i===is&&(this.promise.rej=()=>{c(i)}),u.error(i),c&&this.promise&&(this.promise.rej=c)},complete:()=>{if(this.subscription=null,this.promise&&(this.promise.rej(new wa),this.promise=null),this.currentValue!==Ie)return this.subject.complete();if(t===Ie){const i=this.subject;return this.subject=null,i.error(new wa)}this.subject.next(this.currentValue=t),this.subject.complete()}}),e.subscribe(this.subscription),t!==Ie&&this.currentValue===Ie&&this.subject.next(this.currentValue=t))}),this.defaultValue=t,Ze(this,"subject",null),Ze(this,"subscription",null),Ze(this,"refCount",0),Ze(this,"currentValue",Ie),Ze(this,"promise",null),Ze(this,"pipeState",(...r)=>{const s=super.pipe(...r);return s instanceof sr?s:new sr(s,Ie)}),Ze(this,"getRefCount",()=>this.refCount),Ze(this,"getValue",()=>{if(this.promise)return this.promise.p;if(this.currentValue!==Ie&&this.currentValue!==is)return this.currentValue;if(this.defaultValue!==Ie)return this.defaultValue;if(this.refCount===0)throw new ga;const r=new Qh((s,o)=>{this.promise={res:s,rej:o,p:null}});return this.promise.p=r,r}),Ze(this,"getDefaultValue",()=>this.defaultValue),t===Ie&&delete this.getDefaultValue}};function xa(e,t){t.getValue=e.getValue,t.getRefCount=e.getRefCount,t.pipeState=e.pipeState,e.getDefaultValue&&(t.getDefaultValue=e.getDefaultValue)}function Zh(e,t){const n=new Jh,r=typeof t=="function"?t:()=>t,s=o=>{for(let v=o.length-1;o[v]===void 0&&v>-1;v--)o.splice(-1);const i=[o.length,...o],a=n.get(i);if(a!==void 0)return a;const u=new sr(e(...o),r(...o),()=>{n.delete(i)}),c=new U(v=>{const f=n.get(i);let d=u;return f?f!==c&&(d=f,xa(d,c)):n.set(i,l),d.subscribe(v)});xa(u,c);const l=c;return n.set(i,l),l};return(...o)=>s(o)}var Jh=class{constructor(){Ze(this,"root"),this.root=new Map}get(e){let t=this.root;for(let n=0;n<e.length;n++)if(t=t.get(e[n]),!t)return;return t}set(e,t){let n=this.root,r;for(r=0;r<e.length-1;r++){let s=n.get(e[r]);s||(s=new Map,n.set(e[r],s)),n=s}n.set(e[r],t)}delete(e){const t=[this.root];let n=this.root;for(let s=0;s<e.length-1;s++)t.push(n=n.get(e[s]));let r=t.length-1;for(t[r].delete(e[r]);--r>-1&&t[r].get(e[r]).size===0;)t[r].delete(e[r])}};function ed(e,t){return new sr(e,t)}var as=(...e)=>(typeof e[0]=="function"?Zh:ed)(e[0],e.length>1?e[1]:Ie);const Ea=(e,t,n)=>{const r=new Map(t.map(a=>[a.key,a])),s=new Map(e.map(a=>[a.key,a])),o=new Map,i=[];return t.forEach(a=>{const{key:u}=a,c=s.get(u);(!c||c.value!==a.value)&&o.set(u,n(a))}),e.forEach(a=>{r.has(a.key)||i.push(a)}),{deltas:{deleted:i,upserted:[...o.values()]},entries:t.map(({key:a})=>o.get(a)??s.get(a))}},ka=(e,t,n,r=!1)=>{try{let s=r?e:n.blocks.get(e).parent;for(;s&&!t[s];)s=n.blocks.get(s).parent;return s?t[s]:null}catch{return null}},Aa=(e,t)=>n=>{const{keys:r,value:s}=n.dynamicBuilder.buildStorage(e,t);return o=>(o.dec={value:s.dec(o.value),args:r.dec(o.key)},o)},td=(e,t,n)=>{const r=as((a,u,c)=>{const l=Aa(a,u),v=(m,y)=>{const b=hh(e,y.hash).pipe(Ue(g=>!g),fe(1));return t(y.hash,"closestDescendantMerkleValue",()=>c).pipe(M(g=>g===m?.rootHash?oe({...m,block:y,deltas:null,prev:m.block.hash}):t(y.hash,"descendantsValues",()=>c).pipe(n(()=>y.hash),I(([w,k])=>[w,l(k)]),I(([w,k])=>({prev:m&&m.block.hash,rootHash:g,block:y,...Ea(m?.entries??[],w,k)})))),Mi(b),$e(g=>g instanceof Qe?mt:Fn(()=>g)))},f=e.pipe(ve((m,y)=>m.finalized===y.finalized),Zr(({blocks:m,finalized:y})=>v(null,m.get(y))),fe(1),I(m=>({blocks:{[m.block.hash]:m},finalized:m.block.hash}))),[d,p]=xh(),h=e.pipe(ve((m,y)=>m.best===y.best),zr(d),Zr(([m,y])=>{const{best:b}=m,{blocks:g}=y;let w=g[b]?null:b;if(!w)return mt;const k=ka(w,g,m);return k?v(k,m.blocks.get(w)).pipe(I(E=>(g[w]=E,y))):(w=m.finalized,v(g[y.finalized],m.blocks.get(w)).pipe(I(E=>(E.prev=null,{blocks:{[w]:E},finalized:w}))))}));return ln(f,h).pipe(p())}),s=a=>(u,c,l)=>{const v=r(u,c,l),f=Aa(u,c),d=a?"finalized":"best";return zt([v.pipe(Zl(0)),e.pipe(ve((p,h)=>p[d]===h[d]))]).pipe(I(([p,h])=>ka(h[d],p.blocks,h,!0)),Ue(Boolean),ve(),Ui(null),nf(),zr(v),n(([[,p]])=>p.block.hash),I(([[[p,h],m],y])=>[p,h,m,f(y)]),M(([p,h,m,y])=>{if(!p)return[h];let b=h;const g=[];for(;b&&b.block.number>p.block.number;)g.unshift(b),b=b.prev?m.blocks[b.prev]:null;if(a&&(m.finalized=h.block.hash,g.length)){const{blocks:w}=m;Object.keys(w).forEach(k=>{w[k].block.number<g[0].block.number&&delete w[k]})}return p===b?g:[{...h,...p.rootHash===h.rootHash?{entries:p.entries,deltas:null}:Ea(p.entries,h.entries,y)}]}))},o=as(s(!0)),i=as(s(!1));return(a,u,c,l)=>{const v=l?i:o;return e.pipe(fe(1),M(f=>f.runtimes[f.blocks.get(f[l?"best":"finalized"]).runtime].runtime),I(f=>f.dynamicBuilder.buildStorage(a,u).keys.enc(...c))).pipe(fe(1),M(f=>v(a,u,f)),I(({block:{hash:f,number:d,parent:p},deltas:h,entries:m},y)=>{const b=y>0?h:{deleted:[],upserted:m};return{block:{hash:f,number:d,parent:p},entries:m.map(cs),deltas:b&&{deleted:b.deleted.map(cs),upserted:b.upserted.map(cs)}}}))}},cs=e=>e.dec,Sa="RuntimeViewFunction",$a="execute_view_function",us=Sa+"_"+$a,nd=(e,t,n,{isCompatible:r,getCompatibilityLevel:s,compatibleRuntime$:o,argsAreCompatible:i,valuesAreCompatible:a})=>{const u=()=>new Error(`Incompatible runtime entry ViewFn(${e}.${t})`);return Object.assign((...c)=>{const l=c[c.length-1],v=Nt(l),{signal:f,at:d}=v?l:{},p=d??null,h=o(n,p).pipe(M(([m,y])=>{let b;try{b=y.dynamicBuilder.buildRuntimeCall(Sa,$a)}catch{throw new Error(`Runtime entry RuntimeCall(${us}) not found`)}let g;try{g=y.dynamicBuilder.buildViewFn(e,t)}catch{throw new Error(`Runtime entry ViewFn(${e}.${t}) not found`)}if(!i(m,y,c))throw u();const w=g.args.enc(c),k=re([ue(y.lookup.metadata.pallets.find(({name:E})=>E===e).viewFns.find(({name:E})=>E===t).id),C.enc(w.length),w]);return n.call$(p,us,Z(k)).pipe(I(E=>{try{const S=b.value.dec(E);if(!("success"in S&&"value"in S)||!("type"in S.value)&&!("asBytes"in S.value))throw null;return S}catch{throw new Error(`Unexpected RuntimeCall(${us}) type`)}}),I(({success:E,value:S})=>{if(!E)throw new Error(`ViewFn API Error: ${S.type}`);const x=g.value.dec(S.asBytes());if(!a(m,y,x))throw u();return x}))}),n.withHodl(p));return Kt(h,f)},{getCompatibilityLevel:s,isCompatible:r})},rd=/^(?:0x)?((?:[0-9a-fA-F][0-9a-fA-F])+)$/,Ia=(e,t,n)=>{const r={},s=m=>new Proxy(r,{get(y,b){return m(b)}}),o=m=>{const y={};return s(b=>(y[b]||(y[b]={}),s(g=>(y[b][g]||(y[b][g]=m(b,g)),y[b][g]))))},i=(m,y)=>m.lookup.metadata.pallets.find(b=>b.name===y),a=td(t.pinnedBlocks$,t.storage$,t.withRuntime),u=o((m,y)=>Ah(m,y,t,a,Rt(e,b=>b.getEntryPoint(wt.Storage,m,y),b=>{const g=i(b,m)?.storage?.items.find(w=>w.name===y);return g==null?null:Yu(g)}))),c=(m,y,b,g)=>{if(b==null)return null;const w=m.lookup(b);if(w.type!=="enum")throw new Error("Expected enum");if(w.value[g]==null)return null;const k=Gu(w.value[g]);return{args:y==="args"?k:Ln,values:y==="args"?Ln:k}},l=o((m,y)=>ba(m,y,t,n,Rt(e,b=>b.getEntryPoint(wt.Tx,m,y),b=>c(b,"args",i(b,m)?.calls?.type,y)),!0)),v=o((m,y)=>Eh(m,y,t,Rt(e,b=>b.getEntryPoint(wt.Event,m,y),b=>c(b,"values",i(b,m)?.events?.type,y)))),f=o((m,y)=>bh(m,y,Rt(e,b=>b.getEntryPoint(wt.Const,m,y),b=>{const g=i(b,m)?.constants.find(w=>w.name===y)?.type;return g==null?null:Qu(g)}))),d=o((m,y)=>kh(m,y,t,Rt(e,b=>b.getEntryPoint(wt.Api,m,y),b=>Jo(b.lookup.metadata.apis.find(g=>g.name===m).methods.find(g=>g.name===y))))),p=o((m,y)=>nd(m,y,t,Rt(e,b=>b.getEntryPoint(wt.ViewFns,m,y),b=>Jo(b.lookup.metadata.pallets.find(g=>g.name===m).viewFns.find(g=>g.name===y))))),h=(m,y)=>{const{lookup:b,dynamicBuilder:g}=nr(y).runtime();try{const w=g.buildDefinition(b.call).dec(m.asBytes()),k=w.type,E=w.value.type,S=w.value.value;return ba(k,E,t,n,Rt(e,x=>x.getEntryPoint(wt.Tx,k,E),x=>c(x,"args",i(x,k)?.calls?.type,E)),!1)(S)}catch{throw new Error("createTx: invalid call data")}};return{query:u,txFromCallData:(m,y)=>y?h(m,y):e.then(b=>h(m,b)),tx:l,event:v,apis:d,constants:f,view:p}};function sd(e,{getMetadata:t,setMetadata:n}={}){const r=Af(e),s=fh(r,{getMetadata:t?b=>bt(t(b)):void 0,setMetadata:n}),{getChainSpecData:o}=r,{genesis$:i,...a}=s.chainHead$(),u=s.archive(a.getRuntime$),c={...a,genesis$:Wn(o).pipe(I(({genesisHash:b})=>b),$e(()=>i),hn(1)),storage$:Ot(a.storage$,u.storage$),body$:Ot(a.body$,u.body$),call$:Ot(a.call$,u.call$),header$:Ot(a.header$,u.header$),eventsAt$:Ot(a.eventsAt$,u.eventsAt$),storageQueries$:Ot(a.storageQueries$,u.storageQueries$),getRuntimeContext$:Ot(a.getRuntimeContext$,u.getRuntimeContext$)},l=r.request;let v;const f=new WeakMap,d=b=>{const g=f.get(b)||mh(b,c);return f.set(b,g),g},p=()=>v??(v=yh(c)),{broadcastTx$:h}=s,m=b=>c.getRuntimeContext$(b).pipe(I(g=>g.metadataRaw)),y={getChainSpecData:o,getMetadata$:m,getMetadata:(b,g)=>Kt(m(b),g),blocks$:c.newBlocks$,hodlBlock:b=>c.holdBlock(b,!0),finalizedBlock$:c.finalized$,getFinalizedBlock:()=>We(c.finalized$),bestBlocks$:c.bestBlocks$,getBestBlocks:()=>We(c.bestBlocks$),watchBlockBody:c.body$,getBlockBody:b=>We(c.body$(b)),getBlockHeader:b=>We(c.header$(b??null)),submit:(...b)=>ya(c,h,...b),submitAndWatch:b=>os(c,h,b),getTypedApi:b=>{const g=d(b);return Object.assign(Ia(g,c,h),{compatibilityToken:g})},getUnsafeApi:()=>{const b=p();return Object.assign(Ia(b,c,h),{runtimeToken:b})},rawQuery:(b,{at:g,signal:w}={})=>Kt(c.storage$(g??null,"value",()=>{const k=b.match(rd)?.[1];return k?`0x${k}`:He.fromText(b).asHex()}),w),destroy:()=>{c.unfollow(),s.destroy()},_request:l};return y.___INTERNAL_DO_NOT_USE=c,y}const od=(e,t,n,r,s)=>{let o;try{o=r.buildCall(e,t)}catch{throw new Error(`Runtime entry Tx(${e}.${t}) not found`)}const{location:i,codec:a}=o,u=new Uint8Array(i);return c=>{const l=He.fromBytes(re([u,a.enc(c)]));return{encodedData:l,decodedCall:$t(e,$t(t,c)),sign:async(v,f)=>Z(await v.signTx(l.asBytes(),s(f),n,f.mortality.mortal?f.mortality.startAtBlock.height:0))}}},id=async({genesis:e,getMetadata:t})=>{if(!e)throw new Error("Missing genesis hash");const n=ue(e),r=await t(),s=Lt(dt.dec(r)),o=Jn(s),i=Nr(o),a=va(n,o,i),u=p=>s.pallets.find(h=>h.name===p),c={},l=p=>new Proxy(c,{get(h,m){return p(m)}}),v=p=>{const h={};return l(m=>(h[m]||(h[m]={}),l(y=>(h[m][y]||(h[m][y]=p(m,y)),h[m][y]))))},f=v((p,h)=>{const m=u(p)?.constants.find(y=>y.name===h);if(!m)throw new Error(`Runtime entry Constant(${p}.${h}) not found`);return i.buildConstant(p,h).dec(m.value)}),d=v((p,h)=>od(p,h,r,i,a));return{constants:f,tx:d}},Xt=(e,t)=>(n,r)=>{try{return e(n,r)}catch{throw new Error(`Runtime entry ${t}(${n}.${r}) not found`)}},ad=async e=>{const t=Lt(Sr(await e.getMetadata())),n={},r=f=>new Proxy(n,{get(d,p){return f(p)}}),s=f=>{const d={};return r(p=>(d[p]||(d[p]={}),r(h=>(d[p][h]||(d[p][h]=f(p,h)),d[p][h]))))},o=Jn(t),{buildRuntimeCall:i,buildStorage:a,buildConstant:u,buildCall:c,buildEvent:l,buildViewFn:v}=Nr(o);return{query:s((...f)=>{const{value:d,args:p}=Xt(a,"Storage")(...f);return{value:d,args:p}}),tx:s((...f)=>Xt(c,"Call")(...f).codec),event:s((...f)=>Xt(l,"Event")(...f).codec),apis:s(Xt(i,"Runtime API")),constants:s(Xt(u,"Constant")),view:s(Xt(v,"ViewFn"))}};ce.AccountId=kt,ce.Binary=He,ce.BlockNotPinnedError=Qe,ce.CompatibilityLevel=Te,ce.Enum=$t,ce.FixedSizeBinary=Bn,ce.InvalidTxError=ss,ce._Enum=ao,ce.createClient=sd,ce.getOfflineApi=id,ce.getSs58AddressInfo=hr,ce.getTypedCodecs=ad}));
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function Dn(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ct=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,s,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=Ht(i),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this)}}catch(h){t={error:h}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else i.remove(this);var l=this.initialTeardown;if(N(l))try{l()}catch(h){o=h instanceof Lr?h.errors:[h]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var f=Ht(v),d=f.next();!d.done;d=f.next()){var p=d.value;try{si(p)}catch(h){o=o??[],h instanceof Lr?o=Pe(Pe([],Re(o)),Re(h.errors)):o.push(h)}}}catch(h){r={error:h}}finally{try{d&&!d.done&&(s=f.return)&&s.call(f)}finally{if(r)throw r.error}}}if(o)throw new Lr(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)si(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Dn(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Dn(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),ni=Ct.EMPTY;function ri(e){return e instanceof Ct||e&&"closed"in e&&N(e.remove)&&N(e.add)&&N(e.unsubscribe)}function si(e){N(e)?e():e.unsubscribe()}var nl={Promise:void 0},rl={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Pe([e,t],Re(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function oi(e){rl.setTimeout(function(){throw e})}function Se(){}function Vn(e){e()}var an=(function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ri(n)&&n.add(r)):r.destination=il,r}return t.create=function(n,r,s){return new jt(n,r,s)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(Ct),sl=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){Hn(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){Hn(r)}else Hn(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){Hn(n)}},e})(),jt=(function(e){Ye(t,e);function t(n,r,s){var o=e.call(this)||this,i;return N(n)||!n?i={next:n??void 0,error:r??void 0,complete:s??void 0}:i=n,o.destination=new sl(i),o}return t})(an);function Hn(e){oi(e)}function ol(e){throw e}var il={closed:!0,next:Se,error:ol,complete:Se},Dr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ge(e){return e}function ii(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ai(e)}function ai(e){return e.length===0?Ge:e.length===1?e[0]:function(n){return e.reduce(function(r,s){return s(r)},n)}}var U=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var s=this,o=cl(t)?t:new jt(t,n,r);return Vn(function(){var i=s,a=i.operator,u=i.source;o.add(a?a.call(o,u):u?s._subscribe(o):s._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=ci(n),new n(function(s,o){var i=new jt({next:function(a){try{t(a)}catch(u){o(u),i.unsubscribe()}},error:o,complete:s});r.subscribe(i)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[Dr]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return ai(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=ci(t),new t(function(r,s){var o;n.subscribe(function(i){return o=i},function(i){return s(i)},function(){return r(o)})})},e.create=function(t){return new e(t)},e})();function ci(e){var t;return(t=e??nl.Promise)!==null&&t!==void 0?t:Promise}function al(e){return e&&N(e.next)&&N(e.error)&&N(e.complete)}function cl(e){return e&&e instanceof an||al(e)&&ri(e)}function ul(e){return N(e?.lift)}function Q(e){return function(t){if(ul(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function K(e,t,n,r,s){return new ll(e,t,n,r,s)}var ll=(function(e){Ye(t,e);function t(n,r,s,o,i,a){var u=e.call(this,n)||this;return u.onFinalize=i,u.shouldUnsubscribe=a,u._next=r?function(c){try{r(c)}catch(l){n.error(l)}}:e.prototype._next,u._error=o?function(c){try{o(c)}catch(l){n.error(l)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=s?function(){try{s()}catch(c){n.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t})(an),fl=Mr(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ze=(function(e){Ye(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new ui(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new fl},t.prototype.next=function(n){var r=this;Vn(function(){var s,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=Ht(r.currentObservers),a=i.next();!a.done;a=i.next()){var u=a.value;u.next(n)}}catch(c){s={error:c}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(s)throw s.error}}}})},t.prototype.error=function(n){var r=this;Vn(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var s=r.observers;s.length;)s.shift().error(n)}})},t.prototype.complete=function(){var n=this;Vn(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,s=this,o=s.hasError,i=s.isStopped,a=s.observers;return o||i?ni:(this.currentObservers=null,a.push(n),new Ct(function(){r.currentObservers=null,Dn(a,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,s=r.hasError,o=r.thrownError,i=r.isStopped;s?n.error(o):i&&n.complete()},t.prototype.asObservable=function(){var n=new U;return n.source=this,n},t.create=function(n,r){return new ui(n,r)},t})(U),ui=(function(e){Ye(t,e);function t(n,r){var s=e.call(this)||this;return s.destination=n,s.source=r,s}return t.prototype.next=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,n)},t.prototype.error=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&s!==void 0?s:ni},t})(ze),hl=(function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return r._value=n,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(n){var r=e.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},t.prototype.getValue=function(){var n=this,r=n.hasError,s=n.thrownError,o=n._value;if(r)throw s;return this._throwIfClosed(),o},t.prototype.next=function(n){e.prototype.next.call(this,this._value=n)},t})(ze),Vr={now:function(){return(Vr.delegate||Date).now()},delegate:void 0},cn=(function(e){Ye(t,e);function t(n,r,s){n===void 0&&(n=1/0),r===void 0&&(r=1/0),s===void 0&&(s=Vr);var o=e.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=s,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return t.prototype.next=function(n){var r=this,s=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,a=r._timestampProvider,u=r._windowTime;s||(o.push(n),!i&&o.push(a.now()+u)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),s=this,o=s._infiniteTimeWindow,i=s._buffer,a=i.slice(),u=0;u<a.length&&!n.closed;u+=o?1:2)n.next(a[u]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,s=n._timestampProvider,o=n._buffer,i=n._infiniteTimeWindow,a=(i?1:2)*r;if(r<1/0&&a<o.length&&o.splice(0,o.length-a),!i){for(var u=s.now(),c=0,l=1;l<o.length&&o[l]<=u;l+=2)c=l;c&&o.splice(0,c+1)}},t})(ze),dl=(function(e){Ye(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t})(Ct),li={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,Pe([e,t],Re(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},pl=(function(e){Ye(t,e);function t(n,r){var s=e.call(this,n,r)||this;return s.scheduler=n,s.work=r,s.pending=!1,s}return t.prototype.schedule=function(n,r){var s;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var o=this.id,i=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(i,o,r)),this.pending=!0,this.delay=r,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(i,this.id,r),this},t.prototype.requestAsyncId=function(n,r,s){return s===void 0&&(s=0),li.setInterval(n.flush.bind(n,this),s)},t.prototype.recycleAsyncId=function(n,r,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return r;r!=null&&li.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(n,r);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var s=!1,o;try{this.work(n)}catch(i){s=!0,o=i||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),o},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,s=n.scheduler,o=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Dn(o,this),r!=null&&(this.id=this.recycleAsyncId(s,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t})(dl),fi=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=Vr.now,e})(),vl=(function(e){Ye(t,e);function t(n,r){r===void 0&&(r=fi.now);var s=e.call(this,n,r)||this;return s.actions=[],s._active=!1,s}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var s;this._active=!0;do if(s=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,s){for(;n=r.shift();)n.unsubscribe();throw s}},t})(fi),hi=new vl(pl),ml=hi,mt=new U(function(e){return e.complete()});function di(e){return e&&N(e.schedule)}function Hr(e){return e[e.length-1]}function Fr(e){return N(Hr(e))?e.pop():void 0}function un(e){return di(Hr(e))?e.pop():void 0}function yl(e,t){return typeof Hr(e)=="number"?e.pop():t}var pi=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function vi(e){return N(e?.then)}function mi(e){return N(e[Dr])}function yi(e){return Symbol.asyncIterator&&N(e?.[Symbol.asyncIterator])}function bi(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function bl(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var gi=bl();function wi(e){return N(e?.[gi])}function xi(e){return el(this,arguments,function(){var n,r,s,o;return ti(this,function(i){switch(i.label){case 0:n=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Ft(n.read())];case 3:return r=i.sent(),s=r.value,o=r.done,o?[4,Ft(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Ft(s)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Ei(e){return N(e?.getReader)}function ne(e){if(e instanceof U)return e;if(e!=null){if(mi(e))return gl(e);if(pi(e))return wl(e);if(vi(e))return xl(e);if(yi(e))return ki(e);if(wi(e))return El(e);if(Ei(e))return kl(e)}throw bi(e)}function gl(e){return new U(function(t){var n=e[Dr]();if(N(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function wl(e){return new U(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function xl(e){return new U(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,oi)})}function El(e){return new U(function(t){var n,r;try{for(var s=Ht(e),o=s.next();!o.done;o=s.next()){var i=o.value;if(t.next(i),t.closed)return}}catch(a){n={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}t.complete()})}function ki(e){return new U(function(t){Al(e,t).catch(function(n){return t.error(n)})})}function kl(e){return ki(xi(e))}function Al(e,t){var n,r,s,o;return Ju(this,void 0,void 0,function(){var i,a;return ti(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=tl(e),u.label=1;case 1:return[4,n.next()];case 2:if(r=u.sent(),!!r.done)return[3,4];if(i=r.value,t.next(i),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),s={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function yt(e,t,n,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){n(),s?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!s)return o}function Ai(e,t){return t===void 0&&(t=0),Q(function(n,r){n.subscribe(K(r,function(s){return yt(r,e,function(){return r.next(s)},t)},function(){return yt(r,e,function(){return r.complete()},t)},function(s){return yt(r,e,function(){return r.error(s)},t)}))})}function Si(e,t){return t===void 0&&(t=0),Q(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function Sl(e,t){return ne(e).pipe(Si(t),Ai(t))}function $l(e,t){return ne(e).pipe(Si(t),Ai(t))}function Il(e,t){return new U(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function Bl(e,t){return new U(function(n){var r;return yt(n,t,function(){r=e[gi](),yt(n,t,function(){var s,o,i;try{s=r.next(),o=s.value,i=s.done}catch(a){n.error(a);return}i?n.complete():n.next(o)},0,!0)}),function(){return N(r?.return)&&r.return()}})}function $i(e,t){if(!e)throw new Error("Iterable cannot be null");return new U(function(n){yt(n,t,function(){var r=e[Symbol.asyncIterator]();yt(n,t,function(){r.next().then(function(s){s.done?n.complete():n.next(s.value)})},0,!0)})})}function Cl(e,t){return $i(xi(e),t)}function _l(e,t){if(e!=null){if(mi(e))return Sl(e,t);if(pi(e))return Il(e,t);if(vi(e))return $l(e,t);if(yi(e))return $i(e,t);if(wi(e))return Bl(e,t);if(Ei(e))return Cl(e,t)}throw bi(e)}function bt(e,t){return t?_l(e,t):ne(e)}function oe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e);return bt(e,n)}function Fn(e,t){var n=N(e)?e:function(){return e},r=function(s){return s.error(n())};return new U(r)}var Ii=Mr(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Ol(e,t){return new Promise(function(n,r){var s=!1,o;e.subscribe({next:function(i){o=i,s=!0},error:r,complete:function(){s?n(o):r(new Ii)}})})}function We(e,t){return new Promise(function(n,r){var s=new jt({next:function(o){n(o),s.unsubscribe()},error:r,complete:function(){r(new Ii)}});e.subscribe(s)})}function Tl(e){return e instanceof Date&&!isNaN(e)}function I(e,t){return Q(function(n,r){var s=0;n.subscribe(K(r,function(o){r.next(e.call(t,o,s++))}))})}var Rl=Array.isArray;function Pl(e,t){return Rl(t)?e.apply(void 0,Pe([],Re(t))):e(t)}function Bi(e){return I(function(t){return Pl(e,t)})}var Ul=Array.isArray,Ml=Object.getPrototypeOf,Ll=Object.prototype,Dl=Object.keys;function Vl(e){if(e.length===1){var t=e[0];if(Ul(t))return{args:t,keys:null};if(Hl(t)){var n=Dl(t);return{args:n.map(function(r){return t[r]}),keys:n}}}return{args:e,keys:null}}function Hl(e){return e&&typeof e=="object"&&Ml(e)===Ll}function Fl(e,t){return e.reduce(function(n,r,s){return n[r]=t[s],n},{})}function zt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e),r=Fr(e),s=Vl(e),o=s.args,i=s.keys;if(o.length===0)return bt([],n);var a=new U(Ci(o,n,i?function(u){return Fl(i,u)}:Ge));return r?a.pipe(Bi(r)):a}function Ci(e,t,n){return n===void 0&&(n=Ge),function(r){_i(t,function(){for(var s=e.length,o=new Array(s),i=s,a=s,u=function(l){_i(t,function(){var v=bt(e[l],t),f=!1;v.subscribe(K(r,function(d){o[l]=d,f||(f=!0,a--),a||r.next(n(o.slice()))},function(){--i||r.complete()}))},r)},c=0;c<s;c++)u(c)},r)}}function _i(e,t,n){e?yt(n,e,t):t()}function jl(e,t,n,r,s,o,i,a){var u=[],c=0,l=0,v=!1,f=function(){v&&!u.length&&!c&&t.complete()},d=function(h){return c<r?p(h):u.push(h)},p=function(h){c++;var m=!1;ne(n(h,l++)).subscribe(K(t,function(y){t.next(y)},function(){m=!0},void 0,function(){if(m)try{c--;for(var y=function(){var b=u.shift();i||p(b)};u.length&&c<r;)y();f()}catch(b){t.error(b)}}))};return e.subscribe(K(t,d,function(){v=!0,f()})),function(){}}function M(e,t,n){return n===void 0&&(n=1/0),N(t)?M(function(r,s){return I(function(o,i){return t(r,o,s,i)})(ne(e(r,s)))},n):(typeof t=="number"&&(n=t),Q(function(r,s){return jl(r,s,e,n)}))}function jn(e){return e===void 0&&(e=1/0),M(Ge,e)}function zl(){return jn(1)}function zn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return zl()(bt(e,un(e)))}function Wn(e){return new U(function(t){ne(e()).subscribe(t)})}function qn(e,t,n){e===void 0&&(e=0),n===void 0&&(n=ml);var r=-1;return t!=null&&(di(t)?n=t:r=t),new U(function(s){var o=Tl(e)?+e-n.now():e;o<0&&(o=0);var i=0;return n.schedule(function(){s.closed||(s.next(i++),0<=r?this.schedule(void 0,r):s.complete())},o)})}function ln(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e),r=yl(e,1/0),s=e;return s.length?s.length===1?ne(s[0]):jn(r)(bt(s,n)):mt}var Wl=Array.isArray;function Oi(e){return e.length===1&&Wl(e[0])?e[0]:e}function Ue(e,t){return Q(function(n,r){var s=0;n.subscribe(K(r,function(o){return e.call(t,o,s++)&&r.next(o)}))})}function ql(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e=Oi(e),e.length===1?ne(e[0]):new U(Kl(e))}function Kl(e){return function(t){for(var n=[],r=function(o){n.push(ne(e[o]).subscribe(K(t,function(i){if(n){for(var a=0;a<n.length;a++)a!==o&&n[a].unsubscribe();n=null}t.next(i)})))},s=0;n&&!t.closed&&s<e.length;s++)r(s)}}function $e(e){return Q(function(t,n){var r=null,s=!1,o;r=t.subscribe(K(n,void 0,void 0,function(i){o=ne(e(i,$e(e)(t))),r?(r.unsubscribe(),r=null,o.subscribe(n)):s=!0})),s&&(r.unsubscribe(),r=null,o.subscribe(n))})}function Nl(e,t,n,r,s){return function(o,i){var a=n,u=t,c=0;o.subscribe(K(i,function(l){var v=c++;u=a?e(u,l,v):(a=!0,l),i.next(u)},s))}}function Ti(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fr(e);return n?ii(Ti.apply(void 0,Pe([],Re(e))),Bi(n)):Q(function(r,s){Ci(Pe([r],Re(Oi(e))))(s)})}function Xl(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ti.apply(void 0,Pe([],Re(e)))}function Yl(e,t){return N(t)?M(e,t,1):M(e,1)}function fe(e){return e<=0?function(){return mt}:Q(function(t,n){var r=0;t.subscribe(K(n,function(s){++r<=e&&(n.next(s),e<=r&&n.complete())}))})}function Ri(){return Q(function(e,t){e.subscribe(K(t,Se))})}function Gl(e){return I(function(){return e})}function Ql(e,t){return M(function(n,r){return ne(e(n,r)).pipe(fe(1),Gl(n))})}function Zl(e,t){t===void 0&&(t=hi);var n=qn(e,t);return Ql(function(){return n})}function Jl(e,t){return Q(function(n,r){var s=new Set;n.subscribe(K(r,function(o){var i=e?e(o):o;s.has(i)||(s.add(i),r.next(o))})),t&&ne(t).subscribe(K(r,function(){return s.clear()},Se))})}function ve(e,t){return t===void 0&&(t=Ge),e=e??ef,Q(function(n,r){var s,o=!0;n.subscribe(K(r,function(i){var a=t(i);(o||!e(s,a))&&(o=!1,s=a,r.next(i))}))})}function ef(e,t){return e===t}function Pi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(n){return zn(n,oe.apply(void 0,Pe([],Re(e))))}}function tf(e,t){return Q(function(n,r){var s=0,o=null,i=!1;n.subscribe(K(r,function(a){o||(o=K(r,void 0,function(){o=null,i&&r.complete()}),ne(e(a,s++)).subscribe(o))},function(){i=!0,!o&&r.complete()}))})}function nf(){return Q(function(e,t){var n,r=!1;e.subscribe(K(t,function(s){var o=n;n=s,r&&t.next([o,s]),r=!0}))})}function Kn(e,t){return Q(Nl(e,t,arguments.length>=2,!0))}function fn(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new ze}:t,r=e.resetOnError,s=r===void 0?!0:r,o=e.resetOnComplete,i=o===void 0?!0:o,a=e.resetOnRefCountZero,u=a===void 0?!0:a;return function(c){var l,v,f,d=0,p=!1,h=!1,m=function(){v?.unsubscribe(),v=void 0},y=function(){m(),l=f=void 0,p=h=!1},b=function(){var g=l;y(),g?.unsubscribe()};return Q(function(g,w){d++,!h&&!p&&m();var k=f=f??n();w.add(function(){d--,d===0&&!h&&!p&&(v=jr(b,u))}),k.subscribe(w),!l&&d>0&&(l=new jt({next:function(E){return k.next(E)},error:function(E){h=!0,m(),v=jr(y,s,E),k.error(E)},complete:function(){p=!0,m(),v=jr(y,i),k.complete()}}),ne(g).subscribe(l))})(c)}}function jr(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var s=new jt({next:function(){s.unsubscribe(),e()}});return ne(t.apply(void 0,Pe([],Re(n)))).subscribe(s)}}function hn(e,t,n){var r,s,o,i,a=!1;return e&&typeof e=="object"?(r=e.bufferSize,i=r===void 0?1/0:r,s=e.windowTime,t=s===void 0?1/0:s,o=e.refCount,a=o===void 0?!1:o,n=e.scheduler):i=e??1/0,fn({connector:function(){return new cn(i,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function Ui(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=un(e);return Q(function(r,s){(n?zn(e,r,n):zn(e,r)).subscribe(s)})}function Nn(e,t){return Q(function(n,r){var s=null,o=0,i=!1,a=function(){return i&&!s&&r.complete()};n.subscribe(K(r,function(u){s?.unsubscribe();var c=0,l=o++;ne(e(u,l)).subscribe(s=K(r,function(v){return r.next(t?t(u,v,l,c++):v)},function(){s=null,a()}))},function(){i=!0,a()}))})}function rf(){return Nn(Ge)}function Mi(e){return Q(function(t,n){ne(e).subscribe(K(n,function(){return n.complete()},Se)),!n.closed&&t.subscribe(n)})}function Xn(e,t){return t===void 0&&(t=!1),Q(function(n,r){var s=0;n.subscribe(K(r,function(o){var i=e(o,s++);(i||t)&&r.next(o),!i&&r.complete()}))})}function dn(e,t,n){var r=N(e)||t||n?{next:e,error:t,complete:n}:e;return r?Q(function(s,o){var i;(i=r.subscribe)===null||i===void 0||i.call(r);var a=!0;s.subscribe(K(o,function(u){var c;(c=r.next)===null||c===void 0||c.call(r,u),o.next(u)},function(){var u;a=!1,(u=r.complete)===null||u===void 0||u.call(r),o.complete()},function(u){var c;a=!1,(c=r.error)===null||c===void 0||c.call(r,u),o.error(u)},function(){var u,c;a&&((u=r.unsubscribe)===null||u===void 0||u.call(r)),(c=r.finalize)===null||c===void 0||c.call(r)}))}):Ge}function zr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fr(e);return Q(function(r,s){for(var o=e.length,i=new Array(o),a=e.map(function(){return!1}),u=!1,c=function(v){ne(e[v]).subscribe(K(s,function(f){i[v]=f,!u&&!a[v]&&(a[v]=!0,(u=a.every(Ge))&&(a=null))},Se))},l=0;l<o;l++)c(l);r.subscribe(K(s,function(v){if(u){var f=Pe([v],Re(i));s.next(n?n.apply(void 0,Pe([],Re(f))):f)}}))})}var sf=Object.defineProperty,of=(e,t,n)=>t in e?sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t,n)=>of(e,typeof t!="symbol"?t+"":t,n);class Di extends Error{constructor(t){super(t.message),Li(this,"code"),Li(this,"data"),this.code=t.code,this.data=t.data,this.name="RpcError"}}const Vi=()=>{const e=new Map;return{has:e.has.bind(e),subscribe(t,n){e.set(t,n)},unsubscribe(t){e.delete(t)},next(t,n){e.get(t)?.next(n)},error(t,n){const r=e.get(t);r&&(e.delete(t),r.error(n))},errorAll(t){const n=[...e.values()];e.clear(),n.forEach(r=>{r.error(t)})}}};class Wr extends Error{constructor(){super("Client destroyed"),this.name="DestroyedError"}}let af=1;const cf=e=>{let t=af++;const n=new Map,r=Vi();let s=null;const o=(l,v,f)=>{s.send(JSON.stringify({jsonrpc:"2.0",id:l,method:v,params:f}))};function i(l){try{let v,f,d,p,h;if({id:v,result:f,error:d,params:p}=JSON.parse(l),v===null)throw new Error(p?.error?.message??"id null");if(v!=null){const b=n.get(v);return b?(n.delete(v),d?b.onError(new Di(d)):b.onSuccess(f,(g,w)=>{const k=g;return r.subscribe(k,w),()=>{r.unsubscribe(k)}})):void 0}if({subscription:h,result:f,error:d}=p,!h||!d&&!Object.hasOwn(p,"result"))throw 0;const y=h;d?r.error(y,new Di(d)):r.next(y,f)}catch(v){console.warn("Error parsing incomming message: "+l),console.error(v)}}s=e(i);const a=()=>{s?.disconnect(),s=null,r.errorAll(new Wr),n.forEach(l=>l.onError(new Wr)),n.clear()};let u=1;return{request:(l,v,f)=>{if(!s)throw new Error("Not connected");const d=`${t}-${u++}`;return f&&n.set(d,f),o(d,l,v),()=>{n.delete(d)}},disconnect:a}};class Hi extends Error{constructor(){super("ChainHead stopped"),this.name="StopError"}}class Yn extends Error{constructor(){super("ChainHead disjointed"),this.name="DisjointError"}}class Gn extends Error{constructor(){super("ChainHead operations limit reached"),this.name="OperationLimitError"}}class Fi extends Error{constructor(t){super(t),this.name="OperationError"}}class Qn extends Error{constructor(){super("ChainHead operation inaccessible"),this.name="OperationInaccessibleError"}}const Me={body:"",call:"",continue:"",follow:"",header:"",stopOperation:"",storage:"",unfollow:"",unpin:"",followEvent:""},Zn={chainName:"",genesisHash:"",properties:""},qr={broadcast:"",stop:""};Object.entries({chainHead:Me,chainSpec:Zn,transaction:qr}).forEach(([e,t])=>{Object.keys(t).forEach(n=>{t[n]=`${e}_v1_${n}`})});class ji extends Error{constructor(t){super(`Invalid BlockHash: ${t}`),this.name="BlockHashNotFoundError"}}class uf extends Error{constructor(t){super(`Storage Error: ${t}`),this.name="StorageError"}}class lf extends Error{constructor(t){super(`Call Error: ${t}`),this.name="CallError"}}const Wt=()=>{},ff=e=>(t,n)=>{let r=!1,s=()=>{r=!0};return e(qr.broadcast,[t],{onSuccess:o=>{o!==null?(s=()=>{e(qr.stop,[o]),s=Wt},r&&s()):r||n(new Error("Max # of broadcasted transactions has been reached"))},onError:n}),()=>{s()}};function hf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),res:e,rej:t}}const qt=e=>(...t)=>new Promise((n,r)=>{let s=At;const[o,i]=t[t.length-1]instanceof AbortSignal?[t.slice(0,t.length-1),t[t.length-1]]:[t],a=()=>{s(),r(new Qs)};i?.addEventListener("abort",a,{once:!0});const u=c=>l=>{s=At,i?.removeEventListener("abort",a),c(l)};s=e(u(n),u(r),...o)}),zi=(e,t)=>n=>qt((r,s,...o)=>{let i=!0,a=()=>{i=!1};const[u,c]=t(...o);return n(e,u,{onSuccess:(l,v)=>{if(l.result==="limitReached")return s(new Gn);const{operationId:f}=l,d=()=>{n(Me.stopOperation,[f])};if(!i)return d();let p=Wt;const h=y=>{i=!1,p(),r(y)},m=y=>{i=!1,p(),s(y)};p=v(f,{next:y=>{const b=y;b.event==="operationError"?s(new Fi(b.error)):b.event==="operationInaccessible"?s(new Qn):c(y,h,m)},error:m}),a=()=>{i&&(p(),d())}},onError:s}),()=>{a()}}),df=zi(Me.body,e=>[[e],(t,n)=>{n(t.value)}]),pf=zi(Me.call,(e,t,n)=>[[e,t,n],(r,s)=>{s(r.output)}]),vf=e=>t=>new Promise((n,r)=>{e(Me.header,[t],{onSuccess:n,onError:r})}),Wi=e=>(t,n,r,s,o,i,a)=>{if(n.length===0)return i(),At;let u=!0,c=()=>{u=!1};return e(Me.storage,[t,n,r],{onSuccess:(l,v)=>{if(l.result==="limitReached"||l.discardedItems===n.length)return o(new Gn);const{operationId:f}=l,d=()=>{e(Me.stopOperation,[f])};if(!u)return d();const p=v(l.operationId,{next:y=>{switch(y.event){case"operationStorageItems":{s(y.items);break}case"operationStorageDone":{m();break}case"operationError":{h(new Fi(y.error));break}case"operationInaccessible":{h(new Qn);break}default:e(Me.continue,[y.operationId])}},error:o});c=()=>{p(),e(Me.stopOperation,[l.operationId])};const h=y=>{c=At,p(),o(y)},m=()=>{c=At,p(),i()};a(l.discardedItems)},onError:o}),()=>{c()}},mf=e=>{const t=Wi(e);return qt((n,r,s,o,i,a)=>{const u=o.startsWith("descendants");let c=u?[]:null;const v=t(s,[{key:i,type:o}],a??null,u?f=>{c.push(f)}:f=>{c=f[0]?.[o]},r,()=>{try{n(u?c.flat():c)}catch(f){r(f)}},f=>{f>0&&(v(),r(new Gn))});return v})},yf=e=>t=>t.length>0?new Promise((n,r)=>{e(Me.unpin,[t],{onSuccess(){n()},onError:r})}):Promise.resolve();function bf(e){return e.operationId!==void 0}function gf(e){return(t,n,r)=>{const s=Vi(),o=new Set,i=hf();let a=i.promise,u=Wt;const c=p=>{e(Me.unfollow,[p])},l=p=>{u(),a!==null&&(p&&(a instanceof Promise?a.then(h=>{typeof h=="string"&&c(h)}):c(a)),a=null,o.forEach(h=>{h()}),o.clear(),s.errorAll(new Yn))},v=p=>{if(bf(p))return s.next(p.operationId,p);switch(p.event){case"stop":return r(new Hi),l(!1);case"initialized":case"newBlock":case"bestBlockChanged":case"finalized":const{event:h,...m}=p;return n({type:h,...m})}},f=p=>{r(p),l(!(p instanceof Wr))};e(Me.follow,[t],{onSuccess:(p,h)=>{a instanceof Promise&&(a=p,u=h(p,{next:v,error:f})),i.res(p)},onError:p=>{a=null,i.res(p),r(p)}});const d=(p,h,m)=>{const y=()=>{m?.onError(new Yn)};if(a===null)return y(),Wt;const b=w=>{if(!m)return e(p,[w,...h]);o.add(y);const k=(S,x)=>a===null?(x.error(new Yn),Wt):(s.subscribe(S,x),()=>{s.unsubscribe(S)}),E=e(p,[w,...h],{onSuccess:S=>{o.delete(y),m.onSuccess(S,k)},onError:S=>{o.delete(y),m.onError(S)}});return()=>{o.delete(y),E()}};if(typeof a=="string")return b(a);let g=Wt;return a.then(w=>{if(w instanceof Error)return y();a&&(g=b(w))}),()=>{g()}};return{unfollow(){l(!0)},body:df(d),call:pf(d),header:vf(d),storage:mf(d),storageSubscription:Wi(d),unpin:yf(d),_request:d}}}const wf=e=>{const t=qt((r,s,o,i)=>e(o,i,{onSuccess:r,onError:s}));let n=null;return async()=>n||(n=Promise.all([t(Zn.chainName,[]),t(Zn.genesisHash,[]),t(Zn.properties,[])]).then(([r,s,o])=>({name:r,genesisHash:s,properties:o})))},xf=e=>(t,n,r,s,o,i)=>{if(n.length===0)return i(),At;let a=!0,u=()=>{a=!1};return e("storage",[t,n,r],{onSuccess:(c,l)=>{const v=()=>{e("stopStorage",[c])};if(!a)return v();const f=l(c,{next:m=>{const{event:y}=m;if(y==="storage"){const{event:b,...g}=m;s(g)}else y==="storageDone"?h():p(new uf(m.error))},error:o}),d=()=>{u=At,f()};u=()=>{d(),v()};const p=m=>{d(),o(m)},h=()=>{d(),i()}},onError:o}),()=>{u()}},Ef=e=>qt((t,n,r,s,o,i)=>{const a=s.startsWith("descendants");let u=a?[]:null;const c=a?u.push.bind(u):({[s]:l})=>{u=l};return e(r,[{key:o,type:s}],i,c,l=>{n(l),u=null},()=>{t(u),u=null})}),qi=()=>e=>e,Ki=()=>(e,t)=>{if(e===null)throw new ji(t);return e},kf=e=>{const t=(l,...v)=>e(`archive_v1_${l}`,...v),n=l=>v=>qt((f,d,...p)=>t(l,p,{onSuccess:h=>{try{f(v(h,...p))}catch(m){d(m)}},onError:d})),r=n("header")(Ki()),s=n("body")(Ki()),o=xf(t),i=Ef(o),a=n("call")((l,v)=>{if(!l)throw new ji(v);if(!l.success)throw new lf(l.error);return l.value}),u=n("finalizedHeight")(qi()),c=n("hashByHeight")(qi());return{header:r,body:s,storageSubscription:o,storage:i,call:a,finalizedHeight:u,hashByHeight:c}},Af=e=>{const{request:t,disconnect:n}=cf(e);return{archive:kf(t),chainHead:gf(t),transaction:ff(t),getChainSpecData:wf(t),destroy:n,request:qt((r,s,o,i)=>t(o,i,{onSuccess:r,onError:s})),_request:t}};var Sf=Object.defineProperty,$f=(e,t,n)=>t in e?Sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ni=(e,t,n)=>$f(e,typeof t!="symbol"?t+"":t,n);class If{constructor(){Ni(this,"first"),Ni(this,"last")}getRemoveFn(t){return()=>{t.prev?t.prev.next=t.next:this.first=t.next,t.next?t.next.prev=t.prev:this.last=t.prev,delete t.prev,delete t.next}}push(t){const n={value:t};return this.last===void 0?this.last=this.first=n:(this.last.next=n,n.prev=this.last,this.last=n),this.getRemoveFn(n)}unshift(t){return this.first={value:t,next:this.first},this.first.next&&(this.first.next.prev=this.first),this.last||(this.last=this.first),this.getRemoveFn(this.first)}pop(){const t=this.first?.value;return this.first&&(this.first=this.first.next,this.first?(delete this.first.prev?.next,delete this.first.prev):this.last=void 0),t}isEmpty(){return!this.first}}const Bf=()=>{const e=new Map,t=(f,d)=>{e.set(f,()=>{e.delete(f),d()})},n=f=>{e.get(f)?.()},r=new If,s=r.unshift.bind(r),o=r.push.bind(r),i=(f,d)=>{const p=d?s:o;t(f.source$,p(f))},a=()=>{const f=r.pop();f&&(e.delete(f.source$),u(f))},u=f=>{const{source$:d,observer:p}=f;let h=!1;const m=d.subscribe({next(y){p.next(y)},error(y){(h=y instanceof Gn)?i(f,!0):p.error(y)},complete(){p.complete()}});m.closed?h||a():t(d,()=>{m.unsubscribe(),a()})},c=(f=!1)=>d=>new U(p=>{const h={observer:p,source$:d};return r.isEmpty()?u(h):i(h,f),()=>{n(d)}}),l=c();return{withRecovery:c,withRecoveryFn:f=>(...d)=>l(f(...d))}};class Qe extends Error{constructor(t,n){super(`Block ${t} is not pinned (${n})`),this.name="BlockNotPinnedError"}}const Kr=e=>{const t=e.pipe($e(n=>n instanceof Qn?qn(750).pipe(Yl(()=>t)):Fn(()=>n)));return t},Cf=new Set(["best","finalized",null]),_f=(e,t,n)=>r=>(s,...o)=>{if(!Cf.has(s))return Kr(r(s,...o)).pipe(n(s));const a=(s==="best"?t:e).pipe(fe(1),M(u=>r(u,...o).pipe(n(u))),$e(u=>u instanceof Qe?a:Fn(()=>u)));return Kr(a)},_t=e=>(...t)=>new U(n=>{let r=new AbortController;return e(...t,r.signal).then(s=>{n.next(s),n.complete()},s=>{n.error(s)}),()=>{n.unsubscribe(),r.abort(),r=void 0}}),Of=e=>t=>(...n)=>e()[t](...n);function pn(e,t,n){return(r,...s)=>{const o=t(r,...s);return new U(i=>{let a=null,u=!1;const c=()=>{u||(u=!0,a=o.subscribe({next:f=>i.next(f),error:f=>i.error(f),complete:()=>i.complete()}),a.add(()=>{u=!1,a=null}))};let l=!1;const v=e.subscribe({next:f=>{const d=f.blocks.get(r);d?d.recovering?a?.unsubscribe():c():l&&i.error(new Qe(r,n)),l=f.recovering},error:f=>i.error(f)});return()=>{v.unsubscribe(),a?.unsubscribe()}})}}const Tf=(e,t)=>{const n=(r,s,o,i)=>new U(a=>e().storageSubscription(r,s,o??null,u=>{a.next(u)},u=>{a.error(u)},()=>{a.complete()},u=>{u>0&&a.next(n(r,s.slice(-u),o,!0))})).pipe(jn(),t(i));return n},Rf=[Dt,br],Pf=(e,t)=>Rf.find(n=>Z(n(ue(e)))===t)||(()=>{throw new Error("Unsupported hasher")}),Uf=e=>{const t=async(n,r,s)=>{const o=n[r.idx],i=n[s.idx];if(n.length===2)return[o,i];const a=r.idx+Math.floor((s.idx-r.idx)/2),u={idx:a,id:await e(n[a])};if(u.id===r.id)return t(n,u,s);if(u.id===s.id)return t(n,r,u);const[c,[l,...v]]=await Promise.all([t(n,r,u),t(n,u,s)]);return[...c,...v]};return async n=>{if(n.length<2)return n;const r=n.length-1,[s]=n,o=n[r],[i,a]=await Promise.all([s,o].map(e));return i===a?[n[0]]:t(n,{idx:0,id:i},{idx:r,id:a})}},Mf=(e,t)=>{const n=Uf(t),r=i=>e().header(i),s=new cn(1),o=i=>new U(a=>{let u=null;return i.subscribe({next(c){if(c.type==="initialized"){u=[];const[l]=c.finalizedBlockHashes;Promise.all([r(l),n(c.finalizedBlockHashes)]).then(([v,f])=>{s.closed||(s.next(Pf(v,l)),s.complete());const d=Tn.dec(v);a.closed||(a.next({type:"initialized",finalizedBlockHashes:c.finalizedBlockHashes,runtimeChanges:new Set(f),number:d.number,parentHash:d.parentHash,hasNewRuntime:d.digests.some(p=>p.type==="runtimeUpdated")}),u.forEach(p=>{a.next(p)}),u=null)}).catch(v=>{a.closed||a.error(v)})}else u?u.push(c):a.next(c)},error(c){a.error(c)},complete(){a.complete()}})});return{getHeader:i=>r(i).then(Tn[1]),hasher$:s.asObservable(),operator:o}},Lf=e=>{let t=null,n=Se;const r=()=>{if(!t)throw new Error("Missing chainHead subscription");return t},s=async c=>r().storage(c,"hash","0x3a636f6465",null),{hasher$:o,operator:i,getHeader:a}=Mf(r,s),u=new U(c=>{t=e(!0,l=>{c.next(l)},l=>{t=null,c.error(l)}),n=()=>{c.complete(),t?.unfollow()}}).pipe(i,Df(),fn());return{getHeader:a,hasher$:o,getFollower:r,follow$:u,unfollow:()=>{n()}}},Df=()=>e=>new U(t=>{const n=new Ct,r=()=>e.subscribe({next:s=>t.next(s),error:s=>{n.add(r()),s instanceof Hi?t.next({type:"stop-error"}):console.warn("ChainHead follow request failed, retrying\u2026",s)},complete:()=>t.complete()});return n.add(r()),n}),Vf=e=>Z(Ve.enc(e)),Xi=Y(),Hf=ht(Xi),Ff=Ee(Ve).dec,Yi=e=>{const t=e("Metadata_metadata_versions","").pipe(I(Ff),$e(()=>oe([14]))),n=r=>{const[s]=r.filter(o=>o>13&&o<17).sort((o,i)=>i-o);return s===14?e("Metadata_metadata","").pipe(I(Xi.dec)):e("Metadata_metadata_at_version",Vf(s)).pipe(I(o=>Hf.dec(o)))};return t.pipe(M(n))},Gi=(e,t)=>e.type==="array"&&e.len===t&&e.value.type==="primitive"&&e.value.value==="u8",gt={type:"void"},jf=(e,t=()=>null)=>{const n=new Map,r=new Set,s=l=>v=>{let f=n.get(v);if(f)return f;if(r.has(v)){const p={id:v};return n.set(v,p),p}r.add(v);const d=l(v);return f=n.get(v),f?Object.assign(f,d):(f={id:v,...d},n.set(v,f)),r.delete(v),f};let o=!0,i=!0;const a=s(l=>{const v=t(e[l]);if(v)return v;const{def:f,path:d,params:p}=e[l];if(f.tag==="composite"){if(f.value.length===0)return gt;if(f.value.length===1){const h=a(f.value[0].type);return o&&d.at(-1)==="AccountId32"&&Gi(h,32)?(o=!1,{type:"AccountId32"}):i&&d.at(-1)==="AccountId20"&&Gi(h,20)?(i=!1,{type:"AccountId20"}):h}return u(f.value)}if(f.tag==="variant"){if(d.length===1&&d[0]==="Option"&&p.length===1&&p[0].name==="T"){const y=a(p[0].type);return y.type==="void"?{type:"primitive",value:"bool"}:{type:"option",value:y}}if(d.length===1&&d[0]==="Result"&&p.length===2&&p[0].name==="T"&&p[1].name==="E")return{type:"result",value:{ok:a(p[0].type),ko:a(p[1].type)}};if(f.value.length===0)return gt;const h={},m={};return f.value.forEach(y=>{const b=y.name;if(m[b]=y.docs,y.fields.length===0){h[b]={...gt,idx:y.index};return}if(y.fields.length===1&&!y.fields[0].name){h[b]={type:"lookupEntry",value:a(y.fields[0].type),idx:y.index};return}h[b]={...u(y.fields),idx:y.index}}),{type:"enum",value:h,innerDocs:m}}if(f.tag==="sequence")return{type:"sequence",value:a(f.value)};if(f.tag==="array"){const{len:h}=f.value,m=a(f.value.type);return!h||m.type==="void"?gt:h>1?{type:"array",value:m,len:f.value.len}:m}if(f.tag==="tuple")return f.value.length===0?gt:f.value.length>1?c(f.value.map(h=>a(h)),f.value.map(h=>e[h].docs)):a(f.value[0]);if(f.tag==="primitive")return{type:"primitive",value:f.value.tag};if(f.tag==="compact"){const h=a(f.value);return h.type==="void"?gt:{type:"compact",isBig:Number(h.value.slice(1))>32,size:h.value}}return{type:f.tag,isLSB:(e[f.value.bitOrderType].path.at(-1)??"LSB").toUpperCase().startsWith("LSB")}}),u=l=>{let v=!0;const f={},d={};return l.forEach((p,h)=>{v=v&&!!p.name;const m=p.name||h,y=a(p.type);y.type!=="void"&&(f[m]=y,d[m]=p.docs)}),v?{type:"struct",value:f,innerDocs:d}:c(Object.values(f),Object.values(d))},c=(l,v)=>{if(l.every(f=>f.id===l[0].id)&&v.every(f=>!f.length)){const[f]=l;return f.type==="void"?gt:{type:"array",value:l[0],len:l.length}}return{type:"tuple",value:l,innerDocs:v}};return a},Jn=e=>{const t=jf(e.lookup,({def:s})=>{if(s.tag==="composite"){const o=n(s);if(o)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map(i=>[i.name,i.errors==null?{...gt,idx:i.index}:{type:"lookupEntry",value:t(i.errors.type),idx:i.index}])),byteLength:o}}return null});function n(s){if(!(s.value.length===2&&s.value[0].name==="index"&&s.value[1].name==="error"))return null;const i=t(s.value[0].type),a=t(s.value[1].type);return i.type==="primitive"&&i.value==="u8"&&a.type==="array"&&a.value.type==="primitive"&&a.value.value==="u8"?1+a.len:null}return Object.assign(t,{metadata:e,call:"call"in e.extrinsic?e.extrinsic.call:e.lookup[e.extrinsic.type]?.params.find(i=>i.name==="Call")?.type??null})},zf=(e,t,n)=>(r,s,o,...i)=>{const{id:a}=r;if(s.has(a))return s.get(a);if(o.has(a)){const c=t(()=>s.get(a),r,...i);return s.set(a,c),c}o.add(a);let u=e(r,s,o,...i);return o.delete(a),s.has(a)&&(u=n(u,s.get(a),r,...i)),s.set(a,u),u},Wf=nn(),Qi=zf((e,t,n,r)=>{if(e.type==="primitive")return No[e.value];if(e.type==="void")return O;if(e.type==="AccountId32")return r;if(e.type==="AccountId20")return go;if(e.type==="compact")return e.isBig?Cn:C;if(e.type==="bitSequence")return On(e.isLSB);const s=d=>Qi(d,t,n,r),o=(d,p)=>{const h=s(d);return p?Ee(h,p):Ee(h)},i=d=>Fe(...d.map(s)),a=d=>{const p=Object.fromEntries(Object.entries(d).map(([h,m])=>[h,s(m)]));return se(p)};if(e.type==="sequence"&&e.value.type==="primitive"&&e.value.value==="u8")return Wf;if(e.type==="array")return e.value.type==="primitive"&&e.value.value==="u8"?nn(e.len):o(e.value,e.len);if(e.type==="sequence")return o(e.value);if(e.type==="tuple")return i(e.value);if(e.type==="struct")return a(e.value);if(e.type==="option")return ht(s(e.value));if(e.type==="result")return _n(s(e.value.ok),s(e.value.ko));const u=Object.values(e.value).map(d=>{switch(d.type){case"void":return O;case"lookupEntry":return s(d.value);case"tuple":return i(d.value);case"struct":return a(d.value);case"array":return o(d.value,d.len)}}),c=Object.fromEntries(Object.keys(e.value).map((d,p)=>[d,u[p]])),l=Object.values(e.value).map(d=>d.idx),f=l.every((d,p)=>d===p)?we(c):we(c,l);return e.byteLength?qf(f,e.byteLength):f},pr,e=>e),Zi=(e,t=kt())=>{const n=new Map,r=s=>Qi(e(s),n,new Set,t);return s=>r(s)},qf=(e,t)=>{const n=Y(t);return W(r=>n.enc(e.enc(r)),r=>e.dec(n.dec(r)))},Kf=Ke(O,()=>{},()=>null),Nr=e=>{const{metadata:t}=e;let n=Zi(e);const r=t.pallets.find(f=>f.name==="System")?.constants.find(f=>f.name==="SS58Prefix");let s;if(r)try{const f=n(r.type).dec(r.value);typeof f=="number"&&(s=f,n=Zi(e,kt(f)))}catch{}const o=new Map,i=(f,d)=>{let p=o.get(f);p||o.set(f,p=Fo(f));const h=t.pallets.find(x=>x.name===f).storage.items.find(x=>x.name===d),m=x=>x===O?Kf:x,y=(x,_,...P)=>{const X=p(...P),[,...q]=P;return{args:Fe(...q.map(([ie])=>ie)),keys:X,value:_,len:x,fallback:h.modifier===1?_.dec(h.fallback):void 0}};if(h.type.tag==="plain")return y(0,m(n(h.type.value)),d);const{key:b,value:g,hashers:w}=h.type.value,k=m(n(g)),E=w.map(x=>No[x.tag]),S=(()=>{if(E.length===1)return[[n(b),E[0]]];const x=e(b);switch(x.type){case"array":return E.map(_=>[n(x.value.id),_]);case"tuple":return x.value.map((_,P)=>[n(_.id),E[P]]);default:throw new Error("Invalid key type")}})();return y(E.length,k,d,...S)},a=f=>{switch(f.type){case"void":return O;case"lookupEntry":return n(f.value.id);case"tuple":return Fe(...Object.values(f.value).map(d=>n(d.id)));case"struct":return se(Ut(f.value,d=>n(d.id)));case"array":return Ee(n(f.value.id),f.len)}},u=(f,d)=>{const p=t.pallets.find(h=>h.name===f).constants.find(h=>h.name===d);return n(p.type)},c=f=>(d,p)=>{const h=t.pallets.find(b=>b.name===d),m=e(h[f].type);if(m.type!=="enum")throw null;const y=m.value[p];return{location:[h.index,y.idx],codec:a(m.value[p])}},l=(f,d)=>{const p=t.pallets.find(h=>h.name===f)?.viewFns.find(h=>h.name===d);if(!p)throw null;return{args:Fe(...p.inputs.map(h=>n(h.type))),value:n(p.output)}},v=(f,d)=>{const p=t.apis.find(h=>h.name===f)?.methods.find(h=>h.name===d);if(!p)throw null;return{args:Fe(...p.inputs.map(h=>n(h.type))),value:n(p.output)}};return{buildDefinition:n,buildStorage:i,buildEvent:c("events"),buildError:c("errors"),buildViewFn:l,buildRuntimeCall:v,buildCall:c("calls"),buildConstant:u,ss58Prefix:s}},Ji="CheckMortality",ea=(e,t,n)=>{const r=Jn(e),s=Nr(r),o=s.buildStorage("System","Events"),i=e.extrinsic.signedExtensions.find(l=>l.identifier==="ChargeAssetTxPayment");let a=null;if(i){const l=r(i.type);if(l.type==="struct"){const v=l.value.asset_id;v.type==="option"&&(a=v.value.id)}}const u=Yf(r.metadata,s),c=l=>{const v=u(l);return"extra"in v&&v.extra[Ji]||{mortal:!1}};return{assetId:a,metadataRaw:t,codeHash:n,lookup:r,dynamicBuilder:s,events:{key:o.keys.enc(),dec:o.value.dec},accountId:kt(s.ss58Prefix),getMortalityFromTx:c}},Xr=Y(1/0).dec,Nf=wn(Ne[1],e=>{const t=2<<e%16,n=Math.max(t>>12,1),r=(e>>4)*n;return{mortal:!0,period:t,phase:r}}),Xf=Je(e=>{const t=D.dec(e);if(t===0)return{mortal:!1};const n=D.dec(e);return Nf(Uint8Array.from([t,n]))}),Yf=(e,t)=>{const n=Object.fromEntries(e.extrinsic.signedExtensions.map(a=>[a.identifier,a.identifier===Ji?Xf:t.buildDefinition(a.type)[1]]));let r,s;const{extrinsic:o}=e;if("address"in o)r=t.buildDefinition(o.address)[1],s=t.buildDefinition(o.signature)[1];else{const a=e.lookup[o.type]?.params,u=a?.find(v=>v.name==="Call")?.type,c=a?.find(v=>v.name==="Address")?.type,l=a?.find(v=>v.name==="Signature")?.type;if(u==null||c==null||l==null)throw new Error("Call, Address and/or signature not found");r=t.buildDefinition(c)[1],s=t.buildDefinition(l)[1]}const i=se.dec({address:r,signature:s,extra:se.dec(n),callData:Xr});return Je(a=>{const u=C.dec(a),{type:c,version:l}=$r[1](a);if(c==="bare")return{len:u,version:l,type:c,callData:Xr(a)};if(c==="signed")return{len:u,version:l,type:c,...i(a)};const v=D.dec(a);let f;if(e.version===16){const p=e.extrinsic.signedExtensionsByVersion.find(([h])=>h===v);if(!p)throw new Error("Unexpected extension version");f=se.dec(Object.fromEntries(Object.entries(n).filter((h,m)=>p[1].includes(m))))}else f=se.dec(n);const d=f(a);return{len:u,type:c,version:l,extensionVersion:v,extra:d,callData:Xr(a)}})},Gf=e=>t=>{const n=(...r)=>{const s=e();return s?t(s,...r).pipe($e(o=>{if(o instanceof Qe)return n(...r);if(o instanceof Qn)return qn(750).pipe(M(()=>n(...r)));throw o})):mt};return n},Qf=(e,t,n,r)=>{const s=(o,i)=>o.pipe(M(a=>n(a).pipe($e(()=>oe(null)),M(u=>u?oe(u):i.pipe(dn(c=>{r(a,c)}))),I(u=>({codeHash:a,metadataRaw:u,metadata:Lt(dt.dec(u))})))));return o=>{const i=Gf(o),a=o(),u=new Set([a]),c=i(t)().pipe(hn(1)),l=s(c,Yi(i(e))).pipe(I(({metadata:f,metadataRaw:d,codeHash:p})=>ea(f,d,p)),hn(1)),v={at:a,runtime:l,codeHash$:c,addBlock:f=>(u.add(f),v),deleteBlocks:f=>(f.forEach(d=>{u.delete(d)}),u.size),usages:u};return l.subscribe({error(){}}),v}},vn=fn({connector:()=>new cn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0}),er=({hash:e,number:t,parent:n,hasNewRuntime:r})=>({hash:e,number:t,parent:n,hasNewRuntime:r}),ta=(e,t)=>()=>{const n=e.runtimes[t];return n?[...n.usages].at(-1)??null:e.blocks.has(t)?t:null},na=(e,t)=>{e.get(e.get(t).parent)?.children.delete(t),e.delete(t)},Zf=(e,t)=>{t.forEach(n=>{na(e.blocks,n)}),Object.entries(e.runtimes).map(([n,r])=>({key:n,usages:r.deleteBlocks(t)})).filter(n=>n.usages===0).map(n=>n.key).forEach(n=>{delete e.runtimes[n]})},Jf=(e,t,n,r,s,o,i,a,u)=>{const c=h=>{i.next(er(h))},l=new ze,v=l.pipe(tf(()=>qn(0)),I(()=>({type:"cleanup"}))),f=ra(),d=ln(o,v,e).pipe(Kn((h,m)=>{const y=b=>{Zf(h,b),a(b)};switch(m.type){case"initialized":h.recovering&&!m.finalizedBlockHashes.some(E=>h.blocks.has(E))&&(h=Object.assign(h,ra()),i.next(null));const b=h.blocks.get(h.finalized)?.number??-1,g=m.finalizedBlockHashes.length-1;h.finalized=h.best=m.finalizedBlockHashes[g];let w=h.finalizedRuntime.at;const k=[];return m.finalizedBlockHashes.forEach((E,S)=>{const x=S!==g,_=h.blocks.get(E);if(_)_.recovering=!1,_.unpinnable=x;else{const P=m.number+S,X=P>b,q=m.runtimeChanges.has(E)&&!h.runtimes[E]&&X;q&&(w=E);const ie=S===0?m.parentHash:m.finalizedBlockHashes[S-1],j={hash:E,hasNewRuntime:S?m.runtimeChanges.has(E):m.hasNewRuntime,parent:ie,children:new Set(S===g?[]:[m.finalizedBlockHashes[S+1]]),unpinnable:x,runtime:w,refCount:0,number:P,recovering:!1};h.blocks.set(E,j),q&&(h.finalizedRuntime=h.runtimes[E]=p(ta(h,E))),h.runtimes[w].usages.add(E),X&&k.push(j)}}),k.forEach(c),h;case"stop-error":for(const E of h.blocks.values())E.recovering=!0;return h.recovering=!0,h;case"newBlock":{const{parentBlockHash:E,blockHash:S}=m;if(h.blocks.has(S))h.blocks.get(S).recovering=!1;else{const x=h.blocks.get(E);x.children.add(S);const _=x.number+1,P={hash:S,number:_,parent:E,children:new Set,runtime:m.newRuntime?S:x.runtime,unpinnable:!1,refCount:0,recovering:!1,hasNewRuntime:!!m.newRuntime};h.blocks.set(S,P),m.newRuntime&&(h.runtimes[S]=p(ta(h,S))),h.runtimes[P.runtime].addBlock(S),c(P)}return h}case"bestBlockChanged":{if(h.recovering){for(const[E,S]of h.blocks)S.recovering&&(na(h.blocks,E),u(E));h.recovering=!1}return h.best=m.bestBlockHash,h}case"finalized":{h.finalized=m.finalizedBlockHashes.slice(-1)[0];const{blocks:E}=h;E.get(h.best).number<E.get(h.finalized).number&&(h.best=h.finalized),h.finalizedRuntime=h.runtimes[E.get(h.finalized).runtime],m.prunedBlockHashes.forEach(x=>{const _=h.blocks.get(x);_&&(_.unpinnable=!0)});let S=E.get(E.get(h.finalized).parent);for(;S&&!S.unpinnable;)S.unpinnable=!0,S=E.get(S.parent);return l.next(),h}case"cleanup":{const E=[...h.blocks.values()].filter(({unpinnable:S,refCount:x})=>S&&!x).map(({hash:S})=>S);return y(E),h}case"blockUsage":{if(!h.blocks.has(m.value.hash))return h;const E=h.blocks.get(m.value.hash);if(E.refCount+=m.value.type==="hold"?1:-1,E.refCount===0&&!E.recovering&&E.unpinnable){const S=[E.hash];y(S)}return h}}},f),Ue(h=>!!h.finalizedRuntime.runtime),I(h=>({...h})),dn({error(h){i.error(h)}}),vn),p=Qf(pn(d,t,"pinned-blocks"),pn(d,n,"pinned-blocks"),r,s);return Object.assign(d,{state:f})},ra=()=>({best:"",finalized:"",runtimes:{},blocks:new Map,finalizedRuntime:{},recovering:!1}),sa=(e,t,n,r)=>{const s=a=>Mi(e.pipe(Ue(({blocks:u})=>!u.has(a)))),o=(a,u,c)=>{if(c)return oe({hash:a,found:{type:!1,validity:null}});const l=s(a);return t(a).pipe(M(v=>{const f=v.indexOf(u);return f>-1?l(r(a)).pipe(I(d=>({hash:a,found:{type:!0,index:f,events:d}}))):n(a,u).pipe(I(d=>({hash:a,found:{type:!1,validity:d}})))}),l)},i=(a,u,c)=>o(a,u,c.has(a)).pipe(M(l=>{const{found:v}=l;return v.type||v.validity?.success===!1?oe(l):e.pipe(s(a),M(f=>f.blocks.get(a).children),Jl(),M(f=>i(f,u,c)))}));return a=>e.pipe(fe(1),M(u=>i(u.finalized,a,new Set(u.blocks.keys()))))},eh=new Uint8Array([2]),th=(e,t)=>Z(re([eh,ue(e),ue(t)])),oa="TaggedTransactionQueue",ia="validate_transaction",[,nh]=we({InvalidTransaction:we({Call:O,Payment:O,Future:O,Stale:O,BadProof:O,AncientBirthBlock:O,ExhaustsResources:O,Custom:D,BadMandatory:O,MandatoryValidation:O,BadSigner:O}),UnknownTransaction:we({CannotLookup:O,NoUnsignedValidator:O,Custom:D})}),rh=Je(e=>{const t=D.dec(e);if(t>1)throw new Error("Unable to decode validateTransaction result");if(!t)return{success:!0,value:void 0};let n;try{n=nh(e)}catch{n={type:"UnknownInvalidTx"}}return{success:!1,value:n}}),sh=(e,t)=>(n,r)=>{const s=t(n).pipe(I(o=>{try{return o.dynamicBuilder.buildRuntimeCall(oa,ia).value[1]}catch{return rh}}));return e(n,`${oa}_${ia}`,th(r,n)).pipe(zr(s),I(([o,i])=>i(o)))},oh=e=>t=>new U(n=>{let r=!1;const s=t.subscribe({next(o){r=!0,n.next(o)},error(o){n.error(o)},complete(){n.complete()}});return r||n.next(e),s}),ih=e=>t=>new U(n=>{const r=t.subscribe({next(o){n.next(o)},error(o){n.error(o)},complete(){n.complete()}}),s=()=>r.unsubscribe();return()=>{Promise.resolve().then(s)}}),aa=(e,t=1/0)=>n=>new U(r=>{let s;const o=new Map,i=new Map,a=new Map;let u=0,c=0,l=0;const v=()=>{const f=o.get(c);if(!f){i.size===0&&(typeof s>"u"||s.closed)&&r.complete();return}const d=c++;o.delete(d),l!==d&&a.set(d,[]);let p=!1,h=f.subscribe({next(m){l===d?r.next(m):a.get(d).push(m)},complete(){if(p=!0,i.delete(d),d===l)for(l++;a.has(l)&&(a.get(l).forEach(m=>r.next(m)),a.delete(l),!i.has(l));)l++;v()},error(m){r.error(m)}});p||i.set(d,h)};return s=new Ct,s.add(n.subscribe({next(f){const d=u++;o.set(d,Wn(()=>e(f,d))),i.size<t&&v()},error(f){r.error(f)},complete(){i.size===0&&r.complete()}})),()=>{i.forEach(f=>f.unsubscribe()),s.unsubscribe(),o.clear(),a.clear()}}),ah=(e,t,n)=>{const{getFollower:r,unfollow:s,follow$:o,getHeader:i,hasher$:a}=Lf(e),u=Of(r),{withRecovery:c,withRecoveryFn:l}=Bf(),v=new ze,f=A=>B=>new U(T=>{v.next({type:"blockUsage",value:{type:"hold",hash:A}});const z=B.subscribe(T);return z.add(()=>{setTimeout(()=>{v.next({type:"blockUsage",value:{type:"release",hash:A}})},0)}),z}),d=A=>(B,...T)=>A(B,...T).pipe(f(B)),p=(A,B)=>(T,...z)=>new U(Be=>k.state.blocks.has(T)?A(T,...z).subscribe(Be):Be.error(new Qe(T,B))),h=A=>r().unpin(A).catch(B=>{if(!(B instanceof Yn))throw B}),m=(A,B)=>p(d(pn(k,l(_t(A)),`stop-${B}`)),B),y=new Map,b=d(l(_t(u("storage")))),g=A=>b(A,"hash","0x3a636f6465",null).pipe(I(B=>B)),w=new ze,k=Jf(o,d(l(_t(u("call")))),g,t,n,v,w,A=>{h(A).catch(B=>{console.error("unpin",B)}),A.forEach(B=>{y.delete(B)})},A=>{y.delete(A)}),E=p(d(A=>k.state.runtimes[k.state.blocks.get(A).runtime].runtime),"getRuntimeCtx"),S=A=>B=>B.pipe(aa(T=>E(A(T)).pipe(I(z=>[T,z])))),x=(A,B,T)=>{const z=y.get(A)??new Map,Be=z.get(B);if(Be)return Be;y.set(A,z);let xt;const ot=T.pipe(fn({connector:()=>xt=new cn}),dn({complete(){z.set(B,xt)}}),ih());return z.set(B,ot),ot},_=k.pipe(Ue(A=>!A.recovering),ve((A,B)=>A.finalized===B.finalized),Kn((A,B)=>{let T=B.blocks.get(B.finalized);const z=[T],Be=A.at(-1);if(!Be)return z;for(;T.number>Be.number+1&&(T=B.blocks.get(T.parent),!!T);)z.unshift(T);return z},[]),jn(),I(er),vn),P=k.pipe(ve((A,B)=>A.best===B.best),I(A=>er(A.blocks.get(A.best))),vn),X=k.pipe(Ue(A=>!A.recovering),ve((A,B)=>A.finalized===B.finalized&&A.best===B.best),Kn((A,B)=>{const T=De=>A.get(De)||er(B.blocks.get(De)),z=T(B.best),Be=T(B.finalized),xt=z.number-Be.number+1,ot=new Array(xt);for(let De=0,Ta=z.hash;De<xt;De++)ot[De]=T(Ta),Ta=ot[De].parent;return new Map(ot.map(De=>[De.hash,De]))},new Map),I(A=>[...A.values()]),vn),q=k.pipe(ve((A,B)=>A.finalizedRuntime===B.finalizedRuntime),Nn(({finalizedRuntime:{runtime:A}})=>A.pipe(oh(null))),vn),ie=q.pipe(I(A=>A?.lookup.metadata??null)),j=_f(_.pipe(I(A=>A.hash)),P.pipe(I(A=>A.hash)),f),ae=m(u("body"),"body"),me=A=>Kr(x(A,"body",ae(A))),ye=m(u("storage"),"storage"),Le=j(p((A,B,T,z=null,Be)=>k.state.runtimes[k.state.blocks.get(A).runtime].runtime.pipe(M(xt=>{const ot=T(xt);return x(A,`storage-${B}-${ot}-${z??""}`,ye(A,B,ot,z)).pipe(Be?I(De=>Be(De,xt)):Ge)})),"storage")),or=Tf(r,c),yn=j(p(pn(k,(A,B,T)=>or(A,B,T??null,!1),"storageQueries"),"storageQueries")),ls=j(p(pn(k,A=>Wn(()=>i(A)),"header"),"header")),Ba=A=>Le(A,"value",B=>B.events.key,null,(B,T)=>T.events.dec(B)),cd=m(u("call"),"call"),Ca=j((A,B,T)=>x(A,`call-${B}-${T}`,cd(A,B,T))),fs=sh(Ca,E),_a=A=>x(A,"body",ae(A)),ud=sa(k,_a,fs,Ba),ld=sa(k,_a,fs,()=>oe()),fd=q.pipe(Ue(Boolean),fe(1),M(A=>{const{enc:B}=A.dynamicBuilder.buildStorage("System","BlockHash").keys;let T;try{T=B(0)}catch{T=B(0n)}return Le(null,"value",()=>T,null)}),hn(1));ln(q,X).subscribe({error(){}});const hd=A=>ln(...Object.values(k.state.runtimes).map(B=>B.codeHash$.pipe(M(T=>A===T?B.runtime:mt)))).pipe(Pi(null),fe(1)),Oa=(A,B=!1)=>{let T=A||"finalized";if(T=k.state[T]||T,!k.state.blocks.has(T)){if(B)throw new Qe(T,"holdBlock");return Se}v.next({type:"blockUsage",value:{type:"hold",hash:T}});let z=()=>{v.next({type:"blockUsage",value:{type:"release",hash:T}}),z=Se};return()=>{z()}},dd=A=>B=>new U(T=>{const z=B.subscribe(T);return z.closed||z.add(Oa(A)),z});return{follow$:o,unfollow:s,finalized$:_,best$:P,bestBlocks$:X,newBlocks$:w.pipe(Xn(Boolean)),runtime$:q,metadata$:ie,genesis$:fd,hasher$:a,getRuntime$:hd,header$:ls,body$:me,call$:Ca,storage$:Le,storageQueries$:yn,eventsAt$:Ba,withHodl:dd,holdBlock:Oa,trackTx$:ud,trackTxWithoutEvents$:ld,validateTx$:fs,pinnedBlocks$:k,withRuntime:S,getRuntimeContext$:j(E)}};var ch=e=>t=>new U(n=>e(t,r=>{n.error(r)}));const uh=({storageSubscription:e,...t})=>n=>{const r={},s=_t(t.storage),o=_t(t.call),i=_t(t.header),a=_t(t.body),u=h=>i(h).pipe(I(Tn[1])),c=h=>s(h,"hash","0x3a636f6465",null).pipe(I(m=>m)),l=(h,m)=>n(h).pipe($e(()=>oe(null)),M(y=>y?oe(y):Yi((...b)=>o(m,...b)).pipe(I(b=>ea(Lt(dt.dec(b)),b,h)))),dn(y=>{r[h]=y})),v=h=>c(h).pipe(M(m=>{const y=r[m];return y?oe(y):l(m,h)})),f=(h,m,y,b=null,g)=>v(h).pipe(M(w=>s(h,m,y(w),b).pipe(I(k=>g?g(k,w):k))));return{body$:a,header$:u,storage$:f,storageQueries$:(h,m,y)=>new U(b=>e(h,m,y||null,g=>b.next(g),g=>b.error(g),()=>{b.complete()})),call$:o,eventsAt$:h=>f(h,"value",m=>m.events.key,null,(m,y)=>y.events.dec(m)),getRuntimeContext$:v}},lh=()=>oe(null),fh=(e,{getMetadata:t,setMetadata:n}={})=>({chainHead$:()=>ah(e.chainHead,t||lh,n||Se),archive:uh(e.archive),broadcastTx$:ch(e.transaction),destroy:e.destroy}),hh=(e,t)=>e.pipe(Xn(n=>n.blocks.has(t)),ve((n,r)=>n.finalized===r.finalized&&n.best===r.best),I(n=>{if(n.blocks.get(t).number>n.blocks.get(n.best).number)return null;const{number:r}=n.blocks.get(t);let s=n.blocks.get(n.best),o=n.finalized===s.hash;for(;s.number>r;)s=n.blocks.get(s.parent),o=o||n.finalized===s.hash;return o?"finalized":s.hash===t?"best":null}),ve(),Xn(n=>n!=="finalized",!0)),Ot=(e,t)=>(n,...r)=>e(n,...r).pipe($e(s=>{if(!(s instanceof Qe))throw s;return t(n,...r).pipe($e(o=>{throw console.warn(o),s}))}));class Tt{constructor(){}_runtime(t){}}class Yr{constructor(){}_compatibility(t){}}const tr=new WeakMap,ca=new WeakMap,nr=e=>e instanceof Tt?ca.get(e):tr.get(e);var wt=(e=>(e.Storage="storage",e.Tx="tx",e.Event="events",e.Const="constants",e.ViewFns="viewFns",e.Api="apis",e))(wt||{});const dh=Ee(Xu),ph=Ee(Cr),vh=Fe(dh,ph),mh=(e,t)=>{const n=new Promise(async r=>{const s=t.runtime$.pipe(Ue(i=>i!=null));let o=await We(s);s.subscribe(i=>o=i),r(()=>o)});return Promise.all([e.metadataTypes.then(vh.dec),e.descriptors,n]).then(([[r,s],o,i])=>{const a=new Yr;return tr.set(a,{runtime:i,getEntryPoint(u,c,l){const v=o[u]?.[c]?.[l];if(v==null)throw new Error(`Descriptor for ${u} ${c}.${l} does not exist`);return r[v]},typedefNodes:s}),a})},yh=e=>new Promise(async t=>{const n=e.runtime$.pipe(Ue(s=>s!=null));let r=await We(n);n.subscribe(s=>r=s),t(()=>r)}).then(t=>{const n=new Tt;return ca.set(n,{runtime:t}),n}),Gr=new WeakMap,ua=e=>(Gr.has(e.metadataRaw)||Gr.set(e.metadataRaw,{compat:new Map,lookup:e.lookup,typeNodes:[]}),Gr.get(e.metadataRaw)),Rt=(e,t,n)=>{const r=(i,a)=>{var u;const c=ua(i);return(u=c.typeNodes)[a]||(u[a]=Un(c.lookup(a)))};function s(i,a){if(i instanceof Tt)return{args:Te.Identical,values:Te.Identical};const u=tr.get(i);a||(a=u.runtime());const c=n(a);if(c==null)return{args:Te.Incompatible,values:Te.Incompatible};const l=u.typedefNodes,v=ua(a),f=t(u),d=Zu(f,p=>l[p],c,p=>r(a,p),v.compat);return{args:d.args.level,values:d.values.level}}const o=fa(e,i=>la(s(i)));return{isCompatible:fa(e,(i,a)=>o(a)>=i),getCompatibilityLevel:o,getCompatibilityLevels:s,descriptors:e,withCompatibleRuntime:(i,a)=>u=>zt([u.pipe(i.withRuntime(a)),e]).pipe(I(([[c,l],v])=>[c,v,l])),compatibleRuntime$:(i,a)=>zt([e,i.getRuntimeContext$(a)]),argsAreCompatible:(i,a,u)=>{if(i instanceof Tt)return!0;const c=s(i,a);if(c.args===Te.Incompatible)return!1;if(c.args>Te.Partial)return!0;if(c.values===Te.Incompatible)return!1;const l=n(a);return l==null?!1:ei(l.args,v=>r(a,v),u)},valuesAreCompatible:(i,a,u)=>{if(i instanceof Tt)return!0;const c=s(i,a).values;if(c===Te.Incompatible)return!1;if(c>Te.Partial)return!0;const l=tr.get(i),v=t(l);return ei(v.values,f=>l.typedefNodes[f],u)},getRuntimeTypedef:r}},la=e=>Math.min(e.args,e.values),fa=(e,t)=>(...n)=>{const r=n.at(-1);return r instanceof Yr||r instanceof Tt?t(...n):e.then(s=>t(...n,s))},bh=(e,t,{valuesAreCompatible:n,descriptors:r,isCompatible:s,getCompatibilityLevel:o})=>{const i=new WeakMap,a=c=>{if(i.has(c))return i.get(c);const l=c.lookup.metadata.pallets.find(f=>f.name===e)?.constants.find(f=>f.name===t);if(l==null)throw new Error(`Runtime entry Constant(${e}.${t}) not found`);const v=c.dynamicBuilder.buildConstant(e,t).dec(l.value);return i.set(c,v),v},u=c=>{if(c){const l=nr(c).runtime(),v=a(l);if(!n(c,l,v))throw new Error(`Incompatible runtime entry Constant(${e}.${t})`);return v}return r.then(u)};return Object.assign(u,{isCompatible:s,getCompatibilityLevel:o})},gh=fn({connector:()=>new cn(1),resetOnError:!0,resetOnComplete:!0,resetOnRefCountZero:!0});function Kt(e,t){return new Promise((n,r)=>{let s=null,o=!1;const i=t?()=>{s?.unsubscribe(),r(new Qs)}:Se;s=e.subscribe({next:a=>{n(a),s?.unsubscribe(),o=!0},error:a=>{t?.removeEventListener("abort",i),r(a),o=!0},complete:()=>{t?.removeEventListener("abort",i),r(new Error("Observable completed without emitting")),o=!0}}),o||t?.addEventListener("abort",i)})}const Qr=Symbol("EMPTY_VALUE"),Zr=e=>t=>new U(n=>{let r=0,s=null,o=Qr,i=!1;const a=()=>{const c=e(o,r++);o=Qr,s=c.subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){o!==Qr?a():(s=null,i&&n.complete())}})},u=t.subscribe({next(c){o=c,s||a()},error(c){n.error(c)},complete(){s||n.complete(),i=!0}});return()=>{s?.unsubscribe(),u.unsubscribe()}});let ha={};const wh=e=>t=>new U(n=>{let r=ha,s=t.subscribe({next(o){n.next(r=o)},error(o){n.error(o)},complete(){r===ha?n.complete():s=e(r).subscribe(n)}});return()=>{s.unsubscribe()}}),Nt=e=>typeof e=="object"&&e!==null&&Object.entries(e).every(([t,n])=>t==="at"&&(n===void 0||typeof n=="string")||t==="signal"&&(n===void 0||n instanceof AbortSignal)),xh=()=>{const e=new hl(new ze);return[e.pipe(rf()),()=>dn({next:t=>e.value.next(t),error:t=>{e.value.error(t),e.next(new ze)},complete:()=>{e.value.complete(),e.next(new ze)}})]},Eh=(e,t,n,{isCompatible:r,getCompatibilityLevel:s,withCompatibleRuntime:o,argsAreCompatible:i,valuesAreCompatible:a})=>{const u=()=>new Error(`Incompatible runtime entry Event(${e}.${t})`),c=n.finalized$.pipe(o(n,l=>l.hash),I(([l,v,f])=>{const d=f.lookup.metadata.pallets.find(p=>p.name===e)?.events?.type;if(d==null||f.lookup.metadata.lookup[d].def.tag!=="variant"||f.lookup.metadata.lookup[d].def.value.find(p=>p.name===t)==null)throw new Error(`Runtime entry Event(${e}.${t}) not found`);if(!i(v,f,null))throw u();return[l,v,f]}),aa(([l,v,f])=>n.eventsAt$(l.hash).pipe(I(d=>d.filter(p=>p.event.type===e&&p.event.value.type===t).map(p=>{if(!a(v,f,p.event.value.value))throw u();return{meta:{phase:p.phase,block:l},payload:p.event.value.value}})))),gh);return{watch:l=>c.pipe(M(v=>l?v.filter(f=>l(f.payload)):v)),pull:()=>We(c),filter:l=>l.filter(v=>v.type===e&&v.value.type===t).map(v=>v.value.value),getCompatibilityLevel:s,isCompatible:r}},kh=(e,t,n,{isCompatible:r,getCompatibilityLevel:s,compatibleRuntime$:o,argsAreCompatible:i,valuesAreCompatible:a})=>{const u=`${e}_${t}`,c=()=>new Error(`Incompatible runtime entry RuntimeCall(${u})`);return Object.assign((...l)=>{const v=l[l.length-1],f=Nt(v),{signal:d,at:p}=f?v:{},h=p??null,m=o(n,h).pipe(M(([y,b])=>{let g;try{g=b.dynamicBuilder.buildRuntimeCall(e,t)}catch{throw new Error(`Runtime entry RuntimeCall(${u}) not found`)}if(!i(y,b,l))throw c();return n.call$(h,u,Z(g.args.enc(l))).pipe(I(g.value.dec),I(w=>{if(!a(y,b,w))throw c();return w}))}),n.withHodl(h));return Kt(m,d)},{getCompatibilityLevel:s,isCompatible:r})},da=I(e=>e.mapped),Ah=(e,t,n,r,{isCompatible:s,getCompatibilityLevel:o,getCompatibilityLevels:i,descriptors:a,argsAreCompatible:u,valuesAreCompatible:c})=>{const l=e==="System"&&t==="Number",v=e==="System"&&t==="BlockHash",f=n.runtime$.pipe(Ue(Boolean),fe(1),I(({dynamicBuilder:x})=>typeof x.buildStorage("System","Number").value.dec(new Uint8Array(32))=="bigint"?BigInt:Ge),hn()),d=ii(Xl(f),I(([x,_])=>_(x))),p=()=>new Error(`Incompatible runtime entry Storage(${e}.${t})`),h=x=>new Error(`Invalid Arguments calling ${e}.${t}(${x})`),m=x=>{try{return x.dynamicBuilder.buildStorage(e,t)}catch{throw new Error(`Runtime entry Storage(${e}.${t}) not found`)}},y=(...x)=>{const _=x[x.length-1],P=_==="best",X=P||_==="finalized"?x.slice(0,-1):x;return n[P?"best$":"finalized$"].pipe(Zr(()=>b(...X,P?{at:"best"}:{})),ve((q,ie)=>q.raw===ie.raw),da)},b=(...x)=>{const _=x[x.length-1],P=Nt(_),{at:X}=P?_:{},q=X??null,ie=bt(a).pipe(M(j=>n.storage$(q,"value",ae=>{const me=m(ae),ye=x.length===me.len?x:x.slice(0,-1);if(x!==ye&&!P)throw h(x);if(!u(j,ae,ye))throw p();return me.keys.enc(...ye)},null,(ae,me)=>{const ye=m(me),Le=ae===null?ye.fallback:ye.value.dec(ae);if(!c(j,me,Le))throw p();return{raw:ae,mapped:Le}})),n.withHodl(q));return l?n.pinnedBlocks$.pipe(I(j=>{const ae=q==="finalized"||!q?j.finalized:q==="best"?j.best:q,me=j.blocks.get(ae);if(!me)throw new Qe(ae,"System.Number");return me.number}),ve(),d,I(j=>({raw:j.toString(),mapped:j})),$e(j=>{if(j instanceof Qe)return ie;throw j})):v&&Number(x[0])===0?n.genesis$.pipe(I(j=>({raw:j,mapped:Bn.fromHex(j)}))):ie},g=async(...x)=>{const _=x[x.length-1],P=Nt(_),{signal:X}=P?_:{};return Kt(b(...x).pipe(da),X)},w=async(...x)=>{const _=x[x.length-1],P=Nt(_),{signal:X,at:q}=P?_:{},ie=q??null,j=bt(a).pipe(M(ae=>n.storage$(ie,"descendantsValues",me=>{const ye=m(me);if(la(i(ae,me))===Te.Incompatible)throw p();if(x.length>ye.len)throw h(x);const Le=x.length>0&&P?x.slice(0,-1):x;if(x.length===ye.len&&Le===x)throw h(x);return ye.keys.enc(...Le)},null,(me,ye)=>{const Le=m(ye),or=me.map(({key:yn,value:ls})=>({keyArgs:Le.keys.dec(yn),value:Le.value.dec(ls)}));if(or.some(({value:yn})=>!c(ae,ye,yn)))throw p();return or})),n.withHodl(ie));return Kt(j,X)},k=(x,_)=>Promise.all(x.map(P=>g(..._?[...P,_]:P))),E=(...x)=>{const _=x.at(-1),P=Nt(_);return r(e,t,P?x.slice(0,-1):x,P&&_.at==="best")},S=(...x)=>{const _=x.at(-1);if(_ instanceof Yr||_ instanceof Tt){const P=x.slice(0,-1),X=nr(_).runtime();if(!u(_,X,P))throw p();return m(X).keys.enc(...P)}return a.then(P=>S(...x,P))};return{isCompatible:s,getCompatibilityLevel:o,getKey:S,getValue:g,getValues:k,getEntries:w,watchValue:y,watchEntries:E}},Jr=()=>new Error("Unkown signer"),Sh=e=>{const{extrinsic:t}=e,n=Jn(e);let r,s;if("address"in t)r=n(t.address),s=n(t.signature);else{const o=Object.fromEntries(e.lookup[t.type].params.filter(i=>i.type!=null).map(i=>[i.name,n(i.type)]));if(r=o.Address,s=o.Signature,!r||!s)throw Jr()}if(r.type==="AccountId20"&&s.type==="array"&&s.len===65&&s.value.type==="primitive"&&s.value.value==="u8")return[1,[]];if(s.type!=="enum"||["Ecdsa","Ed25519","Sr25519"].some(o=>!(o in s.value)))throw Jr();if(r.type==="enum"){const o=r.value.Id;if(o.type==="lookupEntry"&&o.value.type==="AccountId32")return[0,[o.idx]]}else if(r.type==="AccountId32")return[0,[]];throw Jr()},$h={Ed25519:0,Sr25519:1,Ecdsa:2},Ih=(e,t,n,r,s,o)=>{const[i,a]=Sh(e),u=re([$r.enc({version:4,type:"signed"}),i===1?t:new Uint8Array([...a,...t]),i===1||!o?n:new Uint8Array([$h[o],...n]),...r,s]);return re([he.enc(u.length),u])},[rr,mn]=["<Bytes>","</Bytes>"].map(e=>He.fromText(e).asBytes()),Bh=e=>async t=>{let n=!0,r;for(r=0;n&&r<rr.length;r++)n=rr[r]===t[r];n=n&&r===rr.length;const s=t.length-mn.length;for(r=0;n&&r<mn.length;r++)n=mn[r]===t[s+r];return n=n&&r===mn.length,e(n?t:re([rr,t,mn]))};function Ch(e,t,n){return{publicKey:e,signTx:async(s,o,i,a,u=Dt)=>{const c=Lt(Sr(i)),l=[],v=[];c.extrinsic.signedExtensions.map(({identifier:p})=>{const h=o[p];if(!h)throw new Error(`Missing ${p} signed extension`);l.push(h.value),v.push(h.additionalSigned)});const f=re([s,...l,...v]),d=await n(f.length>256?u(f):f);return Ih(c,e,d,l,s,t)},signBytes:Bh(n)}}Uint8Array.from([1]);const _h=(e,t)=>{const n=e.metadata.pallets.find(o=>o.name==="System").constants.find(o=>o.name==="Version"),r=e(n.type),s=t.buildDefinition(n.type).dec;if(r.type!=="struct")throw new Error("not a struct");return s(n.value)};function Oh(e){let t=0;for(;!(e&1);)t++,e>>=1;return t}const Th=e=>1<<Math.ceil(Math.log2(e)),Rh=gn(Y(2)[0],e=>{const t=Math.min(Math.max(Th(e.period),4),65536),n=e.startAtBlock%t,r=Math.max(t>>12,1),s=Math.min(Math.max(Oh(t)-1,1),15),o=n/r<<4;return Ne[0](s|o)}),[Ph]=se({tip:he,asset:ht(Y(1/0))}),pa=new Uint8Array,es=Uint8Array.from([0]),ts=e=>({value:e,additionalSigned:pa}),ns=e=>({value:pa,additionalSigned:e}),rs=(e,t)=>({value:e,additionalSigned:t}),va=(e,t,n)=>{const r={};return t.metadata.extrinsic.signedExtensions.forEach(({identifier:s,type:o,additionalSigned:i})=>{r[s]=[o,i].map(a=>n.buildDefinition(a)[0])}),({mortality:s,tip:o=0n,nonce:i,customSignedExtensions:a={},...u})=>{const c=[],l=_h(t,n),v=d=>{const[p,h]=r[d],m=a[d];try{return Ut({value:p,additionalSigned:h},(y,b)=>{const g=m?.[b];return g instanceof Uint8Array?g:y(g)})}catch{return c.push(d),null}},f=Ut(r,([d,p],h)=>{if(a[h])return v(h);switch(h){case"CheckNonce":return ts(d(i));case"CheckMortality":return s.mortal?rs(Rh({period:s.period,startAtBlock:s.startAtBlock.height}),ue(s.startAtBlock.hash)):rs(es,e);case"ChargeTransactionPayment":return ts(d(o));case"ChargeAssetTxPayment":return ts(Ph({tip:o,asset:u.asset}));case"CheckGenesis":return ns(e);case"CheckMetadataHash":return rs(es,es);case"CheckSpecVersion":return ns(p(l.spec_version));case"CheckTxVersion":return ns(p(l.transaction_version));default:return v(h)}});return c.forEach(d=>{delete f[d]}),Ut(f,(d,p)=>({...d,identifier:p}))}},ma="AccountNonceApi_account_nonce",Uh={1:D.dec,2:Ne.dec,4:Ve.dec,8:Gt.dec},Mh=(e,t,n)=>e(n,ma,t).pipe(I(r=>{const s=ue(r),o=Uh[s.length];if(!o)throw new Error(`${ma} retrieved wrong data`);return o(s)})),Lh=(e,t,n,r,s,o={})=>zt([o.nonce?oe(o.nonce):Dh(e,Z(t.publicKey)),e.getRuntimeContext$(r.hash),e.genesis$]).pipe(fe(1),M(([i,a,u])=>{const c=va(ue(u),a.lookup,a.dynamicBuilder),l=o.mortality??{period:64,mortal:!0},v=c({nonce:i,tip:o.tip??0n,mortality:l.mortal?{mortal:!0,period:l.period,startAtBlock:{height:r.number,hash:r.hash}}:{mortal:!1},customSignedExtensions:s,asset:o.asset});return t.signTx(n,v,a.metadataRaw,r.number)})),Dh=(e,t)=>{const n=o=>e.newBlocks$.pipe(Kn((i,a)=>a.parent===i?a.hash:i,o),Ui(o),ve()),r=o=>n(o).pipe(fe(2),Nn(i=>Mh(e.call$,t,i))),s=o=>zt(o.map(i=>r(i).pipe(I(a=>({success:!0,value:a})),$e(a=>oe({success:!1,value:a}))))).pipe(fe(1));return e.pinnedBlocks$.pipe(Ue(o=>!o.recovering&&o.blocks.size>0),fe(1),I(({blocks:o,best:i})=>{const a=o.get(i);return[...o.values()].filter(u=>!u.unpinnable&&u.children.size===0&&u.number>=a.number).map(u=>u.hash)}),Nn(s),I(o=>{const i=o.reduce((a,u)=>u.success&&u.value>=(a??0)?u.value:a,null);if(i==null)throw o[0].value;return i}))};var Vh=Object.defineProperty,Hh=(e,t,n)=>t in e?Vh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fh=(e,t,n)=>Hh(e,t+"",n);const jh=(e,t)=>new U(n=>{const r=new Map;let s,o;const i=()=>{let u=s.best,c=r.get(u),l=s.blocks.get(u).number;for(;!c;){const d=s.blocks.get(u);if(!d)break;c=r.get(u=d.parent),l--}if(!c)return;const v=l<=s.blocks.get(s.finalized).number,f=c.found.type;if(f&&o?.found&&o.hash===c.hash){v&&n.complete();return}n.next(o=c.found.type?{found:f,hash:c.hash,number:l,index:c.found.index,events:c.found.events}:{found:f,validity:c.found.validity}),v&&(f?n.complete():c.found.validity?.success===!1&&n.error(new ss(c.found.validity.value)))},a=t.pipe(ve((u,c)=>u.finalized===c.finalized&&u.best===c.best)).subscribe({next:u=>{s=u,r.size!==0&&i()},error(u){n.error(u)}});return a.add(e.subscribe({next:u=>{r.set(u.hash,u),i()},error(u){n.error(u)}})),a}).pipe(ve((n,r)=>n===r)),zh=(e,t)=>{const n=e.filter(s=>s.phase.type==="ApplyExtrinsic"&&s.phase.value===t).map(s=>({...s.event,topics:s.topics})),r=n[n.length-1];return r.type==="System"&&r.value.type==="ExtrinsicFailed"?{ok:!1,events:n,dispatchError:r.value.value.dispatch_error}:{ok:!0,events:n}};class ss extends Error{constructor(t){super(JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r instanceof He?r.asHex():r,2)),Fh(this,"error"),this.name="InvalidTxError",this.error=t}}const os=(e,t,n,r=!1)=>e.hasher$.pipe(M(s=>{const o=s(ue(n)),i=(p,h)=>({type:p,txHash:o,...h}),a=e.pinnedBlocks$.state,u=p=>{if(!p.mortal)return 0;const{phase:h,period:m}=p,y=a.blocks.get(a.best).number;return Math.floor((Math.max(y,h)-h)/m)*m+h},c=p=>{let h=[...a.blocks.values()].filter(b=>!b.unpinnable&&!b.children.size);const m=Math.max(...h.map(({number:b})=>b));h=h.filter(({number:b})=>b>=m-1);const y=a.blocks.get(a.finalized);return h=y.children?[y,...h]:h,h.filter(b=>b.number>=p)},l=({hash:p})=>e.validateTx$(p,n),v=Wn(()=>a.finalizedRuntime.runtime.pipe(I(p=>p.getMortalityFromTx(n)),I(u),I(c),M(p=>{let h;return ln(...p.map(m=>ql(l(m),e.finalized$.pipe(Xn(y=>{if(y.number<m.number)return!0;let b=y;for(;b.number>m.number;){const g=a.blocks.get(b.parent);if(!g)return!1;b=g}return b.hash===y.hash}),Ri(),Pi({success:null}))))).pipe(Ue((m,y)=>{if(m.success===!1&&(h??(h=new ss(m.value))),m.success)return!0;if(y===p.length-1&&h)throw h;return!1}),fe(1))}),Ri())),f=new U(p=>{const h=e.trackTx$(n).subscribe(p);return h.add(t(n).subscribe({error(m){p.error(m)}})),h}),d=jh(f,e.pinnedBlocks$).pipe(I(p=>p.found?i("txBestBlocksState",{found:!0,block:{index:p.index,number:p.number,hash:p.hash},...zh(p.events,p.index)}):i("txBestBlocksState",{found:!1,isValid:p.validity?.success!==!1})));return zn(r?oe(i("signed",{})):mt,v,oe(i("broadcasted",{})),d.pipe(wh(({found:p,type:h,...m})=>p?oe(i("finalized",m)):mt)))})),ya=async(e,t,n,r)=>Ol(os(e,t,n)).then(s=>{if(s.type!=="finalized")throw null;const o={...s};return delete o.type,o}),Wh=kt().enc,qh=new Uint8Array(64),Kh=new Uint8Array(65),Nh=e=>()=>e?Kh:qh,[,Xh]=se({weight:se({ref_time:Cn,proof_size:Cn}),class:we({Normal:O,Operational:O,Mandatory:O}),partial_fee:ms}),ba=(e,t,n,r,{isCompatible:s,getCompatibilityLevel:o,compatibleRuntime$:i,argsAreCompatible:a,getRuntimeTypedef:u},c)=>Object.assign(l=>{const v=(w,k,E={})=>{const S=nr(w).runtime(),{dynamicBuilder:x,assetId:_,lookup:P}=S;let X;try{X=x.buildCall(e,t)}catch{throw new Error(`Runtime entry Tx(${e}.${t}) not found`)}if(c&&!a(w,S,k))throw new Error(`Incompatible runtime entry Tx(${e}.${t})`);let q=E;if(E.asset){if(_==null||!_r(E.asset,Un(P(_)),ae=>u(S,ae)))throw new Error("Incompatible runtime asset");q={...E,asset:x.buildDefinition(_).enc(E.asset)}}const{location:ie,codec:j}=X;return{callData:He.fromBytes(re([new Uint8Array(ie),j.enc(k)])),options:q}},f=(w,k={})=>i(n,null).pipe(I(([E])=>v(E,w,k))),d=w=>w?v(w,l).callData:We(f(l).pipe(I(k=>k.callData))),p=(w,{...k},E)=>f(l,k).pipe(M(({callData:S,options:x})=>Lh(n,w,S.asBytes(),E,k.customSignedExtensions||{},x))),h=(w,{at:k,...E}={})=>(!k||k==="finalized"?n.finalized$:k==="best"?n.best$:n.bestBlocks$.pipe(I(S=>S.find(x=>x.hash===k)))).pipe(fe(1),M(S=>S?p(w,E,S).pipe(I(x=>({tx:Z(x),block:S}))):Fn(()=>new Error(`Uknown block ${k}`)))),m=(w,k)=>We(h(w,k)).then(E=>E.tx),y=(w,k)=>We(h(w,k)).then(({tx:E,block:S})=>ya(n,r,E,S.hash)),b=(w,k)=>h(w,k).pipe(M(({tx:E})=>os(n,r,E,!0))),g=async(w,k)=>{typeof w=="string"&&(w=w.startsWith("0x")?ue(w):Wh(w));const E=w.length===20,S=Ch(w,E?"Ecdsa":"Sr25519",Nh(E)),x=ue(await m(S,k)),_=Z(re([x,Ve.enc(x.length)])),P=n.getRuntimeContext$(null).pipe(I(q=>{try{return q.dynamicBuilder.buildRuntimeCall("TransactionPaymentApi","query_info").value[1]}catch{return Xh}})),X=n.call$(null,"TransactionPaymentApi_query_info",_);return We(zt([X,P]).pipe(I(([q,ie])=>ie(q))))};return{getPaymentInfo:g,getEstimatedFees:async(w,k)=>(await g(w,k)).partial_fee,decodedCall:{type:e,value:$t(t,l)},getEncodedData:d,sign:m,signSubmitAndWatch:b,signAndSubmit:y}},{getCompatibilityLevel:o,isCompatible:s});var Yh=Object.defineProperty,Gh=(e,t,n)=>t in e?Yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ze=(e,t,n)=>(Gh(e,typeof t!="symbol"?t+"":t,n),n),is=Symbol("SUSPENSE"),Qh=class extends Promise{constructor(e){super(e)}},ga=class extends Error{constructor(){super(),this.name="NoSubscribersError"}},wa=class extends Error{constructor(){super(),this.name="EmptyObservableError"}},Ie={},sr=class extends U{constructor(e,t,n=Se){super(r=>{const s=new an({next:r.next.bind(r),error:r.error.bind(r),complete:Se});this.refCount++;let o;r.add(()=>{var i;this.refCount--,o.unsubscribe(),this.refCount===0&&(this.currentValue=Ie,this.subscription&&this.subscription.unsubscribe(),n(),(i=this.subject)==null||i.complete(),this.subject=null,this.subscription=null,this.promise&&(this.promise.rej(new ga),this.promise=null))}),this.subject?(o=this.subject.subscribe(s),this.currentValue!==Ie&&r.next(this.currentValue)):(this.subject=new ze,o=this.subject.subscribe(s),this.subscription=null,this.subscription=new an({next:i=>{this.promise&&i!==is&&(this.promise.res(i),this.promise=null),this.subject.next(this.currentValue=i)},error:i=>{var a;this.subscription=null;const u=this.subject;this.subject=null,this.currentValue=Ie;const c=(a=this.promise)==null?void 0:a.rej;c&&i===is&&(this.promise.rej=()=>{c(i)}),u.error(i),c&&this.promise&&(this.promise.rej=c)},complete:()=>{if(this.subscription=null,this.promise&&(this.promise.rej(new wa),this.promise=null),this.currentValue!==Ie)return this.subject.complete();if(t===Ie){const i=this.subject;return this.subject=null,i.error(new wa)}this.subject.next(this.currentValue=t),this.subject.complete()}}),e.subscribe(this.subscription),t!==Ie&&this.currentValue===Ie&&this.subject.next(this.currentValue=t))}),this.defaultValue=t,Ze(this,"subject",null),Ze(this,"subscription",null),Ze(this,"refCount",0),Ze(this,"currentValue",Ie),Ze(this,"promise",null),Ze(this,"pipeState",(...r)=>{const s=super.pipe(...r);return s instanceof sr?s:new sr(s,Ie)}),Ze(this,"getRefCount",()=>this.refCount),Ze(this,"getValue",()=>{if(this.promise)return this.promise.p;if(this.currentValue!==Ie&&this.currentValue!==is)return this.currentValue;if(this.defaultValue!==Ie)return this.defaultValue;if(this.refCount===0)throw new ga;const r=new Qh((s,o)=>{this.promise={res:s,rej:o,p:null}});return this.promise.p=r,r}),Ze(this,"getDefaultValue",()=>this.defaultValue),t===Ie&&delete this.getDefaultValue}};function xa(e,t){t.getValue=e.getValue,t.getRefCount=e.getRefCount,t.pipeState=e.pipeState,e.getDefaultValue&&(t.getDefaultValue=e.getDefaultValue)}function Zh(e,t){const n=new Jh,r=typeof t=="function"?t:()=>t,s=o=>{for(let v=o.length-1;o[v]===void 0&&v>-1;v--)o.splice(-1);const i=[o.length,...o],a=n.get(i);if(a!==void 0)return a;const u=new sr(e(...o),r(...o),()=>{n.delete(i)}),c=new U(v=>{const f=n.get(i);let d=u;return f?f!==c&&(d=f,xa(d,c)):n.set(i,l),d.subscribe(v)});xa(u,c);const l=c;return n.set(i,l),l};return(...o)=>s(o)}var Jh=class{constructor(){Ze(this,"root"),this.root=new Map}get(e){let t=this.root;for(let n=0;n<e.length;n++)if(t=t.get(e[n]),!t)return;return t}set(e,t){let n=this.root,r;for(r=0;r<e.length-1;r++){let s=n.get(e[r]);s||(s=new Map,n.set(e[r],s)),n=s}n.set(e[r],t)}delete(e){const t=[this.root];let n=this.root;for(let s=0;s<e.length-1;s++)t.push(n=n.get(e[s]));let r=t.length-1;for(t[r].delete(e[r]);--r>-1&&t[r].get(e[r]).size===0;)t[r].delete(e[r])}};function ed(e,t){return new sr(e,t)}var as=(...e)=>(typeof e[0]=="function"?Zh:ed)(e[0],e.length>1?e[1]:Ie);const Ea=(e,t,n)=>{const r=new Map(t.map(a=>[a.key,a])),s=new Map(e.map(a=>[a.key,a])),o=new Map,i=[];return t.forEach(a=>{const{key:u}=a,c=s.get(u);(!c||c.value!==a.value)&&o.set(u,n(a))}),e.forEach(a=>{r.has(a.key)||i.push(a)}),{deltas:{deleted:i,upserted:[...o.values()]},entries:t.map(({key:a})=>o.get(a)??s.get(a))}},ka=(e,t,n,r=!1)=>{try{let s=r?e:n.blocks.get(e).parent;for(;s&&!t[s];)s=n.blocks.get(s).parent;return s?t[s]:null}catch{return null}},Aa=(e,t)=>n=>{const{keys:r,value:s}=n.dynamicBuilder.buildStorage(e,t);return o=>(o.dec={value:s.dec(o.value),args:r.dec(o.key)},o)},td=(e,t,n)=>{const r=as((a,u,c)=>{const l=Aa(a,u),v=(m,y)=>{const b=hh(e,y.hash).pipe(Ue(g=>!g),fe(1));return t(y.hash,"closestDescendantMerkleValue",()=>c).pipe(M(g=>g===m?.rootHash?oe({...m,block:y,deltas:null,prev:m.block.hash}):t(y.hash,"descendantsValues",()=>c).pipe(n(()=>y.hash),I(([w,k])=>[w,l(k)]),I(([w,k])=>({prev:m&&m.block.hash,rootHash:g,block:y,...Ea(m?.entries??[],w,k)})))),Mi(b),$e(g=>g instanceof Qe?mt:Fn(()=>g)))},f=e.pipe(ve((m,y)=>m.finalized===y.finalized),Zr(({blocks:m,finalized:y})=>v(null,m.get(y))),fe(1),I(m=>({blocks:{[m.block.hash]:m},finalized:m.block.hash}))),[d,p]=xh(),h=e.pipe(ve((m,y)=>m.best===y.best),zr(d),Zr(([m,y])=>{const{best:b}=m,{blocks:g}=y;let w=g[b]?null:b;if(!w)return mt;const k=ka(w,g,m);return k?v(k,m.blocks.get(w)).pipe(I(E=>(g[w]=E,y))):(w=m.finalized,v(g[y.finalized],m.blocks.get(w)).pipe(I(E=>(E.prev=null,{blocks:{[w]:E},finalized:w}))))}));return ln(f,h).pipe(p())}),s=a=>(u,c,l)=>{const v=r(u,c,l),f=Aa(u,c),d=a?"finalized":"best";return zt([v.pipe(Zl(0)),e.pipe(ve((p,h)=>p[d]===h[d]))]).pipe(I(([p,h])=>ka(h[d],p.blocks,h,!0)),Ue(Boolean),ve(),Ui(null),nf(),zr(v),n(([[,p]])=>p.block.hash),I(([[[p,h],m],y])=>[p,h,m,f(y)]),M(([p,h,m,y])=>{if(!p)return[h];let b=h;const g=[];for(;b&&b.block.number>p.block.number;)g.unshift(b),b=b.prev?m.blocks[b.prev]:null;if(a&&(m.finalized=h.block.hash,g.length)){const{blocks:w}=m;Object.keys(w).forEach(k=>{w[k].block.number<g[0].block.number&&delete w[k]})}return p===b?g:[{...h,...p.rootHash===h.rootHash?{entries:p.entries,deltas:null}:Ea(p.entries,h.entries,y)}]}))},o=as(s(!0)),i=as(s(!1));return(a,u,c,l)=>{const v=l?i:o;return e.pipe(fe(1),M(f=>f.runtimes[f.blocks.get(f[l?"best":"finalized"]).runtime].runtime),I(f=>f.dynamicBuilder.buildStorage(a,u).keys.enc(...c))).pipe(fe(1),M(f=>v(a,u,f)),I(({block:{hash:f,number:d,parent:p},deltas:h,entries:m},y)=>{const b=y>0?h:{deleted:[],upserted:m};return{block:{hash:f,number:d,parent:p},entries:m.map(cs),deltas:b&&{deleted:b.deleted.map(cs),upserted:b.upserted.map(cs)}}}))}},cs=e=>e.dec,Sa="RuntimeViewFunction",$a="execute_view_function",us=Sa+"_"+$a,nd=(e,t,n,{isCompatible:r,getCompatibilityLevel:s,compatibleRuntime$:o,argsAreCompatible:i,valuesAreCompatible:a})=>{const u=()=>new Error(`Incompatible runtime entry ViewFn(${e}.${t})`);return Object.assign((...c)=>{const l=c[c.length-1],v=Nt(l),{signal:f,at:d}=v?l:{},p=d??null,h=o(n,p).pipe(M(([m,y])=>{let b;try{b=y.dynamicBuilder.buildRuntimeCall(Sa,$a)}catch{throw new Error(`Runtime entry RuntimeCall(${us}) not found`)}let g;try{g=y.dynamicBuilder.buildViewFn(e,t)}catch{throw new Error(`Runtime entry ViewFn(${e}.${t}) not found`)}if(!i(m,y,c))throw u();const w=g.args.enc(c),k=re([ue(y.lookup.metadata.pallets.find(({name:E})=>E===e).viewFns.find(({name:E})=>E===t).id),C.enc(w.length),w]);return n.call$(p,us,Z(k)).pipe(I(E=>{try{const S=b.value.dec(E);if(!("success"in S&&"value"in S)||!("type"in S.value)&&!("asBytes"in S.value))throw null;return S}catch{throw new Error(`Unexpected RuntimeCall(${us}) type`)}}),I(({success:E,value:S})=>{if(!E)throw new Error(`ViewFn API Error: ${S.type}`);const x=g.value.dec(S.asBytes());if(!a(m,y,x))throw u();return x}))}),n.withHodl(p));return Kt(h,f)},{getCompatibilityLevel:s,isCompatible:r})},rd=/^(?:0x)?((?:[0-9a-fA-F][0-9a-fA-F])+)$/,Ia=(e,t,n)=>{const r={},s=m=>new Proxy(r,{get(y,b){return m(b)}}),o=m=>{const y={};return s(b=>(y[b]||(y[b]={}),s(g=>(y[b][g]||(y[b][g]=m(b,g)),y[b][g]))))},i=(m,y)=>m.lookup.metadata.pallets.find(b=>b.name===y),a=td(t.pinnedBlocks$,t.storage$,t.withRuntime),u=o((m,y)=>Ah(m,y,t,a,Rt(e,b=>b.getEntryPoint(wt.Storage,m,y),b=>{const g=i(b,m)?.storage?.items.find(w=>w.name===y);return g==null?null:Yu(g)}))),c=(m,y,b,g)=>{if(b==null)return null;const w=m.lookup(b);if(w.type!=="enum")throw new Error("Expected enum");if(w.value[g]==null)return null;const k=Gu(w.value[g]);return{args:y==="args"?k:Ln,values:y==="args"?Ln:k}},l=o((m,y)=>ba(m,y,t,n,Rt(e,b=>b.getEntryPoint(wt.Tx,m,y),b=>c(b,"args",i(b,m)?.calls?.type,y)),!0)),v=o((m,y)=>Eh(m,y,t,Rt(e,b=>b.getEntryPoint(wt.Event,m,y),b=>c(b,"values",i(b,m)?.events?.type,y)))),f=o((m,y)=>bh(m,y,Rt(e,b=>b.getEntryPoint(wt.Const,m,y),b=>{const g=i(b,m)?.constants.find(w=>w.name===y)?.type;return g==null?null:Qu(g)}))),d=o((m,y)=>kh(m,y,t,Rt(e,b=>b.getEntryPoint(wt.Api,m,y),b=>Jo(b.lookup.metadata.apis.find(g=>g.name===m).methods.find(g=>g.name===y))))),p=o((m,y)=>nd(m,y,t,Rt(e,b=>b.getEntryPoint(wt.ViewFns,m,y),b=>Jo(b.lookup.metadata.pallets.find(g=>g.name===m).viewFns.find(g=>g.name===y))))),h=(m,y)=>{const{lookup:b,dynamicBuilder:g}=nr(y).runtime();try{const w=g.buildDefinition(b.call).dec(m.asBytes()),k=w.type,E=w.value.type,S=w.value.value;return ba(k,E,t,n,Rt(e,x=>x.getEntryPoint(wt.Tx,k,E),x=>c(x,"args",i(x,k)?.calls?.type,E)),!1)(S)}catch{throw new Error("createTx: invalid call data")}};return{query:u,txFromCallData:(m,y)=>y?h(m,y):e.then(b=>h(m,b)),tx:l,event:v,apis:d,constants:f,view:p}};function sd(e,{getMetadata:t,setMetadata:n}={}){const r=Af(e),s=fh(r,{getMetadata:t?b=>bt(t(b)):void 0,setMetadata:n}),{getChainSpecData:o}=r,{genesis$:i,...a}=s.chainHead$(),u=s.archive(a.getRuntime$),c={...a,genesis$:Wn(o).pipe(I(({genesisHash:b})=>b),$e(()=>i),hn(1)),storage$:Ot(a.storage$,u.storage$),body$:Ot(a.body$,u.body$),call$:Ot(a.call$,u.call$),header$:Ot(a.header$,u.header$),eventsAt$:Ot(a.eventsAt$,u.eventsAt$),storageQueries$:Ot(a.storageQueries$,u.storageQueries$),getRuntimeContext$:Ot(a.getRuntimeContext$,u.getRuntimeContext$)},l=r.request;let v;const f=new WeakMap,d=b=>{const g=f.get(b)||mh(b,c);return f.set(b,g),g},p=()=>v??(v=yh(c)),{broadcastTx$:h}=s,m=b=>c.getRuntimeContext$(b).pipe(I(g=>g.metadataRaw)),y={getChainSpecData:o,getMetadata$:m,getMetadata:(b,g)=>Kt(m(b),g),blocks$:c.newBlocks$,hodlBlock:b=>c.holdBlock(b,!0),finalizedBlock$:c.finalized$,getFinalizedBlock:()=>We(c.finalized$),bestBlocks$:c.bestBlocks$,getBestBlocks:()=>We(c.bestBlocks$),watchBlockBody:c.body$,getBlockBody:b=>We(c.body$(b)),getBlockHeader:b=>We(c.header$(b??null)),submit:(...b)=>ya(c,h,...b),submitAndWatch:b=>os(c,h,b),getTypedApi:b=>{const g=d(b);return Object.assign(Ia(g,c,h),{compatibilityToken:g})},getUnsafeApi:()=>{const b=p();return Object.assign(Ia(b,c,h),{runtimeToken:b})},rawQuery:(b,{at:g,signal:w}={})=>Kt(c.storage$(g??null,"value",()=>{const k=b.match(rd)?.[1];return k?`0x${k}`:He.fromText(b).asHex()}),w),destroy:()=>{c.unfollow(),s.destroy()},_request:l};return y.___INTERNAL_DO_NOT_USE=c,y}const od=(e,t,n,r,s)=>{let o;try{o=r.buildCall(e,t)}catch{throw new Error(`Runtime entry Tx(${e}.${t}) not found`)}const{location:i,codec:a}=o,u=new Uint8Array(i);return c=>{const l=He.fromBytes(re([u,a.enc(c)]));return{encodedData:l,decodedCall:$t(e,$t(t,c)),sign:async(v,f)=>Z(await v.signTx(l.asBytes(),s(f),n,f.mortality.mortal?f.mortality.startAtBlock.height:0))}}},id=async({genesis:e,getMetadata:t})=>{if(!e)throw new Error("Missing genesis hash");const n=ue(e),r=await t(),s=Lt(dt.dec(r)),o=Jn(s),i=Nr(o),a=va(n,o,i),u=p=>s.pallets.find(h=>h.name===p),c={},l=p=>new Proxy(c,{get(h,m){return p(m)}}),v=p=>{const h={};return l(m=>(h[m]||(h[m]={}),l(y=>(h[m][y]||(h[m][y]=p(m,y)),h[m][y]))))},f=v((p,h)=>{const m=u(p)?.constants.find(y=>y.name===h);if(!m)throw new Error(`Runtime entry Constant(${p}.${h}) not found`);return i.buildConstant(p,h).dec(m.value)}),d=v((p,h)=>od(p,h,r,i,a));return{constants:f,tx:d}},Xt=(e,t)=>(n,r)=>{try{return e(n,r)}catch{throw new Error(`Runtime entry ${t}(${n}.${r}) not found`)}},ad=async e=>{const t=Lt(Sr(await e.getMetadata())),n={},r=f=>new Proxy(n,{get(d,p){return f(p)}}),s=f=>{const d={};return r(p=>(d[p]||(d[p]={}),r(h=>(d[p][h]||(d[p][h]=f(p,h)),d[p][h]))))},o=Jn(t),{buildRuntimeCall:i,buildStorage:a,buildConstant:u,buildCall:c,buildEvent:l,buildViewFn:v}=Nr(o);return{query:s((...f)=>{const{value:d,args:p}=Xt(a,"Storage")(...f);return{value:d,args:p}}),tx:s((...f)=>Xt(c,"Call")(...f).codec),event:s((...f)=>Xt(l,"Event")(...f).codec),apis:s(Xt(i,"Runtime API")),constants:s(Xt(u,"Constant")),view:s(Xt(v,"ViewFn"))}};ce.AccountId=kt,ce.Binary=He,ce.BlockNotPinnedError=Qe,ce.CompatibilityLevel=Te,ce.Enum=$t,ce.FixedSizeBinary=Bn,ce.InvalidTxError=ss,ce._Enum=ao,ce.createClient=sd,ce.getOfflineApi=id,ce.getSs58AddressInfo=hr,ce.getTypedCodecs=ad}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(C,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(C=typeof globalThis<"u"?globalThis:C||self,i(C.papiWsProvider={}))})(this,(function(C){"use strict";var i=(t=>(t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.ERROR=2]="ERROR",t[t.CLOSE=3]="CLOSE",t))(i||{});const _=t=>JSON.stringify({jsonrpc:"2.0",...t}),M=new Set(["v1","unstable"].map(t=>`chainHead_${t}_unfollow`)),$=t=>{let e={type:1,pending:[]};const s=n=>{if(e.type===0){const o=JSON.parse(n);if("id"in o)"result"in o&&e.onGoingRequests.get(o.id)?.type===0&&e.activeChainHeads.add(o.result),e.onGoingRequests.delete(o.id);else if("params"in o){const{subscription:l,result:u}=o.params;u?.event==="stop"&&e.activeChainHeads.delete(l)}}e.type!==2&&t(n)},r=n=>{if(e.type===2)return;if(e.type===1){e.pending.push(n);return}const o=JSON.parse(n);if(M.has(o.method)&&e.activeChainHeads.delete(o.params[0]),"id"in o){const{method:l,id:u}=o,d=l.startsWith("chainHead")?l.endsWith("follow")?{type:0,msg:n}:{type:1,id:u}:{type:2,msg:n};e.onGoingRequests.set(u,d)}e.connection.send(n)};return{send:r,disconnect:()=>{e.type!==2&&(e.type===0&&e.connection.disconnect(),e={type:2})},connect:n=>{if(e.type!==1)throw new Error("Nonesense");const{pending:o}=e,l=new Map,u=new Set;e={type:0,connection:n(s,()=>{e={type:1,pending:[]},u.forEach(h=>{s(_({params:{subscription:h,result:{event:"stop",internal:!0}}}))}),u.clear();for(const h of l.values())h.type===1?s(_({id:h.id,error:{code:-32603,message:"Internal error"},internal:!0})):r(h.msg);l.clear()}),onGoingRequests:l,activeChainHeads:u},o.forEach(r)}}},k=t=>e=>{let s=$(e);const r=()=>{t().then(n=>{if(s)s.connect((o,l)=>n(o,()=>{l(),r()}));else try{n(()=>{},()=>{}).disconnect()}catch{}},()=>{s&&setTimeout(r,0)})};return r(),{send:n=>{s?.send(n)},disconnect:()=>{s?.disconnect(),s=null}}},H={};["v1","unstable"].forEach(t=>{H[`chainHead_${t}_follow`]="follow",H[`chainHead_${t}_unfollow`]="unfollow"});const q=(t,e)=>{const s=new Set,r=new Map,n=new Set;let o;return Object.assign(u=>{const{send:d,disconnect:h}=t(p=>{const f=JSON.parse(p);if("id"in f){const{id:c,result:E}=f;if(c===o&&(o=void 0,E&&!E.methods.some(m=>{const[a,,N]=m.split("_");return a==="chainHead"&&N==="follow"}))){u(p),e();return}const y=r.get(c);if(y){if(r.delete(c),s.has(E)){s.delete(E);return}n.add(E);const m=n.size+r.size;if(m>2)console.warn(`Too many chainHead follow subscriptions (${m})`);else if(f.error){console.warn(`chainHead follow failed on the ${m} sub`),e(),r.set(c,y),d(y);return}}}else{const{subscription:c,result:E}=f.params;E?.event==="stop"&&(n.has(c)?n.delete(c):s.add(c))}u(p)});return{send(p){const f=JSON.parse(p);f.method==="rpc_methods"&&(o=f.id);const c=H[f.method];c==="follow"?r.set(f.id,p):c==="unfollow"&&n.delete(f.params[0]),d(p)},disconnect:h}},{cleanup:()=>{s.clear(),r.clear(),n.clear()}})},G={type:i.ERROR,event:{type:"timeout"}},S=()=>{},J={onStatusChanged:S,innerEnhancer:t=>t,timeout:5e3},j=t=>t.map(e=>typeof e=="string"?[e]:[e.uri,e.protocol]),x=(t,e)=>{const{onStatusChanged:s,innerEnhancer:r,timeout:n}={...J,...e},o=j(Array.isArray(t)?t:[t]),l=e?.websocketClass??globalThis.WebSocket;if(!l)throw new Error("Missing WebSocket class");let u=0,d,h=null,p=S,f=S;const c=q(k(async()=>{const[y,m]=h||o[u++%t.length];h=null;const a=new l(y,m),N=()=>{try{a.addEventListener("error",S,{once:!0}),a.close()}catch{}};s(d={type:i.CONNECTING,uri:y,protocols:m}),await new Promise((L,v)=>{const T=()=>{R(),L()},O=g=>{R(),g==null&&N(),console.error(`Unable to connect to ${y}${m?", protocols: "+m:""}`),s(d={type:g?i.ERROR:i.CLOSE,event:g}),setTimeout(v,g?300:0,g)},b=n!==1/0?setTimeout(()=>{R(),N(),s(d=G),v(G.event)},n):void 0,R=()=>{clearTimeout(b),a.removeEventListener("error",O),a.removeEventListener("open",T)};a.addEventListener("open",T),a.addEventListener("error",O),p=()=>{O(null)}}),s(d={type:i.CONNECTED,uri:y,protocols:m});let I;const z=r(L=>(I=L,{send:v=>{a.send(v)},disconnect:()=>{p()}}));return(L,v)=>{const T=z(L),O=w=>{typeof w.data=="string"&&I(w.data)},b=w=>P=>{console.warn(`WS halt (${w})`),s(d={type:w,event:P}),v()},R=b(i.ERROR),g=b(i.CLOSE);return a.addEventListener("message",O),a.addEventListener("error",R),a.addEventListener("close",g),p=w=>{f(),p=S,a.removeEventListener("message",O),a.removeEventListener("error",R),a.removeEventListener("close",g),N(),w&&g({})},T}}),()=>{E()});f=c.cleanup,delete c.cleanup;const E=(...y)=>{d.type!==i.CLOSE&&(y.length&&(h=y),d.type!==i.ERROR&&p(!0))};return Object.assign(c,{switch:E,getStatus:()=>d})};C.WsEvent=i,C.getWsProvider=x}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(C,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(C=typeof globalThis<"u"?globalThis:C||self,v(C.papiWsProviderWeb={}))})(this,(function(C){"use strict";const v=t=>JSON.stringify({jsonrpc:"2.0",...t}),M=new Set(["v1","unstable"].map(t=>`chainHead_${t}_unfollow`)),W=t=>{let e={type:1,pending:[]};const s=o=>{if(e.type===0){const n=JSON.parse(o);if("id"in n)"result"in n&&e.onGoingRequests.get(n.id)?.type===0&&e.activeChainHeads.add(n.result),e.onGoingRequests.delete(n.id);else if("params"in n){const{subscription:r,result:c}=n.params;c?.event==="stop"&&e.activeChainHeads.delete(r)}}e.type!==2&&t(o)},i=o=>{if(e.type===2)return;if(e.type===1){e.pending.push(o);return}const n=JSON.parse(o);if(M.has(n.method)&&e.activeChainHeads.delete(n.params[0]),"id"in n){const{method:r,id:c}=n,d=r.startsWith("chainHead")?r.endsWith("follow")?{type:0,msg:o}:{type:1,id:c}:{type:2,msg:o};e.onGoingRequests.set(c,d)}e.connection.send(o)};return{send:i,disconnect:()=>{e.type!==2&&(e.type===0&&e.connection.disconnect(),e={type:2})},connect:o=>{if(e.type!==1)throw new Error("Nonesense");const{pending:n}=e,r=new Map,c=new Set;e={type:0,connection:o(s,()=>{e={type:1,pending:[]},c.forEach(h=>{s(v({params:{subscription:h,result:{event:"stop",internal:!0}}}))}),c.clear();for(const h of r.values())h.type===1?s(v({id:h.id,error:{code:-32603,message:"Internal error"},internal:!0})):i(h.msg);r.clear()}),onGoingRequests:r,activeChainHeads:c},n.forEach(i)}}},A=t=>e=>{let s=W(e);const i=()=>{t().then(o=>{if(s)s.connect((n,r)=>o(n,()=>{r(),i()}));else try{o(()=>{},()=>{}).disconnect()}catch{}},()=>{s&&setTimeout(i,0)})};return i(),{send:o=>{s?.send(o)},disconnect:()=>{s?.disconnect(),s=null}}};var f=(t=>(t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.ERROR=2]="ERROR",t[t.CLOSE=3]="CLOSE",t))(f||{});const _={};["v1","unstable"].forEach(t=>{_[`chainHead_${t}_follow`]="follow",_[`chainHead_${t}_unfollow`]="unfollow"});const P=(t,e)=>{const s=new Set,i=new Map,o=new Set;let n;return Object.assign(c=>{const{send:d,disconnect:h}=t(u=>{const p=JSON.parse(u);if("id"in p){const{id:a,result:E}=p;if(a===n&&(n=void 0,E&&!E.methods.some(m=>{const[l,,L]=m.split("_");return l==="chainHead"&&L==="follow"}))){c(u),e();return}const y=i.get(a);if(y){if(i.delete(a),s.has(E)){s.delete(E);return}o.add(E);const m=o.size+i.size;if(m>2)console.warn(`Too many chainHead follow subscriptions (${m})`);else if(p.error){console.warn(`chainHead follow failed on the ${m} sub`),e(),i.set(a,y),d(y);return}}}else{const{subscription:a,result:E}=p.params;E?.event==="stop"&&(o.has(a)?o.delete(a):s.add(a))}c(u)});return{send(u){const p=JSON.parse(u);p.method==="rpc_methods"&&(n=p.id);const a=_[p.method];a==="follow"?i.set(p.id,u):a==="unfollow"&&o.delete(p.params[0]),d(u)},disconnect:h}},{cleanup:()=>{s.clear(),i.clear(),o.clear()}})},k={type:f.ERROR,event:{type:"timeout"}},S=()=>{},G={onStatusChanged:S,innerEnhancer:t=>t,timeout:5e3},$=t=>t.map(e=>typeof e=="string"?[e]:[e.uri,e.protocol]),j=(t,e)=>{const{onStatusChanged:s,innerEnhancer:i,timeout:o}={...G,...e},n=$(Array.isArray(t)?t:[t]),r=e?.websocketClass??globalThis.WebSocket;if(!r)throw new Error("Missing WebSocket class");let c=0,d,h=null,u=S,p=S;const a=P(A(async()=>{const[y,m]=h||n[c++%t.length];h=null;const l=new r(y,m),L=()=>{try{l.addEventListener("error",S,{once:!0}),l.close()}catch{}};s(d={type:f.CONNECTING,uri:y,protocols:m}),await new Promise((b,O)=>{const T=()=>{N(),b()},R=g=>{N(),g==null&&L(),console.error(`Unable to connect to ${y}${m?", protocols: "+m:""}`),s(d={type:g?f.ERROR:f.CLOSE,event:g}),setTimeout(O,g?300:0,g)},H=o!==1/0?setTimeout(()=>{N(),L(),s(d=k),O(k.event)},o):void 0,N=()=>{clearTimeout(H),l.removeEventListener("error",R),l.removeEventListener("open",T)};l.addEventListener("open",T),l.addEventListener("error",R),u=()=>{R(null)}}),s(d={type:f.CONNECTED,uri:y,protocols:m});let I;const J=i(b=>(I=b,{send:O=>{l.send(O)},disconnect:()=>{u()}}));return(b,O)=>{const T=J(b),R=w=>{typeof w.data=="string"&&I(w.data)},H=w=>z=>{console.warn(`WS halt (${w})`),s(d={type:w,event:z}),O()},N=H(f.ERROR),g=H(f.CLOSE);return l.addEventListener("message",R),l.addEventListener("error",N),l.addEventListener("close",g),u=w=>{p(),u=S,l.removeEventListener("message",R),l.removeEventListener("error",N),l.removeEventListener("close",g),L(),w&&g({})},T}}),()=>{E()});p=a.cleanup,delete a.cleanup;const E=(...y)=>{d.type!==f.CLOSE&&(y.length&&(h=y),d.type!==f.ERROR&&u(!0))};return Object.assign(a,{switch:E,getStatus:()=>d})},q=(t=>(...e)=>{let s=[],{timeout:i,innerEnhancer:o,onStatusChanged:n}=G;const[r]=e;return e.length===1&&typeof r=="object"&&!Array.isArray(r)?(s=$(r.endpoints),n=r.onStatusChanged??S,i=r.timeout??i,o=r.innerEnhancer??(c=>c)):(typeof e[1]=="function"&&(n=e[1]),Array.isArray(r)?s=$(r):(s=[[r]],e[1]&&e[1]!==n&&(s[0][1]=e[1]),e[2]&&(n=e[2]))),j(s.map(c=>c.length===1?c[0]:{uri:c[0],protocol:c[1]}),{websocketClass:t,onStatusChanged:n,timeout:i,innerEnhancer:o})})(WebSocket);C.WsEvent=f,C.getWsProvider=q}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polkadot-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"author": "Josep M Sobrepere (https://github.com/josepot)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -84,6 +84,18 @@
|
|
|
84
84
|
"require": "./dist/reexports/sm-provider.js",
|
|
85
85
|
"default": "./dist/reexports/sm-provider.js"
|
|
86
86
|
},
|
|
87
|
+
"./ws-provider": {
|
|
88
|
+
"types": "./dist/reexports/ws-provider.d.ts",
|
|
89
|
+
"node": {
|
|
90
|
+
"import": "./dist/esm/reexports/ws-provider.mjs",
|
|
91
|
+
"require": "./dist/reexports/ws-provider.js",
|
|
92
|
+
"default": "./dist/reexports/ws-provider.js"
|
|
93
|
+
},
|
|
94
|
+
"module": "./dist/esm/reexports/ws-provider.mjs",
|
|
95
|
+
"import": "./dist/esm/reexports/ws-provider.mjs",
|
|
96
|
+
"require": "./dist/reexports/ws-provider.js",
|
|
97
|
+
"default": "./dist/reexports/ws-provider.js"
|
|
98
|
+
},
|
|
87
99
|
"./ws-provider/*": {
|
|
88
100
|
"types": "./dist/reexports/ws-provider_*.d.ts",
|
|
89
101
|
"node": {
|
|
@@ -192,24 +204,24 @@
|
|
|
192
204
|
},
|
|
193
205
|
"dependencies": {
|
|
194
206
|
"@rx-state/core": "^0.1.4",
|
|
195
|
-
"@polkadot-api/cli": "0.14.
|
|
196
|
-
"@polkadot-api/
|
|
207
|
+
"@polkadot-api/cli": "0.14.15",
|
|
208
|
+
"@polkadot-api/ink-contracts": "0.3.11",
|
|
197
209
|
"@polkadot-api/json-rpc-provider": "0.0.4",
|
|
210
|
+
"@polkadot-api/known-chains": "0.9.10",
|
|
198
211
|
"@polkadot-api/logs-provider": "0.0.6",
|
|
199
|
-
"@polkadot-api/ink-contracts": "0.3.11",
|
|
200
212
|
"@polkadot-api/metadata-builders": "0.13.5",
|
|
201
|
-
"@polkadot-api/
|
|
202
|
-
"@polkadot-api/observable-client": "0.15.0",
|
|
213
|
+
"@polkadot-api/observable-client": "0.15.1",
|
|
203
214
|
"@polkadot-api/pjs-signer": "0.6.15",
|
|
215
|
+
"@polkadot-api/metadata-compatibility": "0.3.6",
|
|
204
216
|
"@polkadot-api/polkadot-sdk-compat": "2.3.3",
|
|
205
217
|
"@polkadot-api/polkadot-signer": "0.1.6",
|
|
206
218
|
"@polkadot-api/signer": "0.2.9",
|
|
207
|
-
"@polkadot-api/smoldot": "0.3.
|
|
208
|
-
"@polkadot-api/sm-provider": "0.1.
|
|
209
|
-
"@polkadot-api/substrate-client": "0.4.6",
|
|
219
|
+
"@polkadot-api/smoldot": "0.3.14",
|
|
220
|
+
"@polkadot-api/sm-provider": "0.1.11",
|
|
210
221
|
"@polkadot-api/substrate-bindings": "0.16.3",
|
|
211
|
-
"@polkadot-api/
|
|
212
|
-
"@polkadot-api/ws-provider": "0.
|
|
222
|
+
"@polkadot-api/substrate-client": "0.4.7",
|
|
223
|
+
"@polkadot-api/ws-provider": "0.6.0",
|
|
224
|
+
"@polkadot-api/utils": "0.2.0"
|
|
213
225
|
},
|
|
214
226
|
"devDependencies": {
|
|
215
227
|
"rxjs": "^7.8.2",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "polkadot-api_ws-provider",
|
|
3
|
+
"types": "../dist/reexports/ws-provider.d.ts",
|
|
4
|
+
"module": "../dist/esm/reexports/ws-provider.mjs",
|
|
5
|
+
"import": "../dist/esm/reexports/ws-provider.mjs",
|
|
6
|
+
"browser": "../dist/esm/reexports/ws-provider.mjs",
|
|
7
|
+
"require": "../dist/reexports/ws-provider.js",
|
|
8
|
+
"default": "../dist/reexports/ws-provider.js"
|
|
9
|
+
}
|