1/*! For license information please see modu.8a6f905d52c72166.js.LICENSE.txt */ 2"use strict";(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[1080],{88215:(e,t,r)=>{r.d(t,{X:()=>Ln});var n={};r.r(n),r.d(n,{AccountId:()=>sr,Binary:()=>Rr,BitSeq:()=>dn,Blake2128:()=>cr,Blake2128Concat:()=>ur,Blake2256:()=>ar,Blake3256:()=>F,Blake3256Concat:()=>j,Bytes:()=>W.Jj,Enum:()=>ee,Hex:()=>Le,Identity:()=>dr,Keccak256:()=>nn,Option:()=>J,Result:()=>G,ScaleEnum:()=>ie,Self:()=>Lr,SizedBytes:()=>Cr,Storage:()=>qr,Struct:()=>K,TrieNodeHeaders:()=>xn,TrieNodeWithHash:()=>qn,Tuple:()=>z,Twox128:()=>kr,Twox256:()=>Er,Twox64Concat:()=>_r,Variant:()=>se,Vector:()=>Z,_Enum:()=>te,_void:()=>W.R9,bitSequence:()=>Mr,blockHeader:()=>mn,bool:()=>W.Xg,char:()=>Or,compact:()=>W.oA,compactBn:()=>oe,compactNumber:()=>ae,createCodec:()=>W.VG,createDecoder:()=>W.UF,decAnyMetadata:()=>mt,enhanceCodec:()=>W.hD,enhanceDecoder:()=>W.sv,enhanceEncoder:()=>W.J8,ethAccount:()=>on,extrinsicFormat:()=>ue,fixedStr:()=>Dr,fromBufferToBase58:()=>nr,getMultisigAccountId:()=>vn,getSs58AddressInfo:()=>tr,h64:()=>xr,i128:()=>W.bH,i16:()=>W.TQ,i256:()=>W.jn,i32:()=>W.kx,i64:()=>W.fO,i8:()=>W.i8,metadata:()=>ht,selfDecoder:()=>$r,selfEncoder:()=>Vr,sortMultisigSignatories:()=>wn,str:()=>W.Bd,trieNodeDec:()=>An,u128:()=>W.z7,u16:()=>W.KB,u256:()=>W.Ks,u32:()=>W.Jq,u64:()=>W.AW,u8:()=>W.u8,unifyMetadata:()=>ke,v14:()=>at,v14Lookup:()=>Me,v15:()=>ct,v16:()=>dt,validateProofs:()=>Un});const s=e=>{const t=e.reduce(((e,t)=>e+t.byteLength),0),r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const s=e[t];r.set(s,n),n+=s.byteLength}return r},i=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=BigInt(2**32-1),o=BigInt(32);function c(e,t=!1){return t?{h:Number(e&a),l:Number(e>>o&a)}:{h:0|Number(e>>o&a),l:0|Number(e&a)}}const u=(e,t,r)=>e>>>r|t<<32-r,d=(e,t,r)=>e<<32-r|t>>>r,l=(e,t,r)=>e>>>r-32|t<<64-r;function p(e,t,r,n){const s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:0|s}}const h=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),f=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;function y(e,t=""){if(!Number.isSafeInteger(e)||e<0)throw new Error(`${t&&`"${t}" `}expected integer >= 0, got ${e}`)}function g(e,t,r=""){const n=(s=e)instanceof Uint8Array||ArrayBuffer.isView(s)&&"Uint8Array"===s.constructor.name;var s;const i=e?.length,a=void 0!==t;if(!n||a&&i!==t)throw new Error((r&&`"${r}" `)+"expected Uint8Array"+(a?` of length ${t}`:"")+", got "+(n?`length=${i}`:"type="+typeof e));return e}function m(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 b(e,t){g(e,void 0,"digestInto() output");const r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function v(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function w(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function x(e,t){return e<<32-t|e>>>t}const k=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function E(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const _=k?e=>e:e=>E(e),S=k?e=>e:function(e){for(let t=0;t<e.length;t++)e[t]=E(e[t]);return e};function A(e,t={}){const r=(t,r)=>e(r).update(t).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=t=>e(t),Object.assign(r,t),Object.freeze(r)}const q=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 U(e,t,r,n,s){return n=x(n^(e=e+t+s|0),16),{a:e,b:t=x(t^(r=r+n|0),12),c:r,d:n}}function I(e,t,r,n,s){return n=x(n^(e=e+t+s|0),8),{a:e,b:t=x(t^(r=r+n|0),7),c:r,d:n}}const T=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),R=new Uint32Array(32);function C(e,t,r,n,s,i){const a=s[i],o=s[i+1];let c=R[2*e],l=R[2*e+1],y=R[2*t],g=R[2*t+1],m=R[2*r],b=R[2*r+1],v=R[2*n],w=R[2*n+1],x=h(c,y,a);var k,E;l=f(x,l,g,o),c=0|x,({Dh:w,Dl:v}={Dh:w^l,Dl:v^c}),({Dh:w,Dl:v}={Dh:(E=v,E),Dl:(k=w,k)}),({h:b,l:m}=p(b,m,w,v)),({Bh:g,Bl:y}={Bh:g^b,Bl:y^m}),({Bh:g,Bl:y}={Bh:u(g,y,24),Bl:d(g,y,24)}),R[2*e]=c,R[2*e+1]=l,R[2*t]=y,R[2*t+1]=g,R[2*r]=m,R[2*r+1]=b,R[2*n]=v,R[2*n+1]=w}function B(e,t,r,n,s,i){const a=s[i],o=s[i+1];let c=R[2*e],y=R[2*e+1],g=R[2*t],m=R[2*t+1],b=R[2*r],v=R[2*r+1],w=R[2*n],x=R[2*n+1],k=h(c,g,a);var E,_,S;y=f(k,y,m,o),c=0|k,({Dh:x,Dl:w}={Dh:x^y,Dl:w^c}),({Dh:x,Dl:w}={Dh:u(x,w,16),Dl:d(x,w,16)}),({h:v,l:b}=p(v,b,x,w)),({Bh:m,Bl:g}
2={Bh:m^v,Bl:g^b}),({Bh:m,Bl:g}={Bh:(E=m,_=g,S=63,E<<64-S|_>>>S-32),Bl:l(m,g,63)}),R[2*e]=c,R[2*e+1]=y,R[2*t]=g,R[2*t+1]=m,R[2*r]=b,R[2*r+1]=v,R[2*n]=w,R[2*n+1]=x}class M{buffer;buffer32;finished=!1;destroyed=!1;length=0;pos=0;blockLen;outputLen;constructor(e,t){y(e),y(t),this.blockLen=e,this.outputLen=t,this.buffer=new Uint8Array(e),this.buffer32=v(this.buffer)}update(e){m(this),g(e);const{blockLen:t,buffer:r,buffer32:n}=this,s=e.length,i=e.byteOffset,a=e.buffer;for(let o=0;o<s;){this.pos===t&&(S(n),this.compress(n,0,!1),S(n),this.pos=0);const c=Math.min(t-this.pos,s-o),u=i+o;if(c!==t||u%4||!(o+c<s))r.set(e.subarray(o,o+c),this.pos),this.pos+=c,this.length+=c,o+=c;else{const e=new Uint32Array(a,u,Math.floor((s-o)/4));S(e);for(let r=0;o+t<s;r+=n.length,o+=t)this.length+=t,this.compress(e,r,!1);S(e)}}return this}digestInto(e){m(this),b(e,this);const{pos:t,buffer32:r}=this;this.finished=!0,w(this.buffer.subarray(t)),S(r),this.compress(r,0,!0),S(r);const n=v(e);this.get().forEach(((e,t)=>n[t]=_(e)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:n,destroyed:s,outputLen:i,pos:a}=this;return e||=new this.constructor({dkLen:i}),e.set(...this.get()),e.buffer.set(t),e.destroyed=s,e.finished=n,e.length=r,e.pos=a,e.outputLen=i,e}clone(){return this._cloneInto()}}class O extends M{v0l=0|T[0];v0h=0|T[1];v1l=0|T[2];v1h=0|T[3];v2l=0|T[4];v2h=0|T[5];v3l=0|T[6];v3h=0|T[7];v4l=0|T[8];v4h=0|T[9];v5l=0|T[10];v5h=0|T[11];v6l=0|T[12];v6h=0|T[13];v7l=0|T[14];v7h=0|T[15];constructor(e={}){const t=void 0===e.dkLen?64:e.dkLen;super(128,t),function(e,t={},r,n,s){if(y(r),e<0||e>r)throw new Error("outputLen bigger than keyLen");const{key:i,salt:a,personalization:o}=t;if(void 0!==i&&(i.length<1||i.length>r))throw new Error('"key" expected to be undefined or of length=1..'+r);void 0!==a&&g(a,n,"salt"),void 0!==o&&g(o,s,"personalization")}(t,e,64,16,16);let{key:r,personalization:n,salt:s}=e,i=0;if(void 0!==r&&(g(r,void 0,"key"),i=r.length),this.v0l^=this.outputLen|i<<8|65536|1<<24,void 0!==s){g(s,void 0,"salt");const e=v(s);this.v4l^=_(e[0]),this.v4h^=_(e[1]),this.v5l^=_(e[2]),this.v5h^=_(e[3])}if(void 0!==n){g(n,void 0,"personalization");const e=v(n);this.v6l^=_(e[0]),this.v6h^=_(e[1]),this.v7l^=_(e[2]),this.v7h^=_(e[3])}if(void 0!==r){const e=new Uint8Array(this.blockLen);e.set(r),this.update(e)}}get(){let{v0l:e,v0h:t,v1l:r,v1h:n,v2l:s,v2h:i,v3l:a,v3h:o,v4l:c,v4h:u,v5l:d,v5h:l,v6l:p,v6h:h,v7l:f,v7h:y}=this;return[e,t,r,n,s,i,a,o,c,u,d,l,p,h,f,y]}set(e,t,r,n,s,i,a,o,c,u,d,l,p,h,f,y){this.v0l=0|e,this.v0h=0|t,this.v1l=0|r,this.v1h=0|n,this.v2l=0|s,this.v2h=0|i,this.v3l=0|a,this.v3h=0|o,this.v4l=0|c,this.v4h=0|u,this.v5l=0|d,this.v5h=0|l,this.v6l=0|p,this.v6h=0|h,this.v7l=0|f,this.v7h=0|y}compress(e,t,r){this.get().forEach(((e,t)=>R[t]=e)),R.set(T,16);let{h:n,l:s}=c(BigInt(this.length));R[24]=T[8]^s,R[25]=T[9]^n,r&&(R[28]=~R[28],R[29]=~R[29]);let i=0;const a=q;for(let r=0;r<12;r++)C(0,4,8,12,e,t+2*a[i++]),B(0,4,8,12,e,t+2*a[i++]),C(1,5,9,13,e,t+2*a[i++]),B(1,5,9,13,e,t+2*a[i++]),C(2,6,10,14,e,t+2*a[i++]),B(2,6,10,14,e,t+2*a[i++]),C(3,7,11,15,e,t+2*a[i++]),B(3,7,11,15,e,t+2*a[i++]),C(0,5,10,15,e,t+2*a[i++]),B(0,5,10,15,e,t+2*a[i++]),C(1,6,11,12,e,t+2*a[i++]),B(1,6,11,12,e,t+2*a[i++]),C(2,7,8,13,e,t+2*a[i++]),B(2,7,8,13,e,t+2*a[i++]),C(3,4,9,14,e,t+2*a[i++]),B(3,4,9,14,e,t+2*a[i++]);this.v0l^=R[0]^R[16],this.v0h^=R[1]^R[17],this.v1l^=R[2]^R[18],this.v1h^=R[3]^R[19],this.v2l^=R[4]^R[20],this.v2h^=R[5]^R[21],this.v3l^=R[6]^R[22],this.v3h^=R[7]^R[23],this.v4l^=R[8]^R[24],this.v4h^=R[9]^R[25],this.v5l^=R[10]^R[26],this.v5h^=R[11]^R[27],this.v6l^=R[12]^R[28],this.v6h^=R[13]^R[29],this.v7l^=R[14]^R[30],this.v7h^=R[15]^R[31],w(R)}destroy(){this.destroyed=!0,w(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const P=A((e=>new O(e)));function H(e,t,r,n,s,i,a,o,c,u,d,l,p,h,f,y,g,m,b,v){let w=0;for(let x=0;x<n;x++)({a:s,b:c,c:p,d:g}=U(s,c,p,g,r[t+e[w++]])),({a:s,b:c,c:p,d:g}=I(s,c,p,g,r[t+e[w++]])),({a:i,b:u,c:h,d:m}=U(i,u,h,m,r[t+e[w++]])),({a:i,b:u,c:h,d:m}=I(i,u,h,m,r[t+e[w++]])),({a,b:d,c:f,d:b}=U(a,d,f,b,r[t+e[w++]])),({a,b:d,c:f,d:b}=I(a,d,f,b,r[t+e[w++]])),({a:o,b:l,c:y,d:v}=U(o,l,y,v,r[t+e[w++]])),({a:o,b:l,c:y,d:v}=I(o,l,y,v,r[t+e[w++]])),({a:s,b:u,c:f,d:v}=U(s,u,f,v,r[t+e[w++]])),({a:s,b:u,c:f,d:v}=I(s,u,f,v,r[t+e[w++]])),({a:i,b:d,c:y,d:g}=U(i,d,y,g,r[t+e[w++]])),({a:i,b:d,c:y,d:g}=I(i,d,y,g,r[t+e[w++]])),({a,b:l,c:p,d:m}=U(a,l,p,m,r[t+e[w++]])),({a,b:l,c:p,d:m}=I(a,l,p,m,r[t+e[w++]])),({a:o,b:c,c:h,d:b}=U(o,c,h,b,r[t+e[w++]])),({a:o,b:c,c:h,d:b}=I(o,c,h,b,r[t+e[w++]]));return{v0:s,v1:i,v2:a,v3:o,v4:c,v5:u,v6:d,v7:l,v8:p,v9:h,v10:f,v11:y,v12:g,v13:m,v14:b,v15:v}}const D=i.slice(),V=(()=>{const e=Array.from({length:16},((e,t)=>t)),t=e=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map((t=>e[t])),r=[];for(let n=0,s=e;n<7;n++,s=t(s))r.push(...s);return Uint8Array.from(r)})();class $ extends M{chunkPos=0;chunksDone=0;flags=0;IV;state;stack=[];posOut=0;bufferOut32=new Uint32Array(16);bufferOut;chunkOut=0;enableXOF=!0;constructor(e={},t=0){super(64,void 0===e.dkLen?32:e.dkLen);const{key:r,context:n}=e,s=void 0!==n;if(void 0!==r){if(s)throw new Error('Only "key" or "context" can be specified at same time');g(r,32,"key");const e=r.slice();this.IV=v(e),S(this.IV),this.flags=16|t}else if(s){g(n,void 0,"context");const e=n,r=new $({dkLen:32},32).update(e).digest();this.IV=v(r),S(this.IV),this.flags=64|t}else this.IV=D.slice(),this.flags=t;this.state=this.IV.slice(),this.bufferOut=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}(this.bufferOut32)}get(){return[]}set(){}b2Compress(e,t,r,n=0){const{state:s,pos:i}=this,{h:a,l:o}=c(BigInt(e),!0),{v0:u,v1:d,v2:l,v3:p,v4:h,v5:f,v6:y,v7:g,v8:m,v9:b,v10:v,v11:w,v12:x,v13:k,v14:E,v15:_}=H(V,n,r,7,s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],D[0],D[1],D[2],D[3],a,o,i,t);s[0]=u^m,s[1]=d^b,s[2]=l^v,s[3]=p^w,s[4]=h^x,s[5]=f^k,s[6]=y^E,s[7]=g^_}compress(e,t=0,r=!1){let n=this.flags;if(this.chunkPos||(n|=1),(15===this.chunkPos||r)&&(n|=2),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,n,e,t),this.chunkPos+=1,16===this.chunkPos||r){let e=this.state;this.state=this.IV.slice();for(let t,n=this.chunksDone+1;(r||!(1&n))&&(t=this.stack.pop());n>>=1)this.buffer32.set(t,0),this.buffer32.set(e,8),this.pos=this.blockLen,this.b2Compress(0,4|this.flags,this.buffer32,0),e=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(e)}this.pos=0}_cloneInto(e){e=super._cloneInto(e);const{IV:t,flags:r,state:n,chunkPos:s,posOut:i,chunkOut:a,stack:o,chunksDone:c}=this;return e.state.set(n.slice()),e.stack=o.map((e=>Uint32Array.from(e))),e.IV.set(t),e.flags=r,e.chunkPos=s,e.chunksDone=c,e.posOut=i,e.chunkOut=a,e.enableXOF=this.enableXOF,e.bufferOut32.set(this.bufferOut32),e}destroy(){this.destroyed=!0,w(this.state,this.buffer32,this.IV,this.bufferOut32),w(...this.stack)}b2CompressOut(){const{state:e,pos:t,flags:r,buffer32:n,bufferOut32:s}=this,{h:i,l:a}=c(BigInt(this.chunkOut++));S(n);const{v0:o,v1:u,v2:d,v3:l,v4:p,v5:h,v6:f,v7:y,v8:g,v9:m,v10:b,v11:v,v12:w,v13:x,v14:k,v15:E}=H(V,0,n,7,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],D[0],D[1],D[2],D[3],a,i,t,r);s[0]=o^g,s[1]=u^m,s[2]=d^b,s[3]=l^v,s[4]=p^w,s[5]=h^x,s[6]=f^k,s[7]=y^E,s[8]=e[0]^g,s[9]=e[1]^m,s[10]=e[2]^b,s[11]=e[3]^v,s[12]=e[4]^w,s[13]=e[5]^x,s[14]=e[6]^k,s[15]=e[7]^E,S(n),S(s),this.posOut=0}finish(){if(this.finished)return;this.finished=!0,w(this.buffer.subarray(this.pos));let e=8|this.flags;this.stack.length?(e|=4,S(this.buffer32),this.compress(this.buffer32,0,!0),S(this.buffer32),this.chunksDone=0,this.pos=this.blockLen):e|=2|(this.chunkPos?0:1),this.flags=e,this.b2CompressOut()}writeInto(e){m(this,!1),g(e),this.finish();const{blockLen:t,bufferOut:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=t&&this.b2CompressOut();const i=Math.min(t-this.posOut,s-n);e.set(r.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(e)}xof(e){return y(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(b(e,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}const L=A(((e={})=>new $(e))),N={dkLen:32},F=e=>L(e,N),j=e=>s([F(e),e]);var W=r(65202);const X=(e,t)=>{const r=e;return r.inner=t,r},K=e=>X((0,W.AU)(e),e);K.enc=e=>X(W.AU.enc(e),e),K.dec=e=>X(W.AU.dec(e),e);const z=(...e)=>X((0,W.ps)(...e),e);z.enc=(...e)=>X(W.ps.enc(...e),e),z.dec=(...e)=>X(W.ps.dec(...e),e);const Z=(e,...t)=>X((0,W.OW)(e,...t),e);Z.enc=(e,...t)=>X(W.OW.enc(e,...t),e),Z.dec=(e,...t)=>X(W.OW.dec(e,...t),e);const G=(e,t)=>X((0,W.x4)(e,t),{ok:e,ko:t});G.enc=(e,t)=>X(W.x4.enc(e,t),{ok:e,ko:t}),G.dec=(e,t)=>X(W.x4.dec(e,t),{ok:e,ko:t});const J=e=>X((0,W.Wx)(e),e);function Y(e,t){return Object.fromEntries(Object.entries(e).map((([e,r])=>[e,t(r,e)])))}J.enc=e=>X(W.Wx.enc(e),e),J.dec=e=>X(W.Wx.dec(e),e);const Q={is:(e,t)=>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}},ee=Object.assign(((e,t)=>({type:e,value:t})),Q),te=new Proxy({},{get:(e,t)=>e=>ee(t,e)}),re=(...e)=>{const t=W.xs.enc(...e);return X((e=>t({tag:e.type,value:e.value})),e[0])},ne=(...e)=>{const t=W.xs.dec(...e);return X((e=>{const{tag:r,value:n}=t(e);return ee(r,n)}),e[0])},se=(e,...t)=>X((0,W.VG)(re(Y(e,(([e])=>e)),...t),ne(Y(e,(([,e])=>e)),...t)),e);se.enc=re,se.dec=ne;const ie=(e,...t)=>X((0,W.xs)(e,...t),e);ie.enc=(e,...t)=>X(W.xs.enc(e,...t),e),ie.dec=(e,...t)=>X(W.xs.dec(e,...t),e);const ae=(0,W.hD)(W.oA,(e=>e),Number),oe=(0,W.hD)(W.oA,(e=>e),BigInt),ce={bare:0,0:"bare",general:1,1:"general",signed:2,2:"signed"},ue=(0,W.hD)(W.u8,(({version:e,type:t})=>e+(ce[t]<<6)),(e=>{const t=63&e,r=e>>6;if(4===t&&(r===ce.bare||r===ce.signed))return{version:t,type:ce[r]};if(5===t&&(r===ce.bare||r===ce.general))return{version:t,type:ce[r]};throw new Error(`ExtrinsicFormat ${e}
2 not valid`)})),de={specVersion:W.Jq,specName:W.Bd,base58Prefix:W.KB,decimals:W.u8,tokenSymbol:W.Bd},le=K(de),pe=(0,W.Jj)(32),he=ie({V0:W.R9,V1:K({typeInformationTreeRoot:pe,extrinsicMetadataHash:pe,...de})});ie({bool:W.R9,char:W.R9,str:W.R9,u8:W.R9,u16:W.R9,u32:W.R9,u64:W.R9,u128:W.R9,u256:W.R9,i8:W.R9,i16:W.R9,i32:W.R9,i64:W.R9,i128:W.R9,i256:W.R9});const fe=ie({bool:W.R9,char:W.R9,str:W.R9,u8:W.R9,u16:W.R9,u32:W.R9,u64:W.R9,u128:W.R9,u256:W.R9,i8:W.R9,i16:W.R9,i32:W.R9,i64:W.R9,i128:W.R9,i256:W.R9,compactU8:W.R9,compactU16:W.R9,compactU32:W.R9,compactU64:W.R9,compactU128:W.R9,compactU256:W.R9,void:W.R9,perId:ae}),ye=K({name:J(W.Bd),ty:fe,typeName:J(W.Bd)}),ge=ie({composite:Z(ye),enumeration:K({name:W.Bd,fields:Z(ye),index:ae}),sequence:fe,array:K({len:W.Jq,typeParam:fe}),tuple:Z(fe),bitSequence:K({numBytes:W.u8,leastSignificantBitFirst:W.Xg})}),me=K({path:Z(W.Bd),typeDef:ge,typeId:ae}),be=Z(me),ve=K({version:W.u8,addressTy:fe,callTy:fe,signatureTy:fe,signedExtensions:Z(K({identifier:W.Bd,includedInExtrinsic:fe,includedInSignedData:fe}))}),we=z.dec(W.oA[1],ue[1],(0,W.Jj)(1/0)[1]),xe=(K({leaves:be,leafIdxs:Z(W.Jq),proofs:Z(pe),extrinsic:ve,info:le}),{u8:1,u16:2,u32:4,u64:8}),ke=e=>{if("magicNumber"in e&&(e=e.metadata),"tag"in e){if("v14"!==e.tag&&"v15"!==e.tag&&"v16"!==e.tag)throw new Error("Only metadata 14, 15, and 16 are supported");e=e.value}if("signedExtensionsByVersion"in e.extrinsic){const{extrinsic:{signedExtensions:t,signedExtensionsByVersion:r,...n},...s}=e;if(!r.some((([e])=>
20===e)))throw new Error("Extension version 0 not found");return{version:16,extrinsic:{...n,signedExtensions:Object.fromEntries(r.map((([e,r])=>[e,r.map((e=>t[e]))])))},...s}}if("custom"in e){const{lookup:t,extrinsic:r,custom:n,apis:s,pallets:i,outerEnums:a}=e;return{version:15,lookup:t,pallets:i.map((e=>({...e,calls:null!=e.calls?{type:e.calls}:void 0,events:null!=e.events?{type:e.events}:void 0,errors:null!=e.errors?{type:e.errors}:void 0,viewFns:[],associatedTypes:[]}))),extrinsic:{...r,signedExtensions:{0:r.signedExtensions},version:[r.version]},apis:s,outerEnums:a,custom:n}}const{lookup:t,extrinsic:r,pallets:n}=e;return{version:14,lookup:t,pallets:n.map((e=>({...e,calls:null!=e.calls?{type:e.calls}:void 0,events:null!=e.events?{type:e.events}:void 0,errors:null!=e.errors?{type:e.errors}:void 0,viewFns:[],associatedTypes:[]}))),extrinsic:{...r,signedExtensions:{0:r.signedExtensions},version:[r.version]},apis:[]}},Ee=(0,W.OW)(W.Bd),_e=(0,W.Wx)(W.Bd),Se=(0,W.xs)({bool:W.R9,char:W.R9,str:W.R9,u8:W.R9,u16:W.R9,u32:W.R9,u64:W.R9,u128:W.R9,u256:W.R9,i8:W.R9,i16:W.R9,i32:W.R9,i64:W.R9,i128:W.R9,i256:W.R9}),Ae=(0,W.OW)((0,W.AU)({name:_e,type:ae,typeName:_e,docs:Ee})),qe=(0,W.AU)({len:W.Jq,type:ae}),Ue=(0,W.AU)({bitStoreType:ae,bitOrderType:ae}),Ie=(0,W.OW)((0,W.AU)({name:W.Bd,fields:Ae,index:W.u8,docs:Ee})),Te=(0,W.xs)({composite:Ae,variant:Ie,sequence:ae,array:qe,tuple:(0,W.OW)(ae),primitive:Se,compact:ae,bitSequence:Ue}),Re=(0,W.AU)({name:W.Bd,type:(0,W.Wx)(ae)}),Ce=(0,W.OW)(Re),Be=(0,W.AU)({id:ae,path:Ee,params:Ce,def:Te,docs:Ee}),Me=(0,W.OW)(Be),Oe="0123456789abcdef";function Pe(e){const t=new Array(e.length+1);t[0]="0x";for(let r=0;r<e.length;){const n=e[r++];t[r]=Oe[n>>4]+Oe[15&n]}return t.join("")}const He={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 De(e){const t=e.length%2,r=("x"===e[1]?2:0)+t,n=(e.length-r)/2+t,s=new Uint8Array(n);t&&(s[0]=0|He[e[2]]);for(let i=0;i<n;){const n=r+2*i,a=He[e[n]],o=He[e[n+1]];s[t+i++]=a<<4|o}return s}const Ve=e=>{const t=W.Jj.enc(e);return e=>t(De(e))},$e=e=>{const t=W.Jj.dec(e);return e=>Pe(t(e))},Le=e=>(0,W.VG)(Ve(e),$e(e));Le.enc=Ve,Le.dec=$e;const Ne=(0,W.xs)({NotDeprecated:W.R9,DeprecatedWithoutNote:W.R9,Deprecated:(0,W.AU)({note:W.Bd,since:(0,W.Wx)(W.Bd)})}),Fe=(0,W.OW)((0,W.AU)({index:W.u8,deprecation:(0,W.xs)({DeprecatedWithoutNote:W.R9,Deprecated:(0,W.AU)({note:W.Bd,since:(0,W.Wx)(W.Bd)})},[1,2])})),je={name:W.Bd,inputs:(0,W.OW)((0,W.AU)({name:W.Bd,type:ae})),output:ae,docs:Ee},We=(0,W.AU)({name:W.Bd,methods:(0,W.OW)((0,W.AU)(je)),docs:Ee}),Xe=(0,W.AU)({name:W.Bd,methods:(0,W.OW)((0,W.AU)({...je,deprecationInfo:Ne})),docs:Ee,version:ae,deprecationInfo:Ne}),Ke=(0,W.AU)({id:Le(32),...je,deprecationInfo:Ne}),ze=(0,W.xs)({Blake2128:W.R9,Blake2256:W.R9,Blake2128Concat:W.R9,Twox128:W.R9,Twox256:W.R9,Twox64Concat:W.R9,Identity:W.R9}),Ze=(0,W.OW)(ze),Ge=(0,W.AU)({hashers:Ze,key:ae,value:ae}),Je={name:W.Bd,modifier:W.u8,type:(0,W.xs)({plain:ae,map:Ge}),fallback:Le(),docs:Ee},Ye=(0,W.Wx)(ae),Qe={name:W.Bd,storage:(0,W.Wx)((0,W.AU)({prefix:W.Bd,items:(0,W.OW)((0,W.AU)(Je))})),calls:Ye,events:Ye,constants:(0,W.OW)((0,W.AU)({name:W.Bd,type:ae,value:Le(),docs:Ee})),errors:Ye,index:W.u8},et={...Qe,docs:Ee},tt=(0,W.Wx)((0,W.AU)({type:ae,deprecationInfo:Fe})),rt={name:W.Bd,storage:(0,W.Wx)((0,W.AU)({prefix:W.Bd,items:(0,W.OW)((0,W.AU)({...Je,deprecationInfo:Ne}))})),calls:tt,events:tt,constants:(0,W.OW)((0,W.AU)({name:W.Bd,type:ae,value:Le(),docs:Ee,deprecationInfo:Ne})),errors:tt,associatedTypes:(0,W.OW)((0,W.AU)({name:W.Bd,type:ae,docs:Ee})),viewFns:(0,W.OW)(Ke),index:W.u8,docs:Ee,deprecationInfo:Ne},nt=new Uint8Array,st=e=>(0,W.VG)((()=>nt),(()=>e)),it=(0,W.AU)({type:ae,version:W.u8,signedExtensions:(0,W.OW)((0,W.AU)({identifier:W.Bd,type:ae,additionalSigned:ae}))}),at=(0,W.AU)({lookup:Me,pallets:(0,W.OW)((0,W.AU)({...Qe,docs:st([])})),extrinsic:it,type:ae,apis:st([])}),ot=(0,W.AU)({version:W.u8,address:ae,call:ae,signature:ae,extra:ae,signedExtensions:(0,W.OW)((0,W.AU)({identifier:W.Bd,type:ae,additionalSigned:ae}))}),ct=(0,W.AU)({lookup:Me,pallets:(0,W.OW)((0,W.AU)(et)),extrinsic:ot,type:ae,apis:(0,W.OW)(We),outerEnums:(0,W.AU)({call:ae,event:ae,error:ae}),custom:(0,W.OW)((0,W.ps)(W.Bd,(0,W.AU)({type:ae,value:Le()})))}),ut=(0,W.AU)({version:(0,W.OW)(W.u8),address:ae,call:ae,signature:ae,signedExtensionsByVersion:(0,W.OW)((0,W.ps)(W.u8,(0,W.OW)(ae))),signedExtensions:(0,W.OW)((0,W.AU)({identifier:W.Bd,type:ae,additionalSigned:ae}))}),dt=(0,W.AU)({lookup:Me,pallets:(0,W.OW)((0,W.AU)(rt)),extrinsic:ut,apis:(0,W.OW)(Xe),outerEnums:(0,W.AU)({call:ae,event:ae,error:ae}),custom:(0,W.OW)((0,W.ps)(W.Bd,(0,W.AU)({type:ae,value:Le()})))}),lt=()=>{throw new Error("Unsupported metadata version!")},pt=(0,W.VG)(lt,lt),ht=(0,W.AU)({magicNumber:W.Jq,metadata:(0,W.xs)({v0:pt,v1:pt,v2:pt,v3:pt,v4:pt,v5:pt,v6:pt,v7:pt,v8:pt,v9:pt,v10:pt,v11:pt,v12:pt,v13:pt,v14:at,v15:ct,v16:dt})}),ft=(0,W.Jj)(),yt=(0,W.Wx)(ft),gt=(0,W.ps)(W.oA,ft),mt=e=>{try{return ht.dec(e)}catch(e){}try{return ht.dec(yt.dec(e))}catch(e){}try{return ht.dec(ft.dec(e))}catch(e){}try{return ht.dec(gt.dec(e)[1])}catch(e){}throw null},bt=e=>"string"==typeof e?De(e):e,vt={null:"void",u8:"compactU8",u16:"compactU16",u32:"compactU32",u64:"compactU64",u128:"compactU128",u256:"compactU256"},wt={bool:W.u8,char:W.u8,str:W.Bd,u8:W.u8,u16:W.KB,u32:W.Jq,u64:W.AW,u128:W.z7,u256:W.Ks,i8:W.i8,i16:W.TQ,i32:W.kx,i64:W.fO,i128:W.bH,i256:W.jn,void:W.R9,compactU8:W.oA,compactU16:W.oA,compactU32:W.oA,compactU64:W.oA,compactU128:W.oA,compactU256:W.oA},xt=(e,t,r,n,s)=>{if("perId"!==t.tag)return void wt[t.tag][1](e);const i=t=>{xt(e,t,r,n,s)},a=r.get(t.value),[o]=a,c=n[o];switch(1===a.length&&s.add(o),c.typeDef.tag){case"enumeration":{const t=W.u8.dec(e),[r,o]=a.map((e=>[n[e].typeDef,e])).find((([e])=>e.value.index===t));s.add(o),r.value.fields.forEach((({ty:e})=>{i(e)}));break}case"sequence":{const t=W.oA.dec(e);for(let e=0;e<t;e++)i(c.typeDef.value);break}case"array":for(let e=0;e<c.typeDef.value.len;e++)i(c.typeDef.value.typeParam);break;case"composite":c.typeDef.value.forEach((e=>{i(e.ty)}));break;case"tuple":c.typeDef.value.forEach(i);break;case"bitSequence":throw new Error("bitSequence is not supported")}},kt=(e,t,r)=>{let n=new Uint8Array;(0,W.UF)((e=>{n=e}))(e);const s=new Map;r.forEach(((e,t)=>{const r=s.get(e.typeId);r?r.push(t):s.set(e.typeId,[t])}));const i=new Set;return t.forEach((e=>{xt(n,e,s,r,i)})),[...i].sort(((e,t)=>e-t))},Et=e=>0|Math.log2(e+1);function _t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function St(e){if(!_t(e))throw new Error("Uint8Array expected")}function At(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"==typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function qt(e){if("function"!=typeof e)throw new Error("function expected");return!0}function Ut(e,t){if("string"!=typeof t)throw new Error(`${e}: string expected`);return!0}function It(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Tt(e){if(!Array.isArray(e))throw new Error("array expected")}function Rt(e,t){if(!At(!0,t))throw new Error(`${e}
2: array of strings expected`)}function Ct(e,t){if(!At(!1,t))throw new Error(`${e}: array of numbers expected`)}function Bt(...e){const t=e=>e,r=(e,t)=>r=>e(t(r));return{encode:e.map((e=>e.encode)).reduceRight(r,t),decode:e.map((e=>e.decode)).reduce(r,t)}}function Mt(e){const t="string"==typeof e?e.split(""):e,r=t.length;Rt("alphabet",t);const n=new Map(t.map(((e,t)=>[e,t])));return{encode:n=>(Tt(n),n.map((n=>{if(!Number.isSafeInteger(n)||n<0||n>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${n}". Allowed: ${e}`);return t[n]}))),decode:t=>(Tt(t),t.map((t=>{Ut("alphabet.decode",t);const r=n.get(t);if(void 0===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r})))}}function Ot(e=""){return Ut("join",e),{encode:t=>(Rt("join.decode",t),t.join(e)),decode:t=>(Ut("join.decode",t),t.split(e))}}function Pt(e,t="="){return It(e),Ut("padding",t),{encode(r){for(Rt("padding.encode",r);r.length*e%8;)r.push(t);return r},decode(r){Rt("padding.decode",r);let n=r.length;if(n*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if((n-1)*e%8==0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,n)}}}function Ht(e){return qt(e),{encode:e=>e,decode:t=>e(t)}}function Dt(e,t,r){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(Tt(e),!e.length)return[];let n=0;const s=[],i=Array.from(e,(e=>{if(It(e),e<0||e>=t)throw new Error(`invalid integer: ${e}`);return e})),a=i.length;for(;;){let e=0,o=!0;for(let s=n;s<a;s++){const a=i[s],c=t*e,u=c+a;if(!Number.isSafeInteger(u)||c/t!==e||u-a!==c)throw new Error("convertRadix: carry overflow");const d=u/r;e=u%r;const l=Math.floor(d);if(i[s]=l,!Number.isSafeInteger(l)||l*r+e!==u)throw new Error("convertRadix: carry overflow");o&&(l?o=!1:n=s)}if(s.push(e),o)break}for(let t=0;t<e.length-1&&0===e[t];t++)s.push(0);return s.reverse()}const Vt=(e,t)=>0===t?e:Vt(t,e%t),$t=(e,t)=>e+(t-Vt(e,t)),Lt=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function Nt(e,t,r,n){if(Tt(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if($t(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${$t(t,r)}`);let s=0,i=0;const a=Lt[t],o=Lt[r]-1,c=[];for(const n of e){if(It(n),n>=a)throw new Error(`convertRadix2: invalid data word=${n} from=${t}`);if(s=s<<t|n,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=r;i-=r)c.push((s>>i-r&o)>>>0);const e=Lt[i];if(void 0===e)throw new Error("invalid carry");s&=e-1}if(s=s<<r-i&o,!n&&i>=t)throw new Error("Excess padding");if(!n&&s>0)throw new Error(`Non-zero padding: ${s}`);return n&&i>0&&c.push(s>>>0),c}function Ft(e,t=!1){if(It(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if($t(8,e)>32||$t(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!_t(r))throw new Error("radix2.encode input should be Uint8Array");return Nt(Array.from(r),8,e,!t)},decode:r=>(Ct("radix2.decode",r),Uint8Array.from(Nt(r,e,8,t)))}}function jt(e){return qt(e),function(...t){try{return e.apply(null,t)}catch(e){}}}Bt(Ft(4),Mt("0123456789ABCDEF"),Ot("")),Bt(Ft(5),Mt("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Pt(5),Ot(""));const Wt=(Bt(Ft(5),Mt("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ot("")),Bt(Ft(5),Mt("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Pt(5),Ot("")),Bt(Ft(5),Mt("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Ot("")),Bt(Ft(5),Mt("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Ot(""),Ht((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),(()=>"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64)()),Xt=(e,t)=>{Ut("base64",e);const r=t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,n=t?"base64url":"base64";if(e.length>0&&!r.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:n,lastChunkHandling:"strict"})},Kt=(Wt||Bt(Ft(6),Mt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
2+/"),Pt(6),Ot("")),Bt(Ft(6),Mt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ot("")),Wt||Bt(Ft(6),Mt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Pt(6),Ot("")),Bt(Ft(6),Mt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Ot("")),e=>{return Bt((It(t=58),{encode:e=>{if(!_t(e))throw new Error("radix.encode input should be Uint8Array");return Dt(Array.from(e),256,t)},decode:e=>(Ct("radix.decode",e),Uint8Array.from(Dt(e,t,256)))}),Mt(e),Ot(""));var t}),zt=Kt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Zt=(Kt("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Kt("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),Bt(Mt("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Ot(""))),Gt=[996825010,642813549,513874426,1027748829,705979059];function Jt(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e<Gt.length;e++)1==(t>>e&1)&&(r^=Gt[e]);return r}function Yt(e,t,r=1){const n=e.length;let s=1;for(let t=0;t<n;t++){const r=e.charCodeAt(t);if(r<33||r>126)throw new Error(`Invalid prefix (${e})`);s=Jt(s)^r>>5}s=Jt(s);for(let t=0;t<n;t++)s=Jt(s)^31&e.charCodeAt(t);for(let e of t)s=Jt(s)^e;for(let e=0;e<6;e++)s=Jt(s);return s^=r,Zt.encode(Nt([s%Lt[30]],30,5,!1))}function Qt(e){const t="bech32"===e?1:734539939,r=Ft(5),n=r.decode,s=r.encode,i=jt(n);function a(e,r,n=90){Ut("bech32.encode prefix",e),_t(r)&&(r=Array.from(r)),Ct("bech32.encode",r);const s=e.length;if(0===s)throw new TypeError(`Invalid prefix length ${s}`);const i=s+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const a=e.toLowerCase(),o=Yt(a,r,t);return`${a}1${Zt.encode(r)}${o}`}function o(e,r=90){Ut("bech32.decode input",e);const n=e.length;if(n<8||!1!==r&&n>r)throw new TypeError(`invalid string length: ${n} (${e}). Expected (8..${r})`);const s=e.toLowerCase();if(e!==s&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=s.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const a=s.slice(0,i),o=s.slice(i+1);if(o.length<6)throw new Error("Data must be at least 6 characters long");const c=Zt.decode(o).slice(0,-6),u=Yt(a,c,t);if(!o.endsWith(u))throw new Error(`Invalid checksum in ${e}: expected "${u}"`);return{prefix:a,words:c}}return{encode:a,decode:o,encodeFromBytes:function(e,t){return a(e,s(t))},decodeToBytes:function(e){const{prefix:t,words:r}=o(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:jt(o),fromWords:n,fromWordsUnsafe:i,toWords:s}}Qt("bech32"),Qt("bech32m");const er=((()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)()||Bt(Ft(4),Mt("0123456789abcdef"),Ot(""),Ht((e=>{if("string"!=typeof e||e.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}))),(new TextEncoder).encode("SS58PRE")),tr=e=>{try{const t=zt.decode(e),r=t.subarray(0,64&t[0]?2:1),n=t.subarray(r.length,t.length-2),s=t.subarray(r.length+n.length),i=P(Uint8Array.of(...er,...r,...n),{dkLen:64}).subarray(0,2);return s[0]===i[0]&&s[1]===i[1]?{isValid:!0,ss58Format:rr(r),publicKey:n.slice()}:{isValid:!1}}catch(e){return{isValid:!1}}},rr=e=>{const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return 1===t.byteLength?t.getUint8(0):t.getUint16(0)},nr=e=>{const t=e<64?Uint8Array.of(e):Uint8Array.of((252&e)>>2|64,e>>8|(3&e)<<6);return(e=>{let r={},n=0,s=0;const i=()=>{n===s?(r={},n=s=0):(s=n,setTimeout(i,0))};return e=>{var s,a;1==++n&&i();let o=r;const c=e.length-1;for(let t=0;t<=c;t++)o=o[s=e[t]]||(o[s]={});return o[a=e[c]]||(o[a]=(e=>{const r=P(Uint8Array.of(...er,...t,...e),{dkLen:64}).subarray(0,2);return zt.encode(Uint8Array.of(...t,...e,...r))})(e))}})()},sr=(e=42,t=32)=>(0,W.hD)((0,W.Jj)(t),function(e,t){return t=>{const r=tr(t);if(!r.isValid)throw new Error("Invalid checksum");const{publicKey:n}=r;if(n.length!==e)throw new Error("Invalid public key length");return n}}(t),nr(e)),ir={dkLen:32},ar=e=>P(e,ir),or={dkLen:16},cr=e=>P(e,or),ur=e=>s([cr(e),e]),dr=e=>e,lr=(e,t,r,n)=>new DataView(new Uint16Array([e,t,r,n]).buffer).getBigUint64(0,!0),pr=2n**64n-1n,hr=(e,t)=>
2e<<t&pr|e>>64n-t,fr=(e,t)=>e*t&pr,yr=(e,t)=>e+t&pr,gr=11400714785074694791n,mr=14029467366897019727n,br=1609587929392839161n,vr=9650029242287828579n,wr=2870177450012600261n;function xr(e,t=0n){let r,n=yr(yr(t,gr),mr),s=yr(t,mr),i=t,a=t-gr,o=e.length,c=0,u=null;!function(){let t=0,r=t+o;if(o){if(u=new Uint8Array(32),o<32)return u.set(e.subarray(0,o),c),void(c+=o);if(t<=r-32){const o=r-32;do{let r;r=lr(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),n=fr(hr(yr(n,fr(r,mr)),31n),gr),t+=8,r=lr(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),s=fr(hr(yr(s,fr(r,mr)),31n),gr),t+=8,r=lr(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),i=fr(hr(yr(i,fr(r,mr)),31n),gr),t+=8,r=lr(e[t+1]<<8|e[t],e[t+3]<<8|e[t+2],e[t+5]<<8|e[t+4],e[t+7]<<8|e[t+6]),a=fr(hr(yr(a,fr(r,mr)),31n),gr),t+=8}while(t<=o)}t<r&&(u.set(e.subarray(t,r),c),c=r-t)}}(),e=u||e;let d=0;for(o>=32?(r=hr(n,1n),r=yr(r,hr(s,7n)),r=yr(r,hr(i,12n)),r=yr(r,hr(a,18n)),n=fr(hr(fr(n,mr),31n),gr),r^=n,r=yr(fr(r,gr),vr),s=fr(hr(fr(s,mr),31n),gr),r^=s,r=yr(fr(r,gr),vr),i=fr(hr(fr(i,mr),31n),gr),r^=i,r=yr(fr(r,gr),vr),a=fr(hr(fr(a,mr),31n),gr),r^=a,r=yr(fr(r,gr),vr)):r=yr(t,wr),r=yr(r,BigInt(o));d<=c-8;){let t=lr(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]);t=fr(hr(fr(t,mr),31n),gr),r=yr(fr(hr(r^t,27n),gr),vr),d+=8}if(d+4<=c){let t=fr(lr(e[d+1]<<8|e[d],e[d+3]<<8|e[d+2],0,0),gr);r=yr(fr(hr(r^t,23n),mr),br),d+=4}for(;d<c;){const t=fr(lr(e[d++],0,0,0),wr);r=fr(hr(r^t,11n),gr)}let l=r>>33n;return r=fr(r^l,mr),l=r>>29n,r=fr(r^l,br),l=r>>32n,r^=l,r}const kr=e=>{const t=new Uint8Array(16),r=new DataView(t.buffer);return r.setBigUint64(0,xr(e),!0),r.setBigUint64(8,xr(e,1n),!0),t},Er=e=>{const t=new Uint8Array(32),r=new DataView(t.buffer);return r.setBigUint64(0,xr(e),!0),r.setBigUint64(8,xr(e,1n),!0),r.setBigUint64(16,xr(e,2n),!0),r.setBigUint64(24,xr(e,3n),!0),t},_r=e=>s([W.AW.enc(xr(e)),e]),Sr=new TextEncoder,Ar=new Map([[dr,0],[_r,8],[ur,16],[cr,-16],[ar,-32],[kr,-16],[Er,-32]]),qr=e=>{const t=kr(Sr.encode(e));return(r,...n)=>{const i=s([t,kr(Sr.encode(r))]),a=Pe(i),o=n.map((([{enc:e},t])=>r=>t(e(r))));return{enc:(...e)=>Pe(s([i,...e.map(((e,t)=>o[t](e)))])),dec:t=>{if(!t.startsWith(a))throw new Error(`key does not match this storage (${e}.${r})`);if(0===n.length)return[];const s=De(t.slice(a.length)),i=new Array(n.length);for(let e=0,t=0;e<n.length;e++){const[r,a]=n[e],o=Ar.get(a);if(null==o)throw new Error("Unknown hasher");if(o<0){const r=-1*o;i[e]=Pe(s.slice(t,t+r)),t+=r}else t+=o,i[e]=r.dec(s.slice(t)),t+=r.enc(i[e]).length}return i}}}},Ur=new TextEncoder,Ir=new TextDecoder,Tr=(0,W.ps)(ae,(0,W.Jj)(1/0))[1],Rr={toText:e=>Ir.decode(e),toHex:e=>Pe(e),toOpaque:e=>s([W.oA[0](e.length),e]),fromText:e=>Ur.encode(e),fromHex:e=>De(e),fromOpaque:e=>{const t="string"==typeof e?De(e):e;try{const[e,r]=Tr(t);if(e===r.length)return r}catch(e){}throw new Error("Invalid opaque bytes")}},Cr=e=>(0,W.hD)((0,W.Jj)(e),De,Pe),Br=(0,W.UF)((e=>{const t=ae.dec(e),r=Math.ceil(t/8);return{bytes:(0,W.Jj)(r).dec(e),bitsLen:t}})),Mr=(0,W.VG)((e=>{if(e.bitsLen>8*e.bytes.length)throw new Error(`Not enough bytes. (bitsLen:${e.bitsLen}, bytesLen:${e.bytes.length})`);const t=ae.enc(e.bitsLen),r=new Uint8Array(e.bytes.length+t.length);return r.set(t,0),r.set(e.bytes,t.length),r}),Br),Or=(0,W.hD)(W.u8,(e=>e.charCodeAt(0)),String.fromCharCode),Pr=new TextEncoder,Hr=new TextDecoder,Dr=e=>(0,W.hD)((0,W.Jj)(e),(e=>Pr.encode(e)),(e=>Hr.decode(e))),Vr=e=>{let t=r=>{const n=e();return t=n,n(r)};return e=>t(e)},$r=e=>{let t=r=>{const n=e();return t=n,n(r)};return e=>t(e)},Lr=e=>(0,W.VG)(Vr((()=>e().enc)),$r((()=>e().dec))),Nr=BigInt(0),Fr=BigInt(1),jr=BigInt(2),Wr=BigInt(7),Xr=BigInt(256),Kr=BigInt(113),zr=[],Zr=[],Gr=[];for(let e=0,t=Fr,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],zr.push(2*(5*n+r)),Zr.push((e+1)*(e+2)/2%64);let s=Nr;for(let e=0;e<7;e++)t=(t<<Fr^(t>>Wr)*Kr)%Xr,t&jr&&(s^=Fr<<(Fr<<BigInt(e))-Fr);Gr.push(s)}const Jr=function(e,t=!1){const r=e.length;let n=new Uint32Array(r),s=new Uint32Array(r);for(let i=0;i<r;i++){const{h:r,l:a}=c(e[i],t);[n[i],s[i]]=[r,a]}return[n,s]}(Gr,!0),Yr=Jr[0],Qr=Jr[1],en=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),tn=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class rn{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(e,t,r,n=!1,s=24){if(this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,y(r,"outputLen"),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=v(this.state)}clone(){return this._cloneInto()}
2keccak(){S(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,s=(t+2)%10,i=r[s],a=r[s+1],o=en(i,a,1)^r[n],c=tn(i,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],s=e[3];for(let r=0;r<24;r++){const n=Zr[r],i=en(t,s,n),a=tn(t,s,n),o=zr[r];t=e[o],s=e[o+1],e[o]=i,e[o+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=Yr[n],e[1]^=Qr[n]}w(r)}(this.state32,this.rounds),S(this.state32),this.posOut=0,this.pos=0}update(e){m(this),g(e);const{blockLen:t,state:r}=this,n=e.length;for(let s=0;s<n;){const i=Math.min(t-this.pos,n-s);for(let t=0;t<i;t++)r[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,0!=(128&t)&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){m(this,!1),g(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-n);e.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return y(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(b(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,w(this.state)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:s,enableXOF:i}=this;return e||=new rn(t,r,n,i,s),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=r,e.outputLen=n,e.enableXOF=i,e.destroyed=this.destroyed,e}}const nn=((e,t,r,n={})=>A((()=>new rn(t,e,r)),n))(1,136,32),sn=e=>{const t=e.slice(2),r=Pe(nn(Pr.encode(t))).slice(2),n=new Array(40);for(let e=0;e<40;e++){const s=parseInt(r[e],16),i=t[e];n[e]=s>7?i.toUpperCase():i}return`0x${n.join("")}`},an=(0,W.Jj)(20)[1],on=(0,W.VG)((e=>{const t=De(e);if(20!==t.length)throw new Error(`Invalid length found on EthAddress(${e})`);const r=Pe(t);if(e===r||e===r.toUpperCase())return t;if(sn(r)!==e)throw new Error(`Invalid checksum found on EthAddress(${e})`);return t}),(0,W.UF)((e=>sn(Pe(an(e)))))),cn=(e=!0)=>(0,W.UF)((t=>{const r=ae.dec(t),n=Math.ceil(r/8),s=(0,W.Jj)(n).dec(t),i=new Array(r);let a=0;return s.forEach((t=>{for(let n=0;n<8&&a<r;n++){const r=e?n:7-n;i[a++]=t>>r&1}})),i})),un=(e=!0)=>t=>{const r=ae.enc(t.length),n=Math.ceil(t.length/8),i=new Uint8Array(n);for(let r=0;r<n;r++){let n=8*r,s=0;for(let r=0;r<8&&n<t.length;r++,n++)s|=t[n]<<(e?r:7-r);i[r]=s}return s([r,i])},dn=e=>(0,W.VG)(un(e),cn(e));dn.enc=un,dn.dec=cn;const ln=new TextEncoder,pn=new TextDecoder,hn=(0,W.hD)((0,W.Jj)(4),ln.encode.bind(ln),pn.decode.bind(pn)),fn=K({engine:hn,payload:Le()}),yn=se({other:(0,W.Jj)(),consensus:fn,seal:fn,preRuntime:fn,runtimeUpdated:W.R9},[0,4,5,6,8]),gn=Le(32),mn=K({parentHash:gn,number:ae,stateRoot:gn,extrinsicRoot:gn,digests:Z(yn)}),bn=Rr.fromText("modlpy/utilisuba"),vn=({threshold:e,signatories:t})=>{const r=wn(t),n=s([bn,W.oA.enc(r.length),...r,W.KB.enc(e)]);return ar(n)},wn=e=>e.slice().sort(((e,t)=>{for(let r=0;;r++){const n=r>=e.length,s=r>=t.length;if(n&&s)return 0;if(n)return-1;if(s)return 1;if(e[r]!==t[r])return e[r]>t[r]?1:-1}})),xn={Leaf:"Leaf",Branch:"Branch",BranchWithVal:"BranchWithVal",LeafWithHash:"LeafWithHash",BranchWithHash:"BranchWithHash",Empty:"Empty",Reserved:"Reserved"},kn=Le().dec,En=Le(1/0).dec,_n=Le(32).dec,Sn=W.u8.dec,An=(0,W.UF)((e=>{const t=(e=>{const t=Sn(e);let r=6;const n=t>>r,s=n?1===n?xn.Leaf:2===n?xn.Branch:xn.BranchWithVal:t>>--r?xn.LeafWithHash:t>>--r?xn.BranchWithHash:t?xn.Reserved:xn.Empty;let i=t&255>>8-r;if(i===2**r-1){let t;do{i+=t=Sn(e)}while(255===t)}return{type:s,partialKey:Le(Math.ceil(i/2)).dec(e).slice(i%2?3:2)}})(e),{type:r}=t;if("Empty"===r||"Reserved"===r)return t;if("Leaf"===r||"LeafWithHash"===r)return{...t,value:En(e)};const n=W.KB.dec(e),s=[];for(let e=0;e<16;e++)n>>e&1&&s.push(e.toString(16));let i=null;"BranchWithVal"===r&&(i=kn(e)),"BranchWithHash"===r&&(i=_n(e));const a={...t,children:Object.fromEntries(s.map((t=>[t,kn(e)])))};return null!==i&&(a.value=i),a})),qn=e=>(0,W.UF)((t=>{const r=Pe(e(new Uint8Array(t.buffer)));try{return{hash:r,...An(t)}}catch{return{type:"Raw",hash:r,value:""}}})),Un=(e,t=ar)=>{const r=e.map(qn(t)),n=Object.fromEntries(r.map((e=>[e.hash,e]))),s=r.map((e=>e.hash)),i=new Set(s),a=t=>{if(t.value)return;const r=e[s.indexOf(t.hash)];t.value="string"==typeof r?r:Pe(r)};return r.forEach((e=>
2{if("children"in e&&Object.values(e.children).forEach((t=>{const r=n[t];r&&(r.parent=e.hash,i.delete(t))})),"BranchWithHash"===e.type||"LeafWithHash"===e.type){const t=e.value,r=n[t];if(!r)return;i.delete(t),"Raw"!==r.type&&(Object.keys(r).forEach((e=>delete r[e])),r.type="Raw",r.hash=t),r.parent=e.hash,a(r)}"Raw"===e.type&&a(e)})),1===i.size?{rootHash:i.values().next().value,proofs:n}:null},In=W.Jj(),Tn=(Rn=(e,t,r,s)=>{if("primitive"===e.type)return n[e.value];if("void"===e.type)return W.R9;if("AccountId32"===e.type)return s;if("AccountId20"===e.type)return on;if("compact"===e.type)return e.isBig?oe:ae;if("bitSequence"===e.type)return dn(e.isLSB);const i=e=>Tn(e,t,r,s),a=(e,t)=>{const r=i(e);return t?Z(r,t):Z(r)},o=e=>z(...e.map(i)),c=e=>{const t=Object.fromEntries(Object.entries(e).map((([e,t])=>[e,i(t)])));return K(t)};if("sequence"===e.type&&"primitive"===e.value.type&&"u8"===e.value.value)return In;if("array"===e.type)return"primitive"===e.value.type&&"u8"===e.value.value?Cr(e.len):a(e.value,e.len);if("sequence"===e.type)return a(e.value);if("tuple"===e.type)return o(e.value);if("struct"===e.type)return c(e.value);if("option"===e.type)return J(i(e.value));if("result"===e.type)return G(i(e.value.ok),i(e.value.ko));const u=Object.values(e.value).map((e=>{switch(e.type){case"void":return W.R9;case"lookupEntry":return i(e.value);case"tuple":return o(e.value);case"struct":return c(e.value);case"array":return a(e.value,e.len)}})),d=Object.fromEntries(Object.keys(e.value).map(((e,t)=>[e,u[t]]))),l=Object.values(e.value).map((e=>e.idx)),p=l.every(((e,t)=>e===t))?se(d):se(d,l);return e.byteLength?On(p,e.byteLength):p},Cn=Lr,Bn=e=>e,(e,t,r,...n)=>{const{id:s}=e;if(t.has(s))return t.get(s);if(r.has(s)){const r=Cn((()=>t.get(s)),e,...n);return t.set(s,r),r}r.add(s);let i=Rn(e,t,r,...n);return r.delete(s),t.has(s)&&(i=Bn(i,t.get(s),e,...n)),t.set(s,i),i});var Rn,Cn,Bn;const Mn=(e,t=sr())=>{const r=new Map;return n=>(n=>Tn(e(n),r,new Set,t))(n)},On=(e,t)=>{const r=W.Jj(t);return W.VG((t=>r.enc(e.enc(t))),(t=>e.dec(r.dec(t))))},Pn=W.hD(W.R9,(()=>{}),(()=>null)),Hn=(e,t)=>"array"===e.type&&e.len===t&&"primitive"===e.value.type&&"u8"===e.value.value,Dn={type:"void"},Vn=(e,t=(()=>null))=>{const r=new Map,n=new Set;let s=!0,i=!0;const a=u=>{let d=r.get(u);if(d)return d;if(n.has(u)){const e={id:u};return r.set(u,e),e}n.add(u);const l=(r=>{const n=t(e[r]);if(n)return n;const{def:u,path:d,params:l}=e[r];if("composite"===u.tag){if(0===u.value.length)return Dn;if(1===u.value.length){const e=a(u.value[0].type);return s&&"AccountId32"===d.at(-1)&&Hn(e,32)?(s=!1,{type:"AccountId32"}):i&&"AccountId20"===d.at(-1)&&Hn(e,20)?(i=!1,{type:"AccountId20"}):e}return o(u.value)}if("variant"===u.tag){if(1===d.length&&"Option"===d[0]&&1===l.length&&"T"===l[0].name){const e=a(l[0].type);return"void"===e.type?{type:"primitive",value:"bool"}:{type:"option",value:e}}if(1===d.length&&"Result"===d[0]&&2===l.length&&"T"===l[0].name&&"E"===l[1].name)return{type:"result",value:{ok:a(l[0].type),ko:a(l[1].type)}};if(0===u.value.length)return Dn;const e={},t={};return u.value.forEach((r=>{const n=r.name;t[n]=r.docs,0!==r.fields.length?1!==r.fields.length||r.fields[0].name?e[n]={...o(r.fields),idx:r.index}:e[n]={type:"lookupEntry",value:a(r.fields[0].type),idx:r.index}:e[n]={...Dn,idx:r.index}})),{type:"enum",value:e,innerDocs:t}}if("sequence"===u.tag)return{type:"sequence",value:a(u.value)};if("array"===u.tag){const{len:e}=u.value,t=a(u.value.type);return e&&"void"!==t.type?e>1?{type:"array",value:t,len:u.value.len}:t:Dn}if("tuple"===u.tag)return 0===u.value.length?Dn:u.value.length>1?c(u.value.map((e=>a(e))),u.value.map((t=>e[t].docs))):a(u.value[0]);if("primitive"===u.tag)return{type:"primitive",value:u.value.tag};if("compact"===u.tag){const e=a(u.value);return"void"===e.type?Dn:{type:"compact",isBig:Number(e.value.slice(1))>32,size:e.value}}return{type:u.tag,isLSB:(e[u.value.bitOrderType].path.at(-1)??"LSB").toUpperCase().startsWith("LSB")}})(u);return d=r.get(u),d?Object.assign(d,l):(d={id:u,...l},r.set(u,d)),n.delete(u),d},o=e=>{let t=!0;const r={},n={};return e.forEach(((e,s)=>{t=t&&!!e.name;const i=e.name||s,o=a(e.type);"void"!==o.type&&(r[i]=o,n[i]=e.docs)})),t?{type:"struct",value:r,innerDocs:n}:c(Object.values(r),Object.values(n))},c=(e,t)=>{if(e.every((t=>t.id===e[0].id))&&t.every((e=>!e.length))){const[t]=e;return"void"===t.type?Dn:{type:"array",value:e[0],len:e.length}}return{type:"tuple",value:e,innerDocs:t}};return a},$n=(e,t,r)=>{if(null!=r&&r!==t)throw new Error(`${e} not expected. Received ${r} expected ${t}`)},Ln=(e,{decimals:t,tokenSymbol:r,...i})=>{const a=(e=>{try{const t=ke(mt(e));if(t.version<=14)throw new Error("Wrong metadata version");return t}catch(e){throw e||new Error("Unable to decode metadata")}})(e),o=a.extrinsic.version.includes(4)?4:null;if(null==o)throw new Error("Only extrinsic v4 is supported");const{ss58Prefix:c,buildDefinition:u}=(e=>{const{metadata:t}=e;let r=Mn(e);const s=t.pallets.find((e=>"System"===e.name))?.constants.find((e=>"SS58Prefix"===e.name));let i;if(s)try{const t=r(s.type).dec(s.value);"number"==typeof t&&(i=t,r=Mn(e,sr(t)))}catch(e){}const a=new Map,o=e=>{switch(e.type){case"void":return W.R9;case"lookupEntry":return r(e.value.id);case"tuple":return z(...Object.values(e.value).map((e=>r(e.id))));case"struct":return K(Y(e.value,(e=>r(e.id))));case"array":return Z(r(e.value.id),e.len)}},c=r=>(n,s)=>{const i=t.pallets.find((e=>e.name===n)),a=e(i[r].type);if("enum"!==a.type)throw null;const c=a.value[s];return{location:[i.index,c.idx],codec:o(a.value[s])}};return{buildDefinition:r,buildStorage:(s,i)=>{let o=a.get(s);o||a.set(s,o=qr(s));const c=t.pallets.find((e=>e.name===s)).storage.items.find((e=>e.name===i)),u=e=>e===W.R9?Pn:e,d=(e,t,...r)=>{const n=o(...r),[,...s]=r;return{args:z(...s.map((([e])=>e))),keys:n,value:t,len:e,fallback:1===c.modifier?t.dec(c.fallback):void 0}};if("plain"===c.type.tag)return d(0,u(r(c.type.value)),i);const{key:l,value:p,hashers:h}=c.type.value,f=u(r(p)),y=h.map((e=>n[e.tag])),g=(()=>
2{if(1===y.length)return[[r(l),y[0]]];const t=e(l);switch(t.type){case"array":return y.map((e=>[r(t.value.id),e]));case"tuple":return t.value.map(((e,t)=>[r(e.id),y[t]]));default:throw new Error("Invalid key type")}})();return d(y.length,f,i,...g)},buildEvent:c("events"),buildError:c("errors"),buildViewFn:(e,n)=>{const s=t.pallets.find((t=>t.name===e))?.viewFns.find((e=>e.name===n));if(!s)throw null;return{args:z(...s.inputs.map((e=>r(e.type)))),value:r(s.output)}},buildRuntimeCall:(e,n)=>{const s=t.apis.find((t=>t.name===e))?.methods.find((e=>e.name===n));if(!s)throw null;return{args:z(...s.inputs.map((e=>r(e.type)))),value:r(s.output)}},buildCall:c("calls"),buildConstant:(e,n)=>{const s=t.pallets.find((t=>t.name===e)).constants.find((e=>e.name===n));return r(s.type)},ss58Prefix:i}})((e=>{const t=Vn(e.lookup,(({def:r})=>{if("composite"===r.tag){const n=function(e){if(2!==e.value.length||"index"!==e.value[0].name||"error"!==e.value[1].name)return null;const r=t(e.value[0].type),n=t(e.value[1].type);return"primitive"===r.type&&"u8"===r.value&&"array"===n.type&&"primitive"===n.value.type&&"u8"===n.value.value?1+n.len:null}(r);if(n)return{type:"enum",innerDocs:{},value:Object.fromEntries(e.pallets.map((e=>[e.name,null==e.errors?{...Dn,idx:e.index}:{type:"lookupEntry",value:t(e.errors.type),idx:e.index}]))),byteLength:n}}return null}));return Object.assign(t,{metadata:e,call:(()=>{if("call"in e.extrinsic)return e.extrinsic.call;const t=e.lookup[e.extrinsic.type],r=t?.params.find((e=>"Call"===e.name));return r?.type??null})()})})(a));if(null==c)throw new Error("SS58 prefix not found in metadata");$n("SS58 prefix",c,i.base58Prefix);const d=a.pallets.find((e=>"System"===e.name))?.constants.find((e=>"Version"===e.name));if(null==d)throw new Error("System.Version constant not found");const{spec_name:l,spec_version:p}=u(d.type).dec(d.value);if("string"!=typeof l||"number"!=typeof p)throw new Error("Spec name or spec version not found");$n("Spec name",l,i.specName),$n("Spec version",p,i.specVersion);const h={decimals:t,tokenSymbol:r,specVersion:p,specName:l,base58Prefix:c},f=new Map(a.lookup.map((e=>[e.id,e]))),y=((e,t)=>{const r=new Set,n=e=>{if(r.has(e))return;const{tag:s,value:i}=t.get(e).def;switch(s){case"composite":if(!i.length)break;r.add(e),i.forEach((({type:e})=>{n(e)}));break;case"variant":if(!i.length)break;r.add(e),i.forEach((({fields:e})=>{e.forEach((({type:e})=>{n(e)}))}));break;case"tuple":if(!i.length)break;r.add(e),i.forEach(n);break;case"sequence":r.add(e),n(i);break;case"array":r.add(e),n(i.type);break;case"bitSequence":r.add(e)}};n(e.extrinsic.call),n(e.extrinsic.address),n(e.extrinsic.signature),e.extrinsic.signedExtensions[0].forEach((({type:e,additionalSigned:t})=>{n(e),n(t)}));const s=[...r].sort(((e,t)=>e-t));return new Map(s.map(((e,t)=>[e,t])))})(a,f),g=e=>{const{def:{tag:t,value:r}}=f.get(e);if("primitive"===t)return r.tag;if("composite"!==t&&"tuple"!==t||r.length>1)throw new Error("The provided definition doesn't map to a primitive");return 0===r.length?null:g("tuple"===t?r[0]:r[0].type)},m=e=>{const{def:t}=f.get(e);if("primitive"===t.tag)return{tag:t.value.tag,value:void 0};if("compact"===t.tag){const e=g(t.value),r=vt[e];if(!r)throw new Error("Invalid primitive for Compact");return{tag:r,value:void 0}}return y.has(e)?{tag:"perId",value:y.get(e)}:{tag:"void",value:void 0}},b={version:o,addressTy:m(a.extrinsic.address),callTy:m(a.extrinsic.call),signatureTy:m(a.extrinsic.signature),signedExtensions:a.extrinsic.signedExtensions[0].map((e=>({identifier:e.identifier,includedInExtrinsic:m(e.type),includedInSignedData:m(e.additionalSigned)})))},v=((e,t,r,n)=>{const s=[];return[...t.entries()].forEach((([t,i])=>{const{path:a}=e.get(t);((e,t,r,n)=>{const{def:{tag:s,value:i}}=e.get(n);switch(s){case"composite":return[{tag:s,value:i.map((e=>({name:e.name,typeName:e.typeName,ty:t(e.type)})))}];case"variant":return i.map((e=>({tag:"enumeration",value:{name:e.name,index:e.index,fields:e.fields.map((e=>({name:e.name,typeName:e.typeName,ty:t(e.type)})))}})));case"sequence":return[{tag:s,value:t(i)}];case"array":return[{tag:s,value:{len:i.len,typeParam:t(i.type)}}];case"tuple":return[{tag:s,value:i.map(t)}];case"bitSequence":{const t=r(i.bitStoreType),n=xe[t];if(!n)throw new Error("Invalid primitive for BitSequence");const s=e.get(i.bitOrderType).path,a=s.includes("Lsb0");if(!a&&!s.includes("Msb0"))throw new Error("BitOrderType not recognized");return[{tag:"bitSequence",value:{numBytes:n,leastSignificantBitFirst:a}}]}}throw new Error(`FrameId(${n}) should have been filtered out`)})(e,r,n,t).forEach((e=>{s.push({path:a,typeId:i,typeDef:e})}))})),s.sort(((e,t)=>{if(e.typeId!==t.typeId)return e.typeId-t.typeId;if("enumeration"!==e.typeDef.tag||"enumeration"!==t.typeDef.tag)throw new Error("Found two types with same id");return e.typeDef.value.index-t.typeDef.value.index})),s})(f,y,m,g),w=v.map(me.enc);let x;const k=()=>
2{if(x)return x;if(!w.length)return x=[new Uint8Array(32).fill(0)];x=new Array(2*w.length-1);let e=w.length-1;for(let t=0;t<w.length;t++)x[e+t]=F(w[t]);for(let e=x.length-2;e>0;e-=2)x[(e-1)/2]=F(s([x[e],x[e+1]]));return x};let E;const _=e=>{const t=function(e,t){const r=t.map((t=>e[t])),n=e.length-1,s=t.map((e=>n+e)),i=[];if(s.length){const e=Et(s.at(-1)),t=Math.pow(2,e)-1,n=s.findIndex((e=>e>=t));n>0&&(s.unshift(...s.splice(n)),r.unshift(...r.splice(n)))}let a=0;const o=e=>{if(a===s.length)return void i.push(e);const t=s[a];if(t===e)return void++a;const r=Et(e);if(e!==(t+1>>Et(t)-r)-1)return void i.push(e);const n=2*e+1;o(n),o(n+1)};return o(0),{leaves:r,leafIdxs:s,proofIdxs:i}}(w,e),r=k(),n=t.proofIdxs.map((e=>r[e]));return s([W.oA.enc(t.leaves.length),...t.leaves,W.oA.enc(t.leafIdxs.length),...t.leafIdxs.map((e=>W.Jq.enc(e))),W.oA.enc(n.length),...n,ve.enc(b),le.enc(h)])},S=e=>{const t=[b.callTy,...b.signedExtensions.map((e=>e.includedInExtrinsic)),...b.signedExtensions.map((e=>e.includedInSignedData))];return _(kt(e,t,v))};return{digest:()=>{if(E)return E;const e={tag:"V1",value:{typeInformationTreeRoot:k()[0],extrinsicMetadataHash:F(ve.enc(b)),...h}};return E=F(he.enc(e))},getProofForExtrinsic:(e,t)=>{let[,{version:r,type:n},i]=we(e);if(r!==b.version)throw new Error("Incorrect extrinsic version");const a="signed"===n?[b.addressTy,b.signatureTy,...b.signedExtensions.map((e=>e.includedInExtrinsic)),b.callTy]:[b.callTy];return t&&(i=s([i,bt(t)]),a.push(...b.signedExtensions.map((e=>e.includedInSignedData)))),_(kt(i,a,v))},getProofForExtrinsicParts:(e,t,r)=>{const n=s([e,t,r].map(bt));return S(n)},getProofForExtrinsicPayload:S}}},98083:(e,t,r)=>{r.d(t,{P:()=>$});var n=r(35562),s=r(37602),i=r(23601),a=r(4615),o=r(65968),c=r(54371),u=r(69543),d=r(48731),l=r(11147),p=r(82671),h=r(1346),f=r(6485),y=r(84789),g=r(55858),m=r(88311),b=r(51330),v=r(59003),w=r(33403);function x(e){return e.map((e=>(0,w.Z)({},e,{name:Array.isArray(e.name)?e.name:[e.name]})))}function k(e,t){if(!t.metadataVersion.length)throw new Error("Invalid format for V0 (detected) contract metadata");return e.createType("ContractMetadataV1",(0,w.Z)({},t,{spec:(0,w.Z)({},t.spec,{constructors:x(t.spec.constructors),messages:x(t.spec.messages)}),types:(0,v.t)(e,t.types)}))}const E={ContractConstructorSpec:"ContractMessageParamSpecV2",ContractEventSpec:"ContractEventParamSpecV2",ContractMessageSpec:"ContractMessageParamSpecV2"};function _(e){return(0,w.Z)({},e,{label:Array.isArray(e.name)?e.name.join("::"):e.name})}function S(e,t,r){return r.map((r=>e.createType(`${t}V2`,(0,w.Z)(_(r),{args:r.args.map((r=>e.createType(E[t],_(r))))}))))}function A(e,t){return e.createType("ContractMetadataV2",(0,w.Z)({},t,{spec:(0,w.Z)({},t.spec,{constructors:S(e,"ContractConstructorSpec",t.spec.constructors),events:S(e,"ContractEventSpec",t.spec.events),messages:S(e,"ContractMessageSpec",t.spec.messages)})}))}function q(e,t){return e.createType("ContractMetadataV3",(0,w.Z)({},t,{spec:(0,w.Z)({},t.spec,{constructors:t.spec.constructors.map((t=>e.createType("ContractConstructorSpecV3",(0,w.Z)({},t,{payable:!0}))))})}))}function U(e,t){return e.createType("ContractMetadataV4",(0,w.Z)({},t,{spec:(0,w.Z)({},t.spec,{constructors:t.spec.constructors.map((t=>e.createType("ContractConstructorSpecV4",(0,w.Z)({},t)))),messages:t.spec.messages.map((t=>e.createType("ContractMessageSpecV3",(0,w.Z)({},t))))}),version:e.createType("Text","4")}))}const I=["V6","V5","V4","V3","V2","V1"];function T(e,t){return(r,n)=>e(r,t(r,n))}function R(e,t){return t}const C=T(R,U),B=T(C,q),M=T(B,A),O=[["V6",function(e,t){return t}],["V5",function(e,t){return t}],["V4",R],["V3",C],["V2",B],["V1",M],["V0",T(M,k)]],P=(0,a.k)("Abi"),H=["AccountId","AccountId20","AccountIndex","Address","Balance"];function D(e,t){const r=(0,o.h)(t)?e[t]:(0,c.H)(t)?e.find((({identifier:e})=>[e,(0,u.yZ)(e)].includes(t.toString()))):t;return(0,d.k8)(r,(()=>`Attempted to call an invalid contract interface, ${(0,l.P)(t)}`))}function V(e){return!!e&&e instanceof Map&&!(0,h.o)(e.type)&&!(0,h.o)(e.displayName)}class ${events;constructors;info;json;messages;metadata;registry;environment=new Map;isRevive;constructor(e,t){[this.json,this.registry,this.metadata,this.info,this.isRevive]=function(e,t){const r=new n.P,s=function(e){const t=e.source,r=e.version;return"object"==typeof t&&null!==t&&"contract_binary"in t||"number"==typeof r&&r>=6}(e),i=s?"ContractReviveProjectInfo":"ContractProjectInfo",a=r.createType(i,e),o=function(e,t){const r=I.find((e=>
2(0,p.K)(t[e]))),n=t.version;if(!r&&n&&!I.find((e=>e===`V${n}`)))throw new Error(`Unable to handle version ${n}`);const s=e.createType("ContractMetadata",r?{[r]:t[r]}:n?{[`V${n}`]:t}:{V0:t}),i=O.find((([e])=>s[`is${e}`]));if(!i)throw new Error(`Unable to convert ABI with version ${s.type} to a supported version`);return i[1](e,s[`as${i[0]}`])}(r,e),c=r.createType("PortableRegistry",{types:o.types},!0);return r.setLookup(c),t&&r.setChainProperties(t),c.types.forEach((({id:e})=>c.getTypeDef(e))),[e,r,o,a,s]}((0,c.H)(e)?JSON.parse(e):e,t),this.constructors=this.metadata.spec.constructors.map(((e,t)=>this.#e(e,t,{isConstructor:!0,isDefault:e.default.isTrue,isPayable:e.payable.isTrue,returnType:e.returnType.isSome?this.registry.lookup.getTypeDef(e.returnType.unwrap().type):null}))),this.events=this.metadata.spec.events.map(((e,t)=>this.#t(t))),this.messages=this.metadata.spec.messages.map(((e,t)=>this.#e(e,t,{isDefault:e.default.isTrue,isMutating:e.mutates.isTrue,isPayable:e.payable.isTrue,returnType:e.returnType.isSome?this.registry.lookup.getTypeDef(e.returnType.unwrap().type):null})));for(const[e,t]of this.metadata.spec.environment.entries()){if(!((r=t)&&r instanceof s.W))throw new Error(`Expected Option<*> definition for ${e} in ContractEnvironment`);if(t.isSome){const r=t.unwrap();if((0,f.H)(r))this.environment.set(e,r);else{if(!V(r))throw new Error(`Invalid environment definition for ${e}:: Expected either Number or ContractTypeSpec`);this.environment.set(e,this.registry.lookup.getTypeDef(r.type))}}}var r}decodeEvent(e){switch(this.metadata.version.toString()){case"4":return this.#r(e);case"5":return this.#n(e);default:return this.#s(e)}}#s=e=>{const t=e.event.data[2],r=t[0],n=e.event.data[1];if(r){const e=this.events.find((e=>void 0!==e.signatureTopic&&null!==e.signatureTopic&&e.signatureTopic===r.toHex()));if(e)return e.fromU8a(n)}const s=t.length,i=this.events.filter((e=>(null===e.signatureTopic||void 0===e.signatureTopic)&&e.args.filter((e=>e.indexed)).length===s));if(1===i.length)return i[0].fromU8a(n);throw new Error("Unable to determine event")};#n=e=>{const t=e.topics[0],r=e.event.data[1];if(t){const e=this.events.find((e=>void 0!==e.signatureTopic&&null!==e.signatureTopic&&e.signatureTopic===t.toHex()));if(e)return e.fromU8a(r)}const n=e.topics.length,s=this.events.filter((e=>(null===e.signatureTopic||void 0===e.signatureTopic)&&e.args.filter((e=>e.indexed)).length===n));if(1===s.length)return s[0].fromU8a(r);throw new Error("Unable to determine event")};#r=e=>{const t=e.event.data[1],r=t[0],n=this.events[r];if(!n)throw new Error(`Unable to find event with index ${r}`);return n.fromU8a(t.subarray(1))};decodeConstructor(e){return this.#i("message",this.constructors,e)}decodeMessage(e){return this.#i("message",this.messages,e)}findConstructor(e){return D(this.constructors,e)}findMessage(e){return D(this.messages,e)}#a=(e,t)=>e.map((({label:e,type:r},n)=>{try{if(!(0,p.K)(r))throw new Error("Invalid type definition found");const t=r.displayName.length?r.displayName[r.displayName.length-1].toString():void 0,n=(0,u.yZ)(e);if(t&&H.includes(t))return{name:n,type:{info:i.u.Plain,type:t}};const s=this.registry.lookup.getTypeDef(r.type);return{name:n,type:t&&!s.type.startsWith(t)?{displayName:t,...s}:s}}catch(e){throw P.error(`Error expanding argument ${n} in ${(0,l.P)(t)}`),e}}));#o=(e,t)=>this.#a(e,t);#c=(e,t)=>this.#a(e,t).map(((t,r)=>({...t,indexed:e[r].indexed.toPrimitive()})));#t=e=>"4"===this.metadata.version.toString()?this.#u(this.metadata.spec.events[e],e):this.#d(this.metadata.spec.events[e],e);#d=(e,t)=>{const r=this.#c(e.args,e),n={args:r,docs:e.docs.map((e=>e.toString())),fromU8a:e=>({args:this.#l(r,e),event:n}),identifier:[e.module_path,e.label].join("::"),index:t,signatureTopic:e.signature_topic.isSome?e.signature_topic.unwrap().toHex():null};return n};#u=(e,t)=>{const r=this.#c(e.args,e),n={args:r,docs:e.docs.map((e=>e.toString())),fromU8a:e=>({args:this.#l(r,e),event:n}),identifier:e.label.toString(),index:t};return n};#e=(e,t,r={})=>{const n=this.#o(e.args,e),s=e.label.toString(),i={...r,args:n,docs:e.docs.map((e=>e.toString())),fromU8a:e=>({args:this.#l(n,e),message:i}),identifier:s,index:t,isDefault:e.default.isTrue,method:(0,u.yZ)(s),path:s.split("::").map((e=>(0,u.yZ)(e))),selector:e.selector,toU8a:t=>this.#p(e,n,t)};return i};#l=(e,t)=>
2{let r=0;return e.map((({type:{lookupName:e,type:n}})=>{const s=this.registry.createType(e||n,t.subarray(r));return r+=s.encodedLength,s}))};#i=(e,t,r)=>{const[,n]=(0,y.o)(r),s=n.subarray(0,4),i=t.find((e=>e.selector.eq(s)));if(!i)throw new Error(`Unable to find ${e} with selector ${(0,g.c)(s)}`);return i.fromU8a(n.subarray(4))};#p=({label:e,selector:t},r,n)=>{if(n.length!==r.length)throw new Error(`Expected ${r.length} arguments to contract message '${e.toString()}', found ${n.length}`);return(0,m.N)((0,b.e)(this.registry.createType("ContractSelector",t).toU8a(),...r.map((({type:{lookupName:e,type:t}},r)=>this.registry.createType(e||t,n[r]).toU8a()))))}}},75768:(e,t,r)=>{r.d(t,{b8:()=>O,wi:()=>P,vM:()=>H});var n=r(10589),s=r(89492),i=r(1346),a=r(95292);function o(e,t,r,n){if(e.isInBlock||e.isFinalized){const s=n?"revive":"contracts",i=e.filterRecords(s,t);if(i.length)return r(i)}}var c=r(33661),u=r(98083);class d{abi;api;_decorateMethod;_isWeightV1;_isRevive;constructor(e,t,r){if(!e||!e.isConnected||!e.tx)throw new Error("Your API has not been initialized correctly and is not connected to a chain");if(this.abi=t instanceof u.P?t:new u.P(t,e.registry.getChainProperties()),this.api=e,this._decorateMethod=r,this._isWeightV1=!e.registry.createType("Weight").proofSize,this._isRevive=this.abi.isRevive,this._isRevive){if(!e.tx.revive||!(0,c.m)(e.tx.revive.instantiateWithCode)||6!==e.tx.revive.instantiateWithCode.meta.args.length)throw new Error("The runtime does not expose api.tx.revive.instantiateWithCode with storageDepositLimit");if(!e.call.reviveApi||!(0,c.m)(e.call.reviveApi.call))throw new Error("Your runtime does not expose the api.call.reviveApi.call runtime interfaces")}else{if(!e.tx.contracts||!(0,c.m)(e.tx.contracts.instantiateWithCode)||6!==e.tx.contracts.instantiateWithCode.meta.args.length)throw new Error("The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit");if(!e.call.contractsApi||!(0,c.m)(e.call.contractsApi.call))throw new Error("Your runtime does not expose the api.call.contractsApi.call runtime interfaces")}}get registry(){return this.api.registry}}var l=r(77984),p=r(48801),h=r(4615),f=r(66626),y=r(88311),g=r(46610),m=r(12372),b=r(52926);const v=new Uint8Array;function w(e,t){return t.meta=e,t}function x(e,t){return w(e,((e,...r)=>t(e,r)))}function k(e=(0,b.F)()){return e instanceof f.J?e:e?.length?(0,y.N)((0,g.Y)(e)):v}function E(e){const[t,r]=function(e){return!!e.proofSize}(e)?[e.refTime.toBn(),e.proofSize.toBn()]:[(0,m.G)(e),void 0];return{v1Weight:t,v2Weight:{proofSize:r,refTime:t}}}const _=new p(5e12).isub(a.If),S=(0,h.k)("Contract");class A extends s.h{contractEvents;constructor(e,t){super(e),this.contractEvents=t}}class q extends d{address;#h={};#f={};constructor(e,t,r,n){super(e,t,n),this.address=this.registry.createType(this._isRevive?"AccountId20":"AccountId",r),this.abi.messages.forEach((e=>{var t;(0,i.o)(this.#f[e.method])&&(this.#f[e.method]=(t=(t,r)=>this.#y(e,t,r),w(e,((e,...r)=>t(e,r))))),(0,i.o)(this.#h[e.method])&&(this.#h[e.method]=function(e,t){return w(e,((e,r,...n)=>t(e,r,n)))}(e,((t,r,n)=>this.#g(e,r,n).send(t))))}))}get query(){return this.#h}get tx(){return this.#f}#m=(e,t=!1)=>{const r=E(e);return r.v1Weight.gt(a.nw)?r:E(t?_:E(this.api.consts.system.blockWeights?this.api.consts.system.blockWeights.maxBlock:this.api.consts.system.maximumBlockWeight).v1Weight.muln(64).div(a.S8))};#y=(e,{gasLimit:t=a.nw,storageDepositLimit:r=null,value:n=a.nw},s)=>(this._isRevive?this.api.tx.revive:this.api.tx.contracts).call(this.address,n,this._isWeightV1?E(t).v1Weight:E(t).v2Weight,r,this.abi.findMessage(e).toU8a(s)).withResultTransform((e=>new A(e,o(e,["ContractEmitted","ContractExecution"],(e=>e.filter((e=>{try{const t=e.event.data[0];return!!this.address.eq(t)||(S.debug(`Skipping event from different contract ${t.toString()} (this contract: ${this.address.toString()})`),!1)}catch(e){return S.warn(`Unable to extract contract address from event: ${e.message}`),!1}})).map((e=>{try{return this.abi.decodeEvent(e)}catch(e){return S.error(`Unable to decode contract event: ${e.message}`),null}})).filter((e=>!!e))),this._isRevive))));#g=(e,{gasLimit:t=a.nw,storageDepositLimit:r=null,value:n=a.nw},s)=>{const i=this.abi.findMessage(e);return{send:this._decorateMethod((e=>(this._isRevive?this.api.rx.call.reviveApi.call:this.api.rx.call.contractsApi.call)(e,this.address,n,this._isWeightV1?this.#m(t,!0).v1Weight:this.#m(t,!0).v2Weight,r,i.toU8a(s)).pipe((0,l.U)((({debugMessage:e,gasConsumed:t,gasRequired:r,result:n,storageDeposit:s})=>({debugMessage:e,gasConsumed:t,gasRequired:r&&!E(r).v1Weight.isZero()?r:t,output:n.isOk&&i.returnType?this.abi.registry.createTypeUnsafe(i.returnType.lookupName||i.returnType.type,[n.asOk.data.toU8a(!0)],{isPedantic:!0}):null,result:n,storageDeposit:s}))))))}}}class U extends s.h{contract;constructor(e,t){super(e),this.contract=t}}class I extends d{codeHash;#f={};constructor(e,t,r,n){super(e,t,n),this.codeHash=this.registry.createType("Hash",r),this.abi.constructors.forEac
2h((e=>{(0,i.o)(this.#f[e.method])&&(this.#f[e.method]=x(e,((t,r)=>this.#b(e,t,r))))}))}get tx(){return this.#f}#b=(e,{gasLimit:t=a.nw,salt:r,storageDepositLimit:n=null,value:s=a.nw},i)=>(this._isRevive?this.api.tx.revive:this.api.tx.contracts).instantiate(s,this._isWeightV1?E(t).v1Weight:E(t).v2Weight,n,this.codeHash,this.abi.findConstructor(e).toU8a(i),k(r)).withResultTransform((e=>new U(e,o(e,["Instantiated"],(([e])=>new q(this.api,this.abi,e.event.data[1],this._decorateMethod)),this._isRevive))))}var T=r(6226),R=r(25553);class C extends s.h{blueprint;contract;constructor(e,t,r){super(e),this.blueprint=t,this.contract=r}}function B(e){return(0,T.F)(e)||(0,R.B)(e)}class M extends d{code;#f={};constructor(e,t,r,n){if(super(e,t,n),this.code=B(this.abi.info.source.wasm)?this.abi.info.source.wasm:(0,g.Y)(r),!B(this.code))throw new Error("Invalid code provided");this.abi.constructors.forEach((e=>{(0,i.o)(this.#f[e.method])&&(this.#f[e.method]=x(e,((t,r)=>this.#v(e,t,r))))}))}get tx(){return this.#f}#v=(e,{gasLimit:t=a.nw,salt:r,storageDepositLimit:n=null,value:s=a.nw},i)=>{const c=this._isRevive?this.api.tx.revive:this.api.tx.contracts;return this._isRevive?c.instantiateWithCode(s,this._isWeightV1?E(t).v1Weight:E(t).v2Weight,n,(0,y.N)(this.code),this.abi.findConstructor(e).toU8a(i),k(r)).withResultTransform((e=>new C(e,...o(e,["Instantiated"],(e=>e.reduce((([e,t],{event:r})=>this.api.events.revive.Instantiated.is(r)?[e,new q(this.api,this.abi,r.data[1],this._decorateMethod)]:[e,t]),[void 0,void 0])),this._isRevive)||[void 0,void 0]))):c.instantiateWithCode(s,this._isWeightV1?E(t).v1Weight:E(t).v2Weight,n,(0,y.N)(this.code),this.abi.findConstructor(e).toU8a(i),k(r)).withResultTransform((e=>new C(e,...o(e,["CodeStored","Instantiated"],(e=>e.reduce((([e,t],{event:r})=>this.api.events.contracts.Instantiated.is(r)?[e,new q(this.api,this.abi,r.data[1],this._decorateMethod)]:this.api.events.contracts.CodeStored.is(r)?[new I(this.api,this.abi,r.data[0],this._decorateMethod),t]:[e,t]),[void 0,void 0])),this._isRevive)||[void 0,void 0])))}}class O extends I{constructor(e,t,r){super(e,t,r,n.x)}}class P extends M{constructor(e,t,r){super(e,t,r,n.x)}}class H extends q{constructor(e,t,r){super(e,t,r,n.x)}}},75274:(e,t,r)=>{r.d(t,{O:()=>n});const n=(0,r(16173).a)((e=>e.rpc.chain.subscribeNewHeads()))},60094:(e,t,r)=>{r.d(t,{b:()=>n});const n=(0,r(16173).a)((e=>e.rpc.chain.subscribeFinalizedHeads()))},23052:(e,t,r)=>{r.d(t,{f:()=>a});var n=r(43806),s=r(77984),i=r(44777);function a(e,t){return(0,i.X)(e,(()=>(0,n.a)([t.derive.chain.bestNumber(),t.derive.chain.bestNumberFinalized()]).pipe((0,s.U)((([e,r])=>t.registry.createType("BlockNumber",e.sub(r)))))))}},32166:(e,t,r)=>{r.d(t,{Q:()=>d});var n=r(43806),s=r(12335),i=r(35120),a=r(77984),o=r(69551),c=r(44777),u=r(16173);function d(e,t){return(0,c.X)(e,(e=>(0,n.a)([t.rpc.chain.getBlock(e),t.queryAt(e)]).pipe((0,s.w)((([r,s])=>(0,n.a)([(0,i.of)(r),s.system.events(),(0,u.w)(t,r.block.header,e)]))),(0,a.U)((([e,t,[,r,n]])=>function(e,t,r,n,s){const i=e.createClass("SignedBlock");return new class extends i{#w;#x;#k;constructor(e,t,r,n,s){var i,a;super(e,t),this.#w=s||(0,o.R)(this.block.header.digest,n||[]),this.#x=r||[],this.#k=(i=this.block.extrinsics,a=this.#x,i.map(((e,t)=>{let r,n;const s=a.filter((({phase:e})=>e.isApplyExtrinsic&&e.asApplyExtrinsic.eq(t))).map((({event:e})=>("system"===e.section&&("ExtrinsicSuccess"===e.method?n=e.data[0]:"ExtrinsicFailed"===e.method&&(r=e.data[0],n=e.data[1])),e)));return{dispatchError:r,dispatchInfo:n,events:s,extrinsic:e}}))),this.createdAtHash=t?.createdAtHash}get author(){return this.#w}get events(){return this.#x}get extrinsics(){return this.#k}}(e,t,r,n,s)}(t.registry,e,t,r,n))))))}},79490:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(62355),s=r(44777);function i(e,t){return(0,s.X)(e,(()=>t.derive.chain.subscribeNewHeads().pipe((0,n.z)((e=>t.derive.chain.getBlock(e.createdAtHash||e.hash))))))}},16173:(e,t,r)=>{r.d(t,{a:()=>d,w:()=>l});var n=r(77984),s=r(35120),i=r(43806),a=r(62355),o=r(12335),c=r(44777),u=r(44604);function d(e){return(t,r)=>(0,c.X)(t,(()=>e(r).pipe((0,n.U)(u.E))))}function l(e,t,r){return e.queryAt(t.parentHash.isEmpty?r||t.hash:t.parentHash).pipe((0,o.w)((e=>function(e,t){const r=t.session?.validators?t.session.validators():(0,s.of)(null),{logs:[o]}=e.digest,c=o&&(o.isConsensus&&o.asConsensus[0].isNimbus&&o.asConsensus[1]||o.isPreRuntime&&o.asPreRuntime[0].isNimbus&&o.asPreRuntime[1]);if(c){if(t.authorMapping?.mappingWithDeposit)return(0,i.a)([(0,s.of)(e),r,t.authorMapping.mappingWithDeposit(c).pipe((0,n.U)((e=>e.unwrapOr({account:null}).account)))]);if(t.parachainStaking?.selectedCandidates&&t.session?.nextKeys){const o=c.toHex();return(0,i.a)([(0,s.of)(e),r,t.parachainStaking.selectedCandidates().pipe((0,a.z)((e=>(0,i.a)([(0,s.of)(e),t.session.nextKeys.multi(e).pipe((0,n.U)((e=>e.findIndex((e=>e.unwrapOrDefault().nimbus.toHex()===o)))))]))),(0,n.U)((([e,t])=>-1===t?null:e[t])))])}}return(0,i.a)([(0,s.of)(e),r,(0,s.of)(null)])}(t,e))))}},15938:(e,t,r)=>{r.d(t,{Pc:()=>p,Uc:()=>g,hr:()=>y,lR:()=>f,pn:()=>h});var n=r(31283),s=r(48801),i=r(33403),a=r(54371),o=r(74076),c=r(54827),u=r(48358),d=r(55858);function l(e,t,r,n){for(;;){const s=e.div(t),i=r.div(n);if(s.lt(i))return!0;
2if(i.lt(s))return!1;const a=e.mod(t),o=r.mod(n);if(o.isZero())return!1;if(a.isZero())return!0;e=n,r=t,t=o,n=a}}function p(e,t,r){return e.isSimpleMajority?r.votedAye.gt(r.votedNay):function(e,t,{votedAye:r,votedNay:s,votedTotal:i}){const a=(0,n.D)(i);return!a.isZero()&&(e.isSuperMajorityApprove?l(s,a,r,t):l(s,t,r,a))}(e,t,r)}function h(e,t,r){const n=t.status.tally?function(e,t){const r=[],n=[];return t.forEach((e=>{e.vote.isAye?r.push(e):n.push(e)})),{allAye:r,allNay:n,voteCount:r.length+n.length,voteCountAye:r.length,voteCountNay:n.length,votedAye:e.ayes,votedNay:e.nays,votedTotal:e.turnout}}(t.status.tally,r):r.reduce(((e,t)=>{const{balance:r,vote:n}=t,s=0===n.conviction.index,i=r.muln(s?1:n.conviction.index).divn(s?10:1);return n.isAye?(e.allAye.push(t),e.voteCountAye++,e.votedAye.iadd(i)):(e.allNay.push(t),e.voteCountNay++,e.votedNay.iadd(i)),e.voteCount++,e.votedTotal.iadd(i),e}),{allAye:[],allNay:[],voteCount:0,voteCountAye:0,voteCountNay:0,votedAye:new s(0),votedNay:new s(0),votedTotal:new s(0)});return(0,i.Z)({},n,{isPassing:p(t.status.threshold,e,n),votes:r})}function f(e){if(e.isNone)return null;const t=e.unwrap();return function(e){return!!e.proposalHash}(t)?t:t.isOngoing?t.asOngoing:null}function y(e){return e.isLegacy?e.asLegacy.hash_.toHex():e.isLookup?e.asLookup.hash_.toHex():e.isInline?e.asInline.hash.toHex():(0,a.H)(e)?(0,o.vq)(e)?e:(0,c.$)(e):(0,u.U)(e)?(0,d.c)(e):e.toHex()}function g(e){return y(e.proposal||e.proposalHash)}},69551:(e,t,r)=>{function n(e,t){const[r]=e.logs.filter((e=>e.isConsensus)),n=e.logs.filter((e=>e.isPreRuntime)),[s]=e.logs.filter((e=>e.isSeal));let i;try{for(const e of n){const[r,n]=e.asPreRuntime;if(i=r.extractAuthor(n,t),i)return i}if(!i&&r){const[e,n]=r.asConsensus;i=e.extractAuthor(n,t)}if(!i&&s){const[e,r]=s.asSeal;i=e.extractAuthor(r,t)}}catch{}return i}r.d(t,{R:()=>n})},44604:(e,t,r)=>{r.d(t,{E:()=>s});var n=r(57826);function s(e){return(0,n.f)(e.number)?e.number.unwrap():e.number}},36733:(e,t,r)=>{r.d(t,{G:()=>i,u:()=>a});var n=r(3919);const s=6048e5;let i;function a(e="",t){i=t?function(e,t){return{del:r=>t.del(`${e}${r}`),forEach:t.forEach,get:r=>{const n=`${e}${r}`,s=t.get(n);if(s)return s.x=Date.now(),t.set(n,s),s.v},set:(r,n)=>{t.set(`${e}${r}`,{v:n,x:Date.now()})}}}(`derive:${e}:`,t):n.R,t&&function(e){const t=Date.now(),r=[];e.forEach(((e,{x:n})=>{t-n>s&&r.push(e)})),r.forEach((t=>e.del(t)))}(t)}a()},3919:(e,t,r)=>{r.d(t,{A:()=>s,R:()=>i});const n=new Map,s={del:e=>{n.delete(e)},forEach:e=>{for(const[t,r]of n.entries())e(t,r)},get:e=>n.get(e),set:(e,t)=>{n.set(e,t)}},i={del:()=>{},forEach:()=>{},get:()=>{},set:(e,t)=>t}},59437:(e,t,r)=>{r.d(t,{G:()=>Gi});var n={};r.r(n),r.d(n,{_flags:()=>se,_identity:()=>fe,accountId:()=>re,flags:()=>ie,hasIdentity:()=>ge,hasIdentityMulti:()=>me,idAndIndex:()=>ae,idToIndex:()=>be,identity:()=>ye,indexToId:()=>ke,indexes:()=>xe,info:()=>_e});var s={};r.r(s),r.d(s,{hasProposals:()=>He,members:()=>Pe,prime:()=>Ne,proposal:()=>De,proposalCount:()=>Ve,proposalHashes:()=>$e,proposals:()=>Le});var i={};r.r(i),r.d(i,{_getIds:()=>We,all:()=>Xe,expand:()=>ze,get:()=>Ke,getExpanded:()=>Ze,listNodes:()=>Je});var a={};r.r(a),r.d(a,{account:()=>ht,all:()=>at,votingBalance:()=>yt,votingBalances:()=>ft});var o={};r.r(o),r.d(o,{bounties:()=>bt});var c={};r.r(c),r.d(c,{_getHeaderRange:()=>Tt,bestNumber:()=>vt.O,bestNumberFinalized:()=>wt.b,bestNumberLag:()=>xt.f,getBlock:()=>kt.Q,getBlockByNumber:()=>Et,getHeader:()=>qt,subscribeFinalizedBlocks:()=>It,subscribeFinalizedHeads:()=>Rt,subscribeNewBlocks:()=>Ct.A,subscribeNewHeads:()=>Bt});var u={};r.r(u),r.d(u,{fees:()=>Mt});var d={};r.r(d),r.d(d,{hasProposals:()=>Lt,members:()=>$t,prime:()=>Xt,proposal:()=>Nt,proposalCount:()=>Ft,proposalHashes:()=>jt,proposals:()=>Wt,votes:()=>Dt,votesOf:()=>Vt});var l={};r.r(l),r.d(l,{childKey:()=>zt,contributions:()=>tr,ownContributions:()=>sr});var p={};r.r(p),r.d(p,{_referendumInfo:()=>Ar,_referendumVotes:()=>_r,_referendumsVotes:()=>Sr,dispatchQueue:()=>ur,locks:()=>
2lr,nextExternal:()=>pr,preimage:()=>yr,preimages:()=>fr,proposals:()=>mr,referendumIds:()=>br,referendums:()=>vr,referendumsActive:()=>wr,referendumsFinished:()=>xr,referendumsInfo:()=>qr,sqrtElectorate:()=>Ir});var h={};r.r(h),r.d(h,{info:()=>Br});var f={};r.r(f),r.d(f,{receivedHeartbeats:()=>Or});var y={};r.r(y),r.d(y,{hasProposals:()=>Hr,members:()=>Pr,prime:()=>Nr,proposal:()=>Dr,proposalCount:()=>Vr,proposalHashes:()=>$r,proposals:()=>Lr});var g={};r.r(g),r.d(g,{info:()=>Xr,overview:()=>zr});var m={};r.r(m),r.d(m,{eraLength:()=>en,eraProgress:()=>tn,indexes:()=>Gr,info:()=>Jr,progress:()=>Qr,sessionProgress:()=>rn});var b={};r.r(b),r.d(b,{_members:()=>on,candidates:()=>nn,info:()=>sn,member:()=>an,members:()=>cn});var v={};r.r(v),r.d(v,{_eraExposure:()=>Rn,_eraPrefs:()=>Ln,_eraSlashes:()=>Zn,_erasExposure:()=>Bn,_erasPoints:()=>Dn,_erasPrefs:()=>Fn,_erasRewards:()=>Xn,_erasSlashes:()=>Jn,_ownExposures:()=>rs,_ownSlashes:()=>is,_stakerExposures:()=>ps,_stakerPoints:()=>ys,_stakerPrefs:()=>ms,_stakerRewards:()=>xs,_stakerRewardsEras:()=>ws,_stakerSlashes:()=>Ss,account:()=>hn,accounts:()=>pn,currentPoints:()=>fn,electedInfo:()=>En,eraExposure:()=>Cn,eraPrefs:()=>Nn,eraSlashes:()=>Gn,erasExposure:()=>Mn,erasHistoric:()=>On,erasPoints:()=>Vn,erasPrefs:()=>jn,erasRewards:()=>Kn,erasSlashes:()=>Yn,keys:()=>Qn,keysMulti:()=>es,nextElected:()=>Is,overview:()=>ts,ownExposure:()=>ns,ownExposures:()=>ss,ownSlash:()=>as,ownSlashes:()=>os,query:()=>ds,queryMulti:()=>ls,stakerExposure:()=>fs,stakerExposures:()=>hs,stakerPoints:()=>gs,stakerPrefs:()=>bs,stakerRewards:()=>ks,stakerRewardsMulti:()=>_s,stakerRewardsMultiEras:()=>Es,stakerSlashes:()=>As,stashes:()=>Us,validators:()=>Ts,waitingInfo:()=>Cs});var w={};r.r(w),r.d(w,{hasProposals:()=>Ms,members:()=>Bs,prime:()=>Vs,proposal:()=>Os,proposalCount:()=>Ps,proposalHashes:()=>Hs,proposals:()=>Ds});var x={};r.r(x),r.d(x,{proposals:()=>$s});var k={};r.r(k),r.d(k,{accountExtrinsics:()=>Fs,events:()=>Ls,extrinsicInfo:()=>Ns,signingInfo:()=>ei});var E=r(36061),_=r(33403),S=r(54371),A=r(55858),q=r(46610);const U=(new URL("file:///home/runner/work/apps/apps/node_modules/@polkadot/api/packageInfo.js").pathname.substring(0,new URL("file:///home/runner/work/apps/apps/node_modules/@polkadot/api/packageInfo.js").pathname.lastIndexOf("/")+1),"17.0.1");function I(e,t){return e.findMetaCall((0,q.Y)(t))}function T(e,t){return e.findMetaError((0,q.Y)(t))}var R=r(68730),C=r(12335),B=r(35120),M=r(77984),O=r(35562),P=r(18297),H=r(19),D=r(85617),V=r(4615),$=r(48731),L=r(1346),N=r(95292),F=r(65417),j=r(34323),W=r(58615),X=r(19184),K=r(56130),z=r(43806),Z=r(11348),G=r(98825),J=r(27127);function Y(e,t,r,n){(0,J.W)(e,t,(()=>(0,J.G)({},r(t),(e=>n(t,e)))))}var Q=r(48358),ee=r(94175),te=r(44777);function re(e,t){return(0,te.X)(e,(e=>{const r=(0,Q.U)(e)?e:(0,ee.m)((e||"").toString());if(r.length>8)return(0,B.of)(t.registry.createType(20===r.length?"AccountId20":"AccountId",r));const n=t.registry.createType("AccountIndex",r);return t.derive.accounts.indexToId(n.toString()).pipe((0,M.U)((e=>(0,$.k8)(e,"Unable to retrieve accountId"))))}))}var ne=r(33661);function se(e,t){return(0,te.X)(e,(()=>{const e=[void 0,[],[],[],void 0],r=[(t.query.elections||t.query.phragmenElection||t.query.electionsPhragmen)?.members,t.query.council?.members,t.query.technicalCommittee?.members,t.query.society?.members,t.query.sudo?.key],n=r.filter((e=>e));return n.length?t.queryMulti(n).pipe((0,M.U)((t=>{let n=-1;for(let s=0,i=r.length;s<i;s++)(0,ne.m)(r[s])&&(e[s]=t[++n]);return e}))):(0,B.of)(e)}))}function ie(e,t){return(0,te.X)(e,(e=>t.derive.accounts._flags().pipe((0,M.U)((t=>function(e,[t,r,n,s,i]){const a=e?.toString(),o=e=>e.toString()===a;return{isCouncil:(t?.map((e=>Array.isArray(e)?e[0]:e.who))||r||[]).some(o),isSociety:(s||[]).some(o),isSudo:i?.toString()===a,isTechCommittee:(n||[]).some(o)}}(e,t))))))}function ae(e,t){return(0,te.X)(e,(e=>{try{const r=(0,Q.U)(e)?e:(0,ee.m)((e||"").toString());if(r.length>8){const e=t.registry.createType(20===r.length?"AccountId20":"AccountId",r);return t.derive.accounts.idToIndex(e).pipe((0,M.U)((t=>[e,t])))}const n=t.registry.createType("AccountIndex",r);return t.derive.accounts.indexToId(n.toString()).pipe((0,M.U)((e=>[e,n])))}catch{return(0,B.of)([void 0,void 0])}}))}var oe=r(56623),ce=r(74076);function ue(e){return e.pipe((0,M.U)((([e])=>e)))}function de(e){return(t,r)=>(0,te.X)(t,((...t)=>ue(e(r,...t))))}const le={toHex:()=>{}};function pe(e){return e?e.isRaw?(0,oe.z)(e.asRaw.toU8a(!0)):e.isNone?void 0:e.toHex():e}function he(e){const t=e.unwrap();return Array.isArray(t)?t[0]:t}function fe(e,t){return(0,te.X)(e,(e=>e&&t.query.identity?.identityOf?(0,z.a)([t.query.identity.identityOf(e),t.query.identity.superOf(e)]):(0,B.of)([void 0,void 0])))}function ye(e,t){return(0,te.X)(e,(e=>t.derive.accounts._identity(e).pipe((0,C.w)((([e,r])=>function(e,t,r){if(t?.isSome)return(0,B.of)([t,void 0]);if(r?.isSome){const t=r.unwrap();return(0,z.a)([e.derive.accounts._identity(t[0]).pipe((0,M.U)((([e])=>e))),(0,B.of)(t)])}return(0,B.of)([void 0,void 0])}(t,e,r))),(0,M.U)((([e,t])=>function(e,t){if(!e?.isSome)return{judgements:[]};const{info:r,judgements:n}=he(e),s=pe(r.display);return{discord:pe(r.discord),display:t&&pe(t[1])||s,displayParent:t&&s,email:pe(r.email),github:pe(r.github),image:pe(r.image),judgements:n,legal:pe(r.legal),matrix:pe(r.matrix),other:r.additional?(i=r.additional,i.reduce(((e,[t,r])=>{const n=pe(t),s=pe(r);return n&&s&&(e[n]=s),e}),{})):{},parent:t?.[0],pgp:r.pgpFingerprint.unwrapOr(le).toHex(),riot:pe(r.riot),twitter:pe(r.twitter),web:pe(r.web)};var i}(e,t))),(0,C.w)((r=>function(e,t,r){const n=e.parent||r;return n&&t.query.identity?t.query.identity.subsOf(n).pipe((0,M.U)((t=>{const r=t[1];return{...e,subs:r}}))):(0,B.of)(e)}(r,t,e))))))}const ge=de(((e,t)=>e.derive.accounts.hasIdentityMulti([t])));function me(e,t){return(0,te.X)(e,(e=>t.query.identity?.identityOf?(0,z.a)([t.query.identity.identityOf.multi(e),t.query.identity.superOf.multi(e)]).pipe((0,M.U)((([e,t])=>e.map(((e,r)=>{const n=t[r],s=n&&n.isSome?n.unwrap()[0].toString():void 0;let i;if(e&&e.isSome){const t=pe(he(e).info.display);t&&!(0,ce.vq)(t)&&(i=t)}return{display:i,hasIdentity:!(!i&&!s),parentId:s}}))))):(0,B.of)(e.map((()=>({hasIdentity:!1}))))))}function be(e,t){return(0,te.X)(e,(e=>t.derive.accounts.indexes().pipe((0,M.U)((t=>t[e.toString()])))))}var ve=r(62952);let we=null;function xe(e,t){return(0,te.X)(e,(()=>we?(0,B.of)(we):(t.query.indices?function(e){return e.query.indices.accounts.entries().pipe((0,M.U)((t=>t.reduce(((t,[r,n])=>(n.isSome&&(t[n.unwrap()[0].toString()]=e.registry.createType("AccountIndex",r.args[0])),t)),{}))))}(t).pipe((0,ve.O)({})):(0,B.of)({})).pipe((0,M.U)((e=>(we=e,e))))))}function ke(e,t){return(0,te.X)(e,(e=>t.query.indices?t.query.indices.accounts(e).pipe((0,M.U)((e=>e.unwrapOr([])[0]))):(0,B.of)(void 0)))}function Ee(e,t){return(t&&e.query.nicks?.nameOf?e.query.nicks.nameOf(t):(0,B.of)(void 0)).pipe((0,M.U)((t=>t?.isSome?(0,oe.z)(t.unwrap()[0]).substring(0,e.consts.nicks.maxLength.toNumber()):void 0)))}function _e(e,t){return(0,te.X)(e,(e=>t.derive.accounts.idAndIndex(e).pipe((0,C.w)((([e,r])=>(0,z.a)([(0,B.of)({accountId:e,accountIndex:r}),t.derive.accounts.identity(e),Ee(t,e)]))),(0,M.U)((([{accountId:e,accountIndex:t},r,n])=>({accountId:e,accountIndex:t,identity:r,nickname:n}))))))}function Se(e,t){return(r,n)=>(0,te.X)(r,t(function(e,t){const r=e.registry.getModuleInstances(e.runtimeVersion.specName,t),n=r?.length?r[0]:t;return e.query[n]}(n,e),n,r))}function Ae(e,t){return r=>Se(r,(r=>()=>(0,ne.m)(r?.[e])?r[e]():(0,B.of)(t)))}const qe=Ae("members",[]);var Ue=r(47009);function Ie(e,t,r){return((0,ne.m)(t?.proposals)&&r.length?(0,z.a)([(0,B.of)(r),t.proposalOf.multi(r).pipe((0,Ue.K)((()=>(0,B.of)(r.map((()=>null)))))),t.voting.multi(r)]):(0,B.of)([[],[],[]])).pipe((0,M.U)((t=>function(e,[t,r,n]){return r.map(((r,s)=>({hash:e.registry.createType("Hash",t[s]),proposal:r&&r.isSome?r.unwrap():null,votes:n[s].unwrapOr(null)})))}(e,t))))}function Te(e){return Se(e,(e=>()=>(0,B.of)((0,ne.m)(e?.proposals))))}function Re(e){return Se(e,((t,r)=>()=>r.derive[e].proposalHashes().pipe((0,C.w)((e=>Ie(r,t,e))))))}function Ce(e){return Se(e,((e,t)=>
2r=>(0,ne.m)(e?.proposals)?ue(Ie(t,e,[r])):(0,B.of)(null)))}const Be=Ae("proposalCount",null),Me=Ae("proposals",[]);function Oe(e){return Se(e,(e=>()=>(0,ne.m)(e?.prime)?e.prime().pipe((0,M.U)((e=>e.unwrapOr(null)))):(0,B.of)(null)))}const Pe=qe("allianceMotion"),He=Te("allianceMotion"),De=Ce("allianceMotion"),Ve=Be("allianceMotion"),$e=Me("allianceMotion"),Le=Re("allianceMotion"),Ne=Oe("allianceMotion");var Fe=r(12372);function je(e){return e.query.voterList||e.query.voterBagsList||e.query.bagsList}function We(e,t){const r=je(t);return(0,te.X)(e,(e=>{const t=e.map((e=>(0,Fe.G)(e)));return t.length?r.listBags.multi(t).pipe((0,M.U)((e=>function(e,t){const r=e.map(((e,r)=>({bag:t[r].unwrapOr(null),id:e,key:e.toString()}))).sort(((e,t)=>t.id.cmp(e.id))),n=r.length-1;return r.map(((e,t)=>(0,_.Z)(e,{bagLower:t===n?N.nw:r[t+1].id,bagUpper:e.id,index:t})))}(t,e)))):(0,B.of)([])}))}function Xe(e,t){const r=je(t);return(0,te.X)(e,(()=>r.listBags.keys().pipe((0,C.w)((e=>t.derive.bagsList._getIds(e.map((({args:[e]})=>e))))),(0,M.U)((e=>e.filter((({bag:e})=>e)))))))}function Ke(e,t){return(0,te.X)(e,(e=>t.derive.bagsList._getIds([(0,Fe.G)(e)]).pipe((0,M.U)((e=>e[0])))))}function ze(e,t){return(0,te.X)(e,(e=>t.derive.bagsList.listNodes(e.bag).pipe((0,M.U)((t=>(0,_.Z)({nodes:t},e))))))}function Ze(e,t){return(0,te.X)(e,(e=>t.derive.bagsList.get(e).pipe((0,C.w)((e=>t.derive.bagsList.expand(e))))))}var Ge=r(17965);function Je(e,t){return(0,te.X)(e,(e=>e&&e.head.isSome?function(e,t){const r=new K.X(t),n=je(e);return r.pipe((0,C.w)((e=>n.listNodes(e))),(0,Z.b)((e=>{(0,Ge.Y)((()=>{e.isSome&&e.value.next.isSome?r.next(e.unwrap().next.unwrap()):r.complete()}))})),(0,G.q)(),(0,M.U)((e=>e.map((e=>e.unwrap())))))}(t,e.head.unwrap()):(0,B.of)([])))}var Ye=r(48801),Qe=r(52107);const et="0x76657374696e6720";function tt(e,t,r,n){const{allLocked:s,lockedBalance:i,lockedBreakdown:a,vestingLocked:o}=function(e,t,r){let n=e.registry.createType("Balance"),s=[],i=e.registry.createType("Balance"),a=!1;if(Array.isArray(r)){s=r.filter((({until:e})=>!e||t&&e.gt(t))),a=s.some((({amount:e})=>e&&e.isMax())),i=e.registry.createType("Balance",s.filter((({id:e})=>e.eq(et))).reduce(((e,{amount:t})=>e.iadd(t)),new Ye(0)));const o=s.filter((({amount:e})=>e&&!e.isMax()));o.length&&(n=e.registry.createType("Balance",(0,Qe.x)(...o.map((({amount:e})=>e)))))}return{allLocked:a,lockedBalance:n,lockedBreakdown:s,vestingLocked:i}}(e,t,n);let c=null;if(r?.frameSystemAccountInfo?.frozen){const{frameSystemAccountInfo:t,freeBalance:n,reservedBalance:i}=r,a=t.frozen.isZero()&&i.isZero(),o=e.consts.balances.existentialDeposit,u=a?new Ye(0):o,d=t.frozen.sub(i);c=e.registry.createType("Balance",s?0:(0,Qe.x)(new Ye(0),n.sub((0,Qe.x)(u,d))))}return(0,_.Z)({},r,{availableBalance:e.registry.createType("Balance",s?0:(0,Qe.x)(new Ye(0),r?.freeBalance?r.freeBalance.sub(i):new Ye(0))),lockedBalance:i,lockedBreakdown:a,transferable:c,vestingLocked:o})}function rt(e,t){return(0,z.a)([e.query.balances.locks(t),e.query.balances.vesting(t)]).pipe((0,M.U)((([t,r])=>{let n=null;if(r.isSome){const{offset:t,perBlock:s,startingBlock:i}=r.unwrap();n=e.registry.createType("VestingInfo",{locked:t,perBlock:s,startingBlock:i})}return[n?[n]:null,[t],[]]})))}const nt=e=>!!e;function st(e){return[e.map((e=>!e)),e.filter(nt)]}function it(e,t,r=["balances"]){const[n,s]=st(r.map((t=>e.derive[t]?.customLocks||e.query[t]?.locks))),[i,a]=st(r.map((t=>e.query[t]?.reserves)));return(0,z.a)([e.query.vesting?.vesting?e.query.vesting.vesting(t):(0,B.of)(e.registry.createType("Option<VestingInfo>")),s.length?(0,z.a)(s.map((e=>e(t)))):(0,B.of)([]),a.length?(0,z.a)(a.map((e=>e(t)))):(0,B.of)([])]).pipe((0,M.U)((([t,r,s])=>{let a=-1,o=-1;const c=t.unwrapOr(null);return[c?Array.isArray(c)?c:[c]:null,n.map((t=>t?e.registry.createType("Vec<BalanceLock>"):r[++a])),i.map((t=>t?e.registry.createType("Vec<PalletBalancesReserveData>"):s[++o]))]})))}function at(e,t){const r=t.registry.getModuleInstances(t.runtimeVersion.specName,"balances");return(0,te.X)(e,(e=>(0,z.a)([t.derive.balances.account(e),(0,ne.m)(t.query.system?.account)||(0,ne.m)(t.query.balances?.account)?it(t,e,r):rt(t,e)]).pipe((0,C.w)((([e,r])=>(0,z.a)([(0,B.of)(e),(0,B.of)(r),t.derive.chain.bestNumber()]))),(0,M.U)((e=>function(e,t){const[r,[n,s,i],a]=t,o=tt(e,a,r,s[0]);return(0,_.Z)(o,function(e,t,r){const n=r||[],s=!t.vestingLocked.isZero(),i=n.map((({locked:t,perBlock:r,startingBlock:n})=>e.gt(n)?(0,Qe.N)(t,r.mul(e.sub(n))):N.nw)),a=i.reduce(((e,t)=>e.iadd(t)),new Ye(0)),o=n.reduce(((e,{locked:t})=>e.iadd(t)),new Ye(0));return{isVesting:s,vestedBalance:a,vestedClaimable:s?t.vestingLocked.sub(o.sub(a)):N.nw,vesting:n.map((({locked:e,perBlock:t,startingBlock:r},n)=>({endBlock:e.div(t).iadd(r),locked:e,perBlock:t,startingBlock:r,vested:i[n]}))).filter((({locked:e})=>!e.isZero())),vestingTotal:o}}(a,o,n),{accountId:r.accountId,accountNonce:r.accountNonce,additional:s.slice(1).map(((t,n)=>tt(e,a,r.additional[n],t))),namedReserves:i})}(t,e))))))}function ot(e){return e.registry.createType("Balance")}function ct(e,[t,r,n,s],i){const a=e.registry.createType("Balance",t.toBn());return i.isFrameAccountData?{frameSystemAccountInfo:{flags:s,frozen:n},freeBalance:t,frozenFee:e.registry.createType("Balance",0),frozenMisc:e.registry.createType("Balance",0),reservedBalance:r,votingBalance:a}:{freeBalance:t,frozenFee:n,frozenMisc:s,reservedBalance:r,votingBalance:a}}function ut(e,t){return(0,z.a)([e.query.balances.freeBalance(t),e.query.balances.reservedBalance(t),e.query.system.accountNonce(t)]).pipe((0,M.U)((([t,r,n])=>[n,[[t,r,ot(e),ot(e)]],{isFrameAccountData:!1}])))}function dt(e,t){const r=t=>[t,[[ot(e),ot(e),ot(e),ot(e)]],{isFrameAccountData:!1}];return(0,ne.m)(e.query.system.account)?e.query.system.account(t).pipe((0,M.U)((({nonce:e})=>
2r(e)))):(0,ne.m)(e.query.system.accountNonce)?e.query.system.accountNonce(t).pipe((0,M.U)((e=>r(e)))):(0,B.of)(r(e.registry.createType("Index")))}function lt(e,t,r=["balances"]){const n=r.map((t=>e.derive[t]?.customAccount||e.query[t]?.account)).filter((e=>(0,ne.m)(e))),s=(e,t)=>[e,t.map((({feeFrozen:e,free:t,miscFrozen:r,reserved:n})=>[t,n,e,r])),{isFrameAccountData:!1}];return n.length?(0,ne.m)(e.query.system.account)?(0,z.a)([e.query.system.account(t),...n.map((e=>e(t)))]).pipe((0,M.U)((([{nonce:e},...t])=>s(e,t)))):(0,z.a)([e.query.system.accountNonce(t),...n.map((e=>e(t)))]).pipe((0,M.U)((([e,...t])=>s(e,t)))):dt(e,t)}function pt(e,t){return e.query.system.account(t).pipe((0,M.U)((t=>{const r=t.nonce?t.data:t[1],n=t.nonce||t[0];if(!r||r.isEmpty)return[n,[[ot(e),ot(e),ot(e),ot(e)]],{isFrameAccountData:!1}];if(t.data.frozen){const{flags:e,free:t,frozen:s,reserved:i}=r;return[n,[[t,i,s,e]],{isFrameAccountData:!0}]}{const{feeFrozen:e,free:t,miscFrozen:s,reserved:i}=r;return[n,[[t,i,e,s]],{isFrameAccountData:!1}]}})))}function ht(e,t){const r=t.registry.getModuleInstances(t.runtimeVersion.specName,"balances"),n=r&&"balances"!==r[0];return(0,te.X)(e,(e=>t.derive.accounts.accountId(e).pipe((0,C.w)((e=>e?(0,z.a)([(0,B.of)(e),n?lt(t,e,r):(0,ne.m)(t.query.system?.account)?pt(t,e):(0,ne.m)(t.query.balances?.account)?lt(t,e):(0,ne.m)(t.query.balances?.freeBalance)?ut(t,e):dt(t,e)]):(0,B.of)([t.registry.createType("AccountId"),[t.registry.createType("Index"),[[ot(t),ot(t),ot(t),ot(t)]],{isFrameAccountData:!1}]]))),(0,M.U)((e=>function(e,[t,[r,[n,...s],i]]){return(0,_.Z)({accountId:t,accountNonce:r,additional:s.map((t=>ct(e,t,i)))},ct(e,n,i))}(t,e))))))}function ft(e,t){return(0,te.X)(e,(e=>e?.length?(0,z.a)(e.map((e=>t.derive.balances.account(e)))):(0,B.of)([])))}const yt=at;function gt(e,t){const r=e.tx.bounties?e.tx.bounties:e.tx.treasury,n=[r.approveBounty,r.closeBounty,r.proposeCurator,r.unassignCurator];return t.filter((e=>n.find((t=>e.proposal&&t.is(e.proposal)))))}function mt([e,t,r,n]){const s=[];return e.forEach(((e,i)=>{e.isSome&&s.push({bounty:e.unwrap(),description:t[i].unwrapOrDefault().toUtf8(),index:r[i],proposals:n.filter((e=>e.proposal&&r[i].eq(e.proposal.args[0])))})})),s}function bt(e,t){const r=t.query.bounties||t.query.treasury;return(0,te.X)(e,(()=>r.bounties?(0,z.a)([r.bountyCount(),t.query.council?t.query.council.proposalCount():(0,B.of)(0)]).pipe((0,C.w)((()=>(0,z.a)([r.bounties.keys(),t.derive.council?t.derive.council.proposals():(0,B.of)([])]))),(0,C.w)((([e,n])=>{const s=e.map((({args:[e]})=>e));return(0,z.a)([r.bounties.multi(s),r.bountyDescriptions.multi(s),(0,B.of)(s),(0,B.of)(gt(t,n))])})),(0,M.U)(mt)):(0,B.of)(mt([[],[],[],[]]))))}var vt=r(75274),wt=r(60094),xt=r(23052),kt=r(32166);function Et(e,t){return(0,te.X)(e,(e=>t.rpc.chain.getBlockHash(e).pipe((0,C.w)((e=>t.derive.chain.getBlock(e))))))}var _t=r(69551);function St(e,t,r,n){const s=e.createClass("Header");return new class extends s{#w;constructor(e,t,r,n){super(e,t),this.#w=n||(0,_t.R)(this.digest,r||[]),this.createdAtHash=t?.createdAtHash}get author(){return this.#w}}(e,t,r,n)}var At=r(16173);function qt(e,t){return(0,te.X)(e,(e=>t.rpc.chain.getHeader(e).pipe((0,C.w)((r=>(0,At.w)(t,r,e))),(0,M.U)((([e,t,r])=>St((t||e).registry,e,t,r))))))}var Ut=r(62355);function It(e,t){return(0,te.X)(e,(()=>t.derive.chain.subscribeFinalizedHeads().pipe((0,Ut.z)((e=>t.derive.chain.getBlock(e.createdAtHash||e.hash))))))}function Tt(e,t){return(0,te.X)(e,((e,r,n=[])=>t.rpc.chain.getHeader(e).pipe((0,C.w)((e=>e.parentHash.eq(r)?(0,B.of)([e,...n]):t.derive.chain._getHeaderRange(e.parentHash,r,[e,...n]))))))}function Rt(e,t){return(0,te.X)(e,(()=>{let e=null;return t.rpc.chain.subscribeFinalizedHeads().pipe((0,Ut.z)((r=>{const n=e,s=r.parentHash;return e=r.createdAtHash=r.hash,null===n||s.eq(n)?(0,B.of)(r):t.derive.chain._getHeaderRange(s,n,[r]).pipe((0,C.w)((e=>(0,X.D)(e))))})))}))}var Ct=r(79490);function Bt(e,t){return(0,te.X)(e,(()=>t.rpc.chain.subscribeNewHeads().pipe((0,Ut.z)((e=>(0,At.w)(t,e))),(0,M.U)((([e,t,r])=>(e.createdAtHash=e.hash,St(e.registry,e,t,r)))))))}function Mt(e,t){return(0,te.X)(e,(()=>function(e){return(0,B.of)([e.consts.contracts.callBaseFee||e.registry.createType("Balance"),e.consts.contracts.contractFee||e.registry.createType("Balance"),e.consts.contracts.creationFee||e.registry.createType("Balance"),e.consts.contracts.transactionBaseFee||e.registry.createType("Balance"),e.consts.contracts.transactionByteFee||e.registry.createType("Balance"),e.consts.contracts.transferFee||e.registry.createType("Balance"),e.consts.contracts.rentByteFee||e.registry.createType("Balance"),e.consts.contracts.rentDepositOffset||e.registry.createType("Balance"),e.consts.contracts.surchargeReward||e.registry.createType("Balance"),e.consts.contracts.tombstoneDeposit||e.registry.createType("Balance")])}(t).pipe((0,M.U)((([e,t,r,n,s,i,a,o,c,u])=>({callBaseFee:e,contractFee:t,creationFee:r,rentByteFee:a,rentDepositOffset:o,surchargeReward:c,tombstoneDeposit:u,transactionBaseFee:n,transactionByteFee:s,transferFee:i}))))))}function Ot(e){return!Array.isArray(e)}function Pt(e){return e.stakeOf.entries().pipe((0,M.U)((e=>e.map((([{args:[e]},t])=>[e,t])))))}function Ht(e){return e.votesOf.entries().pipe((0,M.U)((e=>e.map((([{args:[e]},t])=>[e,t])))))}function Dt(e,t){const r=t.query.elections||t.query.phragmenElection||t.query.electionsPhragmen;return(0,te.X)(e,(()=>r?r.stakeOf?function(e,t){return(0,z.a)([Pt(t),Ht(t)]).pipe((0,M.U)((([t,r])=>{const n=[];return r.forEach((([t,r])=>{n.push([t,{stake:e.registry.createType("Balance"),votes:r}])}
2)),t.forEach((([e,t])=>{const r=n.find((([t])=>t.eq(e)));r?r[1].stake=t:n.push([e,{stake:t,votes:[]}])})),n})))}(t,r):function(e){return e.voting.entries().pipe((0,M.U)((e=>e.map((([{args:[e]},t])=>[e,Ot(t)?{stake:t.stake,votes:t.votes}:{stake:t[0],votes:t[1]}])))))}(r):(0,B.of)([])))}function Vt(e,t){return(0,te.X)(e,(e=>t.derive.council.votes().pipe((0,M.U)((r=>(r.find((([t])=>t.eq(e)))||[null,{stake:t.registry.createType("Balance"),votes:[]}])[1])))))}const $t=qe("council"),Lt=Te("council"),Nt=Ce("council"),Ft=Be("council"),jt=Me("council"),Wt=Re("council"),Xt=Oe("council");var Kt=r(51330);function zt(e,t){return(0,te.X)(e,(e=>t.query.crowdloan.funds(e).pipe((0,M.U)((e=>e.isSome?function(e){return(0,A.c)((0,Kt.e)(":child_storage:default:",(0,j.b)((0,Kt.e)("crowdloan",(e.fundIndex||e.trieIndex).toU8a()))))}(e.unwrap()):null)))))}var Zt=r(20),Gt=r(95209);function Jt(e,t){return t.filter((({event:{data:[,t],method:r,section:n}})=>"crowdloan"===n&&["Contributed","Withdrew"].includes(r)&&t.eq(e))).reduce(((e,{event:{data:[t],method:r}})=>("Contributed"===r?e.added.push(t.toHex()):e.removed.push(t.toHex()),e)),{added:[],blockHash:t.createdAtHash?.toHex()||"-",removed:[]})}const Yt=1e3;function Qt(e,t){let r=[],n=[];return e.query.system.events().pipe((0,C.w)((e=>{const s=Jt(t,e);return s.added.length||s.removed.length?(r=r.concat(...s.added),n=n.concat(...s.removed),(0,B.of)({added:r,addedDelta:s.added,blockHash:e.createdAtHash?.toHex()||"-",removed:n,removedDelta:s.removed})):Zt.E})),(0,ve.O)({added:r,addedDelta:[],blockHash:"-",removed:n,removedDelta:[]}))}function er(e,t,r){return function(e,t){return e.query.system.events().pipe((0,C.w)((e=>e.filter((({event:{data:[e],method:r,section:n}})=>"crowdloan"===n&&["AllRefunded","Dissolved","PartiallyRefunded"].includes(r)&&e.eq(t))).length?(0,B.of)(e.createdAtHash?.toHex()||"-"):Zt.E)),(0,ve.O)("-"))}(e,t).pipe((0,C.w)((()=>(0,ne.m)(e.rpc.childstate.getKeysPaged)?function(e,t){const r=new K.X(void 0);return r.pipe((0,C.w)((r=>e.rpc.childstate.getKeysPaged(t,"0x",Yt,r))),(0,Z.b)((e=>{(0,Ge.Y)((()=>{e.length===Yt?r.next(e[Yt-1].toHex()):r.complete()}))})),(0,G.q)(),(0,M.U)((e=>(0,Gt.a)(e))))}(e,r):e.rpc.childstate.getKeys(r,"0x"))),(0,M.U)((e=>e.map((e=>e.toHex())))))}function tr(e,t){return(0,te.X)(e,(e=>t.derive.crowdloan.childKey(e).pipe((0,C.w)((r=>r?function(e,t,r){return(0,z.a)([er(e,t,r),Qt(e,t)]).pipe((0,M.U)((([e,{added:t,blockHash:r,removed:n}])=>{const s={};return e.forEach((e=>{s[e]=!0})),t.forEach((e=>{s[e]=!0})),n.forEach((e=>{delete s[e]})),{blockHash:r,contributorsHex:Object.keys(s)}})))}(t,e,r):(0,B.of)({blockHash:"-",contributorsHex:[]}))))))}function rr(e,t,r){return(0,z.a)(r.map((r=>e.rpc.childstate.getStorage(t,r)))).pipe((0,M.U)((t=>t.map((t=>e.registry.createType("Option<StorageData>",t))).map((t=>t.isSome?e.registry.createType("Balance",t.unwrap()):e.registry.createType("Balance"))).reduce(((e,t,n)=>(0,_.Z)(e,{[r[n]]:t})),{}))))}function nr(e,t,r,n){return e.query.system.events().pipe((0,C.w)((s=>{const i=Jt(t,s),a=n.filter((e=>i.added.includes(e)||i.removed.includes(e)));return a.length?rr(e,r,a):Zt.E})),(0,ve.O)({}))}function sr(e,t){return(0,te.X)(e,((e,r)=>t.derive.crowdloan.childKey(e).pipe((0,C.w)((n=>n&&r.length?function(e,t,r,n){return(0,z.a)([rr(e,r,n),nr(e,t,r,n)]).pipe((0,M.U)((([e,t])=>(0,_.Z)({},e,t))))}(t,e,n,r):(0,B.of)({}))))))}var ir=r(27113),ar=r(54827),or=r(15938);const cr=(0,ar.$)("democrac");function ur(e,t){return(0,te.X)(e,(()=>(0,ne.m)(t.query.scheduler?.agenda)?function(e){return function(e){return e.derive.democracy.referendumsFinished().pipe((0,C.w)((()=>e.query.scheduler.agenda.keys())),(0,C.w)((t=>{const r=t.map((({args:[e]})=>e));return r.length?(0,z.a)([(0,B.of)(r),e.query.scheduler.agenda.multi(r).pipe((0,Ue.K)((()=>(0,B.of)(r.map((()=>[]))))))]):(0,B.of)([[],[]])})))}(e).pipe((0,C.w)((([t,r])=>{const n=[];return t.forEach(((t,s)=>{(r[s]||[]).filter((e=>e.isSome)).forEach((r=>{const s=r.unwrap();if(s.maybeId.isSome){const r=s.maybeId.unwrap().toHex();if(r.startsWith(cr)){const a=s.call instanceof ir.x?(i=s.call).isInline||i.isLegacy||i.isLookup?(0,or.hr)(s.call):s.call.isHash?s.call.asHash.toHex():s.call.asValue.args[0].toHex():s.call.args[0].toHex();n.push({at:t,imageHash:a,index:e.registry.createType("(u64, ReferendumIndex)",r)[1]})}}var i}))})),(0,z.a)([(0,B.of)(n),n.length?e.derive.democracy.preimages(n.map((({imageHash:e})=>e))):(0,B.of)([])])})),(0,M.U)((([e,t])=>e.map(((e,r)=>(0,_.Z)({image:t[r]},e))))))}(t):t.query.democracy.dispatchQueue?function(e){return e.query.democracy.dispatchQueue().pipe((0,C.w)((t=>(0,z.a)([(0,B.of)(t),e.derive.democracy.preimages(t.map((([,e])=>e)))]))),(0,M.U)((([e,t])=>e.map((([e,r,n],s)=>({at:e,image:t[s],imageHash:(0,or.hr)(r),index:n}))))))}(t):(0,B.of)([])))}const dr=[0,1,2,4,8,16,32];function lr(e,t){return(0,te.X)(e,(e=>t.query.democracy.votingOf?t.query.democracy.votingOf(e).pipe((0,C.w)((e=>e.isDirect?function(e,{votes:t}){return t.length?e.query.democracy.referendumInfoOf.multi(t.map((([e])=>e))).pipe((0,M.U)((r=>t.map(((e,t)=>[e,r[t].unwrapOr(null)])).filter((e=>!!e[1]&&(0,L.o)(e[1].end)&&e[0][1].isStandard)).map((([t,r])=>function(e,[t,r],n){const{balance:s,vote:i}=r.asStandard,[a,o]=n.isFinished?function(e,t,{approved:r,end:n}){return[n,r.isTrue&&t.isAye||r.isFalse&&t.isNay?n.add((e.consts.democracy.voteLockingPerio
2d||e.consts.democracy.enactmentPeriod).muln(dr[t.conviction.index])):N.nw]}(e,i,n.asFinished):[N.nw,N.nw];return{balance:s,isDelegated:!1,isFinished:n.isFinished,referendumEnd:a,referendumId:t,unlockAt:o,vote:i}}(e,t,r)))))):(0,B.of)([])}(t,e.asDirect):e.isDelegating?function(e,{balance:t,conviction:r,target:n}){return e.derive.democracy.locks(n).pipe((0,M.U)((n=>n.map((({isFinished:n,referendumEnd:s,referendumId:i,unlockAt:a,vote:o})=>({balance:t,isDelegated:!0,isFinished:n,referendumEnd:s,referendumId:i,unlockAt:a.isZero()?a:s.add((e.consts.democracy.voteLockingPeriod||e.consts.democracy.enactmentPeriod).muln(dr[r.index])),vote:e.registry.createType("Vote",{aye:o.isAye,conviction:r})}))))))}(t,e.asDelegating):(0,B.of)([])))):(0,B.of)([])))}function pr(e,t){return(0,te.X)(e,(()=>t.query.democracy?.nextExternal?t.query.democracy.nextExternal().pipe((0,C.w)((e=>function(e,t){if(t.isNone)return(0,B.of)(null);const[r,n]=t.unwrap();return e.derive.democracy.preimage(r).pipe((0,M.U)((e=>({image:e,imageHash:(0,or.hr)(r),threshold:n}))))}(t,e)))):(0,B.of)(null)))}function hr(e,[t,r,n,s]){let i;try{i=e.registry.createType("Call",t.toU8a(!0))}catch(e){console.error(e)}return{at:s,balance:n,proposal:i,proposer:r}}function fr(e,t){return(0,te.X)(e,(e=>e.length?(0,ne.m)(t.query.democracy.preimages)?function(e,t){const r=t.map((e=>(0,or.hr)(e)));return e.query.democracy.preimages.multi(r).pipe((0,M.U)((t=>t.map((t=>function(e,t){if(!t.isNone){if(function(e,t){return!!t&&!e.query.democracy.dispatchQueue}(e,t)){const r=t.unwrap();if(r.isMissing)return;const{data:n,deposit:s,provider:i,since:a}=r.asAvailable;return hr(e,[n,i,s,a])}return hr(e,t.unwrap())}}(e,t))))))}(t,e):(0,ne.m)(t.query.preimage.preimageFor)?function(e,t){const r=t.map((e=>(0,or.hr)(e))),n=e.registry.lookup.getTypeDef(e.query.preimage.preimageFor.creator.meta.type.asMap.key).type;return e.query.preimage.statusFor.multi(r).pipe((0,C.w)((t=>{const s=t.map((e=>e.unwrapOr(null))),i=s.map(((e,t)=>e?"H256"===n?r[t]:e.isRequested?[r[t],e.asRequested.len.unwrapOr(0)]:[r[t],e.asUnrequested.len]:null)).filter((e=>!!e));return e.query.preimage.preimageFor.multi(i).pipe((0,M.U)((t=>{let n=-1;return s.map(((e,s)=>e?[r[s],e,t[++n].unwrapOr(null)]:[r[s],null,null])).map((t=>function(e,[t,r,n]){if(!r)return;const[s,i]=r.isUnrequested?function(e){return e.ticket||e.deposit}(r.asUnrequested):function(e){return(e.maybeTicket||e.deposit).unwrapOrDefault()}(r.asRequested);let a;if(n)try{a=e.registry.createType("Call",n.toU8a(!0))}catch(e){console.error(e)}return{at:N.nw,balance:i,proposal:a,proposalHash:t,proposer:s}}(e,t)))})))})))}(t,e):(0,B.of)([]):(0,B.of)([])))}const yr=de(((e,t)=>e.derive.democracy.preimages([t])));function gr([e,t,r]){return e.filter((([,,e],t)=>!!r[t]?.isSome&&!e.isEmpty)).map((([e,n,s],i)=>{const a=r[i].unwrap();return(0,_.Z)({image:t[i],imageHash:(0,or.hr)(n),index:e,proposer:s},function(e){return(0,ne.m)(e[1].mul)}(a)?{balance:a[1],seconds:a[0]}:{balance:a[0],seconds:a[1]})}))}function mr(e,t){return(0,te.X)(e,(()=>(0,ne.m)(t.query.democracy?.publicProps)?t.query.democracy.publicProps().pipe((0,C.w)((e=>e.length?(0,z.a)([(0,B.of)(e),t.derive.democracy.preimages(e.map((([,e])=>e))),t.query.democracy.depositOf.multi(e.map((([e])=>e)))]):(0,B.of)([[],[],[]]))),(0,M.U)(gr)):(0,B.of)([])))}function br(e,t){return(0,te.X)(e,(()=>t.query.democracy?.lowestUnbaked?t.queryMulti([t.query.democracy.lowestUnbaked,t.query.democracy.referendumCount]).pipe((0,M.U)((([e,t])=>t.gt(e)?[...Array(t.sub(e).toNumber())].map(((t,r)=>e.addn(r))):[]))):(0,B.of)([])))}function vr(e,t){return(0,te.X)(e,(()=>t.derive.democracy.referendumsActive().pipe((0,C.w)((e=>e.length?(0,z.a)([(0,B.of)(e),t.derive.democracy._referendumsVotes(e)]):(0,B.of)([[],[]]))),(0,M.U)((([e,t])=>e.map(((e,r)=>(0,_.Z)({},e,t[r]))))))))}function wr(e,t){return(0,te.X)(e,(()=>t.derive.democracy.referendumIds().pipe((0,C.w)((e=>e.length?t.derive.democracy.referendumsInfo(e):(0,B.of)([]))))))}function xr(e,t){return(0,te.X)(e,(()=>t.derive.democracy.referendumIds().pipe((0,C.w)((e=>t.query.democracy.referendumInfoOf.multi(e))),(0,M.U)((e=>e.map((e=>e.unwrapOr(null))).filter((e=>!!e&&e.isFinished)).map((e=>e.asFinished)))))))}function kr(e,t){return e.query.democracy.votersFor(t).pipe((0,C.w)((r=>(0,z.a)([(0,B.of)(r),r.length?e.query.democracy.voteOf.multi(r.map((e=>[t,e]))):(0,B.of)([]),e.derive.balances.votingBalances(r)]))),(0,M.U)((([t,r,n])=>t.map(((t,s)=>({accountId:t,balance:n[s].votingBalance||e.registry.createType("Balance"),isDelegating:!1,vote:r[s]||e.registry.createType("Vote")}))))))}function Er(e,t){return e.query.democracy.votingOf.entries().pipe((0,M.U)((r=>{const n=r.map((([{args:[e]},t])=>[e,t])),s=function(e,t){return e.filter((([,e])=>e.isDirect)).map((([e,r])=>[e,r.asDirect.votes.filter((([e])=>e.eq(t)))])).filter((([,e])=>!!e.length)).reduce(((e,[t,r])=>r.reduce(((e,[,r])=>(r.isStandard&&e.push((0,_.Z)({accountId:t,isDelegating:!1},r.asStandard)),e)),e)),[])}(n,t),i=n.filter((([,e])=>e.isDelegating)).map((([e,t])=>[e,t.asDelegating]));
2return i.forEach((([t,{balance:r,conviction:n,target:a}])=>{const o=i.find((([e])=>e.eq(a))),c=s.find((({accountId:e})=>e.eq(o?o[0]:a)));c&&s.push({accountId:t,balance:r,isDelegating:!0,vote:e.registry.createType("Vote",{aye:c.vote.isAye,conviction:n})})})),s})))}function _r(e,t){return(0,te.X)(e,(e=>(0,z.a)([t.derive.democracy.sqrtElectorate(),(0,ne.m)(t.query.democracy.votingOf)?Er(t,e.index):kr(t,e.index)]).pipe((0,M.U)((([t,r])=>(0,or.pn)(t,e,r))))))}function Sr(e,t){return(0,te.X)(e,(e=>e.length?(0,z.a)(e.map((e=>t.derive.democracy._referendumVotes(e)))):(0,B.of)([])))}function Ar(e,t){return(0,te.X)(e,((e,r)=>{const n=(0,or.lR)(r);return n?t.derive.democracy.preimage(n.proposal||n.proposalHash).pipe((0,M.U)((r=>({image:r,imageHash:(0,or.Uc)(n),index:t.registry.createType("ReferendumIndex",e),status:n})))):(0,B.of)(null)}))}function qr(e,t){return(0,te.X)(e,(e=>e.length?t.query.democracy.referendumInfoOf.multi(e).pipe((0,C.w)((r=>(0,z.a)(e.map(((e,n)=>t.derive.democracy._referendumInfo(e,r[n])))))),(0,M.U)((e=>e.filter((e=>!!e))))):(0,B.of)([])))}var Ur=r(31283);function Ir(e,t){return(0,te.X)(e,(()=>t.query.balances.totalIssuance().pipe((0,M.U)(Ur.D))))}function Tr(e){return function(e){return!Array.isArray(e)}(e)?[e.who,e.stake]:e}function Rr(e){return function(e){return Array.isArray(e)}(e)?e[0]:e}function Cr([,e],[,t]){return t.cmp(e)}function Br(e,t){return(0,te.X)(e,(()=>{const[e,r]=function(e){const[t]=e.registry.getModuleInstances(e.runtimeVersion.specName,"council")||["council"],r=e.query.phragmenElection?"phragmenElection":e.query.electionsPhragmen?"electionsPhragmen":e.query.elections?"elections":null;return[e.query[t]?t:"council",r]}(t);return(r?function(e,t,r){return e.queryMulti([e.query[t].members,e.query[r].candidates,e.query[r].members,e.query[r].runnersUp])}(t,e,r):function(e,t){return(0,z.a)([e.query[t].members(),(0,B.of)([]),(0,B.of)([]),(0,B.of)([])])}(t,e)).pipe((0,M.U)((([e,n,s,i])=>(0,_.Z)({},function(e,t){return t?{candidacyBond:e.consts[t].candidacyBond,desiredRunnersUp:e.consts[t].desiredRunnersUp,desiredSeats:e.consts[t].desiredMembers,termDuration:e.consts[t].termDuration,votingBond:e.consts[t].votingBond,votingBondBase:e.consts[t].votingBondBase,votingBondFactor:e.consts[t].votingBondFactor}:{}}(t,r),{candidateCount:t.registry.createType("u32",n.length),candidates:n.map(Rr),members:s.length?s.map(Tr).sort(Cr):e.map((e=>[e,t.registry.createType("Balance")])),runnersUp:i.map(Tr).sort(Cr)}))))}))}function Mr([e,t,r,n]){return t.forEach(((t,s)=>{const i=t.toString(),a=n[s],o=!r[s].isEmpty,c=e[i];c&&c.hasMessage===o&&c.blockCount.eq(a)||(e[i]={blockCount:a,hasMessage:o,isOnline:o||a.gt(N.nw)})})),e}function Or(e,t){return(0,te.X)(e,(()=>t.query.imOnline?.receivedHeartbeats?t.derive.staking.overview().pipe((0,C.w)((({currentIndex:e,validators:r})=>(0,z.a)([(0,B.of)({}),(0,B.of)(r),t.query.imOnline.receivedHeartbeats.multi(r.map(((t,r)=>[e,r]))),t.query.imOnline.authoredBlocks.multi(r.map((t=>[e,t])))]))),(0,M.U)(Mr)):(0,B.of)({})))}const Pr=qe("membership"),Hr=Te("membership"),Dr=Ce("membership"),Vr=Be("membership"),$r=Me("membership"),Lr=Re("membership"),Nr=Oe("membership");function Fr(e,t){return!!e.isSome&&e.unwrap().some((e=>e.eq(t)))}function jr(e,t){const r=t.find((([t])=>t===e));if(r&&r[1].isSome){const[e,t]=r[1].unwrap();return(0,_.Z)({collatorId:e},t.isWithRetries?{isRetriable:!0,retries:t.asWithRetries.toNumber()}:{isRetriable:!1,retries:0})}return null}function Wr(e,t){return t.map((t=>{const r=t.find((([t])=>t===e));return r?r[1]:null}))}function Xr(e,t){return(0,te.X)(e,(e=>t.query.registrar&&t.query.parachains?t.queryMulti([t.query.registrar.active,t.query.registrar.retryQueue,t.query.registrar.selectedThreads,t.query.parachains.didUpdate,[t.query.registrar.paras,e],[t.query.registrar.pendingSwap,e],[t.query.parachains.heads,e],[t.query.parachains.relayDispatchQueue,e]]).pipe((0,M.U)((r=>function(e,[t,r,n,s,i,a,o,c]){return i.isNone?null:{active:jr(e,t),didUpdate:Fr(s,e),heads:o,id:e,info:(0,_.Z)({id:e},i.unwrap()),pendingSwapId:a.unwrapOr(null),relayDispatchQueue:c,retryCollators:Wr(e,r),selectedCollators:Wr(e,n)}}(t.registry.createType("ParaId",e),r)))):(0,B.of)(null)))}function Kr([e,t,r,n,s]){return e.map(((e,i)=>({didUpdate:Fr(t,e),id:e,info:(0,_.Z)({id:e},n[i].unwrapOr(null)),pendingSwapId:s[i].unwrapOr(null),relayDispatchQueueSize:r[i][0].toNumber()})))}function zr(e,t){return(0,te.X)(e,(()=>t.query.registrar?.parachains&&t.query.parachains?t.query.registrar.parachains().pipe((0,C.w)((e=>(0,z.a)([(0,B.of)(e),t.query.parachains.didUpdate(),t.query.parachains.relayDispatchQueueSize.multi(e),t.query.registrar.paras.multi(e),t.query.registrar.pendingSwap.multi(e)]))),(0,M.U)(Kr)):(0,B.of)([])))}function Zr([e,t,r,n,s]){return{activeEra:t,activeEraStart:r,currentEra:n,currentIndex:e,validatorCount:s}}function Gr(e,t){return(0,te.X)(e,(()=>t.query.session?t.query.staking?function(e){return e.queryMulti([e.query.session.currentIndex,e.query.staking.activeEra,e.query.staking.currentEra,e.query.staking.validatorCount]).pipe((0,M.U)((([e,t,r,n])=>{const{index:s,start:i}=t.unwrapOrDefault();return Zr([e,s,i,r.unwrapOrDefault(),n])})))}(t):function(e){return e.query.session.currentIndex().pipe((0,M.U)((t=>Zr([t,e.registry.createType("EraIndex"),e.registry.createType("Option<Moment>"),e.registry.createType("EraIndex"),e.registry.createType("u32")]))))}(t):function(e){return(0,B.of)(Zr([e.registry.createType("SessionIndex",1),e.registry.createType("EraIndex"),e.registry.createType("Option<Moment>"),e.registry.createType("EraIndex"),e.registry.createType("u32")]))}(t)))}function Jr(e,t){return(0,te.X)(e,(()=>t.derive.session.indexes().pipe((0,M.U)((e=>{const r=t.consts?.babe?.epochDuration||t.registry.createType("u64",1),n=t.consts?.staking?.sessionsPerEra||t.registry.createType("SessionIndex",1);return(0,_.Z)({eraLength:t.registry.createType("BlockNumber",n.mul(r)),isEpoch:!!t.query.babe,sessionLength:r,sessionsPerEra:n},e)})))))}function Yr(e){return(t,r)=>(0,te.X)(t,(()=>r.derive.session.progress().pipe((0,M.U)((t=>t[e])))))}function Qr(e,t){return(0,te.X)(e,(()=>t.query.babe?function(e){return e.derive.session.info().pipe((0,C.w)((t=>
2(0,z.a)([(0,B.of)(t),e.query.staking?.erasStartSessionIndex?e.queryMulti([e.query.babe.currentSlot,e.query.babe.epochIndex,e.query.babe.genesisSlot,[e.query.staking.erasStartSessionIndex,t.activeEra]]):e.queryMulti([e.query.babe.currentSlot,e.query.babe.epochIndex,e.query.babe.genesisSlot])]))),(0,M.U)((([t,[r,n,s,i]])=>[t,[r,n,s,i&&i.isSome?i.unwrap():e.registry.createType("SessionIndex",1)]])))}(t).pipe((0,M.U)((([e,r])=>function(e,t,[r,n,s,i]){const a=n.mul(t.sessionLength).iadd(s),o=r.sub(a),c=t.currentIndex.sub(i).imul(t.sessionLength).iadd(o);return(0,_.Z)({eraProgress:e.registry.createType("BlockNumber",c),sessionProgress:e.registry.createType("BlockNumber",o)},t)}(t,e,r)))):function(e){return e.derive.session.info().pipe((0,M.U)((t=>(0,_.Z)({eraProgress:e.registry.createType("BlockNumber"),sessionProgress:e.registry.createType("BlockNumber")},t))))}(t)))}const en=Yr("eraLength"),tn=Yr("eraProgress"),rn=Yr("sessionProgress");function nn(e,t){return(0,te.X)(e,(()=>t.query.society.suspendedCandidates&&t.query.society.candidates.creator.meta.type.isPlain?function(e){return e.query.society.candidates().pipe((0,C.w)((t=>(0,z.a)([(0,B.of)(t),e.query.society.suspendedCandidates.multi(t.map((({who:e})=>e)))]))),(0,M.U)((([e,t])=>e.map((({kind:e,value:r,who:n},s)=>({accountId:n,isSuspended:t[s].isSome,kind:e,value:r}))))))}(t):function(e){return e.query.society.candidates.entries().pipe((0,M.U)((e=>e.filter((([,e])=>e.isSome)).map((([{args:[e]},t])=>[e,t.unwrap()])).map((([e,{bid:t,kind:r}])=>({accountId:e,isSuspended:!1,kind:r,value:t}))))))}(t)))}function sn(e,t){return(0,te.X)(e,(()=>(0,z.a)([t.query.society.bids(),t.query.society.defender?t.query.society.defender():(0,B.of)(void 0),t.query.society.founder(),t.query.society.head(),t.query.society.maxMembers?t.query.society.maxMembers():(0,B.of)(void 0),t.query.society.pot()]).pipe((0,M.U)((([e,t,r,n,s,i])=>({bids:e,defender:t?.unwrapOr(void 0),founder:r.unwrapOr(void 0),hasDefender:t?.isSome&&n.isSome&&!n.eq(t)||!1,head:n.unwrapOr(void 0),maxMembers:s,pot:i}))))))}function an(e,t){return(0,te.X)(e,(e=>t.derive.society._members([e]).pipe((0,M.U)((([e])=>e)))))}function on(e,t){return(0,te.X)(e,(e=>t.query.society.members.creator.meta.type.isMap?function(e,t){return(0,z.a)([(0,B.of)(t),e.query.society.members.multi(t),e.query.society.payouts.multi(t),e.query.society.challengeRoundCount().pipe((0,C.w)((r=>e.query.society.defenderVotes.multi(t.map((e=>[r,e])))))),e.query.society.suspendedMembers.multi(t)]).pipe((0,M.U)((([e,t,r,n,s])=>e.map(((e,i)=>t[i].isSome?{accountId:e,isDefenderVoter:n[i].isSome,isSuspended:s[i].isSome,member:t[i].unwrap(),payouts:r[i].payouts}:null)).filter((e=>!!e)).map((({accountId:e,isDefenderVoter:t,isSuspended:r,member:n,payouts:s})=>({accountId:e,isDefenderVoter:t,isSuspended:r,payouts:s,strikes:n.strikes,vouching:n.vouching.unwrapOr(void 0)}))))))}(t,e):function(e,t){return(0,z.a)([(0,B.of)(t),e.query.society.payouts.multi(t),e.query.society.strikes.multi(t),e.query.society.defenderVotes.multi(t),e.query.society.suspendedMembers.multi(t),e.query.society.vouching.multi(t)]).pipe((0,M.U)((([e,t,r,n,s,i])=>e.map(((e,a)=>({accountId:e,isDefenderVoter:n[a].isSome,isSuspended:s[a].isTrue,payouts:t[a],strikes:r[a],vote:n[a].unwrapOr(void 0),vouching:i[a].unwrapOr(void 0)}))))))}(t,e)))}function cn(e,t){return(0,te.X)(e,(()=>t.query.society.members.creator.meta.type.isMap?t.query.society.members.keys().pipe((0,C.w)((e=>t.derive.society._members(e.map((({args:[e]})=>e)))))):t.query.society.members().pipe((0,C.w)((e=>t.derive.society._members(e))))))}const un={withDestination:!0,withLedger:!0,withNominations:!0,withPrefs:!0};function dn(e,t,r){const n=Object.entries((s=(t?.unlocking||[]).filter((({era:e})=>e.unwrap().gt(r.activeEra))),s.reduce(((e,{era:t,value:r})=>{const n=t.toString();return e[n]=(e[n]||N.nw).add(r.unwrap()),e}),{}))).map((([t,n])=>({remainingEras:new Ye(t).isub(r.activeEra),value:e.registry.createType("Balance",n)})));var s;return n.length?n:void 0}function ln(e,t,r){return e.registry.createType("Balance",(t?.unlocking||[]).reduce(((e,{era:t,value:n})=>t.unwrap().gt(r.currentEra)?e:e.iadd(n.unwrap())),new Ye(0)))}function pn(e,t){return(0,te.X)(e,((e,r=un)=>t.derive.session.info().pipe((0,C.w)((n=>(0,z.a)([t.derive.staking.keysMulti(e),t.derive.staking.queryMulti(e,r)]).pipe((0,M.U)((([e,r])=>r.map(((r,s)=>function(e,t,r,n){return(0,_.Z)({},r,n,{redeemable:ln(e,n.stakingLedger,t),unlocking:dn(e,n.stakingLedger,t)})}(t,n,e[s],r)))))))))))}const hn=de(((e,t,r)=>e.derive.staking.accounts([t],r)));function fn(e,t){return(0,te.X)(e,(()=>t.derive.session.indexes().pipe((0,C.w)((({activeEra:e})=>t.query.staking.erasRewardPoints(e))))))}var yn=r(18877);function gn(e,t){const r=e.query.staking.erasStakersOverview||e.query.staking.erasStakers;return r?r.keys(t).pipe((0,M.U)((t=>[...new Set(t.map((({args:[,e]})=>e.toString())))].map((t=>e.registry.createType("AccountId",t)))))):e.query.staking.currentElected()}function mn(e,t){return e.filter((e=>!t.some((({era:t})=>e.eq(t)))))}function bn(e){return(t,r)=>(0,te.X)(t,((t=!1)=>r.derive.staking.erasHistoric(t).pipe((0,C.w)((n=>r.derive.staking[e](n,t))))))}function vn(e){return(t,r)=>(0,te.X)(t,((t,n=!1,s)=>r.derive.staking.erasHistoric(n).pipe((0,C.w)((i=>r.derive.staking[e](t,i,n,s||0))))))}function wn(e){return(t,r)=>(0,te.X)(t,(t=>r.derive.staking[e](t,!0)))}function xn(e){return(t,r)=>(0,te.X)(t,((t,n)=>t.length?function(e,t){const r=(0,yn.Z)(e,14);let n=0;const s=new K.X(r[n]);return s.pipe((0,C.w)(t),(0,Z.b)((()=>{(0,Ge.Y)((()=>{n++,n===r.length?s.complete():s.next(r[n])}))})),(0,G.q)(),(0,M.U)(Gt.a))}(t,(t=>(0,z.a)(t.map((t=>r.derive.staking[e](t,n)))))):(0,B.of)([])))}const kn={withController:!0,withExposure:!0,withPrefs:!0};function En(e,t){return(0,te.X)(e,((e=kn,r=0)=>t.derive.session.indexes().pipe((0,C.w)((({activeEra:n,currentEra:s})=>(0,z.a)([t.query.session?t.query.session.validators():(0,B.of)([]),gn(t,s)]).pipe((0,C.w)((([i,a])=>{const o=new Set(a.map((e=>e.toString()))),c=i.filter((e=>!o.has(e.toString()))),u=a.length?a:i;return(0,z.a)([t.derive.staking.queryMulti(a,e,r,s),t.derive.staking.queryMulti(c,e,r,n)]).pipe((0,M.U)((([e,t])=>({info:(0,Gt.a)([e,t]),nextElected:u,validators:i}))))}))))))))}var _n=r(36733);function Sn(e,t,r){const n=`${e}-${t.toString()}`;return[n,r?void 0:_n.G.get(n)]}function An(e,t,r){return r?[]:t.map((t=>_n.G.get(`${e}-${t.toString()}`))).filter((e=>!!e))}function qn(e,t,r){return!t&&_n.G.set(e,r),r}function Un(e,t,r){return!t&&r.forEach((t=>_n.G.set(`${e}-${t.era.toString()}`,t))),r}function In(e,t,r){return e.map((e=>t.find((({era:t})=>e.eq(t)))||r.find((({era:t})=>e.eq(t))))).filter((e=>!!e))}const Tn="eraExposure";function Rn(e,t){return(0,te.X)(e,((e,r=!1)=>{const[n,s]=Sn(Tn,e,r);return s?(0,B.of)(s):t.query.staking.erasStakersPaged?t.query.staking.erasStakersPaged.entries(e).pipe((0,M.U)((t=>qn(n,r,function(e,t){const r={},n={};return t.forEach((([e,t])=>
2{if(t.isSome){const s=e.args[1].toString(),i=t.unwrap();n[s]=i,i.others.forEach((({who:e},t)=>{const n=e.toString();r[n]=r[n]||[],r[n].push({validatorId:s,validatorIndex:t})}))}})),{era:e,nominators:r,validators:n}}(e,t))))):t.query.staking.erasStakersClipped.entries(e).pipe((0,M.U)((t=>qn(n,r,function(e,t){const r={},n={};return t.forEach((([e,t])=>{const s=e.args[1].toString();n[s]=t,t.others.forEach((({who:e},t)=>{const n=e.toString();r[n]=r[n]||[],r[n].push({validatorId:s,validatorIndex:t})}))})),{era:e,nominators:r,validators:n}}(e,t)))))}))}const Cn=wn("_eraExposure"),Bn=xn("_eraExposure"),Mn=bn("_erasExposure");function On(e,t){return(0,te.X)(e,(e=>(0,z.a)([t.query.staking.activeEra(),t.consts.staking.historyDepth?(0,B.of)(t.consts.staking.historyDepth):t.query.staking.historyDepth()]).pipe((0,M.U)((([r,n])=>{const s=[],i=n.toNumber(),a=r.unwrapOrDefault().index;let o=a;for(;o.gte(N.nw)&&s.length<i;)o===a&&!0!==e||s.push(t.registry.createType("EraIndex",o)),o=o.sub(N.If);return s.reverse()})))))}const Pn="eraPoints";function Hn({individual:e}){return[...e.entries()].filter((([,e])=>e.gt(N.nw))).reduce(((e,[t,r])=>(e[t.toString()]=r,e)),{})}function Dn(e,t){return(0,te.X)(e,((e,r)=>{if(!e.length)return(0,B.of)([]);const n=An(Pn,e,r),s=mn(e,n);return s.length?t.query.staking.erasRewardPoints.multi(s).pipe((0,M.U)((t=>In(e,n,Un(Pn,r,function(e,t){return e.map(((e,r)=>({era:e,eraPoints:t[r].total,validators:Hn(t[r])})))}(s,t)))))):(0,B.of)(n)}))}const Vn=bn("_erasPoints"),$n="eraPrefs";function Ln(e,t){return(0,te.X)(e,((e,r)=>{const[n,s]=Sn($n,e,r);return s?(0,B.of)(s):t.query.staking.erasValidatorPrefs.entries(e).pipe((0,M.U)((t=>qn(n,r,function(e,t){const r={};return t.forEach((([e,t])=>{r[e.args[1].toString()]=t})),{era:e,validators:r}}(e,t)))))}))}const Nn=wn("_eraPrefs"),Fn=xn("_eraPrefs"),jn=bn("_erasPrefs"),Wn="eraRewards";function Xn(e,t){return(0,te.X)(e,((e,r)=>{if(!e.length)return(0,B.of)([]);const n=An(Wn,e,r),s=mn(e,n);return s.length?t.query.staking.erasValidatorReward.multi(s).pipe((0,M.U)((t=>In(e,n,Un(Wn,r,function(e,t){return e.map(((e,r)=>({era:e,eraReward:t[r].unwrapOrDefault()})))}(s,t)))))):(0,B.of)(n)}))}const Kn=bn("_erasRewards"),zn="eraSlashes";function Zn(e,t){return(0,te.X)(e,((e,r)=>{const[n,s]=Sn(zn,e,r);return s?(0,B.of)(s):(0,z.a)([t.query.staking.nominatorSlashInEra.entries(e),t.query.staking.validatorSlashInEra.entries(e)]).pipe((0,M.U)((([t,s])=>qn(n,r,function(e,t,r){const n={},s={};return t.forEach((([e,t])=>{n[e.args[1].toString()]=t.unwrap()})),r.forEach((([e,t])=>{s[e.args[1].toString()]=t.unwrapOrDefault()[1]})),{era:e,nominators:n,validators:s}}(e,t,s)))))}))}const Gn=wn("_eraSlashes"),Jn=xn("_eraSlashes"),Yn=bn("_erasSlashes"),Qn=de(((e,t)=>e.derive.staking.keysMulti([t])));function es(e,t){return(0,te.X)(e,(e=>e.length?t.query.session.queuedKeys().pipe((0,C.w)((r=>(0,z.a)([(0,B.of)(r),t.consts.session?.dedupKeyPrefix?t.query.session.nextKeys.multi(e.map((e=>[t.consts.session.dedupKeyPrefix,e]))):(0,z.a)(e.map((e=>t.query.session.nextKeys(e))))]))),(0,M.U)((([t,r])=>e.map(((e,n)=>function(e,t,r){const n=(t.find((([t])=>t.eq(e)))||[void 0,[]])[1],s=r.unwrapOr([]);return{nextSessionIds:Array.isArray(s)?s:[...s.values()],sessionIds:Array.isArray(n)?n:[...n.values()]}}(e,t,r[n])))))):(0,B.of)([])))}function ts(e,t){return(0,te.X)(e,(()=>(0,z.a)([t.derive.session.indexes(),t.derive.staking.validators()]).pipe((0,M.U)((([e,{nextElected:t,validators:r}])=>(0,_.Z)({},e,{nextElected:t,validators:r}))))))}function rs(e,t){return(0,te.X)(e,((e,r,n,s)=>{const i=t.registry.createType("Exposure"),a=t.registry.createType("Option<Null>"),o=t.registry.createType("Option<Null>");return r.length?(0,z.a)([t.query.staking.erasStakersClipped?(0,z.a)(r.map((r=>t.query.staking.erasStakersClipped(r,e)))):(0,B.of)(r.map((e=>i))),t.query.staking.erasStakers?(0,z.a)(r.map((r=>t.query.staking.erasStakers(r,e)))):(0,B.of)(r.map((e=>i))),t.query.staking.erasStakersPaged?(0,z.a)(r.map((r=>t.query.staking.erasStakersPaged(r,e,s)))):(0,B.of)(r.map((e=>a))),t.query.staking.erasStakersOverview?(0,z.a)(r.map((r=>t.query.staking.erasStakersOverview(r,e)))):(0,B.of)(r.map((e=>o)))]).pipe((0,M.U)((([e,t,n,s])=>r.map(((r,i)=>({clipped:e[i],era:r,exposure:t[i],exposureMeta:s[i],exposurePaged:n[i]})))))):(0,B.of)([])}))}const ns=de(((e,t,r,n)=>e.derive.staking._ownExposures(t,[r],!0,n||0))),ss=vn("_ownExposures");function is(e,t){return(0,te.X)(e,((e,r,n)=>r.length?(0,z.a)([(0,z.a)(r.map((r=>t.query.staking.validatorSlashInEra(r,e)))),(0,z.a)(r.map((r=>t.query.staking.nominatorSlashInEra(r,e))))]).pipe((0,M.U)((([e,t])=>r.map(((r,n)=>({era:r,total:e[n].isSome?e[n].unwrap()[1]:t[n].unwrapOrDefault()})))))):(0,B.of)([])))}const as=de(((e,t,r)=>e.derive.staking._ownSlashes(t,[r],!0))),os=vn("_ownSlashes");function cs(e,t){return e.registry.createType("Vec<u32>",t.filter((e=>-1!==e)))}function us(e,t,r,n,s,i){return function(e,t,r,n,{withClaimedRewardsEras:s,withController:i,withDestination:a,withExposure:o,withExposureErasStakersLegacy:c,withExposureMeta:u,withLedger:d,withNominations:l,withPrefs:p},h){const f=e.registry.createType("Option<Nominations>"),y=e.registry.createType("RewardDestination"),g=e.registry.createType("Exposure"),m=e.registry.createType("ValidatorPrefs"),b=e.registry.createType("Option<Null>"),v=e.registry.createType("Option<Null>"),w=[-1],x=Number(e.consts.staking.historyDepth.toNumber()),k=new Array(x).fill(0).map(((e,t)=>0===t?r.toNumber()-1:r.toNumber()-t-1));return(0,z.a)([i||d?(0,z.a)(t.map((t=>e.query.staking.bonded(t)))):(0,B.of)(t.map((()=>null))),l?(0,z.a)(t.map((t=>e.query.staking.nominators(t)))):(0,B.of)(t.map((()=>f))),a?(0,z.a)(t.map((t=>e.query.staking.payee(t)))):(0,B.of)(t.map((()=>y))),p?(0,z.a)(t.map((t=>e.query.staking.validators(t)))):(0,B.of)(t.map((()=>m))),o&&e.query.staking.erasStakersPaged?(0,z.a)(t.map((t=>e.query.staking.erasStakersPaged(n,t,h)))):(0,B.of)(t.map((()=>b))),u&&e.query.staking.erasStakersOverview?(0,z.a)(t.map((t=>e.query.staking.erasStakersOverview(n,t)))):(0,B.of)(t.map((()=>v))),s&&e.query.staking.claimedRewards?(0,z.a)([e.query.staking.claimedRewards.entries(),e.query.staking.erasStakersOverview.entries()]).pipe((0,M.U)((([e,r])=>function(e,t,r,n){const s={},i={},a=e.map((e=>e.toString()));return r.forEach((([e,t])=>{const r=e.args[1].toString(),n=e.args[0].toNumber();a.includes(r)&&(s[r]||(s[r]=new Map),s[r].set(n,t.toArray()))}
2)),n.forEach((([e,t])=>{const r=e.args[1].toString(),n=e.args[0].toNumber();a.includes(r)&&t.isSome&&(i[r]||(i[r]=new Map),i[r].set(n,t.unwrap().pageCount))})),e.map((e=>{const r=s[e.toString()],n=i[e.toString()];return t.map((e=>{if(r&&r.has(e)&&n&&n.has(e)){const t=r.get(e),s=n.get(e);return t.length===s.toNumber()?e:-1}return-1}))}))}(t,k,e,r)))):(0,B.of)(t.map((()=>w))),c&&e.query.staking.erasStakers?(0,z.a)(t.map((t=>e.query.staking.erasStakers(n,t)))):(0,B.of)(t.map((()=>g)))])}(e,n,t,r,s,i).pipe((0,C.w)((([t,i,a,o,c,u,d,l])=>function(e,t,{withLedger:r=!1}){const n=t.filter((e=>r&&!!e&&e.isSome)).map((e=>e.unwrap())),s=e.registry.createType("Option<StakingLedger>");return(n.length?(0,z.a)(n.map((t=>e.query.staking.ledger(t)))):(0,B.of)([])).pipe((0,M.U)((e=>{let r=-1;return t.map((t=>t&&t.isSome&&e[++r]||s))})))}(e,t,s).pipe((0,M.U)((s=>n.map(((n,p)=>function(e,t,r,n,s,i,a,o,c,u,d,l){return{accountId:t,claimedRewardsEras:cs(e,u),controllerId:r?.unwrapOr(null)||null,era:l,exposureEraStakers:d,exposureMeta:c,exposurePaged:a,nominators:n.isSome?n.unwrap().targets:[],rewardDestination:(p=s,"boolean"==typeof p.isSome?p.unwrapOr(null):p),stakingLedger:o.unwrapOrDefault(),stashId:t,validatorPrefs:i};var p}(e,n,t[p],i[p],a[p],o[p],c[p],s[p],u[p],d[p],l[p],r)))))))))}const ds=de(((e,t,r,n,s)=>e.derive.staking.queryMulti([t],r,n,s)));function ls(e,t){return(0,te.X)(e,((e,r,n,s)=>t.derive.session.indexes().pipe((0,C.w)((({activeEra:i})=>{const a=e.map((e=>t.registry.createType("AccountId",e))),o=n||0;return a.length?us(t,i,s||i,a,r,o):(0,B.of)([])})))))}function ps(e,t){return(0,te.X)(e,((e,r,n=!1)=>{const s=e.map((e=>t.registry.createType("AccountId",e).toString()));return t.derive.staking._erasExposure(r,n).pipe((0,M.U)((e=>s.map((t=>e.map((({era:e,nominators:r,validators:n})=>{const s=!!n[t],i={},a=r[t]||[];return s?i[t]=n[t]:a&&a.forEach((({validatorId:e})=>{i[e]=n[e]})),{era:e,isEmpty:!Object.keys(i).length,isValidator:s,nominating:a,validators:i}})))))))}))}function hs(e,t){return(0,te.X)(e,((e,r=!1)=>t.derive.staking.erasHistoric(r).pipe((0,C.w)((n=>t.derive.staking._stakerExposures(e,n,r))))))}const fs=de(((e,t,r)=>e.derive.staking.stakerExposures([t],r)));function ys(e,t){return(0,te.X)(e,((e,r,n)=>{const s=t.registry.createType("AccountId",e).toString();return t.derive.staking._erasPoints(r,n).pipe((0,M.U)((e=>e.map((({era:e,eraPoints:r,validators:n})=>({era:e,eraPoints:r,points:n[s]||t.registry.createType("RewardPoint")}))))))}))}const gs=vn("_stakerPoints");function ms(e,t){return(0,te.X)(e,((e,r,n)=>t.query.staking.erasValidatorPrefs.multi(r.map((t=>[t,e]))).pipe((0,M.U)((e=>e.map(((e,t)=>({era:r[t],validatorPrefs:e}))))))))}const bs=vn("_stakerPrefs");function vs(e){return e?(e.legacyClaimedRewards||e.claimedRewards)?.toArray():[]}function ws(e,t){return(0,te.X)(e,((e,r=!1)=>(0,z.a)([t.derive.staking._erasPoints(e,r),t.derive.staking._erasPrefs(e,r),t.derive.staking._erasRewards(e,r)])))}function xs(e,t){return(0,te.X)(e,((e,r,n=!1)=>{const s=r.map((e=>"number"==typeof e||"string"==typeof e?t.registry.createType("u32",e):e));return(0,z.a)([t.derive.staking.queryMulti(e,{withClaimedRewardsEras:!0,withLedger:!0}),t.derive.staking._stakerExposures(e,s,n),t.derive.staking._stakerRewardsEras(s,n)]).pipe((0,C.w)((([e,s,i])=>{const a=e.map((({claimedRewardsEras:e,stakingLedger:r,stashId:n},a)=>n&&(r||e)?function(e,t,[r,n,s],i,a){return i.map((({era:i,isEmpty:o,isValidator:c,nominating:u,validators:d})=>{const{eraPoints:l,validators:p}=r.find((e=>e.era.eq(i)))||{eraPoints:N.nw,validators:{}},{eraReward:h}=s.find((e=>e.era.eq(i)))||{eraReward:e.registry.createType("Balance")},{validators:f}=n.find((e=>e.era.eq(i)))||{validators:{}},y={},g=t.toString();return Object.entries(d).forEach((([t,r])=>{const n=p[t]||N.nw,s=f[t]?.commission.unwrap()||N.nw,i=r.total?r.total?.unwrap():r.pageTotal?r.pageTotal?.unwrap():N.nw;let a,o=N.nw;if(!(i.isZero()||n.isZero()||l.isZero())){o=h.mul(n).div(l);const e=s.mul(o).div(N.ed);let c;if(t===g)if(r.own)c=r.own.unwrap();else{const e=r.others.find((({who:e})=>e.eq(t)));c=e?e.value.unwrap():N.nw}else{const e=r.others.find((({who:e})=>e.eq(g)));c=e?e.value.unwrap():N.nw}a=o.sub(e).imul(c).div(i).iadd(t===g?e:N.nw)}y[t]={total:e.registry.createType("Balance",o),value:e.registry.createType("Balance",a)}})),{era:i,eraReward:h,isClaimed:a.some((e=>e.eq(i))),isEmpty:o,isValidator:c,nominating:u,validators:y}}))}(t,n,i,s[a],e):[]));if(n)return(0,B.of)(a);const[o,c]=a.reduce((([e,t],r)=>{const n=[];return t.push(n),r.forEach((({validators:t})=>Object.keys(t).forEach((t=>{n.includes(t)||(n.push(t),e.includes(t)||e.push(t))})))),[e,t]}),[[],[]]);return t.derive.staking.queryMulti(o,{withClaimedRewardsEras:!0,withLedger:!0}).pipe((0,M.U)((t=>e.map((({claimedRewardsEras:e,stakingLedger:n},s)=>function(e,t,{claimedRewardsEras:r,rewards:n,stakingLedger:s}){const i=e.filter((e=>!function(e,t){return(e.toArray()||[]).concat(vs(t))}(r,s).some((t=>t?.eq(e))))),a=t.map((([e])=>e)),o=t.map((([,e])=>e));return n.filter((({isEmpty:e})=>!e)).filter((e=>!!i.some((t=>e.era.eq(t)))&&(function(e,t,r){const n=[];
2Object.keys(r.validators).forEach((s=>{const i=e.indexOf(s);if(-1!==i){const e=t[i];(e.claimedRewardsEras?.toArray().some((e=>r.era?.eq(e)))||vs(e.stakingLedger).some((e=>r.era?.eq(e))))&&n.push(s)}})),n.forEach((e=>{delete r.validators[e]}))}(a,o,e),!0))).filter((({validators:e})=>0!==Object.keys(e).length)).map((e=>(0,_.Z)({},e,{isClaimed:!1,nominators:e.nominating.filter((t=>e.validators[t.validatorId]))})))}(r,c[s].map((e=>[e,t.find((t=>t.accountId.eq(e)))])).filter((e=>!!e[1])),{claimedRewardsEras:e,rewards:a[s],stakingLedger:n}))))))})))}))}const ks=de(((e,t,r)=>e.derive.staking.erasHistoric(r).pipe((0,C.w)((n=>e.derive.staking._stakerRewards([t],n,r))))));function Es(e,t){return(0,te.X)(e,((e,r)=>e.length&&r.length?t.derive.staking._stakerRewards(e,r,!1):(0,B.of)([])))}function _s(e,t){return(0,te.X)(e,((e,r=!1)=>t.derive.staking.erasHistoric(r).pipe((0,C.w)((r=>t.derive.staking.stakerRewardsMultiEras(e,r))))))}function Ss(e,t){return(0,te.X)(e,((e,r,n)=>{const s=t.registry.createType("AccountId",e).toString();return t.derive.staking._erasSlashes(r,n).pipe((0,M.U)((e=>e.map((({era:e,nominators:r,validators:n})=>({era:e,total:r[s]||n[s]||t.registry.createType("Balance")}))))))}))}const As=vn("_stakerSlashes");var qs=r(92870);function Us(e,t){return(0,te.X)(e,(()=>function(e){let t=Date.now();return e.query.system.events().pipe((0,M.U)((e=>(t=e.filter((({event:e,phase:t})=>{try{return t.isApplyExtrinsic&&"staking"===e.section&&"Bonded"===e.method}catch{return!1}}))?Date.now():t,t))),(0,ve.O)(t),(0,qs.h)({skipTimeout:!0}))}(t).pipe((0,C.w)((()=>t.query.staking.validators.keys())),(0,M.U)((e=>e.map((({args:[e]})=>e)).filter((e=>e)))))))}function Is(e,t){return(0,te.X)(e,(()=>(0,ne.m)(t.query.staking.erasStakersOverview)||(0,ne.m)(t.query.staking.erasStakers)?t.derive.session.indexes().pipe((0,C.w)((({currentEra:e})=>gn(t,e)))):t.query.staking.currentElected()))}function Ts(e,t){return(0,te.X)(e,(()=>(0,z.a)([t.query.session?t.query.session.validators():(0,B.of)([]),t.query.staking?t.derive.staking.nextElected():(0,B.of)([])]).pipe((0,M.U)((([e,t])=>({nextElected:t.length?t:e,validators:e}))))))}const Rs={withController:!0,withPrefs:!0};function Cs(e,t){return(0,te.X)(e,((e=Rs)=>(0,z.a)([t.derive.staking.validators(),t.derive.staking.stashes()]).pipe((0,C.w)((([{nextElected:r},n])=>{const s=r.map((e=>e.toString())),i=n.filter((e=>!s.includes(e.toString())));return t.derive.staking.queryMulti(i,e).pipe((0,M.U)((e=>({info:e,waiting:i}))))})))))}const Bs=qe("technicalCommittee"),Ms=Te("technicalCommittee"),Os=Ce("technicalCommittee"),Ps=Be("technicalCommittee"),Hs=Me("technicalCommittee"),Ds=Re("technicalCommittee"),Vs=Oe("technicalCommittee");function $s(e,t){return(0,te.X)(e,(()=>t.query.treasury?(0,z.a)([t.query.treasury.proposalCount(),t.query.treasury.approvals()]).pipe((0,C.w)((([e,r])=>function(e,t,r){const n=[],s=t.toNumber();for(let t=0;t<s;t++)r.some((e=>e.eqn(t)))||n.push(e.registry.createType("ProposalIndex",t));const i=[...n,...r];return(0,z.a)([e.query.treasury.proposals.multi(i),e.derive.council?e.derive.council.proposals():(0,B.of)([])]).pipe((0,M.U)((([n,s])=>function(e,{allIds:t,allProposals:r,approvalIds:n,councilProposals:s,proposalCount:i}){const a=[],o=[],c=s.filter((({proposal:t})=>t&&(e.tx.treasury.approveProposal&&e.tx.treasury.approveProposal.is(t)||e.tx.treasury.rejectProposal&&e.tx.treasury.rejectProposal.is(t))));return t.forEach(((e,t)=>{if(r[t].isSome){const s=c.filter((({proposal:t})=>t&&e.eq(t.args[0]))).sort(((e,t)=>e.proposal&&t.proposal?e.proposal.method.localeCompare(t.proposal.method):e.proposal?-1:1)),i=n.some((t=>t.eq(e))),u={council:s,id:e,proposal:r[t].unwrap()};i?a.push(u):o.push(u)}})),{approvals:a,proposalCount:i,proposals:o}}(e,{allIds:i,allProposals:n,approvalIds:r,councilProposals:s,proposalCount:t}))))}(t,e,r)))):(0,B.of)({approvals:[],proposalCount:t.registry.createType("ProposalIndex"),proposals:[]})))}function Ls(e,t){return(0,te.X)(e,(e=>(0,z.a)([t.rpc.chain.getBlock(e),t.queryAt(e).pipe((0,C.w)((e=>e.system.events())))]).pipe((0,M.U)((([e,t])=>({block:e,events:t}))))))}function Ns(e,t){return(0,te.X)(e,((e,r)=>t.derive.tx.events(e).pipe((0,M.U)((({block:e,events:t})=>{const n=e.block.extrinsics.findIndex((e=>e.hash.toString()===r));if(-1===n)return null;const s=t.filter((({phase:e})=>e.isApplyExtrinsic&&e.asApplyExtrinsic.eq(n)));return{blockHash:e.hash.toHex(),blockNumber:e.block.header.number.toNumber(),events:s,extrinsic:e.block.extrinsics[n],success:-1!==s.findIndex((e=>"ExtrinsicSuccess"===e.event.method))}})))))}function Fs(e,t){return(0,te.X)(e,((e,r)=>t.derive.tx.events(e).pipe((0,M.U)((({block:e,events:t})=>{const n=[];return{blockHash:e.hash.toHex(),blockNumber:e.block.header.number.toNumber(),extrinsics:e.block.extrinsics.filter(((e,t)=>e.signer.toString()===r&&(n.push(t),!0))).map(((e,r)=>{const s=t.filter((({phase:e})=>e.isApplyExtrinsic&&e.asApplyExtrinsic.eq(n[r])));return{events:s,extrinsic:e,success:-1!==s.findIndex((e=>"ExtrinsicSuccess"===e.event.method))}}))}})))))}var js=r(65968),Ws=r(44604);const Xs=250,Ks=new Ye(6e3),zs=new Ye(5),Zs=new Ye(3e5);function Gs(e,t){return e.derive.balances.account(t).pipe((0,M.U)((({accountNonce:e})=>e)))}function Js(e,t){return e.call.accountNonceApi?e.call.accountNonceApi.accountNonce(t):e.rpc.system?.accountNextIndex?e.rpc.system.accountNextIndex(t):Gs(e,t)}function Ys(e){return(0,z.a)([e.rpc.chain.getHeader().pipe((0,C.w)((t=>t.parentHash.isEmpty?(0,B.of)(t):e.rpc.chain.getHeader(t.parentHash).pipe((0,Ue.K)((()=>(0,B.of)(t))))))),e.rpc.chain.getFinalizedHead().pipe((0,C.w)((t=>e.rpc.chain.getHeader(t).pipe((0,Ue.K)((()=>(0,B.of)(null)))))))]).pipe((0,M.U)((([e,t])=>!t||(0,Ws.E)(e).sub((0,Ws.E)(t)).gt(zs)?e:t)))}function Qs(e){const t=e.consts.babe?.expectedBlockTime||e.consts.aura?.slotDuration||e.consts.timestamp?.minimumPerio
2d.muln(2);return t&&t.isZero&&!t.isZero()?t:void 0}function ei(e,t){return(e,r,n)=>(0,z.a)([(0,L.o)(r)?Gs(t,e):-1===r?Js(t,e):(0,B.of)(t.registry.createType("Index",r)),(0,L.o)(n)||(0,js.h)(n)&&n>0?Ys(t):(0,B.of)(null)]).pipe((0,M.U)((([e,r])=>({header:r,mortalLength:Math.min(t.consts.system?.blockHashCount?.toNumber()||Xs,Zs.div(Qs(t)||Ks).iadd(zs).toNumber()),nonce:e}))))}const ti={accounts:n,alliance:s,bagsList:i,balances:a,bounties:o,chain:c,contracts:u,council:d,crowdloan:l,democracy:p,elections:h,imOnline:f,membership:y,parachains:g,session:m,society:b,staking:v,technicalCommittee:w,treasury:x,tx:k},ri={allianceMotion:{instances:["allianceMotion"],methods:[]},bagsList:{instances:["voterBagsList","voterList","bagsList"],methods:[],withDetect:!0},contracts:{instances:["contracts"],methods:[]},council:{instances:["council"],methods:[],withDetect:!0},crowdloan:{instances:["crowdloan"],methods:[]},democracy:{instances:["democracy"],methods:[]},elections:{instances:["phragmenElection","electionsPhragmen","elections","council"],methods:[],withDetect:!0},imOnline:{instances:["imOnline"],methods:[]},membership:{instances:["membership"],methods:[]},parachains:{instances:["parachains","registrar"],methods:[]},session:{instances:["session"],methods:[]},society:{instances:["society"],methods:[]},staking:{instances:["staking"],methods:["erasRewardPoints"]},technicalCommittee:{instances:["technicalCommittee"],methods:[],withDetect:!0},treasury:{instances:["treasury"],methods:[]}};function ni(e,t,r){const n={},s=Object.keys(r),i=Object.keys(t.query),a=t.runtimeVersion.specName,o=e=>i.includes(e),c=e=>function(e,t,r){return e.registry.getModuleInstances(t,r)||[]}(t,a,e).some(o),u=e=>Object.keys(r[e]),d=(n,s)=>r[n][s](e,t),l=e=>{return!ri[e]||ri[e].instances.some(o)&&(!ri[e].methods.length||ri[e].methods.every((r=ri[e].instances,e=>r.some((r=>i.includes(r)&&t.query[r][e])))))||ri[e].withDetect&&ri[e].instances.some(c);var r};for(let e=0,t=s.length;e<t;e++){const t=s[e];l(t)&&Y(n,t,u,d)}return n}var si=r(6369),ii=r(42582),ai=r(32085),oi=r(47326),ci=r(21652),ui=r(30242),di=r(69543),li=r(84789),pi=r(10119),hi=r(6485);function fi(e){return(0,ne.m)(e.sign)}var yi=r(57826);const gi=(0,V.k)("api/util");function mi(e,{block:{extrinsics:t,header:r}},n,s){for(const[s,i]of t.entries())if(i.hash.eq(e))return{blockNumber:(0,yi.f)(r.number)?r.number.unwrap():r.number,events:n.filter((({phase:e})=>e.isApplyExtrinsic&&e.asApplyExtrinsic.eqn(s))),txIndex:s};if(s.isInBlock){const n=t.map((e=>e.hash.toHex()));gi.warn(`block ${r.hash.toHex()}: Unable to find extrinsic ${e.toHex()} inside ${n.join(", ")}`)}return{}}var bi=r(89492);function vi(e,t,r,{header:n,mortalLength:s,nonce:i}){if(!n){if(r.era&&!r.blockHash)throw new Error("Expected blockHash to be passed alongside non-immortal era options");return(0,js.h)(r.era)&&(delete r.era,delete r.blockHash),xi(e,r,{nonce:i})}return xi(e,r,{blockHash:n.hash,era:t.createTypeUnsafe("ExtrinsicEra",[{current:n.number,period:r.era||s}]),nonce:i})}function wi(e,t){let r={};return(0,ne.m)(e)?t=e:r=(0,_.Z)({},e),[r,t]}function xi(e,t,r){return(0,_.Z)({blockHash:e.genesisHash,genesisHash:e.genesisHash},t,r,{runtimeVersion:e.runtimeVersion,signedExtensions:e.registry.signedExtensions,version:e.extrinsicType})}function ki(e,t,r,n,s){const i=function({api:e,apiType:t,blockHash:r,decorateMethod:n}){const s=e.registry.createClass("Extrinsic"),i=new WeakMap;class a extends s{#E;#_=E.y;constructor(r,n){super(r,n,{version:e.extrinsicType}),this.#E="rxjs"===t}get hasDryRun(){return(0,ne.m)(e.rpc.system?.dryRun)}get hasPaymentInfo(){return(0,ne.m)(e.call.transactionPaymentApi?.queryInfo)}dryRun(t,s){if(!this.hasDryRun)throw new Error("The system.dryRun RPC call is not available in your environment");return r||(0,S.H)(s)||(0,Q.U)(s)?n((()=>e.rpc.system.dryRun(this.toHex(),r||s))):n((()=>this.#S(t,s).pipe((0,C.w)((()=>e.rpc.system.dryRun(this.toHex()))))))()}paymentInfo(t,s){if(!this.hasPaymentInfo)throw new Error("The transactionPaymentApi.queryInfo runtime call is not available in your environment");if(r||(0,S.H)(s)||(0,Q.U)(s))return n((()=>e.callAt(r||s).pipe((0,C.w)((e=>{const t=this.toU8a();return e.transactionPaymentApi.queryInfo(t,t.length)})))));const[i]=wi(s),a=fi(t)?t.address:t.toString();return n((()=>e.derive.tx.signingInfo(a,i.nonce,i.era).pipe((0,pi.P)(),(0,C.w)((t=>{const r=vi(e,this.registry,i,t),n=xi(e,r,{}),s=e.tx(this.toU8a()).signFake(a,n).toU8a();return e.call.transactionPaymentApi.queryInfo(s,s.length)})))))()}send(t){const r=e.hasSubscriptions&&(this.#E||!!t),s=i.get(this);return i.delete(this),n(r?()=>this.#A(s):()=>this.#q(s))(t)}signAsync(t,r){return n((()=>
2this.#S(t,r).pipe((0,M.U)((t=>{if(t.signedTransaction){const r=new a(e.registry,t.signedTransaction);return i.set(this,t),r}return this})))))()}signAndSend(t,r,s){const[i,a]=wi(r,s),o=e.hasSubscriptions&&(this.#E||!!a);return n((()=>this.#S(t,i).pipe((0,C.w)((e=>o?this.#A(e):this.#q(e))))))(a)}withResultTransform(e){return this.#_=e,this}#S=(t,r)=>{const n=fi(t)?t.address:t.toString(),s=function(e={}){return(0,hi.H)(e)||(0,js.h)(e)?{nonce:e}:e}(r);return e.derive.tx.signingInfo(n,s.nonce,s.era).pipe((0,pi.P)(),(0,Ut.z)((async r=>{const i=vi(e,this.registry,s,r);let a=-1,o=null;if(fi(t))this.sign(t,i);else{const e=await this.#U(n,i,r.header);a=e.id,e.signedTransaction&&(o=e.signedTransaction)}return{options:i,signedTransaction:o,updateId:a}})))};#I=(t,r)=>{if(!r.isFinalized&&!r.isInBlock)return(0,B.of)(this.#_(new bi.h({status:r,txHash:t})));const n=r.isInBlock?r.asInBlock:r.asFinalized;return e.derive.tx.events(n).pipe((0,M.U)((({block:e,events:n})=>this.#_(new bi.h({...mi(t,e,n,r),status:r,txHash:t})))),(0,Ue.K)((e=>(0,B.of)(this.#_(new bi.h({internalError:e,status:r,txHash:t}))))))};#q=t=>e.rpc.author.submitExtrinsic(t?.signedTransaction||this).pipe((0,Z.b)((e=>{this.#T(e,t)})));#A=t=>{const r=this.hash;return e.rpc.author.submitAndWatchExtrinsic(t?.signedTransaction||this).pipe((0,C.w)((e=>this.#I(r,e))),(0,Z.b)((e=>{this.#T(e,t)})))};#U=async(t,r,n)=>{const s=r.signer||e.signer,i=r.allowCallDataAlteration??!0;if(!s)throw new Error("No signer specified, either via api.setSigner or via sign options. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.");const a=this.registry.createTypeUnsafe("SignerPayload",[(0,_.Z)({},r,{address:t,blockNumber:n?n.number:0,method:this.method})]);let o;if((0,ne.m)(s.signPayload)){if(o=await s.signPayload(a.toPayload()),o.signedTransaction&&!r.withSignedTransaction)throw new Error("The `signedTransaction` field may not be submitted when `withSignedTransaction` is disabled");if(o.signedTransaction&&r.withSignedTransaction){const e=this.registry.createTypeUnsafe("Extrinsic",[o.signedTransaction]),r=this.registry.createTypeUnsafe("SignerPayload",[(0,_.Z)({},{address:t,assetId:e.assetId&&e.assetId.isSome?e.assetId.toHex():null,blockHash:a.blockHash,blockNumber:n?n.number:0,era:e.era.toHex(),genesisHash:a.genesisHash,metadataHash:e.metadataHash?e.metadataHash.toHex():null,method:e.method.toHex(),mode:e.mode?e.mode.toHex():null,nonce:e.nonce.toHex(),runtimeVersion:a.runtimeVersion,signedExtensions:a.signedExtensions,tip:e.tip?e.tip.toHex():null,version:a.version})]);if(!e.isSigned)throw new Error(`When using the signedTransaction field, the transaction must be signed. Recieved isSigned: ${e.isSigned}`);return i||this.#R(a,e),super.addSignature(t,o.signature,r.toPayload()),{id:o.id,signedTransaction:o.signedTransaction}}}else{if(!(0,ne.m)(s.signRaw))throw new Error("Invalid signer interface, it should implement either signPayload or signRaw (or both)");o=await s.signRaw(a.toRaw())}return super.addSignature(t,o.signature,a.toPayload()),{id:o.id}};#T=(t,r)=>{if(r&&-1!==r.updateId){const{options:n,updateId:s}=r,i=n.signer||e.signer;i&&(0,ne.m)(i.update)&&i.update(s,t)}};#R=(e,t)=>{if(e.toPayload().method!==t.method.toHex())throw new Error("signAndSend: call data does not match the original payload")}}return a}({api:t,apiType:e,blockHash:s,decorateMethod:r});return e=>new i(n||t.registry,e)}var Ei=r(36879);const _i=(0,V.k)("api/augment");function Si(e,t,r=[]){return t.length?` ${t.length} ${e}${r.length?" and":""}`:""}function Ai(e,t){return t.length?`\n\t${e.padStart(7)}: ${t.sort().join(", ")}`:""}function qi(e,t,[r,n]){(r.length||n.length)&&_i.warn(`api.${e}: Found${Si("added",r,n)}${Si("removed",n)} ${t}:${Ai("added",r)}${Ai("removed",n)}`)}function Ui(e,t){return e.filter((e=>!t.includes(e)))}function Ii(e,t){const r=Object.keys(e),n=(s=Object.keys(t),i=r,s.filter((e=>i.includes(e))));var s,i;const a=[];for(let r=0,s=n.length;r<s;r++){const s=n[r],i=Object.keys(e[s]),o=Object.keys(t[s]);for(let e=0,t=o.length;e<t;e++){const t=o[e];i.includes(t)||a.push(`${s}.${t}`)}}return a}function Ti(e,t,r,n=!1){n&&(0,Ei.n)(r),e&&Object.keys(r).length&&(qi(e,"modules",function(e,t){const r=Object.keys(e),n=Object.keys(t);return[Ui(r,n),Ui(n,r)]}(t,r)),qi(e,"calls",function(e,t){return[Ii(t,e),Ii(e,t)]}(t,r)));const s=Object.keys(t);for(let e=0,n=s.length;e<n;e++){const n=s[e],i=t[n];r[n]||(r[n]={}),(0,J.G)(r[n],Object.keys(i),(e=>i[e]))}return r}function Ri(e,t){const r=e=>Object.keys(t[e]),n=(r,n)=>e(t[r][n]),s={},i=Object.keys(t);for(let e=0,t=i.length;e<t;e++)Y(s,i[e],r,n);return s}function Ci({lookup:e},{method:t,section:r},n){return`${r}.${t}(${n.map((t=>e.getTypeDef(t).type)).join(", ")})`}function Bi(e,t,r){const n=r.filter((e=>!(0,L.o)(e)));if(t.meta.type.isPlain){if(0!==n.length)throw new Error(`${Ci(e,t,[])} does not take any arguments, ${n.length} found`)}else{const{hashers:r,key:s}=t.meta.type.asMap,i=1===r.length?[s]:e.lookup.getSiType(s).def.asTuple.map((e=>e));if(n.length!==i.length)throw new Error(`${Ci(e,t,i)} is a map, requiring ${i.length} arguments, ${n.length} found`)}return[t,n]}var Mi=r(30686);class Oi{#C=new Mi.v;emit(e,...t){return this.#C.emit(e,...t)}on(e,t){return this.#C.on(e,t),this}off(e,t){return this.#C.removeListener(e,t),this}once(e,t){return this.#C.once(e,t),this}}const Pi=1e3,Hi=(0,V.k)("api/init");let Di=0;function Vi(e,{method:t,section:r}){return(0,$.k8)(e.rx.query[r]&&e.rx.query[r][t],(()=>`query.${r}.${t} is not available in this version of the metadata`))}class $i extends Oi{#B;#M={};#O;#P=[];#H=[];__phantom=new Ye(0);_type;_call={};_consts={};_derive;_errors={};_events={};_extrinsics;_extrinsicType=ai.Y.LATEST_EXTRINSIC_VERSION;_genesisHash;_isConnected;_isReady=!1;_query={};_queryMulti;_rpc;_rpcCore;_runtimeMap={};_runtimeChain;_runtimeMetadata;_runtimeVersion;_rx={call:{},consts:{},query:{},tx:{}};_options;_decorateMethod;constructor(e,t,r){super(),this.#B=""+ ++Di,this.#O=e.source?.registry||e.registry||new O.P,this._rx.callAt=(e,t)=>(0,X.D)(this.at(e,t)).pipe((0,M.U)((e=>
2e.rx.call))),this._rx.queryAt=(e,t)=>(0,X.D)(this.at(e,t)).pipe((0,M.U)((e=>e.rx.query))),this._rx.registry=this.#O,this._decorateMethod=r,this._options=e,this._type=t;const n=e.source?e.source._rpcCore.provider.isClonable?e.source._rpcCore.provider.clone():e.source._rpcCore.provider:e.provider||new ii.U;this._rpcCore=new si.mk(this.#B,this.#O,{isPedantic:this._options.isPedantic,provider:n,rpcCacheCapacity:this._options.rpcCacheCapacity,ttl:this._options.provider?.ttl,userRpc:this._options.rpc}),this._isConnected=new K.X(this._rpcCore.provider.isConnected),this._rx.hasSubscriptions=this._rpcCore.provider.hasSubscriptions}get registry(){return this.#O}createType(e,...t){return this.#O.createType(e,...t)}registerTypes(e){e&&this.#O.register(e)}get hasSubscriptions(){return this._rpcCore.provider.hasSubscriptions}get supportMulti(){return this._rpcCore.provider.hasSubscriptions||!!this._rpcCore.state.queryStorageAt}_emptyDecorated(e,t){return{call:{},consts:{},errors:{},events:{},query:{},registry:e,rx:{call:{},query:{}},tx:ki(this._type,this._rx,this._decorateMethod,e,t)}}_createDecorated(e,t,r,n){r||(r=this._emptyDecorated(e.registry,n)),!t&&e.decoratedMeta||(e.decoratedMeta=(0,oi.hJ)(e.registry,e.metadata));const s=this._decorateCalls(e,this._decorateMethod,n),i=this._decorateCalls(e,this._rxDecorateMethod,n),a=this._decorateStorage(e.decoratedMeta,this._decorateMethod,n),o=this._decorateStorage(e.decoratedMeta,this._rxDecorateMethod,n);return Ti("consts",e.decoratedMeta.consts,r.consts,t),Ti("errors",e.decoratedMeta.errors,r.errors,t),Ti("events",e.decoratedMeta.events,r.events,t),Ti("query",a,r.query,t),Ti("query",o,r.rx.query,t),Ti("call",s,r.call,t),Ti("call",i,r.rx.call,t),r.findCall=t=>I(e.registry,t),r.findError=t=>T(e.registry,t),r.queryMulti=n?this._decorateMultiAt(r,this._decorateMethod,n):this._decorateMulti(this._decorateMethod),r.runtimeVersion=e.runtimeVersion,{createdAt:n,decoratedApi:r,decoratedMeta:e.decoratedMeta}}_injectMetadata(e,t=!1){!t&&e.decoratedApi||(e.decoratedApi=this._emptyDecorated(e.registry));const{decoratedApi:r,decoratedMeta:n}=this._createDecorated(e,t,e.decoratedApi);this._call=r.call,this._consts=r.consts,this._errors=r.errors,this._events=r.events,this._query=r.query,this._rx.call=r.rx.call,this._rx.query=r.rx.query;const s=this._decorateExtrinsics(n,this._decorateMethod),i=this._decorateExtrinsics(n,this._rxDecorateMethod);t||!this._extrinsics?(this._extrinsics=s,this._rx.tx=i):(Ti("tx",s,this._extrinsics,!1),Ti(null,i,this._rx.tx,!1)),Ti(null,n.consts,this._rx.consts,t),this.emit("decorated")}injectMetadata(e,t,r){this._injectMetadata({counter:0,metadata:e,registry:r||this.#O,runtimeVersion:this.#O.createType("RuntimeVersionPartial")},t)}_decorateFunctionMeta(e,t){return t.meta=e.meta,t.method=e.method,t.section=e.section,t.toJSON=e.toJSON,e.callIndex&&(t.callIndex=e.callIndex),t}_filterRpc(e,t){0!==Object.keys(t).length&&(this._rpcCore.addUserInterfaces(t),this._decorateRpc(this._rpcCore,this._decorateMethod,this._rpc),this._decorateRpc(this._rpcCore,this._rxDecorateMethod,this._rx.rpc));const r={};for(let t=0,n=e.length;t<n;t++){const[n]=e[t].split("_");r[n]=!0}const n=Object.keys(r);for(let e=0,t=n.length;e<t;e++){const t=(0,ui.k)(n[e]),r=`${t}Api`;this._runtimeMap[(0,j.$)(t,64)]=t,this._runtimeMap[(0,j.$)(r,64)]=r}this._filterRpcMethods(e)}_filterRpcMethods(e){const t=0!==e.length,r=[...this._rpcCore.mapping.entries()],n=[],s=r.length;for(let e=0;e<s;e++){const[,{alias:t,endpoint:s,method:i,pubsub:a,section:o}]=r[e];n.push(`${o}_${i}`),a&&(n.push(`${o}_${a[1]}`),n.push(`${o}_${a[2]}`)),t&&n.push(...t),s&&n.push(s)}const i=e.filter((e=>!n.includes(e)&&!e.includes("_unstable_")));i.length&&!this._options.noInitWarn&&Hi.warn(`RPC methods not decorated: ${i.join(", ")}`);for(let n=0;n<s;n++){const[s,{method:i,section:a}]=r[n];t&&!e.includes(s)&&"rpc_methods"!==s&&this._rpc[a]&&(delete this._rpc[a][i],delete this._rx.rpc[a][i])}}_rpcSubmitter(e){return e(((e,...t)=>(0,X.D)(this._rpcCore.provider.send(e,t))))}_decorateRpc(e,t,r=this._rpcSubmitter(t)){const n=r,s=(r,n)=>{const s=e[r][n],i=t(s,{methodName:n});return i.meta=s.meta,i.raw=t(s.raw,{methodName:n}),i};for(let t=0,r=e.sections.length;t<r;t++){const r=e.sections[t];if(!Object.prototype.hasOwnProperty.call(n,r)){const t=Object.keys(e[r]),i=e=>s(r,e);for(let e=0,s=t.length;e<s;e++){const s=t[e];(this.hasSubscriptions||!s.startsWith("subscribe")&&!s.startsWith("unsubscribe"))&&(Object.prototype.hasOwnProperty.call(n,r)||(n[r]={}),(0,J.W)(n[r],s,i))}}}return n}_addRuntimeDef(e,t){if(!t)return;const r=Object.entries(t);for(let t=0,n=r.length;t<n;t++){const[n,s]=r[t];if(e[n])for(let t=0,r=s.length;t<r;t++){const r=s[t],i=e[n].find((({version:e})=>r.version===e));i?(0,_.Z)(i.methods,r.methods):e[n].push(r)}else e[n]=s}}_getRuntimeDefs(e,t,r=""){const n={},s=Object.values(ci);for(let e=0,t=s.length;e<t;e++)this._addRuntimeDef(n,s[e].runtime);return this._addRuntimeDef(n,(0,D.eH)(e,r,t)),this._addRuntimeDef(n,this._options.runtime),Object.entries(n)}_getMethods(e,t){const r={};return t.forEach((t=>{const{docs:n,inputs:s,name:i,output:a}=t;r[i.toString()]={description:n.map((e=>e.toString())).join(),params:s.map((({name:t,type:r})=>({name:t.toString(),type:e.lookup.getName(r)||e.lookup.getTypeDef(r).type}))),type:e.lookup.getName(a)||e.lookup.getTypeDef(a).type}})),r}_getRuntimeDefsViaMetadata(e){const t={},{apis:r}=e.metadata;for(let n=0,s=r.length;n<s;n++){const{methods:s,name:i}=r[n];t[i.toString()]=[{methods:this._getMethods(e,s),version:0}]}return Object.entries(t)}_decorateCalls({registry:e,runtimeVersion:{apis:t,specName:r,specVersion:n}},s,i){const a={},o={},c={},u=e.metadata.apis.length>0,d=u?this._getRuntimeDefsViaMetadata(e):this._getRuntimeDefs(e,r,this._runtimeChain),l=[],p=`${r.toString()}/${n.toString()}`,h=this.#M[p]||!1;if(this.#M[p]=!0,u)for(let e=0,t=d.length;e<t;e++){const[t,r]=d[e],n=r[0],s=(0,j.$)(t,64),i=(0,di.yZ)(t),a=Object.entries(n.methods);o[i]||(o[i]={});for(let e=0,r=a.length;e<r;e++){const[r,n]=a[e],c=(0,di.yZ)(r);o[i][c]=(0,_.Z)({method:c,name:`${t}_${r}`,section:i,sectionHash:s},n)}}else{for(let e=0,r=d.length;e<r;e++){const[r,n]=d[e],s=(0,j.$)(r,64),i=t.find((([e])=>e.eq(s)));if(c[s]=!0,i){const e=n.map((({version:e})=>e)).sort(),t=n.find((({version:e})=>i[1].eq(e)));if(t){const e=(0,di.yZ)(r),n=Object.entries(t.methods);if(n.length){o[e]||(o[e]={});for(let t=0,i=n.length;t<i;t++){const[i,a]=n[t],c=(0,di.yZ)(i);o[e][c]=(0,_.Z)({method:c,name:`${r}_${i}`,section:e,sectionHash:s},a)}}}else l.push(`${r}/${i[1].toString()} (${e.join("/")} known)`)}}const e=t.map((([e,t])=>[e.toHex(),t.toString()])).filter((([e])=>!c[e])).map((([e,t])=>`${this._runtimeMap[e]||e}/${t}`));this._options.noInitWarn||h||(l.length&&Hi.warn(`${p}: Not decorating runtime apis without matching versions: ${l.join(", ")}`),e.length&&Hi.warn(`${p}: Not decorating unknown runtime apis: ${e.join(", ")}`))}const f=i?(e,t)=>this._rpcCore.state.call(e,t,i):(e,t)=>this._rpcCore.state.call(e,t),y=t=>(0,J.G)({},Object.keys(o[t]),(r=>this._decorateCall(e,o[t][r],f,s))),g=Object.keys(o);for(let e=0,t=g.length;e<t;e++)(0,J.W)(a,g[e],y);return a}_decorateCall(e,t,r,n){const s=n(((...n)=>{if(n.length!==t.params.length)throw new Error(`${t.name}:: Expected ${t.params.length} arguments, found ${n.length}`);const s=e.createType("Raw",(0,Kt.d)(n.map(((r,n)=>e.createTypeUnsafe(t.params[n].type,[r]).toU8a()))));return r(t.name,s).pipe((0,M.U)((r=>e.createTypeUnsafe(t.type,[r]))))}));return s.meta=t,s}_decorateMulti(e){return e((e=>e.length?(this.hasSubscriptions?this._rpcCore.state.subscribeStorage:this._rpcCore.state.queryStorageAt)(e.map((e=>Array.isArray(e)?e[0].creator.meta.type.isPlain?[e[0].creator]:1===e[0].creator.meta.type.asMap.hashers.length?[e[0].creator,e.slice(1)]:[e[0].creator,...e.slice(1)]:[e.creator]))):(0,B.of)([])))}_decorateMultiAt(e,t,r){return t((t=>t.length?this._rpcCore.state.queryStorageAt(t.map((t=>{if(Array.isArray(t)){const{creator:r}=Vi(e,t[0].creator);return r.meta.type.isPlain?[r]:1===r.meta.type.asMap.hashers.length?[r,t.slice(1)]:[r,...t.slice(1)]}return[Vi(e,t.creator).creator]})),r):(0,B.of)([])))}_decorateExtrinsics({tx:e},t){const r=ki(this._type,this._rx,t),n=t=>(0,J.G)({},Object.keys(e[t]),(n=>n.startsWith("$")?e[t][n]:this._decorateExtrinsicEntry(e[t][n],r))),s=Object.keys(e);for(let e=0,t=s.length;e<t;e++)(0,J.W)(r,s[e],n);return r}_decorateExtrinsicEntry(e,t){const r=(...r)=>t(e(...r));return r.is=t=>e.is(t),this._decorateFunctionMeta(e,r)}_decorateStorage({query:e,registry:t},r,n){const s={},i=s=>(0,J.G)({},Object.keys(e[s]),(i=>n?this._decorateStorageEntryAt(t,e[s][i],r,n):this._decorateStorageEntry(e[s][i],r))),a=Object.keys(e);for(let e=0,t=a.length;e<t;e++)(0,J.W)(s,a[e],i);return s}_decorateStorageEntry(e,t){const r=(t,r)=>Bi(r||this.#O,e,t),n=t=>(0,X.D)(this.at(t)).pipe((0,M.U)((t=>Vi(t,e)))),s=this._decorateStorageCall(e,t);return s.creator=e,s.at=t(((e,...t)=>n(e).pipe((0,C.w)((e=>e(...t)))))),s.hash=t(((...e)=>this._rpcCore.state.getStorageHash(r(e)))),s.is=t=>t.section===e.section&&t.method===e.method,s.key=(...t)=>(0,A.c)((0,li.o)(e(...t))[1]),s.keyPrefix=(...t)=>(0,A.c)(e.keyPrefix(...t)),s.size=t(((...e)=>
2this._rpcCore.state.getStorageSize(r(e)))),s.sizeAt=t(((e,...t)=>n(e).pipe((0,C.w)((n=>this._rpcCore.state.getStorageSize(r(t,n.creator.meta.registry),e)))))),e.iterKey&&e.meta.type.isMap&&(s.entries=t((0,te.X)(this.#B,((...t)=>this._retrieveMapEntries(e,null,t)))),s.entriesAt=t((0,te.X)(this.#B,((e,...t)=>n(e).pipe((0,C.w)((r=>this._retrieveMapEntries(r.creator,e,t))))))),s.entriesPaged=t((0,te.X)(this.#B,(t=>this._retrieveMapEntriesPaged(e,void 0,t)))),s.keys=t((0,te.X)(this.#B,((...t)=>this._retrieveMapKeys(e,null,t)))),s.keysAt=t((0,te.X)(this.#B,((e,...t)=>n(e).pipe((0,C.w)((r=>this._retrieveMapKeys(r.creator,e,t))))))),s.keysPaged=t((0,te.X)(this.#B,(t=>this._retrieveMapKeysPaged(e,void 0,t))))),this.supportMulti&&e.meta.type.isMap&&(s.multi=t((t=>1===e.meta.type.asMap.hashers.length?this._retrieveMulti(t.map((t=>[e,[t]]))):this._retrieveMulti(t.map((t=>[e,t])))))),this._decorateFunctionMeta(e,s)}_decorateStorageEntryAt(e,t,r,n){const s=r=>Bi(e,t,r),i=r(((...e)=>this._rpcCore.state.getStorage(s(e),n)));return i.creator=t,i.hash=r(((...e)=>this._rpcCore.state.getStorageHash(s(e),n))),i.is=e=>e.section===t.section&&e.method===t.method,i.key=(...e)=>(0,A.c)((0,li.o)(t(...e))[1]),i.keyPrefix=(...e)=>(0,A.c)(t.keyPrefix(...e)),i.size=r(((...e)=>this._rpcCore.state.getStorageSize(s(e),n))),t.iterKey&&t.meta.type.isMap&&(i.entries=r((0,te.X)(this.#B,((...e)=>this._retrieveMapEntries(t,n,e)))),i.entriesPaged=r((0,te.X)(this.#B,(e=>this._retrieveMapEntriesPaged(t,n,e)))),i.keys=r((0,te.X)(this.#B,((...e)=>this._retrieveMapKeys(t,n,e)))),i.keysPaged=r((0,te.X)(this.#B,(e=>this._retrieveMapKeysPaged(t,n,e))))),this.supportMulti&&t.meta.type.isMap&&(i.multi=r((e=>1===t.meta.type.asMap.hashers.length?this._retrieveMulti(e.map((e=>[t,[e]])),n):this._retrieveMulti(e.map((e=>[t,e])),n)))),this._decorateFunctionMeta(t,i)}_queueStorage(e,t){const r=t===this.#H?this._rpcCore.state.subscribeStorage:this._rpcCore.state.queryStorageAt;let n,s=t.length-1,i=0;return-1!==s&&t[s]&&50!==t[s][1].length?(n=t[s][0],i=t[s][1].length,t[s][1].push(e)):(s++,n=(0,X.D)(new Promise((e=>{(0,Ge.Y)((()=>{const r=t[s][1];delete t[s],e(r)}))}))).pipe((0,C.w)((e=>r(e)))),t.push([n,[e]])),n.pipe((0,M.U)((e=>e[i])))}_decorateStorageCall(e,t){return t((0,te.X)(this.#B,((...t)=>{const r=Bi(this.#O,e,t);return this.hasSubscriptions?this._queueStorage(r,this.#H):this._rpcCore.state.getStorage(r)})),{methodName:e.method,overrideNoSub:(...t)=>this._queueStorage(Bi(this.#O,e,t),this.#P)})}_retrieveMulti(e,t){if(!e.length)return(0,B.of)([]);const r=this.hasSubscriptions&&!t?this._rpcCore.state.subscribeStorage:this._rpcCore.state.queryStorageAt;return e.length<=250?t?r(e,t):r(e):(0,z.a)((0,yn.Z)(e,250).map((e=>t?r(e,t):r(e)))).pipe((0,M.U)(Gt.a))}_retrieveMapKeys({iterKey:e,meta:t,method:r,section:n},s,i){if(!e||!t.type.isMap)throw new Error("keys can only be retrieved on maps");const a=e(...i).toHex(),o=new K.X(a),c=s?e=>this._rpcCore.state.getKeysPaged(a,Pi,e,s):e=>this._rpcCore.state.getKeysPaged(a,Pi,e),u=e=>e.setMeta(t,n,r);return o.pipe((0,C.w)(c),(0,M.U)((e=>e.map(u))),(0,Z.b)((e=>(0,Ge.Y)((()=>{e.length===Pi?o.next(e[999].toHex()):o.complete()})))),(0,G.q)(),(0,M.U)(Gt.a))}_retrieveMapKeysPaged({iterKey:e,meta:t,method:r,section:n},s,i){if(!e||!t.type.isMap)throw new Error("keys can only be retrieved on maps");const a=e=>e.setMeta(t,n,r);return(s?e=>this._rpcCore.state.getKeysPaged(e,i.pageSize,i.startKey||e,s):e=>this._rpcCore.state.getKeysPaged(e,i.pageSize,i.startKey||e))(e(...i.args).toHex()).pipe((0,M.U)((e=>e.map(a))))}_retrieveMapEntries(e,t,r){const n=t?e=>this._rpcCore.state.queryStorageAt(e,t):e=>this._rpcCore.state.queryStorageAt(e);return this._retrieveMapKeys(e,t,r).pipe((0,C.w)((e=>e.length?(0,z.a)((0,yn.Z)(e,250).map(n)).pipe((0,M.U)((t=>(0,Gt.a)(t).map(((t,r)=>[e[r],t]))))):(0,B.of)([]))))}_retrieveMapEntriesPaged(e,t,r){const n=t?e=>this._rpcCore.state.queryStorageAt(e,t):e=>this._rpcCore.state.queryStorageAt(e);return this._retrieveMapKeysPaged(e,t,r).pipe((0,C.w)((e=>e.length?n(e).pipe((0,M.U)((t=>t.map(((t,r)=>[e[r],t]))))):(0,B.of)([]))))}_decorateDeriveRx(e){const t=this._runtimeVersion?.specName.toString();return Ri(e,function(e,t,r={}){return{...ni(e,t,ti),...ni(e,t,r)}}(this.#B,this._rx,(0,_.Z)({},this._options.derives,this._options.typesBundle?.spec?.[t||""]?.derives)))}_decorateDerive(e){return Ri(e,this._rx.derive)}_rxDecorateMethod=e=>e}const Li=[16,15,14],Ni=(0,V.k)("api/init");function Fi(e){return e.toString()}class ji extends $i{#D=null;#V=null;#$=[];#L=null;#N={};constructor(e,t,r){super(e,t,r),this.registry.setKnownTypes(e),e.source?this.#$=e.source.#$:this.registerTypes(e.types),this._rpc=this._decorateRpc(this._rpcCore,this._decorateMethod),this._rx.rpc=this._decorateRpc(this._rpcCore,this._rxDecorateMethod),this.supportMulti&&(this._queryMulti=this._decorateMulti(this._decorateMethod),this._rx.queryMulti=this._decorateMulti(this._rxDecorateMethod)),this._rx.signer=e.signer,this._rpcCore.setRegistrySwap((e=>this.getBlockRegistry(e))),this._rpcCore.setResolveBlockHash((e=>(0,R.z)(this._rpcCore.chain.getBlockHash(e)))),this.hasSubscriptions?(this._rpcCore.provider.on("disconnected",(()=>this.#F())),this._rpcCore.provider.on("error",(e=>this.#j(e))),this._rpcCore.provider.on("connected",(()=>
2this.#W()))):this._options.noInitWarn||Ni.warn("Api will be available in a limited mode since the provider does not support subscriptions"),this._rpcCore.provider.isConnected&&this.#W().catch(E.Z)}_initRegistry(e,t,r,n,s){e.clearCache(),e.setChainProperties(s||this.registry.getChainProperties()),e.setKnownTypes(this._options),e.register((0,D.kh)(e,t,r.specName,r.specVersion)),e.setHasher((0,D.ve)(e,t,r.specName)),e.knownTypes.typesBundle&&(e.knownTypes.typesAlias=(0,D.Xn)(e,t,r.specName)),e.setMetadata(n,void 0,(0,_.Z)({},(0,D.oR)(e,t,r.specName),this._options.signedExtensions),this._options.noInitWarn)}_getDefaultRegistry(){return(0,$.k8)(this.#$.find((({isDefault:e})=>e)),"Initialization error, cannot find the default registry")}async at(e,t){const r=(0,q.Y)(e),n=(0,A.c)(r),s=await this.getBlockRegistry(r,t);return this.#D&&this.#D[0]===n||(this.#D=[n,this._createDecorated(s,!0,null,r).decoratedApi]),this.#D[1]}async _createBlockRegistry(e,t,r){const n=new O.P(e),s=await this._retrieveMetadata(r.apis,t.parentHash,n),i=this._runtimeChain;if(!i)throw new Error("Invalid initializion order, runtimeChain is not available");this._initRegistry(n,i,r,s);const a={counter:0,lastBlockHash:e,metadata:s,registry:n,runtimeVersion:r};return this.#$.push(a),a}_cacheBlockRegistryProgress(e,t){let r=this.#N[e];return(0,L.o)(r)&&(r=this.#N[e]=new Promise(((r,n)=>{t().then((t=>{delete this.#N[e],r(t)})).catch((t=>{delete this.#N[e],n(t)}))}))),r}_getBlockRegistryViaVersion(e,t){if(t){const r=this.#$.find((({runtimeVersion:{specName:e,specVersion:r}})=>e.eq(t.specName)&&r.eq(t.specVersion)));if(r)return r.counter++,r.lastBlockHash=e,r}return null}async _getBlockRegistryViaHash(e){if(!this._genesisHash||!this._runtimeVersion)throw new Error("Cannot retrieve data on an uninitialized chain");const t=this.registry.createType("HeaderPartial",this._genesisHash.eq(e)?{number:N.nw,parentHash:this._genesisHash}:await(0,R.z)(this._rpcCore.chain.getHeader.raw(e)));if(t.parentHash.isEmpty)throw Ni.warn(`Unable to retrieve header ${e.toString()} and parent ${t.parentHash.toString()} from supplied hash`),new Error("Unable to retrieve header and parent from supplied hash");const[r,n]=(0,D.ur)(this._genesisHash,t.number),s=this.registry.createType("RuntimeVersionPartial",await(0,R.z)(this._rpcCore.state.getRuntimeVersion.raw(t.parentHash)));return this._getBlockRegistryViaVersion(e,s)||await this._cacheBlockRegistryProgress(s.toHex(),(()=>this._createBlockRegistry(e,t,s)))}async getBlockRegistry(e,t){return this.#$.find((({lastBlockHash:t})=>t&&(0,F.S)(t,e)))||this._getBlockRegistryViaVersion(e,t)||await this._cacheBlockRegistryProgress((0,A.c)(e),(()=>this._getBlockRegistryViaHash(e)))}async _loadMeta(){return this._isReady?(this._options.source||this._subscribeUpdates(),!0):(this._unsubscribeUpdates(),[this._genesisHash,this._runtimeMetadata]=this._options.source?._isReady?await this._metaFromSource(this._options.source):await this._metaFromChain(this._options.metadata),this._initFromMeta(this._runtimeMetadata))}async _metaFromSource(e){this._extrinsicType=e.extrinsicVersion,this._runtimeChain=e.runtimeChain,this._runtimeVersion=e.runtimeVersion;const t=Object.keys(e.rpc),r=[];for(let n=0,s=t.length;n<s;n++){const s=t[n],i=Object.keys(e.rpc[s]);for(let e=0,t=i.length;e<t;e++)r.push(`${s}_${i[e]}`)}return this._filterRpc(r,(0,D.KM)(this.registry,e.runtimeChain,e.runtimeVersion.specName)),[e.genesisHash,e.runtimeMetadata]}_subscribeUpdates(){!this.#L&&this.hasSubscriptions&&(this.#L=this._rpcCore.state.subscribeRuntimeVersion().pipe((0,C.w)((e=>this._runtimeVersion?.specVersion.eq(e.specVersion)?(0,B.of)(!1):this._rpcCore.state.getMetadata().pipe((0,M.U)((t=>{Ni.log(`Runtime version updated to spec=${e.specVersion.toString()}, tx=${e.transactionVersion.toString()}`),this._runtimeMetadata=t,this._runtimeVersion=e,this._rx.runtimeVersion=e;const r=this._getDefaultRegistry(),n=this._runtimeChain;if(!n)throw new Error("Invalid initializion order, runtimeChain is not available");return r.metadata=t,r.runtimeVersion=e,this._initRegistry(this.registry,n,e,t),this._injectMetadata(r,!0),!0})))))).subscribe())}async _metaFromChain(e){const[t,r,n,s,i]=await Promise.all([(0,R.z)(this._rpcCore.chain.getBlockHash(0)),(0,R.z)(this._rpcCore.state.getRuntimeVersion()),(0,R.z)(this._rpcCore.system.chain()),(0,R.z)(this._rpcCore.system.properties()),(0,R.z)(this._rpcCore.rpc.methods())]);this._runtimeChain=n,this._runtimeVersion=r,this._rx.runtimeVersion=r;const a=`${t.toHex()||"0x"}-${r.specVersion.toString()}`,o=e?.[a]?new P.S(this.registry,e[a]):await this._retrieveMetadata(r.apis);return this._initRegistry(this.registry,n,r,o,s),this._filterRpc(i.methods.map(Fi),(0,D.KM)(this.registry,n,r.specName)),this._subscribeUpdates(),this.#$.length||this.#$.push({counter:0,isDefault:!0,metadata:o,registry:this.registry,runtimeVersion:r}),o.getUniqTypes(this._options.throwOnUnknown||!1),[t,o]}_initFromMeta(e){const t=this._runtimeVersion;if(!t)throw new Error("Invalid initializion order, runtimeVersion is not available");return this._extrinsicType=e.asLatest.extrinsic.versions.at(0)||H.Ex,this._rx.extrinsicType=this._extrinsicType,this._rx.genesisHash=this._genesisHash,this._rx.runtimeVersion=t,this._injectMetadata(this._getDefaultRegistry(),!0),this._rx.derive=this._decorateDeriveRx(this._rxDecorateMethod),this._derive=this._decorateDerive(this._decorateMethod),!0}async _retrieveMetadata(e,t,r){let n=null;const s=e.find((([e])=>e.eq((0,j.$)("Metadata",64)))),i=r||this.registry;if(!s||s[1].toNumber()<2)return Ni.warn("MetadataApi not available, rpc::state::get_metadata will be used."),t?new P.S(i,await(0,R.z)(this._rpcCore.state.getMetadata.raw(t))):await(0,R.z)(this._rpcCore.state.getMetadata());try{const e=t?await(0,R.z)(this._rpcCore.state.call.raw("Metadata_metadata_versions","0x",t)):await(0,R.z)(this._rpcCore.state.call("Metadata_metadata_versions","0x"));n=i.createType("Vec<u32>",e).filter((e=>Li.includes(e.toNumber()))).reduce(((e,t)=>t.gt(e)?t:e))}catch(e){Ni.debug(e.message),Ni.warn("error with state_call::Metadata_metadata_versions, rpc::state::get_metadata will be used")}if(n&&!Li.includes(n.toNumber())&&(n=null),n)try{const e=t?await(0,R.z)(this._rpcCore.state.call.raw("Metadata_metadata_at_version",(0,A.c)(n.toU8a()),t)):await(0,R.z)(this._rpcCore.state.call("Metadata_metadata_at_version",(0,A.c)(n.toU8a()))),r=t?i.createType("Raw",e).toU8a():e,s=i.createType("Option<OpaqueMetadata>",r).unwrapOr(null);if(s)return new P.S(i,s.toHex())}catch(e){Ni.debug(e.message),Ni.warn("error with state_call::Metadata_metadata_at_version, rpc::state::get_metadata will be used")}return t?new P.S(i,await(0,R.z)(this._rpcCore.state.getMetadata.raw(t))):await(0,R.z)(this._rpcCore.state.getMetadata())}_subscribeHealth(){this._unsubscribeHealth(),this.#V=this.hasSubscriptions?setInterval((()=>{(0,R.z)(this._rpcCore.system.health.raw()).catch(E.Z)}),1e4):null}_unsubscribeHealth(){this.#V&&(clearInterval(this.#V),this.#V=null)}_unsubscribeUpdates(){this.#L&&(this.#L.unsubscribe(),this.#L=null)}_unsubscribe(){this._unsubscribeHealth(),this._unsubscribeUpdates()}
2async#W(){this._isConnected.next(!0),this.emit("connected");try{const e=!1===this._options.initWasm||await(0,W.I)(),t=await this._loadMeta();this._subscribeHealth(),t&&!this._isReady&&e&&(this._isReady=!0,this.emit("ready",this))}catch(e){const t=new Error(`FATAL: Unable to initialize the API: ${e.message}`);Ni.error(t),this.emit("error",t)}}#F(){this._isConnected.next(!1),this._unsubscribe(),this.emit("disconnected")}#j(e){this.emit("error",e)}}function Wi(e){if(void 0===e)throw new Error("Api interfaces needs to be initialized before using, wait for 'isReady'");return e}class Xi extends ji{get call(){return Wi(this._call)}get consts(){return Wi(this._consts)}get derive(){return Wi(this._derive)}get errors(){return Wi(this._errors)}get events(){return Wi(this._events)}get extrinsicVersion(){return this._extrinsicType}get genesisHash(){return Wi(this._genesisHash)}get isConnected(){return this._isConnected.getValue()}get libraryInfo(){return`@polkadot/api v${U}`}get query(){return Wi(this._query)}get queryMulti(){return Wi(this._queryMulti)}get rpc(){return Wi(this._rpc)}get runtimeChain(){return Wi(this._runtimeChain)}get runtimeMetadata(){return Wi(this._runtimeMetadata)}get runtimeVersion(){return Wi(this._runtimeVersion)}get rx(){return Wi(this._rx)}get stats(){return this._rpcCore.stats}get type(){return this._type}get tx(){return Wi(this._extrinsics)}findCall(e){return I(this.registry,e)}findError(e){return T(this.registry,e)}}class Ki extends Xi{constructor(e={},t,r){super(e,t,r)}connect(){return this._rpcCore.connect()}disconnect(){return this._unsubscribe(),this._rpcCore.disconnect()}setSigner(e){this._rx.signer=e}async sign(e,t,{signer:r}={}){if((0,S.H)(e)){const n=r||this._rx.signer;if(!n?.signRaw)throw new Error("No signer exists with a signRaw interface. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.");return(await n.signRaw((0,_.Z)({type:"bytes"},t,{address:e}))).signature}return(0,A.c)(e.sign((0,q.Y)(t.data)))}}class zi{#X=!1;#K;#z=[];#Z=[];#G=!0;#J=[];#Y=[];constructor(e,t){this.#K=t,this.#Y=e.map((async(e,t)=>{const[r,...n]=Array.isArray(e)?e:[e];return this.#z.push(!1),this.#Z.push(r),r(...n,this._createCallback(t))}))}_allHasFired(){return this.#X||=0===this.#z.filter((e=>!e)).length,this.#X}_createCallback(e){return t=>{this.#z[e]=!0,this.#J[e]=t,this._triggerUpdate()}}_triggerUpdate(){if(this.#G&&(0,ne.m)(this.#K)&&this._allHasFired())try{Promise.resolve(this.#K(this.#J)).catch(E.Z)}catch{}}unsubscribe(){this.#G&&(this.#G=!1,Promise.all(this.#Y.map((async e=>{try{const t=await e;(0,ne.m)(t)&&t()}catch{}}))).catch((()=>{})))}}var Zi=r(10589);class Gi extends Ki{#Q;#ee;constructor(e){super(e,"promise",Zi.x),this.#Q=new Promise((e=>{super.once("ready",(()=>e(this)))})),this.#ee=new Promise(((e,t)=>{const r=(0,Zi.g)(e,t);super.once("ready",(()=>r.resolve(this))),super.once("error",(e=>r.reject(e)))}))}static create(e){const t=new Gi(e);return e&&e.throwOnConnect?t.isReadyOrError:(t.isReadyOrError.catch(E.Z),t.isReady)}get isReady(){return this.#Q}get isReadyOrError(){return this.#ee}clone(){return new Gi((0,_.Z)({},this._options,{source:this}))}async combineLatest(e,t){const r=new zi(e,t);return()=>{r.unsubscribe()}}}},10589:(e,t,r)=>{r.d(t,{g:()=>c,x:()=>u});var n=r(20),s=r(47009),i=r(11348),a=r(33661),o=r(17965);function c(e,t){let r=!1;return{reject:e=>(r||(r=!0,t(e)),n.E),resolve:t=>{r||(r=!0,e(t))}}}function u(e,t){const r=!(!t?.methodName||!t.methodName.includes("subscribe"));return function(...n){const[u,d]=function(e,t){const r=e.slice(),n=e.length&&(0,a.m)(e[e.length-1])?r.pop():void 0;if(t&&!(0,a.m)(n))throw new Error("Expected a callback to be passed with subscriptions");return[r,n]}(n,r);return d?function(e,t,r){return new Promise(((n,a)=>{const u=c(n,a),d=e(...t).pipe((0,s.K)((e=>u.reject(e))),(0,i.b)((()=>u.resolve((()=>d.unsubscribe()))))).subscribe((e=>{(0,o.Y)((()=>r(e)))}))}))}(e,u,d):function(e,t){return new Promise(((r,n)=>{const i=c(r,n),a=e(...t).pipe((0,s.K)((e=>i.reject(e)))).subscribe((e=>{i.resolve(e),(0,o.Y)((()=>a.unsubscribe()))}
2))}))}(t?.overrideNoSub||e,u)}}},89492:(e,t,r)=>{r.d(t,{h:()=>o});const n=e=>e;function s(e,t,r,n){return e.filter((({event:e})=>t===e.section&&r.includes(e.method))).map((e=>n(e)))}function i({event:{data:[e]}}){return e}function a({event:{data:e,method:t}}){return"ExtrinsicSuccess"===t?e[0]:e[1]}class o{dispatchError;dispatchInfo;internalError;events;status;txHash;txIndex;blockNumber;constructor({blockNumber:e,dispatchError:t,dispatchInfo:r,events:n,internalError:o,status:c,txHash:u,txIndex:d}){this.dispatchError=t||function(e=[]){return s(e,"system",["ExtrinsicFailed"],i)[0]}(n),this.dispatchInfo=r||function(e=[]){return s(e,"system",["ExtrinsicFailed","ExtrinsicSuccess"],a)[0]}(n),this.events=n||[],this.internalError=o,this.status=c,this.txHash=u,this.txIndex=d,this.blockNumber=e}get isCompleted(){return this.isError||this.status.isInBlock||this.status.isFinalized}get isError(){return this.status.isDropped||this.status.isFinalityTimeout||this.status.isInvalid||this.status.isUsurped}get isFinalized(){return this.status.isFinalized}get isInBlock(){return this.status.isInBlock}get isWarning(){return this.status.isRetracted}filterRecords(e,t){return s(this.events,e,Array.isArray(t)?t:[t],n)}findRecord(e,t){return this.filterRecords(e,t)[0]}toHuman(e){return{dispatchError:this.dispatchError?.toHuman(),dispatchInfo:this.dispatchInfo?.toHuman(),events:this.events.map((t=>t.toHuman(e))),internalError:this.internalError?.message.toString(),status:this.status.toHuman(e)}}}},345:(e,t,r)=>{r.d(t,{LW:()=>o,vK:()=>p,$y:()=>l,R0:()=>h});var n=r(33403),s=r(90107),i=r(94175);const a=window;a.injectedWeb3=a.injectedWeb3||{};let o=u(),c=null;function u(){return 0!==Object.values(a.injectedWeb3).filter((({connect:e,enable:t})=>!(!e&&!t))).length}function d(e){throw new Error(`${e}: web3Enable(originName) needs to be called before ${e}`)}function l(e,t=[]){if(!e)throw new Error("You must pass a name for your app to the web3Enable function");const r=t.length?Promise.all(t.map((e=>e().catch((()=>!1))))):Promise.resolve([!0]);var s;return s=()=>r.then((()=>function(e){return Promise.all(Object.entries(a.injectedWeb3).map((([t,{connect:r,enable:s,version:i}])=>Promise.resolve().then((()=>r?r(e):s?s(e).then((e=>(0,n.Z)({name:t,version:i||"unknown"},e))):Promise.reject(new Error("No connect(..) or enable(...) hook foun
2d")))).catch((({message:e})=>{console.error(`Error initializing ${t}: ${e}`)}))))).then((e=>e.filter((e=>!!e))))}(e).then((e=>e.map((e=>(e.accounts.subscribe||(e.accounts.subscribe=t=>(e.accounts.get().then(t).catch(console.error),()=>{})),e))))).catch((()=>[])).then((e=>{const t=e.map((({name:e,version:t})=>`${e}/${t}`));return o=u(),console.info(`web3Enable: Enabled ${e.length} extension${1!==e.length?"s":""}: ${t.join(", ")}`),e})))),c=new Promise((e=>{"complete"===document.readyState?e(s()):window.addEventListener("load",(()=>e(s())))})),c}async function p({accountType:e,extensions:t,genesisHash:r,ss58Format:n}={}){const a=[],o=await async function(e,t){return c?(await c).filter((({name:e})=>!t||t.includes(e))):d(e)}("web3Accounts",t),u=await Promise.all(o.map((async({accounts:t,name:a})=>{try{return function(e,t,r){return t.map((({address:t,genesisHash:n,name:a,type:o})=>({address:42===t.length?t:(0,s.m)((0,i.m)(t),r),meta:{genesisHash:n,name:a,source:e},type:o})))}(a,function(e,t,r){return e.filter((e=>(!e.type||!r||r.includes(e.type))&&(!e.genesisHash||!t||e.genesisHash===t)))}(await t.get(),r,e),n)}catch{return[]}})));return u.forEach((e=>{a.push(...e)})),console.info(`web3Accounts: Found ${a.length} address${1!==a.length?"es":""}`),a}async function h(e){if(!c)return d("web3FromSource");const t=await c,r=e&&t.find((({name:t})=>t===e));if(!r)throw new Error(`web3FromSource: Unable to find an injected ${e}`);return r}},90809:(e,t,r)=>{r.d(t,{g:()=>i});var n=r(28646);function s(...e){return e.map((([e,t])=>({create:()=>t.create(),type:e})))}const i=s(["webusb",r(28016).Z],["hid",n.Z])},97772:(e,t,r)=>{r.d(t,{P:()=>h});var n=r(67046),s=r(90809),i=r(84195),a=r(50145),o=r(52256);const c=36864;var u=r(39582);async function d(e){const t=await e;if(t.return_code!==c)throw new Error(t.error_message);return t}async function l(e){if(e)try{await e.close()}catch{}}function p(e,t,r=0,n=0,{account:s=2147483648,addressIndex:o=2147483648,change:c=2147483648}={}){return async u=>{const{signature:l}=await d(u[e](s+r,c,o+n,(0,i.Y)(t)));return{signature:(0,a.t)(l.toString("hex"))}}}class h{#te;#re;#ne=null;constructor(e,t){const r=u.oZ[t],n=s.g.find((({type:t})=>t===e));if(!r)throw new Error(`Unsupported Ledger chain ${t}`);if(!n)throw new Error(`Unsupported Ledger transport ${e}`);this.#te=r,this.#re=n}async getAddress(e=!1,t=0,r=0,{account:n=2147483648,addressIndex:s=2147483648,change:i=2147483648}={}){return this.withApp((async o=>{const{address:c,pubKey:u}=await d(o.getAddress(n+t,i,s+r,e));return{address:c,publicKey:(0,a.t)(u)}}))}async getVersion(){return this.withApp((async e=>{const{device_locked:t,major:r,minor:n,patch:s,test_mode:i}=await d(e.getVersion());return{isLocked:t,isTestMode:i,version:[r,n,s]}}))}async sign(e,t,r,n){return this.withApp(p("sign",e,t,r,n))}async signRaw(e,t,r,n){return this.withApp(p("signRaw",(0,o.Rl)(e),t,r,n))}async disconnect(){const e=this.#ne;this.#ne=null,await l(e?.transport||null)}async withApp(e){let t=null;try{return this.#ne||(t=await this.#re.create(),this.#ne=(0,n.newSubstrateApp)(t,this.#te)),await e(this.#ne)}catch(e){throw await l(this.#ne?.transport||t),this.#ne=null,e}}}},17346:(e,t,r)=>{r.d(t,{T:()=>f});var n=r(67046),s=r(90809),i=r(84195),a=r(50145),o=r(52256),c=r(39582),u=r(48834).Buffer;async function d(e){let t;try{t=await e}catch(e){if(e.returnCode)throw new Error(`${e.returnCode}: ${e.errorMessage}`);throw new Error(e.message)}return t}async function l(e){if(e)try{await e.close()}catch{}}function p(e,t,r,n=0,s=0){const o=`m/44'/${r}'/${n}'/0'/${s}'`;return async r=>{const{signature:n}=await d(r[e](o,(0,i.Y)(t)));return{signature:(0,a.t)(n.toString("hex"))}}}function h(e,t,r,n=0,s=0){const o=`m/44'/${r}'/${n}'/0'/${s}'`;return async r=>{const{r:n,s,v:c}=await d(r[e](o,(0,i.Y)(t))),l=u.concat([n,s,c]);return{signature:(0,a.t)(l.toString("hex"))}}}class f{#re;#se;#ie;#ae;#ne=null;constructor(e,t,r,n,i){const a=c.oZ[t],o=s.g.find((({type:t})=>t===e));if(!a)throw new Error(`Unsupported Ledger chain ${t}`);if(!o)throw new Error(`Unsupported Ledger transport ${e}`);this.#ae=i,this.#ie=n,this.#se=r,this.#re=o}async getAddress(e,t=!1,r=0,n=0){const s=`m/44'/${this.#se}'/${r}'/0'/${n}'`;return this.withApp((async r=>{const{address:n,pubKey:i}=await d(r.getAddressEd25519(s,e,t));return{address:n,publicKey:(0,a.t)(i)}}))}async getAddressEcdsa(e=!1,t=0,r=0){const n=`m/44'/${this.#se}'/${t}'/0'/${r}'`;return this.withApp((async t=>{const{address:r,pubKey:s}=await d(t.getAddressEcdsa(n,e));return{address:r,publicKey:(0,a.t)(s)}}))}async getVersion(){return this.withApp((async e=>{const{deviceLocked:t,major:r,minor:n,patch:s,testMode:i}=await d(e.getVersion());return{isLocked:!!t,isTestMode:!!i,version:[r||0,n||0,s||0]}}))}async sign(e,t,r){return this.withApp(p("signEd25519",e,this.#se,t,r))}async signRaw(e,t,r){return this.withApp(p("signRawEd25519",(0,o.Rl)(e),this.#se,t,r))}async signEcdsa(e,t,r){return this.withApp(h("signEcdsa",(0,o.Rl)(e),this.#se,t,r))}async signRawEcdsa(e,t,r){return this.withApp(h("signRawEcdsa",(0,o.Rl)(e),this.#se,t,r))}async signWithMetadata(e,t,r,n){return this.withApp(function(e,t,r=0,n=0,{metadata:s}={}){const i=`m/44'/${t}'/${r}'/0'/${n}'`;return async t=>{if(!s)throw new Error("The metadata option must be present when using signWithMetadata");const r=u.from(e),{signature:n}=await d(t.signWithMetadataEd25519(i,r,s));return{signature:(0,a.t)(n.toString("hex"))}}}(e,this.#se,t,r,n))}async signWithMetadataEcdsa(e,t,r,n){return this.withApp(function(e,t,r=0,n=0,{metadata:s}={}){const i=`m/44'/${t}'/${r}'/0'/${n}'`;return async t=>{if(!s)throw new Error("The metadata option must be present when using signWithMetadata");const r=u.from(e),{r:n,s:o,v:c}=await d(t.signWithMetadataEcdsa(i,r,s)),l=u.concat([n,o,c]);return{signature:(0,a.t)(l.toString("hex"))}}}(e,this.#se,t,r,n))}async disconnect(){const e=this.#ne;this.#ne=null,await l(e?.transport||null)}async withApp(e){let t=null;try{return this.#ne||(t=await this.#re.create(),this.#ne=new n.PolkadotGenericApp(t,this.#ie,this.#ae)),await e(this.#ne)}catch(e){throw await l(this.#ne?.transport||t),this.#ne=null,e}}}},39582:(e,t,r)=>{r.d(t,{oZ:()=>n});const n={acala:"Acala",ajuna:"Ajuna","aleph-node":"AlephZero",astar:"Astar",bifrost:"Bifrost","bifrost-kusama":"BifrostKusama",centrifuge:"Centrifuge",composable:"Composable",darwinia:"Darwinia","dock-mainnet":"Dock",edgeware:"Edgeware",enjin:"Enjin",equilibrium:"Equilibrium",genshiro:"Genshiro",hydradx:"HydraDX","interlay-parachain":"Interlay",karura:"Karura",khala:"Khala",kusama:"Kusama",matrixchain:"Matrixchain",nodle:"Nodle",origintrail:"OriginTrail",parallel:"Parallel",peaq:"Peaq",pendulum:"Pendulum",phala:"Phala",picasso:"Picasso",polkadex:"Polkadex",polkadot:"Polkadot",polymesh:"Polymesh",quartz:"Quartz",sora:"Sora",stafi:"Stafi",statemine:"Statemine",statemint:"Statemint",ternoa:"Ternoa",unique:"Unique",vtb:"VTB",xxnetwork:"XXNetwork",zeitgeist:"Zeitgeist",bittensor:"Bittensor",creditcoin3:"Creditcoin3",dentnet:"DENTNet",encointer:"Encointer",frequency:"Frequency",integritee:"Integritee",liberland:"Liberland",mythos:"Mythos",polimec:"Polimec",vara:"Vara"}},31667:(e,t,r)=>{r.d(t,{g:()=>n});const n="bottom drive obey lake curtain smoke basket hold race lonely fit walk"},92580:(e,t,r)=>{r.d(t,{s:()=>F});var n=r(38628),s=r(51330),i=r(33403),a=r(46610),o=r(55858),c=r(65417),u=r(36916),d=r(50528),l=r(46359),p=r(92892),h=r(62417),f=r(89581),y=r(34323),g=r(64071),m=r(23604),b=r(73493),v=r(55736),w=r(68257),x=r(20402),k=r(53501),E=r(38303),_=r(91851),S=r(42861);const A=new Uint8Array([161,35,3,33,0]),q=new Uint8Array([48,83,2,1,1,48,5,6,3,43,101,112,4,34,4,32]),U=32,I=64,T=32,R=q.length;var C=r(27054),B=r(21256),M=r(35495),O=r(98805);const P=new Uint8Array,H={ecdsa:u.y,ed25519:d.U,ethereum:u.y,sr25519:l.F},D={ecdsa:new Uint8Array([2]),ed25519:new Uint8Array([0]),ethereum:new Uint8Array([2]),sr25519:new Uint8Array([1])},V={ecdsa:(e,t)=>(0,p.y)(e,t,"blake2"),ed25519:h.P,ethereum:(e,t)=>
2(0,p.y)(e,t,"keccak"),sr25519:f.x},$={ecdsa:e=>e.length>32?(0,y.b)(e):e,ed25519:e=>e,ethereum:e=>20===e.length?e:(0,g.ij)((0,m.o)(e)),sr25519:e=>e};function L(e){return!e||(0,n.S)(e)}function N(e,t,r){return(0,y.b)((0,s.e)(t||"",r||"",e))}function F({toSS58:e,type:t},{publicKey:r,secretKey:n},u={},d=null,l){const p=(e,s)=>{const i=function(e,t,r){const n=Array.isArray(r)||void 0===r?r:[r],s=(0,S.g)(t,e,n),i=s.subarray(0,q.length);if(!(0,c.S)(i,q))throw new Error("Invalid encoding header found in body");let a=s.subarray(R,R+I),o=R+I,u=s.subarray(o,o+A.length);if(!(0,c.S)(u,A)&&(o=R+T,a=s.subarray(R,o),u=s.subarray(o,o+A.length),!(0,c.S)(u,A)))throw new Error("Invalid encoding divider found in body");const d=o+A.length;return{publicKey:s.subarray(d,d+U),secretKey:a}}(e,s||d,l);if(64===i.secretKey.length)r=i.publicKey,n=i.secretKey;else{const e=H[t](i.secretKey);r=e.publicKey,n=e.secretKey}},h=e=>(L(n)&&d&&p(e,d),d=function({publicKey:e,secretKey:t},r){if(!t)throw new Error("Expected a valid secretKey to be passed to encode");const n=(0,s.e)(q,t,A,e);if(!r)return n;const{params:i,password:a,salt:o}=(0,C.z)(r),{encrypted:c,nonce:u}=(0,B.V)(n,a.subarray(0,32));return(0,s.e)((0,M.e)(o,i),u,c)}({publicKey:r,secretKey:n},e),l=void 0,d),f=()=>{const n=$[t](r);return"ethereum"===t?(0,b.K)(n):e(n)};return{get address(){return f()},get addressRaw(){const e=$[t](r);return"ethereum"===t?e.slice(-20):e},get isLocked(){return L(n)},get meta(){return u},get publicKey(){return r},get type(){return t},decodePkcs8:p,derive:(s,i)=>{if("ethereum"===t)throw new Error("Unable to derive on this keypair");if(L(n))throw new Error("Cannot derive on a locked keypair");const{path:a}=(0,v.c)(s),o=(0,w.p)({publicKey:r,secretKey:n},a,t);return F({toSS58:e,type:t},o,i,null)},encodePkcs8:e=>h(e),lock:()=>{n=new Uint8Array},setMeta:e=>{u=(0,i.Z)({},u,e)},sign:(e,i={})=>{if(L(n))throw new Error("Cannot sign with a locked key pair");return(0,s.e)(i.withType?D[t]:P,V[t]((0,a.Y)(e),{publicKey:r,secretKey:n}))},toJson:e=>{const n=["ecdsa","ethereum"].includes(t)?20===r.length?(0,o.c)(r):(0,o.c)((0,x.R)(r)):f();return function(e,{address:t,meta:r},n,s){return(0,i.Z)((0,O.T)(n,["pkcs8",e],s),{address:t,meta:r})}(t,{address:n,meta:u},h(e),!!e)},unlock:e=>p(e),verify:(e,r,n)=>(0,k.D)(e,r,$[t]((0,a.Y)(n))).isValid,vrfSign:(e,i,o)=>{if(L(n))throw new Error("Cannot sign with a locked key pair");if("sr25519"===t)return(0,E.g)(e,{secretKey:n},i,o);const c=V[t]((0,a.Y)(e),{publicKey:r,secretKey:n});return(0,s.e)(N(c,i,o),c)},vrfVerify:(e,n,i,o,u)=>"sr25519"===t?(0,_.e)(e,n,r,o,u):(0,k.D)(e,(0,s.e)(D[t],n.subarray(32)),$[t]((0,a.Y)(i))).isValid&&
2(0,c.S)(n.subarray(0,32),N(n.subarray(32),o,u))}}},73917:(e,t,r)=>{r.d(t,{oK:()=>T});var n=r(48533),s=r(92580),i=r(74076),a=r(64021),o=r(36916),c=r(50528),u=r(46359),d=r(94175),l=r(41444),p=r(6851),h=r(2731),f=r(73547),y=r(8666),g=r(68257),m=r(73493),b=r(90107),v=r(31667),w=r(48358),x=r(55858),k=r(46610);class E{#oe={};add(e){return this.#oe[(0,d.m)(e.address).toString()]=e,e}all(){return Object.values(this.#oe)}get(e){const t=this.#oe[(0,d.m)(e).toString()];if(!t)throw new Error(`Unable to retrieve keypair '${(0,w.U)(e)||(0,i.vq)(e)?(0,x.c)((0,k.Y)(e)):e}'`);return t}remove(e){delete this.#oe[(0,d.m)(e).toString()]}}const _={ecdsa:e=>(0,o.y)(e),ed25519:e=>(0,c.U)(e),ethereum:e=>(0,o.y)(e),sr25519:e=>(0,u.F)(e)};function S({publicKey:e}){return e}class A{#ce;#ue;#de;decodeAddress=d.m;constructor(e={}){if(e.type=e.type||"ed25519",!["ecdsa","ethereum","ed25519","sr25519"].includes(e.type||"undefined"))throw new Error(`Expected a keyring type of either 'ed25519', 'sr25519', 'ethereum' or 'ecdsa', found '${e.type||"unknown"}`);this.#ce=new E,this.#de=e.ss58Format,this.#ue=e.type}get pairs(){return this.getPairs()}get publicKeys(){return this.getPublicKeys()}get type(){return this.#ue}addPair(e){return this.#ce.add(e)}addFromAddress(e,t={},r=null,n=this.type,i,a){const o=this.decodeAddress(e,i);return this.addPair((0,s.s)({toSS58:this.encodeAddress,type:n},{publicKey:o,secretKey:new Uint8Array},t,r,a))}addFromJson(e,t){return this.addPair(this.createFromJson(e,t))}addFromMnemonic(e,t={},r=this.type,n){return this.addFromUri(e,t,r,n)}addFromPair(e,t={},r=this.type){return this.addPair(this.createFromPair(e,t,r))}addFromSeed(e,t={},r=this.type){return this.addPair((0,s.s)({toSS58:this.encodeAddress,type:r},_[r](e),t,null))}addFromUri(e,t={},r=this.type,n){return this.addPair(this.createFromUri(e,t,r,n))}createFromJson({address:e,encoded:t,encoding:{content:r,type:a,version:o},meta:c},u){if("3"===o&&"pkcs8"!==r[0])throw new Error(`Unable to decode non-pkcs8 type, [${r.join(",")}] found}`);const d="0"!==o&&Array.isArray(r)?r[1]:this.type,p=Array.isArray(a)?a:[a];if(!["ed25519","sr25519","ecdsa","ethereum"].includes(d))throw new Error(`Unknown crypto type ${d}`);const h=(0,i.vq)(e)?(0,n.G)(e):this.decodeAddress(e,u),f=(0,i.vq)(t)?(0,n.G)(t):(0,l.tV)(t);return(0,s.s)({toSS58:this.encodeAddress,type:d},{publicKey:h,secretKey:new Uint8Array},c,f,p)}createFromPair(e,t={},r=this.type){return(0,s.s)({toSS58:this.encodeAddress,type:r},e,t,null)}createFromUri(e,t={},r=this.type,o){const c=e.startsWith("//")?`${v.g}${e}`:e,{derivePath:u,password:d,path:l,phrase:m}=(0,p.Q)(c);let b;const w=(0,i.vq)(m,256);if(w)b=(0,n.G)(m);else{const e=m.split(" ");if([12,15,18,21,24].includes(e.length))b="ethereum"===r?(0,h.r)(m,"",!1,64):(0,f.S)(m,d,o);else{if(m.length>32)throw new Error("specified phrase is not a valid mnemonic and is invali
2d as a raw seed at > 32 bytes");b=(0,a.d)(m.padEnd(32))}}const x="ethereum"===r?w?_[r](b):(0,y.d)(b,u.substring(1)):(0,g.p)(_[r](b),l,r);return(0,s.s)({toSS58:this.encodeAddress,type:r},x,t,null)}encodeAddress=(e,t)=>"ethereum"===this.type?(0,m.K)(e):(0,b.m)(e,t??this.#de);getPair(e){return this.#ce.get(e)}getPairs(){return this.#ce.all()}getPublicKeys(){return this.#ce.all().map(S)}removePair(e){this.#ce.remove(e)}setSS58Format(e){this.#de=e}toJson(e,t){return this.#ce.get(e).toJson(t)}}const q=[{p:"0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",s:"0x98319d4ff8a9508c4bb0cf0b5a78d760a0b2082c02775e6e82370816fedfff48925a225d97aa00682d6a59b95b18780c10d7032336e88f3442b42361f4a66011",seed:"Alice",type:"sr25519"},{p:"0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",s:"0xe8da6c9d810e020f5e3c7f5af2dea314cbeaa0d72bc6421e92c0808a0c584a6046ab28e97c3ffc77fe12b5a4d37e8cd4afbfebbf2391ffc7cb07c0f38c023efd",seed:"Alice//stash",type:"sr25519"},{p:"0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226a
2a4794f26a48",s:"0x081ff694633e255136bdb456c20a5fc8fed21f8b964c11bb17ff534ce80ebd5941ae88f85d0c1bfc37be41c904e1dfc01de8c8067b0d6d5df25dd1ac0894a325",seed:"Bob",type:"sr25519"},{p:"0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",s:"0xc006507cdfc267a21532394c49ca9b754ca71de21e15a1cdf807c7ceab6d0b6c3ed408d9d35311540dcd54931933e67cf1ea10d46f75408f82b789d9bd212fde",seed:"Bob//stash",type:"sr25519"},{p:"0x90b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22",s:"0xa8f2d83016052e5d6d77b2f6fd5d59418922a09024cda701b3c34369ec43a7668faf12ff39cd4e5d92bb773972f41a7a5279ebc2ed92264bed8f47d344f8f18c",seed:"Charlie",type:"sr25519"},{p:"0x306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20",s:"0x20e05482ca4677e0edbc58ae9a3a59f6ed3b1a9484ba17e64d6fe8688b2b7b5d108c4487b9323b98b11fe36cb301b084e920f7b7895536809a6d62a451b25568",seed:"Dave",type:"sr25519"},{p:"0xe659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e",s:"0x683576abfd5dc35273e4264c23095a1bf21c14517bece57c7f0cc5c0ed4ce06a3dbf386b7828f348abe15d76973a72009e6ef86a5c91db2990cb36bb657c6587",seed:"Eve",type:"sr25519"},{p:"0x1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07c",s:"0xb835c20f450079cf4f513900ae9faf8df06ad86c681884122c752a4b2bf74d4303e4f21bc6cc62bb4eeed5a9cce642c25e2d2ac1464093b50f6196d78e3a7426",seed:"Ferdie",type:"sr25519"}],U=[{name:"Alith",p:"0x02509540919faacf9ab52146c9aa40db68172d83777250b28e4679176e49ccdd9f",s:"0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133",type:"ethereum"},{name:"Baltathar",p:"0x033bc19e36ff1673910575b6727a974a9abd80c9a875d41ab3e2648dbfb9e4b518",s:"0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b",type:"ethereum"},{name:"Charleth",p:"0x0234637bdc0e89b5d46543bcbf8edff329d2702bc995e27e9af4b1ba009a3c2a5e",s:"0x0b6e18cafb6ed99687ec547bd28139cafdd2bffe70e6b688025de6b445aa5c5b",type:"ethereum"},{name:"Dorothy",p:"0x02a00d60b2b408c2a14c5d70cdd2c205db8985ef737a7e55ad20ea32cc9e7c417c",s:"0x39539ab1876910bbf3a223d84a29e28f1cb4e2e456503e7e91ed39b2e7223d68",type:"ethereum"},{name:"Ethan",p:"0x025cdc005b752651cd3f728fb9192182acb3a9c89e19072cbd5b03f3ee1f1b3ffa",s:"0x7dce9bc8babb68fec1409be38c8e1a52650206a7ed90ff956ae8a6d15eeaaef4",type:"ethereum"},{name:"Faith",p:"0x037964b6c9d546da4646ada28a99e34acaa1d14e7aba861a9055f9bd200c8abf74",s:"0xb9d2ea9a615f3165812e8d44de0d24da9bbd164b65c4f0573e1ce2c8dbd9c8df",type:"ethereum"}];function I(e,t){if(!e&&!t)throw new Error("Testing pair should have either a name or a seed");return{isTesting:!0,name:e||t?.replace("//","_").toLowerCase()}}function T(e={},t=!0){const r=new A(e),i="ethereum"===e.type?U:q;for(const{name:a,p:o,s:c,seed:u,type:d}of i){const i=I(a,u);(t||a||!u?r.addPair((0,s.s)({toSS58:r.encodeAddress,type:d},{publicKey:(0,n.G)(o),secretKey:(0,n.G)(c)},i)):r.addFromUri(u,i,e.type)).lock=()=>{}}return r}},70392:(e,t,r)=>{r.d(t,{A:()=>n});const n={acala:["0xfc41b9bd8ef8fe53d58c7ea67c794c7ec9a73daf05e6d54b14ff6342c99ba64c"],ajuna:["0xe358eb1d11b31255a286c12e44fe6780b7edb171d657905a97e39f71d9c6c3ee"],"aleph-node":["0x70255b4d28de0fc4e1a193d7e175ad1ccef431598211c55538f1018651a0344e"],astar:["0x9eb76c5184c4ab8679d2d5d819fdf90b9c001403e9e17da2e14b6d8aec4029c6"],basilisk:["0xa85cfb9b9fd4d622a5b28289a02347af987d8f73fa3108450e2b4a11c1ce5755"],bifrost:["0x262e1b2ad728475fd6fe88e62d34c200abe6fd693931ddad144059b1eb884e5b"],"bifrost-kusama":["0x9f28c6a68e0fc9646eff64935684f6eeeece527e37bbe1f213d22caa1d9d6bed"],bittensor:["0x2f0555cc76fc2840a25a6ea3b9637146806f1f44b090c175ffde2a7e5ab36c03"],centrifuge:["0xb3db41421702df9a7fcac62b53ffeac85f7853cc4e689e0b93aeb3db18c09d82","0x67dddf2673b69e5f875f6f25277495834398eafd67f492e09f3f3345e003d1b5"],cere:["0x81443836a9a24caaa23f1241897d1235717535711d1d3fe24eae4fdc942c092c"],composable:["0xdaab8df776eb52ec604a5df5d388bb62a050a0aaec4556a64265b9d42755552d"],creditcoin3:["0x4436a7d64e363df85e065a894721002a86643283f9707338bf195d360ba2ee71","0xfc4ec97a1c1f119c4353aecb4a17c7c0cf7b40d5d660143d8bad9117e9866572","0xfc9df99a665f964aed6649f275055e54df5e3420489538ed31d7788f53d11ef6"],darwinia:["0xe71578b37a7c799b0ab4ee87ffa6f059a6b98f71f06fb8c84a8d88013a548ad6"],dentnet:["0x0313f6a011d128d22f996703cbab05162e2fdc9e031493314fe6db79979c5ca7"],"dock-mainnet":["0x6bfe24dca2a3be10f22212678ac13a6446ec764103c0f3471c71609eac384aae","0xf73467c6544aa68df2ee546b135f955c46b90fa627e9b5d7935f41061bb8a5a9"],edgeware:["0x742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b"],encointer:["0x7dd99936c1e9e6d1ce7d90eb6f33bea8393b4bf87677d675aa63c9cb3e8c5b5b"],enjin:["0xd8761d3c88f26dc12875c00d3165f7d67243d56fc85b4cf19937601a7916e5a9"],equilibrium:["0x6f1a800de3daff7f5e037ddf66ab22ce03ab91874debeddb1086f5f7dbd48925"],frequency:["0x4a587bf17a404e3572747add7aab7bbe56e805a5479c6c436f07f36fcc8d3ae1"],genshiro:["0x9b8cefc0eb5c568b527998bdd76c184e2b76ae561be76e4667072230217ea243"],hydradx:["0xafdc188f45c71dacbaa0b62e16a91f726c7b8699a9748cdf715459de6b7f366d","0xd2a620c27ec5cbc5621ff9a522689895074f7cca0d08e7134a7804e1a3ba86fc","0x10af6e84234477d84dc572bac0789813b254aa490767ed06fb9591191d1073f9","0x3d75507dd46301767e601265791da1d9cb47b6ebc94e87347b635e5bf58bd047","0x0ed32bfcab4a83517fac88f2aa7cbc2f88d3ab93be9a12b6188a036bf8a943c2"],integritee:["0xcdedc8eadbfa209d3f207bba541e57c3c58a667b05a2e1d1e86353c9000758da","0xe13e7af377c64e83f95e0d70d5e5c3c01d697a84538776c5b9bbe0e7d7b6034c"],"interlay-parachain":["0xbf88efe70e9e0e916416e8bed61f2b45717f517d7f3523e33c7b001e5ffcbc72"],karura:["0xbaf5aabe40646d11f0ee8abbdc64f4a4b7674925cba08e4a05ff9ebed6e2126b"],khala:["0xd43540ba6d3eb4897c28a77d48cb5b729fea37603cbbfc7a86a73b72adb3be8d"],kulupu:["0xf7a99d3cb92853d00d5275c971c132c074636256
2583fee53b3bbe60d7b8769ba"],kusama:["0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe","0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636","0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf"],liberland:["0x6bd89e052d67a45bb60a9a23e8581053d5e0d619f15cb9865946937e690c42d6"],matrixchain:["0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615"],mythos:["0xf6ee56e9c5277df5b4ce6ae9983ee88f3cbed27d31beeb98f9f84f997a1ab0b9"],nodle:["0x97da7ede98d7bad4e36b4d734b6055425a3be036da2a332ea5a7037656427a21"],origintrail:["0xe7e0962324a3b86c83404dbea483f25fb5dab4c224791c81b756cfc948006174"],p3d:["0x6c5894837ad89b6d92b114a2fb3eafa8fe3d26a54848e3447015442cd6ef4e66"],parallel:["0xe61a41c53f5dcd0beb09df93b34402aada44cb05117b71059cce40a2723a4e97"],peaq:["0xd2a5d385932d1f650dae03ef8e2748983779ee342c614f80854d32b8cd8fa48c"],pendulum:["0x5d3c298622d5634ed019bf61ea4b71655030015bde9beb0d6a24743714462c86"],phala:["0x1bb969d85965e4bb5a651abbedf21a54b6b31a21f66b5401cc3f1e286268d736"],picasso:["0x6811a339673c9daa897944dcdac99c6e2939cc88245ed21951a0a3c9a2be75bc","0xe8e7f0f4c4f5a00720b4821dbfddefea7490bcf0b19009961cc46957984e2c1c"],polimec:["0x7eb9354488318e7549c722669dcbdcdc526f1fef1420e7944667212f3601fdbd"],polkadex:["0x3920bcb4960a1eef5580cd5367ff3f430eef052774f78468852f7b9cb39f8a3c"],polkadot:["0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3"],polymesh:["0x6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063"],quartz:["0xcd4d732201ebe5d6b014edda071c4203e16867305332301dc8d092044b28e554"],rococo:["0x6408de7737c59c238890533af25896a2c20608d8b380bb01029acb392781063e","0xaaf2cd1b74b5f726895921259421b534124726263982522174147046b8827897","0x037f5f3c8e67b314062025fc886fcd6238ea25a4a9b45dce8d246815c9ebe770","0xc196f81260cf1686172b47a79cf002120735d7cb0eb1474e8adce56618456fff","0xf6e9983c37baf68846fedafe21e56718790e39fb1c582abc408b81bc7b208f9a","0x5fce687da39305dfe682b117f0820b319348e8bb37eb16cf34acbf6a202de9d9","0xe7c3d5edde7db964317cd9b51a3a059d7cd99f81bdbce14990047354334c9779","0x1611e1dbf0405379b861e2e27daa90f480b2e6d3682414a80835a52e8cb8a215","0x343442f12fa715489a8714e79a7b264ea88c0d5b8c66b684a7788a516032f6b9","0x78bcd530c6b3a068bc17473cf5d2aff9c287102bed9af3ae3c41c33b9d6c6147","0x47381ee0697153d64404fc578392c8fd5cba9073391908f46c888498415647bd","0x19c0e4fa8ab75f5ac7865e0b8f74ff91eb9a100d336f423cd013a8befba40299"],sora:["0x7e4e32d0feafd4f9c9414b0be86373f9a1efa904809b683453a9af6856d38ad5"],stafi:["0x290a4149f09ea0e402c74c1c7e96ae4239588577fe78932f94f5404c68243d80"],statemine:["0x48239ef607d7928874027a43a67689209727dfb3d3dc5e5b03a39bdc2eda771a"],statemint:["0x68d56f15f85d3136970ec16946040bc1752654e906147f7e43e9d539d7c3de2f"],subsocial:["0x0bd72c1c305172e1275278aaeb3f161e02eccb7a819e63f62d47bd53a28189f8"],ternoa:["0x6859c81ca95ef624c9dfe4dc6e3381c33e5d6509e35e147092bfbc780f777c4e"],unique:["0x84322d9cddbf35088f1e54e9a85c967a41a56a4f43445768125e61af166c7d31"],vara:["0xfe1b4c55fd4d668101126434206571a7838a8b6b93a6d1b95d607e78e6c53763"],vtb:["0x286bc8414c7000ce1d6ee6a834e29a54c1784814b76243eb77ed0b2c5573c60f","0x7483b89572fb2bd687c7b9a93b242d0b237f9aba463aba07ec24503931038aaa"],westend:["0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e"],xxnetwork:["0x50dd5d206917bf10502c68fb4d18a59fc8aa31586f4e8856b493e43544aa82aa"],zeitgeist:["0x1bf2a2ecb4a868de66ea8610f2ce7c8c43706561b6476031315f6640fe38e060"]}},7404:(e,t,r)=>{r.d(t,{Y:()=>n});const n={acala:787,ajuna:354,"aleph-node":643,astar:810,bifrost:788,"bifrost-kusama":788,bittensor:354,centrifuge:747,composable:354,creditcoin3:354,darwinia:354,dentnet:734,"dock-mainnet":594,edgeware:523,encointer:434,enjin:1155,equilibrium:99999997,frequency:2091,genshiro:99999996,hydradx:354,integritee:2015,"interlay-parachain":354,karura:686,khala:434,kusama:434,liberland:767,matrixchain:1155,mythos:60,nodle:1003,origintrail:354,parallel:354,peaq:3338,pendulum:354,phala:354,picasso:434,polimec:3344,polkadex:799,polkadot:354,polymesh:595,quartz:631,sora:617,stafi:907,statemine:434,statemint:354,ternoa:995,unique:661,vara:4976,vtb:694,xxnetwork:1955,zeitgeist:354}},72570:(e,t,r)=>{r.d(t,{FA:()=>d,oc:()=>l,uG:()=>p});var n=r(18281),s=r(7404),i=r(70392);const a={centrifuge:"polkadot",kusama:"polkadot",polkadot:"polkadot",sora:"polkadot",statemine:"polkadot",statemint:"polkadot",westmint:"polkadot"}
2,o={"":!0,"cess-testnet":!0,"dock-testnet":!0,jupiter:!0,"mathchain-testnet":!0,p3dt:!0,subspace_testnet:!0,"zero-alphaville":!0},c=[0,2,42],u=["testnet"],d=n.Z.map((function(e){const t=e.network||"",r=t.replace(/_/g,"-").split("-"),n=e;return n.slip44=s.Y[t],n.hasLedgerSupport=!!n.slip44,n.genesisHash=i.A[t]||[],n.icon=a[t]||"substrate",n.isTestnet=!!o[t]||u.includes(r[r.length-1]),n.isIgnored=n.isTestnet||!(e.standardAccount&&e.decimals?.length&&e.symbols?.length)&&42!==e.prefix,n})),l=d.filter((function(e){return!e.isIgnored&&!!e.network})).sort((function(e,t){const r=c.includes(e.prefix);return r===c.includes(t.prefix)?r?0:e.displayName.localeCompare(t.displayName):r?-1:1})),p=l.filter((function({genesisHash:e,prefix:t}){return!!e.length||42===t}))},91087:(e,t,r)=>{r.d(t,{b:()=>n});const n={name:"@polkadot/networks",path:new URL("file:///home/runner/work/apps/apps/node_modules/@polkadot/networks/packageInfo.js").pathname.substring(0,new URL("file:///home/runner/work/apps/apps/node_modules/@polkadot/networks/packageInfo.js").pathname.lastIndexOf("/")+1),type:"esm",version:"14.0.3"}},2727:(e,t,r)=>{r.d(t,{fF:()=>d}),r(70732);var n=r(65417),s=r(94175),i=r(95551);const a="https://polkadot.js.org/phishing/address.json",o=27e5,c={end:0,list:{},u8a:[]};async function u(e=!0){const t=Date.now();if(e&&t<c.end)return c;const r=await(n=a,async function(e,t=2e3){const r=new AbortController;let n=!1;const s=setTimeout((()=>{console.log(`Timeout on ${e}`),n=!0,r.abort()}),t);try{const t=await(0,i.h)(e,{signal:r.signal});return clearTimeout(s),t}catch(e){throw n||clearTimeout(s),e}}(n,undefined).then((e=>e.json())));var n;return c.end=t+o,c.list=r,c.u8a=Object.entries(r).map((([e,t])=>[e,t.map((e=>(0,s.m)(e)))])),c}async function d(e,t=!0){try{const r=(0,s.m)(e),i=(await u(t)).u8a.find((([,e])=>e.some((e=>(0,n.S)(e,r)))));return i?.[0]||null}catch{return null}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.