From 1abc6baae5bd9e9a466f59c024773f13f4c3646d Mon Sep 17 00:00:00 2001 From: Kami Date: Sat, 6 Jan 2024 02:49:11 +0330 Subject: [PATCH] fix FF issue --- docs/comm.c005d73dc9c68511.js | 4129 +++++++++++++++++++++++++++++++++ docs/index.html | 2 +- docs/modu.daa0d0d53666b88c.js | 1 + docs/page.89c997cfce551273.js | 1935 +++++++++++++++ 4 files changed, 6066 insertions(+), 1 deletion(-) create mode 100644 docs/comm.c005d73dc9c68511.js create mode 100644 docs/modu.daa0d0d53666b88c.js create mode 100644 docs/page.89c997cfce551273.js diff --git a/docs/comm.c005d73dc9c68511.js b/docs/comm.c005d73dc9c68511.js new file mode 100644 index 000000000000..9f9845194bd1 --- /dev/null +++ b/docs/comm.c005d73dc9c68511.js @@ -0,0 +1,4129 @@ +"use strict";(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[136],{34777:(e,t,n)=>{n.r(t),n.d(t,{ApiCtxRoot:()=>q,DEFAULT_AUX:()=>z,DEFAULT_DECIMALS:()=>M,DEFAULT_SS58:()=>F});var a=n(52322),s=n(13649),i=n(2784),r=n(23729),o=n.n(r),l=n(1719),c=n(21899),d=n(64176),u=n(36733),m=n(3919),h=n(16265),p=n(20525),g=n(14534),f=n(50265),b=n(86135),x=n(47564),A=n(11677);const v=(0,x.Rf)(((e,t)=>t?.toString()||e)),w=(0,A.e)("useEndpoint",(function(e){return(0,i.useMemo)((()=>function(e){return v.find((({value:t})=>t===e))||null}(e)),[e])}));var y=n(18837),j=n(87206);class C{#e;#t;#n;constructor(e,t,n){this.#e=t,this.#t=n,this.#n=e}async signPayload(e){return new Promise(((t,n)=>{this.#e(this.#n,e,((e,a)=>{a?t(a):n(new Error("Unable to sign"))}))}))}update(e,t){t instanceof this.#n.createClass("Hash")?this.#t(e,"sent",t.toHex()):this.#t(e,t.status.type.toLowerCase(),t)}}var k=n(69187),N=n(16039),E=n(33403),S=n(92730),I=n(30495),B=n(11147),D=n(65968),L=n(68145),V=n(36956),P=n(95267),T=n(81369);const M=P.statics.registry.createType("u32",12),F=P.statics.registry.createType("u32",L.c.prefix),z=["Aux1","Aux2","Aux3","Aux4","Aux5","Aux6","Aux7","Aux8","Aux9"],Z=[],R={hasInjectedAccounts:!1,isApiReady:!1};async function $(e){try{return await e,(await(0,g.vK)()).map((({address:e,meta:t},n)=>({address:e,meta:(0,E.Z)({},t,{name:`${t.name||"unknown"} (${"polkadot-js"===t.source?"extension":t.source})`,whenCreated:n})})))}catch(e){return console.error("web3Accounts",e),[]}}function q({apiUrl:e,children:t,isElectron:r,store:x}){const{queuePayload:A,queueSetTxStatus:v}=(0,b.L)(),[L,q]=(0,i.useState)(R),[U,H]=(0,i.useState)(!1),[Q,O]=(0,i.useState)(!1),[W,G]=(0,i.useState)(null),[J,K]=(0,i.useState)(),Y=w(e),X=(0,i.useMemo)((()=>Y?.valueRelay&&(0,D.h)(Y.paraId)&&Y.paraId<2e3?Y.valueRelay:null),[Y]),_=(0,y.J)(X),ee=(0,i.useMemo)((()=>function(e,t){return(n,a)=>`${t?"https://polkadot.js.org/apps/":`${window.location.origin}${window.location.pathname}`}?rpc=${encodeURIComponent(a||e)}#${n}`}(e,r)),[e,r]),te=(0,i.useMemo)((()=>(0,E.Z)({},L,{api:P.statics.api,apiEndpoint:Y,apiError:W,apiRelay:_,apiUrl:e,createLink:ee,extensions:J,isApiConnected:U,isApiInitialized:Q,isElectron:r,isWaitingInjected:!J})),[W,ee,J,U,Q,r,L,Y,_,e]);return(0,i.useEffect)((()=>{const t=e=>{console.error(e),G(e.message)};(async function(e,t,a){const i=function(){const e=(0,T.decodeUrlTypes)()||o().get("types",{}),t=Object.keys(e);return t.length&&console.log("Injected types:",t.join(", ")),e}(),r=e.startsWith("light://");try{const a=r?await async function(e){const[t,a,i]=e.split("/");if("substrate-connect"!==t)throw new Error(`Cannot connect to non substrate-connect protocol ${e}`);if(!V.relaySpecs[a]||i&&!V.lightSpecs[a]?.[i])throw new Error(`Unable to construct light chain ${e}`);const r=new l.x(s,V.relaySpecs[a]);if(!i)return r;const o=await n(29038)(`${V.lightSpecs[a][i]}`);return new l.x(s,JSON.stringify(o.default),r)}(e.replace("light://","")):new c.U(e);P.statics.api=new d.G({provider:a,registry:P.statics.registry,signer:t,types:i,typesBundle:p.UD}),r&&await a.connect()}catch(e){a(e)}return i})(e,new C(P.statics.registry,A,v),t).then((e=>{P.statics.api.on("connected",(()=>H(!0))),P.statics.api.on("disconnected",(()=>H(!1))),P.statics.api.on("error",t),P.statics.api.on("ready",(()=>{const n=(0,g.$y)("polkadot-js/apps");n.then(K).catch(console.error);const a=!!location.href.includes("keyring-type=ethereum");(async function(e,t,n,a,s,i=!1){P.statics.registry.register(s);const{injectedAccounts:r,properties:o,systemChain:l,systemChainType:c,systemName:d,systemVersion:p}=await async function(e,t){const[n,a,s,i,r]=await Promise.all([e.rpc.system.chain(),e.rpc.system.chainType?e.rpc.system.chainType():Promise.resolve(P.statics.registry.createType("ChainType","Live")),e.rpc.system.name(),e.rpc.system.version(),$(t)]);return{injectedAccounts:r.filter((({meta:{source:e}})=>!Z.includes(e))),properties:P.statics.registry.createType("ChainProperties",{ss58Format:e.registry.chainSS58,tokenDecimals:e.registry.chainDecimals,tokenSymbol:e.registry.chainTokens}),systemChain:(n||"").toString(),systemChainType:a,systemName:s.toString(),systemVersion:i.toString()}}(e,n),g=o.ss58Format.unwrapOr(F).toNumber(),b=-1===N.X.prefix?g:N.X.prefix,x=o.tokenSymbol.unwrapOr([S.a.getDefaults().unit,...z]),A=o.tokenDecimals.unwrapOr([M]),v=h.W.includes(e.runtimeVersion.specName.toString())||i,w=c.isDevelopment||c.isLocal||(0,I.s)(l);console.log(`chain: ${l} (${c.toString()}), ${(0,B.P)(o)}`),P.statics.registry.setChainProperties(P.statics.registry.createType("ChainProperties",{ss58Format:b,tokenDecimals:A,tokenSymbol:x})),S.a.setDefaults({decimals:A.map((e=>e.toNumber())),unit:x[0].toString()}),f.k.setAbbr(x[0].toString()),function(){try{return!!k.Nn.keyring}catch{return!1}}()||k.Nn.loadAll({genesisHash:e.genesisHash,genesisHashAdd:t&&(0,D.h)(t.paraId)&&t.paraId<2e3&&t.genesisHashRelay?[t.genesisHashRelay]:[],isDevelopment:w,ss58Format:b,store:a,type:v?"ethereum":"ed25519"},r);const y=Object.keys(e.tx)[0],j=Object.keys(e.tx[y])[0],C=e.tx[y][j],E=e.tx.system?.setCode||C;return(0,u.u)(e.genesisHash.toHex(),m.A),{apiDefaultTx:C,apiDefaultTxSudo:E,chainSS58:g,hasInjectedAccounts:0!==r.length,isApiReady:!0,isDevelopment:w,isEthereum:v,specName:e.runtimeVersion.specName.toString(),specVersion:e.runtimeVersion.specVersion.toString(),systemChain:l,systemName:d,systemVersion:p}})(P.statics.api,Y,n,x,e,a).then(q).catch(t)})),O(!0)})).catch(t)}),[Y,e,A,v,x]),te.isApiInitialized?(0,a.jsx)(j.E.Provider,{value:te,children:t}):null}},94356:(e,t,n)=>{n.r(t),n.d(t,{default:()=>o});var a=n(52322),s=n(2784),i=n(87206),r=n(48731);function o(e,t={}){class n extends s.PureComponent{component=s.createRef();render(){return(0,a.jsx)(i.E.Consumer,{children:n=>((0,r.hu)(n?.api,"Application root must be wrapped inside 'react-api/Api' to provide API context"),(0,a.jsx)(e,{...t,...n,...this.props,ref:this.component}))})}}return n}},98727:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var a=n(52322),s=n(2784),i=n(17965),r=n(1346),o=n(17751),l=n(48731),c=n(80522),d=n(41186),u=n(94356);const m=()=>{},h=()=>!1,p={};function g(e,{at:t,atProp:n,callOnResult:g,fallbacks:f,isMulti:b=!1,paramName:x,paramPick:A,paramValid:v=!1,params:w=[],propName:y,skipIf:j=h,transform:C=c.default,withIndicator:k=!1}={}){return c=>{class h extends s.Component{state={callResult:void 0,callUpdated:!1,callUpdatedAt:0};destroy;isActive=!1;propName;timerId=-1;constructor(t){super(t);const[,n,a]=e.split(".");this.propName=`${n}_${a}`}componentDidUpdate(e){const t=this.getParams(e),n=this.getParams(this.props);this.isActive&&!(0,d.isEqual)(n,t)&&this.subscribe(n).then(m).catch(m)}componentDidMount(){this.isActive=!0,k&&(this.timerId=window.setInterval((()=>{const e=Date.now()-(this.state.callUpdatedAt||0)<=1500;e!==this.state.callUpdated&&this.nextState({callUpdated:e})}),500)),(0,i.Y)((()=>{this.subscribe(this.getParams(this.props)).then(m).catch(m)}))}componentWillUnmount(){this.isActive=!1,this.unsubscribe().then(m).catch(m),-1!==this.timerId&&clearInterval(this.timerId)}nextState(e){this.isActive&&this.setState(e)}getParams(e){const a=A?A(e):x?e[x]:void 0;return n&&(t=e[n]),!v&&x&&((0,r.o)(a)||(0,o.F)(a))?[!1,[]]:[!0,(0,r.o)(a)?w:w.concat(Array.isArray(a)&&!a.toU8a?a:[a])]}constructApiSection=e=>{const{api:n}=this.props,[a,s,i,...r]=e.split(".");return(0,l.hu)(a.length&&s.length&&i.length&&0===r.length,`Invalid API format, expected .
., found ${e}`),(0,l.hu)(["consts","rpc","query","derive"].includes(a),`Unknown api.${a}, expected consts, rpc, query or derive`),(0,l.hu)(!t||"query"===a,"Only able to do an 'at' query on the api.query interface"),[n[a][s],a,s,i]};getApiMethod(t){if("subscribe"===e){const[e,...n]=t;return[e,n,"subscribe"]}const n=[e].concat(f||[]).map(this.constructApiSection),[a,s,i,c]=n.find((([e])=>!!e))||[{},n[0][1],n[0][2],n[0][3]];(0,l.hu)(a?.[c],`Unable to find api.${s}.${i}.${c}`);const d=a[c].meta;if("query"===s&&d?.type.isMap){const e=t[0];(0,l.hu)(!(0,r.o)(e)&&!(0,o.F)(e)||d.type.asMap.kind.isLinkedMap,`${d.name} expects one argument`)}return[a[c],t,c.startsWith("subscribe")?"subscribe":s]}async subscribe([a,s]){if(!a||j(this.props))return;const{api:i}=this.props;let r;await i.isReady;try{(0,l.hu)(t||!n,"Unable to perform query on non-existent at hash"),r=this.getApiMethod(s)}catch(t){p[t.message]||(console.warn(e,"::",t),p[t.message]=!0)}if(!r)return;const[o,c,d]=r,u=e=>this.triggerUpdate(this.props,e);await this.unsubscribe();try{["derive","subscribe"].includes(d)||"query"===d&&!t&&!n?this.destroy=b?await o.multi(c,u):await o(...c,u):u("consts"===d?o:t?await o.at(t,...c):await o(...c))}catch{}}async unsubscribe(){this.destroy&&(this.destroy(),this.destroy=void 0)}triggerUpdate(e,t){try{const n=(e.transform||C)(t);if(!this.isActive||(0,d.isEqual)(n,this.state.callResult))return;(0,d.triggerChange)(n,g,e.callOnResult),this.nextState({callResult:n,callUpdated:!0,callUpdatedAt:Date.now()})}catch{}}render(){const{callResult:e,callUpdated:t,callUpdatedAt:n}=this.state,s={...this.props,callUpdated:t,callUpdatedAt:n};return(0,r.o)(e)||(s[y||this.propName]=e),(0,a.jsx)(c,{...s})}}return(0,u.default)(h)}}},3364:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var a=n(52322),s=(n(2784),n(98727));function i(e,t={}){return(n,i={})=>(0,s.default)(e,{...t,propName:"callResult"})((function({callResult:e,callUpdated:t,children:s,className:r=i.className,label:o=""}){return(0,a.jsxs)("div",{...i,className:[r||"",t?"rx--updated":void 0].join(" "),children:[o,n(e),s]})}))}},5246:(e,t,n)=>{n.r(t),n.d(t,{default:()=>s});var a=n(98727);function s(...e){return t=>e.reverse().reduce(((e,t)=>Array.isArray(t)?(0,a.default)(...t)(e):(0,a.default)(t)(e)),t)}},69356:(e,t,n)=>{n.r(t),n.d(t,{onlyOnApp:()=>c.onlyOnApp,onlyOnWeb:()=>c.onlyOnWeb,withApi:()=>a.default,withCall:()=>s.default,withCallDiv:()=>i.default,withCalls:()=>r.default,withMulti:()=>o.default,withObservable:()=>l.default});var a=n(94356),s=n(98727),i=n(3364),r=n(5246),o=n(60028),l=n(33989),c=n(35475)},60028:(e,t,n)=>{function a(e,...t){return t.reverse().reduce(((e,t)=>t(e)),e)}n.r(t),n.d(t,{default:()=>a})},33989:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var a=n(52322),s=n(2784),i=n(77984),r=n(47009),o=n(35120),l=n(80522),c=n(41186);function d(e,{callOnResult:t,propName:n="value",transform:d=l.default}={}){return(l,u={},m)=>{class h extends s.Component{isActive=!0;state={callResult:void 0,callUpdated:!1,callUpdatedAt:0,subscriptions:[]};componentDidMount(){this.setState({subscriptions:[e.pipe((0,i.U)(d),(0,r.K)((()=>(0,o.of)(void 0)))).subscribe((e=>this.triggerUpdate(this.props,e))),(0,c.intervalObservable)(this)]})}componentWillUnmount(){this.isActive=!1,this.state.subscriptions.forEach((e=>e.unsubscribe()))}triggerUpdate=(e,n)=>{try{if(!this.isActive||(0,c.isEqual)(n,this.state.callResult))return;(0,c.triggerChange)(n,t,e.callOnResult||u.callOnResult),this.setState({callResult:n,callUpdated:!0,callUpdatedAt:Date.now()})}catch(e){console.error(this.props,e)}};render(){const{children:e}=this.props,{callResult:t,callUpdated:s,callUpdatedAt:i}=this.state,r={...u,...this.props,callUpdated:s,callUpdatedAt:i,[n]:t};return(0,a.jsxs)(l,{...r,children:[m?.(t),e]})}}return h}}},35475:(e,t,n)=>{n.r(t),n.d(t,{onlyOnApp:()=>r,onlyOnWeb:()=>i});var a=n(41186);const s=e=>t=>(0,a.getEnvironment)()===e?t:()=>null,i=s("web"),r=s("app")},57139:(e,t,n)=>{n.r(t),n.d(t,{ApiCtxRoot:()=>a.ApiCtxRoot,DEFAULT_DECIMALS:()=>a.DEFAULT_DECIMALS,DEFAULT_SS58:()=>a.DEFAULT_SS58,statics:()=>i.statics,withApi:()=>s.withApi,withCallDiv:()=>s.withCallDiv,withCalls:()=>s.withCalls,withMulti:()=>s.withMulti,withObservable:()=>s.withObservable});var a=n(34777),s=n(69356),i=n(95267)},36956:(e,t,n)=>{n.r(t),n.d(t,{lightSpecs:()=>r,relaySpecs:()=>o});var a=n(13649),s=n(37178),i=n(15299);const r=Object.entries({kusama:s.specs,polkadot:i.specs}).reduce(((e,[t,n])=>(e[t]=n.reduce(((e,n)=>(e[n]=`./light/${t}/${n}.json`,e)),{}),e)),{}),o={kusama:a.WellKnownChain.ksmcc3,polkadot:a.WellKnownChain.polkadot,rococo:a.WellKnownChain.rococo_v2_2,westend:a.WellKnownChain.westend2}},37178:(e,t,n)=>{n.r(t),n.d(t,{specs:()=>a});const a=["gm","shiden","tinkernet"]},15299:(e,t,n)=>{n.r(t),n.d(t,{specs:()=>a});const a=["astar"]},95267:(e,t,n)=>{n.r(t),n.d(t,{statics:()=>a});const a={api:void 0,registry:new(n(35562).P)}},80522:(e,t,n)=>{function a(e,t){return e}n.r(t),n.d(t,{default:()=>a})},81369:(e,t,n)=>{n.r(t),n.d(t,{decodeUrlTypes:()=>d,encodeUrlTypes:()=>u});var a=n(13824),s=n(85168),i=n(16039),r=n(48731),o=n(56623),l=n(64021),c=n(41444);function d(){const e=s.Z.parse(location.href.split("?")[1]);if(e.types)try{(0,r.hu)(!Array.isArray(e.types),"Expected a single type specification");const t=e.types.split("#"),n=(0,c.tV)(decodeURIComponent(t[0])),s=(0,a.HT)(n);return JSON.parse((0,o.z)(s))}catch(e){console.error(e)}return null}function u(e){const t=(0,l.d)(JSON.stringify(e)),n=(0,a.iZ)(t,{level:9}),s=(0,c.h$)(n);return`${window.location.origin}${window.location.pathname}?rpc=${encodeURIComponent(i.X.apiUrl)}&types=${encodeURIComponent(s)}`}},68372:(e,t,n)=>{n.r(t),n.d(t,{getEnvironment:()=>s});var a=n(34406);function s(){return a?.versions?.electron||"renderer"===window?.process?.type||navigator?.userAgent?.indexOf("Electron")>=0?"app":"web"}},77809:(e,t,n)=>{async function a(e,t,n){return Promise.all(n.map((n=>e(n,...t)))).then((e=>e.map(((e,t)=>[n[t],e]))))}n.r(t),n.d(t,{getHistoric:()=>a})},41186:(e,t,n)=>{n.r(t),n.d(t,{getEnvironment:()=>a.getEnvironment,getHistoric:()=>s.getHistoric,intervalObservable:()=>i.intervalObservable,isEqual:()=>r.isEqual,triggerChange:()=>o.triggerChange});var a=n(68372),s=n(77809),i=n(71951),r=n(65345),o=n(74733)},71951:(e,t,n)=>{n.r(t),n.d(t,{intervalObservable:()=>s});const a=(0,n(487).F)(500);function s(e){return a.subscribe((()=>{const t=Date.now()-(e.state.callUpdatedAt||0)<=1500;t!==e.state.callUpdated&&e.setState({callUpdated:t})}))}},65345:(e,t,n)=>{function a(e,t){return t?t.$$typeof?"":Array.isArray(t)?t.map((e=>a(0,e))):t:t}function s(e,t){return JSON.stringify({test:e},a)===JSON.stringify({test:t},a)}n.r(t),n.d(t,{isEqual:()=>s})},74733:(e,t,n)=>{n.r(t),n.d(t,{triggerChange:()=>i});var a=n(4757),s=n(33661);function i(e,...t){t?.length&&t.forEach((t=>{(0,a.b)(t)?t.next(e):(0,s.m)(t)&&t(e)}))}},13731:(e,t,n)=>{n.d(t,{Z:()=>h,d:()=>m});var a=n(52322),s=n(2784),i=n(56360),r=n(97794),o=n(48801),l=n.n(o),c=n(95292),d=n(25294),u=n(43151);const m=[1,2,4,8,16,32].map(((e,t)=>[t+1,e,new(l())(e)])),h=s.memo((function({className:e="",label:t,onChange:n,value:o,voteLockingPeriod:l}){const{t:h}=(0,u.$)(),p=(0,i.n)(),g=(0,s.useRef)(function(e,t,n){return[{text:n("0.1x voting balance, no lockup period"),value:0},...m.map((([a,s,i])=>({text:n("{{value}}x voting balance, locked for {{duration}}x duration{{period}}",{replace:{duration:s,period:t&&t.gt(c.nw)?` (${(0,r.A)(e,i.mul(t),n)[1]})`:"",value:a}}),value:a})))]}(p,l,h));return(0,a.jsx)(d.Z,{className:e,label:t,onChange:n,options:g.current,value:o})}))},25294:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(52322),s=n(2784),i=n(25650),r=n(31076),o=n(1346),l=n(12493);const c=(0,n(21779).z)(l.Z)` + .ui--Dropdown-item { + position: relative; + white-space: nowrap; + + .ui--Dropdown-icon, + .ui--Dropdown-name { + display: inline-block; + } + + .ui--Dropdown-icon { + height: 32px; + left: 0; + position: absolute; + top: -9px; + width: 32px; + + &.opaque { + opacity: var(--opacity-light); + } + } + + .ui--Dropdown-name { + margin-left: 3rem; + } + } + + .ui.selection.dropdown { + > .text > .ui--Dropdown-item { + .ui--Dropdown-icon { + left: -2.6rem; + top: -1.15rem; + opacity: 1; + } + + .ui--Dropdown-name { + margin-left: 0; + } + } + } +`,d=s.memo((function({allowAdd:e=!1,children:t,className:n="",defaultValue:l,dropdownClassName:d,isButton:u,isDisabled:m,isError:h,isFull:p,isMultiple:g,label:f,labelExtra:b,onAdd:x,onBlur:A,onChange:v,onClose:w,onSearch:y,options:j,placeholder:C,renderLabel:k,searchInput:N,tabIndex:E,transform:S,value:I,withEllipsis:B,withLabel:D}){const L=(0,s.useRef)(""),[V,P]=(0,s.useState)(),T=(0,s.useCallback)((e=>{const t=JSON.stringify({v:e});L.current!==t&&(L.current=t,P(e),v&&v(S?S(e):e))}),[v,S]);(0,s.useEffect)((()=>{T((0,o.o)(I)?l:I)}),[T,l,I]);const M=(0,s.useCallback)(((e,{value:t})=>x&&x(t)),[x]),F=(0,s.useCallback)(((e,{value:t})=>T(t)),[T]),z=(0,a.jsx)(i.Z,{allowAdditions:e,button:u,className:d,compact:u,disabled:m,error:h,floating:u,multiple:g,onAddItem:M,onBlur:A,onChange:F,onClose:w,options:j,placeholder:C,renderLabel:k,search:y||e,searchInput:N,selection:!0,tabIndex:E,value:V});return u?(0,a.jsxs)(r.Z.Group,{children:[z,t]}):(0,a.jsxs)(c,{className:`${n} ui--Dropdown`,isFull:p,label:f,labelExtra:b,withEllipsis:B,withLabel:D,children:[z,t]})}));d.Header=i.Z.Header;const u=d},79472:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(69316),r=n(15445);const o=n(21779).z.div` + cursor: pointer; + + .ui--Icon.icon-button { + color: ${i.Iv}; + cursor: pointer; + margin: 0 0 0 0.5rem; + } + + .editSpan { + white-space: nowrap; + } +`,l=s.memo((function({children:e,className:t="",icon:n="edit",onClick:s}){return(0,a.jsxs)(o,{className:`${t} ui--EditButton`,onClick:s,children:[e,(0,a.jsx)("span",{className:"editSpan",children:(0,a.jsx)(r.Z,{className:"icon-button",icon:n})})]})}))},15445:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(52322),s=n(81674),i=n(9725),r=n(49929),o=n(2784),l=n(21779);s.vI.add(i.mRB);const c=(0,l.z)(r.G)` + outline: none; + + &.isClickable { + cursor: pointer; + } + + &.isPadded { + margin: 0 0.25rem; + } + + &.grayColor { + opacity: 0.25; + } + + &.greenColor { + color: green; + } + + &.orangeColor { + color: darkorange; + } + + &.redColor { + color: darkred; + } + + &.transparentColor { + color: transparent; + } + + &.whiteColor { + color: white; + } + + &.darkGrayColor { + color: #8B8B8B; + } +`,d=o.memo((function({className:e="",color:t="normal",icon:n,isPadded:s,isSpinning:i,onClick:r,size:o="1x",tooltip:l}){const d={"data-testid":n,...l?{"data-for":l,"data-tip":!0}:{}};return(0,a.jsx)(c,{...d,className:`${e} ui--Icon ${t}Color${r?" isClickable":""}${s?" isPadded":""}`,icon:n,onClick:r,size:o,spin:i,tabIndex:-1})}))},33749:(e,t,n)=>{n.d(t,{ZP:()=>u,nk:()=>c});var a=n(52322),s=n(2784),i=n(46340),r=n(33661),o=n(1346),l=n(12493);const c=["Alt","Meta","Control"];let d=0;const u=s.memo((function({autoFocus:e=!1,children:t,className:n,defaultValue:c,icon:u,inputClassName:m,isAction:h=!1,isDisabled:p=!1,isDisabledError:g=!1,isEditable:f=!1,isError:b=!1,isFull:x=!1,isHidden:A=!1,isInPlaceEditor:v=!1,isLoading:w=!1,isReadOnly:y=!1,isWarning:j=!1,label:C,labelExtra:k,max:N,maxLength:E,min:S,name:I,onBlur:B,onChange:D,onEnter:L,onEscape:V,onKeyDown:P,onKeyUp:T,onPaste:M,placeholder:F,tabIndex:z,type:Z="text",value:R,withEllipsis:$,withLabel:q}){const[U]=(0,s.useState)((()=>`in_${d++}_at_${Date.now()}`)),[H]=(0,s.useState)((()=>c));(0,s.useEffect)((()=>{H&&D&&D(H)}),[H,D]);const Q=(0,s.useCallback)((()=>B&&B()),[B]),O=(0,s.useCallback)((({target:e})=>D&&D(e.value)),[D]),W=(0,s.useCallback)((e=>P&&P(e)),[P]),G=(0,s.useCallback)((e=>{T&&T(e),!L||"Enter"!==e.key&&13!==e.keyCode||(e.target.blur(),(0,r.m)(L)&&L()),!V||"Escape"!==e.key&&27!==e.keyCode||(e.target.blur(),V())}),[L,V,T]),J=(0,s.useCallback)((e=>M&&M(e)),[M]);return(0,a.jsx)(l.Z,{className:n,isFull:x,label:C,labelExtra:k,withEllipsis:$,withLabel:q,children:(0,a.jsxs)(i.Z,{action:h,autoFocus:e,className:[f?"ui--Input edit icon":"ui--Input",v?"inPlaceEditor":"",w?"--tmp":"",m||"",j&&!b?"isWarning":""].join(" "),defaultValue:(0,o.o)(R)?c||"":void 0,disabled:p||w,error:!p&&b||g,hidden:A,iconPosition:(0,o.o)(u)?void 0:"left",id:I,max:N,maxLength:E,min:S,name:I||U,onBlur:Q,onChange:O,onKeyDown:W,onKeyUp:G,placeholder:F,readOnly:y,tabIndex:z,type:Z,value:R,children:[(0,a.jsx)("input",{autoCapitalize:"off",autoComplete:"password"===Z?"new-password":"off",autoCorrect:"off","data-testid":C,onPaste:J,spellCheck:!1,style:{pointerEvents:"auto"}}),f&&(0,a.jsx)("i",{className:"edit icon"}),u,t]})})}))},44294:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(92730),r=n(1346),o=n(39764);const l=s.memo((function({autoFocus:e,children:t,className:n="",defaultValue:l,isDisabled:c,isError:d,isFull:u,isLoading:m,isWarning:h,isZeroable:p,label:g,labelExtra:f,maxValue:b,onChange:x,onEnter:A,onEscape:v,placeholder:w,siDecimals:y,siSymbol:j,value:C,withEllipsis:k,withLabel:N,withMax:E}){const{defaultValue:S,siDefault:I}=(0,s.useMemo)((()=>function(e,t=!1,n){if(!e)return{};const a=(0,i.a)(e,{decimals:(0,r.o)(n)?i.a.getDefaults().decimals:n,forceUnit:"-",withAll:!0,withSi:!1,withZero:!1});return{defaultValue:t?`${a}.`.split(".").slice(0,2).map(((e,t)=>t?e.padEnd(4,"0"):e)).join("."):a.replace(/,/g,""),siDefault:i.a.findSi("-")}}(l,c,y)),[l,c,y]);return(0,a.jsx)(o.Z,{autoFocus:e,bitLength:128,className:`${n} ui--InputBalance`,defaultValue:S,isDisabled:c,isError:d,isFull:u,isLoading:m,isSi:!0,isWarning:h,isZeroable:p,label:g,labelExtra:f,maxValue:b,onChange:x,onEnter:A,onEscape:v,placeholder:w,siDecimals:y,siDefault:I,siSymbol:j,value:C,withEllipsis:k,withLabel:N,withMax:E,children:t})}))},50265:(e,t,n)=>{n.d(t,{k:()=>a});class a{static abbr="Unit";static setAbbr(e=a.abbr){a.abbr=e}}},39764:(e,t,n)=>{n.d(t,{Z:()=>j});var a=n(52322),s=n(2784),i=n(90778),r=n(95292),o=n(48801),l=n.n(o),c=n(1346),d=n(92730),u=n(6485),m=n(50265),h=n(33749),p=n(21779),g=n(43151);const f=32;function b(e){return r.um.pow(new(l())(e||f)).isub(r.If)}function x(e,t){return new RegExp(e?`^${t?"-?":""}(0|[1-9]\\d*)(\\.\\d*)?$`:`^${t?"-?":""}(0|[1-9]\\d*)$`)}function A(e,t,n,a,s){return!(!n&&e.lt(r.nw)||e.gt(b(t))||!a&&e.isZero()||e.bitLength()>(t||f)||s&&s.gtn(0)&&e.gt(s))}function v(e,t,n,a,s,i,o,u){const[m,h,p]=function(e,t){if(!e)return[r.nw,0,0];const n=(0,c.o)(t)?d.a.getDefaults().decimals:t;return[new(l())(n+e.power),n,e.power]}(n,u),g=t.match(/^(\d+)\.(\d+)$/);let f;if(g){p-g[2].length<-h&&(f=new(l())(-1));const n=new(l())(t.replace(/\.\d*$/,"")),a=t.replace(/^\d+\./,"").substring(0,e.registry.chainDecimals[0]),s=new(l())(a);f=n.mul(r.aP.pow(m)).add(s.mul(r.aP.pow(new(l())(h+p-a.length))))}else f=new(l())(t.replace(/[^\d]/g,"")).mul(r.aP.pow(m)).muln(s&&t.startsWith("-")?-1:1);return[f,A(f,a,s,i,o)]}function w(e,t,n,a,s,i,r,o){return[t,...v(e,t,n,a,s,i,r,o)]}const y=(0,p.z)(h.ZP)` + .siUnit { + bottom: 0.85rem; + color: var(--color-label); + font-size: var(--font-size-tiny); + font-weight: var(--font-weight-label); + position: absolute; + font-weight: var(--font-weight-bold); + right: 1.25rem; + } +`,j=s.memo((function({autoFocus:e,bitLength:t=f,children:n,className:o="",defaultValue:p,isDecimal:A,isDisabled:v,isError:j=!1,isFull:C,isLoading:k,isSi:N,isSigned:E=!1,isWarning:S,isZeroable:I=!0,label:B,labelExtra:D,maxLength:L,maxValue:V,onChange:P,onEnter:T,onEscape:M,placeholder:F,siDecimals:z,siDefault:Z,siSymbol:R,value:$}){const{t:q}=(0,g.$)(),{api:U}=(0,i.h)(),[H]=(0,s.useState)((()=>N?Z||d.a.findSi("-"):null)),[[Q,O,W],G]=(0,s.useState)((()=>function(e,t=r.nw,n,a,s,i,o,m){return(0,u.H)(t)?function(e,t,n,a,s){const i=(0,c.o)(s)?d.a.getDefaults().decimals:s;return[t?e.div(r.aP.pow(new(l())(i+t.power))).toString():e.toString(),e,!(!a&&!n)||e.gt(r.nw)]}(t,n,s,i,m):w(e,t,n,a,s,i,o,m)}(U,$||p,H,t,E,I,V,z))),[J,K]=(0,s.useState)(!1);(0,s.useEffect)((()=>{P&&P(W?O:void 0)}),[W,P,O]);const Y=(0,s.useCallback)(((e,n)=>G(w(U,e,n,t,E,I,V,z))),[U,t,E,I,V,z]),X=(0,s.useCallback)((e=>Y(e,H)),[Y,H]);(0,s.useEffect)((()=>{p&&X(p.toString())}),[X,p]);const _=(0,s.useCallback)((e=>{if(h.nk.includes(e.key))K(!0);else if(1===e.key.length&&!J){const{selectionEnd:t,selectionStart:n,value:a}=e.target,s=`${a.substring(0,n||0)}${e.key}${a.substring(t||0)}`;x(A||!!H,E).test(s)||e.preventDefault()}}),[A,J,E,H]),ee=(0,s.useCallback)((e=>{h.nk.includes(e.key)&&K(!1)}),[]),te=(0,s.useCallback)((e=>{const{value:t}=e.target;x(A||!!H,E).test(t)||e.preventDefault()}),[A,E,H]),ne=b(t).toString().length;return(0,a.jsxs)(y,{autoFocus:e,className:`${o} ui--InputNumber ${v?"isDisabled":""}`,isDisabled:v,isError:!W||j,isFull:C,isLoading:k,isWarning:S,label:B,labelExtra:D,maxLength:L||ne,onChange:X,onEnter:T,onEscape:M,onKeyDown:_,onKeyUp:ee,onPaste:te,placeholder:F||q(E?"Valid number":"Positive number"),type:"text",value:Q,children:[H&&(0,a.jsx)("div",{className:"siUnit",children:R||m.k.abbr}),n]})}))},35220:(e,t,n)=>{n.d(t,{Z:()=>g});var a=n(52322),s=n(2784),i=n(23729),r=n.n(i),o=n(3663),l=n(25294),c=n(21779);function d(e){return{key:e,text:e,value:e}}const u=(r().get("tags")||["Default"]).sort(),m=u.map(d);function h(e){u.push(e),m.push(d(e)),function(e){r().set("tags",e.sort())}(u)}const p=(0,c.z)(l.Z)` + && .ui.label { + border: none; + border-radius: 0.25rem; + box-shadow: none; + color: #fff; + display: inline-block; + font-size: var(--font-size-small); + font-weight: var(--font-weight-normal); + line-height: 1.143rem; + margin: 0.125rem 0.125rem; + padding: 0.571em 0.857em; + position: relative; + white-space: nowrap; + z-index: 1; + + .delete.icon::before { + content: '\u2715'; + } + } + + &&.darkTheme .ui.label { + background-color: rgba(255, 255, 255, 0.08); + } +`,g=s.memo((function({allowAdd:e=!0,className:t="",defaultValue:n,isDisabled:s,isError:i,label:r,onBlur:l,onChange:c,onClose:d,placeholder:u,searchInput:g,value:f,withLabel:b}){const{theme:x}=(0,o.F)();return(0,a.jsx)(p,{allowAdd:e&&!s,className:`${t} ui--InputTags ${x}Theme`,defaultValue:n,isDisabled:s,isError:i,isMultiple:!0,label:r,onAdd:h,onBlur:l,onChange:c,onClose:d,options:m,placeholder:u,searchInput:g,value:f,withLabel:b})}))},12493:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(21779);const r=(0,a.jsx)("div",{children:" "}),o=i.z.div` + &.ui--Labelled { + display: block; + position: relative; + + label { + padding-right: 1rem; + } + + .ui--CopyButton { + position: absolute; + top: 0.9rem; + right: 0.5rem; + } + + .withEllipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + &.isSmall { + display: block; + + > label { + margin: 0; + min-width: 0; + padding-right: 0; + } + } + + &:not(.isSmall) { + padding-left: 2rem; + + &:not(.isOuter) { + > label, + .labelExtra { + position: absolute; + text-align: left; + top: 0.75rem; + z-index: 1; + } + + > label { + left: 3.55rem; + right: 0; + text-align: left; + } + } + + &.isFull { + padding-left: 0; + + > label { + left: 1.55rem; + } + } + + &.isOuter { + margin: 0.25rem 0; + + .labelExtra { + top: -0.125rem; + // right: 0; + } + } + + .labelExtra { + color: var(--color-label); + font-size: var(--font-size-label); + font-weight: var(--font-weight-label); + position: absolute; + right: 1.25rem; + text-align: right; + text-transform: var(--text-transform-label); + top: 0.75rem; + z-index: 1; + + > .ui--Toggle > label { + padding-right: 0 !important; + } + } + + > .ui--Labelled-content { + box-sizing: border-box; + flex: 1 1; + min-width: 0; + + > .--tmp { + // existing is a bit too much + opacity: 0.15; + } + + .ui.selection.dropdown { + &:not(.floating) { + padding-left: 1.45rem; + padding-top: 1.75rem; + } + + &.floating { + > .dropdown.icon { + top: 1.25rem; + } + + .text { + line-height: 1; + padding: 0.47rem 0 + } + } + + &.search:not(.multiple) > input.search { + padding-left: 1.45rem; + padding-top: 1.75rem; + } + + > .delete.icon, + > .dropdown.icon, + > .search.icon { + top: 1.75rem; + } + } + + .ui--InputFile, + .ui.input > input, + .ui--output { + padding-left: 1.45rem; + padding-top: 1.75rem; + } + + .ui--Messages { + padding-bottom: 2rem; + padding-left: 1.45rem; + padding-top: 2rem; + } + } + } + } +`,l=s.memo((function({children:e,className:t="",isFull:n,isHidden:s,isOuter:i,isSmall:l,label:c=r,labelExtra:d,withEllipsis:u,withLabel:m=!0}){return s?null:m?(0,a.jsxs)(o,{className:`${t} ui--Labelled ${l?"isSmall":""} ${n?"isFull":""} ${i?"isOuter":""}`,children:[(0,a.jsx)("label",{children:u?(0,a.jsx)("div",{className:"withEllipsis",children:c}):c}),d&&(0,a.jsx)("div",{className:"labelExtra",children:d}),(0,a.jsx)("div",{className:"ui--Labelled-content",children:e})]}):(0,a.jsx)("div",{className:t,children:e})}))},16613:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(52322),s=n(2784),i=n(38894),r=n(79472),o=n(33749),l=n(21779),c=n(53657);const d=l.z.div` + text-align: left; + + &.isDisabled { + opacity: var(--opacity-light); + + .ui--IdentityIcon { + filter: grayscale(100%); + } + } + + &.isInline { + display: flex; + + .ui--Row-accountId { + white-space: nowrap; + } + } + + &.isInvalid { + .ui--Row-accountId, + .ui--Row-icon { + filter: grayscale(100); + opacity: var(--opacity-light); + } + } + + .ui--Row-base { + display: flex; + min-width: 16rem; + } + + .ui--Row-buttons { + position: relative; + margin-right: -0.5rem; + margin-top: -0.5rem; + white-space: nowrap; + height: 0rem; + overflow: visible; + + button.ui.button:last-child { + margin-right: 0; + } + } + + .ui--Row-children { + display: block; + padding-left: 1rem; + padding-top: 1rem; + } + + .ui--Row-details { + flex: 1; + margin-right: 1rem; + padding: 0.25rem 0 0; + width: 100%; + min-width: 0; + + .account-label{ + margin: -0.75rem 0 0 0 + } + + * { + vertical-align: middle; + } + } + + .ui--Row-address, + .ui--Row-accountIndex { + padding: 0; + margin-bottom: 0.25rem; + + &.shortAddr { + min-width: var(--width-shortaddr); + max-width: var(--width-shortaddr); + opacity: var(--opacity-light); + overflow: hidden; + text-overflow: ellipsis; + } + } + + .ui--Row-name { + display: flex; + box-sizing: border-box; + height: 1.5rem; + margin: 0; + padding: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-transform: uppercase; + overflow: hidden; + text-overflow: inherit; + } + + .ui--Row-icon { + flex: 0; + margin-right: 1em; + position: relative; + + .ui--Row-icon-info { + left: -0.5rem; + position: absolute; + top: -0.5rem; + } + } + + .ui--Row-name-input { + input { + height: 1em; + text-transform: uppercase; + margin-top: -0.3em; + } + } + + .ui--Row-tags { + &.editable { + display: flex; + flex-wrap: wrap; + justify-content: left; + + .addTags { + border: 1px #00000052 solid; + border-radius: .5em; + border-style: dashed; + color: grey; + font-size: var(--font-size-tiny); + padding: .1em 0.3em 0.1em 0.3em; + margin-top: .2em; + } + + > div.label { + margin-top:.3em + } + } + } + + .ui--Row-tags-input { + margin-bottom: -1.4em; + } +`,u=s.memo((function({address:e,buttons:t,children:n,className:l="",defaultName:u,details:m,icon:h,iconInfo:p,isDisabled:g,isEditableName:f,isEditableTags:b,isInline:x,isShortAddr:A=!0,name:v,onChangeName:w,onChangeTags:y,onSaveName:j,onSaveTags:C,tags:k}){const[N,E]=(0,i.O)(),[S,I]=(0,i.O)(),B=(0,s.useCallback)((()=>{j&&j(),E()}),[j,E]);return(0,a.jsxs)(d,{className:`${l} ui--Row ${g?"isDisabled":""} ${x?"isInline":""}`,children:[(0,a.jsxs)("div",{className:"ui--Row-base",children:[h&&(0,a.jsxs)("div",{className:"ui--Row-icon",children:[h,p&&(0,a.jsx)("div",{className:"ui--Row-icon-info",children:p})]}),(0,a.jsxs)("div",{className:"ui--Row-details",children:[(v||u)&&(f&&N?(0,a.jsx)(o.ZP,{autoFocus:!0,defaultValue:v||u,isInPlaceEditor:!0,onBlur:B,onChange:w,onEnter:!0,withLabel:!1}):(0,a.jsx)("div",{className:"ui--Row-name",children:f?(0,a.jsx)(r.Z,{onClick:E,children:v||u}):v||u})),e&&(0,a.jsx)("div",{className:"ui--Row-address "+(A?"shortAddr":""),children:e.toString()}),m,k&&(0,a.jsx)(c.Z,{className:"ui--Row-tags",isEditable:b,isEditing:S,onChange:y,onSave:C,onToggleIsEditing:I,value:k})]}),t&&(0,a.jsx)("div",{className:"ui--Row-buttons",children:t})]}),n&&(0,a.jsx)("div",{className:"ui--Row-children",children:n})]})}))},56245:(e,t,n)=>{n.d(t,{z:()=>a});const a=["finalitytimeout","finalized","inblock","usurped","dropped","invalid","cancelled","error","sent"]},17608:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(52322),s=n(2784),i=n(3663),r=n(21779),o=n(527);let l=0;const c=r.z.div` + border-radius: 0.25rem; + color: #fff; + display: inline-block; + font-size: var(--font-size-tiny); + font-weight: var(--font-weight-normal); + line-height: 1rem; + margin: 0 0.125rem; + opacity: 0.85; + padding: 0.25em 0.75em; + position: relative; + white-space: nowrap; + z-index: 1; + + &.tinySize { + font-size: var(--font-size-tiny); + } + + &.blackColor { + background: #000; + } + + &.blueColor { + background: #2185d0; + } + + &.greenColor { + background: #21ba45; + } + + &.greyColor { + background: #767676; + } + + &.lightgreyColor { + background: #b6b6b6; + opacity: 0.7; + } + + &.orangeColor { + background: #f2711c; + } + + &.pinkColor { + background: #e03997; + } + + &.purpleColor { + background: #a45ee5; + } + + &.redColor { + background: #db2828; + } + + &.yellowColor { + background: darkgoldenrod; + } + + &.themeColor.darkTheme { + background-color: rgba(255,255,255,0.08); + } +`,d=s.memo((function({className:e="",color:t="theme",hover:n,label:r,size:d="small"}){const{theme:u}=(0,i.F)(),[m]=(0,s.useState)((()=>`tag-hover-${Date.now()}-${l++}`));return(0,a.jsxs)(c,{className:`${e} ui--Tag ${t}Color ${d}Size ${u}Theme`,color:t||"grey","data-for":n&&m,"data-tip":!!n,children:[r,n&&(0,a.jsx)(o.Z,{text:n,trigger:m})]})}))},53657:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(52322),s=n(2784),i=n(79472),r=n(35220),o=n(21779),l=n(17608),c=n(43151);const d=o.z.div` + label { + display: inline-block; + } + + .ui--EditButton { + display: flex; + align-items: center; + flex-wrap: wrap; + + &.center { + justify-content: center; + } + + &.left { + justify-content: left; + } + } + + .ui--Tag { + margin: 0.1rem 0 0.1rem 0.571rem; + } +`,u=s.memo((function({children:e,className:t="",isEditable:n,isEditing:o,onChange:u,onSave:m,onToggleIsEditing:h,value:p,withEditButton:g=!0,withTitle:f}){const{t:b}=(0,c.$)(),x=(0,s.useMemo)((()=>p.length?p.map((e=>(0,a.jsx)(l.Z,{label:e},e))):(0,a.jsx)("div",{children:b("none")})),[b,p]),A=(0,s.useCallback)((()=>{m&&m(),h&&h()}),[m,h]);return(0,a.jsxs)(d,{className:`${t} ui--Tags`,children:[f&&(0,a.jsx)("h5",{children:b("Tags")}),n&&o?(0,a.jsx)(r.Z,{defaultValue:p,onBlur:A,onChange:u,onClose:A,openOnFocus:!0,searchInput:{autoFocus:!1},value:p,withLabel:!1}):n&&g?(0,a.jsx)(i.Z,{className:0===p.length?"center":"left",onClick:h,children:x}):x,e]})}))},527:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(28316),r=n(33710);const o=(0,n(21779).z)(r.Z)` + .tooltipSpacer { + padding: 0.375rem; + } + + > div { + overflow: hidden; + } + + &.ui--Tooltip { + z-index: 1002; + } + + table { + border: 0; + overflow: hidden; + width: 100%; + + td { + text-align: left; + } + + td:first-child { + opacity: 0.75; + padding-right: 0.25rem; + text-align: right; + white-space: nowrap; + } + } + + div+table, + table+div { + margin-top: 0.75rem; + } + + > div+div { + margin-top: 0.5rem; + } + + &.address div { + overflow: hidden; + text-overflow: ellipsis; + } + + .faded { + margin-top: 0; + opacity: 0.75 !important; + font-size: var(--font-size-tiny) !important; + + .faded { + font-size: 1em !important; + } + } + + .faded+.faded { + margin-top: 0; + } + + .row+.row { + margin-top: 0.5rem; + } +`,l=s.memo((function({children:e,className:t="",isClickable:n=!1,place:r,text:l,trigger:c}){const[d]=(0,s.useState)("undefined"==typeof document?{}:document.createElement("div"));return(0,s.useEffect)((()=>{const e="undefined"==typeof document?null:document.getElementById("tooltips");return e?.appendChild(d),()=>{e?.removeChild(d)}}),[d]),(0,i.createPortal)((0,a.jsx)(o,{className:`${t} ui--Tooltip`,clickable:n,effect:"solid",id:c,place:r,children:(0,a.jsxs)("div",{className:"tooltipSpacer",children:[l,e]})}),d)}))},54926:(e,t,n)=>{n.d(t,{Z:()=>a});const a={}},94953:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(24991),s=n(42754),i=n(61349),r=n(16039),o=n(2453),l=n(54926);const c={},d=new s.Z;d.addDetector({lookup:()=>{const e=r.X.i18nLang;return e===o.cr?void 0:e},name:"i18nLangDetector"}),a.ZP.use(d).use(i.Db).use(class{type="backend";static type="backend";async read(e,t,n){if(l.Z[e])return n(null,l.Z[e]);c[e]||(c[e]=this.createLoader(e));const[a,s]=await c[e];return n(a,s)}async createLoader(e){try{const t=await fetch(`locales/${e}/translation.json`,{});return t.ok?(l.Z[e]=await t.json(),[null,l.Z[e]]):[`i18n: failed loading ${e}`,t.status>=500&&t.status<600]}catch(e){return[e.message,!1]}}}).init({backend:{},debug:!1,detection:{order:["i18nLangDetector","navigator"]},fallbackLng:!1,interpolation:{escapeValue:!1,prefix:"{{",suffix:"}}"},keySeparator:!1,load:"languageOnly",ns:["apps","apps-config","apps-electron","apps-routing","app-accounts","app-claims","app-contracts","app-council","app-democracy","app-explorer","app-extrinsics","app-generic-asset","app-js","app-parachains","app-poll","app-rpc","app-settings","app-signing","app-society","app-staking","app-storage","app-sudo","app-tech-comm","app-treasury","react-api","react-components","react-hooks","react-params","react-query","react-signer","translation"],nsSeparator:!1,react:{useSuspense:!0},returnEmptyString:!1,returnNull:!1}).catch((e=>console.log("i18n: failure",e))),r.X.on("change",(e=>{(e.i18nLang===o.cr?a.ZP.changeLanguage():a.ZP.changeLanguage(e.i18nLang)).catch(console.error)}));const u=a.ZP},64348:(e,t,n)=>{n.d(t,{J0:()=>Na,hl:()=>Me,ax:()=>ot,mV:()=>Ba,N:()=>yt,Kc:()=>Va,Ct:()=>j,RN:()=>Pa,zx:()=>G,Zb:()=>Ma,Jy:()=>Ua,Mj:()=>Ka,H_:()=>_a,kL:()=>bs,XZ:()=>As,P0:()=>ks,v:()=>Ns.Z,qi:()=>hn,lK:()=>re,Lt:()=>Xt.Z,ML:()=>Is,SV:()=>Zn,Vh:()=>Ds,xH:()=>me,n0:()=>ii,HS:()=>oi,lm:()=>ci,u5:()=>hi,JO:()=>x.Z,JH:()=>ut,k:()=>Ke,Kd:()=>xi,II:()=>_t.ZP,rp:()=>Vn,m3:()=>ji,bm:()=>ki,H:()=>la.Z,$q:()=>Vi,eV:()=>Zi,UT:()=>Ui,ht:()=>Yi,Rn:()=>Xi.Z,iQ:()=>ir,nU:()=>ur,RF:()=>gr,R2:()=>wr,__:()=>he,ob:()=>Cr,jN:()=>pn.Z,NR:()=>$,oy:()=>Tn,Pd:()=>da,v2:()=>Dt,u_:()=>Yn,EK:()=>kr,r_:()=>xr,f:()=>Ir,ro:()=>Br,YV:()=>Pr,GI:()=>Gt,Ex:()=>$a,iH:()=>ho.r_,K0:()=>ho.K0,CU:()=>ho.CU,lB:()=>ho.lB,YE:()=>K,ak:()=>Mr,$j:()=>U,d4:()=>Fr,by:()=>we,JM:()=>ke,qG:()=>gn,qb:()=>Ur,Ty:()=>Qr,iA:()=>ni,mQ:()=>no,Vp:()=>xt.Z,$G:()=>sa.Z,Kx:()=>so,ZD:()=>ma,tX:()=>oo,u:()=>v.Z,Zd:()=>pa,cA:()=>Ae,UE:()=>lo,xb:()=>mo,zo:()=>A.z});var a=n(52322),s=n(2784),i=n(29455),r=n(60773);s.memo((function({children:e,className:t="",defaultValue:n,label:o,value:l}){const c=(0,i.J)(),d=(0,r.Y)(l),u=(0,s.useMemo)((()=>function({accountIndex:e}={}){return e?e.toString():null}(d)),[d]);return c?.query.indices?(0,a.jsxs)("div",{className:`${t} ui--AccountIndex`,children:[o||"",(0,a.jsx)("div",{className:"account-index",children:u||n||"-"}),e]}):null}));var o=n(95267);const l=s.createContext(void 0);var c=n(64021),d=n(24107),u=n(65417),m=n(38628),h=n(14681),p=n(16737),g=n(33661),f=n(11798),b=n(3663),x=n(15445),A=n(21779),v=n(527);let w=0;const y=A.z.div` + border-radius: 16px; + box-sizing: border-box; + color: #eeedec; + display: inline-block; + font-size: var(--font-size-tiny); + height: 20px; + line-height: 20px; + margin-right: 0.43rem; + min-width: 20px; + padding: 0 4px; + overflow: hidden; + text-align: center; + vertical-align: middle; + width: 20px; + + &.isTooltip { + cursor: help; + } + + &.isBlock { + display: block; + } + + .ui--Icon { + cursor: inherit; + margin-top: 4px; + vertical-align: top; + width: 1em; + } + + &.isClickable:not(.withAction) { + cursor: pointer; + } + + &.isSmall { + font-size: 10px; + height: 16px; + line-height: 16px; + min-width: 16px; + padding: 0; + width: 16px; + + .ui--Icon { + margin-top: 3px; + } + } + + &.blueColor { + background: steelblue; + } + + &.counterColor { + margin: 0 0.5rem; + vertical-align: middle; + } + + &.grayColor { + background: #eeedec !important; + color: #aaa9a8; + } + + &.redColor { + background: darkred; + } + + &.greenColor { + background: green; + } + + &.orangeColor { + background: darkorange; + } + + &.purpleColor { + background: indigo; + } + + &.transparentColor { + background: transparent; + box-shadow: none; + } + + &.whiteColor { + background: rgba(255, 255, 255, 0.3); + } + + &.recovery, &.warning, &.information, &.important { + background-color: #FFFFFF; + + &.darkTheme { + background-color: #212227; + } + } + + &.recovery { + background-image: linear-gradient(0deg, rgba(17, 185, 74, 0.08), rgba(17, 185, 74, 0.08)); + color: #11B94A; + } + + &.warning { + background-image: linear-gradient(0deg, rgba(232, 111, 0, 0.08), rgba(232, 111, 0, 0.08)); + color: #FF7D01; + } + + &.information { + background-image: linear-gradient(0deg, rgba(226, 246, 255, 0.08), rgba(226, 246, 255, 0.08)); + color: #3BBEFF; + + &.lightTheme { + background-color: rgba(226, 246, 255, 1); + } + } + + &.important { + background: linear-gradient(0deg, rgba(230, 0, 122, 0.08), rgba(230, 0, 122, 0.08)), rgba(230, 0, 122, 0.01); + color: #E6007A; + } + + &.withAction.withIcon:not(.withInfo) { + width: 34px; + border-radius: 4px; + } + + &.withInfo.withIcon:not(.withAction) { + width: 34px; + border-radius: 18px; + } + + &.withAction.withIcon.withInfo { + width: 44px; + border-radius: 4px; + } + + &.withInfo .ui--Icon:not(.action-icon) { + margin-right: 4px; + } + + .hoverContent { + display: flex; + flex-direction: column; + } + + .action-icon { + margin-left: 4px; + } +`,j=s.memo((function({className:e="",color:t="normal",hover:n,hoverAction:i,icon:r,info:o,isBlock:l,isSmall:c,onClick:d}){const u=(r?`${r}-`:"")+"badge",{theme:m}=(0,b.F)(),[h]=(0,s.useState)((()=>`${u}-hover-${Date.now()}-${w++}`)),p=n?{"data-for":h,"data-tip":!0}:{},g="highlight"===t,f=(0,s.useMemo)((()=>(0,a.jsxs)("div",{className:"hoverContent",children:[(0,a.jsx)("div",{children:n}),i&&(0,a.jsx)("a",{className:`${t}Color`,onClick:d,children:i})]})),[t,n,i,d]);return(0,a.jsxs)(y,{...p,className:`${e} ui--Badge ${n?"isTooltip":""} ${l?"isBlock":""} ${c?"isSmall":""} ${d?"isClickable":""} ${g?"highlight--bg":""} ${t}Color ${r?"withIcon":""} ${o?"withInfo":""} ${i?"withAction":""} ${m}Theme`,"data-testid":u,onClick:i?void 0:d,children:[(0,a.jsxs)("div",{className:g?"highlight--color-contrast":"",children:[r&&(0,a.jsx)(x.Z,{icon:r}),o,i&&(0,a.jsx)(x.Z,{className:"action-icon",icon:"chevron-right"})]}),n&&(0,a.jsx)(v.Z,{className:"accounts-badge",isClickable:!!i,text:f,trigger:h})]})}));function C(e,t){const n=o.statics.registry.createType("AccountId",(0,c.d)(e.padEnd(32,"\0")));return e=>n.eq(e)?t:null}function k(e,t,n){const a=(0,c.d)(e),s=a.length+4;return e=>{const i=(0,d.c)(e)?e.toU8a():o.statics.registry.createType("AccountId",e).toU8a();return i.length>=s&&(0,u.S)(a,i.subarray(0,a.length))&&(0,m.S)(i.subarray(s))?`${t} ${(0,h.u)((0,p._)(i.subarray(a.length,s)))}${n?` (${n})`:""}`:null}}const N=[C("modlpy/socie","Society"),C("modlpy/trsry","Treasury"),C("modlpy/xcmch","XCM"),k("modlpy/cfund","Crowdloan"),k("modlpy/npols\0","Pool","Stash"),k("modlpy/npols","Pool","Reward"),k("modlpy/nopls\0","Pool","Stash"),k("modlpy/nopls","Pool","Reward"),k("para","Parachain"),k("sibl","Sibling")],E=new Map,S=new Map,I=new Map;function B(e="",t,n){let a=null;for(let e=0;null===a&&eL((m||"").toString(),void 0,n))),A=(0,s.useContext)(l);(0,s.useEffect)((()=>{const{accountId:e,accountIndex:t,identity:s,nickname:i}=f||{},r=(e||m||"").toString();s?.parent&&I.set(r,s.parent.toString()),p&&(0,g.m)(p.query.identity?.identityOf)?x((()=>s?.display?function(e,t){const n=t.judgements.filter((([,e])=>!e.isFeePaid)),s=n.some((([,e])=>e.isKnownGood||e.isReasonable)),i=n.some((([,e])=>e.isErroneous||e.isLowQuality)),r=s?t.display:(t.display||"").replace(/[^\x20-\x7E]/g,""),o=t.displayParent&&(s?t.displayParent:t.displayParent.replace(/[^\x20-\x7E]/g,"")),l=(c=(0,a.jsxs)("span",{className:"name"+(s&&!i?" isGood":""),children:[(0,a.jsx)("span",{className:"top",children:o||r}),o&&(0,a.jsx)("span",{className:"sub",children:`/${r||""}`})]}),d=i?"red":s?"green":"gray",u=t.parent?"link":s&&!i?"check":"minus",(0,a.jsxs)("span",{className:"via-identity",children:[(0,a.jsx)(j,{color:d,icon:u,isSmall:!0}),c]}));var c,d,u;return E.set(e,l),l}(r,s):L(r,t))):x(i||D(n,r,t))}),[p,n,f,u,m]);const v=(0,s.useCallback)((()=>x(D(n,(m||"").toString()))),[n,m]),w=(0,s.useCallback)((()=>A&&m&&A([m.toString(),v])),[v,A,m]);return(0,a.jsxs)(V,{className:`${t} ui--AccountName ${h?"withSidebar":""}`,"data-testid":"account-name",onClick:h?w:c,children:[o||"",d||b,e]})}));var T=n(37198),M=n(17730),F=n(90778),z=n(43151);function Z(e,{data:t,hash:n,isText:s,type:i}){return Object.entries(M.N).map((([r,{chains:o,create:l,homepage:c,isActive:d,paths:u,ui:m}])=>{const h=o[e],p=u[i];return d&&h&&p?(0,a.jsx)("a",{href:l(h,p,t,n),rel:"noopener noreferrer",target:"_blank",title:`${r}, ${c}`,children:s?r:(0,a.jsx)("img",{src:m.logo})},r):null})).filter((e=>!!e))}const R=A.z.div` + text-align: right; + + &.isMain { + text-align: left; + } + + &.isSmall { + font-size: var(--font-size-small); + line-height: 1.35; + text-align: center; + } + + &.isSidebar { + text-align: center; + + .links { + img { + height: 2rem; + width: 2rem; + } + } + } + + &:not(.fullColor) { + .links { + img { + filter: grayscale(1) opacity(0.66); + + &:hover { + filter: grayscale(0) opacity(1); + } + } + } + } + + .links { + img { + border-radius: 50%; + cursor: pointer; + height: 1.5rem; + width: 1.5rem; + } + + span { + word-wrap: normal; + display: inline-block; + } + + span+span { + margin-left: 0.3rem; + } + } + + &.isLogo { + line-height: 1; + + .links { + white-space: nowrap; + } + } +`,$=s.memo((function({className:e="",data:t,hash:n,isSidebar:i,isSmall:r,isText:o,type:l,withTitle:c}){const{t:d}=(0,z.$)(),{systemChain:u}=(0,F.h)(),m=(0,s.useMemo)((()=>Z(u,{data:t,hash:n,isSidebar:i,isText:o,type:l})),[u,t,n,i,o,l]);return m.length||c?(0,a.jsxs)(R,{className:`${e} ui--LinkExternal ${o?"isText":"isLogo"} ${c?"isMain":""} ${r?"isSmall":""} ${i?"isSidebar":""}`,children:[o&&!r&&(0,a.jsx)("div",{children:d("View this externally")}),c&&(0,a.jsx)("h5",{children:d("external links")}),(0,a.jsx)("div",{className:"links",children:m.length?m.map(((e,t)=>(0,a.jsx)("span",{children:e},t))):(0,a.jsx)("div",{children:d("none")})})]}):null})),q=A.z.div` + display: block; + line-height: 1rem; + margin: 0 auto; + text-align: center; + + &.variant-appPadded { + margin-top: 0.5rem; + } + + img { + border: 1px solid transparent; + border-radius: 10rem; + } + + &.variant-cover { + bottom: 0; + left: 0; + position: absolute; + right: 0; + + img { + border: 1 px solid white; + margin: 0 auto; + } + } + + .text { + color: inherit !important; + margin: 0.25rem auto 1.5rem auto; + opacity: var(--opacity-light); + + div+div { + margin-top: 0.25rem; + } + } +`,U=s.memo((function({className:e="",label:t,noLabel:n,variant:s="app"}){const{t:i}=(0,z.$)();return(0,a.jsxs)(q,{className:`${e} ui--Spinner variant-${s}`,children:[(0,a.jsx)("img",{className:"push"===s?"":"highlight--bg highlight--border",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACGFjVEwAAAAfAAAAAGv9wEMAAAAaZmNUTAAAAAAAAAAcAAAAHAAAAAAAAAAAACED6AAAv2jyggAAAQdJREFUSEvtlj0SwUAYhp80KioVB6BSqXQOQOUOzuEc7qDiADqVSsUBqFRUmph3JjGZtdmE7OzEjK/Nbp793u83iuN4QUCL/kDfatdW0gbQA1pAG+gmnp+BK3ADTsCjSJEyHnaAcQJz/U/QLXBxHXIB5dUQGBS92vh+AHZ5d1zA0RewlJMLzQNKxumHnpnH1zZ5bUBJOSsRs6L3KKYrM5FsQMVMcvowxVLyvswGVEaqBHzYWyxtwEmmzqpCVaebIg/nVSnG/WXtgMEl9Zk06q9qd84sDV4WwQtf7gdtbaneQZu3oFXG0z5vGNdqAGezWd72k/WiaawY92TNOPpaMbx2ujKS/jbwCfQCksl5///YAAAAGmZjVEwAAAABAAAAHAAAABwAAAAAAAAAAAAhA+gAACQbGFYAAAFOZmRBVAAAAAJIS92WoVIDUQxFT00HAaoOhQKDQ+Gq+IEqHIrv4G9QYIpCoagqBoeqAgMKBGCWucyr6Db7ktfd6Ux7Z9Zlc/bm5SXbq6rqijWqt2nAHeC7pEBtHa4dWGLuPzbq8BA4APrAfqK8AjPgBfiNkj2gIKfAXibhTwI/AZ8eOAccAnIWlcB3wEfuhSZgKWzOEPQ6V2ILeALoWVXvyal5rhbw3DmzyIc8pGZaiq0D1SRnkYxOjFzeWjF1oGCCdqEbq4HqwMsuSCnHFNCzoK0CToBnz+FFGl9dVHYMvHnAVS+89YEaAEujrn6GA2DUgT0N9fvItVCMgAK3kVlOJbQmTVuXGt66g6aahre2hM6zVILJXeN+zK2nUqgW8aO3jL0FrMV7DBxlros6URNFQFcecJ5Avxaasfq92AW+UsurhOrIsKLAcEIvcPuBf1pIl8mD6RT1AAAAGmZjVEwAAAADAAAAHAAAABwAAAAAAAAAAAAhA+gAAMmNy78AAAE0ZmRBVAAAAARIS+2WIW8CQRCFvzNUNSEB06oqXBMSFAqHquMP9Q+1qqoKVwMKhwIDBhIS6o880eSyvd2dvU0ugTDJqtvZLzP73uwVZVm+02IU1wjsAwdrk3Ir7AJDYAH8WqC5QDEEPVlg2mMBvgBPQK9y6BnYAFsr6G9fCPgITIDnwKECfwNHK9gHHAFa1lgCWtGoA74C42jm/w0r4CeW5wJ1T2/AQyzR8/0j1l4XOHPEkcqVHz9DSVWgqhMwNyQiKbg2qsBUofjOXANzC1B3F7KAtfId8HUHqgPynjyYG+Y7bF2lqixXOJqpMr83XONrYMuLnYZ9TZ404jT1o2mA+14LiUdga6UmmKqJvYfTyGyVyfVCZL+H1SuUegcOWIB9aGZaJk1DnaSlWf5p0k6M7L594AXOiI/Jnr/nvwAAABpmY1RMAAAABQAAABwAAAAcAAAAAAAAAAAAIQPoAAAkR7nFAAABbmZkQVQAAAAGSEvtlqFOA0EQhr8mBExRIKBpAgoFCgwOhSoKVYfiOXgOHAqFAoVCIggGBQoFCKqooE2TI3+yl2wudzezV3IJCZOc6ezMd//Mzlw7WZad0aJ1/iJwAVgDPoCZVazfULgNrAJj4KEN4B7QBb6B+3mBy8AGsBkSTYER8Aa8h99U0j7wGVTWMqtKugLsA72a6GfgEfiyVMX+MqBgA2DJkWgC3ATVjuNQBK4Dh05YDkiCFoFDQH1LNZX10hMUA3cBPU3tOrpIlTli4DGg/jW1F+DOCo6Bp9Zhw69eXlg5cqCUSeG8dm4lyIG6nUfWYYffDVSuE2DRkbTqiDbQlRUf9/AA2LICavyvwK0VHwO1LzX0TU1zaK654uA3HQ3XSEhJEage6vKkzKN6p6HXl8S0suWdAlXfNOwuWJnC+A13wqoru7lS9QSolEnm+YuhGdVC1yMlUmVejqq38ACTFFiH/4FWhZL9rZf0Bx7WlMmFw2vxAAAAGmZjVEwAAAAHAAAAHAAAABwAAAAAAAAAAAAhA+gAAMnRaiwAAAFiZmRBVAAAAAhIS+2VsS6GMRSGnz8RDCQSBkwmsUgkLDaTC2ByA67DdbgB038DJpuFRGITg0FYmBhEJJ+8cpo0n379T+sLIU7SdDlvn563Pe2gaZoDvjEGvxU4BswAz8BLzrA+KpwENgBB34CzHLQP4AowH1V1C1x3VZkDLgCLgOZZ4BG4B+5sDmsuARohbgCNZKSA48BWa5G2WAueAK9m5RowZWd4Yda6gNPADjDh6JQn4NgqV3oAZqXtCnfNPgfvI0XQI2+y8mLgJrBaIrbcc0DDFTFwD5ClNXHoFQWgQALWhmyVvSMjAJftZo4UdCTo8nS2QqwJQPXRdi3NWuTKo/8xS7W5fc8OEzlFrRHf0nVAozQugVOvqN34pa2h93XohSmvDdQjrcvj6Ue9o4K52iFs6iuPt2wsgqUqjN2Jv6c54MG+Jdno6rmU1X18wCVH+OkMi8Q1yf8V1riW1fx9S98BLkKVyeDqVfIAAAAaZmNUTAAAAAkAAAAcAAAAHAAAAAAAAAAAACED6AAAJKJbcAAAAVxmZEFUAAAACkhL7ZW9SgNREEZPwMJGELRQsbCyihBIZWdlpZWVb+PbWGmjVao8gEXAVGJhpRYKghYqwsoH9+J1vbmZSRYhkIFtlpk5O3/ftqqqOuEfrTXrwEXgvdSwpircBLaAhQC8Ar5yYAtwCXgtfLVAelJ7AwT9Y6OA60AX2EgiPoAhcA18Ju87wHImt4AC/7IccA/YLlQkcA94CD5tYDXjPwBexgH3M+3JsQW9BJ5DdarS3VJVpeqsprmeBue18KHa0kfg1rI0B7WZWcB94MbiGH3iDFeAI09g8L0PrTWHRqC28tAc9eP4BJx74qYFamnOJgFO2tK7cCJmZnqHx4BUxWMXyT2a4lKg5El3aLX0LKwx1JVmnMrExJI2VacZuiwnbbvATiGLKpO0uWHKOUq8NUuJd6qpAunI6+I9dYWuBF5ny//Qm7PoPwc22s7SljYOignnM2y8td/hDZXJ+O7TKAAAABpmY1RMAAAACwAAABwAAAAcAAAAAAAAAAAAIQPoAADJNIiZAAABXGZkQVQAAAAMSEvtlTEvBVEQhb+XCAovkVDgB6i8REmiUKmoVDqV3+HfqF6lU+k0JBIqUSgkFFQUiGTlJPPkuu7u3LsvUchOss3ec+fMOTOz26uq6pA/jF5HmOn2BLAAzAOfwBPwmLrbZOkcsAhMWYIH4CORZAZYBUQaxh2g50ekCEW0DixF2HfgAriO3q8B04lCpPQceAvPYkIp2nFsVNUnhpGqjQb8L5Uh4SSwZxZ6rZNSPYrNtoSyceAx2bnsPbKeqn+zNfdugfs6S3cB9S83jgENkvqnPsbxClza1H6fhZYe5DIZLrRV6zBaCxFJlbsW+4D6mBtnwFUueIQLFW4nVqEp3xB4Hodw2Zm4MPeLDU0pH/Ee5qpspU7VxYTq4ZZj7SlwUyzNLtR9S7WPK0A/SCwSTabsbB05/0ORjkVSt/itqy65mKOwJJ+L7Qhdi0oBnaWljrn4/2/pF+D1lMkDwUxEAAAAGmZjVEwAAAANAAAAHAAAABwAAAAAAAAAAAAhA+gAACT++uMAAAFRZmRBVAAAAA5IS+2VMUoEQRBF34KogcGCiYqBgcgmwoKJZh5AD2DmUbyKiRfwAhsaaKSBLBtsIGigIGiiCCNfqodm7J7pHsGoC4pmpn/1p379nhlUVXXGP8agEGaqPTT8a6wuJuk6sAWsWuEbcAe8RA4SdhNYsP0v4AGYN/Ehwj1AGYobQOnHtpGF8E/Avb/RJGwjc3UTYGoPy8B+h+zXwLvD+ISLwAmw1HHAB3BuGEmpbAvJWkvrE2pux4kmuQQejaw34S5wkEjoZF0DRh01MzPQD8zvcAc4TCR0HcqVmqFzZ7Ncbr0CtP4i1AxPEwg/gQtAq0J3bxyoE4m6k1PraLpUkkratghdDblV12PFun02GWt3hjp0746AjQijroPm1ztiXxrNU+mIZWu58rY3U2CGfz0rqb78npJkygEVSXPUSsIWSZNkygEVSXPUSsJ+AxAwkclMg/ONAAAAGmZjVEwAAAAPAAAAHAAAABwAAAAAAAAAAAAhA+gAAMloKQoAAAFLZmRBVAAAABBIS+3UwSpFURQG4O+WMDBQDCgDIxlQygQZeAczT+NpeAAvYKCYKMVAMjBQTJRiQupqae9b9zjnnnNzMuD+tVqDvfb6z/7Xv06n2+3u+0V0/j3hfFL7oS3VqyRdxwomEtEbrnBeQTyFBUym81c8InIfygh3sFTR+BKnhbNFRJThDhE9FAlnsFsj3yFeUs0clmvqb3Gfa4qEIWXEIISsWdptjNXUf+AMkf2EcDbNuYmfLvBcRriKzZoOx7hBEzlzq56sxReOYw+Ry/COA0SexlqT5+E6ufabpHE/HLpVQXqEvJMxu40GM4yeJ1UzzB8cbg15w+6xg09pHbI7c92glcg14dCQ9Att/EtjLWKeZYjlDzl7aIMwmsVfJmYazg2EI4Msog9tETb0TjuSNiZra4YjwpFphvLA0MWjPRxasroLf1/ST/OwkcnZW5muAAAAGmZjVEwAAAARAAAAHAAAABwAAAAAAAAAAAAhA+gAACVpnhoAAAFbZmRBVAAAABJIS+2VvUoDQRRGT0CChUJACwsLK7ERBC0U8go+QN7G57CyS5XOB7BIkcLCIoVYWaSwEQQtoggbPpmRyXJ3Z4dZbNwL02R+ztwz9256RVFc8YfR+9fAQ+AA6APPwBPwlWu/SukpoBHGJ3ALvBrQDWAAbAHfwBvwYV3OAm4Do4pM3oFxaU4W9gFBwxD0EViGP1pAK7twz41TK8ARsBvRfB9mawEvgOOaQ67dnDLTiIUUz5xqLKBgglqhwrlz+s4NjVVwFZ2GCVRVXgI7pd2q0Amgd1SBnMRSC+ZVQFJrAv06tYWyFdi3xc8tncomOsM7yUwtsC6Bpu/nz9A7TnOA6rezBKVqkYccoPYOE4pG/fiSC2xaOL/Z5QK1f881f5Vdwea+B9sA6oxNV7WC+9DnbOHG2mXa/j8UfO3bWU69bWC0cDtgVFHqgk5pqrHo+k5pVFHqghVrSZPJKF5DUgAAABpmY1RMAAAAEwAAABwAAAAcAAAAAAAAAAAAIQPoAADI/03zAAABOWZkQVQAAAAUSEvtlbFqAkEURY8gYqEQ0CKCtaRIkSJFEH/BKj+Uf4qVX2BhIIVFCClShMTCQjBFrFYuzMDsrrvOzEpIYC8Muww7c+bd9+ZtI0mSB35Rjb8I7AK7c5lQFmELuAcE3ANPwKoquAwoWC8DEFSjSG3gp+xQRUCBBMzqE5g5k01gaIberbbAO6BnSkXAATA9AtQmczPfB64AF5RdsgZe3MlQSx+BL6AD3JyAWc7Gzf2pohkDI1Olyt2r2WXiCbNQFZvAxNzDS2NlSMEql8+xQFl5EUIz3y6B75gIb00OQ5mKcPsvgNeArkSooi0VTNAQqfssYotG6+4AtTFfVboWgoRc/FS3iSkaG5UP9AN4821tPnbZ5q1m4FqsqNR3c3+OKhH6HCj3TQ2Msq1sUW1pbWmwAweHyo/J5a+DkwAAABpmY1RMAAAAFQAAABwAAAAcAAAAAAAAAAAAIQPoAAAlNT+JAAABTmZkQVQAAAAWSEvtlbFKxEAURc+CqIWCqIWFhYUsFnZaWPoDNn6RX2TjD1hYWGhnsYiFhaDFCoIWqwiRs2QgIOvkTVwR8cIrQmZy8u7cl/SqqjriB9X7jcBFYBm4B966mpHrUNghMAe8AsfAcxdoDrgP9BuAa+B0msAdwEq6BKykJSDVAvACPDXq07vlOpwFDoAV4BE4qc9xBtgCVr/odggMgPfmmhwwrU1Ar+1kG5hvYa2wC2CU1rYFNp+91xKW9miz0LGiwA3AiuoOuCkBmtoSael5FOjZ7ZbQ6j0CRxFLTaRhKZWJfYgA1+pRKAVeAcMI0DEwoaUKWyooOhLp5ZzHs2hoXL8JrBe0eAtY4Tl0j0k1sW3VafCFeJZC/Z7m5PwZFqFjRULTfLhQ7Z3ax3tSJwK111/Ut/yecpaF75daGgZ1PcN/4EQH/v4ZfgCnE5bJGGzaHwAAABpmY1RMAAAAFwAAABwAAAAcAAAAAAAAAAAAIQPoAADIo+xgAAABUWZkQVQAAAAYSEvtlbFKA0EQQF9AxCKCoIVFCiuxsEhhYWHhP1j5N/6QP5DKwsLCQtBCgoWlhYJFChHh5B2XcFySu51TTwsHtspe3r7ZmdlelmVndBi9vwpcBXaBMfD+lYSkGp4Am8AjMOoCeAqsAy/AeRdA7XaA21JKNwBXH1gpDvEMuN6WHSo1peXv1wr4do3pK/AATKp7okBthiWjuux+ADdVaAQYgU0PIvQO0DiPCPAQMJ3R8D6vosAtYD9KKu23nVzJhntAXZE0ncXiuY4AjxILpQ58EQEeNykk/K7hJLVoOgceFBMlQWThFtvjMpJSK9RKbRtPwH0EaNNr2TacOHnzp96he9u2xqwlokBfBOeotqkhTDvvMI+IofuFep8+S00xB2sDnEKcOoMlttr4NFkocxE1rP6Bw9zq1dwh7Zq9DD8BbErrtxv+A38/pZ8vU5TJO67YgwAAABpmY1RMAAAAGQAAABwAAAAcAAAAAAAAAAAAIQPoAAAl0N08AAABK2ZkQVQAAAAaSEvtlSEOwkAQRR8OgSABgUAgEAgEgptwIe7ENRAIBAKBIAEBCQKBICn5DSULbdrZbtMQwiTrOvs6M3/+NqIomlNjNL4dOAB2IQ3xqbADzIAFcCgL9QGKIei5LEx5vsCE1QV0mg78ClyAU94P+QJbwPgD9Hm/oBvglgX2AUowOtaQuFICswKHQN9Kcr7bAns3zwJUG6clYEq5AytA843DAhRM0LIh2NIKlBIlktAQMK6yqMIR0AulPcUTC6gIOAHaFQC1KprlH0jtM6xdpZpz6B6+BGMRjb4JdRrt4MvIi9Yi2Qhf407yUgZuBeoCH6g8VLA347a21N17tVcvR54ZyMLWVbyHLljqFdQ1dYGO7suQ5VA+La3A4YqtrRKIe8nvV/gAlB2SyVuvvicAAAAaZmNUTAAAABsAAAAcAAAAHAAAAAAAAAAAACED6AAAyEYO1QAAAUZmZEFUAAAAHEhL5ZYhTwMxGIafJQgESxAIJAKBQExM8PP4aRMIBAKBQCARiIklIBAkR56lWy63W9v1mssIb3Lqrn36fu339iZN09wzoiZ/ATgFPkuLUuJwdGCpufW4Qx2eAJfABXAeyCvgB1gCH6nV5AJPgasAErpP38BbgPd+kwM8A2ZADNSd/D2Ad6ApoM7mB8I2EMv72iXGgDrSmQ5LZXl1u1UM6OG4KSWFce7pYy7QUg5xt+G8tA/RPoeCBNaQ7SI02oe2gE8N2aMPYwJlLY4OaGzZEjWUVVIb/q4GLeTrNgBifXgbsnMo9wn4Su2h72uUVZDArKTxoyHN7949t905YSq8h+Sp+7ZzP6aALkrodbh4c/ezF5bjsA0wzE0fT3CfLKGOvB0M7V7lOOwO9PfCrBXs4+T+ZpiZQqMqAabm/OfAX+09kcnrFVoXAAAAGmZjVEwAAAAdAAAAHAAAABwAAAAAAAAAAAAhA+gAACWMfK8AAAEHZmRBVAAAAB5IS+2WrQ7CMBRGzxIEAoFEIBAIJIIH4NF4NB4AgUQgEAgkAoEgKfmSlSyl7QZtmpFw7dae3u/+VsaYDQWt+gNzq91bSQfABBgCI2Bce34FbsAduACPNkW6eKjLFzUsdp+gB0CPCFoMKK9mwLTt1c73M3AMnYkB51/ALCcIDQEl4/JDz9zf9z55fUBJueoQs7b3KKY7N5F8QMVMcuYwxVLyvswHVEaqBHLYWyx9QMXO1lkqVCWiWEY9XKdSnPPb3gGLS5ozadRf1e6iMSxeFsULX+4XbW1W76LNW9CU8XQKDeNeDeBmNtsVQ+uF1ozmiqGpoDUj24qRtdN1kfS3gU86tpLJwbIt6wAAABpmY1RMAAAAHwAAABwAAAAcAAAAAAAAAAAAIQPoAADIGq9GAAABRmZkQVQAAAAgSEvdli1PA0EQhp8mCAQkCAQCgUAgkIgKBD+Nn4dAVFQgEAgEAkECAtHkyEO2gru93bmPNKGTrGmm8+w7Ox+3aJrmnh3a4r8Bj4HPIQmaqnDnwCHifn2jCs+AU+AAOEmUD+AdeAM2UXINKOQSOCwEFCb4BfiugUvAK0BlURO8Ar5Kf+gDDoVtGUIfSinOAS8Az1hToUqz75oDLitvFrnIUyqmjm8baJFcRyJWfFT5mPNpA4UJncMEdgqoDbybg5Ri2CaeP7ZXwGfgtabwNo2vOTJrazj+iikd2/C5CzoAOqOu/YZHwM0M8pyt60hb6CNQ8BTLptOAuUkzVWVv0/cB/d0t4XsOteIcLQHHQF3EtkJxGdcWsIv3PCl22+fMSnSiCKxaDbgNIMwZ6+eFlxDiMYVWZNiiwHDAmuP+A38AqS2XyWIgHogAAAAaZmNUTAAAACEAAAAcAAAAHAAAAAAAAAAAACED6AAAJv4UzgAAASdmZEFUAAAAIkhL7ZYhjgJBEEXfJAgEAoHYTRAIBAKxgmvsnbjQ3gSBQCAQCBIQbLICgRvyyYjOZJr+QyeTLKGSVtNdL9X9f9UUZVku6TCK/wicAHv3knIr/AS+gR/g14HmAsUQ9OjAtMcBjoAhMAiSXoFztVzWfd8jYB+YVbBYUoE3wMWlxoASgpYbEo0lnCbgGJi6pGDfAdilztWBeqcvoJc6GPm+Sl1vHbioiaMtV28paDRCoKoTMDckIim4MUJgW6HEcp6ArQPU28lvufEHrN9A3YC8Jw/mhv2GnatUleUKp5UPBVTDlhc76zSCPutHq4HHpoXEI7BbqQVTNal5OE/0VplcEyJ7HobWkHo/amABBIv2TKfT5PrPOu/801iJ3E2vD7wBMKCPydWAdMEAAAAaZmNUTAAAACMAAAAcAAAAHAAAAAAAAAAAACED6AAAy2jHJwAAAWJmZEFUAAAAJEhL7ZavSgVBFIe/CyIGg6DBYDCIGBQMBoPB5Av4Qr6NzWcwGAyGGwxiMhgMCoIGEWHlg10YlnXPzK4sCB6YcufPN79z5nf2zqqqOmPCmP1F4CKwDdwDn1GyfkPhCbAJPAMXUwBPgVXgDTgfC1wC1urhWV/AO/BaD38zpXvAA/AyFLgMbAErPQc81ZCPCJLOd9VQ2D6wkHGQiue16ozl0AaqaDcT1gCKoG3gIWDdSsO0XudsSoE+bcfQMLU+pt5IgQeA9RsaPqK7aHMKPI4WB/PW8io6owGqTIVj4zI6oAH6OrXC2MgGCjoqtEP7cnagm+jGaQ13gPVoQ8+8zfs22p8C7Zmafmjow7DNtY0/1BpZllBJG2j/9PGU+NHaaXptEUZX8y6BWjfNngXrUpjecKNudV1fDVU9AqayKHL+YuhRG7pDJaoKH8dPt8gBFimIFv8DowwVz0+e0m+Zx5TJuoME3gAAABpmY1RMAAAAJQAAABwAAAAcAAAAAAAAAAAAIQPoAAAmorVdAAABUmZkQVQAAAAmSEvt1b8uBVEQx/HPTQQFiYSCRKEQUegolF5A44k8kcYL6CioKBQKhUKBSCgQyZVJ7kk2a/+cXTeE+CXTzex353dmzhkMh8N936jBbwVOYgkPeGoybBwdzmIPU3jFQRN0HMAdrBW6OsdxXZdNwDmkmMEzHguRvrmJiKQzRFSqCjiBdSw0nMUdLvGOOL9dzOMeh3jLBU5jCwFt0wsuRp1HbgI21pU7DFjYl6uAnuQmR14RuIrlLsWj3GtEZKkI3EZY2kdHuUUJGKAA9lXYGva2KgEXR5PZWlCTEMMTk9uqBIwV2GjNrk+IFbnNqf8xS+Pn4orqo06rUZzSFUR01Q2ucovKi991NeJ+Pc2FRV4ZGLdMDE/OPsY9GrCsdUg/9ZXLO2zsBKvqsOhO3fMUNmbtXJXV43iAuxzhpzPsVNwn+b/DPq411vx9Sz8AxMuVydtsQOQAAAAaZmNUTAAAACcAAAAcAAAAHAAAAAAAAAAAACED6AAAyzRmtAAAAVRmZEFUAAAAKEhL7ZUxSwNBEIW/VFpEsLBQsbAQsVAQtfAXpNL/5B8yjf9BUlhYWIi1YIoIghYigQsPdmFZN7szIoqSB8eF3My+ezPz5npd113wg+j9dcIV4LVWsO9SeAAcAUuB8BL4KBFbCJeB98pbHwO6UkyAoYdwFdgGdI+YAo/h0u+IM2CzcLhUPuf/lxTuAesVRSK7A15CzCC8XJ5yBTy1CPeBNYNLRHoLvAEbwHmWI2VS+AmpQqmSOivU11EI3g191JQ+ANeWoTnMemYhvgfGlsAYExX2gRNPYohVH1VaMyKhplEKvVAPbzxJv0b41ZLK4LKIGemUngLaKh6of9GPpryUUP6TD61IbWHNId80rS0TD06NbyZTYGm17QBblVOkTH3ThLox72uhXmp5pztVRDK5Fni6vF2kls+T68BW8IKwVSH380VJ3SVrJfz/ks4AlT2VyRWi+ZYAAAAaZmNUTAAAACkAAAAcAAAAHAAAAAAAAAAAACED6AAAJkdX6AAAAV1mZEFUAAAAKkhL7ZW/LkRREMZ/mwgKEolGRKEQ2UKhUCgUHsAL6FSewxNpPAQFySYUIgqFQkEioUAkVz6ZZRzn7hnXjULuJKfYzJ9vvm9m9vaqqtrjD63XAQbVHgeWgUXgBbgCLnK5oySdAmaAMeARuAdeM0VmgS1gIvGdAHpfLAcooCUD88ECU+fXSY1tYDrTyDOwDzx4XwooRqsFGW+BM4uRlDsj4r+x9ICSbt0kLI1OTPVku00BJeNCCcn8kvfIZqr5zdfkHQKndZKuAZpf1Aa2SJqf5pjaHXBgW/vh85JuRpEszsuqcxiehYDEqngWG8H5Dfu6zGxssWfPUNupLY3asd1nNP49zgPOAf1g9pMtTTD8Myy9wyjLRuxShvqtW1wpSHsO3PyYmiXU/ZfqHvUmXWGBaDMlZ2OLfA8F+isQ310EsDGbXGIH2KqcubNoHSAt2M2wdYn/v6Rvs/GUyT5AreQAAAAaZmNUTAAAACsAAAAcAAAAHAAAAAAAAAAAACED6AAAy9GEAQAAAUJmZEFUAAAALEhL7dXBKgVxFMfxzy2xoRQLysJCsqCUDWXhBTwAT+Np7DyEEjZKscDKQrGgLCyQujr6j6bpP/fOvbcsNL/692/mf878mu85Z6bT7XYP/KE6reGAtOdT/GNdXh3SacxiMiW+4wFvNQ/awCom0vkHrnFRjc8ZLiJWTveIVdYW1mrib3FcPqsa9jIr8m7wlC6msNcH+xFeipiy4Rg2EXsvfeEkBQTKWL0UWH/Rlg2jbusNm+QSr8lsaMMFLDU0LLAuY6dPzhmuckjnsNLQsHjDcewj9pw+cYjYf1St4XYDw6jhOWIPxeztZvLC5BR35bNqlwbSQNtLudGIbo3xmEmzGDGB8bc7c29Y3IvGiQbKKcYh6je06r40Uc9YhfFz6sr42oyk9m8xEr5ccou0RTowgbZpBkbWL+H/I/0GANyRycrkVyMAAAAaZmNUTAAAAC0AAAAcAAAAHAAAAAAAAAAAACED6AAAJhv2ewAAAVBmZEFUAAAALkhL7ZSxSgNBFEVPIFgpBLRQsEghYqGVFpZWdv6AlZ+ST7HLB/gDdtoIgo2IhYUkNoKFhYqwcuW9JRl3M7NksNC9MEwxb97due/e7RRFMeAX0fn3hD1T+yWX6nWS9oF1oGtEn8Aj8FBDvAxsA0t2/gzcAdqnUEW4BazWNBbpfXC2C2hV4QrQKhESLgJ7EfkugTer2QQOIvUXwI3XhISSUmsWJKtLewIsROrfgSHwobp5CPVhh4lmOgPGVYQyykakyS3wBKTI6a1KWcMXypX7E+4MueVWzVD7GnCU+MJzc+0PSXVfDtUrPRKTPa8Bz6Rmd5wwQ90/rZuhN5dbJe+KvebV4uDu9LpZkfAaOVSSfiPHv1Sx0DyroPBLzhI5CNVsx2bqkRrZzEQ4hVyEid7JI2kyWa4ZtoStaRp5oHFxm8PGksUu/H1JvwAC/5HJqA1GLgAAABpmY1RMAAAALwAAABwAAAAcAAAAAAAAAAAAIQPoAADLjSWSAAABWmZkQVQAAAAwSEvtlbFKA0EURU9AjIVWWkRIYSFWFoKNpT+QKpWdn+J3pEqXSisrKwULCwVBC/EDTIqk0kJDYOXCrEyWN5kNs6bQPBgWdmb2vHvnvdlalmVnLDBq/xrYALaAFWAIDIBJqvshS3cADT8EewQ+DOgqsO0S/AL6wMhKzgKuAUcBJZ/AXWHuENgH6oX3b8AN8O6/t4CWOn/PrbNWqo4NJ4q5nvtqLeAu0JxxVtduTso0YiGLe8BYCy2gYIJaocJ5AaTuxLAxBH8ANEygqvIAWDeK5h7QOapAWjFp3ryq/CIEzNepLaRW4Lwt9FSUtdPPqRMDzhIwL1Dn100BbgLtOSxVi1ymALX31BVPGa4q+zUVWLZwftSlArV/zzV/SKVgV3kPVgHUNzZc1Qqeh66zZ+CpmEnV/0PBp+7O3wZGC6hqhUugeXlHbUlZsDzDFPfMvX/f0m+YZZPJwK6giQAAABpmY1RMAAAAMQAAABwAAAAcAAAAAAAAAAAAIQPoAAAnjJKCAAABRmZkQVQAAAAySEvtlT1LA0EQhp+AmBQGhDQhVYpgZcDC3lRWsUpll5+Sf5PKylSpTJVKELTRykI0RQJCmhTChTfswbHm7nb3RBRu4Iqb7OTZeefjKlEUjfhFq/xFYA3Y/JQIWRkeAOeAgF/AK/BWFJwFFOzIAgiqJ83qwDrrUmlAgQS07RN4SDgPgS5wClQT/nfgHviw/yANeAyc7QEugSfjbwMXFsgOeQZmSaevpMpOWTaAfg4s5qgE0/glr2k6QNN0qQIXJnAISE5XE3BX+5A5PAF6riRzTjWdhAIlZcsTqOM3wCokw4GpoS/zVl37L4CXgEbC14IlFUxQH9P2GYc2jeKuAa0xVys0FoJo8K8cZ/EFuHMZ/Lzbu0AfgbnrassD6vd4eWsZJCVWVlre374cIWPhcpHUMyWwkHz7gktJS0m9FdgC08KPyUWYUhIAAAAaZmNUTAAAADMAAAAcAAAAHAAAAAAAAAAAACED6AAAyhpBawAAAWFmZEFUAAAANEhL7ZUxSsVAEIa/ByIWWmmhVlZiIwja2Fl5ASsv4Dk8ip2VHsDKzkZBsBErK7VQEJ6FihD5HrsQIo9kNigiDiwhZCbfzj8zu4Oqqvb5QRv8RuAUMA08Ax99xWjLUNgGMJFg58BrH2gbcAWYrwEegOvvBC4Brmy3gCvbArAI+JwFnoB74C49v+ytLUOlXEs1fAEuk7STwFZjM82fu7FT4L3+oQ2YfW0agZqZbAMzHaR9A46BYfbtCqz/e7cjLMc8JujoPQpcB1xRuwLOSoB7UVLyV9LDKNDa7RQCDRM4jEjqeNgspWbH3kSAy2kUSoEnznAE6BjYoaUWllRQdCTy5hz+g2jT6L8JrBakeAG4wnNojJ1qx3Y1z9ej7BypYY6xlkI9T9vM+bNZhI6sBGicUOWt3yRNeK/De1wmApXX62kO8NzsdT21SRb+XippGNS3hv/AsQr8/Rp+AhBylsksbT/iAAAAGmZjVEwAAAA1AAAAHAAAABwAAAAAAAAAAAAhA+gAACfQMxEAAAFRZmRBVAAAADZIS+2Vr09CURiGHzYHBkkQ0GTSRHEEI8mEiWQz+Xfwd5hsJCmYTCYs2kgk3RwYIEHBuV32Mi47A5HzHeRq8NtuuTvfnvO+34+TiqKoRoKR+qvAHaAAvAOfmxjiq7AE7AF9oJ0E8BTYBUbAUxJAqcsDb46l+8ABkAPSs0u8AK/AcNWlfC1187PACXD8jdIu8AgMFs9YgVJTATIeto6Bu0WoBWiBxfcR9B7oxT8swAtAdlpD9axbgYfAmZXknH8G9OGrsAwcbQDU/DYswEun9UO51xbgVSjFybtVx/pamjiwOtsooUI/gBuLpepQdWpodIAHC1BDL5Wh0YyH37eGAoWOhvapGmYaFqBehHNjLQWTOtXQDFSCoKqnnqV1sQSzKnQB2jrFFWqlpgWoUZbCYulX+Vrm6l4p15LWN38ZtgFcZ+uPK/wH/r6lE7RLlMlljEz2AAAAGmZjVEwAAAA3AAAAHAAAABwAAAAAAAAAAAAhA+gAAMpG4PgAAAEyZmRBVAAAADhIS+2VLW9CQRBFD76oYlpDFa6qNbiqKhx/iD9UFKquqqoJSV0dBlUSktaAeeQSliyvhJ39yAshnWTdmz1vZu7cbVVVNaLBaJ07sAN85zQkpsIr4BGYAstUaAxQDEF/U2HKiwU61h3QBdoefAHMgdmpH4oFXgPPNVD9fkHfgJ9j4BjgA6BjjQ9A5yCswD5wbyV5370Dn36eBag2DhNgSlkBE0Dz3YYFKJigqaG9HVuBUqNEkhsvrspQhU9AL5e2E89WQCHgALgtANSqaJb/QBqfYeMq1Zxz93AvGIto9E2O06wB7eDeyENr4TYi1rhd3h8DtwJ1QQxUlQl2YNzWlvp7r/bq5ThlBjLq1xLvoQ+Wem9qpi7Ql/8yHHOomJYWcLiwtRWB+JdcfoUbMhSSyUMtkHIAAAAaZmNUTAAAADkAAAAcAAAAHAAAAAAAAAAAACED6AAAJzXRpAAAAVFmZEFUAAAAOkhL5ZaxMgUxFIa/26CgoqFSeQA6lUpFQ+VtPIeKSqXSqa7KA9BQqXQqCjRrPhN3dvauJDe7s8M4M1ttki//OSd/Mqqq6pgBY/QXgAvAW2lSShQODiwV9zVvVoVzwAawDqwF8hPwATwCD6nd5AKXgM0Amo8s+gLcBHjrsBzgMrAHxEDNxW8DeAqaAqrsYEbYN+QeuG4SY0DrpbKVVF0i/02vaicRA9ocOx1gTrWm57nAQ8D6dY2rehP9pFCQwD7C4yI0eg63AL8+4h04GxIo6+TXAVeB/T7yGWzvNKXQA3/UE1B/HaeA/t8N3tmVewE85wD7SKsggZNIeWmXw++VdVlXJzUF1E9tnhLHsW5T92MK6KaEboeLN7eerbAchXWAZq772MFtYQq9ku6CabcOylHYnOjzwhQLXgReAZ8ZeqbQaJQAU2v+c+AnnkSRySARYEAAAAAaZmNUTAAAADsAAAAcAAAAHAAAAAAAAAAAACED6AAAyqMCTQAAAQtmZEFUAAAAPEhL7ZY9EsFAGIafNCoqFQegUql0DkDlDs7hHO6g4gA6lUrFAahUVJqYdyYxmbXZhOzsxIyvzW6e/d7vN4rjeEFAi/5A32rXVtIG0ANaQBvoJp6fgStwA07Ao0iRMh52gHECc/1P0C1wcR1yAeXVEBgUvdr4fgB2eXdcwNEXsJSTC80DSsbph56Zx9c2eW1ASTkrEbOi9yimKzORbEDFTHL6MMVS8r7MBlRGqgR82FssbcBJps6qQlWnmyIP51Upxv1l7YDBJfWZNOqvanfOLA1eFsELX+4HbW2p3kGbt6BVxtM+bxjXagBns1ne9pP1ommsGPdkzTj6WjG8droykv428An0ApLJQN0ShwAAAABJRU5ErkJggg=="}),!n&&s.startsWith("app")&&(0,a.jsx)("div",{className:"text",children:t||i("Retrieving data")})]})})),H=A.z.div` + margin: 1rem 0; + text-align: right; + + & .clear { + clear: both; + } + + &.isCentered { + margin-bottom: 0.5rem; + text-align: center; + } + + &+.ui--Table { + margin-top: 1.5rem; + } + + .ui--Button { + margin: 0 0.25rem; + } + + .ui--CopyButton { + display: inline-block; + } + + .ui--ToggleGroup, .ui--Dropdown { + float: left; + } +`,Q=s.memo((function({children:e,className:t="",isCentered:n}){return(0,a.jsxs)(H,{className:`${t} ui--Button-Group ${n?"isCentered":""}`,children:[e,(0,a.jsx)("div",{className:"clear"})]})})),O=A.z.button` + background: transparent; + border: none; + color: inherit; + cursor: pointer; + line-height: 1; + margin: 0; + outline: none; + position: relative; + vertical-align: middle; + text-align: center; + + &:not(.hasLabel) { + padding: 0.7em; + + .ui--Icon { + padding: 0.6rem; + margin: -0.6rem; + } + } + + &:not(.isCircular) { + border-radius: 0.25rem; + } + + &:focus { + outline:0; + } + + &.hasLabel { + padding: 0.7rem 1.1rem 0.7rem ${1.1-.5}rem; + + .ui--Icon { + margin-right: 0.425rem !important; + } + } + + &.isBasic { + background: var(--bg-table); + } + + &.isCircular { + border-radius: 10rem; + } + + &.isDisabled, &.isReadOnly { + background: none; + box-shadow: none; + cursor: not-allowed; + } + + &.isBusy { + cursor: wait; + } + + &.isFull { + display: block; + width: 100%; + } + + &.isIcon { + background: transparent; + } + + .ui--Button-overlay { + background: rgba(253, 252, 251, 0.75); + bottom: 0; + left: 0; + position: absolute; + right: 0; + top: 0; + visibility: hidden; + } + + .ui--Icon { + border-radius: 50%; + box-sizing: content-box; + height: 1rem; + margin: -${.5}rem 0; + padding: ${.5}rem; + width: 1rem; + } + + &.isDisabled { + color: #bcbbba; + } +`,W=s.memo((function({activeOnEnter:e,children:t,className:n="",dataTestId:i="",icon:r,isBasic:o,isBusy:l,isCircular:c,isDisabled:d,isFull:u,isIcon:m,isSelected:h,isToplevel:p,label:g,onClick:f,isReadOnly:b=!f,onMouseEnter:A,onMouseLeave:v,tabIndex:w,withoutLink:y}){const j=(0,s.useCallback)((()=>{!l&&!d&&f&&Promise.resolve(f()).catch(console.error)}),[l,d,f]),C=(0,s.useCallback)((()=>{A&&Promise.resolve(A()).catch(console.error)}),[A]),k=(0,s.useCallback)((()=>{v&&Promise.resolve(v()).catch(console.error)}),[v]),N=(0,s.useCallback)((e=>{l||d||"Enter"!==e.key||f&&Promise.resolve(f()).catch(console.error)}),[l,d,f]);return(0,s.useEffect)((()=>(e&&window.addEventListener("keydown",N,!0),()=>{e&&window.removeEventListener("keydown",N,!0)})),[e,N]),(0,a.jsxs)(O,{className:`${n} ui--Button ${g?"hasLabel":""} ${o?"isBasic":""} ${c?"isCircular":""} ${u?"isFull":""} ${m?"isIcon":""} ${l||d?"isDisabled":""} ${l?"isBusy":""} ${b?"isReadOnly":""}${h?"isSelected":""} ${p?"isToplevel":""} ${y?"withoutLink":""}`,"data-testid":i,onClick:j,onMouseEnter:C,onMouseLeave:k,tabIndex:w,children:[r&&(0,a.jsx)(x.Z,{icon:r}),g,t,l&&(0,a.jsx)(U,{className:"ui--Button-spinner",variant:"cover"})]})}));W.Group=Q;const G=W,J=A.z.div` + background: var(--bg-page); + bottom: 0; + margin-left: -0.125rem; + max-width: 24rem; + min-width: 24rem; + position: fixed; + padding: 1rem; + overflow-y: auto; + top: 0; + z-index: 999; + + &.leftPosition { + box-shadow: 6px 0px 20px 0px rgba(0, 0, 0, 0.3); + left: 0; + } + + &.rightPosition { + box-shadow: -6px 0px 20px 0px rgba(0, 0, 0, 0.3); + right: 0; + } + + .ui--Sidebar-buttons { + margin: 0; + position: absolute; + right: 0.5rem; + top: 0.5rem; + } +`,K=s.memo((function({button:e,children:t,className:n="",dataTestId:s="",onClose:i,position:r,sidebarRef:o}){return(0,a.jsxs)(J,{className:`${n} ui--Sidebar ${r}Position`,"data-testid":s,ref:o,children:[(0,a.jsxs)(G.Group,{className:"ui--Sidebar-buttons",children:[e,(0,a.jsx)(G,{dataTestId:"close-sidebar-button",icon:"times",isBasic:!0,isCircular:!0,onClick:i})]}),t]})}));var Y=n(69316),X=n(69356),_=n(54383),ee=n(58607),te=n(65874),ne=n(82671),ae=n(95292),se=n(92730),ie=n(52107);const re=s.memo((function({accountId:e,className:t="",label:n=""}){const[i,r]=(0,s.useState)("unknown");return(0,s.useEffect)((()=>{const t=(0,f.C9)(e);"unknown"!==t&&r(t)}),[e]),(0,a.jsxs)("div",{className:`${t} ui--CryptoType`,children:[n,i]})}));let oe=0;const le=A.z.div` + white-space: nowrap; + + .ui--FormatBalance { + display: inline-block; + } +`,ce=s.memo((function({className:e="",value:t}){const{t:n}=(0,z.$)(),i=(0,_.C)(),[r]=(0,s.useState)((()=>`${Date.now()}-democracy-locks-${++oe}`)),[{maxBalance:o,sorted:l},c]=(0,s.useState)({maxBalance:ae.nw,sorted:[]});return(0,s.useEffect)((()=>{i&&c((e=>{const s=function(e,t,n=[]){return{maxBalance:(0,ie.x)(...n.map((({balance:e})=>e)).filter((e=>!!e))),sorted:n.map((e=>[e,e.unlockAt&&e.unlockAt.gt(t)?e.unlockAt.sub(t):ae.nw])).sort(((e,t)=>(e[0].referendumId||ae.nw).cmp(t[0].referendumId||ae.nw))).sort(((e,t)=>e[1].cmp(t[1]))).sort(((e,t)=>e[0].isFinished===t[0].isFinished?0:e[0].isFinished?-1:1)).reduce(((t,[{balance:n,isDelegated:s,isFinished:i=!1,referendumId:r,vote:o},l])=>{const c=l.gt(ae.nw),d=r&&o?(0,a.jsxs)("div",{children:["#",r.toString()," ",(0,se.a)(n,{forceUnit:"-"})," ",o.conviction?.toString(),s&&"/d"]}):(0,a.jsx)("div",{children:e("Prior locked voting")}),u=t.length?t[t.length-1]:null;return!u||c||i!==u.isFinished?t.push({details:(0,a.jsx)("div",{className:"faded",children:c?(0,a.jsx)(te.Z,{label:`${e("{{blocks}} blocks",{replace:{blocks:(0,h.u)(l)}})}, `,value:l}):e(i?"lock expired":"ongoing referendum")}),headers:[d],isCountdown:c,isFinished:i}):u.headers.push(d),t}),[])}}(n,i,t);return e.sorted.length!==s.sorted.length||e.sorted.some(((e,t)=>e.headers.length!==s.sorted[t].headers.length))?s:e}))}),[i,n,t]),l.length?(0,a.jsxs)(le,{className:e,children:[(0,a.jsx)(ee.Z,{labelPost:(0,a.jsx)(x.Z,{icon:"clock",tooltip:r}),value:o}),(0,a.jsx)(v.Z,{trigger:r,children:l.map((({details:e,headers:t},n)=>(0,a.jsxs)("div",{className:"row",children:[t.map(((e,t)=>(0,a.jsx)("div",{children:e},t))),(0,a.jsx)("div",{className:"faded",children:e})]},n)))})]}):null}));var de=n(38894);const ue=A.z.div` + max-width: 60rem; + overflow: hidden; + text-overflow: ellipsis; + + &:not(.isExpanded) { + .ui--Expander-content { + display: none; + } + } + + &.isExpanded { + .ui--Expander-content { + margin-top: 0.75rem; + + .body.column { + justify-content: end; + } + } + } + + &.isHeader { + margin-left: 2rem; + } + + &.withBreaks .ui--Expander-content { + white-space: normal; + } + + .ui--Expander-summary { + margin: 0; + min-width: 13.5rem; + overflow: hidden; + + .ui--Expander-summary-header { + display: inline-block; + max-width: calc(100% - 2rem); + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + white-space: nowrap; + + span { + white-space: normal; + } + + .ui--Expander-summary-header-sub, + .ui--Expander-summary-title { + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + box-orient: vertical; + display: -webkit-box; + line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: normal; + } + + .ui--Expander-summary-header-sub { + font-size: var(--font-size-small); + opacity: var(--opacity-light); + } + } + + .ui--Icon { + vertical-align: middle; + } + + &:not(.isLeft) > .ui--Icon { + margin-left: 0.75rem; + } + + &.isLeft > .ui--Icon { + margin-right: 0.75rem; + } + + .ui--LabelHelp { + .ui--Icon { + margin-left: 0; + margin-right: 0.5rem; + vertical-align: text-bottom; + } + } + } + + &.hasContent .ui--Expander-summary { + cursor: pointer; + } + + &.isPadded .ui--Expander-summary { + margin-left: 2.25rem; + } +`,me=s.memo((function({children:e,className:t="",isHeader:n,isLeft:i,isOpen:r,isPadded:o,onClick:l,renderChildren:c,summary:d,summaryHead:u,summaryMeta:m,summarySub:h,withBreaks:p,withHidden:g}){const[f,b]=(0,de.O)(r,l),A=(0,s.useMemo)((()=>f&&c&&c()),[f,c]),[v,w]=(0,s.useMemo)((()=>function(e){if(!e?.docs.length)return null;const t=e.docs.map((e=>e.toString().trim())),n=t.findIndex((e=>!e.length)),s=(i=(-1===n?t:t.slice(0,n)).join(" ").replace(/#(| ).*<\/weight>/,"").replace(/\\/g,"").replace(/`/g,""),["[","]"].reduce(((e,t)=>function(e,t){return e.reduce(((e,n)=>n.split(t).reduce(((e,t)=>e.concat(t)),e)),[])}(e,t)),[i]));var i;return[s[0].split(/[.(]/)[0],(0,a.jsxs)(a.Fragment,{children:[s.map(((e,t)=>t%2?(0,a.jsxs)("em",{children:["[",e,"]"]},t):(0,a.jsx)("span",{children:e},t)))," "]})]}(m)||[h,h]),[m,h]),y=(0,s.useMemo)((()=>!!c||!!e&&(!Array.isArray(e)||0!==e.length)),[e,c]),j=(0,s.useMemo)((()=>(0,a.jsx)(x.Z,{color:y?void 0:"transparent",icon:f?"caret-up":"caret-down"})),[y,f]);return(0,a.jsxs)(ue,{className:`${t} ui--Expander ${f?"isExpanded":""} ${n?"isHeader":""} ${o?"isPadded":""} ${y?"hasContent":""} ${p?"withBreaks":""}`,children:[(0,a.jsxs)("div",{className:"ui--Expander-summary"+(i?" isLeft":""),onClick:b,children:[i&&j,(0,a.jsxs)("div",{className:"ui--Expander-summary-header",children:[(0,a.jsx)("div",{className:"ui--Expander-summary-title",children:u}),d,w&&(0,a.jsx)("div",{className:"ui--Expander-summary-header-sub",children:f?w:v})]}),!i&&j]}),y&&(f||g)&&(0,a.jsx)("div",{className:"ui--Expander-content",children:e||A})]})})),he=s.memo((function({className:e="",label:t,withEllipsis:n}){return(0,a.jsx)("label",{className:e,children:n?(0,a.jsx)("div",{className:"withEllipsis",children:t}):t})}));var pe=n(34814),ge=n(9118),fe=n(74065),be=n(86135),xe=n(48731);const Ae=s.memo((function({accountId:e,className:t="",extrinsic:n,icon:i,isBasic:r,isBusy:o,isDisabled:l,isIcon:c,isToplevel:d,isUnsigned:u,label:m,onClick:h,onFailed:p,onSendRef:f,onStart:b,onSuccess:x,onUpdate:A,params:v,tooltip:w,tx:y,withSpinner:j,withoutLink:C}){const{t:k}=(0,z.$)(),N=(0,fe.X)(),{queueExtrinsic:E}=(0,be.L)(),[S,I]=(0,s.useState)(!1),[B,D]=(0,s.useState)(!1);(0,s.useEffect)((()=>{B&&b&&b()}),[B,b]);const L=(0,s.useCallback)((e=>{N.current&&I(!1),p&&p(e)}),[p,I,N]),V=(0,s.useCallback)((e=>{N.current&&I(!1),x&&x(e)}),[x,I,N]),P=(0,s.useCallback)((()=>{N.current&&D(!0)}),[D,N]),T=(0,s.useCallback)((()=>{let t;n?t=Array.isArray(n)?n:[n]:y&&(t=[y(...(0,g.m)(v)?v():v||[])]),(0,xe.hu)(t?.length,"Expected generated extrinsic passed to TxButton"),N.current&&j&&I(!0),t.forEach((t=>{E({accountId:e?.toString(),extrinsic:t,isUnsigned:u,txFailedCb:j?L:p,txStartCb:P,txSuccessCb:j?V:x,txUpdateCb:A})})),h&&h()}),[L,P,V,e,u,h,p,x,A,v,n,E,I,y,j,N]);return f&&(f.current=T),(0,a.jsx)(G,{className:t,icon:i||"check",isBasic:r,isBusy:o,isDisabled:S||l||!u&&!e||!y&&(Array.isArray(n)?0===n.length:!n),isIcon:c,isToplevel:d,label:m||(c?"":k("Submit")),onClick:T,tooltip:w,withoutLink:C})})),ve={transform:e=>e.isNone?0:e.unwrap().prior.length+1},we=s.memo((function({className:e="",isPool:t,stakingInfo:n}){const{api:s}=(0,F.h)(),{allAccounts:i}=(0,pe.x)(),{t:r}=(0,z.$)(),o=(0,ge.W7)(s.query.staking.slashingSpans,[n?.stashId],ve);return n?.redeemable?.gtn(0)?(0,a.jsx)("div",{className:e,children:(0,a.jsx)(ee.Z,{value:n.redeemable,children:i.includes((n.controllerId||"").toString())?(0,a.jsx)(Ae,{accountId:n.controllerId,icon:"lock",isIcon:!0,params:t?[n.controllerId,o]:1===s.tx.staking.withdrawUnbonded.meta.args.length?[o]:[],tooltip:r("Withdraw these unbonded funds"),tx:t?s.tx.nominationPools.withdrawUnbonded:s.tx.staking.withdrawUnbonded},"unlock"):(0,a.jsx)("span",{className:"icon-void",children:" "})})}):null}));var ye=n(48801),je=n.n(ye);const Ce=A.z.div` + white-space: nowrap; + + .ui--Icon.left { + margin-left: 0; + margin-right: 0.25rem; + } + + .ui--Icon.right { + margin-left: 0.25rem; + margin-right: 0; + } + + .ui--FormatBalance { + display: inline-block; + } +`,ke=s.memo((function({className:e="",iconPosition:t="left",stakingInfo:n}){const{api:i}=(0,F.h)(),r=(0,ge.W7)(i.derive.session.progress),{t:o}=(0,z.$)(),[l,c,d]=(0,s.useMemo)((()=>function(e,t){if(!e?.unlocking||!t)return[[],ae.nw,!1];const n=t.eraProgress.gt(ae.nw)&&t.eraProgress.gt(t.eraLength),a=e.unlocking.filter((({remainingEras:e,value:t})=>t.gt(ae.nw)&&e.gt(ae.nw))).map((e=>[e,e.remainingEras,e.remainingEras.sub(ae.If).imul(t.eraLength).iadd(t.eraLength).isub(n?t.eraProgress.mod(t.eraLength):t.eraProgress)])),s=a.reduce(((e,[{value:t}])=>e.iadd(t)),new(je())(0));return[a,s,n]}(n,r)),[r,n]);if(!n||!l.length)return null;const u=`${n.accountId.toString()}-unlocking-trigger`;return(0,a.jsxs)(Ce,{className:e,children:["left"===t&&(0,a.jsx)(x.Z,{className:"left",icon:"clock",tooltip:u}),(0,a.jsx)(ee.Z,{value:c}),(0,a.jsx)(v.Z,{trigger:u,children:l.map((([{value:e},t,n],s)=>(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("div",{children:o("Unbonding {{value}}",{replace:{value:(0,se.a)(e,{forceUnit:"-"})}})}),(0,a.jsx)("div",{className:"faded",children:i.consts.babe?.epochDuration?(0,a.jsx)(te.Z,{label:`${o("{{blocks}} blocks",{replace:{blocks:(0,h.u)(n)}})}, `,value:n}):o("{{eras}} eras remaining",{replace:{eras:(0,h.u)(t)}})}),d&&(0,a.jsx)("div",{className:"faded",children:o("Era is overdue for completion due to current network operating conditions")})]},s)))}),"right"===t&&(0,a.jsx)(x.Z,{className:"right",icon:"clock",tooltip:u})]})})),Ne={available:!0,bonded:!0,locked:!0,redeemable:!0,reserved:!0,total:!0,unlocking:!0,vested:!0},Ee={crypto:!0,nonce:!0},Se={unstakeThreshold:!0,validatorPayment:!0};function Ie(){return(0,a.jsx)("span",{className:"icon-void",children:" "})}function Be(e,t){const n=t.toHuman();try{return e[n]||n}catch{return n}}function De({stakingInfo:e,withBalance:t=!0,withValidatorPrefs:n=!1}){if(e)return!0;if(!0===t||n)return!1;if((0,ne.K)(t)){if(t.unlocking||t.redeemable)return!1;if(t.bonded)return Array.isArray(t.bonded)}return!0}function Le({address:e,balancesAll:t,withExtended:n},s){const i=!0===n?Ee:n||void 0;return i?(0,a.jsxs)("div",{className:"column",children:[t&&i.nonce&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(he,{label:s("transactions")}),(0,a.jsx)("div",{className:"result",children:(0,h.u)(t.accountNonce)})]}),i.crypto&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(he,{label:s("type")}),(0,a.jsx)(re,{accountId:e,className:"result"})]})]}):null}function Ve({stakingInfo:e,withValidatorPrefs:t=!1},n){const s=!0===t?Se:t;return s&&e?.validatorPrefs?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{}),s.unstakeThreshold&&e.validatorPrefs.unstakeThreshold&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(he,{label:n("unstake threshold")}),(0,a.jsx)("div",{className:"result",children:e.validatorPrefs.unstakeThreshold.toString()})]}),s.validatorPayment&&(e.validatorPrefs.commission||e.validatorPrefs.validatorPayment)&&(e.validatorPrefs.validatorPayment?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(he,{label:n("commission")}),(0,a.jsx)(ee.Z,{className:"result",value:e.validatorPrefs.validatorPayment})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(he,{label:n("commission")}),(0,a.jsxs)("span",{children:[(e.validatorPrefs.commission.unwrap().toNumber()/1e7).toFixed(2),"%"]})]}))]}):null}function Pe(e,t,n,{address:i,balanceDisplay:r,balancesAll:o,bestNumber:l,convictionLocks:c,democracyLocks:d,isAllLocked:u,otherBonded:m,ownBonded:p,stakingInfo:g,votingOf:f,withBalanceToggle:b,withLabel:A}){const w=[],y=o;if(!b&&r.total&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:A?n("total"):""}),(0,a.jsx)(ee.Z,{className:"result "+(o?"":"--tmp"),formatIndex:e,labelPost:(0,a.jsx)(Ie,{}),value:o?o.freeBalance.add(o.reservedBalance):1})]},0)),o&&r.available&&y.availableBalance&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("transferrable")}),(0,a.jsx)(ee.Z,{className:"result",formatIndex:e,labelPost:(0,a.jsx)(Ie,{}),value:y.availableBalance})]},1)),l&&r.vested&&y?.isVesting){const t=y.vesting.filter((({endBlock:e})=>l.lt(e)));w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("vested")}),(0,a.jsx)(ee.Z,{className:"result",formatIndex:e,labelPost:(0,a.jsx)(x.Z,{icon:"info-circle",tooltip:`${i}-vested-trigger`}),value:y.vestedBalance,children:(0,a.jsxs)(v.Z,{trigger:`${i}-vested-trigger`,children:[(0,a.jsxs)("div",{children:[(0,se.a)(y.vestedClaimable,{forceUnit:"-"}),(0,a.jsx)("div",{className:"faded",children:n("available to be unlocked")})]}),t.map((({endBlock:e,locked:t,perBlock:s,vested:i},r)=>(0,a.jsxs)("div",{className:"inner",children:[(0,a.jsxs)("div",{children:[(0,se.a)(i,{forceUnit:"-"}),(0,a.jsx)("div",{className:"faded",children:n("of {{locked}} vested",{replace:{locked:(0,se.a)(t,{forceUnit:"-"})}})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(te.Z,{value:e.sub(l)}),(0,a.jsxs)("div",{className:"faded",children:[n("until block")," ",(0,h.u)(e)]})]}),(0,a.jsxs)("div",{children:[(0,se.a)(s),(0,a.jsx)("div",{className:"faded",children:n("per block")})]})]},`item:${r}`)))]})})]},2))}const j=(y?.namedReserves||[]).reduce(((e,t)=>e.concat(...t)),[]),C=!!j&&0!==j.length;if(r.locked&&o&&(u||y.lockedBalance?.gtn(0))&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("locked")}),(0,a.jsx)(ee.Z,{className:"result",formatIndex:e,labelPost:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.Z,{icon:"info-circle",tooltip:`${i}-locks-trigger`}),(0,a.jsx)(v.Z,{trigger:`${i}-locks-trigger`,children:y.lockedBreakdown.map((({amount:e,id:s,reasons:i},r)=>(0,a.jsxs)("div",{className:"row",children:[e?.isMax()?n("everything"):(0,se.a)(e,{forceUnit:"-"}),s&&(0,a.jsx)("div",{className:"faded",children:Be(t,s)}),(0,a.jsx)("div",{className:"faded",children:i.toString()})]},r)))})]}),value:u?"all":y.lockedBalance})]},3)),r.reserved&&o?.reservedBalance?.gtn(0)&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("reserved")}),(0,a.jsx)(ee.Z,{className:"result",formatIndex:e,labelPost:C?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.Z,{icon:"info-circle",tooltip:`${i}-named-reserves-trigger`}),(0,a.jsx)(v.Z,{trigger:`${i}-named-reserves-trigger`,children:j.map((({amount:e,id:n},s)=>(0,a.jsxs)("div",{children:[(0,se.a)(e,{forceUnit:"-"}),n&&(0,a.jsx)("div",{className:"faded",children:Be(t,n)})]},s)))})]}):(0,a.jsx)(Ie,{}),value:o.reservedBalance})]},4)),r.bonded&&(p.gtn(0)||0!==m.length)&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("bonded")}),(0,a.jsx)(ee.Z,{className:"result",formatIndex:e,labelPost:(0,a.jsx)(Ie,{}),value:p,children:0!==m.length&&(0,a.jsxs)(a.Fragment,{children:[" (+",m.map(((t,n)=>(0,a.jsx)(ee.Z,{formatIndex:e,labelPost:(0,a.jsx)(Ie,{}),value:t},n))),")"]})})]},5)),r.redeemable&&g?.redeemable?.gtn(0)&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("redeemable")}),(0,a.jsx)(we,{className:"result",stakingInfo:g})]},6)),r.unlocking){if(g?.unlocking&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("unbonding")}),(0,a.jsx)("div",{className:"result",children:(0,a.jsx)(ke,{iconPosition:"right",stakingInfo:g})})]},7)),d&&0!==d.length)w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("democracy")}),(0,a.jsx)("div",{className:"result",children:(0,a.jsx)(ce,{value:d})})]},8));else if(l&&f&&f.isDirect){const{prior:[e,t]}=f.asDirect;t.gt(ae.nw)&&e.gt(ae.nw)&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("democracy")}),(0,a.jsx)("div",{className:"result",children:(0,a.jsx)(ce,{value:[{balance:t,isFinished:l.gt(e),unlockAt:e}]})})]},8))}if(l&&c?.length){const e=c.reduce(((e,{total:t})=>(0,ie.x)(e,t)),ae.nw);w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("referenda")}),(0,a.jsx)(ee.Z,{className:"result",labelPost:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.Z,{icon:"clock",tooltip:`${i}-conviction-locks-trigger`}),(0,a.jsx)(v.Z,{trigger:`${i}-conviction-locks-trigger`,children:c.map((({endBlock:e,locked:t,refId:s,total:i},r)=>(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("div",{className:"nowrap",children:["#",s.toString()," ",(0,se.a)(i,{forceUnit:"-"})," ",t]}),(0,a.jsx)("div",{className:"faded nowrap",children:e.eq(ae.Ew)?n("ongoing referendum"):l.gte(e)?n("lock expired"):(0,a.jsxs)(a.Fragment,{children:[(0,h.u)(e.sub(l))," ",n("blocks"),", ",(0,a.jsx)(te.Z,{isInline:!0,value:e.sub(l)})]})})]},r)))})]}),value:e})]},9))}}return o&&o.accountNonce&&r.nonce&&w.push((0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:n("transactions")}),(0,a.jsxs)("div",{className:"result",children:[(0,h.u)(o.accountNonce),(0,a.jsx)(Ie,{})]})]},10)),b?(0,a.jsx)(s.Fragment,{children:(0,a.jsx)(me,{className:o?"":"isBlurred",summary:(0,a.jsx)(ee.Z,{formatIndex:e,value:o?.freeBalance.add(o.reservedBalance)}),children:0!==w.length&&(0,a.jsx)("div",{className:"body column",children:w})})},e):(0,a.jsx)(s.Fragment,{children:w},e)}function Te(e,t,n,a){const{address:s,balancesAll:i,convictionLocks:r,democracyLocks:o,stakingInfo:l,votingOf:c,withBalance:d=!0,withBalanceToggle:u=!1,withLabel:m=!1}=e,h=!0===d?Ne:d||!1;if(!h)return[null];const[p,g]=function(e,t){let n=[],a=ae.nw;return Array.isArray(t)?(n=t.filter(((e,t)=>0!==t)).filter((e=>e.gt(ae.nw))),a=t[0]):e?.stakingLedger?.active&&e.accountId.eq(e.stashId)&&(a=e.stakingLedger.active.unwrap()),[a,n]}(l,h.bonded),f={address:s,balanceDisplay:h,bestNumber:n,convictionLocks:r,democracyLocks:o,isAllLocked:!!i&&i.lockedBreakdown.some((({amount:e})=>e?.isMax())),otherBonded:g,ownBonded:p,votingOf:c,withBalanceToggle:u,withLabel:m},b=[Pe(0,t,a,{...f,balancesAll:i,stakingInfo:l})];return u&&i?.additional.length&&i.additional.forEach(((e,n)=>{b.push(Pe(n+1,t,a,{...f,balancesAll:e}))})),b}const Me=(0,X.withMulti)((0,A.z)((function(e){const{t}=(0,z.$)(),n=(0,_.C)(),{children:i,className:r="",extraInfo:o,withBalanceToggle:l,withHexSessionId:c}=e,d=(0,s.useRef)({democrac:t("via Democracy/Vote"),phrelect:t("via Council/Vote"),pyconvot:t("via Referenda/Vote"),"staking ":t("via Staking/Bond"),"vesting ":t("via Vesting")});return(0,a.jsxs)("div",{className:`${r} ui--AddressInfo ${l?"ui--AddressInfo-expander":""}`,children:[(0,a.jsxs)("div",{className:"column"+(l?" column--expander":""),children:[Te(e,d.current,n,t),c?.[0]&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(he,{label:t("session keys")}),(0,a.jsx)("div",{className:"result",children:c[0]})]}),c&&c[0]!==c[1]&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(he,{label:t("session next")}),(0,a.jsx)("div",{className:"result",children:c[1]})]}),Ve(e,t),o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{}),o.map((([e,t],n)=>(0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(he,{label:e}),(0,a.jsx)("div",{className:"result",children:t})]},`label:${n}`)))]})]}),Le(e,t),i&&(0,a.jsx)("div",{className:"column",children:i})]})}))` + align-items: flex-start; + display: flex; + flex: 1; + white-space: nowrap; + + &:not(.ui--AddressInfo-expander) { + justify-content: flex-end; + } + + .nowrap { + white-space: nowrap; + + .ui--FormatBalance { + display: inline-block; + } + } + + & + .ui--Button, + & + .ui--ButtonGroup { + margin-right: 0.25rem; + margin-top: 0.5rem; + } + + .column { + max-width: 260px; + &.column--expander { + width: 17.5rem; + + .ui--Expander { + width: 100%; + + .summary { + display: inline-block; + text-align: right; + min-width: 12rem; + } + } + } + + &:not(.column--expander) { + flex: 1; + display: grid; + column-gap: 0.75rem; + row-gap: 0.5rem; + opacity: 1; + + div.inner { + margin-top: 0.25rem; + + &:first-child { + margin-top: 0; + } + } + + label { + grid-column: 1; + padding-right: 0.5rem; + text-align: right; + vertical-align: middle; + margin-bottom: 0.25rem; + + .help.circle.icon { + display: none; + } + } + + .result { + grid-column: 2; + text-align: right; + + .ui--Icon, + .icon-void { + margin-left: 0.25rem; + margin-right: 0; + padding-right: 0 !important; + } + + .icon-void { + float: right; + width: 1em; + } + } + } + } + `,(0,X.withCalls)(["derive.balances.all",{paramName:"address",propName:"balancesAll",skipIf:function({withBalance:e=!0,withExtended:t=!1}){if(!0===e||!0===t)return!1;if((0,ne.K)(e)){if(e.available||e.locked||e.reserved||e.total||e.vested)return!1}else if((0,ne.K)(t)&&t.nonce)return!1;return!0}}],["derive.staking.account",{paramName:"address",propName:"stakingInfo",skipIf:De}],["derive.democracy.locks",{paramName:"address",propName:"democracyLocks",skipIf:De}],["query.democracy.votingOf",{paramName:"address",propName:"votingOf",skipIf:De}])),Fe={available:!0,bonded:!0,free:!0,locked:!0,reserved:!0,total:!0},ze=A.z.section` + .balanceExpander { + justify-content: flex-start; + + .column { + width: auto; + max-width: 18.57rem; + + label { + text-align: left; + color: inherit; + } + + .ui--Expander-content .ui--FormatBalance-value { + font-size: var(--font-size-small); + } + } + } +`,Ze=s.memo((function({address:e,className:t}){const{t:n}=(0,z.$)();return(0,a.jsxs)(ze,{className:t,children:[(0,a.jsx)("div",{className:"ui--AddressMenu-sectionHeader",children:n("balance")}),(0,a.jsx)(Me,{address:e,className:"balanceExpander",withBalance:Fe,withLabel:!0},e)]})}));var Re=n(11677);const $e=(0,Re.e)("useRegistrars",(function(e){const{api:t}=(0,F.h)(),{allAccounts:n,hasAccounts:a}=(0,pe.x)(),i=(0,ge.W7)(!e&&t.query.identity?.registrars);return(0,s.useMemo)((()=>{const e=(i||[]).map(((e,t)=>({address:e.isSome?e.unwrap().account.toString():null,index:t}))).filter((e=>!!e.address));return{isRegistrar:a&&e.some((({address:e})=>n.includes(e))),registrars:e}}),[n,a,i])}));var qe=n(19008),Ue=n(52953),He=n(74076),Qe=n(9652),Oe=n(15221),We=n(16039),Ge=n(47025);function Je(e){return!(!e||!e.toHuman)}const Ke=s.memo((function({className:e="",forceIconType:t,prefix:n,size:i=24,theme:r,value:o}){const{apiEndpoint:l,isEthereum:c,specName:d,systemName:u}=(0,F.h)(),{t:m}=(0,z.$)(),{queueAction:h}=(0,be.L)(),p=r||function(e,t,n){return"default"===We.X.icon&&(e?.ui?.identityIcon||(0,Qe.t)(t,n))||We.X.icon}(l,u,d),g="robohash"===p?Ge.Z:void 0,f=(0,s.useCallback)((e=>h({account:e,action:m("clipboard"),message:m("address copied"),status:"queued"})),[h,m]);return(0,a.jsx)(Oe.ZP,{Custom:g,className:`ui--Identicon-React-Base ${e}`,onCopy:f,prefix:n,size:i,theme:t||(c?"ethereum":p),value:Je(o)?o.toString():o})}));var Ye=n(36609);function Xe({className:e="",label:t,value:n}){let s;if(Array.isArray(n)){const e=n.filter(((e,t)=>0!==t)),t=e.reduce(((e,t)=>e.add(t)),ae.nw).gtn(0);t&&(s=e.map(((e,t)=>(0,a.jsx)(ee.Z,{value:e},t))))}return(0,a.jsx)(ee.Z,{className:`${e} ui--Balance`,label:t,value:Array.isArray(n)?n[0]:n,children:s&&(0,a.jsxs)("span",{children:[" (+",s,")"]})})}const _e=s.memo((function(e){const{balance:t,className:n="",label:s,params:i}=e;return i?t?(0,a.jsx)(a.Fragment,{children:Xe({className:n,label:s,value:t})}):(0,a.jsx)(Ye.Z,{className:`${n} ui--Balance`,label:s,params:i}):null})),et={transform:e=>e.unwrapOr(null)},tt={transform:e=>e.unwrapOr(null)},nt=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,F.h)(),r=(0,ge.W7)(i.query.staking?.bonded,[s],et),o=(0,ge.W7)(r&&i.query.staking?.ledger,[r],tt);return(0,a.jsx)(ee.Z,{className:t,label:n,value:o?.active,children:e})})),at=s.memo((function(e){const{bonded:t,className:n="",label:s,params:i}=e;return i?t?(0,a.jsx)(a.Fragment,{children:Xe({className:n,label:s,value:t})}):(0,a.jsx)(nt,{className:`${n} ui--Bonded`,label:s,params:i}):null})),st=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,F.h)(),r=(0,ge.W7)(i.derive.council.votesOf,[s]);return r?.stake.gtn(0)?(0,a.jsx)(ee.Z,{className:t,label:n,value:r?.stake,children:e}):null})),it=s.memo((function({className:e="",label:t,params:n}){return n?(0,a.jsx)(st,{className:`${e} ui--LockedVote`,label:t,params:n}):null})),rt=A.z.div` + overflow-x: hidden; + padding: 0 0.25rem 0 1rem; + text-align: left; + text-overflow: ellipsis; + white-space: nowrap; + + &.padded { + padding: 0 1rem 0 0; + } + + &.summary { + position: relative; + top: -0.2rem; + } + + .ui--AddressMini-info { + } + + .ui--AddressMini-address { + overflow: hidden; + text-align: left; + text-overflow: ellipsis; + + > div { + overflow: hidden; + text-overflow: ellipsis; + + &.shortAddress { + min-width: var(--width-shortaddr); + max-width: var(--width-shortaddr); + opacity: var(--opacity-light); + } + } + } + + &.withShrink { + .ui--AddressMini-address { + min-width: 3rem; + } + } + + .ui--AddressMini-label { + margin: 0 0 -0.5rem 2.25rem; + } + + .ui--AddressMini-balances { + display: grid; + + .ui--Balance, + .ui--Bonded, + .ui--LockedVote { + font-size: var(--font-size-tiny); + margin-left: 2.25rem; + margin-top: -0.5rem; + text-align: left; + } + } + + .ui--AddressMini-icon { + .ui--AddressMini-icon-info { + position: absolute; + right: -0.5rem; + top: -0.5rem; + z-index: 1; + } + + .ui--IdentityIcon { + margin-right: 0.5rem; + vertical-align: middle; + } + } + + .ui--AddressMini-icon, + .ui--AddressMini-info { + position: relative; + vertical-align: middle; + } + + .ui--AddressMini-summary { + font-size: var(--font-size-small); + line-height: 1.2; + margin-left: 2.25rem; + margin-top: -0.2rem; + text-align: left; + } +`,ot=s.memo((function({balance:e,bonded:t,children:n,className:s="",iconInfo:i,isHighlight:r,isPadded:o=!0,label:l,labelBalance:c,nameExtra:d,onNameClick:u,summary:m,value:h,withAddress:p=!0,withBalance:g=!1,withBonded:f=!1,withLockedVote:b=!1,withName:x=!0,withShrink:A=!1,withSidebar:v=!0}){return h?(0,a.jsxs)(rt,{className:`${s} ui--AddressMini ${r?"isHighlight":""} ${o?"padded":""} ${A?"withShrink":""}`,children:[l&&(0,a.jsx)("label",{className:"ui--AddressMini-label",children:l}),(0,a.jsxs)("span",{className:"ui--AddressMini-icon",children:[(0,a.jsx)(Ke,{value:h}),i&&(0,a.jsx)("div",{className:"ui--AddressMini-icon-info",children:i})]}),(0,a.jsxs)("span",{className:"ui--AddressMini-info",children:[p&&(0,a.jsx)("span",{className:"ui--AddressMini-address",onClick:u,children:x?(0,a.jsx)(P,{value:h,withSidebar:v,children:d}):(0,a.jsx)("span",{className:"shortAddress",children:h.toString()})}),n]}),(0,a.jsxs)("div",{className:"ui--AddressMini-balances",children:[g&&(0,a.jsx)(_e,{balance:e,label:c,params:h}),f&&(0,a.jsx)(at,{bonded:t,label:"",params:h}),b&&(0,a.jsx)(it,{params:h}),m&&(0,a.jsx)("div",{className:"ui--AddressMini-summary",children:m})]})]}):null})),lt=A.z.div` + & { + display: flex; + align-items: center; + + .ui--AvatarItem-icon { + margin-right: 0.5rem; + display: flex; + align-items: center; + justify-content: center; + } + } + + .ui--AvatarItem-details { + .ui--AvatarItem-title { + font-weight: 600; + font-size: var(--font-size-base); + } + + .ui--AvatarItem-subtitle { + font-weight: var(--font-weight-normal); + font-size: var(--font-size-base); + } + } + + &.big { + .ui--AvatarItem-icon { + width: 3.4rem; + height: 3.4rem; + margin-right: 0.6rem; + + > .ui--Icon { + font-size: 1.6rem; + line-height: 3.4rem; + } + } + + .ui--AvatarItem-details { + .ui--AvatarItem-name { + font-size: 1.4rem; + line-height: 1.4rem; + } + } + } +`,ct=s.memo((function({children:e,className:t="",icon:n,isBig:s,subtitle:i,title:r}){return(0,a.jsxs)(lt,{className:["ui--AvatarItem",t,s&&"big"].join(" "),children:[(0,a.jsx)("div",{className:"ui--AvatarItem-icon",children:n}),(0,a.jsxs)("div",{className:"ui--AvatarItem-details",children:[(0,a.jsx)("div",{className:"ui--AvatarItem-title",children:r}),(0,a.jsx)("div",{className:"ui--AvatarItem-subtitle",children:i})]}),e]})})),dt=A.z.a` + .ui--Icon { + margin-right: 0.5em; + } +`,ut=s.memo((function({className:e="",href:t,icon:n,label:s,onClick:i,rel:r,target:o}){return(0,a.jsxs)(dt,{className:e,href:t,onClick:i,rel:r,target:o,children:[n&&(0,a.jsx)(x.Z,{icon:n}),s]})}));const mt=e=>e.filter((([,e])=>!e.isFeePaid)),ht=e=>e.filter((([,e])=>e.isKnownGood)),pt=e=>e.filter((([,e])=>e.isReasonable)),gt=e=>e.filter((([,e])=>e.isErroneous)),ft=e=>e.filter((([,e])=>e.isLowQuality));const bt=(0,Re.e)("useJudgements",(function(e){const{identity:t}=(0,T.B)(e),{registrars:n}=$e(),a=(0,s.useMemo)((()=>function(e){if(!e)return[];const t=function(e){const t=mt(e),n=ht(t),a=pt(t);return{Erroneous:gt(t),"Known good":n,"Low quality":ft(t),Reasonable:a}}(e.judgements),n=[];for(const e in t){const s=e;0!==t[s].length&&n.push({judgementName:s,registrarsIndexes:(a=t[s],a.map((e=>e[0])))})}var a;return n}(t)),[t]);return(0,s.useMemo)((()=>function(e,t){return e.map((({judgementName:e,registrarsIndexes:n})=>({judgementName:e,registrars:n.map((e=>(e=>t.find((t=>t.index===e)))(e.toNumber())))})))}(a,n)),[n,a])}));var xt=n(17608);const At=A.z.div` + align-items: center; + color: #8B8B8B; + var(--font-size-small); + display: flex; + + & .parent-icon { + font-size: var(--font-size-percent-small); + margin-right: 0.3rem; + margin-left: 0.15rem; + } +`,vt=s.memo((function({address:e,className:t}){return(0,a.jsxs)(At,{className:t,"data-testid":"parent",children:[(0,a.jsx)(x.Z,{className:"parent-icon",icon:"code-branch"}),(0,a.jsx)(P,{value:e,withSidebar:!0})]})})),wt=A.z.div` + overflow-x: hidden; + text-overflow: ellipsis; + white-space: nowrap; + + &.withPadding { + padding: 0.75rem 0; + } + + .ui--AddressSmall-icon { + .ui--IdentityIcon { + margin-right: 0.5rem; + vertical-align: middle; + } + } + + .ui--AddressSmall-info { + position: relative; + vertical-align: middle; + + .parentName, .shortAddress { + font-size: var(--font-size-tiny); + } + + .parentName { + left: 0; + position: absolute; + top: -0.80rem; + } + + .shortAddress { + bottom: -0.95rem; + color: #8B8B8B; + display: inline-block; + left: 0; + min-width: var(--width-shortaddr); + max-width: var(--width-shortaddr); + overflow: hidden; + position: absolute; + text-overflow: ellipsis; + } + } + + .ui--AccountName { + overflow: hidden; + vertical-align: middle; + white-space: nowrap; + + &.withSidebar { + cursor: help; + } + } +`,yt=s.memo((function({children:e,className:t="",defaultName:n,onClickName:s,overrideName:i,parentAddress:r,toggle:o,value:l,withShortAddress:c=!1,withSidebar:d=!0}){return(0,a.jsxs)(wt,{className:`${t} ui--AddressSmall ${r||c?"withPadding":""}`,children:[(0,a.jsx)("span",{className:"ui--AddressSmall-icon",children:(0,a.jsx)(Ke,{value:l})}),(0,a.jsxs)("span",{className:"ui--AddressSmall-info",children:[r&&(0,a.jsx)("div",{className:"parentName",children:(0,a.jsx)(vt,{address:r})}),(0,a.jsx)(P,{className:"accountName "+(d?"withSidebar":""),defaultName:n,onClick:s,override:i,toggle:o,value:l,withSidebar:d,children:e}),l&&c&&(0,a.jsx)("div",{className:"shortAddress","data-testid":"short-address",children:l.toString()})]})]})})),jt=A.z.div` + margin: 0.25rem 0 1rem; + border-top: 1px solid var(--border-table); + + &:first-child, &:last-child { + display: none + } +`,Ct=s.memo((function({className:e=""}){return(0,a.jsx)(jt,{className:`${e} ui--Menu__Divider`})})),kt=A.z.div` + color: var(--color-label); + font-size: var(--font-size-tiny); + line-height: 0.857rem; + margin-bottom: 0.3rem; +`,Nt=s.memo((function({children:e,className:t}){return(0,a.jsx)(kt,{className:t,children:e})})),Et=A.z.div` + align-items: center; + cursor: pointer; + display: flex; + flex-direction: row; + font-size: var(--font-size-small); + line-height: 0.93rem; + padding: 0.5rem 1rem; + position: relative; + + &:last-child { + margin-bottom: 0; + } + + &.hasIcon { + padding-left: 2.6rem; + } + + .ui--Icon { + position: absolute; + left: 1rem; + } + + &.isDisabled { + cursor: default; + opacity: 0.5; + } +`,St=s.memo((function({children:e,className:t="",icon:n,isDisabled:i,label:r,onClick:o}){const l=(0,s.useCallback)((()=>{!i&&o&&Promise.resolve(o()).catch(console.error)}),[i,o]);return(0,a.jsxs)(Et,{className:`${t} ui--Menu__Item ${n?"hasIcon":""} ${i?"isDisabled":""}`,onClick:l,children:[n&&(0,a.jsx)(x.Z,{color:"darkGray",icon:n}),r,e]})})),It=A.z.div` + display: flex; + flex-direction: column; + min-width: 14.286rem; + margin: 1rem 0; + + & > *:not(.ui--Menu__Item):not(.ui--Menu__Divider) { + margin-right: 1rem; + margin-left: 1rem; + } +`,Bt=s.memo((function({children:e,className:t=""}){return(0,a.jsx)(It,{className:`${t} ui--Menu`,children:e})}));Bt.Divider=Ct,Bt.Item=St,Bt.Header=Nt;const Dt=Bt,Lt=(0,Re.e)("useOutsideClick",(function(e,t){const n=(0,s.useCallback)((n=>{e.length&&!function(e,t){return e.some((e=>e.current&&e.current.contains(t.target)))}(e,n)&&t()}),[e,t]);(0,s.useEffect)((()=>(document.addEventListener("click",n,!0),()=>{document.removeEventListener("click",n,!0)})),[n,t])}));var Vt=n(28316);const Pt=14*.8;function Tt(e,t){return"left"===t?e-Pt:"right"===t?Pt:e/2}function Mt(e,t,n,a,s){const{height:i,y:r}=t;return"bottom"===e?a.height-i-r-14>n:s<56?r-(56-s)>n:r>n}function Ft(e,t,n){return"bottom"===t?e/2:-1*(e/2+n+Pt)}function zt(e,t,n,a){return"bottom"===t?e+n.height-a-14:e<56?56:e}const Zt=(0,Re.e)("useScroll",(function(){const[e,t]=(0,s.useState)(window.scrollY),n=(0,s.useCallback)((()=>t(window.scrollY)),[]);return(0,s.useEffect)((()=>(window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)})),[n]),e}));var Rt=n(91012);const $t=(0,Re.e)("useWindowSize",(function(){return(0,s.useContext)(Rt.d)})),qt=(0,Re.e)("useElementPosition",(function(e){const[t,n]=(0,s.useState)(),a=(0,fe.X)(),i=$t(),r=Zt();return(0,s.useEffect)((()=>{if(a.current&&e?.current){const{height:t,width:a,x:s,y:i}=e.current.getBoundingClientRect();n({height:t,width:a,x:s,y:i})}}),[a,e,r,i]),t})),Ut={x:0,y:0},Ht=(0,Re.e)("usePopupWindow",(function(e,t,n){const[a,i]=(0,s.useState)(Ut),[r,o]=(0,s.useState)("top"),l=qt(e),c=qt(t),d=Zt(),u=$t();return(0,s.useEffect)((()=>{u&&c&&o(c.y>u.height/2?"top":"bottom")}),[c,u]),(0,s.useEffect)((()=>{l&&c&&i(function(e,t,n,a,s,i){const r=e.x+e.width/2,o=e.y+s+e.height/2;return{x:r-Tt(a.width,t),y:Mt(n,e,a.height,i,s)?o+Ft(e.height,n,a.height):zt(s,n,i,a.height)}}(c,n,r,l,d,u))}),[n,d,c,r,l,u]),(0,s.useMemo)((()=>({pointerStyle:r,renderCoords:a})),[a,r])})),Qt=A.z.div` + background-color: var(--bg-menu); + border: 1px solid #d4d4d5; + border-radius: 4px; + box-shadow: 0 2px 4px 0 rgb(34 36 38 / 12%), 0 2px 10px 0 rgb(34 36 38 / 15%); + color: var(--color-text); + left: 0; + margin: 0.7rem 0; + padding: 0; + position: absolute; + top: 0; + z-index: -1; + + &.leftPosition { + &::before { + left: unset; + right: 0.75rem; + } + } + + &.rightPosition { + &::before { + left: 0.75rem; + right: unset; + } + } + + &::before { + background-color: var(--bg-menu); + bottom: -0.5rem; + box-shadow: 1px 1px 0 0 #bababc; + content: ''; + height: 1rem; + position: absolute; + right: 50%; + top: unset; + width: 1rem; + transform: rotate(45deg); + z-index: 2; + } + + &.bottomPointer::before { + box-shadow: -1px -1px 0 0 #bababc; + + top: -0.5rem; + bottom: unset; + } + + .ui.text.menu .item { + color: var(--color-text) !important; + text-align: left; + + &.disabled { + opacity: 0.3; + } + } + + & > *:not(.ui--Menu) { + margin-left: 1rem; + margin-right: 1rem; + } + + & > *:first-child:not(.ui--Menu) { + margin-top: 1rem; + } + + & > *:last-child:not(.ui--Menu) { + margin-bottom: 1rem; + } +`,Ot=s.memo((function({children:e,className:t="",position:n,triggerRef:s,windowRef:i}){const{pointerStyle:r,renderCoords:{x:o,y:l}}=Ht(i,s,n);return(0,Vt.createPortal)((0,a.jsx)(Qt,{className:`${t} ${r}Pointer ${n}Position`,"data-testid":"popup-window",ref:i,style:o&&l&&{transform:`translate3d(${o}px, ${l}px, 0)`,zIndex:1e3}||void 0,children:e}),document.body)})),Wt=A.z.div` + display: inline-flex; + flex-direction: column; + justify-content: center; + position: relative; +`,Gt=s.memo((function({children:e,className:t="",closeOnScroll:n,isDisabled:i,onCloseAction:r,position:o="left",value:l}){const{themeClassName:c}=(0,b.F)(),[d,u,m]=(0,de.O)(!1),h=(0,s.useRef)(null),p=(0,s.useRef)(null),g=(0,s.useCallback)((()=>m(!1)),[m]),f=(0,s.useMemo)((()=>[h,p]),[h,p]);return Lt(f,g),(0,s.useEffect)((()=>(n&&document.addEventListener("scroll",g,!0),()=>document.removeEventListener("scroll",g,!0))),[n,g,m]),(0,s.useEffect)((()=>{!d&&r&&r()}),[d,r]),(0,a.jsxs)(Wt,{className:`${t} ui--Popup ${c}`,children:[d&&(0,a.jsx)(Ot,{position:o,triggerRef:h,windowRef:p,children:l}),(0,a.jsx)("div",{"data-testid":"popup-open",onClick:u,ref:h,children:e??(0,a.jsx)(G,{className:d?"isOpen":"",icon:"ellipsis-v",isDisabled:i,isReadOnly:!1})})]})})),Jt=s.memo((function({judgement:{judgementName:e,registrars:t}}){const n=(0,s.useMemo)((()=>{return"Erroneous"===(t=e)||"Low quality"===t?"red":"green";var t}),[e]);return(0,a.jsx)(Gt,{closeOnScroll:!0,position:"middle",value:(0,a.jsx)(Dt,{children:t.map((e=>e&&(0,a.jsx)(yt,{value:e.address},e.address)))}),children:(0,a.jsx)(xt.Z,{color:n,label:`${t.length} ${e}`,size:"tiny"})})})),Kt=A.z.div` + margin-top: 0.714rem; + + &:not(.no-judgements) { + .ui--Tag:hover { + cursor: pointer; + } + } +`,Yt=s.memo((function({address:e,className:t=""}){const{t:n}=(0,z.$)(),s=bt(e);return 0===s.length?(0,a.jsx)("div",{className:`${t} no-judgements`,"data-testid":"judgements",children:(0,a.jsx)(xt.Z,{color:"yellow",label:n("No judgements"),size:"tiny"},"NoJudgements")}):(0,a.jsx)(Kt,{className:t,"data-testid":"judgements",children:s.map((t=>(0,a.jsx)(Jt,{judgement:t},`${e}${t.judgementName}`)))})}));var Xt=n(25294),_t=n(33749),en=n(23729),tn=n.n(en),nn=n(69187),an=n(99374),sn=n(1346),rn=n(17751),on=n(61162),ln=n(72282),cn=n.n(ln),dn=n(54371);const un=()=>{},mn=A.z.div` + .copySpan { + white-space: nowrap; + } +`,hn=s.memo((function({children:e,className:t="",icon:n="copy",label:i,type:r,value:o}){const{t:l}=(0,z.$)(),{queueAction:c}=(0,be.L)(),d=(0,s.useCallback)((()=>{c&&c({action:l("clipboard"),message:l("{{type}} copied",{replace:{type:r||l("value")}}),status:"queued"})}),[r,c,l]);return(0,dn.H)(o)?(0,a.jsx)(mn,{className:`${t} ui--CopyButton`,children:(0,a.jsx)(cn(),{onCopy:d,text:o,children:(0,a.jsxs)("div",{className:"copyContainer",children:[e,(0,a.jsx)("span",{className:"copySpan",children:(0,a.jsx)(G,{className:"icon-button show-on-hover",icon:n,isDisabled:!o,label:i,onClick:un})})]})})}):null}));var pn=n(12493);const gn=s.memo((function({children:e,className:t="",copyValue:n,defaultValue:s,isFull:i,isHidden:r,isSmall:o,label:l,value:c,withCopy:d,withLabel:u}){return(0,a.jsxs)(pn.Z,{className:t,isFull:i,isHidden:r,isSmall:o,label:l,withLabel:u,children:[(0,a.jsxs)("div",{className:"ui--Static ui dropdown selection disabled",children:[c||s,e]}),d&&(0,a.jsx)(hn,{value:n||c||s})]})}));var fn=n(94175);const bn=A.z.div` + display: flex; + flex-wrap: nowrap; + justify-content: space-between; + position: relative; + white-space: nowrap; + + > .address { + display: inline-block; + flex: 1; + font-size: var(--font-size-small); + margin-left: 1rem; + max-width: var(--width-shortaddr); + min-width: var(--width-shortaddr); + opacity: var(--opacity-light); + overflow: hidden; + text-align: right; + text-overflow: ellipsis; + } + + > .icon { + position: absolute; + top: -5px; + left: 0; + } + + > .name { + display: inline-block; + flex: 1 0; + margin-left: 3rem; + overflow: hidden; + text-overflow: ellipsis; + + &.uppercase { + text-transform: uppercase; + } + } +`,xn=s.memo((function({address:e,className:t=""}){return(0,a.jsxs)(bn,{className:`${t} ui--KeyPair`,children:[(0,a.jsx)(Ke,{className:"icon",value:e}),(0,a.jsx)("div",{className:"name",children:(0,a.jsx)(P,{value:e})}),(0,a.jsx)("div",{className:"address",children:e})]})}));function An(e,t=!0){const n="ethereum"===nn.Nn.keyring.type?20:32;try{if((0,fn.m)(e.key).length>=n)return{...e,text:(0,a.jsx)(xn,{address:e.key||"",isUppercase:t,name:e.name})}}catch{}return null}const vn="options:InputAddress",wn="all",yn=[];function jn(e){try{return(0,f.Hc)(e,!1,"ethereum"===nn.Nn.keyring.type?20:32)||null}catch{}return null}function Cn(e){if(!e)return null;return jn(e)||null}function kn(e){let t;const n=nn.Nn.getAccount(e);let a;if(n)a=n.meta.name;else{const n=nn.Nn.getAddress(e);n?(a=n.meta.name,t=n.meta.isRecent):t=!0}return An((0,an.e)(e,a),!t)}function Nn(){return tn().get(vn)||{defaults:{}}}function En(e=wn){return Nn().defaults[e]}function Sn(e=wn,t){const n=Nn();n.defaults[e]=t,tn().set(vn,n)}function In(e){return e.reduce(((e,t,n)=>(e.some((({key:e},a)=>a!==n&&e===t.key))||e.push(t),e)),[])}class Bn extends s.PureComponent{state={};static getDerivedStateFromProps({type:e,value:t},{lastValue:n}){try{return{lastValue:n||En(e),value:Array.isArray(t)?t.map((e=>(0,f.Hc)(e))):(0,f.Hc)(t)||void 0}}catch{return null}}render(){const{className:e="",defaultValue:t,hideAddress:n=!1,isDisabled:s=!1,isError:i,isMultiple:r,label:o,labelExtra:l,options:c,optionsAll:d,placeholder:u,type:m=wn,withEllipsis:h,withLabel:p}=this.props;if(!(c&&0!==c.length||d&&0!==Object.keys(d[m]).length||s))return(0,a.jsx)(gn,{className:e,label:o,children:"No accounts are available for selection."});const{lastValue:g,value:f}=this.state,b=this.getLastOptionValue(),x=jn(s||t&&"0x"!==t&&(this.hasValue(t)||"allPlus"===m)?t:this.hasValue(g)?g:b?.value),A=c?In(c.map((e=>An(e))).filter((e=>!!e))):s&&x?[kn(x)].filter((e=>!!e)):x?this.addActual(x):this.getFiltered(),v=r||!(0,sn.o)(f)?void 0:x;return(0,a.jsx)(Dn,{className:`${e} ui--InputAddress ${n?"hideAddress":""}`,defaultValue:v,isDisabled:s,isError:i,isMultiple:r,label:o,labelExtra:l,onChange:r?this.onChangeMulti:this.onChange,onSearch:this.onSearch,options:A,placeholder:u,renderLabel:r?this.renderLabel:void 0,value:r&&!f?yn:f,withEllipsis:h,withLabel:p})}addActual(e){const t=this.getFiltered();return this.hasValue(e)?t:t.concat(...[kn(e)].filter((e=>!!e)))}renderLabel=({value:e})=>{if(e)return(0,f.s2)(e)};getLastOptionValue(){const e=this.getFiltered();return e.length?e[e.length-1]:void 0}hasValue(e){const t=e?.toString();return this.getFiltered().some((({value:e})=>e===t))}getFiltered(){const{filter:e,optionsAll:t,type:n=wn,withExclude:a=!1}=this.props;return t?In(t[n]).filter((({value:t})=>!e||!!t&&(a?!e.includes(t):e.includes(t)))):[]}onChange=e=>{const{filter:t,onChange:n,type:a}=this.props;!t&&Sn(a,e),n&&n(e&&(this.hasValue(e)||"allPlus"===a&&(0,on.U)(e))?Cn(e):null)};onChangeMulti=e=>{const{onChangeMulti:t}=this.props;t&&t(e.map(Cn).filter((e=>!!e)))};onSearch=(e,t)=>{const{isInput:n=!0}=this.props,a=t.trim(),s=a.toLowerCase(),i=e.filter((e=>!!e.value&&(e.name.toLowerCase&&e.name.toLowerCase().includes(s)||e.value.toLowerCase().includes(s))));if(n&&0===i.length){const e=Cn(a);e&&i.push(nn.Nn.saveRecent(e.toString()).option)}return i.filter(((e,t)=>{const n=t===i.length-1,a=i[t+1],s=a?.value;return!((0,rn.F)(e.value)||(0,sn.o)(e.value))||!n&&!!s}))}}const Dn=(0,A.z)(Xt.Z)` + .ui.dropdown .text { + width: 100%; + } + + .ui.disabled.search { + pointer-events: all; + } + + .ui.search.selection.dropdown { + > .text > .ui--KeyPair { + .ui--IdentityIcon { + left: -2.75rem; + top: -1.05rem; + + > div, + img, + svg { + height: 32px !important; + width: 32px !important; + } + } + + .name { + margin-left: 0; + + > .ui--AccountName { + height: auto; + } + } + } + + > .menu > div.item > .ui--KeyPair > .name > .ui--AccountName { + height: auto; + } + } + + &.hideAddress .ui.search.selection.dropdown > .text > .ui--KeyPair .address { + flex: 0; + max-width: 0; + } +`,Ln=(0,X.withMulti)(Bn,(0,X.withObservable)(nn.Nn.keyringOption.optionsSubject,{propName:"optionsAll",transform:e=>Object.entries(e).reduce(((e,[t,n])=>(e[t]=n.map((e=>null===e.value?function(e){return(0,a.jsx)(Xt.Z.Header,{content:e.name},e.key||e.name)}(e):An(e))).filter((e=>!!e)),e)),{})}));Ln.createOption=An,Ln.setLastValue=Sn;const Vn=Ln,Pn=A.z.article` + .ui--Icon { + color: rgba(255, 12, 12, 1); + margin-right: 0.5rem; + } +`,Tn=s.memo((function({children:e,className:t="",content:n}){return(0,a.jsxs)(Pn,{className:`${t} mark error`,children:[(0,a.jsx)(x.Z,{icon:"exclamation-triangle"}),n,e]})}));var Mn=n(31383);function Fn(e=""){return(0,a.jsx)(a.Fragment,{children:e.split("\n").map(((e,t)=>(0,a.jsx)("div",{children:e},t)))})}class zn extends s.Component{state={error:null,prevTrigger:null};static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps({trigger:e},{prevTrigger:t}){const n=JSON.stringify({trigger:e});return t!==n?{error:null,prevTrigger:n}:null}componentDidCatch(e){const{doThrow:t,onError:n}=this.props;if(n&&n(),t)throw e}render(){const{children:e,error:t,t:n}=this.props,{error:s}=this.state,i=t||s;return i?(0,a.jsxs)("article",{className:"error extraMargin",children:[(0,a.jsx)("p",{children:n("Uncaught error. Something went wrong with the query and rendering of this component. Please supply all the details below when logging an issue, it may help in tracing the cause.")}),(0,a.jsx)("p",{children:i.message}),Fn(i.stack)]}):e}}const Zn=(0,z.Z)(zn),Rn=A.z.div` + background-color: var(--bg-input); + border-radius: 0 0 4px 4px; + + .ui--Button-Group { + margin: 1rem 1rem; + } +`,$n=s.memo((function({children:e,className:t=""}){return(0,a.jsx)(Rn,{className:`${t} ui--Modal-Actions`,children:(0,a.jsx)(G.Group,{children:e})})})),qn=A.z.div` + align-items: center; + display: flex; + justify-content: space-between; + + &.centerAlign > div.ui--Modal-Columns-content { + text-align: center; + } + + &.rightAlign > div.ui--Modal-Columns-content { + text-align: right; + } + + &+& { + margin-top: 0.25rem; + } + + > div { + padding: 0.25em 0; + + &:nth-child(1) { + flex: 100%; + max-width: 100%; + } + + &:nth-child(2) { + display: none; + flex: 0%; + } + + @media only screen and (min-width: 1024px) { + &:nth-child(1), + &:only-child { + flex: 0 65%; + max-width: 65%; + } + + &:nth-child(2) { + box-sizing: border-box; + display: block; + flex: 0 34%; + font-size: var(--font-size-small); + opacity: 0.75; + padding: 0.25rem 0 0.25rem 0.5rem; + } + } + } +`,Un=s.memo((function({align:e="left",children:t,className:n="",hint:s}){return(0,a.jsxs)(qn,{className:`${n} ui--Modal-Columns ${e}Align`,children:[(0,a.jsx)("div",{className:"ui--Modal-Columns-content",children:t}),s&&(0,a.jsx)("div",{className:"ui--Modal-Columns-hint",children:s})]})})),Hn=A.z.div` + padding: 1.5rem; +`,Qn=s.memo((function({children:e,className:t=""}){return(0,a.jsx)(Hn,{className:`${t} ui--Modal-Content`,children:e})})),On=A.z.div` + display: flex; + justify-content: space-between; + padding: 0.75rem 1.5rem 0; +`,Wn=s.memo((function({className:e="",header:t,onClose:n}){return(0,a.jsxs)(On,{className:`${e} ui--Modal-Header`,children:[t&&(0,a.jsx)("h1",{children:t}),(0,a.jsx)(G,{dataTestId:"close-modal",icon:"times",onClick:n})]})})),Gn=Mn.vJ` + body { + overflow: hidden; + } +`,Jn=A.z.div` + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + min-height: 100vh; + z-index: 1000; + overflow-y: auto; + + .ui--Modal__overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(96, 96, 96, 0.5); + } + + .ui--Modal__body { + margin-top: 30px; + background: var(--bg-page); + border-radius: 4px; + box-shadow: none; + + display: flex; + flex-direction: column; + position: absolute; + top: 0; + left: 50%; + transform: translate(-50%, 0); + + max-width: 900px; + width: calc(100% - 16px); + + color: var(--color-text); + font: var(--font-sans); + } + + &.smallSize .ui--Modal__body { + max-width: 720px; + } + + &.largeSize .ui--Modal__body { + max-width: 1080px; + } +`,Kn=s.memo((function({children:e,className:t="",header:n,onClose:i,size:r="medium",testId:o="modal"}){const{themeClassName:l}=(0,b.F)(),c=(0,s.useCallback)((e=>{"Escape"!==e.key&&27!==e.keyCode||i()}),[i]);return(0,s.useEffect)((()=>(window.addEventListener("keydown",c,!0),()=>{window.removeEventListener("keydown",c,!0)})),[c]),(0,Vt.createPortal)((0,a.jsxs)(Jn,{className:`${t} ui--Modal ${r}Size ${l} `,"data-testid":o,children:[(0,a.jsx)(Gn,{}),(0,a.jsx)("div",{className:"ui--Modal__overlay",onClick:i}),(0,a.jsxs)("div",{className:"ui--Modal__body",children:[(0,a.jsx)(Wn,{header:n,onClose:i}),(0,a.jsx)(Zn,{children:e})]})]}),document.body)}));Kn.Actions=$n,Kn.Columns=Un,Kn.Content=Qn;const Yn=Kn,Xn=[{text:"Unknown",value:0},{text:"Fee paid",value:1},{text:"Reasonable",value:2},{text:"Known good",value:3},{text:"Out of date",value:4},{text:"Low quality",value:5}],_n={transform:e=>e.isSome?e.unwrap().info.hash.toHex():null},ea=s.memo((function({address:e,registrars:t,toggleJudgement:n}){const{t:i}=(0,z.$)(),{api:r}=(0,F.h)(),o=(0,ge.W7)(r.query.identity.identityOf,[e],_n),[l]=(0,s.useState)((()=>t.map((({address:e})=>e)))),[c,d]=(0,s.useState)(null),[u,m]=(0,s.useState)(2),[h,p]=(0,s.useState)(-1);return(0,s.useEffect)((()=>{const e=t.find((({address:e})=>c===e));p(e?e.index:-1)}),[c,t]),(0,a.jsxs)(Yn,{header:i("Provide judgement"),onClose:n,size:"small",children:[(0,a.jsxs)(Yn.Content,{children:[(0,a.jsx)(Vn,{filter:l,label:i("registrar account"),onChange:d,type:"account"}),(0,a.jsx)(_t.ZP,{isDisabled:!0,label:i("registrar index"),value:-1===h?i("invalid/unknown registrar account"):h.toString()}),(0,a.jsx)(Xt.Z,{label:i("judgement"),onChange:m,options:Xn,value:u}),o?(0,a.jsx)(_t.ZP,{defaultValue:o,isDisabled:!0,label:i("identity hash")}):null===o?(0,a.jsx)(Tn,{content:i("No identity associated with account")}):(0,a.jsx)(U,{noLabel:!0})]}),(0,a.jsx)(Yn.Actions,{children:(0,a.jsx)(Ae,{accountId:c,icon:"check",isDisabled:!o||-1===h,label:i("Judge"),onStart:n,params:4===r.tx.identity.provideJudgement.meta.args.length?[h,e,u,o]:[h,e,u],tx:r.tx.identity.provideJudgement})})]})})),ta=s.memo((function(){return(0,a.jsxs)("svg",{fill:"none",height:"40",viewBox:"0 0 40 40",width:"40",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[(0,a.jsx)("circle",{cx:"20",cy:"20",fill:"url(#pattern0)",r:"20"}),(0,a.jsxs)("defs",{children:[(0,a.jsx)("pattern",{height:"1",id:"pattern0",patternContentUnits:"objectBoundingBox",width:"1",children:(0,a.jsx)("use",{transform:"scale(0.00277778)",xlinkHref:"#image0"})}),(0,a.jsx)("image",{height:"360",id:"image0",width:"360",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWgAAAFoCAYAAAB65WHVAAAeFElEQVR4Ae2d6VrbyrZFz/u/RmhCsyE0aSD0bQhdCJAACXH2k9T5pu9VjmJkW7K6VVrjB5/B2JZVa9So6bJU+s+///4b+KENYAAGYMAeA/+hKPaKQk2oCQzAgBhA0HyC4BMUDMCAUQYQtNHCkKBIUDAAAwgaQZOeYAAGjDKAoI0WhvREeoIBGEDQCJr0BAMwYJQBBG20MKQn0hMMwACCRtCkJxiAAaMMIGijhSE9kZ5gAAYQNIImPcEADBhlAEEbLQzpifQEAzCAoBE06QkGYMAoAwjaaGFIT6QnGIABBI2gSU8wAANGGUDQRgtDeiI9wQAMIGgETXqCARgwygCCNloY0hPpCQZgAEEjaNITDMCAUQYQtNHCkJ5ITzAAAwgaQZOeYAAGjDKAoI0WhvREeoIBGEDQCJr0BAMwYJQBBG20MKQn0hMMwACCRtCkJxiAAaMMIGijhSE9kZ5gAAYQNIImPcEADBhlAEEbLQzpifQEAzCAoBE06QkGYMAoAwjaaGFIT6QnGIABBI2gSU8wAANGGUDQRgtDeiI9wQAMIGgETXqCARgwygCCNloY0hPpCQZgAEEjaNITDMCAUQYQtNHCkJ5ITzAAAwgaQZOeYAAGjDKAoI0WhvREeoIBGEDQCJr0BAMwYJQBBG20MKQn0hMMwACCRtCkJxiAAaMMIGijhSE9kZ5gAAYQNIImPcEADBhlAEEbLQzpifQEAzCAoBE06QkGYMAoAwjaaGFIT6QnGIABBI2gSU8wAANGGUDQRgtDeiI9wQAMIGgETXqCARgwygCCNloY0hPpCQZgAEEjaNITDMCAUQYQtNHCkJ5ITzAAAwgaQUeVnn7//h0eHx/Dzc1NuLi4CKenp+Ho6CgcHByE/f39/o9+1336nx6jxz48PAQ9F+khvZgYQNAI2qy0fv78Ga6urvrSfffuXVhYWAivXr0q9aPX0GtJ5nptbSOmDst79TXAIGgEbUZQvV4vXF9fh52dnbC4uFhKxEVErm1pm9q23gMS9CVBy/VG0Ai6VSFp2kFJdmNjI8zMzDQm5WEC13vQe9F7YkoEUbctbwSNoFsRtOaR9/b2wtzcXOtSHiZrvTe9R73Xtjsq2/c5WCBoBN2ofO7u7sL79+/D1NSUWTFnCVvvWe8dUfoUZVt1R9AIuhHp3N/fh7dv30Yl5SxRax+0L211WLbra4BA0Ai6Vtk8PT3153SzZBfzfZqn1r4hTF/CbLreCBpB1yIZfcF2eHgYpqeno0/NwwYS7Zv2kS8TkXRd4kbQCLpyQWuudmlpqbNiHhS29pX5aSRdh6QRNIKuTNBJao7tC8BB4U7yt/aZNI2kq5Y0gkbQlQj6x48fYW1tzU1qHiZxtYHaouqOyuv5lD+CRtClZXJ7e2v6eOZhMq3rfh0/rTZBqj6lWmXdETSCLiWS8/Pz6I5prkvM6dfVlIfapsrOymv5Ez6CRtATS0QrxqWlxO8vF3JSGyFWf2KtquYIGkFPJBCdAo2QXwo5q03UVlV1WF7Hl+wRNIIuLA+t/JYlIu4bLmy1GXL1Jdcq6o2gEXQhcZCch0t43ABFkkbQRaWNoBF0bkEfHx+TnEteMEBtWLST8ni/YkfQCDqXMHTpqHEJkf/nS9dqS6TrV7pFao+gEfRYWeg05i6vqdH0wKK25NRwBJ1H1AgaQY8UtK7ZNz8/T3ouObUxOAioTbkeIpIeJ2kEjaBHCnp9fR05VyznRNZq23EdlP/7ljiCRtBDJXFycoKca5JzImm1MRL2LeFR9UfQCDpTEN++feMU7prlLEnrlHC19ahOyv/8ChxBI+hMObx584b03ICgJWm1NRL2K+FRtUfQCPqFHJjayHe4XDJNUcUtUx0IOkvUCBpB/yVoHVkwOztLem4oPSdyV5tzVAeSHpQ0gkbQfwl6a2sLOTcs50TSavvBDsrfvqWNoBH0Hyk8PDzwxWBLcpak9YWhaoCUfUs5XX8EjaD/CGFjY4P03KKgJWnVIN1B+d23rBE0gu4LQckt+ajNbfNfEqbbnBTtW8rpQRlBI+i+oJl7blfKaUEzF42gE0kjaATdP3qAxZDsCFq14IgOJC1JI2gEHVjn2Y6ckyTNutEIGkEj5/70xuLiIvPPLX85mIg5uVVNko+53PqVNQnauaRvb2+RszE5J5JWbZCzXzmToJ3LWQBwAVh70xuJoHd3dxG08z5KgnYOwNzcHAnaaIJWbUjQJGggcCrp+/t75GxUzkmKVo2QtF9Jk6Cdylmd/vDwEEEbF/TR0RGCdtxHEbTj4q+trSFo44JWjUjQJGggcCbq379/c6Vu43LWNIdOWlGtkLRPSZOgnYk56eh3d3ek5wgELUmrVknduPUlagTtVNCnp6cIOhJBq1aI2ZeYk3ojaKeCZnEku8c/J0dwJLfb29sI2mk/RdBOC7+6ukqCjiRBq1ZJouLWV5JG0E4FzQkq8SRoTljxJeX0IIygHQq61+uRniNJz8k0h2qW7rj87kPaCNqhoLl6SjzpORE0V1nxIeTBgRdBOxQ0K9jFJ2gOtUPQfIRyIuvr62umOCKb4lDNBtMVf3df2iRoJ1JOd+bz83MEHZmgLy4uELTDvoqgHRb98+fPCDoyQatm6UGW37ufnlVjBO1Q0GdnZwgaQSP8CPo+go6gSFWnJRJ0fF8SkqB9JObBvo6gETRpOoI0jaARNB95nMhaXzglx9dyG0eavry8pH866Z/pFE2Cdlj0L1++IOgIUnN68FTN0h2X330kagTtUNCsBR1Hak4LmmsT+hDy4MCLoB0K+unpiQQdWYJWzQY7L393X9oI2qGgdQmlqakpJB2JpFUrLnvVfRlnDbgI2qGgBcLCwgKCjkTQqlVW5+W+7ksbQTsV9Pr6OoKORNCqFTLuvoyzaoygnQp6d3cXQUciaNUqq/NyX/eljaCdCpqzCeM5koOTVLov4mGDLYJ2KmgW7Y9H0CzWj6D5COVQ1K9fv2aaw/g0h2o0LF1xf/fFTYJ2KOakY7979w5BGxe0apTUi9vuC3mwxgjasaA/ffqEoI0LWjUa7LT87UfUCNqxoB8fHxG0cUFzBqEfGWcNvAjasaAFxNLSEpI2Kunl5WXSs/P+iaCdA3B0dISgjQpatclKVdznJ1UjaOeCZprD7uF2qg0y9iPjrFojaOeCFhSrq6ukaGMpem1tDTnTN7lobNao5e2+8/NzBG1M0KqJNw7Z35efFkjQjNKh1+uFubk5JG1E0qoFy4u+lJVHgSNoBN1PaoeHhwjaiKBVC48yYp9fDkoIGkH3ZfD8/BxmZmaQdMuSVg1UC2T1UlYe2wRBI+g/Mtjf30fQLQv64ODgTz08Col9/ntgQtAI+o8QlNxmZ2eRdEuSVtuTnv8WlHdhI2gE/UfQ6gzHx8cIuiVBq+29C4n9/3uAQtAI+i8p6OiBxcVFJN2wpNXmHLnxt5yQ9b8cBw0ELzvFly9fEHTDglabw+JLFr23CQmaBJ0phs3NTSTdkKTV1t5FxP5nD04IGkFnyuHnz5+cvNKAoHVSitoaQWULynu7IGgEPVQOTHXUv5DSzc3N0Pb3Lif2nzloOseYAWpvb4+pjpqStNoWCZGcRzFAgh4jqFGN5+F/OrJAK6u9qklSXl9XbcpRG8h5nEMQNIIem+I0R7qwsICkKxqk1JbMOyPncXLW/xE0gh4raIHy/ft3zjKsQNA6W1Btmadz8hgkjqARdG5Z6Aut6elpkvSEolbb8aUg0i0y8CJoBJ1b0ALr6uoqTE1NIemCklabqe2KdE4ei8wRNIIuLI3Ly0skXUDQkrPaDOEi3KIMIGgEPZE4lAaZ7hh/nLTaiOSMmIuKOXk8gkbQEwlaAH39+pUvDkckaX0hqDZKOhu3iLooAwgaQZcSiI5I4BC8l0labcLRGgi5qJAHH4+gEXQpQQsoLTK/vr7OF4f/n6bVFiy8j5wHZTvJ3wgaQZcWtMDTWXG6XJPXMwOT/dZlwzhDEDlPIuOs5yBoBF2JoBO4bm9vXU55aEqD+WbEnPSDqm4RNIKuVNAC89evX2F7e9tNmta+ap+r6pS8DqJPGEDQCLo2sShNLy8vd1bU2jftY9KZuEWsVTOAoBF07YL59OlTpxb/1yL72qeqOyOvh+AHGUDQCLoR0fR6vf4Vw1+/fh1totZ715W3tS+DHYm/kWsdDCBoBN2obCS309PTqK4critu6z0jZiRch4RHvSaCRtCNCjoNoy6p9f79e5Premj9DL03rraNlNPMNv07gkbQrQk6gV0ndZydnfVPdmlzpTxtWyeZ6L1wogliTvhs8xZBI+jWBZ3uADpcTYsLbW1thaWlpdrnq7UNbUvb5FA5pJxm0cLvCBpBmxL0YKdQktUi9ycnJ+Hjx49hdXU1zM/PFxa3nqPn6jX0WnpNUjJCHuTN2t8IGkGbFvSoDqPr+mlBoru7u75wJd3kR/fpf1z7DwmPYsj6/xA0go5W0NY7F++PwaEsAwgaQSNoGIABowwgaKOFKTvy8nzSGwzEzwCCRtCkJxiAAaMMIGijhSH9xJ9+qCE1LMsAgkbQpCcYgAGjDCBoo4UpO/LyfNIbDMTPAIJG0KQnGIABowwgaKOFIf3En36oITUsywCCRtCkJxiAAaMMIGijhSk78vJ80hsMxM8AgkbQpCcYgAGjDCBoo4Uh/cSffqghNSzLAIJG0KQnGIABowwgaKOFKTvy8nzSGwzEzwCCRtCkJxiAAaMMIGijhSH9xJ9+qCE1LMsAgkbQpCcYgAGjDCBoo4UpO/LyfNIbDMTPAIJG0KQnGIABowwgaKOFIf3En36oITUsywCCRtCkJxiAAaMMIGijhSk78vJ80hsMxM8AgkbQpCcYgAGjDCBoo4Uh/cSffqghNSzLAIJG0KQnGIABowwgaKOFKTvy8nzSGwzEzwCCRtCkJxiAAaMMIGijhSH9xJ9+qCE1LMsAgkbQpCcYgAGjDCBoo4UpO/LyfNIbDMTPAIJG0KQnGIABowwgaKOFIf0UTz+/f/8O+qHtircdbWazzRA0gjYltF6vF75//x5ubm7C+fl5ODo6Cru7u2FzczO8ffs2rKyshH/++ScsLCyE2dnZMDU1FV69epX5o//pMXqsnqPn6jX0WnpNvba2oW1pm9o2orIpKq91QdAIunEpPT8/h9vb2/D58+ewv78fPnz4EN68eRPm5uYyRTtMwHXcr/eg96L3pPem96j3qvfsVRLsd3uDFoJG0LWJR4lUcvv06VPY2dkJa2trJiQ8qdglb+2D9kX7pH0jdbcnLw8DB4JG0JUIOpHxyclJ2NjY6E8pTCrC2J6n6RPts/YdaSPsKgcOBI2gJxL009NTuLi4CNvb2/0pgVFzwbEJt+z7VVtomkRtozZSW1XZaXktP4MAgkbQueTx+PgYzs7O+l+w6Uu3shLz9ny1mb6cVBuqLZGsH8mWqTWCRtCZstCXYpeXl2FrayssLi4i5CFHikw60KhN1bZqY76ARNbDJI6gEfQfQd/f3/cPPVtdXR15+NqkUuJ5ww8HVJvrsD/VYFhn5X5/IkfQjgWtkzp0DLDmSufn50nJFafkSQck1UI1+fLlCyfeOO6fGpARtDMAJOXr6+v+UQc6iWNSifC87DRcdbuoRjpCRDXjLEkSNB+vOihsdWylsY8fP/bPrKtaIrxec7JWDUnWfkRNgu6gkJO5ym/fvvVPabZwhh4Sr1biqqlOV1eNk3pz2z1xI+iOCfrXr1/h9PQ0LC8vM31hZE657sFJtVbNVXsk3S1JI+iOCPru7q4/hTE9PY2YnYh5UPyqvaZAxAKi7oaoEXTEgtbcshbz0Vlrg52Vv6udUoitPcWE2OCLxbhFjaAjFPTPnz/DwcFB1AsPxSa8WN+v5qrFipghVccnawQdkaC1poNWUmMaw3c6nmSwEDNih3VB4pI0go5A0A8PD/11HFiQCDFPIuf0c8SQ1gQRUyRq+7JG0IYFrbSjL30QM2JOS7aK38WU2CJR25Y0gjYoaM0X6lRfxIyYq5DxqNcQY2KNOWqbokbQhgStRe+1YM7MzAxHZTg9VG6UTOv8n5gTe1whxpaoEbQRQWthd9ZZJjHXKeE8ry0GxSLz0zZEjaBbFrS+rNGVpvN0Hh6DwJtiYH19nS8SW3aDBkkE3VIRdALB4eEhh8wxlWF2cNaheWKUk13aS9MIugVBa4Eb1sogDTeVhstuR6yyKFM7kkbQDQv6+PiY1ExqNpuah8lcaVrsMjfdrKgRdEOC/vHjR1hbW4uuYw7rsNzv8xOAGBbLiLoZUSPoBgT99etX1s0gNXdmcNb6HmIaSdcvaQRds6BPTk444QQ5d0bOyScnneAitpF0vZJG0DUJWt98b21tda5jJh2UW59THIN1F+Mc5VGfpBF0DYJ+fn4OOo50EGb+RmpdZECsi3nSdPWiRtAVC1qgsoA+Iu6iiEftk5hH0gja9CitBWeWlpZIzsw5u2RA7LPoUrWSJkFXlKCVHpAzyXlUyvTwP/UBknR1kkbQFQhaK4CtrKy4TE0epMM+Fht41RdYFa8aSSPokoLWN9jv379HzkxrwECKAfUJju4oL2kEXVLQe3t7dMxUxyRtFkubXW4v9Q2O7CgnaQRdQtBXV1fIGTnDwAgG1EeQ9OSSRtATCvrx8THMzs7SOUd0zi6nQ/Yt3ycF9RH1FSQ9maQR9ISC5kSUfB0UkdFO6isIGkE3BsH5+TnJmeQMAwUYUJ9B0sUlTYIumKB1jOfr16/pnAU6JymaFK0+w/HRCLr2UXp3dxc5I2cYmIAB9R1SdDFJk6ALJGidxqorS5AISYQwUJwB9R1OBUfQtY3S+/v7yHmC5ITMisusq22mPkSKzi9pEnTOBK2zonQlia52HPYLiTbBgPoQZxgi6MpH6cvLS+RMeoaBChhQXyJF55M0CTpngv7w4QOds4LO2URKYxu2Pw2oLyFoBF0ZBPpIxlmDtjs9Uo6nPupLTHMg6MoEfXd3R3omPcNAhQyoT5Gix0uaKY4cUxy6ejEJLZ6ERq3s14orgo+XswYwBJ1D0B8/fkTQFaYnBGpfoHXXSH2KBD1e0gg6h6BXV1cRNIKGgQoZUJ9C0Ai6EggWFxfpnBV2zrrTGa9vP6GrTyFoBF0JBBsbGwgaQcNAhQxwqN14OTMHnWN6Q42k9QNYwc5+KiM5x1Ej9SXW5EDQlaTn5GPYxcUFCarCBIVM45BpHXVSX0r6FbejRc2XhDlTtEBiqsOvVOoQlcfXVB9CyqOlnG4fBF1A0FpwfH5+niRNkoaBCRhQ32HR/vxylqgRdAFBq8Fubm7onBN0To9pkX3++xOX+k46HfL7eFkj6IKCFlSsC/13x0NEtMc4BlgHeryMswYsBD2BoLXQy8rKCkmaJA0DORhQX2FxJATd6Menp6cnDr3L0TnHJSv+3+30rUPq1Fey0iH3jZc2CXqCBJ2AxXx0t+XC4FG+vsw7j5dw4pOsWwRdQtBq0KOjIz7mkqRhIIMB9Y0s6XBffmkj6JKCFmxcbaV80iKtdqsNOZU7v4RHDVgIugJB93q9sLy8TIrKSFGIt1vizVNP9QX1iVHi4X/5BI6gKxC0YNMXIVz125+M8gjL02PUB/hSMJ988wxSCLoiQaux7+/vw8zMDEmaJO2SAbGvPpBHPDwmn8QRdIWCFnTX19cuO6enlMi+Zn9SEvuIN59487YTgq5Y0Gr4s7MzJE2KdsWAmM8rHR6XX+IIugZBC8DDw0NXHZRUmZ0qPbSLWEe6+aVbpK0QdE2CVhH29vaQNEm60wyI8SLC4bHFRI6gaxS0YNza2up0B/WQENnH7E8HYhvhFhNu0fZC0DULGklnd26kF3e7IOd6xZyIHEE3IGg19ubmJkma6Y5OMCCWE4FwW6+oEXRDgtZyi0x3xJ0aSf2v+gyzdGi9Uk4Pegi6IUEnjb6zs9OJFIWs/A02YjfhmNtmJI2gGxa0wOaKLP7kFvuAxhVRmhHy4MCHoFsQtIpwcnJCkmZOOgoGxOqgOPi7GWEj6JYELcAvLi7C1NRUFJ009gTI+y/+qUVsilFk3IyMs9oZQbcoaBXk69evYXZ2FkmTpk0xICbFZpY0uK85YSPolgUt2B8eHsLi4qKpDkriLJ44u9JmYlFMIuLmRDysrRG0AUGrOM/Pz2FtbQ1Jk6RbZUAMisVhwuD+ZqWNoI0IWuDr+FIOw/ObXNtO4GKPY5ybFfC4AQ9BGxJ0Uqzz8/MwPT3dapJqWxZsv7mBSqyJuYQ/bu1IGkEbFLQ6yLdv35iXZrqj9kFa881iDSnbkXK6FgjaqKBVpF+/fnHFcCRdm6R15W0xlhYCv9sSNYI2LOiks+hqFVzrsLmP/F2fXhFLXAHFloiTvj54i6AjELSKpsOe3rx5U1ua6rqU2L//G+DEEIfQxSFn9XsEHYmgVSx9w67LC3H2IWm66IAjZsQOR2nEI2cEHZGcVazk5/v376Rp5qZzf5pSahYzCT/c/q8vWW8LEnRKfNaLlX5/SkLHx8ccjoeoh4pah8+JEVJzPEJO93H9jqAjFXRSSM0nrq+vD+2kRT8K8/huTJ+ICeaa4xVz0r8RdOSCTgp5eXkZFhYWELXzRC0GxELCBbdxSxpBd0TQ6oi9Xi8cHBww7eFQ0prOUO3FAFKOW8rp+iHoDgk6Kezj4yMnuDiStE44Uc2T+nOLoIEhArHf398zP91hUWueWTVGyN0R8mAtSdARiHawaEX/1sLrq6urzE93RNaqJYvpd1fK6f6NoB0IOin49fV1WFlZQdSRilq1Uw2TenLbfUkjaEeCTjq00tfbt28RdSSiVq1IzN2XcdI/07cI2qGgEwB0dtnm5ianjhsUtU7NVm04A9CnmJM+iqAdCzqB4OnpqX+I1vz8PKm6ZVmrBjpcTjVJ6sOtX0kjaAT9RwQ6Jfjq6orpjxYkrWkMtT2nZfuVcdZAjKAR9B9BpwHRcbX7+/ucnVijrHXWn9qYY5iRcrrvpX9H0Ag6U9BpSO7u7sLu7m6Ym5tjCqSksNWGaku1abqN+R1JZzGAoBF0IVHoaILt7e3AfHX+RZXUVmozjsRAwlkSHnUfgkbQhQSdhkkXGz06OuqfBMNFBP4nbLWFTiZR23BBVqSc7jNFf0fQCHpiQadhe35+7q+ipqS4vLzsbipkaWmpn5K1kpzaIt02/I6kJ2UAQSPoWmQiSemsN30JpjTZpYveal+0T9o37SNCRsCTCnjc8xA0gq5F0FngaQF5JUwd5/vu3bsojhDRkRZ6r3rPeu8sgo+Ms9iu6z4EjaAbE3QWxFq/WGfLKYmenJyEnZ2dvhA1ZaAjHuqc29ZraxvaliSsbes96L3oPbG2MjLOYrbJ+xA0gm5V0Hlg1xSCkqsOTZM8P3/+3P85PT3tC1XX3VPCTf/oPslWj0ker+fqNfRaTEsg3zzstf0YBI2gzQu67U7C9pF5WwwgaASNoGEABowygKCNFqatEZvtkhZhwA4DCBpBk55gAAaMMoCgjRaGFGMnxVALatEWAwgaQZOeYAAGjDKAoI0Wpq0Rm+2SFmHADgMIGkGTnmAABowygKCNFoYUYyfFUAtq0RYDCBpBk55gAAaMMoCgjRamrRGb7ZIWYcAOAwgaQZOeYAAGjDKAoI0WhhRjJ8VQC2rRFgMIGkGTnmAABowygKCNFqatEZvtkhZhwA4DCBpBk55gAAaMMoCgjRaGFGMnxVALatEWAwgaQZOeYAAGjDKAoI0Wpq0Rm+2SFmHADgMIGkGTnmAABowygKCNFoYUYyfFUAtq0RYDCBpBk55gAAaMMoCgjRamrRGb7ZIWYcAOAwgaQZOeYAAGjDKAoI0WhhRjJ8VQC2rRFgMIGkGTnmAABowygKCNFqatEZvtkhZhwA4DCBpBk55gAAaMMoCgjRaGFGMnxVALatEWAwgaQZOeYAAGjDKAoI0Wpq0Rm+2SFmHADgMIGkGTnmAABowygKCNFoYUYyfFUAtq0RYDCBpBk55gAAaMMoCgjRamrRGb7ZIWYcAOAwgaQZOeYAAGjDKAoI0WhhRjJ8VQC2rRFgMIGkGTnmAABowygKCNFqatEZvtkhZhwA4DCBpBk55gAAaMMoCgjRaGFGMnxVALatEWAwgaQZOeYAAGjDKAoI0Wpq0Rm+2SFmHADgMIGkGTnmAABowygKCNFoYUYyfFUAtq0RYDCBpBk55gAAaMMoCgjRamrRGb7ZIWYcAOAwgaQZOeYAAGjDKAoI0WhhRjJ8VQC2rRFgMIGkGTnmAABowygKCNFqatEZvtkhZhwA4DCBpBk55gAAaMMvBfNudY0IVxrEoAAAAASUVORK5CYII="})]})]})})),na=s.memo((function({address:e,identity:t}){const{t:n}=(0,z.$)(),{api:i}=(0,F.h)(),{isRegistrar:r,registrars:o}=$e(),[l,c]=(0,de.O)(),d=(0,qe.x)(e),u=(0,s.useMemo)((()=>d?.map((e=>(0,a.jsx)(ot,{className:"subs",isPadded:!1,value:e},e.toString())))),[d]);return t&&t.isExistent&&i.query.identity?.identityOf?(0,a.jsxs)("section",{className:"withDivider","data-testid":"identity-section",children:[(0,a.jsxs)("div",{className:"ui--AddressMenu-section ui--AddressMenu-identity",children:[(0,a.jsx)("div",{className:"ui--AddressMenu-sectionHeader",children:n("identity")}),(0,a.jsxs)("div",{children:[(0,a.jsx)(ct,{icon:(0,a.jsx)(ta,{}),subtitle:t.legal,title:t.display}),(0,a.jsx)(Yt,{address:e}),(0,a.jsxs)("div",{className:"ui--AddressMenu-identityTable",children:[t.parent&&(0,a.jsxs)("div",{className:"tr parent",children:[(0,a.jsx)("div",{className:"th",children:n("parent")}),(0,a.jsx)("div",{className:"td",children:(0,a.jsx)(ot,{className:"parent",isPadded:!1,value:t.parent})})]}),t.email&&(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th",children:n("email")}),(0,a.jsx)("div",{className:"td",children:(0,He.vq)(t.email)||!t.isKnownGood?t.email:(0,a.jsx)("a",{href:`mailto:${t.email}`,rel:"noopener noreferrer",target:"_blank",children:t.email})})]}),t.web&&(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th",children:n("website")}),(0,a.jsx)("div",{className:"td",children:(0,He.vq)(t.web)||!t.isKnownGood?t.web:(0,a.jsx)("a",{href:t.web.replace(/^(https?:\/\/)?/g,"https://"),rel:"noopener noreferrer",target:"_blank",children:t.web})})]}),t.twitter&&(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th",children:n("twitter")}),(0,a.jsx)("div",{className:"td",children:(0,He.vq)(t.twitter)||!t.isKnownGood?t.twitter:(0,a.jsx)("a",{href:t.twitter.startsWith("https://twitter.com/")?t.twitter:`https://twitter.com/${t.twitter}`,rel:"noopener noreferrer",target:"_blank",children:t.twitter})})]}),t.other&&Ue.n in t.other&&(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th",children:n("discord")}),(0,a.jsx)("div",{className:"td",children:t.other[Ue.n]})]}),t.riot&&(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th",children:n("riot")}),(0,a.jsx)("div",{className:"td",children:t.riot})]}),!!d?.length&&(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th top",children:n("subs")}),(0,a.jsx)("div",{className:"td","data-testid":"subs",children:d.length>4?(0,a.jsx)(me,{summary:d.length,children:u}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"subs-number",children:d.length}),u]})})]})]})]})]}),r&&(0,a.jsx)("div",{className:"ui--AddressMenu-section",children:(0,a.jsx)("div",{className:"ui--AddressMenu-actions",children:(0,a.jsx)("ul",{children:(0,a.jsx)("li",{children:(0,a.jsx)(ut,{icon:"address-card",label:n("Add identity judgment"),onClick:c})})})})}),l&&r&&(0,a.jsx)(ea,{address:e,registrars:o,toggleJudgement:c},"modal-judgement")]}):null})),aa=s.memo((function({isMultisig:e,meta:t}){const{t:n}=(0,z.$)();if(!e||!t)return null;const{threshold:s,who:i}=t;return(0,a.jsxs)("section",{className:"ui--AddressMenu-multisig withDivider",children:[(0,a.jsx)("div",{className:"ui--AddressMenu-sectionHeader",children:n("multisig")}),(0,a.jsxs)("div",{className:"ui--AddressMenu-multisigTable",children:[(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th",children:n("threshold")}),(0,a.jsxs)("div",{className:"td",children:[s,"/",i?.length]})]}),(0,a.jsxs)("div",{className:"tr",children:[(0,a.jsx)("div",{className:"th signatories",children:n("signatories")}),(0,a.jsx)("div",{className:"td",children:i?.map((e=>(0,a.jsx)(ot,{value:e},e)))})]})]})]})}));var sa=n(53657),ia=n(2727),ra=n(67609),oa=n(17965),la=n(44294);const ca=A.z.article` + .ui--Icon { + color: rgba(255, 196, 12, 1); + margin-right: 0.5rem; + } +`,da=s.memo((function({children:e,className:t="",content:n,withIcon:s=!0}){return(0,a.jsxs)(ca,{className:`${t} mark warning`,children:[s&&(0,a.jsx)(x.Z,{icon:"exclamation-triangle"}),n,e]})})),ua=A.z.div` + > label { + display: inline-block; + margin: 0 0.5rem !important; + } + + > label, + > div { + vertical-align: middle; + } + + .ui--Toggle-Slider { + background: var(--bg-toggle); + border-radius: 1.5rem; + display: inline-block; + height: 1.5rem; + position: relative; + width: 3rem; + + &::before { + background: var(--bg-table); + border: 0.125rem solid var(--bg-toggle); + border-radius: 50%; + content: ""; + height: 1.5rem; + left: 0; + position: absolute; + top: 0; + width: 1.5rem; + } + } + + &:not(.isDisabled) { + cursor: pointer; + + > label { + cursor: pointer; + } + } + + &.isChecked { + &:not(.isRadio) { + .ui--Toggle-Slider:before { + transform: translateX(1.5rem); + } + } + + &.isRadio { + .ui--Toggle-Slider:before { + border-width: 0.5rem; + } + } + } + + &.isRadio { + .ui--Toggle-Slider { + width: 1.5rem; + } + } +`,ma=s.memo((function({className:e="",isDisabled:t,isRadio:n,label:i,onChange:r,preventDefault:o,value:l}){const c=(0,s.useCallback)((e=>{t||(o&&(e.preventDefault(),e.stopPropagation()),r&&r(!l))}),[t,r,o,l]);return(0,a.jsxs)(ua,{className:`${e} ui--Toggle ${l?"isChecked":""} ${t?"isDisabled":""} ${n?"isRadio":""}`,onClick:c,children:[i&&(0,a.jsx)("label",{children:i}),(0,a.jsx)("div",{className:"ui--Toggle-Slider "+(n?"highlight--before-border":"")})]})})),ha=(0,A.z)(Yn)` + .balance { + margin-bottom: 0.5rem; + text-align: right; + padding-right: 1rem; + + .label { + opacity: 0.7; + } + } + + label.with-help { + flex-basis: 10rem; + } + + .typeToggle { + text-align: right; + } + + .typeToggle+.typeToggle { + margin-top: 0.375rem; + } +`,pa=s.memo((function({className:e="",onClose:t,recipientId:n,senderId:i}){const{t:r}=(0,z.$)(),{api:o}=(0,F.h)(),[l,c]=(0,s.useState)(ae.nw),[d]=(0,s.useState)(!0),[u,m]=(0,s.useState)(!0),[h,p]=(0,s.useState)(!1),[[f,b],x]=(0,s.useState)([null,!1]),[A,v]=(0,s.useState)(null),[w,y]=(0,s.useState)(null),[[,j],C]=(0,s.useState)([null,null]),k=(0,ge.W7)(o.derive.balances?.all,[i||w]),N=(0,ge.W7)(o.query.system.account,[i||w]);(0,s.useEffect)((()=>{const e=i||w,t=n||A;k&&k.accountId?.eq(e)&&e&&t&&o.call.transactionPaymentApi&&o.tx.balances?(0,oa.Y)((async()=>{try{const n=(o.tx.balances.transferAllowDeath||o.tx.balances.transfer)(t,k.availableBalance),{partialFee:a}=await n.paymentInfo(e),s=a.muln(110).div(ae.S8),i=k.availableBalance.sub(s);x(o.consts.balances&&i.gt(o.consts.balances.existentialDeposit)?[i,!1]:[null,!0])}catch(e){console.error(e)}})):x([null,!1])}),[o,k,n,i,A,w]),(0,s.useEffect)((()=>{(async function(e,t){return[null,t?await(0,ia.fF)(t):null]})(0,n||A).then(C).catch(console.error)}),[n,i,A,w]);const E=!N||(function(e){return!!e.refcount}(N)?N.refcount.isZero():N.consumers.isZero()),S=!u&&k&&k.accountId?.eq(i||w)&&f&&E;return(0,a.jsxs)(ha,{className:"app--accounts-Modal",header:r("Send funds"),onClose:t,size:"large",children:[(0,a.jsx)(Yn.Content,{children:(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(Yn.Columns,{hint:r("The transferred balance will be subtracted (along with fees) from the sender account."),children:(0,a.jsx)(Vn,{defaultValue:i,isDisabled:!!i,label:r("send from account"),labelExtra:(0,a.jsx)(ra.Z,{label:r("transferrable"),params:i||w}),onChange:y,type:"account"})}),(0,a.jsxs)(Yn.Columns,{hint:r("The beneficiary will have access to the transferred fees when the transaction is included in a block."),children:[(0,a.jsx)(Vn,{defaultValue:n,isDisabled:!!n,label:r("send to address"),labelExtra:(0,a.jsx)(ra.Z,{label:r("transferrable"),params:n||A}),onChange:v,type:"allPlus"}),j&&(0,a.jsx)(Tn,{content:r("The recipient is associated with a known phishing site on {{url}}",{replace:{url:j}})})]}),(0,a.jsx)(Yn.Columns,{hint:r("If the recipient account is new, the balance needs to be more than the existential deposit. Likewise if the sending account balance drops below the same value, the account will be removed from the state."),children:S&&h?(0,a.jsx)(la.Z,{autoFocus:!0,defaultValue:f,isDisabled:!0,label:r("transferrable minus fees")},f?.toString()):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(la.Z,{autoFocus:!0,isError:!d,isZeroable:!0,label:r("amount"),maxValue:f,onChange:c}),(0,a.jsx)(la.Z,{defaultValue:o.consts.balances?.existentialDeposit,isDisabled:!0,label:r("existential deposit")})]})}),(0,a.jsxs)(Yn.Columns,{hint:r("With the keep-alive option set, the account is protected against removal due to low balances."),children:[(0,g.m)(o.tx.balances?.transferKeepAlive)&&(0,a.jsx)(ma,{className:"typeToggle",label:r(u?"Transfer with account keep-alive checks":"Normal transfer without keep-alive checks"),onChange:m,value:u}),S&&(0,a.jsx)(ma,{className:"typeToggle",label:r("Transfer the full account balance, reap the sender"),onChange:p,value:h}),!u&&!E&&(0,a.jsx)(da,{content:r("There is an existing reference count on the sender account. As such the account cannot be reaped from the state.")}),b&&(0,a.jsx)(da,{content:r("The transaction, after application of the transfer fees, will drop the available balance below the existential deposit. As such the transfer will fail. The account needs more free funds to cover the transaction fees.")})]})]})}),(0,a.jsx)(Yn.Actions,{children:(0,a.jsx)(Ae,{accountId:i||w,icon:"paper-plane",isDisabled:!((h||d&&l)&&(n||A)&&!j),label:r("Make Transfer"),onStart:t,params:S&&h?(0,g.m)(o.tx.balances?.transferAll)?[n||A,!1]:[n||A,f]:[n||A,l],tx:S&&h&&(0,g.m)(o.tx.balances?.transferAll)?o.tx.balances?.transferAll:u?o.tx.balances?.transferKeepAlive:o.tx.balances?.transferAllowDeath||o.tx.balances?.transfer})})]})})),ga=A.z.div` + width: 100%; + + .ui--Button-Group { + display: flex; + flex-direction: row; + justify-content: space-around; + margin-bottom: 0; + } +`,fa=s.memo((function({className:e="",flags:t,isEditing:n,isEditingName:i,onCancel:r,onForgetAddress:o,onSaveName:l,onSaveTags:c,onUpdateName:d,recipientId:u,toggleIsEditingName:m,toggleIsEditingTags:h}){const{t:p}=(0,z.$)(),[f,b]=(0,de.O)(),x=(0,F.h)(),A=(0,s.useCallback)((()=>{o(),d&&d()}),[o,d]),v=(0,s.useCallback)((()=>{t.isEditable&&m(),h()}),[t.isEditable,m,h]),w=(0,s.useCallback)((()=>{l(),d&&d()}),[l,d]),y=(0,s.useCallback)((()=>{i&&(t.isInContacts||t.isOwned)&&(w(),m())}),[i,t.isInContacts,t.isOwned,w,m]),j=(0,s.useCallback)((()=>{n&&(y(),c()),v()}),[n,v,y,c]);return(0,a.jsxs)(ga,{className:`${e} ui--AddressMenu-buttons`,children:[n?(0,a.jsxs)(G.Group,{children:[(0,a.jsx)(G,{icon:"times",label:p("Cancel"),onClick:r}),(0,a.jsx)(G,{icon:"save",label:p("Save"),onClick:j})]}):(0,a.jsxs)(G.Group,{children:[(0,g.m)(x.api.tx.balances?.transfer)&&(0,a.jsx)(G,{icon:"paper-plane",isDisabled:n,label:p("Send"),onClick:b}),!t.isOwned&&!t.isInContacts&&(0,a.jsx)(G,{icon:"plus",isDisabled:n,label:p("Save"),onClick:w}),!t.isOwned&&t.isInContacts&&(0,a.jsx)(G,{icon:"ban",isDisabled:n,label:p("Remove"),onClick:A}),(0,a.jsx)(G,{icon:"edit",isDisabled:!t.isEditable,label:p("Edit"),onClick:j})]}),f&&(0,a.jsx)(pa,{onClose:b,recipientId:u},"modal-transfer")]})})),ba=s.memo((function({accountIndex:e,defaultValue:t,editingName:n,flags:s,onChange:i,value:r}){const{t:o}=(0,z.$)(),[l,c]=(0,de.O)(),d=()=>{};return(0,a.jsxs)("div",{className:"ui--AddressSection",children:[(0,a.jsx)(Ke,{size:80,value:r}),(0,a.jsxs)("div",{className:"ui--AddressSection__AddressColumn",children:[(0,a.jsx)(P,{override:n?(0,a.jsx)(_t.ZP,{className:"name--input",defaultValue:t,label:"name-input",onChange:i,withLabel:!1}):s.isEditable?t.toUpperCase()||o(""):void 0,value:r,withSidebar:!1}),(0,a.jsx)("div",{className:"ui--AddressMenu-addr",children:r}),e&&(0,a.jsxs)("div",{className:"ui--AddressMenu-index",children:[(0,a.jsxs)("label",{children:[o("index"),":"]})," ",e]})]}),(0,a.jsx)("div",{className:"ui--AddressSection__CopyColumn",children:(0,a.jsx)("div",{className:"ui--AddressMenu-copyaddr",children:(0,a.jsx)(cn(),{text:r,children:(0,a.jsx)("span",{children:(0,a.jsx)(G.Group,{children:(0,a.jsx)(G,{icon:l?"check":"copy",label:o(l?"Copied":"Copy"),onClick:l?d:c,onMouseLeave:l?c:d})})})})})})]})})),xa=(0,A.z)(xt.Z)` + border-radius: 0 0.25rem 0.25rem 0; + padding: 0.5833em 1.25em 0.5833em 1.5em; + font-size: var(--font-size-tiny); + line-height: 1; + color: #fff !important; + + &.darkTheme { + :after { + background-color: var(--bg-tabs); + } + } + + &:after { + background-color: #fff; + border-radius: 500rem; + content: ''; + left: -0.25em; + margin-top: -0.25em; + position: absolute; + width: 0.5em; + height: 0.5em; + top: 50%; + } + + &:before { + border-radius: 0.2rem 0 0.1rem 0; + background-color: inherit; + background-image: none; + content: ''; + right: 100%; + width: 1.5em; + height: 1.5em; + position: absolute; + transform: translateY(-50%) translateX(50%) rotate(-45deg); + top: 50%; + transition: none; + } +`,Aa=s.memo((function({className:e="",color:t,label:n}){return(0,a.jsx)(xa,{className:`${e} ${"theme"===t?" highlight--color-bg highlight--bg":""}`,color:t,label:n,size:"tiny"})})),va=A.z.div` + .ui--Tag { + margin: 0.2rem 1rem 0.2rem 0.571rem; + } +`,wa=s.memo((function({className:e="",flags:{isCouncil:t,isDevelopment:n,isExternal:s,isInjected:i,isMultisig:r,isNominator:o,isProxied:l,isSociety:c,isSudo:d,isTechCommittee:u,isValidator:m}}){const{t:h}=(0,z.$)(),p=t||n||s||i||r||l||c||d||u||m||o;return p?(0,a.jsxs)(va,{className:`${e} ui--AddressMenu-flags`,children:[p&&(0,a.jsx)("h5",{children:h("Flags")}),(0,a.jsxs)("div",{children:[m&&(0,a.jsx)(Aa,{color:"theme",label:h("Validator")}),o&&(0,a.jsx)(Aa,{color:"theme",label:h("Nominator")}),s&&(r?(0,a.jsx)(Aa,{color:"green",label:h("Multisig")}):l?(0,a.jsx)(Aa,{color:"grey",label:h("Proxied")}):(0,a.jsx)(Aa,{color:"grey",label:h("External")})),i&&(0,a.jsx)(Aa,{color:"grey",label:h("Injected")}),n&&(0,a.jsx)(Aa,{color:"grey",label:h("Test account")}),t&&(0,a.jsx)(Aa,{color:"blue",label:h("Council")}),c&&(0,a.jsx)(Aa,{color:"green",label:h("Society")}),u&&(0,a.jsx)(Aa,{color:"orange",label:h("Technical committee")}),d&&(0,a.jsx)(Aa,{color:"pink",label:h("Sudo key")})]})]}):null})),ya=s.memo((function({accountIndex:e,address:t,isBeingEdited:n,onUpdateName:i,sidebarRef:r}){const{flags:o,isEditing:l,isEditingName:c,isEditingTags:d,name:u,onForgetAddress:m,onSaveName:h,onSaveTags:p,setIsEditingName:g,setIsEditingTags:f,setName:b,setTags:x,tags:A,toggleIsEditingName:v,toggleIsEditingTags:w}=(0,T.B)(t),y=(0,s.useMemo)((()=>[r]),[r]);(0,s.useEffect)((()=>{n(l())}),[n,l]);const j=(0,s.useCallback)((()=>{if(l())try{const e=nn.Nn.getAccount(t)||nn.Nn.getAddress(t);b(e?.meta.name||""),x(e?.meta.tags?e.meta.tags.sort():[]),g(!1),f(!1)}catch{}}),[l,b,x,g,f,t]);return Lt(y,j),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ba,{accountIndex:e,defaultValue:u,editingName:c,flags:o,onChange:b,value:t}),(0,a.jsx)("div",{className:"ui--AddressMenu-tags","data-testid":"sidebar-tags",children:(0,a.jsx)(sa.Z,{isEditable:!0,isEditing:d,onChange:x,value:A,withEditButton:!1,withTitle:!0})}),(0,a.jsx)(wa,{flags:o}),(0,a.jsx)(fa,{flags:o,isEditing:l(),isEditingName:c,onCancel:j,onForgetAddress:m,onSaveName:h,onSaveTags:p,onUpdateName:i,recipientId:t,toggleIsEditingName:v,toggleIsEditingTags:w})]})})),ja=(0,A.z)(K)` + display: flex; + flex-direction: column; + background-color: var(--bg-sidebar); + max-width: 30.42rem; + min-width: 30.42rem; + overflow-y: hidden; + padding: 0 0 3.286rem; + + input { + width: auto !important; + } + + .ui--AddressMenu-header { + align-items: center; + background: var(--bg-tabs); + border-bottom: 1px solid var(--border-table); + display: flex; + flex-direction: column; + justify-content: center; + padding: 1.35rem 1rem 1rem 1rem; + } + + .ui--AddressSection { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-items: center; + width: 100%; + + .ui--AddressSection__AddressColumn { + flex: 1; + margin-left: 1rem; + + .ui--AccountName { + max-width: 21.5rem; + overflow: hidden; + white-space: normal; + } + } + + .ui--AddressSection__CopyColumn { + margin-left: 1rem; + + .ui--AccountName { + max-width: 10rem; + overflow: hidden; + } + } + } + + .ui--AddressMenu-addr, + .ui--AddressMenu-index { + text-align: left; + font-size: var(--font-size-small); + } + + .ui--AddressMenu-addr { + word-break: break-all; + width: 24ch; + margin: 0.571rem 0; + color: var(--color-label); + } + + .ui--AddressMenu-copyaddr, + .ui--AddressMenu-index { + text-align: left; + font-size: var(--font-size-small); + } + + .ui--AddressMenu-copyaaddr { + word-break: break-all; + width: 12ch; + margin: 0.371rem 0; + color: var(--color-label); + } + + + .ui--AddressMenu-index { + display: flex; + flex-direction: row; + + label { + font-size: var(--font-size-small); + margin-right: 0.4rem; + text-transform: capitalize; + } + } + + section { + position: relative; + + &:not(:last-child) { + margin-bottom: 1rem; + } + + .ui--AddressMenu-sectionHeader { + display: flex; + justify-content: space-between; + align-items: center; + text-transform: capitalize; + + margin-bottom: 0.57rem; + width: 100%; + + color: var(--color-text); + font-size: 1.143rem; + } + + &.withDivider { + padding-top: 1rem; + + ::before { + position: absolute; + top: 0; + left: 0; + + content: ''; + width: 100%; + height: 1px; + background-color: var(--border-table); + } + } + } + + .ui--AddressMenu-identity, + .ui--AddressMenu-multisig { + .ui--AddressMenu-identityTable, + .ui--AddressMenu-multisigTable { + font-size: var(--font-size-small); + margin-top: 0.6rem; + + .tr { + padding: 0.25rem 0; + display: inline-flex; + align-items: center; + width: 100%; + + .th { + text-transform: uppercase; + color: var(--color-label); + font-weight: var(--font-weight-normal); + text-align: left; + flex-basis: 25%; + font-size: var(--font-size-tiny); + + &.top { + align-self: flex-start; + } + } + + .td { + flex: 1; + overflow: hidden; + padding-left: 0.6rem; + text-overflow: ellipsis; + } + } + + .ui--AddressMini, .subs-number { + margin-bottom: 0.4rem; + padding: 0; + } + + .subs-number { + font-size: var(--font-size-base); + margin-bottom: 0.714rem; + } + } + + .parent { + padding: 0 !important; + } + } + + && .column { + align-items: center; + + .ui--FormatBalance:first-of-type { + margin-bottom: 0.4rem; + } + + .ui--FormatBalance { + line-height: 1rem; + } + } + + .ui--AddressMenu-buttons { + .ui--Button-Group { + margin-bottom: 0; + } + } + + .ui--AddressMenu-tags, + .ui--AddressMenu-flags { + margin: 0.75rem 0 0; + width: 100%; + } + + .ui--AddressMenu-identityIcon { + background: ${Y.Iv}66; + } + + .ui--AddressMenu-actions { + ul { + list-style-type: none; + margin-block-start: 0; + margin-block-end: 0; + padding-inline-start: 1rem; + + li { + margin: 0.2rem 0; + } + } + } + + .inline-icon { + cursor: pointer; + margin: 0 0 0 0.5rem; + color: ${Y.Iv}; + } + + .name--input { + .ui.input { + margin: 0 !important; + + > input { + } + } + } + + &.inEditMode { + .ui--AddressMenu-flags { + opacity: 60%; + } + } + + .ui--AddressMenu-multisig .th.signatories { + align-self: flex-start; + } + + .ui--ScrollSection { + padding: 1rem; + overflow: auto; + } + + .ui--LinkSection { + border-top: 1px solid var(--border-table); + padding: 0.5rem 0 0.571rem; + width: 100%; + position: absolute; + bottom: 0; + + span { + margin: 0 0.5rem; + } + } +`,Ca=s.memo((function({address:e,className:t="",dataTestId:n,onClose:i,onUpdateName:r}){const[o,l]=(0,s.useState)(!1),{accountIndex:c,flags:d,identity:u,meta:m}=(0,T.B)(e),h=(0,s.useRef)(null);return(0,a.jsxs)(ja,{className:`${t}${o?" inEditMode":""}`,dataTestId:n,onClose:i,position:"right",sidebarRef:h,children:[(0,a.jsx)("div",{className:"ui--AddressMenu-header","data-testid":"sidebar-address-menu",children:(0,a.jsx)(ya,{accountIndex:c,address:e,isBeingEdited:l,onUpdateName:r,sidebarRef:h})}),(0,a.jsxs)("div",{className:"ui--ScrollSection",children:[(0,a.jsx)(Ze,{address:e}),(0,a.jsx)(na,{address:e,identity:u}),(0,a.jsx)(aa,{isMultisig:d.isMultisig,meta:m})]}),(0,a.jsx)("section",{className:"ui--LinkSection",children:(0,a.jsx)($,{data:e,isSidebar:!0,type:"address"})})]})})),ka=[null,null],Na=s.memo((function({children:e}){const[[t,n],i]=(0,s.useState)(ka),r=(0,s.useCallback)((()=>i([null,null])),[]);return(0,a.jsxs)(l.Provider,{value:i,children:[e,t&&(0,a.jsx)(Ca,{address:t,dataTestId:"account-sidebar",onClose:r,onUpdateName:n})]})}));var Ea=n(16613);const Sa="5".padEnd(48,"x"),Ia=(0,A.z)(Ea.Z)` + button.u.ui--Icon.editButton { + padding: 0 .3em .3em .3em; + color: #2e86ab; + background: none; + /*trick to let the button in the flow but keep the content centered regardless*/ + margin-left: -2em; + position: relative; + right: -2.3em; + z-index: 1; + } + + .editSpan { + white-space: nowrap; + + &:before { + content: ''; + } + } + + .ui--AddressRow-balances { + display: flex; + .column { + display: block; + + label, + .result { + display: inline-block; + vertical-align: middle; + } + } + + > span { + text-align: left; + } + } + + .ui--AddressRow-placeholder { + opacity: var(--opacity-light); + } +`,Ba=s.memo((function({buttons:e,children:t,className:n,defaultName:s,fullLength:i=!1,isContract:r=!1,isDisabled:o,isEditableName:l,isInline:c,isValid:d,overlay:u,value:m,withTags:h=!1}){const{accountIndex:p,isNull:g,name:f,onSaveName:b,onSaveTags:x,setName:A,setTags:v,tags:w}=(0,T.B)(m?m.toString():null,r),y=!g&&(d||m||p),j=m?Ke:Oe.ZP,C=m&&y?m:Sa;return(0,a.jsxs)(Ia,{address:C,buttons:e,className:n,defaultName:s,icon:(0,a.jsx)(j,{size:32,value:m?m.toString():null}),isDisabled:o,isEditableName:l,isEditableTags:!0,isInline:c,isShortAddr:!i,name:f,onChangeName:A,onChangeTags:v,onSaveName:b,onSaveTags:x,tags:h?w:void 0,children:[t,u]})})),Da=A.z.div` + align-items: flex-start; + border: 1px solid transparent; /* #eee */ + border-radius: 0.25rem; + cursor: pointer; + display: flex; + justify-content: space-between; + margin: 0.125rem; + padding: 0.125rem 0.25rem; + text-align: left; + vertical-align: middle; + white-space: nowrap; + + .ui--AddressToggle-address { + filter: grayscale(100%); + opacity: var(--opacity-light); + } + + &:hover { + border-color: #ccc; + } + + &.isHidden { + display: none; + } + + &.isDragging { + background: white; + box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.15); + } + + .ui--AddressToggle-address, + .ui--AddressToggle-toggle { + flex: 1; + padding: 0; + } + + .ui--AddressToggle-toggle { + margin-top: 0.1rem; + text-align: right; + } + + &.isAye { + .ui--AddressToggle-address { + filter: none; + opacity: 1; + } + } +`,La=s.memo((function({address:e,className:t="",filter:n,isHidden:i,noToggle:o,onChange:l,value:c}){const{api:d}=(0,F.h)(),u=(0,r.Y)(e),m=(0,s.useMemo)((()=>!u||(0,f.r7)(d,e,u,n,!1)),[d,e,n,u]),h=(0,s.useCallback)((()=>l&&l(!c)),[l,c]);return(0,a.jsxs)(Da,{className:`${t} ui--AddressToggle ${c||o?"isAye":"isNay"} ${i||!m?"isHidden":""}`,onClick:h,children:[(0,a.jsx)(ot,{className:"ui--AddressToggle-address",value:e,withSidebar:!1}),!o&&(0,a.jsx)("div",{className:"ui--AddressToggle-toggle",children:(0,a.jsx)(ma,{label:"",value:c})})]})})),Va=s.memo((function({className:e="",label:t,params:n}){return n?(0,a.jsx)(ra.Z,{className:`${e} ui--Available`,label:t,params:n}):null})),Pa=s.memo((function(){const{t:e}=(0,z.$)(),{api:t}=(0,F.h)();return(0,g.m)(t.tx.utility.batchAll)?null:(0,a.jsx)(da,{content:e("This chain does not yet support atomic batch operations. This means that if the transaction gets executed and one of the operations do fail (due to invalid data or lack of available funds) some of the changes made may not be applied.")})}));s.memo((function({className:e="",isDisabled:t,label:n,onClick:s,tabIndex:i}){const{t:r}=(0,z.$)();return(0,a.jsx)(G,{className:e,icon:"times",isDisabled:t,label:n||r("Cancel"),onClick:s,tabIndex:i})}));const Ta=A.z.article` + position: relative; + flex: 1 1; + min-width: 24%; + justify-content: space-around; + + label { + opacity: 0.42; + } + + i.help.circle.icon, + .ui.button.mini, + .ui.button.tiny, + .addTags { + visibility: hidden; + } + + .ui--AddressSummary-buttons { + text-align: right; + margin-bottom: 2em; + + button { + margin-left: 0.2em; + } + } + + &:hover { + i.help.circle.icon, + .ui.button.mini, + .ui.button.tiny, + .addTags { + visibility: visible; + } + + label { + opacity: 1; + } + } + + &.error { + background: rgba(255, 0, 0, 0.05); + + &, h1, h2, h3, h4, h5, h6, p { + color: rgba(156, 0, 0) !important; + } + } + + &.success { + border: 1px solid rgb(168, 255, 136); + background: rgba(0, 255, 0, 0.05); + + &, h1, h2, h3, h4, h5, h6, p { + color: rgba(34, 125, 0) !important; + } + } + + &.withBottomMargin { + margin-bottom: 1.5rem; + } +`,Ma=s.memo((function({children:e,className:t="",isError:n,isSuccess:s,withBottomMargin:i}){return(0,a.jsx)(Ta,{className:`${t} ui--Card ${n&&!s?"error":""} ${!n&&s?"success":""} ${i?"withBottomMargin":""}`,children:e})}));var Fa=n(12372);const za=s.memo((function({angle:e,type:t}){return(0,a.jsx)("div",{className:`clip ${t}`,children:(0,a.jsx)("div",{className:"highlight--bg",style:{transform:`rotate(${e}deg)`}})})})),Za="3.5rem",Ra=A.z.div` + border-radius: 100%; + clip-path: circle(50%); + height: ${Za}; + position: relative; + width: ${Za}; + + &.isDisabled { + filter: grayscale(100%); + opacity: 0.25; + } + + .background, + .clip { + bottom: 0; + left: 0; + position: absolute; + right: 0; + top: 0; + } + + .background { + opacity: 0.125; + } + + .inner { + align-items: center; + background: var(--bg-inverse); + border-radius: 100%; + bottom: 0.375rem; + color: var(--color-summary); + display: flex; + justify-content: center; + left: 0.375rem; + position: absolute; + right: 0.375rem; + top: 0.375rem; + + div { + font-size: var(--font-size-small); + line-height: 1; + } + } + + .clip { + div { + border-radius: 100%; + bottom: 0; + left: 0; + position: absolute; + right: 0; + transform: rotate(0); + top: 0; + zoom: 1; + } + } + + .clip.first { + clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%); + + div { + clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%); + } + } + + .clip.second { + clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%); + + div { + clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%); + } + } +`,$a=s.memo((function({className:e="",isBlurred:t,isDisabled:n,total:s,value:i}){const r=(0,Fa.G)(s||0),o=r.gtn(0)?(0,Fa.G)(i||0).muln(36e3).div(r).toNumber()/100:0;if(o<0)return null;const l=360===o?360:o%360;return(0,a.jsxs)(Ra,{className:`${e} ui--Progress ${n?"isDisabled":""} ${t?"--tmp":""}`,children:[(0,a.jsx)("div",{className:"background highlight--bg"}),(0,a.jsx)(za,{angle:l<=180?l.toFixed(1):"180",type:"first"}),(0,a.jsx)(za,{angle:l<=180?"0":(l-180).toFixed(1),type:"second"}),(0,a.jsx)("div",{className:"inner",children:(0,a.jsxs)("div",{children:[Math.floor(100*o/360),"%"]})})]})})),qa=A.z.article` + align-items: center; + background: transparent !important; + border: none !important; + box-shadow: none !important; + color: var(--color-summary); + display: flex; + flex: 0 1 auto; + flex-flow: row wrap; + justify-content: flex-end; + padding: 0 1.5rem; + + .ui--FormatBalance .balance-postfix { + opacity: 1; + } + + .ui--Progress { + margin: 0.5rem 0.125rem 0.125rem 0.75rem; + } + + > .ui--Labelled { + font-size: var(--font-size-h1); + font-weight: var(--font-weight-header); + position: relative; + line-height: 1; + text-align: right; + + > .ui--Labelled-content { + color: var(--color-header); + } + + > * { + margin: 0.25rem 0; + + &:first-child { + margin-top: 0; + } + + &:last-child { + margin-bottom: 0; + } + } + + .isSecondary { + font-size: var(--font-size-base); + font-weight: var(--font-weight-normal); + + .timer { + min-width: 8rem; + } + } + } + + @media(max-width: 767px) { + min-height: 4.8rem; + padding: 0.25 0.4em; + + > div { + font-size: 1.4rem; + } + } +`,Ua=s.memo((function({children:e,className:t="",label:n,progress:s}){const i=s?.value,r=s?.total,o=s&&!(0,sn.o)(i)&&!(0,sn.o)(r)&&i.gten(0)&&r.gtn(0)?i.gt(r)?`>${s.isPercent?"100":(0,h.u)(r)}`:s.isPercent?i.mul(ae.S8).div(r).toString():(0,h.u)(i):void 0;if(s&&(0,sn.o)(o))return null;const l=s&&s.withTime&&!(0,sn.o)(s.total),c=(n??"").toString();return(0,a.jsxs)(qa,{className:t,"data-testid":`card-summary:${c}`,children:[(0,a.jsxs)(pn.Z,{isSmall:!0,label:n,children:[e,s&&!s.hideValue&&(0,a.jsxs)(a.Fragment,{children:[l&&!e&&(0,a.jsx)(te.Z,{className:s.isBlurred?"--tmp":"",value:s.total}),(0,a.jsx)("div",{className:l?"isSecondary":"isPrimary",children:!o||(0,sn.o)(s.total)?"-":l&&!s.isPercent&&s.value?(0,a.jsx)(te.Z,{className:(s.isBlurred?"--tmp":"")+" timer",value:s.total.sub(s.value)}):`${o}${s.isPercent?"":"/"}${s.isPercent?"%":(0,h.u)(s.total)}`})]})]}),s&&!s.hideGraph&&(0,a.jsx)($a,{...s})]})}));var Ha=n(47564),Qa=n(84522);const Oa=(0,Ha.Rf)((()=>"")),Wa="\n background: white;\n border-radius: 50%;\n box-sizing: border-box;\n color: #333;\n\n &.isInline {\n display: inline-block;\n height: 24px;\n margin-right: 0.75rem;\n vertical-align: middle;\n width: 24px;\n }\n",Ga=(0,A.z)(x.Z)`${Wa}`,Ja=A.z.img`${Wa}`,Ka=s.memo((function({className:e="",isInline:t,logo:n,onClick:i,withoutHl:r}){const{apiEndpoint:o}=(0,F.h)(),[l,c,d]=(0,s.useMemo)((()=>{const e=Oa.find((e=>e.info===n)),t=e?.ui.logo||n||o?.ui.logo,a=t||Qa.h,[s,i]=a&&"empty"!==a&&(a.startsWith("data:")||a.startsWith("fa;"))?a.startsWith("fa;")?[!0,a.substring(3)]:[!1,a]:[!1,Qa.h];return[!t||"empty"===n,i,s]}),[o,n]),u=`${e} ui--ChainImg ${l&&!r?"highlight--bg":""} ${t?"isInline":""}`;return d?(0,a.jsx)(Ga,{className:u,icon:c}):(0,a.jsx)(Ja,{alt:"chain logo",className:u,onClick:i,src:c})}));var Ya=n(22581);const Xa=(0,A.z)(ma)` + text-align: right; +`,_a=s.memo((function({className:e="",genesisHash:t,isDisabled:n,onChange:i}){const{t:r}=(0,z.$)(),{api:o,isDevelopment:l}=(0,F.h)(),c=(0,s.useMemo)((()=>function(e,t){return!!t&&(Object.values(Ya.p).find((t=>t.includes(e)))||[e]).includes(t)}(o.genesisHash.toHex(),t)),[o,t]),d=(0,s.useCallback)((e=>i(e?o.genesisHash.toHex():null)),[o,i]);return l?null:(0,a.jsx)(Xa,{className:e,isDisabled:n,label:r("only this network"),onChange:d,preventDefault:!0,value:c})}));var es=n(24468),ts=n(94858),ns=n(74844),as=n(93738);const ss=A.z.div` + position: relative; + display: inline-block; + padding: 1em 1em 0; + height: 15vw; + width: 15vw; +`,is=s.memo((function({children:e,className:t=""}){return(0,a.jsx)(ss,{className:`${t} ui--Chart`,children:e})})),rs=s.memo((function({className:e="",size:t=100,values:n}){const s={colorHover:[],colorNormal:[],data:[],labels:[]};return n.forEach((({colors:[e="#00f",t],label:n,value:a})=>{s.colorNormal.push(e),s.colorHover.push(t||e),s.data.push((0,Fa.G)(a).toNumber()),s.labels.push(n)})),(0,a.jsx)(is,{className:`${e} ui--Chart-Doughnut`,children:(0,a.jsx)(as.$I,{data:{datasets:[{backgroundColor:s.colorNormal,data:s.data,hoverBackgroundColor:s.colorHover}],labels:s.labels},height:t,width:t})})}));var os=n(65968),ls=n(88858);function cs(e){return ls.c(e).alpha(.65).rgbString()}const ds=s.memo((function({aspectRatio:e=8,className:t="",max:n=100,showLabels:i=!1,values:r}){const[{chartData:o,chartOptions:l,jsonValues:c},d]=(0,s.useState)({});return(0,s.useEffect)((()=>{const t=JSON.stringify(r);t!==c&&d(function(e,t,n,a,s){return{chartData:t.reduce(((e,{colors:[t="#00f",n],label:a,value:s})=>{const i=e.datasets[0];return i.backgroundColor.push(cs(t)),i.hoverBackgroundColor.push(cs(n||t)),i.data.push((0,os.h)(s)?s:(0,Fa.G)(s).toNumber()),e.labels.push(a),e}),{datasets:[{backgroundColor:[],data:[],hoverBackgroundColor:[]}],labels:[]}),chartOptions:{aspectRatio:e,plugins:{legend:{display:!1},tooltip:{callbacks:{label:e=>t[e.dataIndex].tooltip||t[e.dataIndex].label}}},scales:{x:s?{beginAtZero:!0,max:a}:{display:!1}}},jsonValues:n}}(e,r,t,n,i))}),[e,c,n,i,r]),o?(0,a.jsx)("div",{className:`${t} ui--Chart-HorizBar`,children:(0,a.jsx)(as.$Q,{data:o,height:null,options:l,width:null})}):null}));var us=n(33403),ms=n(6485);const hs=["#ff8c00","#008c8c","#8c008c"],ps={animation:{duration:0},elements:{point:{hoverRadius:6,radius:0}},hover:{intersect:!1},interaction:{intersect:!1,mode:"index"},plugins:{crosshair:{line:{color:"#ff8c00",dashPattern:[5,5],width:2},snap:{enabled:!0},sync:{enabled:!0},zoom:{enabled:!1}},legend:{display:!1},tooltip:{intersect:!1}},scales:{x:{ticks:{maxRotation:60,minRotation:60}}}},gs=A.z.div` + h1.ui--Chart-Header { + margin-bottom: 0.25rem; + margin-top: 1rem; + padding-left: 0.25rem; + } +`,fs=s.memo((function({className:e="",colors:t,labels:n,legends:i,options:r,title:o,values:l}){const c=(0,s.useMemo)((()=>function(e={}){return(0,us.Z)({},ps,e,{plugins:(0,us.Z)({},ps.plugins,e.plugins,{annotation:(0,us.Z)({},ps.plugins?.annotation,e.plugins?.annotation),crosshair:(0,us.Z)({},ps.plugins?.crosshair,e.plugins?.crosshair),tooltip:(0,us.Z)({},ps.plugins?.tooltip,e.plugins?.tooltip)}),scales:(0,us.Z)({},ps.scales,e.scales,{x:(0,us.Z)({},ps.scales?.x,e.scales?.x),y:(0,us.Z)({},ps.scales?.y,e.scales?.y)})})}(r)),[r]),d=(0,s.useMemo)((()=>function(e=[],t,n,a){return a.reduce(((n,a,s)=>{const i=e[s]||cs(hs[s]),r=a.map((e=>(0,ms.H)(e)?e.toNumber():e));return n.datasets.push({backgroundColor:i,borderColor:i,cubicInterpolationMode:"default",data:r,fill:!1,hoverBackgroundColor:i,label:t[s],lineTension:.25}),n}),{datasets:[],labels:n})}(t,i,n,l)),[t,n,i,l]);return(0,a.jsxs)(gs,{className:`${e} ui--Chart-Line`,children:[o&&(0,a.jsx)("h1",{className:"ui--Chart-Header",children:o}),(0,a.jsx)(Zn,{children:(0,a.jsx)(as.x1,{data:d,options:c})})]})}));es.kL.register(es.uw,es.f$,es.jn,es.od,es.Dx,es.u,ts.Z,ns.ZP);const bs={Doughnut:rs,HorizBar:ds,Line:fs},xs=A.z.div` + display: inline-block; + cursor: pointer; + + &.isDisabled { + opacity: 0.5; + } + + &:not(.isDisabled) { + cursor: pointer; + } + + > label { + color: var(--color-text); + display: inline-block; + margin: 0 0.5rem; + opacity: 1; + cursor: pointer; + user-select: none; + } + + > label, + > .ui--Icon { + vertical-align: middle; + } + + .ui--Icon { + border: 1px solid var(--color-checkbox); + border-radius: 0.125rem; + } +`,As=s.memo((function({className:e="",isDisabled:t,label:n,onChange:i,value:r}){const o=(0,s.useCallback)((()=>{!t&&i&&i(!r)}),[t,i,r]);return(0,a.jsxs)(xs,{className:`${e} ui--Checkbox ${t?"isDisabled":""}`,onClick:o,children:[(0,a.jsx)(x.Z,{color:r?"normal":"transparent",icon:"check"}),n&&(0,a.jsx)("label",{children:n})]})})),vs="750px",ws="550px",ys="\n display: flex;\n flex-wrap: wrap;\n\n &.is50 {\n > .ui--Column {\n max-width: 50%;\n min-width: 50%;\n }\n }\n\n &.is60 {\n > .ui--Column:first-child {\n max-width: 60%;\n min-width: 60%;\n }\n\n > .ui--Column:last-child {\n max-width: 40%;\n min-width: 40%;\n }\n }\n\n &.is100 {\n > .ui--Column {\n max-width: 100%;\n min-width: 100%;\n }\n }\n",js=A.z.div` + &.isReverse { + flex-direction: row-reverse; + } + + &.defaultSize { + @media only screen and (min-width: ${"1025px"}) { + ${ys} + } + + &.isPadded > .ui--Column { + padding: 0 0.75rem; + } + } + + &.smallSize { + @media only screen and (min-width: ${vs}) { + ${ys} + } + + &isPadded > .ui--Column { + padding: 0 0.5rem; + } + } + + &.tinySize { + @media only screen and (min-width: ${ws}) { + ${ys} + } + + &.isPadded > .ui--Column { + padding: 0 0.25rem; + } + } + + &.defaultSize, &.smallSize { + @media only screen and (max-width: ${vs}) { + &.isPadded > .ui--Column { + padding: 0 0.5rem; + } + } + } + + &.defaultSize, &.smallSize, &.tinySize { + @media only screen and (max-width: ${ws}) { + &.isPadded > .ui--Column { + padding: 0 0.25rem; + } + } + } + + > .ui--Column { + box-sizing: border-box; + max-width: 100%; + flex: 1 1; + margin: 0; + width: 100%; + + &:first-child { + padding-left: 0; + } + + &:last-child { + padding-right: 0; + } + } +`,Cs=s.memo((function({children:e,className:t="",is60:n,is100:s,isPadded:i=!0,isReverse:r,size:o="default"}){return(0,a.jsx)(js,{className:`${t} ui--Columar ${s?"is100":n?"is60":"is50"} ${i?"isPadded":""} ${r?"isReverse":""} ${o}Size`,children:e})}));Cs.Column=function({children:e,className:t=""}){return(0,a.jsx)("div",{className:`${t} ui--Column`,children:e})};const ks=Cs;var Ns=n(13731),Es=(n(79472),n(92890));const Ss=A.z.div` + .codeflask { + border: 1px solid var(--border-input); + background: transparent; + } + + &.invalid { + .codeflask { + background-color: #fff6f6; + border-color: #e0b4b4; + } + } +`,Is=s.memo((function({className:e="",code:t,isValid:n,onEdit:i}){const[r]=(0,s.useState)((()=>`flask-${Date.now()}`)),o=(0,s.useRef)(null);return(0,s.useEffect)((()=>{const e=new Es.Z(`#${r}`,{language:"js",lineNumbers:!0});e.updateCode(t),e.editorRoot.addEventListener("keydown",(()=>{e.onUpdate(i)})),o.current=e}),[]),(0,s.useEffect)((()=>{o.current&&o.current.updateCode(t)}),[t]),(0,a.jsx)(Ss,{className:`${e} ui-Editor ${!1===n?"invalid":""}`,id:r})})),Bs=A.z.div` + display: inline-flex; + align-items: center; + justify-content: center; + width: 1.7rem; + height: 1.7rem; + border: 1px solid var(--border-table); + border-radius: 4px; + cursor: pointer; +`,Ds=s.memo((function({className:e="",expanded:t,onClick:n}){return(0,a.jsx)(Bs,{className:`${e} ui--ExpandButton`,"data-testid":"row-toggle",onClick:n,children:(0,a.jsx)(x.Z,{icon:t?"caret-up":"caret-down"})})}));var Ls=n(27421);const Vs=(0,Re.e)("useWindowColumns",(function(e=3){const t=$t();return(0,Ls.N)(e>=3&&t.width>=1500?3:e>=2&&t.width>=1050?2:1)})),Ps=s.memo((function({children:e,className:t="",colSpan:n,label:s,labelPost:i,rowSpan:r,value:o,withLoading:l}){return(0,a.jsxs)("td",{className:`${t} ui--Table-Column-Balance number`,colSpan:n,rowSpan:r,children:[o?(0,a.jsx)(ee.Z,{label:s,labelPost:i,value:o}):l&&(0,a.jsx)(ee.Z,{className:"--tmp",value:1}),e]})})),Ts=A.z.td` + && { + box-sizing: content-box; + cursor: pointer; + min-width: 1.7rem; + padding-left: 0; + text-align: left; + width: 1.7rem; + + > div { + align-items: center; + border: 1px solid var(--border-table); + border-radius: 4px; + box-sizing: border-box; + display: inline-flex; + height: 1.7rem; + justify-content: center; + width: 1.7rem; + } + } +`,Ms=s.memo((function({className:e="",colSpan:t,isExpanded:n,rowSpan:s,toggle:i}){return(0,a.jsx)(Ts,{className:`${e} ui--Table-Column-Expand`,colSpan:t,onClick:i,rowSpan:s,children:(0,a.jsx)("div",{children:(0,a.jsx)(x.Z,{icon:n?"caret-up":"caret-down"})})})})),Fs=A.z.td` + && { + box-sizing: content-box; + cursor: pointer; + min-width: 1rem; + padding-right: 0.35rem; + text-align: right; + width: 1rem; + } +`,zs=s.memo((function({address:e,className:t="",colSpan:n,isFavorite:i,rowSpan:r,toggle:o}){const l=(0,s.useCallback)((()=>o(e)),[e,o]);return(0,a.jsx)(Fs,{className:`${t} ui--Table-Column-Favorite`,colSpan:n,onClick:l,rowSpan:r,children:(0,a.jsx)(x.Z,{color:i?"orange":"gray",icon:"star"})})})),Zs=`${7.15.toFixed(3)}ch`,Rs=A.z.td` + && { + box-sizing: content-box; + min-width: ${Zs}; + text-align: right; + white-space: nowrap; + width: ${Zs}; +`,$s=s.memo((function({children:e,className:t="",colSpan:n,rowSpan:s,value:i}){return(0,a.jsxs)(Rs,{className:`${t} ui--Table-Column-Id`,colSpan:n,rowSpan:s,children:[(0,a.jsx)("h2",{className:"--digits",children:(0,h.u)(i)}),e]})})),qs=s.memo((function({children:e,className:t=""}){return(0,a.jsx)("td",{className:`${t} ui--Table-Column`,children:e})}));qs.Balance=Ps,qs.Expand=Ms,qs.Favorite=zs,qs.Id=$s;const Us=qs,Hs=s.memo((function({children:e,className:t=""}){return(0,a.jsx)("tr",{className:`${t} ui--Table-Row`,children:e})})),Qs=s.memo((function({children:e,className:t="",empty:n,emptySpinner:s,isEmpty:i,noBodyTag:r}){const o=`${t} ui--Table-Body`;return i?(0,a.jsx)("tbody",{className:o,children:(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:100,children:(0,dn.H)(n)?(0,a.jsx)("div",{className:"empty",children:n}):n||(0,a.jsx)(U,{label:s})})})}):r?(0,a.jsx)(a.Fragment,{children:e}):(0,a.jsx)("tbody",{className:o,children:e})})),Os=A.z.tfoot` + td { + color: var(--color-table-foot); + font: var(--font-sans); + font-weight: var(--font-weight-normal); + padding: 0.75rem 1rem 0.25rem; + text-align: right; + vertical-align: baseline; + white-space: nowrap; + } + + tr { + background: var(--bg-page); + } +`,Ws=s.memo((function({className:e="",footer:t,isEmpty:n}){return!t||n?null:(0,a.jsx)(Os,{className:`${e} ui--Table-Foot`,children:t})})),Gs=A.z.thead` + z-index: 1; + + th { + background: var(--bg-table); + font: var(--font-sans); + font-weight: var(--font-weight-normal); + padding: 0.375rem 1rem; + text-align: right; + vertical-align: middle; + white-space: nowrap; + + h1 { + display: table-cell; + vertical-align: middle; + + .sub { + display: inline-block; + font-size: var(--font-size-base); + font-weight: var(--font-weight-normal); + opacity: var(--opacity-light); + padding-left: 1.5rem; + text-overflow: ellipsis; + vertical-align: middle; + } + } + + > label { + margin: 0 !important; + } + + &.address { + padding-left: 3rem; + text-align: left; + } + + &.badge { + padding: 0; + } + + &.expand, + &.number { + text-align: right; + } + + &.isClickable { + cursor: pointer; + } + + &.mini { + padding: 0 !important; + } + + &.no-pad-left { + padding-left: 0.125rem; + } + + &.no-pad-right { + padding-right: 0.125rem; + } + + &.start { + text-align: left; + } + + &.balances { + text-align: right; + padding-right: 2.25rem; + } + } + + tr { + text-transform: lowercase; + + &.filter { + .ui.input, + .ui.selection.dropdown { + background: transparent; + + &:first-child { + margin-top: 0; + } + } + + th { + padding: 0; + } + } + + &:not(.filter) { + th { + color: var(--color-table-head); + } + } + } +`,Js=s.memo((function({children:e,className:t="",filter:n,header:s,isEmpty:i}){return s?.length?(0,a.jsxs)(Gs,{className:`${t} ui--Table-Head`,children:[n&&(0,a.jsx)("tr",{className:"filter",children:(0,a.jsx)("th",{colSpan:100,children:n})}),(0,a.jsx)("tr",{children:s.filter((e=>!!e)).map((([e,t="default",n=1,s],r)=>(0,a.jsx)("th",{className:t,colSpan:n,onClick:s,children:0===r?(0,a.jsx)("h1",{children:e}):!i&&e&&(0,a.jsx)("label",{children:e})},r)))}),e]}):null})),Ks={2:[0,1],3:[0,1,2]},Ys="0.125rem solid var(--bg-page)",Xs="0.25rem solid var(--bg-page)",_s="0.5rem",ei=A.z.div` + max-width: 100%; + width: 100%; + + .ui--Table-Split { + display: flex; + flex-wrap: nowrap; + margin-bottom: 1.5rem; + + > .ui--Table-Split-3 { + max-width: 33.3%; + min-width: 33.3%; + } + + > .ui--Table-Split-2 { + max-width: 50%; + min-width: 50%; + } + } + + table { + border-collapse: collapse; + border-spacing: 0; + max-width: 100%; + overflow: hidden; + position: relative; + width: 100%; + z-index: 1; + + &.isFixed { + table-layout: fixed; + } + + &:not(.isInline):not(.noMargin) { + margin-bottom: 1.5rem; + } + + &.isInline { + tbody tr td { + border-top-width: 1px; + padding: 0.25rem 0.75rem; + } + } + + tr { + max-width: 100%; + width: 100%; + + td, + &:not(.filter) th { + &:first-child { + padding-left: 1.5rem; + } + + &:last-child { + padding-right: 0.75rem; + } + + &.all { + width: 100%; + + &:not(.overflow) { + word-break: break-word; + } + + summary { + white-space: normal; + } + } + } + } + } + + tbody, thead { + position: relative; + width: 100%; + + tr { + width: 100%; + } + } + + tbody { + position: relative; + + td { + background: var(--bg-table); + padding: 0.5rem 1rem; + text-align: left; + vertical-align: middle; + + > article.mark { + margin-left: 0rem; + } + + &:first-child { + border-left: ${Ys}; + } + + &:last-child { + border-right: ${Ys}; + } + + label { + display: block !important; + white-space: nowrap; + } + + div.empty { + opacity: var(--opacity-light); + padding: 0.25rem; + } + + .ui--Spinner { + margin: 0 auto; + + .text { + margin-bottom: 0; + } + } + + &.actions { + padding-left: 0.35rem; + width: 1%; + + > div { + display: flex; + align-items: center; + flex-wrap: nowrap; + justify-content: flex-end; + + & > * + * { + margin-left: 0.35rem; + } + + .ui--Button { + white-space: nowrap; + } + } + + &:not(:last-child) { + padding-right: 0; + } + } + + &.address { + max-width: 0; + min-width: 15rem; + overflow-x: hidden; + } + + &.badge { + padding: 0.5rem; + } + + &.balance { + min-width: 20rem; + padding: 0.5rem 0 0.75rem; + } + + &.button { + padding: 0.25rem 0.35rem 0.5rem; + text-align: right; + white-space: nowrap; + + > * { + vertical-align: middle; + } + + .ui--Toggle { + display: inline-block; + white-space: nowrap; + + label { + display: inline-block !important; + } + } + } + + &.chart { + padding: 0; + } + + &.expand { + &:not(.left) { + text-align: right; + } + + .ui--Expander + .ui--Expander { + margin-top: 0.375rem; + } + } + + &.hash { + // we actually want to use 10ch here, however in the + // block expand page gives different sizes to the hashes + min-width: 7.5rem; + white-space: nowrap; + + > .shortHash { + max-width: var(--width-shorthash); + min-width: 3em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: var(--width-shorthash); + } + } + + &.links { + padding: 0.5rem 0.75rem; + text-align: center; + width: 0; + } + + &.no-pad-left { + padding-left: 0.125rem; + } + + &.no-pad-right { + padding-right: 0.125rem; + } + + &.no-pad-top { + padding-top: 0.125rem; + } + + &.no-pad { + padding: 0; + } + + &.number { + font-variant-numeric: tabular-nums; + text-align: right; + } + + &.relative { + position: relative; + + .absolute { + position: absolute; + right: 0.5rem; + // this seems aligned with expander (when zoomed in) + top: 0.72rem; + white-space: nowrap; + } + } + + &.overflow { + max-width: 0; + overflow: hidden; + text-overflow: ellipsis; + word-break: none; + } + + &.start { + text-align: left; + } + + &.together { + white-space: nowrap; + } + + &.top { + vertical-align: top; + } + + &.columar { + vertical-align: top; + + .ui--Columar .ui--Column { + margin: 1rem 0 0.75rem 0; + padding: 0; + + * + h5 { + margin-top: 1rem; + } + + .ui--Chart-Line { + padding: 0 0.5rem; + } + } + } + + &.middle { + text-align: center; + } + + &.mini { + padding: 0 !important; + width: fit-content; + white-space: normal; + + > div { + margin-right: 0.75rem; + max-width: 3.8rem; + min-width: 3.8rem; + } + } + + &.upper { + text-transform: uppercase; + } + + .ui--Button-Group .ui--Button:not(.isToplevel) { + margin: 0; + } + } + + tr { + &:not(.isExpanded) { + td { + border-top: ${Xs}; + + &:first-child { + border-top-left-radius: ${_s}; + border-bottom-left-radius: ${_s}; + } + + &:last-child { + border-top-right-radius: ${_s}; + border-bottom-right-radius: ${_s}; + } + } + } + + &.isExpanded { + &.isFirst { + td { + border-top: ${Xs}; + + &:first-child { + border-top-left-radius: ${_s}; + } + + &:last-child { + border-top-right-radius: ${_s}; + } + } + } + + &.isLast { + td { + &:first-child { + border-bottom-left-radius: ${_s}; + } + + &:last-child { + border-bottom-right-radius: ${_s}; + } + } + } + } + + &.packedBottom { + td { + padding-bottom: 0; + } + } + + &.packedTop { + td { + padding-top: 0; + } + } + + &.packedAll { + td { + padding-bottom: 0; + padding-top: 0; + } + } + + &.transparent { + background: transparent; + } + + &.isCollapsed { + display: none; + } + + .ui--Button-Group { + margin: 0; + } + + .ui--Button:not(.isIcon):not(:hover) { + background: transparent !important; + box-shadow: none !important; + } + + .ui.toggle.checkbox input:checked ~ .box:before, + .ui.toggle.checkbox input:checked ~ label:before { + background-color: #eee !important; + } + } + } + + thead { + tr { + &:first-child { + th { + border-top: ${Xs}; + + &:first-child { + border-top-left-radius: ${_s}; + } + + &:last-child { + border-top-right-radius: ${_s}; + } + } + } + + &:last-child { + th { + padding-top: 1rem; + + &:first-child { + border-bottom-left-radius: ${_s}; + } + + &:last-child { + border-bottom-right-radius: ${_s}; + } + } + } + + th { + &:first-child { + border-left: ${Ys}; + } + + &:last-child { + border-right: ${Ys}; + } + } + } + } +`,ti=s.memo((function({children:e,className:t="",empty:n,emptySpinner:s,filter:i,footer:r,header:o,headerChildren:l,isFixed:c,isInline:d,isSplit:u,legend:m,maxColumns:h,noBodyTag:p}){const g=Vs(h),f=Array.isArray(e),b=!e||f&&0===e.length,x=(0,a.jsx)(Js,{filter:i,header:o,isEmpty:b,children:l});return u&&f&&!b&&1!==g?(0,a.jsxs)(ei,{className:`${t} ui--Table isSplit`,children:[m,(0,a.jsx)("table",{className:"noMargin",children:x}),(0,a.jsx)("div",{className:"ui--Table-Split",children:Ks[g].map((t=>(0,a.jsx)("div",{className:`ui--Table-Split-${g}`,children:(0,a.jsx)("table",{className:"noMargin",children:(0,a.jsx)("tbody",{className:"ui--Table-Body",children:e.filter(((e,n)=>n%g===t))})})},t)))})]}):(0,a.jsxs)(ei,{className:`${t} ui--Table`,children:[m,(0,a.jsxs)("table",{className:`${c&&!b?"isFixed":"isNotFixed"} ${d?"isInline":""}`,children:[x,(0,a.jsx)(Qs,{empty:n,emptySpinner:s,isEmpty:b,noBodyTag:p,children:e}),(0,a.jsx)(Ws,{footer:r,isEmpty:b})]})]})}));ti.Column=Us,ti.Row=Hs;const ni=ti;function ai(e,t){return(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:e})},t)}const si=(0,A.z)(me)` + .tableContainer { + overflow-y: scroll; + display: block; + margin: 0 0 0 auto; + max-height: 13.75rem; + max-width: 25rem; + overflow-x: hidden; + } +`,ii=s.memo((function({children:e,className:t,empty:n,renderChildren:i,summary:r}){const o=(0,s.useMemo)((()=>!(!i&&!e)),[e,i]),l=(0,s.useCallback)((()=>(i||e)&&(0,a.jsx)("div",{className:"tableContainer",children:(0,a.jsx)(ni,{empty:n,isInline:!0,children:i?i()?.map(ai):Array.isArray(e)?e.map(ai):(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:e})})})})),[e,n,i]);return(0,a.jsx)(si,{className:t,renderChildren:o?l:void 0,summary:r})})),ri=A.z.div` + width: 29.5rem; + + .ui--Input { + margin: 0; + height: 3.893rem; + } +`,oi=s.memo((function({className:e="",filterOn:t,label:n,setFilter:s}){return(0,a.jsx)(ri,{className:e,children:(0,a.jsx)(_t.ZP,{autoFocus:!0,isFull:!0,label:n,onChange:s,value:t})})})),li=A.z.div` + display: none; + right: calc(50% - var(--width-half) + 1.5rem); + + .ui--Labelled label { + display: none; + } + + && .ui--Input { + margin: 0.29rem 0; + } + + @media only screen and (min-width: 1150px) { + display: flex; + justify-content: flex-end; + position: absolute; + top: 0; + + > div { + max-width: 35rem !important; + } + + .ui--Labelled label { + display: flex; + } + + .ui.selection.dropdown { + white-space: nowrap; + } + } + + /* hardcoded: var(--width-full) doesn't work in media */ + @media only screen and (max-width: 1750px) { + right: 1.5rem; + } +`,ci=s.memo((function({children:e,className:t}){return(0,a.jsx)(li,{className:t,children:e})}));function di(e,t){switch(e){case"account":return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("You are about to remove this account from your list of available accounts. Once completed, should you need to access it again, you will have to re-create the account either via seed or via a backup file.")}),(0,a.jsx)("p",{children:t("This operation does not remove the history of the account from the chain, nor any associated funds from the account. The forget operation only limits your access to the account on this browser.")})]});case"address":return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("You are about to remove this address from your address book. Once completed, should you need to access it again, you will have to re-add the address.")}),(0,a.jsx)("p",{children:t("This operation does not remove the history of the account from the chain, nor any associated funds from the account. The forget operation only limits your access to the address on this browser.")})]});case"contract":return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("You are about to remove this contract from your list of available contracts. Once completed, should you need to access it again, you will have to manually add the contract's address in the Instantiate tab.")}),(0,a.jsx)("p",{children:t("This operation does not remove the history of the contract from the chain, nor any associated funds from its account. The forget operation only limits your access to the contract on this browser.")})]});default:return null}}function ui(e,t){switch(e){case"account":return t("Confirm account removal");case"address":return t("Confirm address removal");case"contract":return t("Confirm contract removal");case"code":return t("Confirm code removal")}}function mi(e,t){const{address:n,mode:s="account"}=e;switch(s){case"account":case"address":case"contract":return(0,a.jsx)(Ba,{isInline:!0,value:n||"",children:di(s,t)});default:return null}}const hi=s.memo((function(e){const{t}=(0,z.$)(),{children:n,mode:s="account",onClose:i,onForget:r}=e;return(0,a.jsxs)(Yn,{className:"app--accounts-Modal",header:ui(s,t),onClose:i,children:[(0,a.jsx)(Yn.Content,{children:n||mi(e,t)}),(0,a.jsx)(Yn.Actions,{children:(0,a.jsx)(G,{icon:"trash",label:t("Forget"),onClick:r})})]})}));var pi=n(71689);const gi=[n(70827).Z],fi=A.z.div` + .help-button { + color: var(--color-text); + cursor: pointer; + font-size: 2rem; + padding: 0.35rem 1.5rem 0 0; + } + + > .help-button { + position: absolute; + right: 0rem; + top: 0rem; + z-index: 10; + } + + .help-slideout { + background: var(--bg-page); + box-shadow: -6px 0px 20px 0px rgba(0, 0, 0, 0.3); + bottom: 0; + max-width: 50rem; + overflow-y: scroll; + position: fixed; + right: -50rem; + top: 0; + transition-duration: .5s; + transition-property: all; + z-index: 225; /* 5 more than menubar */ + + .help-button { + text-align: right; + } + + .help-content { + padding: 1rem 1.5rem 5rem; + } + + &.open { + right: 0; + } + } +`;s.memo((function({className:e="",md:t}){const[n,s]=(0,de.O)();return(0,a.jsxs)(fi,{className:`${e} ui--HelpOverlay`,children:[(0,a.jsx)("div",{className:"help-button",children:(0,a.jsx)(x.Z,{icon:"question-circle",onClick:s})}),(0,a.jsxs)("div",{className:"help-slideout "+(n?"open":"closed"),children:[(0,a.jsx)("div",{className:"help-button",children:(0,a.jsx)(x.Z,{icon:"times",onClick:s})}),(0,a.jsx)(pi.D,{className:"help-content",rehypePlugins:gi,children:t})]})]})}));const bi=(0,A.z)(pn.Z)` + background: white; + border-radius: 0 0 0.25rem 0.25rem; + margin: -0.5rem 0 0.25rem; + padding: 1.25rem 1.5rem 1rem; + + &.error { + background: #db2828; + color: #eee; + } + + &.warning { + background: #ffffe0; + } + + > ul { + margin: 0; + padding: 0; + } +`,xi=s.memo((function({children:e,className:t="",type:n="info"}){return(0,a.jsx)(bi,{children:(0,a.jsx)("div",{className:`${t} ${n}`,children:e})})}));var Ai=n(47623);const vi=s.memo((function({address:e,filter:t,isHidden:n,onSelect:i}){const r=(0,s.useCallback)((()=>i(e)),[e,i]);return n?null:(0,a.jsx)(La,{address:e,filter:t,noToggle:!0,onChange:r})})),wi=s.memo((function({address:e,filter:t,isHidden:n,onDeselect:i}){const r=(0,s.useCallback)((()=>i(e)),[e,i]);return n?null:(0,a.jsx)(La,{address:e,filter:t,noToggle:!0,onChange:r})})),yi=A.z.div` + border-top-width: 0px; + margin-left: 2rem; + width: calc(100% - 2rem); + + .ui--InputAddressMulti-Input { + .ui.input { + margin-bottom: 0.25rem; + opacity: 1 !important; + } + } + + .ui--InputAddressMulti-columns { + display: inline-flex; + flex-direction: row-reverse; + justify-content: space-between; + width: 100%; + + .ui--InputAddressMulti-column { + display: flex; + flex-direction: column; + min-height: 15rem; + max-height: 15rem; + width: 50%; + padding: 0.25rem 0.5rem; + + .ui--InputAddressMulti-items { + padding: 0.5rem 0; + background: var(--bg-input); + border: 1px solid var(--border-input); + border-radius: 0.286rem 0.286rem; + flex: 1; + overflow-y: auto; + overflow-x: hidden; + + .ui--Spinner { + margin-top: 2rem; + } + + .ui--AddressToggle { + padding-left: 0.75rem; + } + + .ui--AddressMini-address { + min-width: auto; + max-width: 100%; + } + + .ui--AddressMini-info { + max-width: 100%; + } + } + } + } +`,ji=s.memo((function({available:e,availableLabel:t,className:n="",defaultValue:i,maxCount:r,onChange:o,valueLabel:l}){const{t:c}=(0,z.$)(),[d,u]=(0,s.useState)(""),[m,h]=(0,s.useState)([]),p=(0,Ls.N)(d),g=(0,Ai.q)();(0,s.useEffect)((()=>{i&&h(i)}),[i]),(0,s.useEffect)((()=>{m&&o(m)}),[o,m]);const f=(0,s.useCallback)((e=>h((t=>function(e,t,n){return!e.includes(t)&&e.lengthh((t=>function(e,t){return e.includes(t)?e.filter((e=>e!==t)):e}(t,e)))),[]);return(0,a.jsxs)(yi,{className:`${n} ui--InputAddressMulti`,children:[(0,a.jsx)(_t.ZP,{autoFocus:!0,className:"ui--InputAddressMulti-Input",isSmall:!0,onChange:u,placeholder:c("filter by name, address, or account index"),value:d,withLabel:!1}),(0,a.jsxs)("div",{className:"ui--InputAddressMulti-columns",children:[(0,a.jsxs)("div",{className:"ui--InputAddressMulti-column",children:[(0,a.jsx)("label",{children:l}),(0,a.jsx)("div",{className:"ui--InputAddressMulti-items",children:m.map((e=>(0,a.jsx)(wi,{address:e,onDeselect:b},e)))})]}),(0,a.jsxs)("div",{className:"ui--InputAddressMulti-column",children:[(0,a.jsx)("label",{children:t}),(0,a.jsx)("div",{className:"ui--InputAddressMulti-items",children:g?e.map((e=>(0,a.jsx)(vi,{address:e,filter:p,isHidden:m?.includes(e),onSelect:f},e))):(0,a.jsx)(U,{})})]})]})]})})),Ci=A.z.div` + position: relative; + + .ui--InputAddressSimpleIcon { + background: #eee; + border: 1px solid #888; + border-radius: 50%; + left: 0.75rem; + position: absolute; + top: 1rem; + } +`,ki=s.memo((function({autoFocus:e,bytesLength:t,children:n,className:i="",defaultValue:r,forceIconType:o,isDisabled:l,isError:c,isFull:d,label:u,noConvert:m,onChange:h,onEnter:p,onEscape:g,placeholder:b}){const[x,A]=(0,s.useState)(r||null),v=(0,s.useCallback)((e=>{const n=(0,f.Hc)(e,void 0,t)||null,a=m?n?e:null:n;A(a),h&&h(a)}),[t,m,h]);return(0,a.jsxs)(Ci,{className:`${i} ui--InputAddressSimple`,children:[(0,a.jsx)(_t.ZP,{autoFocus:e,defaultValue:r,isDisabled:l,isError:c||!x,isFull:d,label:u,onChange:v,onEnter:p,onEscape:g,placeholder:b,children:n}),(0,a.jsx)(Ke,{className:"ui--InputAddressSimpleIcon",forceIconType:o,size:32,value:x})]})})),Ni=A.z.div` + .ui--DropdownLinked-Items { + .text { + box-sizing: border-box; + display: flex !important; + flex-wrap: nowrap; + justify-content: space-between; + overflow: hidden; + position: relative; + width: 100%; + white-space: nowrap; + } + + > .text { + padding-left: 1em; + } + } + + .ui--DropdownLinked-Item-text, + .ui--DropdownLinked-Item-call { + display: inline-block; + } + + .ui--DropdownLinked-Item-call { + flex: 1 0; + margin-right: 1rem; + text-align: left; + text-overflow: ellipsis; + } + + .ui--DropdownLinked-Item-text { + flex: 1; + font-size: var(--font-size-small); + opacity: var(--opacity-light); + overflow: hidden; + text-align: right; + text-overflow: ellipsis; + } + + > .ui--Labelled > label { + text-transform: none; + } +`,Ei=s.memo((function({children:e,className:t="",label:n,withLabel:s}){return(0,a.jsx)(Ni,{className:t,children:(0,a.jsx)(pn.Z,{label:n,withLabel:s,children:(0,a.jsx)("div",{className:"ui--DropdownLinked ui--row",children:e})})})}));function Si(e,t){if(!t)return[];const n=e[t];return n&&0!==Object.keys(e[t]).length?Object.keys(e[t]).filter((e=>!e.startsWith("$"))).sort().map((e=>n[e])).map((({description:e,method:n,params:s})=>{const i=s.map((({name:e})=>e)).join(", ");return{className:"ui--DropdownLinked-Item",key:`${t}_${n}`,text:[(0,a.jsxs)("div",{className:"ui--DropdownLinked-Item-call",children:[n,"(",i,")"]},`${t}_${n}:call`),(0,a.jsx)("div",{className:"ui--DropdownLinked-Item-text",children:e||n},`${t}_${n}:text`)],value:n}})):[]}const Ii=s.memo((function({className:e="",defs:t,isError:n,onChange:i,options:r,value:o}){const l=(0,s.useCallback)((e=>t[o.section][e]),[t,o]);return r.length?(0,a.jsx)(Xt.Z,{className:`${e} ui--DropdownLinked-Items`,isError:n,onChange:i,options:r,transform:l,value:o.method,withLabel:!1}):null})),Bi=s.memo((function({className:e="",defaultValue:t,isError:n,onChange:s,options:i,value:r}){return(0,a.jsx)(Xt.Z,{className:`${e} ui--DropdownLinked-Sections`,defaultValue:t,isError:n,onChange:s,options:i,value:r.section,withLabel:!1})}));function Di(e){return Object.entries(e).sort((([e],[t])=>e.localeCompare(t)))}const Li=(0,Re.e)("useRuntime",(function(){const{api:e}=(0,F.h)();return(0,s.useMemo)((()=>function(e){const t={};let n=null;const a=Di(e.call);for(let e=0,s=a.length;e{return e=r,Object.keys(e).filter((e=>!e.startsWith("$"))).sort().filter((t=>0!==Object.keys(e[t]).length)).map((e=>({text:e,value:e})));var e})),[c,d]=(0,s.useState)((()=>Si(r,o?.section))),[u,m]=(0,s.useState)((()=>o));(0,s.useEffect)((()=>{u&&n&&n(u)}),[n,u]);const h=(0,s.useCallback)((e=>{u!==e&&m((()=>e))}),[u]),p=(0,s.useCallback)((e=>{if(u&&e!==u.section){const t=Si(r,e);d(t),h(r[e][t[0].value])}}),[h,r,u]);return u?(0,a.jsxs)(Ei,{className:e,label:t,withLabel:i,children:[(0,a.jsx)(Bi,{className:"small",onChange:p,options:l,value:u}),(0,a.jsx)(Ii,{className:"large",defs:r,onChange:h,options:c,value:u})]}):null}));var Pi=n(44055);function Ti(e,t){const n=e.consts[t];return n&&0!==Object.keys(n).length?Object.keys(n).filter((e=>!e.startsWith("$"))).sort().map((s=>{const i=n[s];return{className:"ui--DropdownLinked-Item",key:`${t}_${s}`,text:[(0,a.jsxs)("div",{className:"ui--DropdownLinked-Item-call",children:[s,": ",(0,Pi.I)(e.registry.lookup,i.meta.type)]},`${t}_${s}:call`),(0,a.jsx)("div",{className:"ui--DropdownLinked-Item-text",children:(i.meta.docs[0]||i.meta.name).toString()},`${t}_${s}:text`)],value:s}})):[]}function Mi({value:e}){return t=>({method:t,section:e.section})}const Fi=s.memo((function(e){const{className:t="",isError:n,onChange:s,options:i,value:r}=e;return i.length?(0,a.jsx)(Xt.Z,{className:`${t} ui--DropdownLinked-Items`,isError:n,onChange:s,options:i,transform:Mi(e),value:r.method,withLabel:!1}):null})),zi=s.memo((function({className:e="",defaultValue:t,isError:n,onChange:s,options:i,value:{section:r}}){return(0,a.jsx)(Xt.Z,{className:`${e} ui--DropdownLinked-Sections`,defaultValue:t,isError:n,onChange:s,options:i,value:r,withLabel:!1})})),Zi=s.memo((function({className:e="",defaultValue:t,label:n,onChange:i,withLabel:r}){const{api:o}=(0,F.h)(),[l,c]=(0,s.useState)((()=>Ti(o,t.section))),[d]=(0,s.useState)((()=>function(e){return Object.keys(e.consts).filter((e=>!e.startsWith("$"))).sort().filter((t=>Object.keys(e.consts[t]).length)).map((e=>({text:e,value:e})))}(o))),[u,m]=(0,s.useState)((()=>function(e,{method:t,section:n}){const a=Object.keys(e.consts)[0],s=Object.keys(e.consts[a])[0],i=e.consts[n]?.[t]?{method:t,section:n}:{method:s,section:a};return{...i,meta:e.consts[i.section][i.method].meta}}(o,t))),h=(0,s.useCallback)((e=>{if(u.section!==e.section||u.method!==e.method){const{method:t,section:n}=e,a={meta:o.consts[n][t].meta,method:t,section:n};m(a),i&&i(a)}}),[o,i,u]),p=(0,s.useCallback)((e=>{if(e!==u.section){const t=Ti(o,e);c(t),h({method:t[0].value,section:e})}}),[h,o,u]);return(0,a.jsxs)(Ei,{className:e,label:n,withLabel:r,children:[(0,a.jsx)(zi,{className:"small",onChange:p,options:d,value:u}),(0,a.jsx)(Fi,{className:"large",onChange:h,options:l,value:u})]})}));function Ri(e,t,n){const s=e.tx[t],i=!n||n(t);return s&&0!==Object.keys(s).length&&i?Object.keys(s).filter((e=>!e.startsWith("$")&&(!n||n(t,e)))).sort().map((e=>{const n=s[e],i=n.meta.args.map((e=>e.name.toString())).join(", ");return{className:"ui--DropdownLinked-Item",key:`${t}_${e}`,text:[(0,a.jsxs)("div",{className:"ui--DropdownLinked-Item-call",children:[e,"(",i,")"]},`${t}_${e}:call`),(0,a.jsx)("div",{className:"ui--DropdownLinked-Item-text",children:(n.meta.docs[0]||e).toString()},`${t}_${e}:text`)],value:e}})):[]}const $i=s.memo((function({api:e,className:t="",defaultValue:n,isDisabled:i,isError:r,onChange:o,options:l,value:c}){const d=(0,s.useCallback)((t=>e.tx[c.section][t]),[e,c]);return l.length?(0,a.jsx)(Xt.Z,{className:`${t} ui--DropdownLinked-Items`,defaultValue:n,isDisabled:i,isError:r,onChange:o,options:l,transform:d,value:c.method,withLabel:!1}):null})),qi=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:s,onChange:i,options:r,value:o}){return(0,a.jsx)(Xt.Z,{className:`${e} ui--DropdownLinked-Sections`,defaultValue:t,isDisabled:n,isError:s,onChange:i,options:r,value:o.section,withLabel:!1})})),Ui=s.memo((function({className:e="",defaultValue:t,filter:n,isDisabled:i,label:r,onChange:o,withLabel:l}){const{api:c}=(0,F.h)(),[d,u]=(0,s.useState)((()=>Ri(c,t.section,n))),[m]=(0,s.useState)((()=>function(e,t){return Object.keys(e.tx).filter((e=>!e.startsWith("$")&&(!t||t(e)))).sort().filter((t=>Object.keys(e.tx[t]).length)).map((e=>({text:e,value:e})))}(c,n))),[h,p]=(0,s.useState)((()=>t)),[{defaultMethod:g,defaultSection:f}]=(0,s.useState)((()=>({defaultMethod:t.method,defaultSection:t.section}))),b=(0,s.useCallback)((e=>{h!==e&&(p((()=>e)),o&&o(e))}),[o,h]),x=(0,s.useCallback)((e=>{if(e!==h.section){const t=Ri(c,e,n);u(t),b(c.tx[e][t[0].value])}}),[b,c,n,h]);return(0,a.jsxs)(Ei,{className:e,label:r,withLabel:l,children:[(0,a.jsx)(qi,{className:"small",defaultValue:f,isDisabled:i,onChange:i?void 0:x,options:m,value:h}),(0,a.jsx)($i,{api:c,className:"large",defaultValue:g,isDisabled:i,onChange:i?void 0:b,options:d,value:h})]})}));var Hi=n(6574),Qi=n(56623),Oi=n(48533);const Wi="0".charCodeAt(0),Gi="x".charCodeAt(0),Ji=()=>{},Ki=A.z.div` + background: var(--bg-input); + border: 1px solid var(--border-input); + border-radius: 0.28571429rem; + font-size: var(--font-size-base); + margin: 0.25rem 0; + padding: 0.67857143em 1em; + width: 100% !important; + + &.error { + background: var(--bg-input-error); + border-color: #e0b4b4; + } + + &:hover { + cursor: pointer; + } +`,Yi=s.memo((function({accept:e,className:t="",clearContent:n,isDisabled:i,isError:r=!1,isFull:o,label:l,labelExtra:c,onChange:d,placeholder:u,withEllipsis:m,withLabel:p}){const{t:g}=(0,z.$)(),f=(0,s.createRef)(),[b,x]=(0,s.useState)(),A=(0,s.useCallback)((e=>{e.forEach((e=>{const t=new FileReader;t.onabort=Ji,t.onerror=Ji,t.onload=({target:t})=>{if(t?.result){const n=e.name,a=function(e){const t=new Uint8Array(e);if(t[0]===Wi&&t[1]===Gi){let e=(0,Qi.z)(t);for(;e.endsWith("\n");)e=e.substring(0,e.length-1);if((0,He.vq)(e))return(0,Oi.G)(e)}return t}(t.result);d&&d(a,n),f&&x({name:n,size:a.length})}},t.readAsArrayBuffer(e)}))}),[f,d]),{getInputProps:v,getRootProps:w}=(0,Hi.uI)({accept:e?.reduce(((e,t)=>({...e,[t]:[]})),{}),disabled:i,onDrop:A}),y=(0,a.jsxs)(Ki,{...w({className:`${t} ui--InputFile ${r?"error":""}`}),children:[(0,a.jsx)("input",{...v()}),(0,a.jsx)("em",{className:"label",children:!b||n?u||g("click to select or drag and drop the file here"):u||g("{{name}} ({{size}} bytes)",{replace:{name:b.name,size:(0,h.u)(b.size)}})})]});return l?(0,a.jsx)(pn.Z,{isFull:o,label:l,labelExtra:c,withEllipsis:m,withLabel:p,children:y}):y}));var Xi=n(39764);function _i(e,t,n){const s=t[n];return s&&0!==Object.keys(e.rpc[n]).length?Object.keys(e.rpc[n]).filter((e=>!e.startsWith("$"))).sort().map((e=>s[e])).filter((e=>!!e)).filter((({isSubscription:e})=>!e)).map((({description:e,method:t,params:s})=>{const i=s.map((({name:e})=>e)).join(", ");return{className:"ui--DropdownLinked-Item",key:`${n}_${t}`,text:[(0,a.jsxs)("div",{className:"ui--DropdownLinked-Item-call",children:[t,"(",i,")"]},`${n}_${t}:call`),(0,a.jsx)("div",{className:"ui--DropdownLinked-Item-text",children:e||t},`${n}_${t}:text`)],value:t}})):[]}var er=n(13529),tr=n(85617);const nr=(0,Re.e)("useRpcs",(function(){const{api:e}=(0,F.h)();return(0,s.useMemo)((()=>function(e,t,{specName:n}){return Object.entries((0,tr.KM)(e,t,n)).reduce(((e,[t,n])=>(e[t]??=function(e,t){return Object.entries(t).reduce(((t,[n,a])=>(t[n]={isSubscription:!1,jsonrpc:`${e}_${n}`,method:n,section:e,...a},t)),{})}(t,n),e)),{...er.Z})}(e.registry,e.runtimeChain,e.runtimeVersion)),[e])})),ar=s.memo((function({className:e="",isError:t,onChange:n,options:i,value:r}){const o=nr(),l=(0,s.useCallback)((e=>o[r.section][e]),[o,r]);return i.length?(0,a.jsx)(Xt.Z,{className:`${e} ui--DropdownLinked-Items`,isError:t,onChange:n,options:i,transform:l,value:r.method,withLabel:!1}):null})),sr=s.memo((function({className:e="",defaultValue:t,isError:n,onChange:s,options:i,value:r}){return(0,a.jsx)(Xt.Z,{className:`${e} ui--DropdownLinked-Sections`,defaultValue:t,isError:n,onChange:s,options:i,value:r.section,withLabel:!1})})),ir=s.memo((function({className:e="",defaultValue:t,label:n,onChange:i,withLabel:r}){const{api:o}=(0,F.h)(),l=nr(),[c,d]=(0,s.useState)((()=>_i(o,l,t.section))),[u]=(0,s.useState)((()=>function(e){return Object.keys(e.rpc).filter((e=>!e.startsWith("$"))).sort().filter((t=>0!==Object.keys(e.rpc[t]).length)).map((e=>({text:e,value:e})))}(o))),[m,h]=(0,s.useState)((()=>t));(0,s.useEffect)((()=>{i&&i(m)}),[i,m]);const p=(0,s.useCallback)((e=>{m!==e&&h((()=>e))}),[m]),g=(0,s.useCallback)((e=>{if(e!==m.section){const t=_i(o,l,e);d(t),p(l[e][t[0].value])}}),[p,o,l,m]);return(0,a.jsxs)(Ei,{className:e,label:n,withLabel:r,children:[(0,a.jsx)(sr,{className:"small",onChange:g,options:u,value:m}),(0,a.jsx)(ar,{className:"large",onChange:p,options:c,value:m})]})}));var rr=n(19729);function or(e,t){const n=e.query[t];return n&&0!==Object.keys(n).length?Object.keys(n).filter((e=>!e.startsWith("$"))).sort().map((s=>{const{meta:{docs:i,modifier:r,name:o,type:l}}=n[s],c=(0,rr.P)(e.registry,l,r.isOptional);let d="";if(l.isMap){const{hashers:t,key:n}=l.asMap;if(1===t.length)d=(0,Pi.I)(e.registry.lookup,n);else{const t=e.registry.lookup.getSiType(n).def;d=t.isTuple?t.asTuple.map((t=>(0,Pi.I)(e.registry.lookup,t))).join(", "):t.asHistoricMetaCompat.toString()}}return{className:"ui--DropdownLinked-Item",key:`${t}_${s}`,text:[(0,a.jsxs)("div",{className:"ui--DropdownLinked-Item-call",children:[s,"(",d,"): ",c]},`${t}_${s}:call`),(0,a.jsx)("div",{className:"ui--DropdownLinked-Item-text",children:(i[0]||o).toString()},`${t}_${s}:text`)],value:s}})):[]}function lr(e,{value:t}){return function(n){return e.query[t.creator.section]?e.query[t.creator.section][n]:t}}const cr=s.memo((function(e){const{api:t}=(0,F.h)(),{className:n="",isError:s,onChange:i,options:r,value:o}=e;return r.length?(0,a.jsx)(Xt.Z,{className:`${n} ui--DropdownLinked-Items`,isError:s,onChange:i,options:r,transform:lr(t,e),value:o.creator.method,withLabel:!1}):null})),dr=s.memo((function({className:e="",defaultValue:t,isError:n,onChange:s,options:i,value:{creator:{section:r}}}){return(0,a.jsx)(Xt.Z,{className:`${e} ui--DropdownLinked-Sections`,defaultValue:t,isError:n,onChange:s,options:i,value:r,withLabel:!1})})),ur=s.memo((function({className:e="",defaultValue:t,label:n,onChange:i,withLabel:r}){const{api:o}=(0,F.h)(),[l,c]=(0,s.useState)((()=>or(o,t.creator.section))),[d]=(0,s.useState)((()=>function(e){return Object.keys(e.query).filter((e=>!e.startsWith("$"))).sort().filter((t=>Object.keys(e.query[t]).length)).map((e=>({text:e,value:e})))}(o))),[u,m]=(0,s.useState)((()=>t)),h=(0,s.useCallback)((e=>{u!==e&&(m((()=>e)),i&&i(e))}),[i,u]),p=(0,s.useCallback)((e=>{if(e!==u.creator.section){const t=or(o,e);c(t),h(o.query[e][t[0].value])}}),[h,o,u]);return(0,a.jsxs)(Ei,{className:e,label:n,withLabel:r,children:[(0,a.jsx)(dr,{className:"small",onChange:p,options:d,value:u}),(0,a.jsx)(cr,{className:"large",onChange:h,options:l,value:u},u.creator.section)]})}));n(35220);var mr=n(6226),hr=n(88311);const pr=["application/wasm"],gr=s.memo((function({onChange:e,...t}){const n=(0,s.useCallback)(((t,n)=>{const a=(0,mr.F)(t);e((0,hr.N)(t),a,n)}),[e]);return(0,a.jsx)(Yi,{...t,accept:pr,onChange:n})}));var fr=n(55858);const br=(0,A.z)(pn.Z)` + .ui.selection.dropdown.ui--output.isDisabled { + background: transparent; + border-style: dashed; + opacity: 1; + } + + pre { + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + } +`,xr=s.memo((function({children:e,className:t="",isDisabled:n,isError:s,isFull:i,isHidden:r,isMonospace:o,isSmall:l,isTrimmed:c,label:d,labelExtra:u,value:m,withCopy:h=!1,withLabel:p}){return(0,a.jsxs)(br,{className:`${t} ui--Output`,isFull:i,isHidden:r,isSmall:l,label:d,labelExtra:u,withLabel:p,children:[(0,a.jsxs)("div",{className:`ui--output ui dropdown selection ${s?" error":""}${o?" monospace":""}${n?"isDisabled":""}`,children:[c&&(0,dn.H)(m)&&m.length>512?`${m.slice(0,256)}…${m.slice(-256)}`:m,e]}),h&&(0,a.jsx)(hn,{value:m})]})}));function Ar({inner:e=[],name:t="",outer:n=[]},a=[]){if(n.length){const e=new Array(n.length);for(let t=0;tn&&Ar(n)),[n]),[c,d]=(0,s.useMemo)((()=>{if(t){const e=`/extrinsics/decode/${t}`;return[o(e),`#${e}`]}return[null,null]}),[o,t]);return l?(0,a.jsx)(vr,{className:e,isDisabled:!0,label:i,children:(0,a.jsx)("table",{children:(0,a.jsxs)("tbody",{children:[l.map((({name:e,value:t},n)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("label",{children:e})}),(0,a.jsx)("td",{children:t})]},n))),c&&(0,a.jsxs)("tr",{className:"isLink",children:[(0,a.jsx)("td",{children:(0,a.jsx)("label",{children:r("link")})}),(0,a.jsx)("td",{children:(0,a.jsx)("a",{href:c,rel:"noreferrer",target:"_blank",children:d})})]},"hex")]})})}):null}));let yr=0;const jr=A.z.div` + cursor: help; + display: inline-block; + line-height: 1rem; + margin: 0 0 0 0.25rem; +`,Cr=s.memo((function({className:e="",help:t,icon:n="question-circle"}){const[i]=(0,s.useState)((()=>"label-help-"+ ++yr));return(0,a.jsxs)(jr,{className:`${e} ui--LabelHelp`,tabIndex:-1,children:[(0,a.jsx)(x.Z,{icon:n,tooltip:i}),(0,a.jsx)(v.Z,{text:t,trigger:i})]})})),kr=s.memo((function({children:e,isActive:t=!0}){const[n,i]=(0,s.useState)((()=>new Array(e.length).fill(!1)));return(0,s.useEffect)((()=>{if(t){const e=n.findIndex((e=>!e));-1!==e&&(0,oa.Y)((()=>i(n.map(((t,n)=>n===e||t)))))}}),[t,n]),(0,a.jsx)(a.Fragment,{children:t?n.map(((t,n)=>t&&e[n])):(0,a.jsx)(U,{})})})),Nr=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,F.h)(),r=(0,ge.W7)(i.derive.balances?.all,[s]);return(0,a.jsxs)("div",{className:t,children:[n||"",(0,h.u)(r?.accountNonce),e]})}));s.memo((function({className:e="",label:t,params:n}){return n?(0,a.jsx)(Nr,{className:`${e} ui--Nonce`,label:t,params:n.toString()}):null}));var Er=n(84450);const Sr=A.z.div` + vertical-align: middle; + white-space: nowrap; + + a.chainAlign { + display: inline-block; + height: 24px; + line-height: 24px; + max-width: 10em; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + } +`,Ir=s.memo((function({className:e,id:t}){const n=(0,Er.jC)(t),i=(0,s.useMemo)((()=>n.filter((({isDisabled:e,isUnreachable:t})=>!e&&!t))),[n]);if(!n.length)return null;const{text:r,ui:o,value:l}=i.length?i[i.length-1]:n[0];return(0,a.jsxs)(Sr,{className:e,children:[(0,a.jsx)(Ka,{isInline:!0,logo:o.logo||"empty",withoutHl:!0}),i.length?(0,a.jsx)("a",{className:"chainAlign",href:`${window.location.origin}${window.location.pathname}?rpc=${encodeURIComponent(l)}`,children:r}):r]})})),Br=s.memo((function({autoFocus:e,children:t,className:n="",defaultValue:s,isDisabled:i,isError:r,isFull:o,label:l,labelExtra:c,name:d,onChange:u,onEnter:m,onEscape:h,tabIndex:p,value:g,withLabel:f}){return(0,a.jsx)(_t.ZP,{autoFocus:e,className:`${n} ui--Password`,defaultValue:s,isDisabled:i,isError:r,isFull:o,label:l,labelExtra:c,name:d,onChange:u,onEnter:m,onEscape:h,tabIndex:p,type:"password",value:g,withLabel:f,children:t})}));var Dr=n(81679),Lr=n.n(Dr);Lr().config({allowPassphrases:!0,maxLength:128,minLength:8,minPhraseLength:20});const Vr=A.z.div` + align-items: center; + margin-top: 0.5rem; + margin-left: 2rem; + font-size: var(--font-size-base); + text-transform: uppercase; + color: var(--color-label); + + .ui--Strength-bar { + position: relative; + height: 0.6rem; + width: 100%; + margin: 0 10px; + border: 1px solid #DFDFDF; + border-radius: 0.15rem; + background: #ECECEC; + } + + .ui--Strength-bar-highlighted { + position: absolute; + top: -0.07rem; + height: 0.6rem; + width: 100%; + border-radius: 0.15rem; + background: linear-gradient(90.43deg, #FF8B00 0%, #FFBB50 112.75%); + } +`,Pr=s.memo((function({className:e="",value:t}){const{t:n}=(0,z.$)(),s={width:100*function(e){const t=Lr().test(e),n=Math.max(0,t.passedTests.length-t.failedTests.length);return t.isPassphrase?7:n}(t)/7+"%"};return(0,a.jsxs)(Vr,{className:e,style:{display:t?"flex":"none"},children:[n("weak"),(0,a.jsx)("div",{className:"ui--Strength-bar",children:(0,a.jsx)("div",{className:"ui--Strength-bar-highlighted",style:s})}),n("strong")]})})),Tr=A.z.div` + position: relative; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + margin-right: 0.5rem; + + && .ui--Labelled.ui--Dropdown { + padding: 0; + + label { + left: 1.55rem; + z-index: 115; + } + + .ui.selection.dropdown { + min-width: 7.857rem; + z-index: 110; + + border-width: 1px 0 1px 1px; + border-style: solid; + border-color: var(--border-input); + border-radius: 4px 0 0 4px; + + &.active { + position: absolute; + min-width: 10.714rem; + + z-index: 120; + + border-width: 1px; + border-radius: 4px; + top: 0; + left: 0; + } + + .visible.menu { + border-color: var(--border-input); + } + } + } + + button { + margin: 0.25rem 0; + position: relative; + width: 2.857rem; + height: 3.893rem; + + background-color: var(--bg-input); + border-width: 1px 1px 1px 0; + border-style: solid; + border-color: var(--border-input); + border-radius: 0 4px 4px 0; + + align-items: center; + display: flex; + flex-flow: column; + justify-content: center; + + &:hover { + cursor: pointer; + } + + .arrow { + &:first-child { + margin-bottom: -20%; + } + + &:last-child { + margin-top: -20%; + } + } + } + + &::after { + content: ''; + position: absolute; + left: 7.857rem; + top: 10%; + + width: 1px; + height: 80%; + + background-color: var(--border-input); + z-index: 99; + } + + button:hover, + .ui--Labelled.ui--Dropdown:hover { + &::after { + content: ''; + position: absolute; + top: 0; + height: 100%; + width: 1px; + z-index: 100; + } + } + + button:hover::after { + left: 0; + } + + .ui--Labelled.ui--Dropdown:hover::after { + left: 7.857rem; + } +`,Mr=s.memo((function({className:e="",defaultValue:t,label:n,onChange:s,onClick:i,options:r,sortDirection:o}){return(0,a.jsxs)(Tr,{className:`${e} ui--Sort`,children:[(0,a.jsx)(Xt.Z,{defaultValue:t,label:n,onChange:s,options:r}),(0,a.jsxs)("button",{onClick:i,children:[(0,a.jsx)(x.Z,{className:"arrow up"+("ascending"===o?" isActive":""),color:"gray",icon:"sort-up"}),(0,a.jsx)(x.Z,{className:"arrow down"+("descending"===o?" isActive":""),color:"gray",icon:"sort-down"})]})]})})),Fr=s.memo((function({className:e="",stakingInfo:t}){const n=t?.stakingLedger?.active?.unwrap();return n?.gtn(0)?(0,a.jsx)(ee.Z,{className:e,value:n}):null}));var zr=n(56245);function Zr(e){switch(e){case"error":return"ban";case"event":case"eventWarn":return"assistive-listening-systems";case"received":return"telegram-plane";default:return"check"}}function Rr({account:e,action:t,id:n,message:s,removeItem:i,status:r}){return(0,a.jsx)("div",{className:`item ${r}`,children:(0,a.jsx)("div",{className:"wrapper",children:(0,a.jsxs)("div",{className:"container",children:[(0,a.jsx)(x.Z,{icon:"times",onClick:i}),(0,a.jsx)("div",{className:"short",children:(0,a.jsx)(x.Z,{icon:Zr(r)})}),(0,a.jsxs)("div",{className:"desc",children:[(0,a.jsx)("div",{className:"header",children:Array.isArray(t)?t.map(((e,t)=>(0,a.jsx)("div",{children:e},t))):t}),e&&(0,a.jsx)(ot,{value:e}),(0,a.jsx)("div",{className:"status",children:s})]})]})})},n)}function $r({error:e,extrinsic:t,id:n,removeItem:s,rpc:i,status:r}){let{method:o,section:l}=i;if(t){const e=t.registry.findMetaCall(t.callIndex);"unknown"!==e.section&&(o=e.method,l=e.section)}const c=function(e){switch(e){case"cancelled":return"ban";case"completed":case"inblock":case"finalized":case"sent":return"check";case"dropped":case"invalid":case"usurped":return"arrow-down";case"error":case"finalitytimeout":return"exclamation-triangle";case"queued":return"random";default:return"spinner"}}(r);return(0,a.jsx)("div",{className:`item ${r}`,children:(0,a.jsx)("div",{className:"wrapper",children:(0,a.jsxs)("div",{className:"container",children:[zr.z.includes(r)&&(0,a.jsx)(x.Z,{icon:"times",onClick:s}),(0,a.jsx)("div",{className:"short",children:"spinner"===c?(0,a.jsx)(U,{variant:"push"}):(0,a.jsx)(x.Z,{icon:c})}),(0,a.jsxs)("div",{className:"desc",children:[(0,a.jsxs)("div",{className:"header",children:[l,".",o]}),(0,a.jsx)("div",{className:"status",children:e?e.message||e.toString():r})]})]})})},n)}const qr=A.z.div` + display: inline-block; + overflow: hidden; + position: fixed; + right: 0.75rem; + top: 0.75rem; + transition-property: width; + transition-duration: 0.75s; + width: 4.5rem; + z-index: 1001; + + &:hover { + transform: scale(1); + width: 23rem; + + .item .desc { + display: block; + } + } + + .item { + display: block; + + .desc { + display: none; + } + + > .wrapper > .container { + align-items: top; + background: #00688b; + border-radius: 0.25rem; + color: white; + display: flex; + justify-content: space-between; + margin-bottom: 0.25rem; + padding: 0 0.5rem; + vertical-align: middle; + position: relative; + + .desc { + flex: 1; + overflow: hidden; + padding: 0.75rem 1rem 0.5rem; + width: 19rem; + + .status { + font-weight: var(--font-weight-normal); + } + + .ui--AddressMini { + .ui--AddressMini-address { + min-width: 0; + text-align: left; + } + } + } + + .header { + opacity: 0.66; + } + + .short { + font-size: 2.5rem; + min-width: 3rem; + opacity: 0.75; + padding: 0.5rem 0 0.5rem 0.5rem; + + .ui--Icon { + color: white !important; + line-height: 1; + } + + .ui--Spinner { + display: inline-block; + height: 1em; + line-height: 1; + vertical-align: -0.125em; + + img { + height: 1em; + width: 1em; + } + } + } + + .padded { + padding: 0.25rem 0 0 0 !important; + } + + .ui--Icon.isClickable { + position: absolute; + top: 0.5rem; + right: 0.5rem; + cursor: pointer; + } + } + + &.cancelled > .wrapper > .container { + background: #cd9b1d + } + + &.event > .wrapper > .container { + background: teal; + } + + &.eventWarn > .wrapper > .container { + background: darkorange; + } + + &.completed, + &.finalized, + &.inblock, + &.sent, + &.success { + & > .wrapper > .container { + background: green; + } + } + + &.dropped, + &.error, + &.finalitytimeout, + &.invalid, + &.usurped { + & > .wrapper > .container { + background: red; + } + } + } +`,Ur=s.memo((function({className:e=""}){const{stqueue:t,txqueue:n}=(0,be.L)(),[i,r]=(0,s.useState)([]),[o,l]=(0,s.useState)([]);return(0,s.useEffect)((()=>{r(function(e){return(e||[]).filter((({isCompleted:e})=>!e))}(t))}),[t]),(0,s.useEffect)((()=>{l(function(e){return(e||[]).filter((({status:e})=>!["completed","incomplete"].includes(e)))}(n))}),[n]),i.length||o.length?(0,a.jsxs)(qr,{className:`${e} ui--Status`,children:[o.map($r),i.map(Rr)]}):null})),Hr=A.z.div` + align-items: stretch; + border-radius: 0.25rem; + display: flex; + flex-wrap: no-wrap; + justify-content: space-between; + margin: 1.5rem 0; + + > section { + display: flex; + flex: 0 1 auto; + text-align: left; + } + + details & { + display: block; + margin: 0.5rem 0.25rem; + opacity: 0.75; + outline: none; + overflow: hidden; + text-align: left; + text-overflow: ellipsis; + white-space: nowrap; + + + div { + margin-top: 0.75rem; + } + } + + &.isSmall { + margin-bottom: 0; + } + + .ui.label { + padding-left: 0; + padding-right: 0; + padding-top: 0; + } +`,Qr=s.memo((function({children:e,className:t="",isSmall:n}){return(0,a.jsx)(Hr,{className:`${t}${n?" isSmall":""}`,children:e})}));var Or=n(73557),Wr=n(59149);const Gr=A.z.div` + margin: 0 2.5rem 0 1.5rem; + font-weight: var(--font-weight-normal); + font-size: var(--font-size-base); + line-height: 1.57rem; + min-width: max-content; + height: 100%; + display: flex; + align-items: center; + color: var(--color-text); + + .ui--Icon { + margin-right: 0.85rem; + max-width: 1rem; + max-height: 1rem; + } + + @media only screen and (max-width: 900px) { + margin: 0 1.5rem; + } +`,Jr=s.memo((function({className:e="",icon:t,text:n}){return(0,a.jsxs)(Gr,{className:`${e} active-tab`,children:[(0,a.jsx)(x.Z,{icon:t}),(0,a.jsx)("span",{children:n})]})}));var Kr=n(39857);const Yr=(0,A.z)(Kr.OL)` + align-items: center; + display: flex; + color: #8B8B8B; + height: 100%; + padding: 0 1.5rem; + position: relative; + + &:hover { + color: #8B8B8B; + + .tabLinkText::after { + background-color: #8B8B8B; + } + } + + &.active, &:hover { + .tabLinkText::after { + content: ''; + position: absolute; + width: 3.14rem; + height: 2px; + bottom: -2px; + left: 50%; + transform: translateX(-50%); + } + } + + &.active { + color: var(--color-text) !important; + font-weight: var(--font-weight-normal); + + &:hover { + cursor: default; + } + } + + .tabLinkText { + position: relative; + height: 100%; + display: flex; + align-items: center; + } + + .tabCounter { + margin: -1rem 0 -1rem 0.75rem; + } + + .tabIcon { + margin-left: 0.75rem; + } +`,Xr=s.memo((function({basePath:e,className:t="",count:n,hasParams:s,index:i,isExact:r,isRoot:o,name:l,text:c}){const d=o?e:`${e}/${l}`,u=r||!s||0===i;return(0,a.jsxs)(Yr,{className:`${t} ui--Tab`,end:u,to:d,children:[(0,a.jsx)("div",{className:"tabLinkText",children:c}),!!n&&(0,a.jsx)(j,{className:"tabCounter",color:"counter",info:n})]})})),_r=A.z.div` + height: 100%; + width: auto; +`,eo=s.memo((function({className:e=""}){return(0,a.jsx)(_r,{className:e,children:(0,a.jsx)("svg",{fill:"none",height:"47",viewBox:"0 0 17 65",width:"17",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{className:"highlight--stroke",d:"M1 1L16 32.5L1 64",stroke:"#D1D1D1"})})})})),to=A.z.header` + background: var(--bg-tabs); + border-bottom: 1px solid var(--border-tabs); + text-align: left; + z-index: 1; + + & .tabs-container { + display: flex; + align-items: center; + width: 100%; + margin: 0 auto; + max-width: var(--width-full); + padding: 0 1.5rem 0 0; + height: 3.286rem; + } + + &::-webkit-scrollbar { + display: none; + width: 0px; + } + + .ui--TabsList { + display: flex; + height: 100%; + list-style: none; + margin: 0 1.4rem; + padding: 0; + white-space: nowrap; + + @media only screen and (max-width: 900px) { + margin: 0 2.72rem 0 2.35rem; + } + } +`,no=s.memo((function({basePath:e,className:t="",hidden:n,items:i}){const r=(0,Or.TH)(),{icon:o,text:l}=s.useContext(Wr.m),c=(0,s.useMemo)((()=>i.filter((e=>!(!e||n&&n.includes(e.name))))),[n,i]);return(0,s.useEffect)((()=>function(e,t,n,a){if(t.pathname!==e){const[,,s]=t.pathname.split("/"),i=n.find((e=>e&&e.alias===s));i?window.location.hash=i.isRoot?e:`${e}/${i.name}`:!a||!a.includes(s)&&n.some((e=>e&&!e.isRoot&&e.name===s))||(window.location.hash=e)}}(e,r,i,n)),[e,n,i,r]),(0,a.jsx)(to,{className:`${t} ui--Tabs`,children:(0,a.jsxs)("div",{className:"tabs-container",children:[l&&o&&(0,a.jsx)(Jr,{icon:o,text:l}),(0,a.jsx)(eo,{}),(0,a.jsx)("ul",{className:"ui--TabsList",children:c.map(((t,n)=>(0,a.jsx)("li",{className:t.isHidden?"--hidden":"",children:(0,s.createElement)(Xr,{...t,basePath:e,index:n,key:t.name})},n)))})]})})})),ao=(0,A.z)(pn.Z)` + .TextAreaWithDropdown { + display: flex; + textarea { + border-radius: 0.25rem 0 0 0.25rem; + border: 1px solid #DDE1EB; + border-right: none; + background: var(--bg-input); + box-sizing: border-box; + color: var(--color-text); + display: block; + outline: none; + padding: 1.75rem 3rem 0.75rem 1.5rem; + resize: none; + width: 100%; + + &:read-only { + background: var(--bg-inverse); + box-shadow: none; + outline: none; + + ~ .ui.buttons > .ui.selection.dropdown { + background: var(--bg-inverse); + } + } + + &.ui-textArea-withError { + background: var(--bg-input-error); + color: var(--color-error); + } + } + + & > .ui.buttons > .ui.button.floating.selection.dropdown { + border: 1px solid #DDE1EB; + border-left: none; + border-top-left-radius: 0; + border-bottom-left-radius: 0; + display: flex; + align-items: center; + justify-content: center; + & > .dropdown.icon { + top: 2rem; + } + } + } +`,so=s.memo((function({children:e,className:t,isError:n,isReadOnly:i,label:r,onChange:o,seed:l,withLabel:c}){const d=(0,s.useCallback)((({target:{value:e}})=>{o&&o(e)}),[o]);return(0,a.jsx)(ao,{className:t,label:r,withLabel:c,children:(0,a.jsxs)("div",{className:"TextAreaWithDropdown",children:[(0,a.jsx)("textarea",{autoCapitalize:"off",autoCorrect:"off",autoFocus:!1,className:n?"ui-textArea-withError":"",onChange:d,readOnly:i,rows:2,spellCheck:!1,value:l}),e]})})})),io=s.memo((function({index:e,isDisabled:t,isSelected:n,onChange:i,text:r,value:o}){const l=(0,s.useCallback)((()=>{!t&&i(e,o)}),[t,e,i,o]);return(0,a.jsx)(G,{icon:n?"check":"circle",isBasic:!0,isDisabled:t,isSelected:n,label:r,onClick:l},r)})),ro=A.z.div` + display: inline-block; + margin-right: 1.5rem; + + .ui--Button { + margin: 0; + + &:not(:first-child) { + border-bottom-left-radius: 0; + border-top-left-radius: 0; + } + + &:not(:last-child) { + border-bottom-right-radius: 0; + border-top-right-radius: 0; + } + + .ui--Icon { + width: 1em; + } + } +`,oo=s.memo((function({className:e="",onChange:t,options:n,value:i}){const r=(0,s.useMemo)((()=>n.filter((e=>!!e))),[n]);return r.length&&r[0].value?(0,a.jsx)(ro,{className:`${e} ui--ToggleGroup`,children:r.map((({isDisabled:e,text:n,value:s},r)=>(0,a.jsx)(io,{index:r,isDisabled:e,isSelected:i===r,onChange:t,text:n,value:s},r)))}):null})),lo=s.memo((function({className:e="",filter:t,onChange:n}){const{t:s}=(0,z.$)();return(0,a.jsx)(Vn,{className:e,filter:t,label:s("vote with account"),onChange:n,type:"account",withLabel:!0})})),co=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,F.h)(),r=(0,ge.W7)(i.derive.balances?.all,[s]);return(0,a.jsx)(ee.Z,{className:t,label:n,value:r?.votingBalance,children:e})})),uo=["pyconvot","democrac","phrelect"],mo=s.memo((function({accountId:e,autoFocus:t,label:n,noDefault:i,onChange:r}){const{t:o}=(0,z.$)(),{api:l}=(0,F.h)(),c=(0,ge.W7)(l.derive.balances?.all,[e]),[{defaultValue:d,maxValue:u,selectedId:m,value:h},p]=(0,s.useState)({defaultValue:ae.nw,maxValue:ae.nw,value:ae.nw});(0,s.useEffect)((()=>{c&&c.accountId.eq(e)&&p((t=>t.selectedId!==e?function(e,t,n,a){const s=n.lockedBreakdown.sort(((e,t)=>t.amount.cmp(e.amount))).sort(((e,t)=>{if(!e.id.eq(t.id))for(let n=0,a=uo.length;ne)),i=n.votingBalance;let r=s[0]||n.lockedBalance;if(t)r=ae.nw;else if(r.isZero()){let e=i.sub(a);for(let t=0;t<3;t++)e.gt(a)&&(r=e,e=e.sub(a))}return{defaultValue:r,maxValue:i,selectedId:e,value:r}}(e,i,c,l.consts.balances.existentialDeposit):t))}),[c,e,l,i]),(0,s.useEffect)((()=>{r(h)}),[r,h]);const g=(0,s.useCallback)((t=>p((n=>n.selectedId===e&&t&&!t.eq(n.value)?{...n,value:t}:n))),[e]),f=e!==m;return(0,a.jsx)(la.Z,{autoFocus:t,defaultValue:f?void 0:d,isDisabled:f,isZeroable:!0,label:n||o("vote value"),labelExtra:(0,a.jsx)(co,{label:(0,a.jsx)("label",{children:o("voting balance")}),params:e}),maxValue:u,onChange:g})}));var ho=n(63684)},21779:(e,t,n)=>{n.d(t,{z:()=>a.zo});var a=n(31383)},56787:(e,t,n)=>{n.d(t,{Z:()=>g});var a=n(31383);const s=["2000","1900","1800","1700","1600","1500","1400","1300","1200","1100","1000","900","800","700","600","500","400"].map((e=>`\n .media--${e} {\n @media only screen and (max-width: ${e}px) {\n display: none !important;\n }\n }\n\n .media--${e}-noPad {\n @media only screen and (max-width: ${e}px) {\n min-width: 0 !important;\n padding: 0 !important;\n }\n }\n`)).join("");var i=n(69316);const r=160,o=[.2126,.7152,.0722],l=[0,2,4],c="#f19135";function d(e){return e||c}function u(e){const t=d(e).replace("#","").toLowerCase();return l.reduce(((e,n,a)=>e+parseInt(t.substring(n,n+2),16)*o[a]),0)}function m(e){return u(e)>r?"rgba(45, 43, 41, 0.875)":"rgba(255, 253, 251, 0.875)"}function h(e){const t=u(e);return t<16?"rgba(255, 255, 255, 0.15)":t`\n .highlight--all {\n background: ${d(e)} !important;\n border-color: ${d(e)} !important;\n color: ${d(e)} !important;\n }\n\n .highlight--before:before {\n background: ${d(e)} !important;\n }\n\n .highlight--before-border:before {\n border-color: ${d(e)} !important;\n }\n\n .highlight--bg {\n background: ${d(e)} !important;\n }\n\n .highlight--bg-contrast {\n background: ${m(e)};\n }\n\n .ui--MenuItem.isActive .ui--Badge {\n background: ${d(e)};\n color: ${m(e)} !important;\n }\n\n .ui--MenuItem {\n & .ui--Badge {\n color: ${u(e)r?"#fff":"#424242"};\n }\n }\n\n .ui--Tab .ui--Badge {\n background: ${d(e)};\n color: ${u(e)r?"#424242":d(e)};\n }\n\n .ui--Tag.themeColor.darkTheme,\n .ui--InputTags.darkTheme .ui.label {\n color: ${u(e)>r?d(e):"#fff"};\n }\n\n #root {\n background: var(--bg-page);\n color: var(--color-text);\n font: var(--font-sans);\n font-weight: var(--font-weight-normal);\n height: 100%;\n }\n\n a {\n cursor: pointer;\n }\n\n article {\n background: var(--bg-table);\n border: 1px solid #f2f2f2;\n border-radius: 0.25rem;\n box-sizing: border-box;\n margin: 0.25rem;\n padding: 1.25rem;\n position: relative;\n text-align: left;\n\n > ul {\n margin: 0;\n padding: 0;\n }\n\n &.error,\n &.warning {\n border-left-width: 0.25rem;\n font-size: var(--font-size-small);\n line-height: 1.5;\n margin-left: 2.25rem;\n padding: 0.75rem 1rem;\n position: relative;\n z-index: 5;\n\n &:before {\n border-radius: 0.25rem;\n bottom: 0;\n content: ' ';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n }\n }\n\n &.mark {\n margin: 0.5rem 0 0.5rem 2.25rem;\n padding: 0.5rem 1rem !important;\n }\n\n &.nomargin {\n margin-left: 0;\n }\n\n &.extraMargin {\n margin: 2rem auto;\n }\n\n &.centered {\n margin: 1.5rem auto;\n max-width: 75rem;\n\n &+.ui--Button-Group {\n margin-top: 2rem;\n }\n }\n\n &.error {\n &:before {\n background: rgba(255, 12, 12, 0.05);\n }\n\n border-color: rgba(255, 12, 12, 1);\n }\n\n &.padded {\n padding: 0.75rem 1rem;\n\n > div {\n margin: 0.25rem;\n }\n }\n\n &.warning {\n &:before {\n background: rgba(255, 196, 12, 0.05);\n }\n\n border-color: rgba(255, 196, 12, 1);\n }\n }\n\n body {\n height: 100%;\n margin: 0;\n font: var(--font-sans);\n }\n\n br {\n line-height: 1.5rem;\n }\n\n details {\n cursor: pointer;\n\n &[open] > summary {\n white-space: normal;\n\n br, br + * {\n display: block;\n }\n }\n\n > summary {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n outline: none;\n\n br, br + * {\n display: none;\n }\n }\n }\n\n h1, h2, h3, h4, h5 {\n color: var(--color-header);\n font: var(--font-sans);\n font-weight: var(--font-weight-header);\n margin-bottom: 0.25rem;\n }\n\n\n h1 {\n font-size: var(--font-size-h1);\n text-transform: lowercase;\n\n em {\n font-style: normal;\n text-transform: none;\n }\n }\n\n h2 {\n font-size: var(--font-size-h2);\n }\n\n h3 {\n font-size: var(--font-size-h3);\n }\n\n h4 {\n font-size: var(--font-size-h4);\n }\n\n header {\n margin-bottom: 1.5rem;\n text-align: center;\n\n > article {\n background: transparent;\n }\n }\n\n html {\n height: 100%;\n }\n\n label {\n box-sizing: border-box;\n display: block;\n font: var(--font-sans);\n }\n\n // we treat h5 and label as equivalents\n label, h5 {\n color: var(--color-label);\n font-size: var(--font-size-label);\n font-style: normal;\n font-weight: var(--font-weight-label);\n line-height: 1rem;\n margin-bottom: 0.25rem !important;\n text-transform: var(--text-transform-label);\n vertical-align: middle;\n }\n\n button {\n font-size: var(--font-size-small);\n font-weight: var(--font-weight-normal);\n }\n\n main {\n > section {\n margin-bottom: 2em;\n }\n }\n\n /* Add our overrides */\n \n .ui.hidden.divider {\n margin: 0.5rem 0;\n }\n\n .ui.dropdown {\n display: block;\n min-width: 0;\n width: 100%;\n }\n\n .ui.dropdown,\n .ui.input {\n margin: 0.25rem 0;\n }\n\n .ui.selection.dropdown,\n .ui.input > input,\n .ui.selection.dropdown > input {\n background: var(--bg-input);\n border-color: var(--border-input);\n color: var(--color-text);\n font: var(--font-sans);\n font-size: var(--font-size-base);\n\n &:focus {\n background: var(--bg-input);\n color: var(--color-text);\n }\n }\n\n .ui.action.input > .buttons {\n position: relative;\n }\n\n .ui.dropdown {\n &.disabled {\n background: transparent;\n border-style: dashed;\n opacity: 1;\n\n .dropdown.icon {\n opacity: 0;\n }\n }\n\n &.selection.visible {\n background: var(--bg-input);\n color: var(--color-text);\n }\n\n .menu {\n background: var(--bg-input);\n color: var(--color-text);\n\n > .item {\n border-color: transparent !important;\n color: var(--color-text) !important;\n\n &.header.disabled {\n margin: 1em 0 0 0;\n opacity: 1;\n\n &:hover,\n &.selected {\n background: var(--bg-input);\n }\n }\n }\n }\n\n > .text {\n min-height: 1em;\n\n &:not(.default) {\n color: var(--color-text) !important;\n }\n }\n }\n\n .ui.input {\n width: 100%;\n\n &.disabled:not(.retain-appearance) {\n opacity: 1;\n\n input {\n background: transparent;\n border-style: dashed;\n }\n\n .ui.buttons {\n .ui.button {\n background: transparent;\n }\n\n &.primary .ui.button {\n background-color: #666;\n border-color: transparent;\n color: #f9f8f7;\n opacity: 0.5;\n\n .dropdown.icon {\n opacity: 0;\n }\n }\n }\n }\n\n &.error input {\n background-color: var(--bg-input-error);\n border-color: #e0b4b4;\n }\n\n > input {\n width: 0;\n }\n }\n\n .ui.label {\n background: transparent;\n font-weight: var(--font-weight-normal);\n position: relative;\n z-index: 1;\n }\n\n .ui.page.modals.transition.visible {\n display: flex !important;\n }\n\n .ui.secondary.vertical.menu > .item {\n margin: 0;\n }\n\n .ui[class*="left icon"].input.left.icon > input {\n padding-left: 4rem !important;\n }\n\n .ui[class*="left icon"].input.left.icon > .ui--Icon.big {\n left: -7px;\n opacity: 1;\n }\n\n /* modals aligned to top, not center */\n .ui.dimmer {\n background-color: rgba(96, 96, 96, 0.5);\n justify-content: flex-start;\n }\n\n /* remove the default white background, settings app has it as part of Tab */\n .ui.segment {\n background: transparent;\n }\n\n ${i.ZP}\n \n .ui--grid,\n .ui--row {\n width: 100%;\n }\n\n .ui--grid,\n .ui--row {\n align-items: stretch;\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n justify-content: flex-start;\n text-align: left;\n min-width: 0;\n }\n\n .ui--grid > div,\n .ui--row > div {\n box-sizing: border-box;\n min-width: 0;\n }\n\n .ui--grid > div:not(.grow):not(.shrink),\n .ui--row > div:not(.grow):not(.shrink) {\n width: 100%;\n }\n\n .ui--grid > div:not(.shrink),\n .ui--grid > div.full,\n .ui--row > div.full {\n flex: 0 100%;\n }\n\n .ui--grid > div.shrink,\n .ui--row > div.shrink {\n flex: 0 1 auto;\n }\n\n .ui--grid > div.grow,\n .ui--row > div.grow {\n flex: 1 1 auto;\n }\n\n .ui--grid > div.large,\n .ui--row > div.large {\n flex: 0 75%;\n }\n\n .ui--grid > div.medium,\n .ui--row > div.medium {\n flex: 0 50%;\n }\n\n .ui--grid > div.small,\n .ui--row > div.small {\n flex: 0 25%;\n }\n\n .ui--grid > div.sixty6,\n .ui--row > div.sixty6 {\n flex: 0 66.66%;\n }\n\n .ui--grid > div.thirty3,\n .ui--row > div.thirty3 {\n flex: 0 33.33%;\n }\n\n ${s}\n \n .ui--output {\n background: var(--bg-input);\n border-radius: 4px;\n border: 1px dashed #eee;\n box-sizing: border-box;\n line-height: 1rem;\n max-height: 25rem;\n overflow-y: auto;\n padding: 0.75rem 1rem;\n position: relative;\n word-break: break-all;\n\n &.error {\n background: var(--bg-input-error);\n border-color: #e0b4b4;\n }\n\n &.monospace {\n font-family: monospace;\n }\n }\n\n header .ui--Button-Group {\n text-align: center;\n }\n\n .ui.input .ui--Button-Group {\n margin: 0;\n }\n\n button.u.ui--Icon.icon-button {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0.3em;\n padding-left: 0.3em;\n color: #2e86ab !important;\n background: none !important;\n }\n\n button.ui--Button {\n font: var(--font-sans);\n }\n\n .editable {\n cursor: pointer;\n }\n\n .ui--DropdownLinked.ui--row {\n .small .ui.selection.dropdown {\n border-right: none;\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n min-width: 5rem;\n }\n\n .large .ui.selection.dropdown {\n border-left: none;\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n }\n }\n\n .ui--Identicon-React-Base {\n border: 1px solid var(--border-identicon);\n border-radius: 50%;\n display: inline-block;\n overflow: hidden;\n\n svg circle:first-child {\n fill: var(--bg-identicon-circle);\n }\n }\n\n .ui--Input {\n &.disabled {\n overflow: hidden;\n\n input {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n\n &.inPlaceEditor {\n margin: 0 !important;\n\n input {\n padding: 0 !important;\n background: rgba(230, 230, 230, 0.8) !important;\n border: 0 !important;\n border-radius: 0 !important;\n box-shadow: 0 3px 3px rgba(0,0,0,.2);\n }\n }\n\n &.isWarning.ui.input {\n > input,\n input:focus {\n background: #ffffe0;\n border-color: #eeeeae;\n }\n }\n\n .ui--SiDropdown {\n width: 6rem;\n text-align: center;\n }\n }\n\n .ui--Static {\n min-width: 2rem; /* adjust width from normal dropdown sizing */\n overflow: hidden;\n word-break: break-all;\n }\n\n .ui--Tooltip {\n text-align: center;\n z-index: 1002;\n max-width: 300px;\n\n\n &.accounts-badge {\n background-color: var(--bg-menu) !important;\n color: var(--color-text) !important;\n box-shadow: 0 2px 4px 0 rgb(34 36 38 / 12%), 0 2px 10px 0 rgb(34 36 38 / 15%);\n z-index: 999;\n\n &.place-top::after {\n border-top-color: var(--bg-menu) !important;\n }\n\n &.place-right::after {\n border-right-color: var(--bg-menu) !important;\n }\n\n a {\n color: #3BBEFF;\n\n &.purpleColor {\n color: #E6007A;\n }\n }\n }\n\n`))},69316:(e,t,n)=>{n.d(t,{Iv:()=>a,ZP:()=>s});const a="#2e86ab",s=`\n .theme--dark,\n .theme--light {\n a:not(.ui--Tab) {\n color: ${a};\n\n &:hover,\n a:visited {\n color: ${a};\n }\n }\n\n .ui--Button {\n &.isIcon:not(.isDisabled):not(.withoutLink):not(:hover) {\n .ui--Icon {\n color: ${a};\n }\n }\n }\n\n .ui.modal > .header:not(.ui) {\n border-bottom-color: #767778;\n }\n\n .ui.negative.button,\n .ui.buttons .negative.button {\n background: #666 !important;\n }\n }\n`},43151:(e,t,n)=>{n.d(t,{$:()=>s,Z:()=>i});var a=n(61349);function s(){return(0,a.$G)("react-components")}function i(e){return(0,a.Zh)(["react-components"])(e)}},11798:(e,t,n)=>{n.d(t,{r7:()=>i,C9:()=>r,Ly:()=>o,s2:()=>l,oX:()=>u,Hc:()=>g});var a=n(69187),s=n(33661);function i(e,t,n,i="",r=!1){let o=!1;const l=i.toLowerCase();if(l||r){if(n){const{accountId:t,accountIndex:a,identity:c,nickname:d}=n,u=!!t&&t.toString().includes(i)||!!a&&a.toString().includes(i);!r&&u?o=!0:(0,s.m)(e.query.identity?.identityOf)?o=!!c&&(!!c.display||!!c.displayParent)&&(u||!!c.display&&c.display.toLowerCase().includes(l)||!!c.displayParent&&c.displayParent.toLowerCase().includes(l)):d&&(o=d.toLowerCase().includes(l))}if(!o){const e=a.Nn.getAddress(t);o=!!e?.meta?.name&&e.meta.name.toLowerCase().includes(l)}}else o=!0;return o}function r(e){try{const t=e?a.Nn.getPair(e.toString()):null;if(t)return t.meta.isInjected?"injected":t.meta.isHardware?t.meta.hardwareType||"hardware":t.meta.isExternal?t.meta.isMultisig?"multisig":t.meta.isProxied?"proxied":"qr":t.type}catch{}return"unknown"}function o(e,t=null){let n;try{const s=a.Nn.getAddress(e,t);n=s?.meta}catch{}return n||{}}function l(e,t=null,n){const a=o(e,t);return a.name?[!1,!1,a.name.toUpperCase()]:n?[!1,!0,n.toUpperCase()]:[!0,!1,e]}var c=n(8257),d=n(95267);function u(e){if(!e)return null;let t;const n=o(e,"contract");try{const e=n.contract&&JSON.parse(n.contract.abi);t=new c.P(e,d.statics.api.registry.getChainProperties())}catch(e){console.error(e)}return t||null}var m=n(74076),h=n(48533),p=n(73493);function g(e,t=!1,n){if(e)try{const s=(0,m.vq)(e)?(0,h.G)(e):a.Nn.decodeAddress(e);if(!t&&32!==s.length&&20!==s.length)throw new Error("AccountIndex values not allowed");if(n&&s.length!==n)throw new Error("Invalid key length");return 20===s.length?(0,p.K)(s):a.Nn.encodeAddress(s)}catch{}}},11677:(e,t,n)=>{function a(e,t){return(...n)=>{try{return t(...n)}catch(t){throw new Error(`${e}:: ${t.message}:: ${t.stack||""}`)}}}n.d(t,{e:()=>a})},87206:(e,t,n)=>{n.d(t,{E:()=>a});const a=n(2784).createContext({})},68944:(e,t,n)=>{n.d(t,{y:()=>d,u:()=>u});var a=n(52322),s=n(2784),i=n(90778),r=n(74065);const o=60,l=5e3,c=[],d=s.createContext(c);function u({children:e}){const{api:t}=(0,i.h)(),n=(0,s.useCallback)((e=>function(e,t){return 0===t.length?[e]:t.length===o?t.concat(e).slice(-o):t.concat(e)}(function(...e){const t={active:{requests:0,subscriptions:0},total:{bytesRecv:0,bytesSent:0,cached:0,errors:0,requests:0,subscriptions:0,timeout:0}};for(let n=0,a=e.length;n(function t(){if(o.current=null,l.current){try{i(e)}catch(e){console.error(e)}o.current=setTimeout(t,n)}}(),()=>{o.current&&clearTimeout(o.current)})),[]),a}(n,c,l);return(0,a.jsx)(d.Provider,{value:u,children:e})}},57120:(e,t,n)=>{n.d(t,{U:()=>m,g:()=>h});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(14681);const l=75,c={},d={},u={byAuthor:c,eraPoints:d,lastBlockAuthors:[],lastHeaders:[]},m=s.createContext(u);function h({children:e}){const{api:t,isApiReady:n}=(0,i.h)(),h=(0,r.W7)(n&&t.derive.staking?.currentPoints),[p,g]=(0,s.useState)(u);return(0,s.useEffect)((()=>{t.isReady.then((()=>{let e=[],n=[],a="";t.derive.chain.subscribeNewHeads((t=>{if(t?.number){const s=t.number.unwrap();let i="";t.author&&(i=t.author.toString());const r=(0,o.u)(s);i&&(c[i]=r,r!==a?(a=r,n=[i]):n.push(i)),e=e.filter(((e,t)=>t(e.push(t),e)),[t]).sort(((e,t)=>t.number.unwrap().cmp(e.number.unwrap()))),g({byAuthor:c,eraPoints:d,lastBlockAuthors:n.slice(),lastBlockNumber:a,lastHeader:t,lastHeaders:e})}})).catch(console.error)})).catch(console.error)}),[]),(0,s.useEffect)((()=>{if(h){const e=[...h.individual.entries()].map((([e,t])=>[e.toString(),(0,o.u)(t)])),t=Object.keys(d);t.length!==e.length&&t.forEach((e=>{delete d[e]})),e.forEach((([e,t])=>{d[e]=t}))}}),[h]),(0,a.jsx)(m.Provider,{value:p,children:e})}},44028:(e,t,n)=>{n.d(t,{m:()=>m,w:()=>h});var a=n(52322),s=n(2784),i=n(64021),r=n(11147),o=n(69516),l=n(90778),c=n(9118);const d={eventCount:0,events:[]},u=75,m=s.createContext(d);function h({children:e}){const{api:t,isApiReady:n}=(0,l.h)(),[h,p]=(0,s.useState)(d),g=(0,c.W7)(n&&t.query.system.events),f=(0,s.useRef)({block:null,event:null});return(0,s.useEffect)((()=>{g&&async function(e,t,n,a){const s=n.map(((e,t)=>({indexes:[t],record:e}))).filter((({record:{event:{method:e,section:t}}})=>!("system"===t||["balances","treasury"].includes(t)&&["Deposit","UpdatedInactive","Withdraw"].includes(e)||["transactionPayment"].includes(t)&&["TransactionFeePaid"].includes(e)||["paraInclusion","parasInclusion","inclusion"].includes(t)&&["CandidateBacked","CandidateIncluded"].includes(e)||["relayChainInfo"].includes(t)&&["CurrentBlockNumbers"].includes(e)))).reduce(((e,t)=>{const n=e.find((({record:{event:{method:e,section:n}}})=>t.record.event.section===n&&t.record.event.method===e));return n?n.indexes.push(...t.indexes):e.push(t),e}),[]).reverse(),l=(0,o.R)((0,i.d)((0,r.P)(s)));if(l!==t.event&&s.length){t.event=l;const i=await e.rpc.chain.getHeader(n.createdAtHash),r=i.number.unwrap(),o=i.hash.toHex();o!==t.block&&(t.block=o,a((({events:e})=>({eventCount:n.length,events:[...s.map((({indexes:e,record:t})=>({blockHash:o,blockNumber:r,indexes:e,key:`${r.toNumber()}-${o}-${e.join(".")}`,record:t}))),...e.filter((e=>!e.blockNumber?.eq(r)))].slice(0,u)}))))}else a((({events:e})=>({eventCount:n.length,events:e})))}(t,f.current,g,p).catch(console.error)}),[t,f,g,p]),(0,a.jsx)(m.Provider,{value:h,children:e})}},3773:(e,t,n)=>{n.d(t,{H:()=>h,y:()=>x});var a=n(52322),s=n(2784),i=n(43806),r=n(77984),o=n(69187),l=n(55858),c=n(94175),d=n(90778);const u=()=>!1,m={accounts:{allAccounts:[],allAccountsHex:[],areAccountsLoaded:!1,hasAccounts:!1,isAccount:u},addresses:{allAddresses:[],allAddressesHex:[],areAddressesLoaded:!1,hasAddresses:!1,isAddress:u}},h=s.createContext(m);function p(e,t,n=[]){const a=e?20:32;return t.reduce(((e,t)=>{if(!e.includes(t)&&!n.includes(t))try{(0,c.m)(t).length>=a?e.push(t):console.warn(`Not adding address ${t}, not in correct format for chain (requires publickey from address)`)}catch{console.error(t,a)}return e}),[])}function g(e){return e.map((e=>{try{return(0,l.c)((0,c.m)(e))}catch(t){return console.error(`Unable to convert address ${e} to hex`,t.message),null}})).filter((e=>!!e))}function f(e){return t=>!!t&&e.includes(t.toString())}function b(e,t={},n){const a=p(e,Object.keys(t),n);return{allAddresses:a,allAddressesHex:g(a),areAddressesLoaded:!0,hasAddresses:0!==a.length,isAddress:f(a)}}function x({children:e}){const{isApiReady:t,isEthereum:n}=(0,d.h)(),[l,c]=(0,s.useState)(m);return(0,s.useEffect)((()=>{let e=null;return t&&(e=(0,i.a)([o.Nn.accounts.subject.pipe((0,r.U)((e=>function(e,t={}){const n=p(e,Object.keys(t));return{allAccounts:n,allAccountsHex:g(n),areAccountsLoaded:!0,hasAccounts:0!==n.length,isAccount:f(n)}}(n,e)))),o.Nn.addresses.subject]).pipe((0,r.U)((([e,t])=>({accounts:e,addresses:b(n,t,e.allAccounts)})))).subscribe((e=>c(e)))),()=>{e&&e.unsubscribe()}}),[t,n]),(0,a.jsx)(h.Provider,{value:l,children:e})}},87561:(e,t,n)=>{n.d(t,{l:()=>A,q:()=>y});var a=n(52322),s=n(2784);const i="incomplete execution";function r(e){return e?e.isErr?`error: ${u(e.asErr)}`:null:i}function o({data:[e]}){return r(e)}const l={Executed:function({data:[,e]}){return r(e)}},c={Attempted:function({data:[e]}){if(!e)return i;if(e.isIncomplete){const[,t]=e.asIncomplete;return`error: ${t.type}`}return null}},d={allianceMotion:l,council:l,membership:l,multisig:{MultisigExecuted:function({data:[,,,,e]}){return r(e)}},polkadotXcm:c,proxy:{ProxyExecuted:o},sudo:{Sudid:o,SudoAsDone:o},technicalCommittee:l,utility:{BatchInterrupted:function({data:[e,t]}){return`error: ${e.toString()}: ${u(t)}`},DispatchedAs:o},xcmPallet:c};function u(e){let t=e.type;if(e.isModule)try{const n=e.asModule,a=e.registry.findMetaError(n);t=`${a.section}.${a.name}`}catch{}else e.isToken&&(t=`${e.type}.${e.asToken.type}`);return t}var m=n(56245),h=n(11798),p=n(13529);let g=0;const f="extrinsic event",b=7500,x=p.Z.author.submitAndWatchExtrinsic,A=s.createContext({stqueue:[],txqueue:[]});const v=[],w=[];function y({children:e}){const[t,n]=(0,s.useState)(v),[i,r]=(0,s.useState)(w),o=(0,s.useRef)(t),l=(0,s.useRef)(i),c=(0,s.useCallback)((e=>{o.current=e,n(e)}),[]),p=(0,s.useCallback)((e=>{l.current=e,r(e)}),[]),y=(0,s.useCallback)((e=>{const t=++g;p([...l.current,{...e,id:t,removeItem:()=>p([...l.current.map((e=>e.id===t?{...e,status:"completed"}:e))]),rpc:e.rpc||x,status:"queued"}])}),[p]),j=(0,s.useCallback)((e=>{const t=Array.isArray(e)?e:[e];t.length&&c([...o.current,...t.map((e=>{const t=++g,n=()=>c([...o.current.filter((e=>e.id!==t))]);return setTimeout(n,b),{...e,id:t,isCompleted:!1,removeItem:n}}))])}),[c]),C=(0,s.useCallback)((e=>y({...e})),[y]),k=(0,s.useCallback)(((e,t,n)=>{y({accountId:t.address,extrinsic:e.createType("Extrinsic",{method:e.createType("Call",t.method)},{version:t.version}),payload:t,signerCb:n})}),[y]),N=(0,s.useCallback)((e=>y({...e})),[y]),E=(0,s.useCallback)(((e,t,n,a)=>{p([...l.current.map((s=>s.id===e?{...s,error:void 0===a?s.error:a,result:void 0===n?s.result:n,status:"completed"===s.status?s.status:t}:s))]),j(function(e){return function(e){let t=null;const n=e.reduce(((e,t)=>{const n=e.find((({status:e})=>e.action===t.action&&e.status===t.status));return n?n.count++:e.push({count:1,status:t}),e}),[]).map((({count:e,status:t})=>1===e?t:{...t,action:`${t.action} (x${e})`})).filter((e=>e.message!==f||(t?e.action.startsWith("system.ExtrinsicSuccess")?t.action.unshift(e.action):t.action.push(e.action):t={...e,action:[e.action]},!1)));return t?n.concat(t):n}((e?.events||[]).filter((e=>!!e.event&&"democracy"!==e.event.section)).map((e=>{const{event:{data:t,method:n,section:a}}=e;if("system"===a&&"ExtrinsicFailed"===n){const[e]=t;return{action:`${a}.${n}`,message:u(e),status:"error"}}const s=function({event:e}){const{method:t,section:n}=e;return!!d[n]&&!!d[n][t]&&d[n][t](e)}(e);if(s)return{action:`${a}.${n}`,message:s,status:"eventWarn"};if("contracts"===a)if("ContractExecution"===n&&2===t.length){const[e,n]=t;try{const t=(0,h.oX)(e.toString());if(t)return{action:t.decodeEvent(n).event.identifier,message:"contract event",status:"event"}}catch(e){console.error(e)}}else if("Evicted"===n)return{action:`${a}.${n}`,message:"contract evicted",status:"error"};return{action:`${a}.${n}`,message:f,status:"event"}})))}(n)),m.z.includes(t)&&setTimeout((()=>{const t=l.current.find((t=>t.id===e));t&&t.removeItem()}),b)}),[j,p]),S=(0,s.useMemo)((()=>({queueAction:j,queueExtrinsic:C,queuePayload:k,queueRpc:N,queueSetTxStatus:E,stqueue:t,txqueue:i})),[j,C,k,N,E,t,i]);return(0,a.jsx)(A.Provider,{value:S,children:e})}},59149:(e,t,n)=>{n.d(t,{m:()=>a});const a=n(2784).createContext({})},91012:(e,t,n)=>{n.d(t,{A:()=>o,d:()=>r});var a=n(52322),s=n(2784);function i(){return{height:window.innerHeight,width:window.innerWidth}}const r=s.createContext(i());function o({children:e}){const[t,n]=(0,s.useState)((()=>i()));return(0,s.useEffect)((()=>{function e(){n(i())}return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),(0,a.jsx)(r.Provider,{value:t,children:e})}},52953:(e,t,n)=>{n.d(t,{n:()=>a});const a="Discord"},58800:(e,t,n)=>{n.d(t,{F:()=>s});var a=n(2784);const s=(0,n(11677).e)("useAccountId",(function(e=null,t){const[n,s]=(0,a.useState)(e),i=(0,a.useCallback)(((e=null)=>{s(e),t&&t(e)}),[t]);return[n,i]}))},37198:(e,t,n)=>{n.d(t,{B:()=>f});var a=n(2784),s=n(69187),i=n(33661),r=n(74076),o=n(11677),l=n(90778),c=n(9118),d=n(29455);const u=(0,o.e)("useDeriveAccountFlags",(function(e){const t=(0,d.J)();return(0,c.W7)(t?.derive.accounts.flags,[e])}));var m=n(60773),h=n(37146),p=n(38894);const g={isCouncil:!1,isDevelopment:!1,isEditable:!1,isEthereum:!1,isExternal:!1,isFavorite:!1,isHardware:!1,isInContacts:!1,isInjected:!1,isMultisig:!1,isNominator:!1,isOwned:!1,isProxied:!1,isSociety:!1,isSudo:!1,isTechCommittee:!1,isValidator:!1},f=(0,o.e)("useAccountInfo",(function(e,t=!1){const{api:n}=(0,l.h)(),{accounts:{isAccount:o},addresses:{isAddress:d}}=(0,h.i)(),f=(0,m.Y)(e),b=u(e),x=(0,c.W7)(n.query.staking?.nominators,[e]),A=(0,c.W7)(n.query.staking?.validators,[e]),[v,w]=(0,a.useState)(void 0),[y,j]=(0,a.useState)([]),[C,k]=(0,a.useState)(""),[N,E]=(0,a.useState)(null),[S,I]=(0,a.useState)(),[B,D]=(0,a.useState)(g),[L,V]=(0,a.useState)(),[P,T,M]=(0,p.O)(),[F,z,Z]=(0,p.O)();(0,a.useEffect)((()=>{A&&D((e=>({...e,isValidator:!A.isEmpty})))}),[A]),(0,a.useEffect)((()=>{x&&D((e=>({...e,isNominator:!x.isEmpty})))}),[x]),(0,a.useEffect)((()=>{b&&D((e=>({...e,...b})))}),[b]),(0,a.useEffect)((()=>{const{accountIndex:e,identity:t,nickname:a}=f||{},s=e?.toString();let r;if(w((e=>e!==s?s:e)),(0,i.m)(n.query.identity?.identityOf)?t?.display&&(r=t.display):a&&(r=a),k(r||""),t){const e=t.judgements.filter((([,e])=>!e.isFeePaid)),n=e.some((([,e])=>e.isKnownGood));I({...t,isExistent:!!t.display,isKnownGood:n,judgements:e,waitCount:t.judgements.length-e.length})}else I(void 0)}),[f,n]),(0,a.useEffect)((()=>{if(e)try{const t=s.Nn.getAccount(e)||s.Nn.getAddress(e),n=o(e),a=d(e);E(t?.meta.genesisHash||null),D((s=>({...s,isDevelopment:t?.meta.isTesting||!1,isEditable:!(S?.display||!(a||t?.meta.isMultisig||t&&!t.meta.isInjected))||!1,isEthereum:(0,r.vq)(e,160),isExternal:!!t?.meta.isExternal||!1,isHardware:!!t?.meta.isHardware||!1,isInContacts:a,isInjected:!!t?.meta.isInjected||!1,isMultisig:!!t?.meta.isMultisig||!1,isOwned:n,isProxied:!!t?.meta.isProxied||!1}))),V(t?.meta),k(t?.meta.name||""),j(t?.meta.tags?.sort()||[])}catch{}}),[S,o,d,e]);const R=(0,a.useCallback)((()=>{P&&T();const a={name:C,whenEdited:Date.now()};if(t)try{if(e){const t=s.Nn.getAddress(e)?.meta;s.Nn.saveContract(e,{...t,...a})}}catch(e){console.error(e)}else if(e)try{const t=s.Nn.getPair(e);t&&s.Nn.saveAccountMeta(t,a)}catch{s.Nn.getAddress(e)?s.Nn.saveAddress(e,a):s.Nn.saveAddress(e,{genesisHash:n.genesisHash.toHex(),...a})}}),[n,t,P,C,T,e]),$=(0,a.useCallback)((()=>{const n={tags:y,whenEdited:Date.now()};if(t)try{if(e){const t=s.Nn.getAddress(e)?.meta;e&&s.Nn.saveContract(e,{...t,...n})}}catch(e){console.error(e)}else if(e)try{const t=s.Nn.getPair(e);t&&s.Nn.saveAccountMeta(t,n)}catch{s.Nn.saveAddress(e,n)}}),[t,y,e]),q=(0,a.useCallback)((()=>{P&&T(),F&&z();try{e&&s.Nn.forgetAddress(e)}catch(e){console.error(e)}}),[P,F,T,z,e]),U=(0,a.useCallback)((t=>{if(e){const n=s.Nn.getPair(e);n&&s.Nn.saveAccountMeta(n,{...n.meta,genesisHash:t}),E(t)}}),[e]),H=(0,a.useCallback)((e=>j(e.sort())),[]),Q=(0,a.useCallback)((()=>P||F),[P,F]);return(0,a.useMemo)((()=>({accountIndex:v,flags:B,genesisHash:N,identity:S,isEditing:Q,isEditingName:P,isEditingTags:F,isNull:!e,meta:L,name:C,onForgetAddress:q,onSaveName:R,onSaveTags:$,onSetGenesisHash:U,setIsEditingName:M,setIsEditingTags:Z,setName:k,setTags:H,tags:y,toggleIsEditingName:T,toggleIsEditingTags:z})),[v,B,N,S,Q,P,F,L,C,q,R,$,U,M,Z,k,H,y,T,z,e])}))},34814:(e,t,n)=>{n.d(t,{x:()=>i});var a=n(2784),s=n(3773);const i=(0,n(11677).e)("useAccounts",(function(){return(0,a.useContext)(s.H).accounts}))},81642:(e,t,n)=>{n.d(t,{J:()=>i});var a=n(2784),s=n(3773);const i=(0,n(11677).e)("useAddresses",(function(){return(0,a.useContext)(s.H).addresses}))},90778:(e,t,n)=>{n.d(t,{h:()=>i});var a=n(2784),s=n(87206);const i=(0,n(11677).e)("useApi",(function(){return(0,a.useContext)(s.E)}))},47297:(e,t,n)=>{n.d(t,{m:()=>i});var a=n(2784),s=n(68944);const i=(0,n(11677).e)("useApiStats",(function(){return(0,a.useContext)(s.y)}))},18837:(e,t,n)=>{n.d(t,{J:()=>m});var a=n(2784),s=n(64176),i=n(21899),r=n(20525),o=n(54371),l=n(26912),c=n(11677),d=n(74065);function u(e){return e?.disconnect().catch(console.error),null}const m=(0,c.e)("useApiUrl",(function(e){const t=(0,a.useRef)(null),n=(0,d.X)(),[c,m]=(0,a.useState)(null),h=(0,a.useMemo)((()=>e?(0,o.H)(e)?[e]:(0,l.r)(e.filter((e=>!e.startsWith("light://")))):[]),[e]);return(0,a.useEffect)((()=>()=>{t.current=u(t.current)}),[]),(0,a.useEffect)((()=>{m(null),t.current=u(t.current),h.length&&s.G.create({provider:t.current=new i.U(h),typesBundle:r.UD}).then((e=>n.current&&m(e))).catch(console.error)}),[n,t,h]),c}))},43223:(e,t,n)=>{n.d(t,{g:()=>u});var a=n(2784),s=n(95292),i=n(48801),r=n.n(i),o=n(11677),l=n(90778),c=n(9118),d=n(74065);const u=(0,o.e)("useAvailableSlashes",(function(){const{api:e}=(0,l.h)(),t=(0,c.W7)(e.derive.session?.indexes),n=(0,c.W7)(e.query.staking?.earliestUnappliedSlash),i=(0,d.X)(),[o,u]=(0,a.useState)([]);return(0,a.useEffect)((()=>{let a;const[o,l]=e.query.staking?.earliestUnappliedSlash?[n?.unwrapOr(null),s.nw]:[t?.activeEra,s.If.add(e.consts.staking?.slashDeferDuration||s.S8)];if(i.current&&t&&o){const n=[],c=t.activeEra.add(l);let d=new(r())(o);for(;d.lte(c);)n.push(d),d=d.add(s.If);n.length&&(async()=>{a=await e.query.staking.unappliedSlashes.multi(n,(e=>{i.current&&u(e.map(((e,t)=>[o.addn(t),e])).filter((([,e])=>e.length)))}))})().catch(console.error)}return()=>{a&&a()}}),[e,n,t,i]),o}))},83696:(e,t,n)=>{n.d(t,{r:()=>r});var a=n(11677),s=n(90778),i=n(9118);const r=(0,a.e)("useBalancesAll",(function(e){const{api:t}=(0,s.h)();return(0,i.W7)(t.derive.balances?.all,[e])}))},62395:(e,t,n)=>{n.d(t,{P:()=>o});var a=n(11677),s=n(90778),i=n(9118);const r={transform:e=>e.hash.toHex()},o=(0,a.e)("useBestHash",(function(){const{api:e}=(0,s.h)();return(0,i.W7)(e.rpc.chain.subscribeNewHeads,void 0,r)}))},54383:(e,t,n)=>{n.d(t,{C:()=>r});var a=n(11677),s=n(90778),i=n(9118);const r=(0,a.e)("useBestNumber",(function(){const{api:e}=(0,s.h)();return(0,i.W7)(e.derive.chain.bestNumber)}))},75387:(e,t,n)=>{n.d(t,{E:()=>i});var a=n(2784),s=n(57120);const i=(0,n(11677).e)("useBlockAuthors",(function(){return(0,a.useContext)(s.U)}))},67405:(e,t,n)=>{n.d(t,{d:()=>i});var a=n(2784),s=n(44028);const i=(0,n(11677).e)("useBlockEvents",(function(){return(0,a.useContext)(s.m)}))},56360:(e,t,n)=>{n.d(t,{n:()=>h});var a=n(2784),s=n(95292),i=n(48801),r=n.n(i),o=n(52107),l=n(11677),c=n(90778),d=n(49255);const u=s.D_.div(s.um),m=new(r())(6e3),h=(0,l.e)("useBlockInterval",(function(e){const{api:t}=(0,c.h)();return(0,a.useMemo)((()=>function(e){return(0,o.N)(d.P,e.consts.babe?.expectedBlockTime||e.consts.difficulty?.targetBlockTime||e.consts.subspace?.expectedBlockTime||(e.consts.timestamp?.minimumPeriod.gte(u)?e.consts.timestamp.minimumPeriod.mul(s.um):e.query.parachainSystem?m.mul(s.um):m))}(e||t)),[t,e])}))},97794:(e,t,n)=>{n.d(t,{A:()=>u,h:()=>m});var a=n(2784),s=n(52107),i=n(95292),r=n(22771),o=n(12372),l=n(11677),c=n(61349),d=n(56360);function u(e,t,n){const a=(0,s.N)(i.Ew,e.mul(t)).toNumber(),o=(0,r.E)(Math.abs(a)),{days:l,hours:c,minutes:d,seconds:u}=o;return[e.toNumber(),`${a<0?"+":""}${[l?l>1?n("{{days}} days",{replace:{days:l}}):n("1 day"):null,c?c>1?n("{{hours}} hrs",{replace:{hours:c}}):n("1 hr"):null,d?d>1?n("{{minutes}} mins",{replace:{minutes:d}}):n("1 min"):null,u?u>1?n("{{seconds}} s",{replace:{seconds:u}}):n("1 s"):null].filter((e=>!!e)).slice(0,2).join(" ")}`,o]}const m=(0,l.e)("useBlockTime",(function(e=i.If,t){const{t:n}=(0,c.$G)("react-hooks"),s=(0,d.n)(t);return(0,a.useMemo)((()=>u(s,(0,o.G)(e),n)),[s,e,n])}))},49255:(e,t,n)=>{n.d(t,{P:()=>c,u:()=>d});var a=n(2784),s=n(48801),i=n.n(s),r=n(12372),o=n(11677),l=n(56360);const c=new(i())(864e5),d=(0,o.e)("useBlocksPerDays",(function(e=1){const t=(0,l.n)();return(0,a.useMemo)((()=>c.mul((0,r.G)(e)).div(t)),[t,e])}))},9118:(e,t,n)=>{n.d(t,{S3:()=>u,SB:()=>d,W7:()=>h,r1:()=>m});var a=n(2784),s=n(1346),i=n(17751),r=n(33661),o=n(17965),l=n(90778),c=n(74065);function d(e){return e}function u(e,t,n){console.error(t.current.error=new Error(`${t.current.type}(${function(e){return!!e&&!(0,s.o)(e.creator)}(n)?`${n.creator.section}.${n.creator.method}`:"..."}):: ${e.message}:: ${e.stack||""}`))}function m(e){e.current.isActive=!1,e.current.subscriber&&(e.current.subscriber.then((e=>(0,r.m)(e)&&e())).catch((t=>u(t,e))),e.current.subscriber=null)}function h(e,t,n){const{api:r}=(0,l.h)(),h=(0,c.X)(),p=(0,a.useRef)({error:null,fn:null,isActive:!1,serialized:null,subscriber:null,type:"useCall"}),[g,f]=(0,a.useState)(n?.defaultValue);return(0,a.useEffect)((()=>()=>m(p)),[]),(0,a.useEffect)((()=>{if(h.current&&e){const[a,l]=function(e,t,{paramMap:n=d}={}){return[JSON.stringify({f:e?.name,p:t}),0!==t.length&&t.some((e=>(0,i.F)(e)||(0,s.o)(e)))?null:n(t)]}(e,t||[],n);!l||e===p.current.fn&&a===p.current.serialized||(p.current.fn=e,p.current.serialized=a,function(e,t,n,a,i,r,{transform:l=d,withParams:c,withParamsTransform:h}={}){const p=i.filter((e=>!(0,s.o)(e)));m(n),(0,o.Y)((()=>{t.current&&(!a||function(e){return!!e.meta?.type?.isMap}(a)&&a.meta.type.asMap.hashers.length!==p.length?n.current.subscriber=null:(n.current.isActive=!0,n.current.subscriber=a(...i,(s=>{if(t.current&&n.current.isActive)try{r(c?[i,l(s,e)]:l(h?[i,s]:s,e))}catch(e){u(e,n,a)}})).catch((e=>u(e,n,a)))))}))}(r,h,p,e,l,f,n))}}),[r,e,n,h,t]),g}},54890:(e,t,n)=>{n.d(t,{L:()=>c});var a=n(2784),s=n(17965),i=n(1346),r=n(90778),o=n(9118),l=n(74065);function c(e,t){const{api:n}=(0,r.h)(),c=(0,l.X)(),d=(0,a.useRef)({error:null,fn:null,isActive:!1,serialized:null,subscriber:null,type:"useCallMulti"}),[u,m]=(0,a.useState)((()=>(0,i.o)(t?.defaultValue)?[]:t?.defaultValue));return(0,a.useEffect)((()=>()=>(0,o.r1)(d)),[]),(0,a.useEffect)((()=>{if(c.current&&e){const a=JSON.stringify(e);a!==d.current.serialized&&(d.current.serialized=a,function(e,t,n,a,i,{transform:r=o.SB}={}){(0,o.r1)(n),(0,s.Y)((()=>{if(t.current){const s=a.map((e=>!(!e||Array.isArray(e)&&!e[0]))),l=a.filter(((e,t)=>s[t]));l.length?(n.current.isActive=!0,n.current.subscriber=e.queryMulti(l,(l=>{if(t.current&&n.current.isActive){let t=-1;try{i(r(a.map(((e,n)=>s[n]?l[++t]:void 0)),e))}catch(e){(0,o.S3)(e,n)}}})).catch((e=>(0,o.S3)(e,n)))):n.current.subscriber=null}}))}(n,c,d,e,m,t))}}),[n,e,t,c]),u}},81190:(e,t,n)=>{n.d(t,{m:()=>r});var a=n(2784),s=n(90778),i=n(33661);const r=(0,n(11677).e)("useCollectiveInstance",(function(e,t){const{api:n}=(0,s.h)();return(0,a.useMemo)((()=>{const a=t||0,s=n.registry.getModuleInstances(n.runtimeVersion.specName.toString(),e),r=s&&a{n.d(t,{V:()=>d});var a=n(2784),s=n(11677),i=n(34814),r=n(90778),o=n(9118);const l={transform:e=>e.map((e=>e.toString()))},c={transform:e=>e?.toString()||null},d=(0,s.e)("useCollectiveMembers",(function(e){const{api:t}=(0,r.h)(),{allAccounts:n}=(0,i.x)(),s=(0,o.W7)(t.derive[e]?.members,[],l),d=(0,o.W7)(t.derive[e]?.prime,[],c);return(0,a.useMemo)((()=>({isMember:(s||[]).some((e=>n.includes(e))),members:s||[],prime:d})),[n,s,d])}))},27421:(e,t,n)=>{n.d(t,{N:()=>r});var a=n(2784),s=n(74065);const i=250;function r(e,t=i){const n=(0,s.X)(),[r,o]=(0,a.useState)(e);return(0,a.useEffect)((()=>{const a=setTimeout((()=>{n.current&&o(e)}),t);return()=>{clearTimeout(a)}}),[t,e,n]),r}},32980:(e,t,n)=>{n.d(t,{W:()=>r});var a=n(90778),s=n(34814),i=n(9118);const r=(0,n(11677).e)("useDelegations",(function(){const{api:e}=(0,a.h)(),{allAccounts:t}=(0,s.x)();return(0,i.W7)(e.query.democracy?.votingOf?.multi,[t])}))},60773:(e,t,n)=>{n.d(t,{Y:()=>r});var a=n(11677),s=n(9118),i=n(29455);const r=(0,a.e)("useDeriveAccountInfo",(function(e){const t=(0,i.J)();return(0,s.W7)(t?.derive.accounts.info,[e])}))},39824:(e,t,n)=>{n.d(t,{N:()=>c});var a=n(2784),s=n(33661),i=n(90778),r=n(24305),o=n(80501);function l(e=[],{added:t=[],removed:n=[]}){if(!t.length&&!n.length)return e;const a={};[e,t].forEach((e=>e.forEach((e=>{a[e.toHex()]=e})))),n.forEach((e=>{delete a[e.toHex()]}));const i=Object.entries(a).sort(((e,t)=>(0,s.m)(e[1].cmp)?e[1].cmp(t[1]):e[0].localeCompare(t[0]))).map((([,e])=>e));return i.length!==e.length||i.find(((t,n)=>!t.eq(e[n])))?i:e}function c(e,t,n,s){const{api:c}=(0,i.h)(),[d,u]=(0,a.useState)(),m=(0,o.Wg)(e),{blockHash:h,events:p}=(0,r.b)(m);return(0,a.useEffect)((()=>{n&&u((e=>l(e,{added:n})))}),[n]),(0,a.useEffect)((()=>{h&&u((e=>l(e,t(p,c,s))))}),[s,c,h,p,t]),d}},24305:(e,t,n)=>{n.d(t,{b:()=>u});var a=n(2784),s=n(11677),i=n(90778),r=n(9118),o=n(74065),l=n(80501);const c={blockHash:"",events:[]},d=()=>!0,u=(0,s.e)("useEventTrigger",(function(e,t=d){const{api:n}=(0,i.h)(),[s,u]=(0,a.useState)((()=>c)),m=(0,l.Wg)(e),h=(0,o.X)(),p=(0,r.W7)(n.query.system.events);return(0,a.useEffect)((()=>{if(h.current&&p){const e=p.filter((e=>e.event&&m.some((t=>t&&t.is(e.event)))&&t(e)));e.length&&u({blockHash:p.createdAtHash?.toHex()||"",events:e})}}),[p,t,m,h]),s}))},54131:(e,t,n)=>{n.d(t,{r:()=>l});var a=n(2784),s=n(11677),i=n(23729),r=n.n(i),o=n(90778);const l=(0,s.e)("useFavorites",(function(e){const[t,n]=function(e){const{api:t,isDevelopment:n}=(0,o.h)(),s=(0,a.useMemo)((()=>`${e}:${n?"development":t.genesisHash.toHex()}`),[t,n,e]);return[(0,a.useCallback)((()=>r().get(s)),[s]),(0,a.useCallback)((e=>r().set(s,e)),[s])]}(e),[s,i]=(0,a.useState)((()=>t()||[])),l=(0,a.useCallback)((e=>i((t=>n(t.includes(e)?t.filter((t=>e!==t)):[...t,e])))),[n]);return(0,a.useMemo)((()=>[s,l]),[s,l])}))},93803:(e,t,n)=>{n.d(t,{Y:()=>r});var a=n(2784),s=n(1346);const i=()=>!0;function r(e,t=i){const[n,r]=(0,a.useState)(e),o=(0,a.useMemo)((()=>!!n&&t(n)),[t,n]),l=(0,a.useCallback)((e=>!(0,s.o)(e)&&r(e)),[]);return[n,o,l]}},60864:(e,t,n)=>{n.d(t,{y:()=>r});var a=n(2784),s=n(11677),i=n(74065);const r=(0,s.e)("useIncrement",(function(e=1){const t=(0,i.X)(),[n,s]=(0,a.useState)(e),r=(0,a.useCallback)((()=>{t.current&&s((e=>++e))}),[t]);return[n,r,s]}))},57493:(e,t,n)=>{n.d(t,{V:()=>d});var a=n(2784),s=n(6119),i=n(95292),r=n(11677),o=n(90778),l=n(9118);const c={idealInterest:0,idealStake:0,inflation:0,stakedFraction:0,stakedReturn:0},d=(0,r.e)("useInflation",(function(e){const{api:t}=(0,o.h)(),n=(0,l.W7)(t.query.balances?.totalIssuance),r=(0,l.W7)(t.query.auctions?.auctionCounter),[d,u]=(0,a.useState)(c);return(0,a.useEffect)((()=>{const a=t.query.auctions?r:i.nw;a&&n&&e&&u(function(e,t,n,a){const{auctionAdjust:r,auctionMax:o,falloff:l,maxInflation:c,minInflation:d,stakeTarget:u}=(0,s.S)(e),m=t.isZero()||n.isZero()?0:t.mul(i.uy).div(n).toNumber()/i.uy.toNumber(),h=u-Math.min(o,a.toNumber())*r,p=c/h,g=100*(d+(m<=h?m*(p-d/h):(p*h-d)*Math.pow(2,(h-m)/l)));return{idealInterest:p,idealStake:h,inflation:g,stakedFraction:m,stakedReturn:m?g/m:0}}(t,e,n,a))}),[t,r,n,e]),d}))},83337:(e,t,n)=>{n.d(t,{K:()=>c,g:()=>d});var a=n(2784),s=n(11677);const i=["ipfs","ipns"],r=i.map((e=>`/${e}/`)),o=".ipfs.localhost",l=".ipns.localhost";function c(){const[e]=window.location.href.split("#");return e.includes(o)?function(e){const[,,t]=e.split("/"),n=t.split(":")[0];return{ipfsHash:n.replace(o,""),ipfsPath:n,ipnsChain:null,ipnsDomain:null,isIpfs:!0,isIpns:!1}}(e):e.includes(l)?function(e){const[,,t]=e.split("/"),n=t.split(":")[0],a=n.replace(l,""),s=a.split(".");let i=null,r=null;return s.length>2?(i=s[0],r=s.slice(1).join(".")):r=a,{ipfsHash:null,ipfsPath:n,ipnsChain:i,ipnsDomain:r,isIpfs:!0,isIpns:!0}}(e):function(e){const t=r.some((t=>e.includes(t))),n=e.includes(r[1]),a=e.split("/"),s=a.indexOf(n?i[1]:i[0]);let o=null,l=null,c=null,d=null;if(-1!==s)if(l=a.slice(0,s+1).join("/"),n){const e=a[s+1],t=e.split(".");t.length>2?(c=t[0],d=t.slice(1).join(".")):d=e}else o=a[s+1];return{ipfsHash:o,ipfsPath:l,ipnsChain:c,ipnsDomain:d,isIpfs:t,isIpns:n}}(e)}const d=(0,s.e)("useIpfs",(function(){const[e]=(0,a.useState)((()=>c()));return e}))},67239:(e,t,n)=>{n.d(t,{g:()=>o});var a=n(33702),s=n(2784),i=n(74065);const r=new Map;function o(e,t){const n=(0,i.X)(),[o,l]=(0,s.useState)(),c=(0,s.useMemo)((()=>{if(e)return e.map((e=>{return(t=e)&&(a.rb(t)||a.MC(t.toLowerCase()))?e:"";var t})).filter((e=>!!e))}),[e]);return(0,s.useEffect)((()=>{n.current&&c&&async function(e){const t=new Map,n=e.map((e=>r.has(e)?(t.set(e,r.get(e)),Promise.resolve()):fetch(`https://ipfs.io/ipfs/${e}`).then((async n=>{const a=n.status>=200&&n.status<300?await n.text():null;r.set(e,a),t.set(e,a)}))));return await Promise.allSettled(n),t}(c).then((e=>l(function(e,{transform:t}={}){if(!t)return e;for(const[n,a]of e.entries())e.set(n,t(a));return e}(e,t)))).catch((()=>{}))}),[c,t,n]),o}},62837:(e,t,n)=>{n.d(t,{Y:()=>s});var a=n(2784);const s=(0,n(11677).e)("useIpfsLink",(function(e){return(0,a.useMemo)((()=>e?{ipfsHash:e,ipfsShort:`${e.substring(0,4)}…${e.slice(-4)}`,ipfsUrl:`https://ipfs.io/ipfs/${e}`}:null),[e])}))},74065:(e,t,n)=>{n.d(t,{X:()=>s});var a=n(2784);const s=(0,n(11677).e)("useIsMountedRef",(function(){const e=(0,a.useRef)(!1);return(0,a.useEffect)((()=>(e.current=!0,()=>{e.current=!1})),[]),e}))},37146:(e,t,n)=>{n.d(t,{i:()=>i});var a=n(2784),s=n(3773);const i=(0,n(11677).e)("useKeyring",(function(){return(0,a.useContext)(s.H)}))},45479:(e,t,n)=>{n.d(t,{c:()=>x});var a=n(2784),s=n(99736),i=n(70392),r=n(7404),o=n(38711),l=n(48731),c=n(11677),d=n(90778);const u={hasLedgerChain:!1,hasWebUsb:!1,isLedgerCapable:!1,isLedgerEnabled:!1},m=!!window.USB,h=Object.keys(i.A).filter((e=>r.Y[e])),p=h.reduce(((e,t)=>[...e,...i.A[t]]),[]);let g=null,f=null;function b(e){const t=p.includes(e.genesisHash.toHex()),n=m&&t;return{hasLedgerChain:t,hasWebUsb:m,isLedgerCapable:n,isLedgerEnabled:n&&"none"!==o.ZP.ledgerConn}}const x=(0,c.e)("useLedger",(function(){const{api:e,isApiReady:t}=(0,d.h)(),n=(0,a.useCallback)((()=>function(e){const t=o.ZP.ledgerConn;if(!g||f!==t){const n=e.genesisHash.toHex(),a=h.find((e=>i.A[e].includes(n)));(0,l.hu)(a,`Unable to find a known Ledger config for genesisHash ${n}`),g=new s.P(t,a),f=t}return g}(e)),[e]);return(0,a.useMemo)((()=>({...t?b(e):u,getLedger:n})),[e,n,t])}))},51240:(e,t,n)=>{n.d(t,{t:()=>i});var a=n(2784),s=n(11147);function i(e,t,{transform:n}={},i){const[r,o]=(0,a.useState)(),l=(0,a.useRef)(null);return(0,a.useEffect)((()=>{if(e&&t){const a=(0,s.P)({at:i,params:t});a!==l.current&&(l.current=a,(i&&"0"!==i?e.entriesAt(i,...t):e.entries(...t)).then((e=>o(n?n(e):e))).catch(console.error))}}),[i,e,t,n]),r}},12298:(e,t,n)=>{n.d(t,{k:()=>i});var a=n(2784),s=n(11147);function i(e,t,{transform:n}={},i){const[r,o]=(0,a.useState)(),l=(0,a.useRef)(null);return(0,a.useEffect)((()=>{if(e&&t){const a=(0,s.P)({at:i,params:t});a!==l.current&&(l.current=a,(i&&"0"!==i?e.keysAt(i,...t):e.keys(...t)).then((e=>o(n?n(e):e))).catch(console.error))}}),[i,e,t,n]),r}},80501:(e,t,n)=>{n.d(t,{Wg:()=>o});var a=n(2784),s=n(11147);function i(e,t,n=-1){return n++,e!==t&&(!(n<2&&Array.isArray(e)&&Array.isArray(t)&&e.length===t.length)||e.some(((e,a)=>i(e,t[a],n))))}function r(e,t){if(!e.current||i(e.current.value,t)){const n=(0,s.P)({value:t});e.current&&e.current.stringified===n||(e.current={stringified:n,value:t})}return e.current.value}function o(e){const t=(0,a.useRef)(null);return(0,a.useMemo)((()=>r(t,e)),[t,e])}},65121:(e,t,n)=>{n.d(t,{d:()=>r});var a=n(2784),s=n(11677),i=n(38894);const r=(0,s.e)("useModal",(function(e,t,n){const[s,,r]=(0,i.O)(e||!1),o=(0,a.useCallback)((()=>{r(!0),t&&t()}),[t,r]);return{isOpen:s,onClose:(0,a.useCallback)((()=>{r(!1),n&&n()}),[n,r]),onOpen:o}}))},47623:(e,t,n)=>{n.d(t,{q:()=>i});var a=n(2784),s=n(17965);const i=(0,n(11677).e)("useNextTick",(function(){const[e,t]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{(0,s.Y)((()=>t(!0)))}),[]),e}))},6589:(e,t,n)=>{n.d(t,{n:()=>r});var a=n(11677),s=n(93803);function i(e){return e&&e.length>0||!1}const r=(0,a.e)("useNonEmptyString",(function(e=""){return(0,s.Y)(e,i)}))},59118:(e,t,n)=>{n.d(t,{Q:()=>h});var a=n(2784),s=n(95292),i=n(11677),r=n(90778),o=n(9118),l=n(74065),c=n(50417);const d={filteredEras:[],validatorEras:[]},u={isLoadingRewards:!0,rewardCount:0},m={withParams:!0},h=(0,i.e)("useOwnEraRewards",(function(e,t,n){const{api:i}=(0,r.h)(),h=(0,l.X)(),p=(0,c.q)(n),g=(0,o.W7)(i.derive.staking?.erasHistoric),[{filteredEras:f,validatorEras:b},x]=(0,a.useState)(d),[A,v]=(0,a.useState)(u),w=(0,o.W7)(!t?.length&&!!f.length&&p&&i.derive.staking?.stakerRewardsMultiEras,[p,f],m),y=(0,o.W7)(!!b.length&&!!f.length&&i.derive.staking._erasPoints,[f,!1]),j=(0,o.W7)(!!b.length&&!!f.length&&i.derive.staking._erasRewards,[f,!1]);return(0,a.useEffect)((()=>{v({allRewards:null,isLoadingRewards:!0,rewardCount:0})}),[e,t]),(0,a.useEffect)((()=>{if(g&&e){const n=g.slice(-1*e),a=[];0===g.length?(v({allRewards:{},isLoadingRewards:!1,rewardCount:0}),x({filteredEras:n,validatorEras:a})):t?.length&&(t.forEach((({stakingLedger:e,stashId:t})=>{if(e){const s=n.filter((t=>!e.claimedRewards.some((e=>t.eq(e)))));s.length&&a.push({eras:s,stashId:t})}})),n.length&&!a.length&&v({allRewards:{},isLoadingRewards:!1,rewardCount:0})),x({filteredEras:n,validatorEras:a})}}),[g,e,t]),(0,a.useEffect)((()=>{h.current&&w&&!t&&v(function([[e],t]){const n={};return e.forEach(((e,a)=>{n[e]=t[a].filter((({eraReward:e})=>!e.isZero()))})),{allRewards:n,isLoadingRewards:!1,rewardCount:Object.values(n).filter((e=>0!==e.length)).length}}(w))}),[h,t,w]),(0,a.useEffect)((()=>{h&&y&&j&&t&&v(function(e,t,n,a){const i={};return t.forEach((({eras:t,stashId:r})=>{t.forEach((t=>{const o=n.find((e=>e.era.eq(t))),l=a.find((e=>e.era.eq(t)));if(o?.eraPoints.gt(s.nw)&&o?.validators[r]&&l){const n=o.validators[r].mul(l.eraReward).div(o.eraPoints);if(!n.isZero()){const a=e.createType("Balance",n);i[r]||(i[r]=[]),i[r].push({era:t,eraReward:l.eraReward,isEmpty:!1,isValidator:!0,nominating:[],validators:{[r]:{total:a,value:a}}})}}}))})),{allRewards:i,isLoadingRewards:!1,rewardCount:Object.values(i).filter((e=>0!==e.length)).length}}(i,b,y,j))}),[i,y,j,h,t,b]),A}))},12213:(e,t,n)=>{n.d(t,{w:()=>m});var a=n(2784),s=n(51330),i=n(55858),r=n(11677),o=n(34814),l=n(90778),c=n(74065),d=n(50417);function u(e){return e?e.toString():null}const m=(0,r.e)("useOwnStashInfos",(function(){const{api:e}=(0,l.h)(),{allAccounts:t}=(0,o.x)(),n=(0,c.X)(),r=(0,d.y)(),[m,h]=(0,a.useState)();return(0,a.useEffect)((()=>{let t;if(r)if(r.length){const a=r.map((([e])=>e)),s=[[e.derive.staking.accounts,a],[e.query.staking.validators.multi,a]];e.combineLatest(s,(([e,t])=>{n.current&&r.length===e.length&&r.length===t.length&&h(r.reduce(((n,[a,s],i)=>({...n,[a]:[s,e[i],t[i]]})),{}))})).then((e=>{t=e})).catch(console.error)}else n.current&&h({});return()=>{t&&t()}}),[e,n,r]),(0,a.useMemo)((()=>r&&m&&r.length===Object.keys(m).length?r.filter((([e])=>m[e])).map((([e])=>function(e,t,[n,{controllerId:a,exposure:r,nextSessionIds:o,nominators:l,rewardDestination:c,sessionIds:d,stakingLedger:m,validatorPrefs:h},p]){const g=!!l?.length,f=!(Array.isArray(p)?p[1].isEmpty:p.isEmpty),b=o instanceof Map?[...o.values()]:o,x=(0,s.e)(...b.map((e=>e.toU8a()))),A=d instanceof Map?[...d.values()]:d,v=(0,s.e)(...A.map((e=>e.toU8a()))),w=u(a);return{controllerId:w,destination:c,exposure:r,hexSessionIdNext:(0,i.c)(x,48),hexSessionIdQueue:(0,i.c)(v.length?v:x,48),isLoading:!1,isOwnController:t.includes(w||""),isOwnStash:n,isStashNominating:g,isStashValidating:f,nominating:l?.map(u),sessionIds:(b.length?b:A).map(u),stakingLedger:m,stashId:e,validatorPrefs:h}}(e,t,m[e]))):void 0),[t,r,m])}))},50417:(e,t,n)=>{n.d(t,{q:()=>c,y:()=>l});var a=n(2784),s=n(11677),i=n(34814),r=n(90778),o=n(9118);const l=(0,s.e)("useOwnStashes",(function(e){const{allAccounts:t}=(0,i.x)(),{api:n}=(0,r.h)(),s=(0,a.useMemo)((()=>t.concat(e||[])),[t,e]),l=(0,o.W7)(0!==s.length&&n.query.staking?.bonded.multi,[s]),c=(0,o.W7)(0!==s.length&&n.query.staking?.ledger.multi,[s]);return(0,a.useMemo)((()=>s.length?l&&c?function(e,t,n){const a=[];return t.forEach(((t,n)=>{t.isSome&&a.push([e[n],!0])})),n.forEach((e=>{if(e.isSome){const t=e.unwrap().stash.toString();!a.some((([e])=>e===t))&&a.push([t,!1])}})),a}(s,l,c):void 0:[]),[s,l,c])})),c=(0,s.e)("useOwnStashIds",(function(e){const t=l(e);return(0,a.useMemo)((()=>t?t.map((([e])=>e)):void 0),[t])}))},36198:(e,t,n)=>{n.d(t,{x:()=>c});var a=n(2784),s=n(26912),i=n(11677),r=n(18837),o=n(74065),l=n(84450);const c=(0,i.e)("useParaApi",(function(e){const t=(0,o.X)(),n=(0,l.jC)(e),[i,c]=(0,a.useState)((()=>({api:null,endpoints:n,urls:[]}))),d=(0,r.J)(i.urls);return(0,a.useEffect)((()=>{t.current&&c({api:null,endpoints:n,urls:(0,s.r)(n.filter((({isDisabled:e,isUnreachable:t})=>!e&&!t)).map((({value:e})=>e)))})}),[n,t]),(0,a.useEffect)((()=>{t.current&&c((({endpoints:e,urls:t})=>({api:d,endpoints:e,urls:t})))}),[d,t]),i}))},84450:(e,t,n)=>{n.d(t,{gW:()=>m,jC:()=>u});var a=n(2784),s=n(47564),i=n(12372),r=n(11677),o=n(90778);const l=(0,s.Rf)(((e,t)=>t?.toString()||e));function c(e,t){const n=(0,i.G)(t).toNumber();return e.filter((({paraId:e})=>e===n))}const d=(0,r.e)("useRelayEndpoints",(function(){const{api:e}=(0,o.h)();return(0,a.useMemo)((()=>{return t=e.genesisHash.toHex(),l.filter((({genesisHashRelay:e})=>t===e));var t}),[e])})),u=(0,r.e)("useParaEndpoints",(function(e){const t=d();return(0,a.useMemo)((()=>c(t,e)),[t,e])})),m=(0,r.e)("useIsParasLinked",(function(e){const t=d();return(0,a.useMemo)((()=>e?e.reduce(((e,n)=>({...e,[n.toString()]:0!==c(t,n).length})),{}):{}),[t,e])}))},31313:(e,t,n)=>{n.d(t,{CH:()=>v,uD:()=>b});var a=n(2784),s=n(90778),i=n(9118),r=n(11677),o=n(37602),l=n(54371),c=n(48358),d=n(55858),u=n(48801),m=n.n(u),h=n(14681),p=n(33403),g=n(95292);function f(e){if(e.query.preimage&&e.query.preimage.preimageFor&&e.query.preimage.preimageFor.creator.meta.type.isMap){const{type:t}=e.registry.lookup.getTypeDef(e.query.preimage.preimageFor.creator.meta.type.asMap.key);if("H256"===t)return"hash";if("(H256,u32)"===t)return"hashAndLen"}return"unknown"}function b(e,t){let n,a;if((0,l.H)(t))n=t;else if((0,c.U)(t))n=t.toHex();else{const s=t;s.isInline?(a=s.asInline.toU8a(!0),n=(0,d.c)(e.registry.hash(a))):t.isLegacy?n=t.asLegacy.hash_.toHex():t.isLookup?n=t.asLookup.hash_.toHex():console.error(`Unhandled FrameSupportPreimagesBounded type ${t.type}`)}return{inlineData:a,paramsStatus:n&&[n],proposalHash:n,resultPreimageHash:n&&{count:0,isCompleted:!1,isHashParam:"hash"===f(e),proposalHash:n,proposalLength:a&&new(m())(a.length),registry:e.registry,status:null}}}function x(e,t){const n=(0,c.U)(t)?t:t.unwrapOr(null);let a,s=null,i=null,r=null;if(n)try{s=e.registry.createType("Call",n);const t=s.encodedLength;if(e.proposalLength){const n=e.proposalLength.toNumber();t!==n&&(r=`Decoded call length does not match on-chain stored preimage length (${(0,h.u)(t)} bytes vs ${(0,h.u)(n)} bytes)`)}else a=new(m())(t)}catch(e){console.error(e),i="Unable to decode preimage bytes into a valid Call"}else r="No preimage bytes found";return(0,p.Z)({},e,{isCompleted:!0,proposal:s,proposalError:i,proposalLength:a||e.proposalLength,proposalWarning:r})}function A(e){return e?{amount:e[1],who:e[0].toString()}:void 0}const v=(0,r.e)("usePreimage",(function(e){const{api:t}=(0,s.h)(),{inlineData:n,paramsStatus:r,resultPreimageHash:l}=(0,a.useMemo)((()=>e?b(t,e):{}),[t,e]),c=(0,i.W7)(!n&&r&&t.query.preimage?.statusFor,r),{paramsBytes:d,resultPreimageFor:u}=(0,a.useMemo)((()=>l&&c?function(e,t){const n=(0,p.Z)({},e,{status:t.unwrapOr(null)});if(n.status)if(n.status.isRequested){const e=n.status.asRequested;if(e instanceof o.W);else{const{count:t,deposit:a,len:s}=e;n.count=t.toNumber(),n.deposit=A(a.unwrapOr(null)),n.proposalLength=s.unwrapOr(g.nw)}}else if(n.status.isUnrequested){const e=n.status.asUnrequested;if(e instanceof o.W)n.deposit=A(e.unwrapOr(null));else{const{deposit:e,len:t}=n.status.asUnrequested;n.deposit=A(e),n.proposalLength=t}}else console.error(`Unhandled PalletPreimageRequestStatus type: ${n.status.type}`);return{paramsBytes:n.isHashParam?[n.proposalHash]:[[n.proposalHash,n.proposalLength||g.nw]],resultPreimageFor:n}}(l,c):{}),[c,l]),m=(0,i.W7)(d&&t.query.preimage?.preimageFor,d);return(0,a.useMemo)((()=>u?m?x(u,m):u:l?n?x(l,n):l:void 0),[n,m,l,u])}))},19276:(e,t,n)=>{n.d(t,{N:()=>l});var a=n(11677),s=n(34814),i=n(90778),r=n(9118);const o={transform:(e,t)=>3===t.tx.proxy.addProxy.meta.args.length?e:e.map((([e,n])=>[e.map((([e,n])=>t.createType("ProxyDefinition",{delegate:e,proxyType:n}))),n]))},l=(0,a.e)("useProxies",(function(){const{api:e}=(0,i.h)(),{allAccounts:t}=(0,s.x)();return(0,r.W7)(e.query.proxy?.proxies.multi,[t],o)}))},86135:(e,t,n)=>{n.d(t,{L:()=>i});var a=n(2784),s=n(87561);const i=(0,n(11677).e)("useQueue",(function(){return(0,a.useContext)(s.l)}))},69250:(e,t,n)=>{n.d(t,{o:()=>o});var a=n(2784),s=n(23729),i=n.n(s),r=n(47538);function o(e,t){const[n,s]=(0,a.useState)((()=>function(e,t){const n=i().get(`flags:${e}`,{});return Object.keys(t).reduce(((e,t)=>((0,r.j)(n[t])&&(e[t]=n[t]),e)),{...t})}(e,t))),[o]=(0,a.useState)((()=>function(e,t){return Object.keys(e).reduce(((e,n)=>(e[n]=(e=>n=>t((t=>({...t,[e]:n}))))(n),e)),{})}(t,s)));return(0,a.useEffect)((()=>{i().set(`flags:${e}`,n)}),[n,e]),[n,o]}},78627:(e,t,n)=>{n.d(t,{_:()=>r});var a=n(11677),s=n(90778),i=n(9118);const r=(0,a.e)("useStakingInfo",(function(e){const{api:t}=(0,s.h)();return(0,i.W7)(t.derive.staking?.account,[e])}))},98551:(e,t,n)=>{n.d(t,{t:()=>s});var a=n(2784);const s=(0,n(11677).e)("useStepper",(function(){const[e,t]=(0,a.useState)(1),n=(0,a.useCallback)((()=>t((e=>e+1))),[]),s=(0,a.useCallback)((()=>t((e=>e-1))),[]);return(0,a.useMemo)((()=>[e,n,s,t]),[e,n,s,t])}))},19008:(e,t,n)=>{n.d(t,{x:()=>r});var a=n(11677),s=n(90778),i=n(9118);const r=(0,a.e)("useSubidentities",(function(e){const{api:t}=(0,s.h)();return(0,i.W7)(t.query.identity?.subsOf,[e])?.[1]}))},74421:(e,t,n)=>{n.d(t,{p:()=>c});var a=n(2784),s=n(11677),i=n(34814),r=n(90778),o=n(9118);const l={transform:e=>e.toString()},c=(0,s.e)("useSudo",(function(){const{api:e}=(0,r.h)(),{allAccounts:t,hasAccounts:n}=(0,i.x)(),s=(0,o.W7)(n&&e.query.sudo?.key,void 0,l),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{d(!!s&&!!t&&t.some((e=>e===s)))}),[t,s]),{allAccounts:t,hasSudoKey:c,sudoKey:s}}))},29455:(e,t,n)=>{n.d(t,{J:()=>r});var a=n(2784),s=n(11677),i=n(90778);const r=(0,s.e)("useSystemApi",(function(){const{api:e,apiRelay:t}=(0,i.h)();return(0,a.useMemo)((()=>t||e),[t,e])}))},41411:(e,t,n)=>{n.d(t,{M:()=>m});var a=n(2784),s=n(47564),i=n(65968),r=n(11677),o=n(90778),l=n(9118);const c={allowTeleport:!1,destinations:[],oneWay:[]},d=(0,s.Rf)(((e,t)=>t?.toString()||e)).filter((e=>!!e.teleport));function u(e,t){return d.filter((n=>(n.genesisHashRelay===e||n.genesisHash===e)&&t(n))).reduce(((e,t)=>(e.some((({genesisHash:e,paraId:n})=>n===t.paraId||e&&e===t.genesisHash))||e.push(t),e)),[]).sort(((e,t)=>e.isRelay===t.isRelay?0:e.isRelay?-1:1))}const m=(0,r.e)("useTeleport",(function(){const{api:e,apiUrl:t,isApiReady:n}=(0,o.h)(),s=(0,l.W7)(n&&e.query.parachainInfo?.parachainId),[r,m]=(0,a.useState)((()=>({...c})));return(0,a.useEffect)((()=>{if(n){const t=e.genesisHash.toHex(),n=d.find((({genesisHash:e})=>e===t));if(n){const e=u(t,(({paraId:e})=>(0,i.h)(e)&&n.teleport.includes(e))),a=u(t,(({paraId:e,teleport:t})=>(0,i.h)(e)&&!t.includes(-1))).map((({paraId:e})=>e||-1));m({allowTeleport:0!==e.length,destinations:e,isRelayTeleport:!0,oneWay:a})}}}),[e,n]),(0,a.useEffect)((()=>{if(s){const e=d.find((({value:e})=>e===t));if(e?.genesisHashRelay){const t=u(e.genesisHashRelay,(({paraId:t})=>e.teleport.includes((0,i.h)(t)?t:-1))),n=u(e.genesisHashRelay,(({paraId:e,teleport:t})=>!t.includes((0,i.h)(e)?e:-1))).map((({paraId:e})=>e||-1));m({allowTeleport:0!==t.length,destinations:t,isParaTeleport:!0,oneWay:n})}}}),[t,s]),r}))},3663:(e,t,n)=>{n.d(t,{F:()=>i});var a=n(2784),s=n(31383);const i=(0,n(11677).e)("useTheme",(function(){const e=(0,a.useContext)(s.Ni);return(0,a.useMemo)((()=>({theme:e?.theme||"light",themeClassName:`theme--${e?.theme||"light"}`})),[e])}))},38894:(e,t,n)=>{n.d(t,{O:()=>r});var a=n(2784),s=n(11677),i=n(74065);const r=(0,s.e)("useToggle",(function(e=!1,t){const n=(0,i.X)(),[s,r]=(0,a.useState)(e),o=(0,a.useCallback)((()=>{n.current&&r((e=>!e))}),[n]),l=(0,a.useCallback)((e=>{n.current&&r(e)}),[n]);return(0,a.useEffect)((()=>t&&t(s)),[s,t]),(0,a.useMemo)((()=>[s,o,l]),[s,o,l])}))},68920:(e,t,n)=>{n.d(t,{_:()=>m});var a=n(2784),s=n(95292),i=n(51330),r=n(48801),o=n.n(r),l=n(11677),c=n(90778),d=n(9118);const u=new Uint8Array(32),m=(0,l.e)("useTreasury",(function(){const{api:e}=(0,c.h)(),[t,n]=(0,a.useState)((()=>({pendingBounties:s.nw,pendingProposals:s.nw,spendPeriod:e.consts.treasury?e.consts.treasury.spendPeriod:s.nw,treasuryAccount:(0,i.e)("modl",e.consts.treasury&&e.consts.treasury.palletId?e.consts.treasury.palletId.toU8a(!0):"py/trsry",u).subarray(0,32)}))),r=(0,d.W7)(e.derive.bounties?.bounties),l=(0,d.W7)(e.derive.treasury.proposals),m=(0,d.W7)(e.derive.balances?.account,[t.treasuryAccount]);return(0,a.useEffect)((()=>{m&&e.consts.treasury&&n((({pendingBounties:t,pendingProposals:n,spendPeriod:a,treasuryAccount:i})=>({burn:m.freeBalance.gt(s.nw)&&!e.consts.treasury.burn.isZero()?e.consts.treasury.burn.mul(m.freeBalance).div(s.uy):s.nw,pendingBounties:t,pendingProposals:n,spendPeriod:a,treasuryAccount:i,value:m.freeBalance.gt(s.nw)?m.freeBalance:void 0})))}),[e,m]),(0,a.useEffect)((()=>{l&&n((e=>({...e,pendingProposals:l.approvals.reduce(((e,{proposal:{value:t}})=>e.iadd(t)),new(o())(0)),totalProposals:l.proposalCount.toNumber()})))}),[l]),(0,a.useEffect)((()=>{r&&n((e=>({...e,pendingBounties:r.reduce(((e,{bounty:{status:t,value:n}})=>e.iadd(t.isApproved?n:s.nw)),new(o())(0))})))}),[r]),t}))},79760:(e,t,n)=>{n.d(t,{b:()=>f});var a=n(2784),s=n(12372),i=n(57826),r=n(95292),o=n(52107),l=n(33661),c=n(17965),d=n(11677),u=n(34814),m=n(90778),h=n(56949);function p(e){return{proofSize:e.proofSize?(0,s.G)((0,i.f)(e.proofSize)?e.proofSize.unwrap():e.proofSize):r.nw,refTime:(0,s.G)((0,i.f)(e.refTime)?e.refTime.unwrap():e.refTime)}}function g(e,t){const n=p(e),a=p(t);return{proofSize:(0,o.x)(r.nw,n.proofSize.sub(a.proofSize)),refTime:(0,o.x)(r.nw,n.refTime.sub(a.refTime))}}const f=(0,d.e)("useTxBatch",(function(e,t){const{api:n}=(0,m.h)(),{allAccounts:s}=(0,u.x)(),[i,d]=(0,a.useState)((()=>Math.floor(t?.max||4))),f=(0,a.useMemo)((()=>function(e){return{baseExtrinsic:e.consts.system.blockWeights?p((0,h.ZQ)(e.consts.system.blockWeights.perClass.normal.baseExtrinsic).v2Weight):null,maxBlock:p((0,h.ZQ)(e.consts.system.blockWeights?e.consts.system.blockWeights.maxBlock:e.consts.system.maximumBlockWeight).v2Weight),maxExtrinsic:e.consts.system.blockWeights&&e.consts.system.blockWeights.perClass.normal.maxExtrinsic.isSome?p((0,h.ZQ)(e.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrap()).v2Weight):null}}(n)),[n]);return(0,a.useEffect)((()=>{e&&e.length&&s[0]&&e[0].hasPaymentInfo&&(0,c.Y)((async()=>{try{const t=await e[0].paymentInfo(s[0]),n=(0,h.ZQ)(t.weight);d((e=>n.v1Weight.isZero()?e:function({v1Weight:e,v2Weight:t},{baseExtrinsic:n,maxBlock:a,maxExtrinsic:s}){let i=0;return n&&s&&(i=Math.floor(.85*function(e,t){const n=p(e),a=p(t),s={proofSize:a.proofSize.isZero()?r.nw:(0,o.x)(r.nw,n.proofSize.mul(r.S8).div(a.proofSize)),refTime:a.refTime.isZero()?r.nw:(0,o.x)(r.nw,n.refTime.mul(r.S8).div(a.refTime))};return(s.proofSize.isZero()?s.refTime.toNumber():(0,o.N)(s.proofSize,s.refTime).toNumber())/100}(g(s,n),g(t,n)))),i||Math.floor(a.refTime.muln(64).div(e).toNumber()/100)}(n,f)))}catch(e){console.error(e)}}))}),[s,n,f,t,e]),(0,a.useMemo)((()=>e&&e.length?function(e,t,n,a="default"){return 1!==n&&(0,l.m)(e.tx.utility?.batch)?t.reduce(((e,t)=>{const a=e[e.length-1];return a.length>=n?e.push([t]):a.push(t),e}),[[]]).map((t=>1===t.length?t[0]:"all"===a&&(0,l.m)(e.tx.utility.batchAll)?e.tx.utility.batchAll(t):"force"===a&&(0,l.m)(e.tx.utility.forceBatch)?e.tx.utility.forceBatch(t):e.tx.utility.batch(t))):t}(n,e,i,t?.type):null),[n,i,t,e])}))},87660:(e,t,n)=>{n.d(t,{I:()=>c});var a=n(2784),s=n(33661),i=n(11677),r=n(90778),o=n(54383);const l={hasFailed:!1,hasPassed:!1,isCloseable:!1,isVoteable:!1,remainingBlocks:null},c=(0,i.e)("useVotingStatus",(function(e,t,n){const{api:i}=(0,r.h)(),c=(0,o.C)();return(0,a.useMemo)((()=>c&&e?function(e,t,n,a,i){const[r]=e.registry.getModuleInstances(e.runtimeVersion.specName.toString(),i)||[i],o=(0,s.m)(e.tx[r]?.close)?r:null;if(!n.end||!o)return{hasFailed:!1,hasPassed:!1,isCloseable:!1,isVoteable:!0,remainingBlocks:null};const l=t.gte(n.end),c=n.threshold.lten(n.ayes.length),d=n.threshold.gtn(Math.abs(a-n.nays.length));return{hasFailed:d,hasPassed:c,isCloseable:4===e.tx[o].close.meta.args.length?l||c||d:l,isVoteable:!l,remainingBlocks:l?null:n.end.sub(t)}}(i,c,e,t,n):l),[i,c,t,n,e])}))},56949:(e,t,n)=>{n.d(t,{TS:()=>u,ZQ:()=>h,h7:()=>p});var a=n(2784),s=n(95292),i=n(33403),r=n(33661),o=n(17965),l=n(11677),c=n(90778),d=n(74065);const u="0x9876543210abcdef9876543210abcdef9876543210abcdef9876543210abcdef",m={encodedCallLength:0,v1Weight:s.nw,v2Weight:{refTime:s.nw},weight:s.nw};function h(e){if(e.proofSize)return{v1Weight:e.refTime.toBn(),v2Weight:e};if(e.refTime){const t=e.refTime.toBn();return{v1Weight:t,v2Weight:{refTime:t}}}const t=e.toBn();return{v1Weight:t,v2Weight:{refTime:t}}}const p=(0,l.e)("useWeight",(function(e){const{api:t}=(0,c.h)(),n=(0,d.X)(),[s,l]=(0,a.useState)((()=>(0,i.Z)({isWeightV2:!(0,r.m)(t.registry.createType("Weight").toBn)},m)));return(0,a.useEffect)((()=>{e&&t.call.transactionPaymentApi?(0,o.Y)((async()=>{try{const{v1Weight:a,v2Weight:s}=h((await t.tx(e).paymentInfo(u)).weight);n.current&&l((t=>(0,i.Z)({},t,{encodedCallLength:e.encodedLength,v1Weight:a,v2Weight:s,weight:t.isWeightV2?s:a})))}catch(e){console.error(e)}})):l((e=>(0,i.Z)({},e,m)))}),[t,e,n]),s}))},37245:(e,t,n)=>{n.d(t,{Z:()=>r});var a=n(52322),s=n(2784);const i=n(64348).zo.div` + &.withBorder { + padding-left: 2rem; + + .ui--Params-Content { + border-left: 1px dashed var(--border-input); + + .ui--Params.withBorder { + padding-left: 0; + } + } + } + + &.withExpander { + padding-left: 0.25rem; + } + + &.withPadding { + padding-left: 4rem; + } + + .ui--Param-composite .ui--row, + .ui--Param-composite .ui--row .ui--InputAddressSimple { + & > .ui--Labelled > label { + text-transform: none !important; + } + } + + .ui--row { + flex-wrap: wrap; + } + + .ui--Param-Address { + } + + .ui--Params-Content { + box-sizing: border-box; + padding: 0; + + .ui--Params-Content { + margin-left: 2rem; + } + } + + .ui--Param-text { + display: inline-block; + font-size: var(--font-size-base); + line-height: 1.714rem; + overflow: hidden; + text-overflow: ellipsis; + } + + .ui--Param-text .icon { + margin-right: 0.5rem !important; + } + + .ui--Param-text * { + vertical-align: middle; + } + + .ui--Param-text.nowrap { + white-space: nowrap; + } + + .ui--Param-text.name { + color: rgba(0, 0, 0, .6); + font-style: italic; + } + + .ui--Param-text + .ui--Param-text { + margin-left: 0.5rem; + } + + .ui--Param-Vector-buttons { + text-align: right; + } + + .ui--Param-composite { + position: relative; + + .ui--Param-overlay { + position: absolute; + top: 0.5rem; + right: 3.5rem; + } + } +`,r=s.memo((function({children:e,className:t="",withBorder:n,withExpander:s,withPadding:r}){return(0,a.jsx)(i,{className:`${t} ui--Params ${n?"withBorder":""} ${r?"withPadding":""} ${s?"withExpander":""}`,children:e})}))},98988:(e,t,n)=>{n.d(t,{Z:()=>h});var a=n(52322),s=n(2784),i=n(64348),r=n(86353),o=n(58607),l=n(6046),c=n(27113),d=n(48653),u=n(37750);const m=i.zo.div` + .ui--Labelled.hash .ui--Static { + overflow: hidden; + text-overflow: ellipsis; + word-break: unset; + word-wrap: unset; + white-space: nowrap; + } + + .ui--Call--toplevel { + margin-top: 0; + + .ui--Labelled { + &:last-child > .ui--Labelled-content > .ui--Static { + margin-bottom: 0; + } + + > .ui--Labelled-content > .ui--Static { + background: var(--bg-static-extra); + } + + + .ui--Labelled > .ui--Labelled-content > .ui--Static { + margin-top: 0; + } + } + } + + > .ui--Params { + margin-top: -0.25rem; + } +`,h=s.memo((function({callName:e,children:t,className:n="",labelHash:h,labelSignature:p,mortality:g,onError:f,tip:b,value:x,withBorder:A,withExpander:v,withHash:w,withSignature:y}){const{t:j}=(0,u.$)(),[{hash:C,overrides:k,params:N,signature:E,signatureType:S,values:I},B]=(0,s.useState)({hash:null,params:[],signature:null,signatureType:null,values:[]});return(0,s.useEffect)((()=>{B(function(e,t,n,a){const s=a&&d.xS.includes(a)?d.fQ:void 0,i=e?.meta.args.map((({name:e,type:t})=>({name:e.toString(),type:(0,l.s)(t.toString())}))),r=e?.args.map((e=>({isValid:!0,value:e}))),o=t?e?.hash.toHex():null;let u=null,m=null;if(n&&function(e){return!!e.signature}(e)&&e.isSigned){const t=function(e){return e._raw?.signature?.multiSignature}(e);u=e.signature.toHex(),m=t instanceof c.x?t.type:null}return{hash:o,overrides:s,params:i,signature:u,signatureType:m,values:r}}(x,w,y,e))}),[e,x,w,y]),(0,a.jsx)(m,{className:`${n} ui--Call`,children:(0,a.jsxs)(r.ZP,{isDisabled:!0,onError:f,overrides:k,params:N,registry:x?.registry,values:I,withBorder:A,withExpander:v,children:[t,(0,a.jsxs)("div",{className:"ui--Call--toplevel",children:[C&&(0,a.jsx)(i.qG,{className:"hash",label:h||j("extrinsic hash"),value:C,withCopy:!0}),E&&(0,a.jsx)(i.qG,{className:"hash",label:p||j("signature {{type}}",{replace:{type:S?`(${S})`:""}}),value:E,withCopy:!0}),g&&(0,a.jsx)(i.qG,{className:"mortality",label:j("lifetime"),value:g}),b?.gtn(0)&&(0,a.jsx)(i.qG,{className:"tip",label:j("tip"),value:(0,a.jsx)(o.Z,{value:b})})]})]})})}))},15991:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(52322),s=n(2784),i=n(64348),r=n(98988);const o=s.memo((function({children:e,className:t="",isHeader:n,labelHash:o,labelSignature:l,mortality:c,onError:d,stringId:u,tip:m,value:h,withBorder:p,withHash:g,withSignature:f}){const b=(0,s.useMemo)((()=>h?.callIndex?h.registry.findMetaCall(h.callIndex):null),[h]);if(!b||!h)return null;const{meta:x,method:A,section:v}=b,w=`${v}.${A}`;return(0,a.jsx)("div",{className:`${t} ui--CallExpander`,children:(0,a.jsxs)(i.xH,{isHeader:n,isLeft:!0,summaryHead:(0,a.jsxs)(a.Fragment,{children:[u&&`#${u}: `,w]}),summaryMeta:x,children:[(0,a.jsx)(r.Z,{callName:w,labelHash:o,labelSignature:l,mortality:c,onError:d,tip:m,value:h,withBorder:p,withExpander:!0,withHash:g,withSignature:f}),e]})})}))},98202:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(52322),s=n(2784),i=n(64348),r=n(11798),o=n(86353),l=n(48653),c=n(37750);const d=s.memo((function({children:e,className:t="",eventName:n,value:d,withExpander:u}){const{t:m}=(0,c.$)(),h=d.data.names,p=d.typeDef.map(((e,t)=>({name:h?.[t]||void 0,type:e}))),g=d.data.map((e=>({isValid:!0,value:e}))),f=(0,s.useMemo)((()=>n&&l._o.includes(n)?l.fr:void 0),[n]),b=(0,s.useMemo)((()=>{if("contracts"===d.section&&"ContractExecution"===d.method&&2===d.data.length){const[e,t]=d.data;try{const n=(0,r.oX)(e.toString());if(n){const e=n.decodeEvent(t);return{...e,values:e.args.map((e=>({isValid:!0,value:e})))}}}catch(e){console.error(e)}}return null}),[d]);return(0,a.jsxs)("div",{className:`${t} ui--Event`,children:[e,(0,a.jsx)(o.ZP,{isDisabled:!0,overrides:f,params:p,registry:d.registry,values:g,withExpander:u,children:b&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.II,{isDisabled:!0,label:m("contract event"),value:b.event.identifier}),(0,a.jsx)(o.ZP,{isDisabled:!0,params:b.event.args,registry:d.registry,values:b.values})]})})]})}))},60404:(e,t,n)=>{n.d(t,{Z:()=>y});var a=n(52322),s=n(2784),i=n(64348),r=n(86353),o=n(6046),l=n(33403),c=n(1346),d=n(90778),u=n(54371),m=n(82671);const h=s.memo((function({className:e="",defaultArgs:t,defaultValue:n,isDisabled:i,isError:r,isPrivate:o,label:l,onChange:c,onEnter:d,onEscape:u,withLabel:m}){const h=(0,s.useCallback)((e=>c&&c({isValid:!!e,value:e})),[c]);return(0,a.jsx)(y,{className:e,defaultArgs:t,defaultValue:n,isDisabled:i,isError:r,isPrivate:o,label:l,onChange:h,onEnter:d,onEscape:u,withLabel:m})}));function p(e){return e.map((e=>({isValid:!0,value:e})))}function g(e,t,n){try{return n?.value?(a=n.value,(0,u.H)(a.section)&&(0,u.H)(a.method)?{initialArgs:p(n.value.args),initialValue:e.tx[n.value.section][n.value.method]}:function(e){return(0,m.K)(e.method)&&(0,u.H)(e.method.section)&&(0,u.H)(e.method.method)}(n.value)?{initialArgs:p(n.value.method.args),initialValue:e.tx[n.value.method.section][n.value.method.method]}:{initialValue:n.value}):{initialValue:t}}catch{return{initialValue:t}}var a}const f=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:r,onChange:o,onEnter:l,onEscape:c,withLabel:u}){const{api:m,apiDefaultTx:p}=(0,d.h)(),[{initialArgs:f,initialValue:b}]=(0,s.useState)((()=>g(m,p,t)));return(0,a.jsx)(h,{className:e,defaultArgs:f,defaultValue:b,isDisabled:n,isError:i,isPrivate:!1,label:r,onChange:o,onEnter:l,onEscape:c,withLabel:u})})),b={Call:f,OpaqueCall:s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:r,onChange:o,onEnter:l,onEscape:c,withLabel:u}){const{api:m,apiDefaultTxSudo:p}=(0,d.h)(),[{initialArgs:f,initialValue:b}]=(0,s.useState)((()=>g(m,p,t))),x=(0,s.useCallback)((({isValid:e,value:t})=>{let n=null;e&&t&&(n=t.method.toHex()),o&&o({isValid:e,value:n})}),[o]);return(0,a.jsx)(h,{className:e,defaultArgs:f,defaultValue:b,isDisabled:n,isError:i,isPrivate:!0,label:r,onChange:x,onEnter:l,onEscape:c,withLabel:u})})),Proposal:s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:r,onChange:o,onEnter:l,onEscape:c,withLabel:u}){const{api:m,apiDefaultTxSudo:p}=(0,d.h)(),[{initialArgs:f,initialValue:b}]=(0,s.useState)((()=>g(m,p,t))),x=(0,s.useCallback)((({isValid:e,value:t})=>{let n=null;e&&t&&(n=m.createType("Proposal",t)),o&&o({isValid:e,value:n})}),[m,o]);return(0,a.jsx)(h,{className:e,defaultArgs:f,defaultValue:b,isDisabled:n,isError:i,isPrivate:!0,label:r,onChange:x,onEnter:l,onEscape:c,withLabel:u})})),RuntimeCall:f};var x=n(48653);const A=(0,l.Z)({},b,x.fQ);function v({meta:e}){return e.args.map((({name:e,type:t,typeName:n})=>({name:e.toString(),type:{...(0,o.s)(t.toString()),...n.isSome?{typeName:n.unwrap().toString()}:{}}})))}function w(e,t=[]){return{extrinsic:{fn:e,params:v(e)},values:t}}const y=s.memo((function({defaultArgs:e,defaultValue:t,filter:n,isDisabled:o,isError:l,isPrivate:d,label:u,onChange:m,onEnter:h,onError:p,onEscape:g,withLabel:f}){const[{extrinsic:v,values:y},j]=(0,s.useState)((()=>w(t,e)));(0,s.useEffect)((()=>{const e=function(e,t){return t.reduce(((e,t)=>e&&!(0,c.o)(t)&&!(0,c.o)(t.value)&&t.isValid),e.length===t.length)}(v.params,y);let t;if(e)try{t=v.fn(...y.map((({value:e})=>e)))}catch(e){p&&p(e)}else p&&p(null);m(t)}),[v,m,p,y]);const C=(0,s.useMemo)((()=>x.xS.includes(`${v.fn.section}.${v.fn.method}`)?A:b),[v]),k=(0,s.useCallback)((e=>j((t=>e.section===t.extrinsic.fn.section&&e.method===t.extrinsic.fn.method?t:w(e)))),[]),N=(0,s.useCallback)((e=>j((({extrinsic:t})=>({extrinsic:t,values:e})))),[]),{fn:{method:E,section:S},params:I}=v;return(0,a.jsxs)("div",{className:"extrinsics--Extrinsic",children:[(0,a.jsx)(i.UT,{defaultValue:t,filter:n,isDisabled:o,isError:l,isPrivate:d,label:u,onChange:k,withLabel:f}),(0,a.jsx)(r.ZP,{onChange:N,onEnter:h,onEscape:g,overrides:C,params:I,values:y},`${S}.${E}:params`)]})}))},81661:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(52322),s=n(2784),i=n(54371),r=n(1346),o=n(14681),l=n(37750),c=n(15991);const d=s.memo((function({className:e="",idNumber:t,proposal:n}){const{t:s}=(0,l.$)(),d=(0,i.H)(t)||(0,r.o)(t)?t:(0,o.u)(t);return n?(0,a.jsx)("div",{className:`${e} ui--ProposedAction`,children:(0,a.jsx)(c.Z,{isHeader:!0,labelHash:s("preimage"),stringId:d,value:n,withHash:!0})}):(0,a.jsx)("div",{className:`${e} ui--ProposedAction`,children:(0,a.jsxs)("div",{children:[d?`#${d}: `:"",s("No execution details available for this proposal")]})})}))},40943:(e,t,n)=>{n.d(t,{Z:()=>c});var a=n(52322),s=n(2784),i=n(44294),r=n(48801),o=n.n(r),l=n(50005);const c=s.memo((function({className:e="",defaultValue:{value:t},isDisabled:n,isError:r,label:c,onChange:d,onEnter:u,onEscape:m,withLabel:h}){const[p,g]=(0,s.useState)(!1),[f]=(0,s.useState)((()=>new(o())((t||"0").toString()).toString(10))),b=(0,s.useCallback)((e=>{const t=!r&&!!e;d&&d({isValid:t,value:e}),g(t)}),[r,d]);return(0,a.jsx)(l.Z,{className:e,children:(0,a.jsx)(i.Z,{className:"full",defaultValue:f,isDisabled:n,isError:r||!p,label:c,onChange:b,onEnter:u,onEscape:m,withEllipsis:!0,withLabel:h})})}))},50005:(e,t,n)=>{n.d(t,{Z:()=>s});var a=n(52322);const s=n(2784).memo((function({children:e,className:t=""}){return(0,a.jsx)("div",{className:`${t} ui--row --relative`,children:e})}))},86353:(e,t,n)=>{n.d(t,{ZP:()=>nt});var a=n(52322),s=n(2784),i=n(95267),r=n(64348),o=n(11147),l=n(37245),c=n(6046),d=n(67557),u=n(1346),m=n(23601),h=n(6485),p=n(69187),g=n(50005),f=n(27113),b=n(82671);function x(e,t){return(0,c.s)(e.createType(t.type).toRawType()).sub}const A=s.memo((function(e){const{className:t="",defaultValue:n,isDisabled:i,isError:o,label:l,onChange:c,overrides:d,registry:u,type:m,withLabel:h}=e,[{options:p,subTypes:A}]=(0,s.useState)((()=>function(e,t){const n=x(e,t).filter((({name:e})=>!!e&&!e.startsWith("__Unused")));return{options:n.map((({name:e})=>({text:e,value:e}))),subTypes:n}}(u,m))),[v,w]=(0,s.useState)((()=>function(e,t,n,a){const s=x(e,t);return n.value instanceof f.x?[{name:n.value.type,type:s[n.value.index]}]:[{name:a[0].name,type:a[0]}]}(u,m,n,A))),[{initialEnum:y,initialParams:j},C]=(0,s.useState)((()=>function(e,t){if(e?.value){if(e.value instanceof f.x)return{initialEnum:e.value.type,initialParams:[{isValid:!0,value:e.value.inner}]};if((0,b.K)(e.value)){const[n,a]=Object.entries(e.value)[0];if(t.some((({value:e})=>e===n)))return{initialEnum:n,initialParams:[{isValid:!0,value:a}]}}}return{initialEnum:t[0]?.value,initialParams:void 0}}(n,p))),k=(0,s.useCallback)((e=>{if(i)return;const t=A.find((({name:t})=>t===e))||null;w(t?[{name:t.name,type:t}]:null),t&&C((e=>t.name===e.initialEnum?e:{initialEnum:e.initialEnum,initialParams:null}))}),[i,A]),N=(0,s.useCallback)((([{isValid:e,value:t}])=>{i||v&&c&&c({isValid:e,value:{[v[0].name||"unknown"]:t}})}),[v,i,c]);return(0,a.jsxs)(g.Z,{className:t,children:[(0,a.jsx)(r.Lt,{className:"full",defaultValue:y,isDisabled:i,isError:o,label:l,onChange:k,options:p,withEllipsis:!0,withLabel:h}),v&&(0,a.jsx)(nt,{isDisabled:i,isError:o,onChange:N,overrides:d,params:v,registry:u,values:j})]})}));function v(e){if(e)try{return p.Nn.decodeAddress(e),!0}catch(e){console.error(e)}return!1}const w=s.memo((function(e){const{className:t="",defaultValue:{value:n},isDisabled:i,isError:o,label:l,onChange:c,type:d,withLabel:u}=e,[m]=(0,s.useState)((()=>n?.toString())),h=(0,s.useCallback)((e=>c&&c({isValid:v(e),value:e})),[c]);return"MultiAddress"!==d.type||i&&n&&"Id"===n.type?(0,a.jsx)(g.Z,{className:t,children:(0,a.jsx)(r.rp,{className:"full",defaultValue:m,isDisabled:i,isError:o,isInput:!0,label:l,onChange:h,placeholder:"5...",type:"allPlus",withEllipsis:!0,withLabel:u})}):(0,a.jsx)(A,{...e})}));var y=n(14681),j=n(12372);const C=s.memo((function({className:e="",defaultValue:{value:t},isDisabled:n,isError:i,label:o,onChange:l,onEnter:c,registry:d,type:m,withLabel:h}){const p=(0,s.useMemo)((()=>/^i\d*$/.test(m.type)),[m]),f=(0,s.useMemo)((()=>n?t instanceof d.createClass("AccountIndex")?t.toString():(0,y.u)(t):(0,j.G)(t||0).toString()),[n,d,t]),b=(0,s.useMemo)((()=>function(e,{type:t}){try{return e.createType(t).bitLength()}catch{return 32}}(d,m)),[d,m]),x=(0,s.useCallback)((e=>l&&l({isValid:!(0,u.o)(e),value:e})),[l]);return(0,a.jsx)(g.Z,{className:e,children:n?(0,a.jsx)(r.II,{className:"full",defaultValue:f,isDisabled:!0,label:o,withEllipsis:!0,withLabel:h}):(0,a.jsx)(r.Rn,{bitLength:b,className:"full",defaultValue:f,isError:i,isSigned:p,isZeroable:!0,label:o,onChange:x,onEnter:c,withLabel:h})})}));var k=n(40943),N=n(68774),E=n(5122);function S(e,t){if(e)try{return t?(0,N.u)(e):(0,E.Y)(e)}catch(e){console.error(e)}return!1}const I=s.memo((function(e){const{bytesLength:t,className:n="",defaultValue:{value:i},isDisabled:o,isError:l,label:c,onChange:d}=e,[u]=(0,s.useState)((()=>i?.toString())),m=(0,s.useCallback)((e=>d&&d({isValid:S(e,20===t),value:e})),[t,d]);return(0,a.jsx)(g.Z,{className:n,children:(0,a.jsx)(r.bm,{bytesLength:t,className:"full",defaultValue:u,forceIconType:20===t?"ethereum":"substrate",isDisabled:o,isError:l,label:c,noConvert:!0,onChange:m,placeholder:20===t?"0x1...":"5..."})})})),B=s.memo((function(e){return(0,a.jsx)(I,{...e,bytesLength:20})})),D=s.memo((function(e){return(0,a.jsx)(I,{...e,bytesLength:32})}));var L=n(47538),V=n(37750);const P=s.memo((function({className:e="",defaultValue:{value:t},isDisabled:n,isError:i,label:o,onChange:l,withLabel:c}){const{t:d}=(0,V.$)(),[u]=(0,s.useState)(t instanceof Boolean?t.valueOf():!!(0,L.j)(t)&&t),m=(0,s.useRef)([{text:d("No"),value:!1},{text:d("Yes"),value:!0}]),h=(0,s.useCallback)((e=>l&&l({isValid:!0,value:e})),[l]);return(0,a.jsx)(g.Z,{className:e,children:(0,a.jsx)(r.Lt,{className:"full",defaultValue:u,isDisabled:n,isError:i,label:o,onChange:h,options:m.current,withEllipsis:!0,withLabel:c})})}));var T=n(88311),M=n(48533),F=n(70676),z=n(64021),Z=n(46610),R=n(56623),$=n(55858),q=n(74076),U=n(94175);const H=()=>!0,Q=(0,r.zo)(g.Z)` + .ui--InputAddressSimpleIcon { + background: #eee; + border: 1px solid #888; + border-radius: 50%; + left: -16px; + position: absolute; + top: 8px; + } +`,O=s.memo((function({asHex:e,children:t,className:n="",defaultValue:{value:i},isDisabled:o,isError:l,label:c,labelExtra:d,length:u=-1,onChange:m,onEnter:h,onEscape:p,size:g="full",validate:f=H,withCopy:b,withLabel:x,withLength:A}){const{t:v}=(0,V.$)(),[w]=(0,s.useState)((()=>{if(i){const e=(0,Z.Y)(i);return(0,F._)(e)?(0,R.z)(e):(0,$.c)(e)}})),[{isAddress:y,isValid:j,lastValue:C},k]=(0,s.useState)((()=>({isAddress:!1,isValid:(0,q.vq)(w)||(0,F._)(w)}))),N=(0,s.useCallback)((t=>{let[n,a,s]=function(e){if("0x"===e)return[!0,!1,new Uint8Array([])];if(e.startsWith("0x"))try{return[!0,!1,(0,M.G)(e)]}catch{return[!1,!1,new Uint8Array([])]}try{return[!0,!0,(0,U.m)(e)]}catch{}return(0,F._)(e)?[!0,!1,(0,z.d)(e)]:["0x"===e,!1,new Uint8Array([])]}(t);n=n&&f(s)&&(-1!==u?s.length===u:0!==s.length||"0x"===t),A&&n&&(s=(0,T.N)(s)),m&&m({isValid:n,value:e?(0,$.c)(s):s}),k({isAddress:a,isValid:n,lastValue:s})}),[e,u,m,f,A]);return(0,a.jsx)(Q,{className:n,children:(0,a.jsxs)(r.II,{className:g,defaultValue:w,isAction:!!t,isDisabled:o,isError:l||!j,label:c,labelExtra:d,onChange:N,onEnter:h,onEscape:p,placeholder:v("0x prefixed hex, e.g. 0x1234 or ascii data"),type:"text",withEllipsis:!0,withLabel:x,children:[t,b&&(0,a.jsx)(r.qi,{value:w}),y&&(0,a.jsx)(r.k,{className:"ui--InputAddressSimpleIcon",size:32,value:C})]})})})),W=s.memo((function({className:e="",isDisabled:t,isError:n=!1,label:s,labelExtra:i,onChange:o,placeholder:l,withLabel:c}){return(0,a.jsx)(g.Z,{className:e,children:(0,a.jsx)(r.ht,{isDisabled:t,isError:n,label:s,labelExtra:i,onChange:o,placeholder:l,withEllipsis:!0,withLabel:c})})})),G=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:o,name:l,onChange:c,onEnter:d,onEscape:u,type:m,withLabel:h}){const{t:p}=(0,V.$)(),[g,f]=(0,s.useState)(!1),[b,x]=(0,s.useState)(!1),A=(0,s.useCallback)((e=>{const t=0!==e.length;c&&c({isValid:t,value:(0,T.N)(e)}),f(t)}),[c]),v=!n&&(0,a.jsx)(r.ZD,{label:p("file upload"),onChange:x,value:b});return(0,a.jsx)("div",{className:`${e} --relative`,children:!n&&b?(0,a.jsx)(W,{isDisabled:n,isError:i||!g,label:o,labelExtra:v,onChange:A,withLabel:h}):(0,a.jsx)(O,{defaultValue:t,isDisabled:n,isError:i,label:o,labelExtra:v,length:-1,name:l,onChange:c,onEnter:d,onEscape:u,type:m,withLabel:h,withLength:!0})})}));var J=n(98988),K=n(83488);const Y=(0,r.zo)(g.Z)` + pre { + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + } + + .ui--Static { + margin-bottom: 0 !important; + } +`,X=s.memo((function({asHex:e,children:t,childrenPre:n,className:i="",defaultValue:o,isOptional:l,label:c}){const{t:d}=(0,V.$)(),u=(0,s.useMemo)((()=>!!o?.value&&(e?o.value.toHex():(0,K.k)(o.value.toHuman?o.value.toHuman():o.value))),[e,o]);return(0,a.jsxs)(Y,{className:i,children:[n,(0,a.jsx)(r.qG,{className:"full",label:c,value:(0,a.jsx)("pre",{children:u||(l?(0,a.jsx)(a.Fragment,{children:" "}):d(""))})}),t]})})),_=s.memo((function(e){const{className:t="",defaultValue:n,isDisabled:s,isError:i,label:r,name:o,onChange:l,onEnter:c,onEscape:d,type:u}=e;return s?(0,a.jsx)(X,{...e}):(0,a.jsx)(O,{asHex:!0,className:t,defaultValue:n,isDisabled:s,isError:i,label:r,length:-1,name:o,onChange:l,onEnter:c,onEscape:d,type:u})})),ee=s.memo((function(e){const{t}=(0,V.$)(),{className:n="",defaultValue:{value:s},isDisabled:i,label:o,withLabel:l}=e;if(!i)return(0,a.jsx)(_,{...e});const c=s,{method:d,section:u}=c.registry.findMetaCall(c.callIndex),m=`${u}.${d}`;return(0,a.jsxs)(g.Z,{children:[(0,a.jsx)(r.qG,{className:`${n} full`,label:o,withLabel:l,children:m}),(0,a.jsx)(J.Z,{callName:m,labelHash:t("call hash / {{section}}.{{method}}",{replace:{method:d,section:u}}),value:c,withHash:!0})]})}));var te=n(24107),ne=n(67292),ae=n(45409);const se=s.memo((function({children:e,className:t="",isOuter:n,label:s,labelExtra:i,size:o="full",withLabel:l}){return(0,a.jsxs)(g.Z,{className:t,children:[(0,a.jsx)(r.jN,{className:o,isOuter:!0,label:s,labelExtra:i,withEllipsis:!0,withLabel:l,children:!n&&e}),n&&e]})}));const ie=(0,n(11677).e)("useParamDefs",(function(e,t){return(0,s.useMemo)((()=>function(e,t){const n=function(e,t){try{return(0,c.s)(e.createType(t.type).toRawType())}catch{return t}}(e,t);return n.sub?(Array.isArray(n.sub)?n.sub:[n.sub]).map((e=>({length:n.length,name:e.name,type:e}))):[]}(e,t)),[e,t])})),re=s.memo((function(e){const t=ie(e.registry,e.type),{className:n="",defaultValue:i,isDisabled:r,label:o,onChange:l,overrides:c,withLabel:d}=e,[u]=(0,s.useState)((()=>function({isValid:e,value:t}){return e&&(0,te.c)(t)&&t instanceof ae.A?t.toArray().map((e=>({isValid:!0,value:e}))):void 0}(i))),m=(0,s.useCallback)((e=>{r||l&&l({isValid:e.reduce(((e,{isValid:t})=>e&&t),!0),value:t.reduce(((t,{name:n},a)=>(t[n||"unknown"]=e[a].value,t)),{})})}),[r,t,l]);return(0,a.jsxs)("div",{className:"ui--Params-Struct",children:[(0,a.jsx)(se,{className:n,label:o,withLabel:d}),(0,a.jsx)(nt,{isDisabled:r,onChange:m,overrides:c,params:t,registry:e.registry,values:u})]})})),oe=s.memo((function(e){const{className:t="",defaultValue:n,isDisabled:i,isError:o,label:l,onChange:c,withLabel:d}=e,[u,m]=(0,s.useState)(!1),[h]=(0,s.useState)((()=>i&&n&&(0,te.c)(n.value)?(0,ne.c)(n.value):null)),[p]=(0,s.useState)((()=>i||!n||(0,te.c)(n.value))),f=(0,s.useCallback)((e=>{const t=(0,ne.h)(e),n=!!t;c&&c({isValid:n,value:t}),m(n)}),[c]);return h?(0,a.jsx)(X,{...e,children:(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:"ipfs",type:"text",value:h,withLabel:d})}):p?(0,a.jsx)(re,{...e}):(0,a.jsx)(g.Z,{className:t,children:(0,a.jsx)(r.II,{className:"full",isDisabled:i,isError:o||!u,label:l,onChange:f,placeholder:"IPFS compatible CID",type:"text",withLabel:d})})}));var le=n(6226);const ce=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:r,onChange:o,onEnter:l,onEscape:c,registry:d,type:u,withLabel:m}){const[h,p]=(0,s.useState)(!1),g=(0,s.useCallback)((e=>{const t=(0,le.F)(e);o&&o({isValid:t,value:e}),p(t)}),[o]);return n?(0,a.jsx)(G,{className:e,defaultValue:t,isError:i||!h,label:r,onEnter:l,onEscape:c,registry:d,type:u,withLabel:m}):(0,a.jsx)(W,{className:e,defaultValue:t,isError:i||!h,label:r,onChange:g,withLabel:m})})),de=s.memo((function(e){const{t}=(0,V.$)(),[{details:n,type:i},o]=(0,s.useState)({});return(0,s.useEffect)((()=>{const{value:t}=e.defaultValue||{};if(function(e){return!(!e||!e.isModule&&!e.isToken)}(t))if(t.isModule)try{const e=t.asModule,{docs:n,name:a,section:s}=e.registry.findMetaError(e);return o({details:n.join(", "),type:`${s}.${a}`})}catch(e){console.error(e)}else if(t.isToken)return o({details:t.asToken.type,type:t.type});o({details:null})}),[e.defaultValue]),e.isDisabled&&n?(0,a.jsxs)(X,{...e,children:[(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("type"),value:i}),n&&(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("details"),value:n})]}):(0,a.jsx)(_,{...e})})),ue=s.memo((function(e){const{defaultValue:t,isDisabled:n,label:i}=e,o=(0,s.useMemo)((()=>{return t&&(e=t.value)&&e.isErr?{isValid:!0,value:t.value.asErr}:null;var e}),[t]);return n?o?(0,a.jsx)(de,{...e,childrenPre:(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:i,value:"Err"}),defaultValue:o,label:"DispatchError"}):(0,a.jsx)(X,{...e,defaultValue:{isValid:!0,value:"Ok"}}):(0,a.jsx)(_,{...e})})),me=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:s,label:i,name:r,onChange:o,onEnter:l,onEscape:c,type:d,withLabel:u}){return(0,a.jsx)(O,{asHex:!0,className:e,defaultValue:t,isDisabled:n,isError:s,label:i,length:20,name:r,onChange:o,onEnter:l,onEscape:c,type:d,withCopy:n,withLabel:u})})),he=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:o,name:l,onChange:c,onEnter:d,onEscape:u,registry:m,type:h,withLabel:p}){const{t:g}=(0,V.$)(),[f,b]=(0,s.useState)(!1),[x,A]=(0,s.useState)(null),v=(0,s.useCallback)((e=>{const t=m.hash(e);A((0,$.c)(t)),c&&c({isValid:!0,value:t})}),[c,m]),w=(0,s.useCallback)((e=>{A(null),b(e)}),[b,A]),y=!n&&(0,a.jsx)(r.ZD,{label:g("hash a file"),onChange:w,value:f});return(0,a.jsx)("div",{className:e,children:!n&&f?(0,a.jsx)(W,{isDisabled:n,isError:i,label:o,labelExtra:y,onChange:v,placeholder:x||void 0,withLabel:p}):(0,a.jsx)(O,{asHex:!0,defaultValue:t,isDisabled:n,isError:i,label:o,labelExtra:y,length:32,name:l,onChange:c,onEnter:d,onEscape:u,type:h,withCopy:n,withLabel:p})})})),pe=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:s,label:i,name:r,onChange:o,onEnter:l,onEscape:c,type:d,withLabel:u}){return(0,a.jsx)(O,{asHex:!0,className:e,defaultValue:t,isDisabled:n,isError:s,label:i,length:64,name:r,onChange:o,onEnter:l,onEscape:c,type:d,withCopy:n,withLabel:u})}));var ge=n(51330);function fe(e,t=!1){let n,a=!1;try{n=(0,M.G)(e.toString()),a=t||0!==n.length}catch{n=new Uint8Array([])}return{isValid:a,u8a:(0,T.N)(n)}}const be=s.memo((function({className:e="",isDisabled:t,label:n,onChange:i,onEnter:o,withLabel:l}){const[,c]=(0,s.useState)(!1),[d,u]=(0,s.useState)((()=>({isValid:!1,u8a:new Uint8Array([])}))),[m,h]=(0,s.useState)((()=>({isValid:!1,u8a:new Uint8Array([])})));(0,s.useEffect)((()=>{const e=d.isValid&&m.isValid;i&&i({isValid:e,value:(0,ge.e)(d.u8a,m.u8a)}),c(e)}),[d,i,m]);const p=(0,s.useCallback)((e=>u(fe(e))),[]),f=(0,s.useCallback)((e=>h(fe(e,!0))),[]);return(0,a.jsxs)(g.Z,{className:e,children:[(0,a.jsx)(r.II,{className:"medium",isDisabled:t,isError:!d.isValid,label:n,onChange:p,placeholder:"0x...",type:"text",withLabel:l}),(0,a.jsx)(r.II,{className:"medium",isDisabled:t,isError:!m.isValid,onChange:f,onEnter:o,placeholder:"0x...",type:"text",withLabel:l})]})}));var xe=n(48731);const Ae={info:0,type:"Bytes"},ve=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:r,onChange:o,onEnter:l,onEscape:c,registry:d,withLabel:u}){const{t:m}=(0,V.$)(),[h,p]=(0,s.useState)(m("click to select or drag and drop JSON key/value (hex-encoded) file")),g=(0,s.useCallback)((e=>{let t={isValid:!1,value:[]};try{t=function(e){const t=JSON.parse((0,R.z)(e)),n=Object.keys(t);let a=0!==n.length;const s=n.map((e=>{const n=t[e];(0,xe.hu)((0,q.vq)(e)&&(0,q.vq)(n),`Non-hex key/value pair found in ${e.toString()} => ${n.toString()}`);const s=fe(e),i=fe(n,!0);return a=a&&s.isValid&&i.isValid,[s.u8a,i.u8a]}));return{isValid:a,value:s}}(e),p(m("{{count}} key/value pairs encoded for submission",{replace:{count:t.value.length}}))}catch(e){console.error("Error converting json k/v",e),p(m("click to select or drag and drop JSON key/value (hex-encoded) file"))}o&&o(t)}),[o,m]);if(n){const n=t.value;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(se,{className:e,label:r,children:(0,a.jsx)("div",{})}),(0,a.jsx)("div",{className:"ui--Params",children:n.map((([e,t])=>{const n=(0,$.c)(e.toU8a(!0));return(0,a.jsx)(G,{defaultValue:{value:t},isDisabled:!0,label:n,name:n,onEnter:l,onEscape:c,registry:d,type:Ae},n)}))})]})}return(0,a.jsx)(W,{className:e,isDisabled:n,isError:i,label:r,onChange:g,placeholder:h,withLabel:u})})),we=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,label:o,onChange:l,onEnter:c,onEscape:d,registry:u,type:m,withLabel:h}){const p=(0,s.useCallback)((e=>l&&l(e)),[l]);return n?(0,a.jsx)(r.qG,{className:e,defaultValue:t?.value?t.value.toString():"",isError:i,label:o,withLabel:h}):(0,a.jsx)(C,{className:e,defaultValue:t,isDisabled:n,isError:i,label:o,onChange:p,onEnter:c,onEscape:d,registry:u,type:m,withLabel:h})})),ye=s.memo((function({onChange:e}){return(0,s.useEffect)((()=>{e&&e({isValid:!0,value:null})}),[e]),null})),je=s.memo((function(e){if(!e.isDisabled)return(0,a.jsx)(_,{...e});const t=e.registry.createType("Call",e.defaultValue.value.toHex());return(0,a.jsx)(ee,{...e,defaultValue:{isValid:!0,value:t}})}));var Ce=n(37602),ke=n(48358);const Ne={isValid:!0,value:void 0},Ee=new Uint8Array([1]),Se=s.memo((function({className:e="",defaultValue:t,isDisabled:n,label:i,onChange:o,onEnter:c,onEscape:d,registry:u,type:{sub:m,withOptionActive:h},withLabel:p}){const{t:g}=(0,V.$)(),[f,b]=(0,s.useState)((()=>h||!!(t&&t.value instanceof Ce.W&&t.value.isSome)||!1)),[x]=(0,s.useState)((()=>f||n?t&&(t.value instanceof Ce.W&&t.value.isSome?{isValid:t.isValid,value:t.value.unwrap()}:Ne):Ne));(0,s.useEffect)((()=>{!f&&o&&o({isValid:!0,value:null})}),[f,o]);const A=(0,s.useCallback)((e=>o&&o(e.isValid&&(0,ke.U)(e.value)&&!h&&f?{isValid:!0,value:(0,ge.e)(Ee,e.value)}:e)),[f,o,h]);return(0,a.jsxs)("div",{className:`${e} --relative`,children:[(0,a.jsx)(se,{className:"--relative",label:i,labelExtra:!n&&(0,a.jsx)(r.ZD,{label:g("include option"),onChange:b,value:f}),withLabel:p}),(0,a.jsx)(l.Z,{children:(0,a.jsx)("div",{className:"ui--Params-Content",children:f?(0,a.jsx)(_e,{defaultValue:x,isDisabled:n||!f,isOptional:!f&&!n,onChange:A,onEnter:c,onEscape:d,registry:u,type:m}):(0,a.jsx)(X,{defaultValue:Ne,isOptional:!0,label:"None"})})})]})})),Ie=s.memo((function({className:e="",defaultValue:{value:t},isDisabled:n,isError:i,label:o,onChange:l,onEnter:c,onEscape:d,withLabel:u}){const[m,h]=(0,s.useState)(!1),p=(0,s.useCallback)((e=>{const t=0!==e.length;l&&l({isValid:t,value:e}),h(t)}),[l]),f=t?t.toHex?t.toHex():t:"";return(0,a.jsx)(g.Z,{className:e,children:(0,a.jsx)(r.II,{className:"full",defaultValue:f,isDisabled:n,isError:i||!m,label:o,onChange:p,onEnter:c,onEscape:d,placeholder:"Hex data",type:"text",withLabel:u})})})),Be=s.memo((function({className:e="",defaultValue:{value:t},isDisabled:n,isError:i,label:o,onChange:l,onEnter:c,onEscape:d,withLabel:u}){const[m,h]=(0,s.useState)(!1),p=(0,s.useCallback)((e=>{const t=0!==e.length;l&&l({isValid:t,value:e}),h(t)}),[l]),f=(t||"").toString();return(0,a.jsx)(g.Z,{className:e,children:(0,a.jsx)(r.II,{className:"full",defaultValue:f,isDisabled:n,isError:i||!m,label:o,onChange:p,onEnter:c,onEscape:d,placeholder:"",type:"text",withLabel:u})})}));var De=n(71285);const Le=s.memo((function(e){const{className:t="",defaultValue:n,isDisabled:i,label:r,onChange:o,overrides:l,registry:c,type:d,withLabel:u}=e,m=ie(c,d),[h]=(0,s.useState)((()=>function({value:e}){return e instanceof De.p?e.map((e=>({isValid:!0,value:e}))):e}(n))),p=(0,s.useCallback)((e=>{i||o&&o({isValid:e.reduce(((e,{isValid:t})=>e&&t),!0),value:e.map((({value:e})=>e))})}),[i,o]);return(0,a.jsxs)("div",{className:"ui--Params-Tuple",children:[(0,a.jsx)(se,{className:t,label:r,withLabel:u}),(0,a.jsx)(nt,{isDisabled:i,onChange:p,overrides:l,params:m,registry:c,values:h})]})}));var Ve=n(95292);const Pe=[];function Te(e,t){if(t.info===m.u.Vec)return[Te(e,t.sub)];if(t.info===m.u.Tuple)return Array.isArray(t.sub)?t.sub.map((t=>Te(e,t))):[];if(t.info===m.u.Struct)return Array.isArray(t.sub)?t.sub.reduce(((t,n)=>(t[n.name||"unknown"]=Te(e,n),t)),{}):{};if(t.info===m.u.Enum)return Array.isArray(t.sub)?{[t.sub[0].name||"unknown"]:Te(e,t.sub[0])}:{};const n=[m.u.Compact,m.u.Option].includes(t.info)?t.sub.type:t.type;switch(n){case"AccountIndex":case"Balance":case"BalanceOf":case"BlockNumber":case"Compact":case"Gas":case"Index":case"Nonce":case"ParaId":case"PropIndex":case"ProposalIndex":case"ReferendumIndex":case"i8":case"i16":case"i32":case"i64":case"i128":case"u8":case"u16":case"u32":case"u64":case"u128":case"VoteIndex":case"Moment":return Ve.nw;case"bool":return!1;case"Bytes":case"AccountId":case"AccountId20":case"AccountId32":case"AccountIdOf":case"Address":case"Call":case"CandidateReceipt":case"Digest":case"Header":case"KeyValue":case"LookupSource":case"MisbehaviorReport":case"Proposal":case"RuntimeCall":case"Signature":case"SessionKey":case"StorageKey":case"ValidatorId":return;case"String":case"Text":case"Raw":case"Keys":return"";case"Vote":return-1;case"VoteThreshold":return 0;case"BlockHash":case"CodeHash":case"Hash":case"H256":return e.createType("H256");case"H512":return e.createType("H512");case"H160":return e.createType("H160");case"Extrinsic":return e.createType("Raw");case"Null":return null;default:{let a=null;try{const t=e.createType(n),a=(0,c.s)(t.toRawType());if((0,h.H)(t))return Ve.nw;if([m.u.Struct].includes(a.info))return;if([m.u.Enum,m.u.Tuple].includes(a.info))return Te(e,a)}catch(e){a=e.message}return Pe.includes(n)||(Pe.push(n),a&&console.error(`params: initValue: ${a}`),console.info(`params: initValue: No default value for type ${n} from ${JSON.stringify(t)}, using defaults`)),"0x"}}}function Me([{name:e,type:t}],n){return{name:`${n}: ${e||t.type}`,type:t}}function Fe(e,t,n){if(t.length===n||(0,u.o)(n))return t;const a=[];for(let t=0;t(0,u.o)(e)||(0,u.o)(e.isValid)?{isValid:!(0,u.o)(e),value:e}:e)):[]}const Ze=s.memo((function({className:e="",defaultValue:t,isDisabled:n=!1,label:i,onChange:o,overrides:l,registry:c,type:d,withLabel:m}){const{t:h}=(0,V.$)(),p=ie(c,d),[g,f]=(0,s.useState)((()=>ze(t))),[b,x]=(0,s.useState)((()=>g.length)),[A,v]=(0,s.useState)((()=>Fe(p,[],b)));(0,s.useEffect)((()=>{p.length&&v((e=>Fe(p,e,n?(t.value||[]).length:b)))}),[b,t,n,p]),(0,s.useEffect)((()=>{!n&&p.length&&f((e=>{if(e.length===b)return e;for(;e.length{o&&o({isValid:g.reduce(((e,{isValid:t})=>e&&t),!0),value:g.map((({value:e})=>e))})}),[g,o]);const w=(0,s.useCallback)((()=>x((e=>e+1))),[]),y=(0,s.useCallback)((()=>x((e=>e-1))),[]);return(0,a.jsxs)(se,{className:e,isOuter:!0,label:i,withLabel:m,children:[!n&&(0,a.jsxs)("div",{className:"ui--Param-Vector-buttons",children:[(0,a.jsx)(r.zx,{icon:"plus",label:h("Add item"),onClick:w}),(0,a.jsx)(r.zx,{icon:"minus",isDisabled:0===g.length,label:h("Remove item"),onClick:y})]}),(0,a.jsx)(nt,{isDisabled:n,onChange:f,overrides:l,params:A,registry:c,values:g})]})}));var Re=n(65581);const $e=s.memo((function({className:e="",defaultValue:t,isDisabled:n=!1,label:i,onChange:r,overrides:o,registry:l,type:c,withLabel:d}){const m=ie(l,c),[h]=(0,s.useState)((()=>Fe(m,[],m[0].length||1))),[p,g]=(0,s.useState)((()=>function(e){return e.value instanceof Re.$?e.value.map((e=>({isValid:!0,value:e}))):ze(e)}(t)));return(0,s.useEffect)((()=>{!n&&m.length&&g((e=>{const t=m[0].length||1;if(e.length===t)return e;for(;e.length{r&&r({isValid:p.reduce(((e,{isValid:t})=>e&&t),!0),value:p.map((({value:e})=>e))})}),[p,r]),(0,a.jsx)(se,{className:e,isOuter:!0,label:i,withLabel:d,children:(0,a.jsx)(nt,{isDisabled:n,onChange:g,overrides:o,params:h,registry:l,values:p})})}));var qe=n(70447);const Ue={aye:!0,conviction:0},He=s.memo((function({className:e="",defaultValue:{value:t},isDisabled:n,isError:i,onChange:o,withLabel:l}){const{t:c}=(0,V.$)(),[d,u]=(0,s.useState)(Ue);(0,s.useEffect)((()=>{o&&o({isValid:!0,value:d})}),[o,d]);const m=(0,s.useCallback)((e=>u((({conviction:t})=>({aye:e,conviction:t})))),[]),p=(0,s.useCallback)((e=>u((({aye:t})=>({aye:t,conviction:e})))),[]),f=(0,s.useRef)([{text:c("Nay"),value:!1},{text:c("Aye"),value:!0}]),b=(0,s.useRef)([{text:c("None"),value:0},{text:c("Locked1x"),value:1},{text:c("Locked2x"),value:2},{text:c("Locked3x"),value:3},{text:c("Locked4x"),value:4},{text:c("Locked5x"),value:5},{text:c("Locked6x"),value:6}]),x=(0,h.H)(t)?0!==t.toNumber():t instanceof qe.P?t.isAye:0!==t,A=t instanceof qe.P?t.conviction.index:0;return(0,a.jsxs)(g.Z,{className:e,children:[(0,a.jsx)(r.Lt,{className:"full",defaultValue:x,isDisabled:n,isError:i,label:c("aye: bool"),onChange:m,options:f.current,withLabel:l}),(0,a.jsx)(r.Lt,{className:"full",defaultValue:A,isDisabled:n,isError:i,label:c("conviction: Conviction"),onChange:p,options:b.current,withLabel:l})]})}));var Qe=n(33661);const Oe=[{text:"Super majority approval",value:0},{text:"Super majority rejection",value:1},{text:"Simple majority",value:2}];Oe.reduce(((e,{text:t,value:n})=>(e[n]=t,e)),{});const We=s.memo((function({className:e="",defaultValue:{value:t},isDisabled:n,isError:i,label:o,onChange:l,withLabel:c}){const d=(0,s.useCallback)((e=>l&&l({isValid:!0,value:e})),[l]),u=(0,s.useMemo)((()=>(0,Qe.m)(t.toNumber)?t.toNumber():(0,j.G)(t).toNumber()),[t]);return(0,a.jsx)(g.Z,{className:e,children:(0,a.jsx)(r.Lt,{className:"full",defaultValue:u,isDisabled:n,isError:i,label:o,onChange:d,options:Oe,withLabel:c})})})),Ge=["AccountId","AccountId20","AccountId32","AccountIndex","Address","Balance","BalanceOf","Vec"],Je=["DispatchError","SpRuntimeDispatchError"],Ke=[{c:w,t:["AccountId","Address","LookupSource","MultiAddress"]},{c:C,t:["AccountIndex","i8","i16","i32","i64","i128","u8","u16","u32","u64","u128","u256"]},{c:k.Z,t:["Amount","Balance","BalanceOf"]},{c:P,t:["bool"]},{c:G,t:["Bytes","Vec"]},{c:ee,t:["Call","Proposal","RuntimeCall"]},{c:oe,t:["PalletAllianceCid"]},{c:ce,t:["Code"]},{c:de,t:Je},{c:ue,t:["DispatchResult","Result"]},{c:Ie,t:["Raw","RuntimeSessionKeys","Keys"]},{c:A,t:["Enum"]},{c:he,t:["Hash","H256"]},{c:me,t:["H160"]},{c:pe,t:["H512"]},{c:be,t:["KeyValue"]},{c:ve,t:["Vec"]},{c:we,t:["Moment","MomentOf"]},{c:ye,t:["Null"]},{c:je,t:["OpaqueCall"]},{c:Se,t:["Option"]},{c:Be,t:["String","Text"]},{c:re,t:["Struct"]},{c:Le,t:["Tuple"]},{c:Ze,t:["Vec","BTreeSet"]},{c:$e,t:["VecFixed"]},{c:He,t:["Vote"]},{c:We,t:["VoteThreshold"]},{c:_,t:["Unknown"]}].reduce(((e,{c:t,t:n})=>(n.forEach((n=>{e[n]=t})),e)),{}),Ye=[];function Xe({displayName:e,info:t,lookupName:n,sub:a,type:s}){if(e&&Ge.includes(e))return e;if(s.endsWith("RuntimeSessionKeys"))return"RuntimeSessionKeys";const i=n||s;switch(t){case m.u.Compact:return a.type;case m.u.Option:return"Option";case m.u.Enum:return"Enum";case m.u.Result:{const[,e]=a;return Je.includes(e.lookupName||e.type)?"DispatchResult":i}case m.u.Struct:return"Struct";case m.u.BTreeSet:return"BTreeSet";case m.u.Tuple:return Ke[s]===w?s:"Tuple";case m.u.Vec:return"Vec"===s?"Bytes":["Vec"].includes(s)?"Vec":"Vec";case m.u.VecFixed:return"u8"===a.type?s:"VecFixed";default:return i}}const _e=s.memo((function({className:e="",defaultValue:t,isDisabled:n,isError:i,isOptional:r,name:o,onChange:l,onEnter:p,onEscape:g,overrides:f,registry:b,type:x}){const A=(0,s.useMemo)((()=>function(e,t,n={}){if(["AccountId20","AccountId32"].includes(t.type)){const n=`AccountId${e.createType("AccountId").length}`;if(t.type!==n)return"AccountId20"===t.type?B:D}const a=e=>e?n[e]||Ke[e]:null,s=Xe(t);let i=a(t.lookupName)||a(t.type)||a(s);if(!i){try{const t=e.createType(s),n=(0,c.s)(t.toRawType());if(i=a(n.lookupName||n.type)||a(Xe(n)),i)return i;if((0,h.H)(t))return C}catch(e){console.error(`params: findComponent: ${e.message}`)}Ye.includes(s)||(Ye.push(s),console.info(`params: findComponent: No pre-defined component for type ${s} from ${m.u[t.info]}: ${JSON.stringify(t)}`))}return i||_}(b,x,f)),[b,x,f]),v=(0,s.useMemo)((()=>{const e=(0,d.RH)(b,b.isLookupType(x.lookupName||x.type)?(0,c.s)(b.createType(x.type).toRawType()):x).replace(/"/g,"").replace(/\\/g,"").replace(/:Null/g,"").replace(/:/g,": ").replace(/,/g,", ").replace(/^{_alias: {.*}, /,"{");return`${(0,u.o)(o)?"":`${o}: `}${e}${x.typeName&&!e.includes(x.typeName)?` (${x.typeName})`:""}`}),[o,b,x]);return A?r?(0,a.jsx)(X,{defaultValue:t,isOptional:!0,label:"None"}):(0,a.jsx)(A,{className:`${e} ui--Param`,defaultValue:t,isDisabled:n,isError:i,label:v,name:o,onChange:l,onEnter:p,onEscape:g,overrides:f,registry:b,type:x},`${o||"unknown"}:${v}`):null})),et=s.memo((function({defaultValue:e,index:t,isDisabled:n,isError:i,name:r,onChange:o,onEnter:l,onEscape:c,overrides:d,registry:u,type:m}){const h=(0,s.useCallback)((e=>o(t,e)),[t,o]);return(0,a.jsx)("div",{className:"ui--Param-composite",children:(0,a.jsx)(_e,{defaultValue:e,isDisabled:n,isError:i,name:r,onChange:h,onEnter:l,onEscape:c,overrides:d,registry:u,type:m},`input:${t}`)})}));class tt extends s.PureComponent{state={params:null};static getDerivedStateFromProps({isDisabled:e,params:t=[],registry:n=i.statics.api.registry,values:a},s){return e||(0,o.P)(s.params)===(0,o.P)(t)?null:{params:t,values:t.reduce(((e,t,s)=>(e.push(a?.[s]?a[s]:function(e,t){const n=Te(e,t.type);return{isValid:!(0,u.o)(n),value:n}}(n,t)),e)),[])}}componentDidMount(){this.componentDidUpdate(null,{})}componentDidUpdate(e,t){const{isDisabled:n}=this.props,{values:a}=this.state;n||(0,o.P)(t.values)===(0,o.P)(a)||this.triggerUpdate()}render(){const{children:e,className:t="",isDisabled:n,isError:s,onEnter:c,onEscape:d,overrides:u,params:m,registry:h=i.statics.api.registry,withBorder:p=!0,withExpander:g}=this.props,{values:f=this.props.values}=this.state;return f?.length?(0,a.jsx)(l.Z,{className:t,withBorder:p,withExpander:g,children:(0,a.jsx)(r.SV,{onError:this.onRenderError,children:(0,a.jsxs)("div",{className:"ui--Params-Content",children:[f&&m?.map((({name:e,type:t},i)=>(0,a.jsx)(et,{defaultValue:f[i],index:i,isDisabled:n,isError:s,name:e,onChange:this.onChangeParam,onEnter:c,onEscape:d,overrides:u,registry:h,type:t},`${e||""}:${t.type.toString()}:${i}:${n?(0,o.P)(f[i]):""}`))),e]})})}):null}onChangeParam=(e,t)=>{const{isDisabled:n}=this.props;if(n)return;const{isValid:a=!1,value:s}=t;this.setState((t=>({values:(t.values||[]).map(((t,n)=>n!==e?t:{isValid:a,value:s}))})),this.triggerUpdate)};triggerUpdate=()=>{const{isDisabled:e,onChange:t}=this.props,{values:n}=this.state;!e&&n&&t&&t(n)};onRenderError=()=>{const{onError:e}=this.props;e&&e()}}const nt=(0,V.Z)(tt)},48653:(e,t,n)=>{n.d(t,{_o:()=>i,fQ:()=>r,fr:()=>o,xS:()=>s});var a=n(40943);const s=["auctions.bid","balances.forceTransfer","balances.forceUnreserve","balances.setBalance","balances.transfer","balances.transferAllowDeath","balances.transferKeepAlive","bounties.proposeBounty","bounties.proposeCurator","childBounties.addChildBounty","childBounties.proposeCurator","claims.mintClaim","convictionVoting.delegate","convictionVoting.vote","crowdloan.contribute","crowdloan.create","crowdloan.edit","democracy.delegate","democracy.propose","democracy.vote","identity.requestJudgement","identity.setFee","nominationPools.bondExtra","nominationPools.create","nominationPools.createWithPoolId","nominationPools.join","nominationPools.unbond","phragmenElection.vote","society.bid","society.vouch","staking.bond","staking.bondExtra","staking.rebond","staking.unbond","tips.tip","tips.tipNew","treasury.proposeSpend","treasury.spend","vesting.forceVestedTransfer","vesting.vestedTransfer"],i=["auctions.BidAccepted","auctions.ReserveConfiscated","auctions.Reserved","auctions.Unreserved","balances.Deposit","balances.DustLost","balances.Endowed","balances.Transfer","balances.Unreserved","balances.Withdraw","bounties.BountyClaimed","bounties.BountyRejected","claims.Claimed","convictionVoting.Voted","crowdloan.Contributed","crowdloan.Withdrew","democracy.Voted","nominationPools.Bonded","nominationPools.PaidOut","nominationPools.PoolSlashed","nominationPools.Unbonded","nominationPools.UnbondingPoolSlashed","referenda.DecisionDepositPlaced","referenda.DecisionDepositRefunded","referenda.DepositSlashed","referenda.SubmissionDepositRefunded","staking.Bonded","staking.Rewarded","staking.Unbonded","staking.Withdrawn","transactionPayment.TransactionFeePaid","treasury.Deposit"],r={"Compact":a.Z,u128:a.Z},o=r},37750:(e,t,n)=>{n.d(t,{$:()=>s,Z:()=>i});var a=n(61349);function s(){return(0,a.$G)("react-params")}function i(e){return(0,a.Zh)(["react-params"])(e)}},67292:(e,t,n)=>{n.d(t,{c:()=>r,h:()=>i});var a=n(33410),s=n(55858);function i(e){try{const{code:t,multihash:{code:n,digest:i},version:r}=a.k0.parse(e);return{codec:t,hash:{code:n,digest:(0,s.c)(i)},version:r}}catch(t){return console.error(`fromIpfsCid: ${t.message}::`,e),null}}function r(e){try{const{codec:t,hash_:{code:n,digest:s},version:i}=e,r=s.toU8a(!0),o=a.PP.encodingLength(n.toNumber()),l=a.PP.encodingLength(r.length),c=new Uint8Array(o+l+r.length);return a.PP.encodeTo(n.toNumber(),c,0),a.PP.encodeTo(r.length,c,o),c.set(r,o+l),a.k0.create(i.index,t.toNumber(),a.uR.decode(c)).toString()}catch(t){return console.error(`toIpfsCid: ${t.message}::`,e.toHuman()),null}}},83488:(e,t,n)=>{n.d(t,{Z:()=>p,k:()=>h});var a=n(52322),s=(n(2784),n(49754)),i=n(37602),r=n(33661),o=n(11147),l=n(17751),c=n(1346),d=n(55858);function u({className:e="",key:t},...n){return(0,a.jsx)("div",{className:`${e} ui--Param-text`,children:n},t)}function m(e){return(0,r.m)(e.toHuman)?e.toHuman():Array.isArray(e)?e.map((e=>m(e))):e.toString()}function h(e){return(0,o.P)(e,2).replace(/,\n/g,"\n").replace(/"/g,"").replace(/\\/g,"").replace(/\],\[/g,"],\n[")}function p(e,t){return(0,l.F)(t)||(0,c.o)(t)?u({},""):u({},["Bytes","Raw","Option","Keys"].includes(e)&&(0,r.m)(t.toU8a)?(0,d.c)(t.toU8a(!0)):"Vec<(ValidatorId,Keys)>"===e?h((n=t,JSON.stringify(n.map((([e,t])=>[e.toString(),t.toHex()]))))):t instanceof s.N?t.isEmpty?"":t.toString():t instanceof i.W&&t.isNone?"":h(m(t)));var n}},67609:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(58607);const l=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:l}=(0,i.h)(),c=(0,r.W7)(l.derive.balances?.all,[s]);return(0,a.jsx)(o.Z,{className:t,label:n,value:c?.availableBalance,children:e})}))},36609:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(58607);const l=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:l}=(0,i.h)(),c=(0,r.W7)(l.derive.balances?.all,[s]);return(0,a.jsx)(o.Z,{className:t,label:n,value:c?.freeBalance,children:e})}))},26839:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(14681);const l=s.memo((function({children:e,className:t="",label:n}){const{api:s}=(0,i.h)(),l=(0,r.W7)(s.derive.chain.bestNumberFinalized);return(0,a.jsxs)("div",{className:`${t} ${l?"":"--tmp"}`,children:[n||"",(0,a.jsx)("span",{className:"--digits",children:(0,o.u)(l||1234)}),e]})}))},95689:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(14681);const l=s.memo((function({children:e,className:t="",isFinalized:n,label:s,withPound:l}){const{api:c,isApiReady:d}=(0,i.h)(),u=(0,r.W7)(d&&(n?c.derive.chain.bestNumberFinalized:c.derive.chain.bestNumber));return(0,a.jsxs)("div",{className:`${t} ${u?"":"--tmp"}`,children:[s||"",l&&"#",(0,a.jsx)("span",{className:"--digits",children:(0,o.u)(u||1234)}),e]})}))},65874:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(21779),r=n(97794);const o=i.z.div` + &.isInline { + display: inline-block; + } + + span+span { + padding-left: 0.25em; + } + + span.timeUnits { + font-size: var(--font-percent-tiny); + } +`,l=s.memo((function({api:e,children:t,className:n="",isInline:s,label:i,value:l}){const[,c]=(0,r.h)(l,e);return!l||l.isZero()?null:(0,a.jsxs)(o,{className:`${n} ui--BlockToTime ${s?"isInline":""}`,children:[i||"",c.split(" ").map(((e,t)=>(0,a.jsx)("span",{className:t%2?"timeUnits":void 0,children:e},t))),t]})}))},12176:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(52322),s=n(2784),i=n(90778),r=n(68256);const o=s.memo((function({children:e,className:t="",label:n}){const{t:s}=(0,r.$)(),{systemChain:o}=(0,i.h)();return(0,a.jsxs)("div",{className:t,children:[n||"",o||s("Unknown"),e]})}))},53598:(e,t,n)=>{n.d(t,{Z:()=>h});var a=n(52322),s=n(2784),i=n(21779),r=n(12372);const o=new Map;let l=Date.now(),c=0;function d(e,t="s",n=!1){const[s,i]=e.toFixed(1).split(".");return n?(0,a.jsxs)(a.Fragment,{children:[s,".",i," ",(0,a.jsx)("span",{className:"timeUnit",children:t})]}):(0,a.jsxs)(a.Fragment,{children:[s," ",(0,a.jsx)("span",{className:"timeUnit",children:t})]})}function u(e=0,t=0){const n=(t&&t.getTime?t.getTime():(0,r.G)(t).toNumber())||0;if(!e||!n)return d(0,"s",!0);const a=Math.max(Math.abs(e-n),0)/1e3;return a<60?d(a,"s",a<15):a<3600?d(a/60,"min"):d(a/3600,"hr")}!function e(){l=Date.now();for(const e of o.values())e(l);setTimeout(e,100)}();const m=i.z.div` + .timeUnit { + font-size: var(--font-percent-tiny); + } +`,h=s.memo((function({children:e,className:t="",value:n}){const[i,r]=(0,s.useState)(l);return(0,s.useEffect)((()=>{const e=c++;return o.set(e,r),()=>{o.delete(e)}}),[]),(0,a.jsxs)(m,{className:`${t} ui--Elapsed --digits`,children:[u(i,n),e]})}))},58607:(e,t,n)=>{n.d(t,{Z:()=>p});var a=n(52322),s=n(2784),i=n(21779),r=n(90778),o=n(92730),l=n(54371),c=n(68256);function d(e,t,n,s="",i=!1){return(0,a.jsxs)(a.Fragment,{children:[`${e}${i?"":"."}`,!i&&(0,a.jsx)("span",{className:"ui--FormatBalance-postfix",children:`0000${t||""}`.slice(-4)}),(0,a.jsxs)("span",{className:"ui--FormatBalance-unit",children:[" ",n]}),s]})}function u(e,t,n){const[a,s]=e.split("."),[i,r]=s.split(" ");return d(a,i,r,t,n)}function m(e,[t,n],s=!0,i,r,l){const[c,u]=(0,o.a)(e,{decimals:t,forceUnit:"-",withSi:!1}).split("."),m=r||i&&c.length>=4,h=s?n:"";if(c.length>7){const[n,s]=(0,o.a)(e,{decimals:t,withUnit:!1}).split("."),i=s.substring(0,4),r=s.substring(4);return(0,a.jsxs)(a.Fragment,{children:[n,".",(0,a.jsx)("span",{className:"ui--FormatBalance-postfix",children:i}),(0,a.jsxs)("span",{className:"ui--FormatBalance-unit",children:[r,r?h:` ${h}`]}),l||""]})}return d(c,u,h,l,m)}const h=i.z.span` + vertical-align: baseline; + white-space: nowrap; + + * { + vertical-align: baseline !important; + } + + > label, + > .label { + display: inline-block; + margin-right: 0.25rem; + vertical-align: baseline; + } + + .ui--FormatBalance-unit { + font-size: var(--font-percent-tiny); + text-transform: uppercase; + } + + .ui--FormatBalance-value { + text-align: right; + + > .ui--FormatBalance-postfix { + font-weight: lighter; + vertical-align: baseline; + } + } + + > .ui--Button { + margin-left: 0.25rem; + } + + .ui--Icon { + margin-bottom: -0.25rem; + margin-top: 0.25rem; + } + + .ui--Icon+.ui--FormatBalance-value { + margin-left: 0.375rem; + } +`,p=s.memo((function({children:e,className:t="",format:n,formatIndex:i,isShort:o,label:d,labelPost:p,value:g,valueFormatted:f,withCurrency:b,withSi:x}){const{t:A}=(0,c.$)(),{api:v}=(0,r.h)(),w=(0,s.useMemo)((()=>n||function(e,t=0){const n=e.chainDecimals,a=e.chainTokens;return[t{n.d(t,{Z:()=>r});var a=n(52322),s=n(2784),i=n(90778);const r=s.memo((function({children:e,className:t="",label:n}){const{systemName:s}=(0,i.h)();return(0,a.jsxs)("div",{className:t,children:[n||"",s,e]})}))},52727:(e,t,n)=>{n.d(t,{Z:()=>r});var a=n(52322),s=n(2784),i=n(90778);const r=s.memo((function({children:e,className:t="",label:n}){const{systemVersion:s}=(0,i.h)(),r=s.split("-")[0];return(0,a.jsxs)("div",{className:t,children:[n||"",r,e]})}))},99924:(e,t,n)=>{n.d(t,{Z:()=>c});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(95292),l=n(65874);const c=s.memo((function({children:e,className:t,isInline:n,label:c,value:d}){const{api:u}=(0,i.h)(),m=(0,r.W7)(u.derive.session.progress),h=(0,s.useMemo)((()=>m&&d&&m.currentIndex.lt(d)?d.sub(m.currentIndex).imul(m.sessionLength).isub(m.sessionProgress):o.nw),[m,d]);return(0,a.jsx)(l.Z,{className:t,isInline:n,label:c,value:h,children:e})}))},67634:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(53598);const l=s.memo((function({children:e,className:t="",label:n,value:l}){const{api:c}=(0,i.h)(),d=(0,r.W7)(!l&&c.query.timestamp?.now),[u,m]=(0,s.useMemo)((()=>[l||d,!(!l&&!d)]),[d,l]);return(0,a.jsxs)("div",{className:`${t} ${m?"":"--tmp"}`,children:[n||"",(0,a.jsx)(o.Z,{value:m?u:Date.now()}),e]})}))},96916:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(58607);const l=s.memo((function({children:e,className:t="",label:n}){const{api:s}=(0,i.h)(),l=(0,r.W7)(s.query.balances?.inactiveIssuance);return(0,a.jsxs)("div",{className:t,children:[n||"",(0,a.jsx)(o.Z,{className:l?"":"--tmp",value:l||1,withSi:!0}),e]})}))},79608:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(52322),s=n(2784),i=n(90778),r=n(9118),o=n(58607);const l=s.memo((function({children:e,className:t="",label:n}){const{api:s}=(0,i.h)(),l=(0,r.W7)(s.query.balances?.totalIssuance);return(0,a.jsxs)("div",{className:t,children:[n||"",(0,a.jsx)(o.Z,{className:l?"":"--tmp",value:l||1,withSi:!0}),e]})}))},68256:(e,t,n)=>{n.d(t,{$:()=>s});var a=n(61349);function s(){return(0,a.$G)("react-query")}},4984:(e,t,n)=>{n.d(t,{ZP:()=>he});var a=n(52322),s=n(2784),i=n(64348),r=n(90778),o=n(86135),l=n(48731),c=n(33661),d=n(4615),u=n(61349);function m(){return(0,u.$G)("react-signer")}var h=n(14534),p=n(45479),g=n(38894),f=n(69187),b=n(17965),x=n(29659);let A=0;class v{#a;#s;#i;#n;constructor(e,t,n,a){this.#a=n,this.#s=a,this.#i=t,this.#n=e}async signPayload(e){const t=this.#n.createType("ExtrinsicPayload",e,{version:e.version}),{signature:n}=await this.#i().sign(t.toU8a(!0),this.#a,this.#s);return{id:++A,signature:n}}}var w=n(34323);class y{#n;#r;constructor(e,t){this.#n=e,this.#r=t}async signPayload(e){return new Promise(((t,n)=>{const a=e.method.length>5e3,s=this.#n.createType("ExtrinsicPayload",e,{version:e.version}),i=a?(0,w.b)(s.toU8a(!0)):s.toU8a();this.#r({isQrHashed:a,qrAddress:e.address,qrPayload:i,qrReject:n,qrResolve:t})}))}}var j=n(33403);const C=()=>{},k={accountOffset:0,addressOffset:0,isHardware:!1,isMultisig:!1,isProxied:!1,isQr:!1,isUnlockable:!1,threshold:0,who:[]},N={};function E(e){if(!e)return k;let t;try{t=f.Nn.decodeAddress(e)}catch(e){return console.error(e),k}const n=f.Nn.getPair(t),{isExternal:a,isHardware:s,isInjected:i,isMultisig:r,isProxied:o}=n.meta,l=!a&&!s&&!i;if(l){const e=N[n.address];e&&Date.now()>e&&!n.isLocked&&(n.lock(),N[n.address]=0)}return{accountOffset:n.meta.accountOffset||0,addressOffset:n.meta.addressOffset||0,hardwareType:n.meta.hardwareType,isHardware:!!s,isMultisig:!!r,isProxied:!!o,isQr:!(!a||r||o||s||i),isUnlockable:l&&n.isLocked,threshold:n.meta.threshold||0,who:(n.meta.who||[]).map(S)}}function S(e){return f.Nn.encodeAddress(f.Nn.decodeAddress(e))}function I(e,t,{id:n,txFailedCb:a=C,txSuccessCb:s=C,txUpdateCb:i=C},r){return o=>{if(!o?.status)return;const l=o.status.type.toLowerCase();console.log(`${e}: status :: ${JSON.stringify(o)}`),t(n,l,o),i(o),o.status.isFinalized||o.status.isInBlock?o.events.filter((({event:{section:e}})=>"system"===e)).forEach((({event:{method:e}})=>{"ExtrinsicFailed"===e?a(o):"ExtrinsicSuccess"===e&&s(o)})):o.isError&&a(o),o.isCompleted&&r()}}let B=0;class D{#o;#n;constructor(e,t){this.#o=t,this.#n=e}async signPayload(e){return new Promise((t=>{const n=this.#n.createType("ExtrinsicPayload",e,{version:e.version}).sign(this.#o);var a;a=this.#o,Date.now()>(N[a.address]||0)&&!a.isLocked&&a.lock(),t((0,j.Z)({id:++B},n))}))}}var L=n(34814),V=n(74065),P=n(95292);const T=(0,i.zo)(i.u_.Columns)` + .errorLabel { + margin-right: 1rem; + color: #9f3a38 !important; + } + + .ui--Toggle { + bottom: 1.1rem; + } +`,M=s.memo((function({address:e,className:t,error:n,onChange:r,onEnter:o,tabIndex:l}){const{t:c}=m(),[d,u]=(0,s.useState)(""),[h,p]=(0,s.useState)(!1),g=(0,s.useMemo)((()=>function(e){try{return f.Nn.getPair(e)}catch{return null}}(e)),[e]);return(0,s.useEffect)((()=>{r(d,h)}),[r,h,d]),g&&g.isLocked&&!g.meta.isInjected?(0,a.jsx)(T,{className:t,hint:c("Unlock the sending account to allow signing of this transaction."),children:(0,a.jsx)(i.ro,{autoFocus:!0,isError:!!n,label:c("unlock account with password"),labelExtra:(0,a.jsx)(i.ZD,{label:c("unlock for {{expiry}} min",{replace:{expiry:15}}),onChange:p,value:h}),onChange:u,onEnter:o,tabIndex:l,value:d})}):null})),F=!0;function z(e){try{const{method:t,section:n}=e.registry.findMetaCall(e.callIndex);return{method:t,section:n}}catch{return{method:"unknown",section:"unknown"}}}function Z(e,t,n){const{method:a,section:s}=z(t),i=(t,a)=>!a.some((a=>!Z(e,a,n).includes(t))),r=e=>"utility"===s&&(["batch","batchAll"].includes(a)&&i(e,t.args[0])||["asLimitedSub"].includes(a)&&i(e,[t.args[0]]));return n.filter((([n,i,o])=>{if(!e.includes(n)||!i.isZero())return!1;if(F)return!0;switch(o.toString()){case"Any":default:return!0;case"Governance":return r(n)||["convictionVoting","council","councilCollective","democracy","elections","electionsPhragmen","fellowshipCollective","fellowshipReferenda","phragmenElection","poll","referenda","society","technicalCommittee","tips","treasury","whitelist"].includes(s);case"IdentityJudgement":return r(n)||"identity"===s&&"provideJudgement"===a;case"NonTransfer":return!("balances"===s||"indices"===s&&"transfer"===a||"vesting"===s&&"vestedTransfer"===a);case"Staking":return r(n)||["fastUnstake","staking"].includes(s);case"SudoBalances":return r(n)||"sudo"===s&&"sudo"===a&&"balances"===z(t.args[0]).section}})).map((([e])=>e))}async function R(e,t,n,a){if((0,c.m)(e.query.proxy?.proxies)){const{isProxied:s}=E(n),[i]=await e.query.proxy.proxies(n),r=3===e.tx.proxy.addProxy.meta.args.length?i.map((({delay:e,delegate:t,proxyType:n})=>[t.toString(),e,n])):i.map((([e,t])=>[e.toString(),P.nw,t])),o=Z(t,a,r);if(o.length)return{address:n,isProxied:s,proxies:r,proxiesFilter:o}}return null}const $=s.memo((function({currentItem:e,onChange:t,onEnter:n,passwordError:o,requestAddress:l}){const{t:d}=m(),{api:u}=(0,r.h)(),{allAccounts:h}=(0,L.x)(),p=(0,V.X)(),[g,f]=(0,s.useState)(null),[b,x]=(0,s.useState)(null),[A,v]=(0,s.useState)(!1),[w,y]=(0,s.useState)(!0),[j,C]=(0,s.useState)(null),[k,N]=(0,s.useState)(null),[{isUnlockCached:S,signPassword:I},B]=(0,s.useState)((()=>({isUnlockCached:!1,signPassword:""}))),[D,P]=(0,s.useMemo)((()=>{const e=j&&g||w&&k&&b||l;try{return[e,E(e)]}catch{return[e,{}]}}),[g,b,w,j,k,l]),T=(0,s.useCallback)(((e,t)=>B({isUnlockCached:t,signPassword:e})),[]);return(0,s.useEffect)((()=>{!k&&x(null)}),[k]),(0,s.useEffect)((()=>{N(null),e.extrinsic&&R(u,h,l,e.extrinsic).then((e=>p.current&&N(e))).catch(console.error)}),[h,u,e,p,l]),(0,s.useEffect)((()=>{C(null),e.extrinsic&&E(b||l).isMultisig&&async function(e,t,n,a){const s=e.tx.multisig?"multisig":"utility";if((0,c.m)(e.query[s]?.multisigs)){const i=n||t,{threshold:r,who:o}=E(i),l=(n?e.tx.proxy.proxy(t||"",null,a):a).method.hash,c=(await e.query[s].multisigs(i,l)).unwrapOr(null);return c?{address:i,isMultiCall:c.approvals.length+1>=r,who:o,whoFilter:o.filter((e=>!c.approvals.some((t=>t.eq(e)))))}:{address:i,isMultiCall:!1,who:o,whoFilter:o}}return null}(u,l,b,e.extrinsic).then((e=>{p.current&&(C(e),v(e?.isMultiCall||!1))})).catch(console.error)}),[b,u,e,p,l]),(0,s.useEffect)((()=>{t({isMultiCall:A,isUnlockCached:S,multiRoot:j?j.address:null,proxyRoot:k&&w?k.address:null,signAddress:D,signPassword:I})}),[w,A,S,g,j,t,b,k,D,I]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.u_.Columns,{hint:d("The sending account that will be used to send this transaction. Any applicable fees will be paid by this account."),children:(0,a.jsx)(i.rp,{className:"full",defaultValue:l,isDisabled:!0,isInput:!0,label:d("sending from my account"),withLabel:!0})}),k&&w&&(0,a.jsx)(i.u_.Columns,{hint:d("The proxy is one of the allowed proxies on the account, as set and filtered by the transaction type."),children:(0,a.jsx)(i.rp,{filter:k.proxiesFilter,label:d("proxy account"),onChange:x,type:"account"})}),j&&(0,a.jsx)(i.u_.Columns,{hint:d("The signatory is one of the allowed accounts on the multisig, making a recorded approval for the transaction."),children:(0,a.jsx)(i.rp,{filter:j.whoFilter,label:d("multisig signatory"),onChange:f,type:"account"})}),D&&!e.isUnsigned&&P.isUnlockable&&(0,a.jsx)(M,{address:D,error:o,onChange:T,onEnter:n}),o&&(0,a.jsx)(i.u_.Columns,{children:(0,a.jsx)(i.oy,{content:o})}),k&&(0,a.jsx)(i.u_.Columns,{hint:d("This could either be an approval for the hash or with full call details. The call as last approval triggers execution."),children:(0,a.jsx)(i.ZD,{className:"tipToggle",isDisabled:k.isProxied,label:d(w?"Use a proxy for this call":"Don't use a proxy for this call"),onChange:y,value:w})}),j&&(0,a.jsx)(i.u_.Columns,{hint:d("This could either be an approval for the hash or with full call details. The call as last approval triggers execution."),children:(0,a.jsx)(i.ZD,{className:"tipToggle",label:d(A?"Multisig message with call (for final approval)":"Multisig approval with hash (non-final approval)"),onChange:v,value:A})})]})}));var q=n(74076);const U=(0,i.zo)(i.P0)` + .qrDisplay { + margin: 0 auto; + max-width: 30rem; + + img { + border: 1px solid white; + } + } +`,H=s.memo((function({address:e,className:t,genesisHash:n,isHashed:r,onSignature:o,payload:l}){const{t:c}=m(),[d,u]=(0,s.useState)(null),h=(0,s.useCallback)((e=>{if((0,q.vq)(e.signature))o(e);else{const t=e.signature;u(c('Non-signature, non-hex data received from QR. Data contains "{{sample}}" instead of a hex-only signature. Please present the correct signature generated from the QR presented for submission.',{replace:{sample:t.length>47?`${t.slice(0,24)}…${t.slice(-22)}`:t}}))}}),[o,c]);return e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(U,{className:t,children:[(0,a.jsx)(i.P0.Column,{children:(0,a.jsx)("div",{className:"qrDisplay",children:(0,a.jsx)(i.iH,{address:e,cmd:r?1:2,genesisHash:n,payload:l})})}),(0,a.jsx)(i.P0.Column,{children:(0,a.jsx)("div",{className:"qrDisplay",children:(0,a.jsx)(i.lB,{onScan:h})})})]}),d&&(0,a.jsx)(i.oy,{className:"nomargin",content:d})]}):(0,a.jsx)(i.$j,{label:c("Preparing QR for signing")})}));var Q=n(48801),O=n.n(Q);const W=s.memo((function({address:e,onChange:t,signedTx:n}){const{api:o}=(0,r.h)(),[l,c]=(0,s.useState)((()=>new(O())(64))),[d,u]=(0,s.useState)(P.nw),{t:h}=m();(0,s.useEffect)((()=>{e&&o.derive.balances.account(e).then((({accountNonce:e})=>u(e))).catch(console.error)}),[e,o]),(0,s.useEffect)((()=>{t({era:l.toNumber(),nonce:d})}),[l,d,t]);const p=(0,s.useCallback)(((e=P.nw)=>c(e)),[]),g=(0,s.useCallback)(((e=P.nw)=>u(e)),[]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(i.u_.Columns,{hint:h("Override any applicable values for the specific signed output. These will be used to construct and display the signed transaction."),children:[(0,a.jsx)(i.Rn,{isDisabled:!!n,isZeroable:!0,label:h("Nonce"),labelExtra:h("Current account nonce: {{accountNonce}}",{replace:{accountNonce:d}}),onChange:g,value:d}),(0,a.jsx)(i.Rn,{isDisabled:!!n,isZeroable:!0,label:h("Lifetime (# of blocks)"),labelExtra:h("Set to 0 to make transaction immortal"),onChange:p,value:l})]}),!!n&&(0,a.jsx)(i.u_.Columns,{hint:h("The actual fully constructed signed output. This can be used for submission via other channels."),children:(0,a.jsx)(i.r_,{isFull:!0,isTrimmed:!0,label:h("Signed transaction"),value:n,withCopy:!0})})]})})),G=s.memo((function({className:e,onChange:t}){const{t:n}=m(),[r,o]=(0,s.useState)(),[l,c]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{t(l?r:P.nw)}),[t,l,r]),(0,a.jsxs)(i.u_.Columns,{className:e,hint:n("Adding an optional tip to the transaction could allow for higher priority, especially when the chain is busy."),children:[(0,a.jsx)(i.ZD,{className:"tipToggle",label:n(l?"Include an optional tip for faster processing":"Do not include a tip for the block author"),onChange:c,value:l}),l&&(0,a.jsx)(i.H,{isZeroable:!0,label:n("Tip (optional)"),onChange:o})]})}));var J=n(15991),K=n(9118),Y=n(92730);const X=s.memo((function({accountId:e,className:t="",extrinsic:n,isHeader:o}){const{t:l}=m(),{api:c}=(0,r.h)(),[d,h]=(0,s.useState)(null),p=(0,K.W7)(c.derive.balances?.all,[e]),g=(0,V.X)();if((0,s.useEffect)((()=>{e&&n&&n.hasPaymentInfo&&(0,b.Y)((async()=>{try{const t=await n.paymentInfo(e);g.current&&h(t)}catch(e){console.error(e)}}))}),[c,e,n,g]),!d||!n)return null;const f=c.consts.balances&&!(c.tx.balances?.transferAllowDeath?.is(n)||c.tx.balances?.transfer?.is(n))&&p?.accountId.eq(e)&&(p.availableBalance.lte(d.partialFee)||p.freeBalance.sub(d.partialFee).lte(c.consts.balances.existentialDeposit));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.xH,{className:t,isHeader:o,summary:(0,a.jsxs)(u.cC,{i18nKey:"feesForSubmission",children:["Fees of ",(0,a.jsx)("span",{className:"highlight",children:(0,Y.a)(d.partialFee,{withSiFull:!0})})," will be applied to the submission"]})}),f&&(0,a.jsx)(i.Pd,{content:l("The account does not have enough free funds (excluding locked/bonded/reserved) available to cover the transaction fees without dropping the balance below the account existential amount.")})]})})),_=(0,i.zo)(i.u_.Columns)` + .paymentInfo { + margin-top: 0.5rem; + } +`,ee=s.memo((function({accountId:e,className:t,currentItem:{extrinsic:n,isUnsigned:s,payload:i},onError:r,tip:o}){const{t:l}=m();return n?(0,a.jsxs)(_,{className:t,hint:l("The details of the transaction including the type, the description (as available from the chain metadata) as well as any parameters and fee estimations (as available) for the specific type of call."),children:[(0,a.jsx)(J.Z,{isHeader:!0,onError:r,value:n}),!s&&!i&&(0,a.jsx)(X,{accountId:e,className:"paymentInfo",extrinsic:n,isHeader:!0,tip:o})]}):null})),te=()=>{},ne={innerHash:null,innerTx:null};let ae=0;async function se(e,t,{isMultiCall:n,multiRoot:a,proxyRoot:s,signAddress:i}){let r=t.extrinsic;if(s&&(r=e.tx.proxy.proxy(s,null,r)),a){const t=e.tx.multisig?"multisig":"utility",[s,{weight:o}]=await Promise.all([e.query[t].multisigs(a,r.method.hash),r.paymentInfo(a)]);console.log("multisig max weight=",o.toString());const{threshold:l,who:c}=E(a),d=c.filter((e=>e!==i));let u=null;s.isSome&&(u=s.unwrap().when),r=n?5===e.tx[t].asMulti.meta.args.length?e.tx[t].asMulti(l,d,u,r.method.toHex(),o):6===e.tx[t].asMulti.meta.args.length?e.tx[t].asMulti(l,d,u,r.method.toHex(),!1,o):e.tx[t].asMulti(l,d,u,r.method):5===e.tx[t].approveAsMulti.meta.args.length?e.tx[t].approveAsMulti(l,d,u,r.method.hash,o):e.tx[t].approveAsMulti(l,d,u,r.method.hash)}return r}async function ie(e,t,n,a,s){const i=f.Nn.getPair(t),{meta:{accountOffset:r,addressOffset:o,isExternal:c,isHardware:d,isInjected:u,isProxied:m,source:p}}=i;if(d)return["signing",t,{...n,signer:new v(e.registry,a,r||0,o||0)}];if(c&&!m)return["qr",t,{...n,signer:new y(e.registry,s)}];if(u){if(!p)throw new Error(`Unable to find injected source for ${t}`);const e=await(0,h.R0)(p);return(0,l.hu)(e,`Unable to find a signer for ${t}`),["signing",t,{...n,signer:e.signer}]}return(0,l.hu)((0,x.Q)(t,i.address),`Unable to retrieve keypair for ${t}`),["signing",t,{...n,signer:new D(e.registry,i)}]}function re(e){try{return E(e)}catch{return{}}}const oe=(0,i.zo)(i.u_.Content)` + .tipToggle { + width: 100%; + text-align: right; + } + + .ui--Checks { + margin-top: 0.75rem; + } +`,le=s.memo((function({className:e,currentItem:t,isQueueSubmit:n,queueSize:l,requestAddress:c,setIsQueueSubmit:d}){const{t:u}=m(),{api:h}=(0,r.h)(),{getLedger:x}=(0,p.c)(),{queueSetTxStatus:A}=(0,o.L)(),[v,w]=(0,s.useState)((()=>re(c))),[y,j]=(0,s.useState)(null),[{isQrHashed:C,qrAddress:k,qrPayload:E,qrResolve:S},B]=(0,s.useState)((()=>({isQrHashed:!1,qrAddress:"",qrPayload:new Uint8Array}))),[D,L]=(0,s.useState)(!1),[V,P]=(0,g.O)(),[T,M]=(0,s.useState)(!0),[F,z]=(0,s.useState)(null),[Z,R]=(0,s.useState)((()=>({isMultiCall:!1,isUnlockCached:!1,multiRoot:null,proxyRoot:null,signAddress:c,signPassword:""}))),[q,U]=(0,s.useState)({}),[Q,O]=(0,s.useState)(null),[{innerHash:J,innerTx:K},Y]=(0,s.useState)(ne),[X,_]=(0,s.useState)(),[le]=(0,s.useState)(n);(0,s.useEffect)((()=>{w(re(Z.signAddress)),z(null)}),[Z]),(0,s.useEffect)((()=>{const e=t.extrinsic&&(Z.proxyRoot?h.tx.proxy.proxy(Z.proxyRoot,null,t.extrinsic):t.extrinsic).method;Y(e?{innerHash:e.hash.toHex(),innerTx:Z.multiRoot?e.toHex():null}:ne)}),[h,t,Z]);const ce=(0,s.useCallback)((({signature:e})=>S&&S({id:++ae,signature:e})),[S]),de=(0,s.useCallback)((async()=>{let e=null;if(Z.signAddress)if(v.isUnlockable)e=function({isUnlockCached:e,signAddress:t,signPassword:n}){let a;try{if(!t)throw new Error("Invalid signAddress");a=f.Nn.decodeAddress(t)}catch(e){return console.error(e),"unable to decode address"}const s=f.Nn.getPair(a);try{s.decodePkcs8(n),e&&function(e){N[e.address]=Date.now()+9e5}(s)}catch(e){return console.error(e),e.message}return null}(Z);else if(v.isHardware)try{const e=x(),{address:t}=await e.getAddress(!1,v.accountOffset,v.addressOffset);console.log(`Signing with Ledger address ${t}`)}catch(t){console.error(t);const n=t.message;e=u("Unable to connect to the Ledger, ensure support is enabled in settings and no other app is using it. {{errorMessage}}",{replace:{errorMessage:n}})}return z(e),!e}),[v,x,Z,u]),ue=(0,s.useCallback)(((e,t,n)=>{if(n.signAddress&&t.payload){const{id:a,payload:s,signerCb:i=te}=t,r=f.Nn.getPair(n.signAddress);i(a,{id:a,...h.createType("ExtrinsicPayload",s,{version:s.version}).sign(r)}),e(a,"completed")}}),[h]),me=(0,s.useCallback)((async(e,t,n)=>{if(n.signAddress){const[a,[s,i,r]]=await Promise.all([se(h,t,n),ie(h,n.signAddress,{nonce:-1,tip:X},x,B)]);e(t.id,s),await async function(e,t,n,a,s){t.txStartCb&&t.txStartCb();try{await n.signAsync(a,s),console.info("sending",n.toHex()),e(t.id,"sending");const i=await n.send(I("signAndSend",e,t,(()=>{i()})))}catch(n){console.error("signAndSend: error:",n),e(t.id,"error",{},n),t.txFailedCb&&t.txFailedCb(n)}}(e,t,a,i,r)}}),[h,x,X]),he=(0,s.useCallback)((async(e,t,n)=>{if(n.signAddress){const[a,[,s,i]]=await Promise.all([se(h,t,n),ie(h,n.signAddress,{...q,tip:X},x,B)]);O(await async function(e,{id:t,txFailedCb:n=te,txStartCb:a=te},s,i,r){a();try{return await s.signAsync(i,r),s.toJSON()}catch(a){console.error("signAsync: error:",a),e(t,"error",void 0,a),n(a)}return null}(e,t,a,s,i))}}),[h,x,q,X]),pe=(0,s.useCallback)((()=>{L(!0),(0,b.Y)((()=>{const e=e=>{console.error(e),L(!1),j(e)};de().then((n=>{n?T?t.payload?ue(A,t,Z):me(A,t,Z).catch(e):he(A,t,Z).catch(e):L(!1)})).catch((t=>{e(t)}))}))}),[me,ue,he,de,t,T,A,Z]),ge=Z.signAddress&&l>1&&T&&!(v.isHardware||v.isMultisig||v.isProxied||v.isQr||v.isUnlockable)&&!V;return!D&&ge&&le?(L(!0),setTimeout(pe,1e3),null):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(oe,{className:e,children:(0,a.jsx)(i.SV,{error:y,onError:P,children:D&&v.isQr?(0,a.jsx)(H,{address:k,genesisHash:h.genesisHash,isHashed:C,onSignature:ce,payload:E}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ee,{accountId:Z.signAddress,currentItem:t,onError:P}),(0,a.jsx)($,{currentItem:t,onChange:R,onEnter:pe,passwordError:F,requestAddress:c}),!t.payload&&(0,a.jsx)(G,{onChange:_}),!T&&(0,a.jsx)(W,{address:Z.signAddress,onChange:U,signedTx:Q}),T&&!Z.isMultiCall&&K&&(0,a.jsx)(i.u_.Columns,{hint:u("The full call data that can be supplied to a final call to multi approvals"),children:(0,a.jsx)(i.r_,{isDisabled:!0,isTrimmed:!0,label:u("multisig call data"),value:K,withCopy:!0})}),T&&J&&(0,a.jsx)(i.u_.Columns,{hint:u("The call hash as calculated for this transaction"),children:(0,a.jsx)(i.r_,{isDisabled:!0,isTrimmed:!0,label:u("call hash"),value:J,withCopy:!0})})]})})}),(0,a.jsxs)(i.u_.Actions,{children:[(0,a.jsx)(i.zx,{icon:v.isQr?"qrcode":"sign-in-alt",isBusy:D,isDisabled:!Z.signAddress||V,label:v.isQr?u("Sign via Qr"):u(T?"Sign and Submit":"Sign (no submission)"),onClick:pe,tabIndex:2}),(0,a.jsxs)("div",{className:"signToggle",children:[!D&&(0,a.jsx)(i.ZD,{isDisabled:!!t.payload,label:u(T?"Sign and Submit":"Sign (no submission)"),onChange:M,value:T}),ge&&(0,a.jsx)(i.ZD,{label:n?u("Submit {{queueSize}} items",{replace:{queueSize:l}}):u("Submit individual"),onChange:d,value:n})]})]})]})})),ce=s.memo((function({className:e,currentItem:t}){const{t:n}=m(),{queueSetTxStatus:r}=(0,o.L)(),[l,c]=(0,g.O)(),d=(0,s.useCallback)((async()=>{t.extrinsic&&await async function(e,t,n){t.txStartCb&&t.txStartCb();try{const a=await n.send(I("send",e,t,(()=>{a()})))}catch(n){console.error("send: error:",n),e(t.id,"error",{},n),t.txFailedCb&&t.txFailedCb(null)}}(r,t,t.extrinsic)}),[t,r]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.u_.Content,{className:e,children:(0,a.jsx)(i.SV,{onError:c,children:(0,a.jsx)(ee,{currentItem:t,onError:c})})}),(0,a.jsx)(i.u_.Actions,{children:(0,a.jsx)(i.zx,{icon:"sign-in-alt",isDisabled:l,label:n("Submit (no signature)"),onClick:d,tabIndex:2})})]})})),de=()=>{},ue=["queued","qr","signing"];const me=(0,i.zo)(i.u_)` + .signToggle { + bottom: 1.5rem; + left: 1.5rem; + position: absolute; + + .ui--Toggle { + display: inline-block; + + &+.ui--Toggle { + margin-left: 1rem; + } + } + } +`,he=s.memo((function({children:e,className:t=""}){const{api:n}=(0,r.h)(),{t:i}=m(),{queueSetTxStatus:u,txqueue:h}=(0,o.L)(),[p,g]=(0,s.useState)(!1),{currentItem:f,isRpc:b,isVisible:x,queueSize:A,requestAddress:v}=(0,s.useMemo)((()=>function(e){const t=e.filter((({status:e})=>ue.includes(e))),n=t[0]||null;let a=!1,s=!1;return n&&("queued"!==n.status||n.extrinsic||n.payload?"signing"!==n.status&&(s=!0):a=!0),{currentItem:n,isRpc:a,isVisible:s,queueSize:t.length,requestAddress:n?.accountId||null}}(h)),[h]);(0,s.useEffect)((()=>{1===A&&g(!1)}),[A]),(0,s.useEffect)((()=>{b&&f&&async function(e,t,{id:n,rpc:a,values:s=[]}){if(a){t(n,"sending");const{error:i,result:r,status:o}=await async function(e,{method:t,section:n},a){try{const s=e.rpc;(0,l.hu)((0,c.m)(s[n]?.[t]),`api.rpc.${n}.${t} does not exist`);const i=await s[n][t](...a);return console.log("submitRpc: result ::",(0,d.a)(i)),{result:i,status:"sent"}}catch(e){return console.error(e),{error:e,status:"error"}}}(e,a,s);t(n,o,r,i)}}(n,u,f).catch(console.error)}),[n,b,f,u]);const w=(0,s.useCallback)((()=>{if(f){const{id:e,signerCb:t=de,txFailedCb:n=de}=f;u(e,"cancelled"),t(e,null),n(null)}}),[f,u]);return(0,a.jsxs)(a.Fragment,{children:[e,f&&x&&(0,a.jsx)(me,{className:t,header:(0,a.jsxs)(a.Fragment,{children:[i("Authorize transaction"),1===A?void 0:(0,a.jsxs)(a.Fragment,{children:[" 1/",A]})]}),onClose:w,size:"large",children:f.isUnsigned?(0,a.jsx)(ce,{currentItem:f}):(0,a.jsx)(le,{currentItem:f,isQueueSubmit:p,queueSize:A,requestAddress:v,setIsQueueSubmit:g})},f.id)]})}))}}]); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 7f338fbe2031..c150a031ea63 100644 --- a/docs/index.html +++ b/docs/index.html @@ -124,7 +124,7 @@ opacity: 0.15; } - +
diff --git a/docs/modu.daa0d0d53666b88c.js b/docs/modu.daa0d0d53666b88c.js new file mode 100644 index 000000000000..d2e81e7fb089 --- /dev/null +++ b/docs/modu.daa0d0d53666b88c.js @@ -0,0 +1 @@ +"use strict";(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[2589],{14534:(e,n,t)=>{t.d(n,{LW:()=>b,vK:()=>k,$y:()=>$,R0:()=>E});var a=t(33403),s=t(90107),o=t(94175);const r=window.ethereum?.isMetaMask,c="npm:@polkagate/snap";let i="0.1.11";const u="polkamask",l={[c]:{version:`>=${i}`}};(async function(e){try{const n=await fetch(`https://registry.npmjs.org/${e}`);if(!n.ok)throw new Error(`Failed to fetch package information. Status: ${n.status}`);return(await n.json())["dist-tags"].latest}catch(e){throw console.error("Error fetching package information:",e.message),e}})(c).then((e=>{i=e,console.log(`Latest version of ${c}: ${e}`)})).catch((e=>{console.error("Failed to get the latest version:",e)}));const m=async e=>{console.info("Args in invokeSnap:",e);const n=e?.snapId||c,t={method:e.method,params:e?.params||[]};return await window.ethereum.request({method:"wallet_invokeSnap",params:{snapId:n,request:t}})},d=async()=>[{address:await m({method:"getAddress"}),name:"Metamask account 1 🍻",type:"sr25519"}],h={accounts:{get:d,subscribe:(()=>{let e=[];return{subscribe:n=>(e.push(n),()=>{e=e.filter((e=>e!==n)),d().then(n).catch(console.error)}),notifySubscribers:n=>{e.forEach((e=>e(n)))}}})().subscribe},metadata:new class{get(){return(async()=>await m({method:"getMetadataList",params:{}}))()}provide(e){return(async e=>await m({method:"setMetadata",params:{metaData:e}}))(e)}},name:u,signer:{signPayload:async e=>await m({method:"signJSON",params:{payload:e}}),signRaw:async e=>await m({method:"signRaw",params:{raw:e}})},version:i},p=async e=>{console.info(`${u} is connecting to ${e} ...`);const n=await(async()=>await window.ethereum.request({method:"wallet_requestSnaps",params:l}))();return{...h,version:n?.[c]?.version}},w={connect:p,enable:p,version:i},f=window;f.injectedWeb3=f.injectedWeb3||{};let b=y(),g=null;function y(){return 0!==Object.values(f.injectedWeb3).filter((({connect:e,enable:n})=>!(!e&&!n))).length}function v(e){throw new Error(`${e}: web3Enable(originName) needs to be called before ${e}`)}function $(e,n=[]){if(!e)throw new Error("You must pass a name for your app to the web3Enable function");const t=n.length?Promise.all(n.map((e=>e().catch((()=>!1))))):Promise.resolve([!0]);var s;return s=()=>t.then((()=>function(e){return r&&(f.injectedWeb3[u]=w),Promise.all(Object.entries(f.injectedWeb3).map((([n,{connect:t,enable:s,version:o}])=>Promise.resolve().then((()=>t?t(e):s?s(e).then((e=>(0,a.Z)({name:n,version:o||"unknown"},e))):Promise.reject(new Error("No connect(..) or enable(...) hook found")))).catch((({message:e})=>{console.error(`Error initializing ${n}: ${e}`)}))))).then((e=>e.filter((e=>!!e))))}(e).then((e=>e.map((e=>(e.accounts.subscribe||(e.accounts.subscribe=n=>(e.accounts.get().then(n).catch(console.error),()=>{})),e))))).catch((()=>[])).then((e=>{const n=e.map((({name:e,version:n})=>`${e}/${n}`));return b=y(),console.info(`web3Enable: Enabled ${e.length} extension${1!==e.length?"s":""}: ${n.join(", ")}`),e})))),g=new Promise((e=>{"complete"===document.readyState?e(s()):window.addEventListener("load",(()=>e(s())))})),g}async function k({accountType:e,extensions:n,genesisHash:t,ss58Format:a}={}){const r=[],c=await async function(e,n){return g?(await g).filter((({name:e})=>!n||n.includes(e))):v(e)}("web3Accounts",n),i=await Promise.all(c.map((async({accounts:n,name:r})=>{try{return function(e,n,t){return n.map((({address:n,genesisHash:a,name:r,type:c})=>({address:42===n.length?n:(0,s.m)((0,o.m)(n),t),meta:{genesisHash:a,name:r,source:e},type:c})))}(r,function(e,n,t){return e.filter((e=>(!e.type||!t||t.includes(e.type))&&(!e.genesisHash||!n||e.genesisHash===n)))}(await n.get(),t,e),a)}catch{return[]}})));return i.forEach((e=>{r.push(...e)})),console.info(`web3Accounts: Found ${r.length} address${1!==r.length?"es":""}`),r}async function E(e){if(!g)return v("web3FromSource");const n=await g,t=e&&n.find((({name:n})=>n===e));if(!t)throw new Error(`web3FromSource: Unable to find an injected ${e}`);return t}}}]); \ No newline at end of file diff --git a/docs/page.89c997cfce551273.js b/docs/page.89c997cfce551273.js new file mode 100644 index 000000000000..d06291c747b2 --- /dev/null +++ b/docs/page.89c997cfce551273.js @@ -0,0 +1,1935 @@ +"use strict";(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[9768],{4709:(e,s,t)=>{t.d(s,{Z:()=>rt});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(34814),l=t(83337),c=t(11798),u=t(90778),d=t(45479),m=t(38894),h=t(54131),p=t(32980),x=t(19276),g=t(47623),b=t(69187),f=t(16039),j=t(95292),v=t(33661),y=t(31667),C=t(98551),w=t(55858),N=t(74076),k=t(17965),S=t(81503),I=t(6851),A=t(21924),P=t(57594),E=t(52926),M=t(46186),T=t(61349);function D(){return(0,T.$G)("app-accounts")}var F=t(46782),V=t.n(F),_=t(41186);function q(e,s,t){const o=s.filter((e=>!!e));return o.length?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(r.v2.Divider,{}),t&&(0,a.jsx)(r.v2.Header,{children:t}),o]},e):null}function O({json:e,pair:s}){V().saveAs(new Blob([JSON.stringify(e)],{type:"application/json; charset=utf-8"}),`${s.address}.json`)}function R(e,s){const t={action:"create",message:s,status:"success"};try{const s=e(),a=s.pair.address;t.account=a,"web"===(0,_.getEnvironment)()&&O(s),O(s),r.rp.setLastValue("account",a)}catch(e){t.status="error",t.message=e.message}return t}const z=["parent","name","date","balances"];function H({onChange:e,onEnter:s}){const{t}=D(),[{isPass1Valid:o,password1:i},l]=(0,n.useState)({isPass1Valid:!1,password1:""}),[{isPass2Valid:c,password2:u},d]=(0,n.useState)({isPass2Valid:!1,password2:""});(0,n.useEffect)((()=>e(i,o&&c)),[i,e,o,c]);const m=(0,n.useCallback)((e=>{l({isPass1Valid:b.Nn.isPassValid(e),password1:e}),d({isPass2Valid:b.Nn.isPassValid(u)&&u===e,password2:u})}),[u]),h=(0,n.useCallback)((e=>d({isPass2Valid:b.Nn.isPassValid(e)&&e===i,password2:e})),[i]);return(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("The password and password confirmation for this account. This is required to authenticate any transactions made and to encrypt the keypair.")}),(0,a.jsx)("p",{children:t("Ensure you are using a strong password for proper account protection.")})]}),children:[(0,a.jsx)(r.ro,{className:"full",isError:!o,label:t("password"),onChange:m,onEnter:s,value:i}),(0,a.jsx)(r.ro,{className:"full",isError:!c,label:t("password (repeat)"),onChange:h,onEnter:s,value:u}),(0,a.jsx)(r.YV,{value:i})]})}const $=n.memo((({name:{isNameValid:e,name:s},onCommit:t,setName:o,setPassword:i})=>{const{t:l}=D(),c=(0,n.useCallback)((e=>o({isNameValid:!!e.trim(),name:e})),[o]),u=(0,n.useCallback)(((e,s)=>i({isPasswordValid:s,password:e})),[i]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u_.Columns,{hint:l("The name for this account and how it will appear under your addresses. With an on-chain identity, it can be made available to others."),children:(0,a.jsx)(r.II,{className:"full",isError:!e,label:l("name"),onChange:c,onEnter:t,placeholder:l("new account"),value:s})}),(0,a.jsx)(H,{onChange:u,onEnter:t})]})})),L=n.memo((function({address:e,derivePath:s,name:t,pairType:n,seed:o}){const{t:i}=D(),l=o?.split(" "),c=(0,N.vq)(o)?`${o.slice(10)} … ${o.slice(-8)}`:l?.map(((e,s)=>s%3?"…":e)).join(" ");return(0,a.jsx)(r.u_.Content,{children:(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:i('We will provide you with a generated backup file after your account is created. As long as you have access to your account you can always download this file later by clicking on "Backup" button from the Accounts section.')}),(0,a.jsx)("p",{children:i("Please make sure to save this file in a secure location as it is required, together with your password, to restore your account.")})]}),children:[e&&t&&(0,a.jsx)(r.mV,{defaultName:t,isInline:!0,noDefaultNameOpacity:!0,value:e}),c&&(0,a.jsx)(r.qG,{label:i("partial seed"),value:c}),(0,a.jsx)(r.qG,{label:i("keypair type"),value:n}),(0,a.jsx)(r.qG,{label:i("derivation path"),value:s||i("")})]})})})),B="m/44'/60'/0'/0/0",Z=n.memo((function({className:e,derivePath:s,deriveValidation:t,onChange:o,seedType:i}){const{t:l}=D(),[c,u]=(0,n.useState)(0),[d,h]=(0,n.useState)(j.nw),[p]=(0,n.useState)((()=>new Array(10).fill(0).map(((e,s)=>({key:s,text:l("Address index {{index}}",{replace:{index:s}}),value:s}))))),[x,g]=(0,m.O)(),[b,f]=(0,m.O)(),v=(0,n.useRef)({INVALID_DERIVATION_PATH:l("This is an invalid derivation path."),PASSWORD_IGNORED:l("Password are ignored for hex seed"),SOFT_NOT_ALLOWED:l("Soft derivation paths are not allowed on ed25519"),WARNING_SLASH_PASSWORD:l('Your password contains at least one "/" character. Disregard this warning if it is intended.')});return(0,n.useEffect)((()=>{o(`m/44'/60'/0'/0/${b?Number(d):c}`)}),[d,o,b,c]),(0,a.jsxs)(r.u_.Columns,{className:e,hint:l("raw"===i?"The derivation path is only relevant when deriving keys from a mnemonic.":"The derivation path allows you to create different accounts from the same base mnemonic."),children:["bip"===i?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"saveToggle",children:(0,a.jsx)(r.XZ,{label:(0,a.jsx)(a.Fragment,{children:l("Use custom address index")}),onChange:f,value:b})}),b?(0,a.jsx)(r.Rn,{isDecimal:!1,label:l("Custom index"),onChange:h,value:d}):(0,a.jsx)(r.Lt,{label:l("address index"),onChange:u,options:p,value:c}),(0,a.jsx)("div",{className:"saveToggle",children:(0,a.jsx)(r.XZ,{label:(0,a.jsx)(a.Fragment,{children:l("Use custom derivation path")}),onChange:g,value:x})}),x?(0,a.jsx)(r.II,{isError:!!t?.error,label:l("secret derivation path"),onChange:o,placeholder:B,tabIndex:-1,value:s}):null]}):(0,a.jsx)(r.Pd,{content:l("The derivation path is only relevant when deriving keys from a mnemonic.")}),t?.error&&(0,a.jsx)(r.oy,{content:v.current[t.error]||t.error}),t?.warning&&(0,a.jsx)(r.Pd,{content:v.current[t.warning]})]})}));var W=t(72570);const U=(0,t(77004).h)(20),J=n.memo((function({className:e,onClose:s}){const{t}=D(),{api:o}=(0,u.h)(),{getLedger:i}=(0,d.c)(),[l,c]=(0,n.useState)(0),[m,h]=(0,n.useState)(0),[p,x]=(0,n.useState)(null),[{isNameValid:g,name:f},j]=(0,n.useState)({isNameValid:!1,name:""}),[v,y]=(0,n.useState)(!1),C=(0,n.useRef)(U.map((e=>({text:t("Account type {{index}}",{replace:{index:e}}),value:e})))),w=(0,n.useRef)(U.map((e=>({text:t("Address index {{index}}",{replace:{index:e}}),value:e})))),N=(0,n.useCallback)((e=>j({isNameValid:!!e.trim(),name:e})),[]),k=(0,n.useCallback)((()=>{x(null),y(!0),async function(e,s,t,a,n){const{address:o}=await s().getAddress(!1,a,n);b.Nn.addHardware(o,"ledger",{accountOffset:a,addressOffset:n,genesisHash:e.genesisHash.toHex(),name:t||`ledger ${a}/${n}`})}(o,i,f,l,m).then((()=>s())).catch((e=>{console.error(e),y(!1),x(e)}))}),[l,m,o,i,f,s]);return(0,a.jsxs)(r.u_,{className:e,header:t("Add account via Ledger"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:t("The name for this account as it will appear under your accounts."),children:(0,a.jsx)(r.II,{autoFocus:!0,className:"full",isError:!g,label:t("name"),onChange:N,placeholder:t("account name"),value:f})}),(0,a.jsx)(r.u_.Columns,{hint:t("The account type that you wish to create. This is the top-level derivation."),children:(0,a.jsx)(r.Lt,{label:t("account type"),onChange:c,options:C.current,value:l})}),(0,a.jsxs)(r.u_.Columns,{hint:t("The address index on the account that you wish to add. This is the second-level derivation."),children:[(0,a.jsx)(r.Lt,{label:t("address index"),onChange:h,options:w.current,value:m}),p&&(0,a.jsx)(r.oy,{content:p.message})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isBusy:v,isDisabled:!g,label:t("Save"),onClick:k})})]})})),G=W.uG.filter((({hasLedgerSupport:e})=>e)),Y=n.memo((function({className:e,onChange:s,seedType:t}){const{t:o}=D(),[i,l]=(0,n.useState)(0),[c,u]=(0,n.useState)(0),[d,m]=(0,n.useState)("polkadot"),h=(0,n.useRef)(G.map((({displayName:e,network:s})=>({text:e,value:s})))),p=(0,n.useRef)(U.map((e=>({text:o("Account type {{index}}",{replace:{index:e}}),value:e})))),x=(0,n.useRef)(U.map((e=>({text:o("Address index {{index}}",{replace:{index:e}}),value:e}))));return(0,n.useEffect)((()=>{const e=G.find((({network:e})=>e===d));s(`m/44'/${e?.slip44}'/${i}'/0'/${c}'`)}),[i,c,d,s]),(0,a.jsx)(r.u_.Columns,{className:e,hint:o("The derivation will be constructed from the values you specify."),children:"bip"===t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Lt,{label:o("Ledger app type (originated from)"),onChange:m,options:h.current,value:d}),(0,a.jsx)(r.Lt,{label:o("account type"),onChange:l,options:p.current,value:i}),(0,a.jsx)(r.Lt,{label:o("address index"),onChange:u,options:x.current,value:c})]}):(0,a.jsx)(r.oy,{content:o("Derivation for Ledger-type accounts are only available on mnemonic seeds.")})})})),Q=navigator.userAgent.toLowerCase().indexOf(" electron/")>-1,K=n.memo((function(){const{t:e}=D();return Q?null:(0,a.jsx)(r.Pd,{content:(0,a.jsxs)(a.Fragment,{children:[e("Consider storing your account in a signer such as a browser extension, hardware device, QR-capable phone wallet (non-connected) or desktop application for optimal account security.")," ",e("Future versions of the web-only interface will drop support for non-external accounts, much like the IPFS version.")]})})}));function X(e,s,t){return"ed25519-ledger"===t?(0,w.c)((0,S.O)(e,s).secretKey.slice(0,32)):"ethereum"===t?`${e}/${s}`:`${e}${s}`}function ee(e,s,t){return b.Nn.createFromUri(X(e,s,t),{},"ed25519-ledger"===t?"ed25519":t).address}function se(e,s,t,a="sr25519"){const n=function(e,s){switch(s){case"bip":return(0,P._)();case"dev":return y.g;default:return e||(0,w.c)((0,E.F)())}}(e,t);return{address:ee(n,s,a),derivePath:s,deriveValidation:void 0,isSeedValid:!0,pairType:a,seed:n,seedType:t}}function te(e,s,t,a){let n=null,o=function(e,s,t,a){try{const{password:n,path:o}=(0,I.Q)("ethereum"===a?`${e}/${t}`:`${e}${t}`);let r={};return n?.includes("/")&&(r={warning:"WARNING_SLASH_PASSWORD"}),"ed25519"===a&&o.some((({isSoft:e})=>e))?{...r,error:"SOFT_NOT_ALLOWED"}:"raw"===s&&n?{...r,error:"PASSWORD_IGNORED"}:"ethereum"!==a||(0,A.p)(t)?r:{...r,error:"INVALID_DERIVATION_PATH"}}catch(e){return{error:e.message}}}(e,t,s,a),r=!1;if("raw"===t)r=function(e){return e.length>0&&e.length<=32||function(e){return(0,N.vq)(e)&&66===e.length}(e)}(e);else{const s=e.split(" ");"ed25519-ledger"===a&&25===s.length?(s.pop(),r=(0,M.S)(s.join(" "))):r=(0,M.S)(e)}if(!o?.error&&r)try{n=ee(e,s,a)}catch(e){console.error(e),o={error:e.message?e.message:e.toString()},r=!1}return{address:n,derivePath:s,deriveValidation:o,isSeedValid:r,pairType:a,seed:e,seedType:t}}const ae=(0,r.zo)(r.u_)` + .accounts--Creator-advanced { + margin-top: 1rem; + overflow: visible; + } + + .ui--CopyButton.copyMoved { + position: absolute; + right: 9.25rem; + top: 1.15rem; + } + + && .TextAreaWithDropdown { + textarea { + width: 80%; + } + .ui.buttons { + width: 20%; + } + } + + .saveToggle { + text-align: right; + + .ui--Checkbox { + margin: 0.8rem 0; + + > label { + font-weight: var(--font-weight-normal); + } + } + } +`,ne=n.memo((function({className:e="",onClose:s,onStatusChange:t,seed:o,type:i}){const{t:l}=D(),{api:c,isDevelopment:m,isEthereum:h}=(0,u.h)(),{isLedgerEnabled:p}=(0,d.c)(),[{address:x,derivePath:g,deriveValidation:j,isSeedValid:v,pairType:y,seed:w,seedType:N},S]=(0,n.useState)((()=>se(o,h?B:"",o?"raw":"bip",h?"ethereum":i))),[I,A]=(0,n.useState)(!1),[P,E,M]=(0,C.t)(),[T,F]=(0,n.useState)(!1),[{isNameValid:V,name:_},q]=(0,n.useState)((()=>({isNameValid:!1,name:""}))),[{isPasswordValid:O,password:z},H]=(0,n.useState)((()=>({isPasswordValid:!1,password:""}))),W=!!x&&I&&!j?.error&&v,U=V&&O,J=W&&U,G=(0,n.useRef)({INVALID_DERIVATION_PATH:l("This is an invalid derivation path."),PASSWORD_IGNORED:l("Password are ignored for hex seed"),SOFT_NOT_ALLOWED:l("Soft derivation paths are not allowed on ed25519"),WARNING_SLASH_PASSWORD:l('Your password contains at least one "/" character. Disregard this warning if it is intended.')}),Q=(0,n.useRef)((m?[{text:l("Development"),value:"dev"}]:[]).concat({text:l("Mnemonic"),value:"bip"},h?{text:l("Private Key"),value:"raw"}:{text:l("Raw seed"),value:"raw"})),ee=(0,n.useCallback)((e=>S(te(w,e,N,y))),[y,w,N]),ne=(0,n.useCallback)((e=>S(te(e,g,N,y))),[g,y,N]),oe=(0,n.useCallback)((e=>S(te(w,h?B:"",N,e))),[w,N,h]),re=(0,n.useCallback)((e=>{e!==N&&S(se(null,g,e,y))}),[g,y,N]),ie=(0,n.useCallback)((()=>A(!I)),[I]),le=(0,n.useCallback)((()=>{J&&(F(!0),(0,k.Y)((()=>{const e={genesisHash:m?void 0:c.genesisHash.toHex(),isHardware:!1,name:_.trim()},a=function(e,s,t,{genesisHash:a,name:n,tags:o=[]},r,i){return R((()=>b.Nn.addUri(X(e,s,t),r,{genesisHash:a,isHardware:!1,name:n,tags:o},"ed25519-ledger"===t?"ed25519":t)),i)}(w,g,y,e,z,l("created account"));t(a),F(!1),s()})))}),[c,g,m,J,_,s,t,y,z,w,l]);return(0,a.jsxs)(ae,{className:e,header:l("Add an account via seed {{step}}/{{STEPS_COUNT}}",{replace:{STEPS_COUNT:3,step:P}}),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(r.mV,{defaultName:_,fullLength:!0,isEditableName:!1,noDefaultNameOpacity:!0,value:v&&x||null})}),1===P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u_.Columns,{hint:l("The secret seed value for this account. Ensure that you keep this in a safe place, with access to the seed you can re-create the account."),children:(0,a.jsxs)(r.Kx,{isError:!v,isReadOnly:"dev"===N,label:l("bip"===N?"mnemonic seed":"dev"===N?"development seed":h?"ethereum private key":"seed (hex or string)"),onChange:ne,seed:w,withLabel:!0,children:[(0,a.jsx)(r.qi,{className:"copyMoved",type:"bip"===N?l("mnemonic"):"raw"===N?h?l("private key"):"seed":l("raw seed"),value:w}),(0,a.jsx)(r.Lt,{defaultValue:N,isButton:!0,onChange:re,options:Q.current})]})}),(0,a.jsxs)(r.xH,{className:"accounts--Creator-advanced",isPadded:!0,summary:l("Advanced creation options"),children:["ethereum"!==y&&(0,a.jsx)(r.u_.Columns,{hint:l("If you are moving accounts between applications, ensure that you use the correct type."),children:(0,a.jsx)(r.Lt,{defaultValue:y,label:l("keypair crypto type"),onChange:oe,options:h?f.X.availableCryptosEth:p?f.X.availableCryptosLedger:f.X.availableCryptos,tabIndex:-1})}),"ed25519-ledger"===y?(0,a.jsx)(Y,{onChange:ee,seedType:N}):"ethereum"===y?(0,a.jsx)(Z,{derivePath:g,deriveValidation:j,onChange:ee,seed:w,seedType:N}):(0,a.jsxs)(r.u_.Columns,{hint:l("The derivation path allows you to create different accounts from the same base mnemonic."),children:[(0,a.jsx)(r.II,{isDisabled:"raw"===N,isError:!!j?.error,label:l("secret derivation path"),onChange:ee,placeholder:l("raw"===N?"sr25519"===y?"//hard/soft":"//hard":"sr25519"===y?"//hard/soft///password":"//hard///password"),tabIndex:-1,value:g}),j?.error&&(0,a.jsx)(r.oy,{content:G.current[j.error]||j.error}),j?.warning&&(0,a.jsx)(r.Pd,{content:G.current[j.warning]})]})]}),(0,a.jsxs)(r.u_.Columns,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("div",{className:"saveToggle",children:(0,a.jsx)(r.XZ,{label:(0,a.jsx)(a.Fragment,{children:l("I have saved my mnemonic seed safely")}),onChange:ie,value:I})})]})]}),2===P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)($,{name:{isNameValid:V,name:_},onCommit:le,setName:q,setPassword:H}),";",(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(K,{})})]}),3===P&&x&&(0,a.jsx)(L,{derivePath:g,isBusy:T,pairType:"ed25519-ledger"===y?"ed25519":y,seed:w})]}),(0,a.jsxs)(r.u_.Actions,{children:[1===P&&(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"step-forward",isDisabled:!W,label:l("Next"),onClick:E}),2===P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:l("Prev"),onClick:M}),(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"step-forward",isDisabled:!U,label:l("Next"),onClick:E})]}),3===P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:l("Prev"),onClick:M}),(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"plus",isBusy:T,label:l("Save"),onClick:le})]})]})]})}));var oe=t(56623),re=t(48731);const ie=["application/json","text/plain"],le=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=D(),{api:i,isDevelopment:l,isEthereum:c}=(0,u.h)(),[d,m]=(0,n.useState)(!1),[h,p]=(0,n.useState)(null),[x,g]=(0,n.useState)(null),[{isPassValid:f,password:j},v]=(0,n.useState)({isPassValid:!1,password:""}),y=(0,n.useMemo)((()=>l?null:i.genesisHash.toHex()),[i,l]),C=(0,n.useMemo)((()=>!!h?.meta.genesisHash&&h.meta.genesisHash!==y),[y,h]),w=(0,n.useCallback)((e=>p(function(e,s,t,a){try{const s=b.Nn.createFromJson(JSON.parse((0,oe.z)(e)),{genesisHash:a});return t?(0,re.hu)("ethereum"===s.type,"JSON File does not contain an ethereum type key pair"):(0,re.hu)("ethereum"!==s.type,"JSON contains an ethereum keytype, this is not available on this network"),s}catch(e){console.error(e),s(e.message?e.message:e.toString())}return null}(e,g,c,y))),[y,c]),N=(0,n.useCallback)((e=>v({isPassValid:b.Nn.isPassValid(e),password:e})),[]),S=(0,n.useCallback)((()=>{h&&(m(!0),(0,k.Y)((()=>{const e={action:"restore"};try{b.Nn.addPair(h,j),e.status="success",e.account=h.address,e.message=o("account restored"),r.rp.setLastValue("account",h.address)}catch(s){v((e=>({...e,isPassValid:!1}))),e.status="error",e.message=s.message,console.error(s)}m(!1),t(e),"error"!==e.status&&s()})))}),[s,t,h,j,o]);return(0,a.jsxs)(r.u_,{className:e,header:o("Add via backup file"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(r.mV,{defaultName:h?.meta.name||null,noDefaultNameOpacity:!0,value:h?.address||null})}),(0,a.jsx)(r.u_.Columns,{hint:o("Supply a backed-up JSON file, encrypted with your account-specific password."),children:(0,a.jsx)(r.ht,{accept:ie,className:"full",isError:!h,label:o("backup file"),onChange:w,withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:o("The password previously used to encrypt this account."),children:(0,a.jsx)(r.ro,{autoFocus:!0,className:"full",isError:!f,label:o("password"),onChange:N,onEnter:S,value:j})}),(0,a.jsxs)(r.u_.Columns,{children:[x&&(0,a.jsx)(r.oy,{content:x}),C&&(0,a.jsx)(r.Pd,{content:o('The network from which this account was originally generated is different than the network you are currently connected to. Once imported ensure you toggle the "allow on any network" option for the account to keep it visible on the current network.')}),(0,a.jsx)(K,{})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"sync",isBusy:d,isDisabled:!h||!f,label:o("Restore"),onClick:S})})]})}));var ce=t(48801),ue=t.n(ce),de=t(5122),me=t(37146),he=t(11677);function pe(e,s,t){return s.reduce(((e,s)=>(s===t||e.includes(s)||e.push(s),e)),e)}const xe=(0,he.e)("useKnownAddresses",(function(e){const{accounts:{allAccounts:s},addresses:{allAddresses:t}}=(0,me.i)();return(0,n.useMemo)((()=>pe(pe([],s,e),t,e)),[s,t,e])})),ge=new(ue())(2),be=["application/json"],fe=(0,r.zo)(r.u_)` + .signaturesFileToggle { + width: 100%; + text-align: right; + } +`,je=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{api:o,isDevelopment:i}=(0,u.h)(),{t:l}=D(),c=xe(),[{isNameValid:d,name:m},h]=(0,n.useState)({isNameValid:!1,name:""}),[{isUploadedFileValid:p,uploadedFileError:x,uploadedSignatories:g},f]=(0,n.useState)({isUploadedFileValid:!0,uploadedFileError:"",uploadedSignatories:[]}),[j,v]=(0,n.useState)([""]),[y,C]=(0,n.useState)(!1),[{isThresholdValid:w,threshold:N},k]=(0,n.useState)({isThresholdValid:!0,threshold:ge}),S=(0,n.useCallback)((()=>{const e={genesisHash:i?void 0:o.genesisHash.toHex(),name:m.trim()},a=function(e,s,{genesisHash:t,name:a,tags:n=[]},o){const r={action:"create"};try{const i=b.Nn.addMultisig(e,s,{genesisHash:t,name:a,tags:n}),{address:l}=i.pair;r.account=l,r.status="success",r.message=o}catch(e){r.status="error",r.message=e.message,console.error(e)}return r}(j,N,e,l("created multisig"));t(a),s()}),[o.genesisHash,i,m,s,t,j,l,N]),I=(0,n.useCallback)((e=>h({isNameValid:e.trim().length>=3,name:e})),[]),A=(0,n.useCallback)((e=>e&&k({isThresholdValid:e.gte(ge)&&e.lten(j.length),threshold:e})),[j]),P=(0,n.useCallback)((e=>{const s=function(e){let s,t="";try{s=JSON.parse((0,oe.z)(e)),(0,re.hu)(Array.isArray(s)&&!!s.length,"JSON file should contain an array of signatories"),s=s.filter((e=>(0,de.Y)(e))),s=[...new Set(s)],(0,re.hu)(s.length<=16,"Maximum you can have 16 signatories")}catch(e){s=[],t=e.message?e.message:e.toString()}return{isUploadedFileValid:!t,uploadedFileError:t,uploadedSignatories:s}}(e);f(s),(s.isUploadedFileValid||g.length)&&v(s.uploadedSignatories.length?s.uploadedSignatories:[""])}),[g]),E=(0,n.useCallback)((()=>{f({isUploadedFileValid:p,uploadedFileError:x,uploadedSignatories:[]})}),[x,p]),M=(0,n.useCallback)((e=>{E(),v(e)}),[E]),T=d&&w;return(0,a.jsxs)(fe,{className:e,header:l("Add multisig"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(r.ZD,{className:"signaturesFileToggle",label:l("Upload JSON file with signatories"),onChange:C,value:y})}),!y&&(0,a.jsx)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:l("The signatories has the ability to create transactions using the multisig and approve transactions sent by others.Once the threshold is reached with approvals, the multisig transaction is enacted on-chain.")}),(0,a.jsx)("p",{children:l("Since the multisig function like any other account, once created it is available for selection anywhere accounts are used and needs to be funded before use.")})]}),children:(0,a.jsx)(r.m3,{available:c,availableLabel:l("available signatories"),maxCount:16,onChange:M,valueLabel:l("selected signatories")})}),y&&(0,a.jsxs)(r.u_.Columns,{hint:l("Supply a JSON file with the list of signatories."),children:[(0,a.jsx)(r.ht,{accept:be,className:"full",clearContent:!g.length&&p,isError:!p,label:l("upload signatories list"),onChange:P,withLabel:!0}),!!g.length&&(0,a.jsx)(r.jN,{label:l("found signatories"),labelExtra:(0,a.jsx)(r.JH,{icon:"sync",label:l("Reset"),onClick:E}),children:(0,a.jsx)("div",{className:"ui--Static ui dropdown selection",children:g.map((e=>(0,a.jsx)("div",{children:(0,a.jsx)(r.ax,{value:e,withSidebar:!1})},e)))})}),x&&(0,a.jsx)(r.oy,{content:x})]}),(0,a.jsx)(r.u_.Columns,{hint:l("The threshold for approval should be less or equal to the number of signatories for this multisig."),children:(0,a.jsx)(r.Rn,{isError:!w,label:l("threshold"),onChange:A,value:N})}),(0,a.jsx)(r.u_.Columns,{hint:l("The name is for unique identification of the account in your owner lists."),children:(0,a.jsx)(r.II,{autoFocus:!0,className:"full",isError:!d,label:l("name"),onChange:I,placeholder:l("multisig name")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!T,label:l("Create"),onClick:S})})]})}));var ve=t(74065);function ye(e,s,t,a=j.nw){const n=s.toString();return{address:n,delay:a,isOwned:e.includes(n),type:t}}const Ce=(0,he.e)("useProxies",(function(e){const{api:s}=(0,u.h)(),{allAccounts:t}=(0,i.x)(),a=(0,ve.X)(),[o,r]=(0,n.useState)(null);return(0,n.useEffect)((()=>{r(null),e&&s.query.proxy?.proxies(e).then((([e])=>{const n=3===s.tx.proxy.addProxy.meta.args.length?e.map((({delay:e,delegate:s,proxyType:a})=>ye(t,s,a,e))):e.map((([e,s])=>ye(t,e,s))),o=n.filter((({isOwned:e})=>e));a.current&&r({isEmpty:0===o.length,owned:o,proxies:n})})).catch(console.error)}),[t,s,e,a]),o})),we=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{api:o,isDevelopment:i}=(0,u.h)(),{t:l}=D(),[{isNameValid:c,name:d},m]=(0,n.useState)({isNameValid:!1,name:""}),[h,p]=(0,n.useState)(null),x=Ce(h),g=(0,n.useCallback)((()=>{if(h){const e={genesisHash:i?void 0:o.genesisHash.toHex(),name:d.trim()},a=function(e,{genesisHash:s,name:t,tags:a=[]},n){const o={action:"create"};try{b.Nn.addExternal(e,{genesisHash:s,isProxied:!0,name:t,tags:a}),o.account=e,o.status="success",o.message=n}catch(e){o.status="error",o.message=e.message}return o}(h,e,l("added proxy"));t(a),s()}}),[o.genesisHash,i,d,s,t,h,l]),f=(0,n.useCallback)((e=>m({isNameValid:e.trim().length>=3,name:e})),[]),j=c&&!!h&&x&&!x.isEmpty;return(0,a.jsxs)(r.u_,{className:e,header:l("Add proxied account"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:l("The address that has previously setup a proxy to one of the accounts that you control."),children:(0,a.jsx)(r.bm,{autoFocus:!0,isError:!x||x.isEmpty,label:l("proxied account"),onChange:p,placeholder:l("address being proxied")})}),(0,a.jsx)(r.u_.Columns,{hint:l("The name is for unique identification of the account in your owner lists."),children:(0,a.jsx)(r.II,{className:"full",isError:!c,label:l("name"),onChange:f,placeholder:l("proxied name")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!j,label:l("Add"),onClick:g})})]})})),Ne=(0,r.zo)(r.u_)` + .qr-wrapper { + margin: 0 auto; + max-width: 30rem; + } +`,ke=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=D(),{api:i,isEthereum:c}=(0,u.h)(),{isIpfs:d}=(0,l.g)(),[{isNameValid:m,name:h},p]=(0,n.useState)({isNameValid:!1,name:""}),[{address:x,isAddress:g,scanned:f,warning:j},v]=(0,n.useState)({address:"",isAddress:!1,scanned:null}),[{isPasswordValid:y,password:C},w]=(0,n.useState)({isPasswordValid:!1,password:""}),N=!!x&&m&&(g||y),k=(0,n.useMemo)((()=>!!f&&!!f.genesisHash&&!i.genesisHash.eq(f.genesisHash)),[f,i]),S=(0,n.useCallback)((e=>p({isNameValid:!!e.trim(),name:e})),[]),I=(0,n.useCallback)(((e,s)=>w({isPasswordValid:s,password:e})),[]),A=(0,n.useCallback)((e=>{v({address:e.isAddress?e.content:b.Nn.createFromUri(e.content,{},"sr25519").address,isAddress:e.isAddress,scanned:e}),e.name&&S(e.name)}),[S]),P=(0,n.useCallback)((e=>{v({address:"",isAddress:!1,scanned:null,warning:e.message})}),[]),E=(0,n.useCallback)((()=>{if(!f||!N)return;const{content:e,isAddress:a}=f,n={genesisHash:f.genesisHash||i.genesisHash.toHex(),name:h.trim()},l=a?c?b.Nn.addExternal(e).pair.address:b.Nn.addExternal(e,n).pair.address:b.Nn.addUri(e,C,n,"sr25519").pair.address;r.rp.setLastValue("account",l),t({account:l,action:"create",message:o("created account"),status:"success"}),s()}),[i,N,h,s,t,C,f,c,o]);return(0,a.jsxs)(Ne,{className:e,header:o("Add account via Qr"),onClose:s,size:"large",children:[(0,a.jsx)(r.u_.Content,{children:f?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(r.mV,{defaultName:h,noDefaultNameOpacity:!0,value:f.content})}),(0,a.jsxs)(r.u_.Columns,{hint:o("The local name for this account. Changing this does not affect your on-line identity, so this is only used to indicate the name of the account locally."),children:[(0,a.jsx)(r.II,{autoFocus:!0,className:"full",isError:!m,label:o("name"),onChange:S,onEnter:E,value:h}),k&&(0,a.jsx)(r.Pd,{content:o("The genesisHash for the scanned account does not match the genesisHash of the connected chain. The account will not be usable on this chain.")})]}),!g&&(0,a.jsx)(H,{onChange:I,onEnter:E})]}):(0,a.jsxs)(r.u_.Columns,{hint:o("Provide the account QR from the module/external application for scanning. Once detected as valid, you will be taken to the next step to add the account to your list."),children:[(0,a.jsx)("div",{className:"qr-wrapper",children:(0,a.jsx)(r.CU,{isEthereum:c,onError:P,onScan:A})}),j&&(0,a.jsx)(r.Pd,{content:j})]})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!f||!N||!g&&d,label:o("Save"),onClick:E})})]})}));var Se=t(13731),Ie=t(9118);const Ae={transform:e=>e.map((([e])=>e))},Pe={transform:([[e],s])=>s.map(((s,t)=>{if(!s.isCasting)return null;const a=s.asCasting;return[e[t][1],a.votes.map((([e])=>e)),a]})).filter((e=>!!e)),withParamsTransform:!0},Ee={transform:([[e],s])=>s.map(((s,t)=>s.isSome?[e[t],s.unwrap()]:null)).filter((e=>!!e)),withParamsTransform:!0},Me=(0,he.e)("useAccountLocks",(function(e,s,t){const{api:a}=(0,u.h)(),o=(0,n.useMemo)((()=>[t]),[t]),r=(0,Ie.W7)(o&&a.query[s]?.classLocksFor,o,Ae),i=(0,n.useMemo)((()=>function(e,s){if(s)return[s.map((s=>[e,s]))]}(t,r)),[t,r]),l=(0,Ie.W7)(i&&a.query[s]?.votingFor.multi,i,Pe),c=(0,n.useMemo)((()=>function(e){if(e?.length){const s=e.reduce(((e,[,s])=>e.concat(s)),[]);if(s.length)return[s]}}(l)),[l]),d=(0,Ie.W7)(c&&a.query[e]?.referendumInfoFor.multi,c,Ee);return(0,n.useMemo)((()=>l&&d&&function(e,s,t,a){const n=e.consts[s].voteLockingPeriod,o=[];for(let e=0,s=t.length;ee.eq(t)));if(l){const[,e]=l;let a,r,c=0,u="None";const d=1;if(i.isStandard){const{balance:s,vote:t}=i.asStandard;a=s,(e.isApproved&&t.isAye||e.isRejected&&t.isNay)&&(c=t.conviction.index,u=t.conviction.type)}else if(i.isSplit){const{aye:e,nay:s}=i.asSplit;a=e.add(s)}else if(i.isSplitAbstain){const{abstain:e,aye:s,nay:t}=i.asSplitAbstain;a=s.add(t).add(e)}else console.error(`Unable to handle ${i.type}`);e.isOngoing?r=j.Ew:e.isKilled?r=e.asKilled:e.isCancelled||e.isTimedOut?r=e.isCancelled?e.asCancelled[0]:e.asTimedOut[0]:e.isApproved||e.isRejected?r=n.muln(c?Se.d[c-1][d]:0).add(e.isApproved?e.asApproved[0]:e.asRejected[0]):console.error(`Unable to handle ${e.type}`),a&&r&&o.push({classId:s,endBlock:r,locked:u,refId:t,total:a})}}}return o}(a,s,l,d)),[a,s,d,l])}));var Te=t(86135),De=t(54383),Fe=t(83696),Ve=t(78627),_e=t(37198),qe=t(14681),Oe=t(92730);const Re=n.memo((function({address:e,onClose:s}){const{t}=D(),[o,i]=(0,n.useState)(!1),[{isPassTouched:l,password:c},u]=(0,n.useState)({isPassTouched:!1,password:""}),[d,m]=(0,n.useState)(!1),h=!d&&b.Nn.isPassValid(c),p=(0,n.useCallback)((e=>{m(!1),u({isPassTouched:!0,password:e})}),[]),x=(0,n.useCallback)((()=>{i(!0),(0,k.Y)((()=>{try{const s=e&&b.Nn.getPair(e),t=s&&b.Nn.backupAccount(s,c),a=new Blob([JSON.stringify(t)],{type:"application/json; charset=utf-8"});V().saveAs(a,`${e}.json`)}catch(e){return m(!0),i(!1),void console.error(e)}i(!1),s()}))}),[e,s,c]);return(0,a.jsxs)(r.u_,{className:"app--accounts-Modal",header:t("Backup account"),onClose:s,children:[(0,a.jsx)(r.u_.Content,{children:(0,a.jsxs)(r.mV,{isInline:!0,value:e,children:[(0,a.jsx)("p",{children:t('An encrypted backup file will be created once you have pressed the "Download" button. This can be used to re-import your account on any other machine.')}),(0,a.jsx)("p",{children:t("Save this backup file in a secure location. Additionally, the password associated with this account is needed together with this backup file in order to restore your account.")}),(0,a.jsx)("div",{children:(0,a.jsx)(r.ro,{autoFocus:!0,isError:l&&!h,label:t("password"),onChange:p,onEnter:x,tabIndex:0,value:c})})]})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"download",isBusy:o,isDisabled:!h,label:t("Download"),onClick:x})})]})})),ze=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=D(),[i,l]=(0,n.useState)(!1),[c,u]=(0,n.useState)({isValid:!1,password:""}),[d,m]=(0,n.useState)({isValid:!1,password:""}),[{isOldValid:h,oldPass:p},x]=(0,n.useState)({isOldValid:!1,oldPass:""}),g=(0,n.useCallback)((e=>u({isValid:b.Nn.isPassValid(e),password:e})),[]),f=(0,n.useCallback)((e=>m({isValid:b.Nn.isPassValid(e)&&c.password===e,password:e})),[c]),j=(0,n.useCallback)((e=>x({isOldValid:b.Nn.isPassValid(e),oldPass:e})),[]),v=(0,n.useCallback)((()=>{const s=e&&b.Nn.getPair(e);s&&(l(!0),(0,k.Y)((()=>{try{s.isLocked||s.lock(),s.decodePkcs8(p)}catch{return x((e=>({...e,isOldValid:!1}))),void l(!1)}try{b.Nn.encryptAccount(s,c.password)}catch{return m((e=>({...e,isValid:!1}))),void l(!1)}l(!1),t()})))}),[e,c,p,t]);return(0,a.jsxs)(r.u_,{className:`${s} app--accounts-Modal`,header:o("Change account password"),onClose:t,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.mV,{isInline:!0,value:e}),(0,a.jsx)(r.u_.Columns,{hint:o("The existing account password as specified when this account was created or when it was last changed."),children:(0,a.jsx)(r.ro,{autoFocus:!0,isError:!h,label:o("your current password"),onChange:j,tabIndex:1,value:p})}),(0,a.jsxs)(r.u_.Columns,{hint:o("This will apply to any future use of this account as stored on this browser. Ensure that you securely store this new password and that it is strong and unique to the account."),children:[(0,a.jsx)(r.ro,{isError:!c.isValid,label:o("your new password"),onChange:g,onEnter:v,tabIndex:2,value:c.password}),(0,a.jsx)(r.ro,{isError:!d.isValid,label:o("password (repeat)"),onChange:f,onEnter:v,tabIndex:2,value:d.password}),(0,a.jsx)(r.YV,{value:c.password})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"sign-in-alt",isBusy:i,isDisabled:!c.isValid||!d.isValid||!h,label:o("Change"),onClick:v})})]})}));var He=t(36609);const $e=n.memo((function({amount:e,delegatingAccount:s,onError:t}){const{t:o}=D(),{api:i}=(0,u.h)(),l=(0,Ie.W7)(i.derive.balances?.all,[s]),[{error:c,warning:d},m]=(0,n.useState)({error:null,warning:null});return(0,n.useEffect)((()=>{if(l?.freeBalance&&e?.gt(j.nw)){let s=null;e.gte(l.freeBalance)&&(s=o("The maximum amount you can delegate is the amount of funds available on the delegating account.")),m((e=>{const a=e.error!==s?s:e.error,n=e.warning;return t(a||n?{error:a,warning:n}:null),{error:a,warning:n}}))}}),[i,t,e,o,l]),c?(0,a.jsx)(r.oy,{content:c}):d?(0,a.jsx)(r.Pd,{content:d}):null})),Le=n.memo((function({onClose:e,previousAmount:s,previousConviction:t,previousDelegatedAccount:o,previousDelegatingAccount:i}){const{t:l}=D(),{api:c}=(0,u.h)(),[d,m]=(0,n.useState)(null),[h]=(0,n.useState)(),[p,x]=(0,n.useState)(s),[g,b]=(0,n.useState)(i||null),[f,v]=(0,n.useState)(o||null),y=void 0===t?0:t.toNumber(),[C,w]=(0,n.useState)(y),N=p?.toString()!==s?.toString()||f!==o||g!==i||C!==t?.toNumber();return(0,a.jsxs)(r.u_,{className:"staking--Delegate",header:l(o?"democracy vote delegation":"delegate democracy vote"),onClose:e,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:l("Any democracy vote performed by the delegated account will result in an additional vote from the delegating account")}),(0,a.jsx)("p",{children:l("If the delegated account is currently voting in a referendum, the delegating vote and conviction will be added.")})]}),children:[(0,a.jsx)(r.rp,{label:l("delegating account"),onChange:b,type:"account",value:g}),(0,a.jsx)(r.rp,{label:l("delegated account"),onChange:v,type:"account",value:f})]}),(0,a.jsxs)(r.u_.Columns,{hint:l("The amount to allocate and the conviction that will be applied to all votes made on a referendum."),children:[(0,a.jsx)(r.H,{autoFocus:!0,isError:!!d?.error,isZeroable:!1,label:l("delegating amount"),labelExtra:(0,a.jsx)(He.Z,{label:(0,a.jsx)("span",{className:"label",children:l("balance")}),params:g}),maxValue:h,onChange:x,value:p}),(0,a.jsx)($e,{amount:p,delegatingAccount:g,onError:m}),(0,a.jsx)(r.v,{label:l("conviction"),onChange:w,value:C,voteLockingPeriod:c.consts.democracy.voteLockingPeriod||c.consts.democracy.enactmentPeriod})]})]}),(0,a.jsxs)(r.u_.Actions,{children:[o&&(0,a.jsx)(r.cA,{accountId:g,icon:"trash-alt",label:l("Undelegate"),onStart:e,tx:c.tx.democracy.undelegate}),(0,a.jsx)(r.cA,{accountId:g,icon:"sign-in-alt",isDisabled:!p?.gt(j.nw)||!!d?.error||!N,label:l(o?"Save delegation":"Delegate"),onStart:e,params:[f,C,p],tx:c.tx.democracy.delegate})]})]})}));var Be=t(27421),Ze=t(55736);const We=n.memo((function({className:e="",from:s,onClose:t}){const{t:o}=D(),{api:i,isDevelopment:l}=(0,u.h)(),{queueAction:c}=(0,Te.L)(),[d]=(0,n.useState)((()=>b.Nn.getPair(s))),[h,p]=(0,n.useState)(!1),[{isNameValid:x,name:g},f]=(0,n.useState)({isNameValid:!1,name:""}),[{isPasswordValid:j,password:v},y]=(0,n.useState)({isPasswordValid:!1,password:""}),[{address:C,deriveError:w},N]=(0,n.useState)({address:null,deriveError:null}),[S,I]=(0,m.O)(),[{isLocked:A,lockedError:P},E]=(0,n.useState)({isLocked:d.isLocked,lockedError:null}),[{isRootValid:M,rootPass:T},F]=(0,n.useState)({isRootValid:!1,rootPass:""}),[V,_]=(0,n.useState)(""),q=(0,Be.N)(V),O=!!C&&!w&&x&&j;(0,n.useEffect)((()=>{E({isLocked:d.isLocked,lockedError:null})}),[d]),(0,n.useEffect)((()=>{!A&&N((()=>{let e=null;const s=function(e,s){if(e.includes("///"))return"Password paths are not supported on keys derived from others";try{const{path:t}=(0,Ze.c)(e);if("ed25519"===s&&t.some((({isSoft:e})=>e)))return"Soft derivation paths are not allowed on ed25519"}catch(e){return console.error(e),e.message}return null}(q,d.type);return s||(e=d.derive(q).address),{address:e,deriveError:s}}))}),[q,A,d]);const z=(0,n.useCallback)((e=>{F({isRootValid:!!e,rootPass:e}),E((({isLocked:e})=>({isLocked:e,lockedError:null})))}),[]),H=(0,n.useCallback)((()=>{p(!0),(0,k.Y)((()=>{try{d.decodePkcs8(T),E({isLocked:d.isLocked,lockedError:null})}catch(e){console.error(e),E({isLocked:!0,lockedError:e.message})}p(!1)}))}),[T,d]),B=(0,n.useCallback)((()=>{O&&(p(!0),(0,k.Y)((()=>{const e=function(e,s,t,a,n,o){return R((()=>{const n=e.derive(s);return n.setMeta({...n.meta,genesisHash:o,name:t,parentAddress:e.address,tags:[]}),b.Nn.addPair(n,a||"")}),n)}(d,V,g,v,o("created account"),l?void 0:i.genesisHash.toHex());c(e),p(!1),t()})))}),[i,l,O,g,t,v,c,d,V,o]),Z=(0,a.jsx)(r.rp,{isDisabled:!0,label:o("derive root account"),value:s});return(0,a.jsxs)(r.u_,{className:e,header:o("Derive account from pair"),onClose:t,children:[C&&S?(0,a.jsx)(L,{address:C,derivePath:V,isBusy:h,name:g,pairType:d.type}):(0,a.jsxs)(r.u_.Content,{children:[A&&(0,a.jsxs)(a.Fragment,{children:[Z,(0,a.jsx)(r.ro,{autoFocus:!0,isError:!!P,label:o("password"),onChange:z,value:T})]}),!A&&(0,a.jsxs)(r.mV,{defaultName:g,noDefaultNameOpacity:!0,value:w?"":C,children:[Z,(0,a.jsx)(r.II,{autoFocus:!0,label:o("derivation path"),onChange:_,placeholder:o("//hard/soft")}),w&&(0,a.jsx)(r.oy,{content:w}),(0,a.jsx)($,{name:{isNameValid:x,name:g},onCommit:B,setName:f,setPassword:y}),";"]})]}),(0,a.jsx)(r.u_.Actions,{children:A?(0,a.jsx)(r.zx,{icon:"lock",isBusy:h,isDisabled:!M,label:o("Unlock"),onClick:H}):S?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:o("Prev"),onClick:I}),(0,a.jsx)(r.zx,{icon:"plus",isBusy:h,label:o("Save"),onClick:B})]}):(0,a.jsx)(r.zx,{icon:"step-forward",isDisabled:!O,label:o("Next"),onClick:I})})]})}));var Ue=t(52953);const Je=[" ","\t"];function Ge(e,s,t){e.isRaw&&(s&&s(!0),t((0,oe.z)(e.asRaw.toU8a(!0))))}function Ye(e,s,t,a,n,o,r=Je,i=Je){return!e||!!s&&s.length>=t&&a.reduce(((e,t)=>e&&s.includes(t)),!0)&&(!o.length||o.some((e=>s.startsWith(e))))&&!n.some((e=>s.includes(e)))&&!r.some((e=>s.startsWith(e)))&&!i.some((e=>s.endsWith(e)))}const Qe=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=D(),{api:i}=(0,u.h)(),l=(0,Ie.W7)(i.query.identity.identityOf,[e]),[{info:d,okAll:m,okDiscord:h,okDisplay:p,okEmail:x,okLegal:g,okRiot:b,okTwitter:f,okWeb:j},v]=(0,n.useState)({info:{},okAll:!1}),[y,C]=(0,n.useState)(!1),[w,N]=(0,n.useState)(!1),[k,S]=(0,n.useState)(!1),[I,A]=(0,n.useState)(!1),[P,E]=(0,n.useState)(!1),[M,T]=(0,n.useState)(!1),[F,V]=(0,n.useState)((()=>((0,c.Ly)(e).name||"").replace(/\(.*\)/,"").trim())),[_,q]=(0,n.useState)(""),[O,R]=(0,n.useState)(""),[z,H]=(0,n.useState)(""),[$,L]=(0,n.useState)(""),[B,Z]=(0,n.useState)(""),[W,U]=(0,n.useState)(""),[J,G]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{if(l&&l.isSome){const{info:e}=l.unwrap();Ge(e.display,null,V),Ge(e.email,C,q),Ge(e.legal,N,R),Ge(e.riot,S,H),Ge(e.twitter,A,L);const s=function(e,s,t,a,n){const o=e.registry.createType("Data",e.registry.createType("Data",{Raw:t})),r=e.registry.createType("Data",""),i=s.additional.find((e=>e[0].eq(o)))?.[1]||r;return i.isRaw&&Ge(i,a,n),i}(i,e,Ue.n,E,Z);Ge(e.web,T,U),[e.display,e.email,e.legal,e.riot,e.twitter,s,e.web].some((e=>!!e.isRaw&&(G(!0),!0)))}}),[l,i]),(0,n.useEffect)((()=>{const e=Ye(!0,F,1,[],[],[]),s=Ye(y,_,3,["@"],Je,[]),t=Ye(w,O,1,[],[],[]),a=Ye(k,z,6,[":"],Je,["@","~"]),n=Ye(I,$,3,[],Je,["@"]),o=Ye(P,B,3,[],Je,[]),r=Ye(M,W,8,["."],Je,["https://","http://"]);v({info:{additional:[o&&P?[{raw:Ue.n},{raw:B}]:null].filter((e=>!!e)),display:{[e?"raw":"none"]:F||null},email:{[s&&y?"raw":"none"]:s&&y?_:null},legal:{[t&&w?"raw":"none"]:t&&w?O:null},riot:{[a&&k?"raw":"none"]:a&&k?z:null},twitter:{[n&&I?"raw":"none"]:n&&I?$:null},web:{[r&&M?"raw":"none"]:r&&M?W:null}},okAll:e&&s&&t&&a&&n&&o&&r,okDiscord:o,okDisplay:e,okEmail:s,okLegal:t,okRiot:a,okTwitter:n,okWeb:r})}),[y,w,k,I,P,M,F,_,O,z,$,B,W]),(0,a.jsxs)(r.u_,{className:s,header:o("Register identity"),onClose:t,children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.II,{autoFocus:!0,isError:!p,label:o("display name"),maxLength:32,onChange:V,placeholder:o("My On-Chain Name"),value:F}),(0,a.jsx)(r.II,{isDisabled:!w,isError:!g,label:o("legal name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:N,value:w}),maxLength:32,onChange:R,placeholder:o("Full Legal Name"),value:w?O:""}),(0,a.jsx)(r.II,{isDisabled:!y,isError:!x,label:o("email"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:C,value:y}),maxLength:32,onChange:q,placeholder:o("somebody@example.com"),value:y?_:""}),(0,a.jsx)(r.II,{isDisabled:!M,isError:!j,label:o("web"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:T,value:M}),maxLength:32,onChange:U,placeholder:o("https://example.com"),value:M?W:""}),(0,a.jsx)(r.II,{isDisabled:!I,isError:!f,label:o("twitter"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:A,value:I}),onChange:L,placeholder:o("@YourTwitterName"),value:I?$:""}),(0,a.jsx)(r.II,{isDisabled:!P,isError:!h,label:o("discord"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:E,value:P}),onChange:Z,placeholder:o("YourDiscordHandle"),value:P?B:""}),(0,a.jsx)(r.II,{isDisabled:!k,isError:!b,label:o("riot name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:S,value:k}),maxLength:32,onChange:H,placeholder:o("@yourname:matrix.org"),value:k?z:""}),(0,a.jsx)(r.H,{defaultValue:i.consts.identity?.basicDeposit,isDisabled:!0,label:o("total deposit")})]}),(0,a.jsxs)(r.u_.Actions,{children:[(0,a.jsx)(r.cA,{accountId:e,icon:"trash-alt",isDisabled:!J,label:o("Clear Identity"),onStart:t,tx:i.tx.identity.clearIdentity}),(0,a.jsx)(r.cA,{accountId:e,isDisabled:!m,label:o("Set Identity"),onStart:t,params:[d],tx:i.tx.identity.setIdentity})]})]})}));var Ke=t(19008);const Xe=n.memo((function({address:e,index:s,name:t,setAddress:o,setName:i,t:l}){const c=(0,n.useCallback)((e=>o(s,e||"")),[s,o]),u=(0,n.useCallback)((e=>i(s,e||"")),[s,i]);return(0,a.jsxs)(r.P0,{children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.rp,{defaultValue:e,label:l("address {{index}}",{replace:{index:s+1}}),onChange:c})}),(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.II,{defaultValue:t,isError:!t,isFull:!0,label:l("sub name"),onChange:u})})]})})),es={withParams:!0},ss=n.memo((function({address:e,className:s,onClose:t}){const{t:o}=D(),{api:l}=(0,u.h)(),{allAccounts:c}=(0,i.x)(),d=(0,Ke.x)(e),m=(0,Ie.W7)(d&&0!==d.length&&l.query.identity.superOf.multi,[d],es),[h,p]=(0,n.useState)();(0,n.useEffect)((()=>{m?p(function([[e],s]){return e.reduce(((e,t,a)=>{const n=s[a];if(n.isSome){const[,s]=n.unwrap();s.isRaw&&e.push([t,(0,oe.z)(s.asRaw)])}return e}),[])}(m)):d&&!d.length&&p([])}),[c,d,m]);const x=(0,n.useCallback)((()=>p((e=>e?.concat([[c[0],""]])))),[c]),g=(0,n.useCallback)((()=>p((e=>e?.slice(0,e.length-1)))),[]),b=(0,n.useCallback)(((e,s)=>p((t=>(t||[]).map((([t,a],n)=>[e===n?s:t,a]))))),[]),f=(0,n.useCallback)(((e,s)=>p((t=>(t||[]).map((([t,a],n)=>[t,e===n?s:a]))))),[]);return(0,a.jsxs)(r.u_,{className:s,header:o("Register sub-identities"),onClose:t,size:"large",children:[(0,a.jsx)(r.u_.Content,{children:h?(0,a.jsxs)("div",{children:[h.length?h.map((([e,s],t)=>(0,a.jsx)(Xe,{address:e,index:t,name:s,setAddress:b,setName:f,t:o},t))):(0,a.jsx)("article",{children:o("No sub identities set.")}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.zx,{icon:"plus",label:o("Add sub"),onClick:x}),(0,a.jsx)(r.zx,{icon:"minus",isDisabled:0===h.length,label:o("Remove sub"),onClick:g})]})]}):(0,a.jsx)(r.$j,{label:o("Retrieving sub-identities")})}),(0,a.jsx)(r.u_.Actions,{children:h&&(0,a.jsx)(r.cA,{accountId:e,isDisabled:h.some((([e,s])=>!e||!s)),label:o("Set Subs"),onStart:t,params:[h.map((([e,s])=>[e,{raw:s}]))],tx:l.tx.identity.setSubs})})]})}));var ts=t(56949),as=t(98988);const ns={callData:null,callError:null,callInfo:null},os=(0,r.zo)(r.u_)` + .tipToggle { + width: 100%; + text-align: right; + } +`,rs=n.memo((function({className:e="",onClose:s,ongoing:t,threshold:o=0,who:l=[]}){const{t:c}=D(),{api:d}=(0,u.h)(),{allAccounts:m}=(0,i.x)(),[h,p]=(0,n.useState)(""),[{callData:x,callError:g,callInfo:b},f]=(0,n.useState)(ns),{encodedCallLength:j,weight:v}=(0,ts.h7)(x),[y,C]=(0,n.useState)((()=>t[0][0].toHex())),[{isMultiCall:w,multisig:k},S]=(0,n.useState)((()=>({isMultiCall:!1,multisig:null}))),[I,A]=(0,n.useState)(!0),[P,E]=(0,n.useState)([]),[M,T]=(0,n.useState)(null),[F,V]=(0,n.useState)([]),[_,q]=(0,n.useState)("aye"),[O,R]=(0,n.useState)(null),z=(0,n.useRef)([{text:c("Approve this call hash"),value:"aye"},{text:c("Cancel this call hash"),value:"nay"}]),H=(0,n.useMemo)((()=>t.map((([e])=>({text:e.toHex(),value:e.toHex()})))),[t]);(0,n.useEffect)((()=>{const[,e]=t.find((([e])=>e.eq(y)))||[null,null];S({isMultiCall:!!e&&e.approvals.length+1>=o,multisig:e}),f(ns)}),[y,t,o]),(0,n.useEffect)((()=>{E(l.map((e=>d.createType("AccountId",e))).filter((e=>!M||!e.eq(M))))}),[d,M,l]),(0,n.useEffect)((()=>{const e=k&&k.approvals.length>=o;V(l.map((e=>d.createType("AccountId",e).toString())).filter((s=>m.some((e=>e===s))&&k&&("nay"===_?k.depositor.eq(s):e||!k.approvals.some((e=>e.eq(s)))))))}),[d,m,k,o,_,l]),(0,n.useEffect)((()=>{if(h)try{(0,re.hu)((0,N.vq)(h),"Hex call data required");const e=d.createType("Call",h);(0,re.hu)(e.hash.eq(y),"Call data does not match the existing call hash");const s=d.registry.findMetaCall(e.callIndex);f({callData:e,callError:null,callInfo:s})}catch(e){f({callData:null,callError:e.message,callInfo:null})}else f(ns)}),[d,h,y]),(0,n.useEffect)((()=>{const e=d.tx.multisig||d.tx.utility;R((()=>y&&k?"aye"===_?w&&I?x?5===e.asMulti.meta.args.length?e.asMulti(o,P,k.when,x.toHex(),v):6===e.asMulti.meta.args.length?e.asMulti(o,P,k.when,x.toHex(),!1,v):e.asMulti(o,P,k.when,x):null:5===e.approveAsMulti.meta.args.length?e.approveAsMulti(o,P,k.when,y,v):e.approveAsMulti(o,P,k.when,y):e.cancelAsMulti(o,P,k.when,y):null))}),[d,x,y,I,w,P,k,o,_,v]);const $="aye"===_;return(0,a.jsxs)(os,{className:e,header:c("Pending call hashes"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:c("The call hash from the list of available and unapproved calls."),children:(0,a.jsx)(r.Lt,{label:c("pending hashes {{count}}",{replace:{count:H.length}}),onChange:C,options:H,value:y})}),k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u_.Columns,{hint:c("The creator for this multisig call"),children:(0,a.jsx)(r.rp,{defaultValue:k.depositor,isDisabled:!0,label:c("depositor")})}),(0,a.jsx)(r.u_.Columns,{hint:c("The current approvals applied to this multisig"),children:(0,a.jsx)(r.xH,{isPadded:!0,summary:c("Existing approvals ({{approvals}}/{{threshold}})",{replace:{approvals:k.approvals.length,threshold:o}}),children:k.approvals.map((e=>(0,a.jsx)(r.ax,{isPadded:!1,value:e},re.hu.toString())))})})]}),(0,a.jsx)(r.u_.Columns,{hint:c("The operation type to apply. For approvals both non-final and final approvals are supported."),children:(0,a.jsx)(r.Lt,{label:c("approval type"),onChange:q,options:z.current,value:_})}),0!==F.length&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u_.Columns,{hint:c("For approvals outstanding approvers will be shown, for hashes that should be cancelled the first approver is required."),children:(0,a.jsx)(r.rp,{filter:F,label:c("signatory"),onChange:T})}),"aye"===_&&w&&(0,a.jsxs)(a.Fragment,{children:[I&&(0,a.jsxs)(r.u_.Columns,{hint:c("The call data for this transaction matching the hash. Once sent, the multisig will be executed against this."),children:[x&&b?(0,a.jsx)(r.xH,{isPadded:!0,summary:`${b.section}.${b.method}`,summaryMeta:b.meta,children:(0,a.jsx)(as.Z,{className:"details",value:x})}):(0,a.jsx)(r.II,{autoFocus:!0,isError:!h||!!g,label:c("call data for final approval"),onChange:p}),g&&(0,a.jsx)(r.oy,{content:g})]}),(0,a.jsx)(r.u_.Columns,{hint:c("Swap to a non-executing approval type, with subsequent calls providing the actual call data."),children:(0,a.jsx)(r.ZD,{className:"tipToggle",label:c(w?"Multisig message with call (for final approval)":"Multisig approval with hash (non-final approval)"),onChange:A,value:I})})]})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:M,extrinsic:O,icon:$?"check":"times",isDisabled:!O||$&&(!F.length||!!x&&!j),label:$?"Approve":"Reject",onStart:s})})]})}));var is=t(79760);const ls={type:"all"},cs=[[],j.nw];function us(e,s,t,a=0){return 2===e.tx.proxy.removeProxy.meta.args.length?e.tx.proxy.removeProxy(s,t):e.tx.proxy.removeProxy(s,t,a)}function ds({index:e,onRemove:s,typeOpts:t,value:[o,i]}){const{t:l}=D(),c=(0,n.useCallback)((()=>{o&&s(o,i,e)}),[o,e,s,i]);return(0,a.jsxs)("div",{className:"proxy-container",children:[(0,a.jsxs)("div",{className:"input-column",children:[(0,a.jsx)(r.rp,{defaultValue:o,isDisabled:!0,label:l("proxy account")}),(0,a.jsx)(r.Lt,{isDisabled:!0,label:"type",options:t,value:i.toNumber()})]}),(0,a.jsx)("div",{className:"buttons-column",children:(0,a.jsx)(r.zx,{icon:"times",onClick:c})})]})}function ms({index:e,onChangeAccount:s,onChangeType:t,onRemove:o,proxiedAccount:i,typeOpts:l,value:[c,u]}){const{t:d}=D(),m=(0,n.useCallback)((t=>s(e,t)),[e,s]),h=(0,n.useCallback)((s=>t(e,s)),[e,t]),p=(0,n.useCallback)((()=>o(e)),[e,o]);return(0,a.jsxs)("div",{className:"proxy-container",children:[(0,a.jsxs)("div",{className:"input-column",children:[(0,a.jsx)(r.rp,{isError:!c,label:d("proxy account"),onChange:m,type:"account",value:c}),c&&c.eq(i)&&(0,a.jsx)(r.oy,{content:d("You should not setup proxies to act as a self-proxy.")}),(0,a.jsx)(r.Lt,{label:"type",onChange:h,options:l,value:u.toNumber()})]}),(0,a.jsx)("div",{className:"buttons-column",children:(0,a.jsx)(r.zx,{icon:"times",onClick:p})})]},`addedProxy-${e}`)}function hs(e,s=0){const t=e.registry.lookup.names.filter((e=>e.endsWith("RuntimeProxyType")));return e.createType(t.length?t[0]:"ProxyType",s)}const ps=(0,r.zo)(r.u_)` + .proxy-container { + display: grid; + grid-column-gap: 0.5rem; + grid-template-columns: minmax(0, 1fr) auto; + margin-bottom: 1rem; + + .input-column { + grid-column: 1; + } + + .buttons-column { + grid-column: 2; + padding-top: 0.3rem; + } + } +`,xs=n.memo((function({className:e,onClose:s,previousProxy:[t]=cs,proxiedAccount:o}){const{t:i}=D(),{api:l}=(0,u.h)(),[c,d]=(0,n.useState)([]),[m,h]=(0,n.useState)([]),[p,x]=(0,n.useState)(null),[g,b]=(0,n.useState)((()=>t.map((({delegate:e,proxyType:s})=>[e,s])))),[f,j]=(0,n.useState)([]),v=(0,is.b)(p,ls),y=(0,n.useMemo)((()=>l.consts.proxy.proxyDepositFactor.muln(c.length+m.length).iadd(l.consts.proxy.proxyDepositBase)),[l,c,m]),C=(0,n.useRef)(function(e){return hs(e).defKeys.map(((e,s)=>({text:e,value:s}))).filter((({text:e})=>!e.startsWith("__Unused")))}(l));(0,n.useEffect)((()=>{h(f.filter((e=>!!e[0])).map((([e,s])=>function(e,s,t,a=0){return 2===e.tx.proxy.addProxy.meta.args.length?e.tx.proxy.addProxy(s,t):e.tx.proxy.addProxy(s,t,a)}(l,e,s))))}),[l,f]),(0,n.useEffect)((()=>{x((()=>[...c,...m]))}),[c,m]);const w=(0,n.useCallback)((()=>j((e=>[...e,[e.length?e[e.length-1][0]:g.length?g[g.length-1][0]:l.createType("AccountId",o),hs(l)]]))),[l,g,o]),N=(0,n.useCallback)((e=>j((s=>s.filter(((s,t)=>t!==e))))),[]),k=(0,n.useCallback)(((e,s,t)=>{b((e=>e.filter(((e,s)=>s!==t)))),d((t=>[...t,us(l,e,s)]))}),[l]),S=(0,n.useCallback)(((e,s)=>j((t=>{const a=[...t];return a[e][0]=s?l.createType("AccountId",s):null,a}))),[l]),I=(0,n.useCallback)(((e,s)=>j((t=>{const a=[...t];return a[e][1]=hs(l,s),a}))),[l]),A=f.some((([e])=>e&&e.eq(o)));return(0,a.jsxs)(ps,{className:e,header:i("Proxy overview"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:i("Any account set as proxy will be able to perform actions in place of the proxied account"),children:(0,a.jsx)(r.rp,{isDisabled:!0,label:i("proxied account"),type:"account",value:o})}),(0,a.jsxs)(r.u_.Columns,{hint:i("If you add several proxy accounts for the same proxy type (e.g 2 accounts set as proxy for Governance), then any of those 2 accounts will be able to perform governance actions on behalf of the proxied account"),children:[g.map(((e,s)=>(0,a.jsx)(ds,{index:s,onRemove:k,typeOpts:C.current,value:e},`${e.toString()}-${s}`))),f.map(((e,s)=>(0,a.jsx)(ms,{index:s,onChangeAccount:S,onChangeType:I,onRemove:N,proxiedAccount:o,typeOpts:C.current,value:e},`${e.toString()}-${s}`))),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"plus",label:i("Add proxy"),onClick:w})})]}),(0,a.jsx)(r.u_.Columns,{hint:i("A deposit paid by the proxied account that can not be used while the proxy is in existence. The deposit is returned when the proxy is destroyed. The amount reserved is based on the base deposit and number of proxies"),children:(0,a.jsx)(r.H,{defaultValue:y,isDisabled:!0,label:i("reserved balance")})}),(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(r.RN,{})})]}),(0,a.jsxs)(r.u_.Actions,{children:[0!==t.length&&(0,a.jsx)(r.cA,{accountId:o,icon:"trash-alt",label:i("Clear all"),onStart:s,tx:l.tx.proxy.removeProxies}),(0,a.jsx)(r.cA,{accountId:o,extrinsic:v,icon:"sign-in-alt",isDisabled:A||!c.length&&!m.length,onStart:s})]})]})})),gs=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=D(),{api:i}=(0,u.h)(),[l,c]=(0,n.useState)(null);return(0,a.jsxs)(r.u_,{className:s,header:o("Initiate account recovery"),onClose:t,children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.rp,{isDisabled:!0,label:o("the account to recover to"),value:e}),(0,a.jsx)(r.rp,{label:o("recover this account"),onChange:c,type:"allPlus"})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:e,icon:"recycle",isDisabled:!l||l===e,label:o("Start recovery"),onStart:t,params:[l],tx:i.tx.recovery.initiateRecovery})})]})}));var bs=t(65606);const fs=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=D(),{api:i}=(0,u.h)(),l=xe(e),[c,d]=(0,n.useState)(),[m,h]=(0,n.useState)([]),[p,x]=(0,n.useState)(),g=!c,b=!m.length,f=!p||!p.gtn(0)||p.gtn(m.length);return(0,a.jsxs)(r.u_,{className:s,header:o("Setup account as recoverable"),onClose:t,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("The recoverable account is protected against the loss of seed/access by a social process."),children:(0,a.jsx)(r.rp,{isDisabled:!0,label:o("the account to make recoverable"),value:e})}),(0,a.jsx)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:o("These are trusted individuals that can verify and approve any recovery actions. With recovery, once the threshold is reached, the funds associated with the account can be moved to a new destination.")}),(0,a.jsx)("p",{children:o("The helpers should be able to verify, via an off-chain mechanism, that the account owner indeed wishes to recover access and as such provide any approvals. In the cases of malicious recovery procedures, they will have the power to stop it.")})]}),children:(0,a.jsx)(r.m3,{available:l,availableLabel:o("available social recovery helpers"),maxCount:16,onChange:h,valueLabel:o("trusted social recovery helpers")})}),(0,a.jsxs)(r.u_.Columns,{hint:o("The threshold for approvals and the delay is the protection associated with the account. The delay should be such that any colluding recovery attempts does have a window to stop."),children:[(0,a.jsx)(r.Rn,{isError:f,label:o("recovery threshold"),onChange:x}),(0,a.jsx)(r.Rn,{isError:g,isZeroable:!0,label:o("recovery block delay"),onChange:d})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:e,icon:"share-alt",isDisabled:b||f||g,label:o("Make recoverable"),onStart:t,params:[(0,bs.i)(m),p,c],tx:i.tx.recovery.createRecovery})})]})})),js=n.memo((function({accountDelegating:e,onClose:s}){const{t}=D(),{api:n}=(0,u.h)();return(0,a.jsxs)(r.u_,{className:"staking--Undelegate",header:t("Undelegate"),onClose:s,size:"large",children:[(0,a.jsx)(r.u_.Content,{children:(0,a.jsx)(r.u_.Columns,{hint:t("You will remove any delegation made by this acccount"),children:(0,a.jsx)(r.rp,{defaultValue:e,isDisabled:!0,label:t("delegating account")})})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:e,icon:"sign-in-alt",label:t("Undelegate"),onStart:s,tx:n.tx.democracy.undelegate})})]})}));var vs=t(67405),ys=t(60864);const Cs=(0,he.e)("useMultisigApprovals",(function(e){const{events:s}=(0,vs.d)(),{api:t}=(0,u.h)(),[a,o]=(0,n.useState)(),[r,i]=(0,ys.y)(1),l=(0,ve.X)();return(0,n.useEffect)((()=>{s.some((({record:{event:{data:s,section:t}}})=>"multisig"===t&&s.some((s=>"AccountId"===s.toRawType()&&s.eq(e)))))&&i()}),[e,s,i]),(0,n.useEffect)((()=>{r&&t.query.multisig?.multisigs.entries(e).then((e=>{l.current&&o(e.filter((([,e])=>e.isSome)).map((([e,s])=>[e.args[1],s.unwrap()])))})).catch(console.error)}),[e,t,l,r]),a})),ws={available:!1,bonded:!1,locked:!1,redeemable:!1,reserved:!1,total:!0,unlocking:!1,vested:!1},Ns={available:!0,bonded:!0,locked:!0,nonce:!0,redeemable:!0,reserved:!0,total:!1,unlocking:!0,vested:!0};function ks(e){return e?.unlocking?e.unlocking.filter((({remainingEras:e,value:s})=>s.gt(j.nw)&&e.gt(j.nw))).map((e=>e.value)).reduce(((e,s)=>e.iadd(s)),new(ue())(0)):j.nw}function Ss(e,s,t){return e.tx.utility&&t.length?e.tx.utility.batch(t.map((s=>e.tx.democracy.removeVote(s))).concat(e.tx.democracy.unlock(s))):null}function Is(e,s,t,a="convictionVoting"){if(!e.tx.utility||!t.length)return null;const n=t.map((([s,t])=>e.tx[a].removeVote(s,t)));return t.reduce(((e,[s])=>(e.find((e=>e.eq(s)))||e.push(s),e)),[]).forEach((t=>{n.push(e.tx[a].unlock(t,s))})),e.tx.utility.batch(n)}const As={transform:e=>e.unwrapOr(null)},Ps=r.zo.tr` + .devBadge { + opacity: var(--opacity-light); + } +`,Es=n.memo((function({account:{address:e,meta:s},className:t="",delegation:o,filter:i,isFavorite:l,proxy:c,setBalance:h,toggleFavorite:p}){const{t:x}=D(),[g,f]=(0,m.O)(!1),{queueExtrinsic:y}=(0,Te.L)(),C=(0,u.h)(),{getLedger:w}=(0,d.c)(),N=(0,De.C)(),k=(0,Fe.r)(e),S=(0,Ve._)(e),I=(0,Ie.W7)(C.api.derive.democracy?.locks,[e]),A=(0,Ie.W7)(C.api.query.recovery?.recoverable,[e],As),P=Cs(e),E=Ce(e),{flags:{isDevelopment:M,isEditable:T,isEthereum:F,isExternal:V,isHardware:_,isInjected:O,isMultisig:R,isProxied:z},genesisHash:H,identity:$,name:L,onSetGenesisHash:B,tags:Z}=(0,_e.B)(e),W=Me("referenda","convictionVoting",e),[{democracyUnlockTx:U},J]=(0,n.useState)({democracyUnlockTx:null,ids:[]}),[{referendaUnlockTx:G},Y]=(0,n.useState)({ids:[],referendaUnlockTx:null}),[Q,K]=(0,n.useState)(null),[X,ee]=(0,m.O)(),[se,te]=(0,m.O)(),[ae,ne]=(0,m.O)(),[oe,re]=(0,m.O)(),[ie,le]=(0,m.O)(),[ce,ue]=(0,m.O)(),[de,me]=(0,m.O)(),[he,pe]=(0,m.O)(),[xe,ge]=(0,m.O)(),[be,fe]=(0,m.O)(),[je,ve]=(0,m.O)(),[ye,we]=(0,m.O)(),[Ne,ke]=(0,m.O)();(0,n.useEffect)((()=>{k&&(h(e,{bonded:S?.stakingLedger.active?.unwrap()||j.nw,locked:k.lockedBalance,redeemable:S?.redeemable||j.nw,total:k.freeBalance.add(k.reservedBalance),transferrable:k.availableBalance,unbonding:ks(S)}),C.api.tx.vesting?.vest&&K((()=>k.vestingLocked.isZero()?null:C.api.tx.vesting.vest())))}),[e,C,k,h,S]),(0,n.useEffect)((()=>{N&&I&&J((s=>{const t=I.filter((({isFinished:e,unlockAt:s})=>e&&N.gt(s))).map((({referendumId:e})=>e));return JSON.stringify(s.ids)===JSON.stringify(t)?s:{democracyUnlockTx:Ss(C.api,e,t),ids:t}}))}),[e,C,N,I]),(0,n.useEffect)((()=>{N&&W&&Y((s=>{const t=W.filter((({endBlock:e})=>e.gt(j.nw)&&N.gt(e))).map((({classId:e,refId:s})=>[e,s]));return JSON.stringify(s.ids)===JSON.stringify(t)?s:{ids:t,referendaUnlockTx:Is(C.api,e,t)}}))}),[e,C,N,W]);const Se=(0,n.useMemo)((()=>function(e,s,t){if(0===e.length)return!0;const a=e.toLowerCase();return t.reduce(((e,s)=>e||s.toLowerCase().includes(a)),s.toLowerCase().includes(a))}(i,L,Z)),[L,i,Z]),Ae=(0,n.useCallback)((()=>{if(!e)return;const s={account:e,action:"forget"};try{b.Nn.forgetAccount(e),s.status="success",s.message=x("account forgotten")}catch(e){s.status="error",s.message=e.message}}),[e,x]),Pe=(0,n.useCallback)((()=>U&&y({accountId:e,extrinsic:U})),[e,U,y]),Ee=(0,n.useCallback)((()=>G&&y({accountId:e,extrinsic:G})),[e,G,y]),He=(0,n.useCallback)((()=>Q&&y({accountId:e,extrinsic:Q})),[e,y,Q]),$e=(0,n.useCallback)((()=>{(async function(e,s){const t=e();await t.getAddress(!0,s.accountOffset||0,s.addressOffset||0)})(w,s).catch((e=>{console.error(`ledger: ${e.message}`)}))}),[w,s]),Be=(0,n.useMemo)((()=>[q("identityGroup",[(0,v.m)(C.api.tx.identity?.setIdentity)&&!_&&(0,a.jsx)(r.v2.Item,{icon:"link",label:x("Set on-chain identity"),onClick:re},"identityMain"),(0,v.m)(C.api.tx.identity?.setSubs)&&$?.display&&!_&&(0,a.jsx)(r.v2.Item,{icon:"vector-square",label:x("Set on-chain sub-identities"),onClick:le},"identitySub"),(0,v.m)(C.api.tx.democracy?.unlock)&&U&&(0,a.jsx)(r.v2.Item,{icon:"broom",label:x("Clear expired democracy locks"),onClick:Pe},"clearDemocracy"),(0,v.m)(C.api.tx.convictionVoting?.unlock)&&G&&(0,a.jsx)(r.v2.Item,{icon:"broom",label:x("Clear expired referenda locks"),onClick:Ee},"clearReferenda"),(0,v.m)(C.api.tx.vesting?.vest)&&Q&&(0,a.jsx)(r.v2.Item,{icon:"unlock",label:x("Unlock vested amount"),onClick:He},"vestingVest")],x("Identity")),q("deriveGroup",[!(F||V||_||O||R||C.isEthereum)&&(0,a.jsx)(r.v2.Item,{icon:"download",label:x("Derive account via derivation path"),onClick:te},"deriveAccount"),_&&(0,a.jsx)(r.v2.Item,{icon:"eye",label:x("Show address on hardware device"),onClick:$e},"showHwAddress")],x("Derive")),q("backupGroup",[!(V||_||O||R||M)&&(0,a.jsx)(r.v2.Item,{icon:"database",label:x("Create a backup file for this account"),onClick:ee},"backupJson"),!(V||_||O||R||M)&&(0,a.jsx)(r.v2.Item,{icon:"edit",label:x("Change this account's password"),onClick:pe},"changePassword"),!(O||M)&&(0,a.jsx)(r.v2.Item,{icon:"trash-alt",label:x("Forget this account"),onClick:ne},"forgetAccount")],x("Backup")),(0,v.m)(C.api.tx.recovery?.createRecovery)&&q("reoveryGroup",[!A&&(0,a.jsx)(r.v2.Item,{icon:"redo",label:x("Make recoverable"),onClick:fe},"makeRecoverable"),(0,a.jsx)(r.v2.Item,{icon:"screwdriver",label:x("Initiate recovery for another"),onClick:ge},"initRecovery")],x("Recovery")),(0,v.m)(C.api.tx.multisig?.asMulti)&&R&&q("multisigGroup",[(0,a.jsx)(r.v2.Item,{icon:"file-signature",isDisabled:!P?.length,label:x("Multisig approvals"),onClick:ue},"multisigApprovals")],x("Multisig")),(0,v.m)(C.api.query.democracy?.votingOf)&&o?.accountDelegated&&q("undelegateGroup",[(0,a.jsx)(r.v2.Item,{icon:"user-edit",label:x("Change democracy delegation"),onClick:we},"changeDelegate"),(0,a.jsx)(r.v2.Item,{icon:"user-minus",label:x("Undelegate"),onClick:ke},"undelegate")],x("Undelegate")),q("delegateGroup",[(0,v.m)(C.api.query.democracy?.votingOf)&&!o?.accountDelegated&&(0,a.jsx)(r.v2.Item,{icon:"user-plus",label:x("Delegate democracy votes"),onClick:we},"delegate"),(0,v.m)(C.api.query.proxy?.proxies)&&(0,a.jsx)(r.v2.Item,{icon:"sitemap",label:c?.[0].length?x("Manage proxies"):x("Add proxy"),onClick:me},"proxy-overview")],x("Delegate")),T&&!C.isDevelopment&&q("genesisGroup",[(0,a.jsx)(r.H_,{className:"accounts--network-toggle",genesisHash:H,onChange:B},"chainlock")])].filter((e=>e))),[Pe,Ee,$e,He,C,o,U,H,$,M,T,F,V,_,O,R,P,B,c,G,A,x,ee,we,te,ne,re,le,ue,pe,me,ge,fe,ke,Q]);return Se?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(Ps,{className:`${t} isExpanded isFirst packedBottom`,children:[(0,a.jsx)(r.iA.Column.Favorite,{address:e,isFavorite:l,toggle:p}),(0,a.jsxs)("td",{className:"address all relative",children:[(0,a.jsx)(r.N,{parentAddress:s.parentAddress,value:e,withShortAddress:!0}),X&&(0,a.jsx)(Re,{address:e,onClose:ee},"modal-backup-account"),ye&&(0,a.jsx)(Le,{onClose:we,previousAmount:o?.amount,previousConviction:o?.conviction,previousDelegatedAccount:o?.accountDelegated,previousDelegatingAccount:e},"modal-delegate"),se&&(0,a.jsx)(We,{from:e,onClose:te},"modal-derive-account"),ae&&(0,a.jsx)(r.u5,{address:e,onClose:ne,onForget:Ae},"modal-forget-account"),oe&&(0,a.jsx)(Qe,{address:e,onClose:re},"modal-identity-main"),ie&&(0,a.jsx)(ss,{address:e,onClose:le},"modal-identity-sub"),he&&(0,a.jsx)(ze,{address:e,onClose:pe},"modal-change-pass"),je&&(0,a.jsx)(r.Zd,{onClose:ve,senderId:e},"modal-transfer"),de&&(0,a.jsx)(xs,{onClose:me,previousProxy:c,proxiedAccount:e},"modal-proxy-overview"),R&&ce&&P&&0!==P.length&&(0,a.jsx)(rs,{address:e,onClose:ue,ongoing:P,threshold:s.threshold,who:s.who},"multisig-approve"),xe&&(0,a.jsx)(gs,{address:e,onClose:ge},"recover-account"),be&&(0,a.jsx)(fs,{address:e,onClose:fe},"recover-setup"),Ne&&(0,a.jsx)(js,{accountDelegating:e,onClose:ke},"modal-delegate"),(0,a.jsxs)("div",{className:"absolute",children:[s.genesisHash?(0,a.jsx)(r.Ct,{color:"transparent"}):M?(0,a.jsx)(r.Ct,{className:"warning",hover:x("This is a development account derived from the known development seed. Do not use for any funds on a non-development network."),icon:"wrench"}):(0,a.jsx)(r.Ct,{className:"warning",hover:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:x('This account is available on all networks. It is recommended to link to a specific network via the account options ("only this network" option) to limit availability. For accounts from an extension, set the network on the extension.')}),(0,a.jsx)("p",{children:x("This does not send any transaction, rather it only sets the genesis in the account JSON.")})]}),icon:"exclamation-triangle"}),A&&(0,a.jsx)(r.Ct,{className:"recovery",hover:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:x("This account is recoverable, with the following friends:")}),(0,a.jsx)("div",{children:A.friends.map(((e,s)=>(0,a.jsx)(r.N,{value:e},s)))}),(0,a.jsx)("table",{children:(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:x("threshold")}),(0,a.jsx)("td",{children:(0,qe.u)(A.threshold)})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:x("delay")}),(0,a.jsx)("td",{children:(0,qe.u)(A.delayPeriod)})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:x("deposit")}),(0,a.jsx)("td",{children:(0,Oe.a)(A.deposit)})]})]})})]}),icon:"redo"}),z&&E?.isEmpty&&(0,a.jsx)(r.Ct,{className:"important",hover:x("Proxied account has no owned proxies"),icon:"sitemap",info:"0"}),R&&P&&0!==P.length&&(0,a.jsx)(r.Ct,{className:"important",color:"purple",hover:x("Multisig approvals pending"),hoverAction:x("View pending approvals"),icon:"file-signature",onClick:ue}),o?.accountDelegated&&(0,a.jsx)(r.Ct,{className:"information",hover:x("This account has a governance delegation"),hoverAction:x("Manage delegation"),icon:"calendar-check",onClick:we}),c&&0!==c[0].length&&C.api.tx.utility&&(0,a.jsx)(r.Ct,{className:"information",hover:1===c[0].length?x("This account has a proxy set"):x("This account has {{proxyNumber}} proxies set",{replace:{proxyNumber:c[0].length}}),hoverAction:x("Manage proxies"),icon:"sitemap",onClick:me})]})]}),(0,a.jsx)("td",{className:"actions button",children:(0,a.jsxs)(r.zx.Group,{children:[(0,v.m)(C.api.tx.balances?.transfer)&&(0,a.jsx)(r.zx,{className:"send-button",icon:"paper-plane",label:x("send"),onClick:ve}),(0,a.jsx)(r.GI,{isDisabled:!Be.length,value:(0,a.jsx)(r.v2,{children:Be})})]})}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:g,toggle:f})]}),(0,a.jsxs)(Ps,{className:`${t} isExpanded ${g?"":"isLast"} packedTop`,children:[(0,a.jsx)("td",{}),(0,a.jsx)("td",{className:"balance all",colSpan:2,children:(0,a.jsx)(r.hl,{address:e,balancesAll:k,withBalance:ws})}),(0,a.jsx)("td",{})]}),(0,a.jsxs)(Ps,{className:`${t} ${g?"isExpanded isLast":"isCollapsed"} packedTop`,children:[(0,a.jsx)("td",{}),(0,a.jsxs)("td",{className:"balance columar",colSpan:2,children:[(0,a.jsx)(r.hl,{address:e,balancesAll:k,convictionLocks:W,withBalance:Ns}),(0,a.jsxs)(r.P0,{size:"tiny",children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)("div",{"data-testid":"tags",children:(0,a.jsx)(r.$G,{value:Z,withTitle:!0})})}),(0,a.jsxs)(r.P0.Column,{children:[(0,a.jsx)("h5",{children:x("account type")}),(0,a.jsx)(r.lK,{accountId:e})]})]}),(0,a.jsx)(r.P0,{is100:!0,children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.NR,{data:e,type:"address",withTitle:!0})})})]}),(0,a.jsx)("td",{})]})]}):null}));var Ms=t(73352);const Ts=r.zo.article` + .box { + padding: 0 0.5rem; + } +`,Ds=n.memo((function({children:e,className:s="",type:t}){return(0,a.jsx)(Ts,{className:`${s} ${t} centered`,children:(0,a.jsx)("div",{className:"box",children:e})})})),Fs=n.memo((function(){const e=(0,Ms.Z)(),{t:s}=D();return e?(0,a.jsx)(Ds,{type:"error",children:(0,a.jsxs)("p",{children:[s("You have {{claimCount}} accounts that need attestations. Use the Claim Tokens app on the navigation bar to complete the process. Until you do, your balances for those accounts will not be reflected.",{replace:{claimCount:e}})," ",(0,a.jsx)("a",{href:"#/claims",children:s("Claim tokens...")})]})}):null}));var Vs=t(54924),_s=t(76075),qs=t(79444),Os=t(14534),Rs=t(69356),zs=t(30242);const Hs=(0,Vs.qY)(),$s=Hs&&Hs.name||null,Ls=$s&&Object.keys(qs.l).includes($s),Bs=(0,Rs.onlyOnWeb)(n.memo((function(){const{t:e}=D(),{hasInjectedAccounts:s}=(0,u.h)(),t=(0,_s.Z)(),o=(0,n.useRef)(e("Since some extensions, such as the polkadot-js extension, protects you against all community reported phishing sites, there are valid reasons to use them for additional protection, even if you are not storing accounts in it."));return Ls&&$s?Os.LW?s?t?(0,a.jsxs)(Ds,{type:"warning",children:[(0,a.jsxs)("p",{children:[1===t?e("You have 1 extension that needs to be updated with the latest chain properties in order to display the correct information for the chain you are connected to."):e("You have {{upgradableCount}} extensions that need to be updated with the latest chain properties in order to display the correct information for the chain you are connected to.",{replace:{upgradableCount:t}}),e(" This update includes chain metadata and chain properties.")]}),(0,a.jsx)("p",{children:(0,a.jsxs)(T.cC,{children:["Visit your ",(0,a.jsx)("a",{href:"#/settings/metadata",children:"settings page"})," to apply the updates to the injected extensions."]},"extensionUpgrade")})]}):null:(0,a.jsxs)(Ds,{type:"warning",children:[(0,a.jsx)("p",{children:e("One or more extensions are detected in your browser, however no accounts has been injected.")}),(0,a.jsx)("p",{children:e("Ensure that the extension has accounts, some accounts are visible globally and available for this chain and that you gave the application permission to access accounts from the extension to use them.")}),(0,a.jsx)("p",{children:o.current})]}):(0,a.jsxs)(Ds,{type:"warning",children:[(0,a.jsx)("p",{children:e("It is recommended that you create/store your accounts securely and externally from the app. On {{yourBrowser}} the following browser extensions are available for use -",{replace:{yourBrowser:(0,zs.k)($s)}})}),(0,a.jsx)("ul",{children:qs.l[$s].map((({desc:s,link:t,name:n})=>(0,a.jsxs)("li",{children:[(0,a.jsx)("a",{href:t,rel:"noopener noreferrer",target:"_blank",children:n})," (",e(s),")"]},n)))}),(0,a.jsxs)("p",{children:[e("Accounts injected from any of these extensions will appear in this application and be available for use. The above list is updated as more extensions with external signing capability become available.")," ",(0,a.jsx)("a",{href:"https://github.com/polkadot-js/extension",rel:"noopener noreferrer",target:"_blank",children:e("Learn more...")})]}),(0,a.jsx)("p",{children:o.current})]}):null})));var Zs=t(58607);const Ws=n.memo((function({balance:e,className:s}){const{t}=D();return(0,a.jsxs)(r.Ty,{className:s,children:[(0,a.jsx)(r.Jy,{label:t("total balance"),children:(0,a.jsx)(Zs.Z,{className:e?"":"--tmp",value:e?.total||1})}),(0,a.jsx)(r.Jy,{className:"media--900",label:t("total transferrable"),children:(0,a.jsx)(Zs.Z,{className:e?"":"--tmp",value:e?.transferrable||1})}),(0,a.jsx)(r.Jy,{label:t("total locked"),children:(0,a.jsx)(Zs.Z,{className:e?"":"--tmp",value:e?.locked||1})}),e?.bonded.gtn(0)&&(0,a.jsx)(r.Jy,{className:"media--1100",label:t("bonded"),children:(0,a.jsx)(Zs.Z,{value:e.bonded})}),e?.redeemable.gtn(0)&&(0,a.jsx)(r.Jy,{className:"media--1500",label:t("redeemable"),children:(0,a.jsx)(Zs.Z,{value:e.redeemable})}),e?.unbonding.gtn(0)&&(0,a.jsx)(r.Jy,{className:"media--1300",label:t("unbonding"),children:(0,a.jsx)(Zs.Z,{value:e.unbonding})})]})})),Us={sortBy:"date",sortFromMax:!0},Js=["accounts","injected","qr","hardware","proxied","multisig","testing"],Gs=r.zo.div` + .ui--Dropdown { + width: 15rem; + } + + .header-box { + .dropdown-section { + display: flex; + flex-direction: row; + align-items: center; + } + + .ui--Button-Group { + margin-left: auto; + } + } +`,Ys=n.memo((function({className:e="",onStatusChange:s}){const{t}=D(),{api:o,isElectron:y}=(0,u.h)(),{allAccounts:C,hasAccounts:w}=(0,i.x)(),{isIpfs:N}=(0,l.g)(),{isLedgerEnabled:k}=(0,d.c)(),[S,I]=(0,m.O)(),[A,P]=(0,m.O)(),[E,M]=(0,m.O)(),[T,F]=(0,m.O)(),[V,_]=(0,m.O)(),[q,O]=(0,m.O)(),[R,H]=(0,h.r)("accounts:favorites"),[$,L]=(0,n.useState)({accounts:{}}),[B,Z]=(0,n.useState)(""),[W,U]=(0,n.useState)([]),[{sortBy:G,sortFromMax:Y},Q]=(0,n.useState)(Us),K=(0,p.W)(),X=(0,x.N)(),ee=(0,g.q)(),se=(0,n.useCallback)((e=>Q((({sortFromMax:s})=>({sortBy:e,sortFromMax:s})))),[]),te=(0,n.useCallback)((()=>Q((({sortBy:e,sortFromMax:s})=>({sortBy:e,sortFromMax:!s})))),[]),ae=(0,n.useRef)(z.map((e=>({text:e,value:e})))),oe=(0,n.useCallback)(((e,s)=>L((({accounts:t})=>{t[e]=s;const a=e=>Object.values(t).reduce(((s,t)=>s.add(t[e])),j.nw);return{accounts:t,summary:{bonded:a("bonded"),locked:a("locked"),redeemable:a("redeemable"),total:a("total"),transferrable:a("transferrable"),unbonding:a("unbonding")}}}))),[]),re=(0,n.useMemo)((()=>y||!N&&"on"===f.X.get().storage),[y,N]),ie=(0,n.useMemo)((()=>Object.fromEntries(R.map((e=>[e,!0])))),[R]),ce=(0,n.useMemo)((()=>(0,v.m)((o.tx.multisig||o.tx.utility)?.approveAsMulti)),[o]),ue=(0,n.useMemo)((()=>(0,v.m)(o.tx.proxy?.addProxy)),[o]),de=(0,n.useMemo)((()=>C.map(((e,s)=>{const t=K&&K[s]?.isDelegating&&K[s]?.asDelegating,a=t&&{accountDelegated:t.target.toString(),amount:t.balance,conviction:t.conviction}||void 0;return{account:b.Nn.getAccount(e),address:e,delegation:a,isFavorite:ie[e??""]??!1}})).filter((e=>!!e.account)).reduce(((e,s)=>(e[s.address]=s,e)),{})),[C,ie,K]),me=(0,n.useMemo)((()=>{const e={accounts:[[(0,a.jsxs)(a.Fragment,{children:[t("accounts"),(0,a.jsx)("div",{className:"sub",children:t("all locally stored accounts")})]})]],hardware:[[(0,a.jsxs)(a.Fragment,{children:[t("hardware"),(0,a.jsx)("div",{className:"sub",children:t("accounts managed via hardware devices")})]})]],injected:[[(0,a.jsxs)(a.Fragment,{children:[t("extension"),(0,a.jsx)("div",{className:"sub",children:t("accounts available via browser extensions")})]})]],multisig:[[(0,a.jsxs)(a.Fragment,{children:[t("multisig"),(0,a.jsx)("div",{className:"sub",children:t("on-chain multisig accounts")})]})]],proxied:[[(0,a.jsxs)(a.Fragment,{children:[t("proxied"),(0,a.jsx)("div",{className:"sub",children:t("on-chain proxied accounts")})]})]],qr:[[(0,a.jsxs)(a.Fragment,{children:[t("via qr"),(0,a.jsx)("div",{className:"sub",children:t("accounts available via mobile devices")})]})]],testing:[[(0,a.jsxs)(a.Fragment,{children:[t("development"),(0,a.jsx)("div",{className:"sub",children:t("accounts derived via development seeds")})]})]]};return Object.values(e).forEach((e=>{e[0][1]="start",e[0][2]=4})),e}),[t]),he=(0,n.useMemo)((()=>function(e){const s={accounts:[],hardware:[],injected:[],multisig:[],proxied:[],qr:[],testing:[]};for(let t=0,a=e.length;tObject.values(de).reduce(((e,{account:s,address:t,delegation:n,isFavorite:o},r)=>(e[t]=(0,a.jsx)(Es,{account:s,delegation:n,filter:B,isFavorite:o,proxy:X?.[r],setBalance:oe,toggleFavorite:H},t),e)),{})),[de,B,X,oe,H]),xe=(0,n.useMemo)((()=>Js.reduce(((e,s)=>{const t=he[s];return t.length&&(e[s]=t.map((e=>pe[e]))),e}),{})),[he,pe]);return(0,n.useEffect)((()=>{U((e=>[...e.map((e=>de[e.address])).filter((e=>!!e)),...Object.keys(de).filter((s=>!e.find((e=>s===e.address)))).map((e=>de[e]))]))}),[de]),(0,n.useEffect)((()=>{U((e=>function(e,s,t,a,n){return[...e].sort(function(e,s,t,a){function n(e,s){const t=a?1:-1;return(a,n)=>t*s(e(a),e(n))}switch(t){case"parent":return n((function s(t){if(t){const a=t.account?.meta.parentAddress||"";return s(e[a])+t.address}return""}),((e,s)=>e.localeCompare(s)));case"name":return n((e=>(0,c.Ly)(e.address).name??""),((e,s)=>e.localeCompare(s)));case"date":return n((e=>e.account?.meta.whenCreated??0),((e,s)=>e-s));case"balances":return n((e=>s[e.address]?.total??j.nw),((e,s)=>e.cmp(s)))}}(s,t,a,n)).sort(((e,s)=>e.isFavorite===s.isFavorite?0:s.isFavorite?1:-1))}(e,de,$.accounts,G,Y)))}),[de,$,G,Y]),(0,a.jsxs)(Gs,{className:e,children:[S&&(0,a.jsx)(ne,{onClose:I,onStatusChange:s}),A&&(0,a.jsx)(le,{onClose:P,onStatusChange:s}),E&&(0,a.jsx)(J,{onClose:M}),T&&(0,a.jsx)(je,{onClose:F,onStatusChange:s}),V&&(0,a.jsx)(we,{onClose:_,onStatusChange:s}),q&&(0,a.jsx)(ke,{onClose:O,onStatusChange:s}),(0,a.jsx)(Bs,{}),(0,a.jsx)(Fs,{}),(0,a.jsx)(Ws,{balance:$.summary}),(0,a.jsxs)(r.Ty,{className:"header-box",children:[(0,a.jsxs)("section",{className:"dropdown-section media--1300","data-testid":"sort-by-section",children:[(0,a.jsx)(r.ak,{className:"media--1500",defaultValue:G,label:t("sort by"),onChange:se,onClick:te,options:ae.current,sortDirection:Y?"ascending":"descending"}),(0,a.jsx)(r.HS,{filterOn:B,label:t("filter by name or tags"),setFilter:Z})]}),(0,a.jsxs)(r.zx.Group,{children:[re&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",label:t("Account"),onClick:I}),(0,a.jsx)(r.zx,{icon:"sync",label:t("From JSON"),onClick:P})]}),(0,a.jsx)(r.zx,{icon:"qrcode",label:t("From Qr"),onClick:O}),k&&(0,a.jsx)(r.zx,{icon:"project-diagram",label:t("From Ledger"),onClick:M}),w&&(0,a.jsxs)(a.Fragment,{children:[ce&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Multisig"),onClick:F}),ue&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Proxied"),onClick:_})]})]})]}),ee&&W.length?Js.map((e=>xe[e]&&(0,a.jsx)(r.iA,{empty:t("No accounts"),header:me[e],isSplit:!0,children:xe[e]},e))):(0,a.jsx)(r.iA,{empty:ee&&W&&t("You don't have any accounts. Some features are currently hidden and will only become available once you have accounts."),header:me.accounts})]})}));var Qs=t(61261),Ks=t(76116),Xs=t(22420);const et=r.zo.tr` + text-align: center; + + &:hover { + background: #f9f8f7; + } + + .vanity--Match-addr { + font-size: 1.1rem; + + .no { + color: inherit; + } + + .yes { + color: red; + } + } + + .vanity--Match-buttons, + .vanity--Match-data, + .vanity--Match-icon { + display: inline-block; + vertical-align: middle; + } + + .vanity--Match-item { + display: inline-block; + font: var(--font-mono); + margin: 0 auto; + padding: 0.5em; + position: relative; + } + + .vanity--Match-seed { + opacity: 0.45; + padding: 0 1rem; + } +`,st=n.memo((function({address:e,className:s="",count:t,offset:o,onCreateToggle:i,onRemove:l,seed:c}){const{t:u}=D(),d=(0,n.useMemo)((()=>(0,w.c)(c)),[c]),m=(0,n.useCallback)((()=>i(d)),[d,i]),h=(0,n.useCallback)((()=>l(e)),[e,l]);return(0,a.jsxs)(et,{className:s,children:[(0,a.jsx)("td",{className:"number",colSpan:2,children:(0,a.jsx)(r.k,{className:"vanity--Match-icon",value:e})}),(0,a.jsx)("td",{className:"address all",children:(0,a.jsxs)("div",{className:"vanity--Match-addr",children:[(0,a.jsx)("span",{className:"no",children:e.slice(0,o)}),(0,a.jsx)("span",{className:"yes",children:e.slice(o,t+o)}),(0,a.jsx)("span",{className:"no",children:e.slice(t+o)})]})}),(0,a.jsx)("td",{className:"hash",children:d}),(0,a.jsxs)("td",{className:"button",children:[(0,a.jsx)(r.zx,{icon:"plus",label:u("Save"),onClick:m}),(0,a.jsx)(r.zx,{icon:"times",onClick:h})]})]})})),tt=[{text:"No",value:!1},{text:"Yes",value:!0}],at=r.zo.div` + .vanity--App-matches { + overflow-x: auto; + padding: 1em 0; + } + + .vanity--App-stats { + padding: 1em 0 0 0; + opacity: 0.45; + text-align: center; + } +`,nt=n.memo((function({className:e="",onStatusChange:s}){const{t}=D(),{api:o,isEthereum:i}=(0,u.h)(),l=(0,n.useRef)([]),c=(0,n.useRef)(!1),d=(0,ve.X)(),[m,h]=(0,n.useState)(null),[{elapsed:p,isRunning:x,keyCount:g,matches:b},j]=(0,n.useState)({elapsed:0,isRunning:!1,keyCount:-1,keyTime:0,matches:[],startAt:0}),[{isMatchValid:v,match:y},C]=(0,n.useState)({isMatchValid:!0,match:"Some"}),[w,N]=(0,n.useState)("ed25519"),[S,I]=(0,n.useState)(!0),A=(0,n.useCallback)((()=>h(null)),[]),P=(0,n.useCallback)((()=>{const e=l.current;l.current=[],0!==e.length&&d.current&&j((({isRunning:s,keyCount:t,keyTime:a,matches:n,startAt:o})=>{let r=t,i=a;const l=e.reduce(((e,{elapsed:s,found:t})=>(r+=t.length,i+=s,e.concat(t))),n);return{elapsed:Date.now()-o,isRunning:s,keyCount:r,keyTime:i,matches:l.sort(Xs.Z).slice(0,25),startAt:o}}))}),[d]),E=(0,n.useCallback)((()=>{if(!c.current)return P();(0,k.Y)((()=>{d.current&&(25===l.current.length&&P(),l.current.push((0,Qs.Z)({match:y,runs:10,ss58Format:o.registry.chainSS58||0,type:w,withCase:S,withHex:!0})),E())}))}),[P,o,y,d,c,w,S]),M=(0,n.useCallback)((e=>C({isMatchValid:Ks.Z.test(e)&&0!==e.length&&e.length<31,match:e})),[]),T=(0,n.useCallback)((e=>j((s=>({...s,matches:s.matches.filter((s=>s.address!==e))})))),[]),F=(0,n.useCallback)((()=>j((({elapsed:e,isRunning:s,keyCount:t,keyTime:a,matches:n,startAt:o})=>({elapsed:e,isRunning:!s,keyCount:s?t:0,keyTime:s?a:0,matches:n,startAt:s?o:Date.now()})))),[]);(0,n.useEffect)((()=>{c.current=x,x&&E()}),[E,x]);const V=(0,n.useMemo)((()=>[[t("matches"),"start",2],[t("Evaluated {{count}} keys in {{elapsed}}s ({{avg}} keys/s)",{replace:{avg:(g/(p/1e3)).toFixed(3),count:g,elapsed:(p/1e3).toFixed(2)}}),"start --digits"],[t("secret"),"start"],[]]),[p,g,t]);return(0,a.jsxs)(at,{className:e,children:[(0,a.jsxs)("div",{className:"ui--row",children:[(0,a.jsx)(r.II,{autoFocus:!0,className:"medium",isDisabled:x,isError:!v,label:t("Search for"),onChange:M,onEnter:F,value:y}),(0,a.jsx)(r.Lt,{className:"medium",isDisabled:x,label:t("case sensitive"),onChange:I,options:tt,value:S})]}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{className:"medium",defaultValue:w,label:t("keypair crypto type"),onChange:N,options:i?f.X.availableCryptosEth:f.X.availableCryptos})}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:x?"stop":"sign-in-alt",isDisabled:!v,label:t(x?"Stop generation":"Start generation"),onClick:F})}),0!==b.length&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("article",{className:"warning centered",children:t('Ensure that you utilized the "Save" functionality before using a generated address to receive funds. Without saving the address and the associated seed any funds sent to it will be lost.')}),(0,a.jsx)(r.iA,{className:"vanity--App-matches",empty:t("No matches found"),header:V,children:b.map((e=>(0,n.createElement)(st,{...e,key:e.address,onCreateToggle:h,onRemove:T})))})]}),m&&(0,a.jsx)(ne,{onClose:A,onStatusChange:s,seed:m,type:w})]})})),ot=["vanity"],rt=n.memo((function({basePath:e,onStatusChange:s}){const{t}=D(),{hasAccounts:c}=(0,i.x)(),{isIpfs:u}=(0,l.g)(),d=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("My accounts")},{name:"vanity",text:t("Vanity generator")}]);return(0,a.jsxs)("main",{className:"accounts--App",children:[(0,a.jsx)(r.mQ,{basePath:e,hidden:c&&!u?void 0:ot,items:d.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(nt,{onStatusChange:s}),path:"vanity"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Ys,{onStatusChange:s}),index:!0})]})})]})}))},10189:(e,s,t)=>{t.d(s,{Z:()=>n});var a=t(34814);const n=(0,t(11677).e)("useCounter",(function(){const{hasAccounts:e}=(0,a.x)();return e?null:"!"}))},28096:(e,s,t)=>{t.d(s,{Z:()=>I});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(81642),l=t(38894),c=t(54131),u=t(47623),d=t(90778),m=t(9118),h=t(69187),p=t(48533),x=t(73493),g=t(61349);function b(){return(0,g.$G)("app-addresses")}const f=n.memo((function({onClose:e,onStatusChange:s}){const{t}=b(),{api:o,isEthereum:i}=(0,d.h)(),[{isNameValid:l,name:c},u]=(0,n.useState)({isNameValid:!1,name:""}),[{address:g,addressInput:f,isAddressExisting:j,isAddressValid:v},y]=(0,n.useState)({address:"",addressInput:"",isAddressExisting:!1,isAddressValid:!1,isPublicKey:!1}),C=(0,m.W7)(!!g&&v&&o.derive.accounts.info,[g]),w=v&&l&&!!C?.accountId,N=(0,n.useCallback)((e=>{let s="",t=!0,a=!1,n=!1;try{if(i){const t=(0,p.G)(e);s=(0,x.K)(t),n=20===t.length}else{const t=h.Nn.decodeAddress(e);s=h.Nn.encodeAddress(t),n=32===t.length}if(!t){const e=h.Nn.getAddress(s);if(e){const s=e.meta.name||c;a=!0,t=!0,u({isNameValid:!!(s||"").trim(),name:s})}}}catch{t=!1}y({address:t?s:"",addressInput:e,isAddressExisting:a,isAddressValid:t,isPublicKey:n})}),[i,c]),k=(0,n.useCallback)((e=>u({isNameValid:!!e.trim(),name:e})),[]),S=(0,n.useCallback)((()=>{const a={action:"create"};if(w&&C?.accountId){try{const e=C.accountId.toString();h.Nn.saveAddress(e,{genesisHash:h.Nn.genesisHash,name:c.trim(),tags:[]}),a.account=e,a.status=e?"success":"error",a.message=t(j?"address edited":"address created"),r.rp.setLastValue("address",e)}catch(e){a.status="error",a.message=e.message}s(a),e()}}),[C,j,w,c,e,s,t]);return(0,a.jsxs)(r.u_,{header:t("Add an address"),onClose:e,children:[(0,a.jsx)(r.u_.Content,{children:(0,a.jsxs)(r.mV,{defaultName:c,noDefaultNameOpacity:!0,value:v?C?.accountId?.toString():void 0,children:[(0,a.jsx)(r.II,{autoFocus:!0,className:"full",isError:!v,label:t("address"),onChange:N,onEnter:S,placeholder:t("new address"),value:f}),(0,a.jsx)(r.II,{className:"full",isError:!l,label:t("name"),onChange:k,onEnter:S,value:c})]})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"save",isDisabled:!w,label:t("Save"),onClick:S})})]})}));var j=t(60773),v=t(83696),y=t(33661);const C={available:!1,bonded:!1,locked:!1,redeemable:!1,reserved:!1,total:!0,unlocking:!1,vested:!1},w={available:!0,bonded:!0,locked:!0,nonce:!0,redeemable:!0,reserved:!0,total:!1,unlocking:!0,vested:!0},N=n.memo((function({address:e,className:s="",filter:t,isFavorite:o,toggleFavorite:i}){const{t:c}=b(),u=(0,d.h)(),m=(0,j.Y)(e),p=(0,v.r)(e),[x,g]=(0,n.useState)([]),[f,N]=(0,n.useState)(""),[k,S]=(0,n.useState)(null),[I,A]=(0,n.useState)(null),[P,E]=(0,n.useState)(!1),[M,T]=(0,n.useState)(!1),[D,F]=(0,n.useState)(!0),[V,_]=(0,l.O)(!1),q=(0,n.useCallback)((e=>g(e.sort())),[]);(0,n.useEffect)((()=>{const s=h.Nn.getAddress(e);S(s||null),A(s?.meta.genesisHash||null)}),[]),(0,n.useEffect)((()=>{const{identity:e,nickname:s}=m||{};(0,y.m)(u.api.query.identity?.identityOf)?e?.display&&N(e.display):s&&N(s)}),[u,m]),(0,n.useEffect)((()=>{const s=h.Nn.getAddress(e);q(s?.meta?.tags||[]),N(s?.meta?.name||"")}),[q,e]),(0,n.useEffect)((()=>{if(0===t.length)F(!0);else{const e=t.toLowerCase();F(x.reduce(((s,t)=>s||t.toLowerCase().includes(e)),f.toLowerCase().includes(e)))}}),[f,t,x]);const O=(0,n.useCallback)((s=>{A(s);const t=h.Nn.getAddress(e);t&&h.Nn.saveAddress(e,{...t.meta,genesisHash:s}),A(s)}),[e]),R=(0,n.useCallback)((()=>E(!P)),[P]),z=(0,n.useCallback)((()=>T(!M)),[M]),H=(0,n.useCallback)((()=>{if(e){const s={account:e,action:"forget"};try{h.Nn.forgetAddress(e),s.status="success",s.message=c("address forgotten")}catch(e){s.status="error",s.message=e.message}}}),[e,c]);if(!D)return null;const $=(0,a.jsxs)(r.v2,{children:[(0,a.jsx)(r.v2.Item,{isDisabled:!1,label:c("Forget this address"),onClick:R}),!u.isDevelopment&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.v2.Divider,{}),(0,a.jsx)(r.H_,{className:"addresses--network-toggle",genesisHash:I,onChange:O})]})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${s} isExpanded isFirst packedBottom`,children:[(0,a.jsx)(r.iA.Column.Favorite,{address:e,isFavorite:o,toggle:i}),(0,a.jsxs)("td",{className:"address all",children:[(0,a.jsx)(r.N,{value:e,withShortAddress:!0}),e&&k&&(0,a.jsxs)(a.Fragment,{children:[P&&(0,a.jsx)(r.u5,{address:k.address,mode:"address",onClose:R,onForget:H},"modal-forget-account"),M&&(0,a.jsx)(r.Zd,{onClose:z,recipientId:e},"modal-transfer")]})]}),(0,a.jsx)("td",{className:"actions button",children:(0,a.jsxs)(r.zx.Group,{children:[(0,y.m)(u.api.tx.balances?.transfer)&&(0,a.jsx)(r.zx,{className:"send-button",icon:"paper-plane",label:c("send"),onClick:z},"send"),(0,a.jsx)(r.GI,{value:$})]})}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:V,toggle:_})]}),(0,a.jsxs)("tr",{className:`${s} isExpanded ${V?"":"isLast"} packedTop`,children:[(0,a.jsx)("td",{}),(0,a.jsx)("td",{className:"balance all",colSpan:2,children:(0,a.jsx)(r.hl,{address:e,balancesAll:p,withBalance:C})}),(0,a.jsx)("td",{})]}),(0,a.jsxs)("tr",{className:`${s} ${V?"isExpanded isLast":"isCollapsed"} packedTop`,children:[(0,a.jsx)("td",{}),(0,a.jsxs)("td",{className:"balance columar",colSpan:2,children:[(0,a.jsx)(r.hl,{address:e,balancesAll:p,withBalance:w}),(0,a.jsx)(r.P0,{size:"tiny",children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)("div",{"data-testid":"tags",children:(0,a.jsx)(r.$G,{value:x,withTitle:!0})})})}),(0,a.jsx)(r.P0,{is100:!0,children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.NR,{data:e,type:"address",withTitle:!0})})})]}),(0,a.jsx)("td",{})]})]})})),k=r.zo.div` + .summary-box-contacts { + align-items: center; + } +`,S=n.memo((function({className:e="",onStatusChange:s}){const{t}=b(),{allAddresses:o}=(0,i.J)(),[d,m]=(0,l.O)(!1),[h,p]=(0,c.r)("accounts:favorites"),[x,g]=(0,n.useState)(),[j,v]=(0,n.useState)(""),y=(0,u.q)(),C=(0,n.useRef)([[t("contacts"),"start",4]]);return(0,n.useEffect)((()=>{g(o.map((e=>({address:e,isFavorite:h.includes(e)}))).sort(((e,s)=>e.isFavorite===s.isFavorite?0:s.isFavorite?1:-1)))}),[o,h]),(0,a.jsxs)(k,{className:e,children:[d&&(0,a.jsx)(f,{onClose:m,onStatusChange:s}),(0,a.jsxs)(r.Ty,{className:"summary-box-contacts",children:[(0,a.jsx)("section",{children:(0,a.jsx)(r.HS,{className:"media--1000",filterOn:j,label:t("filter by name or tags"),setFilter:v})}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"plus",label:t("Add contact"),onClick:m})})]}),(0,a.jsx)(r.iA,{empty:y&&x&&t("no addresses saved yet, add any existing address"),header:C.current,isSplit:!0,children:y&&x?.map((({address:e,isFavorite:s})=>(0,a.jsx)(N,{address:e,filter:j,isFavorite:s,toggleFavorite:p},e)))})]})})),I=n.memo((function({basePath:e,onStatusChange:s}){const{t}=b(),i=(0,n.useRef)([{isRoot:!0,name:"contacts",text:t("My contacts")}]);return(0,a.jsxs)("main",{children:[(0,a.jsx)(r.mQ,{basePath:e,items:i.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsx)(o.AW,{path:e,children:(0,a.jsx)(o.AW,{element:(0,a.jsx)(S,{onStatusChange:s}),index:!0})})})]})}))},49307:(e,s,t)=>{t.d(s,{Z:()=>$});var a=t(52322),n=t(2784),o=t(73557),r=t(92858),i=t(64348),l=t(90778),c=t(9118),u=t(70563),d=t(61349);function m(){return(0,d.$G)("app-alliance")}var h=t(62837);const p=n.memo((function({className:e,value:{cid:{codec:s,hash_:{code:t},version:n},ipfs:o}}){const r=(0,h.Y)(o);return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)("td",{className:"start all",children:r&&(0,a.jsx)("a",{href:r.ipfsUrl,rel:"noopener noreferrer",target:"_blank",children:r.ipfsHash})}),(0,a.jsx)("td",{className:"number",children:n.type}),(0,a.jsxs)("td",{className:"number",children:["0x",s.toString(16)]}),(0,a.jsxs)("td",{className:"number",children:["0x",t.toString(16)]})]})})),x=n.memo((function({accouncements:e,className:s}){const{t}=m(),o=(0,n.useRef)([[t("annoucements"),"start"],[t("version"),"number"],[t("codec"),"number"],[t("code"),"number"]]);return(0,a.jsx)("div",{className:s,children:(0,a.jsx)(i.iA,{empty:e&&t("No annoucements"),header:o.current,children:e?.map((e=>(0,a.jsx)(p,{value:e},e.key)))})})}));var g=t(38894),b=t(54383),f=t(34814);const j=n.memo((function({className:e,members:s,onClose:t,unscrupulous:{accounts:o}}){const{t:r}=m(),{api:c}=(0,l.h)(),{allAccounts:u}=(0,f.x)(),[d,h]=(0,n.useState)(null),p=(0,n.useMemo)((()=>u.filter((e=>!s.some((({accountId:s})=>s===e))&&!o.some((s=>s===e))))),[o,u,s]);return(0,a.jsxs)(i.u_,{className:e,header:r("Join alliance"),onClose:t,size:"large",children:[(0,a.jsxs)(i.u_.Content,{children:[(0,a.jsx)(i.u_.Columns,{hint:r("This account will be submitted to join the aliance. It will be allocated one of the alliance roles upon joining, starting with Ally."),children:(0,a.jsx)(i.rp,{filter:p,label:r("alliance account"),onChange:h,type:"account"})}),(0,a.jsx)(i.u_.Columns,{hint:r("The bond will be reserved for the duration of your alliance membership."),children:(0,a.jsx)(i.H,{defaultValue:c.consts.alliance.allyDeposit,isDisabled:!0,label:r("alliance deposit")})})]}),(0,a.jsx)(i.u_.Actions,{children:(0,a.jsx)(i.cA,{accountId:d,onStart:t,tx:c.tx.alliance.joinAlliance})})]})}));var v=t(86135),y=t(11677);const C=(0,y.e)("useMemberInfo",(function(e){const{api:s}=(0,l.h)(),t=(0,c.W7)(s.query.alliance.upForKicking,[e]),a=(0,c.W7)(s.query.alliance.retiringMembers,[e]),o=(0,c.W7)(s.query.alliance.depositOf,[e]);return(0,n.useMemo)((()=>o&&{accountId:e,deposit:o.unwrapOr(null),isUpForKicking:t&&t.isTrue,retiringAt:a?.unwrapOr(null)}),[e,o,a,t])})),w=n.memo((function({bestNumber:e,className:s,info:{accountId:t,role:o},isPrime:r,isVoter:c}){const{t:u}=m(),{api:d}=(0,l.h)(),{allAccounts:h}=(0,f.x)(),p=C(t),{queueExtrinsic:x}=(0,v.L)(),g=!!d.tx.alliance.giveRetirementNotice,b=(0,n.useMemo)((()=>h.includes(t)),[h,t]),j=(0,n.useCallback)((()=>x({accountId:t,extrinsic:d.tx.alliance.retire()})),[t,d,x]),y=(0,n.useCallback)((()=>x({accountId:t,extrinsic:d.tx.alliance.giveRetirementNotice()})),[t,d,x]);return(0,a.jsxs)("tr",{className:s,children:[(0,a.jsxs)("td",{className:"address all relative",children:[(0,a.jsx)(i.N,{value:t}),(0,a.jsx)("div",{className:"absolute",children:p?.isRetiringAt&&(0,a.jsx)(i.Vp,{color:"yellow",hover:u("Is retiring"),label:u("retirting")})||p?.isUpForKicking&&(0,a.jsx)(i.Vp,{color:"red",hover:u("Up for kicking"),label:u("kicking")})||r&&(0,a.jsx)(i.Vp,{color:"green",hover:u("Current prime member, default voting"),label:u("prime voter")})||c&&(0,a.jsx)(i.Vp,{color:"green",hover:u("Allowed to vote on motions"),label:u("voter")})})]}),(0,a.jsx)("td",{className:"number",children:o}),(0,a.jsx)("td",{className:"button",children:b&&(0,a.jsx)(i.GI,{value:(0,a.jsxs)(i.v2,{children:[g&&(0,a.jsx)(i.v2.Item,{isDisabled:!!p?.isRetiringAt,label:u("Announce retirement"),onClick:y}),(0,a.jsx)(i.v2.Item,{isDisabled:!!p&&(p.isUpForKicking||!!g&&(!e||!p.isRetiringAt||p.isRetiringAt.lt(e))),label:u("Retire"),onClick:j})]})},"settings")})]})}));var N=t(14681);const k=n.memo((function({className:e,members:s,rule:t}){const{t:n}=m(),o=(0,h.Y)(t?.cid?.ipfs);return(0,a.jsxs)(i.Ty,{className:e,children:[(0,a.jsx)(i.Jy,{label:n("rule"),children:t?t.hasRule?o?(0,a.jsx)("a",{href:o.ipfsUrl,rel:"noopener noreferrer",target:"_blank",children:o.ipfsShort}):n("yes"):n("no"):(0,a.jsx)("span",{className:"--tmp",children:n("no")})}),(0,a.jsx)(i.Jy,{label:n("members"),children:s?(0,N.u)(s.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]})})),S=n.memo((function({className:e,members:s,prime:t,rule:o,unscrupulous:r,voters:l}){const{t:c}=m(),[u,d]=(0,g.O)(),h=(0,b.C)(),p=(0,n.useRef)([[c("members"),"start",3]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(k,{members:s,rule:o}),(0,a.jsxs)(i.zx.Group,{children:[(0,a.jsx)(i.zx,{icon:"add",isDisabled:!s||!r,label:c("Join"),onClick:d}),s&&r&&u&&(0,a.jsx)(j,{members:s,onClose:d,unscrupulous:r})]}),(0,a.jsx)(i.iA,{empty:s&&c("No members"),header:p.current,isSplit:!0,maxColumns:2,children:s?.map((e=>(0,a.jsx)(w,{bestNumber:h,info:e,isPrime:t===e.accountId,isVoter:!!l&&l.includes(e.accountId)},e.accountId)))})]})})),I=n.memo((function({className:e,value:s}){return(0,a.jsx)("tr",{className:e,children:(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(i.N,{value:s})})})})),A=n.memo((function({className:e,value:s}){return(0,a.jsx)("tr",{className:e,children:(0,a.jsx)("td",{className:"start all",children:s})})})),P=n.memo((function({className:e,unscrupulous:s}){const{t}=m(),o=(0,n.useRef)([[t("accounts"),"start"]]),r=(0,n.useRef)([[t("websites"),"start"]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(i.iA,{empty:s?.accounts&&t("No accounts"),header:o.current,children:s?.accounts.map((e=>(0,a.jsx)(I,{value:e},e)))}),(0,a.jsx)(i.iA,{empty:s?.websites&&t("No websites"),header:r.current,children:s?.websites.map((e=>(0,a.jsx)(A,{value:e},e)))})]})}));var E=t(67292);function M(e){return{cid:e,ipfs:(0,E.c)(e),key:e.toHex()}}const T={transform:e=>e.map(M)},D=(0,y.e)("useAnnouncements",(function(){const{api:e}=(0,l.h)();return(0,c.W7)(e.query.alliance.announcements,[],T)})),F=["Retiring","Ally","Fellow"],V=(0,y.e)("useMembers",(function(){const{api:e}=(0,l.h)(),[s,t]=(0,n.useState)(),a=(0,c.W7)(e.query.alliance.members,[F[0]]),o=(0,c.W7)(e.query.alliance.members,[F[1]]),r=(0,c.W7)(e.query.alliance.members,[F[2]]);return(0,n.useEffect)((()=>{a&&o&&r&&t(((e=[])=>function(e,...s){const t=[];for(let a=0;ae.accountId===a&&e.role===n));t.push(r||{accountId:a,role:n})}}return t.reverse()}(e,a,o,r)))}),[a,o,r]),s})),_={transform:e=>e.isSome?{cid:M(e.unwrap()),hasRule:!0}:{cid:null,hasRule:!1}},q=(0,y.e)("useRule",(function(){const{api:e}=(0,l.h)();return(0,c.W7)(e.query.alliance.rule,[],_)}));function O(e){return e.map((e=>e.toString()))}const R={transform:e=>O(e)},z={transform:e=>O(e.filter((e=>e.isAscii)))},H=(0,y.e)("useUnscrupulous",(function(){const{api:e}=(0,l.h)(),s=(0,c.W7)(e.query.alliance.unscrupulousAccounts,[],R),t=(0,c.W7)(e.query.alliance.unscrupulousWebsites,[],z);return(0,n.useMemo)((()=>s&&t&&{accounts:s,websites:t}),[s,t])})),$=n.memo((function({basePath:e,className:s}){const{t}=m(),{api:d}=(0,l.h)(),h=(0,c.W7)(d.derive.alliance.proposalHashes),{isMember:p,members:g,prime:b}=(0,u.V)("alliance"),f=D(),j=V(),v=q(),y=H(),C=(0,n.useCallback)((e=>"alliance"===e),[]),w=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:t("Overview")},{name:"motions",text:t("Motions ({{count}})",{replace:{count:h?.length||0}})},{name:"announcements",text:t("Announcements ({{count}})",{replace:{count:f?.length||0}})},{name:"unscrupulous",text:t("Unscrupulous")}]),[f,h,t]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(i.mQ,{basePath:e,items:w}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(x,{accouncements:f}),path:"announcements"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(r.Z,{defaultProposal:d.tx.alliance.addUnscrupulousItems,defaultThreshold:.6666666666666666,filter:C,isMember:p,members:g,prime:b,proposalHashes:h,type:"alliance"}),path:"motions"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(P,{unscrupulous:y}),path:"unscrupulous"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(S,{isVoter:p,members:j,prime:b,rule:v,unscrupulous:y,voters:g}),index:!0})]})})]})}))},58370:(e,s,t)=>{t.d(s,{Z:()=>r});var a=t(2784),n=t(90778),o=t(9118);const r=(0,t(11677).e)("useCounter",(function(){const{api:e,isApiReady:s}=(0,n.h)(),t=(0,o.W7)(s&&e.derive.alliance.proposalHashes);return(0,a.useMemo)((()=>t?.length||0),[t])}))},25467:(e,s,t)=>{t.d(s,{Z:()=>W});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(34814),l=t(95292),c=t(14681),u=t(61349);function d(){return(0,u.$G)("app-assets")}var m=t(58607),h=t(90778),p=t(38894);const x=n.memo((function({accountId:e,assetId:s,className:t,minBalance:o,siFormat:[i,l]}){const{t:c}=d(),{api:u}=(0,h.h)(),[m,x]=(0,p.O)(),[g,b]=(0,n.useState)(),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(!0);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"paper-plane",label:c("send"),onClick:x}),m&&(0,a.jsxs)(r.u_,{className:t,header:c("transfer asset"),onClose:x,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:c("The account to transfer from. This account should have sufficient assets for this transfer."),children:(0,a.jsx)(r.rp,{defaultValue:e,isDisabled:!0,label:c("send from")})}),(0,a.jsx)(r.u_.Columns,{hint:c("The beneficiary will have access to the transferred asset when the transaction is included in a block."),children:(0,a.jsx)(r.rp,{label:c("send to address"),onChange:j,type:"allPlus"})}),(0,a.jsx)(r.u_.Columns,{hint:c("The amount of tokens to transfer to the account."),children:(0,a.jsx)(r.H,{autoFocus:!0,label:c("amount to transfer"),onChange:b,siDecimals:i,siSymbol:l})}),(0,a.jsx)(r.u_.Columns,{hint:c("The minimum balance allowed for the asset."),children:(0,a.jsx)(r.H,{defaultValue:o,isDisabled:!0,label:c("minimum balance"),siDecimals:i,siSymbol:l})}),(0,a.jsx)(r.u_.Columns,{hint:c("With the keep-alive option set, the account is protected against removal due to low balances."),children:(0,a.jsx)(r.ZD,{className:"typeToggle",label:c(v?"Transfer with account keep-alive checks":"Normal transfer without keep-alive checks"),onChange:y,value:v})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:e,icon:"paper-plane",isDisabled:!f||!g,label:c("Send"),onStart:x,params:[s,f,g],tx:v?u.tx.assets.transferKeepAlive:u.tx.assets.transfer})})]})]})})),g=n.memo((function({account:{balance:e,isFrozen:s,reason:t,sufficient:n},accountId:o,assetId:i,className:l,minBalance:c,siFormat:u}){const{t:h}=d();return(0,a.jsxs)("tr",{className:l,children:[(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(r.N,{value:o})}),(0,a.jsx)("td",{className:"start",children:h(s?.isTrue?"Yes":"No")}),(0,a.jsx)("td",{className:"start",children:n?n.isTrue?h("Yes"):h("No"):t?.toString()}),(0,a.jsx)("td",{className:"number all",children:(0,a.jsx)(m.Z,{format:u,value:e})}),(0,a.jsx)("td",{className:"button",children:(0,a.jsx)(x,{accountId:o,assetId:i,minBalance:c,siFormat:u})})]})}));var b=t(9118),f=t(11677);const j={transform:([[e],s])=>({accounts:e.map((([,e],t)=>{const a=s[t];return{account:(n=a,n.isSome||n.isNone?a.unwrapOr(null):a),accountId:e};var n})).filter((e=>!!e.account&&!e.account.balance.isZero())),assetId:e[0][0]}),withParamsTransform:!0},v=(0,f.e)("useBalances",(function(e){const{api:s}=(0,h.h)(),{allAccounts:t}=(0,i.x)(),a=(0,n.useMemo)((()=>[t.map((s=>[e,s]))]),[t,e]),o=(0,b.W7)(a&&s.query.assets.account.multi,a,j);return o&&e&&o.assetId===e&&o.accounts||null})),y=r.zo.div` + table { + overflow: auto; + } +`,C=n.memo((function({className:e,infos:s=[]}){const{t}=d(),[o,i]=(0,n.useState)(0),[l,u]=(0,n.useState)(null),m=v(l?.id),h=(0,n.useRef)([[t("accounts"),"start"],[t("frozen"),"start"],[t("sufficient"),"start"],[],[]]),p=(0,n.useMemo)((()=>s.filter((e=>!(!e.details||!e.metadata||e.details.supply.isZero()))).sort(((e,s)=>e.id.cmp(s.id)))),[s]),x=(0,n.useMemo)((()=>p.map((({id:e,metadata:s},t)=>({text:`${s.name.toUtf8()} (${(0,c.u)(e)})`,value:t})))),[p]),b=(0,n.useMemo)((()=>l?[l.metadata.decimals.toNumber(),l.metadata.symbol.toUtf8().toUpperCase()]:[0,"NONE"]),[l]);return(0,n.useEffect)((()=>{u((()=>o>=0&&o(0,a.jsx)(g,{account:e,accountId:s,assetId:l.id,minBalance:l.details.minBalance,siFormat:b},s)))})})}));var w=t(98551),N=t(79760);const k=n.memo((function({assetIds:e,className:s="",defaultValue:t,onChange:o,openId:i}){const{t:c}=d(),{api:u}=(0,h.h)(),[m]=(0,n.useState)((()=>t)),[p]=(0,n.useState)((()=>i)),[x,g]=(0,n.useState)(null),[b,f]=(0,n.useState)(),[j,v]=(0,n.useState)(),[y,C]=(0,n.useState)((()=>t?.assetName)),[w,N]=(0,n.useState)((()=>t?.assetSymbol)),[k,S]=(0,n.useState)(),[I,A]=(0,n.useMemo)((()=>j&&w?[j.toNumber(),w.toUpperCase()]:[0,"NONE"]),[j,w]),P=(0,n.useMemo)((()=>!!j&&j.lten(20)),[j]),E=(0,n.useMemo)((()=>!!y&&y.length>=3&&y.length<=32),[y]),M=(0,n.useMemo)((()=>!!w&&w.length>=3&&w.length<=7),[w]),T=(0,n.useMemo)((()=>!!b&&b.gt(l.nw)&&!e.some((e=>e.eq(b)))),[b,e]);return(0,n.useEffect)((()=>{o(b&&y&&w&&j&&T&&E&&M&&P&&x&&k&&!k.isZero()?{accountId:x,assetDecimals:j,assetId:b,assetName:y,assetSymbol:w,minBalance:k}:null)}),[u,x,j,b,e,y,w,T,E,M,P,k,o]),(0,a.jsxs)(r.u_.Content,{className:s,children:[(0,a.jsx)(r.u_.Columns,{hint:c("The account that is to be used to create this asset and setup the initial metadata."),children:(0,a.jsx)(r.rp,{defaultValue:m?.accountId,label:c("creator account"),onChange:g,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:c("The descriptive name for this asset."),children:(0,a.jsx)(r.II,{autoFocus:!0,defaultValue:m?.assetName,isError:!E,label:c("asset name"),onChange:C})}),(0,a.jsx)(r.u_.Columns,{hint:c("The symbol that will represent this asset."),children:(0,a.jsx)(r.II,{defaultValue:m?.assetSymbol,isError:!M,label:c("asset symbol"),onChange:N})}),(0,a.jsx)(r.u_.Columns,{hint:c("The number of decimals for this token. Max allowed via the UI is set to 20."),children:(0,a.jsx)(r.Rn,{defaultValue:m?.assetDecimals,isError:!P,label:c("asset decimals"),onChange:v})}),(0,a.jsx)(r.u_.Columns,{hint:c("The minimum balance for the asset. This is specified in the units and decimals as requested."),children:(0,a.jsx)(r.H,{defaultValue:m?.minBalance,isZeroable:!1,label:c("minimum balance"),onChange:S,siDecimals:I,siSymbol:A})}),(0,a.jsx)(r.u_.Columns,{hint:c("The selected id for the asset. This should not match an already-existing asset id."),children:(0,a.jsx)(r.Rn,{defaultValue:m?.assetId||p,isError:!T,isZeroable:!1,label:c("asset id"),onChange:f})})]})})),S=n.memo((function({accountId:e,className:s="",defaultValue:t,onChange:o}){const{t:i}=d(),{api:l}=(0,h.h)(),[c]=(0,n.useState)((()=>t)),[u,m]=(0,n.useState)(null),[p,x]=(0,n.useState)(null),[g,b]=(0,n.useState)(null);return(0,n.useEffect)((()=>{o(u&&p&&g?{adminId:u,freezerId:p,issuerId:g}:null)}),[l,u,p,g,o]),(0,a.jsxs)(r.u_.Content,{className:s,children:[(0,a.jsx)(r.u_.Columns,{hint:i("The account that is to be used for ongoing admin on the token."),children:(0,a.jsx)(r.rp,{defaultValue:c?.adminId||e,label:i("admin account"),onChange:m,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:i("The account that is to be used for issuing this token."),children:(0,a.jsx)(r.rp,{defaultValue:c?.issuerId||e,label:i("issuer account"),onChange:b,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:i("The account that is to be used for performing freezing."),children:(0,a.jsx)(r.rp,{defaultValue:c?.freezerId||e,label:i("freezer account"),onChange:x,type:"account"})})]})})),I={type:"all"},A=n.memo((function({assetIds:e,className:s,onClose:t,openId:o}){const{t:i}=d(),{api:l}=(0,h.h)(),[c,u,m]=(0,w.t)(),[p,x]=(0,n.useState)(null),[g,b]=(0,n.useState)(null),[f,j]=(0,n.useMemo)((()=>p?[l.tx.assets.create(p.assetId,p.accountId,p.minBalance),l.tx.assets.setMetadata(p.assetId,p.assetName,p.assetSymbol,p.assetDecimals)]:[null,null]),[l,p]),v=(0,n.useMemo)((()=>p&&g&&(g.adminId!==p.accountId||g.freezerId!==p.accountId||g.issuerId!==p.accountId)?l.tx.assets.setTeam(p.assetId,g.issuerId,g.adminId,g.freezerId):null),[l,p,g]),y=(0,n.useMemo)((()=>f&&j&&g&&(v?[f,j,v]:[f,j])),[f,j,g,v]),C=(0,N.b)(y,I);return(0,a.jsxs)(r.u_,{className:s,header:i("create asset {{step}}/{{steps}}",{replace:{step:c,steps:2}}),onClose:t,size:"large",children:[1===c&&(0,a.jsx)(k,{assetIds:e,defaultValue:p,onChange:x,openId:o}),2===c&&p&&(0,a.jsx)(S,{accountId:p.accountId,defaultValue:g,onChange:b}),(0,a.jsxs)(r.u_.Actions,{children:[1===c&&(0,a.jsx)(r.zx,{icon:"step-forward",isDisabled:!p,label:i("Next"),onClick:u}),2===c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:i("Prev"),onClick:m}),(0,a.jsx)(r.cA,{accountId:p?.accountId,extrinsic:C,icon:"plus",label:i("Create"),onStart:t})]})]})]})})),P=n.memo((function({assetIds:e,className:s,openId:t}){const{t:n}=d(),{hasAccounts:o}=(0,i.x)(),[l,c]=(0,p.O)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!e||!o,label:n("Create"),onClick:c}),l&&e&&(0,a.jsx)(A,{assetIds:e,className:s,onClose:c,openId:t})]})})),E=n.memo((function({className:e,details:{issuer:s,minBalance:t},id:o,metadata:i,onClose:l}){const{t:c}=d(),{api:u}=(0,h.h)(),[m,p]=(0,n.useState)(),[x,g]=(0,n.useState)(null),b=(0,n.useMemo)((()=>m&&m.gte(t)),[m,t]),[f,j]=(0,n.useMemo)((()=>[i.decimals.toNumber(),i.symbol.toUtf8().toUpperCase()]),[i]);return(0,a.jsxs)(r.u_,{className:e,header:c("mint asset"),onClose:l,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:c("The recipient account for this minting operation."),children:(0,a.jsx)(r.rp,{defaultValue:s,isDisabled:!0,label:c("issuer account")})}),(0,a.jsx)(r.u_.Columns,{hint:c("The recipient account for this minting operation."),children:(0,a.jsx)(r.rp,{label:c("mint to address"),onChange:g,type:"allPlus"})}),(0,a.jsx)(r.u_.Columns,{hint:c("The amount of tokens to issue to the account."),children:(0,a.jsx)(r.H,{autoFocus:!0,isError:!b,isZeroable:!1,label:c("amount to issue"),onChange:p,siDecimals:f,siSymbol:j})}),(0,a.jsx)(r.u_.Columns,{hint:c("The minimum balance allowed for the asset."),children:(0,a.jsx)(r.H,{defaultValue:t,isDisabled:!0,label:c("minimum balance"),siDecimals:f,siSymbol:j})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:s,icon:"plus",isDisabled:!x||!b,label:c("Mint"),onStart:l,params:[o,x,m],tx:u.tx.assets.mint})})]})})),M=n.memo((function({className:e,details:s,id:t,metadata:n}){const{t:o}=d(),[i,l]=(0,p.O)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:n.isFrozen.isTrue,label:o("Mint"),onClick:l}),i&&(0,a.jsx)(E,{className:e,details:s,id:t,metadata:n,onClose:l})]})})),T=n.memo((function({className:e,value:{details:s,id:t,isIssuerMe:o,metadata:i}}){const l=(0,n.useMemo)((()=>i?[i.decimals.toNumber(),i.symbol.toUtf8()]:[0,"---"]),[i]);return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:t}),(0,a.jsx)("td",{className:"together",children:i?.name.toUtf8()}),(0,a.jsx)("td",{className:"address media--1000",children:s&&(0,a.jsx)(r.N,{value:s.owner})}),(0,a.jsx)("td",{className:"address media--1300",children:s&&(0,a.jsx)(r.N,{value:s.admin})}),(0,a.jsx)("td",{className:"address media--1600",children:s&&(0,a.jsx)(r.N,{value:s.issuer})}),(0,a.jsx)("td",{className:"address media--1900",children:s&&(0,a.jsx)(r.N,{value:s.freezer})}),(0,a.jsx)("td",{className:"number all",children:s&&(0,a.jsx)(m.Z,{format:l,value:s.supply})}),(0,a.jsx)("td",{className:"button",children:s&&i&&o&&(0,a.jsx)(M,{details:s,id:t,metadata:i})})]})})),D=n.memo((function({className:e,infos:s}){const{t}=d(),o=(0,n.useRef)([[t("assets"),"start",2],[t("owner"),"address media--1000"],[t("admin"),"address media--1300"],[t("issuer"),"address media--1600"],[t("freezer"),"address media--1900"],[t("supply")],[]]);return(0,a.jsx)(r.iA,{className:e,empty:s&&t("No assets found"),header:o.current,children:s?.map((e=>(0,a.jsx)(T,{value:e},e.key)))})})),F=n.memo((function({className:e,numAssets:s}){const{t}=d();return(0,a.jsx)(r.Ty,{className:e,children:(0,a.jsx)(r.Jy,{label:t("assets"),children:(0,c.u)(s)})})})),V=n.memo((function({className:e,ids:s,infos:t,openId:n}){return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(F,{numAssets:s?.length}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(P,{assetIds:s,openId:n})}),(0,a.jsx)(D,{infos:t})]})}));var _=t(12298),q=t(39824);const O=[],R={transform:e=>e.map((({args:[e]})=>e))};function z(e){const s=[],t=[];return e.forEach((({event:{data:[e],method:a}})=>{"Created"===a||"ForceCreated"===a?s.push(e):t.push(e)})),{added:s,removed:t}}const H=(0,f.e)("useAssetIds",(function(){const{api:e}=(0,h.h)(),s=(0,_.k)(e.query.assets.asset,O,R);return(0,q.N)([e.events.assets.Created,e.events.assets.Destroyed,e.events.assets.ForceCreated],z,s)})),$={isAdminMe:!1,isFreezerMe:!1,isIssuerMe:!1,isOwnerMe:!1},L={withParams:!0};function B(e,s){const t=s.toString();return e.some((e=>e===t))}const Z=(0,f.e)("useAssetInfos",(function(e){const{api:s}=(0,h.h)(),{allAccounts:t}=(0,i.x)(),a=(0,b.W7)(s.query.assets.metadata.multi,[e],L),o=(0,b.W7)(s.query.assets.asset.multi,[e],L),[r,l]=(0,n.useState)();return(0,n.useEffect)((()=>{o&&a&&o[0][0].length===a[0][0].length&&l(o[0][0].map(((e,s)=>function(e,s,t,a){const n=t.unwrapOr(null);return{...n?{isAdminMe:B(e,n.admin),isFreezerMe:B(e,n.freezer),isIssuerMe:B(e,n.issuer),isOwnerMe:B(e,n.owner)}:$,details:n,id:s,key:s.toString(),metadata:a.isEmpty?null:a}}(t,e,o[1][s],a[1][s]))))}),[t,o,e,a]),r})),W=n.memo((function({basePath:e,className:s}){const{t}=d(),{hasAccounts:c}=(0,i.x)(),u=H(),m=Z(u),h=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")},{name:"balances",text:t("Balances")}]),p=(0,n.useMemo)((()=>c&&m&&m.some((({details:e,metadata:s})=>!(!e||!s)))?[]:["balances"]),[c,m]),x=(0,n.useMemo)((()=>function(e){if(!e?.length)return l.If;const s=e.find(((s,t)=>0===t?!s.eq(l.If):!s.sub(l.If).eq(e[t-1])));return s?s.sub(l.If):e[e.length-1].add(l.If)}(u)),[u]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,hidden:p,items:h.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(C,{infos:m}),path:"balances"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(V,{ids:u,infos:m,openId:x}),index:!0})]})})]})}))},95039:(e,s,t)=>{t.d(s,{Z:()=>ve});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(9118),l=t(54383),c=t(11677),u=t(95292);const d=(0,c.e)("useBounties",(function(){const{api:e}=(0,r.h)(),s=(0,i.W7)(e.derive.bounties.bounties),t=(0,i.W7)((e.query.bounties||e.query.treasury).bountyCount),a=(0,i.W7)(e.query.childBounties?.childBountyCount),o=(0,l.C)(),c=(0,n.useMemo)((()=>function(e){const s=e.consts.bounties||e.consts.treasury,t=e.tx.bounties||e.tx.treasury;return{bountyCuratorDeposit:s.bountyCuratorDeposit||u.nw,bountyDepositBase:s.bountyDepositBase,bountyUpdatePeriod:s.bountyUpdatePeriod,bountyValueMinimum:s.bountyValueMinimum,dataDepositPerByte:s.dataDepositPerByte,maximumReasonLength:s.maximumReasonLength.toNumber(),acceptCurator:t.acceptCurator,approveBounty:t.approveBounty,awardBounty:t.awardBounty,claimBounty:t.claimBounty,closeBounty:t.closeBounty,extendBountyExpiry:t.extendBountyExpiry,proposeBounty:t.proposeBounty,proposeCurator:t.proposeCurator,unassignCurator:t.unassignCurator}}(e)),[e]);return(0,n.useMemo)((()=>({...c,bestNumber:o,bounties:s,bountyCount:t,childCount:a})),[o,s,t,a,c])}));var m=t(38894),h=t(58607);const p=(0,c.e)("useBountyStatus",(function(e){return(0,n.useCallback)((()=>(e=>{let s={beneficiary:void 0,bountyStatus:e.type,curator:void 0,unlockAt:void 0,updateDue:void 0};return e.isCuratorProposed&&(s={...s,bountyStatus:"CuratorProposed",curator:e.asCuratorProposed.curator}),e.isActive&&(s={...s,curator:e.asActive.curator,updateDue:e.asActive.updateDue}),e.isPendingPayout&&(s={...s,beneficiary:e.asPendingPayout.beneficiary,bountyStatus:"PendingPayout",curator:e.asPendingPayout.curator,unlockAt:e.asPendingPayout.unlockAt}),s})(e)),[e])()}));var x=t(34814);function g(e,s){return e.length>s?e.substring(0,s-1)+String.fromCharCode(8230):e}var b=t(61349);function f(){return(0,b.$G)("app-bounties")}const j=n.memo((function({curatorId:e,description:s,index:t}){const{t:r}=f(),{awardBounty:i}=d(),{allAccounts:l}=(0,x.x)(),[c,u]=(0,m.O)(),[h,p]=(0,n.useState)(null);return(0,n.useMemo)((()=>l.includes(e.toString())),[l,e])?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"award",isDisabled:!1,label:r("Reward implementer"),onClick:u}),c&&(0,a.jsxs)(o.u_,{header:`${r("award bounty")} - "${g(s,30)}"`,onClose:u,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:r("The Curator account that will be used to send this transaction. Any applicable fees will be paid by this account."),children:(0,a.jsx)(o.rp,{defaultValue:e,isDisabled:!0,label:r("award with account"),type:"account",withLabel:!0})}),(0,a.jsx)(o.u_.Columns,{hint:r("Reward the bounty to an implementer's account. The implementer will be able to claim the funds after a delay period."),children:(0,a.jsx)(o.rp,{label:r("implementer account"),onChange:p,withLabel:!0})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:e,icon:"check",label:r("Approve"),onStart:u,params:[t,h],tx:i})})]})]}):null}));var v=t(70563);const y=(0,c.e)("useUserRole",(function(e){const{allAccounts:s,hasAccounts:t}=(0,x.x)(),{isMember:a}=(0,v.V)("council");return(0,n.useMemo)((()=>{const n=!!e&&s.includes(e.toString()),o=[];return n&&o.push("Curator"),a&&o.push("Member"),t&&o.push("User"),{isCurator:n,roles:o}}),[s,e,t,a])})),C=n.memo((function({curatorId:e,description:s,fee:t,index:r}){const{t:i}=f(),{acceptCurator:l}=d(),{isCurator:c}=y(e),{bountyCuratorDeposit:h}=d(),[p,x]=(0,m.O)(),b=(0,n.useMemo)((()=>{return e=h,t.mul(e).div(u.uy);var e}),[t,h]);return c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"check",isDisabled:!1,label:i("Accept"),onClick:x}),p&&(0,a.jsxs)(o.u_,{header:`${i("accept curator role")} - "${g(s,30)}"`,onClose:x,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:i("Only the account proposed as curator by the council can create the assign curator transaction"),children:(0,a.jsx)(o.rp,{isDisabled:!0,label:i("curator account"),type:"account",value:e.toString(),withLabel:!0})}),(0,a.jsx)(o.u_.Columns,{hint:i("This amount will be sent to your account after bounty is rewarded and you claim curator's fee."),children:(0,a.jsx)(o.H,{defaultValue:t.toString(),isDisabled:!0,label:i("curator's fee")})}),(0,a.jsx)(o.u_.Columns,{hint:i("This amount will be reserved from your account and returned after bounty claim is confirmed or if you give up, unless you are slashed earlier."),children:(0,a.jsx)(o.H,{defaultValue:b.toString(),isDisabled:!0,label:i("curator's deposit")})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:e,icon:"check",label:i("Accept Curator Role"),onStart:x,params:[r],tx:l})})]})]}):null})),w=n.memo((function({beneficiaryId:e,index:s,payoutDue:t}){const{t:r}=f(),{claimBounty:i}=d(),{allAccounts:l}=(0,x.x)();return(0,n.useMemo)((()=>function(e,s,t){return t.ltn(0)&&e.includes(s.toString())}(l,e,t)),[l,e,t])?(0,a.jsx)(o.cA,{accountId:e,icon:"plus",label:r("Claim"),params:[s],tx:i}):null}));var N=t(30943),k=t(81190),S=t(48801),I=t.n(S);const A=["approveBounty","closeBounty"],P=n.memo((function({description:e,index:s,proposals:t}){const{t:i}=f(),{api:l}=(0,r.h)(),{isMember:c,members:u}=(0,v.V)("council"),h=(0,k.m)("council"),{approveBounty:p,closeBounty:x}=d(),[b,j]=(0,m.O)(),[y,C]=(0,n.useState)(null),[w,S]=(0,n.useState)();(0,n.useEffect)((()=>{u&&S(new(I())(Math.ceil(u.length*(0,N.mo)(l))))}),[l,u]);const P=(0,n.useRef)(p(s)),E=(0,n.useRef)(x(s)),M=(0,n.useMemo)((()=>0!==t?.filter((({proposal:e})=>e&&A.includes(e.method))).length),[t]);return c&&!M&&h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"step-forward",isDisabled:!1,label:i("Initiate voting"),onClick:j}),b&&(0,a.jsxs)(o.u_,{header:`${i("Initiate voting")} - "${g(e,30)}"`,onClose:j,size:"large",children:[(0,a.jsx)(o.u_.Content,{children:(0,a.jsx)(o.u_.Columns,{hint:i('The council member that will create a motion, submission equates to an "aye" vote for chosen option.'),children:(0,a.jsx)(o.rp,{filter:u,label:i("vote with account"),onChange:C,type:"account",withLabel:!0})})}),(0,a.jsxs)(o.u_.Actions,{children:[(0,a.jsx)(o.cA,{accountId:y,icon:"check",isDisabled:!1,label:i("Approve"),onStart:j,params:[w,P.current,P.current.length],tx:l.tx[h].propose}),(0,a.jsx)(o.cA,{accountId:y,icon:"ban",isDisabled:!1,label:i("Reject"),onStart:j,params:[w,E.current,E.current.length],tx:l.tx[h].propose})]})]})]}):null})),E=["proposeCurator"],M=n.memo((function({description:e,index:s,proposals:t,value:i}){const{t:l}=f(),{api:c}=(0,r.h)(),{isMember:u,members:h}=(0,v.V)("council"),p=(0,k.m)("council"),{proposeCurator:x}=d(),[b,j]=(0,m.O)(),[y,C]=(0,n.useState)(null),[w,S]=(0,n.useState)(null),[A,P]=(0,n.useState)(),[M,T]=(0,n.useState)(),[D,F]=(0,n.useState)(!1);(0,n.useEffect)((()=>{h&&P(new(I())(Math.ceil(h.length*(0,N.mo)(c))))}),[c,h]);const V=(0,n.useMemo)((()=>w&&x(s,w,M)),[w,M,s,x]),_=(0,n.useMemo)((()=>0!==t?.filter((({proposal:e})=>e&&E.includes(e.method))).length),[t]);return(0,n.useEffect)((()=>{F(!!M&&!!i?.gt(M))}),[i,M]),u&&!_&&p?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"step-forward",isDisabled:!1,label:l("Propose curator"),onClick:j}),b&&(0,a.jsxs)(o.u_,{header:`${l("Propose curator")} - "${g(e,30)}"`,onClose:j,size:"large",testId:"propose-curator-modal",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:l("The council member that will create the motion."),children:(0,a.jsx)(o.rp,{filter:h,label:l("proposing account"),onChange:C,type:"account",withLabel:!0})}),(0,a.jsx)(o.u_.Columns,{hint:l("Choose a curator whose background and expertise is such that they are capable of determining when the task is complete."),children:(0,a.jsx)(o.rp,{label:l("select curator"),onChange:S,withLabel:!0})}),(0,a.jsxs)(o.u_.Columns,{hint:l("Part of the bounty value that will go to the Curator as a reward for their work"),children:[(0,a.jsx)(o.H,{isError:!D,isZeroable:!0,label:l("curator's fee"),onChange:T,value:M}),!D&&(0,a.jsx)(o.oy,{content:l("Curator's fee can't be higher than bounty value.")})]})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:y,icon:"check",isDisabled:!D,label:l("Propose curator"),onStart:j,params:[A,V,V?.length],tx:c.tx[p].propose})})]})]}):null}));function T({bestNumber:e,description:s,fee:t,index:o,proposals:r,status:i,value:l}){const{beneficiary:c,curator:u,unlockAt:d}=p(i),m=(0,n.useMemo)((()=>d?.sub(e)),[e,d]);return(0,a.jsxs)(a.Fragment,{children:[i.isProposed&&(0,a.jsx)(P,{description:s,index:o,proposals:r}),i.isFunded&&(0,a.jsx)(M,{description:s,index:o,proposals:r,value:l}),i.isCuratorProposed&&u&&t&&(0,a.jsx)(C,{curatorId:u,description:s,fee:t,index:o}),i.isPendingPayout&&c&&m&&(0,a.jsx)(w,{beneficiaryId:c,index:o,payoutDue:m}),i.isActive&&u&&(0,a.jsx)(j,{curatorId:u,description:s,index:o})]})}const D=n.memo((function({curatorId:e,description:s,index:t,toggleOpen:n}){const{t:r}=f(),{unassignCurator:i}=d();return(0,a.jsxs)(o.u_,{header:`${r("reject curator")} - "${g(s,30)}"`,onClose:n,size:"large",children:[(0,a.jsx)(o.u_.Content,{children:(0,a.jsx)(o.u_.Columns,{hint:r("Only the account proposed as curator by the council can create the unassign curator transaction "),children:(0,a.jsx)(o.rp,{isDisabled:!0,label:r("curator account"),type:"account",value:e.toString(),withLabel:!0})})}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:e,icon:"times",label:r("Reject"),onStart:n,params:[t],tx:i})})]})})),F=n.memo((function({description:e,index:s,toggleOpen:t}){const{t:i}=f(),{api:l}=(0,r.h)(),{members:c}=(0,v.V)("council"),u=(0,k.m)("council"),{closeBounty:m}=d(),[h,p]=(0,n.useState)(null),[x,b]=(0,n.useState)();(0,n.useEffect)((()=>{c&&b(new(I())(Math.ceil(c.length*(0,N.mo)(l))))}),[l,c]);const j=(0,n.useRef)(m(s));return u?(0,a.jsxs)(o.u_,{header:`${i("close bounty")} - "${g(e,30)}"`,onClose:t,size:"large",children:[(0,a.jsx)(o.u_.Content,{children:(0,a.jsx)(o.u_.Columns,{hint:i('The council member that will create the close bounty proposal, submission equates to an "aye" vote.'),children:(0,a.jsx)(o.rp,{filter:c,label:i("propose with account"),onChange:p,type:"account",withLabel:!0})})}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:h,icon:"ban",isDisabled:!1,label:i("Close Bounty"),onStart:t,params:[x,j.current,j.current.length],tx:l.tx[u].propose})})]}):null}));var V=t(97794);const _=n.memo((function({curatorId:e,description:s,index:t,toggleOpen:r}){const{t:i}=f(),{bountyUpdatePeriod:l,extendBountyExpiry:c}=d(),[u,m]=(0,n.useState)(""),[h,p]=(0,V.h)(l),x=(0,n.useCallback)((e=>{m(e)}),[]),b=(0,n.useMemo)((()=>l&&function(e,s){return new Date(Date.now()+e.muln(s).toNumber())}(l,h)),[l,h]);return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(o.u_,{header:`${i("extend expiry")} - "${g(s,30)}"`,onClose:r,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:i("Only curator can extend the bounty time."),children:(0,a.jsx)(o.rp,{isDisabled:!0,label:i("curator account"),type:"account",value:e.toString(),withLabel:!0})}),b&&(0,a.jsx)(o.u_.Columns,{hint:i(`Bounty expiry time will be set to ${p} from now.`),children:(0,a.jsx)(o.II,{isDisabled:!0,label:i("new expiry date and time"),value:`${b.toLocaleDateString()} ${b.toLocaleTimeString()}`})}),(0,a.jsx)(o.u_.Columns,{hint:i("The note that will be added to the transaction. It won't be stored on chain"),children:(0,a.jsx)(o.II,{autoFocus:!0,defaultValue:"",label:i("bounty remark"),onChange:x,value:u})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:e,icon:"check",label:i("Accept"),onStart:r,params:[t,u],tx:c})})]})})})),q=n.memo((function({curatorId:e,description:s,index:t,toggleOpen:n}){const{t:r}=f(),{unassignCurator:i}=d();return(0,a.jsxs)(o.u_,{header:`${r("give up curator's role")} - "${g(s,30)}"`,onClose:n,size:"large",children:[(0,a.jsx)(o.u_.Content,{children:(0,a.jsx)(o.u_.Columns,{hint:r("You are giving up your curator role, the bounty will return to the Funded state. You will get your deposit back."),children:(0,a.jsx)(o.rp,{isDisabled:!0,label:r("curator account"),type:"account",value:e.toString(),withLabel:!0})})}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:e,icon:"check",label:r("Give up"),onStart:n,params:[t],tx:i})})]})})),O=n.memo((function({action:e,curatorId:s,description:t,index:i,toggleOpen:l}){const{t:c}=f(),{api:u}=(0,r.h)(),{members:m}=(0,v.V)("council"),h=(0,k.m)("council"),{unassignCurator:p}=d(),[b,j]=(0,n.useState)(null),[y,C]=(0,n.useState)(),{allAccounts:w}=(0,x.x)();(0,n.useEffect)((()=>{m&&C(new(I())(Math.ceil(m.length*(0,N.mo)(u))))}),[u,m]);const S=(0,n.useMemo)((()=>p(i)),[i,p]),A=(0,n.useMemo)((()=>({SlashCuratorAction:{filter:w,header:c("This action will Slash the Curator."),params:[i],proposingAccountTip:c("The account that will create the transaction."),tip:c("Curator's deposit will be slashed and curator will be unassigned. Bounty will return to the Funded state."),title:c("Slash curator"),tx:p},SlashCuratorMotion:{filter:m,header:c("This action will create a Council motion to slash the Curator."),params:[y,S,S?.length],proposingAccountTip:c('The council member that will create the motion, submission equates to an "aye" vote.'),tip:c("If the motion is approved, Curator's deposit will be slashed and Curator will be unassigned. Bounty will return to the Funded state."),title:c("Slash curator"),tx:h&&u.tx[h].propose},UnassignCurator:{filter:m,header:c("This action will create a Council motion to unassign the Curator."),params:[y,S,S?.length],proposingAccountTip:c('The council member that will create the motion, submission equates to an "aye" vote.'),tip:c("If the motion is approved, the current Curator will be unassigned and the Bounty will return to the Funded state."),title:c("Unassign curator"),tx:h&&u.tx[h].propose}})),[c,i,p,u,w,h,m,y,S]),{filter:P,params:E,proposingAccountTip:M,tip:T,title:D,tx:F}=A[e];return F?(0,a.jsxs)(o.u_,{header:`${D} - "${g(t,30)}"`,onClose:l,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:M,children:(0,a.jsx)(o.rp,{filter:P,label:c("proposing account"),onChange:j,type:"account",withLabel:!0})}),(0,a.jsx)(o.u_.Columns,{hint:T,children:(0,a.jsx)(o.rp,{defaultValue:s,isDisabled:!0,label:c("current curator"),withLabel:!0})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:b,icon:"check",label:"Approve",onStart:l,params:E,tx:F})})]}):null})),R=n.memo((function({bestNumber:e,className:s,description:t,index:r,proposals:i,status:l}){const[c,d]=(0,m.O)(),[h,x]=(0,m.O)(),[g,b]=(0,m.O)(),[j,C]=(0,m.O)(),[w,N]=(0,m.O)(),[k,S]=(0,n.useState)(),{t:I}=f(),{isMember:A}=(0,v.V)("council"),{curator:P,updateDue:E}=p(l),{isCurator:M,roles:T}=y(P),V=function(e,s,t){const a=[];return s.isCuratorProposed&&e.includes("Member")&&a.push("UnassignCurator"),s.isActive&&(e.includes("Member")&&a.push("SlashCuratorMotion"),e.includes("User")&&t&&t.lt(u.nw)&&a.push("SlashCuratorAction")),s.isPendingPayout&&e.includes("Member")&&a.push("SlashCuratorMotion"),a}(T,l,(0,n.useMemo)((()=>E?.sub(e)),[e,E])),R=(0,n.useRef)({SlashCuratorAction:I("Slash curator"),SlashCuratorMotion:I("Slash curator (Council)"),UnassignCurator:I("Unassign curator")}),z=(0,n.useMemo)((()=>i?.find((({proposal:e})=>e&&"closeBounty"===e.method))),[i]),H=(0,n.useMemo)((()=>i?.find((({proposal:e})=>e&&"unassignCurator"===e.method))),[i]),$=(l.isFunded||l.isActive||l.isCuratorProposed)&&A&&!z,L=l.isCuratorProposed&&M,B=l.isActive&&M,Z=l.isActive&&M,W=(l.isCuratorProposed||l.isActive||l.isPendingPayout)&&!H&&0!==V.length,U=!($||L||Z||W||B),J=(0,n.useCallback)((e=>()=>{S(e),b()}),[b]);return U?null:(0,a.jsxs)("div",{className:s,children:[c&&(0,a.jsx)(F,{description:t,index:r,toggleOpen:d}),h&&P&&(0,a.jsx)(D,{curatorId:P,description:t,index:r,toggleOpen:x}),j&&P&&(0,a.jsx)(_,{curatorId:P,description:t,index:r,toggleOpen:C}),w&&P&&(0,a.jsx)(q,{curatorId:P,description:t,index:r,toggleOpen:N}),g&&P&&k&&(0,a.jsx)(O,{action:k,curatorId:P,description:t,index:r,toggleOpen:b}),(0,a.jsx)(o.GI,{value:(0,a.jsxs)(o.v2,{className:"settings-menu",children:[$&&(0,a.jsx)(o.v2.Item,{label:I("Close"),onClick:d},"closeBounty"),L&&(0,a.jsx)(o.v2.Item,{label:I("Reject curator"),onClick:x},"rejectCurator"),Z&&(0,a.jsx)(o.v2.Item,{label:I("Extend expiry"),onClick:C},"extendExpiry"),B&&(0,a.jsx)(o.v2.Item,{label:I("Give up"),onClick:N},"giveUpCurator"),W&&V.map((e=>(0,a.jsx)(o.v2.Item,{label:R.current[e],onClick:J(e)},e)))]})})]})})),z=o.zo.div` + margin-top: 0.28rem; + font-size: var(--font-size-tiny); + line-height: 0.85rem; + color: var(--color-label); +`,H=n.memo((function({className:e="",dataTestId:s="",description:t}){return(0,a.jsx)(z,{className:e,"data-testid":s,children:t})})),$={Active:["closeBounty","unassignCurator"],Approved:[],CuratorProposed:["closeBounty","unassignCurator"],Funded:["proposeCurator","closeBounty"],PendingPayout:["unassignCurator"],Proposed:["approveBounty","closeBounty"]};function L(e,s){return function(e,s){return e.find((({proposal:e})=>e&&e.method===s))}(e,function(e,s){const t=e.map((({proposal:e})=>e?.method));return function(e){return $[e.type]}(s).find((e=>t.includes(e)))}(e,s))??null}const B=o.zo.div` + margin-left: 0.2rem; +`,Z=n.memo((function({className:e,proposal:s,status:t}){const r=function(e,s){return e.proposal&&"unassignCurator"!==e.proposal.method?e.proposal.method:s.isCuratorProposed?"unassignCurator":"slashCurator"}(s,t),{t:i}=f(),l=(0,n.useRef)({approveBounty:i("Bounty approval under voting"),closeBounty:i("Bounty rejection under voting"),proposeCurator:i("Curator proposal under voting"),slashCurator:i("Curator slash under voting"),unassignCurator:i("Unassign curator under voting")});return(0,a.jsx)(B,{className:e,"data-testid":"voting-description",children:r&&l.current[r]&&(0,a.jsx)(o.ob,{help:l.current[r]})})})),W=o.zo.a` + line-height: 0.85rem; + font-size: var(--font-size-tiny); + text-decoration: underline; +`,U=n.memo((function({className:e}){const{t:s}=f();return(0,a.jsx)(W,{className:e,href:"#/council/motions",children:s("Voting")})})),J=o.zo.div` + .voting-summary-text { + font-size: var(--font-size-small); + line-height: 1.5rem; + color: var(--color-label); + + span { + min-width: 0.5rem; + margin-right: 0.5rem; + } + } + + .link-info { + display: flex; + justify-content: space-between; + align-items: center; + line-height: 1.5rem; + } +`,G=n.memo((function({className:e,proposal:s,status:t}){const{members:o}=(0,v.V)("council"),{t:r}=f(),i=(0,n.useMemo)((()=>s?.votes?.ayes?.length),[s]),l=(0,n.useMemo)((()=>s?.votes?.nays?.length),[s]),c=(0,n.useMemo)((()=>s?.votes?.threshold.toNumber()),[s]),u=(0,n.useMemo)((()=>o?.length&&c?o.length-c+1:0),[o,c]);return(0,a.jsx)(a.Fragment,{children:s&&(0,a.jsxs)(J,{className:e,"data-testid":"voting-summary",children:[(0,a.jsxs)("div",{className:"voting-summary-text",children:[(0,a.jsx)("span",{children:r("Aye")})," ",(0,a.jsxs)("b",{children:[i,"/",c]})]}),(0,a.jsxs)("div",{className:"voting-summary-text",children:[(0,a.jsx)("span",{children:r("Nay")})," ",(0,a.jsxs)("b",{children:[l,"/",u]})]}),(0,a.jsxs)("div",{className:"link-info",children:[(0,a.jsx)(U,{}),(0,a.jsx)(Z,{proposal:s,status:t})]})]})})})),Y=n.memo((function({beneficiary:e,proposals:s,status:t}){const{t:r}=f(),i=(0,n.useMemo)((()=>s&&L(s,t)),[s,t]);return(0,a.jsxs)(a.Fragment,{children:[i&&(0,a.jsx)(G,{proposal:i,status:t}),e&&(0,a.jsxs)("div",{children:[(0,a.jsx)(o.N,{value:e}),(0,a.jsx)(H,{description:r("Beneficiary")})]})]})})),Q=o.zo.div` + display: flex; + align-items: center; + font-size: var(--font-size-small); + line-height: 1.5rem; + + .info-icon { + margin-right: 0.2rem; + + svg { + color: var(--color-bounty-info); + } + } + + .description { + font-weight: var(--font-weight-normal); + var(font-size: var(--font-size-tiny);) + line-height: 0.864rem; + color: var(--color-label); + word-wrap: break-word; + } +`,K=n.memo((function({className:e="",description:s,type:t="info"}){return(0,a.jsxs)(Q,{className:e,children:["warning"===t&&(0,a.jsx)("div",{className:"info-icon",children:(0,a.jsx)(o.JO,{icon:"exclamation-triangle"})}),(0,a.jsx)("div",{className:"description",children:s})]})})),X=new(I())("10000"),ee=n.memo((function({bestNumber:e,blocksUntilUpdate:s,status:t}){const{t:o}=f(),{unlockAt:r}=p(t),{bountyUpdatePeriod:i}=d(),l=(0,n.useMemo)((()=>r?.sub(e)),[e,r]),c=i?.muln(10).div(u.S8),m=c??X;return(0,a.jsxs)("div",{children:[s?.lte(u.nw)&&(0,a.jsx)(K,{description:o("Update overdue"),type:"warning"}),s?.lt(m)&&s?.gt(u.nw)&&(0,a.jsx)(K,{description:o("Close deadline"),type:"warning"}),t.isApproved&&(0,a.jsx)(K,{description:o("Waiting for Bounty Funding"),type:"info"}),t.isCuratorProposed&&(0,a.jsx)(K,{description:o("Waiting for Curator's acceptance"),type:"info"}),l?.lt(u.nw)&&(0,a.jsx)(K,{description:o("Waiting for implementer to claim"),type:"info"})]})})),se=o.zo.div` + display: flex; + align-items: center; +`,te=n.memo((function({bountyStatus:e,className:s=""}){return(0,a.jsx)(se,{className:s,"data-testid":"bountyStatus",children:(t=e,t.replace(/([a-z])([A-Z])/g,"$1 $2"))});var t})),ae=n.memo((function({curator:e,isFromProposal:s}){const{t}=f();return(0,a.jsxs)("div",{children:[(0,a.jsx)(o.N,{value:e.toString()}),s&&(0,a.jsx)(H,{description:t("Proposed Curator")})]})}));var ne=t(65874),oe=t(14681);const re=n.memo((function({dueBlocks:e,endBlock:s,label:t}){return(0,a.jsx)(a.Fragment,{children:e.gtn(0)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(ne.Z,{value:e,children:[" (",t,")"]}),"#",(0,oe.u)(s)]})})})),ie={ayes:"check",nays:"times"},le=o.zo.div` + width: 50%; + + .vote-numbers { + display: flex; + align-items: center; + margin-bottom: 0.85rem; + } + + .vote-numbers-icon svg { + max-width: 10px; + color: var(--color-label); + } + + .vote-numbers-label { + margin-left: 0.75rem; + font-weight: var(--font-weight-bold); + font-size: var(--font-size-tiny); + line-height: 0.85rem; + text-transform: uppercase; + color: var(--color-label); + } +`,ce=n.memo((function({className:e,option:s,proposals:t,status:r}){const{t:i}=f(),l=(0,n.useMemo)((()=>L(t,r)),[t,r]),c=(0,n.useMemo)((()=>"ayes"===s?l?.votes?.ayes:l?.votes?.nays),[l,s]),u=(0,n.useMemo)((()=>c?.map((e=>(0,a.jsx)("div",{className:"voter","data-testid":`voters_${s}_${e.toString()}`,children:(0,a.jsx)(o.N,{value:e})},e.toString())))),[s,c]);return(0,a.jsx)(a.Fragment,{children:l&&(0,a.jsxs)(le,{className:e,children:[(0,a.jsxs)("div",{className:"vote-numbers",children:[(0,a.jsx)("span",{className:"vote-numbers-icon",children:(0,a.jsx)(o.JO,{icon:ie[s]})}),(0,a.jsxs)("span",{className:"vote-numbers-label",children:["ayes"===s&&i("Aye: {{count}}",{replace:{count:c?c.length:0}}),"nays"===s&&i("Nay: {{count}}",{replace:{count:c?c.length:0}})]})]}),u]})})})),ue=o.zo.tr` + .description-column { + max-width: 200px; + + div { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + } + + & .links { + display: inline-flex; + } + + & .inline-balance { + width: 50%; + font-size: var(--font-size-base); + line-height: normal; + } + + .column { + align-items: center; + display: flex; + padding: 0 0 0.5rem; + + h5 { + text-align: right; + padding: 0 1.7rem 0 0; + width: 50%; + } + } + + & .td-info-action-row { + padding-right: 0; + } + + .td-row { + display: flex; + justify-content: space-between; + align-items: center; + + & :only-child { + margin-left: auto; + } + } + + .bounty-action-row { + display: flex; + justify-content: flex-end; + align-items: center; + + & > * + * { + margin-left: 0.6rem; + } + } + + .block-to-time { + font-size: var(--font-size-tiny); + line-height: 1.5rem; + color: var(--color-label); + } + + & .votes-table { + display: flex; + justify-content: space-between; + } +`,de=n.memo((function({bestNumber:e,bounty:s,className:t="",description:r,index:i,proposals:l}){const{t:c}=f(),[u,d]=(0,m.O)(!1),{bond:x,curatorDeposit:g,fee:b,proposer:j,status:v,value:y}=s,{beneficiary:C,bountyStatus:w,curator:N,unlockAt:k,updateDue:S}=p(v),I=(0,n.useMemo)((()=>S?.sub(e)),[e,S]),A=(0,n.useMemo)((()=>k?.sub(e)),[e,k]),P=(0,n.useMemo)((()=>{if(N)return{curator:N,isFromProposal:!1};const e=l&&L(l,v);return"proposeCurator"===e?.proposal?.method?{curator:e.proposal.args[1],isFromProposal:!0}:null}),[N,l,v]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(ue,{className:`${t} isExpanded isFirst ${u?"":"isLast"}`,children:[(0,a.jsx)(o.iA.Column.Id,{value:i}),(0,a.jsx)("td",{className:"description-column","data-testid":"description",children:(0,a.jsx)("div",{title:r,children:r})}),(0,a.jsx)("td",{children:(0,a.jsx)(te,{bountyStatus:w})}),(0,a.jsx)(o.iA.Column.Balance,{value:y}),(0,a.jsx)("td",{children:P&&(0,a.jsx)(ae,{curator:P.curator,isFromProposal:P.isFromProposal})}),(0,a.jsxs)("td",{children:[A&&k&&(0,a.jsx)(re,{dueBlocks:A,endBlock:k,label:c("payout")}),I&&S&&(0,a.jsx)(re,{dueBlocks:I,endBlock:S,label:c("update")}),(0,a.jsx)(ee,{bestNumber:e,blocksUntilUpdate:I,status:v}),(0,a.jsx)(T,{bestNumber:e,description:r,fee:b,index:i,proposals:l,status:v,value:y})]}),(0,a.jsx)("td",{children:(0,a.jsx)(Y,{beneficiary:C,proposals:l,status:v})}),(0,a.jsx)("td",{className:"actions",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(R,{bestNumber:e,description:r,index:i,proposals:l,status:v}),(0,a.jsx)(o.Vh,{expanded:u,onClick:d})]})})]}),(0,a.jsxs)(ue,{className:`${t} ${u?"isExpanded isLast":"isCollapsed"}`,children:[(0,a.jsx)("td",{}),(0,a.jsx)("td",{className:"columar",colSpan:3,children:(0,a.jsxs)(o.P0,{children:[(0,a.jsx)(o.P0.Column,{children:(0,a.jsx)(o.NR,{data:i,type:"bounty",withTitle:!0})}),(0,a.jsxs)(o.P0.Column,{children:[(0,a.jsxs)("div",{className:"column",children:[(0,a.jsx)("h5",{children:c("Proposer")}),(0,a.jsx)(o.N,{value:j})]}),(0,a.jsxs)("div",{className:"column",children:[(0,a.jsx)("h5",{children:c("Bond")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(h.Z,{value:x})})]}),N&&(0,a.jsxs)("div",{className:"column",children:[(0,a.jsx)("h5",{children:c("Curator's fee")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(h.Z,{value:b})})]}),(0,a.jsx)("div",{className:"column",children:N&&!g.isZero()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:c("Curator's deposit")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(h.Z,{value:g})})]})})]})]})}),(0,a.jsx)("td",{}),(0,a.jsx)("td",{}),(0,a.jsx)("td",{children:l&&(0,a.jsxs)("div",{className:"votes-table",children:[(0,a.jsx)(ce,{option:"ayes",proposals:l,status:v}),(0,a.jsx)(ce,{option:"nays",proposals:l,status:v})]})}),(0,a.jsx)("td",{})]})]})}));function me(e){return new Blob([e]).size}const he=(0,c.e)("useBalance",(function(e){const{api:s}=(0,r.h)();return(0,i.W7)(s.derive.balances?.all,[e])?.availableBalance})),pe=u.nw,xe=n.memo((function(){const{t:e}=f(),{bountyDepositBase:s,bountyValueMinimum:t,dataDepositPerByte:r,maximumReasonLength:i,proposeBounty:l}=d(),[c,u]=(0,n.useState)(null),h=he(c),[p,x]=(0,n.useState)(""),[g,b]=(0,n.useState)(s),[j,v]=(0,n.useState)(pe),[y,C]=(0,m.O)(),[w,N]=(0,n.useState)(!1),[k,S]=(0,n.useState)(!1),[I,A]=(0,n.useState)(!1);(0,n.useEffect)((()=>{N(p?.length>=1&&me(p)<=i)}),[i,p]),(0,n.useEffect)((()=>{S(!!j?.gte(t))}),[t,j]),(0,n.useEffect)((()=>{A(!!h?.gte(g))}),[h,g]);const P=I&&w&&k,E=(0,n.useCallback)((e=>{var t,a;x(e),b((t=e,a=r,s.add(a.muln(me(t)))))}),[s,r]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"plus",isDisabled:!1,label:e("Add Bounty"),onClick:C}),y&&(0,a.jsxs)(o.u_,{className:"ui--AddBountyModal",header:e("Add Bounty"),onClose:C,children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsxs)(o.u_.Columns,{hint:e("Description of the Bounty (to be stored on-chain)"),children:[(0,a.jsx)(o.II,{autoFocus:!0,defaultValue:"",isError:!w,label:e("bounty title"),onChange:E,value:p}),!w&&""!==p&&(0,a.jsx)(o.oy,{content:e("Title too long")})]}),(0,a.jsxs)(o.u_.Columns,{hint:e("How much should be paid out for completed Bounty. Upon funding, the amount will be reserved in treasury."),children:[(0,a.jsx)(o.H,{isError:!k,isZeroable:!0,label:e("bounty requested allocation"),onChange:v,value:j}),!k&&!j?.eq(pe)&&(0,a.jsx)(o.oy,{content:e("Allocation value is smaller than the minimum bounty value.")})]}),(0,a.jsx)(o.u_.Columns,{hint:e("Proposer bond depends on bounty title length."),children:(0,a.jsx)(o.H,{defaultValue:g.toString(),isDisabled:!0,label:e("bounty bond")})}),(0,a.jsxs)(o.u_.Columns,{hint:e("This account will propose the bounty. Bond amount will be reserved on its balance."),children:[(0,a.jsx)(o.rp,{isError:!I,label:e("submit with account"),onChange:u,type:"account",withLabel:!0}),!I&&(0,a.jsx)(o.oy,{content:e("Account does not have enough funds.")})]})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:c,icon:"plus",isDisabled:!c||!P,label:e("Add Bounty"),onStart:C,params:[j,p],tx:l})})]})]})}));var ge=t(68920);const be=n.memo((function({className:e="",info:{bestNumber:s,bounties:t,bountyCount:r,childCount:i}}){const{t:l}=f(),{spendPeriod:c}=(0,ge._)(),u=(0,n.useMemo)((()=>(t||[]).reduce(((e,{bounty:{value:s}})=>e.iadd(s)),new(I())(0))),[t]);return(0,a.jsxs)(o.Ty,{className:`${e} ui--BountySummary`,children:[(0,a.jsxs)("section",{children:[t&&(0,a.jsx)(o.Jy,{label:l("active"),children:(0,oe.u)(t.length)}),r&&t&&(0,a.jsx)(o.Jy,{label:l("past"),children:(0,oe.u)(r.subn(t.length))}),i&&(0,a.jsx)(o.Jy,{label:l("children"),children:(0,oe.u)(i)})]}),(0,a.jsx)("section",{children:(0,a.jsx)(o.Jy,{label:l("active total"),children:(0,a.jsx)(h.Z,{value:u,withSi:!0})})}),(0,a.jsx)("section",{children:s&&!c.isZero()&&(0,a.jsx)(o.Jy,{label:l("funding period"),progress:{total:c,value:s.mod(c),withTime:!0}})})]})})),fe=o.zo.div` + .bounties-table-wrapper table { + tr { + td, &:not(.filter) th { + &:last-child { + padding-right: 1.14rem; + } + } + } + } + + .ui--IdentityIcon { + margin-right: 0.42rem; + } + + .via-identity .name { + font-size: var(--font-size-base); + line-height: 1.7rem; + text-transform: initial; + filter: initial; + opacity: 1; + } +`,je=n.memo((function({className:e}){const{t:s}=f(),t=d(),r=(0,n.useMemo)((()=>t?.bounties&&[...t.bounties].sort(((e,s)=>s.index.cmp(e.index)))),[t]),i=(0,n.useRef)([[s("bounties"),"start",3],[s("value")],[s("curator"),"start"],[s("next action"),"start",3]]),l=t.bestNumber;return(0,a.jsxs)(fe,{className:e,children:[(0,a.jsx)(be,{info:t}),(0,a.jsx)(o.zx.Group,{children:(0,a.jsx)(xe,{})}),(0,a.jsx)(o.iA,{className:"bounties-table-wrapper",empty:r&&s("No open bounties"),header:i.current,children:r&&l&&r.map((({bounty:e,description:s,index:t,proposals:n})=>(0,a.jsx)(de,{bestNumber:l,bounty:e,description:s,index:t,proposals:n},t.toNumber())))})]})})),ve=n.memo((function({basePath:e,className:s=""}){const{t}=f(),r=(0,n.useRef)([{isRoot:!0,name:"index",text:t("Overview")}]);return(0,a.jsxs)("main",{className:`${s} bounties--App`,children:[(0,a.jsx)(o.mQ,{basePath:e,items:r.current}),(0,a.jsx)(je,{})]})}))},19739:(e,s,t)=>{t.d(s,{Z:()=>r});var a=t(2784),n=t(90778),o=t(9118);const r=(0,t(11677).e)("useCounter",(function(){const{api:e,isApiReady:s}=(0,n.h)(),t=(0,o.W7)(s&&e.derive.bounties?.bounties);return(0,a.useMemo)((()=>t?.length||0),[t])}))},6742:(e,s,t)=>{t.d(s,{Z:()=>Z});var a=t(52322),n=t(2784),o=t(64348);const r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=["January","February","March","April","May","June","July","August","September","October","November","December"];var l=t(54371),c=t(14681),u=t(61349);function d(){return(0,u.$G)("app-calendar")}function m(e){const s=new Date(e);return s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0),s}function h(e,s=1){const t=e.getMonth();return 11===t?new Date(e.getFullYear()+1,0,s):new Date(e.getFullYear(),t+1,s)}function p(e,s){const t=m(e);t.setDate(1);const a=h(t),n=m(s),o=h(t,0).getDate(),i=[];for(let e=1;e<=o;e++)i.push(e);return{dateMonth:t,dateMonthNext:a,dateSelected:n,days:i,startClass:`start${r[t.getDay()]}`}}function x(e){return new Date(e).toISOString().split(".")[0].replace(/-/g,"").replace(/:/g,"")+"Z"}const g={day:"numeric",month:"long",weekday:"long",year:"numeric"};function b(e,s){return(0,a.jsx)("div",{className:"itemLink",children:(0,a.jsx)("a",{href:`#/${e}`,children:s})})}const f=o.zo.div` + align-items: flex-start; + display: flex; + justify-content: flex-start; + margin: 0.5rem 0.75rem; + + > div+div { + margin-left: 0.5rem; + } + + > div.itemTime+div.itemBlock { + margin-left: 0.25rem; + } + + .exportCal { + padding: 0; + position: absolute; + right: 1.5rem; + + .ui--Icon { + width: 0.7rem; + height: 0.7rem; + } + } + + .exportCal-allEvents { + right: 3.5rem; + } + + .itemBlock { + background: #aaa; + color: #eee; + font-size: var(--font-size-small); + align-self: center; + padding: 0.075rem 0.375rem; + border-radius: 0.25rem; + } + + .itemDate { + padding: 0 0.375rem; + border-radius: 0.25rem; + width: 17rem; + } + + .itemTime { + background: #999; + color: #eee; + padding: 0 0.375rem; + border-radius: 0.25rem; + } +`,j=n.memo((function({className:e,item:{blockNumber:s,date:t,info:r,type:i},showAllEvents:u}){const{t:m}=d(),[h,p]=(0,n.useState)(""),j=(0,n.useCallback)((()=>function(e,s){const t="BEGIN:VCALENDAR\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\nPRODID:-//Test Cal//EN\nVERSION:2.0\nBEGIN:VEVENT\nUID:test-1\nDTSTART;VALUE=DATE:"+x(e)+"\nDTEND;VALUE=DATE:"+x(new Date(new Date(e).setHours(new Date(e).getHours()+1)))+"\nSUMMARY:"+s+"\nDESCRIPTION:"+s+"\nEND:VEVENT\nEND:VCALENDAR",a=encodeURI(s)+".ics",n=new File([t],a,{type:"text/plain"}),o=window.document.createElement("a");o.href=window.URL.createObjectURL(n),o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(o.href)}(t,h)),[h,t]),v=(0,n.useMemo)((()=>{const e=r&&((0,l.H)(r)?r:(0,c.u)(r)),s=["councilElection"].includes(i)?b("council",m("via Council")):["councilMotion"].includes(i)?b("council/motions",m("via Council/Motions")):["democracyDispatch","scheduler"].includes(i)?b("democracy/dispatch",m("via Democracy/Dispatch")):["democracyLaunch","referendumDispatch","referendumVote"].includes(i)?b("/democracy",m("via Democracy")):["societyChallenge","societyRotate"].includes(i)?b("society",m("via Society")):["stakingEpoch","stakingEra"].includes(i)?b("staking",m("via Staking")):["stakingSlash"].includes(i)?b("staking/slashes",m("via Staking/Slashed")):["treasurySpend"].includes(i)?b("treasury",m("via Treasury")):["parachainLease"].includes(i)?b("parachains",m("via Parachains")):["parachainAuction"].includes(i)?b("parachains/auction",m("via Parachains/Auction")):void 0;let t="";switch(i){case"councilElection":t=m("Election of new council candidates");break;case"councilMotion":t=m("Voting ends on council motion {{id}}",{replace:{id:e}});break;case"democracyDispatch":t=m("Enactment of the result of referendum {{id}}",{replace:{id:e}});break;case"democracyLaunch":t=m("Start of the next referendum voting period");break;case"parachainAuction":t=m("End of the current parachain auction {{id}}",{replace:{id:e}});break;case"parachainLease":t=m("Start of the next parachain lease period {{id}}",{replace:{id:e}});break;case"referendumDispatch":t=m("Potential dispatch of referendum {{id}} (if passed)",{replace:{id:e}});break;case"referendumVote":t=m("Voting ends for referendum {{id}}",{replace:{id:e}});break;case"scheduler":t=e?m("Execute named scheduled task {{id}}",{replace:{id:e}}):m("Execute anonymous scheduled task");break;case"stakingEpoch":t=m("Start of a new staking session {{id}}",{replace:{id:e}});break;case"stakingEra":t=m("Start of a new staking era {{id}}",{replace:{id:e}});break;case"stakingSlash":t=m("Application of slashes from era {{id}}",{replace:{id:e}});break;case"treasurySpend":t=m("Start of next spending period");break;case"societyChallenge":t=m("Start of next membership challenge period");break;case"societyRotate":t=m("Acceptance of new members and bids");break;default:return function(e){throw new Error(`We should not get here, unhandled ${e}`)}(i)}return p(t),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"itemDesc",children:t}),s]})}),[r,m,i]);return(0,a.jsxs)(f,{className:e,children:[u&&(0,a.jsx)("div",{className:"itemDate",children:t.toLocaleString(void 0,g)}),(0,a.jsx)("div",{className:"itemTime",children:t.toLocaleTimeString().split(":").slice(0,2).join(":")}),(0,a.jsxs)("div",{className:"itemBlock",children:["#",(0,c.u)(s)]}),v,t&&(0,a.jsx)(o.zx,{className:u?"exportCal exportCal-allEvents":"exportCal",icon:"calendar-plus",onClick:j})]})})),v=36e5,y=o.zo.div` + align-items: center; + display: flex; + position: relative; + z-index: 2; + + &:nth-child(odd) { + background: var(--bg-table); + } + + &.isPast { + opacity: 0.75; + } + + .hourContainer { + flex: 1; + padding: 0.25rem 0; + } + + .hourLabel { + flex: 0; + font-size: var(--font-size-small); + font-weight: var(--font-weight-normal); + line-height: 1; + min-width: 5.5rem; + opacity: var(--opacity-light); + padding: 0.5rem 1rem; + text-align: right; + text-transform: uppercase; + z-index: 1; + } + + &.hasItems .hourLabel { + font-size: 1.1rem; + font-weight: var(--font-weight-normal); + opacity: 1; + padding: 0.7rem 1rem; + } +`,C=n.memo((function({className:e="",date:s,hour:t,index:o,minutes:r,scheduled:i}){const l=(0,n.useMemo)((()=>function(e,s,t,a){const n=e.getTime()+t*v,o=n+v,r=n+6e4*s;return a.filter((({dateTime:e})=>e>=r&&ee.dateTime-s.dateTime||e.type.localeCompare(s.type)))}(s,r,o,i)),[s,o,r,i]),c=`${` ${t}`.slice(-2)} ${t>=12?"pm":"am"}`;return(0,a.jsxs)(y,{className:`${e}${l.length?" hasItems":""}`,children:[(0,a.jsx)("div",{className:"hourLabel"+(l.length?" highlight--color":""),children:c}),(0,a.jsx)("div",{className:"hourContainer",children:l.map(((e,s)=>(0,a.jsx)(j,{item:e},s)))})]})})),w=n.memo((function(){const[e,s]=(0,n.useState)(new Date);return(0,n.useEffect)((()=>{const e=setInterval((()=>s(new Date)),1e3);return()=>{clearInterval(e)}}),[]),(0,a.jsx)(a.Fragment,{children:e.toLocaleTimeString().split(":").slice(0,2).join(":")})})),N=(()=>{const e=[];for(let s=0;s<24;s++)e.push(s);return e})(),k=o.zo.div` + flex: 1; + + .dayHeader { + align-items: center; + display: flex; + font-size: 1.25rem; + justify-content: space-between; + padding: 1rem 1.5rem 0; + } + + .hoursContainer { + z-index: 1; + } +`,S=n.memo((function({className:e,date:s,hasNextDay:t,now:r,scheduled:l,setNextDay:c,setPrevDay:u,setView:m}){const{t:h}=d(),p=(0,n.useRef)(i.map((e=>h(e)))),[x,g,b]=(0,n.useMemo)((()=>[s.getMonth()===r.getMonth()&&s.getFullYear()===r.getFullYear()&&s.getDate()===r.getDate(),r.getHours(),r.getMinutes()]),[s,r]),f=(0,n.useCallback)((()=>m(!0)),[m]);return(0,a.jsxs)(k,{className:e,children:[(0,a.jsxs)("h1",{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.zx,{className:"all-events-button",icon:"list",onClick:f}),s.getDate()," ",p.current[s.getMonth()]," ",s.getFullYear()," ",x&&(0,a.jsx)(w,{})]}),(0,a.jsxs)(o.zx.Group,{children:[(0,a.jsx)(o.zx,{icon:"chevron-left",isDisabled:x,onClick:u}),(0,a.jsx)(o.zx,{icon:"chevron-right",isDisabled:!t,onClick:c})]})]}),(0,a.jsx)("div",{className:"hoursContainer highlight--bg-faint",children:N.map(((e,t)=>(0,a.jsx)(C,{date:s,hour:e,index:t,minutes:x&&g===t?b:0,scheduled:l},e)))})]})})),I=864e5,A=o.zo.div` + background-color: transparent; + border: 1px solid transparent; + border-radius: 50%; + line-height: 1; + padding: 1rem; + position: relative; + text-align: center; + z-index: 1; + + &:before { + border-radius: 50%; + } + + &:not(.isDisabled) { + cursor: pointer; + } + + &:not(.isSelected):hover { + background: #f7f5f3; + } + + .eventIndicator { + border: 0.25rem solid transparent; + border-radius: 50%; + height: 0.25rem; + position: absolute; + right: 0.625rem; + top: 0.625rem; + width: 0.25rem; + } + + &.isDisabled { + opacity: 0.375; + + &:hover { + background: transparent; + } + + .eventIndicator { + display: none; + } + } +`,P=n.memo((function({className:e="",dateMonth:s,day:t,isCurrent:o,isDisabled:r,scheduled:i,setDay:l}){const c=(0,n.useMemo)((()=>{const e=s.getTime()+(t-1)*I,a=e+I;return i.some((({dateTime:s})=>s>=e&&s{!r&&l(t)}),[t,r,l]);return(0,a.jsxs)(A,{className:`${e} day ${r?"isDisabled":o?"highlight--bg-light highlight--color isSelected":""}`,onClick:u,children:[t,c&&(0,a.jsx)("div",{className:"eventIndicator highlight--border"})]})})),E=o.zo.div` + flex: 0; + max-width: max-content; + + .calendar { + padding: 1rem 1.5rem; + + .dateGrid, + .dayOfWeek { + display: grid; + grid-template-columns: repeat(7, 1fr); + } + + .dateGrid { + margin-top: 0.5em; + } + + &.startSun .dateGrid .day:first-child { grid-column: 1 } + &.startMon .dateGrid .day:first-child { grid-column: 2 } + &.startTue .dateGrid .day:first-child { grid-column: 3 } + &.startWed .dateGrid .day:first-child { grid-column: 4 } + &.startThu .dateGrid .day:first-child { grid-column: 5 } + &.startFri .dateGrid .day:first-child { grid-column: 6 } + &.startSat .dateGrid .day:first-child { grid-column: 7 } + + .dayOfWeek { + > * { + font-size: var(--font-size-tiny); + font-weight: var(--font-weight-normal); + letter-spacing: 0.1em; + text-align: center; + text-transform: uppercase; + } + } + + .monthIndicator { + align-items: center; + display: flex; + font-size: 1.25rem; + justify-content: space-between; + } + } +`,M=n.memo((function({className:e,hasNextMonth:s,lastDay:t,now:l,scheduled:c,setDay:u,setNextMonth:m,setPrevMonth:h,state:{dateMonth:p,dateSelected:x,days:g,startClass:b}}){const{t:f}=d(),j=(0,n.useRef)(r.map((e=>f(e)))),v=(0,n.useRef)(i.map((e=>f(e)))),[y,C,w,N,k]=(0,n.useMemo)((()=>[p.getFullYear()===x.getFullYear(),p.getMonth()===x.getMonth(),l.getFullYear()===p.getFullYear(),l.getMonth()===p.getMonth(),l.getMonth()>p.getMonth()]),[p,x,l]);return(0,a.jsxs)(E,{className:e,children:[(0,a.jsxs)("h1",{children:[(0,a.jsxs)("div",{children:[v.current[p.getMonth()]," ",p.getFullYear()]}),(0,a.jsxs)(o.zx.Group,{children:[(0,a.jsx)(o.zx,{icon:"chevron-left",isDisabled:w&&(k||N),onClick:h}),(0,a.jsx)(o.zx,{icon:"chevron-right",isDisabled:!s,onClick:m})]})]}),(0,a.jsxs)("div",{className:`calendar ${b}`,children:[(0,a.jsx)("div",{className:"dayOfWeek",children:j.current.map((e=>(0,a.jsx)("div",{children:f(e)},e)))}),(0,a.jsx)("div",{className:"dateGrid",children:g.map((e=>(0,a.jsx)(P,{dateMonth:p,day:e,isCurrent:y&&C&&e===x.getDate(),isDisabled:w&&(k||N&&l.getDate()>e)||!s&&e>t,scheduled:c,setDay:u},e)))})]})]})})),T=o.zo.div` + flex: 0; + max-width: max-content; + + .all-events-rows { + padding: 10px 0; + font-size: 13px; + &:nth-child(odd) { + background: var(--bg-table); + } + } + + .allEventsWrapper { + padding-inline-start: 10px; + } +`,D=n.memo((function({className:e,scheduled:s,setView:t}){const{t:r}=d(),i=(0,n.useMemo)((()=>s.sort(((e,s)=>e.dateTime-s.dateTime))),[s]),l=(0,n.useCallback)((()=>t(!1)),[t]);return(0,a.jsxs)(T,{className:e,children:[(0,a.jsx)("h1",{children:(0,a.jsxs)("div",{children:[(0,a.jsx)(o.zx,{className:"all-events-button",icon:"calendar",onClick:l}),r("Upcoming Events")]})}),(0,a.jsx)("ul",{className:"allEventsWrapper",children:i.map(((e,s)=>(0,a.jsx)(j,{className:"all-events-rows",item:e,showAllEvents:!0},s)))})]})}));var F=t(31132),V=t(90778),_=t(56360),q=t(54383),O=t(9118),R=t(11677),z=t(95292);function H(e,s){const t=new Date(Date.now()+e.mul(s).toNumber());return{date:t,dateTime:t.getTime()}}function $(e,s){return s.reduce(((e,[s,t])=>e.filter((({type:e})=>e!==s)).concat(...t.map((e=>(e.type=s,e))))),e)}const L=(0,R.e)("useScheduled",(function(){const{api:e}=(0,V.h)(),s=(0,_.n)(),t=(0,q.C)(),a=(0,F.f)(),o=(0,O.W7)(e.query.auctions?.auctionInfo),r=(0,O.W7)(e.derive.council?.proposals),i=(0,O.W7)(e.derive.democracy?.dispatchQueue),l=(0,O.W7)(e.derive.democracy?.referendums),c=(0,O.W7)(e.query.scheduler?.agenda?.entries),u=(0,O.W7)(e.derive.session?.progress),d=(0,O.W7)(e.query.staking?.unappliedSlashes.entries),[m,h]=(0,n.useState)([]);return(0,n.useEffect)((()=>{t&&i&&h((e=>$(e,function(e,s,t){return t.map((({at:t,index:a})=>{const n=t.sub(e);return["democracyDispatch",[{...H(n,s),blockNumber:t,blocks:n,info:a}]]}))}(t,s,i))))}),[t,s,i]),(0,n.useEffect)((()=>{t&&r&&h((e=>$(e,function(e,s,t){return[["councilMotion",t.map((({hash:t,votes:a})=>{if(!a)return null;const n=t.toHex(),o=a.end.sub(e);return{...H(o,s),blockNumber:a.end,blocks:o,info:`${n.slice(0,6)}…${n.slice(-4)}`}})).filter((e=>!!e))]]}(t,s,r))))}),[t,s,r]),(0,n.useEffect)((()=>{t&&l&&h((e=>$(e,function(e,s,t){return t.reduce(((t,{index:a,status:n})=>{const o=n.end.add(n.delay).isub(e),r=n.end.sub(e).isub(z.If);return t.push(["referendumVote",[{...H(r,s),blockNumber:e.add(r),blocks:r,info:a}]]),t.push(["referendumDispatch",[{...H(o,s),blockNumber:e.add(o),blocks:o,info:a,isPending:!0}]]),t}),[])}(t,s,l))))}),[t,s,l]),(0,n.useEffect)((()=>{t&&c&&h((e=>$(e,function(e,s,t){return[["scheduler",t.filter((([,e])=>e.some((e=>e.isSome)))).reduce(((t,[a,n])=>{const o=a.args[0];return n.filter((e=>e.isSome)).map((e=>e.unwrap())).reduce(((t,{maybeId:a})=>{const n=a.unwrapOr(null),r=o.sub(e);return t.push({...H(r,s),blockNumber:o,blocks:r,info:n?n.isAscii?n.toUtf8():n.toHex():null}),t}),t)}),[])]]}(t,s,c))))}),[t,s,c]),(0,n.useEffect)((()=>{t&&u?.sessionLength.gt(z.If)&&h((a=>$(a,function(e,s,t,a,n){const o=t.eraLength.sub(t.eraProgress),r=t.sessionLength.sub(t.sessionProgress),i=n?.mul(t.eraLength),l=i?a.filter((([,e])=>e.length)).map((([a])=>{const n=a.args[0],o=t.activeEra.sub(n).isub(z.If).imul(t.eraLength).iadd(t.eraProgress),r=i.sub(o);return{...H(r,s),blockNumber:e.add(r),blocks:r,info:n}})):[];return[["stakingEpoch",[{...H(r,s),blockNumber:e.add(r),blocks:r,info:t.currentIndex.add(z.If)}]],["stakingEra",[{...H(o,s),blockNumber:e.add(o),blocks:o,info:t.activeEra.add(z.If)}]],["stakingSlash",l]]}(t,s,u,d||[],e.consts.staking?.slashDeferDuration))))}),[e,t,s,u,d]),(0,n.useEffect)((()=>{t&&o?.isSome&&h((e=>$(e,function(e,s,t,[a,n]){const o=n.sub(e);return[["parachainAuction",[{...H(o,s),blockNumber:n,blocks:o,info:`${a.toString()} - ${a.add(t).toString()}`}]]]}(t,s,a,o.unwrap()))))}),[o,t,s,a]),(0,n.useEffect)((()=>{t&&h((a=>$(a,function(e,s,t){return t.map((([t,a,n=z.nw,o=z.nw])=>{if(!a)return[t,[]];const r=e.sub(o),i=a.sub(r.mod(a));return[t,[{...H(i,s),blockNumber:r.add(i),blocks:i,info:r.div(a).iadd(n)}]]}))}(t,s,[["councilElection",(e.consts.elections||e.consts.phragmenElection||e.consts.electionsPhragmen)?.termDuration],["democracyLaunch",e.consts.democracy?.launchPeriod],["parachainLease",e.consts.slots?.leasePeriod,z.If,e.consts.slots?.leaseOffset],["societyChallenge",e.consts.society?.challengePeriod],["societyRotate",e.consts.society?.rotationPeriod],["treasurySpend",e.consts.treasury?.spendPeriod]]))))}),[e,t,s]),m})),B=o.zo.main` + .calendarFlex { + align-items: flex-start; + display: flex; + flex-wrap: nowrap; + + .wrapper-style { + flex: 1; + + .upcoming-events { + position: relative; + max-width: 100%; + } + } + + > div { + background-color: var(--bg-table); + border: 1px solid var(--border-table); + border-radius: 0.25rem; + + &+div { + margin-left: 1.5rem; + } + + .ui--Button-Group { + margin: 0; + } + } + + h1 { + align-items: center; + border-bottom: 0.25rem solid var(--bg-page); + display: flex; + justify-content: space-between; + padding: 0.5rem 0.5rem 0.5rem 1rem; + + > div:first-child { + align-items: center; + display: inline-flex; + } + + .all-events-button { + margin-right: 1rem; + } + + .ui--Button { + font-size: var(--font-size-small); + } + } + } +`,Z=n.memo((function({basePath:e,className:s}){const{t}=d(),r=L(),[i,l]=(0,n.useState)((()=>new Date)),[c,u]=(0,n.useState)((()=>p(i,i))),[m,x]=(0,n.useState)(!1),g=(0,n.useRef)([{isRoot:!0,name:"view",text:t("Upcoming events")}]);(0,n.useEffect)((()=>{const e=setInterval((()=>l(new Date)),3e4);return()=>{clearInterval(e)}}),[]);const[b,f,j]=(0,n.useMemo)((()=>{const e=new Date(c.dateSelected);e.setDate(e.getDate()+1);const s=e.getTime(),t=c.dateMonthNext.getTime(),a=r.some((({dateTime:e})=>e>=t));return[a,a||r.some((({dateTime:e})=>e>=s)),a?42:r.reduce(((e,{date:s})=>s.getFullYear()===c.dateMonth.getFullYear()&&s.getMonth()===c.dateMonth.getMonth()?Math.max(e,s.getDate()):e),0)]}),[c,r]),v=(0,n.useCallback)((()=>u((({dateMonth:e,dateSelected:s})=>p(h(e),s)))),[]),y=(0,n.useCallback)((()=>u((({dateMonth:e,dateSelected:s})=>p(function(e){const s=e.getMonth();return 0===s?new Date(e.getFullYear()-1,11,1):new Date(e.getFullYear(),s-1,1)}(e),s)))),[]),C=(0,n.useCallback)((()=>u((({dateSelected:e})=>{const s=new Date(e);return s.setDate(s.getDate()+1),p(s,s)}))),[]),w=(0,n.useCallback)((()=>u((({dateSelected:e})=>{const s=new Date(e);return s.setDate(s.getDate()-1),p(s,s)}))),[]),N=(0,n.useCallback)((e=>u((({dateMonth:s})=>{const t=new Date(s);return t.setDate(e),p(t,t)}))),[]),k=(0,n.useCallback)((e=>x(e)),[]);return(0,a.jsxs)(B,{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:g.current}),(0,a.jsxs)("div",{className:"calendarFlex",children:[(0,a.jsx)(M,{hasNextMonth:b,lastDay:j,now:i,scheduled:r,setDay:N,setNextMonth:v,setPrevMonth:y,state:c}),(0,a.jsx)("div",{className:"wrapper-style",children:m?(0,a.jsx)(D,{className:"upcoming-events",scheduled:r,setView:k}):(0,a.jsx)(S,{date:c.dateSelected,hasNextDay:f,now:i,scheduled:r,setNextDay:C,setPrevDay:w,setView:k})})]})]})}))},75798:(e,s,t)=>{t.d(s,{Z:()=>J});var a=t(52322),n=t(2784),o=t(72282),r=t.n(o),i=t(61349),l=t(64348),c=t(50265),u=t(90778),d=t(9118),m=t(56623),h=t(55858),p=t(94175),x=t(34814),g=t(58607),b=t(95292);function f(){return(0,i.$G)("app-claims")}var j=t(97637),v=t.n(j),y=t(95267),C=t(64021),w=t(84195),N=t(48533),k=t(48731),S=t(51330),I=t(64071);function A(e){const s=e.toLowerCase(),t=(0,I.Cl)(s.substring(2)).substring(2);let a="0x";for(let e=0;e<40;e++)a=`${a}${parseInt(t[e],16)>7?s[e+2].toUpperCase():s[e+2]}`;return a}function P(e,{recovery:s,signature:t}){const a=function(e){const s=(0,C.d)(`Ethereum Signed Message:\n${e.length.toString()}${e}`),t=(0,I.ij)(s);return(0,w.Y)(t)}(e),n=v().recover(a,t,s);return o=v().publicKeyConvert(n,!1).subarray(1),A(`0x${(0,I.Cl)(o).slice(-40)}`);var o}function E(e,s){switch(e){case"Polkadot":case"Polkadot CC1":return function(e){if(!e)return;const s=e.isRegular?"https://statement.polkadot.network/regular.html":"https://statement.polkadot.network/saft.html";return{sentence:`I hereby agree to the terms of the statement whose SHA-256 multihash is ${e.isRegular?"Qmc1XYqT6S39WNp2UeiRUrZichUWUPpGEThDE6dAb3f6Ny":"QmXEkMahfhHJPzT3RjkXiZVFi77ZeVeuxtAjhojGRNYckz"}. (This may be found at the URL: ${s})`,url:s}}(s);default:return}}function M(e,s,t,a,n,o){return a?o||!n?{params:[t,a],tx:e.tx.claims.claim}:{params:[t,a,E(s,n)?.sentence],tx:e.tx.claims.claimAttest}:{}}const T="\nfont-size: var(--font-size-h3);\ndisplay: flex;\nflex-direction: column;\njustify-content: center;\nmin-height: 12rem;\nalign-items: center;\nmargin: 0 1rem;\n\nh3 {\n font-family: monospace;\n font-size: 1.5rem;\n max-width: 100%;\n margin: 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\nh2 {\n margin: 0.5rem 0 2rem;\n font-family: monospace;\n font-size: 2.5rem;\n font-weight: var(--font-weight-normal);\n}\n",D=l.zo.div`${T}`,F=n.memo((function({accountId:e,className:s="",ethereumAddress:t,ethereumSignature:o,isOldClaimProcess:r,onSuccess:i,statementKind:c}){const{t:d}=f(),{api:m,systemChain:h}=(0,u.h)(),[p,x]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1);if((0,n.useEffect)((()=>{t&&(v(!0),m.query.claims.claims(t).then((e=>{x(e.unwrapOr(b.nw)),v(!1)})).catch((e=>{console.error(e),v(!1)})))}),[m,t]),!t||j||!p)return null;const y=p.gt(b.nw);return(0,a.jsx)(l.Zb,{isError:!y,isSuccess:y,children:(0,a.jsxs)(D,{className:s,children:[d("Your Ethereum account"),(0,a.jsx)("h2",{children:A(t.toString())}),y?(0,a.jsxs)(a.Fragment,{children:[d("has a valid claim for"),(0,a.jsx)("h2",{children:(0,a.jsx)(g.Z,{value:p})}),(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.cA,{icon:"paper-plane",isUnsigned:!0,label:d("Claim"),onSuccess:i,...M(m,h,e,o,c,r)})})]}):(0,a.jsx)(a.Fragment,{children:d("does not appear to have a valid claim. Please double check that you have signed the transaction correctly on the correct ETH account.")})]})})}));function V({statementUrl:e,systemChain:s}){const{t}=f();switch(s){case"Polkadot":case"Polkadot CC1":return e?(0,a.jsx)("iframe",{src:e}):null;default:return(0,a.jsx)("p",{children:t("Warning: we did not find any attest statement for {{chain}}",{replace:{chain:s}})})}}const _=l.zo.div` + .statement{ + border: 1px solid #c2c2c2; + background: #f2f2f2; + height: 15rem; + padding: 1rem; + width: 100%; + margin: 1rem 0; + white-space: normal; + + p { + color: var(--color-text) !important; + } + + iframe { + border: 0; + height: 100%; + width: 100%; + } + } + + .statementUrl{ + margin-left: 0.3rem + } +`,q=n.memo((function({className:e,kind:s,systemChain:t}){const{t:n}=f(),o=E(t,s)?.url;return o?(0,a.jsxs)(_,{className:e,children:[n("Please read these terms and conditions carefully. By submitting this statement, you are deemed to have accepted these Terms and Conditions. If you do not agree to these terms, please refrain from accessing or proceeding. You can also find them at:"),(0,a.jsx)("a",{className:"statementUrl",href:o,rel:"noopener noreferrer",target:"_blank",children:o}),(0,a.jsx)("div",{className:"statement",children:(0,a.jsx)(V,{statementUrl:o,systemChain:t})})]}):null})),O=l.zo.div`${T}`,R=n.memo((function({accountId:e,className:s,ethereumAddress:t,onSuccess:o,statementKind:r,systemChain:i}){const c=(0,x.x)(),{t:d}=f(),{api:m}=(0,u.h)(),[h,p]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1);(0,n.useEffect)((()=>{t&&(v(!0),m.query.claims.claims(t).then((e=>{p(e.unwrapOr(b.nw)),v(!1)})).catch((e=>{console.error(e),v(!1)})))}),[m,t]);const y=(0,n.useMemo)((()=>E(i,r)?.sentence),[i,r]);if(j||!h)return null;const C=h.isZero();return C||!y?(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)(O,{className:s,children:[C&&(0,a.jsx)("p",{children:d("There is no on-chain claimable balance associated with the Ethereum account {{ethereumAddress}}",{replace:{ethereumAddress:t}})}),!y&&(0,a.jsx)("p",{children:d("There is no on-chain attestation statement associated with the Ethereum account {{ethereumAddress}}",{replace:{ethereumAddress:t}})})]})}):c.isAccount(e)?(0,a.jsx)(l.Zb,{isSuccess:!0,children:(0,a.jsxs)(O,{className:s,children:[(0,a.jsx)(q,{kind:r,systemChain:i}),(0,a.jsx)("h2",{children:(0,a.jsx)(g.Z,{label:d("Account balance:"),value:h})}),(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.cA,{accountId:e,icon:"paper-plane",isDisabled:!y,label:d("I agree"),onSuccess:o,params:[y],tx:m.tx.claims.attest})})]})}):(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)(O,{className:s,children:[d("We found a pre-claim with this Polkadot address. However, attesting requires signing with this account. To continue with attesting, please add this account as an owned account first."),(0,a.jsx)("h2",{children:(0,a.jsx)(g.Z,{label:d("Account balance:"),value:h})})]})})}));var z=t(15153);const H=l.zo.div` + font-size: var(--font-size-h3); + display: flex; + flex-direction: column; + justify-content: center; + min-height: 8rem; + align-items: center; + margin: 0 1rem; + + .ui--AddressMini-address { + max-width: 20rem; + } +`,$=n.memo((function({className:e}){const{t:s}=f(),t=(0,z.Z)();return t.length?(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)(H,{className:e,children:[t.length>1?s("You need to sign an attestation for the following accounts:"):s("You need to sign an attestation for the following account:"),t.map((e=>(0,a.jsx)(l.ax,{value:e},e)))]})}):null}));var L;!function(e){e[e.Account=0]="Account",e[e.ETHAddress=1]="ETHAddress",e[e.Sign=2]="Sign",e[e.Claim=3]="Claim"}(L||(L={}));const B="PRECLAIMS_LOADING",Z=l.zo.pre` + cursor: copy; + font: var(--font-mono); + border: 1px dashed #c2c2c2; + background: #f2f2f2; + padding: 1rem; + width: 100%; + margin: 1rem 0; + white-space: normal; + word-break: break-all; +`,W=l.zo.textarea` + font: var(--font-mono); + padding: 1rem; + border: 1px solid var(--border-input); + border-radius: 0.25rem; + margin: 1rem 0; + resize: none; + width: 100%; + + &::placeholder { + color: rgba(0, 0, 0, 0.5); + } + + &::-ms-input-placeholder { + color: rgba(0, 0, 0, 0.5); + } + + &:-ms-input-placeholder { + color: rgba(0, 0, 0, 0.5); + } +`,U={transform:e=>e.unwrapOr(null)},J=n.memo((function({basePath:e}){const[s,t]=(0,n.useState)(!1),[o,x]=(0,n.useState)(null),[g,b]=(0,n.useState)(null),[j,v]=(0,n.useState)(L.Account),[C,I]=(0,n.useState)(null),{api:A,systemChain:M}=(0,u.h)(),{t:T}=f(),[D,V]=(0,n.useState)(B),_=!!D&&D!==B,O=(0,n.useRef)([{isRoot:!0,name:"create",text:T("Claim tokens")}]);(0,n.useEffect)((()=>{if(C){if(v(L.Account),x(null),V(B),!A.query.claims||!A.query.claims.preclaims)return V(null);A.query.claims.preclaims(C).then((e=>{const s=e.unwrapOr(null)?.toString();x(s),V(s)})).catch((e=>{console.error(e),V(null)}))}}),[C,A.query.claims,A.query.claims.preclaims]);const z=!A.tx.claims.claimAttest;(0,n.useEffect)((()=>{s&&setTimeout((()=>{t(!1)}),1e3)}),[s]);const H=(0,n.useCallback)((()=>{v(L.Account)}),[]),J=(0,n.useCallback)((()=>{v(L.Sign)}),[]),G=(0,n.useCallback)((()=>{v(L.Claim)}),[]),Y=(0,n.useCallback)((()=>{_?G():o||z?J():v(L.ETHAddress)}),[o,G,J,_,z]),Q=(0,n.useCallback)((e=>{const{value:s}=e.target,{ethereumAddress:t,signature:a}=function(e){try{const{msg:s,sig:t}=JSON.parse(e||"{}");if(!s||!t)throw new Error("Invalid signature object");const a=function(e){const s=(0,N.G)(e);(0,k.hu)(65===s.length,`Invalid signature length, expected 65 found ${s.length}`);let t=s[64];t<27&&(t+=27);const a=t-27;return(0,k.hu)(0===a||1===a,"Invalid signature v value"),{recovery:a,signature:(0,w.Y)(s.slice(0,64))}}(t);return{error:null,ethereumAddress:y.statics.registry.createType("EthereumAddress",P(s,a)),signature:y.statics.registry.createType("EcdsaSignature",(0,S.e)(a.signature,new Uint8Array([a.recovery])))}}catch(e){return console.error(e),{error:e,ethereumAddress:null,signature:null}}}(s);x(t?.toString()),b(a)}),[]),K=(0,n.useCallback)((e=>{x(e.trim())}),[]),X=(0,n.useCallback)((()=>{t(!0)}),[]),ee=(0,d.W7)(!_&&!z&&!!o&&A.query.claims.signing,[o],U),se=E(M,ee)?.sentence||"",te=(0,m.z)(A.consts.claims.prefix.toU8a(!0)),ae=C?`${te}${(0,h.c)((0,p.m)(C),-1,!1)}${se}`:"";return(0,a.jsxs)("main",{children:[(0,a.jsx)(l.mQ,{basePath:e,items:O.current}),!z&&(0,a.jsx)($,{}),(0,a.jsx)("h1",{children:(0,a.jsxs)(i.cC,{children:["Claim your ",(0,a.jsx)("em",{children:c.k.abbr})," tokens"]})}),(0,a.jsxs)(l.P0,{children:[(0,a.jsxs)(l.P0.Column,{children:[(0,a.jsxs)(l.Zb,{withBottomMargin:!0,children:[(0,a.jsx)("h2",{children:T("1. Select your {{chain}} account",{replace:{chain:M}})}),(0,a.jsx)(l.rp,{defaultValue:C,label:T("claim to account"),onChange:I,type:"all"}),j===L.Account&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:D===B,label:T(D===B?"Loading":"Continue"),onClick:Y})})]}),j>=L.ETHAddress&&!_&&!z&&(0,a.jsxs)(l.Zb,{withBottomMargin:!0,children:[(0,a.jsx)("h2",{children:T("2. Enter the ETH address from the sale.")}),(0,a.jsx)(l.II,{autoFocus:!0,className:"full",label:T("Pre-sale ethereum address"),onChange:K,value:o||""}),j===L.ETHAddress&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:!o,label:T("Continue"),onClick:J})})]}),j>=L.Sign&&!_&&(0,a.jsxs)(l.Zb,{children:[(0,a.jsx)("h2",{children:T("{{step}}. Sign with your ETH address",{replace:{step:z?"2":"3"}})}),!z&&(0,a.jsx)(q,{kind:ee,systemChain:M}),(0,a.jsx)("div",{children:T("Copy the following string and sign it with the Ethereum account you used during the pre-sale in the wallet of your choice, using the string as the payload, and then paste the transaction signature object below:")}),(0,a.jsx)(r(),{onCopy:X,text:ae,children:(0,a.jsx)(Z,{"data-for":"tx-payload","data-tip":!0,children:ae})}),(0,a.jsx)(l.u,{place:"right",text:T(s?"copied":"click to copy"),trigger:"tx-payload"}),(0,a.jsx)("div",{children:T("Paste the signed message into the field below. The placeholder text is there as a hint to what the message should look like:")}),(0,a.jsx)(W,{onChange:Q,placeholder:`{\n "address": "0x ...",\n "msg": "${te}:...",\n "sig": "0x ...",\n "version": "2"\n}`,rows:10}),j===L.Sign&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:!C||!g,label:T("Confirm claim"),onClick:G})})]})]}),(0,a.jsx)(l.P0.Column,{children:C&&j>=L.Claim&&(_?(0,a.jsx)(R,{accountId:C,ethereumAddress:o,onSuccess:H,statementKind:ee,systemChain:M}):(0,a.jsx)(F,{accountId:C,ethereumAddress:o,ethereumSignature:g,isOldClaimProcess:z,onSuccess:H,statementKind:ee}))})]})]})}))},73352:(e,s,t)=>{t.d(s,{Z:()=>o});var a=t(11677),n=t(15153);const o=(0,a.e)("useCounter",(function(){return(0,n.Z)().length}))},15153:(e,s,t)=>{t.d(s,{Z:()=>l});var a=t(2784),n=t(34814),o=t(90778),r=t(74065),i=t(9118);const l=(0,t(11677).e)("usePolkadotPreclaims",(function(){const{allAccounts:e}=(0,n.x)(),{api:s}=(0,o.h)(),t=(0,r.X)(),[l,c]=(0,a.useState)([]),u=(0,i.W7)(s.query.claims?.preclaims?.multi,[e],{transform:s=>s.map(((s,t)=>[e[t],s])).filter((([,e])=>e.isSome)).map((([e,s])=>[e,s.unwrap()]))});return(0,a.useEffect)((()=>{u&&s.queryMulti(u.reduce(((e,[,t])=>e.concat([[s.query.claims.claims,t],[s.query.claims.vesting,t]])),[]),(e=>{t.current&&c(u.filter(((s,t)=>e[2*t].isSome||e[2*t+1].isSome)).map((([e])=>e)))})).catch(console.error)}),[s,e,t,u]),l}))},2799:(e,s,t)=>{t.d(s,{Z:()=>y});var a=t(52322),n=t(2784),o=t(64348),r=t(75387),i=t(36609),l=t(14681);const c=n.memo((function({className:e,info:{accountId:s,deposit:t,isInvulnerable:r,lastBlock:c},lastBlock:u}){const d=(0,n.useMemo)((()=>c?(0,l.u)(c):u),[c,u]);return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)("td",{className:"badge number",children:r&&(0,a.jsx)(o.Ct,{color:"green",icon:"shield"})}),(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(o.N,{value:s})}),(0,a.jsx)(o.iA.Column.Balance,{value:t}),(0,a.jsx)("td",{className:"number",children:(0,a.jsx)(i.Z,{params:s})}),(0,a.jsx)("td",{className:"number",children:d})]})}));var u=t(90778),d=t(9118),m=t(61349);function h(){return(0,m.$G)("app-collator")}const p=n.memo((function({className:e}){const{t:s}=h(),{api:t}=(0,u.h)(),n=(0,d.W7)(t.query.collatorSelection.desiredCandidates);return(0,a.jsx)(o.Ty,{className:e,children:(0,a.jsx)("section",{children:n&&(0,a.jsx)(o.Jy,{label:s("desired"),children:(0,l.u)(n)})})})}));var x=t(11677);const g={transform:e=>e.map((e=>({accountId:e.toString(),isInvulnerable:!0})))},b={transform:e=>Array.isArray(e)?e.map((({deposit:e,who:s})=>({accountId:s.toString(),deposit:e,isInvulnerable:!1}))):e.strings.map((e=>({accountId:e,isInvulnerable:!1})))},f={transform:([[e],s])=>e.reduce(((e,t,a)=>({...e,[t]:s[a]})),{}),withParamsTransform:!0},j=(0,x.e)("useCollatorImpl",(function(){const{api:e}=(0,u.h)(),[s,t]=(0,n.useState)(),a=(0,n.useMemo)((()=>s?.map((({accountId:e})=>e))),[s]),o=(0,d.W7)(e.query.collatorSelection.invulnerables,[],g),r=(0,d.W7)(e.query.collatorSelection.candidates,[],b),i=(0,d.W7)(a&&e.query.collatorSelection.lastAuthoredBlock?.multi,[a],f);return(0,n.useEffect)((()=>o&&r&&t((()=>[...o,...r]))),[r,o]),(0,n.useEffect)((()=>i&&t((e=>e&&function(e,s){let t=!1;const a=e.map((e=>!s[e.accountId]||e.lastBlock&&s[e.accountId].eq(e.lastBlock)?e:(t=!0,{...e,lastBlock:s[e.accountId]})));return t?a:e}(e,i)))),[i]),s})),v=n.memo((function({className:e}){const{t:s}=h(),t=j(),{byAuthor:i}=(0,r.E)(),l=(0,n.useRef)([[s("collators"),"start",2],[s("deposit"),"number"],[s("balance"),"number"],[s("last #"),"number"]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(p,{}),(0,a.jsx)(o.iA,{empty:t&&s("No running collators"),header:l.current,children:t?.map((e=>(0,a.jsx)(c,{info:e,lastBlock:i[e.accountId]},e.accountId)))})]})})),y=n.memo((function({basePath:e,className:s}){const{t}=h(),r=(0,n.useRef)([{isRoot:!0,name:"index",text:t("Overview")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:r.current}),(0,a.jsx)(v,{})]})}))},22516:(e,s,t)=>{t.d(s,{Z:()=>He});var a=t(52322),n=t(2784),o=t(64348),r=t(38894),i=t(17751),l=t(61349);function c(){return(0,l.$G)("app-contracts")}const u=n.memo((function({className:e,isBusy:s,isContract:t,isError:n,onChange:r,onEnter:i,value:l=""}){const{t:u}=c();return(0,a.jsx)(o.II,{className:e,isDisabled:s,isError:n,label:u(t?"contract name":"code bundle name"),onChange:r,onEnter:i,value:l})}));var d=t(90778),m=t(9118),h=t(14681),p=t(83488),x=t(67557);const g=o.zo.div` + font: var(--font-mono); + font-weight: var(--font-weight-normal); + flex-grow: 1; + + .ui--MessageSignature-mutates { + color: #ff8600; + margin-left: 0.5rem; + opacity: var(--opacity-light); + } + + .ui--MessageSignature-name { + color: #2f8ddb; + font-weight: var(--font-weight-normal); + } + + .ui--MessageSignature-type { + color: #21a2b2; + } + + .ui--MessageSignature-returnType { + color: #ff8600; + } +`,b=n.memo((function({className:e,message:{args:s,isConstructor:t,isMutating:r,method:i,returnType:l},params:u=[],withTooltip:m=!1}){const{t:h}=c(),{api:p}=(0,d.h)();return(0,a.jsxs)(g,{className:e,children:[(0,a.jsx)("span",{className:"ui--MessageSignature-name",children:i})," ","(",s.map((({name:e,type:t},o)=>{return(0,a.jsxs)(n.Fragment,{children:[e,":"," ",(0,a.jsx)("span",{className:"ui--MessageSignature-type",children:u?.[o]?(0,a.jsx)("b",{children:(r=u[o].toString(),r.length>20?`${r.substring(0,10)}…${r.substring(r.length-10)}`:r)}):(0,x.RH)(p.registry,t)}),oe.trim())).filter((e=>e)).filter(((e,t)=>!(s||(t||e.startsWith("#"))&&(s=!0,1))))}const j=o.zo.div` + align-items: center; + border-radius: 0.25rem; + display: flex; + padding: 0.25rem 0.75rem 0.25rem 0; + + &.disabled { + opacity: 1 !important; + background: #eee !important; + color: #555 !important; + } + + .info { + flex: 1 1; + margin-left: 1.5rem; + + .docs { + font-size: var(--font-size-small); + font-weight: var(--font-weight-normal); + } + } + + .result { + min-width: 15rem; + } + + &+& { + margin-top: 0.5rem; + } +`,v=n.memo((function({className:e="",index:s,lastResult:t,message:r,onSelect:i}){const{t:l}=c(),u=(0,n.useCallback)((()=>i&&i(s)),[s,i]);return(0,a.jsxs)(j,{className:`${e} ${i?"":"exempt-hover"} ${r.isConstructor?"constructor":""}`,children:[i&&(r.isConstructor?(0,a.jsx)(o.zx,{className:"accessory",icon:"upload",label:l("deploy"),onClick:u}):(0,a.jsx)(o.zx,{className:"accessory",icon:"play",isDisabled:!r.isMutating&&!r.args.length&&t?.result.isOk,label:r.isMutating?l("exec"):l("read"),onClick:u})),(0,a.jsxs)("div",{className:"info",children:[(0,a.jsx)(b,{asConstructor:r.isConstructor,message:r,withTooltip:!0}),(0,a.jsx)("div",{className:"docs",children:r.docs.length?f(r.docs).map(((e,s)=>(0,a.jsx)("div",{children:e},`${r.identifier}-docs-${s}`))):(0,a.jsxs)("i",{children:[" ",l("No documentation provided")," "]})})]}),t&&t.result.isOk&&t.output&&(0,a.jsx)(o.r_,{className:"result",isFull:!0,label:l("current value"),children:(0,p.Z)("Text",t.output)})]},`${r.identifier}-${s}`)})),y="0x".padEnd(66,"0");function C(e){return e.map(((e,s)=>[e,s])).sort(((e,s)=>e[0].identifier.localeCompare(s[0].identifier))).sort(((e,s)=>e[0].isMutating===s[0].isMutating?0:e[0].isMutating?-1:1))}const w=o.zo.div` + padding-bottom: 0.75rem !important; + + &.isLabelled { + background: var(--bg-input); + box-sizing: border-box; + border: 1px solid var(--border-input); + border-radius: .28571429rem; + padding: 1rem 1rem 0.5rem; + width: 100%; + } +`,N=n.memo((function({className:e="",contract:s,contractAbi:{constructors:t,info:{source:r},messages:i},isLabelled:l,isWatching:u,onSelect:p,onSelectConstructor:x,trigger:g,withConstructors:b,withMessages:f,withWasm:j}){const{t:N}=c(),{api:k}=(0,d.h)(),S=(0,m.W7)(s&&k.query.contracts.contractInfoOf,[s?.address]),[I,A]=(0,n.useState)(!1),[P,E]=(0,n.useState)([]),M=(0,n.useCallback)((e=>{u&&A(e)}),[u]),T=(0,n.useCallback)((()=>{S&&s&&Promise.all(i.map((e=>e.isMutating||0!==e.args.length?Promise.resolve(void 0):s.query[e.method](y,{gasLimit:-1,value:0}).catch((s=>console.error(`contract.query.${e.method}:: ${s.message}`))).then((()=>{}))))).then(E).catch(console.error)}),[s,i,S]);(0,n.useEffect)((()=>{(I||g)&&S&&s&&T()}),[T,s,I,S,g]);const D=(0,n.useCallback)(((e,s)=>{}),[]),F=(0,n.useCallback)((e=>p&&p(e,D)),[D,p]);return(0,a.jsxs)(w,{className:`${e} ui--Messages ${l?"isLabelled":""}`,children:[b&&(0,a.jsx)(o.xH,{summary:N("Constructors ({{count}})",{replace:{count:t.length}}),children:C(t).map((([e,s])=>(0,a.jsx)(v,{index:s,message:e,onSelect:x},s)))}),f&&(0,a.jsx)(o.xH,{onClick:M,summary:N("Messages ({{count}})",{replace:{count:i.length}}),children:C(i).map((([e,s])=>(0,a.jsx)(v,{index:s,lastResult:P[s],message:e,onSelect:F},s)))}),j&&0!==r.wasm.length&&(0,a.jsx)("div",{children:N("{{size}} WASM bytes",{replace:{size:(0,h.u)(r.wasm.length)}})})]})})),k=()=>{},S=n.memo((function({className:e,contractAbi:s,errorText:t,isDisabled:n,isError:r,isFull:i,isValid:l,label:u,onChange:d,onRemove:m=k,onSelectConstructor:h,withConstructors:p=!0,withLabel:x=!0,withMessages:g=!0,withWasm:b}){const{t:f}=c();return s&&l?(0,a.jsx)(o.jN,{className:e,label:u||f("contract ABI"),labelExtra:m&&(0,a.jsx)(o.JH,{icon:"trash",label:f("Remove ABI"),onClick:m}),withLabel:x,children:(0,a.jsx)(N,{contractAbi:s,isLabelled:x,onSelectConstructor:h,withConstructors:p,withMessages:g,withWasm:b})}):(0,a.jsx)("div",{className:e,children:(0,a.jsx)(o.ht,{isDisabled:n,isError:r,isFull:i,label:u||f("contract ABI"),onChange:d,placeholder:t||f("click to select or drag and drop a JSON file")})})}));var I=t(30686),A=t(23729),P=t.n(A),E=t(8257),M=t(95267),T=t(54371);const D="code:";class F extends I.v{#e={};get hasCode(){return 0!==Object.keys(this.#e).length}getAllCode(){return Object.values(this.#e)}getCode(e){return this.#e[e]}saveCode(e,s){const t=((0,T.H)(e)?M.statics.api.registry.createType("Hash",e):e).toHex(),a=this.getCode(t),n={...a?a.json:{},...s,codeHash:t,genesisHash:M.statics.api.genesisHash.toHex(),whenCreated:a?.json.whenCreated||Date.now()},o=`${D}${n.codeHash}`;P().set(o,n),this.addCode(o,n)}forgetCode(e){this.removeCode(`${D}${e}`,e)}loadAll(e){try{const s=M.statics.api.genesisHash.toHex();P().each(((e,t)=>{e&&e.genesisHash===s&&t.startsWith(D)&&this.addCode(t,e)})),e&&e()}catch(e){console.error("Unable to load code",e)}}addCode(e,s){try{this.#e[s.codeHash]={contractAbi:s.abi?new E.P(s.abi,M.statics.api.registry.getChainProperties()):void 0,json:s},this.emit("new-code")}catch(t){console.error(t),this.removeCode(e,s.codeHash)}}removeCode(e,s){try{delete this.#e[s],P().remove(e),this.emit("removed-code")}catch(e){console.error(e)}}}const V=new F;var _=t(11677),q=t(56623);function O(e,s){return{abi:e[0]||null,abiName:null,contractAbi:e[1]||null,errorText:null,isAbiError:!1,isAbiSupplied:!!e[1],isAbiValid:!s||!!e[1]}}const R={abi:null,abiName:null,contractAbi:null,errorText:null,isAbiError:!1,isAbiSupplied:!1,isAbiValid:!1},z=(0,_.e)("useAbi",(function(e=[null,null],s=null,t=!1){const[a,o]=(0,n.useState)((()=>O(e,t)));return(0,n.useEffect)((()=>o((s=>e[0]&&s.abi!==e[0]?O(e,t):s))),[e,t]),{...a,onChangeAbi:(0,n.useCallback)(((e,t)=>{const a=(0,q.z)(e);try{o({abi:a,abiName:t.replace(".contract","").replace(".json","").replace("_"," "),contractAbi:new E.P(a,M.statics.api.registry.getChainProperties()),errorText:null,isAbiError:!1,isAbiSupplied:!0,isAbiValid:!0}),s&&V.saveCode(s,{abi:a})}catch(e){console.error(e),o({...R,errorText:e.message})}}),[s]),onRemoveAbi:(0,n.useCallback)((()=>{o(R),s&&V.saveCode(s,{abi:null})}),[s])}}));var H=t(74076);const $=n.memo((function({codeHash:e,onChange:s}){const{api:t}=(0,d.h)(),{t:r}=c(),i=(0,m.W7)((t.query.contracts||t.query.contract).pristineCode||(t.query.contracts||t.query.contract).codeStorage,[e]),[l,u]=(0,n.useMemo)((()=>{const t=!!e&&(0,H.vq)(e)&&66===e.length,a=!!i&&i.isSome,n=t&&a;return s(n),[t,n]}),[e,i,s]);return u||!l?null:(0,a.jsx)(o.Kd,{type:"error",children:r(l?"Unable to find on-chain WASM code for the supplied codeHash":"The codeHash is not a valid hex hash")})})),L=n.memo((function({onClose:e}){const{t:s}=c(),[t,r]=(0,n.useState)(""),[l,d]=(0,n.useState)(!1),[m,h]=(0,n.useState)(null),{abi:p,contractAbi:x,errorText:g,isAbiError:b,isAbiSupplied:f,isAbiValid:j,onChangeAbi:v,onRemoveAbi:y}=z(),C=(0,n.useCallback)((()=>{t&&m&&(V.saveCode(t,{abi:p,name:m,tags:[]}),e())}),[p,t,m,e]),w=!(0,i.F)(m)&&m.length>0,N=l&&w&&f&&j;return(0,a.jsxs)(o.u_,{header:s("Add an existing code hash"),onClose:e,children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.II,{autoFocus:!0,isError:t.length>0&&!l,label:s("code hash"),onChange:r,value:t}),(0,a.jsx)($,{codeHash:t,onChange:d}),(0,a.jsx)(u,{isError:!w,onChange:h,value:m||void 0}),(0,a.jsx)(S,{contractAbi:x,errorText:g,isError:b||!b,isSupplied:f,isValid:j,onChange:v,onRemove:y})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.zx,{icon:"save",isDisabled:!N,label:s("Save"),onClick:C})})]})}));var B=t(16613);const Z="",W=(0,o.zo)(B.Z)` + .ui--CodeRow-icon { + margin-right: -0.5em; + background: #eee; + border-radius: 50%; + color: #666; + width: 26px; + height: 26px; + display: flex; + justify-content: center; + align-items: center; + } +`,U=n.memo((function({buttons:e,children:s,className:t,code:{json:r},isInline:i,withTags:l}){const[c,u]=(0,n.useState)(r.name||Z),[d,m]=(0,n.useState)(r.tags||[]),[h,p]=(0,n.useState)(r.codeHash||"0x");(0,n.useEffect)((()=>{u(r.name||Z),m(r.tags||[]),p(r.codeHash||"0x")}),[r]);const x=(0,n.useCallback)((()=>{c.trim()&&h&&V.saveCode(h,{name:c})}),[h,c]),g=(0,n.useCallback)((()=>{h&&V.saveCode(h,{tags:d})}),[h,d]);return(0,a.jsx)(W,{buttons:e,className:t,icon:(0,a.jsx)("div",{className:"ui--CodeRow-icon",children:(0,a.jsx)(o.JO,{icon:"code"})}),isInline:i,name:c,onChangeName:u,onChangeTags:m,onSaveName:x,onSaveTags:g,tags:l?d:void 0,children:s})})),J=o.zo.tr` + .codeHash { + div { + display: inline; + + &:first-child { + font-family: monospace; + margin-right: 0.5rem; + } + } + } +`,G=n.memo((function({className:e,code:s,onShowDeploy:t}){const{t:i}=c(),{api:l}=(0,d.h)(),u=(0,m.W7)(l.query.contracts.pristineCode||l.query.contracts.codeStorage,[s.json.codeHash]),[h,p]=(0,r.O)(),{contractAbi:x}=z([s.json.abi,s.contractAbi],s.json.codeHash,!0),g=(0,n.useCallback)((()=>t(s.json.codeHash,0)),[s,t]),b=(0,n.useCallback)((e=>{t&&t(s.json.codeHash,e||0)}),[s,t]),f=(0,n.useCallback)((()=>{try{V.forgetCode(s.json.codeHash)}catch(e){console.error(e)}finally{p()}}),[s,p]);return(0,a.jsxs)(J,{className:e,children:[(0,a.jsx)("td",{className:"address top",children:(0,a.jsxs)(o.Zb,{children:[(0,a.jsx)(U,{code:s,withTags:!1}),h&&(0,a.jsx)(o.u5,{mode:"code",onClose:p,onForget:f,children:(0,a.jsxs)(U,{code:s||"",isInline:!0,children:[(0,a.jsx)("p",{children:i("You are about to remove this code from your list of available code hashes. Once completed, should you need to access it again, you will have to manually add the code hash again.")}),(0,a.jsx)("p",{children:i("This operation does not remove the uploaded code WASM and ABI from the chain, nor any deployed contracts. The forget operation only limits your access to the code on this browser.")})]})},"modal-forget-account")]})}),(0,a.jsx)("td",{className:"all top",children:x&&(0,a.jsx)(N,{contractAbi:x,onSelectConstructor:b,withConstructors:!0})}),(0,a.jsxs)("td",{className:"together codeHash",children:[(0,a.jsx)("div",{children:`${s.json.codeHash.slice(0,8)}…${s.json.codeHash.slice(-6)}`}),(0,a.jsx)(o.qi,{value:s.json.codeHash})]}),(0,a.jsx)("td",{className:"start together",children:u&&(u.isSome?i("Available"):i("Not on-chain"))}),(0,a.jsxs)("td",{className:"button",children:[(0,a.jsx)(o.zx,{icon:"trash",onClick:p}),!x&&(0,a.jsx)(o.zx,{icon:"upload",label:i("deploy"),onClick:g})]})]})})),Y=n.memo((function({onShowDeploy:e}){const{t:s}=c(),t=(0,n.useRef)([[s("code hashes"),"start"],[],[],[s("status"),"start"],[]]);return(0,a.jsx)(o.iA,{empty:s("No code hashes available"),header:t.current,children:V.getAllCode().map((s=>(0,a.jsx)(G,{code:s,onShowDeploy:e},s.json.codeHash)))})}));var Q=t(75768),K=t(58800),X=t(98551),ee=t(93803),se=t(6589),te=t(67609),ae=t(69187),ne=t(95292),oe=t(6226),re=t(11147),ie=t(86353);const le=n.memo((function({isDisabled:e,onChange:s,onEnter:t,params:o,registry:r}){const[i,l]=(0,n.useState)([]);(0,n.useEffect)((()=>{o&&l(o)}),[o]);const c=(0,n.useCallback)((e=>s(e.map((({value:e})=>e)))),[s]);return i.length?(0,a.jsx)(ie.ZP,{isDisabled:e,onChange:c,onEnter:t,params:i,registry:r}):null})),ce=n.memo((function({className:e,estimatedWeight:s,estimatedWeightV2:t,isCall:r,weight:{executionTime:i,isValid:l,isWeightV2:u,megaGas:d,megaRefTime:m,percentage:h,proofSize:p,setIsEmpty:x,setMegaGas:g,setMegaRefTime:b,setProofSize:f}}){const{t:j}=c(),[v,y]=(0,n.useState)(!0),C=(0,n.useMemo)((()=>s?s.div(ne.uy).iadd(ne.If):null),[s]),w=(0,n.useMemo)((()=>t?t.refTime.toBn().div(ne.uy).iadd(ne.If):null),[t]),N=(0,n.useMemo)((()=>t?t.proofSize.toBn():null),[t]);(0,n.useEffect)((()=>{v&&C&&g(C)}),[C,g,v]),(0,n.useEffect)((()=>{v&&w&&b(w)}),[w,b,v]),(0,n.useEffect)((()=>{v&&N&&f(N)}),[N,f,v]),(0,n.useEffect)((()=>{x(v&&!!r)}),[r,x,v]);const k=!!C&&v;return(0,a.jsx)("div",{className:e,children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Rn,{defaultValue:w&&k?w.toString():void 0,isDisabled:k,isError:!l,isZeroable:r,label:!w||r&&v?j("max RefTime allowed (M)"):j("max RefTime allowed (M, {{estimatedRefTime}} estimated)",{replace:{estimatedMgRefTime:w.toString()}}),onChange:k?void 0:b,value:k?void 0:r&&v?ne.nw:m,children:(t||r)&&(0,a.jsx)(o.ZD,{label:j(r?"max read gas":"use estimated gas"),onChange:y,value:v})}),(0,a.jsx)(o.Rn,{defaultValue:N&&k?N.toString():void 0,isDisabled:k,isError:!l,isZeroable:r,label:!N||r&&v?j("max ProofSize allowed"):j("max ProofSize allowed ({{estimatedProofSize}} estimated)",{replace:{estimatedProofSize:N.toString()}}),onChange:k?void 0:f,value:k?void 0:r&&v?ne.nw:p}),(0,a.jsxs)("div",{className:"contracts--Input-meter",children:[j("{{executionTime}}s execution time",{replace:{executionTime:i.toFixed(3)}}),", ",j("{{percentage}}% of block weight",{replace:{percentage:h.toFixed(2)}})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Rn,{defaultValue:C&&k?C.toString():void 0,isDisabled:k,isError:!l,isZeroable:r,label:!C||r&&v?j("max gas allowed (M)"):j("max gas allowed (M, {{estimatedMg}} estimated)",{replace:{estimatedMg:C.toString()}}),onChange:k?void 0:g,value:k?void 0:r&&v?ne.nw:d,children:(s||r)&&(0,a.jsx)(o.ZD,{label:j(r?"max read gas":"use estimated gas"),onChange:y,value:v})}),(0,a.jsxs)("div",{className:"contracts--Input-meter",children:[j("{{executionTime}}s execution time",{replace:{executionTime:i.toFixed(3)}}),", ",j("{{percentage}}% of block weight",{replace:{percentage:h.toFixed(2)}})]})]})})}));var ue=t(56360),de=t(56949);const me=(0,_.e)("useWeight",(function(){const{api:e}=(0,d.h)(),s=(0,ue.n)(),t=!!e.registry.createType("Weight").proofSize,[a,o]=(0,n.useState)((0,de.ZQ)(e.consts.system.blockWeights?e.consts.system.blockWeights.maxBlock:e.consts.system.maximumBlockWeight).v1Weight.div(ne.uy).div(ne.aP)),[r,i]=(0,n.useState)(e.consts.system.blockWeights?e.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrapOrDefault().refTime.toBn().div(ne.uy).div(ne.aP):ne.nw),[l,c]=(0,n.useState)(e.consts.system.blockWeights?e.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrapOrDefault().proofSize.toBn():ne.nw),[u,m]=(0,n.useState)(!1),h=(0,n.useCallback)((s=>o(s||(0,de.ZQ)(e.consts.system.blockWeights?e.consts.system.blockWeights.maxBlock:e.consts.system.maximumBlockWeight).v1Weight.div(ne.uy).div(ne.aP))),[e]),p=(0,n.useCallback)((s=>i(s||e.consts.system.blockWeights?e.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrapOrDefault().refTime.toBn().div(ne.uy).div(ne.aP):ne.nw)),[e]),x=(0,n.useCallback)((s=>c(s||e.consts.system.blockWeights?e.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrapOrDefault().proofSize.toBn():ne.nw)),[e]);return(0,n.useMemo)((()=>{let n=0,o=0,i=ne.nw,c=e.registry.createType("WeightV2",{proofSize:ne.nw,refTime:ne.nw}),d=!1;return a&&(i=a.mul(ne.uy),n=i.mul(s).div((0,de.ZQ)(e.consts.system.blockWeights?e.consts.system.blockWeights.maxBlock:e.consts.system.maximumBlockWeight).v1Weight).toNumber(),o=n/s.toNumber()*100,n/=3e3,d=!a.isZero()&&o<65),t&&r&&l&&(c=e.registry.createType("WeightV2",{proofSize:l,refTime:r.mul(ne.uy)}),n=r.mul(ne.uy).mul(s).div(e.consts.system.blockWeights?e.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrapOrDefault().refTime.toBn():ne.If).toNumber(),o=n/s.toNumber()*100,n/=3e3,d=!r.isZero()),{executionTime:n,isEmpty:u,isValid:u||d,isWeightV2:t,megaGas:a||ne.nw,megaRefTime:r||ne.nw,percentage:o,proofSize:l||ne.nw,setIsEmpty:m,setMegaGas:h,setMegaRefTime:p,setProofSize:x,weight:i,weightV2:c}}),[e,s,u,t,a,r,l,m,h,p,x])})),he=n.memo((function({onClose:e}){const{t:s}=c(),{api:t}=(0,d.h)(),[r,l]=(0,K.F)(),[m,h,p]=(0,X.t)(),[[x,g],f]=(0,n.useState)([null,null]),[j,v]=(0,n.useState)(0),[y,C,w]=(0,ee.Y)(ne.nw),[N,k]=(0,n.useState)([]),[[I,A],P]=(0,n.useState)([null,!1]),[E,M,T]=(0,se.n)(),{abiName:D,contractAbi:F,errorText:_,isAbiError:q,isAbiSupplied:O,isAbiValid:R,onChangeAbi:H,onRemoveAbi:$}=z(),L=me(),B=(0,n.useMemo)((()=>R&&A&&I&&F?new Q.wi(t,F,I):null),[t,F,R,A,I]),Z=(0,n.useMemo)((()=>F?F.constructors.map(((e,s)=>({info:e.identifier,key:e.identifier,text:(0,a.jsx)(b,{asConstructor:!0,message:e}),value:s}))):[]),[F]);(0,n.useEffect)((()=>{v(0)}),[Z]),(0,n.useEffect)((()=>{k([])}),[F,j]),(0,n.useEffect)((()=>{P(F&&(0,oe.F)(F.info.source.wasm)?[F.info.source.wasm,!0]:[null,!1])}),[F]),(0,n.useEffect)((()=>{D&&T(D)}),[D,T]),(0,n.useEffect)((()=>{(async function(){let e=null,s=null;try{if(B&&F?.constructors[j]?.method&&y&&r){const s=[r,F?.constructors[j].isPayable?t.registry.createType("Balance",y):t.registry.createType("Balance",ne.nw),L.weightV2,null,{Upload:t.registry.createType("Raw",I)},F?.constructors[j]?.toU8a(N),""],a=await t.call.contractsApi.instantiate(...s);e=B.tx[F.constructors[j].method]({gasLimit:a.gasRequired,storageDepositLimit:a.storageDeposit.isCharge?a.storageDeposit.asCharge:null,value:F?.constructors[j].isPayable?y:void 0},...N)}}catch(e){s=e.message}f((()=>[e,s]))})().catch((e=>console.error(e)))}),[r,I,t,B,F,j,y,N,L]);const W=(0,n.useCallback)(((e,s)=>{P([e,(0,oe.F)(e)]),T(s.replace(".wasm","").replace("_"," "))}),[T]),U=(0,n.useCallback)((e=>{e.blueprint&&V.saveCode(e.blueprint.codeHash,{abi:(0,re.P)(e.blueprint.abi.json),name:E||"<>",tags:[]}),e.contract&&ae.Nn.saveContract(e.contract.address.toString(),{contract:{abi:(0,re.P)(e.contract.abi.json),genesisHash:t.genesisHash.toHex()},name:E||"<>",tags:[]})}),[t,E]),J=!!r&&!(0,i.F)(E)&&M&&A&&O&&R&&!!x&&2===m,G=q||!O;return(0,a.jsxs)(o.u_,{header:s("Upload & deploy code {{info}}",{replace:{info:`${m}/2`}}),onClose:e,children:[(0,a.jsxs)(o.u_.Content,{children:[1===m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.rp,{isInput:!1,label:s("deployment account"),labelExtra:(0,a.jsx)(te.Z,{label:s("transferrable"),params:r}),onChange:l,type:"account",value:r}),(0,a.jsx)(S,{contractAbi:F,errorText:_,isError:G,isSupplied:O,isValid:R,label:s("json for either ABI or .contract bundle"),onChange:H,onRemove:$,withWasm:!0}),!G&&F&&(0,a.jsxs)(a.Fragment,{children:[!F.info.source.wasm.length&&(0,a.jsx)(o.ht,{isError:!A,label:s("compiled contract WASM"),onChange:W,placeholder:I&&!A&&s("The code is not recognized as being in valid WASM format")}),(0,a.jsx)(u,{isError:!M,onChange:T,value:E||void 0})]})]}),2===m&&F&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Lt,{isDisabled:F.constructors.length<=1,label:s("deployment constructor"),onChange:v,options:Z,value:j}),(0,a.jsx)(le,{onChange:k,params:F.constructors[j].args,registry:F.registry}),F.constructors[j].isPayable&&(0,a.jsx)(o.H,{isError:!C,isZeroable:!0,label:s("value"),onChange:w,value:y}),(0,a.jsx)(ce,{weight:L}),g&&(0,a.jsx)(o.oy,{content:g})]})]}),(0,a.jsxs)(o.u_.Actions,{children:[1===m?(0,a.jsx)(o.zx,{icon:"step-forward",isDisabled:!B||!F,label:s("Next"),onClick:h}):(0,a.jsx)(o.zx,{icon:"step-backward",label:s("Prev"),onClick:p}),(0,a.jsx)(o.cA,{accountId:r,extrinsic:x,icon:"upload",isDisabled:!J,label:s("Deploy"),onClick:e,onSuccess:U})]})]})}));var pe=t(74065);const xe={allCodes:[],codeTrigger:Date.now()},ge=(0,_.e)("useCodes",(function(){const e=(0,pe.X)(),[s,t]=(0,n.useState)(xe);return(0,n.useEffect)((()=>{const s=()=>{e.current&&t({allCodes:V.getAllCode(),codeTrigger:Date.now()})};V.on("new-code",s),V.on("removed-code",s),V.loadAll(s)}),[]),s}));var be=t(17965);const fe={allContracts:[],hasContracts:!1,isContract:()=>!1},je=(0,_.e)("useContracts",(function(){const e=(0,pe.X)(),[s,t]=(0,n.useState)(fe);return(0,n.useEffect)((()=>{const s=ae.Nn.contracts.subject.subscribe((s=>{if(e.current){const e=s?Object.keys(s):[],a=0!==e.length,n=s=>e.includes(s);t({allContracts:e,hasContracts:a,isContract:n})}}));return()=>{(0,be.Y)((()=>s.unsubscribe()))}}),[]),s})),ve=n.memo((function({address:e,onChange:s}){const{t}=c(),{api:r}=(0,d.h)(),i=(0,m.W7)(r.query.contracts.contractInfoOf,[e]),[l,u]=(0,n.useState)(!1),[h,p]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{try{ae.Nn.decodeAddress(e||""),u(!0)}catch{u(!1)}}),[e]),(0,n.useEffect)((()=>{p(!!i?.isSome)}),[i]),(0,n.useEffect)((()=>{s(l&&h)}),[l,h,s]),h||!l?null:(0,a.jsx)(o.Kd,{type:"error",children:t(l?"Unable to find deployed contract code at the specified address":"The value is not in a valid address format")})})),ye=n.memo((function({onClose:e}){const{t:s}=c(),{api:t}=(0,d.h)(),[r,i]=(0,n.useState)(null),[l,m]=(0,n.useState)(!1),[h,p,x]=(0,se.n)("New Contract"),{abi:g,contractAbi:b,errorText:f,isAbiError:j,isAbiSupplied:v,isAbiValid:y,onChangeAbi:C,onRemoveAbi:w}=z([null,null],null,!0),N=(0,n.useCallback)((()=>{const s={action:"create"};if(r&&g&&h)try{const a={contract:{abi:g,genesisHash:t.genesisHash.toHex()},name:h,tags:[]};ae.Nn.saveContract(r,a),s.account=r,s.status=r?"success":"error",s.message="contract added",e()}catch(e){console.error(e),s.status="error",s.message=e.message}}),[g,r,t,h,e]),k=l&&p&&y;return(0,a.jsxs)(o.u_,{header:s("Add an existing contract"),onClose:e,children:[(0,a.jsx)(o.u_.Content,{children:(0,a.jsxs)(o.mV,{defaultName:h,isValid:!0,value:r||null,children:[(0,a.jsx)(o.II,{autoFocus:!0,isError:!l,label:s("contract address"),onChange:i,value:r||""}),(0,a.jsx)(ve,{address:r,onChange:m}),(0,a.jsx)(u,{isContract:!0,isError:!p,onChange:x,value:h||void 0}),(0,a.jsx)(S,{contractAbi:b,errorText:f,isError:j||!y,isSupplied:v,isValid:y,onChange:C,onRemove:w})]})}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.zx,{icon:"save",isDisabled:!k,label:s("Save"),onClick:N})})]})}));var Ce=t(27421),we=t(48801),Ne=t.n(we);const ke=o.zo.div` + align-items: center; + display: flex; + + .output { + flex: 1 1; + margin: 0.25rem 0.5rem; + } +`,Se=n.memo((function({className:e="",onClear:s,outcome:{from:t,message:n,output:r,params:i,result:l,when:c}}){return(0,a.jsxs)(ke,{className:e,children:[(0,a.jsx)(o.k,{value:t}),(0,a.jsx)(o.r_,{className:"output",isError:!l.isOk,isFull:!0,label:(0,a.jsx)(b,{message:n,params:i}),labelExtra:(0,a.jsxs)("span",{className:"date-time",children:[c.toLocaleDateString()," ",c.toLocaleTimeString()]}),value:(0,p.Z)("Text",l.isOk?r:l)}),(0,a.jsx)(o.zx,{icon:"times",onClick:s})]})}));var Ie=t(11798);const Ae=new(Ne())(5e12).isub(ne.If),Pe=(0,o.zo)(o.u_)` + .rpc-toggle { + margin-top: 1rem; + display: flex; + justify-content: flex-end; + } + + .clear-all { + float: right; + } + + .outcomes { + margin-top: 1rem; + } +`,Ee=n.memo((function({className:e="",contract:s,messageIndex:t,onCallResult:i,onChangeMessage:l,onClose:u}){const{t:m}=c(),{api:h}=(0,d.h)(),p=s.abi.messages[t],[x,g]=(0,K.F)(),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[C,w,N]=(0,ee.Y)(ne.nw),[k,S]=(0,n.useState)([]),[I,A]=(0,n.useState)(null),[P,E]=(0,n.useState)([]),[M,T]=(0,r.O)(),D=me(),F=(0,Ce.N)(C),V=(0,Ce.N)(P);(0,n.useEffect)((()=>{j(null),y(null),E([])}),[s,t]),(0,n.useEffect)((()=>{(async function(){if(x&&C&&p.isMutating){const e=[x,s.address,p.isPayable?h.registry.createType("Balance",C):h.registry.createType("Balance",ne.nw),D.weightV2,null,p.toU8a(P)],t=await h.call.contractsApi.call(...e);A((()=>{try{return s.tx[p.method]({gasLimit:t.gasRequired,storageDepositLimit:t.storageDeposit.isCharge?t.storageDeposit.asCharge:null,value:p.isPayable?C:0},...P)}catch{return null}}))}})().catch((e=>console.error(e)))}),[h,x,s,p,C,D,P]),(0,n.useEffect)((()=>{x&&p&&V&&F&&s.query[p.method](x,{gasLimit:-1,storageDepositLimit:null,value:p.isPayable?F:0},...V).then((({gasRequired:e,result:s})=>{D.isWeightV2?y(s.isOk?h.registry.createType("WeightV2",e):null):j(s.isOk?e.refTime.toBn():null)})).catch((()=>{j(null),y(null)}))}),[h,x,s,p,V,F,D.isWeightV2]);const _=(0,n.useCallback)((()=>{x&&p&&C&&D&&s.query[p.method](x,{gasLimit:D.isWeightV2?D.weightV2:D.isEmpty?-1:D.weight,storageDepositLimit:null,value:p.isPayable?C:0},...P).then((e=>{S([{...e,from:x,message:p,params:P,when:new Date},...k]),i&&i(t,e)})).catch((e=>{console.error(e),i&&i(t)}))}),[x,s.query,p,t,i,k,P,C,D]),q=(0,n.useCallback)((e=>()=>S([...k.filter(((s,t)=>t!==e))])),[k]),O=!!(x&&D.isValid&&w),R=M||!p.isMutating&&!p.isPayable;return(0,a.jsxs)(Pe,{className:`${e} app--contracts-Modal`,header:m("Call a contract"),onClose:u,children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.rp,{isDisabled:!0,label:m("contract to use"),type:"contract",value:s.address}),(0,a.jsx)(o.rp,{defaultValue:x,label:m("call from account"),labelExtra:(0,a.jsx)(te.Z,{label:m("transferrable"),params:x}),onChange:g,type:"account",value:x}),null!==t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Lt,{defaultValue:t,isError:null===p,label:m("message to send"),onChange:l,options:(z=s,z?.abi.messages.map(((e,s)=>({key:e.identifier,text:(0,a.jsx)(b,{message:e}),value:s})))||[]),value:t}),(0,a.jsx)(le,{onChange:E,params:p?p.args:void 0,registry:s.abi.registry})]}),p.isPayable&&(0,a.jsx)(o.H,{isError:!w,isZeroable:!0,label:m("value"),onChange:N,value:C}),(0,a.jsx)(ce,{estimatedWeight:p.isMutating?f:Ae,estimatedWeightV2:p.isMutating?v:h.registry.createType("WeightV2",{proofSize:new(Ne())(1e6),refTIme:Ae}),isCall:!p.isMutating,weight:D}),p.isMutating&&(0,a.jsx)(o.ZD,{className:"rpc-toggle",label:m("read contract only, no execution"),onChange:T,value:M}),k.length>0&&(0,a.jsx)(o.xH,{className:"outcomes",isOpen:!0,summary:m("Call results"),children:k.map(((e,s)=>(0,a.jsx)(Se,{onClear:q(s),outcome:e},`outcome-${s}`)))})]}),(0,a.jsx)(o.u_.Actions,{children:R?(0,a.jsx)(o.zx,{icon:"sign-in-alt",isDisabled:!O,label:m("Read"),onClick:_}):(0,a.jsx)(o.cA,{accountId:x,extrinsic:I,icon:"sign-in-alt",isDisabled:!O||!I,label:m("Execute"),onStart:u})})]});var z}));var Me=t(1346);function Te(e){return e.unwrapOr(null)}const De=o.zo.tr` + td.top a+a { + margin-left: 0.75rem; + } +`,Fe=n.memo((function({className:e,contract:s,index:t,links:i,onCall:l}){const{t:u}=c(),{api:h}=(0,d.h)(),p=(0,m.W7)(h.query.contracts.contractInfoOf,[s.address],{transform:Te}),[x,g]=(0,r.O)(),b=(0,n.useCallback)(((e,s)=>l(t,e,s)),[t,l]),f=(0,n.useCallback)((()=>{const e={account:s.address,action:"forget"};try{ae.Nn.forgetContract(s.address.toString()),e.status="success",e.message=u("address forgotten")}catch(s){e.status="error",e.message=s.message}g()}),[s.address,u,g]);return(0,a.jsxs)(De,{className:e,children:[(0,a.jsxs)("td",{className:"address top",children:[x&&(0,a.jsx)(o.u5,{address:s.address.toString(),mode:"contract",onClose:g,onForget:f},"modal-forget-contract"),(0,a.jsx)(o.ax,{value:s.address})]}),(0,a.jsx)("td",{className:"all top",children:(0,a.jsx)(N,{contract:s,contractAbi:s.abi,isWatching:!0,onSelect:b,trigger:i?.length,withMessages:!0})}),(0,a.jsx)("td",{className:"top",children:i?.map((({blockHash:e,blockNumber:s},t)=>(0,a.jsxs)("a",{href:`#/explorer/query/${e}`,children:["#",s]},`${t}-${s}`)))}),(0,a.jsx)("td",{className:"number",children:(0,a.jsx)(o.hl,{address:s.address,withBalance:!0,withBalanceToggle:!0})}),(0,a.jsx)("td",{className:"start together",children:!(0,Me.o)(p)&&(p?p.type:u("Not on-chain"))}),(0,a.jsx)("td",{className:"button",children:(0,a.jsx)(o.zx,{icon:"trash",onClick:g})})]})}));const Ve=n.memo((function({contracts:e}){const{t:s}=c(),{api:t}=(0,d.h)(),r=(0,m.W7)(t.derive.chain.subscribeNewBlocks),[{contractIndex:i,messageIndex:l,onCallResult:u},p]=(0,n.useState)({contractIndex:0,messageIndex:0}),[x,g]=(0,n.useState)(!1),[b,f]=(0,n.useState)({}),j=(0,n.useRef)([[s("contracts"),"start"],[void 0,void 0,3],[s("status"),"start"],[]]);(0,n.useEffect)((()=>{if(r){const s=r.block.extrinsics.filter((({method:e})=>t.tx.contracts.call.is(e))).map((({args:s})=>{const t=e.find((e=>s[0].eq(e)));return t?{blockHash:r.block.header.hash.toHex(),blockNumber:(0,h.u)(r.block.header.number),contractId:t}:null})).filter((e=>!!e));s.length&&f((e=>(s.forEach((s=>{e[s.contractId]=[s].concat(e[s.contractId]||[]).slice(0,3)})),{...e})))}}),[t,e,r]);const v=(0,n.useMemo)((()=>function(e,s=[]){return s.map((s=>function(e,s){if(s){const t=(0,Ie.oX)(s);return t?new Q.vM(e,t,s):null}return null}(e,s.toString()))).filter((e=>!!e))}(t,e)),[t,e]),y=(0,n.useCallback)((()=>g((e=>!e))),[]),C=(0,n.useCallback)(((e,s,t)=>{p({contractIndex:e,messageIndex:s,onCallResult:t}),g(!0)}),[]),w=(0,n.useCallback)((e=>p((s=>({...s,messageIndex:e})))),[]),N=v[i]||null;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.iA,{empty:s("No contracts available"),header:j.current,children:v.map(((e,s)=>(0,a.jsx)(Fe,{contract:e,index:s,links:b[e.address.toString()],onCall:C},e.address.toString())))}),x&&N&&(0,a.jsx)(Ee,{contract:N,messageIndex:l,onCallResult:u,onChangeMessage:w,onClose:y})]})}));var _e=t(52926);const qe=n.memo((function({codeHash:e,constructorIndex:s=0,onClose:t,setConstructorIndex:r}){const{t:i}=c(),{api:l}=(0,d.h)(),[m,h]=(0,n.useState)(null),[p,x,g]=(0,ee.Y)(null),[f,j,v]=(0,ee.Y)(ne.nw),[y,C]=(0,n.useState)([]),[w,N]=(0,n.useState)((()=>(0,_e.f)())),[k,I]=(0,n.useState)(!1),A=me();(0,n.useEffect)((()=>{C([])}),[s]);const P=(0,n.useMemo)((()=>V.getCode(e)),[e]),[E,M,T]=(0,se.n)(P?.json.name),{contractAbi:D,errorText:F,isAbiError:_,isAbiSupplied:q,isAbiValid:O,onChangeAbi:R,onRemoveAbi:$}=z([P?.json.abi,P?.contractAbi],e,!0),L=(0,n.useMemo)((()=>O&&e&&D?new Q.b8(l,D,e):null),[l,e,D,O]),B=(0,n.useMemo)((()=>D?D.constructors.map(((e,s)=>({info:e.identifier,key:e.identifier,text:(0,a.jsx)(b,{asConstructor:!0,message:e}),value:s}))):[]),[D]);(0,n.useEffect)((()=>{f&&h((()=>{if(L&&D?.constructors[s]?.method)try{return L.tx[D.constructors[s].method]({gasLimit:A.isWeightV2?A.weightV2:A.weight,salt:k?w:null,storageDepositLimit:null,value:D?.constructors[s].isPayable?f:void 0},...y)}catch{return null}return null}))}),[L,D,s,f,y,w,A,k]);const Z=(0,n.useCallback)((e=>{e.contract&&(ae.Nn.saveContract(e.contract.address.toString(),{contract:{abi:(0,re.P)(e.contract.abi.json),genesisHash:l.genesisHash.toHex()},name:E||void 0,tags:[]}),t&&t())}),[l,E,t]),W=!k||w&&(!w.startsWith("0x")||(0,H.vq)(w)),U=M&&j&&A.isValid&&x&&W;return(0,a.jsxs)(o.u_,{header:i("Deploy a contract"),onClose:t,children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.rp,{isInput:!1,label:i("deployment account"),labelExtra:(0,a.jsx)(te.Z,{label:i("transferrable"),params:p}),onChange:g,type:"account",value:p}),(0,a.jsx)(u,{isContract:!0,isError:!M,onChange:T,value:E||""}),!q&&(0,a.jsx)(S,{contractAbi:D,errorText:F,isError:_,isSupplied:q,isValid:O,onChange:R,onRemove:$}),D&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Lt,{isDisabled:D.constructors.length<=1,label:i("deployment constructor"),onChange:r,options:B,value:s}),(0,a.jsx)(le,{onChange:C,params:D.constructors[s]?.args,registry:D.registry})]}),D?.constructors[s].isPayable&&(0,a.jsx)(o.H,{isError:!j,isZeroable:!0,label:i("value"),onChange:v,value:f}),(0,a.jsx)(o.II,{isDisabled:!k,label:i("unique deployment salt"),labelExtra:(0,a.jsx)(o.ZD,{label:i("use deployment salt"),onChange:I,value:k}),onChange:N,placeholder:i("0x prefixed hex, e.g. 0x1234 or ascii data"),value:k?w:i("")}),(0,a.jsx)(ce,{weight:A})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:p,extrinsic:m,icon:"upload",isDisabled:!U||!m,label:i("Deploy"),onClick:t,onSuccess:Z,withSpinner:!0})})]})})),Oe=n.memo((function({trigger:e}){const{t:s}=c(),{api:t}=(0,d.h)(),r=(0,m.W7)(t.query.contracts.accountCounter),[i,l]=(0,n.useState)(0),[u,p]=(0,n.useState)(0);return(0,n.useEffect)((()=>{r&&t.query.contracts.contractInfoOf.keys().then((e=>l(e.length))).catch(console.error)}),[t,r]),(0,n.useEffect)((()=>{(t.query.contracts.pristineCode||t.query.contracts.codeStorage).keys().then((e=>p(e.length))).catch(console.error)}),[t,e]),(0,a.jsxs)(o.Ty,{children:[(0,a.jsx)("section",{children:(0,a.jsx)(o.Jy,{label:s("addresses"),children:(0,h.u)(r)})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(o.Jy,{label:s("code hashes"),children:(0,h.u)(u)}),(0,a.jsx)(o.Jy,{label:s("contracts"),children:(0,h.u)(i)})]})]})})),Re=o.zo.div` + .ui--Table td > article { + background: transparent; + border: none; + margin: 0; + padding: 0; + } +`,ze=n.memo((function({className:e=""}){const{t:s}=c(),{allCodes:t,codeTrigger:i}=ge(),{allContracts:l}=je(),[u,d]=(0,r.O)(),[m,h,p]=(0,r.O)(),[x,g]=(0,r.O)(),[b,f]=(0,r.O)(),[j,v]=(0,n.useState)(),[y,C]=(0,n.useState)(0),w=(0,n.useCallback)(((e,s)=>{v(e||t?.[0]?.json.codeHash||void 0),C(s),h()}),[t,h]),N=(0,n.useCallback)((()=>p(!1)),[p]);return(0,a.jsxs)(Re,{className:e,children:[(0,a.jsx)(Oe,{trigger:i}),(0,a.jsxs)(o.zx.Group,{children:[(0,a.jsx)(o.zx,{icon:"plus",label:s("Upload & deploy code"),onClick:f}),(0,a.jsx)(o.zx,{icon:"plus",label:s("Add an existing code hash"),onClick:g}),(0,a.jsx)(o.zx,{icon:"plus",label:s("Add an existing contract"),onClick:d})]}),(0,a.jsx)(Ve,{contracts:l,updated:i}),(0,a.jsx)(Y,{onShowDeploy:w,updated:i}),j&&m&&(0,a.jsx)(qe,{codeHash:j,constructorIndex:y,onClose:N,setConstructorIndex:C}),b&&(0,a.jsx)(he,{onClose:f}),x&&(0,a.jsx)(L,{onClose:g}),u&&(0,a.jsx)(ye,{onClose:d})]})})),He=n.memo((function({basePath:e,className:s=""}){const{t}=c(),r=(0,n.useRef)([{isRoot:!0,name:"contracts",text:t("Contracts")}]);return(0,a.jsxs)("main",{className:`${s} contracts--App`,children:[(0,a.jsx)(o.mQ,{basePath:e,items:r.current}),(0,a.jsx)(ze,{})]})}))},18324:(e,s,t)=>{t.d(s,{Z:()=>K});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(9118),c=t(70563),u=t(61349);function d(){return(0,u.$G)("app-council")}var m=t(92914),h=t(34814),p=t(87660),x=t(81190),g=t(65874),b=t(14681),f=t(38894),j=t(56949),v=t(81661);const y=n.memo((function({hasFailed:e,hash:s,idNumber:t,proposal:o}){const{t:l}=d(),{api:c}=(0,i.h)(),[u,m]=(0,f.O)(),[h,p]=(0,n.useState)(null),{encodedCallLength:g,weight:b}=(0,j.h7)(o),y=(0,x.m)("council");return y?(0,a.jsxs)(a.Fragment,{children:[u&&(0,a.jsxs)(r.u_,{header:l("Close proposal"),onClose:m,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:l("The proposal that will be affected. Once closed for the current voting round, it would need to be re-submitted to council for a subsequent voting round."),children:(0,a.jsx)(v.Z,{idNumber:t,proposal:o})}),(0,a.jsx)(r.u_.Columns,{hint:l("The council account that will apply the close for the current round."),children:(0,a.jsx)(r.rp,{label:l("close from account"),onChange:p,type:"account"})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,isDisabled:!e&&!g,onStart:m,params:4===c.tx[y].close.meta.args.length?e?[s,t,0,0]:[s,t,b,g]:[s,t],tx:c.tx[y].closeOperational||c.tx[y].close})})]}),(0,a.jsx)(r.zx,{icon:"times",label:l("Close"),onClick:m})]}):null})),C=n.memo((function({isAye:e,members:s,threshold:t,votes:o}){const{t:i}=d(),l=(0,n.useMemo)((()=>{const a=t.toNumber(),n=e?a:s?.length?s.length-a+1:0;return`${o.length}${n?`/${n}`:""}`}),[e,s,t,o]),c=(0,n.useCallback)((()=>o?.map((e=>(0,a.jsx)(r.ax,{value:e,withBalance:!1},e.toString())))),[o]);return l&&o.length?(0,a.jsx)(r.n0,{renderChildren:c,summary:i(e?"Aye {{count}}":"Nay {{count}}",{replace:{count:l}})}):null})),w=n.memo((function({hash:e,idNumber:s,isDisabled:t,members:o,prime:l,proposal:c}){const{t:u}=d(),{api:m}=(0,i.h)(),{hasAccounts:p}=(0,h.x)(),[g,b]=(0,f.O)(),[j,y]=(0,n.useState)(null),C=(0,x.m)("council");if(!p||!C)return null;const w=l?.toString()===j;return(0,a.jsxs)(a.Fragment,{children:[g&&(0,a.jsxs)(r.u_,{header:u("Vote on proposal"),onClose:b,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:u("The proposal that is being voted on. It will pass when the threshold is reached."),children:(0,a.jsx)(v.Z,{idNumber:s,proposal:c})}),(0,a.jsxs)(r.u_.Columns,{hint:u("The council account for this vote. The selection is filtered by the current members."),children:[(0,a.jsx)(r.UE,{filter:o,onChange:y}),w&&(0,a.jsx)(r.Pd,{content:u("You are voting with this collective's prime account. The vote will be the default outcome in case of any abstentions.")})]})]}),(0,a.jsxs)(r.u_.Actions,{children:[(0,a.jsx)(r.cA,{accountId:j,icon:"ban",isDisabled:t,label:u("Vote Nay"),onStart:b,params:[e,s,!1],tx:m.tx[C].vote}),(0,a.jsx)(r.cA,{accountId:j,icon:"check-to-slot",isDisabled:t,label:u("Vote Aye"),onStart:b,params:[e,s,!0],tx:m.tx[C].vote})]})]}),(0,a.jsx)(r.zx,{icon:"check-to-slot",isDisabled:t,label:u("Vote"),onClick:b})]})})),N=n.memo((function({className:e="",isMember:s,members:t,motion:{hash:o,proposal:i,votes:l},prime:c}){const{allAccounts:u}=(0,h.x)(),{hasFailed:d,isCloseable:f,isVoteable:j,remainingBlocks:v}=(0,p.I)(l,t.length,"council"),N=(0,x.m)("council"),{hasVoted:k,hasVotedAye:S}=(0,n.useMemo)((()=>{if(l){const e=u.some((e=>l.ayes.some((s=>s.eq(e))))),s=u.some((e=>l.nays.some((s=>s.eq(e)))));return{hasVoted:e||s,hasVotedAye:e,hasVotedNay:s}}return{hasVoted:!1,hasVotedAye:!1,hasVotedNay:!1}}),[u,l]);if(!l||!N)return null;const{ayes:I,end:A,index:P,nays:E,threshold:M}=l;return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:P}),(0,a.jsx)(m.Z,{imageHash:o,isCollective:!0,proposal:i}),(0,a.jsx)("td",{className:"number together",children:(0,b.u)(M)}),(0,a.jsx)("td",{className:"number together",children:v&&A&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{value:v}),"#",(0,b.u)(A)]})}),(0,a.jsxs)("td",{className:"expand",children:[(0,a.jsx)(C,{isAye:!0,members:t,threshold:M,votes:I}),(0,a.jsx)(C,{members:t,threshold:M,votes:E})]}),(0,a.jsxs)("td",{className:"button",children:[j&&!f&&(0,a.jsx)(w,{hash:o,idNumber:P,isDisabled:!s,members:t,prime:c,proposal:i}),f&&(0,a.jsx)(y,{hasFailed:d,hash:o,idNumber:P,proposal:i})]}),(0,a.jsx)("td",{className:"badge",children:s&&(0,a.jsx)(r.JO,{color:k?S?"green":"red":"gray",icon:"asterisk"})}),(0,a.jsx)("td",{className:"links",children:(0,a.jsx)(r.NR,{data:P,hash:o.toString(),type:"council"})})]})}));var k=t(30943),S=t(31313),I=t(95292),A=t(33661),P=t(74076);const E=n.memo((function({className:e="",isMember:s,members:t}){const{t:o}=d(),{api:l}=(0,i.h)(),[c,u]=(0,f.O)(),[m,h]=(0,n.useState)(null),[{proposal:p,proposalLength:g},b]=(0,n.useState)({proposalLength:0}),[{hash:j,isHashValid:v},y]=(0,n.useState)({isHashValid:!1}),[{imageLen:C,imageLenDefault:w,isImageLenValid:N},E]=(0,n.useState)({imageLen:I.nw,isImageLenValid:!1}),M=(0,x.m)("council"),T=(0,S.CH)(j),D=Math.min(t.length,Math.ceil((t.length||0)*(0,k.d)(l))),F=(0,n.useMemo)((()=>(0,A.m)(l.tx.preimage?.notePreimage)&&!(0,A.m)(l.tx.democracy?.notePreimage)),[l]),V=(0,n.useCallback)((e=>y({hash:e,isHashValid:(0,P.vq)(e,256)})),[]),_=(0,n.useCallback)((e=>{e&&E((s=>({imageLen:e,imageLenDefault:s.imageLenDefault,isImageLenValid:!e.isZero()})))}),[]);return(0,n.useEffect)((()=>{T?.proposalLength&&E((e=>({imageLen:e.imageLen,imageLenDefault:T.proposalLength,isImageLenValid:e.isImageLenValid})))}),[T]),(0,n.useEffect)((()=>{if(v&&j){const e=F?T&&l.tx.democracy.externalProposeMajority({Lookup:{hash:T.proposalHash,len:T.proposalLength||C}}):l.tx.democracy.externalProposeMajority(j);if(e)return b({proposal:e,proposalLength:e.encodedLength||0})}b({proposal:null,proposalLength:0})}),[l,j,F,v,C,T]),M?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!s,label:o("Propose external"),onClick:u}),c&&(0,a.jsxs)(r.u_,{className:e,header:o("Propose external (majority)"),onClose:u,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("The council account for the proposal. The selection is filtered by the current members."),children:(0,a.jsx)(r.rp,{filter:t,label:o("propose from account"),onChange:h,type:"account",withLabel:!0})}),(0,a.jsxs)(r.u_.Columns,{hint:o("The hash of the proposal image, either already submitted or valid for the specific call."),children:[(0,a.jsx)(r.II,{autoFocus:!0,isError:!v,label:o("preimage hash"),onChange:V,value:j}),F&&(0,a.jsx)(r.Rn,{defaultValue:w,isDisabled:!!T?.proposalLength&&!T?.proposalLength.isZero()&&v&&N,isError:!N,label:o("preimage length"),onChange:_,value:C},"inputLength")]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,icon:"plus",isDisabled:!D||!t.includes(m||"")||!p||F&&!N,label:o("Propose"),onStart:u,params:3===l.tx[M].propose.meta.args.length?[D,p,g]:[D,p],tx:l.tx[M].propose})})]})]}):null}));var M=t(60404),T=t(48801),D=t.n(T);const F=n.memo((function({isMember:e,members:s}){const{t}=d(),{api:o,apiDefaultTxSudo:l}=(0,i.h)(),[c,u]=(0,f.O)(),[m,h]=(0,n.useState)(null),[{proposal:p,proposalLength:g},b]=(0,n.useState)({proposalLength:0}),[{isThresholdValid:j,threshold:v},y]=(0,n.useState)({isThresholdValid:!1}),C=(0,x.m)("council");(0,n.useEffect)((()=>{s&&y({isThresholdValid:0!==s.length,threshold:new(D())(Math.min(s.length,Math.ceil(s.length*(0,k.d)(o))))})}),[o,s]);const w=(0,n.useCallback)((e=>b({proposal:e,proposalLength:e?.encodedLength||0})),[]),N=(0,n.useCallback)((e=>y({isThresholdValid:!!e?.gtn(0),threshold:e})),[]);return C?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!e,label:t("Propose motion"),onClick:u}),c&&(0,a.jsxs)(r.u_,{header:t("Propose a council motion"),onClose:u,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:t("The council account for the proposal. The selection is filtered by the current members."),children:(0,a.jsx)(r.rp,{filter:s,label:t("propose from account"),onChange:h,type:"account",withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:t("The desired threshold. Here set to a default of 50%+1, as applicable for general proposals."),children:(0,a.jsx)(r.Rn,{className:"medium",isError:!v||v.eqn(0)||v.gtn(s.length),label:t("threshold"),onChange:N,placeholder:t("Positive number between 1 and {{memberCount}}",{replace:{memberCount:s.length}}),value:v||I.nw})}),(0,a.jsx)(r.u_.Columns,{hint:t("The actual proposal to make, based on the selected call and parameters thereof."),children:(0,a.jsx)(M.Z,{defaultValue:l,label:t("proposal"),onChange:w})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,isDisabled:!p||!j,label:t("Propose"),onStart:u,params:3===o.tx[C].propose.meta.args.length?[v,p,g]:[v,p],tx:o.tx[C].propose})})]})]}):null}));var V=t(43223);const _=n.memo((function({className:e="",isMember:s,members:t}){const{t:o}=d(),{api:l}=(0,i.h)(),c=(0,V.g)(),[u,m]=(0,f.O)(),[h,p]=(0,n.useState)(null),[{proposal:g,proposalLength:b},j]=(0,n.useState)({proposal:null,proposalLength:0}),[v,y]=(0,n.useState)(0),C=(0,x.m)("council"),w=Math.ceil((t.length||0)*(0,k.FK)(l)),N=(0,n.useMemo)((()=>(c||[]).map((([e,s])=>({text:o("era {{era}}, {{count}} slashes",{replace:{count:s.length,era:e.toNumber()}}),value:e.toNumber()})))),[c,o]);return(0,n.useEffect)((()=>{const e=v&&c?.find((([e])=>e.eqn(v))),s=e?l.tx.staking.cancelDeferredSlash(e[0],e[1].map(((e,s)=>s))):null;j({proposal:s,proposalLength:s?.encodedLength||0})}),[l,v,c]),C&&l.tx.staking?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"sync",isDisabled:!s||!c.length,label:o("Cancel slashes"),onClick:m}),u&&(0,a.jsxs)(r.u_,{className:e,header:o("Revert pending slashes"),onClose:m,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("The council account for the proposal. The selection is filtered by the current members."),children:(0,a.jsx)(r.rp,{filter:t,label:o("propose from account"),onChange:p,type:"account",withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:o("The specific eras on which there are unapplied slashes. For each era a separate proposal is to be made."),children:N.length?(0,a.jsx)(r.Lt,{defaultValue:N[0].value,label:o("the era to cancel for"),onChange:y,options:N}):(0,a.jsx)(r.II,{isDisabled:!0,label:o("the era to cancel for"),value:o("no unapplied slashes found")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,icon:"sync",isDisabled:!w||!t.includes(h||"")||!g,label:o("Revert"),onStart:m,params:3===l.tx[C].propose.meta.args.length?[w,g,b]:[w,g],tx:l.tx[C].propose})})]})]}):null})),q=n.memo((function({className:e="",motions:s,prime:t}){const{t:o}=d(),{isMember:i,members:l}=(0,c.V)("council"),u=(0,n.useRef)([[o("motions"),"start",2],[o("threshold")],[o("voting end")],[o("votes"),"expand"],[],[void 0,"badge"],[]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(F,{isMember:i,members:l}),(0,a.jsx)(E,{isMember:i,members:l}),(0,a.jsx)(_,{isMember:i,members:l})]}),(0,a.jsx)(r.iA,{empty:s&&o("No council motions"),header:u.current,children:s?.map((e=>(0,a.jsx)(N,{isMember:i,members:l,motion:e,prime:t},e.hash.toHex())))})]})}));var O=t(54383);const R=(0,t(11677).e)("useModuleElections",(function(){const{api:e}=(0,i.h)();return(0,n.useMemo)((()=>e.tx.phragmenElection?"phragmenElection":e.tx.electionsPhragmen?"electionsPhragmen":e.tx.elections?"elections":null),[e])}));var z=t(58607);const H=n.memo((function({balance:e,voters:s}){const t=(0,n.useCallback)((()=>s?.map((e=>(0,a.jsx)(r.ax,{value:e,withLockedVote:!0},e.toString())))),[s]);return(0,a.jsx)("tr",{className:"isExpanded isLast packedTop",children:(0,a.jsx)("td",{className:"expand all",colSpan:2,children:(0,a.jsx)(r.n0,{renderChildren:t,summary:(0,a.jsx)(z.Z,{className:e&&s?"":"--tmp",value:e})})})})})),$=n.memo((function({address:e,balance:s,className:t="",hasElections:n,isPrime:o,voters:i}){const{t:l}=d();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${t} isExpanded isFirst ${n?"":"isLast"}`,children:[(0,a.jsxs)("td",{className:"address all relative",children:[(0,a.jsx)(r.N,{value:e}),o&&(0,a.jsx)(r.Vp,{className:"absolute",color:"green",label:l("prime")})]}),(0,a.jsx)("td",{className:"number",children:i&&(0,b.u)(i.length)})]}),n&&(0,a.jsx)(H,{balance:s,voters:i})]})})),L=n.memo((function({allVotes:e={},electionsInfo:s,hasElections:t}){const{t:o}=d(),i=(0,n.useRef)([[o("candidates"),"start",2]]),l=(0,n.useRef)([[o("runners up"),"start",2]]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.iA,{empty:s&&o("No runners up found"),header:l.current,isSplit:!0,children:s?.runnersUp.map((([s,n])=>(0,a.jsx)($,{address:s,balance:n,hasElections:t,voters:e[s.toString()]},s.toString())))}),(0,a.jsx)(r.iA,{empty:s&&o("No candidates found"),header:i.current,isSplit:!0,children:s?.candidates.map((s=>(0,a.jsx)($,{address:s,hasElections:!1,voters:e[s.toString()]},s.toString())))})]})})),B=n.memo((function({allVotes:e={},className:s="",electionsInfo:t,hasElections:o,prime:i}){const{t:l}=d(),c=(0,n.useRef)([[l("members"),"start",2]]);return(0,a.jsx)(r.iA,{className:s,empty:t&&l("No members found"),header:c.current,isSplit:!0,children:t?.members.map((([s,t])=>(0,a.jsx)($,{address:s,balance:t,hasElections:o,isPrime:i?.eq(s),voters:e[s.toString()]},s.toString())))})}));var Z=t(65121);const W=n.memo((function({electionsInfo:e}){const{api:s}=(0,i.h)(),{t}=d(),[o,l]=(0,n.useState)(null),{isOpen:c,onClose:u,onOpen:m}=(0,Z.d)(),h=R();return h?(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsxs)(r.u_,{header:t("Submit your council candidacy"),onClose:u,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:t("This account will appear in the list of candidates. With enough votes in an election, it will become either a runner-up or a council member."),children:(0,a.jsx)(r.rp,{label:t("candidate account"),onChange:l,type:"account"})}),s.consts[h]&&(0,a.jsx)(r.u_.Columns,{hint:t("The bond will be reserved for the duration of your candidacy and membership."),children:(0,a.jsx)(r.H,{defaultValue:s.consts[h]?.candidacyBond,isDisabled:!0,label:t("candidacy bond")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:o,isDisabled:!e,onStart:u,params:1===s.tx[h].submitCandidacy.meta.args.length?[e?.candidates.length]:[],tx:s.tx[h].submitCandidacy})})]}),(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!e,label:t("Submit candidacy"),onClick:m})]}):null})),U=n.memo((function({bestNumber:e,className:s="",electionsInfo:t,hasElections:n}){const{t:o}=d();return(0,a.jsxs)(r.Ty,{className:s,children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:o("seats"),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,b.u)(t.members.length),t.desiredSeats&&(0,a.jsxs)(a.Fragment,{children:[" / ",(0,b.u)(t.desiredSeats)]})]}):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),n&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{label:o("runners up"),children:t?(0,a.jsxs)(a.Fragment,{children:[(0,b.u)(t.runnersUp.length),t.desiredRunnersUp&&(0,a.jsxs)(a.Fragment,{children:[" / ",(0,b.u)(t.desiredRunnersUp)]})]}):(0,a.jsx)("span",{className:"--tmp",children:"99 / 99"})}),(0,a.jsx)(r.Jy,{label:o("candidates"),children:t?(0,b.u)(t.candidateCount):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]})]}),t?.voteCount&&(0,a.jsx)("section",{children:(0,a.jsxs)(r.Jy,{label:o("voting round"),children:["#",(0,b.u)(t.voteCount)]})}),t&&e&&t.termDuration&&t.termDuration.gt(I.nw)&&(0,a.jsx)("section",{children:(0,a.jsx)(r.Jy,{label:o("term progress"),progress:{total:t&&e?t.termDuration:I.Jo,value:t&&e?e.mod(t.termDuration):I.um,withTime:!0}})})]})})),J=n.memo((function({electionsInfo:e}){const{t:s}=d(),{api:t}=(0,i.h)(),[o,l]=(0,f.O)(),[c,u]=(0,n.useState)(null),[m,h]=(0,n.useState)([]),[p,x]=(0,n.useState)([]),[g,b]=(0,n.useState)([]),[j,v]=(0,n.useState)(I.nw),y=R();(0,n.useEffect)((()=>{if(e){const{candidates:s,members:t,runnersUp:a}=e;h(t.map((([e])=>e.toString())).concat(a.map((([e])=>e.toString()))).concat(s.map((e=>e.toString()))))}}),[e]),(0,n.useEffect)((()=>{c&&t.derive.council.votesOf(c).then((({votes:e})=>{x(e.map((e=>e.toString())).filter((e=>m.includes(e))))})).catch(console.error)}),[t,c,m]);const C=(0,n.useMemo)((()=>{const e=t.consts.elections||t.consts.phragmenElection||t.consts.electionsPhragmen;return e&&e.votingBondBase&&e.votingBondBase.add(e.votingBondFactor.muln(g.length))}),[t,g]);return y?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"check-to-slot",isDisabled:0===m.length,label:s("Vote"),onClick:l}),o&&(0,a.jsxs)(r.u_,{header:s("Vote for current candidates"),onClose:l,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:s("The vote will be recorded for the selected account."),children:(0,a.jsx)(r.rp,{label:s("voting account"),onChange:u,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:s("The value associated with this vote. The amount will be locked (not available for transfer) and used in all subsequent elections."),children:(0,a.jsx)(r.xb,{accountId:c,onChange:v})}),(0,a.jsx)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:s("The votes for the members, runner-ups and candidates. These should be ordered based on your priority.")}),(0,a.jsx)("p",{children:s("In calculating the election outcome, this prioritized vote ordering will be used to determine the final score for the candidates.")})]}),children:(0,a.jsx)(r.m3,{available:m,availableLabel:s("council candidates"),defaultValue:p,maxCount:16,onChange:b,valueLabel:s("my ordered votes")})}),C&&(0,a.jsx)(r.u_.Columns,{hint:s("The amount will be reserved for the duration of your vote"),children:(0,a.jsx)(r.H,{defaultValue:C,isDisabled:!0,label:s("voting bond")})})]}),(0,a.jsxs)(r.u_.Actions,{children:[(0,a.jsx)(r.cA,{accountId:c,icon:"trash-alt",isDisabled:!p.length,label:s("Unvote all"),onStart:l,tx:t.tx[y].removeVoter}),(0,a.jsx)(r.cA,{accountId:c,isDisabled:!c||0===g.length||j.lten(0),label:s("Vote"),onStart:l,params:[g,j],tx:t.tx[y].vote})]})]})]}):null})),G={transform:e=>e.reduce(((e,[s,{votes:t}])=>(t.forEach((t=>{const a=t.toString();e[a]||(e[a]=[]),e[a].push(s)})),e)),{})},Y=n.memo((function({className:e="",prime:s}){const{api:t}=(0,i.h)(),n=(0,O.C)(),o=(0,l.W7)(t.derive.elections.info),c=(0,l.W7)(t.derive.council.votes,void 0,G),u=R(),d=!!u;return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(U,{bestNumber:n,electionsInfo:o,hasElections:!!u}),d&&(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(J,{electionsInfo:o}),(0,a.jsx)(W,{electionsInfo:o})]}),(0,a.jsx)(B,{allVotes:c,electionsInfo:o,hasElections:d,prime:s}),d&&(0,a.jsx)(L,{allVotes:c,electionsInfo:o,hasElections:d})]})}));var Q=t(40740);const K=n.memo((function({basePath:e,className:s}){const{t}=d(),{api:c}=(0,i.h)(),{pathname:u}=(0,o.TH)(),m=(0,Q.Z)(),h=(0,l.W7)(c.derive.council.prime),p=(0,l.W7)(c.derive.council.proposals),x=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:t("Overview")},{count:m,name:"motions",text:t("Motions")}]),[m,t]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,items:x}),(0,a.jsx)(o.Z5,{children:(0,a.jsx)(o.AW,{path:e,children:(0,a.jsx)(o.AW,{element:(0,a.jsx)(q,{motions:p,prime:h}),path:"motions"})})}),(0,a.jsx)(Y,{className:[e,`${e}/candidates`].includes(u)?"":"--hidden",prime:h})]})}))},40740:(e,s,t)=>{t.d(s,{Z:()=>l});var a=t(34814),n=t(90778),o=t(9118),r=t(11677);const i={transform:e=>e.filter((({votes:e})=>!!e)).length},l=(0,r.e)("useCounter",(function(){const{hasAccounts:e}=(0,a.x)(),{api:s,isApiReady:t}=(0,n.h)();return(0,o.W7)(t&&e&&s.derive.council?.proposals,void 0,i)||0}))},10842:(e,s,t)=>{t.d(s,{Z:()=>b});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(60404),l=t(67609),c=t(48801),u=t.n(c),d=t(95292),m=t(54371),h=t(34323),p=t(6987);const x=(0,h.$)(""),g=(0,o.zo)(o.u_)` + .toggleImminent { + margin: 0.5rem 0; + text-align: right; + } +`,b=n.memo((function({className:e="",imageHash:s,isImminent:t=!1,onClose:c}){const{t:b}=(0,p.$)(),{api:f,apiDefaultTxSudo:j}=(0,r.h)(),[v,y]=(0,n.useState)(null),[{encodedHash:C,encodedProposal:w,storageFee:N},k]=(0,n.useState)({encodedHash:x,encodedProposal:"",storageFee:null}),[S,I]=(0,n.useState)();(0,n.useEffect)((()=>{const e=S?.method.toHex()||"",s=f.consts.democracy.preimageByteDeposit?f.consts.democracy.preimageByteDeposit.mul(e?new(u())((e.length-2)/2):d.nw):null;k({encodedHash:(0,h.$)(e),encodedProposal:e,storageFee:s})}),[f,S]);const A=(0,n.useMemo)((()=>!s||((0,m.H)(s)?s===C:s.eq(C))),[C,s]);return(0,a.jsxs)(g,{className:e,header:b("Submit preimage"),onClose:c,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:b("This account will pay the fees for the preimage, based on the size thereof."),children:(0,a.jsx)(o.rp,{label:b("send from account"),labelExtra:(0,a.jsx)(l.Z,{label:(0,a.jsx)("span",{className:"label",children:b("transferrable")}),params:v}),onChange:y,type:"account"})}),(0,a.jsxs)(o.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:b("The image (proposal) will be stored on-chain against the hash of the contents.")}),(0,a.jsx)("p",{children:b("When submitting a proposal the hash needs to be known. Proposals can be submitted with hash-only, but upon dispatch the preimage needs to be available.")})]}),children:[(0,a.jsx)(i.Z,{defaultValue:j,label:b("propose"),onChange:I}),(0,a.jsx)(o.qG,{label:b("preimage hash"),value:C,withCopy:!0})]}),!t&&N&&(0,a.jsx)(o.u_.Columns,{hint:b("The calculated storage costs based on the size and the per-bytes fee."),children:(0,a.jsx)(o.H,{defaultValue:N,isDisabled:!0,label:b("calculated storage fee")})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:v,icon:"plus",isDisabled:!(S&&v&&A&&w),label:b("Submit preimage"),onStart:c,params:[w],tx:t?f.tx.democracy.noteImminentPreimage:f.tx.democracy.notePreimage})})]})}))},71679:(e,s,t)=>{t.d(s,{Z:()=>u});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(38894),l=t(6987),c=t(10842);const u=n.memo((function({imageHash:e,isImminent:s}){const{t}=(0,l.$)(),{api:n}=(0,r.h)(),[u,d]=(0,i.O)();return n.tx.democracy.notePreimage?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"plus",label:t("Image"),onClick:d}),u&&(0,a.jsx)(c.Z,{imageHash:e,isImminent:s,onClose:d})]}):null}))},92914:(e,s,t)=>{t.d(s,{Z:()=>y});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(31313),l=t(15991),c=t(6987),u=t(9118),d=t(37245);const m=n.memo((function({className:e="",value:s}){const{t}=(0,c.$)(),{api:n}=(0,r.h)(),o=(0,u.W7)(n.derive.democracy.preimage,[s]);return o?.proposal?(0,a.jsx)(d.Z,{className:e,withBorder:!0,withPadding:!0,children:(0,a.jsx)(l.Z,{labelHash:t("proposal hash"),value:o.proposal,withHash:!0})}):null}));var h=t(86353),p=t(6046);const x={params:[],values:[]},g={transform:e=>e.unwrapOr(null)},b=n.memo((function({className:e="",value:s}){const{t}=(0,c.$)(),{api:i}=(0,r.h)(),[l]=(0,n.useState)((()=>s.unwrap())),d=(0,u.W7)(i.query.treasury.proposals,[l],g),[{params:m,values:b},f]=(0,n.useState)(x);return(0,n.useEffect)((()=>{d&&f({params:[{name:"proposal",type:(0,p.s)("TreasuryProposal")}],values:[{isValid:!0,value:d}]})}),[d]),d?(0,a.jsx)("div",{className:e,children:(0,a.jsxs)(h.ZP,{isDisabled:!0,params:m,values:b,children:[(0,a.jsx)(o.rp,{defaultValue:d.beneficiary,isDisabled:!0,label:t("beneficiary")}),(0,a.jsx)(o.H,{defaultValue:d.value,isDisabled:!0,label:t("payout")})]})}):null})),f=["externalPropose","externalProposeDefault","externalProposeMajority","fastTrack"],j=["approveProposal","rejectProposal"],v=o.zo.td` + .shortHash { + + div { + margin-left: 0.5rem; + } + } +`,y=n.memo((function({className:e="",imageHash:s,isCollective:t,proposal:n}){const{t:o}=(0,c.$)(),{api:u}=(0,r.h)(),d=(0,i.CH)(s),h=t||u.query.democracy?.preimages?n:d?.proposal;if(!h){const t=s.toString();return(0,a.jsx)("td",{className:`${e} all hash`,children:(0,a.jsx)("div",{className:"shortHash",children:t})})}const{method:p,section:x}=h.registry.findMetaCall(h.callIndex),g="treasury"===x&&j.includes(p),y="democracy"===x&&f.includes(p);return(0,a.jsx)(v,{className:`${e} all`,children:(0,a.jsxs)(l.Z,{labelHash:o("proposal hash"),value:h,withHash:!g&&!y,children:[y&&(0,a.jsx)(m,{value:h.args[0]}),g&&(0,a.jsx)(b,{value:h.args[0]})]})})}))},50472:(e,s,t)=>{t.d(s,{Z:()=>le});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(38894),c=t(9118),u=t(6987),d=t(70563),m=t(30943),h=t(81190),p=t(48801),x=t.n(p),g=t(54371);const b=new(x())(600),f=new(x())(1800),j=n.memo((function({imageHash:e,members:s,threshold:t}){const{t:o}=(0,u.$)(),{api:d}=(0,i.h)(),[p,j]=(0,l.O)(),[v,y]=(0,n.useState)(null),[C,w]=(0,n.useState)(b),[N,k]=(0,n.useState)(d.consts.democracy.fastTrackVotingPeriod||f),[{proposal:S,proposalLength:I},A]=(0,n.useState)((()=>({proposalLength:0}))),[P,E]=(0,l.O)(!0),M=(0,h.m)("technicalCommittee"),T=(0,c.W7)(M&&d.query[M].proposalCount),D=(0,n.useMemo)((()=>new(x())(Math.ceil(s.length*(0,m.A_)(d,!N||d.consts.democracy.fastTrackVotingPeriod.lte(N))))),[d,s,N]),F=(0,n.useMemo)((()=>{if(!(M&&S&&T&&d.tx.utility))return null;const e=3===d.tx[M].propose.meta.args.length?d.tx[M].propose(D,S,I):d.tx[M].propose(D,S);return P&&s.length>1?d.tx.utility.batch([e,d.tx[M].vote(S.method.hash,T,!0)]):e}),[d,s,D,M,S,T,I,P]);return(0,n.useEffect)((()=>{const s=C&&!C.isZero()&&N&&!N.isZero()?d.tx.democracy.fastTrack(e,N,C):null;A({proposal:s,proposalLength:s?.length||0})}),[d,C,e,s,N]),M&&d.tx.utility?(0,a.jsxs)(a.Fragment,{children:[p&&(0,a.jsxs)(r.u_,{header:o("Fast track proposal"),onClose:j,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("Select the committee account you wish to make the proposal with."),children:(0,a.jsx)(r.rp,{filter:s,label:o("propose from account"),onChange:y,type:"account",withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:o("The external proposal to send to the technical committee"),children:(0,a.jsx)(r.II,{isDisabled:!0,label:o("preimage hash"),value:(0,g.H)(e)?e:e.toHex()})}),(0,a.jsxs)(r.u_.Columns,{hint:o("The voting period and delay to apply to this proposal. The threshold is calculated from these values."),children:[(0,a.jsx)(r.Rn,{autoFocus:!0,isZeroable:!1,label:o("voting period"),onChange:k,value:N}),(0,a.jsx)(r.Rn,{isZeroable:!1,label:o("delay"),onChange:w,value:C}),(0,a.jsx)(r.Rn,{defaultValue:D,isDisabled:!0,label:o("threshold")})]}),s.length>1&&(0,a.jsx)(r.u_.Columns,{hint:o("Submit an Aye vote alongside the proposal as part of a batch"),children:(0,a.jsx)(r.ZD,{label:o("Submit Aye vote with proposal"),onChange:E,value:P})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:v,extrinsic:F,icon:"forward",isDisabled:!v,label:o("Fast track"),onStart:j})})]}),(0,a.jsx)(r.zx,{icon:"forward",isDisabled:t.isSuperMajorityApprove,label:o("Fast track"),onClick:j})]}):null}));var v=t(71679),y=t(92914);const C=n.memo((function({className:e="",value:{image:s,imageHash:t,threshold:n}}){const{isMember:o,members:i}=(0,d.V)("technicalCommittee"),[c,u]=(0,l.O)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${e} isExpanded isFirst ${c?"":"isLast"}`,children:[(0,a.jsx)(y.Z,{imageHash:t,proposal:s?.proposal}),(0,a.jsx)("td",{className:"address",children:s&&(0,a.jsx)(r.ax,{value:s.proposer})}),(0,a.jsx)(r.iA.Column.Balance,{value:s?.balance}),(0,a.jsx)("td",{className:"actions",children:(0,a.jsxs)(r.zx.Group,{children:[!s?.proposal&&(0,a.jsx)(v.Z,{imageHash:t}),n&&o&&(0,a.jsx)(j,{imageHash:t,members:i,threshold:n}),(0,a.jsx)(r.Vh,{expanded:c,onClick:u})]})})]}),(0,a.jsx)("tr",{className:`${e} ${c?"isExpanded isLast":"isCollapsed"}`,children:(0,a.jsx)("td",{className:"columar",colSpan:100,children:(0,a.jsx)(r.P0,{is100:!0,children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.NR,{data:t,type:"democracyExternal",withTitle:!0})})})})})]})})),w=n.memo((function({className:e}){const{t:s}=(0,u.$)(),{api:t}=(0,i.h)(),o=(0,c.W7)(t.derive.democracy.nextExternal),l=(0,n.useRef)([[s("external"),"start"],[s("proposer"),"address"],[s("locked")],[]]);return(0,a.jsx)(r.iA,{className:e,empty:null===o&&s("No external proposal"),header:l.current,children:o&&(0,a.jsx)(C,{value:o})})}));var N=t(10842),k=t(58607),S=t(34814),I=t(81661);const A=n.memo((function({deposit:e,depositors:s,image:t,proposalId:o}){const{t:c}=(0,u.$)(),{hasAccounts:d}=(0,S.x)(),{api:m}=(0,i.h)(),[h,p]=(0,n.useState)(null),[x,g]=(0,l.O)();return d?(0,a.jsxs)(a.Fragment,{children:[x&&(0,a.jsxs)(r.u_,{header:c("Endorse proposal"),onClose:g,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:c("The proposal is in the queue for future referendums. One proposal from this list will move forward to voting."),children:(0,a.jsx)(I.Z,{idNumber:o,proposal:t?.proposal})}),(0,a.jsx)(r.u_.Columns,{hint:c("Endorsing a proposal that indicates your backing for the proposal. Proposals with greater interest moves up the queue for potential next referendums."),children:(0,a.jsx)(r.rp,{label:c("endorse with account"),onChange:p,type:"account",withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:c("The deposit will be locked for the lifetime of the proposal."),children:(0,a.jsx)(r.H,{defaultValue:e||m.consts.democracy.minimumDeposit,isDisabled:!0,label:c("deposit required")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,icon:"sign-in-alt",isDisabled:!h,label:c("Endorse"),onStart:g,params:2===m.tx.democracy.second.meta.args.length?[o,s.length]:[o],tx:m.tx.democracy.second})})]}),(0,a.jsx)(r.zx,{icon:"toggle-off",label:c("Endorse"),onClick:g})]}):null})),P=n.memo((function({className:e="",value:{balance:s,image:t,imageHash:o,index:i,proposer:c,seconds:d}}){const{t:m}=(0,u.$)(),[h,p]=(0,l.O)(!1),x=(0,n.useMemo)((()=>d.filter(((e,s)=>0!==s))),[d]),g=(0,n.useCallback)((()=>x.map(((e,s)=>(0,a.jsx)(r.ax,{value:e,withBalance:!1,withShrink:!0},`${s}:${e.toHex()}`)))),[x]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${e} isExpanded isFirst ${h?"":"isLast"}`,children:[(0,a.jsx)(r.iA.Column.Id,{value:i}),(0,a.jsx)(y.Z,{imageHash:o,proposal:t?.proposal}),(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(r.ax,{value:c})}),(0,a.jsx)("td",{className:"number together media--1200",children:(0,a.jsx)(k.Z,{value:s})}),(0,a.jsx)("td",{className:"expand",children:0!==x.length&&(0,a.jsx)(r.n0,{empty:x&&m("No endorsements"),renderChildren:g,summary:m("Endorsed ({{count}})",{replace:{count:x.length}})})}),(0,a.jsx)("td",{className:"actions",children:(0,a.jsxs)(r.zx.Group,{children:[!t?.proposal&&(0,a.jsx)(v.Z,{imageHash:o}),(0,a.jsx)(A,{deposit:s,depositors:d||[],image:t,proposalId:i}),(0,a.jsx)(r.Vh,{expanded:h,onClick:p})]})})]}),(0,a.jsxs)("tr",{className:`${e} ${h?"isExpanded isLast":"isCollapsed"}`,children:[(0,a.jsx)("td",{}),(0,a.jsx)("td",{className:"columar",colSpan:100,children:(0,a.jsx)(r.P0,{is100:!0,children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.NR,{data:i,type:"democracyProposal",withTitle:!0})})})})]})]})})),E=n.memo((function({className:e}){const{t:s}=(0,u.$)(),{api:t}=(0,i.h)(),o=(0,c.W7)(t.derive.democracy.proposals),l=(0,n.useRef)([[s("proposals"),"start",2],[s("proposer"),"address"],[s("locked"),"media--1200"],[void 0,void 0,2]]);return(0,a.jsx)(r.iA,{className:e,empty:o&&s("No active proposals"),header:l.current,children:o?.map((e=>(0,a.jsx)(P,{value:e},e.index.toString())))})}));var M=t(31313),T=t(67609),D=t(74076),F=t(33661);const V=n.memo((function({className:e="",onClose:s}){const{t}=(0,u.$)(),{api:o}=(0,i.h)(),[l,d]=(0,n.useState)(null),[m,h]=(0,n.useState)(),[{hash:p,isHashValid:x},g]=(0,n.useState)({isHashValid:!1}),b=(0,c.W7)(o.query.democracy.publicProps),f=(0,M.CH)(p),j=(0,n.useCallback)((e=>g({hash:e,isHashValid:(0,D.vq)(e,256)})),[]),v=m?.gte(o.consts.democracy.minimumDeposit);return(0,a.jsxs)(r.u_,{className:e,header:t("Submit proposal"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:t("The proposal will be registered from this account and the balance lock will be applied here."),children:(0,a.jsx)(r.rp,{label:t("send from account"),labelExtra:(0,a.jsx)(T.Z,{label:(0,a.jsx)("span",{className:"label",children:t("transferrable")}),params:l}),onChange:d,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:t("The hash of the preimage for the proposal as previously submitted or intended."),children:(0,a.jsx)(r.II,{autoFocus:!0,isError:!x,label:t("preimage hash"),onChange:j,value:p})}),(0,a.jsxs)(r.u_.Columns,{hint:t("The associated deposit for this proposal should be more then the minimum on-chain deposit required. It will be locked until the proposal passes."),children:[(0,a.jsx)(r.H,{defaultValue:o.consts.democracy.minimumDeposit,isError:!v,label:t("locked balance"),onChange:h}),(0,a.jsx)(r.H,{defaultValue:o.consts.democracy.minimumDeposit,isDisabled:!0,label:t("minimum deposit")})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:l,icon:"plus",isDisabled:!m||!v||!x||!l||!b||(0,F.m)(o.tx.preimage?.notePreimage)&&!(0,F.m)(o.tx.democracy?.notePreimage)&&!f,label:t("Submit proposal"),onStart:s,params:3===o.tx.democracy.propose.meta.args.length?[p,m,b?.length]:(0,F.m)(o.tx.preimage?.notePreimage)&&!(0,F.m)(o.tx.democracy?.notePreimage)?[f&&{Lookup:{hash:f.proposalHash,len:f.proposalLength}},m]:[p,m],tx:o.tx.democracy.propose})})]})}));var _=t(54383),q=t(65874),O=t(95292),R=t(14681),z=t(47538),H=t(11677),$=t(15938);const L=new(x())(-1),B=new(x())(2);function Z(e,s,t,a,n,o){const r=1===o?O.If:L,i=t.add(a),l=O.If.muln(10*n).mul(i).div(O.aP);return[i,e.add(r.mul(i)),x().max(O.nw,s.add(r.mul(l)))]}function W(e,s,{votedAye:t,votedNay:a,votedTotal:n},o,r,i){for(;;){const[l,c,u]=Z(t,n,r,i,o?0:1,o?-1:1);if((0,$.Pc)(e,s,{votedAye:c,votedNay:a,votedTotal:u})!==o)return r;r=l}}function U(e,s,{votedAye:t,votedNay:a,votedTotal:n},o,r,i){for(;;){const[l,c,u]=Z(a,n,r,i,o?1:0,o?1:-1);if((0,$.Pc)(e,s,{votedAye:t,votedNay:c,votedTotal:u})!==o)return r;r=l}}const J=(0,H.e)("useChangeCalc",(function(e,s,t,a){const{api:o}=(0,i.h)(),r=(0,c.W7)(o.derive.democracy.sqrtElectorate),[l,u]=(0,n.useState)({changeAye:O.nw,changeNay:O.nw});return(0,n.useEffect)((()=>{r&&u(function(e,s,t){const a=(0,$.Pc)(e,s,t);if(e.isSimpleMajority){const e=a?t.votedAye.sub(t.votedNay):t.votedNay.sub(t.votedAye);return{changeAye:t.votedNay.isZero()?O.nw:e,changeNay:t.votedAye.isZero()?O.nw:e}}let n=O.nw,o=O.nw,r=t.votedTotal.div(B);for(;!r.isZero();){n=W(e,s,t,a,n,r),o=U(e,s,t,a,o,r);const i=r.div(B);i.isZero()&&(n=n.add(r),o=o.add(r)),r=i}return{changeAye:t.votedNay.isZero()?O.nw:a?x().min(n,t.votedAye):n,changeNay:t.votedAye.isZero()?O.nw:a?o:x().min(o,t.votedNay)}}(e,r,{votedAye:s,votedNay:t,votedTotal:a}))}),[r,e,s,t,a]),l})),G=["0.1x","1x","2x","3x","4x","5x","6x"];function Y({conviction:e},s){return`${G[e.toNumber()]}${s?"/d":""} - `}const Q=n.memo((function({vote:{accountId:e,balance:s,isDelegating:t,vote:n}}){return(0,a.jsx)(r.ax,{balance:s,labelBalance:Y(n,t),value:e,withBalance:!0})})),K=[1,10,20,30,40,50,60],X=n.memo((function({className:e,count:s,isAye:t,total:o,votes:i}){const{t:l}=(0,u.$)(),c=(0,n.useMemo)((()=>i.sort(((e,s)=>{const t=e.balance.muln(K[e.vote.conviction.toNumber()]).div(O.aP);return s.balance.muln(K[s.vote.conviction.toNumber()]).div(O.aP).cmp(t)}))),[i]),d=(0,n.useCallback)((()=>c.map((e=>(0,a.jsx)(Q,{vote:e},e.accountId.toString())))),[c]);return(0,a.jsx)(r.n0,{className:e,empty:i&&l("No voters"),renderChildren:i.length?d:void 0,summary:(0,a.jsxs)(a.Fragment,{children:[l(t?"Aye {{count}}":"Nay {{count}}",{replace:{count:s?` (${(0,R.u)(s)})`:""}}),(0,a.jsx)("div",{children:(0,a.jsx)(k.Z,{value:o})})]})})})),ee=n.memo((function({proposal:e,referendumId:s}){const{t}=(0,u.$)(),{api:o}=(0,i.h)(),{hasAccounts:c}=(0,S.x)(),[d,m]=(0,n.useState)(null),[h,p]=(0,n.useState)(),[x,g]=(0,n.useState)(1),[b,f]=(0,l.O)(),j=(0,n.useMemo)((()=>!!o.query.democracy.votingOf),[o]);if(!c)return null;const v=!!j&&!h;return(0,a.jsxs)(a.Fragment,{children:[b&&(0,a.jsxs)(r.u_,{header:t("Vote on proposal"),onClose:f,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:t("If this proposal is passed, the changes will be applied via dispatch and the deposit returned."),children:(0,a.jsx)(I.Z,{idNumber:s,proposal:e})}),(0,a.jsx)(r.u_.Columns,{hint:t("The vote will be recorded for this account. If another account delegated to this one, the delegated votes will also be counted."),children:(0,a.jsx)(r.UE,{onChange:m})}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("The balance associated with the vote will be locked as per the conviction specified and will not be available for transfer during this period.")}),(0,a.jsx)("p",{children:t("Conviction locks do overlap and are not additive, meaning that funds locked during a previous vote can be locked again.")})]}),children:[j&&(0,a.jsx)(r.xb,{accountId:d,autoFocus:!0,onChange:p}),(0,a.jsx)(r.v,{label:t("conviction"),onChange:g,value:x,voteLockingPeriod:o.consts.democracy.voteLockingPeriod||o.consts.democracy.enactmentPeriod})]})]}),(0,a.jsxs)(r.u_.Actions,{children:[(0,a.jsx)(r.cA,{accountId:d,icon:"ban",isDisabled:v,label:t("Vote Nay"),onStart:f,params:j?[s,{Standard:{balance:h,vote:{aye:!1,conviction:x}}}]:[s,{aye:!1,conviction:x}],tx:o.tx.democracy.vote}),(0,a.jsx)(r.cA,{accountId:d,icon:"check",isDisabled:v,label:t("Vote Aye"),onStart:f,params:j?[s,{Standard:{balance:h,vote:{aye:!0,conviction:x}}}]:[s,{aye:!0,conviction:x}],tx:o.tx.democracy.vote})]})]}),(0,a.jsx)(r.zx,{icon:"check-to-slot",label:t("Vote"),onClick:f})]})}));function se(e,s){return Math.min(100,e.muln(1e4).div(s).toNumber()/100).toFixed(2)}const te=n.memo((function({className:e="",value:{allAye:s,allNay:t,image:o,imageHash:d,index:m,isPassing:h,status:p,voteCountAye:g,voteCountNay:b,votedAye:f,votedNay:j,votedTotal:C}}){const{t:w}=(0,u.$)(),{api:N}=(0,i.h)(),{allAccounts:k}=(0,S.x)(),I=(0,_.C)(),[A,P]=(0,l.O)(!1),E=(0,c.W7)(N.query.balances?.totalIssuance),{changeAye:M,changeNay:T}=J(p.threshold,f,j,C),D=(0,n.useMemo)((()=>p.threshold.type.toString().replace("majority"," majority ")),[p]),F=f.add(j),[V,{hasVoted:H,hasVotedAye:$}]=(0,n.useMemo)((()=>{if(E){const e=s.reduce(((e,{balance:s})=>e.add(s)),new(x())(0)),a=t.reduce(((e,{balance:s})=>e.add(s)),new(x())(0)),n=s.some((({accountId:e})=>k.includes(e.toString())));return[{aye:C.isZero()?"":`${se(e,C)}%`,nay:C.isZero()?"":`${se(a,C)}%`,turnout:`${se(C,E)}%`},{hasVoted:n||t.some((({accountId:e})=>k.includes(e.toString()))),hasVotedAye:n}]}return[null,{hasVoted:!1,hasVotedAye:!1}]}),[k,s,t,E,C]);if(!I||p.end.sub(I).lten(0))return null;const L=p.end.add(p.delay),B=p.end.sub(I).isub(O.If);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${e} isExpanded isFirst ${A?"":"isLast"}`,children:[(0,a.jsx)(r.iA.Column.Id,{value:m}),(0,a.jsx)(y.Z,{imageHash:d,proposal:o?.proposal}),(0,a.jsxs)("td",{className:"number together media--1200",children:[(0,a.jsx)(q.Z,{value:B}),w("{{blocks}} blocks",{replace:{blocks:(0,R.u)(B)}})]}),(0,a.jsxs)("td",{className:"number together media--1400",children:[(0,a.jsx)(q.Z,{value:L.sub(I)}),"#",(0,R.u)(L)]}),(0,a.jsx)("td",{className:"number together media--1400",children:V&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{children:V.turnout})})}),(0,a.jsx)("td",{className:"badge",children:(0,z.j)(h)&&(0,a.jsx)(r.Ct,{color:h?"green":"red",hover:w(h?"{{threshold}}, passing":"{{threshold}}, not passing",{replace:{threshold:D}}),icon:h?"check":"times"})}),(0,a.jsxs)("td",{className:"expand",children:[(0,a.jsx)(X,{change:M,count:g,isAye:!0,isWinning:h,total:f,votes:s}),(0,a.jsx)(X,{change:T,count:b,isAye:!1,isWinning:!h,total:j,votes:t})]}),(0,a.jsx)("td",{className:"media--1000 middle chart",children:(0,a.jsx)(r.Ex,{total:F,value:f})}),(0,a.jsx)("td",{className:"badge",children:(0,a.jsx)(r.JO,{color:H?$?"green":"red":"gray",icon:"asterisk"})}),(0,a.jsx)("td",{className:"actions",children:(0,a.jsxs)(r.zx.Group,{children:[!o?.proposal&&(0,a.jsx)(v.Z,{imageHash:d}),(0,a.jsx)(ee,{proposal:o?.proposal,referendumId:m}),(0,a.jsx)(r.Vh,{expanded:A,onClick:P})]})})]}),(0,a.jsxs)("tr",{className:`${e} ${A?"isExpanded isLast":"isCollapsed"}`,children:[(0,a.jsx)("td",{}),(0,a.jsx)("td",{className:"columar",colSpan:100,children:(0,a.jsx)(r.P0,{is100:!0,children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.NR,{data:m,type:"democracyReferendum",withTitle:!0})})})})]})]})})),ae=n.memo((function({className:e="",referendums:s}){const{t}=(0,u.$)(),o=(0,n.useRef)([[t("referenda"),"start",2],[t("remaining"),"media--1200"],[t("activate"),"media--1400"],[t("turnout"),"media--1400"],[void 0,"badge"],[t("votes"),"expand"],[void 0,"media--1000"],[void 0,void 0,2]]);return(0,a.jsx)(r.iA,{className:e,empty:s&&t("No active referendums"),header:o.current,children:s?.map((e=>(0,a.jsx)(te,{value:e},e.index.toString())))})}));var ne=t(54890);const oe={defaultValue:[void 0,void 0]},re=n.memo((function({referendumCount:e}){const{t:s}=(0,u.$)(),{api:t}=(0,i.h)(),n=(0,c.W7)(t.derive.democracy.proposals),o=(0,_.C)(),[l,d]=(0,ne.L)([t.query.democracy.publicPropCount,t.query.democracy.referendumCount],oe);return(0,a.jsxs)(r.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("proposals"),children:n?(0,R.u)(n.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{label:s("total"),children:l?(0,R.u)(l):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("referenda"),children:void 0!==e?(0,R.u)(e):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{label:s("total"),children:d?(0,R.u)(d):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]}),t.consts.democracy.launchPeriod&&(0,a.jsx)("section",{className:"media--1100",children:(0,a.jsx)(r.Jy,{label:s("launch period"),progress:{isBlurred:!o,total:t.consts.democracy.launchPeriod,value:o?o.mod(t.consts.democracy.launchPeriod).iadd(O.If):t.consts.democracy.launchPeriod.mul(O.um).div(O.Jo),withTime:!0}})})]})})),ie=n.memo((function({className:e}){const{t:s}=(0,u.$)(),{api:t}=(0,i.h)(),[n,o]=(0,l.O)(),[d,m]=(0,l.O)(),h=(0,c.W7)(t.derive.democracy.referendums);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(re,{referendumCount:h?.length}),(0,a.jsxs)(r.zx.Group,{children:[t.tx.democracy.notePreimage&&(0,a.jsx)(r.zx,{icon:"plus",label:s("Submit preimage"),onClick:o}),(0,a.jsx)(r.zx,{icon:"plus",label:s("Submit proposal"),onClick:m})]}),n&&(0,a.jsx)(N.Z,{onClose:o}),d&&(0,a.jsx)(V,{onClose:m}),(0,a.jsx)(ae,{referendums:h}),(0,a.jsx)(E,{}),(0,a.jsx)(w,{})]})})),le=n.memo((function({basePath:e}){const{t:s}=(0,u.$)(),t=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:s("Overview")}]),[s]);return(0,a.jsxs)("main",{className:"democracy--App",children:[(0,a.jsx)(r.mQ,{basePath:e,items:t}),(0,a.jsx)(o.Z5,{children:(0,a.jsx)(o.AW,{path:e,children:(0,a.jsx)(o.AW,{element:(0,a.jsx)(ie,{}),index:!0})})})]})}))},6987:(e,s,t)=>{t.d(s,{$:()=>n});var a=t(61349);function n(){return(0,a.$G)("app-democracy")}},61491:(e,s,t)=>{t.d(s,{Z:()=>l});var a=t(2784),n=t(34814),o=t(90778),r=t(74065),i=t(9118);const l=(0,t(11677).e)("useCounter",(function(){const{hasAccounts:e}=(0,n.x)(),{api:s,isApiReady:t}=(0,o.h)(),l=(0,r.X)(),c=(0,i.W7)(t&&e&&s.derive.democracy?.proposals),u=(0,i.W7)(t&&e&&s.derive.democracy?.referendumsActive),[d,m]=(0,a.useState)(0);return(0,a.useEffect)((()=>{l.current&&m((c?.length||0)+(u?.length||0))}),[l,c,u]),d}))},54705:(e,s,t)=>{t.d(s,{Z:()=>m});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(9118),l=t(53598),c=t(95292),u=t(14681),d=t(88057);const m=n.memo((function({className:e,withEra:s=!0,withSession:t=!0}){const{t:n}=(0,d.$)(),{api:m}=(0,r.h)(),h=(0,i.W7)(m.derive.session?.progress),p=(0,i.W7)(m.query.staking?.forceEra),x=n("era"),g=m.query.babe?n("epoch"):n("session"),b=h?.activeEraStart.unwrapOr(null);return(0,a.jsx)(a.Fragment,{children:m.derive.session&&(0,a.jsxs)(a.Fragment,{children:[t&&(m.query.babe?(0,a.jsx)(o.Jy,{className:e,label:g,progress:{isBlurred:!h,total:h?.sessionLength||c.Jo,value:h?.sessionProgress||c.um,withTime:!0}}):(0,a.jsxs)(o.Jy,{label:g,children:["#",h?(0,u.u)(h.currentIndex):(0,a.jsx)("span",{className:"--tmp",children:"123"}),s&&b&&(0,a.jsx)("div",{className:"isSecondary",children:" "})]})),s&&(m.query.babe?(0,a.jsx)(o.Jy,{className:e,label:x,progress:{isBlurred:!(h&&p),total:h&&p?p.isForceAlways?h.sessionLength:h.eraLength:c.Jo,value:h&&p?p.isForceAlways?h.sessionProgress:h.eraProgress:c.um,withTime:!0}}):(0,a.jsxs)(o.Jy,{className:e,label:x,children:["#",h?(0,u.u)(h.activeEra):(0,a.jsx)("span",{className:"--tmp",children:"123"}),b&&(0,a.jsxs)(l.Z,{className:(h?"":"--tmp")+" isSecondary",value:b,children:[" ",n("elapsed")]})]}))]})})}))},51406:(e,s,t)=>{t.d(s,{Z:()=>Je});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(75387),c=t(67405),u=t(33661),d=t(47297),m=t(14681);const h={aspectRatio:6,maintainAspectRatio:!0},p=r.zo.div` + background: var(--bg-table); + border: 1px solid var(--border-table); + border-radius: 0.25rem; + margin-bottom: 1rem; + padding: 1rem 1.5rem; +`,x=n.memo((function({className:e,colors:s,legends:t,options:n,title:o,value:{labels:i,values:l}}){return(0,a.jsx)(p,{className:e,children:(0,a.jsx)(r.kL.Line,{colors:s,labels:i,legends:t,options:n||h,title:o,values:l})})}));var g=t(88057);const b={aspectRatio:6,maintainAspectRatio:!0,scales:{y:{beginAtZero:!0}}},f=["#00448c","#008c44","#acacac"],j=["#008c8c","#00448c","#8c4400","#acacac"],v=r.zo.div` + .container { + background: var(--bg-table); + border: 1px solid var(--border-table); + border-radius: 0.25rem; + padding: 1rem 1.5rem; + } + + .container+.container { + margin-top: 1rem; + } +`,y=n.memo((function({className:e}){const{t:s}=(0,g.$)(),t=(0,d.m)(),{bytesLegend:o,requestsLegend:i}=(0,n.useMemo)((()=>({bytesLegend:[s("sent"),s("recv"),s("average")],errorsLegend:[s("errors")],requestsLegend:[s("total"),s("requests"),s("subscriptions"),s("average")]})),[s]),{bytesChart:l,requestsChart:c}=(0,n.useMemo)((()=>function(e){const s={labels:[],values:[[],[],[]]},t={labels:[],values:[[]]},a={labels:[],values:[[],[],[],[]]},n=e.reduce(((e,{stats:{active:{requests:s,subscriptions:t}}})=>e+s+t),0);let{bytesRecv:o,bytesSent:r,errors:i}=e[0].stats.total,l=0;for(let c=1;c3,p=(0,a.jsx)("span",{className:"--tmp",children:"99"}),y=(0,a.jsx)("span",{className:"--tmp",children:"1,000kB"});return(0,a.jsxs)(v,{className:e,children:[(0,a.jsxs)(r.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("sent"),children:h?(0,a.jsxs)(a.Fragment,{children:[(0,m.u)(u.stats.total.bytesSent/1024),"kB"]}):y}),(0,a.jsx)(r.Jy,{label:s("recv"),children:h?(0,a.jsxs)(a.Fragment,{children:[(0,m.u)(u.stats.total.bytesRecv/1024),"kB"]}):y})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("total req"),children:h?(0,a.jsx)(a.Fragment,{children:(0,m.u)(u.stats.total.requests)}):p}),(0,a.jsx)(r.Jy,{label:s("total sub"),children:h?(0,a.jsx)(a.Fragment,{children:(0,m.u)(u.stats.total.subscriptions)}):p})]})]}),(0,a.jsxs)(r.EK,{isActive:h,children:[(0,a.jsx)(x,{colors:j,legends:i,options:b,title:s("requests made"),value:c}),(0,a.jsx)(x,{colors:f,legends:o,options:b,title:s("bytes transferred"),value:l})]})]})}));var C=t(54383),w=t(74076);function N(e){return{isValid:(0,w.vq)(e,256)||/^\d+$/.test(e),value:e}}const k=(0,r.zo)(r.lm)` + .explorer--query { + width: 20em; + } +`,S=n.memo((function({className:e="",value:s}){const{t}=(0,g.$)(),[{isValid:o,value:i},l]=(0,n.useState)((()=>N(s||""))),c=(0,n.useCallback)((e=>l(N(e))),[]),u=(0,n.useCallback)((()=>{o&&0!==i.length&&(window.location.hash=`/explorer/query/${i}`)}),[o,i]);return(0,a.jsx)(k,{className:`${e} ui--FilterOverlay hasOwnMaxWidth`,children:(0,a.jsx)(r.II,{className:"explorer--query",defaultValue:s,isError:!o&&0!==i.length,onChange:c,onEnter:u,placeholder:t("block hash or number to query"),withLabel:!1,children:(0,a.jsx)(r.zx,{icon:"play",onClick:u})})})}));var I=t(39857),A=t(74065),P=t(56949),E=t(98202);const M=n.memo((function({className:e="",value:{event:s}}){const t=`${s.section}.${s.method}`;return(0,a.jsx)(r.xH,{className:e,isLeft:!0,summary:t,summaryMeta:s.meta,children:s.data.length?(0,a.jsx)(E.Z,{className:"details",eventName:t,value:s,withExpander:!0}):null})})),T=n.memo((function({className:e="",emptyLabel:s,error:t,eventClassName:o,events:i,label:l}){const{t:c}=(0,g.$)(),u=(0,n.useMemo)((()=>[[l||c("recent events"),"start"]]),[l,c]);return(0,a.jsx)(r.iA,{className:e,empty:s||c("No events available"),header:u,children:t?(0,a.jsx)("tr",{className:o,children:(0,a.jsx)("td",{children:(0,a.jsx)(r.oy,{content:c("Unable to decode the block events. {{error}}",{replace:{error:t.message}})})})},"error"):i?.map((e=>function(e,{blockHash:s,blockNumber:t,indexes:n,key:o,record:r}){return(0,a.jsx)("tr",{className:e,children:(0,a.jsxs)("td",{className:"overflow relative",children:[(0,a.jsx)(M,{value:r}),t&&(0,a.jsxs)("div",{className:"absolute --digits",children:[1!==n.length&&(0,a.jsxs)("span",{children:[(0,m.u)(n.length),"x "]}),(0,a.jsxs)(I.rU,{to:`/explorer/query/${s||""}`,children:[(0,m.u)(t),"-",n[0].toString().padStart(2,"0")]})]})]})},o)}(o,e)))})}));var D=t(15991),F=t(48801),V=t.n(F);const _=new(V())(1e4),q=r.zo.tr` + .explorer--BlockByHash-event+.explorer--BlockByHash-event { + margin-top: 0.75rem; + } + + .explorer--BlockByHash-nonce { + font-size: var(--font-size-small); + margin-left: 2.25rem; + margin-top: -0.5rem; + opacity: var(--opacity-light); + text-align: left; + } + + .explorer--BlockByHash-unsigned { + opacity: var(--opacity-light); + font-weight: var(--font-weight-normal); + } + + a.isDecoded { + display: block; + margin-top: 0.25rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } +`,O=n.memo((function({blockNumber:e,className:s="",events:t,index:o,maxBlockWeight:i,value:l,withLink:c}){const{t:u}=(0,g.$)(),d=(0,n.useMemo)((()=>c?`#/extrinsics/decode/${l.toHex()}`:null),[l,c]),{method:h,section:p}=(0,n.useMemo)((()=>l.registry.findMetaCall(l.callIndex)),[l]),x=(0,n.useMemo)((()=>"timestamp"===p&&"set"===h?new Date(l.args[0].unwrap().toNumber()):void 0),[h,p,l]),b=(0,n.useMemo)((()=>{if(l.isSigned){const s=function({era:e},s){if(s&&e.isMortalEra){const t=e.asMortalEra;return[t.birth(s.toNumber()),t.death(s.toNumber())]}return null}(l,e);return s?u("mortal, valid from #{{startAt}} to #{{endsAt}}",{replace:{endsAt:(0,m.u)(s[1]),startAt:(0,m.u)(s[0])}}):u("immortal")}}),[e,u,l]),[,f,j,v]=(0,n.useMemo)((()=>function(e,s,t){const a=s?s.filter((({record:{phase:s}})=>s.isApplyExtrinsic&&s.asApplyExtrinsic.eq(e))):[],n=a.find((({record:{event:{method:e,section:s}}})=>"system"===s&&["ExtrinsicFailed","ExtrinsicSuccess"].includes(e))),o=n?"ExtrinsicSuccess"===n.record.event.method?n.record.event.data[0]:n.record.event.data[1]:void 0,r=o&&(0,P.ZQ)(o.weight);return[o,r?.v1Weight,r&&t?r.v1Weight.mul(_).div(t).toNumber()/100:0,a]}(o,t,i)),[o,t,i]);return(0,a.jsxs)(q,{className:s,children:[(0,a.jsxs)("td",{className:"top",colSpan:2,children:[(0,a.jsx)(D.Z,{className:"details",mortality:b,tip:l.tip?.toBn(),value:l,withHash:!0,withSignature:!0}),d&&(0,a.jsx)("a",{className:"isDecoded",href:d,rel:"noreferrer",children:d})]}),(0,a.jsx)("td",{className:"top media--1000",colSpan:2,children:v.map((({key:e,record:s})=>(0,a.jsx)(M,{className:"explorer--BlockByHash-event",value:s},e)))}),(0,a.jsx)("td",{className:"top number media--1400",children:f&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(a.Fragment,{children:(0,m.u)(f)}),(0,a.jsxs)("div",{children:[j.toFixed(2),"%"]})]})}),(0,a.jsx)("td",{className:"top media--1200",children:l.isSigned?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.ax,{value:l.signer}),(0,a.jsxs)("div",{className:"explorer--BlockByHash-nonce",children:[u("index")," ",(0,m.u)(l.nonce)]}),(0,a.jsx)(r.NR,{data:l.hash.toHex(),type:"extrinsic"})]}):x?x.toLocaleString():null})]},`extrinsic:${o}`)})),R=n.memo((function({blockNumber:e,className:s="",events:t,label:o,maxBlockWeight:i,value:l,withLink:c}){const{t:u}=(0,g.$)(),d=(0,n.useMemo)((()=>[[o||u("extrinsics"),"start",2],[u("events"),"start media--1000",2],[u("weight"),"media--1400"],[void 0,"address media--1200"]]),[o,u]);return(0,a.jsx)(r.iA,{className:s,empty:u("No extrinsics available"),header:d,isFixed:!0,children:l?.map(((s,n)=>(0,a.jsx)(O,{blockNumber:e,events:t,index:n,maxBlockWeight:i,value:s,withLink:c},`extrinsic:${n}`)))})}));var z=t(86353),H=t(6046);function $(e){const s=e.Types.map((e=>({type:(0,H.s)(e)}))),t=e.toArray().map((e=>({isValid:!0,value:e})));return(0,a.jsx)(z.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}const L=n.memo((function({value:e}){const{t:s}=(0,g.$)(),t=(0,n.useRef)([[s("justifications"),"start"]]),o=e.unwrapOr(null);return o?(0,a.jsx)(r.iA,{empty:s("No justifications available"),header:t.current,children:o?.map(((e,s)=>(0,a.jsx)("tr",{children:(0,a.jsx)("td",{className:"overflow",children:(0,a.jsx)(r.xH,{summary:e[0].toString(),children:$(e)})})},`justification:${s}`)))}):null}));var B=t(45409),Z=t(71285),W=t(54436),U=t(49754);function J(e){return e.value instanceof B.A?function(e){const s=Object.entries(e.Type).map((([e,s])=>({name:e,type:(0,H.s)(s)}))),t=e.toArray().map((e=>({isValid:!0,value:e})));return(0,a.jsx)(z.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}(e.value):e.value instanceof Z.p?function(e){const s=e.Types.map((e=>({type:(0,H.s)(e)}))),t=e.toArray().map((e=>({isValid:!0,value:e})));return(0,a.jsx)(z.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}(e.value):e.value instanceof W.B?function(e){const s=(0,H.s)(e.Type),t=e.toArray().map((e=>({isValid:!0,value:e}))),n=t.map(((e,t)=>({name:`${t}`,type:s})));return(0,a.jsx)(z.ZP,{isDisabled:!0,params:n,values:t,withExpander:!0})}(e.value):e.value instanceof U.N?(s=e.value,(0,a.jsx)(z.ZP,{isDisabled:!0,params:[{type:(0,H.s)("Bytes")}],values:[{isValid:!0,value:s}],withExpander:!0})):(0,a.jsx)("div",{children:e.value.toString().split(",").join(", ")});var s}const G=n.memo((function({value:e}){const{t:s}=(0,g.$)(),t=(0,n.useRef)([[s("logs"),"start"]]);return(0,a.jsx)(r.iA,{empty:s("No logs available"),header:t.current,children:e?.map(((e,s)=>(0,a.jsx)("tr",{children:(0,a.jsx)("td",{className:"overflow",children:(0,a.jsx)(r.xH,{isLeft:!0,summary:e.type.toString(),children:J(e)})})},`log:${s}`)))})}));var Y=t(58607),Q=t(95292);const K=n.memo((function({events:e,maxBlockWeight:s,signedBlock:t}){const{t:o}=(0,g.$)(),{api:l}=(0,i.h)(),[c,u,d]=(0,n.useMemo)((()=>function(e){return e?e.reduce((([e,s,t],{record:{event:{data:a,method:n,section:o}}})=>["balances"===o&&"Deposit"===n?e.iadd(a[1]):e,"balances"===o&&"Transfer"===n?s.iadd(a[2]):s,"system"===o&&["ExtrinsicFailed","ExtrinsicSuccess"].includes(n)?t.iadd((0,P.ZQ)(("ExtrinsicSuccess"===n?a[0]:a[1]).weight).v1Weight):t]),[new(V())(0),new(V())(0),new(V())(0)]):[]}(e)),[e]);return(0,a.jsxs)(r.Ty,{children:[(0,a.jsx)("section",{children:l.query.balances&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{label:o("deposits"),children:(0,a.jsx)(Y.Z,{className:c?"":"--tmp",value:c||Q.If})}),(0,a.jsx)(r.Jy,{className:"media--1000",label:o("transfers"),children:(0,a.jsx)(Y.Z,{className:u?"":"--tmp",value:u||Q.If})})]})}),(0,a.jsx)("section",{children:(0,a.jsx)(r.Jy,{label:o("block weight"),progress:{hideValue:!0,isBlurred:!(s&&d),total:s&&d?s:Q.Jo,value:s&&d?d:Q.um},children:d?(0,m.u)(d):(0,a.jsx)("span",{className:"--tmp",children:"999,999,999"})})}),(0,a.jsxs)("section",{className:"media--900",children:[(0,a.jsx)(r.Jy,{label:o("event count"),children:e?(0,m.u)(e.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{label:o("extrinsic count"),children:t?(0,m.u)(t.block.extrinsics.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]})]})})),X=[["...","start",6]],ee=n.memo((function({className:e="",error:s,value:t}){const{t:o}=(0,g.$)(),{api:l}=(0,i.h)(),c=(0,A.X)(),[{events:u,getBlock:d,getHeader:h,runtimeVersion:p},x]=(0,n.useState)({}),[b,f]=(0,n.useState)(s),[j,v]=(0,n.useState)(),[y,C]=(0,n.useMemo)((()=>[!!p&&l.runtimeVersion.specName.eq(p.specName)&&l.runtimeVersion.specVersion.eq(p.specVersion),l.consts.system.blockWeights&&l.consts.system.blockWeights.maxBlock&&(0,P.ZQ)(l.consts.system.blockWeights.maxBlock).v1Weight]),[l,p]);(0,n.useEffect)((()=>{s&&f(s)}),[s]);const w=(0,n.useMemo)((()=>u?.filter((({record:{phase:e}})=>!e.isApplyExtrinsic))),[u]);(0,n.useEffect)((()=>{t&&Promise.all([l.at(t).then((e=>Promise.all([Promise.resolve(e.runtimeVersion),e.query.system.events().catch((e=>(c.current&&v(e),null)))]))),l.rpc.chain.getBlock(t),l.derive.chain.getHeader(t)]).then((e=>{c.current&&x(function([[e,s],t,a]){return{events:s?.map(((e,s)=>({indexes:[s],key:`${Date.now()}-${s}-${e.hash.toHex()}`,record:e}))),getBlock:t,getHeader:a,runtimeVersion:e}}(e))})).catch((e=>{c.current&&f(e)}))}),[l,c,t]);const N=(0,n.useMemo)((()=>h?[[(0,m.u)(h.number.unwrap()),"start --digits",1],[o("hash"),"start"],[o("parent"),"start"],[o("extrinsics"),"start media--1300"],[o("state"),"start media--1200"],[p?`${p.specName.toString()}/${p.specVersion.toString()}`:void 0,"media--1000"]]:X),[h,p,o]),k=h?.number.unwrap(),S=h?.parentHash.toHex(),E=!h?.parentHash.isEmpty;return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(K,{events:u,maxBlockWeight:C,signedBlock:d}),(0,a.jsx)(r.iA,{header:N,children:b?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:6,children:(0,a.jsx)(r.oy,{content:o("Unable to retrieve the specified block details. {{error}}",{replace:{error:b.message}})})})}):d&&h&&!d.isEmpty&&!h.isEmpty&&(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address",children:h.author&&(0,a.jsx)(r.N,{value:h.author})}),(0,a.jsx)("td",{className:"hash overflow",children:h.hash.toHex()}),(0,a.jsx)("td",{className:"hash overflow",children:E?(0,a.jsx)(I.rU,{to:`/explorer/query/${S||""}`,children:S}):S}),(0,a.jsx)("td",{className:"hash overflow media--1300",children:h.extrinsicsRoot.toHex()}),(0,a.jsx)("td",{className:"hash overflow media--1200",children:h.stateRoot.toHex()}),(0,a.jsx)("td",{className:"media--1000",children:t&&(0,a.jsx)(r.NR,{data:t,type:"block"})})]})}),d&&h&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R,{blockNumber:k,events:u,maxBlockWeight:C,value:d.block.extrinsics,withLink:y}),(0,a.jsxs)(r.P0,{children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(T,{error:j,eventClassName:"explorer--BlockByHash-block",events:w,label:o("system events")})}),(0,a.jsxs)(r.P0.Column,{children:[(0,a.jsx)(G,{value:h.digest.logs}),(0,a.jsx)(L,{value:d.justifications})]})]})]})]})})),se=n.memo((function({value:e}){const{api:s}=(0,i.h)(),[t,o]=(0,n.useState)(null),r=(0,A.X)(),[l,c]=(0,n.useState)(null);return(0,n.useEffect)((()=>{s.rpc.chain.getBlockHash(e).then((e=>{r.current&&o(e)})).catch((e=>{console.error(1),r.current&&c(e)}))}),[s,r,e]),(0,a.jsx)(ee,{error:l,value:t?t.toHex():null})})),te=n.memo((function(){const e=(0,C.C)(),{value:s}=(0,o.UO)(),[t,r]=(0,n.useState)(s);if((0,n.useEffect)((()=>{r((t=>s&&s!==t?s:!t&&e?e.toString():t))}),[e,s]),!t)return null;const i=(0,w.vq)(t)?ee:se;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S,{}),(0,a.jsx)(i,{value:t},t)]})}));var ae=t(17965),ne=t(9118),oe=t(11677);const re=50,ie={details:[],isLoaded:!1,maxItems:re,stdDev:0,timeAvg:0,timeMax:0,timeMin:0};function le(e){const s=e.sort(((e,s)=>e.block.number-s.block.number)).filter((({block:s},t)=>0===t||s.number>e[t-1].block.number));for(let e=0;e"set"===e&&"timestamp"===s))}(s);return a?[...e,{block:{bytes:s.encodedLength,number:s.header.number.toNumber()},delay:0,events:{count:t.length,system:t.filter((({phase:e})=>!e.isApplyExtrinsic)).length},extrinsics:{bytes:s.extrinsics.reduce(((e,s)=>e+s.encodedLength),0),count:s.extrinsics.length},now:a.args[0].toNumber(),parentHash:s.header.parentHash}]:e}function ue(e,s){return s.reduce(((e,s)=>ce(e,s)),e)}async function de(e,s){return s.length?(await Promise.all(s.map((s=>e.derive.chain.getBlockByNumber(s))))).filter((e=>!!e)):[]}const me=(0,oe.e)("useLatency",(function(){const{api:e}=(0,i.h)(),[s,t]=(0,n.useState)([]),a=(0,ne.W7)(e.derive.chain.subscribeNewBlocks),o=(0,n.useRef)(!1);return(0,n.useEffect)((()=>{a&&(t((e=>le(ce(e,a)))),o.current||(o.current=!0,async function(e,{block:{header:s}}){const t=[];let a=s.number.toNumber();for(let e=1;a>0&&e<=50;e++)t.push(--a);return de(e,t)}(e,a).then((e=>t((s=>le(ue(s,e)))))).catch(console.error)))}),[e,a]),(0,n.useEffect)((()=>{if(s.length<=2)return;const a=s.findIndex((({block:e},t)=>t!==s.length-1&&s[t+1].block.number-e.number>1));-1!==a&&async function(e,{block:{number:s}},{block:{number:t}}){const a=[];for(let e=s+1;et((s=>le(ue(s,e)))))).catch(console.error)}),[e,s]),(0,n.useMemo)((()=>{const e=s.map((({delay:e})=>e)).filter((e=>e));if(!e.length)return ie;const t=e.reduce(((e,s)=>e+s),0)/e.length,a=Math.sqrt(e.reduce(((e,s)=>e+Math.pow(t-s,2)),0)/e.length);return{details:s,isLoaded:s.length===re,maxItems:re,stdDev:a,timeAvg:t,timeMax:Math.max(...e),timeMin:Math.min(...e)}}),[s])})),he=["times","blocks","extrinsics","events"],pe={blocks:["#008c8c","#acacac"],events:["#00448c","#8c0044","#acacac"],extrinsics:["#448c00","#acacac"],times:["#8c8c00","#acacac"]};function xe(e,s=1e3){return(0,a.jsxs)("span",{className:"--digits",children:[`${(e/s).toFixed(3)}`,(0,a.jsx)("span",{className:"postfix",children:" s"})]})}const ge=r.zo.div` + .container { + background: var(--bg-table); + border: 1px solid var(--border-table); + border-radius: 0.25rem; + padding: 1rem 1.5rem; + } + + .container+.container { + margin-top: 1rem; + } + + span.--digits { + .postfix { + font-size: var(--font-percent-tiny); + } + } +`,be=n.memo((function({className:e}){const{t:s}=(0,g.$)(),{details:t,isLoaded:o,maxItems:i,stdDev:l,timeAvg:c,timeMax:u,timeMin:d}=me(),[h,p]=(0,n.useState)((()=>new Array(he.length).fill(!1)));(0,n.useEffect)((()=>{if(o){const e=h.findIndex((e=>!e));-1!==e&&(0,ae.Y)((()=>p(h.map(((s,t)=>t===e||s)))))}}),[o,h]);const b=(0,n.useMemo)((()=>function(e,s){const t={labels:[],values:[[],[]]},a={labels:[],values:[[],[],[]]},n={labels:[],values:[[],[]]},o={labels:[],values:[[],[]]},r=e.reduce(((e,{events:{count:s}})=>e+s),0),i=e.reduce(((e,{extrinsics:{count:s}})=>e+s),0),l=e.reduce(((e,{block:{bytes:s}})=>e+s),0);for(let s=0,o=e.length;se)),u=s*c.length;for(let e=0,s=c.length;e[{blocks:[s("bytes"),s("average")],events:[s("events"),s("system"),s("average")],extrinsics:[s("extrinsics"),s("average")],times:[s("blocktime"),s("average")]},{blocks:s("blocksize (last {{n}} blocks)",{replace:{n:i}}),events:s("events (last {{n}} blocks)",{replace:{n:i}}),extrinsics:s("extrinsics (last {{n}} blocks)",{replace:{n:i}}),times:s("blocktimes (last {{n}} blocks)",{replace:{n:i}})}]),[i,s]),v=(0,a.jsxs)("span",{className:"--tmp --digits",children:["0.000 ",(0,a.jsx)("span",{className:"postfix",children:"s"})]});return(0,a.jsxs)(ge,{className:e,children:[(0,a.jsxs)(r.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("avg"),children:o?xe(c):v}),(0,a.jsx)(r.Jy,{className:"media--1000",label:s("std dev"),children:o?xe(l):v})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("min"),children:o?xe(d):v}),(0,a.jsx)(r.Jy,{label:s("max"),children:o?xe(u):v})]}),(0,a.jsx)(r.Jy,{label:s("last"),children:o?xe(b.blockLast,1):v})]}),(0,a.jsx)(r.EK,{isActive:o,children:he.map((e=>(0,a.jsx)(x,{colors:pe[e],legends:f[e],title:j[e],value:b[e]},e)))})]})}));var fe=t(69543);const je=(0,r.zo)(r.iA)` + overflow-x: auto; + + td.roles { + max-width: 9ch; + width: 9ch; + } + + td.bestNumber { + max-width: 11ch; + width: 11ch; + } +`,ve=n.memo((function({className:e="",peers:s}){const{t}=(0,g.$)(),o=(0,n.useRef)([[t("connected peers"),"start",2],[t("best hash"),"start"],[t("best #"),"number"]]),r=(0,n.useMemo)((()=>s&&function(e){return e.map((({bestHash:e,bestNumber:s,peerId:t,roles:a})=>({bestHash:e.toHex(),bestNumber:s,peerId:t.toString(),roles:(0,fe.KT)(a)}))).sort(((e,s)=>e.peerId.localeCompare(s.peerId))).sort(((e,s)=>e.roles.localeCompare(s.roles))).sort(((e,s)=>s.bestNumber.cmp(e.bestNumber)))}(s)),[s]);return(0,a.jsx)(je,{className:e,empty:t("no peers connected"),header:o.current,children:r?.map((({bestHash:e,bestNumber:s,peerId:t,roles:n})=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"roles",children:n}),(0,a.jsx)("td",{className:"hash overflow",children:t}),(0,a.jsx)("td",{className:"hash overflow",children:e}),(0,a.jsx)("td",{className:"number bestNumber",children:(0,m.u)(s)})]},t)))})}));var ye=t(53598),Ce=t(95689);const we={extrinsics:null,health:null,peers:null},Ne=n.memo((function({info:{extrinsics:e,health:s,peers:t}=we,nextRefresh:o}){const{t:i}=(0,g.$)(),[l,c]=(0,n.useState)(Q.nw);return(0,n.useEffect)((()=>{if(t){const e=t.sort(((e,s)=>s.bestNumber.cmp(e.bestNumber)))[0];c(e?e.bestNumber:Q.nw)}}),[t]),(0,a.jsxs)(r.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:i("refresh in"),children:(0,a.jsx)(ye.Z,{value:o})}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{className:"media--800",label:i("total peers"),children:(0,m.u)(s.peers)}),(0,a.jsx)(r.Jy,{className:"media--800",label:i("syncing"),children:s.isSyncing.valueOf()?i("yes"):i("no")})]})]}),e&&e.length>0&&(0,a.jsx)("section",{className:"media--1200",children:(0,a.jsx)(r.Jy,{label:i("queued tx"),children:e.length})}),(0,a.jsxs)("section",{children:[l?.gtn(0)&&(0,a.jsx)(r.Jy,{label:i("peer best"),children:(0,m.u)(l)}),(0,a.jsx)(r.Jy,{label:i("our best"),children:(0,a.jsx)(Ce.Z,{})})]})]})})),ke=n.memo((function(){const{t:e}=(0,g.$)(),{api:s}=(0,i.h)(),[t,o]=(0,n.useState)({}),[r,l]=(0,n.useState)((()=>Date.now()));return(0,n.useEffect)((()=>{const e=()=>{l(Date.now()+9900),async function(e){try{const[s,t,a,n]=await Promise.all([e.derive.chain.bestNumber(),e.rpc.system.health().catch((()=>null)),e.rpc.system.peers().catch((()=>null)),e.rpc.author.pendingExtrinsics().catch((()=>null))]);return{blockNumber:s,extrinsics:n,health:t,peers:a}}catch{return{}}}(s).then(o).catch(console.error)};e();const t=window.setInterval(e,9900);return()=>{window.clearInterval(t)}}),[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Ne,{info:t,nextRefresh:r}),(0,a.jsx)(ve,{peers:t.peers}),(0,a.jsx)(R,{blockNumber:t.blockNumber,label:e("pending extrinsics"),value:t.extrinsics,withLink:!0})]})}));function Se(e){return Math.max(1,e.reduce(((e,{hdr:{width:s}})=>e+s),0))}function Ie(e){return e.reduce(((e,{arr:s,hdr:t})=>(t.height=t.isEmpty?0:1+Ie(s),Math.max(e,t.height))),0)}function Ae({hdr:{author:e,hash:s,isEmpty:t,isFinalized:a,parent:n,width:o}}){return{author:e,hash:s,isEmpty:t,isFinalized:a,parent:n,width:o}}function Pe(e){return e.length?Pe(e.reduce(((e,{arr:s})=>e.concat(...s)),[])).concat({bn:e.reduce(((e,{hdr:{bn:s}})=>e||s),""),cols:e.map(Ae)}):[]}function Ee(e,s,t,a,n=!1){return{author:a,bn:e,hash:s,height:0,isEmpty:n,isFinalized:!1,parent:t,width:0}}function Me(){return{arr:[],hdr:Ee(""," "," ",null,!0)}}function Te(e){e.some((({arr:e})=>0!==e.length))&&(e.filter((({arr:e})=>0===e.length)).forEach((({arr:e})=>e.push(Me()))),Te(e.reduce(((e,{arr:s})=>e.concat(...s)),[])))}function De(e){return!(!e[0]||e[0].isEmpty)&&e.reduce(((e,s,t)=>(0===t||!!s.isEmpty)&&e),!0)}function Fe({author:e,hash:s,isEmpty:t,isFinalized:n,parent:o,width:i},l){return(0,a.jsx)("td",{className:`header ${t?"isEmpty":""} ${n?"isFinalized":""}`,colSpan:i,children:t?(0,a.jsx)("div",{className:"empty"}):(0,a.jsxs)(a.Fragment,{children:[e&&(0,a.jsx)(r.k,{className:"author",size:28,value:e}),(0,a.jsxs)("div",{className:"contents",children:[(0,a.jsx)("div",{className:"hash",children:s}),(0,a.jsx)("div",{className:"parent",children:o})]})]})},`${s}:${l}:${i}`)}function Ve(e){const s=e.length-1;let t=!1;return e.map((({bn:n,cols:o},r)=>{if(0!==r&&r!==s&&De(o)){if(t)return null;if(De(e[r-1].cols))return t=!0,(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{},"blockNumber"),(0,a.jsx)("td",{className:"header isLink",colSpan:o[0].width,children:(0,a.jsx)("div",{className:"link",children:"⋮"})})]},n)}return t=!1,(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:`#${n}`},"blockNumber"),o.map(Fe)]},n)}))}const _e=r.zo.div` + margin-bottom: 1.5rem; + + table { + border-collapse: separate; + border-spacing: 0.25rem; + font: var(--font-mono); + + td { + padding: 0.25rem 0.5rem; + text-align: center; + + .author, + .contents { + display: inline-block; + vertical-align: middle; + } + + .author { + margin-right: 0.25rem; + } + + .contents { + .hash, .parent { + margin: 0 auto; + max-width: 6rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .parent { + font-size: var(--font-size-small); + line-height: 0.75rem; + max-width: 4.5rem; + } + } + + &.blockNumber { + font-size: 1.25rem; + } + + &.header { + background: #fff; + border: 1px solid #e6e6e6; + border-radius: 0.25rem; + + &.isEmpty { + background: transparent; + border-color: transparent; + } + + &.isFinalized { + background: rgba(0, 255, 0, 0.1); + } + + &.isLink { + background: transparent; + border-color: transparent; + line-height: 1rem; + padding: 0; + } + + &.isMissing { + background: rgba(255, 0, 0, 0.05); + } + } + } + } +`,qe=n.memo((function({className:e}){const{t:s}=(0,g.$)(),{api:t}=(0,i.h)(),[o,l]=(0,n.useState)(null),c=(0,n.useRef)(new Map([["root",[]]])),u=(0,n.useRef)({numBlocks:0,numForks:0}),d=(0,n.useRef)(new Map),h=(0,n.useRef)(""),p=(0,n.useCallback)((e=>{const s=d.current.get(e);s&&!s.isFinalized&&(s.isFinalized=!0,p(s.parent))}),[]),x=(0,n.useCallback)(((e,s)=>((c.current.get(e.hash)||[]).map((e=>d.current.get(e))).filter((e=>!!e)).forEach((e=>{s.push({arr:x(e,[]),hdr:e})})),e.height=Ie(s),e.width=Se(s),s.sort(((e,s)=>e.hdr.width>s.hdr.width||e.hdr.height>s.hdr.height||e.hdr.isFinalized?-1:e.hdr.width{const e=Me();return(c.current.get("root")||[]).forEach((s=>{const t=d.current.get(s);t&&e.arr.push({arr:[],hdr:{...t}})})),e.arr.forEach((({arr:e,hdr:s})=>{x(s,e)})),Te(e.arr),e.hdr.height=Ie(e.arr),e.hdr.width=Se(e.arr),e}),[x]),f=(0,n.useCallback)((e=>{p(e.hash.toHex())}),[p]),j=(0,n.useCallback)((e=>{const s=(0,m.u)(e.number),a=e.hash.toHex(),n=e.parentHash.toHex();let o=!1;if(h.current||(h.current=s),!d.current.has(a)){if(h.current===s&&c.current.get("root").push(a),d.current.set(a,Ee(s,a,n,null)),c.current.has(n)?(o=!0,c.current.get(n).push(a)):c.current.set(n,[a]),!d.current.has(n)&&h.current!==s)return console.warn(`Retrieving missing header ${e.parentHash.toHex()}`),void t.rpc.chain.getHeader(e.parentHash).then(j).catch(console.error);u.current.numBlocks++,o&&u.current.numForks++,l(b())}}),[t,b]);return(0,n.useEffect)((()=>{let e=null,s=null;return(async()=>{e=await t.rpc.chain.subscribeFinalizedHeads(f),s=await t.rpc.chain.subscribeNewHeads(j)})().catch(console.error),()=>{e&&e(),s&&s()}}),[t,f,j]),o?(0,a.jsxs)(_e,{className:e,children:[(0,a.jsx)(r.Ty,{children:(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("blocks"),children:(0,m.u)(u.current.numBlocks)}),(0,a.jsx)(r.Jy,{label:s("forks"),children:(0,m.u)(u.current.numForks)})]})}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:Ve(Pe(o.arr))})})]}):null})),Oe=n.memo((function({value:e}){if(!e)return null;const s=e.hash.toHex();return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"number",children:(0,a.jsx)("h4",{className:"--digits",children:(0,a.jsx)(I.rU,{to:`/explorer/query/${s}`,children:(0,m.u)(e.number)})})}),(0,a.jsx)("td",{className:"all hash overflow",children:s}),(0,a.jsx)("td",{className:"address",children:e.author&&(0,a.jsx)(r.N,{value:e.author})})]})})),Re=n.memo((function({headers:e}){const{t:s}=(0,g.$)(),t=(0,n.useRef)([[s("recent blocks"),"start",3]]);return(0,a.jsx)(r.iA,{empty:s("No blocks available"),header:t.current,children:e.filter((e=>!!e)).map((e=>(0,a.jsx)(Oe,{value:e},e.number.toString())))})}));var ze=t(67634),He=t(65874),$e=t(79608),Le=t(96916),Be=t(26839),Ze=t(54705);const We=n.memo((function({eventCount:e}){const{t:s}=(0,g.$)(),{api:t}=(0,i.h)();return(0,a.jsxs)(r.Ty,{children:[(0,a.jsxs)("section",{children:[t.query.timestamp&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{label:s("last block"),children:(0,a.jsx)(ze.Z,{})}),(0,a.jsx)(r.Jy,{className:"media--800",label:s("target"),children:(0,a.jsx)(He.Z,{value:Q.If})})]}),t.query.balances&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{className:"media--800",label:s("total issuance"),children:(0,a.jsx)($e.Z,{})}),!!t.query.balances.inactiveIssuance&&(0,a.jsx)(r.Jy,{className:"media--1300",label:s("inactive issuance"),children:(0,a.jsx)(Le.Z,{})})]})]}),(0,a.jsx)("section",{className:"media--1100",children:(0,a.jsx)(Ze.Z,{withEra:!1})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{className:"media--1400",label:s("last events"),children:(0,m.u)(e)}),t.query.grandpa&&(0,a.jsx)(r.Jy,{label:s("finalized"),children:(0,a.jsx)(Be.Z,{})}),(0,a.jsx)(r.Jy,{label:s("best"),children:(0,a.jsx)(Ce.Z,{})})]})]})})),Ue=n.memo((function({eventCount:e,events:s,headers:t}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S,{}),(0,a.jsx)(We,{eventCount:e}),(0,a.jsxs)(r.P0,{children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(Re,{headers:t})}),(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(T,{events:s})})]})]})})),Je=n.memo((function({basePath:e,className:s}){const{t}=(0,g.$)(),{api:d}=(0,i.h)(),{lastHeaders:m}=(0,l.E)(),{eventCount:h,events:p}=(0,c.d)(),x=(0,n.useRef)(function(e){return[{isRoot:!0,name:"chain",text:e("Chain info")},{hasParams:!0,name:"query",text:e("Block details")},{name:"latency",text:e("Latency")},{name:"forks",text:e("Forks")},{name:"node",text:e("Node info")},{name:"api",text:e("API stats")}]}(t)),b=(0,n.useMemo)((()=>(0,u.m)(d.query.babe?.authorities)?[]:["forks"]),[d]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,hidden:b,items:x.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(y,{}),path:"api"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(qe,{}),path:"forks"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(be,{}),path:"latency"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(ke,{}),path:"node"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(te,{}),path:"query/:value?"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Ue,{eventCount:h,events:p,headers:m}),index:!0})]})})]})}))},88057:(e,s,t)=>{t.d(s,{$:()=>n});var a=t(61349);function n(){return(0,a.$G)("app-explorer")}},38080:(e,s,t)=>{t.d(s,{Z:()=>k});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(98988),c=t(48731),u=t(74076),d=t(51330),m=t(57198),h=t(65417),p=t(55858),x=t(61349);function g(){return(0,x.$G)("app-extrinsics")}const b=(0,r.zo)(r.P0)` + .ui--Column:last-child .ui--Labelled { + padding-left: 0.5rem; + + label { + left: 2.05rem; /* 3.55 - 1.5 (diff from padding above) */ + } + } +`,f=n.memo((function({className:e,extrinsic:s,isCall:t,payload:o,withData:i=!0,withHash:l=!0}){const{t:c}=g(),[u,d,m]=(0,n.useMemo)((()=>function(e,s,t){if(!s)return["0x","0x",null];const a=s.method.toU8a();let n=e?s.method.inspect():s.inspect();if(t){const e=n;n=t.inspect(),n.inner?.map(((s,t)=>(0===t&&(s.inner=e.inner,s.outer=void 0),s)))}return[(0,p.c)(a),s.registry.hash(a).toHex(),n]}(t,s,o)),[s,t,o]);return m?(0,a.jsxs)(b,{className:e,isPadded:!1,children:[(0,a.jsxs)(r.P0.Column,{children:[i&&(0,a.jsx)(r.r_,{isDisabled:!0,isTrimmed:!0,label:c("encoded call data"),value:u,withCopy:!0}),l&&(0,a.jsx)(r.r_,{isDisabled:!0,label:c("encoded call hash"),value:d,withCopy:!0})]}),(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.R2,{hex:u,inspect:m,label:c("encoding details")})})]}):null})),j={decoded:null,extrinsicCall:null,extrinsicError:null,extrinsicFn:null,extrinsicHex:null,extrinsicKey:"none",extrinsicPayload:null,isCall:!0},v=r.zo.div` + .ui--Call--toplevel { + margin-top: 0; + } + + .ui--Call > .ui--Params.withBorder { + padding-left: 2rem; + } +`,y=n.memo((function({className:e,defaultValue:s,setLast:t}){const{encoded:p}=(0,o.UO)(),[x]=(0,n.useState)((()=>s||p)),{t:b}=g(),{api:y}=(0,i.h)(),[{decoded:C,extrinsicCall:w,extrinsicError:N,extrinsicFn:k,extrinsicKey:S,extrinsicPayload:I,isCall:A},P]=(0,n.useState)(j),E=(0,n.useCallback)((e=>{try{let s;(0,c.hu)((0,u.vq)(e),"Expected a hex-encoded call");let a=null,n=null,o=!1;try{const t=y.tx(e);(0,c.hu)(t.toHex()===e,"Cannot decode data as extrinsic, length mismatch"),n=t,s=y.createType("Call",n.method)}catch{try{s=y.createType("Call",e);const t=s.toHex();if(t===e)o=!0;else{if(!e.startsWith(t))throw new Error("Unable to decode data as Call, length mismatch in supplied data");{const t=(0,d.e)((0,m.Y)(s.encodedLength),e);a=y.createType("ExtrinsicPayload",t),(0,c.hu)((0,h.S)(a.toU8a(),t),"Unable to decode data as un-prefixed ExtrinsicPayload"),s=y.createType("Call",a.method.toHex())}}}catch{a=y.createType("ExtrinsicPayload",e),(0,c.hu)(a.toHex()===e,"Unable to decode input data as Call, Extrinsic or ExtrinsicPayload"),s=y.createType("Call",a.method.toHex())}}const{method:r,section:i}=y.registry.findMetaCall(s.callIndex),l=y.tx[i][r],p=s.callIndex.toString();n||(n=l(...s.args)),P({...j,decoded:n,extrinsicCall:s,extrinsicFn:l,extrinsicHex:e,extrinsicKey:p,extrinsicPayload:a,isCall:o}),t({call:s,fn:l,hex:e})}catch(e){P({...j,extrinsicError:e.message}),t(null)}}),[y,t]);return(0,a.jsxs)(v,{className:e,children:[(0,a.jsx)(r.II,{defaultValue:x,isError:!k,label:b("hex-encoded call"),onChange:E,placeholder:b("0x...")}),N&&(0,a.jsx)(r.oy,{content:N}),k&&w&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.UT,{defaultValue:k,isDisabled:!0,label:b("decoded call")},`extrinsicKey:${S}`),(0,a.jsx)(l.Z,{className:"details",value:w})]}),(0,a.jsx)(f,{extrinsic:C,isCall:A,payload:I,withData:!1})]})}));var C=t(60404),w=t(36609);const N=n.memo((function({className:e,defaultValue:s}){const{t}=g(),{apiDefaultTxSudo:o}=(0,i.h)(),[l,c]=(0,n.useState)(null),[u,d]=(0,n.useState)(null),[m,h]=(0,n.useState)(null),[{defaultArgs:p,defaultFn:x}]=(0,n.useState)((()=>function(e,s){return e?{defaultArgs:e.call.args.map((e=>({isValid:!0,value:e}))),defaultFn:e.fn}:{defaultFn:s}}(s,o))),b=(0,n.useCallback)((e=>h((()=>e||null))),[]),j=(0,n.useCallback)((e=>d(e?e.message:null)),[]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(r.rp,{label:t("using the selected account"),labelExtra:(0,a.jsx)(w.Z,{label:(0,a.jsx)("label",{children:t("free balance")}),params:l}),onChange:c,type:"account"}),(0,a.jsx)(C.Z,{defaultArgs:p,defaultValue:x,label:t("submit the following extrinsic"),onChange:b,onError:j}),(0,a.jsx)(f,{extrinsic:m,isCall:!0}),u&&!m&&(0,a.jsx)(r.oy,{content:u}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.cA,{extrinsic:m,icon:"sign-in-alt",isUnsigned:!0,label:t("Submit Unsigned"),withSpinner:!0}),(0,a.jsx)(r.cA,{accountId:l,extrinsic:m,icon:"sign-in-alt",label:t("Submit Transaction")})]})]})})),k=n.memo((function({basePath:e}){const{t:s}=g(),[t,i]=(0,n.useState)(null),l=(0,n.useRef)(function(e){return[{isRoot:!0,name:"create",text:e("Submission")},{hasParams:!0,name:"decode",text:e("Decode")}]}(s));return(0,a.jsxs)("main",{className:"extrinsics--App",children:[(0,a.jsx)(r.mQ,{basePath:e,items:l.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(y,{defaultValue:t?.hex,setLast:i}),path:"decode/:encoded?"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(N,{defaultValue:t}),index:!0})]})})]})}))},58064:(e,s,t)=>{t.d(s,{Z:()=>r});var a=t(52322),n=t(2784),o=t(10257);const r=n.memo((function({basePath:e,className:s}){return(0,a.jsx)(o.Z,{basePath:e,className:s,palletColl:"fellowshipCollective",palletPoll:"fellowshipReferenda"})}))},16472:(e,s,t)=>{t.d(s,{Z:()=>n});var a=t(1398);const n=(0,t(11677).e)("useCounter",(function(){return(0,a.E)("fellowshipReferenda")}))},31043:(e,s,t)=>{t.d(s,{Z:()=>q});var a=t(52322),n=t(2784),o=t(64348),r=t(46782),i=t.n(r),l=t(86135),c=t(23729),u=t.n(c);const d={files:[],isLoad:!0};var m=t(61349);function h(){return(0,m.$G)("app-files")}var p=t(90162),x=t(14534),g=t(69187),b=t(33661),f=t(17965),j=t(54827),v=t(55858),y=t(64021);const C=o.zo.div` + width: 100%; + background: unset; + overflow: hidden; + height: 1.4rem; + border-radius: 0.7rem; + border-style: solid; + border-width: 1px; + + .file-progress-bar { + transition: width 100ms ease-in-out; + width: 0; + height: 100%; + } +`,w=n.memo((function({className:e="",progress:s,style:t}){return(0,a.jsx)(C,{className:`${e} highlight--border`,style:t,children:(0,a.jsx)("div",{className:"file-progress-bar highlight--bg",style:{width:`${s}%`}})})}));var N=t(48834).Buffer;const k=()=>{};function S(e){const s=e.file;return(0,a.jsxs)("div",{className:"file",children:[(0,a.jsx)(o.__,{label:s.webkitRelativePath||e.file.name}),(0,a.jsx)("span",{children:`${s.size} bytes`})]})}const I=(0,o.zo)(o.u_)` + .files { + max-height: 300; + overflow: auto; + padding-left: 2rem; + width: 100%; + + .file { + background-color: white; + border-bottom: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 4px; + padding: 5px 2rem; + } + } + + .progress { + margin-left: 2rem; + margin-top: 2rem; + width: calc(100% - 2rem); + } +`,A=n.memo((function({className:e,file:s,onClose:t=k,onSuccess:r=k}){const{t:i}=h(),l=(0,n.useMemo)((()=>function(e){return[{location:e("Singapore"),text:e("DCF"),value:"https://crustipfs.xyz"},{location:e("Seattle"),text:e("Crust Network"),value:"https://gw.crustfiles.app"},{location:e("Berlin"),text:e("⚡️ Thunder Gateway"),value:"https://gw.crustfiles.net"}]}(i).sort((()=>Math.random()>.5?-1:1)).map((e=>({...e,text:`${e.text??""}(${e.location??""})`})))),[i]),[c,u]=(0,n.useState)(l[0]),d=(0,n.useMemo)((()=>[{text:i("Crust Pinner"),value:"https://pin.crustcode.com"}]),[i]),[m,C]=(0,n.useState)(d[0]),[A,P]=(0,n.useState)((()=>g.Nn.getPairs()[0]||null)),[E,M]=(0,n.useState)(""),[{isInjected:T},D]=(0,n.useState)({isExternal:!1,isHardware:!1,isInjected:!1}),[F,V]=(0,n.useState)(!1),[{isUsable:_,signer:q},O]=(0,n.useState)({isUsable:!0,signer:null}),[R,z]=(0,n.useState)(""),[H,$]=(0,n.useState)(!1),L=(0,n.useMemo)((()=>{const e=104857600;if(s.file)return s.file.size>e;if(s.files){let t=0;for(const e of s.files)t+=e.size;return t>e}return!1}),[s]),[B,Z]=(0,n.useState)(""),W=L?i("Do not upload files larger than 100MB!"):B,[U,J]=(0,n.useState)({progress:0,up:!1}),[G,Y]=(0,n.useState)(null),Q=(0,n.useCallback)((e=>{e&&(M(e),P(g.Nn.getPair(e)))}),[M,P]);(0,n.useEffect)((()=>{const e=A?.meta||{},s=e.isExternal||!1,t=e.isHardware||!1,a=e.isInjected||!1,n=!(s||t||a);D({isExternal:s,isHardware:t,isInjected:a}),V(!a&&(A&&A.isLocked||!1)),O({isUsable:n,signer:null}),e.source&&a&&(0,x.R0)(e.source).catch((()=>null)).then((e=>O({isUsable:(0,b.m)(e?.signer?.signRaw),signer:e?.signer||null}))).catch(console.error)}),[A]);const K=(0,n.useCallback)((()=>new Promise(((e,s)=>{(0,f.Y)((()=>{try{A.decodePkcs8(R),e(1)}catch(e){s(e)}}))}))),[A,R]),X=(0,n.useCallback)((()=>{G&&G.cancel(),t()}),[G,t]),ee=(0,n.useCallback)((async()=>{if(Z(""),_&&A)try{$(!0),F&&await K();let e="";e=q&&(0,b.m)(q.signRaw)?(await q.signRaw({address:A.address,data:(0,j.$)(A.address),type:"bytes"})).signature:(0,v.c)(A.sign((0,y.d)(A.address)));const t=`${A.address}:${e}`,a=N.from(t).toString("base64"),n=`Basic ${a}`,o=`Bearer ${a}`,i=p.Z.CancelToken.source();Y(i),J({progress:0,up:!0});const l=new FormData;if(s.file)l.append("file",s.file,s.file.name);else if(s.files)for(const e of s.files)l.append("file",e,e.webkitRelativePath);const u=c.value,d=await p.Z.request({cancelToken:i.token,data:l,headers:{Authorization:n},maxContentLength:104857600,method:"POST",onUploadProgress:({loaded:e,total:s})=>{const t=e/(s||e||1);J({progress:Math.round(99*t),up:!0})},params:{pin:!0},url:`${u}/api/v0/add`});let h;if("string"==typeof d.data){const e=d.data.replace(/}\n{/g,"},{"),s=JSON.parse(`[${e}]`),t=s.length-1;h=s[t],delete s[t],h.items=s}else h=d.data;console.info("upResult:",d),Y(null),J({progress:100,up:!1});const x=m.value;await p.Z.request({data:{cid:h.Hash,name:h.Name},headers:{Authorization:o},method:"POST",url:`${x}/psa/pins`}),r({...h,PinEndpoint:x,UpEndpoint:u})}catch(e){J({progress:0,up:!1}),$(!1),console.error(e),Z(e.message)}}),[s,K,q,F,_,A,m,c,r]),se=(0,n.useCallback)((e=>{const s=l.find((s=>s.value===e));s&&u(s)}),[l,u]),te=(0,n.useCallback)((e=>{const s=d.find((s=>s.value===e));s&&C(s)}),[d,C]);return(0,a.jsxs)(I,{className:e,header:i("Upload File"),onClose:X,open:!0,size:"medium",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{children:(0,a.jsxs)("div",{className:"files",children:[s.file&&(0,a.jsx)(S,{file:s.file}),s.files?.map(((e,s)=>(0,a.jsx)(S,{file:e},`file_item:${s}`)))]})}),(0,a.jsx)(o.u_.Columns,{children:(0,a.jsx)(o.Lt,{isDisabled:H,label:i("Select a Web3 IPFS Gateway"),onChange:se,options:l,value:c.value})}),(0,a.jsx)(o.u_.Columns,{children:(0,a.jsx)(o.Lt,{isDisabled:!0,label:i("Select a Web3 IPFS Pinner"),onChange:te,options:d,value:m.value})}),(0,a.jsxs)(o.u_.Columns,{children:[(0,a.jsx)(o.rp,{defaultValue:E,isDisabled:H,label:i("Please choose account"),labelExtra:(0,a.jsx)(o.Kc,{label:i("transferrable"),params:E}),onChange:Q,type:"account"}),!U.up&&F&&!T&&(0,a.jsx)(o.ro,{isError:!1,label:i("password"),onChange:z,value:R}),(0,a.jsx)(w,{className:"progress",progress:U.progress}),W&&(0,a.jsx)(o.oy,{content:W})]})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.zx,{icon:"arrow-circle-up",isBusy:H,isDisabled:L,label:i("Sign and Upload"),onClick:ee})})]})})),P=(0,o.zo)(o.qi)` + .copySpan { + display: none; + } +`,E=o.zo.tr` + height: 3.5rem; + + .end { + text-align: end; + } + + .actions { + display: flex; + justify-content: flex-end; + align-items: center; + } +`,M=(e,s=6)=>e.length>2*s?`${e.substring(0,s)}...${e.substring(e.length-s)}`:e;function T(e){return`${e.UpEndpoint||"https://ipfs.io"}/ipfs/${e.Hash}?filename=${e.Name}`}const D=e=>()=>{window.open(T(e),"_blank")},F=()=>{},V=o.zo.main` + h1 { + text-transform: unset !important; + } + + .uploadBtn { + position: relative; + padding: 5px 0; + + &:hover { + .uploadMenu { + display: block; + } + } + } + + .uploadMenu { + z-index: 200; + display: none; + background-color: white; + position: absolute; + top: 43px; + left: 0; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.4); + border-radius: 4px; + overflow: hidden; + line-height: 40px; + + .menuItem { + cursor: pointer; + padding: 0 2rem; + display: flex; + align-items: center; + white-space: nowrap; + + &:hover { + background-color: var(--bg-page); + } + } + } +`,_=n.memo((function({className:e}){const{t:s}=h(),{queueAction:t}=(0,l.L)(),[r,c]=(0,n.useState)(!1),m=function(){const[e,s]=(0,n.useState)(d),[t,a]=(0,n.useState)(!0);(0,n.useEffect)((()=>{try{const e=u().get("files",d);e!==d&&s(e),a(!1)}catch(e){a(!1),console.error(e)}}),[]);const o=(0,n.useCallback)((t=>{const a={...e,files:t};s(a),u().set("files",a)}),[e]);return(0,n.useMemo)((()=>({...e,isLoad:t,setFiles:o})),[e,o,t])}(),[p,x]=(0,n.useState)(void 0),g=(0,n.useRef)(null),b=(0,n.useCallback)(((e=!1)=>{g.current&&(g.current.webkitdirectory=e,g.current.multiple=e,g.current.click())}),[g]),f=(0,n.useCallback)((()=>b(!1)),[b]),j=(0,n.useCallback)((()=>b(!0)),[b]),v=(0,n.useCallback)((e=>{const a=e.target.files;if(a)if(a.length>2e3)t({action:"Upload Folder",message:s("Please do not upload more than 2000 files"),status:"error"});else if(0!==a.length){if(e.target.webkitdirectory){if(a.length>=1){const e=[];for(let s=0,t=a.length;s{t&&t({action:s("Import files"),message:e,status:a})}),[t,s]),C=(0,n.useRef)(null),w=(0,n.useCallback)((()=>{C.current&&C.current.click()}),[C]),N=(0,n.useCallback)((e=>{try{y(s("Importing"));const t=new FileReader,a=e.target.files;if(!a)return;if(t.readAsText(a[0],"UTF-8"),!/(.json)$/i.test(e.target.value))return y(s("file error"),"error");t.onload=e=>{const t=JSON.parse(e.target?.result);if(!Array.isArray(t))return y(s("file content error"),"error");const a=[],n={};for(const e of t)e.Hash&&e.Name&&e.UpEndpoint&&e.PinEndpoint&&(a.push(e),n[e.Hash]=!0);const o=m.files.filter((e=>!n[e.Hash]));m.setFiles([...a,...o]),y(s("Import Success"),"success")}}catch{y(s("file content error"),"error")}}),[m,y,s]),k=(0,n.useCallback)((()=>{c(!1)}),[]),S=(0,n.useCallback)((e=>{c(!1);const s=m.files.filter((s=>s.Hash!==e.Hash));m.setFiles([e,...s])}),[m]),I=(0,n.useCallback)((()=>{const e=new Blob([JSON.stringify(m.files)],{type:"application/json; charset=utf-8"});i().saveAs(e,"files.json")}),[m]);return(0,a.jsxs)(V,{className:e,children:[(0,a.jsx)("header",{}),(0,a.jsx)("input",{onChange:v,ref:g,style:{display:"none"},type:"file"}),(0,a.jsx)("input",{onChange:N,ref:C,style:{display:"none"},type:"file"}),p&&r&&(0,a.jsx)(A,{file:p,onClose:k,onSuccess:S}),(0,a.jsxs)("div",{style:{display:"flex",paddingBottom:"1.5rem"},children:[(0,a.jsxs)("div",{className:"uploadBtn",children:[(0,a.jsx)(o.zx,{icon:"upload",label:s("Upload"),onClick:F}),(0,a.jsxs)("div",{className:"uploadMenu",children:[(0,a.jsx)("div",{className:"menuItem",onClick:f,children:s("File")}),(0,a.jsx)("div",{className:"menuItem",onClick:j,children:s("Folder")})]})]}),(0,a.jsx)("div",{style:{flex:1}}),(0,a.jsx)(o.zx,{icon:"file-import",label:s("Import"),onClick:w}),(0,a.jsx)(o.zx,{icon:"file-export",label:s("Export"),onClick:I})]}),(0,a.jsx)(o.iA,{empty:s("No files"),emptySpinner:s("Loading"),header:[[s("files"),"start",2],[s("file cid"),"expand",2],[void 0,"start"],[s("file size"),"expand",2],[s("status"),"expand"],[s("action"),"expand"],[]],children:m.files.map(((e,t)=>(0,a.jsxs)(E,{children:[(0,a.jsxs)("td",{className:"",colSpan:2,children:[e.items&&(0,a.jsx)(o.JO,{className:"highlight--color",icon:"folder"}),M(e.Name)]}),(0,a.jsx)("td",{className:"end",colSpan:2,children:e.Hash}),(0,a.jsx)("td",{className:"",colSpan:1,children:(0,a.jsx)(P,{value:e.Hash,children:(0,a.jsx)(o.Ct,{color:"highlight",hover:s("Copy file cid"),icon:"copy"})})}),(0,a.jsx)("td",{className:"end",colSpan:2,children:`${e.Size} bytes`}),(0,a.jsx)("td",{className:"end",colSpan:1,children:(0,a.jsx)("a",{href:"https://apps.crust.network/?rpc=wss%3A%2F%2Frpc.crust.network#/storage_files",rel:"noreferrer",target:"_blank",children:s("View status in Crust")})}),(0,a.jsx)("td",{className:"end",colSpan:1,children:(0,a.jsxs)("div",{className:"actions",children:[!e.items&&(0,a.jsx)(o.Ct,{color:"highlight",hover:s("Download"),icon:"download",onClick:D(e)}),(0,a.jsx)(P,{value:T(e),children:(0,a.jsx)(o.Ct,{color:"highlight",hover:s("Copy link"),icon:"copy"})})]})}),(0,a.jsx)("td",{colSpan:1})]},`files_item-${t}`)))}),(0,a.jsx)("div",{children:s("Note: The file list is cached locally, switching browsers or devices will not keep displaying the original browser information.")})]})})),q=n.memo((function({basePath:e,className:s}){const{t}=h(),r=(0,n.useRef)([{isRoot:!0,name:"crust",text:t("Your Files")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:r.current}),(0,a.jsx)(_,{})]})}))},79865:(e,s,t)=>{t.d(s,{Z:()=>E});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(34814),c=t(74065),u=t(11677);const d=(0,u.e)("useProxies",(function(){const{api:e}=(0,i.h)(),{allAccounts:s}=(0,l.x)(),t=(0,c.X)(),[a,o]=(0,n.useState)({});return(0,n.useEffect)((()=>{s.length&&e.query.proxy.proxies.multi(s).then((e=>t.current&&o(e.map((([e],t)=>[s[t],e.map((({delegate:e})=>e.toString()))])).filter((([,e])=>e.length)).reduce(((e,[s,t])=>({...e,[s]:t})),{})))).catch(console.error)}),[s,e,t]),a}));var m=t(38894),h=t(67609),p=t(95292),x=t(61349);function g(){return(0,x.$G)("app-gilt")}const b=n.memo((function({className:e,isDisabled:s,proxies:t}){const{t:o}=g(),{api:l}=(0,i.h)(),[c,u]=(0,m.O)(),[d,x]=(0,n.useState)(null),[b,f]=(0,n.useState)(null),[j,v]=(0,n.useState)(),[y,C]=(0,n.useState)(),w=(0,n.useMemo)((()=>d&&j&&y?l.tx.proxy.proxy(d,null,l.tx.gilt.placeBid(j,y)):null),[l,d,j,y]),N=Object.keys(t),k=!j||j.isZero()||j.lt(l.consts.gilt.minFreeze),S=!y||!y.gte(p.If)||y.gt(l.consts.gilt.queueCount);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!N.length||s,label:o("Submit Bid"),onClick:u}),c&&(0,a.jsxs)(r.u_,{className:e,header:o("submit gilt bid"),onClose:u,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsxs)(r.u_.Columns,{hint:o("This account will make the bid for the gilt and pay all associated fees."),children:[(0,a.jsx)(r.rp,{filter:N,label:o("use proxied account"),labelExtra:(0,a.jsx)(h.Z,{label:(0,a.jsx)("span",{className:"label",children:o("transferrable")}),params:d}),onChange:x,type:"account"}),d&&(0,a.jsx)(r.rp,{filter:t[d],label:o("send via proxy"),onChange:f,type:"account"})]}),(0,a.jsxs)(r.u_.Columns,{hint:o("The amount you wish to lock for the duration. It needs to be more than the gilt minimum."),children:[(0,a.jsx)(r.H,{autoFocus:!0,defaultValue:l.consts.gilt.minFreeze,isError:k,isZeroable:!1,label:o("bid amount"),onChange:v}),(0,a.jsx)(r.H,{defaultValue:l.consts.gilt.minFreeze,isDisabled:!0,label:o("minimum freeze amount")})]}),(0,a.jsxs)(r.u_.Columns,{hint:o("The number of periods this bid is to be freezed for, less than the maximum period"),children:[(0,a.jsx)(r.Rn,{defaultValue:p.If,isError:S,isZeroable:!1,label:o("lock periods"),onChange:C}),(0,a.jsx)(r.Rn,{defaultValue:l.consts.gilt.queueCount,isDisabled:!0,label:o("maximum lock periods")})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:b,extrinsic:w,icon:"check",isDisabled:k||S||!d,label:o("Bid"),onStart:u})})]})]})}));var f=t(58607),j=t(14681);const v=n.memo((function({className:e,value:{balance:s,index:t,numItems:n}}){return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:t}),(0,a.jsx)("td",{className:"number all",children:(0,j.u)(n)}),(0,a.jsx)("td",{className:"all",children:(0,a.jsx)(f.Z,{value:s})})]})})),y=n.memo((function({className:e,queueTotals:s}){const{t}=g(),o=(0,n.useRef)([[t("queues"),"start"],[t("participants"),"number"],[t("balance"),"number"]]);return(0,a.jsx)(r.iA,{className:e,empty:s&&t("No active gilt queues found."),header:o.current,children:s?.map((e=>(0,a.jsx)(v,{value:e},e.index)))})}));var C=t(54383),w=t(48801);const N=new(t.n(w)())(1e4),k=n.memo((function({activeTotal:e,className:s,isDisabled:t}){const{t:n}=g(),{api:o}=(0,i.h)(),l=(0,C.C)();return(0,a.jsxs)(r.Ty,{className:s,children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:n("active"),children:n(t?"no":"yes")}),e&&(0,a.jsx)(r.Jy,{label:n("index"),children:(0,j.u)(e.index)})]}),e&&(0,a.jsxs)("section",{children:[(0,a.jsxs)(r.Jy,{label:n("proportion"),children:[(e.proportion.mul(N).imul(p.S8).div(p.Wi).toNumber()/1e4).toFixed(2),"%"]}),(0,a.jsxs)(r.Jy,{label:n("target"),children:[(e.target.mul(N).imul(p.S8).div(p.Wi).toNumber()/1e4).toFixed(2),"%"]})]}),(0,a.jsx)("section",{children:l&&(0,a.jsx)(r.Jy,{label:n("intake"),progress:{total:o.consts.gilt.intakePeriod,value:l.mod(o.consts.gilt.intakePeriod),withTime:!0}})})]})}));var S=t(54890);const I={defaultValue:{},transform:([e,s])=>({activeIndex:e.index.isZero()?null:e.index.sub(p.If),activeTotal:e,queueTotals:s.map((([e,s],t)=>({balance:s,index:t+1,numItems:e}))).filter((({balance:e})=>!e.isZero()))})},A=(0,u.e)("useInfo",(function(){const{api:e}=(0,i.h)(),s=(0,S.L)([e.query.gilt.activeTotal,e.query.gilt.queueTotals],I);return(0,n.useMemo)((()=>({info:s})),[s])})),P=n.memo((function({className:e}){const s=d(),{info:t}=A(),o=(0,n.useMemo)((()=>!t?.activeTotal||t.activeTotal.target.isZero()),[t]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(k,{activeTotal:t?.activeTotal,isDisabled:o}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(b,{isDisabled:o,proxies:s})}),(0,a.jsx)(y,{queueTotals:t?.queueTotals})]})})),E=n.memo((function({basePath:e,className:s}){const{t}=g(),i=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,items:i.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsx)(o.AW,{path:e,children:(0,a.jsx)(o.AW,{element:(0,a.jsx)(P,{}),index:!0})})})]})}))},30145:(e,s,t)=>{t.d(s,{Z:()=>D});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(38894),l=t(59046),c=t(34100),u=t(14714),d=t(71703);const m={children:"Storage",color:"blue",size:"tiny"},h=[{value:"rpcNetworkAuthoring",text:"Get authoring information",label:{color:"pink",children:"RPC",size:"tiny"},code:"// Returns all pending extrinsics, potentially grouped by sender\nconst unsub = await api.rpc.author.pendingExtrinsics((extrinsics) => {\n if(extrinsics.length === 0){\n console.log('No pending extrinsics');\n return;\n }\n console.log(extrinsics);\n});"},{value:"rpcListenToHead",text:"Listen to new Head",label:{color:"pink",children:"RPC",size:"tiny"},code:"// subscribe to new headers, printing the full info for 5 Blocks\nlet count = 0;\nconst unsub = await api.rpc.chain.subscribeNewHeads((header) => {\n console.log(`#${header.number}:`, header);\n\n if (++count === 5) {\n console.log('5 headers retrieved, unsubscribing');\n unsub();\n }\n});"},{value:"rpcQueryState",text:"Get state metadata",label:{color:"pink",children:"RPC",size:"tiny"},code:"// retrieve and log the complete metadata of your node\nconst metadata = await api.rpc.state.getMetadata();\n\nconsole.log('version: ' + metadata.version);\nconsole.log('formatted: ' + JSON.stringify(metadata.asLatest.toHuman(), null, 2));\n"},{value:"rpcSystemInfo",text:"Get system information",label:{color:"pink",children:"RPC",size:"tiny"},code:"// Retrieve the chain & node information information via rpc calls\nconst [chain, nodeName, nodeVersion, properties] = await Promise.all([\n api.rpc.system.chain(),\n api.rpc.system.name(),\n api.rpc.system.version(),\n api.rpc.system.properties()\n]);\nconsole.log('You are connected to chain ' + chain)\nconsole.log('You are using: ' + nodeName + ' v' + nodeVersion);\n\nif (properties.size > 0) {\n console.log('Node specific properties:');\n properties.forEach((value, key) => {\n console.log(key, value);\n });\n} else {\n console.log('No specific chain properties found.');\n}"},{code:"// Get chain state information\n// Make our basic chain state / storage queries, all in one go\n\nconst [now, minimumValidatorCount, validators] = await Promise.all([\n api.query.timestamp.now(),\n api.query.staking.minimumValidatorCount(),\n api.query.session.validators()\n]);\n\nconsole.log('The current date is: ' + now);\nconsole.log('The minimum validator count: ' + minimumValidatorCount);\n\nif (validators && validators.length > 0) {\n // Retrieve the balances for all validators\n console.log('Validators');\n\n const validatorBalances = await Promise.all(\n validators.map((authorityId) => api.query.system.account(authorityId))\n );\n\n validators.forEach((authorityId, index) => {\n console.log('Validator: ' + authorityId.toString() )\n console.log('AccountData: ' + validatorBalances[index].toHuman() );\n });\n}\n",label:m,text:"Get chain state information",value:"storageGetInfo"},{code:"// Subscribe to system events via storage\napi.query.system.events((events) => {\n console.log('----- Received ' + events.length + ' event(s): -----');\n // loop through the Vec\n events.forEach((record) => {\n // extract the phase, event and the event types\n const { event, phase } = record;\n const types = event.typeDef;\n // show what we are busy with\n console.log(event.section + ':' + event.method + '::' + 'phase=' + phase.toString());\n console.log(event.meta.docs.toString());\n // loop through each of the parameters, displaying the type and data\n event.data.forEach((data, index) => {\n console.log(types[index].type + ';' + data.toString());\n });\n });\n});",label:m,text:"Listen to system events",value:"storageSystemEvents"},{code:"// You may leave this example running and make a transfer\n// of any value from or to Alice address in the 'Transfer' App\nconst ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';\n\n// Retrieve the initial data\nlet [, { free: previous }] = await api.query.system.account(ALICE);\n\nconsole.log('ALICE has a balance of ' + previous);\n\n// Subscribe and listen to balance changes\napi.query.system.account(ALICE, ([, { free }]) => {\n // Calculate the delta\n const change = free.sub(previous);\n // Only display positive value changes (Since we are pulling 'previous' above already,\n // the initial balance change will also be zero)\n if (!change.isZero()) {\n previous = free;\n console.log('New transaction of: '+ change);\n }\n});",label:m,text:"Listen to balance changes",value:"storageListenToBalanceChange"},{code:"// You may leave this example running and make a transfer\n// of any value from or to Alice/Bob address in the 'Transfer' App\nconst ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';\nconst BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';\n\nconsole.log('Tracking balances for:', [ALICE, BOB])\n\n// Subscribe and listen to several balance changes\napi.query.system.account.multi([ALICE, BOB], (info) => {\n console.log('Change detected, new balances: ', info)\n});",label:m,text:"Listen to multiple balances changes",value:"storageListenToMultipleBalancesChange"},{code:"// This example set shows how to make queries at a point\nconst ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';\n\n// retrieve the balance, once-off at the latest block\nconst { data: { free } } = await api.query.system.account(ALICE);\n\nconsole.log('Alice has a current balance of', free.toHuman());\n\n// retrieve balance updates with an optional value callback\nconst balanceUnsub = await api.query.system.account(ALICE, ({ data: { free } }) => {\n console.log('Alice has an updated balance of', free.toHuman());\n});\n\n// retrieve the balance at a block hash in the past\nconst header = await api.rpc.chain.getHeader();\nconst prevHash = await api.rpc.chain.getBlockHash(header.number.unwrap().subn(42));\nconst { data: { free: prev } } = await api.query.system.account.at(prevHash, ALICE);\n\nconsole.log('Alice had a balance of', prev.toHuman(), '(42 blocks ago)');\n\n// useful in some situations - the value hash and storage entry size\nconst currHash = await api.query.system.account.hash(ALICE);\nconst currSize = await api.query.system.account.size(ALICE);\n\nconsole.log('Alice account entry has a value hash of', currHash, 'with a size of', currSize);",label:m,text:"Retrieve historic query data",value:"storageRetrieveInfoOnQueryKeys"},{code:"// this example shows how to retrieve the hex representation of a storage key\n\nconst ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';\n\n// show the key for an entry without arguments\nconsole.log(api.query.timestamp.now.key());\n\n// show the key for a map entry (single argument)\nconsole.log(api.query.system.account.key(ALICE));\n\n// show the key prefix for a map\nconsole.log(api.query.system.account.keyPrefix());\n\n// show the key for a double map\nconsole.log(api.query.staking.erasStakers.key(0, ALICE));\n\n// show the key prefix for a doublemap\nconsole.log(api.query.staking.erasStakers.keyPrefix());\n",label:m,text:"Get underlying storage key hex values",value:"storageKeys"},{value:"constsStakingParameters",text:"Get staking parameters",label:{color:"green",children:"Consts",size:"tiny"},code:"// Get SRML staking parameters as consts\n// 'parameter_types' were added to substrate with spec_version: 101.\n// This example will throw an error if used with versions before that.\n\nconst bondingDuration = api.consts.staking.bondingDuration;\nconst sessionsPerEra = api.consts.staking.sessionsPerEra;\n\nconsole.log('Staking bonding duration: ' + bondingDuration);\nconsole.log('Staking sessions per era: ' + sessionsPerEra);"},{value:"extrinsicMakeTransfer",text:"Make transfer and listen to events",label:{color:"grey",children:"Extrinsics",size:"tiny"},code:"// Make a transfer from Alice to Bob and listen to system events.\n// You need to be connected to a development chain for this example to work.\nconst ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';\nconst BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';\n\n// Get a random number between 1 and 100000\nconst randomAmount = Math.floor((Math.random() * 100000) + 1);\n\n// Create a extrinsic, transferring randomAmount units to Bob.\nconst transfer = api.tx.balances.transferAllowDeath(BOB, randomAmount);\n\n// Sign and Send the transaction\nawait transferAllowDeath.signAndSend(ALICE, ({ events = [], status }) => {\n if (status.isInBlock) {\n console.log('Successful transfer of ' + randomAmount + ' with hash ' + status.asInBlock.toHex());\n } else {\n console.log('Status of transfer: ' + status.type);\n }\n\n events.forEach(({ phase, event: { data, method, section } }) => {\n console.log(phase.toString() + ' : ' + section + '.' + method + ' ' + data.toString());\n });\n});"}];var p=t(61349);function x(){return(0,p.$G)("app-js")}const g=n.memo((function({className:e="",isCustomExample:s,isRunning:t,removeSnippet:r,runJs:i,saveSnippet:l,stopJs:c}){const{t:u}=x(),[d,m]=(0,n.useState)(""),h=(0,n.useCallback)((e=>m(e)),[]),p=(0,n.useCallback)((()=>{m("")}),[]),g=(0,n.useCallback)((()=>{l(d),p()}),[p,l,d]);return(0,a.jsxs)(o.zx.Group,{className:`${e} action-button`,children:[s?(0,a.jsx)(o.zx,{icon:"trash",onClick:r}):(0,a.jsx)(o.GI,{className:"popup-local",onCloseAction:p,value:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.II,{autoFocus:!0,maxLength:50,min:1,onChange:h,onEnter:g,placeholder:u("Name your example"),value:d,withLabel:!1}),(0,a.jsx)(o.zx,{icon:"save",isDisabled:!d.length,label:u("Save snippet to local storage"),onClick:g})]}),children:(0,a.jsx)(o.zx,{icon:"save",isReadOnly:!1})}),t?(0,a.jsx)(o.zx,{icon:"times",onClick:c}):(0,a.jsx)(o.zx,{className:"play-button",icon:"play",onClick:i})]})})),b="polkadot-app-js-examples",f="polkadot-app-js-selected",j={children:"Custom",color:"orange",size:"tiny"};var v=t(12909),y=t(1346),C=t(17751);const w=e=>(0,v.V)(e)?e.stack?e.stack:e.toString():(0,y.o)(e)?"undefined":(0,C.F)(e)?"null":Array.isArray(e)?`[${e.map(w).join(", ")}]`:e instanceof Map?`{${[...e.entries()].map((([e,s])=>`${e.toString()}: ${w(s)}`)).join(", ")}}`:e.toString(),N=({args:e,type:s},t)=>{try{return(0,a.jsx)("div",{className:`js--Log ${s}`,children:e.map(w).join(" ")},t)}catch(e){return(0,a.jsxs)("div",{className:`js--Log ${s} error`,children:["Internal error: ",e.stack||e.message]},t)}},k=o.zo.article` + background-color: #4e4e4e; + color: #ffffff; + display: flex; + flex-direction: column; + flex-grow: 1; + font: var(--font-mono); + font-variant-ligatures: common-ligatures; + line-height: 18px; + padding: 50px 10px 10px; + position: relative; + width: 40%; + + .logs-wrapper { + display: flex; + flex: 1; + min-height: 0; + } + + .logs-container { + flex: 1; + overflow: auto; + } + + .logs-content { + height: auto; + } + + .js--Log { + animation: fadein 0.2s; + margin: 0 0 5px 0; + word-break: break-all; + + &.error { + color: #f88; + } + } +`,S=n.memo((function({children:e,className:s="",logs:t}){return(0,a.jsxs)(k,{className:`${s} container`,children:[(0,a.jsx)("div",{className:"logs-wrapper",children:(0,a.jsx)("div",{className:"logs-container",children:(0,a.jsx)("pre",{className:"logs-content",children:t.map(N)})})}),e]})})),I=["atob","btoa"],A={Atomics:null,Bluetooth:null,Clipboard:null,Document:null,Function:null,Location:null,ServiceWorker:null,SharedWorker:null,USB:null,global:null,window:null},P=JSON.parse(JSON.stringify(h));let E=!1;const M=o.zo.main` + display: flex; + flex-direction: column; + height: 100vh; + position: relative; + + article { + p:last-child { + margin-bottom: 0; + } + } + + .js--Selection { + margin-bottom: 1rem; + } + + .js--Content { + align-content: stretch; + align-items: stretch; + display: flex; + height: 100%; + justify-content: space-between; + margin-bottom: 0; + } + + .js--Dropdown { + position: relative; + z-index: 200; + + .dropdown .menu > .item { + display: flex; + flex-direction: row-reverse; + justify-content: space-between; + } + } + + .js--Editor, + .js--Output { + min-width: 200px; + + .action-button { + margin: 0; + position: absolute; + right: 0.5rem; + top: 0.5rem; + z-index: 100; + } + } + + .js--Editor { + flex-grow: 1; + overflow: auto; + padding: 0; + position: relative; + resize: horizontal; + width: 60%; + + textarea { + outline: 0; + } + + .codeflask { + background: transparent; + } + + .codeflask--has-line-numbers { + z-index: 0; + } + + .codeflask--has-line-numbers .codeflask__flatten { + font-size: 12px; + line-height: 18px; + min-width: calc(100% - 40px); + padding-top: 50px; + width: auto; + } + + .codeflask__lines { + background: #f2f2f2; + line-height: 18px; + padding-top: 50px; + z-index: 100; + } + + &::after { + bottom: 0; + content: '↔'; + cursor: col-resize; + font-size: 20px; + height: 20px; + line-height: 18px; + position: absolute; + right: 0; + width: 22px; + z-index: 1; + } + } + + .ui.popup.popup-local { + display: flex; + flex: 1 1 100%; + max-width: 300px; + } + + .warnOverlay { + left: 0; + position: absolute; + right: 0; + top: -0.25rem; + z-index: 202; + + article p:first-child { + padding-top: 1rem; + } + + .ui--Button-Group { + margin-bottom: 0; + } + } +`,T=n.memo((function({basePath:e,className:s=""}){const{t}=x(),m=(0,r.h)(),h=(0,n.useRef)(null),[p,v]=(0,n.useState)(""),[y,C]=(0,n.useState)(!1),[w,N]=(0,n.useState)(!1),[k,T]=(0,i.O)(!0),[D,F]=(0,n.useState)([]),[V,_]=(0,n.useState)([]),[q,O]=(0,n.useState)([]),[R,z]=(0,n.useState)(P[0]),H=(0,n.useRef)([{isRoot:!0,name:"playground",text:t("Console")}]);(0,n.useEffect)((()=>{E||(P.forEach((e=>{e.code=`${function(e){const s=`api, hashing, ${e?"keyring, ":""}types, util`;return`// All code is wrapped within an async closure,\n// allowing access to ${s}.\n// (async ({ ${s} }) => {\n// ... any user code is executed here ...\n// })();\n\n`}(m.isDevelopment)}${e.code}`})),E=!0);const e={examples:localStorage.getItem(b),selectedValue:localStorage.getItem(f)},s=e.examples?JSON.parse(e.examples):[],t=[...s,...P],a=t.find((s=>s.value===e.selectedValue));F(s),C(a&&"custom"===a.type||!1),O(t),z(a||P[0])}),[]),(0,n.useEffect)((()=>{v(R.code)}),[R]);const $=(0,n.useCallback)((()=>_([])),[]),L=(0,n.useCallback)(((e,s)=>{V.push({args:s,type:e}),_(V.slice(0))}),[V]),B=(0,n.useCallback)((()=>{h.current&&(h.current.api.disconnect().catch(console.error),h.current=null),N(!1)}),[]),Z=(0,n.useCallback)((()=>{(async function(){N(!0),$(),h.current=function({api:e,isDevelopment:s},t,a){return{...Object.keys(window).filter((e=>!e.includes("-")&&!I.includes(e))).reduce(((e,s)=>(e[s]=null,e)),{...A}),api:e.clone(),console:{error:(...e)=>a("error",e),log:(...e)=>a("log",e)},hashing:d,keyring:s?c.ZP.keyring:null,setIsRunning:t,types:l,uiKeyring:s?c.ZP:null,util:u}}(m,N,L),await h.current.api.isReady;try{const e=`(async ({${Object.keys(h.current).sort().join(",")}}) => { try { ${p} \n } catch (error) { console.error(error); setIsRunning(false); } })(injected);`;new Function("injected",e).bind({},h.current)()}catch(e){h.current.console.error(e)}N(!1)})().catch(console.error)}),[$,L,m,p]),W=(0,n.useCallback)((e=>{if(B(),e.length){const s=q.find((s=>s.value===e));s&&(localStorage.setItem(f,e),$(),C("custom"===s.type),z(s))}}),[$,B,q]),U=(0,n.useCallback)((()=>{const e=D.filter((e=>e.value!==R.value)),s=[...e,...P];F(e),C("custom"===s[0].type),O(s),W(s[0].value),localStorage.setItem(b,JSON.stringify(e))}),[W,D,R.value]),J=(0,n.useCallback)((e=>{const s={code:p,label:j,text:e,type:"custom",value:`custom-${Date.now()}`},t=[s,...D,...P];localStorage.setItem(b,JSON.stringify([s,...D])),F([s,...D]),C(!0),O(t),z(s)}),[p,D]),G="custom"===R.type?R.text:void 0;return(0,a.jsxs)(M,{className:`${s} js--App`,children:[(0,a.jsx)(o.mQ,{basePath:e,items:H.current}),(0,a.jsx)("section",{className:"js--Selection",children:(0,a.jsx)(o.Lt,{className:"js--Dropdown",isFull:!0,label:t("Select example"),onChange:W,options:q,value:R.value})}),(0,a.jsxs)("section",{className:"js--Content",children:[(0,a.jsxs)("article",{className:"container js--Editor",children:[(0,a.jsx)(g,{isCustomExample:y,isRunning:w,removeSnippet:U,runJs:Z,saveSnippet:J,snippetName:G,stopJs:B}),(0,a.jsx)(o.ML,{code:p,onEdit:v})]}),(0,a.jsx)(S,{className:"js--Output",logs:V,children:(0,a.jsx)(o.zx,{className:"action-button",icon:"eraser",onClick:$})})]}),k&&(0,a.jsx)("div",{className:"warnOverlay",children:(0,a.jsxs)("article",{className:"warning centered",children:[(0,a.jsx)("p",{children:t("This is a developer tool that allows you to execute selected snippets in a limited context.")}),(0,a.jsx)("p",{children:t("Never execute JS snippets from untrusted sources.")}),(0,a.jsx)("p",{children:t("Unless you are a developer with insight into what the specific script does to your environment (based on reading the code being executed) generally the advice would be to not use this environment.")}),(0,a.jsx)(o.zx.Group,{children:(0,a.jsx)(o.zx,{icon:"times",label:t("Close"),onClick:T})})]})})]})})),D=n.memo((function(e){return(0,a.jsx)(T,{...e})}))},51213:(e,s,t)=>{t.d(s,{Z:()=>r});var a=t(52322),n=t(2784),o=t(95499);const r=n.memo((function({basePath:e,className:s}){return(0,a.jsx)(o.Z,{basePath:e,className:s,type:"membership"})}))},16743:(e,s,t)=>{t.d(s,{Z:()=>i});var a=t(90778),n=t(9118),o=t(11677);const r={transform:e=>e.length},i=(0,o.e)("useCounter",(function(){const{api:e,isApiReady:s}=(0,a.h)();return(0,n.W7)(s&&e.query.membership?.proposals,void 0,r)||0}))},50313:(e,s,t)=>{t.d(s,{Z:()=>q});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(34814),l=t(14681),c=t(61349);function u(){return(0,c.$G)("app-nfts")}const d=n.memo((function({className:e,collectionName:s,value:{account:t,id:n,ipfsData:o}}){const i=o?.name||s,l=o?.image?`https://ipfs.io/ipfs/${o.image}`:"";return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:n}),(0,a.jsx)("td",{className:"together all",children:i&&l?(0,a.jsx)(r.JH,{href:l,icon:"braille",label:i,rel:"noopener",target:"_blank"}):i}),(0,a.jsx)("td",{className:"address media--1000",children:(0,a.jsx)(r.N,{value:t})})]})}));var m=t(74065),h=t(90778),p=t(11677);const x=(0,p.e)("useAccountItems",(function(){const e=(0,m.X)(),{api:s}=(0,h.h)(),{allAccounts:t}=(0,i.x)(),[a,o]=(0,n.useState)();return(0,n.useEffect)((()=>{if(!t.length)return;const a=t.map((e=>s.query.uniques.account.keys(e)));Promise.all(a).then((s=>e.current&&o(function(e){return e.filter((e=>!!e.length)).map((e=>e.map((e=>{const[s,t,a]=e.args;return{accountId:s,collectionId:t,itemId:a}})))).flat()}(s)))).catch(console.error)}),[t,s.query.uniques.account,e]),a}));var g=t(9118),b=t(67239);const f={withParams:!0},j={transform:e=>{if(!e)return null;try{const s=JSON.parse(e);if(s&&"object"==typeof s)return{image:"string"==typeof s.image?s.image.replace(/ipfs:\/\/|ipfs\//gi,""):null,name:"string"==typeof s.name?s.name:null}}catch{}return null}},v=(0,p.e)("useItemsInfos",(function(e){const{api:s}=(0,h.h)(),[t,a]=(0,n.useState)(),o=(0,n.useMemo)((()=>e.map((({collectionId:e,itemId:s})=>[e,s]))),[e]),r=(0,g.W7)(s.query.uniques.instanceMetadataOf.multi,[o],f),i=(0,n.useMemo)((()=>{if(r?.[1].length)return r[1].map((e=>e.isSome?e.unwrap().data.toPrimitive():""))}),[r]),l=(0,b.g)(i,j);return(0,n.useEffect)((()=>{if(l&&e.length&&r?.[0][0].length){const[s]=r[0][0][0];if(!s.eq(o[0][0]))return;const t=r[0][0].map(((s,t)=>function([,e],s,t){const a=t.find((({itemId:s})=>s.eq(e)));if(!a)throw new Error("Unable to extract accountId");return{account:a.accountId,id:e,ipfsData:null,key:e.toString(),metadata:s.unwrapOr(null)}}(s,r[1][t],e)));a(t.map((e=>s=>{const t=s.metadata?.data.toString();return{...s,ipfsData:t&&e.has(t)&&e.get(t)||null}})(l)))}}),[e,o,l,r]),t})),y=r.zo.div` + table { + overflow: auto; + } +`,C=n.memo((function({className:e,infos:s=[]}){const{t}=u(),o=` - ${t("no name")} -`,[i,c]=(0,n.useState)(0),[m,h]=(0,n.useState)(null),p=x(),g=(0,n.useMemo)((()=>m&&p?p.filter((({collectionId:e})=>e.eq(m.id))):[]),[m,p]),b=v(g),f=m?.ipfsData?.name||o,j=(0,n.useMemo)((()=>p?s.filter((e=>!(!e.details||!e.metadata)&&p.some((({collectionId:s})=>e.id.eq(s))))).sort(((e,s)=>e.id.cmp(s.id))):[]),[s,p]),C=(0,n.useMemo)((()=>j.map((({id:e,ipfsData:s},t)=>({text:`${s?.name||o} (ID: ${(0,l.u)(e)})`,value:t})))),[j,o]),w=(0,n.useRef)([[t("items"),"start",2],[t("owner"),"address media--1000"]]);return(0,n.useEffect)((()=>{h((()=>i>=0&&i(0,a.jsx)(d,{collectionName:f,value:e},e.key)))})})})),w=n.memo((function({className:e,value:{details:s,id:t,ipfsData:n}}){const{t:o}=u(),i=n?.name||"",c=n?.image?`https://ipfs.io/ipfs/${n.image}`:"";return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:t}),(0,a.jsx)("td",{className:"together all",children:i&&c?(0,a.jsx)(r.JH,{href:c,icon:"braille",label:i,rel:"noopener",target:"_blank"}):i}),(0,a.jsx)("td",{className:"address media--1000",children:s&&(0,a.jsx)(r.N,{value:s.owner})}),(0,a.jsx)("td",{className:"string",children:s&&s.isFrozen.isTrue&&o("Frozen")}),(0,a.jsx)("td",{className:"number",children:s&&(0,l.u)(s.items||s.instances)})]})})),N=n.memo((function({className:e,infos:s}){const{t}=u(),o=(0,n.useRef)([[t("collections"),"start",2],[t("owner"),"address media--1000"],[t("status")],[t("items")]]);return(0,a.jsx)(r.iA,{className:e,empty:s&&t("No collections found"),header:o.current,children:s?.map((e=>(0,a.jsx)(w,{value:e},e.key)))})})),k=n.memo((function({className:e,numCollections:s}){const{t}=u();return(0,a.jsx)(r.Ty,{className:e,children:(0,a.jsx)(r.Jy,{label:t("collections"),children:(0,l.u)(s)})})})),S=n.memo((function({className:e,ids:s,infos:t}){return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(k,{numCollections:s?.length}),(0,a.jsx)(N,{infos:t})]})}));var I=t(12298),A=t(39824);const P={transform:e=>e.map((({args:[e]})=>e)).sort(((e,s)=>e.cmp(s)))};function E(e){const s=[],t=[];return e.forEach((({event:{data:[e],method:a}})=>{"Created"===a||"ForceCreated"===a?s.push(e):t.push(e)})),{added:s,removed:t}}const M=(0,p.e)("useCollectionIds",(function(){const{api:e}=(0,h.h)(),s=(0,I.k)(e.query.uniques.class,[],P);return(0,A.N)([e.events.uniques.Created,e.events.uniques.Destroyed,e.events.uniques.ForceCreated],E,s)})),T={isAdminMe:!1,isFreezerMe:!1,isIssuerMe:!1,isOwnerMe:!1},D={withParams:!0},F={transform:e=>{if(!e)return null;try{const s=JSON.parse(e);if(s&&"object"==typeof s)return{image:"string"==typeof s.image?s.image.replace(/ipfs:\/\/|ipfs\//gi,""):null,name:"string"==typeof s.name?s.name:null}}catch{}return null}};function V(e,s){const t=s.toString();return e.some((e=>e===t))}const _=(0,p.e)("useCollectionInfos",(function(e){const{api:s}=(0,h.h)(),{allAccounts:t}=(0,i.x)(),a=(0,g.W7)(s.query.uniques.classMetadataOf.multi,[e],D),o=(0,g.W7)(s.query.uniques.class.multi,[e],D),[r,l]=(0,n.useState)(),c=(0,n.useMemo)((()=>a?.[1].length?a[1].map((e=>e.isSome?e.unwrap().data.toPrimitive():"")):[]),[a]),u=(0,b.g)(c,F);return(0,n.useEffect)((()=>{if(u&&o&&a&&o[0][0].length===a[0][0].length){const e=o[0][0].map(((e,s)=>function(e,s,t,a){const n=t.unwrapOr(null);return{...n?{isAdminMe:V(e,n.admin),isFreezerMe:V(e,n.freezer),isIssuerMe:V(e,n.issuer),isOwnerMe:V(e,n.owner)}:T,details:n,id:s,ipfsData:null,key:s.toString(),metadata:a.unwrapOr(null)}}(t,e,o[1][s],a[1][s])));l(e.map((e=>s=>{const t=s.metadata&&s.metadata.data?.toPrimitive();return{...s,ipfsData:t&&e.has(t)&&e.get(t)||null}})(u)))}}),[t,o,e,u,a]),r})),q=n.memo((function({basePath:e,className:s}){const{t}=u(),{hasAccounts:l}=(0,i.x)(),c=M(),d=_(c),m=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")},{name:"my-nfts",text:t("My NFTs")}]),h=(0,n.useMemo)((()=>l&&d&&d.some((({details:e,metadata:s})=>!(!e||!s)))?[]:["my-nfts"]),[l,d]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,hidden:h,items:m.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(C,{infos:d}),path:"my-nfts"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(S,{ids:c,infos:d}),index:!0})]})})]})}))},90992:(e,s,t)=>{t.d(s,{Z:()=>A});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(34814),c=t(74065),u=t(11677);const d=(0,u.e)("useProxies",(function(){const{api:e}=(0,i.h)(),{allAccounts:s}=(0,l.x)(),t=(0,c.X)(),[a,o]=(0,n.useState)({});return(0,n.useEffect)((()=>{s.length&&e.query.proxy.proxies.multi(s).then((e=>t.current&&o(e.map((([e],t)=>[s[t],e.map((({delegate:e})=>e.toString()))])).filter((([,e])=>e.length)).reduce(((e,[s,t])=>({...e,[s]:t})),{})))).catch(console.error)}),[s,e,t]),a}));var m=t(38894),h=t(67609),p=t(95292),x=t(61349);function g(){return(0,x.$G)("app-nis")}const b=n.memo((function({className:e,isDisabled:s,proxies:t}){const{t:o}=g(),{api:l}=(0,i.h)(),[c,u]=(0,m.O)(),[d,x]=(0,n.useState)(null),[b,f]=(0,n.useState)(null),[j,v]=(0,n.useState)(),[y,C]=(0,n.useState)(),w=(0,n.useMemo)((()=>d&&j&&y?l.tx.proxy.proxy(d,null,l.tx.nis.placeBid(j,y)):null),[l,d,j,y]),N=Object.keys(t),k=!j||j.isZero()||j.lt(l.consts.nis.minBid),S=!y||!y.gte(p.If)||y.gt(l.consts.nis.queueCount);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!N.length||s,label:o("Bid via Proxy"),onClick:u}),c&&(0,a.jsxs)(r.u_,{className:e,header:o("submit nis bid"),onClose:u,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsxs)(r.u_.Columns,{hint:o("This account will make the bid for the nis and pay all associated fees."),children:[(0,a.jsx)(r.rp,{filter:N,label:o("use proxied account"),labelExtra:(0,a.jsx)(h.Z,{label:(0,a.jsx)("span",{className:"label",children:o("transferrable")}),params:d}),onChange:x,type:"account"}),d&&(0,a.jsx)(r.rp,{filter:t[d],label:o("send via proxy"),onChange:f,type:"account"})]}),(0,a.jsxs)(r.u_.Columns,{hint:o("The amount you wish to lock for the duration. It needs to be more than the nis minimum."),children:[(0,a.jsx)(r.H,{autoFocus:!0,defaultValue:l.consts.nis.minBid,isError:k,isZeroable:!1,label:o("bid amount"),onChange:v}),(0,a.jsx)(r.H,{defaultValue:l.consts.nis.minBid,isDisabled:!0,label:o("minimum bid amount")})]}),(0,a.jsxs)(r.u_.Columns,{hint:o("The number of periods this bid is to be locked for, less than the maximum period."),children:[(0,a.jsx)(r.Rn,{defaultValue:p.If,isError:S,isZeroable:!1,label:o("lock periods"),onChange:C}),(0,a.jsx)(r.Rn,{defaultValue:l.consts.nis.queueCount,isDisabled:!0,label:o("maximum lock periods")}),!S&&(0,a.jsx)(r.Rn,{defaultValue:l.consts.nis.basePeriod.mul(y),isDisabled:!0,label:o("length of lock (blocks, calculated)")})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:b,extrinsic:w,icon:"check",isDisabled:k||S||!d,label:o("Bid"),onStart:u})})]})]})}));var f=t(58607),j=t(14681);const v=n.memo((function({className:e,value:{balance:s,index:t,numItems:n}}){return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:t}),(0,a.jsx)("td",{className:"number all",children:(0,j.u)(n)}),(0,a.jsx)("td",{className:"number",children:(0,a.jsx)(f.Z,{value:s})})]})})),y=n.memo((function({className:e,queueTotals:s}){const{t}=g(),o=(0,n.useRef)([[t("queues"),"start"],[t("participants"),"number"],[t("balance"),"number"]]);return(0,a.jsx)(r.iA,{className:e,empty:s&&t("No active nis queues found."),header:o.current,children:s?.map((e=>(0,a.jsx)(v,{value:e},e.index)))})}));var C=t(54383);const w=n.memo((function({className:e,info:s}){const{t}=g(),{api:n}=(0,i.h)(),o=(0,C.C)();return(0,a.jsxs)(r.Ty,{className:e,children:[(0,a.jsx)("section",{children:o&&(0,a.jsx)(r.Jy,{label:t("intake"),progress:{total:n.consts.nis.intakePeriod,value:o.mod(n.consts.nis.intakePeriod),withTime:!0}})}),(0,a.jsx)("section",{children:s?.summary&&(0,a.jsx)(r.Jy,{label:t("proportion"),progress:{isPercent:!0,total:p.Wi,value:s.summary.proportionOwed}})})]})}));var N=t(54890);const k={defaultValue:{},transform:([e,s])=>({queueTotals:s.map((([e,s],t)=>({balance:s,index:t+1,numItems:e}))).filter((({balance:e})=>!e.isZero())),summary:e})},S=(0,u.e)("useInfo",(function(){const{api:e}=(0,i.h)(),s=(0,N.L)([e.query.nis.summary,e.query.nis.queueTotals],k);return(0,n.useMemo)((()=>({info:s})),[s])})),I=n.memo((function({className:e}){const s=d(),{info:t}=S(),n=!t?.summary||t.summary.proportionOwed.isZero();return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(w,{info:t,isDisabled:n}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(b,{isDisabled:!0,proxies:s})}),(0,a.jsx)(y,{queueTotals:t?.queueTotals})]})})),A=n.memo((function({basePath:e,className:s}){const{t}=g(),i=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,items:i.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsx)(o.AW,{path:e,children:(0,a.jsx)(o.AW,{element:(0,a.jsx)(I,{}),index:!0})})})]})}))},9847:(e,s,t)=>{t.d(s,{Z:()=>g});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(41411),l=t(18837),c=t(67609),u=t(95292),d=t(33661),m=t(58464);const h=Number.MAX_SAFE_INTEGER,p=["xcm","xcmPallet","polkadotXcm"];function x({paraId:e,text:s,ui:t}){return{text:(0,a.jsxs)("div",{className:"ui--Dropdown-item",children:[(0,a.jsx)(o.Mj,{className:"ui--Dropdown-icon",logo:t.logo}),(0,a.jsx)("div",{className:"ui--Dropdown-name",children:s})]},e),value:e||-1}}const g=n.memo((function({onClose:e}){const{t:s}=(0,m.$)(),{api:t}=(0,r.h)(),[g,b]=(0,n.useState)(u.nw),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[C,w]=(0,n.useState)(h),{allowTeleport:N,destinations:k,isParaTeleport:S,oneWay:I}=(0,i.M)(),A=(0,n.useMemo)((()=>{const e=p.filter((e=>t.tx[e]&&(0,d.m)(t.tx[e].limitedTeleportAssets)))[0];return t.tx[e].limitedTeleportAssets}),[t]),P=(0,n.useMemo)((()=>k.map(x)),[k]),E=(0,n.useMemo)((()=>k.find((({paraId:e},s)=>-1===C?0===s:C===e))?.value),[k,C]),M=(0,l.J)(E),T=(0,n.useMemo)((()=>[{V3:S?{interior:"Here",parents:1}:{interior:{X1:{ParaChain:C}},parents:0}},{V3:{interior:{X1:{AccountId32:{id:t.createType("AccountId32",f).toHex(),network:null}}},parents:0}},{V3:[{fun:{Fungible:g},id:{Concrete:{interior:"Here",parents:S?1:0}}}]},0,{Unlimited:null}]),[t,g,S,f,C]),D=!!g;return(0,a.jsxs)(o.u_,{header:s("Teleport assets"),onClose:e,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:s("The transferred balance will be subtracted (along with fees) from the sender account."),children:(0,a.jsx)(o.rp,{label:s("send from account"),labelExtra:(0,a.jsx)(c.Z,{label:s("transferrable"),params:v}),onChange:y,type:"account"})}),0!==P.length&&(0,a.jsxs)(o.u_.Columns,{hint:s("The destination chain for this asset teleport. The transferred value will appear on this chain."),children:[(0,a.jsx)(o.Lt,{defaultValue:P[0].value,label:s("destination chain"),onChange:w,options:P}),!S&&I.includes(C)&&(0,a.jsx)(o.Pd,{content:s("Currently this is a one-way transfer since the on-chain runtime functionality to send the funds from the destination chain back to this account not yet available.")})]}),(0,a.jsx)(o.u_.Columns,{hint:s("The beneficiary will have access to the transferred amount when the transaction is included in a block."),children:(0,a.jsx)(o.rp,{label:s("send to address"),onChange:j,type:"allPlus"})}),(0,a.jsxs)(o.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:s("This is the amount to be teleported to the destination chain and does not account for the source or the destination transfer fee")}),(0,a.jsx)("p",{children:s("The amount deposited to the recipient will be net the calculated cross-chain fee. If the recipient address is new, the amount deposited should be greater than the Existential Deposit")})]}),children:[(0,a.jsx)(o.H,{autoFocus:!0,isError:!D,isZeroable:!0,label:s("amount"),onChange:b}),(0,a.jsx)(o.H,{defaultValue:M?.consts.balances?.existentialDeposit,isDisabled:!0,isLoading:!M,label:s("destination existential deposit")})]})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:v,icon:"share-square",isDisabled:!(N&&D&&f&&g&&M&&(S||C!==h)),label:s("Teleport"),onStart:e,params:T,tx:A})})]})}))},93242:(e,s,t)=>{t.d(s,{Z:()=>vs});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(9118),c=t(58464),u=t(31132),d=t(14681);const m=n.memo((function({auctionInfo:e,blockNumber:s,className:t="",isFirst:n,isLatest:o,value:{accountId:i,firstSlot:l,isCrowdloan:u,lastSlot:m,paraId:h,value:p}}){const{t:x}=(0,c.$)();return(0,a.jsxs)("tr",{className:t,children:[(0,a.jsx)("td",{children:n&&(0,a.jsx)("h1",{children:o?x("latest"):(0,a.jsxs)(a.Fragment,{children:["#",(0,d.u)(!s||s.isZero()?e.endBlock:s)]})})}),(0,a.jsx)(r.iA.Column.Id,{value:h}),(0,a.jsx)("td",{className:"badge",children:(0,a.jsx)(r.f,{id:h})}),(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(r.ax,{value:i})}),(0,a.jsx)("td",{className:"all number",children:x(u?"Yes":"No")}),(0,a.jsx)("td",{className:"all number together",children:l.eq(m)?(0,d.u)(l):`${(0,d.u)(l)} - ${(0,d.u)(m)}`}),(0,a.jsx)(r.iA.Column.Balance,{value:p})]})})),h=n.memo((function({auctionInfo:e,campaigns:s,className:t,winningData:o}){const{t:d}=(0,c.$)(),{api:h}=(0,i.h)(),p=(0,u.f)(),x=(0,l.W7)(h.query.crowdloan.newRaise),g=(0,n.useRef)([[d("bids"),"start",3],[d("bidder"),"address"],[d("crowdloan")],[d("leases")],[d("value")]]),b=(0,n.useMemo)((()=>{if(x&&e?.leasePeriod&&s.funds){const t=e.leasePeriod,a=t.add(p);return s.funds.filter((({firstSlot:e,isWinner:s,lastSlot:n,paraId:o})=>!s&&x.some((e=>e.eq(o)))&&e.gte(t)&&n.lte(a))).sort(((e,s)=>s.value.cmp(e.value)))}}),[e,s,x,p]),f=(0,n.useCallback)(((s,t)=>!t&&x&&e?.leasePeriod&&b?s.concat(...b.filter((({firstSlot:e,lastSlot:t,paraId:a,value:n})=>!s.some((s=>s.firstSlot.eq(e)&&s.lastSlot.eq(t)))&&!b.some((s=>!a.eq(s.paraId)&&e.eq(s.firstSlot)&&t.eq(s.lastSlot)&&n.lt(s.value)))))).map((e=>b.find((({firstSlot:s,lastSlot:t,value:a})=>e.firstSlot.eq(s)&&e.lastSlot.eq(t)&&e.value.lt(a)))||e)).sort(((e,s)=>e.firstSlot.eq(s.firstSlot)?e.lastSlot.cmp(s.lastSlot):e.firstSlot.cmp(s.firstSlot))):s),[e,b,x]);return(0,a.jsx)(r.iA,{className:t,empty:x&&e?.numAuctions&&o&&(e.endBlock&&!o.length?d("No winners in this auction"):d("No ongoing auction")),header:g.current,noBodyTag:!0,children:e?.leasePeriod&&o&&b&&(o.length?o.map((({blockNumber:s,winners:t},n)=>(0,a.jsx)("tbody",{children:f(t,0!==n||1!==o.length).map(((t,o)=>(0,a.jsx)(m,{auctionInfo:e,blockNumber:s,isFirst:0===o,isLatest:0===n,value:t},`${s.toString()}:${t.key}`)))},n))):0!==b.length&&(0,a.jsx)("tbody",{children:f([],!1).map(((s,t)=>(0,a.jsx)(m,{auctionInfo:e,isFirst:0===t,isLatest:!0,value:s},`latest-crowd:${s.key}`)))},"latest-crowd"))})}));var p=t(34814),x=t(54383),g=t(38894),b=t(95292);const f=n.memo((function({noCodeCheck:e,onChange:s,ownedIds:t}){const{t:o}=(0,c.$)(),[i,l]=(0,n.useState)(null),[u,d]=(0,n.useState)(0);(0,n.useEffect)((()=>{s(i&&u?{accountId:i,paraId:u}:{accountId:null,paraId:0})}),[i,s,t,u]);const m=(0,n.useMemo)((()=>t.map((({manager:e})=>e))),[t]),h=(0,n.useMemo)((()=>t.filter((({manager:e})=>e===i)).map((({paraId:e})=>({text:e.toString(),value:e.toNumber()})))),[i,t]),p=(0,n.useCallback)((s=>d(e||t.some((({hasCode:e,paraId:t})=>t.eq(s)&&e))?s:0)),[e,t]);return(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:o("This account that has been used to register the parachain. This will pay all associated fees.")}),(0,a.jsx)("p",{children:o("The parachain id is associated with the selected account via parathread registration.")})]}),children:[(0,a.jsx)(r.rp,{filter:m,label:o("parachain owner"),onChange:l,type:"account",value:i}),i&&(0,a.jsx)(r.Lt,{defaultValue:h[0].value,label:o("parachain id"),onChange:p,options:h},i),!e&&!u&&(0,a.jsx)(r.oy,{content:o("Before using this registered paraId, you need to have a WASM validation function registered on-chain")})]})})),j={accountId:null,paraId:0},v=n.memo((function({auctionInfo:e,className:s,lastWinners:t,ownedIds:o}){const{t:l}=(0,c.$)(),{api:m}=(0,i.h)(),{hasAccounts:h}=(0,p.x)(),v=(0,x.C)(),y=(0,u.E)(),[{accountId:C,paraId:w},N]=(0,n.useState)(j),[k,S]=(0,n.useState)(b.nw),[I,A]=(0,n.useState)(0),[P,E]=(0,g.O)(),M=(0,n.useMemo)((()=>{if(!e?.leasePeriod)return[];const s=e.leasePeriod.toNumber();return y.map((([e,t],a)=>({firstSlot:s+e,lastSlot:s+t,text:`${(0,d.u)(s+e)} - ${(0,d.u)(s+t)}`,value:a})))}),[e,y]),T=(0,n.useMemo)((()=>t?.winners.find((({firstSlot:e,lastSlot:s})=>e.eqn(M[I].firstSlot)&&s.eqn(M[I].lastSlot)))),[t,I,M]),D=!(!k||!T)&&k.lte(T.value),F=!k||k.isZero()||D;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!o.length||!h||!e?.numAuctions||!e.leasePeriod||!e.endBlock||!m.consts.auctions||v?.gte(e.endBlock.add(m.consts.auctions.endingPeriod)),label:l("Bid"),onClick:E}),P&&(0,a.jsxs)(r.u_,{className:s,header:l("Place bid"),onClose:E,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(f,{onChange:N,ownedIds:o}),(0,a.jsx)(r.u_.Columns,{hint:l("The first and last lease period for this bid. The last lease period should be after the first with the maximum determined by the auction config."),children:(0,a.jsx)(r.Lt,{label:l("bid period range (first lease - last lease)"),onChange:A,options:M,value:I})}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:l("The amount to to bid for this parachain lease period range.")}),(0,a.jsx)("p",{children:l("The bid should be more than the current range winner to be accepted and influence the auction outcome.")})]}),children:[(0,a.jsx)(r.H,{autoFocus:!0,isError:F,isZeroable:!1,label:l("bid amount"),onChange:S}),(0,a.jsx)(r.H,{defaultValue:T?.value,isDisabled:!0,label:l("current range winning bid")},I)]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:C,icon:"plus",isDisabled:!w||F||!e?.leasePeriod,label:l("Bid"),onStart:E,params:[w,e?.numAuctions,e?.leasePeriod?.addn(y[I][0]),e?.leasePeriod?.addn(y[I][1]),k],tx:m.tx.auctions.bid})})]})]})}));var y=t(58607);const C=n.memo((function({auctionInfo:e,className:s,lastWinners:t}){const{t:n}=(0,c.$)(),{api:o}=(0,i.h)(),u=(0,x.C)(),m=(0,l.W7)(o.query.balances?.totalIssuance);return(0,a.jsxs)(r.Ty,{className:s,children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:n("auctions"),children:e?(0,d.u)(e.numAuctions):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{label:n("active"),children:e?e.leasePeriod?n("yes"):n("no"):(0,a.jsx)("span",{className:"--tmp",children:n("no")})})]}),e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{children:[e.leasePeriod&&(0,a.jsxs)(r.Jy,{label:n("first - last"),children:[(0,d.u)(e.leasePeriod)," - ",(0,d.u)(e.leasePeriod.add(o.consts.auctions.leasePeriodsPerSlot).isub(b.If))]}),m&&t&&(0,a.jsx)(r.Jy,{label:n("total"),progress:{hideValue:!0,total:m,value:t.total,withTime:!0},children:(0,a.jsx)(y.Z,{value:t.total,withSi:!0})})]}),(0,a.jsx)("section",{children:e?.endBlock&&u&&(u.lt(e.endBlock)?(0,a.jsxs)(r.Jy,{label:n("end period at"),progress:{hideGraph:!0,total:e.endBlock,value:u,withTime:!0},children:["#",(0,d.u)(e.endBlock)]}):(0,a.jsx)(r.Jy,{label:n("ending period"),progress:{total:o.consts.auctions?.endingPeriod,value:u.sub(e.endBlock),withTime:!0}}))})]})]})})),w=n.memo((function({auctionInfo:e,campaigns:s,className:t,ownedIds:n,winningData:o}){const i=o?.[0];return(0,a.jsxs)("div",{className:t,children:[(0,a.jsx)(C,{auctionInfo:e,lastWinners:i}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(v,{auctionInfo:e,lastWinners:i,ownedIds:n})}),(0,a.jsx)(h,{auctionInfo:e,campaigns:s,winningData:o})]})})),N={accountId:null,paraId:0},k=n.memo((function({auctionInfo:e,bestNumber:s,className:t,leasePeriod:o,ownedIds:l}){const{t:d}=(0,c.$)(),{api:m}=(0,i.h)(),h=(0,u.E)(),[{accountId:p,paraId:x},j]=(0,n.useState)(N),[v,y]=(0,n.useState)(),[C,w]=(0,n.useState)(),[k,S]=(0,n.useState)(),[I,A]=(0,n.useState)(),[P,E]=(0,g.O)(),M=h[h.length-1][1]-h[0][0],T=!s||!C||C.lt(s),D=!k||!!o&&k.lt(o.currentPeriod),F=!I||!k||I.lt(k)||I.gt(k.addn(M)),V=(e?.leasePeriod||o?.currentPeriod.add(b.If)||1).toString();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!l.length,label:d("Add fund"),onClick:E}),P&&(0,a.jsxs)(r.u_,{className:t,header:d("Add campaign"),onClose:E,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(f,{onChange:j,ownedIds:l}),(0,a.jsx)(r.u_.Columns,{hint:d("The amount to be raised in this funding campaign."),children:(0,a.jsx)(r.H,{isZeroable:!1,label:d("crowdfund cap"),onChange:y})}),(0,a.jsx)(r.u_.Columns,{hint:d("The end block for contributions to this fund."),children:(0,a.jsx)(r.Rn,{isError:T,label:d("ending block"),onChange:w})}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:d("The first and last lease periods for this funding campaign.")}),(0,a.jsx)("p",{children:d("The ending lease period should be after the first and a maximum of {{maxPeriods}} periods more than the first",{replace:{maxPeriods:M}})})]}),children:[(0,a.jsx)(r.Rn,{defaultValue:V,isError:D,label:d("first period"),onChange:S}),(0,a.jsx)(r.Rn,{defaultValue:V,isError:F,label:d("last period"),onChange:A})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:p,icon:"plus",isDisabled:!x||!v?.gt(b.nw)||T||D||F,label:d("Add"),onStart:E,params:[x,v,k,I,C,null],tx:m.tx.crowdloan.create})})]})]})}));var S=t(62395),I=t(84450),A=t(65874),P=t(74076),E=t(92730);const M=[132,134],T=n.memo((function({cap:e,className:s,needsSignature:t,paraId:o,raised:l}){const{t:u}=(0,c.$)(),{api:d}=(0,i.h)(),{hasAccounts:m}=(0,p.x)(),[h,x]=(0,g.O)(),[b,f]=(0,n.useState)(null),[j,v]=(0,n.useState)(),[y,C]=(0,n.useState)(null),w=(0,n.useMemo)((()=>t&&!function(e,s){if((0,P.vq)(s)&&M.includes(s.length))try{return e.createType("MultiSignature",s),!0}catch(e){console.error(e)}return!1}(d,y)),[d,t,y]),N=e.sub(l),k=!j||j.lt(d.consts.crowdloan.minContribution),S=!(!j||!j.gt(N)),I=k||S,A=d.consts.crowdloan.minContribution;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!m,label:u("Contribute"),onClick:x}),h&&(0,a.jsxs)(r.u_,{className:s,header:u("Contribute to fund"),onClose:x,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:u("This account will contribute to the crowdloan."),children:(0,a.jsx)(r.rp,{label:u("contribute from"),onChange:f,type:"account",value:b})}),(0,a.jsxs)(r.u_.Columns,{hint:u("The amount to contribute from this account."),children:[(0,a.jsx)(r.H,{autoFocus:!0,defaultValue:d.consts.crowdloan.minContribution,isError:I,isZeroable:!1,label:u("contribution"),onChange:v}),k&&(0,a.jsx)(r.Pd,{content:u("The amount is less than the minimum allowed contribution of {{value}}",{replace:{value:(0,E.a)(A)}})}),S&&(0,a.jsx)(r.Pd,{content:u("The amount is more than the remaining contribution needed {{value}}",{replace:{value:(0,E.a)(N)}})})]}),t&&(0,a.jsxs)(r.u_.Columns,{hint:u("The verifier signature that is to be associated with this contribution."),children:[(0,a.jsx)(r.II,{isError:w,label:u("verifier signature"),onChange:C,placeholder:u("0x...")}),w&&(0,a.jsx)(r.Pd,{content:u("The hex-encoded verifier signature should be provided to you by the team running the crowdloan (based on the information you provide).")})]}),(0,a.jsxs)(r.u_.Columns,{hint:u("The above contribution should more than minimum contribution amount and less than the remaining value."),children:[(0,a.jsx)(r.H,{defaultValue:d.consts.crowdloan.minContribution,isDisabled:!0,label:u("minimum allowed")}),(0,a.jsx)(r.H,{defaultValue:N,isDisabled:!0,label:u("remaining till cap")})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:b,icon:"plus",isDisabled:I||w,label:u("Contribute"),onStart:x,params:[o,j,y],tx:d.tx.crowdloan.contribute})})]})]})})),D=n.memo((function({className:e,paraId:s}){const{t}=(0,c.$)(),{api:o}=(0,i.h)(),{hasAccounts:l}=(0,p.x)(),[u,d]=(0,g.O)(),[m,h]=(0,n.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"minus",isDisabled:!l,label:t("Refund"),onClick:d}),u&&(0,a.jsxs)(r.u_,{className:e,header:t("Withdraw from fund"),onClose:d,size:"large",children:[(0,a.jsx)(r.u_.Content,{children:(0,a.jsx)(r.u_.Columns,{hint:t("This account will be used to send the transaction."),children:(0,a.jsx)(r.rp,{label:t("requesting from"),onChange:h,type:"account",value:m})})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,icon:"credit-card",label:t("Refund"),onStart:d,params:[s],tx:o.tx.crowdloan.refund})})]})]})}));var F=t(11677),V=t(90107);const _={blockHash:"-",contributorsHex:[],hasLoaded:!1,myAccounts:[],myAccountsHex:[],myContributions:{}},q=(0,F.e)("useContributions",(function(e){const{api:s}=(0,i.h)(),{allAccountsHex:t}=(0,p.x)(),[a,o]=(0,n.useState)((()=>_)),r=(0,l.W7)(s.derive.crowdloan.contributions,[e]),c=(0,l.W7)(s.derive.crowdloan.ownContributions,[e,a.myAccountsHex]);return(0,n.useEffect)((()=>{r&&o((e=>{let a,n=r.contributorsHex.filter((e=>t.includes(e)));return n.length===e.myAccountsHex.length?(n=e.myAccountsHex,a=e.myAccounts):a=n.map((e=>(0,V.m)(e,s.registry.chainSS58))),{...e,...r,hasLoaded:!0,myAccounts:a,myAccountsHex:n}}))}),[s,t,r]),(0,n.useEffect)((()=>{c&&o((e=>({...e,myContributions:c})))}),[c]),a})),O=n.memo((function({bestHash:e,bestNumber:s,className:t="",isOngoing:o,leasePeriod:l,value:{info:{cap:u,depositor:m,end:h,firstPeriod:x,lastPeriod:g,raised:b,verifier:f},isCapped:j,isEnded:v,isWinner:C,paraId:w}}){const{t:N}=(0,c.$)(),{api:k}=(0,i.h)(),{isAccount:S}=(0,p.x)(),P=(0,I.jC)(w),{blockHash:E,contributorsHex:M,hasLoaded:F,myAccounts:V,myAccountsHex:_,myContributions:O}=q(w),[R,z]=(0,n.useState)((()=>({prevHash:"",prevLength:0}))),H=(0,n.useMemo)((()=>S(m.toString())),[m,S]),$=(0,n.useMemo)((()=>s&&h.gt(s)?h.sub(s):null),[s,h]),L=(0,n.useMemo)((()=>u.isZero()?"100.00%":`${(b.muln(1e4).div(u).toNumber()/100).toFixed(2)}%`),[u,b]),B=!$&&!!l&&(C?l.currentPeriod.gt(g):l.currentPeriod.gt(x)),Z=o&&!j&&!C&&!!$,W=b.isZero(),U=!b.isZero()&&B,J=0!==P.length&&P[0].homepage;return(0,n.useEffect)((()=>{z((e=>{const s=M.length;return e.prevLength!==s?{prevHash:E,prevLength:s}:e}))}),[M,E]),(0,a.jsxs)("tr",{className:t,children:[(0,a.jsx)(r.iA.Column.Id,{value:w}),(0,a.jsx)("td",{className:"badge",children:(0,a.jsx)(r.f,{id:w})}),(0,a.jsx)("td",{className:"media--800",children:N(C?"Winner":$?j?"Capped":o?"Active":"Past":"Ended")}),(0,a.jsx)("td",{className:"address media--2000",children:(0,a.jsx)(r.ax,{value:m})}),(0,a.jsxs)("td",{className:"all number together media--1200",children:[$&&(0,a.jsx)(A.Z,{value:$}),"#",(0,d.u)(h)]}),(0,a.jsx)("td",{className:"number all together",children:x.eq(g)?(0,d.u)(x):`${(0,d.u)(x)} - ${(0,d.u)(g)}`}),(0,a.jsxs)("td",{className:"number together",children:[(0,a.jsx)(y.Z,{value:b,withCurrency:!1})," / ",(0,a.jsx)(y.Z,{value:u}),(0,a.jsx)("div",{children:L}),0!==V.length&&(0,a.jsx)(r.xH,{summary:N("My contributions ({{count}})",{replace:{count:V.length}}),withBreaks:!0,children:V.map(((e,s)=>(0,a.jsx)(r.ax,{balance:O[_[s]],value:e,withBalance:!0},e)))})]}),(0,a.jsx)("td",{className:"number together media--1100",children:F?(0,a.jsxs)(a.Fragment,{children:[e&&(0,a.jsx)(r.JO,{color:R.prevHash===e?"green":"transparent",icon:"chevron-up",isPadded:!0}),0!==M.length&&(0,d.u)(M.length)]}):(0,a.jsx)("span",{className:"--tmp",children:"999"})}),(0,a.jsxs)("td",{className:"button media--1000",children:[U&&0!==M.length&&(0,a.jsx)(D,{paraId:w}),W&&(0,a.jsx)(r.cA,{accountId:m,className:"media--1400",icon:"times",isDisabled:!(H||B),label:N(v?"Close":"Cancel"),params:[w],tx:k.tx.crowdloan.dissolve}),o&&Z&&(0,a.jsx)(T,{cap:u,needsSignature:f.isSome,paraId:w,raised:b}),o&&J&&(0,a.jsxs)("div",{children:[(0,a.jsx)("a",{href:J,rel:"noopener noreferrer",target:"_blank",children:N("Homepage")}),"   "]})]})]})}));function R(e,s){return s?.sort((({key:s},{key:t})=>{const a=e[s]||!1;return a===(e[t]||!1)?0:a?-1:1}))}const z=n.memo((function({bestNumber:e,className:s,leasePeriod:t,value:o}){const{t:i}=(0,c.$)(),l=(0,S.P)(),[u,d,m]=(0,n.useMemo)((()=>function(e,s){const t=s?.currentPeriod;let a=null,n=null,o=null;return e&&t&&(a=e.filter((({firstSlot:e,isCapped:s,isEnded:a,isWinner:n})=>!(s||a||n)&&t.lte(e))),n=e.filter((({firstSlot:e,isCapped:s,isEnded:a,isWinner:n})=>s||a||n||t.gt(e))),o=e.map((({paraId:e})=>e))),[a,n,o]}(o,t)),[t,o]),h=(0,I.gW)(m),[p,x]=(0,n.useMemo)((()=>[R(h,u),R(h,d)]),[u,d,h]),g=(0,n.useRef)([[i("ongoing"),"start",2],[void 0,"media--800"],[void 0,"media--2000"],[i("ending"),"media--1200"],[i("leases")],[i("raised")],[i("count"),"media--1100"],[void 0,"media--1000"]]),b=(0,n.useRef)([[i("completed"),"start",2],[void 0,"media--800"],[void 0,"media--2000"],[i("ending"),"media--1200"],[i("leases")],[i("raised")],[i("count"),"media--1100"],[void 0,"media--1000"]]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Pd,{className:"warning centered",content:i('Do not transfer any funds directly to a specific account that is associated with a loan or a team. Use the "Contribute" action to record the contribution on-chain using the crowdloan runtime module. When the fund is dissolved, after either the parachain lease expires or the loan ending without winning, the full value will be returned to your account by the runtime. Funds sent directly to an account, without using the crowdloan functionality, may not be returned by the receiving account.')}),(0,a.jsx)(r.iA,{className:s,empty:o&&p&&i("No active campaigns found"),header:g.current,children:p?.map((s=>(0,a.jsx)(O,{bestHash:l,bestNumber:e,isOngoing:!0,value:s},s.accountId)))}),(0,a.jsx)(r.iA,{className:s,empty:o&&x&&i("No completed campaigns found"),header:b.current,children:x?.map((s=>(0,a.jsx)(O,{bestNumber:e,leasePeriod:t,value:s},s.accountId)))})]})})),H=n.memo((function({activeCap:e,activeRaised:s,className:t,fundCount:n,isLoading:o,totalCap:i,totalRaised:l}){const{t:u}=(0,c.$)();return(0,a.jsxs)(r.Ty,{className:t,children:[(0,a.jsx)(r.Jy,{label:u("funds"),children:void 0===n?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,d.u)(n)}),(0,a.jsx)(r.Jy,{label:`${u("active raised / cap")}`,progress:{hideValue:!0,isBlurred:o,total:o?b.Jo:e,value:o?b.um:s},children:(0,a.jsxs)("span",{className:o?"--tmp":"",children:[(0,a.jsx)(y.Z,{value:s,withCurrency:!1,withSi:!0})," / ",(0,a.jsx)(y.Z,{value:e,withSi:!0})]})}),(0,a.jsx)(r.Jy,{label:`${u("total raised / cap")}`,progress:{hideValue:!0,isBlurred:o,total:o?b.Jo:i,value:o?b.um:l},children:(0,a.jsxs)("span",{className:o?"--tmp":"",children:[(0,a.jsx)(y.Z,{value:l,withCurrency:!1,withSi:!0})," / ",(0,a.jsx)(y.Z,{value:i,withSi:!0})]})})]})})),$=n.memo((function({auctionInfo:e,campaigns:{activeCap:s,activeRaised:t,funds:n,isLoading:o,totalCap:i,totalRaised:l},className:c,leasePeriod:u,ownedIds:d}){const m=(0,x.C)();return(0,a.jsxs)("div",{className:c,children:[(0,a.jsx)(H,{activeCap:s,activeRaised:t,fundCount:n?.length,isLoading:o,totalCap:i,totalRaised:l}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(k,{auctionInfo:e,bestNumber:m,leasePeriod:u,ownedIds:d})}),(0,a.jsx)(z,{bestNumber:m,leasePeriod:u,value:n})]})}));var L=t(99924);const B=n.memo((function({lifecycle:e,nextAction:s}){return e&&(0,a.jsxs)(a.Fragment,{children:[e.toString(),s&&(0,a.jsx)(L.Z,{value:s.sessionIndex})]})}));var Z=t(36198);const W={transform:e=>e.number.unwrap()},U=(0,F.e)("useChainDetails",(function(e){const{api:s}=(0,Z.x)(e);return{bestNumber:(0,l.W7)(s?.rpc.chain.subscribeNewHeads,void 0,W),runtimeVersion:(0,l.W7)(s?.rpc.state.subscribeRuntimeVersion)}})),J=r.zo.div` + .version { + font-size: var(--font-size-small); + white-space: nowrap; + + > div { + display: inline-block; + overflow: hidden; + max-width: 10em; + text-overflow: ellipsis; + } + } +`,G=n.memo((function({className:e,id:s}){const{bestNumber:t,runtimeVersion:n}=U(s);return(0,a.jsxs)(J,{className:e,children:[t&&(0,a.jsx)("div",{children:(0,d.u)(t)}),n&&(0,a.jsxs)("div",{className:"version",children:[(0,a.jsx)("div",{className:"media--1100",children:n.specName.toString()}),(0,a.jsx)("div",{className:"media--1100",children:"/"}),(0,a.jsx)("div",{children:n.specVersion.toString()})]})]})}));var Y=t(12372);const Q=n.memo((function({children:e,className:s,leasePeriod:t,value:o}){const r=(0,n.useMemo)((()=>function(e,s){return e&&s&&(0,Y.G)(s).sub(b.If).imul(e.length).iadd(e.remainder)}(t,o)),[t,o]);return r?(0,a.jsx)(A.Z,{className:s,value:r,children:e}):null})),K=n.memo((function({className:e,fromFirst:s,leasePeriod:t,periods:o}){const r=(0,n.useMemo)((()=>function(e,s){return s&&e?.reduce(((e,t)=>{const a=s.addn(t);return!e.length||e[e.length-1][1].add(b.If).lt(a)?e.push([a,a]):e[e.length-1][1]=a,e}),[]).map((([e,s])=>e.eq(s)?(0,d.u)(e):`${(0,d.u)(e)} - ${(0,d.u)(s)}`)).join(", ")}(o,t?.currentPeriod)),[t?.currentPeriod,o]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)("div",{children:r}),o&&(0,a.jsx)(Q,{leasePeriod:t,value:s?o[0]:o[o.length-1]+1})]})}));var X=t(54890);const ee={defaultValue:{headHex:null,leases:[],lifecycle:null,paraInfo:null,pendingAvail:null,qDmp:0,qHrmpE:0,qHrmpI:0,qUmp:0,updateAt:null,watermark:null},transform:([e,s,t,a,n,o,r,i,l,c,u])=>({headHex:e.isSome?e.unwrap().toHex():null,leases:u.map(((e,s)=>e.isSome?s:-1)).filter((e=>-1!==e)),lifecycle:t.unwrapOr(null),paraInfo:c.unwrapOr(null),pendingAvail:l.unwrapOr(null),qDmp:a.length,qHrmpE:o.length,qHrmpI:r.length,qUmp:n.length,updateAt:s.unwrapOr(null),watermark:i.unwrapOr(null)})},se=(0,F.e)("useParaInfo",(function(e){const{api:s}=(0,i.h)();return(0,X.L)([[s.query.paras.heads,e],[s.query.paras.futureCodeUpgrades,e],[s.query.paras.paraLifecycles,e],[(s.query.parasDmp||s.query.paraDmp||s.query.dmp)?.downwardMessageQueues,e],[(s.query.parasUmp||s.query.ump)?.relayDispatchQueues,e],[(s.query.parasHrmp||s.query.paraHrmp||s.query.hrmp)?.hrmpEgressChannelsIndex,e],[(s.query.parasHrmp||s.query.paraHrmp||s.query.hrmp)?.hrmpIngressChannelsIndex,e],[(s.query.parasHrmp||s.query.paraHrmp||s.query.hrmp)?.hrmpWatermarks,e],[(s.query.parasInclusion||s.query.paraInclusion||s.query.inclusion)?.pendingAvailability,e],[s.query.registrar.paras,e],[s.query.slots.leases,e]],ee)}));function te(e,s){return e?.map(((e,t)=>(0,a.jsx)(r.ax,{nameExtra:s&&(0,a.jsxs)(a.Fragment,{children:[" ",`(${(0,d.u)(s[t])})`]}),value:e},e.toString())))}const ae=r.zo.tr` + &.isDisabled { + td { + opacity: 0.5 + } + } + + td.badge.together > div { + display: inline-block; + margin: 0 0.25rem 0 0; + vertical-align: middle; + } +`,ne=n.memo((function({bestNumber:e,className:s="",id:t,lastBacked:o,lastInclusion:i,lastTimeout:l,leasePeriod:u,nextAction:m,sessionValidators:h,validators:p}){const{t:x}=(0,c.$)(),g=se(t),[b,f]=(0,n.useState)([]),j=(0,n.useMemo)((()=>e&&(i?e.sub(i.blockNumber):g.watermark?e.sub(g.watermark):void 0)),[e,i,g]),v=(0,n.useCallback)((()=>te(p?.[1].map((({validatorId:e})=>e)),p?.[1].map((({indexValidator:e})=>e)))),[p]),y=(0,n.useCallback)((()=>te(b)),[b]);return(0,n.useEffect)((()=>{if(h)if(g.pendingAvail){const e=g.pendingAvail.availabilityVotes.toHuman().slice(2).replace(/_/g,"").split("").map(((e,s)=>"0"===e?h[s]:null)).filter(((e,s)=>!!e&&s{s&&a((t=>function(e,s,t){const a={},n={},o={},r=s.block.header.number.unwrap(),i=s.block.header.hash.toHex(),l=e.events.paraInclusion||e.events.parasInclusion||e.events.inclusion;let c=!1,u=!1,d=!1;return l&&s.events.forEach((({event:e,phase:s})=>{s.isApplyExtrinsic&&(l.CandidateBacked.is(e)?(ie(a,e,i,r),c=!0):l.CandidateIncluded.is(e)?(ie(n,e,i,r),u=!0):l.CandidateTimedOut.is(e)&&(ie(o,e,i,r),d=!0))})),c||u||d?{lastBacked:c?{...t.lastBacked,...a}:t.lastBacked,lastIncluded:u?{...t.lastIncluded,...n}:t.lastIncluded,lastTimeout:d?{...t.lastTimeout,...o}:t.lastTimeout}:t}(e,s,t)))}),[e,s]),t})),ce={defaultValue:[null,null,null,null]},ue=(0,F.e)("useValidators",(function(e){const{api:s}=(0,i.h)(),[t,a,o,r]=(0,X.L)([s.query.session.validators,(s.query.parasScheduler||s.query.paraScheduler||s.query.scheduler)?.scheduled,(s.query.parasScheduler||s.query.paraScheduler||s.query.scheduler)?.validatorGroups,(s.query.parasShared||s.query.paraShared||s.query.shared)?.activeValidatorIndices],ce),[l,c]=(0,n.useState)({});return(0,n.useEffect)((()=>{o&&e&&r&&a&&t&&c((s=>function(e,s,t,a,n,o){return s.reduce(((e,s)=>{const r=o.find((({paraId:e})=>e&&e.eq(s)));return r?{...e,[s.toString()]:[r.groupIdx,(a[r.groupIdx.toNumber()]||[]).map((e=>[e,n[e.toNumber()]])).filter((([,e])=>e)).map((([e,s])=>({indexActive:e,indexValidator:s,validatorId:t[s.toNumber()]})))]}:e}),{...e})}(s,e,t,o,r,a)))}),[o,e,r,a,t]),(0,n.useMemo)((()=>[t,l]),[l,t])})),de=n.memo((function({actionsQueue:e,ids:s,leasePeriod:t,scheduled:o}){const{t:i}=(0,c.$)(),l=(0,x.C)(),{lastBacked:u,lastIncluded:d,lastTimeout:m}=le(),h=(0,I.gW)(s),[p,g]=ue(s),b=(0,n.useRef)([[i("parachains"),"start",2],["","media--1400"],[i("head"),"start media--1500"],[i("lifecycle"),"start"],[],[i("included"),void 0,2],[i("backed"),"no-pad-left media--900"],[i("timeout"),"no-pad-left media--1600"],[i("chain"),"no-pad-left"],[i("in/out"),"media--1700",2],[i("leases"),"media--1100"]]),f=(0,n.useMemo)((()=>function(e=[]){return e.reduce(((e,{scheduledIds:s})=>s.reduce(((e,s)=>({...e,[s.toString()]:!0})),e)),{})}(o)),[o]),j=(0,n.useMemo)((()=>s&&function(e,s){return s.map((e=>[e,e.toString()])).sort((([s,t],[a,n])=>{const o=e[t]||!1;return o===(e[n]||!1)?s.cmp(a):o?-1:1}))}(h,s)),[s,h]),v=(0,n.useMemo)((()=>function(e,s=[]){return s.reduce(((s,[t,a])=>({...s,[a]:e.find((({paraIds:e})=>e.some((e=>e.eq(t)))))})),{})}(e,j)),[e,j]);return(0,a.jsx)(r.iA,{empty:j&&i("There are no registered parachains"),header:b.current,children:j?.map((([e,s])=>(0,a.jsx)(ne,{bestNumber:l,id:e,isScheduled:f[s],lastBacked:u[s],lastInclusion:d[s],lastTimeout:m[s],leasePeriod:t,nextAction:v[s],sessionValidators:p,validators:g[s]},s)))})}));var me=t(54705),he=t(26839),pe=t(65968);const xe=function({leasePeriod:e,parachainCount:s,proposalCount:t,upcomingCount:n}){const{t:o}=(0,c.$)();return(0,a.jsxs)(r.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:o("parachains"),children:(0,pe.h)(s)?(0,d.u)(s):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{className:"media--1000",label:o("parathreads"),children:(0,pe.h)(n)?(0,d.u)(n):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,pe.h)(t)&&(0,a.jsx)(r.Jy,{className:"media--1000",label:o("proposals"),children:(0,d.u)(t)})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:o("current lease"),children:e?(0,d.u)(e.currentPeriod):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{className:"media--1200",label:o("lease period"),progress:{isBlurred:!e,total:e?e.length:b.Jo,value:e?e.progress:b.um,withTime:!0}})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:o("finalized"),children:(0,a.jsx)(he.Z,{})}),(0,a.jsx)(me.Z,{className:"media--1200",withEra:!1})]})]})},ge=n.memo((function({actionsQueue:e,className:s,leasePeriod:t,paraIds:n,proposals:o,threadIds:r}){return(0,a.jsxs)("div",{className:s,children:[(0,a.jsx)(xe,{leasePeriod:t,parachainCount:n?.length,proposalCount:o?.proposalIds.length,upcomingCount:r?.length}),(0,a.jsx)(de,{actionsQueue:e,ids:n,leasePeriod:t,scheduled:o?.scheduled})]})}));var be=t(48801),fe=t.n(be);const je=new(fe())(2e3),ve=je.sub(b.If),ye=n.memo((function({className:e,nextParaId:s,onClose:t}){const{t:o}=(0,c.$)(),{api:l}=(0,i.h)(),[u,d]=(0,n.useState)(null);return(0,a.jsxs)(r.u_,{className:e,header:o("Reserve ParaId"),onClose:t,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("This account will be used to the Id reservation and for the future parathread."),children:(0,a.jsx)(r.rp,{label:o("reserve from"),onChange:d,type:"account",value:u})}),(0,a.jsx)(r.u_.Columns,{hint:o("The Id of this parachain as known on the network (selected from nextFreeId)"),children:(0,a.jsx)(r.Rn,{defaultValue:s,isDisabled:!0,label:o("parachain id")})}),(0,a.jsx)(r.u_.Columns,{hint:o("The reservation fee for this Id"),children:(0,a.jsx)(r.H,{defaultValue:l.consts.registrar.paraDeposit,isDisabled:!0,label:o("reserved deposit")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:u,icon:"plus",isDisabled:!s,onStart:t,params:[],tx:l.tx.registrar.reserve})})]})}));var Ce=t(88311);const we=n.memo((function({className:e,nextParaId:s,onClose:t,ownedIds:o}){const{t:l}=(0,c.$)(),{api:u}=(0,i.h)(),[d,m]=(0,n.useState)(null),[h,p]=(0,n.useState)(),[x,g]=(0,n.useState)(null),[b,j]=(0,n.useState)(null),v=(0,n.useCallback)((e=>j((0,Ce.N)(e))),[]),y=(0,n.useCallback)((e=>g((0,Ce.N)(e))),[]),C=(0,n.useCallback)((({accountId:e,paraId:s})=>{m(e),p(new(fe())(s))}),[]),w=(0,n.useMemo)((()=>u.consts.registrar.paraDeposit.add(u.consts.registrar.dataDepositPerByte.muln(x?x.length:0)).iadd(u.consts.registrar.dataDepositPerByte.muln(b?b.length:0))),[u,x,b]),N=!h||!h.gt(ve);return(0,a.jsxs)(r.u_,{className:e,header:l("Register parathread"),onClose:t,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[u.tx.registrar.reserve?(0,a.jsx)(f,{noCodeCheck:!0,onChange:C,ownedIds:o}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u_.Columns,{hint:l("This account will be associated with the parachain and pay the deposit."),children:(0,a.jsx)(r.rp,{label:l("register from"),onChange:m,type:"account",value:d})}),(0,a.jsx)(r.u_.Columns,{hint:l("The id of this parachain as known on the network"),children:(0,a.jsx)(r.Rn,{autoFocus:!0,defaultValue:s,isError:N,isZeroable:!1,label:l("parachain id"),onChange:p})})]}),(0,a.jsx)(r.u_.Columns,{hint:l("The WASM validation function for this parachain."),children:(0,a.jsx)(r.ht,{isError:!x,label:l("code"),onChange:y})}),(0,a.jsx)(r.u_.Columns,{hint:l("The genesis state for this parachain."),children:(0,a.jsx)(r.ht,{isError:!b,label:l("initial state"),onChange:v})}),(0,a.jsx)(r.u_.Columns,{hint:l("The reservation fee for this parachain, including base fee and per-byte fees"),children:(0,a.jsx)(r.H,{defaultValue:w,isDisabled:!0,label:l("reserved deposit")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:d,icon:"plus",isDisabled:!x||!b||N,onStart:t,params:[h,b,x],tx:u.tx.registrar.register})})]})})),Ne={transform:e=>e.isZero()?je:e},ke=n.memo((function({className:e,ownedIds:s}){const{t}=(0,c.$)(),{api:n}=(0,i.h)(),[o,u]=(0,g.O)(),[d,m]=(0,g.O)(),h=(0,l.W7)(n.query.registrar.nextFreeParaId,[],Ne);return(0,a.jsxs)(r.zx.Group,{className:e,children:[(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!n.tx.registrar.reserve,label:t("ParaId"),onClick:m}),d&&(0,a.jsx)(ye,{nextParaId:h,onClose:m}),(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!!n.tx.registrar.reserve&&!s.length,label:t("ParaThread"),onClick:u}),o&&(0,a.jsx)(we,{nextParaId:h,onClose:u,ownedIds:s})]})})),Se={defaultValue:{headHex:null,lifecycle:null,manager:null},transform:([e,s,t,a])=>({headHex:e.isSome?e.unwrap().toHex():s.isSome?s.unwrap().genesisHead.toHex():null,lifecycle:t.unwrapOr(null),manager:a.isSome?a.unwrap().manager:null})},Ie=(0,F.e)("useThreadInfo",(function(e){const{api:s}=(0,i.h)();return(0,X.L)([[s.query.paras.heads,e],[s.query.paras.upcomingParasGenesis,e],[s.query.paras.paraLifecycles,e],[s.query.registrar.paras,e]],Se)})),Ae=n.memo((function({id:e,leasePeriod:s,leases:t,nextAction:o}){const{t:l}=(0,c.$)(),{api:u}=(0,i.h)(),{isAccount:d}=(0,p.x)(),{headHex:m,lifecycle:h,manager:x}=Ie(e),g=(0,n.useMemo)((()=>s?.currentPeriod&&t?.map((({period:e})=>e))),[s?.currentPeriod,t]),b=d(x?.toString());return(0,a.jsxs)("tr",{children:[(0,a.jsx)(r.iA.Column.Id,{value:e}),(0,a.jsx)("td",{className:"badge",children:(0,a.jsx)(r.f,{id:e})}),(0,a.jsx)("td",{className:"address media--2000",children:x&&(0,a.jsx)(r.N,{value:x})}),(0,a.jsx)("td",{className:"start together hash media--1500",children:(0,a.jsx)("div",{className:"shortHash",children:m})}),(0,a.jsx)("td",{className:"start",children:(0,a.jsx)(B,{lifecycle:h,nextAction:o})}),(0,a.jsx)("td",{className:"all"}),(0,a.jsx)("td",{className:"number no-pad-left"}),(0,a.jsx)("td",{className:"number together",children:s&&t&&g&&(t.length?(0,a.jsx)(K,{fromFirst:!0,leasePeriod:s,periods:g}):l("None"))}),(0,a.jsx)("td",{className:"button media--900",children:(0,a.jsx)(r.cA,{accountId:x,icon:"times",isDisabled:!b,label:l("Deregister"),params:[e],tx:u.tx.registrar.deregister})})]})})),Pe=(0,F.e)("useParaMap",(function(e){const{api:s}=(0,i.h)(),t=(0,I.gW)(e),a=(0,n.useCallback)((([[e],s])=>function(e,s,t){return s.reduce(((e,s,a)=>(e.push([s,t[a].map(((e,s)=>{if(e.isNone)return null;const[t,a]=e.unwrap();return{accountId:t,balance:a,period:s}})).filter((e=>!!e))]),e)),[]).sort((([s,t],[a,n])=>{const o=e[s.toString()]||!1,r=e[a.toString()]||!1;return t.length&&n.length?t[0].period-n[0].period||s.cmp(a):t.length?-1:n.length?1:o===r?s.cmp(a):o?-1:1}))}(t,e,s)),[t]);return(0,l.W7)(e&&s.query.slots.leases.multi,[e],{transform:a,withParamsTransform:!0})})),Ee=n.memo((function({actionsQueue:e,className:s,ids:t,leasePeriod:o,ownedIds:i}){const{t:l}=(0,c.$)(),u=Pe(t),d=(0,n.useRef)([[l("parathreads"),"start",2],["","media--2000"],[l("head"),"start media--1500"],[l("lifecycle"),"start"],[],[],[l("leases")],["","media--900"]]);return(0,a.jsxs)("div",{className:s,children:[(0,a.jsx)(ke,{ownedIds:i}),(0,a.jsx)(r.iA,{empty:o&&t&&(0===t.length||u)&&l("There are no available parathreads"),header:d.current,children:o&&u?.map((([s,t])=>(0,a.jsx)(Ae,{id:s,leasePeriod:o,leases:t,nextAction:e.find((({paraIds:e})=>e.some((e=>e.eq(s)))))},s.toString())))})]})}));function Me({address:e,index:s,setAddress:t,t:o}){const i=(0,n.useCallback)((e=>e&&t(s,e)),[s,t]);return(0,a.jsx)(r.rp,{defaultValue:e,label:o("validator {{index}}",{replace:{index:s+1}}),onChange:i})}const Te=n.memo((function({className:e,onClose:s}){const{t}=(0,c.$)(),{api:o}=(0,i.h)(),[l,u]=(0,n.useState)(null),[d,m]=(0,n.useState)(""),[h,p]=(0,n.useState)(),[x,g]=(0,n.useState)((()=>b.D_.mul(b.aP.pow(new(fe())(o.registry.chainDecimals[0]))))),[f,j]=(0,n.useState)([""]),[{isWasmValid:v,wasm:y},C]=(0,n.useState)({isWasmValid:!1,wasm:null}),[w,N]=(0,n.useState)(null),k=(0,n.useCallback)((e=>N((0,Ce.N)(e))),[]),S=(0,n.useCallback)(((e,s)=>C({isWasmValid:s,wasm:e})),[]),I=(0,n.useCallback)(((e,s)=>j((t=>t.map(((t,a)=>a===e?s:t))))),[]),A=(0,n.useCallback)((()=>j((e=>[...e,""]))),[]),P=(0,n.useCallback)((()=>j((e=>[...e.slice(0,e.length-1)]))),[]),E=d.length>=3,M=f.some(((e,s)=>f.some(((t,a)=>s!==a&&e===t))));return(0,a.jsxs)(r.u_,{className:e,header:t("Propose parachain"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:t("This account will be associated with the parachain and pay the deposit."),children:(0,a.jsx)(r.rp,{label:t("propose from"),onChange:u,type:"account",value:l})}),(0,a.jsxs)(r.u_.Columns,{hint:t("The name for this parachain, the id and the allocated/requested balance."),children:[(0,a.jsx)(r.II,{autoFocus:!0,isError:!E,label:t("parachain name"),onChange:m}),(0,a.jsx)(r.Rn,{isZeroable:!1,label:t("requested id"),onChange:p}),(0,a.jsx)(r.H,{defaultValue:x,label:t("initial balance"),onChange:g})]}),(0,a.jsxs)(r.u_.Columns,{hint:t("The WASM validation function as well as the genesis state for this parachain."),children:[(0,a.jsx)(r.RF,{isError:!v,label:t("validation code"),onChange:S,placeholder:y&&!v&&t("The code is not recognized as being in valid WASM format")}),(0,a.jsx)(r.ht,{isError:!w,label:t("genesis state"),onChange:k})]}),(0,a.jsxs)(r.u_.Columns,{hint:t("The validators for this parachain. At least one is required and where multiple is supplied, they need to be unique."),children:[f.map(((e,s)=>(0,a.jsx)(Me,{address:e,index:s,setAddress:I,t},s))),!f.length&&(0,a.jsx)(r.Pd,{content:t("You need to supply at last one running validator for your parachain alongside this request.")}),M&&(0,a.jsx)(r.Pd,{content:t("You have duplicated validator entries, ensure each is unique.")}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.zx,{icon:"plus",label:t("Add validator"),onClick:A}),(0,a.jsx)(r.zx,{icon:"minus",isDisabled:0===f.length,label:t("Remove validator"),onClick:P})]})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:l,icon:"plus",isDisabled:!(v&&w&&E&&f.length&&h?.gt(b.nw)),onStart:s,params:[h,d,y,w,f,x],tx:o.tx.proposeParachain?.proposeParachain})})]})})),De=n.memo((function(){const{t:e}=(0,c.$)(),{hasAccounts:s}=(0,p.x)(),[t,n]=(0,g.O)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!s,label:e("Propose"),onClick:n})}),t&&(0,a.jsx)(Te,{onClose:n})]})}));var Fe=t(74421);const Ve=(0,F.e)("useProposal",(function(e,s,t){const{api:a}=(0,i.h)(),o=(0,l.W7)(a.query.proposeParachain.proposals,[e]);return(0,n.useMemo)((()=>({id:e,isApproved:s.some((s=>s.eq(e))),isScheduled:t.some((({scheduledIds:s})=>s.some((s=>s.eq(e))))),proposal:o&&o.isSome?o.unwrap():void 0})),[s,e,o,t])})),_e=n.memo((function({approvedIds:e,id:s,scheduled:t}){const{t:o}=(0,c.$)(),{api:l}=(0,i.h)(),{allAccounts:u}=(0,p.x)(),{hasSudoKey:m,sudoKey:h}=(0,Fe.p)(),x=Ve(s,e,t),g=(0,n.useMemo)((()=>l.tx.sudo&&m?l.tx.sudo.sudo(l.tx.proposeParachain.cancelProposal(s)):u.some((e=>x.proposal?.proposer.eq(e)))?l.tx.proposeParachain.cancelProposal(s):null),[l,u,m,s,x]),b=(0,n.useMemo)((()=>l.tx.sudo?.sudo(l.tx.proposeParachain.approveProposal(s))),[l,s]),f=(0,n.useMemo)((()=>x?.proposal&&function(e,s=6){const t=e.toHex();return t.length>2*s+2?`${t.slice(0,s+2)}…${t.slice(-s)}`:"0x"===t?"":t}(x.proposal.genesisHead)),[x]),j=(0,n.useCallback)((()=>x.proposal?.validators.map((e=>(0,a.jsx)(r.ax,{value:e},e.toString())))),[x.proposal]);return(0,a.jsxs)("tr",{children:[(0,a.jsx)(r.iA.Column.Id,{value:s}),(0,a.jsx)("td",{className:"badge together",children:(x.isApproved||x.isScheduled)&&(0,a.jsx)(r.Ct,{color:"green",icon:x.isScheduled?"clock":"check"})}),(0,a.jsx)("td",{className:"badge",children:(0,a.jsx)(r.f,{id:s})}),(0,a.jsx)("td",{className:"start together",children:x.proposal?.name.toUtf8()}),(0,a.jsx)("td",{className:"address",children:x.proposal?.validators&&(0,a.jsx)(r.xH,{renderChildren:j,summary:o("Validators ({{count}})",{replace:{count:(0,d.u)(x.proposal?.validators.length)}})})}),(0,a.jsx)("td",{className:"address",children:x.proposal&&(0,a.jsx)(r.N,{value:x.proposal.proposer})}),(0,a.jsx)("td",{className:"number media--1100",children:x.proposal&&(0,a.jsx)(y.Z,{value:x.proposal.balance})}),(0,a.jsx)("td",{className:"start hash together all",children:f}),(0,a.jsx)("td",{className:"button",children:!(x.isApproved||x.isScheduled)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.cA,{accountId:h,className:"media--800",extrinsic:b,icon:"check",isDisabled:!m,label:o("Approve")}),(0,a.jsx)(r.cA,{accountId:m?h:x.proposal?.proposer,className:"media--1100",extrinsic:g,icon:"ban",isDisabled:!m||!x.proposal,label:o("Cancel")})]})})]})})),qe=n.memo((function({proposals:e}){const{t:s}=(0,c.$)(),t=(0,n.useMemo)((()=>e?.proposalIds.sort(((e,s)=>e.cmp(s)))),[e]),o=(0,n.useRef)([[s("proposals"),"start",3],[],[],[s("proposer"),"address"],[s("balance"),"media--1100"],[s("initial state"),"start media--1400"],[]]);return(0,a.jsx)(r.iA,{empty:e&&t&&s("There are no pending proposals"),header:o.current,children:e&&t?.map((s=>(0,a.jsx)(_e,{approvedIds:e.approvedIds,id:s,scheduled:e.scheduled},s.toString())))})})),Oe=n.memo((function({className:e,proposals:s}){return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(De,{}),(0,a.jsx)(qe,{proposals:s})]})})),Re=[b.If,b.um,b.Jo,b.bX,b.nr,b.Ln,b.wJ,b.ru,b.xZ,b.aP],ze={withParams:!0},He=(0,F.e)("useActionsQueue",(function(){const{api:e}=(0,i.h)(),s=(0,l.W7)(e.query.session.currentIndex),t=(0,n.useMemo)((()=>s&&Re.map((e=>s.add(e)))),[s]),a=(0,l.W7)(t&&e.query.paras.actionsQueue.multi,[t],ze);return(0,n.useMemo)((()=>a?a[0][0].map(((e,s)=>({paraIds:a[1][s],sessionIndex:e}))).filter((({paraIds:e})=>e.length)):[]),[a])})),$e={transform:([e,s])=>{const[t,a]=s.unwrapOr([null,null]);return{endBlock:a,leasePeriod:t,numAuctions:e}}},Le=(0,F.e)("useAuctionInfo",(function(){const{api:e}=(0,i.h)();return(0,X.L)([e.query.auctions?.auctionCounter,e.query.auctions?.auctionInfo],$e)}));var Be=t(74065),Ze=t(24305),We=t(12298),Ue=t(51330),Je=t(65417);const Ge=(0,t(64021).d)("modlpy/cfund"),Ye={activeCap:b.nw,activeRaised:b.nw,funds:null,isLoading:!0,totalCap:b.nw,totalRaised:b.nw},Qe=new Uint8Array(32);function Ke(e,s){return s.some((s=>s.eq(e)))}function Xe(e,s){return e.isWinner!==s.isWinner?e.isWinner?-1:1:e.isCapped!==s.isCapped?e.isCapped?-1:1:e.isEnded!==s.isEnded?e.isEnded?1:-1:0}const es={transform:([[e],s])=>e.map(((e,t)=>[e,s[t].unwrapOr(null)])).filter((e=>!!e[1])).map((([e,s])=>{return{accountId:(0,V.m)((t=e,(0,Ue.e)(Ge,t.toU8a(),Qe).subarray(0,32))),firstSlot:s.firstPeriod,info:s,isCrowdloan:!0,key:e.toString(),lastSlot:s.lastPeriod,paraId:e,value:s.raised};var t})).sort(((e,s)=>e.info.end.cmp(s.info.end)||e.info.firstPeriod.cmp(s.info.firstPeriod)||e.info.lastPeriod.cmp(s.info.lastPeriod)||e.paraId.cmp(s.paraId))),withParamsTransform:!0},ss={transform:([[e],s])=>e.filter(((e,t)=>0!==s[t].map((e=>e.unwrapOr(null))).filter((e=>!!e)).filter((([e])=>function(e){return(0,Je.S)(e.slice(0,Ge.length),Ge)}(e))).length)),withParamsTransform:!0},ts={transform:e=>e.map((({args:[e]})=>e))},as=(0,F.e)("useFunds",(function(){const{api:e}=(0,i.h)(),s=(0,x.C)(),t=(0,Be.X)(),a=(0,Ze.b)([e.events.crowdloan?.Created]),o=(0,We.k)(e.query.crowdloan?.funds,[],ts,a.blockHash),r=(0,l.W7)(e.query.crowdloan?.funds.multi,[o],es),c=(0,l.W7)(e.query.slots.leases.multi,[o],ss),[u,d]=(0,n.useState)(Ye);return(0,n.useEffect)((()=>{t.current&&s&&r&&c&&d((t=>function(e,s,t,a,n){const[o,r,i,l]=t.reduce((([s,t,a,n],{info:{cap:o,end:r,raised:i},isWinner:l})=>[e.gt(r)||l?s:s.iadd(i),e.gt(r)||l?t:t.iadd(o),a.iadd(i),n.iadd(o)]),[new(fe())(0),new(fe())(0),new(fe())(0),new(fe())(0)]),c=!n.activeCap.eq(r),u=!n.activeRaised.eq(o),d=!n.totalCap.eq(l),m=!n.totalRaised.eq(i),h=!n.funds||n.funds.length!==t.length||c||u||d||m||t.some((t=>function(e,s,{info:{cap:t,end:a,raised:n},paraId:o},r,i){const l=i.funds?.find((e=>e.paraId.eq(o)));return!l||!l.isEnded&&e.gt(a)||!l.isCapped&&t.sub(n).lt(s)||!l.isWinner&&Ke(o,r)}(e,s,t,a,n)));return h?{activeCap:c?r:n.activeCap,activeRaised:u?o:n.activeRaised,funds:t.map((t=>function(e,s,t,a){return t.isCapped=t.info.cap.sub(t.info.raised).lt(s),t.isEnded=e.gt(t.info.end),t.isWinner=Ke(t.paraId,a),t}(e,s,t,a))).sort(Xe),totalCap:d?l:n.totalCap,totalRaised:m?i:n.totalRaised}:n}(s,e.consts.crowdloan.minContribution,r,c,t)))}),[e,s,r,c,t]),u})),ns=(0,F.e)("useLeasePeriod",(function(){const{api:e}=(0,i.h)(),s=(0,x.C)();return(0,n.useMemo)((()=>{if(!e.consts.slots.leasePeriod||!s)return;const t=e.consts.slots.leasePeriod,a=s.sub(e.consts.slots.leaseOffset||b.nw),n=a.mod(t);return{currentPeriod:a.div(t),length:t,progress:n,remainder:t.sub(n)}}),[e,s])}));var os=t(51240);const rs={transform:e=>{const s=e.map((([{args:[e]},s])=>{if(s.isNone)return null;const t=s.unwrap();return{manager:t.manager.toString(),paraId:e,paraInfo:t}})).filter((e=>!!e));return{ids:s.map((({paraId:e})=>e)),owned:s}}},is={transform:([[e],s])=>e.map(((e,t)=>({hash:s[t].unwrapOr(null),paraId:e}))),withParamsTransform:!0},ls=(0,F.e)("useOwnedIds",(function(){const{api:e}=(0,i.h)(),{allAccounts:s}=(0,p.x)(),t=(0,Ze.b)([e.events.registrar.Registered,e.events.registrar.Reserved]),a=(0,os.t)(e.query.registrar.paras,[],rs,t.blockHash),o=(0,l.W7)(e.query.paras.currentCodeHash.multi,[a?a.ids:[]],is);return(0,n.useMemo)((()=>a&&o?a.owned.filter((e=>s.some((s=>s===e.manager)))).map((e=>({...e,hasCode:o.some((s=>!!s.hash&&s.paraId.eq(e.paraId)))}))):[]),[s,o,a])})),cs={defaultValue:[void 0,void 0]},us={transform:e=>e.map((({args:[e]})=>e))},ds={transform:e=>e.map((([{args:[e]},s])=>({scheduledIds:s,sessionIndex:e})))},ms=(0,F.e)("useProposals",(function(){const{api:e}=(0,i.h)(),s=(0,Be.X)(),t=(0,Ze.b)([e.events.proposeParachain?.ProposeParachain]),a=(0,We.k)(e.query.proposeParachain?.proposals,[],us,t.blockHash),o=(0,os.t)(e.query.proposeParachain?.scheduledProposals,[],ds,t.blockHash),[r,l]=(0,X.L)([e.query.session.currentIndex,e.query.proposeParachain?.approvedProposals],cs);return(0,n.useMemo)((()=>l&&r&&a&&o&&s.current?{approvedIds:l,proposalIds:a,scheduled:o.filter((e=>e.sessionIndex.gt(r)))}:void 0),[l,s,a,r,o])})),hs={transform:e=>e.map((([{args:[e]},s])=>{const t=s.unwrapOr(null);return t&&(t.isParathread||t.isUpgradingParathread||t.isOffboardingParathread||t.isOnboarding)?e:null})).filter((e=>!!e)).sort(((e,s)=>e.cmp(s)))},ps=(0,F.e)("useUpomingIds",(function(){const{api:e}=(0,i.h)(),s=(0,Ze.b)([e.events.session.NewSession,e.events.registrar.Registered]);return(0,os.t)(e.query.paras.paraLifecycles,[],hs,s.blockHash)})),xs=[0];function gs(e,s){return JSON.stringify({w:e})!==JSON.stringify({w:s})}function bs(e,s,t){return t.isNone?[]:t.unwrap().reduce(((t,a,n)=>{if(a.isSome){const[o,r,i]=a.unwrap(),l=s.leasePeriod||b.nw,[c,u]=e[n];t.push({accountId:o.toString(),firstSlot:l.addn(c),isCrowdloan:(0,Je.S)(Ge,o.subarray(0,Ge.length)),key:r.toString(),lastSlot:l.addn(u),paraId:r,value:i})}return t}),[])}function fs({endBlock:e},s,t){return{blockNumber:e&&s?s.add(e):s||b.nw,blockOffset:s||b.nw,total:t.reduce(((e,{value:s})=>e.iadd(s)),new(fe())(0)),winners:t}}const js=(0,F.e)("useWinningData",(function(e){const{api:s}=(0,i.h)(),t=(0,Be.X)(),a=(0,u.E)(),[o,r]=(0,n.useState)(),c=(0,x.C)(),d=(0,Ze.b)([s.events.auctions?.BidAccepted]),m=(0,n.useRef)(d),h=(0,l.W7)(s.query.auctions?.winning.entries),p=(0,l.W7)(s.query.auctions?.winning,xs);return(0,n.useEffect)((()=>{t.current&&e&&h&&r(function(e,s,t){return t.sort((([{args:[e]}],[{args:[s]}])=>e.cmp(s))).reduce(((t,[{args:[a]},n])=>{const o=bs(e,s,n);return o.length&&(0===t.length||gs(o,t[t.length-1].winners))&&t.push(fs(s,a,o)),t}),[]).reverse()}(a,e,h))}),[e,h,t,a]),(0,n.useEffect)((()=>{t.current&&e&&p&&r((s=>function(e,s,t,a){if(t&&t.length<=1){const n=t||[],o=fs(s,null,bs(e,s,a));return o.winners.length?n.length?(n[n.length-1]=o,n.slice()):[o]:n}return t}(a,e,s,p)))}),[e,p,t,a]),(0,n.useEffect)((()=>{if(e?.endBlock&&c&&c.gt(e.endBlock)&&m.current!==d){const n=c.sub(e.endBlock).iadd(b.If);m.current=d,s.query.auctions?.winning(n).then((s=>t.current&&r((t=>function(e,s,t,a,n){const o=fs(s,n,bs(e,s,a));if(o.winners.length){if(!t?.length)return[o];if(gs(o.winners,t[0].winners))return r=o.winners,i=t[0].winners,r.length!==i.length||r.some((({firstSlot:e,lastSlot:s,paraId:t},a)=>!t.eq(i[a].paraId)||!e.eq(i[a].firstSlot)||!s.eq(i[a].lastSlot)))?[o,...t]:(t[0]=o,[...t])}var r,i;return t}(a,e,t,s,n))))).catch(console.error)}}),[s,c,e,t,a,d,m]),o})),vs=n.memo((function({basePath:e,className:s}){const{t}=(0,c.$)(),{api:u}=(0,i.h)(),{pathname:d}=(0,o.TH)(),m=Le(),h=as(),p=ns(),x=ls(),g=js(m),b=ms(),f=He(),j=ps(),v=(0,l.W7)(u.query.paras.parachains),y=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")},{name:"parathreads",text:t("Parathreads")},u.query.proposeParachain&&{name:"proposals",text:t("Proposals")},u.query.auctions&&{name:"auctions",text:t("Auctions")},u.query.crowdloan&&{name:"crowdloan",text:t("Crowdloan")}].filter((e=>!!e)));return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,items:y.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(w,{auctionInfo:m,campaigns:h,ownedIds:x,winningData:g}),path:"auctions"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)($,{auctionInfo:m,campaigns:h,leasePeriod:p,ownedIds:x}),path:"crowdloan"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Oe,{proposals:b}),path:"proposals"})]})}),(0,a.jsx)(ge,{actionsQueue:f,className:d===e?"":"--hidden",leasePeriod:p,paraIds:v,proposals:b,threadIds:j}),(0,a.jsx)(Ee,{actionsQueue:f,className:d===`${e}/parathreads`?"":"--hidden",ids:j,leasePeriod:p,ownedIds:x})]})}))},58464:(e,s,t)=>{t.d(s,{$:()=>n});var a=t(61349);function n(){return(0,a.$G)("app-parachains")}},31132:(e,s,t)=>{t.d(s,{E:()=>c,f:()=>u});var a=t(2784),n=t(90778),o=t(11677),r=t(48801),i=t.n(r);const l=[[0,0],[0,1],[0,2],[0,3],[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]],c=(0,o.e)("useLeaseRanges",(function(){const{api:e}=(0,n.h)();return(0,a.useMemo)((()=>{if(s=e.consts.auctions?.leasePeriodsPerSlot,s){const s=[];for(let t=0;e.consts.auctions.leasePeriodsPerSlot.gtn(t);t++)for(let a=t;e.consts.auctions.leasePeriodsPerSlot.gtn(a);a++)s.push([t,a]);return s}var s;return l}),[e])})),u=(0,o.e)("useLeaseRangeMax",(function(){const e=c();return(0,a.useMemo)((()=>new(i())(e[e.length-1][1])),[e])}))},94349:(e,s,t)=>{t.d(s,{Z:()=>v});var a=t(52322),n=t(2784),o=t(61349),r=t(64348),i=t(90778),l=t(54383),c=t(54890),u=t(65874),d=t(58607),m=t(52107),h=t(95292),p=t(48801),x=t.n(p),g=t(92730),b=t(14681);const f={defaultValue:[void 0,void 0]},j=r.zo.main` + .pollActions { + opacity: 0.75; + } + + .pollAll { + margin-bottom: 0; + padding: 0.75rem 1rem; + text-align: center; + } + + .pollBlocksRight { + position: absolute; + right: 0; + text-align: right; + opacity: 0.75; + bottom: 0; + + > div { + display: inline-block; + padding: 0 0.75rem; + + &+div { + border-left: 1px solid #bbb; + } + } + } + + .pollContainer { + margin: 2rem auto; + max-width: 60rem; + } + + .pollHeader { + position: relative; + } + + .options { + margin: 1rem 0; + + .ui--Columar { + margin: 0 -1.25rem; + padding: 0 1.25rem; + + &:nth-child(odd) { + background: #f9f8f7; + } + + .ui--Column { + padding: 1rem 1.5rem; + } + } + + .optionName { + font-size: 1.2rem; + font-weight: var(--font-weight-normal); + line-height: 1; + margin-bottom: 0.75rem; + } + + .pollToggle { + margin-top: 0.5rem; + text-align: right; + } + + &:not(.canVote) { + .ui--Toggle { + opacity: 0; + + .toggle { + display: none; + } + } + } + } + + .result { + align-items: center; + display: flex; + justify-content: flex-end; + margin: 0; + text-align: right; + + .ui--FormatBalance { + font-size: 1.2rem; + font-weight: var(--font-weight-normal); + line-height: 1; + } + + .ui--Progress { + margin: 0.75rem; + } + } +`,v=n.memo((function({basePath:e,className:s}){const{t}=(0,o.$G)("app-poll"),{api:p}=(0,i.h)(),v=(0,l.C)(),[y,C]=(0,c.L)([p.query.balances?.totalIssuance,p.query.poll.totals],f),[w,N]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),[I,A]=(0,n.useState)(!1),[P,E]=(0,n.useState)(!1),[M,T]=(0,n.useState)(!1),[D,F]=(0,n.useState)(!1),[V,_]=(0,n.useState)(),q=(0,n.useRef)([{isRoot:!0,name:"poll",text:t("Denomination poll")}]);if((0,n.useEffect)((()=>{if(y&&C){const e=(0,m.x)(h.If,...C);_(C.map((s=>s.mul(h.uy).div(e)))),p.query.poll.voteOf.entries().then((e=>{const s=e.reduce(((e,[,[,s]])=>e.iadd(s)),new(x())(0)),t=s.muln(1e4).div(y).toNumber()/100;S({percentage:t,voted:s})})).catch(console.log)}}),[p,y,C]),!C||!V||!v)return(0,a.jsx)("main",{className:s,children:(0,a.jsx)("div",{className:"pollContainer",children:(0,a.jsx)(r.$j,{label:t("Retrieving totals...")})})});const O=p.consts.poll.end.sub(v),R=O.gt(h.nw),z=[[t("No change"),t("No change from the original 2017 sale definitions; will mean a total of 10 million DOT from genesis."),I,A],[t("Split of 10x"),t("Split of 10x from the original sale; will mean a total of 100 million DOT from genesis. Apparent DOT price would be 10x lower and apparent account balances 10x higher."),P,E],[t("Split of 100x"),t("Split of 100x from the original sale; will mean a total of 1 billion DOT from genesis. Apparent DOT price would be 100x lower and apparent account balances 100x higher."),M,T],[t("Split of 1000x"),t("Split of 1000x from the original sale; will mean a total of 10 billion DOT from genesis. Apparent DOT price would be 1000x lower and apparent account balances 1000x higher."),D,F]],H=I||P||M||D;return(0,a.jsxs)(j,{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,items:q.current}),(0,a.jsxs)("div",{className:"pollContainer",children:[(0,a.jsxs)("div",{className:"pollHeader",children:[(0,a.jsx)("h1",{children:t("denomination vote")}),(0,a.jsxs)("div",{className:"pollBlocksRight",children:[k&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{children:t("{{balance}} voted",{replace:{balance:(0,g.a)(k.voted)}})}),(0,a.jsx)("div",{children:t("{{percentage}}% turnout",{replace:{percentage:k.percentage.toFixed(2)}})})]}),(0,a.jsxs)("div",{children:[R?(0,a.jsx)(u.Z,{value:O}):t("Completed"),(0,a.jsxs)("div",{children:["#",(0,b.u)(p.consts.poll.end)]})]})]})]}),(0,a.jsxs)("article",{className:"keepAlive",children:[(0,a.jsx)("p",{children:(0,a.jsx)(o.cC,{children:"The Polkadot DOT denomination vote: Seventy-two hours after the DOT token becomes transferable, the most popular option from this poll will decide the denomination used for the DOT token."},"poll1")}),(0,a.jsx)("p",{children:(0,a.jsxs)(o.cC,{children:["This is an ",(0,a.jsx)("a",{href:"https://en.wikipedia.org/wiki/Approval_voting",rel:"noreferrer",target:"_blank",children:"approval vote"}),". There are four options and you may select any combination of them. The most popular of the four will be selected as the final DOT denomination three days after DOT token transfers are enabled."]},"poll2")}),(0,a.jsx)("p",{children:(0,a.jsxs)(o.cC,{children:["Please see the ",(0,a.jsx)("a",{href:"https://medium.com/polkadot-network/the-first-polkadot-vote-1fc1b8bd357b",rel:"noreferrer",target:"_blank",children:"Medium article "})," for more information"]},"poll3")}),R&&(0,a.jsx)("p",{className:"pollAll",children:(0,a.jsx)(o.cC,{children:(0,a.jsx)("b",{children:"Please vote for any combination of options"})},"poll4")}),(0,a.jsx)("div",{className:"options "+(R?"canVote":""),children:z.map((([e,s,n,o],i)=>(0,a.jsxs)(r.P0,{is60:!0,children:[(0,a.jsxs)(r.P0.Column,{className:"option",children:[(0,a.jsx)("div",{className:"optionName",children:e}),(0,a.jsx)("div",{className:"optionDesc",children:s}),R&&(0,a.jsx)(r.ZD,{className:"pollToggle",isDisabled:!R,label:t(R?n?"Aye, I support this":"Nay, I do not support this":"Voting closed"),onChange:o,value:R&&n})]}),(0,a.jsx)(r.P0.Column,{children:C[i].isZero()?(0,a.jsx)("div",{className:"result"}):(0,a.jsxs)("div",{className:"result",children:[(0,a.jsx)(d.Z,{value:C[i]}),(0,a.jsx)(r.Ex,{isDisabled:!k,total:k?.voted,value:C[i]})]})})]},i)))}),R&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.rp,{label:t("vote using my account"),onChange:N,type:"account"}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.cA,{accountId:w,icon:"paper-plane",isDisabled:!H,label:t("Vote"),params:[[I,P,M,D]],tx:p.tx.poll.vote})})]})]}),(0,a.jsx)("div",{className:"pollActions",children:(0,a.jsxs)("ul",{children:[(0,a.jsx)("li",{children:t("Any combination of the four options may be approved of by the voter. There is no need to select only one option!")}),(0,a.jsx)("li",{children:t("Approving of all or none of the options is equivalent and will not affect the outcome of the poll.")}),(0,a.jsx)("li",{children:t("All voters may alter their votes any number of times prior to the close of the poll.")}),(0,a.jsx)("li",{children:t("Voting costs nothing other than the transaction fee and can be done from all accounts with a non-zero spendable balance.")}),(0,a.jsx)("li",{children:t("Locked funds (e.g. for staking) are counted.")}),(0,a.jsx)("li",{children:t("No discretionary lock-voting is in place; all DOT used to vote counts the same.")}),(0,a.jsx)("li",{children:t("Voting is made on a per-account basis; a single account must all vote the same way and cannot split its vote.")}),(0,a.jsx)("li",{children:t('This vote does not affect any economics of the Polkadot platform. Staking rewards, inflation, effective market capitalisation and the underlying balances of every account remain completely unchanged. It is "merely" about what units we use to denominate the balances into "DOT" for the purpose of display.')})]})})]})]})}))},77311:(e,s,t)=>{t.d(s,{Z:()=>g});var a=t(52322),n=t(2784),o=t(64348),r=t(38894),i=t(67609),l=t(52450),c=t(90778),u=t(60404),d=t(95292),m=t(34323);const h=(0,m.$)(""),p={encodedHash:h,encodedLength:0,encodedProposal:null,notePreimageTx:null,storageFee:d.nw},x=n.memo((function({className:e,onChange:s}){const{t}=(0,l.$)(),{api:r,apiDefaultTxSudo:i}=(0,c.h)(),[{encodedHash:x,encodedLength:g,storageFee:b},f]=(0,n.useState)(p),j=(0,n.useCallback)((e=>{f(e),s(e)}),[s]),v=(0,n.useCallback)((e=>j(function(e,s){let t=h,a=null,n=0,o=null,r=d.nw;return s&&(a=s.method.toHex(),n=Math.ceil((a.length-2)/2),t=(0,m.$)(a),o=e.tx.preimage.notePreimage(a),r=(e.consts.preimage?.baseDeposit||d.nw).add((e.consts.preimage?.byteDeposit||d.nw).muln(n))),{encodedHash:t,encodedLength:n,encodedProposal:a,notePreimageTx:o,storageFee:r}}(r,e))),[r,j]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.u_.Columns,{className:e,hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("The image (proposal) will be stored on-chain against the hash of the contents.")}),(0,a.jsx)("p",{children:t("When submitting a proposal the hash needs to be known. Proposals can be submitted with hash-only, but upon dispatch the preimage needs to be available.")})]}),children:[(0,a.jsx)(u.Z,{defaultValue:i,label:t("propose"),onChange:v}),(0,a.jsx)(o.qG,{label:t("preimage hash"),value:x,withCopy:!0}),(0,a.jsx)(o.qG,{label:t("preimage length"),value:g||"0",withCopy:!0})]}),!b.isZero()&&(0,a.jsx)(o.u_.Columns,{className:e,hint:t("The calculated storage costs based on the base and the per-bytes fee."),children:(0,a.jsx)(o.H,{defaultValue:b,isDisabled:!0,label:t("calculated storage fee")})})]})})),g=n.memo((function({className:e,imageHash:s}){const{t}=(0,l.$)(),[c,u]=(0,r.O)(),[d,m]=(0,n.useState)(null),[{encodedHash:h,notePreimageTx:g},b]=(0,n.useState)(p),f=!s||s===h;return(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsxs)(o.u_,{className:e,header:t("Submit preimage"),onClose:u,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:t("This account will pay the fees for the preimage, based on the size thereof."),children:(0,a.jsx)(o.rp,{label:t("send from account"),labelExtra:(0,a.jsx)(i.Z,{label:(0,a.jsx)("span",{className:"label",children:t("transferrable")}),params:d}),onChange:m,type:"account"})}),(0,a.jsx)(x,{onChange:b})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:d,extrinsic:g,icon:"plus",isDisabled:!d||!f||!g,label:t("Submit preimage"),onStart:u})})]}),(0,a.jsx)(o.zx,{icon:"plus",label:t("Add preimage"),onClick:u})]})}))},69338:(e,s,t)=>{t.d(s,{Z:()=>c});var a=t(52322),n=t(2784),o=t(64348),r=t(56949),i=t(15991),l=t(52450);const c=n.memo((function({className:e="",value:s}){const{t}=(0,l.$)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:`${e} all`,children:s&&s.isCompleted?(0,a.jsxs)(a.Fragment,{children:[s.proposal&&(0,a.jsx)(i.Z,{labelHash:t("call"),value:s.proposal}),s.proposalError?(0,a.jsx)(o.oy,{content:s.proposalError}):s.proposalWarning?(0,a.jsx)(o.Pd,{content:s.proposalWarning}):null]}):(0,a.jsx)("div",{className:"--tmp",children:"balances.transfer"})}),(0,a.jsx)("td",{className:"address media--1300",children:s&&s.isCompleted?s.deposit?(0,a.jsx)(o.ax,{balance:s.deposit.amount,value:s.deposit.who,withBalance:!0}):null:(0,a.jsx)(o.ax,{className:"--tmp",value:r.TS})})]})}))},74525:(e,s,t)=>{t.d(s,{Z:()=>i});var a=t(52322),n=t(2784),o=t(64348);const r=o.zo.td` + white-space: nowrap; + + > div { + display: inline-block; + vertical-align: middle; + } + + .shortHash { + + div { + margin-left: 0.5rem; + } + } +`,i=n.memo((function({className:e="",value:s}){return(0,a.jsxs)(r,{className:`${e} hash`,children:[(0,a.jsx)("div",{className:"shortHash",children:s}),(0,a.jsx)(o.qi,{value:s})]})}))},20600:(e,s,t)=>{t.d(s,{Z:()=>S});var a=t(52322),n=t(2784),o=t(64348),r=t(52450),i=t(90778),l=t(12298),c=t(39824),u=t(11677);const d=[],m={transform:e=>e.map((({args:[e]})=>e))};function h(e){const s=[],t=[];return e.forEach((({event:{data:[e],method:a}})=>{"Noted"===a?s.push(e):t.push(e)})),{added:s,removed:t}}const p=(0,u.e)("usePreimages",(function(){const{api:e}=(0,i.h)(),s=(0,l.k)(e.query.preimage.statusFor,d,m),t=(0,c.N)([e.events.preimage.Cleared,e.events.preimage.Noted],h,s);return(0,n.useMemo)((()=>t?.map((e=>e.toHex()))),[t])}));var x=t(77311),g=t(31313),b=t(14681),f=t(69338),j=t(34814);const v=n.memo((function({className:e,value:{count:s,deposit:t,proposalHash:l,status:c}}){const{t:u}=(0,r.$)(),{api:d}=(0,i.h)(),{allAccounts:m}=(0,j.x)();return(0,n.useMemo)((()=>0===s&&c&&c.isUnrequested&&t&&m.includes(t.who)),[m,s,t,c])&&t?(0,a.jsx)(o.cA,{accountId:t.who,className:e,icon:"minus",label:u("Unnote"),params:[l],tx:d.tx.preimage.unnotePreimage}):null}));var y=t(74525);const C=n.memo((function({className:e,value:s}){const t=(0,g.CH)(s);return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(y.Z,{value:s}),(0,a.jsx)(f.Z,{value:t}),(0,a.jsx)("td",{className:"number media--1000",children:t?.proposalLength?(0,b.u)(t.proposalLength):(0,a.jsx)("span",{className:"--tmp",children:"999,999"})}),(0,a.jsx)("td",{className:"preimageStatus together media--1200",children:t?(0,a.jsxs)(a.Fragment,{children:[t.status&&(0,a.jsxs)("div",{children:[t.status?.type,0!==t.count&&(0,a.jsxs)(a.Fragment,{children:[" / ",(0,b.u)(t.count)]})]}),(0,a.jsx)(v,{value:t})]}):(0,a.jsx)("span",{className:"--tmp",children:"Unrequested"})})]})})),w=n.memo((function({className:e,hashes:s}){const{t}=(0,r.$)();return(0,a.jsx)(o.Ty,{className:e,children:(0,a.jsx)(o.Jy,{label:t("images"),children:void 0===s?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,b.u)(s.length)})})})),N=o.zo.div` + td.preimageStatus { + div+.ui--Button { + margin-top: 0.25rem; + } + } +`,k=n.memo((function({className:e}){const{t:s}=(0,r.$)(),t=p(),i=(0,n.useRef)([[s("preimages"),"start",2],[void 0,"media--1300"],[s("length"),"media--1000"],[s("status"),"start media--1200"]]);return(0,a.jsxs)(N,{className:e,children:[(0,a.jsx)(w,{hashes:t}),(0,a.jsx)(o.zx.Group,{children:(0,a.jsx)(x.Z,{})}),(0,a.jsx)(o.iA,{className:e,empty:t&&s("No hashes found"),header:i.current,children:t?.map((e=>(0,a.jsx)(C,{value:e},e)))})]})})),S=n.memo((function({basePath:e,className:s}){const{t}=(0,r.$)(),i=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:i.current}),(0,a.jsx)(k,{})]})}))},52450:(e,s,t)=>{t.d(s,{$:()=>n});var a=t(61349);function n(){return(0,a.$G)("app-preimages")}},10257:(e,s,t)=>{t.d(s,{Z:()=>I});var a=t(52322),n=t(2784),o=t(73557),r=t(1398),i=t(99501),l=t(64348),c=t(61349);function u(){return(0,c.$G)("app-ranked")}const d=["grey","grey","yellow","orange","purple","blue","green","black"],m=d[d.length-1],h=n.memo((function({className:e,value:{accountId:s,info:{rank:t}}}){const{t:n}=u();return(0,a.jsx)("tr",{className:e,children:(0,a.jsxs)("td",{className:"address all relative",children:[(0,a.jsx)(l.N,{value:s}),(0,a.jsx)(l.Vp,{className:"absolute",color:d[t.toNumber()]||m,hover:n("Membership rank"),label:t.toString()})]})})}));var p=t(14681);const x=n.memo((function({className:e,members:s}){const{t}=u();return(0,a.jsx)(l.Ty,{className:e,children:(0,a.jsx)(l.Jy,{label:t("members"),children:void 0===s?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,p.u)(s.length)})})})),g=n.memo((function({className:e,members:s}){const{t}=u(),o=(0,n.useRef)([[t("members"),"start"]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(x,{members:s}),(0,a.jsx)(l.iA,{className:e,empty:s&&t("No members found"),header:o.current,isSplit:!0,children:s?.map((e=>(0,a.jsx)(h,{value:e},e.accountId)))})]})}));var b=t(90778),f=t(9118),j=t(11677),v=t(12298),y=t(39824);const C={transform:e=>e.map((({args:[e]})=>e))};function w(e){const s=[],t=[];return e.forEach((({event:{data:[e],method:a}})=>{"MemberAdded"===a?s.push(e):t.push(e)})),{added:s,removed:t}}const N=(0,j.e)("useMemberIds",(function(e){const{api:s}=(0,b.h)(),t=(0,v.k)(s.query[e].members,[],C);return(0,y.N)([s.events[e].MemberAdded,s.events[e].MemberRemoved],w,t)})),k={transform:([[e],s])=>{const t=s.map(((s,t)=>[s.unwrapOr(null),e[t]])).filter((e=>!!e[0])).sort((([e],[s])=>s.rank.cmp(e.rank))).map((([e,s])=>({accountId:s.toString(),info:e})));return{memberIds:t.map((({accountId:e})=>e)),memberRanks:t.map((({info:e})=>e.rank)),members:t}},withParamsTransform:!0},S=(0,j.e)("useMembers",(function(e){const{api:s}=(0,b.h)(),t=N(e),a=(0,f.W7)(t&&0!==t.length&&s.query[e].members.multi,[t],k);return(0,n.useMemo)((()=>t&&0===t.length?{memberIds:[],memberRanks:[],members:[]}:a),[t,a])})),I=n.memo((function({basePath:e,className:s,palletColl:t,palletPoll:c}){const{t:d}=u(),m=S(t),h=(0,r.E)(c),p=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:d("Overview")},{name:"referenda",text:d("Referenda ({{count}})",{replace:{count:h||0}})}]),[h,d]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(l.mQ,{basePath:e,items:p}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(i.Z,{members:m?.memberIds,palletReferenda:c,palletVote:t,ranks:m?.memberRanks}),path:"referenda"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(g,{members:m?.members}),index:!0})]})})]})}))},41857:(e,s,t)=>{t.d(s,{Z:()=>r});var a=t(52322),n=t(2784),o=t(10257);const r=n.memo((function({basePath:e,className:s}){return(0,a.jsx)(o.Z,{basePath:e,className:s,palletColl:"rankedCollective",palletPoll:"rankedPolls"})}))},76288:(e,s,t)=>{t.d(s,{Z:()=>n});var a=t(1398);const n=(0,t(11677).e)("useCounter",(function(){return(0,a.E)("rankedPolls")}))},99501:(e,s,t)=>{t.d(s,{Z:()=>He});var a=t(52322),n=t(2784),o=t(77311),r=t(64348),i=t(90778),l=t(9118),c=t(34814),u=t(95292),d=t(54062),m=t(80973),h=t(11677);const p=(0,h.e)("useSummary",(function(e,s){const{api:t}=(0,i.h)(),a=(0,l.W7)(t.query[e].referendumCount),o=(0,n.useMemo)((()=>function(e=[]){return e.reduce(((e,{referenda:s=[]})=>e+s.filter((e=>e.info.isOngoing)).length),0)}(s)),[s]);return(0,n.useMemo)((()=>({refActive:o,refCount:a})),[o,a])}));var x=t(38894),g=t(98551),b=t(79760),f=t(33661),j=t(12372),v=t(57387);const y=(0,h.e)("useTrackOptions",(function(e,s,t,o){const{api:r,specName:l}=(0,i.h)();return(0,n.useMemo)((()=>function(e,s,t,n,o,r){const i=o?.map((e=>(0,j.G)(e))),l=r?.map((e=>(0,j.G)(e)));return n.filter((({id:e})=>(!i||i.some((s=>s.eq(e))))&&(!l||!l.some((s=>s.eq(e)))))).map((({id:o,info:r})=>{const i=(0,v.K2)(e,s,t,n,o.toNumber()),l=(0,v.tp)(o,r);return{text:i?.text?(0,a.jsxs)("div",{className:"trackOption",children:[(0,a.jsx)("div",{className:"normal",children:l}),(0,a.jsx)("div",{className:"faded",children:i.text})]}):l,value:o.toNumber()}}))}(r,l,e,s,t,o)),[r,o,t,e,l,s])})),C=n.memo((0,r.zo)((function({className:e,exclude:s,include:t,onChange:n,palletReferenda:o,tracks:i}){const{t:l}=(0,d.$)(),c=y(o,i,t,s);return(0,a.jsx)(r.Lt,{className:e,defaultValue:c[0].value,label:l("submission track"),onChange:n,options:c})}))` + .trackOption { + .faded { + font-size: var(--font-size-small); + font-weight: var(--font-weight-normal); + margin-top: 0.125rem; + opacity: 0.6; + } + } +`),w=r.zo.div` + .ui--Table { + font-size: var(--font-percent-small); + opacity: var(--opacity-light); + padding-left: 2rem; + } +`,N=n.memo((function({allowEmpty:e,className:s,palletReferenda:t,tracks:o,value:l}){const{t:c}=(0,d.$)(),{api:u,specName:m}=(0,i.h)(),h=(0,n.useMemo)((()=>l&&l.map((e=>[e,(0,v.K2)(u,m,t,o,e.classId.toNumber())]))),[u,t,m,o,l]);return h?(0,a.jsxs)(w,{className:s,children:[h.length?(0,a.jsx)(r.iA,{isInline:!0,children:h.map((([{casting:e,classId:s,delegating:t},n],o)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"all",children:n?.trackName||s.toString()}),(0,a.jsx)("td",{className:"together",children:t&&c("delegating")||e&&`${e.length} ${1===e.length?c("vote"):c("votes")}`})]},o)))}):(0,a.jsx)(r.Pd,{content:c("This account has no voting/delegating activity in the chain state")}),!e&&h.some((([{delegating:e}])=>e))&&(0,a.jsx)(r.Pd,{content:c("This account has some delegations in itself")})]}):null})),k={transform:([[e],s])=>e.reduce(((e,t,a)=>({...e,[t]:s[a].map((([e,s])=>({balance:s.toBn(),classId:e.toBn()})))})),{}),withParamsTransform:!0},S=(0,h.e)("useVotingLocks",(function(e,s){const{api:t}=(0,i.h)(),a=(0,n.useMemo)((()=>s?s.length?[s]:[]:void 0),[s]),o=(0,l.W7)(a?.[0]&&t.query[e]?.classLocksFor?.multi,a,k);return(0,n.useMemo)((()=>a?a[0]?(0,f.m)(t.query[e]?.classLocksFor)?o:a[0].reduce(((e,s)=>({...e,[s]:[]})),{}):{}:null),[t,o,a,e])})),I={transform:([[e],s])=>e.sort(((e,s)=>e[1].cmp(s[1]))).reduce(((e,[t,a],n)=>{let o,r;if(e[t]||(e[t]=[]),s[n].isCasting)o=s[n].asCasting.votes.map((([e])=>({refId:e})));else if(s[n].isDelegating){const{conviction:e,target:t}=s[n].asDelegating;r={conviction:e.type,targetId:t.toString()}}else console.error(`Unable to handle PalletConvictionVotingVoteVoting type ${s[n].type}`);return e[t].push({casting:o,classId:a,delegating:r}),e}),{}),withParamsTransform:!0};function A(e){return e&&Object.entries(e).reduce(((e,[s,t])=>t.reduce(((e,{classId:t})=>(e.push([s,t]),e)),e)),[])}const P=(0,h.e)("useVotingFor",(function(e,s){const{api:t}=(0,i.h)(),a=S(e,s),o=(0,n.useMemo)((()=>[A(a)]),[a]),r=(0,l.W7)(o?.[0]&&t.query[e]?.votingFor?.multi,o,I);return(0,n.useMemo)((()=>a&&o?o[0]?(0,f.m)(t.query[e]?.votingFor)?r&&function(e,s){return Object.keys(e).reduce(((e,s)=>(e[s]||(e[s]=[]),e)),s)}(a,r):a:{}:null),[t,a,o,e,r])})),E=(0,h.e)("useActivityAccount",(function(e,s){const t=(0,n.useMemo)((()=>s&&[s]||null),[s]),a=P(e,t);return a&&s?a[s]||[]:null})),M={transform:([[e],s])=>s.map(((s,t)=>s.isSome?s.unwrap()[0].toString():e[t])).reduce(((e,s)=>(e.includes(s)||e.push(s),e)),[]),withParamsTransform:!0},T=(0,h.e)("useSuperIds",(function(e){const{api:s}=(0,i.h)(),t=(0,n.useMemo)((()=>e&&[e]),[e]),a=(0,l.W7)(t&&!!t[0].length&&s.query.identity?.superOf?.multi,t,M);return(0,n.useMemo)((()=>t?t[0].length?(0,f.m)(s.query.identity?.superOf)?a:e:[]:null),[s,e,a,t])})),D=(0,h.e)("useActivity",(function(e,s){const t=T(s);return P(e,t)}));var F=t(12298);const V={transform:e=>e.map((({args:[e]})=>e.toString()))},_=(0,h.e)("useFellows",(function(){const{api:e}=(0,i.h)(),s=(0,F.k)(e.query.fellowshipCollective?.members,[],V);return(0,n.useMemo)((()=>(0,f.m)(e.query.fellowshipCollective?.members)?s:[]),[e,s])})),q=(0,h.e)("useActivityFellows",(function(e){const s=_();return D(e,s)})),O={transform:e=>e.reduce(((e,s)=>s.isSome?e.concat(s.unwrap().targets.map((e=>e.toString())).filter((s=>!e.includes(s)))):e),[])},R=(0,h.e)("useNominators",(function(){const{api:e}=(0,i.h)(),{allAccounts:s}=(0,c.x)(),t=(0,n.useMemo)((()=>[s]),[s]),a=(0,l.W7)(!!s.length&&t&&e.query.staking?.nominators?.multi,t,O);return(0,n.useMemo)((()=>(0,f.m)(e.query.staking?.nominators)&&s.length?a:[]),[s,e,a])})),z=(0,h.e)("useActivityNominators",(function(e){const s=R();return D(e,s)})),H={type:"force"},$=n.memo((function({className:e,palletReferenda:s,palletVote:t,tracks:o}){const{t:l}=(0,d.$)(),{api:u}=(0,i.h)(),{hasAccounts:m}=(0,c.x)(),[h,p]=(0,x.O)(),[j,v]=(0,x.O)(),[y,w,k]=(0,g.t)(),[S,I]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),[M,T]=(0,n.useState)(0),[D,F]=(0,n.useState)(),[V,_]=(0,n.useState)(1),O=q(t),R=z(t),$=E(t,S),L=E(t,A),[B,Z]=(0,n.useState)({index:0,type:"address"}),W=(0,n.useMemo)((()=>$&&o.filter((e=>!$.some((s=>e.id.eq(s.classId))))).map((({id:e})=>e))),[$,o]),U=(0,n.useMemo)((()=>O&&Object.entries(O).map((([e,s])=>s.length>0&&{key:e,name:e,value:e})).filter((e=>!!e))),[O]),J=(0,n.useMemo)((()=>R&&Object.entries(R).map((([e])=>({key:e,name:e,value:e}))).filter((e=>!!e))),[R]),G=(0,n.useMemo)((()=>[{text:l("Addresses"),value:"address"},(0,f.m)(u.query.staking?.nominators)&&{isDisabled:!J?.length,text:l("Validators"),value:"validators"},(0,f.m)(u.query.fellowshipCollective?.members)&&{isDisabled:!U?.length,text:l("Fellows"),value:"fellows"}]),[U,J,u,l]),Y=(0,n.useCallback)(((e,s)=>Z({index:e,type:s.toString()})),[]),Q=(0,n.useMemo)((()=>D&&V>=0&&A&&W?(j?W:[M]).map((e=>u.tx[t].delegate(e,A,V,D))):null),[u,D,V,W,j,t,A,M]),K=(0,b.b)(Q,H),X=!!(S&&$&&W&&W.length>0),ee=!(!A||!L);return(0,a.jsxs)(a.Fragment,{children:[h&&(0,a.jsxs)(r.u_,{className:e,header:l("Delegate votes {{step}}/{{numSteps}}",{replace:{numSteps:2,step:y}}),onClose:p,size:"large",children:[1===y&&(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsxs)(r.u_.Columns,{hint:l("Delegate from this account to another. All votes made on the target would count as a delegated vote for this account."),children:[(0,a.jsx)(r.rp,{label:l("delegate from account"),onChange:I,type:"account",withLabel:!0}),(0,a.jsx)(N,{allowEmpty:!0,palletReferenda:s,trackId:-1,tracks:o,value:$})]}),(0,a.jsxs)(r.u_.Columns,{align:"right",hint:l("Either delegate your votes for a single track as selected or delegate for all available tracks."),children:[(0,a.jsx)(r.ZD,{label:l("apply delegation to all tracks"),onChange:v,value:j}),!j&&W&&W.length>0&&(0,a.jsx)(C,{include:W,onChange:T,palletReferenda:s,tracks:o})]}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:l("The balance associated with the vote will be locked as per the conviction specified and will not be available for transfer during this period.")}),(0,a.jsx)("p",{children:l("Conviction locks do overlap and are not additive, meaning that funds locked during a previous vote can be locked again.")})]}),children:[(0,a.jsx)(r.xb,{accountId:S,autoFocus:!0,label:l("delegated vote value"),onChange:F}),(0,a.jsx)(r.v,{label:l("conviction"),onChange:_,value:V,voteLockingPeriod:u.consts[t].voteLockingPeriod})]})]}),2===y&&(0,a.jsxs)(r.u_.Content,{children:[G.length>1&&(0,a.jsx)(r.u_.Columns,{align:"center",hint:l("Select from a list of pre-propulated accounts (based on your account activity) or supply your own"),children:(0,a.jsx)(r.tX,{onChange:Y,options:G,value:B.index})}),(0,a.jsxs)(r.u_.Columns,{hint:l("The account that you wish to delegate to"),children:["address"===B.type?(0,a.jsx)(r.rp,{label:l("delegate to address"),onChange:P,type:"allPlus"},"address"):"validators"===B.type?(0,a.jsx)(r.rp,{defaultValue:J?.[0].value,label:l("delegate to validator"),onChange:P,options:J,type:"allPlus"},"validators"):"fellows"===B.type?(0,a.jsx)(r.rp,{defaultValue:U?.[0].value,label:l("delegate to fellow"),onChange:P,options:U,type:"allPlus"},"fellows"):null,(0,a.jsx)(N,{palletReferenda:s,trackId:j?-1:M,tracks:o,value:"fellows"===B.type?O&&!!A&&O[A]:"validators"===B.type?R&&!!A&&R[A]:L})]})]}),(0,a.jsxs)(r.u_.Actions,{children:[1!==y&&(0,a.jsx)(r.zx,{icon:"step-backward",label:l("Prev"),onClick:k}),2!==y&&(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"step-forward",isDisabled:1===y?!X:!ee,label:l("Next"),onClick:w}),(0,a.jsx)(r.cA,{accountId:S,extrinsic:K,icon:"code-merge",isDisabled:!X||!ee||2!==y,label:l("Delegate"),onStart:p})]})]}),(0,a.jsx)(r.zx,{icon:"code-merge",isDisabled:!m,label:l("Delegate"),onClick:p})]})}));var L=t(54383),B=t(31313),Z=t(86353),W=t(67609),U=t(6046),J=t(74076);const G=(0,r.zo)(r.u_)` + .originSelect, .timeSelect { + > .ui--Params-Content { + padding-left: 0; + } + } +`,Y=n.memo((function({className:e="",isMember:s,members:t,palletReferenda:o,tracks:l}){const{t:c}=(0,d.$)(),{api:m,specName:h}=(0,i.h)(),p=(0,L.C)(),[g,b]=(0,x.O)(),[f,j]=(0,n.useState)(null),[y,w]=(0,n.useState)(void 0),[N,k]=(0,n.useState)(null),[{imageHash:S,isImageHashValid:I},A]=(0,n.useState)({imageHash:null,isImageHashValid:!1}),[{imageLen:P,imageLenDefault:E,isImageLenValid:M},T]=(0,n.useState)({imageLen:u.nw,isImageLenValid:!1}),[D,F]=(0,n.useState)(0),[V,_]=(0,n.useState)(u.S8),[q,O]=(0,n.useState)(u.If),[R,z]=(0,n.useState)(),H=(0,B.CH)(S);(0,n.useEffect)((()=>{p&&z((e=>e||p.add(u.D_)))}),[p]),(0,n.useEffect)((()=>{H?.proposalLength&&T((e=>({imageLen:e.imageLen,imageLenDefault:H.proposalLength,isImageLenValid:e.isImageLenValid})))}),[H]);const $=(0,n.useMemo)((()=>(0,v.K2)(m,h,o,l,y)),[m,o,h,y,l]),Y=(0,n.useMemo)((()=>!p||(0===D?V?.lt(u.If):q?.lt(p))),[V,q,p,D]),Q=(0,n.useMemo)((()=>[{name:"origin",type:(0,U.s)(m.tx[o].submit.meta.args[0].type.toString())}]),[m,o]),K=(0,n.useMemo)((()=>$&&Array.isArray($.origin)?$.origin.map(((e,s)=>({text:Object.values(e)[0],value:s+1}))):null),[$]),X=(0,n.useMemo)((()=>!$?.origin||Array.isArray($?.origin)?N:$.origin),[N,$]),ee=(0,n.useMemo)((()=>[{text:c("After delay"),value:"after"},{text:c("At block"),value:"at"}]),[c]),se=(0,n.useCallback)((e=>k($&&Array.isArray($.origin)?$.origin[e-1]:null)),[$]),te=(0,n.useCallback)((([{isValid:e,value:s}])=>k(e?s:null)),[]),ae=(0,n.useCallback)((e=>A({imageHash:e,isImageHashValid:(0,J.vq)(e,256)})),[]),ne=(0,n.useCallback)((e=>{e&&T((s=>({imageLen:e,imageLenDefault:s.imageLenDefault,isImageLenValid:!e.isZero()})))}),[]);return(0,a.jsxs)(a.Fragment,{children:[g&&(0,a.jsxs)(G,{className:e,header:c("Submit proposal"),onClose:b,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:c("The proposal will be registered from this account and the balance lock will be applied here."),children:(0,a.jsx)(r.rp,{filter:t,label:c("propose from account"),labelExtra:(0,a.jsx)(W.Z,{label:(0,a.jsx)("span",{className:"label",children:c("transferrable")}),params:f}),onChange:j,type:"account"})}),(0,a.jsxs)(r.u_.Columns,{hint:c("The origin (and by extension track) that you wish to submit for, each has a different period, different root and acceptance criteria."),children:[(0,a.jsx)(C,{onChange:w,palletReferenda:o,tracks:l}),!$?.origin&&(0,a.jsx)(Z.ZP,{className:"originSelect",onChange:te,params:Q}),K&&(0,a.jsx)(r.Lt,{defaultValue:K[0].value,label:c("track origin"),onChange:se,options:K})]}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:c("The hash of the preimage for the proposal as previously submitted or intended.")}),(0,a.jsx)("p",{children:c("The length value will be auto-populated from the on-chain value if it is found.")})]}),children:[(0,a.jsx)(r.II,{autoFocus:!0,isError:!I,label:c("preimage hash"),onChange:ae,value:S||""}),(0,a.jsx)(r.Rn,{defaultValue:E,isDisabled:!!H?.proposalLength&&!H?.proposalLength.isZero()&&I&&M,isError:!M,label:c("preimage length"),onChange:ne,value:P},"inputLength")]}),(0,a.jsx)(r.u_.Columns,{align:"center",hint:c("The moment of enactment, either at a specific block, or after a specific number of blocks."),children:(0,a.jsx)(r.tX,{onChange:F,options:ee,value:D})}),0===D?(0,a.jsx)(r.u_.Columns,{hint:c("The number of blocks to delay enactment after proposal approval."),children:(0,a.jsx)(r.Rn,{defaultValue:u.S8,isError:Y,label:c("after number of blocks"),onChange:_,value:V})}):(0,a.jsx)(r.u_.Columns,{hint:c("A specific block to enact the proposal at."),children:(0,a.jsx)(r.Rn,{defaultValue:R,isError:Y,label:c("at specific block"),onChange:O,value:q})}),(0,a.jsx)(r.u_.Columns,{hint:c("The deposit for this proposal will be locked for the referendum duration."),children:(0,a.jsx)(r.H,{defaultValue:m.consts[o].submissionDeposit,isDisabled:!0,label:c("submission deposit")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:f,icon:"plus",isDisabled:!X||!I||!M||!f||Y||!H?.proposalHash,label:c("Submit proposal"),onStart:b,params:[X,{Lookup:H?{hash:H.proposalHash,len:P}:{hash:S,len:P}},0===D?{After:V}:{At:q}],tx:m.tx[o].submit})})]}),(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!s,label:c("Submit proposal"),onClick:b})]})}));var Q=t(56360),K=t(97794),X=t(14681),ee=t(52107),se=t(33403),te=t(65874);const ae=n.memo((function({className:e="",label:s,when:t}){const n=(0,L.C)();return(0,a.jsx)("td",{className:`${e} number`,children:n&&t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{children:s}),t.gt(n)&&(0,a.jsx)(te.Z,{value:t.sub(n)}),(0,a.jsxs)("div",{children:["#",(0,X.u)(t)]})]})})})),ne=n.memo((function({value:{info:e}}){const s=(0,n.useMemo)((()=>e.isKilled?e.asKilled:null),[e]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"all no-pad",colSpan:5}),(0,a.jsx)(ae,{label:e.type,when:s})]})}));var oe=t(15991);const re=n.memo((function({className:e="",id:s,palletReferenda:t,track:o}){const{t:l}=(0,d.$)(),{api:c}=(0,i.h)(),[u,m]=(0,x.O)(),[h,p]=(0,n.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[u&&(0,a.jsxs)(r.u_,{className:e,header:l("Place decision deposit"),onClose:m,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:l("The deposit will be registered from this account and the balance lock will be applied here."),children:(0,a.jsx)(r.rp,{label:l("deposit from account"),labelExtra:(0,a.jsx)(W.Z,{label:(0,a.jsx)("span",{className:"label",children:l("transferrable")}),params:h}),onChange:p,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:l("The referendum this deposit would apply to."),children:(0,a.jsx)(r.Rn,{defaultValue:s,isDisabled:!0,label:l("referendum id")})}),(0,a.jsx)(r.u_.Columns,{hint:l("The deposit for this proposal will be locked for the referendum duration."),children:(0,a.jsx)(r.H,{defaultValue:o.decisionDeposit,isDisabled:!0,label:l("decision deposit")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,icon:"plus",label:l("Place deposit"),onStart:m,params:[s],tx:c.tx[t].placeDecisionDeposit})})]}),(0,a.jsx)(r.zx,{icon:"plus",label:l("Decision deposit"),onClick:m})]})})),ie=n.memo((function({className:e="",id:s,palletReferenda:t}){const{t:o}=(0,d.$)(),{api:l}=(0,i.h)(),[c,u]=(0,x.O)(),[m,h]=(0,n.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsxs)(r.u_,{className:e,header:o("Refund decision deposit"),onClose:u,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("The transaction will be submitted from this account."),children:(0,a.jsx)(r.rp,{label:o("refund from account"),onChange:h,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:o("The referendum this deposit would apply to."),children:(0,a.jsx)(r.Rn,{defaultValue:s,isDisabled:!0,label:o("referendum id")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,icon:"minus",label:o("Refund deposit"),onStart:u,params:[s],tx:l.tx[t].refundDecisionDeposit})})]}),(0,a.jsx)(r.zx,{icon:"minus",label:o("Refund deposit"),onClick:u})]})})),le=r.zo.td` + .ui--AddressMini+.ui--Button { + margin-top: 0.25rem; + } +`,ce=n.memo((function({canDeposit:e,canRefund:s,className:t="",decision:n,id:o,noMedia:i,palletReferenda:l,submit:c,track:u}){return(0,a.jsxs)(le,{className:`${t} address ${i?"":"media--1000-noPad"}`,children:[c&&(0,a.jsx)(r.ax,{balance:c.amount,className:i?"":"media--1000",value:c.who,withBalance:!0}),n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.ax,{balance:n.amount,className:i?"":"media--1000",value:n.who,withBalance:!0}),s&&(0,a.jsx)("div",{className:i?"":"media--1000",children:(0,a.jsx)(ie,{id:o,palletReferenda:l})})]}):e&&u&&(0,a.jsx)("div",{className:i?"":"media--1000",children:(0,a.jsx)(re,{id:o,palletReferenda:l,track:u})})]})}));var ue=t(81661);const de=n.memo((function({accountId:e,id:s,onChange:t}){const{t:o}=(0,d.$)(),[i,l]=(0,n.useState)(),[c,u]=(0,n.useState)(),[m,h]=(0,n.useState)();return(0,n.useEffect)((()=>{t([s,{SplitAbstain:{abstain:i,aye:c,nay:m}}])}),[i,c,m,s,t]),(0,a.jsxs)(r.u_.Columns,{hint:o("The value of the balance that is to be split to the abstain, aye and nay parts of the vote"),children:[(0,a.jsx)(r.xb,{accountId:e,autoFocus:!0,label:o("abstain vote value"),onChange:l}),(0,a.jsx)(r.xb,{accountId:e,autoFocus:!0,label:o("aye vote value"),noDefault:!0,onChange:u}),(0,a.jsx)(r.xb,{accountId:e,label:o("nay vote value"),noDefault:!0,onChange:h})]})})),me=n.memo((function({accountId:e,id:s,onChange:t}){const{t:o}=(0,d.$)(),[i,l]=(0,n.useState)(),[c,u]=(0,n.useState)();return(0,n.useEffect)((()=>{t([s,{Split:{aye:i,nay:c}}])}),[i,c,s,t]),(0,a.jsxs)(r.u_.Columns,{hint:o("The value of the balance that is to be split to the aye and nay parts of the vote"),children:[(0,a.jsx)(r.xb,{accountId:e,autoFocus:!0,label:o("aye vote value"),onChange:l}),(0,a.jsx)(r.xb,{accountId:e,label:o("nay vote value"),noDefault:!0,onChange:u})]})})),he=n.memo((function({accountId:e,id:s,isAye:t,onChange:o,voteLockingPeriod:i}){const{t:l}=(0,d.$)(),[c,u]=(0,n.useState)(),[m,h]=(0,n.useState)(1);return(0,n.useEffect)((()=>{o([s,{Standard:{balance:c,vote:{aye:t,conviction:m}}}])}),[c,m,s,t,o]),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:l("The balance associated with the vote will be locked as per the conviction specified and will not be available for transfer during this period.")}),(0,a.jsx)("p",{children:l("Conviction locks do overlap and are not additive, meaning that funds locked during a previous vote can be locked again.")})]}),children:[(0,a.jsx)(r.xb,{accountId:e,autoFocus:!0,label:l(t?"aye vote value":"nay vote value"),onChange:u}),(0,a.jsx)(r.v,{label:l("conviction"),onChange:h,value:m,voteLockingPeriod:i})]})})),pe=(0,r.zo)(r.u_)` + .ui--Modal-Columns.centerVoteType > div:first-child { + text-align: center; + } +`,xe=n.memo((function({className:e,id:s,isConvictionVote:t,isMember:o,members:l,palletVote:u,preimage:m,ranks:h,trackInfo:p}){const{t:g}=(0,d.$)(),{api:b}=(0,i.h)(),{allAccounts:f,hasAccounts:j}=(0,c.x)(),[v,y]=(0,n.useState)(null),[C,w]=(0,x.O)(),[N,k]=(0,n.useState)(0),[S,I]=(0,n.useState)(),A=(0,n.useMemo)((()=>function(e,s){let t=!1;try{t=!!e.createType("PalletConvictionVotingVoteAccountVote",{SplitAbstain:{abstain:1}}).isSplitAbstain}catch{t=!1}return t?[{text:s("Aye"),value:"aye"},{text:s("Nay"),value:"nay"},{text:s("Split"),value:"split"},{text:s("Abstain"),value:"abstain"}]:[{text:s("Aye"),value:"aye"},{text:s("Nay"),value:"nay"},{text:s("Split"),value:"split"}]}(b,g)),[b,g]),P=(0,n.useMemo)((()=>function(e,s,t,a){if(s){const n=s.filter((s=>e.includes(s)));if(t&&a?.compare){const e=a.compare;return n.filter(((s,a)=>e(t[a])))}return n}return s}(f,l,h,p)),[f,l,h,p]),E=(0,n.useMemo)((()=>!o||!(!l||!P)&&!P.length),[P,o,l]);return j?(0,a.jsxs)(a.Fragment,{children:[C&&(0,a.jsxs)(pe,{className:e,header:g("Vote on referendum"),onClose:w,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[m&&(0,a.jsx)(r.u_.Columns,{hint:g("If this proposal is passed, the changes will be applied via dispatch and the deposit returned."),children:(0,a.jsx)(ue.Z,{idNumber:s,proposal:m.proposal})}),(0,a.jsx)(r.u_.Columns,{hint:g("The vote will be recorded for this account. If another account delegated to this one, the delegated votes will also be counted."),children:(0,a.jsx)(r.UE,{filter:P,onChange:y})}),t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u_.Columns,{className:"centerVoteType",hint:g("The type of vote that you wish to cast on the referendum."),children:(0,a.jsx)(r.tX,{onChange:k,options:A,value:N})}),0===N?(0,a.jsx)(he,{accountId:v,id:s,isAye:!0,onChange:I,voteLockingPeriod:b.consts[u].voteLockingPeriod}):1===N?(0,a.jsx)(he,{accountId:v,id:s,onChange:I,voteLockingPeriod:b.consts[u].voteLockingPeriod}):2===N?(0,a.jsx)(me,{accountId:v,id:s,onChange:I}):(0,a.jsx)(de,{accountId:v,id:s,onChange:I})]})]}),(0,a.jsx)(r.u_.Actions,{children:t?(0,a.jsx)(r.cA,{accountId:v,icon:"check-to-slot",label:g("Vote"),onStart:w,params:S,tx:b.tx[u].vote}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.cA,{accountId:v,icon:"ban",label:g("Vote Nay"),onStart:w,params:[s,!1],tx:b.tx[u].vote}),(0,a.jsx)(r.cA,{accountId:v,icon:"check",label:g("Vote Aye"),onStart:w,params:[s,!0],tx:b.tx[u].vote})]})})]}),(0,a.jsx)(r.zx,{icon:"check-to-slot",isDisabled:E,label:g("Vote"),onClick:w})]}):null}));var ge=t(37602);function be(e){return e instanceof ge.W?e.unwrapOr(null):e}var fe=t(58607),je=t(39824);const ve={transform:e=>e.map((({args:[,e]})=>e))},ye={transform:([[e],s])=>e.reduce(((e,[,t],a)=>(s[a]&&s[a].isSome&&(e[t.toString()]=s[a].unwrap()),e)),{}),withParamsTransform:!0};function Ce(e,s,t){const a=[];return e.forEach((({event:{data:[e,s]}})=>{t&&s.eq(t)&&a.push(e)})),{added:a}}const we=(0,h.e)("useVotes",(function(e,s,t){const{api:a}=(0,i.h)(),o=(0,F.k)(!1===t&&a.query[e].voting,[s],ve),r=(0,je.N)([a.events[e].Voted],Ce,o,s),c=(0,n.useMemo)((()=>r?.map((e=>[s,e]))),[r,s]);return(0,l.W7)(c&&a.query[e].voting.multi,[c],ye)}));function Ne(e){return e?.sort((([,e],[,s])=>s.cmp(e))).map((([e])=>(0,a.jsx)(r.ax,{value:e},e)))}const ke=n.memo((function({className:e="",id:s,isConvictionVote:t,palletVote:o,tally:i}){const{t:l}=(0,d.$)(),c=we(o,s,t),[u,m]=(0,n.useMemo)((()=>function(e={}){const s=[],t=[],a=Object.entries(e);for(let e=0,n=a.length;eNe(u)),[u]),p=(0,n.useCallback)((()=>Ne(m)),[m]);return(0,a.jsxs)("td",{className:`${e} expand media--1200-noPad`,children:[(0,a.jsx)(r.xH,{className:"media--1200",renderChildren:u&&h,summary:t?(0,a.jsxs)(a.Fragment,{children:[l("Aye"),(0,a.jsx)("div",{children:(0,a.jsx)(fe.Z,{value:i.ayes})})]}):l("Aye {{count}}",{replace:{count:(0,X.u)(i.ayes)}})}),(0,a.jsx)(r.xH,{className:"media--1200",renderChildren:m&&p,summary:t?(0,a.jsxs)(a.Fragment,{children:[l("Nay"),(0,a.jsx)("div",{children:(0,a.jsx)(fe.Z,{value:i.nays})})]}):l("Nay {{count}}",{replace:{count:(0,X.u)(i.nays)}})})]})})),Se=n.memo((function({isMember:e,members:s,palletReferenda:t,palletVote:o,ranks:l,trackInfo:c,value:{id:u,info:m,isConvictionVote:h,track:p}}){const{t:x}=(0,d.$)(),{api:g}=(0,i.h)(),{decisionDeposit:b,ongoing:f,periods:{confirmEnd:j,decideEnd:v,periodEnd:y},submissionDeposit:C,tally:w,tallyTotal:N}=(0,n.useMemo)((()=>function(e,s,t){const a=s.asOngoing,n=(0,B.uD)(e,a.proposal||a.proposalHash).proposalHash;let o=null,r=null,i=null;if(t){const{deciding:e,submitted:s}=a;if(e.isSome){const{confirming:s,since:a}=e.unwrap();s.isSome?i=s.unwrap():r=a.add(t.decisionPeriod)}else o=s.add(t.preparePeriod)}return{decisionDeposit:be(a.decisionDeposit),ongoing:a,periods:{confirmEnd:i,decideEnd:r,periodEnd:i||r||o,prepareEnd:o},proposalHash:n,submissionDeposit:be(a.submissionDeposit),tally:a.tally,tallyTotal:a.tally.ayes.add(a.tally.nays)}}(g,m,p)),[g,m,p]),k=(0,B.CH)(f.proposal||f.proposalHash);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"all",children:k?.proposal?(0,a.jsx)(oe.Z,{labelHash:x("preimage"),value:k.proposal,withHash:!0}):(0,a.jsx)("div",{className:"shortHash",children:k?.proposalHash})}),(0,a.jsx)(ce,{canDeposit:!0,decision:b,id:u,palletReferenda:t,submit:C,track:p}),(0,a.jsx)(ae,{label:x(j?"Confirming":v?"Deciding":"Preparing"),when:y}),(0,a.jsx)(ke,{id:u,isConvictionVote:h,palletVote:o,tally:w}),(0,a.jsx)("td",{className:"middle chart media--1300-noPad",children:(0,a.jsx)(r.Ex,{className:"media--1300",total:N,value:w.ayes})}),(0,a.jsx)("td",{className:"actions button",children:(0,a.jsx)(xe,{id:u,isConvictionVote:h,isMember:e,members:s,palletVote:o,preimage:k,ranks:l,trackInfo:c})})]})})),Ie=n.memo((function({palletReferenda:e,value:{id:s,info:t,track:o}}){const{decision:r,submit:i,when:l}=(0,n.useMemo)((()=>function(e){const s=e.isApproved?e.asApproved:e.isRejected?e.asRejected:e.isCancelled?e.asCancelled:e.isTimedOut?e.asTimedOut:null;return s?{decision:be(s[2]),submit:be(s[1]),when:s[0]}:{decision:null,submit:null,when:null}}(t)),[t]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"no-pad",colSpan:4}),(0,a.jsx)(ce,{canRefund:!0,className:"all",decision:r,id:s,noMedia:!0,palletReferenda:e,submit:i,track:o}),(0,a.jsx)(ae,{label:t.type,when:l})]})})),Ae={Killed:ne,Ongoing:Se},Pe=["#ff8c00","#9c3333","#339c33"],Ee="rgba(255, 140, 0, 0.1)",Me="rgba(0, 0, 140, 0.1)",Te="rgba(140, 0, 0, 0.02)",De="rgba(0, 140, 0, 0.02)",Fe="rgba(140, 140, 140, 0.2)",Ve={aspectRatio:2.25,maintainAspectRatio:!0,scales:{y:{beginAtZero:!0}}};const _e=r.zo.tr` + .shortHash { + max-width: var(--width-shorthash); + min-width: 3em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: var(--width-shorthash); + } +`,qe=n.memo((function(e){const{t:s}=(0,d.$)(),t=(0,L.C)(),o=(0,Q.n)(),{activeIssuance:i,className:l="",palletReferenda:c,value:{id:m,info:h,isConvictionVote:p,track:g,trackGraph:b}}=e,[f,v]=(0,x.O)(!1),y=(0,n.useMemo)((()=>Ae[h.type]||Ie),[h]),C=(0,n.useMemo)((()=>i&&g&&b&&function(e,s,t,a,n){if(e&&s&&t.isOngoing){const o=t.asOngoing;if(o.deciding.isSome){const{approval:t,support:r,x:i}=n,{deciding:l,tally:c}=o,{confirming:d,since:m}=l.unwrap(),h=d.unwrapOr(null),p=s?c.support:c.bareAyes,x=[],g=[[[],[],[]],[[],[],[]]],b=e.isZero()?0:p.mul(u.D_).div(e).toNumber()/10,f=c.ayes.isZero()?0:c.ayes.mul(u.D_).div(c.ayes.add(c.nays)).toNumber()/10;let j=-1,v=-1;const y=[];for(let e=0;et&&C&&f&&g&&function(e,s,t,a,n,o){const r=t.reduce(((e,{changeX:s})=>-1===e||-1===s?-1:Math.max(e,s)),0);return t.map((({changeX:t,currentY:i,endConfirm:l,labels:c,points:u,progress:d,since:m,values:h},p)=>{const x=c.length,g=0===p?100:50,b=e=>Math.max(0,Math.min(x,x*(e.sub(m).toNumber()/u[u.length-1].toNumber()))),f=-1===t?-1:x*(t/u.length),v=-1!==r&&(0,ee.x)(e,u[r].add(m)),y=l?[l.sub(n.confirmPeriod),l,l.add(n.minEnactmentPeriod)]:v?[v,v.add(n.confirmPeriod),v.add(n.confirmPeriod).add(n.minEnactmentPeriod)]:null,C=function(e,s,t,a){return([{label:n}])=>{try{const o=(0,j.G)(n.replace(/,/g,"")),r=a(o);if(o.gt(s)){const a=o.sub(s),i=new Date(Date.now()+a.mul(t).toNumber()).toLocaleString(),l=(0,K.A)(t,a,e),c=[`#${n}`,e("{{when}} (est.)",{replace:{when:i}}),l[1]];return r&&c.push(r),c}if(r)return[`#${n}`,r]}catch{}return`#${n}`}}(o,e,s,(e=>y&&e.gte(y[0])?e.lte(y[1])?o("Confirmation period"):e.lte(y[2])?o("Enactment period"):"":""));return{colors:Pe,labels:c,options:(0,se.Z)({plugins:{annotation:{annotations:(0,se.Z)({past:{backgroundColor:Fe,borderWidth:0,type:"box",xMax:b(e),xMin:0,yMax:g,yMin:0}},y?{conf:{backgroundColor:Ee,borderWidth:0,type:"box",xMax:b(y[1]),xMin:b(y[0]),yMax:g,yMin:0},enac:{backgroundColor:Me,borderWidth:0,type:"box",xMax:b(y[2]),xMin:b(y[1]),yMax:g,yMin:0}}:{},{fail:{backgroundColor:Te,borderWidth:0,type:"box",xMax:-1===f?x:f,xMin:0,yMax:i,yMin:0}},-1!==f?{pass:{backgroundColor:De,borderWidth:0,type:"box",xMax:x,xMin:f,yMax:i,yMin:0}}:{})},crosshair:{sync:{group:a.toNumber()}},tooltip:{callbacks:{title:C}}}},Ve),progress:d,values:h}}))}(t,o,C,m,g,s)),[t,o,C,m,f,s,g]),{confirmEnd:N,enactAt:k,nextAlarm:S,submittedIn:I}=(0,n.useMemo)((()=>function(e,s){let t=null,a=null,n=null,o=null;if(e.isOngoing){const{alarm:r,deciding:i,enactment:l,submitted:c}=e.asOngoing;if(a={at:l.isAt,blocks:l.isAt?l.asAt:l.asAfter,end:null},n=r.unwrapOr([null])[0],o=c,i.isSome){const{confirming:e}=i.unwrap();if(e.isSome&&(t=e.unwrap(),s)){const e=t.add(s.minEnactmentPeriod);a.end=l.isAt?(0,ee.x)(e,l.asAt):e.add(l.asAfter)}}}return{confirmEnd:t,enactAt:a,nextAlarm:n,submittedIn:o}}(h,g)),[h,g]),A=(0,n.useMemo)((()=>[[s("minimum approval"),s("current approval (failing)"),s("current approval (passing)")],[s("minimum support"),s("current support (failing)"),s("current support (passing)")]]),[s]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(_e,{className:`${l} isExpanded isFirst ${f?"":"isLast"}`,children:[(0,a.jsx)(r.iA.Column.Id,{value:m}),(0,a.jsx)(y,{...e}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:f,toggle:v})]}),(0,a.jsxs)(_e,{className:`${l} ${f?"isExpanded isLast":"isCollapsed"}`,children:[(0,a.jsx)("td",{}),(0,a.jsxs)("td",{className:"columar",colSpan:6,children:[w&&(0,a.jsxs)(r.P0,{children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.kL.Line,{legends:A[0],title:s("approval / {{percent}}%",{replace:{percent:w[0].progress.percent.toFixed(1)}}),...w[0]})}),(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.kL.Line,{legends:A[1],title:s("support / {{percent}}%",{replace:{percent:w[1].progress.percent.toFixed(1)}}),...w[1]})})]}),(0,a.jsxs)(r.P0,{size:"tiny",children:[(0,a.jsxs)(r.P0.Column,{children:[I&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:s("Submitted at")}),"#",(0,X.u)(I)]}),S&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:s("Next alarm")}),"#",(0,X.u)(S)]})]}),(0,a.jsxs)(r.P0.Column,{children:[k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:k.at?s("Enact at"):s("Enact after")}),k.at&&"#",s("{{blocks}} blocks",{replace:{blocks:(0,X.u)(k.blocks)}})]}),N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:s("Confirm end")}),"#",(0,X.u)(N)]}),k?.end&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:s("Enact end")}),"#",(0,X.u)(k.end)]})]})]}),(0,a.jsx)(r.P0,{is100:!0,size:"tiny",children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.NR,{data:m,type:c,withTitle:!0})})})]}),(0,a.jsx)("td",{})]})]})})),Oe=n.memo((function({activeIssuance:e,className:s,isMember:t,members:o,palletReferenda:l,palletVote:c,ranks:u,referenda:m,trackId:h,trackName:p,tracks:g}){const{t:b}=(0,d.$)(),{api:f,specName:j}=(0,i.h)(),[y,C]=(0,x.O)(),w=(0,n.useMemo)((()=>(0,v.K2)(f,j,l,g,h?.toNumber())),[f,j,l,g,h]),[N,k]=(0,n.useMemo)((()=>[!1,y&&w&&(0,a.jsx)("tr",{children:(0,a.jsx)("th",{colSpan:8})})]),[y,C,w]),[S,I]=(0,n.useMemo)((()=>[[[p?(0,a.jsxs)(a.Fragment,{children:[p,(0,a.jsx)("div",{className:"sub",children:w?.text})]}):b("referenda"),"start",8],null],p?`track:${p}`:"untracked"]),[N,b,w,p]);return(0,a.jsx)(r.iA,{className:s,empty:m&&b("No active referenda"),header:S,headerChildren:k,isSplit:!h,children:m?.map((s=>(0,a.jsx)(qe,{activeIssuance:e,isMember:t,members:o,palletReferenda:l,palletVote:c,ranks:u,trackInfo:w,value:s},s.key)))},I)})),Re=n.memo((function({className:e,issuanceActive:s,issuanceInactive:t,issuanceTotal:n,summary:{refActive:o,refCount:l},withIssuance:c}){const{t:u}=(0,d.$)(),{api:m}=(0,i.h)();return(0,a.jsxs)(r.Ty,{className:e,children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:u("active"),children:void 0===o?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,X.u)(o)}),(0,a.jsx)(r.Jy,{label:u("total"),children:void 0===l?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,X.u)(l)})]}),c&&(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:u("total issuance"),children:(0,a.jsx)(fe.Z,{className:n?"":"--tmp",value:n||1,withSi:!0})}),(0,f.m)(m.query.balances.inactiveIssuance)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{className:"media--1000",label:u("inactive issuance"),children:(0,a.jsx)(fe.Z,{className:t?"":"--tmp",value:t||1,withSi:!0})}),(0,a.jsx)(r.Jy,{className:"media--800",label:u("active issuance"),children:(0,a.jsx)(fe.Z,{className:s?"":"--tmp",value:s||1,withSi:!0})})]})]})]})})),ze=r.zo.div` + .ui--Dropdown.topDropdown { + min-width: 25rem; + padding-left: 0; + + > label { + left: 1.55rem !important; + } + } +`,He=n.memo((function({className:e,isConvictionVote:s,members:t,palletReferenda:h,palletVote:x,ranks:g}){const{t:b}=(0,d.$)(),{api:f}=(0,i.h)(),j=(0,l.W7)(f.query.balances.totalIssuance),v=(0,l.W7)(f.query.balances.inactiveIssuance),{allAccounts:y}=(0,c.x)(),[C,w]=(0,m.Z)(h),N=p(h,C),[k,S]=(0,n.useState)(-1),I=(0,n.useMemo)((()=>j?.sub(v||u.nw)),[v,j]),A=(0,n.useMemo)((()=>[{text:b("All active/available tracks"),value:-1}].concat(C.map((({trackId:e,trackName:s})=>({text:s,value:e?e.toNumber():-1}))).filter((e=>!!e.text)))),[C,b]),P=(0,n.useMemo)((()=>(-1===k?C:C.filter((({trackId:e})=>!!e&&e.eqn(k))))||[{referenda:[]}]),[C,k]),E=(0,n.useMemo)((()=>!t||y.some((e=>t.includes(e)))),[y,t]);return(0,a.jsxs)(ze,{className:e,children:[(0,a.jsx)(Re,{issuanceActive:I,issuanceInactive:v,issuanceTotal:j,summary:N,withIssuance:s}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.Lt,{className:"topDropdown media--800",label:b("selected track"),onChange:S,options:A,value:k}),s&&(0,a.jsx)($,{palletReferenda:h,palletVote:x,tracks:w}),(0,a.jsx)(o.Z,{}),(0,a.jsx)(Y,{isMember:E,members:t,palletReferenda:h,tracks:w})]}),P.map((({key:e,referenda:s,trackId:n,trackName:o})=>(0,a.jsx)(Oe,{activeIssuance:I,isMember:E,members:t,palletReferenda:h,palletVote:x,ranks:g,referenda:s,trackId:n,trackName:o,tracks:w},e)))]})}))},89139:(e,s,t)=>{t.d(s,{Z:()=>l});var a=t(52322),n=t(2784),o=t(64348),r=t(99501),i=t(54062);const l=n.memo((function({basePath:e,className:s}){const{t}=(0,i.$)(),l=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:l.current}),(0,a.jsx)(r.Z,{isConvictionVote:!0,palletReferenda:"referenda",palletVote:"convictionVoting"})]})}))},54062:(e,s,t)=>{t.d(s,{$:()=>n});var a=t(61349);function n(){return(0,a.$G)("app-referenda")}},1398:(e,s,t)=>{t.d(s,{E:()=>r,Z:()=>i});var a=t(2784),n=t(11677),o=t(80973);function r(e){const[s]=(0,o.Z)(e);return(0,a.useMemo)((()=>s?s.reduce(((e,{referenda:s})=>e+(s?s.filter((({info:e})=>e.isOngoing)).length:0)),0):0),[s])}const i=(0,n.e)("useCounter",(function(){return r("referenda")}))},80973:(e,s,t)=>{t.d(s,{Z:()=>f});var a=t(2784),n=t(90778),o=t(9118),r=t(11677),i=t(12298),l=t(39824);const c={transform:e=>e.map((({args:[e]})=>e))};function u(e){const s=[],t=[];return e.forEach((({event:{data:[e],method:a}})=>{"Submitted"===a?s.push(e):t.push(e)})),{added:s,removed:t}}const d=(0,r.e)("useReferendaIds",(function(e){const{api:s}=(0,n.h)(),t=(0,i.k)(s.query[e].referendumInfoFor,[],c);return(0,l.N)([s.events[e].Submitted],u,t)}));var m=t(57387);const h=(0,r.e)("useTracks",(function(e){const{api:s}=(0,n.h)();return(0,a.useMemo)((()=>s.consts[e].tracks.map((([e,s])=>({graph:(0,m.nb)(s),id:e,info:s})))),[s,e])}));function p(e,s){return(e.info.isOngoing===s.info.isOngoing?e.info.isOngoing?function(e,s){const t=e.info.asOngoing,a=s.info.asOngoing;return t.track.cmp(a.track)||(t.deciding.isSome===a.deciding.isSome?t.deciding.isSome?e.info.asOngoing.deciding.unwrap().since.cmp(s.info.asOngoing.deciding.unwrap().since):0:t.deciding.isSome?-1:1)}(e,s):0:e.info.isOngoing?-1:1)||s.id.cmp(e.id)}function x(e,s){return e.trackId&&s.trackId?e.trackId.cmp(s.trackId):e.trackId?-1:1}const g={transform:([[e],s])=>s.map(((s,t)=>s.isSome?[e[t],s.unwrap()]:null)).filter((e=>!!e)).map((([e,s])=>({id:e,info:s,isConvictionVote:(0,m.pq)(s),key:e.toString()}))),withParamsTransform:!0};function b(e,s,t){if(!t||!s)return[{key:"empty"}];if(!e)return[{key:"referenda",referenda:t.sort(p)}];const a=[],n={key:"referenda",referenda:[]};for(let o=0,r=t.length;oe.eq(r.info.asOngoing.track))):void 0;if(i){if(r.trackGraph=i.graph,r.trackId=i.id,r.track=i.info,r.isConvictionVote&&r.info.isOngoing){const{deciding:e,tally:t}=r.info.asOngoing;if(e.isSome){const{since:a}=e.unwrap();r.decidingEnd=(0,m.z9)(s,t,i.info,a)}}const e=a.find((({track:e})=>r.track===e));e?e.referenda.push(r):a.push({key:`track:${r.trackId.toString()}`,referenda:[r],track:r.track,trackGraph:r.trackGraph,trackId:r.trackId,trackName:(0,m.tp)(r.trackId,r.track)})}else n.referenda.push(r)}(n.referenda&&0!==n.referenda.length||!a.length)&&a.push(n);for(let e=0,s=a.length;e[i&&0===i.length?[{key:"referenda",referenda:[]}]:b(l,r,c),l]),[i,c,r,l])}))},57387:(e,s,t)=>{t.d(s,{K2:()=>h,nb:()=>j,pq:()=>x,tp:()=>m,z9:()=>f});var a=t(91783),n=t(14681),o=t(69543),r=t(33403),i=t(95292),l=t(52107),c=t(48801),u=t.n(c);const d=500;function m(e,{name:s}){return`${(0,n.u)(e)} / ${s.replace(/_/g," ").split(" ").map(o.KT).join(" ")}`}function h(e,s,t,n,o){let i;if(n&&void 0!==o&&-1!==o){const l=(0,a.Z)(e,s,t),c=n.find((({id:e})=>e.eqn(o)));if(c&&l){const e=c.info.name.toString(),s=l.find((({id:s,name:t})=>s===o&&t===e));s&&(i=(0,r.Z)({track:c,trackName:m(c.id,c.info)},s))}}return i}function p(e){return!!e.support&&!e.bareAyes}function x(e){return e.isOngoing&&p(e.asOngoing.tally)}function g(e,s,t){if(t.isZero())return i.ed;const a=s.mul(i.ed).div(t);if(e.isLinearDecreasing){const{ceil:s,floor:t,length:n}=e.asLinearDecreasing;return s.sub((0,l.N)(a,n).mul(s.sub(t)).div(n))}if(e.isSteppedDecreasing){const{begin:s,end:t,period:n,step:o}=e.asSteppedDecreasing;return(0,l.x)(t,s.sub((0,l.N)(s,o.mul(a).div(n))))}if(e.asReciprocal){const{factor:s,xOffset:t,yOffset:n}=e.asReciprocal,o=a.add(t);return o.isZero()?i.ed:(0,l.N)(i.ed,s.mul(i.ed).div(o).add(n))}throw new Error(`Unknown curve found ${e.type}`)}function b(e,s,t){try{if(t.isZero())return i.ed;const a=s.mul(i.ed).div(t);if(e.isLinearDecreasing){const{ceil:s,floor:t,length:n}=e.asLinearDecreasing;return a.lt(t)?i.ed:a.gt(s)?i.nw:(0,l.N)(i.ed,(0,l.x)(i.nw,s.sub(a).mul(n).div(s.sub(t))))}if(e.isSteppedDecreasing){const{begin:s,end:t,period:n,step:o}=e.asSteppedDecreasing;return a.lt(t)?i.ed:(0,l.N)(i.ed,(0,l.x)(i.nw,n.mul(s.sub((0,l.N)(a,s)).add(o.isZero()?o:o.sub(i.If))).div(o)))}if(e.asReciprocal){const{factor:s,xOffset:t,yOffset:n}=e.asReciprocal,o=a.sub(n);return o.isZero()?i.ed:(0,l.N)(i.ed,(0,l.x)(i.nw,s.mul(i.ed).div(o).sub(t)))}}catch(s){throw console.error(`Failed on curve ${e.type}:`,e.inner.toHuman()),s}throw new Error(`Unknown curve found ${e.type}`)}function f(e,s,{decisionPeriod:t,minApproval:a,minSupport:n},o){const r=p(s)?s.support:s.bareAyes;return o.add(t.mul((0,l.x)(b(a,s.ayes,s.ayes.add(s.nays)),b(n,r,e))).div(i.ed))}function j({decisionPeriod:e,minApproval:s,minSupport:t}){const a=new Array(d),n=new Array(d),o=new Array(d),r=e.divn(d),i=d-1;let l=new(u())(0);for(let c=0;c{t.d(s,{Z:()=>y});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(86135),l=t(83488),c=t(1346);const u=r.zo.section` + .ui--Output > label { + text-transform: none; + } +`,d=n.memo((function({queue:e=[]}){const s=e.filter((({error:e,result:s})=>!(0,c.o)(e)||!(0,c.o)(s))).reverse();return s.length?(0,a.jsx)(u,{className:"rpc--Results",children:s.map((({error:e,id:s,result:t,rpc:{method:n,section:o,type:i}})=>(0,a.jsx)(r.r_,{isError:!!e,label:`${s}: ${o}.${n}: ${i}`,value:e?e.message:(0,a.jsx)("pre",{children:(0,l.Z)("",t)})},s)))}):null}));var m=t(86353),h=t(6046),p=t(13529),x=t(17751),g=t(61349);function b(){return(0,g.$G)("app-rpc")}const f=p.Z.author.submitExtrinsic,j=n.memo((function({queueRpc:e}){const{t:s}=b(),[{isValid:t,rpc:o,values:i},l]=(0,n.useState)({isValid:!1,rpc:f,values:[]}),c=(0,n.useMemo)((()=>o.params.map((({isOptional:e,name:s,type:t})=>({name:s,type:(0,h.s)(e?`Option<${t}>`:t)})))),[o]),u=(0,n.useCallback)((e=>l((s=>{const{rpc:t=s.rpc,values:a=s.values}=e,n=t.params.reduce(((e,{isOptional:s})=>e+(s?0:1)),0);return{isValid:a.reduce(((e,s)=>e&&!0===s.isValid),n<=a.length),rpc:t,values:a}}))),[]),d=(0,n.useCallback)((e=>u({rpc:e,values:[]})),[u]),p=(0,n.useCallback)((e=>u({values:e})),[u]),g=(0,n.useCallback)((()=>e({rpc:o,values:i.filter((({value:e})=>!(0,x.F)(e))).map((({value:e})=>e))})),[e,o,i]);return(0,a.jsxs)("section",{className:"rpc--Selection",children:[(0,a.jsx)(r.iQ,{defaultValue:f,label:s("call the selected endpoint"),onChange:d}),(0,a.jsx)(m.ZP,{onChange:p,params:c},`${o.section}.${o.method}:params`),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"sign-in-alt",isDisabled:!t,label:s("Submit RPC call"),onClick:g})})]})})),v=n.memo((function(){const{queueRpc:e,txqueue:s}=(0,i.L)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{queueRpc:e}),(0,a.jsx)(d,{queue:s})]})})),y=n.memo((function({basePath:e}){const{t:s}=b(),t=(0,n.useRef)([{isRoot:!0,name:"rpc",text:s("Submission")}]);return(0,a.jsxs)("main",{className:"rpc--App",children:[(0,a.jsx)(r.mQ,{basePath:e,items:t.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsx)(o.AW,{path:e,children:(0,a.jsx)(o.AW,{element:(0,a.jsx)(v,{}),index:!0})})})]})}))},39117:(e,s,t)=>{t.d(s,{Z:()=>b});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(83488);const c=n.memo((function({results:e}){return e.length?(0,a.jsx)("section",{className:"runtime--Results",children:e.map((({def:{method:e,section:s,type:t},error:n,id:o,result:i})=>(0,a.jsx)(r.r_,{isError:!!n,label:`${o}: ${s}.${e}: ${t}`,value:n?n.message:(0,a.jsx)("pre",{children:(0,l.Z)("",i)})},o)))}):null}));var u=t(86353),d=t(6046),m=t(61349);function h(){return(0,m.$G)("app-runtime")}const p=n.memo((function({onSubmit:e}){const{t:s}=h(),[{isValid:t,method:o,values:i},l]=(0,n.useState)({isValid:!1,method:null,values:[]}),c=(0,n.useMemo)((()=>o?o.params.map((({name:e,type:s})=>({name:e,type:(0,d.s)(s)}))):[]),[o]),m=(0,n.useCallback)((e=>l((s=>{const{method:t=s.method,values:a=s.values}=e;return{isValid:a.reduce(((e,s)=>e&&!0===s.isValid),!!t&&t.params.length<=a.length),method:t,values:a}}))),[]),p=(0,n.useCallback)((e=>m({method:e,values:[]})),[m]),x=(0,n.useCallback)((e=>m({values:e})),[m]),g=(0,n.useCallback)((()=>{o&&e(o,i)}),[e,o,i]);return(0,a.jsxs)("section",{className:"runtime--Selection",children:[(0,a.jsx)(r.$q,{label:s("call the selected endpoint"),onChange:p}),o&&(0,a.jsx)(u.ZP,{onChange:x,params:c},`${o.section}.${o.method}:params`),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"sign-in-alt",isDisabled:!t||!o,label:s("Submit Runtime call"),onClick:g})})]})}));let x=0;const g=n.memo((function(){const{api:e}=(0,i.h)(),[s,t]=(0,n.useState)([]),o=(0,n.useCallback)((e=>t((s=>[e].concat(...s)))),[]),r=(0,n.useCallback)(((s,t)=>{e.call[s.section][s.method](...t.map((({value:e})=>e))).then((e=>o({def:s,id:++x,result:e}))).catch((e=>{o({def:s,error:e,id:++x}),console.error(e)}))}),[e,o]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{onSubmit:r}),(0,a.jsx)(c,{results:s})]})})),b=n.memo((function({basePath:e}){const{t:s}=h(),t=(0,n.useRef)([{isRoot:!0,name:"runtime",text:s("Calls")}]);return(0,a.jsxs)("main",{className:"runtime--App",children:[(0,a.jsx)(r.mQ,{basePath:e,items:t.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsx)(o.AW,{path:e,children:(0,a.jsx)(o.AW,{element:(0,a.jsx)(g,{}),index:!0})})})]})}))},14673:(e,s,t)=>{t.d(s,{Z:()=>w});var a=t(52322),n=t(2784),o=t(64348),r=t(90778),i=t(54383),l=t(9118),c=t(71679),u=t(92914),d=t(65874),m=t(14681);const h=n.memo((function({value:{at:e,image:s,imageHash:t,index:n}}){const r=(0,i.C)();return(0,a.jsxs)("tr",{children:[(0,a.jsx)(o.iA.Column.Id,{value:n}),(0,a.jsx)(u.Z,{imageHash:t,proposal:s?.proposal}),(0,a.jsx)("td",{className:"number together",children:r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Z,{value:e.sub(r)}),"#",(0,m.u)(e)]})}),(0,a.jsx)("td",{className:"button",children:!s?.proposal&&(0,a.jsx)(c.Z,{imageHash:t,isImminent:!0})}),(0,a.jsx)("td",{className:"links media--1000",children:(0,a.jsx)(o.NR,{data:n,type:"democracyReferendum"})})]})}));var p=t(61349);function x(){return(0,p.$G)("app-scheduler")}const g=n.memo((function({className:e}){const{t:s}=x(),{api:t}=(0,r.h)(),c=(0,i.C)(),u=(0,l.W7)(t.derive.democracy.dispatchQueue),d=(0,n.useMemo)((()=>c&&u?.filter((({at:e})=>e.gte(c))).sort(((e,s)=>e.at.cmp(s.at)))),[c,u]),m=(0,n.useRef)([[s("dispatch queue"),"start",2],[s("enact")],[],[void 0,"media--1000"]]);return(0,a.jsx)(o.iA,{className:e,empty:d&&s("Nothing queued for execution"),header:m.current,children:d?.map((e=>(0,a.jsx)(h,{value:e},e.index.toString())))})}));var b=t(74525),f=t(31313),j=t(15991);const v=n.memo((function({bestNumber:e,className:s="",value:{blockNumber:t,call:n,maybeId:o,maybePeriodic:r,preimageHash:i}}){const l=(0,f.CH)(i),c=r.unwrapOr(null),u=o.unwrapOr(null);return(0,a.jsxs)("tr",{className:s,children:[(0,a.jsx)("td",{className:"all",children:(0,a.jsx)(j.Z,{value:n||l?.proposal})}),u?u.isAscii?(0,a.jsx)("td",{className:"start",children:u.toUtf8()}):(0,a.jsx)(b.Z,{value:u.toHex()}):(0,a.jsx)("td",{}),(0,a.jsx)("td",{className:"number together",children:e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Z,{value:t.sub(e)}),"#",(0,m.u)(t)]})}),(0,a.jsx)("td",{className:"number together",children:c&&(0,m.u)(c[0])}),(0,a.jsx)("td",{className:"number together",children:c&&(0,m.u)(c[1])})]})})),y={transform:(e,s)=>e.filter((([,e])=>e.some((e=>e.isSome)))).reduce(((e,[t,a])=>{const n=t.args[0];return a.filter((e=>e.isSome)).map((e=>e.unwrap())).reduce(((e,{call:t,maybeId:a,maybePeriodic:o,priority:r},i)=>{let l,c=null;if(t.inner)if(t.isValue)c=t.asValue;else if(t.isInline)try{c=s.registry.createType("Call",t.asInline.toHex())}catch(e){console.error(e)}else t.isLookup&&(l=t);else c=t;return e.push({blockNumber:n,call:c,key:`${n.toString()}-${i}`,maybeId:a,maybePeriodic:o,preimageHash:l,priority:r}),e}),e)}),[])},C=n.memo((function({className:e=""}){const{t:s}=x(),{api:t}=(0,r.h)(),c=(0,i.C)(),u=(0,l.W7)(t.query.scheduler.agenda.entries,void 0,y),d=(0,n.useMemo)((()=>c&&u?.filter((({blockNumber:e})=>e.gte(c))).sort(((e,s)=>e.blockNumber.cmp(s.blockNumber)))),[c,u]),m=(0,n.useRef)([[s("scheduled"),"start"],[s("id"),"start"],[s("remaining")],[s("period")],[s("count")]]);return(0,a.jsx)(o.iA,{className:e,empty:d&&s("No active schedules"),header:m.current,children:d?.map((e=>(0,a.jsx)(v,{bestNumber:c,value:e},e.key)))})})),w=n.memo((function({basePath:e,className:s}){const{t}=x(),{api:i}=(0,r.h)(),l=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:t("Overview")}]),[t]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:l}),i.query.democracy&&(0,a.jsx)(g,{}),i.query.scheduler&&(0,a.jsx)(C,{})]})}))},19433:(e,s,t)=>{t.d(s,{Z:()=>ue});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(46782),c=t.n(l),u=t(94953),d=t(54926),m=t(38894),h=t(16039),p=t(61349);function x(){return(0,p.$G)("app-settings")}const g=r.zo.div` + .label { + font-style: italic; + margin-top: 0.5rem; + + +div { + margin-left: 1rem; + } + } +`,b=n.memo((function({className:e="",onChange:s,original:t,tkey:o,tval:i}){const l=(0,n.useCallback)((e=>s(o,e)),[s,o]);return(0,a.jsxs)(g,{className:e,children:[(0,a.jsx)("div",{className:"label",children:t}),(0,a.jsx)(r.II,{onChange:l,value:i,withLabel:!1})]})})),f=new Map;async function j(e){if(f.has(e))return f.get(e);const s=await fetch(`locales/${e}`).then((e=>e.json())).catch((e=>console.error(e)));return f.set(e,s),s||{}}function v(e,s){const t={};let a=0,n=0;return Object.keys(e).forEach((o=>{const r=e[o],i=Object.keys(r).length;let l=0;Object.keys(r).forEach((e=>{s[e]&&l++})),a+=l,n+=i,t[o]=[l,i,0]})),[[a,n,0],t]}function y([e,s,t]=[0,0,0]){return{done:e,progress:(s?100*e/s:100).toFixed(2),total:s}}const C=r.zo.main` + .ui--Column { + display: flex; + + > div:first-child { + flex: 1; + text-align: right; + } + } + + .ui--Progress { + margin: 0 0 0 0.25rem; + } + + .toggleWrapper { + display: flex; + justify-content: flex-end; + margin-top: 0.75rem; + } +`,w=n.memo((function({className:e}){const{t:s}=x(),[t,o]=(0,m.O)(),[{english:i,keys:l,modules:p},g]=(0,n.useState)({english:{},keys:[],modules:[]}),[f,w]=(0,n.useState)("zh"),[[N,k],S]=(0,n.useState)([[0,0,0],{}]),[I,A]=(0,n.useState)("app-accounts.json"),[P,E]=(0,n.useState)(null);(0,n.useEffect)((()=>{(async function(){const e=(await j("index.json")).filter((e=>"en"!==e)),s=e.filter((e=>!d.Z[e])),t=await async function(){const e=await j("en/index.json");return(await Promise.all(e.map((e=>j(`en/${e}`))))).reduce(((s,t,a)=>(s[e[a]]=t,s)),{})}(),a=s.length?await Promise.all(s.map((e=>j(`${e}/translation.json`)))):[];return s.forEach(((e,s)=>{d.Z[e]=a[s]})),e.forEach((e=>{Object.keys(t).forEach((s=>{Object.keys(t[s]).forEach((s=>{d.Z[e][s]||(d.Z[e][s]="")}))}))})),{english:t,keys:e.map((e=>({text:e,value:e}))),modules:Object.keys(t).map((e=>({text:e.replace(".json","").replace("app-","page-"),value:e}))).sort(((e,s)=>e.text.localeCompare(s.text)))}})().then(g).catch(console.error)}),[]),(0,n.useEffect)((()=>{E(d.Z[f]),S(v(i,d.Z[f]))}),[i,f]),(0,n.useEffect)((()=>{w(l.some((({value:e})=>e===h.X.i18nLang))?h.X.i18nLang:"zh")}),[l]);const M=(0,n.useCallback)(((e,s)=>{E((t=>t?{...t,[e]:s}:null));const t=!!d.Z[f][e],a=s.trim();if(d.Z[f][e]=s,t!==!!a){const[e,s]=v(i,d.Z[f]);S((([t])=>(e[2]=Math.max(0,e[0]-t[0]),[e,s])))}}),[i,f]),T=(0,n.useCallback)((()=>{u.Z.reloadResources().catch(console.error)}),[]),D=(0,n.useCallback)((()=>function(e,s){const t=Object.keys(e).sort().reduce(((t,a)=>{const n=e[a].trim();return(n||s)&&(t[a]=n),t}),{});c().saveAs(new Blob([JSON.stringify(t,null,2)],{type:"application/json; charset=utf-8"}),"translation.json")}(P||{},t)),[P,t]);return l.length?(0,a.jsxs)(C,{className:e,children:[(0,a.jsx)("header",{children:(0,a.jsxs)(r.P0,{children:[(0,a.jsxs)(r.P0.Column,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.Lt,{isFull:!0,label:s("the language to display translations for"),onChange:w,options:l,value:f}),s("{{done}}/{{total}}, {{progress}}% done",{replace:y(N)})]}),(0,a.jsx)(r.Ex,{total:N[1],value:N[0]})]}),(0,a.jsxs)(r.P0.Column,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.Lt,{isFull:!0,label:s("the module to display strings for"),onChange:A,options:p,value:I}),s("{{done}}/{{total}}, {{progress}}% done",{replace:y(k[I])})]}),(0,a.jsx)(r.Ex,{total:k[I]?.[1],value:k[I]?.[0]})]})]})}),(0,a.jsx)("div",{className:"toggleWrapper",children:(0,a.jsx)(r.ZD,{label:s(t?"include all empty strings in the generated file":"do not include empty strings in the generated file"),onChange:o,value:t})}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.zx,{icon:"sync",label:s("Apply to UI"),onClick:T}),(0,a.jsx)(r.zx,{icon:"download",label:s("Generate {{lng}}/translation.json",{replace:{lng:f}}),onClick:D})]}),I&&P&&Object.keys(i[I]).map(((e,s)=>(0,a.jsx)(b,{onChange:M,original:i[I][e],tkey:e,tval:P[e]},s)))]}):(0,a.jsx)(r.$j,{})}));var N=t(9652),k=t(57139),S=t(11677),I=t(85617),A=t(65968),P=t(92730),E=t(41444);const M=(0,S.e)("useChainInfo",(function(){const{api:e,apiEndpoint:s,isApiReady:t,isEthereum:a,specName:o,systemChain:r,systemName:l}=(0,i.h)();return(0,n.useMemo)((()=>t?{chain:r,chainType:a?"ethereum":"substrate",color:s?.ui.color,genesisHash:e.genesisHash.toHex(),icon:(0,N.t)(l,o),metaCalls:(0,E.h$)(e.runtimeMetadata.asCallsOnly.toU8a()),specVersion:e.runtimeVersion.specVersion.toNumber(),ss58Format:(0,A.h)(e.registry.chainSS58)?e.registry.chainSS58:k.DEFAULT_SS58.toNumber(),tokenDecimals:(e.registry.chainDecimals||[k.DEFAULT_DECIMALS.toNumber()])[0],tokenSymbol:(e.registry.chainTokens||P.a.getDefaults().unit)[0],types:(0,I.kh)(e.registry,r,e.runtimeVersion.specName,e.runtimeVersion.specVersion)}:null),[e,s,t,o,r,l,a])}));var T=t(79444),D=t(84522),F=t(11818);const V=(0,r.zo)(r.iA)` + table { + overflow: visible; + } +`,_=n.memo((function({chainInfo:e,className:s}){const{t}=x(),{extensions:o}=(0,F.Z)(),[i,l]=(0,n.useState)(0),[c,u]=(0,m.O)(),d=(0,n.useMemo)((()=>(o||[]).map((({extension:{name:e,version:s}},t)=>function(e,s,t){return{text:(0,a.jsxs)("div",{className:"ui--Dropdown-item",children:[(0,a.jsx)("img",{alt:e,className:"ui--Dropdown-icon",src:t}),(0,a.jsx)("div",{className:"ui--Dropdown-name",children:e})]},s),value:s}}(`${e} ${s}`,t,T.J[e]?.ui.logo||D.h)))),[o]),h=(0,n.useCallback)((()=>{e&&o?.[i]&&(u(),o[i].update(e).catch((()=>!1)).then((()=>u())).catch(console.error))}),[e,o,i,u]),p=(0,n.useRef)([[t("Extensions"),"start"]]);return(0,a.jsx)(V,{className:s,empty:t("No Upgradable extensions"),header:p.current,children:o?0!==d.length&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("tr",{className:"isExpanded isFirst",children:(0,a.jsx)("td",{children:(0,a.jsx)(r.Lt,{label:t("upgradable extensions"),onChange:l,options:d,value:i})})}),(0,a.jsx)("tr",{className:"isExpanded isLast",children:(0,a.jsx)("td",{children:(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"upload",isDisabled:c,label:t("Update metadata"),onClick:h})})})})]}):(0,a.jsx)(r.$j,{})})}));var q=t(27421);const O=r.zo.div((({color:e})=>`\n background-color: ${e||"white"} !important;\n width: 100px;\n flex: 1;\n border-radius: 4px;\n`)),R=n.memo((function({className:e,color:s}){return(0,a.jsx)(O,{className:e,color:s})}));function z(){let e="#";for(let s=0;s<6;s++)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e}const H={chainType:"substrate",color:"#FFFFFF",decimals:0,genesisHash:"",prefix:0,title:"",unit:"UNIT"},$=(0,r.zo)(r.iA)` + td { + padding: 0; + + .input.ui--Input input { + border: none !important; + background: transparent; + } + } + + .settings--networkSpecs-name { + position: relative; + + .settings--networkSpecs-logo { + height: 32px; + left: 12px; + position: absolute; + top: 1rem; + width: 32px; + } + } + + .settings--networkSpecs-color { + position: relative; + + > div:first-child { + display: flex; + + .settings--networkSpecs-colorInput { + min-width: 124px; + } + + .settings--networkSpecs-colorChangeButton { + user-select: none; + cursor: pointer; + background: transparent; + border: none; + outline: none; + align-self: flex-end; + padding-bottom: 0.9rem; + } + } + + .settings--networkSpecs-colorBar { + border-radius: 50%; + border: 1px solid grey; + height: 32px; + left: 12px; + position: absolute; + top: 1rem; + width: 32px; + } + } + + .settings--networkSpecs-qr { + margin: 0.25rem auto; + max-width: 15rem; + + img { + border: 1px solid white; + } + } +`,L=n.memo((function({chainInfo:e,className:s}){const{t}=x(),{isApiReady:o,systemChain:l}=(0,i.h)(),[c,u]=(0,n.useState)(H),d=(0,q.N)(c,500),[m,h]=(0,n.useReducer)(((e,s)=>{const t={...e,...s};return u(t),t}),H);(0,n.useEffect)((()=>{e&&h({chainType:e.chainType,color:e.color||z(),decimals:e.tokenDecimals,genesisHash:e.genesisHash,prefix:e.ss58Format,title:l,unit:e.tokenSymbol})}),[e,l]);const p=(0,n.useCallback)((e=>h({color:e})),[]),g=(0,n.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),h({color:z()})}),[]),b=(0,n.useCallback)((()=>/^#[\da-fA-F]{6}|#[\da-fA-F]{3}$/.test(m.color)),[m]),f=(0,n.useRef)([[t("chain specifications"),"start",2]]);return o?(0,a.jsxs)($,{className:s,empty:t("No open tips"),header:f.current,children:[(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"settings--networkSpecs-name",children:[(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("Network Name"),value:m.title}),(0,a.jsx)(r.Mj,{className:"settings--networkSpecs-logo"})]})}),(0,a.jsx)("td",{rowSpan:7,children:c.genesisHash&&(0,a.jsx)(r.K0,{className:"settings--networkSpecs-qr",networkSpecs:d})})]}),(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"settings--networkSpecs-color",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.II,{className:"full settings--networkSpecs-colorInput",isError:!b(),label:t("Color"),onChange:p,value:m.color}),(0,a.jsx)("a",{className:"settings--networkSpecs-colorChangeButton",onClick:g,children:t("generate random color")})]}),(0,a.jsx)(R,{className:"settings--networkSpecs-colorBar",color:m.color})]})})}),(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("Genesis Hash"),value:m.genesisHash})})}),(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("Unit"),value:m.unit})})}),(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("Address Prefix"),value:m.prefix.toString()})})}),(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("Decimals"),value:m.decimals.toString()})})}),(0,a.jsx)("tr",{children:(0,a.jsx)("td",{children:(0,a.jsx)(r.II,{className:"full",isDisabled:!0,label:t("Chain Type"),value:m.chainType})})})]}):(0,a.jsx)(r.$j,{})}));function B(){const{isDevelopment:e}=(0,i.h)(),s=M();return(0,a.jsxs)(a.Fragment,{children:[!e&&(0,a.jsx)(_,{chainInfo:s}),(0,a.jsx)(L,{chainInfo:s})]})}var Z=t(23729),W=t.n(Z),U=t(81369),J=t(56623),G=t(43357),Y=t(64021);const Q="{\n\n}",K={},X=r.zo.div` + .editor { + height: 21rem; + margin-left: 2rem; + position: relative; + } + + .help { + padding: 0.5rem 2rem; + } +`,ee=n.memo((function({className:e="",onStatusChange:s}){const{t}=x(),{api:o}=(0,i.h)(),[l,c]=(0,n.useState)(Q),[u,d]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!0),[g,b]=(0,n.useState)(K),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(null);(0,n.useEffect)((()=>{const e=(0,U.decodeUrlTypes)()||W().get("types")||{};Object.keys(e).length&&(c(JSON.stringify(e,null,2)),b({}),j(Object.keys(e).join(", ")),y((0,U.encodeUrlTypes)(e)))}),[]);const C=(0,n.useCallback)((({code:e,isJsonValid:s,isTypesValid:t,types:a,typesPlaceholder:n})=>{c(e),d(s),h(t),b(a),j(n)}),[]),w=(0,n.useCallback)((()=>{W().remove("types"),C({code:Q,isJsonValid:!0,isTypesValid:!0,types:K,typesPlaceholder:null})}),[C]),N=(0,n.useCallback)((e=>{const s=(0,J.z)(e);try{const e=JSON.parse(s),t=Object.keys(e).join(", ");console.log("Detected types:",t),C({code:s,isJsonValid:!0,isTypesValid:!0,types:0===Object.keys(e).length?{}:e,typesPlaceholder:t})}catch(e){console.error("Error registering types:",e),C({code:s,isJsonValid:!1,isTypesValid:!1,types:{},typesPlaceholder:e.message})}}),[C]),k=(0,n.useCallback)((e=>{try{if(!(0,G.b)(e))throw Error("This is not a valid JSON object.");N((0,Y.d)(e))}catch(s){c(e),d(!1),j(s.message)}}),[N]),S=(0,n.useCallback)((()=>{let e=null;try{o.registerTypes(g),W().set("types",g),h(!0),s({action:t("Your custom types have been added"),status:"success"}),Object.keys(g).length&&(e=(0,U.encodeUrlTypes)(g),console.log(e))}catch(e){console.error(e),h(!1),s({action:t(`Error saving your custom types. ${e.message}`),status:"error"})}y(e)}),[o,s,t,g]),I=0===Object.keys(g).length;return(0,a.jsxs)(X,{className:e,children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)("div",{className:"full",children:(0,a.jsx)(r.ht,{clearContent:I&&m,isError:!m,label:t("Additional types as a JSON file (or edit below)"),onChange:N,placeholder:f})})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)("div",{className:"full",children:(0,a.jsx)(r.ML,{className:"editor",code:l,isValid:u,onEdit:k})})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)("div",{className:"full",children:(0,a.jsx)(p.cC,{i18nKey:"devConfig",children:(0,a.jsxs)("div",{className:"help",children:["If you are a development team with at least a test network available, consider adding the types directly ",(0,a.jsx)("a",{href:"https://github.com/polkadot-js/apps/tree/master/packages/apps-config",rel:"noopener noreferrer",target:"_blank",children:"to the apps-config"}),", allowing out of the box operation for your spec & chains, both for you and anybody trying to connect to it. This is not a replacement for your chain-specific UI, however doing so does help in allowing users to easily discover and use with zero-config."]})})})}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.qi,{label:t("Share"),type:t("url"),value:v}),(0,a.jsx)(r.zx,{icon:"sync",label:t("Reset"),onClick:w}),(0,a.jsx)(r.zx,{icon:"save",isDisabled:!m||!u,label:t("Save"),onClick:S})]})]})}));var se=t(9242),te=t(37417),ae=t(72570),ne=t(83337),oe=t(45479),re=t(35189);const ie=h.X.availableLedgerConn,le=n.memo((function({className:e=""}){const{t:s}=x(),{chainSS58:t,isApiReady:o,isElectron:l}=(0,i.h)(),{isIpfs:c}=(0,ne.g)(),{hasLedgerChain:u,hasWebUsb:d}=(0,oe.c)(),[m,p]=(0,n.useState)(null),[g,b]=(0,n.useState)((()=>{const e=h.X.get();return{...e,uiTheme:"dark"===e.uiTheme?"dark":"light"}})),f=(0,n.useMemo)((()=>ie.filter((({value:e})=>!l||"webusb"!==e))),[l]),j=(0,n.useMemo)((()=>h.X.availableIcons.map((e=>(0,re.tI)(e,["default"]))).concat((0,re.tI)({info:"robohash",text:"RoboHash",value:"robohash"}))),[]),v=(0,n.useMemo)((()=>{const e=ae.FA.find((({prefix:e})=>e===t));return(0,se.M)(s).map((s=>(0,re.SX)(s,["default"],"empty",-1===s.value?o?e?` (${e.displayName}, ${t||0})`:` (${t||0})`:void 0:` (${s.value})`)))}),[t,o,s]),y=(0,n.useMemo)((()=>[{text:s("Allow local in-browser account storage"),value:"on"},{text:s("Do not allow local in-browser account storage"),value:"off"}]),[s]),C=(0,n.useMemo)((()=>[{text:s("Light theme"),value:"light"},{text:s("Dark theme"),value:"dark"}]),[s]),w=(0,n.useMemo)((()=>(0,te.L)(s)),[s]);(0,n.useEffect)((()=>{const e=h.X.get(),s=Object.entries(g).some((([s,t])=>e[s]!==t)),t=e.apiUrl!==g.apiUrl||e.prefix!==g.prefix;p(s?t:null)}),[g]);const N=(0,n.useCallback)((e=>s=>b((t=>({...t,[e]:s})))),[]),k=(0,n.useCallback)((()=>(0,re.wg)(g)),[g]),S=(0,n.useCallback)((()=>{(0,re.a1)(g),p(null)}),[g]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)("h1",{children:s("UI options")}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{defaultValue:g.icon,label:s("default icon theme"),onChange:N("icon"),options:j})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{defaultValue:g.uiTheme,label:s("default interface theme"),onChange:N("uiTheme"),options:C})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{defaultValue:g.i18nLang,label:s("default interface language"),onChange:N("i18nLang"),options:w})}),(0,a.jsx)("h1",{children:s("account options")}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{defaultValue:g.prefix,label:s("address prefix"),onChange:N("prefix"),options:v})}),!c&&!l&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{defaultValue:g.storage,label:s("in-browser account creation"),onChange:N("storage"),options:y})}),"on"===g.storage&&(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Pd,{content:s("It is recommended that you store all keys externally to the in-page browser local storage, either on browser extensions, signers operating via QR codes or hardware devices. This option is provided for advanced users with strong backup policies.")})})]}),u&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{defaultValue:d?g.ledgerConn:f[0].value,isDisabled:!d,label:s("manage hardware connections"),onChange:N("ledgerConn"),options:f})}),d?"none"!==g.ledgerConn?(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Pd,{content:s("Ledger support is still experimental and some issues may remain. Trust, but verify the addresses on your devices before transferring large amounts. There are some features that will not work, including batch calls (used extensively in staking and democracy) as well as any identity operations.")})}):null:(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Pd,{content:s("Ledger hardware device support is only available on Chromium-based browsers where WebUSB and WebHID support is available in the browser.")})})]}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"save",isDisabled:null===m,label:s(m?"Save & Reload":"Save"),onClick:m?k:S})})]})}));var ce=t(76075);const ue=n.memo((function({basePath:e,onStatusChange:s}){const{t}=x(),{api:l,isApiConnected:c,isApiReady:u,isDevelopment:d}=(0,i.h)(),m=(0,ce.Z)(),h=(0,n.useMemo)((()=>[{isRoot:!0,name:"general",text:t("General")},{count:m,name:"metadata",text:t("Metadata")},{name:"developer",text:t("Developer")},{name:"i18n",text:t("Translate")}]),[m,t]),p=(0,n.useMemo)((()=>c&&u?d||l.runtimeMetadata.version<=13?[]:["developer"]:["metadata","i18n"]),[l,c,u,d]);return(0,a.jsxs)("main",{className:"settings--App",children:[(0,a.jsx)(r.mQ,{basePath:e,hidden:p,items:h}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(ee,{onStatusChange:s}),path:"developer"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(w,{}),path:"i18n"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(B,{}),path:"metadata"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(le,{}),index:!0})]})})]})}))},76075:(e,s,t)=>{t.d(s,{Z:()=>o});var a=t(11677),n=t(11818);const o=(0,a.e)("useCounter",(function(){const{count:e}=(0,n.Z)();return e}))},11818:(e,s,t)=>{t.d(s,{Z:()=>m});var a=t(2784),n=t(23729),o=t.n(n),r=t(90778),i=t(11677);let l=0;const c=new Map;function u(e,{name:s,version:t}){const a=`properties:${e.genesisHash.toHex()}`,n=o().get(a,{});n[s]={extensionVersion:t,ss58Format:e.registry.chainSS58,tokenDecimals:e.registry.chainDecimals[0],tokenSymbol:e.registry.chainTokens[0]},o().set(a,n)}const d={count:0,extensions:[]},m=(0,i.e)("useExtensions",(function(){const{api:e,extensions:s,isApiReady:t,isDevelopment:n}=(0,r.h)(),[i,m]=(0,a.useState)(),[h,p]=(0,a.useState)(0);return(0,a.useEffect)((()=>{const e=`${++l}-${Date.now()}`;return c.set(e,p),()=>{c.delete(e)}}),[]),(0,a.useEffect)((()=>{s&&async function(e,s,t){return(await Promise.all(s.map((s=>async function(e,s){if(!s.metadata)return null;try{const t=s.metadata,a=await t.get();return{extension:s,known:a,update:async a=>{let n=!1;try{n=await t.provide(a),n&&(u(e,s),[...c.values()].forEach((e=>e(Date.now()))))}catch{}return n}}}catch{return null}}(e,s))))).filter((e=>!!e))}(e,s).then(m).catch(console.error)}),[e,s,h]),(0,a.useMemo)((()=>!n&&t&&i?function(e,s){const t=s.map((s=>{const t=s.known.find((({genesisHash:s})=>e.genesisHash.eq(s)))||null;return t&&!e.runtimeVersion.specVersion.gtn(t.specVersion)&&function(e,{extension:s}){const t=o().get(`properties:${e.genesisHash.toHex()}`,{});if(!t[s.name])return u(e,s),!0;const{ss58Format:a,tokenDecimals:n,tokenSymbol:r}=t[s.name];return a===e.registry.chainSS58&&n===e.registry.chainDecimals[0]&&r===e.registry.chainTokens[0]}(e,s)?null:{...s,current:t}})).filter((e=>!!e));return{count:t.length,extensions:t}}(e,i):d),[i,e,t,n])}))},35189:(e,s,t)=>{t.d(s,{SX:()=>r,a1:()=>l,tI:()=>i,wg:()=>c});var a=t(52322),n=(t(2784),t(64348)),o=t(16039);function r({info:e,isHeader:s,text:t,value:o},r=[],i="empty",l){return s?(0,a.jsx)(n.Lt.Header,{content:t},t):{text:(0,a.jsxs)("div",{className:"ui--Dropdown-item",children:[(0,a.jsx)(n.Mj,{className:"ui--Dropdown-icon",logo:e&&r.includes(e)?i:e}),(0,a.jsxs)("div",{className:"ui--Dropdown-name",children:[t,l]})]},o),value:o}}function i({info:e,text:s,value:t},o=[],r="empty"){const i=e&&o.includes(e)?r:e;return{text:(0,a.jsxs)("div",{className:"ui--Dropdown-item",children:["empty"===i?(0,a.jsx)(n.Mj,{className:"ui--Dropdown-icon",logo:"empty"}):(0,a.jsx)(n.k,{className:"ui--Dropdown-icon",size:32,theme:i,value:"5F9999K9UgTUgSsbXZQcEmRMvQqwJoBUHMv9e1k2MdgghuRA"}),(0,a.jsx)("div",{className:"ui--Dropdown-name",children:s})]},t),value:t}}function l(e){o.X.set(e)}function c(e){l(e),window.location.reload()}},24569:(e,s,t)=>{t.d(s,{Z:()=>k});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(14534),l=t(38894),c=t(69187),u=t(33661),d=t(74076),m=t(52256),h=t(55858),p=t(61349);function x(){return(0,p.$G)("app-signing")}var g=t(17965);const b=n.memo((function({onClose:e,onUnlock:s,pair:t}){const{t:o}=x(),[i,l]=(0,n.useState)(!1),[c,u]=(0,n.useState)(""),[d,m]=(0,n.useState)(""),[h,p]=(0,n.useState)(null);(0,n.useEffect)((()=>{u(t?.address||"")}),[t]),(0,n.useEffect)((()=>{p(null)}),[d]);const b=(0,n.useCallback)((()=>{t&&t.isLocked&&(l(!0),(0,g.Y)((()=>{try{t.decodePkcs8(d)}catch(e){return l(!1),p(e.message)}l(!1),s()})))}),[s,t,d]);return t?(0,a.jsxs)(r.u_,{className:"toolbox--Unlock",header:o("Unlock account"),onClose:e,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("This account that will perform the message signing."),children:(0,a.jsx)(r.rp,{isDisabled:!0,label:o("account"),value:c})}),(0,a.jsx)(r.u_.Columns,{hint:o("Unlock the account for signing. Once active the signature will be generated based on the content provided."),children:(0,a.jsx)(r.ro,{autoFocus:!0,isError:!!h,label:o("password"),onChange:m,onEnter:b,value:d})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"unlock",isBusy:i,label:o("Unlock"),onClick:b})})]}):null})),f=r.zo.div` + .toolbox--Sign-input { + position: relative; + width: 100%; + height: 100%; + + .unlock-overlay { + position: absolute; + width: 100%; + height: 100%; + top:0; + left:0; + background-color: #0f0e0e7a; + } + + .unlock-overlay-warning { + display: flex; + align-items: center; + justify-content: center; + height:100%; + } + + .unlock-overlay-content { + color:#fff; + padding: 0 2.5rem; + text-align:center; + + .ui--Button-Group { + text-align: center; + } + } + } +`,j=n.memo((function({className:e=""}){const{t:s}=x(),[t,o]=(0,n.useState)((()=>c.Nn.getPairs()[0]||null)),[{data:p,isHexData:g},j]=(0,n.useState)({data:"",isHexData:!1}),[{isInjected:v},y]=(0,n.useState)({isExternal:!1,isHardware:!1,isInjected:!1}),[C,w]=(0,n.useState)(!1),[{isUsable:N,signer:k},S]=(0,n.useState)({isUsable:!0,signer:null}),[I,A]=(0,n.useState)(""),[P,E]=(0,l.O)();(0,n.useEffect)((()=>{const e=t?.meta||{},s=e.isExternal||!1,a=e.isHardware||!1,n=e.isInjected||!1,o=!(s||a||n);y({isExternal:s,isHardware:a,isInjected:n}),w(!n&&(t&&t.isLocked||!1)),A(""),S({isUsable:o,signer:null}),e.source&&n&&(0,i.R0)(e.source).catch((()=>null)).then((e=>S({isUsable:(0,u.m)(e?.signer?.signRaw),signer:e?.signer||null}))).catch(console.error)}),[t]);const M=(0,n.useCallback)((e=>e&&o(c.Nn.getPair(e))),[]),T=(0,n.useCallback)((e=>j({data:e,isHexData:(0,d.vq)(e)})),[]),D=(0,n.useCallback)((()=>{if(C||!N||!t)return;const e=(0,m.Rl)(p);k&&(0,u.m)(k.signRaw)?(A(""),k.signRaw({address:t.address,data:(0,h.c)(e),type:"bytes"}).then((({signature:e})=>A(e))).catch(console.error)):A((0,h.c)(t.sign(e)))}),[t,p,C,N,k]),F=(0,n.useCallback)((()=>{w(!1),E()}),[E]);return(0,a.jsxs)(f,{className:`${e} toolbox--Sign`,children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.rp,{className:"full",isInput:!1,label:s("account"),onChange:M,type:"account"})}),(0,a.jsxs)("div",{className:"toolbox--Sign-input",children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.II,{autoFocus:!0,className:"full",label:s("sign the following data"),onChange:T,value:p})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.qG,{className:"medium",label:s("hex input data"),value:s(g?"Yes":"No")})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.r_,{className:"full",isHidden:0===I.length,isMonospace:!0,label:s("signature of supplied data"),value:I,withCopy:!0})}),(0,a.jsx)("div",{className:"unlock-overlay",hidden:!N||!C||v,children:C&&(0,a.jsx)("div",{className:"unlock-overlay-warning",children:(0,a.jsxs)("div",{className:"unlock-overlay-content",children:[s("You need to unlock this account to be able to sign data."),(0,a.jsx)("br",{}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"unlock",label:s("Unlock account"),onClick:E})})]})})}),(0,a.jsx)("div",{className:"unlock-overlay",hidden:N,children:(0,a.jsx)("div",{className:"unlock-overlay-warning",children:(0,a.jsx)("div",{className:"unlock-overlay-content",children:s(v?"This injected account cannot be used to sign data since the extension does not support raw signing.":"This external account cannot be used to sign data. Only Limited support is currently available for signing from any non-internal accounts.")})})}),P&&(0,a.jsx)(b,{onClose:E,onUnlock:F,pair:t})]}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.zx,{icon:"key",isDisabled:!(N&&!C),label:s("Sign message"),onClick:D})})]})}));var v=t(90778),y=t(16039),C=t(53501);const w=r.zo.div` + .ui--AlignedIconContainer { + position: absolute; + z-index: 1; + } + + .alignedBadge { + left: 1.25rem; + position: relative; + top: 1.25rem; + } +`,N=n.memo((function({className:e=""}){const{t:s}=x(),{isEthereum:t}=(0,v.h)(),[{cryptoType:o,isValid:i},l]=(0,n.useState)({cryptoType:"unknown",isValid:!1}),[{data:u,isHexData:m},h]=(0,n.useState)({data:"",isHexData:!1}),[{isValidPk:p,publicKey:g},b]=(0,n.useState)({isValidPk:!1,publicKey:null}),[{isValidSignature:f,signature:j},N]=(0,n.useState)({isValidSignature:!1,signature:""}),[k]=(0,n.useState)([{text:s("Crypto not detected"),value:"unknown"}].concat(y.X.availableCryptos));(0,n.useEffect)((()=>{let e="unknown",s=p&&f;if(s&&g){const t=(0,C.D)(u,j,g);"none"!==t.crypto?(e=t.crypto,s=t.isValid):s=!1}l({cryptoType:e,isValid:s})}),[u,p,f,g,j]);const S=(0,n.useCallback)((e=>{let s=null;try{s=c.Nn.decodeAddress(e||"")}catch(e){console.error(e)}b({isValidPk:!!s&&(32===s.length||t&&20===s.length),publicKey:s})}),[t]),I=(0,n.useCallback)((e=>h({data:e,isHexData:(0,d.vq)(e)})),[]),A=(0,n.useCallback)((e=>N({isValidSignature:(0,d.vq)(e)&&(130===e.length||t&&132===e.length),signature:e})),[t]);return(0,a.jsxs)(w,{className:`${e} toolbox--Verify`,children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.rp,{className:"full",isError:!p,isInput:!0,label:s("verify using address"),onChange:S})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.II,{autoFocus:!0,className:"full",label:s("using the following data"),onChange:I,value:u})}),(0,a.jsxs)("div",{className:"ui--row",children:[(0,a.jsx)("div",{className:"ui--AlignedIconContainer",children:(0,a.jsx)(r.Ct,{className:"alignedBadge",color:i?"green":f?"red":"gray",icon:i?"check":f?"exclamation":"question"})}),(0,a.jsx)(r.II,{className:"full",isError:!f,label:s("the supplied signature"),onChange:A,value:j})]}),(0,a.jsxs)("div",{className:"ui--row",children:[(0,a.jsx)(r.Lt,{defaultValue:o,isDisabled:!0,label:s("signature crypto type"),options:k}),(0,a.jsx)(r.qG,{className:"medium",label:s("hex input data"),value:s(m?"Yes":"No")})]})]})})),k=n.memo((function({basePath:e}){const{t:s}=x(),t=(0,n.useRef)([{isRoot:!0,name:"sign",text:s("Sign message")},{name:"verify",text:s("Verify signature")}]);return(0,a.jsxs)("main",{className:"toolbox--App",children:[(0,a.jsx)(r.mQ,{basePath:e,items:t.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(N,{}),path:"verify"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(j,{}),index:!0})]})})]})}))},96246:(e,s,t)=>{t.d(s,{Z:()=>ie});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(9118),c=t(48801),u=t.n(c),d=t(95292),m=t(38894),h=t(61349);function p(){return(0,h.$G)("app-society")}const x=n.memo((function({onClose:e}){const{t:s}=p(),{api:t}=(0,i.h)(),[o,l]=(0,n.useState)(),[c,u]=(0,n.useState)();return(0,a.jsxs)(r.u_,{header:s("Bid to join"),onClose:e,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:s("Your candidate/bid account. Once accepted this account will become a member."),children:(0,a.jsx)(r.rp,{label:s("bid account"),onChange:u,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:s("The amount to tie to your bid. The lowest bidder moves forward."),children:(0,a.jsx)(r.H,{autoFocus:!0,label:s("bid amount"),onChange:l})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:c,icon:"sign-in-alt",isDisabled:!o,label:s("Bid"),onStart:e,params:[o],tx:t.tx.society.bid})})]})}));var g=t(34814);const b=r.zo.div` + align-items: center; + display: flex; + flex-wrap: no-wrap; + + > div { + flex: 0; + + &:first-child { + padding-right: 1.5rem; + } + } +`,f=n.memo((function({className:e,value:s}){const t=(0,n.useMemo)((()=>s?.isVouch?s.asVouch[0]:null),[s]);return(0,a.jsxs)(b,{className:e,children:[(0,a.jsx)("div",{children:s?.type}),t&&(0,a.jsx)(r.N,{value:t})]})})),j=n.memo((function({index:e,value:{kind:s,value:t,who:o}}){const{t:l}=p(),{api:c}=(0,i.h)(),{allAccounts:u}=(0,g.x)(),[d,m]=(0,n.useMemo)((()=>s.isVouch?s.asVouch:[null,null]),[s]),[h,x]=(0,n.useMemo)((()=>{const e=o.toString(),s=d?.toString();return[u.some((s=>s===e)),!!s&&u.some((e=>e===s))]}),[u,d,o]);return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(r.N,{value:o})}),(0,a.jsxs)("td",{className:"start",children:[(0,a.jsx)(f,{value:s}),s.isVouch?x&&(0,a.jsx)(r.cA,{accountId:d,icon:"times",label:l("Unvouch"),params:[e],tx:c.tx.society.unvouch}):h&&(0,a.jsx)(r.cA,{accountId:o,icon:"times",label:l("Unbid"),params:[e],tx:c.tx.society.unbid})]}),(0,a.jsx)(r.iA.Column.Balance,{value:t}),(0,a.jsx)(r.iA.Column.Balance,{value:m})]})})),v=n.memo((function({className:e}){const{t:s}=p(),{api:t}=(0,i.h)(),o=(0,l.W7)(t.query.society.bids),c=(0,n.useRef)([[s("bids"),"start"],[s("bid kind"),"start"],[s("value")],[s("tip")]]);return(0,a.jsx)(r.iA,{className:e,empty:o&&s("No bids"),header:c.current,children:o?.map(((e,s)=>(0,a.jsx)(j,{index:s,value:e},e.who.toString())))})})),y=n.memo((function({label:e,votes:s}){return 0===s.length?null:(0,a.jsx)(r.xH,{summary:`${e} (${s.length})`,children:s.map((([e])=>(0,a.jsx)(r.ax,{value:e},e.toString())))})})),C=n.memo((function({votes:e}){const{t:s}=p(),[{allAye:t,allNay:o,allSkeptic:r},i]=(0,n.useState)({allAye:[],allNay:[],allSkeptic:[]});return(0,n.useEffect)((()=>{e&&i({allAye:e.filter((([,e])=>e.isApprove)),allNay:e.filter((([,e])=>e.isReject)),allSkeptic:e.filter((([,e])=>e.isSkeptic))})}),[e]),(0,a.jsxs)("td",{className:"expand",children:[(0,a.jsx)(y,{label:s("Skeptics"),votes:r}),(0,a.jsx)(y,{label:s("Approvals"),votes:t}),(0,a.jsx)(y,{label:s("Rejections"),votes:o})]})})),w=n.memo((function({candidateId:e,isMember:s,ownMembers:t}){const{t:o}=p(),{api:l}=(0,i.h)(),[c,u]=(0,m.O)(),[d,h]=(0,n.useState)(!0),[x,g]=(0,n.useState)(null),b=(0,n.useRef)([{text:o("Aye, I approve"),value:!0},{text:o("Nay, I do not approve"),value:!1}]);return(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsxs)(r.u_,{header:o("Vote for candidate"),onClose:u,children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.rp,{filter:t,label:o("vote from account"),onChange:g}),(0,a.jsx)(r.Lt,{label:o("vote for candidate"),onChange:h,options:b.current,value:d})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:x,icon:"check",label:o("Vote"),onStart:u,params:[e,d],tx:l.tx.society.vote})})]}),(0,a.jsx)(r.zx,{icon:"check",isDisabled:!s,label:o("Vote"),onClick:u})]})})),N=n.memo((function({allMembers:e,isMember:s,ownMembers:t,value:{accountId:o,kind:c,value:u}}){const{api:d}=(0,i.h)(),m=(0,n.useMemo)((()=>[e.map((e=>[o,e]))]),[o,e]),h=(0,l.W7)(d.query.society.votes.multi,m,{transform:s=>s.map(((s,t)=>[e[t],s])).filter((([,e])=>e.isSome)).map((([e,s])=>[e,s.unwrap()]))});return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(r.N,{value:o})}),(0,a.jsx)("td",{className:"start",children:(0,a.jsx)(f,{value:c})}),(0,a.jsx)(r.iA.Column.Balance,{value:u}),(0,a.jsx)(C,{votes:h}),(0,a.jsx)("td",{className:"button",children:(0,a.jsx)(w,{candidateId:o.toString(),isMember:s,ownMembers:t})})]})})),k=n.memo((function({allMembers:e,candidates:s,className:t="",isMember:o,ownMembers:i}){const{t:l}=p(),c=(0,n.useRef)([[l("candidates"),"start"],[l("bid kind"),"start"],[l("value")],[void 0,"expand"],[]]);return(0,a.jsx)(r.iA,{className:t,empty:s&&l("No candidates"),header:c.current,children:s?.map((s=>(0,a.jsx)(N,{allMembers:e,isMember:o,ownMembers:i,value:s},s.accountId.toString())))})})),S=n.memo((function({allMembers:e,onClose:s}){const{t}=p(),{api:o}=(0,i.h)(),[l,c]=(0,n.useState)(),[u,d]=(0,n.useState)(),[m,h]=(0,n.useState)(),[x,g]=(0,n.useState)();return(0,a.jsxs)(r.u_,{header:t("Vouch for a new candidate"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:t("Your member account that the vouch is made from."),children:(0,a.jsx)(r.rp,{filter:e,label:t("member account"),onChange:h,type:"account"})}),(0,a.jsx)(r.u_.Columns,{hint:t("The candidate/bid account. Once accepted this account will become a member."),children:(0,a.jsx)(r.rp,{label:t("bid account"),onChange:g})}),(0,a.jsx)(r.u_.Columns,{hint:t("The amount to tie to your bid. The lowest bidder moves forward."),children:(0,a.jsx)(r.H,{autoFocus:!0,label:t("bid amount"),onChange:c})}),(0,a.jsx)(r.u_.Columns,{hint:t("The amount you wish to be tipped for your bid."),children:(0,a.jsx)(r.H,{label:t("tip amount"),onChange:d})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,icon:"sign-in-alt",isDisabled:!l||!x||!u,label:t("Vouch"),onStart:s,params:[x,l,u],tx:o.tx.society.vouch})})]})})),I=n.memo((function({allMembers:e,candidates:s,className:t,isMember:n,ownMembers:o}){const{t:i}=p(),[l,c]=(0,m.O)(),[u,d]=(0,m.O)();return(0,a.jsxs)("div",{className:t,children:[(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.zx,{icon:"plus",label:i("Submit bid"),onClick:c}),(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!n,label:i("Vouch for"),onClick:d}),l&&(0,a.jsx)(x,{onClose:c}),u&&(0,a.jsx)(S,{allMembers:e,onClose:d})]}),(0,a.jsx)(k,{allMembers:e,candidates:s,isMember:n,ownMembers:o}),(0,a.jsx)(v,{})]})})),A=n.memo((function({isMember:e,ownMembers:s}){const{t}=p(),{api:o}=(0,i.h)(),[l,c]=(0,m.O)(),[u,d]=(0,n.useState)(!0),[h,x]=(0,n.useState)(null),g=(0,n.useRef)([{text:t("Aye, I approve"),value:!0},{text:t("Nay, I do not approve"),value:!1}]);return(0,a.jsxs)(a.Fragment,{children:[l&&(0,a.jsxs)(r.u_,{header:t("Vote for defender"),onClose:c,children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.rp,{filter:s,label:t("vote from account"),onChange:x}),(0,a.jsx)(r.Lt,{label:t("vote for defender"),onChange:d,options:g.current,value:u})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,icon:"check",label:t("Vote"),onStart:c,params:[u],tx:o.tx.society.defenderVote})})]}),(0,a.jsx)(r.zx,{icon:"check",isDisabled:!e,label:t("Vote"),onClick:c})]})})),P={transform:e=>e.filter((({vote:e})=>!!e)).map((({accountId:e,vote:s})=>[e.toString(),s]))},E=n.memo((function({className:e="",info:s,isMember:t,ownMembers:o}){const{t:c}=p(),{api:u}=(0,i.h)(),d=(0,l.W7)(u.derive.society.members,void 0,P),m=(0,n.useRef)([[c("defender"),"start"],[void 0,"expand"],[]]);return s&&s.hasDefender&&s.defender?(0,a.jsx)(r.iA,{className:e,header:m.current,children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(r.N,{value:s.defender})}),(0,a.jsx)(C,{votes:d}),(0,a.jsx)("td",{className:"button",children:(0,a.jsx)(A,{isMember:t,ownMembers:o})})]})}):null}));var M=t(54383),T=t(58607),D=t(65874),F=t(14681),V=t(15968);const _=300;function q(e,s,t,a,n){const o=new Path2D("M373.1,126.9c-5.2-4.1-11.4-9.7-22.7-11.1c-10.6-1.4-21.4,5.7-28.7,10.4c-7.3,4.7-21.1,18.5-26.8,22.7 c-5.7,4.2-20.3,8.1-43.8,22.2s-115.7,73.3-115.7,73.3l24,0.3L52.4,299.8h10.7l-15.4,11.7c0,0,13.6,3.6,25-3.6l0,3.3 c0,0,127.4-50.2,152-37.2l-15,4.4c1.3,0,25.5,1.6,25.5,1.6s0.8,15.1,15.4,24.8c14.6,9.6,14.9,14.9,14.9,14.9s-7.6,3.1-7.6,7 c0,0,11.2-3.4,21.6-3.1c10.4,0.3,19.5,3.1,19.5,3.1s-0.8-4.2-10.9-7c-10.2-2.9-20.1-13.8-25-19.8c-4.9-6-8.3-16.7-4.1-27.4 c3.5-9.1,15.7-14.1,40.9-27.1c29.7-15.4,36.5-26.8,40.7-35.7c4.2-8.9,10.4-26.6,13.9-34.9c4.4-10.7,9.8-16.4,14.3-19.8 c4.4-3.4,24.5-10.9,24.5-10.9S378,130.8,373.1,126.9z");e.save(),e.translate(s/2,t/2),e.scale(a/440,a/440),e.translate(-220,-220),n(e,o),e.restore()}function O(e,s,t,a){e.save(),e.translate(.5,.5);for(let n=0;ne.slice(t,t+=s)))}const z={display:"block",margin:"0 auto"},H=n.memo((function({accountId:e}){const{t:s}=p(),{api:t}=(0,i.h)(),o=(0,n.useRef)(null),[l]=(0,n.useState)((()=>t.genesisHash.eq(V.Cx))),[c,u]=(0,m.O)();return(0,n.useEffect)((()=>{if(o.current){const s=o.current.getContext("2d");s&&function(e,s){console.log(`Generating ink for ${s.toString()} as ${s.toHex()}`);const t=s.toU8a().reduce(((e,s)=>{for(let t=0;t<8;++t)e.push(0!=(s&1<<7-t));return e}),[]);e.save(),e.translate(0,0),e.scale(_,_),function(e,s){const t=R(s,[71,61,51,41,32]);for(let s=0;s{s&&(e.beginPath(),e.arc(0,0,.016,0,2*Math.PI),e.fillStyle="black",e.fill())}));e.lineWidth=10,q(e,1,1,.4,((e,s)=>e.stroke(s)))}(e,t),e.restore(),e.save(),e.translate(325,0),e.scale(_,_),function(e,s){const t=R(s,[71,61,51,41,32]);for(let s=0;s{e.beginPath(),e.arc(0,0,(s?8:4)/500,0,2*Math.PI),e.fillStyle=s?"black":"#e6007a",e.fill()}));q(e,1,1,.44,((e,s)=>e.fill(s)))}(e,t),e.restore(),e.save(),e.translate(0,325),e.scale(_,_),function(e,s){const t=R(s,[64,64,64,64]);for(let s=0;s{s&&(e.beginPath(),e.moveTo(0,-.036),e.lineTo(0,.036),e.lineWidth=.01,e.stroke())}));q(e,1,1,.44,((e,s)=>e.fill(s)))}(e,t),e.restore(),e.save(),e.translate(325,325),e.scale(_,_),function(e,s){e.lineWidth=.01;for(let t=0;t<8;++t)for(let a=0;a<32;++a)s[32*t+a]&&(e.save(),e.translate((a+.5)/32,t/8),e.beginPath(),e.moveTo(0,0),e.lineTo(0,1/8),e.stroke(),e.restore());e.fillStyle="rgba(255, 255, 255, 0.8)",q(e,1,1,1,((e,s)=>e.fill(s))),e.lineWidth=6,q(e,1,1,1,((e,s)=>e.stroke(s)))}(e,t),e.restore(),e.save(),e.translate(650,0),e.scale(_,_),function(e,s){e.save(),e.translate(.484,.516),e.fillStyle="black";let t=.484;for(let a=0,n=s.length;ae.stroke(s)))}(e,t),e.restore(),e.save(),e.translate(650,325),e.scale(_,_),function(e,s){const t=R(s,[128,128]);for(let s=0;s{s&&(e.beginPath(),e.moveTo(0,-.036),e.lineTo(0,.036),e.lineWidth=.01,e.stroke())}));e.lineWidth=6,q(e,1,1,.7,((e,s)=>e.stroke(s)))}(e,t),e.restore()}(s,e)}})),l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"pen-nib",onClick:u}),c&&(0,a.jsx)(r.u_,{header:s("design samples"),onClose:u,size:"large",children:(0,a.jsx)(r.u_.Content,{children:(0,a.jsx)("canvas",{height:625,ref:o,style:z,width:950})})})]}):null})),$=r.zo.tr` + .payoutExpander { + .payout+.payout { + margin-top: 0.5rem; + } + + .ui--Columar { + flex-wrap: unset; + + .ui--Column { + min-width: 15ch; + + &:first-child { + max-width: 100% !important; + } + + &:last-child { + min-width: 15ch; + max-width: 15ch; + white-space: nowrap; + } + } + } + } +`,L=n.memo((function({bestNumber:e,className:s="",value:{accountId:t,isCandidateVoter:o,isDefenderVoter:l,isFounder:c,isHead:u,isSkeptic:d,isSuspended:m,isWarned:h,key:x,payouts:b,strikes:f}}){const{t:j}=p(),{api:v}=(0,i.h)(),{allAccounts:y}=(0,g.x)(),C=(0,n.useCallback)((()=>e&&b&&function(e,s){return s.map((([s,t],n)=>(0,a.jsx)("div",{className:"payout",children:(0,a.jsxs)(r.P0,{children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(T.Z,{value:t})}),(0,a.jsxs)(r.P0.Column,{children:[(0,a.jsxs)("div",{children:["#",(0,F.u)(s)]}),s.gt(e)&&(0,a.jsx)(D.Z,{value:s.sub(e)},n)]})]})},n)))}(e,b)),[e,b]),w=(0,n.useMemo)((()=>y.some((e=>e===x))),[y,x]),N=(0,n.useMemo)((()=>e&&b.find((([s])=>e.gt(s)))),[e,b]),k=(0,n.useMemo)((()=>[o&&j("Candidate"),l&&j("Defender")].filter((e=>!!e)).join(", ")),[o,l,j]);return(0,a.jsxs)($,{className:s,children:[(0,a.jsxs)("td",{className:"address relative all",children:[(0,a.jsx)(r.N,{value:t}),(0,a.jsxs)("div",{className:"absolute",children:[(o||l)&&(0,a.jsx)(r.Vp,{color:"blue",label:j("voted")}),h&&(0,a.jsx)(r.Vp,{color:"orange",label:j("strikes")}),u&&(0,a.jsx)(r.Vp,{color:"green",label:j("society head")}),c&&(0,a.jsx)(r.Vp,{color:"green",label:j("founder")}),d&&(0,a.jsx)(r.Vp,{color:"yellow",label:j("skeptic")}),m&&(0,a.jsx)(r.Vp,{color:"red",label:j("suspended")}),N&&(0,a.jsx)(r.Vp,{color:"grey",label:j("payout")})]})]}),(0,a.jsxs)("td",{className:"number together",children:[!!b?.length&&(0,a.jsx)(r.xH,{className:"payoutExpander",renderChildren:C,summary:j("Payouts ({{count}})",{replace:{count:(0,F.u)(b.length)}})}),w&&N&&(0,a.jsx)(r.cA,{accountId:t,icon:"ellipsis-h",label:"Payout",params:[],tx:v.tx.society.payout})]}),(0,a.jsx)("td",{className:"together",children:k}),(0,a.jsx)("td",{className:"number",children:(0,F.u)(f)}),(0,a.jsx)("td",{className:"button start",children:(0,a.jsx)(H,{accountId:t})})]})})),B=n.memo((function({className:e="",mapMembers:s}){const{t}=p(),o=(0,M.C)(),i=(0,n.useRef)([[t("members"),"start",2],[t("voted on"),"start"],[t("strikes")],[]]);return(0,a.jsx)(r.iA,{className:e,empty:s&&t("No active members"),header:i.current,children:s?.map((e=>(0,a.jsx)(L,{bestNumber:o,value:e},e.key)))})})),Z=(0,r.zo)(r.Ty)` + .society--header--account { + white-space: nowrap; + + .ui--AccountName { + display: inline-block; + } + + .ui--IdentityIcon { + margin-right: 0.5rem; + } + } +`,W=n.memo((function({className:e="",info:s,payoutTotal:t}){const{t:o}=p(),{api:c}=(0,i.h)(),u=(0,l.W7)(c.derive.society.members),d=(0,M.C)(),m=(0,n.useMemo)((()=>s&&s.pot.gtn(0)?s.pot:null),[s]);return(0,a.jsxs)(Z,{className:e,children:[(0,a.jsx)("section",{className:"media--1100",children:s&&u&&(0,a.jsxs)(r.Jy,{label:o("members"),children:[u.length," / ",s.maxMembers?.toString()]})}),d&&(0,a.jsxs)(a.Fragment,{children:[c.consts.society.rotationPeriod&&(0,a.jsx)("section",{children:(0,a.jsx)(r.Jy,{label:o("rotation"),progress:{total:c.consts.society.rotationPeriod,value:d.mod(c.consts.society.rotationPeriod),withTime:!0}})}),(0,a.jsx)("section",{className:"media--1200",children:(0,a.jsx)(r.Jy,{label:o("challenge"),progress:{total:c.consts.society.challengePeriod,value:d.mod(c.consts.society.challengePeriod),withTime:!0}})})]}),(0,a.jsxs)("section",{children:[t&&(0,a.jsx)(r.Jy,{label:o("payouts"),children:(0,a.jsx)(T.Z,{value:t,withSi:!0})}),m&&(0,a.jsx)(r.Jy,{label:o("pot"),children:(0,a.jsx)(T.Z,{value:m,withSi:!0})})]})]})})),U=r.zo.div` + .overviewSection { + margin-bottom: 1.5rem; + } +`,J=n.memo((function({className:e,info:s,isMember:t,mapMembers:n,ownMembers:o,payoutTotal:r}){return(0,a.jsxs)(U,{className:e,children:[(0,a.jsx)(W,{info:s,payoutTotal:r}),(0,a.jsx)(E,{info:s,isMember:t,ownMembers:o}),(0,a.jsx)(B,{mapMembers:n})]})})),G=n.memo((function({balance:e,bid:s,value:t}){return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(r.N,{value:t})}),(0,a.jsx)("td",{className:"start",children:(0,a.jsx)(f,{value:s})}),(0,a.jsx)(r.iA.Column.Balance,{value:e})]})})),Y={transform:e=>e.filter((([{args:[e]},s])=>s.isSome&&e)).map((([{args:[e]},s])=>{const[t,a]=s.unwrap();return{accountId:e,balance:t,bid:a}})).sort(((e,s)=>e.balance.cmp(s.balance)))},Q={transform:e=>e.map((({args:[e]})=>e)).filter((e=>!!e))},K=n.memo((function({className:e}){const{t:s}=p(),{api:t}=(0,i.h)(),o=(0,l.W7)(t.query.society.suspendedCandidates.entries,void 0,Y),c=(0,l.W7)(t.query.society.suspendedMembers.keys,void 0,Q),u=(0,n.useRef)({candidates:[[s("candidates"),"start"],[s("bid kind"),"start"],[s("value")]],members:[[s("members"),"start",3]]});return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(r.iA,{className:e,empty:c&&s("No suspended members"),header:u.current.members,children:c?.map((e=>(0,a.jsx)(G,{value:e},e.toString())))}),(0,a.jsx)(r.iA,{className:e,empty:o&&s("No suspended candidates"),header:u.current.candidates,children:o?.map((({accountId:e,balance:s,bid:t})=>(0,a.jsx)(G,{balance:s,bid:t,value:e},e.toString())))})]})}));var X=t(58900),ee=t(11677);const se={allMembers:[],isMember:!1,ownMembers:[]},te=(0,ee.e)("useMembers",(function(){const{api:e}=(0,i.h)(),{allAccounts:s}=(0,g.x)(),[t,a]=(0,n.useState)(se),o=(0,l.W7)(e.derive.society.members);return(0,n.useEffect)((()=>{s&&o&&a(function(e,s){const t=s.filter((({isSuspended:e})=>!e)).map((({accountId:e})=>e.toString())),a=t.filter((s=>e.includes(s)));return{allMembers:t,isMember:0!==a.length,ownMembers:a}}(s,o))}),[s,o]),t}));var ae=t(24305);const ne={},oe=(0,ee.e)("useVoters",(function(){const{api:e}=(0,i.h)(),s=(0,ae.b)([e.events.society.Vote]),t=(0,l.W7)(e.derive.society.candidates),[a,o]=(0,n.useState)(ne);return(0,n.useEffect)((()=>{s&&t&&async function(e,s){const t=[],a=[];return(s.length?await Promise.all(s.map((({accountId:s})=>e.query.society.votes.entries(s)))):[]).forEach((e=>{e.forEach((([{args:[,e]},s])=>{if(s.isSome){const n=e.toString();s.unwrap().isSkeptic?!t.includes(n)&&t.push(n):!a.includes(n)&&a.push(n)}}))})),{candidates:s,skeptics:t,voters:a}}(e,t).then(o).catch(console.error)}),[e,t,s]),a}));function re(e,s){const t=e.isCandidateVoter||e.isDefenderVoter;return e.isHead!==s.isHead?e.isHead?-1:1:e.isFounder!==s.isFounder?e.isFounder?-1:1:e.isSkeptic!==s.isSkeptic?e.isSkeptic?-1:1:t!==(s.isCandidateVoter||s.isDefenderVoter)?t?-1:1:e.isSuspended!==s.isSuspended?e.isSuspended?-1:1:e.isWarned!==s.isWarned?e.isWarned?-1:1:s.strikes.cmp(e.strikes)||s.payouts.length-e.payouts.length}const ie=n.memo((function({basePath:e,className:s}){const{t}=p(),{api:c}=(0,i.h)(),m=(0,X.Z)(),{allMembers:h,isMember:x,ownMembers:g}=te(),b=(0,l.W7)(c.derive.society.info),f=(0,l.W7)(c.derive.society.members),{candidates:j,skeptics:v,voters:y}=oe(),[C,w]=(0,n.useMemo)((()=>f&&b&&v&&y?function(e,s,t,{defender:a,founder:n,hasDefender:o,head:r},i){const l=e.filter((e=>!o||!e.accountId.eq(a))).map((({accountId:e,isDefenderVoter:a,isSuspended:o,payouts:l,strikes:c})=>{const u=e.toString();return{accountId:e,isCandidateVoter:t.includes(u),isDefenderVoter:a,isFounder:!!n?.eq(e),isHead:!!r?.eq(e),isSkeptic:s.includes(u),isSuspended:o,isWarned:!o&&c.gt(i),key:u,payouts:l,strikes:c}})).sort(re);return[l,l.reduce(((e,{payouts:s})=>s.reduce(((e,[,s])=>e.iadd(s)),e)),new(u())(0))]}(f,v,y,b,(c.consts.society.graceStrikes||c.consts.society.maxStrikes).mul(d.um).div(d.Jo)):[void 0,void 0]),[c,b,f,v,y]),N=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:t("Overview")},{count:m,name:"candidates",text:t("Candidates")},{name:"suspended",text:t("Suspended")}]),[m,t]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,items:N}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(I,{allMembers:h,candidates:j,isMember:x,ownMembers:g}),path:"candidates"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(K,{}),path:"suspended"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(J,{info:b,isMember:x,mapMembers:C,ownMembers:g,payoutTotal:w}),index:!0})]})})]})}))},58900:(e,s,t)=>{t.d(s,{Z:()=>o});var a=t(90778),n=t(9118);const o=(0,t(11677).e)("useCounter",(function(){const{api:e}=(0,a.h)(),s=(0,n.W7)(e.query.society?.candidates);return s?.length||0}))},16215:(e,s,t)=>{t.d(s,{Z:()=>ca});var a=t(52322),n=t(2784),o=t(73557),r=t(75030),i=t(65857),l=t(64348),c=t(90778),u=t(34814),d=t(54131),m=t(9118),h=t(54890),p=t(12213),x=t(43223),g=t(33661),b=t(58607),f=t(48801),j=t.n(f),v=t(95292),y=t(61349);function C(){return(0,y.$G)("app-staking")}const w=n.memo((function({isInElection:e}){const{t:s}=C();return e?(0,a.jsx)(l.Pd,{className:"warning centered",content:s("There is currently an ongoing election for new validator candidates. As such staking operations are not permitted.")}):null}));var N=t(86135),k=t(38894),S=t(14681),I=t(11677);const A={transform:e=>e.isNone?0:e.unwrap().prior.length+1},P=(0,I.e)("useSlashingSpans",(function(e){const{api:s}=(0,c.h)();return(0,m.W7)(s.query.staking.slashingSpans,[e],A)||0}));var E=t(36609),M=t(92730);function T(e){let s=(e.mul(v.D_).div(v.aP.pow(new(j())(M.a.getDefaults().decimals))).toNumber()/1e3).toFixed(3);for(;1!==s.length&&[".","0"].includes(s[s.length-1]);){const e=s.endsWith(".");if(s=s.substring(0,s.length-1),e)break}return s}const D=n.memo((function({currentAmount:e,isNominating:s,minNominated:t,minNominatorBond:o,minValidatorBond:r,onError:i,stashId:u,value:d}){const{t:h}=C(),{api:p}=(0,c.h)(),x=(0,m.W7)(p.derive.balances?.all,[u]),[{error:g,warning:b},f]=(0,n.useState)({error:null,warning:null});return(0,n.useEffect)((()=>{if(x&&d){const a=d.add(e||v.nw),n=p.consts.balances.existentialDeposit,l=x.freeBalance.sub(n.divn(2));let c=null,u=null;a.gte(l)?u=h("The specified value is large and may not allow enough funds to pay future transaction fees."):a.lt(n)?c=h("The bonded amount is less than the minimum bond amount of {{existentialDeposit}}",{replace:{existentialDeposit:T(n)}}):s?o&&a.lt(o)?c=h("The bonded amount is less than the minimum threshold of {{minBond}} for nominators",{replace:{minBond:(0,M.a)(o)}}):t&&a.lt(t)&&(u=h("The bonded amount is less than the current active minimum nominated amount of {{minNomination}} and depending on the network state, may not be selected to participate",{replace:{minNomination:(0,M.a)(t)}})):r&&a.lt(r)&&(c=h("The bonded amount is less than the minimum threshold of {{minBond}} for validators",{replace:{minBond:(0,M.a)(r)}})),f((e=>{const s=e.error!==c?c:e.error,t=e.warning!==u?u:e.warning;return i(s||t?{error:s,warning:t}:null),{error:s,warning:t}}))}}),[p,e,s,t,o,r,i,x,h,d]),g?(0,a.jsx)(l.oy,{content:g}):b?(0,a.jsx)(l.Pd,{content:b}):null})),F=n.memo((function({controllerId:e,onClose:s,stakingInfo:t,stashId:o}){const{t:r}=C(),{api:i}=(0,c.h)(),[u,d]=(0,n.useState)(null),[h,p]=(0,n.useState)(),x=(0,m.W7)(i.derive.balances?.all,[o]),g=(0,n.useMemo)((()=>t?.stakingLedger?.active?.unwrap()),[t]),b=(0,n.useMemo)((()=>function(e,s,t){if(s?.stakingLedger&&t){const a=(s.unlocking||[]).reduce(((e,{value:s})=>e.iadd(s)),new(j())(0)),n=s.redeemable||v.nw,o=t.freeBalance.sub(s.stakingLedger.active?.unwrap()||v.nw).sub(a).sub(n);return o.gt(e.consts.balances.existentialDeposit)?o.sub(e.consts.balances.existentialDeposit):v.nw}return null}(i,t,x)),[i,t,x]);return(0,a.jsxs)(l.u_,{header:r("Bond more funds"),onClose:s,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)(l.u_.Columns,{hint:r("Since this transaction deals with funding, the stash account will be used."),children:(0,a.jsx)(l.rp,{defaultValue:o,isDisabled:!0,label:r("stash account")})}),b&&(0,a.jsxs)(l.u_.Columns,{hint:r("The amount placed at-stake should allow some free funds for future transactions."),children:[(0,a.jsx)(l.H,{autoFocus:!0,defaultValue:b,isError:!!u?.error||!h||h.isZero(),label:r("additional funds to bond"),labelExtra:(0,a.jsx)(E.Z,{label:(0,a.jsx)("span",{className:"label",children:r("balance")}),params:o}),onChange:p}),(0,a.jsx)(D,{controllerId:e,currentAmount:g,onError:d,stashId:o,value:h})]})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:o,icon:"sign-in-alt",isDisabled:!h?.gt(v.nw)||!!u?.error,label:r("Bond more"),onStart:s,params:[h],tx:i.tx.staking.bondExtra})})]})}));var V=t(69187),_=t(48731),q=t(55858),O=t(6851),R=t(46186);const z={aura:["ed25519","sr25519"],babe:["sr25519"],gran:["ed25519"],imon:["ed25519","sr25519"],para:["sr25519"]},H=n.memo((function({onClose:e}){const{t:s}=C(),{queueRpc:t}=(0,N.L)(),[o,r]=(0,n.useState)("sr25519"),[i,c]=(0,n.useState)("0x"),[u,d]=(0,n.useState)(""),[m,h]=(0,n.useState)("babe"),p=(0,n.useRef)([{text:s("Aura"),value:"aura"},{text:s("Babe"),value:"babe"},{text:s("Grandpa"),value:"gran"},{text:s("I'm Online"),value:"imon"},{text:s("Parachains"),value:"para"}]);(0,n.useEffect)((()=>{r(z[m][0])}),[m]),(0,n.useEffect)((()=>{try{const{phrase:e}=(0,O.Q)(u);(0,_.hu)((0,R.S)(e),"Invalid mnemonic phrase"),c((0,q.c)(V.Nn.createFromUri(u,{},o).publicKey))}catch{c("0x")}}),[o,u]);const x=(0,n.useCallback)((()=>t({rpc:{method:"insertKey",section:"author"},values:[m,u,i]})),[m,i,t,u]),g=(0,n.useMemo)((()=>z[m].map((e=>({text:s("ed25519"===e?"ed25519, Edwards":"sr15519, Schnorrkel"),value:e})))),[m,s]);return(0,a.jsxs)(l.u_,{header:s("Inject Keys"),onClose:e,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsxs)(l.u_.Columns,{hint:s("The seed and derivation path will be submitted to the validator node. this is an advanced operation, only to be performed when you are sure of the security and connection risks."),children:[(0,a.jsx)(l.II,{autoFocus:!0,isError:66!==i.length,label:s("suri (seed & derivation)"),onChange:d,value:u}),(0,a.jsx)(l.Pd,{content:s("This operation will submit the seed via an RPC call. Do not perform this operation on a public RPC node, but ensure that the node is local, connected to your validator and secure.")})]}),(0,a.jsxs)(l.u_.Columns,{hint:s("The key type and crypto type to use for this key. Be aware that different keys have different crypto requirements. You should be familiar with the type requirements for the different keys."),children:[(0,a.jsx)(l.Lt,{label:s("key type to set"),onChange:h,options:p.current,value:m}),(0,a.jsx)(l.Lt,{isDisabled:1===g.length,label:s("crypto type to use"),onChange:r,options:g,value:o})]}),(0,a.jsx)(l.u_.Columns,{hint:s("This pubic key is what will be visible in your queued keys list. It is generated based on the seed and the crypto used."),children:(0,a.jsx)(l.II,{isDisabled:!0,label:s("generated public key"),value:i})})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",label:s("Submit key"),onClick:x})})]})})),$=n.memo((function({className:e="",controllerId:s,stashId:t}){const{t:n}=C();if(!t||!s)return null;const o=t!==s;return(0,a.jsxs)(l.u_.Columns,{className:e,hint:n(o?"The stash that is to be affected. The transaction will be sent from the associated controller account.":"The stash that is to be affected."),children:[(0,a.jsx)(l.rp,{defaultValue:t,isDisabled:!0,label:n("stash account")}),o&&(0,a.jsx)(l.rp,{defaultValue:s,isDisabled:!0,label:n("controller account")})]})})),L={withExposure:!0},B=n.memo((function({className:e="",controllerId:s,nominating:t,onClose:o,stashId:r}){const{t:i}=C(),{api:u}=(0,c.h)(),[d,h]=(0,n.useState)([]),[{kickTx:p},x]=(0,n.useState)({}),g=(0,m.W7)(u.derive.staking.query,[r,L]),b=(0,n.useMemo)((()=>g?.exposure?.others.map((({who:e})=>e.toString()))),[g]);return(0,n.useEffect)((()=>{try{x({kickTx:d.length?u.tx.staking.kick(d):null})}catch{x({kickTx:null})}}),[u,d]),(0,a.jsxs)(l.u_,{className:e,header:i("Remove nominees"),onClose:o,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)($,{controllerId:s,stashId:r}),b?(0,a.jsx)(l.m3,{available:b,availableLabel:i("existing/active nominators"),defaultValue:t,maxCount:128,onChange:h,valueLabel:i("nominators to be removed")}):(0,a.jsx)(l.$j,{label:i("Retrieving active nominators")})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:s,extrinsic:p,icon:"user-slash",isDisabled:!p,label:i("Remove"),onStart:o})})]})}));var Z=t(3871),W=t(74065);const U=(0,I.e)("useInactives",(function(e,s){const{api:t}=(0,c.h)(),a=(0,W.X)(),[o,r]=(0,n.useState)({}),i=(0,m.W7)(t.derive.session.indexes);return(0,n.useEffect)((()=>{let n;return a.current&&s?.length&&i&&t.queryMulti([[t.query.staking.nominators,e]].concat(t.query.staking.erasStakers?s.map((e=>[t.query.staking.erasStakers,[i.activeEra,e]])):s.map((e=>[t.query.staking.stakers,e]))).concat(s.map((e=>[t.query.staking.slashingSpans,e]))),(([n,...o])=>{const l=o.slice(0,s.length),c=o.slice(s.length);a.current&&r(function(e,s,t,a,{activeEra:n},o,r){const i=e.consts.staking?.maxNominatorRewardedPerValidator,l=e.events.staking.SlashReported?[]:a.filter(((e,s)=>!t[s].isNone&&t[s].unwrap().lastNonzeroSlash.gt(o))),c=r.map((({others:e})=>e.sort(((e,s)=>(s.value?.unwrap()||v.nw).cmp(e.value?.unwrap()||v.nw))))).map(((e,t)=>!i||i.gtn(e.map((({who:e})=>e.toString())).indexOf(s))?null:a[t])).filter((e=>!!e&&!l.includes(e)));let u=r.map(((e,t)=>e.others.some((({who:e})=>e.eq(s)))?null:a[t])).filter((e=>!!e));const d=r.map(((e,s)=>e.total?.unwrap().isZero()||u.includes(a[s])&&o.gte(n)?a[s]:null)).filter((e=>!!e)).filter((e=>!l.includes(e)&&!c.includes(e))),m=a.filter((e=>!u.includes(e)&&!l.includes(e)&&!c.includes(e)));return u=u.filter((e=>!d.includes(e)&&!l.includes(e)&&!c.includes(e))),{nomsActive:m,nomsChilled:l,nomsInactive:u,nomsOver:c,nomsWaiting:d}}(t,e,c,s,i,n.unwrapOrDefault().submittedIn,l))})).then((e=>{n=e})).catch(console.error),()=>{n&&n()}}),[t,i,a,s,e]),o})),J={};function G(e,s=[],t){return s.length?[s.length,()=>{const n=function(e,s,t){if(!t?.validators)return J;const a={};return s.forEach((s=>{t.validators[s]?.others.some((t=>!(!t.who.eq(e)||!(0,Z.S)(t.value)||(a[s]=t.value.toBn(),0))))})),a}(e,s,t);return s.map(((e,s)=>(0,a.jsx)(l.ax,{balance:n[e],value:e,withBalance:!!t&&!!n[e]},s)))}]:null}const Y=n.memo((function({nominating:e,stashId:s}){const{t}=C(),{api:o}=(0,c.h)(),{nomsActive:r,nomsChilled:i,nomsInactive:u,nomsOver:d,nomsWaiting:h}=U(s,e),p=(0,m.W7)(o.query.staking&&o.derive.session?.indexes),x=(0,m.W7)((0,g.m)(o.query.staking.erasStakers)&&o.derive.staking.eraExposure,[p?.activeEra]),[b,f,j,v,y]=(0,n.useMemo)((()=>[G(s,r,x),G(s,i),G(s,u),G(s,d),G(s,h)]),[x,r,i,u,d,h,s]);return(0,a.jsxs)(a.Fragment,{children:[v&&(0,a.jsx)(l.n0,{className:"stakeOver",renderChildren:v[1],summary:t("Oversubscribed nominations ({{count}})",{replace:{count:v[0]}})}),b&&(0,a.jsx)(l.n0,{renderChildren:b[1],summary:t("Active nominations ({{count}})",{replace:{count:b[0]}})}),j&&(0,a.jsx)(l.n0,{renderChildren:j[1],summary:t("Inactive nominations ({{count}})",{replace:{count:j[0]}})}),f&&(0,a.jsx)(l.n0,{renderChildren:f[1],summary:t("Renomination required ({{count}})",{replace:{count:f[0]}})}),y&&(0,a.jsx)(l.n0,{renderChildren:y[1],summary:t("Waiting nominations ({{count}})",{replace:{count:y[0]}})}),r&&u&&0===r.length&&0!==u.length&&(0,a.jsx)(l.Pd,{content:t("This could mean your nomination has not been applied to any validator in the active set by the election algorithm or it has been applied against a validator who is either oversubscribed or chilled.")})]})})),Q="staking:favorites",K=n.memo((function({className:e="",controllerId:s,poolId:t}){const{t:n}=C();return t&&s?(0,a.jsxs)(l.u_.Columns,{className:e,hint:n("The pool and pool member that is to be affected. The transaction will be sent from the associated pool member account."),children:[(0,a.jsx)(l.Rn,{defaultValue:t,isDisabled:!0,label:n("pool id")}),(0,a.jsx)(l.rp,{defaultValue:s,isDisabled:!0,label:n("member account")})]}):null})),X=l.zo.div` + article.warning { + margin-top: 0; + } + + .auto--toggle { + margin: 0.5rem 0 0; + text-align: right; + width: 100%; + } + + .ui--Static .ui--AddressMini.padded.addressStatic { + padding-top: 0.5rem; + + .ui--AddressMini-info { + min-width: 10rem; + max-width: 10rem; + } + } + + .shortlist { + display: flex; + flex-wrap: wrap; + justify-content: center; + + .candidate { + border: 1px solid #eee; + border-radius: 0.25rem; + margin: 0.25rem; + padding-bottom: 0.25rem; + padding-right: 0.5rem; + position: relative; + + &::after { + content: ''; + position: absolute; + top: 0; + right: 0; + border-color: transparent; + border-style: solid; + border-radius: 0.25em; + border-width: 0.25em; + } + + &.isAye { + background: #fff; + border-color: #ccc; + } + + &.member::after { + border-color: green; + } + + &.runnerup::after { + border-color: steelblue; + } + + .ui--AddressMini-icon { + z-index: 1; + } + + .candidate-right { + text-align: right; + } + } + } +`,ee=n.memo((function({className:e="",controllerId:s,nominating:t,onChange:o,poolId:r,stashId:i,targets:{nominateIds:u=[]},withSenders:m}){const{t:h}=C(),{api:p}=(0,c.h)(),[x]=(0,d.r)(Q),[g,b]=(0,n.useState)(t||[]),[f]=(0,n.useState)((()=>{const e=[...x.filter((e=>u.includes(e))),...(t||[]).filter((e=>!x.includes(e)))];return e.concat(...u.filter((s=>!e.includes(s))))}));(0,n.useEffect)((()=>{try{o({nominateTx:g?.length?r?p.tx.nominationPools.nominate(r,g):p.tx.staking.nominate(g):null})}catch{o({nominateTx:null})}}),[p,o,r,g]);const j=p.consts.staking.maxNominatorRewardedPerValidator?p.consts.staking.maxNominatorRewardedPerValidator.toNumber():p.consts.staking.maxNominations?p.consts.staking.maxNominations.toNumber():16;return(0,a.jsxs)(X,{className:e,children:[m&&(r?(0,a.jsx)(K,{controllerId:s,poolId:r}):(0,a.jsx)($,{controllerId:s,stashId:i})),(0,a.jsxs)(l.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:h("Nominators can be selected manually from the list of all currently available validators.")}),(0,a.jsx)("p",{children:h("Once transmitted the new selection will only take effect in 2 eras taking the new validator election cycle into account. Until then, the nominations will show as inactive.")})]}),children:[(0,a.jsx)(l.m3,{available:f,availableLabel:h("candidate accounts"),defaultValue:t,maxCount:j,onChange:b,valueLabel:h("nominated accounts")}),(0,a.jsx)(l.Pd,{content:h("You should trust your nominations to act competently and honest; basing your decision purely on their current profitability could lead to reduced profits or even loss of funds.")})]})]})})),se=(0,l.zo)(l.u_)` + .nominatePartial { + .ui--Static .ui--AddressMini .ui--AddressMini-info { + max-width: 10rem; + min-width: 10rem; + } + } +`,te=n.memo((function({className:e="",controllerId:s,nominating:t,onClose:o,poolId:r,stashId:i,targets:c}){const{t:u}=C(),[{nominateTx:d},m]=(0,n.useState)({});return(0,a.jsxs)(se,{className:e,header:u("Nominate Validators"),onClose:o,size:"large",children:[(0,a.jsx)(l.u_.Content,{children:(0,a.jsx)(ee,{className:"nominatePartial",controllerId:s,nominating:t,onChange:m,poolId:r,stashId:i,targets:c,withSenders:!0})}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:s,extrinsic:d,icon:"hand-paper",isDisabled:!d,label:u("Nominate"),onStart:o})})]})})),ae=n.memo((function({controllerId:e,onClose:s,stakingInfo:t,stashId:o}){const{t:r}=C(),{api:i}=(0,c.h)(),[u,d]=(0,n.useState)(),m=(0,n.useMemo)((()=>t?.unlocking?t.unlocking.reduce(((e,{value:s})=>e.iadd(s)),new(j())(0)):v.nw),[t]);return(0,a.jsxs)(l.u_,{header:r("Bond more funds"),onClose:s,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)($,{controllerId:e,stashId:o}),m&&(0,a.jsx)(l.u_.Columns,{hint:r("The amount the is to be rebonded from the value currently unlocking, i.e. previously unbonded"),children:(0,a.jsx)(l.H,{autoFocus:!0,defaultValue:m,isError:!u||u.eqn(0)||u.gt(m),label:r("rebonded amount"),onChange:d})})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:e,icon:"sign-in-alt",isDisabled:!u||u.isZero()||!m||u.gt(m),label:r("Rebond"),onStart:s,params:[u],tx:i.tx.staking.rebond})})]})})),ne={transform:e=>e.isSome?e.unwrap().toString():null},oe={transform:e=>e.isSome?e.unwrap().stash.toString():null},re=n.memo((function({accountId:e,controllerId:s,defaultController:t,onError:o}){const{t:r}=C(),{api:i}=(0,c.h)(),u=(0,m.W7)(s?i.query.staking.bonded:null,[s],ne),d=(0,m.W7)(s?i.query.staking.ledger:null,[s],oe),h=(0,m.W7)(s?i.derive.balances?.all:null,[s]),[{error:p,isFatal:x},g]=(0,n.useState)({error:null,isFatal:!1});return(0,n.useEffect)((()=>{if(t!==s){let t=null,a=!1;u&&s!==e?(a=!0,t=r("A controller account should not map to another stash. This selected controller is a stash, controlled by {{bondedId}}",{replace:{bondedId:u}})):d?(a=!0,t=r("A controller account should not be set to manage multiple stashes. The selected controller is already controlling {{stashId}}",{replace:{stashId:d}})):h?.freeBalance.isZero()?(a=!0,t=r("The controller does not have sufficient funds available to cover transaction fees. Ensure that a funded controller is used.")):s===e&&(t=r("Distinct stash and controller accounts are recommended to ensure fund security. You will be allowed to make the transaction, but take care to not tie up all funds, only use a portion of the available funds during this period.")),o(t,a),g((e=>e.error!==t?{error:t,isFatal:a}:e))}}),[e,h,u,s,t,o,d,r]),p&&e?x?(0,a.jsx)(l.oy,{content:p}):(0,a.jsx)(l.Pd,{content:p}):null})),ie=n.memo((function({defaultControllerId:e,onClose:s,stashId:t}){const{t:o}=C(),{api:r}=(0,c.h)(),[i,u]=(0,n.useState)(!1),[d,m]=(0,n.useState)(null),h=(0,n.useCallback)(((e,s)=>u(s)),[]),p=(0,n.useMemo)((()=>1===r.tx.staking.setController.meta.args.length),[r]);return(0,a.jsxs)(l.u_,{header:o("Change controller account"),onClose:s,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)(l.u_.Columns,{hint:o("The stash account that is used. This will allow the controller to perform all non-funds related operations on behalf of the account."),children:(0,a.jsx)(l.rp,{isDisabled:!0,label:o("stash account"),value:t})}),p&&(0,a.jsxs)(l.u_.Columns,{hint:o("The selected controller tied to this stash. Once set, this account will be able to control the actions performed by the stash account."),children:[(0,a.jsx)(l.rp,{defaultValue:e,label:o("controller account"),onChange:m,type:"account",value:d}),(0,a.jsx)(re,{accountId:t,controllerId:d,defaultController:e,onError:h})]})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:t,icon:"sign-in-alt",isDisabled:i||!!p&&!d,label:o("Set controller"),onStart:s,params:p?[d]:[],tx:r.tx.staking.setController})})]})}));function le(e){return function(e){return[{text:e("Stash account (increase the amount at stake)"),value:"Staked"},{text:e("Stash account (do not increase the amount at stake)"),value:"Stash"},{text:e("Controller account"),value:"Controller"}]}(e).concat({text:e("Specified payment account"),value:"Account"})}const ce=n.memo((function({controllerId:e,defaultDestination:s,onClose:t,stashId:o}){const{t:r}=C(),{api:i}=(0,c.h)(),[u,d]=(0,n.useState)((()=>(s?.isAccount?"Account":s?.toString())||"Staked")),[h,p]=(0,n.useState)((()=>s?.isAccount?s.asAccount.toString():null)),x=(0,m.W7)(i.derive.balances?.all,[h]),g=(0,n.useMemo)((()=>le(r)),[r]),b="Account"===u,f=b&&x&&x.accountId.eq(h)&&x.freeBalance.isZero();return(0,a.jsxs)(l.u_,{header:r("Bonding Preferences"),onClose:t,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)($,{controllerId:e,stashId:o}),(0,a.jsxs)(l.u_.Columns,{hint:r("All rewards will go towards the selected output destination when a payout is made."),children:[(0,a.jsx)(l.Lt,{defaultValue:s?.toString(),label:r("payment destination"),onChange:d,options:g,value:u}),b&&(0,a.jsx)(l.rp,{label:r("the payment account"),onChange:p,type:"account",value:h}),f&&(0,a.jsx)(l.oy,{content:r("The selected destination account does not exist and cannot be used to receive rewards")})]})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:e,icon:"sign-in-alt",isDisabled:!e||b&&(!h||f),label:r("Set reward destination"),onStart:t,params:[b?{Account:h}:u],tx:i.tx.staking.setPayee})})]})}));var ue=t(74076);const de=new Uint8Array,me=n.memo((function({className:e="",controllerId:s,onChange:t,stashId:o,withFocus:r,withSenders:i}){const{t:u}=C(),{api:d}=(0,c.h)(),[m,h]=(0,n.useState)(null);return(0,n.useEffect)((()=>{try{t({sessionTx:(0,ue.vq)(m)?d.tx.session.setKeys(m,de):null})}catch{t({sessionTx:null})}}),[d,m,t]),(0,a.jsxs)("div",{className:e,children:[i&&(0,a.jsx)($,{controllerId:s,stashId:o}),(0,a.jsx)(l.u_.Columns,{hint:u("The hex output from author_rotateKeys, as executed on the validator node. The keys will show as pending until applied at the start of a new session."),children:(0,a.jsx)(l.II,{autoFocus:r,isError:!m,label:u("Keys from rotateKeys"),onChange:h,placeholder:"0x..."})})]})})),he=n.memo((function({controllerId:e,onClose:s,stashId:t}){const{t:o}=C(),[{sessionTx:r},i]=(0,n.useState)({});return(0,a.jsxs)(l.u_,{header:o("Set Session Key"),onClose:s,size:"large",children:[(0,a.jsx)(l.u_.Content,{children:(0,a.jsx)(me,{controllerId:e,onChange:i,stashId:t,withFocus:!0,withSenders:!0})}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:e,extrinsic:r,icon:"sign-in-alt",isDisabled:!r,label:o("Set Session Key"),onStart:s})})]})}));var pe=t(65874);const xe=(0,I.e)("useUnbondDuration",(function(){const{api:e}=(0,c.h)(),s=(0,m.W7)(e.derive.session.info);return(0,n.useMemo)((()=>s&&s.sessionLength.gt(v.If)?s.eraLength.mul(e.consts.staking.bondingDuration):void 0),[e,s])})),ge=(0,l.zo)(l.u_)` + .staking--Unbond--max > div { + justify-content: flex-end; + + & .column { + flex: 0; + } + } +`,be=n.memo((function({controllerId:e,onClose:s,stakingLedger:t,stashId:o}){const{t:r}=C(),{api:i}=(0,c.h)(),u=xe(),[d]=(0,n.useState)((()=>t?.active?.unwrap()||null)),[m,h]=(0,n.useState)();return(0,a.jsxs)(ge,{header:r("Unbond funds"),onClose:s,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)($,{controllerId:e,stashId:o}),(0,a.jsxs)(l.u_.Columns,{hint:r("The funds will only be available for withdrawal after the unbonding period, however will not be part of the staked amount after the next validator election. You can follow the unlock countdown in the UI."),children:[(0,a.jsx)(l.H,{autoFocus:!0,defaultValue:d,label:r("unbond amount"),labelExtra:(0,a.jsx)(b.Z,{label:(0,a.jsx)("span",{className:"label",children:r("bonded")}),value:d}),maxValue:d,onChange:h,withMax:!0}),u?.gtn(0)&&(0,a.jsx)(l.qG,{label:r("on-chain bonding duration"),children:(0,a.jsx)(pe.Z,{value:u})})]})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:e,icon:"unlock",isDisabled:!m?.gt(v.nw),label:r("Unbond"),onStart:s,params:[m],tx:i.tx.staking.unbond})})]})}));var fe=t(52107);const je=new(j())(1e7),ve=n.memo((function({className:e="",controllerId:s,minCommission:t,onChange:o,stashId:r,withFocus:i,withSenders:u}){const{t:d}=C(),{api:m}=(0,c.h)(),[h,p]=(0,n.useState)(v.If),[x,b]=(0,n.useState)(!0),f=(0,n.useMemo)((()=>t?(0,fe.x)(t.div(je),v.If):v.If),[t]),j=(0,n.useRef)([{text:d("Yes, allow nominations"),value:!0},{text:d("No, block all nominations"),value:!1}]);(0,n.useEffect)((()=>{try{o({validateTx:m.tx.staking.validate({blocked:!x,commission:h})})}catch{o({validateTx:null})}}),[m,x,h,o]);const y=(0,n.useCallback)((e=>e&&p(e.isZero()?v.If:e.mul(je))),[]),w=!!t&&h.lt(t);return(0,a.jsxs)("div",{className:e,children:[u&&(0,a.jsx)($,{controllerId:s,stashId:r}),(0,a.jsxs)(l.u_.Columns,{hint:d("The commission is deducted from all rewards before the remainder is split with nominators."),children:[(0,a.jsx)(l.Rn,{autoFocus:i,defaultValue:f,isError:w,isZeroable:!0,label:d("reward commission percentage"),maxValue:v.S8,onChange:y}),w&&(0,a.jsx)(l.oy,{content:d("The commission is below the on-chain minimum of {{p}}%",{replace:{p:(t.mul(v.S8).div(je).toNumber()/100).toFixed(2)}})})]}),(0,g.m)(m.tx.staking.kick)&&(0,a.jsx)(l.u_.Columns,{hint:d("The validator can block any new nominations. By default it is set to allow all nominations."),children:(0,a.jsx)(l.Lt,{defaultValue:!0,label:d("allows new nominations"),onChange:b,options:j.current})})]})})),ye=n.memo((function({controllerId:e,minCommission:s,onClose:t,stashId:o}){const{t:r}=C(),[{validateTx:i},c]=(0,n.useState)({});return(0,a.jsxs)(l.u_,{header:r("Set validator preferences"),onClose:t,size:"large",children:[(0,a.jsx)(l.u_.Content,{children:(0,a.jsx)(ve,{controllerId:e,minCommission:s,onChange:c,stashId:o,withFocus:!0,withSenders:!0})}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:e,extrinsic:i,icon:"certificate",isDisabled:!i,label:r("Validate"),onStart:t})})]})})),Ce=n.memo((function({minBond:e,stakingInfo:s}){const{t}=C();return(0,n.useMemo)((()=>e&&s&&s.stakingLedger.active.unwrap().lt(e)),[e,s])?(0,a.jsx)(l.Pd,{content:t("Your bonded amount is below the on-chain minimum threshold of {{minBond}} and may be chilled. Bond extra funds to increase the bonded amount.",{replace:{minBond:(0,M.a)(e)}})}):null})),we=l.zo.tr` + .ui--Button-Group { + display: inline-block; + margin-right: 0.25rem; + vertical-align: inherit; + } +`,Ne=n.memo((function({allSlashes:e,className:s="",info:{controllerId:t,destination:o,hexSessionIdNext:r,hexSessionIdQueue:i,isLoading:u,isOwnController:d,isOwnStash:h,isStashNominating:p,isStashValidating:x,nominating:b,sessionIds:f,stakingLedger:j,stashId:v},isDisabled:y,minCommission:w,targets:I}){const{t:A}=C(),{api:E}=(0,c.h)(),{queueExtrinsic:M}=(0,N.L)(),[T,D]=(0,k.O)(),[V,_]=(0,k.O)(),[q,O]=(0,k.O)(),[R,z]=(0,k.O)(),[$,L]=(0,k.O)(),[Z,W]=(0,k.O)(),[U,J]=(0,k.O)(),[G,Q]=(0,k.O)(),[K,X]=(0,k.O)(),[ee,se]=(0,k.O)(),{balancesAll:ne,spanCount:oe,stakingAccount:re}=function(e,s){const t=(0,n.useMemo)((()=>[s]),[s]),a=(0,m.W7)(e.derive.balances?.all,t),o=(0,m.W7)(e.derive.staking.account,t);return{balancesAll:a,spanCount:P(s),stakingAccount:o}}(E,v),le=(0,n.useMemo)((()=>1===E.tx.staking.setController.meta.args.length||v!==t),[E,t,v]),ue=(0,n.useMemo)((()=>function(e,s=[]){return s.map((([s,t])=>({era:s,slashes:t.filter((({others:s,validator:t})=>t.eq(e)||s.some((([s])=>s.eq(e)))))}))).filter((({slashes:e})=>e.length))}(v,e)),[e,v]),de=(0,n.useCallback)((()=>M({accountId:t,extrinsic:1===E.tx.staking.withdrawUnbonded.meta.args.length?E.tx.staking.withdrawUnbonded(oe):E.tx.staking.withdrawUnbonded()})),[E,t,M,oe]),me=!!re?.stakingLedger&&!re.stakingLedger.active?.isEmpty;return(0,a.jsxs)(we,{className:s,children:[(0,a.jsx)("td",{className:"badge together",children:0!==ue.length&&(0,a.jsx)(l.Ct,{color:"red",hover:A("Slashed in era {{eras}}",{replace:{eras:ue.map((({era:e})=>(0,S.u)(e))).join(", ")}}),icon:"skull-crossbones"})}),(0,a.jsxs)("td",{className:"address",children:[(0,a.jsx)(l.N,{value:v}),T&&(0,a.jsx)(F,{controllerId:t,onClose:D,stakingInfo:re,stashId:v}),V&&(0,a.jsx)(H,{onClose:_}),q&&t&&(0,a.jsx)(B,{controllerId:t,onClose:O,stashId:v}),R&&t&&(0,a.jsx)(te,{controllerId:t,nominating:b,onClose:z,stashId:v,targets:I}),$&&(0,a.jsx)(ae,{controllerId:t,onClose:L,stakingInfo:re,stashId:v}),U&&t&&(0,a.jsx)(ie,{defaultControllerId:t,onClose:J,stashId:v}),Z&&t&&(0,a.jsx)(ce,{controllerId:t,defaultDestination:o,onClose:W,stashId:v}),G&&t&&(0,a.jsx)(he,{controllerId:t,onClose:Q,stashId:v}),K&&(0,a.jsx)(be,{controllerId:t,onClose:X,stakingLedger:j,stashId:v}),ee&&t&&(0,a.jsx)(ye,{controllerId:t,minCommission:w,onClose:se,stashId:v})]}),(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(l.ax,{value:t})}),(0,a.jsx)("td",{className:"start media--1200",children:o?.isAccount?(0,a.jsx)(l.ax,{value:o.asAccount}):o?.toString()}),(0,a.jsxs)("td",{className:"number",children:[(0,a.jsx)(l.d4,{stakingInfo:re}),(0,a.jsx)(l.JM,{stakingInfo:re}),(0,a.jsx)(l.by,{stakingInfo:re})]}),x?(0,a.jsxs)("td",{className:"all",children:[(0,a.jsx)(l.hl,{address:v,withBalance:!1,withHexSessionId:"0x"!==r&&[i,r],withValidatorPrefs:!0}),(0,a.jsx)(Ce,{minBond:I.minValidatorBond,stakingInfo:re})]}):(0,a.jsx)("td",{className:"all expand",children:p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y,{nominating:b,stashId:v}),(0,a.jsx)(Ce,{minBond:I.minNominatorBond,stakingInfo:re})]})}),(0,a.jsx)("td",{className:"button",children:!u&&(0,a.jsxs)(a.Fragment,{children:[p||x?(0,a.jsx)(l.cA,{accountId:t,icon:"stop",isDisabled:!d||y,label:A("Stop"),tx:E.tx.staking.chill},"stop"):(0,a.jsxs)(l.zx.Group,{children:[f.length&&"0x"!==r?(0,a.jsx)(l.zx,{icon:"certificate",isDisabled:!d||y||!me,label:A("Validate"),onClick:se},"validate"):(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:!d||y,label:A("Session Key"),onClick:Q},"set"),(0,a.jsx)(l.zx,{icon:"hand-paper",isDisabled:!d||y||!me,label:A("Nominate"),onClick:z},"nominate")]}),(0,a.jsx)(l.GI,{isDisabled:y,value:(0,a.jsxs)(l.v2,{children:[(0,a.jsx)(l.v2.Item,{isDisabled:!h||!ne?.freeBalance.gtn(0),label:A("Bond more funds"),onClick:D}),(0,a.jsx)(l.v2.Item,{isDisabled:!d||!re?.stakingLedger||re.stakingLedger.active?.isEmpty,label:A("Unbond funds"),onClick:X}),(0,a.jsx)(l.v2.Item,{isDisabled:!d||!re?.unlocking?.length,label:A("Rebond funds"),onClick:L}),(0,a.jsx)(l.v2.Item,{isDisabled:!d||!re?.redeemable||!re.redeemable.gtn(0),label:A("Withdraw unbonded funds"),onClick:de}),(0,a.jsx)(l.v2.Divider,{}),(0,a.jsx)(l.v2.Item,{isDisabled:!h||!le,label:A("Change controller account"),onClick:J}),(0,a.jsx)(l.v2.Item,{isDisabled:!d,label:A("Change reward destination"),onClick:W}),x&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.v2.Item,{isDisabled:!d,label:A("Change validator preferences"),onClick:se}),(0,g.m)(E.tx.staking.kick)&&(0,a.jsx)(l.v2.Item,{isDisabled:!d,label:A("Remove nominees"),onClick:O})]}),(0,a.jsx)(l.v2.Divider,{}),!p&&(0,a.jsx)(l.v2.Item,{isDisabled:!d,label:A("Change session keys"),onClick:Q}),p&&(0,a.jsx)(l.v2.Item,{isDisabled:!d||!I.validators?.length,label:A("Set nominees"),onClick:z}),!p&&(0,a.jsx)(l.v2.Item,{label:A("Inject session keys (advanced)"),onClick:_})]})},"settings")]})})]})})),ke=n.memo((function({allSlashes:e,className:s,footer:t,isInElection:o,list:r,minCommission:i,targets:c}){const{t:u}=C(),d=(0,n.useRef)([[u("stashes"),"start",2],[u("controller"),"address"],[u("rewards"),"start media--1200"],[u("bonded"),"number"],[],[]]);return(0,a.jsx)(l.iA,{className:s,empty:r&&u("No funds staked yet. Bond funds to validate or nominate a validator"),footer:t,header:d.current,children:r?.map((s=>(0,a.jsx)(Ne,{allSlashes:e,info:s,isDisabled:o,minCommission:i,targets:c},s.stashId)))})})),Se={bondTx:null,controllerId:null,controllerTx:null,stashId:null},Ie=n.memo((function({className:e="",isNominating:s,minNominated:t,minNominatorBond:o,minValidatorBond:r,onChange:i}){const{t:u}=C(),{api:d}=(0,c.h)(),[h,p]=(0,n.useState)(),[x,g]=(0,n.useState)(null),[b,f]=(0,n.useState)(!1),[j,y]=(0,n.useState)(null),[w,N]=(0,n.useState)("Staked"),[k,S]=(0,n.useState)(null),[I,A]=(0,n.useState)(null),[P,M]=(0,n.useState)(null),T=(0,m.W7)(d.derive.balances?.all,[I]),F=(0,m.W7)(d.derive.balances?.all,[k]),V=xe(),_=(0,n.useMemo)((()=>3===d.tx.staking.bond.meta.args.length),[d]),q=(0,n.useMemo)((()=>le(u)),[u]),O=(0,n.useCallback)(((e,s)=>f(s)),[]);(0,n.useEffect)((()=>{T&&M(T.freeBalance.gt(d.consts.balances.existentialDeposit)?T.freeBalance.sub(d.consts.balances.existentialDeposit):v.nw)}),[d,T]),(0,n.useEffect)((()=>{M(null)}),[I]),(0,n.useEffect)((()=>{const e="Account"===w?{Account:k}:w,[s,t]=_?[j,b]:[I,null];i(h&&h.gtn(0)&&!x?.error&&!t&&s&&I?{bondTx:_?d.tx.staking.bond(I,h,e):d.tx.staking.bond(h,e),controllerId:s,controllerTx:_?d.tx.staking.setController(s):null,stashId:I}:Se)}),[d,h,x,b,j,w,k,_,i,I]);const R=!!h?.gtn(0),z="Account"===w,H=z&&F&&F.accountId.eq(k)&&F.freeBalance.isZero();return(0,a.jsxs)("div",{className:e,children:[(0,a.jsxs)(l.u_.Columns,{hint:_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:u("Think of the stash as your cold wallet and the controller as your hot wallet. Funding operations are controlled by the stash, any other non-funding actions by the controller itself.")}),(0,a.jsx)("p",{children:u("To ensure optimal fund security using the same stash/controller is strongly discouraged, but not forbidden.")})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:u("The stash should be treated as a cold wallet.")}),(0,a.jsx)("p",{children:u("As such it is recommended that you setup a proxy to control operations via the stash.")})]}),children:[(0,a.jsx)(l.rp,{label:u("stash account"),onChange:A,type:"account",value:I}),_&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.rp,{label:u("controller account"),onChange:y,type:"account",value:j}),(0,a.jsx)(re,{accountId:I,controllerId:j,onError:O})]})]}),P&&(0,a.jsxs)(l.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:u("The amount placed at-stake should not be your full available amount to allow for transaction fees.")}),(0,a.jsx)("p",{children:u("Once bonded, it will need to be unlocked/withdrawn and will be locked for at least the bonding duration.")})]}),children:[(0,a.jsx)(l.H,{autoFocus:!0,defaultValue:P,isError:!R||!!x?.error,label:u("value bonded"),labelExtra:(0,a.jsx)(E.Z,{label:(0,a.jsx)("span",{className:"label",children:u("balance")}),params:I}),onChange:p}),(0,a.jsx)(D,{controllerId:j,isNominating:s,minNominated:t,minNominatorBond:o,minValidatorBond:r,onError:g,stashId:I,value:h}),V?.gtn(0)&&(0,a.jsx)(l.qG,{label:u("on-chain bonding duration"),children:(0,a.jsx)(pe.Z,{value:V})})]}),(0,a.jsxs)(l.u_.Columns,{hint:u("Rewards (once paid) can be deposited to either the stash or controller, with different effects."),children:[(0,a.jsx)(l.Lt,{defaultValue:0,label:u("payment destination"),onChange:N,options:q,value:w}),z&&(0,a.jsx)(l.rp,{label:u("the payment account"),onChange:S,type:"account",value:k}),H&&(0,a.jsx)(l.oy,{content:u("The selected destination account does not exist and cannot be used to receive rewards")})]})]})})),Ae=[],Pe=n.memo((function({isInElection:e,targets:s}){const{t}=C(),{api:o}=(0,c.h)(),[r,i]=(0,k.O)(),[{bondTx:u,controllerId:d,controllerTx:m,stashId:h},p]=(0,n.useState)({}),[{nominateTx:x},b]=(0,n.useState)({}),[f,j]=(0,n.useState)(1),v=e||!(0,g.m)(o.tx.utility?.batch),y=(0,n.useCallback)((()=>j((e=>e+1))),[]),w=(0,n.useCallback)((()=>j((e=>e-1))),[]),N=(0,n.useCallback)((()=>{p({}),b({}),j(1),i()}),[i]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.zx,{icon:"plus",isDisabled:v||!s.validators?.length,label:t("Nominator"),onClick:N},"new-nominator"),r&&(0,a.jsxs)(l.u_,{header:t("Setup Nominator {{step}}/{{NUM_STEPS}}",{replace:{NUM_STEPS:2,step:f}}),onClose:N,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[1===f&&(0,a.jsx)(Ie,{isNominating:!0,minNominated:s.minNominated,minNominatorBond:s.minNominatorBond,onChange:p}),d&&h&&2===f&&(0,a.jsx)(ee,{controllerId:d,nominating:Ae,onChange:b,stashId:h,targets:s}),(0,a.jsx)(l.u_.Columns,{children:(0,a.jsx)(l.RN,{})})]}),(0,a.jsxs)(l.u_.Actions,{children:[(0,a.jsx)(l.zx,{icon:"step-backward",isDisabled:1===f,label:t("prev"),onClick:w}),2===f?(0,a.jsx)(l.cA,{accountId:h,icon:"sign-in-alt",isDisabled:!(u&&x&&h&&d),label:t("Bond & Nominate"),onStart:N,params:[h===d?[u,x]:[u,x,m]],tx:o.tx.utility.batchAll||o.tx.utility.batch}):(0,a.jsx)(l.zx,{icon:"step-forward",isDisabled:!u,label:t("next"),onClick:y})]})]})]})})),Ee=n.memo((function(){const{t:e}=C(),[s,t]=(0,k.O)(),[{bondTx:o,stashId:r},i]=(0,n.useState)({}),c=(0,n.useCallback)((()=>{i({}),t()}),[t]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.zx,{icon:"plus",label:e("Stash"),onClick:c},"new-stash"),s&&(0,a.jsxs)(l.u_,{header:e("Bonding Preferences"),onClose:c,size:"large",children:[(0,a.jsx)(l.u_.Content,{children:(0,a.jsx)(Ie,{onChange:i})}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:r,extrinsic:o,icon:"sign-in-alt",isDisabled:!o||!r,label:e("Bond"),onStart:c})})]})]})})),Me=n.memo((function({isInElection:e,minCommission:s,targets:t}){const{t:o}=C(),{api:r}=(0,c.h)(),[i,u]=(0,k.O)(),[{bondTx:d,controllerId:m,controllerTx:h,stashId:p},x]=(0,n.useState)({}),[{sessionTx:b},f]=(0,n.useState)({}),[{validateTx:j},v]=(0,n.useState)({}),[y,w]=(0,n.useState)(1),N=e||!(0,g.m)(r.tx.utility?.batch),S=(0,n.useCallback)((()=>w((e=>e+1))),[]),I=(0,n.useCallback)((()=>w((e=>e-1))),[]),A=(0,n.useCallback)((()=>{x({}),f({}),v({}),w(1),u()}),[u]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.zx,{icon:"plus",isDisabled:N,label:o("Validator"),onClick:A},"new-validator"),i&&(0,a.jsxs)(l.u_,{header:o("Setup Validator {{step}}/{{NUM_STEPS}}",{replace:{NUM_STEPS:2,step:y}}),onClose:A,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[1===y&&(0,a.jsx)(Ie,{minValidatorBond:t.minValidatorBond,onChange:x}),m&&p&&2===y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(me,{controllerId:m,onChange:f,stashId:p,withFocus:!0}),(0,a.jsx)(ve,{controllerId:m,minCommission:s,onChange:v,stashId:p})]}),(0,a.jsx)(l.u_.Columns,{children:(0,a.jsx)(l.RN,{})})]}),(0,a.jsxs)(l.u_.Actions,{children:[(0,a.jsx)(l.zx,{icon:"step-backward",isDisabled:1===y,label:o("prev"),onClick:I}),2===y?(0,a.jsx)(l.cA,{accountId:p,icon:"sign-in-alt",isDisabled:!d||!b||!j,label:o("Bond & Validate"),onStart:A,params:[m===p?[d,b,j]:[d,b,j,h]],tx:r.tx.utility.batchAll||r.tx.utility.batch}):(0,a.jsx)(l.zx,{icon:"step-forward",isDisabled:!d,label:o("next"),onClick:S})]})]})]})}));var Te=t(19042),De=t(63985);const Fe="rewards",Ve=n.memo((function({className:e,controllerId:s,onClose:t,poolId:o}){const{t:r}=C(),{api:i}=(0,c.h)(),[u,d]=(0,n.useState)(Fe),[m,h]=(0,n.useState)(),p=(0,De.Z)(s,m,v.nw),x=(0,n.useRef)([{text:r("Free balance"),value:"free"},{text:r("Pool rewards"),value:"rewards"}]);return(0,a.jsxs)(l.u_,{className:e,header:r("Bond extra into pool"),onClose:t,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)(K,{controllerId:s,poolId:o}),(0,a.jsxs)(l.u_.Columns,{hint:r("You can either bond a specific amount from your free balance, or all of the accumulated rewards."),children:[(0,a.jsx)(l.Lt,{defaultValue:Fe,label:r("type of funds to bond"),onChange:d,options:x.current}),"free"===u&&(0,a.jsx)(l.H,{autoFocus:!0,isError:p,label:r("additional free funds to bond"),labelExtra:(0,a.jsx)(E.Z,{label:(0,a.jsx)("span",{className:"label",children:r("balance")}),params:s}),onChange:h})]})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:s,icon:"sign-in-alt",isDisabled:"free"===u&&p,label:r("Bond Extra"),onStart:t,params:["free"===u?{FreeBalance:m}:"Rewards"],tx:i.tx.nominationPools.bondExtra})})]})})),_e=n.memo((function({className:e,controllerId:s,maxUnbond:t,onClose:o,poolId:r}){const{t:i}=C(),{api:u}=(0,c.h)(),[d,m]=(0,n.useState)(),h=xe(),p=!d||!t||d.gt(t);return(0,a.jsxs)(l.u_,{className:e,header:i("Unbond funds from pool"),onClose:o,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)(K,{controllerId:s,poolId:r}),(0,a.jsxs)(l.u_.Columns,{hint:i("The amount to unbond. It should be less or equal to the full bonded amount."),children:[(0,a.jsx)(l.H,{autoFocus:!0,defaultValue:t,isError:p,label:i("amount to unbond"),labelExtra:(0,a.jsx)(b.Z,{label:(0,a.jsx)("span",{className:"label",children:i("bonded")}),value:t}),maxValue:t,onChange:m,withMax:!0}),h?.gtn(0)&&(0,a.jsx)(l.qG,{label:i("on-chain bonding duration"),children:(0,a.jsx)(pe.Z,{value:h})})]})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:s,icon:"unlock",isDisabled:p,label:i("Unbond"),onStart:o,params:[s,d],tx:u.tx.nominationPools.unbond})})]})})),qe={transform:e=>e.unwrapOr(null)},Oe=(0,I.e)("useAccountInfo",(function(e){const{api:s}=(0,c.h)(),t=(0,W.X)(),[a,o]=(0,n.useState)(null),r=(0,m.W7)(s.query.nominationPools.poolMembers,[e],qe);return(0,n.useEffect)((()=>{r&&s.call.nominationPoolsApi?.pendingRewards(e).then((e=>t.current&&o({claimable:e,member:r}))).catch(console.error)}),[e,r,s,t]),a})),Re=n.memo((function({accountId:e,className:s,info:{bonded:{roles:t},metadata:o,nominating:r,stashId:i},isFirst:u,poolId:d,sessionProgress:m,targets:h}){const{t:p}=C(),{api:x}=(0,c.h)(),g=P(i),{queueExtrinsic:f}=(0,N.L)(),[v,y]=(0,k.O)(),[w,I]=(0,k.O)(),[A,E]=(0,k.O)(),M=Oe(e),T=(0,n.useMemo)((()=>m&&M?.member.unbondingEras&&!M.member.unbondingEras.isEmpty?function(e,s,{activeEra:t},{unbondingEras:a}){const n=[],o=new(j())(0);for(const[e,s]of a.entries())e.lte(t)?o.iadd(s):n.push({remainingEras:e.sub(t),value:s});return{accountId:e,controllerId:e,redeemable:o,stashId:s,unlocking:n}}(e,i,m,M.member):null),[M,e,i,m]),D=(0,n.useCallback)((()=>f({accountId:e,extrinsic:x.tx.nominationPools.claimPayout()})),[x,e,f]),F=(0,n.useCallback)((()=>f({accountId:e,extrinsic:x.tx.nominationPools.withdrawUnbonded(e,g)})),[x,e,g,f]),{isNominator:V}=(0,n.useMemo)((()=>function(e,{nominator:s,root:t}){return{isNominator:s.eq(e)||t.eq(e)}}(e,t)),[e,t]);return(0,a.jsxs)("tr",{className:s,children:[(0,a.jsx)("td",{className:"number",children:(0,a.jsx)("h1",{children:u&&(0,S.u)(d)})}),(0,a.jsx)("td",{className:"start",children:u&&o}),(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(l.N,{value:e})}),(0,a.jsx)("td",{className:"number",children:M&&(0,a.jsxs)(a.Fragment,{children:[!M.member.points.isZero()&&(0,a.jsx)(b.Z,{value:M.member.points}),T&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.JM,{stakingInfo:T}),(0,a.jsx)(l.by,{isPool:!0,stakingInfo:T})]})]})}),(0,a.jsx)("td",{className:"number",children:M&&!M.claimable.isZero()&&(0,a.jsx)(b.Z,{value:M.claimable})}),(0,a.jsx)("td",{className:"number",children:u&&r&&(0,a.jsx)(Y,{nominating:r,stashId:i})}),(0,a.jsxs)("td",{className:"button",children:[(0,a.jsx)(l.Ct,{color:V?"green":"transparent",icon:"hand-paper"}),v&&(0,a.jsx)(Ve,{controllerId:e,onClose:y,poolId:d}),w&&(0,a.jsx)(te,{controllerId:e,nominating:r,onClose:I,poolId:d,stashId:e,targets:h}),M&&A&&(0,a.jsx)(_e,{controllerId:e,maxUnbond:M.member.points,onClose:E,poolId:d}),(0,a.jsx)(l.GI,{value:(0,a.jsxs)(l.v2,{children:[(0,a.jsx)(l.v2.Item,{label:p("Bond more funds"),onClick:y}),(0,a.jsx)(l.v2.Item,{isDisabled:!M||M.member.points.isZero(),label:p("Unbond funds"),onClick:E}),(0,a.jsx)(l.v2.Divider,{}),(0,a.jsx)(l.v2.Item,{isDisabled:!M||M.claimable.isZero(),label:p("Withdraw claimable"),onClick:D}),(0,a.jsx)(l.v2.Item,{isDisabled:!T||T.redeemable.isZero(),label:p("Withdraw unbonded"),onClick:F}),(0,a.jsx)(l.v2.Divider,{}),(0,a.jsx)(l.v2.Item,{isDisabled:!V,label:p("Set nominees"),onClick:I})]})},"settings")]})]})})),ze=n.memo((function({className:e,count:s,members:t,poolId:n,sessionProgress:o,targets:r}){const i=(0,Te.Z)(n);return i?(0,a.jsx)(a.Fragment,{children:Object.keys(t).map(((t,l)=>(0,a.jsx)(Re,{accountId:t,className:`${e||""} ${s%2?"isEven":"isOdd"}`,info:i,isFirst:0===l,poolId:n,sessionProgress:o,targets:r},`${n.toString()}:${t}`)))}):null})),He=n.memo((function({className:e,list:s,targets:t}){const{t:o}=C(),{api:r}=(0,c.h)(),i=(0,m.W7)(r.derive.session.progress),u=(0,n.useRef)([[o("pools"),"start",2],[o("account"),"address"],[o("bonded")],[o("claimable")],[],[]]);return(0,a.jsx)(l.iA,{className:e,empty:s&&o("Not participating in any pools. Join a pool first."),header:u.current,children:s?.map((({members:e,poolId:s},n)=>(0,a.jsx)(ze,{count:n,members:e,poolId:s,sessionProgress:i,targets:t},s.toString())))})}));function $e({isStashNominating:e,isStashValidating:s}){return s?1:e?5:99}function Le(e,s){return $e(e)-$e(s)}function Be(e,s){return s.filter((({isStashNominating:s,isStashValidating:t})=>{switch(e){case 1:return s;case 2:return t;case 3:return!s&&!t;default:return!0}}))}function Ze(e,s){const t=function(e,{bondedNoms:s,bondedNone:t,bondedTotal:a,bondedVals:n}){switch(e){case 0:default:return a;case 1:return s;case 2:return n;case 3:return t}}(e,s);return t&&(0,a.jsx)(b.Z,{value:t})}const We=n.memo((function({className:e="",isInElection:s,minCommission:t,ownPools:o,ownStashes:r,targets:i}){const{t:u}=C(),{api:d}=(0,c.h)(),m=(0,x.g)(),[h,p]=(0,n.useState)(0),[g,b]=(0,n.useState)(0),f=(0,n.useRef)([{text:u("Stashed"),value:"stash"},{text:u("Pooled"),value:"pool"}]),y=(0,n.useRef)([{text:u("All stashes"),value:"all"},{text:u("Nominators"),value:"noms"},{text:u("Validators"),value:"vals"},{text:u("Inactive"),value:"chill"}]),N=(0,n.useMemo)((()=>function(e){if(!e)return{};const s=new(j())(0),t=new(j())(0),a=new(j())(0),n=new(j())(0);return e.forEach((({isStashNominating:e,isStashValidating:o,stakingLedger:r})=>{const i=r?.total?r.total.unwrap():v.nw;n.iadd(i),e?s.iadd(i):o?a.iadd(i):t.iadd(i)})),{bondedNoms:s,bondedNone:t,bondedTotal:n,bondedVals:a,foundStashes:e.sort(Le)}}(r)),[r]),[k,S]=(0,n.useMemo)((()=>[N.foundStashes&&Be(g,N.foundStashes),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{colSpan:4}),(0,a.jsx)("td",{className:"number",children:Ze(g,N)}),(0,a.jsx)("td",{colSpan:2})]},"footer")]),[N,g]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsxs)(l.zx.Group,{children:[d.consts.nominationPools&&(0,a.jsx)(l.tX,{onChange:p,options:f.current,value:h}),0===h&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.tX,{onChange:b,options:y.current,value:g}),(0,a.jsx)(Pe,{isInElection:s,targets:i}),(0,a.jsx)(Me,{isInElection:s,minCommission:t,targets:i}),(0,a.jsx)(Ee,{})]})]}),(0,a.jsx)(w,{isInElection:s}),0===h?(0,a.jsx)(ke,{allSlashes:m,footer:S,isInElection:s,list:k,minCommission:t,targets:i}):(0,a.jsx)(He,{allSlashes:m,list:o,targets:i})]})}));var Ue=t(79760);const Je=(0,I.e)("useQueryModule",(function(){const{api:e}=(0,c.h)();return(0,n.useMemo)((()=>e.query.voterList||e.query.voterBagsList||e.query.bagsList),[e])})),Ge={transform:e=>e.filter((e=>e.isSome)).map((e=>e.unwrap())).reduce(((e,s)=>{const t=s.bagUpper.toString();return e[t]||(e[t]=[]),e[t].push({node:s,stashId:s.id.toString()}),e}),{})},Ye=(0,I.e)("useBagsNodes",(function(e){const s=Je(),[t,a]=(0,n.useState)(),o=(0,m.W7)(s.listNodes.multi,[e],Ge);return(0,n.useEffect)((()=>{o&&a((e=>function(e,s){return Object.entries(s).reduce(((s,[t,a])=>(s[t]=e?.[t]&&JSON.stringify(a)===JSON.stringify(e[t])?e[t]:a,s)),{})}(e,o)))}),[o]),t})),Qe=n.memo((function({bagUpper:e,stashIds:s}){const{t}=C(),{api:o}=(0,c.h)(),[r,i]=(0,n.useState)(null),[u,d]=(0,k.O)(),m=Ye(s),h=(0,n.useMemo)((()=>m?function(e,s){return Object.values(e[s.toString()]||{}).map((({stashId:e})=>e))}(m,e):[]),[e,m]),[p,x]=(0,n.useState)([]),g=(0,n.useMemo)((()=>p.map((e=>(o.tx.voterBagsList||o.tx.bagsList||o.tx.voterList).rebag(e)))),[o,p]),b=(0,Ue.b)(g);return h.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.zx,{icon:"refresh",label:t("Rebag {{count}}",{replace:{count:h.length}}),onClick:d}),u&&(0,a.jsxs)(l.u_,{header:t("Rebag dislocated entries"),onClose:d,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)(l.u_.Columns,{hint:t("The account that will submit the rebag transaction."),children:(0,a.jsx)(l.rp,{label:t("rebag from account"),onChange:i,type:"account"})}),(0,a.jsx)(l.u_.Columns,{hint:t("The accounts that will be rebagged as a result of this operation."),children:(0,a.jsx)(l.m3,{available:h,availableLabel:t("unselected"),defaultValue:h,maxCount:Number.MAX_SAFE_INTEGER,onChange:x,valueLabel:t("to rebag")})})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:r,extrinsic:b,icon:"refresh",isDisabled:!b||!p.length,label:t("Rebag"),onStart:d})})]})]}):null})),Ke=l.zo.div` + .ui--AddressMini { + vertical-align: middle; + } +`,Xe=n.memo((function({bagLower:e,bagUpper:s,className:t,isLoading:o,list:r,stashId:i}){const{t:u}=C(),{api:d}=(0,c.h)(),{canJump:m,jumpCount:h,stashInfo:p}=(0,n.useMemo)((()=>function(e,s,t,a=[]){const n=a.find((e=>e.stashId===t))||null,o=n?.jump&&a.find((e=>e.stashId===n.jump))||null;return{canJump:!!o,jumpCount:n&&o?n.index-o.index:0,stashInfo:n}}(0,0,i,r)),[e,s,r,i]);return(0,a.jsxs)(Ke,{className:t,children:[(0,a.jsx)(l.ax,{value:i,withBonded:!0}),p&&(m?(0,a.jsx)(l.cA,{accountId:p.stashId,icon:"caret-up",isDisabled:o,label:u("Move up {{jumpCount}}",{replace:{jumpCount:h}}),params:[p.jump],tx:(d.tx.voterBagsList||d.tx.bagsList||d.tx.voterList).putInFrontOf}):null)]})})),es=[null,{isCompleted:!1,list:[]}],ss=[],ts=(0,I.e)("useBagEntries",(function(e,s){const t=Je(),[[a,{isCompleted:o,list:r}],i]=(0,n.useState)(es),l=(0,m.W7)(!!a&&t.listNodes,[a]);return(0,n.useEffect)((()=>i(e&&s?[e,{isCompleted:!1,list:[e]}]:[null,{isCompleted:!0,list:[]}])),[e,s]),(0,n.useEffect)((()=>{if(l&&l.isSome){const{next:e}=l.unwrap();if(e.isSome){const s=e.unwrap();i((([,{list:e}])=>[s,{isCompleted:!1,list:[...e,s]}]))}else i((([e,{list:s}])=>[e,{isCompleted:!0,list:s}]))}}),[l]),[o,o?r:ss]})),as={transform:e=>{const s=e.map((({stakingLedger:e,stashId:s},t)=>({bonded:e.active.unwrap(),index:t,jump:null,stashId:s.toString()})));return s.map((e=>{const t=s.find((({bonded:s,index:t})=>t{t&&o&&c((([,e])=>[t.head.unwrapOr(null),++e]))}),[t,o]),(0,n.useEffect)((()=>{h(!(!o?.length||p&&g))}),[g,p,o]),(0,n.useEffect)((()=>{!m&&g&&d(function(e,s,t){return e.filter((({bonded:e})=>e.gt(s)||e.lt(t))).map((({stashId:e})=>e))}(g,s,e))}),[e,s,g,m]),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"number"}),(0,a.jsx)(l.iA.Column.Balance,{value:s}),(0,a.jsx)(l.iA.Column.Balance,{value:e}),(0,a.jsx)("td",{className:"address",children:t.head.isSome&&(0,a.jsx)(l.ax,{value:t.head.unwrap()})}),(0,a.jsx)("td",{className:"address",children:t.tail.isSome&&(0,a.jsx)(l.ax,{value:t.tail.unwrap()})}),(0,a.jsx)("td",{className:"address",children:o?.map((({stashId:t})=>(0,a.jsx)(Xe,{bagLower:e,bagUpper:s,isLoading:m,list:g,stashId:t},t)))}),(0,a.jsx)("td",{className:"number",children:m?(0,a.jsx)("span",{className:"--tmp",children:"99"}):x.length?(0,S.u)(x.length):null}),(0,a.jsx)("td",{className:"button",children:!m&&(0,a.jsx)(Qe,{bagLower:e,bagUpper:s,stashIds:u})})]})}));var rs=t(65968);const is=n.memo((function({bags:e,className:s="",mapOwn:t}){const{t:o}=C(),r=Je(),i=(0,m.W7)(r.counterForListNodes),c=(0,n.useMemo)((()=>t&&Object.values(t).reduce(((e,s)=>e+s.length),0)),[t]);return(0,a.jsxs)(l.Ty,{className:s,children:[(0,a.jsx)(l.Jy,{label:o("total bags"),children:e?(0,S.u)(e.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(l.Jy,{label:o("total nodes"),children:t?(0,S.u)(i):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(l.Jy,{label:o("my nodes"),children:(0,rs.h)(c)?(0,S.u)(c):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]})]})}));var ls=t(12298);const cs={transform:e=>e.map((({args:[e]})=>e))},us={transform:([[e],s])=>{const t=e.map(((e,t)=>[e,s[t]])).filter((([,e])=>e.isSome)).sort((([e],[s])=>s.cmp(e))).map((([e,s],t)=>({bagLower:v.nw,bagUpper:e,index:t,info:s.unwrap(),key:e.toString()})));return t.map(((e,s)=>s===t.length-1?e:{...e,bagLower:t[s+1].bagUpper}))},withParamsTransform:!0},ds=(0,I.e)("useBagsList",(function(){const e=Je(),[s,t]=(0,n.useState)(),a=(0,ls.k)(e.listBags,[],cs),o=(0,m.W7)(a&&0!==a.length&&e.listBags.multi,[a],us);return(0,n.useEffect)((()=>{o&&t((e=>function(e,s){return e&&s.length===e.length?s.map(((s,t)=>JSON.stringify(s)===JSON.stringify(e[t])?e[t]:s)):s}(e,o)))}),[o]),s})),ms=n.memo((function({className:e,ownStashes:s}){const{t}=C(),o=(0,n.useMemo)((()=>s?s.map((({stashId:e})=>e)):[]),[s]),[r,i]=(0,n.useState)((()=>o.length?0:1)),c=ds(),u=Ye(o),d=(0,n.useRef)([[t("bags")],[t("max"),"number"],[t("min"),"number"],[t("first"),"address"],[t("last"),"address"],[t("stashes"),"address"],[t("nodes"),"number"],[void 0,"mini"]]),m=(0,n.useMemo)((()=>[{isDisabled:!o.length,text:t("My bags"),value:"mine"},{text:t("All bags"),value:"all"}]),[o,t]),h=(0,n.useMemo)((()=>{return c&&u&&(e=u,s=!r,c.map((s=>[s,e[s.key]])).filter((([,e])=>!s||!!e)));var e,s}),[c,r,u]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(is,{bags:c,mapOwn:u}),(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.tX,{onChange:i,options:m,value:r})}),(0,a.jsxs)(l.Pd,{className:"warning centered",withIcon:!1,children:[(0,a.jsx)("p",{children:t("The All bags list is composed of bags that each describe a range of active bonded funds of the nominators. In each bag is a list of nodes that correspond to a nominator and their staked funds.")}),(0,a.jsx)("p",{children:t("Within the context of a single bag, nodes are not sorted by their stake, but instead placed in insertion order. In other words, the most recently inserted node will be the last node in the bag, regardless of stake. Events like staking rewards or slashes do not automatically put you in a different bag. The bags-list pallet comes with an important permissionless extrinsic: rebag. This allows anyone to specify another account that is in the wrong bag, and place it in the correct one.")})]}),(0,a.jsx)(l.iA,{empty:h&&t("No available bags"),emptySpinner:t("Retrieving all available bags, this will take some time"),header:d.current,children:h?.map((([{bagLower:e,bagUpper:s,index:t,info:n,key:o},r])=>(0,a.jsx)(os,{bagLower:e,bagUpper:s,index:t,info:n,nodesOwn:r},o)))})]})}));var hs=t(56360),ps=t(59118);function xs(e,s){return s.sort(((e,s)=>e.era.cmp(s.era))).map((({era:s,validatorId:t})=>e.tx.staking.payoutStakers(t,s)))}function gs(e,s){if(!Array.isArray(s)){const{eras:t,validatorId:a}=s;return 1===t.length?[e.tx.staking.payoutStakers(a,t[0].era)]:xs(e,t.map((e=>({era:e.era,validatorId:a}))))}return 1===s.length?gs(e,s[0]):xs(e,s.reduce(((e,{eras:s,validatorId:t})=>(s.forEach((({era:s})=>{e.push({era:s,validatorId:t})})),e)),[]))}const bs=(0,l.zo)(l.u_)` + .ui--AddressMini.padded.addressStatic { + display: inline-block; + padding-top: 0.5rem; + + .ui--AddressMini-info { + min-width: 10rem; + max-width: 10rem; + } + } +`,fs=n.memo((function({className:e,isAll:s,isDisabled:t,payout:o}){const{t:r}=C(),{api:i}=(0,c.h)(),[u,d]=(0,k.O)(),[m,h]=(0,n.useState)(null),[p,x]=(0,n.useState)(null),g=(0,n.useMemo)((()=>({max:2304/(i.consts.staking.maxNominatorRewardedPerValidator?.toNumber()||64)})),[i]),b=(0,Ue.b)(p,g);(0,n.useEffect)((()=>{o&&x((()=>gs(i,o)))}),[i,o]);const f=!o||Array.isArray(o)&&0===o.length;return(0,a.jsxs)(a.Fragment,{children:[o&&u&&(0,a.jsxs)(bs,{className:e,header:r("Payout all stakers"),onClose:d,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsx)(l.u_.Columns,{hint:r("Any account can request payout for stakers, this is not limited to accounts that will be rewarded."),children:(0,a.jsx)(l.rp,{label:r("request payout from"),onChange:h,type:"account",value:m})}),(0,a.jsx)(l.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:r("All the listed validators and all their nominators will receive their rewards.")}),(0,a.jsx)("p",{children:r("The UI puts a limit of 40 payouts at a time, where each payout is a single validator for a single era.")})]}),children:Array.isArray(o)?(0,a.jsx)(l.qG,{label:r("payout stakers for (multiple)"),value:o.map((({validatorId:e})=>(0,a.jsx)(l.ax,{className:"addressStatic",value:e},e)))}):(0,a.jsx)(l.rp,{defaultValue:o.validatorId,isDisabled:!0,label:r("payout stakers for (single)")})})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:m,extrinsic:b,icon:"credit-card",isDisabled:!b?.length||!m,label:r("Payout"),onStart:d})})]}),(0,a.jsx)(l.zx,{icon:"credit-card",isDisabled:t||f,label:s||Array.isArray(o)?r("Payout all"):r("Payout"),onClick:d})]})})),js=(0,I.e)("useEraBlocks",(function(e,s){const{api:t}=(0,c.h)(),a=(0,m.W7)(t.derive.session.progress),o=(0,m.W7)(t.query.staking.forceEra);return(0,n.useMemo)((()=>e&&s&&o&&a&&a.sessionLength.gt(v.If)?(o.isForceAlways?a.sessionLength:a.eraLength).mul(e.sub(a.activeEra).iadd(s).iadd(v.If)).isub(o.isForceAlways?a.sessionProgress:a.eraProgress):void 0),[s,o,e,a])}));function vs(e){return!Array.isArray(e)}function ys(e){if(!e.length)return"";const s=e.sort(((e,s)=>e.cmp(s))).reduce(((e,s)=>{if(0===e.length)return[s];{const t=e[e.length-1];vs(t)?t.add(v.If).eq(s)?e[e.length-1]=[t,s]:e.push(s):t[1].add(v.If).eq(s)?t[1]=s:e.push(s)}return e}),[]).map((e=>vs(e)?(0,S.u)(e):`${(0,S.u)(e[0])}-${(0,S.u)(e[1])}`));return(0,a.jsx)(a.Fragment,{children:s.map(((e,s)=>(0,a.jsxs)(n.Fragment,{children:[0!==s&&", ",(0,a.jsx)("span",{children:e})]},e)))})}const Cs=n.memo((function({className:e="",historyDepth:s,payout:{available:t,rewards:o,stashId:r}}){const[{eraStr:i,oldestEra:c},u]=(0,n.useState)({eraStr:""}),d=js(s,c);return(0,n.useEffect)((()=>{o&&u({eraStr:ys(o.map((({era:e})=>e))),oldestEra:o[0]?.era})}),[o]),(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)("td",{className:"address",colSpan:2,children:(0,a.jsx)(l.N,{value:r})}),(0,a.jsx)("td",{className:"start",children:(0,a.jsx)("span",{className:"payout-eras",children:i})}),(0,a.jsx)(l.iA.Column.Balance,{value:t}),(0,a.jsx)("td",{className:"number",children:(0,a.jsx)(pe.Z,{className:d?"":"--tmp",value:d||v.uy})}),(0,a.jsx)("td",{className:"button",colSpan:3})]})})),ws=n.memo((function({className:e="",historyDepth:s,isDisabled:t,payout:o}){const{t:r}=C(),{eraStr:i,nominators:c,numNominators:u,oldestEra:d}=(0,n.useMemo)((()=>function(e){const s=ys(e.eras.map((({era:e})=>e))),t=e.eras.reduce(((e,{stashes:s})=>(Object.entries(s).forEach((([s,t])=>{e[s]?e[s]=e[s].add(t):e[s]=t})),e)),{});return{eraStr:s,nominators:t,numNominators:Object.keys(t).length,oldestEra:e.eras[0]?.era}}(o)),[o]),m=js(s,d);return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)("td",{className:"address",colSpan:2,children:(0,a.jsx)(l.N,{value:o.validatorId})}),(0,a.jsx)("td",{className:"start",children:(0,a.jsx)("span",{className:"payout-eras",children:i})}),(0,a.jsx)(l.iA.Column.Balance,{value:o.available}),(0,a.jsx)("td",{className:"number",children:m&&(0,a.jsx)(pe.Z,{value:m})}),(0,a.jsx)("td",{className:"expand",colSpan:2,children:(0,a.jsx)(l.xH,{summary:r("{{count}} own stashes",{replace:{count:u}}),children:Object.entries(c).map((([e,s])=>(0,a.jsx)(l.ax,{balance:s,value:e,withBalance:!0},e)))})}),(0,a.jsx)("td",{className:"button",children:(0,a.jsx)(fs,{isDisabled:t,payout:o})})]})})),Ns=new(j())(864e5);const ks=l.zo.div` + .payout-eras { + padding-left: 0.25rem; + vertical-align: middle; + + span { + white-space: nowrap; + } + } +`,Ss=n.memo((function({className:e="",historyDepth:s,isInElection:t,ownPools:o,ownValidators:r}){const{t:i}=C(),{api:u}=(0,c.h)(),[d]=(0,n.useState)((()=>0!==r.length)),[h,p]=(0,n.useState)((()=>d?0:1)),[x,g]=(0,n.useState)(0),b=(0,m.W7)(u.derive.session.eraLength),f=(0,hs.n)(),y=(0,n.useMemo)((()=>o?.map((({stashId:e})=>e))),[o]),N=(0,n.useMemo)((()=>function(e,s,t,a){if(!s||!t)return[{text:"",value:0}];const n=Ns.div(e),o=s.mul(t),r=[],i=new(j())(2);for(;;){const e=n.mul(i);if(e.gte(o))break;r.push({text:a("{{days}} days",{replace:{days:i.toString()}}),value:e.div(s).toNumber()}),i.imul(v.Jo)}return r.push({text:a("Max, {{eras}} eras",{replace:{eras:t.toNumber()}}),value:t.toNumber()}),r}(f,b,s,i)),[f,b,s,i]),{allRewards:k,isLoadingRewards:S}=(0,ps.Q)(N[x].value,h?void 0:r,y),{stashAvail:I,stashes:A,valAvail:P,validators:E}=(0,n.useMemo)((()=>function(e){if(e){const s=function(e){return Object.entries(e).map((([e,s])=>({available:s.reduce(((e,{validators:s})=>Object.values(s).reduce(((e,{value:s})=>e.iadd(s)),e)),new(j())(0)),rewards:s,stashId:e}))).filter((({available:e})=>!e.isZero())).sort(((e,s)=>s.available.cmp(e.available)))}(e),t=function(e){return Object.entries(e).reduce(((e,[s,t])=>(t.forEach((t=>{Object.entries(t.validators).forEach((([a,{total:n,value:o}])=>{const r=e.find((e=>e.validatorId===a));if(r){const e=r.eras.find((e=>e.era.eq(t.era)));e?e.stashes[s]=o:r.eras.push({era:t.era,stashes:{[s]:o}}),r.available=r.available.add(o),r.total=r.total.add(n)}else e.push({available:o,eras:[{era:t.era,stashes:{[s]:o}}],total:n,validatorId:a})}))})),e)),[]).sort(((e,s)=>s.available.cmp(e.available)))}(e),a=s.length?s.reduce(((e,{available:s})=>e.iadd(s)),new(j())(0)):null,[n,o]=t.length?t.reduce((([e,s],{available:t,total:a})=>[e.iadd(t),s.iadd(a)]),[new(j())(0),new(j())(0)]):[null,null];return{stashAvail:a,stashes:s,valAvail:n,valTotal:o,validators:t}}return{}}(k)),[k]),M=(0,n.useMemo)((()=>[[i(h?"payout/stash":"overall/validator"),"start",2],[i("eras"),"start"],[i(h?"own":"total")],["remaining"],[void 0,void 0,3]]),[h,i]),T=(0,n.useRef)([[i("payout/validator"),"start",2],[i("eras"),"start"],[i("own")],["remaining"],[void 0,void 0,3]]),D=(0,n.useMemo)((()=>[{isDisabled:!d,text:i("Own validators"),value:"val"},{text:i("Own stashes"),value:"all"}]),[d,i]),F=(0,n.useMemo)((()=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{colSpan:3}),(0,a.jsx)(l.iA.Column.Balance,{value:I}),(0,a.jsx)("td",{colSpan:4})]})),[I]),V=(0,n.useMemo)((()=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{colSpan:3}),(0,a.jsx)(l.iA.Column.Balance,{value:P}),(0,a.jsx)("td",{colSpan:4})]})),[P]);return(0,a.jsxs)(ks,{className:e,children:[(0,a.jsxs)(l.zx.Group,{children:[(0,a.jsx)(l.tX,{onChange:p,options:D,value:h}),(0,a.jsx)(l.tX,{onChange:g,options:N,value:x}),(0,a.jsx)(fs,{isAll:!0,isDisabled:t,payout:E})]}),(0,a.jsx)(w,{isInElection:t}),!S&&!A?.length&&(0,a.jsxs)(l.Pd,{className:"warning centered",withIcon:!1,children:[(0,a.jsx)("p",{children:i("Payouts of rewards for a validator can be initiated by any account. This means that as soon as a validator or nominator requests a payout for an era, all the nominators for that validator will be rewarded. Each user does not need to claim individually and the suggestion is that validators should claim rewards for everybody as soon as an era ends.")}),(0,a.jsx)("p",{children:i("If you have not claimed rewards straight after the end of the era, the validator is in the active set and you are seeing no rewards, this would mean that the reward payout transaction was made by another account on your behalf. Always check your favorite explorer to see any historic payouts made to your accounts.")})]}),(0,a.jsx)(l.iA,{empty:!S&&A&&i(h?"No pending payouts for your stashes":"No pending payouts for your validators"),emptySpinner:i("Retrieving info for the selected eras, this will take some time"),footer:F,header:M,isFixed:!0,children:!S&&A?.map((e=>(0,a.jsx)(Cs,{historyDepth:s,payout:e},e.stashId)))}),1===h&&!S&&E&&0!==E.length&&(0,a.jsx)(l.iA,{footer:V,header:T.current,isFixed:!0,children:!S&&E.filter((({available:e})=>!e.isZero())).map((e=>(0,a.jsx)(ws,{historyDepth:s,isDisabled:t,payout:e},e.validatorId)))})]})})),Is=l.zo.div` + &.isLoading { + position: relative; + + canvas, h1 { + opacity: 0.25; + } + + .ui--Spinner { + position: absolute; + top: 34%; + left: 0; + right: 0; + } + } +`,As=n.memo((function({className:e="",colors:s,labels:t,legends:o,title:r,values:i}){const c=(0,n.useMemo)((()=>!t||0===t.length||!i||0===i.length||!i[0]?.length),[t,i]);return(0,a.jsxs)(Is,{className:`${e} staking--Chart ${c?"isLoading":""}`,children:[(0,a.jsx)(l.kL.Line,{colors:s,labels:t,legends:o,title:r,values:i}),c&&(0,a.jsx)(l.$j,{})]})})),Ps=[void 0,"#acacac"],Es=n.memo((function({labels:e,validatorId:s}){const{t}=C(),{api:o}=(0,c.h)(),r=(0,n.useMemo)((()=>[s,!1]),[s]),i=(0,m.W7)(o.derive.staking.stakerPoints,r),[l,u]=(0,n.useState)([]);(0,n.useEffect)((()=>u([])),[s]),(0,n.useEffect)((()=>i&&u(function(e,s){const t=new Array(e.length),a=new Array(e.length),[n,o]=s.reduce((([e,s],{points:t})=>(t.gtn(0)&&(e+=t.toNumber(),s++),[e,s])),[0,0]);return s.forEach((({era:s,points:r})=>{const i=o>0?Math.ceil(100*n/o)/100:0,l=e.indexOf(s.toHuman());-1!==l&&(t[l]=i,a[l]=r.toNumber())})),[a,t]}(e,i))),[e,i]);const d=(0,n.useRef)([t("points"),t("average")]);return(0,a.jsx)(As,{colors:Ps,labels:e,legends:d.current,title:t("era points"),values:l})})),Ms=new(j())(1e4),Ts=[void 0,"#acacac"],Ds=n.memo((function({labels:e,validatorId:s}){const{t}=C(),{api:o}=(0,c.h)(),r=(0,n.useMemo)((()=>[s,!1]),[s]),i=(0,m.W7)(o.derive.staking.stakerPrefs,r),[l,u]=(0,n.useState)([]);(0,n.useEffect)((()=>u([])),[s]),(0,n.useEffect)((()=>i&&u(function(e,s){const t=new Array(e.length),a=new Array(e.length),[n,o]=s.reduce((([e,s],{validatorPrefs:t})=>{const a=t.commission.unwrap().mul(Ms).div(v.ed).toNumber()/100;return 0!==a&&(e+=a,s++),[e,s]}),[0,0]);return s.forEach((({era:s,validatorPrefs:r})=>{const i=r.commission.unwrap().mul(Ms).div(v.ed).toNumber()/100,l=o>0?Math.ceil(100*n/o)/100:0,c=e.indexOf(s.toHuman());-1!==c&&(t[c]=l,a[c]=i)})),[a,t]}(e,i))),[e,i]);const d=(0,n.useRef)([t("commission"),t("average")]);return(0,a.jsx)(As,{colors:Ts,labels:e,legends:d.current,title:t("commission"),values:l})}));var Fs=t(6485);function Vs(e=v.nw,s){return((0,Fs.H)(e)?e:(0,g.m)(e.toBn)?e.toBn():v.nw).mul(v.D_).div(s).toNumber()/1e3}const _s=["#8c2200","#008c22","#acacac"],qs=n.memo((function({labels:e,validatorId:s}){const{t}=C(),{api:o}=(0,c.h)(),r=(0,n.useMemo)((()=>[s,!1]),[s]),i=(0,m.W7)(o.derive.staking.ownSlashes,r),l=(0,m.W7)(o.derive.staking.erasRewards),u=(0,m.W7)(o.derive.staking.stakerPoints,r),[d,h]=(0,n.useState)([]),{currency:p,divisor:x}=(0,n.useMemo)((()=>({currency:M.a.getDefaults().unit,divisor:new(j())("1".padEnd(M.a.getDefaults().decimals+1,"0"))})),[]);(0,n.useEffect)((()=>h([])),[s]),(0,n.useEffect)((()=>l&&i&&u&&h(function(e,s,t,a,n){const o=new Array(e.length),r=new Array(e.length),i=new Array(e.length),[l,c]=s.reduce((([e,s],{era:t,eraReward:o})=>{const r=a.find((e=>e.era.eq(t))),i=r?.eraPoints.gtn(0)?Vs(r.points.mul(o).div(r.eraPoints),n):0;return i>0&&(e+=i,s++),[e,s]}),[0,0]);return s.forEach((({era:s,eraReward:u})=>{const d=a.find((e=>e.era.eq(s))),m=t.find((e=>e.era.eq(s))),h=d?.eraPoints.gtn(0)?Vs(d.points.mul(u).div(d.eraPoints),n):0,p=m?Vs(m.total,n):0,x=c>0?Math.ceil(100*l/c)/100:0,g=e.indexOf(s.toHuman());-1!==g&&(r[g]=h,i[g]=x,o[g]=p)})),[o,r,i]}(e,l,i,u,x))),[e,x,l,i,u]);const g=(0,n.useMemo)((()=>[t("{{currency}} slashed",{replace:{currency:p}}),t("{{currency}} rewards",{replace:{currency:p}}),t("{{currency}} average",{replace:{currency:p}})]),[p,t]);return(0,a.jsx)(As,{colors:_s,labels:e,legends:g,title:t("rewards & slashes"),values:d})})),Os=[void 0,"#8c2200","#acacac"],Rs=n.memo((function({labels:e,validatorId:s}){const{t}=C(),{api:o}=(0,c.h)(),r=(0,n.useMemo)((()=>[s,!1]),[s]),i=(0,m.W7)(o.derive.staking.ownExposures,r),[l,u]=(0,n.useState)([]),{currency:d,divisor:h}=(0,n.useMemo)((()=>({currency:M.a.getDefaults().unit,divisor:new(j())("1".padEnd(M.a.getDefaults().decimals+1,"0"))})),[]);(0,n.useEffect)((()=>u([])),[s]),(0,n.useEffect)((()=>i&&u(function(e,s,t){const a=new Array(e.length),n=new Array(e.length),o=new Array(e.length),[r,i]=s.reduce((([e,s],{clipped:a})=>{const n=Vs(a.total?.unwrap(),t);return n>0&&(e+=n,s++),[e,s]}),[0,0]);return s.forEach((({clipped:s,era:l,exposure:c})=>{const u=Vs(s.total?.unwrap(),t),d=Vs(c.total?.unwrap(),t),m=i>0?Math.ceil(100*r/i)/100:0,h=e.indexOf(l.toHuman());-1!==h&&(o[h]=m,a[h]=u,n[h]=d)})),[a,n,o]}(e,i,h))),[e,h,i]);const p=(0,n.useMemo)((()=>[t("{{currency}} clipped",{replace:{currency:d}}),t("{{currency}} total",{replace:{currency:d}}),t("{{currency}} average",{replace:{currency:d}})]),[d,t]);return(0,a.jsx)(As,{colors:Os,labels:e,legends:p,title:t("elected stake"),values:l})})),zs=(0,l.zo)(l.P0)` + .staking--Chart { + background: var(--bg-table); + border: 1px solid var(--border-table); + border-radius: 0.25rem; + padding: 1rem 1.5rem; + } +`,Hs=n.memo((function({className:e="",labels:s,validatorId:t}){return(0,a.jsxs)(zs,{className:e,children:[(0,a.jsxs)(l.P0.Column,{children:[(0,a.jsx)(Es,{labels:s,validatorId:t}),(0,a.jsx)(qs,{labels:s,validatorId:t})]}),(0,a.jsxs)(l.P0.Column,{children:[(0,a.jsx)(Rs,{labels:s,validatorId:t}),(0,a.jsx)(Ds,{labels:s,validatorId:t})]})]})})),$s=n.memo((function({className:e}){const{t:s}=C(),{api:t}=(0,c.h)(),{value:r}=(0,o.UO)(),[i,u]=(0,n.useState)(r||null),d=(0,m.W7)(t.derive.staking.erasHistoric),h=(0,n.useMemo)((()=>d?.map((e=>e.toHuman()))),[d]),p=(0,n.useCallback)((()=>function(e){e&&(window.location.hash=`/staking/query/${e}`)}(i)),[i]);return h?(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(l.bm,{className:"staking--queryInput",defaultValue:r,label:s("validator to query"),onChange:u,onEnter:p,children:(0,a.jsx)(l.zx,{icon:"play",isDisabled:!i,onClick:p})}),r&&(0,a.jsx)(Hs,{labels:h,validatorId:r})]}):(0,a.jsx)(l.$j,{})}));var Ls=t(30943),Bs=t(70563),Zs=t(81190);const Ws=n.memo((function({index:e,isSelected:s,onSelect:t,slash:{era:o,isMine:r,slash:{others:i,own:u,payout:d,reporters:m,validator:h},total:p,totalOther:x}}){const{t:g}=C(),{api:f}=(0,c.h)(),j=(0,n.useCallback)((()=>t&&t(e)),[e,t]),v=(0,n.useCallback)((()=>i.map((([e,s],t)=>(0,a.jsx)(l.ax,{balance:s,value:e,withBalance:!0},t)))),[i]);return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"badge",children:r&&(0,a.jsx)(l.Ct,{color:"red",icon:"skull-crossbones"})}),(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(l.N,{value:h})}),(0,a.jsx)("td",{className:"expand all",children:!!i.length&&(0,a.jsx)(l.n0,{renderChildren:v,summary:g("Nominators ({{count}})",{replace:{count:(0,S.u)(i.length)}})})}),(0,a.jsx)("td",{className:"address",children:m.map(((e,s)=>(0,a.jsx)(l.ax,{value:e},s)))}),(0,a.jsx)("td",{className:"number together",children:(0,a.jsx)(b.Z,{value:u})}),(0,a.jsx)("td",{className:"number together",children:(0,a.jsx)(b.Z,{value:x})}),(0,a.jsx)("td",{className:"number together",children:(0,a.jsx)(b.Z,{value:p})}),(0,a.jsx)("td",{className:"number together",children:(0,a.jsx)(b.Z,{value:d})}),!f.query.staking.earliestUnappliedSlash&&!!f.consts.staking.slashDeferDuration&&(0,a.jsx)("td",{className:"number together",children:(0,S.u)(o)}),(0,a.jsx)("td",{children:(0,a.jsx)(l.XZ,{isDisabled:!t,onChange:j,value:s})})]})})),Us=n.memo((function({slash:{era:e,nominators:s,reporters:t,total:o,validators:r}}){const{t:i}=C(),{api:u}=(0,c.h)(),d=(0,m.W7)(u.derive.session?.progress),[h,p]=(0,n.useMemo)((()=>d?[d.activeEra.sub(e).isub(v.If).imul(d.eraLength).iadd(d.eraProgress),u.consts.staking.slashDeferDuration.mul(d.eraLength)]:[new(j())(0),new(j())(0)]),[u,e,d]);return(0,a.jsxs)(l.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(l.Jy,{label:i("validators"),children:(0,S.u)(r.length)}),(0,a.jsx)(l.Jy,{label:i("nominators"),children:(0,S.u)(s.length)}),(0,a.jsx)(l.Jy,{label:i("reporters"),children:(0,S.u)(t.length)})]}),h.gtn(0)&&(0,a.jsx)(l.Jy,{label:i("defer"),progress:{total:p,value:h,withTime:!0}}),(0,a.jsx)(l.Jy,{label:i("total"),children:(0,a.jsx)(b.Z,{value:o})})]})})),Js=n.memo((function({buttons:e,councilId:s,councilThreshold:t,slash:o}){const{t:r}=C(),{api:i}=(0,c.h)(),u=(0,Zs.m)("council"),[{selected:d,txAll:m,txSome:h},p]=(0,n.useState)((()=>{const e=i.tx.staking.cancelDeferredSlash(o.era,o.slashes.map(((e,s)=>s)));return{selected:[],txAll:u?{length:e.encodedLength,proposal:e}:null,txSome:null}})),x=(0,n.useRef)([[r("era {{era}}/unapplied",{replace:{era:i.query.staking.earliestUnappliedSlash||!i.consts.staking.slashDeferDuration?o.era.toString():o.era.sub(i.consts.staking.slashDeferDuration).sub(v.If).toString()}}),"start",3],[r("reporters"),"address"],[r("own")],[r("other")],[r("total")],[r("payout")],!i.query.staking.earliestUnappliedSlash&&!!i.consts.staking.slashDeferDuration&&[r("apply")],[]]),b=(0,n.useCallback)((e=>p((s=>{const t=s.selected.includes(e)?s.selected.filter((s=>s!==e)):s.selected.concat(e).sort(((e,s)=>e-s)),a=t.length?i.tx.staking.cancelDeferredSlash(o.era,t):null;return{selected:t,txAll:s.txAll,txSome:a&&u&&(0,g.m)(i.tx[u].propose)?{length:a.encodedLength,proposal:a}:null}}))),[i,u,o]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Us,{slash:o}),(0,a.jsxs)(l.zx.Group,{children:[e,u&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.cA,{accountId:s,isDisabled:!h,isToplevel:!0,label:r("Cancel selected"),params:h&&(3===i.tx[u].propose.meta.args.length?[t,h.proposal,h.length]:[t,h.proposal]),tx:i.tx[u].propose}),(0,a.jsx)(l.cA,{accountId:s,isDisabled:!m,isToplevel:!0,label:r("Cancel all"),params:m&&(3===i.tx[u].propose.meta.args.length?[t,m.proposal,m.length]:[t,m.proposal]),tx:i.tx[u].propose})]})]}),(0,a.jsx)(l.iA,{header:x.current,children:o.slashes.map(((e,t)=>(0,a.jsx)(Ws,{index:t,isSelected:d.includes(t),onSelect:s?b:void 0,slash:e},t)))})]})})),Gs=n.memo((function({ownStashes:e=[],slashes:s}){const{t}=C(),{api:o}=(0,c.h)(),{allAccounts:r}=(0,u.x)(),{members:i}=(0,Bs.V)("council"),[d,m]=(0,n.useState)(0),h=(0,n.useMemo)((()=>function(e,s){const t=[];return e.reduce(((e,[t,a])=>a.reduce(((e,a)=>{const n=a.others.reduce(((e,[,s])=>e.add(s)),new(j())(0)),o=s.some((({stashId:e})=>a.validator.eq(e)||a.others.some((([s])=>s.eq(e)))));return e.push({era:t,isMine:o,slash:a,total:a.own.add(n),totalOther:n}),e}),e)),[]).forEach((e=>{let s=t.find((({era:s})=>s.eq(e.era)));s||(s={era:e.era,nominators:[],payout:new(j())(0),reporters:[],slashes:[],total:new(j())(0),validators:[]},t.push(s)),s.payout.iadd(e.slash.payout),s.total.iadd(e.total),s.slashes.push(e);const a=e.slash.validator.toString();s.validators.includes(a)||s.validators.push(a),e.slash.others.forEach((([e])=>{const t=e.toString();s&&!s.nominators.includes(t)&&s.nominators.push(t)})),e.slash.reporters.forEach((e=>{const t=e.toString();s&&!s.reporters.includes(t)&&s.reporters.push(t)}))})),t.sort(((e,s)=>s.era.cmp(e.era)))}(s,e)),[e,s]),p=(0,n.useMemo)((()=>h.map((({era:e})=>o.query.staking.earliestUnappliedSlash||!o.consts.staking.slashDeferDuration?e:e.sub(o.consts.staking.slashDeferDuration).sub(v.If))).map((e=>({text:t("era {{era}}",{replace:{era:(0,S.u)(e)}}),value:e.toString()})))),[o,h,t]),x=(0,n.useMemo)((()=>r.find((e=>i.includes(e)))||null),[r,i]),g=(0,n.useRef)([[t("unapplied"),"start"]]);if(!h.length)return(0,a.jsx)(l.iA,{empty:t("There are no unapplied/pending slashes"),header:g.current});const b=Math.ceil((i.length||0)*(0,Ls.FK)(o));return(0,a.jsx)(Js,{buttons:(0,a.jsx)(l.tX,{onChange:m,options:p,value:d}),councilId:x,councilThreshold:b,slash:h[d]},h[d].era.toString())}));var Ys=t(87292),Qs=t(49255),Ks=t(69250),Xs=t(85168),et=t(54371);const st=n.memo((function({children:e,className:s,nameFilter:t,setNameFilter:o,setWithIdentity:r,withIdentity:i}){const{t:u}=C(),{api:d}=(0,c.h)();(0,n.useEffect)((()=>{const e=Xs.Z.parse(location.href.split("?")[1]).filter;(0,et.H)(e)&&o(e,!0)}),[]);const m=(0,n.useCallback)((e=>o(e,!1)),[o]);return(0,a.jsxs)("div",{className:s,children:[(0,a.jsx)(l.II,{autoFocus:!0,isFull:!0,label:u("filter by name, address or index"),onChange:m,value:t}),(e||r)&&(0,a.jsxs)("div",{className:"staking--optionsBar",children:[e,r&&d.query.identity&&(0,a.jsx)(l.ZD,{className:"staking--buttonToggle",label:u("with an identity"),onChange:r,value:i})]})]})})),tt={transform:([[e],s])=>{const t={};for(let a=0;a(t||[]).map((({stashId:e})=>e))),[t]),x=(0,n.useCallback)((e=>{const s=t?.find((({stashId:s})=>s===e));d(s?{controllerId:s.controllerId,stashId:s.stashId}:null)}),[t]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.zx,{icon:"hand-paper",isDisabled:s||!p.length||!o.length,label:r("Nominate selected"),onClick:h}),m&&(0,a.jsxs)(nt,{className:e,header:r("Nominate validators"),onClose:h,size:"large",children:[(0,a.jsxs)(l.u_.Content,{children:[(0,a.jsxs)(l.u_.Columns,{hint:r("One of your available nomination accounts, keyed by the stash. The transaction will be sent from the controller."),children:[(0,a.jsx)(l.rp,{filter:p,label:r("the stash account to nominate with"),onChange:x,value:u?.stashId}),(0,a.jsx)(l.rp,{isDisabled:!0,label:r("the associated controller"),value:u?.controllerId})]}),(0,a.jsx)(l.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:r('The selected validators to nominate, either via the "currently best algorithm" or via a manual selection.')}),(0,a.jsx)("p",{children:r("Once transmitted the new selection will only take effect in 2 eras since the selection criteria for the next era was done at the end of the previous era. Until then, the nominations will show as inactive.")})]}),children:(0,a.jsx)(l.qG,{label:r("selected validators"),value:o.map((e=>(0,a.jsx)(l.ax,{className:"addressStatic",value:e},e)))})})]}),(0,a.jsx)(l.u_.Actions,{children:(0,a.jsx)(l.cA,{accountId:u?.controllerId,label:r("Nominate"),onStart:h,params:[o],tx:i.tx.staking.nominate})})]})]})})),rt={transform:e=>e.unwrapOrDefault()};function it(e,s){return{hideValue:!0,isBlurred:!(e&&s),total:e&&s?s:v.Jo,value:e&&s?e:v.um}}const lt=(0,l.zo)(l.Ty)` + .percent { + font-size: var(--font-percent-tiny); + } +`,ct=n.memo((function({avgStaked:e,className:s,lastEra:t,lowStaked:o,minNominated:r,minNominatorBond:i,stakedReturn:u,totalIssuance:d,totalStaked:h}){const{t:p}=C(),{api:x}=(0,c.h)(),g=(0,m.W7)(t&&x.query.staking.erasValidatorReward,[t],rt),f=(0,n.useMemo)((()=>it(h,d)),[d,h]),j=(0,n.useMemo)((()=>it(o,e)),[e,o]),y=(0,a.jsx)("span",{className:"percent",children:"%"});return(0,a.jsxs)(lt,{className:s,children:[(0,a.jsx)("section",{className:"media--800",children:(0,a.jsx)(l.Jy,{label:p("total staked"),progress:f,children:(0,a.jsx)(b.Z,{className:f.isBlurred?"--tmp":"",value:f.value,withSi:!0})})}),(0,a.jsx)("section",{className:"media--800",children:(0,a.jsx)(l.Jy,{label:p("returns"),children:d&&u>0?Number.isFinite(u)?(0,a.jsxs)(a.Fragment,{children:[u.toFixed(1),y]}):"-.-%":(0,a.jsxs)("span",{className:"--tmp",children:["0.0",y]})})}),(0,a.jsx)("section",{className:"media--1000",children:(0,a.jsx)(l.Jy,{label:`${p("lowest / avg staked")}`,progress:j,children:(0,a.jsxs)("span",{className:j.isBlurred?"--tmp":"",children:[(0,a.jsx)(b.Z,{value:j.value,withCurrency:!1,withSi:!0})," / ",(0,a.jsx)(b.Z,{className:j.isBlurred?"--tmp":"",value:j.total,withSi:!0})]})})}),(0,a.jsx)("section",{className:"media--1600",children:r?.gt(v.nw)&&(0,a.jsxs)(l.Jy,{className:"media--1600",label:p(i?"min nominated / threshold":"min nominated"),children:[(0,a.jsx)(b.Z,{value:r,withCurrency:!i,withSi:!0}),i&&(0,a.jsxs)(a.Fragment,{children:[" / ",(0,a.jsx)(b.Z,{value:i,withSi:!0})]})]})}),(0,a.jsx)("section",{children:(0,a.jsx)(l.Jy,{label:p("last reward"),children:(0,a.jsx)(b.Z,{className:g?"":"--tmp",value:g||1,withSi:!0})})})]})})),ut=(0,I.e)("useOwnNominators",(function(e){return(0,n.useMemo)((()=>e?.filter((({isOwnController:e,isStashValidating:s})=>e&&!s))),[e])}));var dt=t(11798),mt=t(60773),ht=t(97794);const pt=n.memo((function({numNominators:e}){const{api:s}=(0,c.h)(),t=s.consts.staking?.maxNominatorRewardedPerValidator;return e&&t&&!t.gten(e)?(0,a.jsx)(l.Ct,{className:"media--1200",color:"red",icon:"balance-scale-right"}):null})),xt=n.memo((function({allSlashes:e,canSelect:s,filterName:t,info:{accountId:o,bondOther:r,bondOwn:i,bondTotal:u,commissionPer:d,isBlocking:m,isElected:h,isFavorite:p,key:x,lastPayout:g,numNominators:f,rankOverall:j,stakedReturnCmp:v},isNominated:y,isSelected:w,nominatedBy:N=[],toggleFavorite:k,toggleSelected:I}){const{t:A}=C(),{api:P}=(0,c.h)(),E=(0,mt.Y)(o),[,,M]=(0,ht.h)(g),T=(0,n.useMemo)((()=>!E||(0,dt.r7)(P,x,E,t)),[E,P,t,x]),D=(0,n.useMemo)((()=>(e||[]).map((([e,s])=>({era:e,slashes:s.filter((({validator:e})=>e.eq(o)))}))).filter((({slashes:e})=>e.length))),[e,o]),F=(0,n.useCallback)((()=>{return e=x,void(window.location.hash=`/staking/query/${e}`);var e}),[x]),V=(0,n.useCallback)((()=>I(x)),[x,I]);return T?(0,a.jsxs)("tr",{children:[(0,a.jsx)(l.iA.Column.Favorite,{address:x,isFavorite:p,toggle:k}),(0,a.jsxs)("td",{className:"badge together",children:[y?(0,a.jsx)(l.Ct,{color:"green",icon:"hand-paper"}):(0,a.jsx)(l.Ct,{color:"transparent"}),h?(0,a.jsx)(l.Ct,{color:"blue",icon:"chevron-right"}):(0,a.jsx)(l.Ct,{color:"transparent"}),(0,a.jsx)(pt,{numNominators:f||N.length}),m&&(0,a.jsx)(l.Ct,{color:"red",icon:"user-slash"}),0!==D.length&&(0,a.jsx)(l.Ct,{color:"red",hover:A("Slashed in era {{eras}}",{replace:{eras:D.map((({era:e})=>(0,S.u)(e))).join(", ")}}),icon:"skull-crossbones"})]}),(0,a.jsx)("td",{className:"number",children:0!==j&&(0,S.u)(j)}),(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(l.N,{value:o})}),(0,a.jsx)("td",{className:"number media--1400",children:g&&(P.consts.babe?M.days?1===M.days?A("yesterday"):A("{{days}} days",{replace:{days:M.days}}):A("recently"):(0,S.u)(g))}),(0,a.jsx)("td",{className:"number media--1200 no-pad-right",children:f||""}),(0,a.jsx)("td",{className:"number media--1200 no-pad-left",children:N.length||""}),(0,a.jsxs)("td",{className:"number media--1100",children:[d.toFixed(2),"%"]}),(0,a.jsx)("td",{className:"number together",children:!u.isZero()&&(0,a.jsx)(b.Z,{value:u})}),(0,a.jsx)("td",{className:"number together media--900",children:!i.isZero()&&(0,a.jsx)(b.Z,{value:i})}),(0,a.jsx)("td",{className:"number together media--1600",children:!r.isZero()&&(0,a.jsx)(b.Z,{value:r})}),(0,a.jsx)("td",{className:"number together",children:v>0&&(0,a.jsxs)(a.Fragment,{children:[v.toFixed(2),"%"]})}),(0,a.jsx)("td",{children:!m&&(s||w)&&(0,a.jsx)(l.XZ,{onChange:V,value:w})}),(0,a.jsx)("td",{children:(0,a.jsx)(l.JO,{className:"staking--stats highlight--color",icon:"chart-line",onClick:F})})]}):null})),gt={rankBondOther:"media--1600",rankBondOwn:"media--900"},bt=["rankBondTotal","rankBondOwn","rankBondOther","rankOverall"],ft={withElected:!1,withGroup:!0,withIdentity:!1,withPayout:!1,withoutComm:!0,withoutOver:!0},jt={isQueryFiltered:!1,nameFilter:""},vt={sortBy:"rankOverall",sortFromMax:!0},yt=l.zo.div` + text-align: center; + + th.isClickable { + .ui--Icon { + margin-left: 0.5rem; + } + } + + .ui--Table { + overflow-x: auto; + } +`,Ct=n.memo((function({className:e="",isInElection:s,nominatedBy:t,ownStashes:o,targets:{avgStaked:r,inflation:{stakedReturn:i},lastEra:u,lowStaked:d,medianComm:m,minNominated:h,minNominatorBond:p,nominators:g,totalIssuance:b,totalStaked:f,validatorIds:j,validators:y},toggleFavorite:N,toggleLedger:k,toggleNominatedBy:S}){const{t:I}=C(),{api:A}=(0,c.h)(),P=(0,x.g)(),E=(0,Qs.u)(7),M=ut(o),T=at(j),[D,F]=(0,n.useState)([]),[{isQueryFiltered:V,nameFilter:_},q]=(0,n.useState)(jt),[O,R]=(0,Ks.o)("staking:targets",ft),[{sortBy:z,sortFromMax:H},$]=(0,n.useState)(vt),[L,B]=(0,n.useState)(),Z=(0,n.useRef)({rankBondOther:I("other stake"),rankBondOwn:I("own stake"),rankBondTotal:I("total stake"),rankOverall:I("return")}),W=(0,n.useMemo)((()=>({...O,daysPayout:E,isBabe:!!A.consts.babe,isQueryFiltered:V,maxPaid:A.consts.staking?.maxNominatorRewardedPerValidator})),[A,E,V,O]),U=(0,n.useMemo)((()=>T&&y&&t&&function(e,s,t,{daysPayout:a,isBabe:n,maxPaid:o,withElected:r,withGroup:i,withIdentity:l,withPayout:c,withoutComm:u,withoutOver:d},m){const h=[],p=[];return e.filter((({accountId:e,commissionPer:s,isElected:x,isFavorite:g,lastPayout:b,numNominators:f})=>{if(g)return!0;const j=e.toString(),y=t[j],C=f||m?.[j]?.length||0;if((!r||x)&&(!l||y?.hasIdentity)&&(!c||!n||b&&a.gte(b))&&(!u||s<=10)&&(!d||!o||o.muln(100).div(v.S8).gten(C))){if(!i)return!0;if(!y||!y.hasIdentity)return p.push(j),!0;if(y.parentId){if(!p.includes(y.parentId))return p.push(y.parentId),!0}else if(!p.includes(j)){if(y.display){const e=y.display.replace(/[^\x20-\x7E]/g,"").replace(/-/g," ").replace(/_/g," ").split(" ").map((e=>e.trim())).filter((e=>!!e));if(function(e,s){return e.some((e=>e.length===s.length&&(1===e.length?e[0]===s[0]:e.reduce(((e,t,a)=>e+(t===s[a]?1:0)),0)>=s.length-1)))}(h,e))return!1;h.push(e)}return p.push(j),!0}}return!1}))}(y,0,T,W,t)),[T,W,m,t,y]);(0,n.useEffect)((()=>{U&&B(function(e,s,t){return t.slice(0).sort(((t,a)=>s?t[e]-a[e]:a[e]-t[e])).sort(((e,s)=>e.isFavorite===s.isFavorite?0:e.isFavorite?-1:1))}(z,H,U))}),[U,z,H]),(0,n.useEffect)((()=>{k(),S()}),[k,S]);const J=(0,n.useMemo)((()=>A.consts.staking.maxNominations?A.consts.staking.maxNominations.toNumber():16),[A]),G=(0,n.useMemo)((()=>function(e=[]){const s=[];return e.forEach((({nominating:e=[]})=>{e.forEach((e=>{!s.includes(e)&&s.push(e)}))})),s}(M)),[M]),Y=(0,n.useCallback)((e=>$((s=>({sortBy:e,sortFromMax:e!==s.sortBy||!s.sortFromMax})))),[]),Q=(0,n.useCallback)((e=>F(D.includes(e)?D.filter((s=>e!==s)):[...D,e])),[D]),K=(0,n.useCallback)((()=>U&&F(function(e,s){const t=[];for(let a=0;a0)&&t.push(o)}return t}(U,J))),[U,J]),X=(0,n.useCallback)(((e,s)=>q({isQueryFiltered:s,nameFilter:e})),[]),ee=(0,n.useMemo)((()=>[[I("validators"),"start",4],[I("payout"),"media--1400"],[I("nominators"),"media--1200",2],[I("comm."),"media--1100"],...bt.map((e=>[(0,a.jsxs)(a.Fragment,{children:[Z.current[e],(0,a.jsx)(l.JO,{icon:z===e?H?"chevron-down":"chevron-up":"minus"})]}),`${L?`isClickable ${z===e?"highlight--border":""} number`:"number"} ${gt[e]||""}`,1,()=>Y(e)])),[],[]]),[Y,Z,z,L,H,I]),se=(0,n.useMemo)((()=>(0,a.jsx)("div",{children:(0,a.jsxs)(st,{nameFilter:_,setNameFilter:X,setWithIdentity:R.withIdentity,withIdentity:O.withIdentity,children:[(0,a.jsx)(l.ZD,{className:"staking--buttonToggle",label:I("one validator per operator"),onChange:R.withGroup,value:O.withGroup}),(0,a.jsx)(l.ZD,{className:"staking--buttonToggle",label:I("comm. <= {{maxComm}}%",{replace:{maxComm:10}}),onChange:R.withoutComm,value:O.withoutComm}),(0,a.jsx)(l.ZD,{className:"staking--buttonToggle",label:I("with capacity"),onChange:R.withoutOver,value:O.withoutOver}),A.consts.babe&&(0,a.jsx)(l.ZD,{className:"staking--buttonToggle",label:I("recent payouts"),onChange:R.withPayout,value:O.withPayout}),(0,a.jsx)(l.ZD,{className:"staking--buttonToggle",label:I("currently elected"),onChange:R.withElected,value:O.withElected})]})})),[A,_,X,R,I,O]),te=V?y:L,ae=D.length(0,a.jsx)(xt,{allSlashes:P,canSelect:ae,filterName:_,info:e,isNominated:G.includes(e.key),isSelected:D.includes(e.key),nominatedBy:t?.[e.key],toggleFavorite:N,toggleSelected:Q},e.key)))})]})}));var wt=t(75387);const Nt=n.memo((function(){const{t:e}=C();return(0,a.jsx)(l.Pd,{className:"warning centered",content:e("Use the account actions to create a new validator/nominator stash and bond it to participate in staking. Do not send funds directly via a transfer to a validator.")})}));var kt=t(47623);function St(e){return e.length?[e.length,()=>e.map((e=>(0,a.jsx)(l.ax,{value:e},e)))]:null}const It=n.memo((function({nominators:e,slashingSpans:s}){const{t}=C(),{api:o}=(0,c.h)(),{active:r,chilled:i}=(0,n.useMemo)((()=>function(e,s=[],t){const a=t&&!e.events.staking.SlashReported?s.filter((({submittedIn:e})=>t.lastNonzeroSlash.gt(e))).map((({nominatorId:e})=>e)):[];return{active:St(s.filter((({nominatorId:e})=>!a.includes(e))).map((({nominatorId:e})=>e))),chilled:St(a)}}(o,e,s)),[o,e,s]);return(0,a.jsxs)("td",{className:"expand all",children:[r&&(0,a.jsx)(l.n0,{renderChildren:r[1],summary:t("Nominations ({{count}})",{replace:{count:(0,S.u)(r[0])}})}),i&&(0,a.jsx)(l.n0,{renderChildren:i[1],summary:t("Renomination required ({{count}})",{replace:{count:(0,S.u)(i[0])}})})]})}));function At(e){return[e.length,()=>e.map((({nominatorId:e,value:s})=>(0,a.jsx)(l.ax,{bonded:s,value:e,withBonded:!0},e)))]}function Pt(e){const s=new(j())(0);for(let t=0,a=e.length;tfunction(e,s,t){if(!s)return[null,v.nw,null,v.nw];const a=s.sort(((e,s)=>s.value.cmp(e.value)));if(!e||e.gtn(a.length))return[At(a),t||v.nw,null,v.nw];const n=e.toNumber(),o=a.slice(0,n),r=Pt(o),i=a.slice(n),l=Pt(i);return[At(o),r,At(i),l]}(t.consts.staking?.maxNominatorRewardedPerValidator,e,s)),[t,e,s]);return(0,a.jsxs)("td",{className:"expand all",children:[(!o||0!==o[0])&&(0,a.jsx)(l.n0,{className:o?"":"--tmp",renderChildren:o?.[1],summary:(0,a.jsx)(b.Z,{labelPost:` (${o?o[0]:"0"})`,value:r})}),i&&(0,a.jsx)(l.n0,{className:"stakeOver",renderChildren:i[1],summary:(0,a.jsx)(b.Z,{labelPost:` (${i[0]})`,value:u})})]})})),Mt=[],Tt=n.memo((function({isChilled:e,isElected:s,isMain:t,isPara:o,isRelay:r,nominators:i=Mt,onlineCount:c,onlineMessage:d}){const{allAccounts:m}=(0,u.x)(),h=c&&c.toNumber(),p=(0,n.useMemo)((()=>i.some((({nominatorId:e})=>m.includes(e)))),[m,i]);return(0,a.jsxs)(a.Fragment,{children:[p?(0,a.jsx)(l.Ct,{className:"media--1100",color:"green",icon:"hand-paper"}):(0,a.jsx)(l.Ct,{className:"media--1100",color:"transparent"}),r&&(o?(0,a.jsx)(l.Ct,{className:"media--1100",color:"purple",icon:"vector-square"}):(0,a.jsx)(l.Ct,{className:"media--1100",color:"transparent"})),e?(0,a.jsx)(l.Ct,{className:"media--1000",color:"red",icon:"cancel"}):s?(0,a.jsx)(l.Ct,{className:"media--1000",color:"blue",icon:"chevron-right"}):(0,a.jsx)(l.Ct,{className:"media--1000",color:"transparent"}),t&&(h?(0,a.jsx)(l.Ct,{className:"media--900",color:"green",info:h}):d?(0,a.jsx)(l.Ct,{className:"media--900",color:"green",icon:"envelope"}):(0,a.jsx)(l.Ct,{className:"media--900",color:"transparent"})),(0,a.jsx)(pt,{numNominators:i.length})]})})),Dt={transform:e=>e.unwrapOr(null)},Ft=n.memo((function({address:e,className:s="",filterName:t,hasQueries:o,isElected:r,isFavorite:i,isMain:u,isPara:d,lastBlock:h,minCommission:p,nominatedBy:x,points:g,recentlyOnline:f,toggleFavorite:j,validatorInfo:y,withIdentity:w}){const{t:N}=C(),{api:S}=(0,c.h)(),[I,A]=(0,k.O)(!1),{accountInfo:P,slashingSpans:E}=function(e,s,t){const a=(0,n.useMemo)((()=>[s]),[s]);return{accountInfo:(0,mt.Y)(s),slashingSpans:(0,m.W7)(!t&&e.query.staking.slashingSpans,a,Dt)}}(S,e,u),{commission:M,isChilled:T,nominators:D,stakeOther:F,stakeOwn:V}=(0,n.useMemo)((()=>y?function({exposure:e,validatorPrefs:s},t){let a,n,o,r;e?.total&&(a=e.others.map((({value:e,who:s})=>({nominatorId:s.toString(),value:e.unwrap()}))),n=e.total?.unwrap()||v.nw,r=e.own.unwrap(),o=n.sub(r));const i=s?.commission?.unwrap();return{commission:i?.toHuman(),isChilled:i&&t&&i.isZero()&&i.lt(t),nominators:a,stakeOther:o,stakeOwn:r,stakeTotal:n}}(y,p):{}),[p,y]),_=(0,n.useMemo)((()=>!P||(0,dt.r7)(S,e,P,t,w)),[S,P,e,t,w]),q=(0,n.useMemo)((()=>`#/staking/query/${e}`),[e]),O=(0,n.useMemo)((()=>g&&"greyAnim-"+Date.now()%25),[g]);return _?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${s} isExpanded isFirst ${I?"packedBottom":"isLast"}`,children:[(0,a.jsx)(l.iA.Column.Favorite,{address:e,isFavorite:i,toggle:j}),(0,a.jsx)("td",{className:"badge together",children:(0,a.jsx)(Tt,{isChilled:T,isElected:r,isMain:u,isPara:d,isRelay:!!(S.query.parasShared||S.query.shared)?.activeValidatorIndices,nominators:u?D:x,onlineCount:f?.blockCount,onlineMessage:f?.hasMessage})}),(0,a.jsxs)("td",{className:"address all relative",children:[(0,a.jsx)(l.N,{value:e}),u&&O&&(0,a.jsx)(l.Vp,{className:`${O} absolute`,color:"lightgrey",label:g})]}),u?(0,a.jsx)(Et,{nominators:D,stakeOther:F}):(0,a.jsx)(It,{nominators:x,slashingSpans:E}),(0,a.jsx)("td",{className:"number",children:M||(0,a.jsx)("span",{className:"--tmp",children:"50.00%"})}),u&&(0,a.jsx)("td",{className:"number",children:h}),(0,a.jsx)(l.iA.Column.Expand,{isExpanded:I,toggle:A})]}),I&&(0,a.jsxs)("tr",{className:`${s} ${I?"isExpanded isLast":"isCollapsed"} packedTop`,children:[(0,a.jsx)("td",{colSpan:2}),(0,a.jsxs)("td",{className:"columar",colSpan:u?4:3,children:[(0,a.jsxs)(l.P0,{size:"small",children:[(0,a.jsx)(l.P0.Column,{children:u&&V?.gtn(0)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:N("own stake")}),(0,a.jsx)(b.Z,{value:V})]})}),(0,a.jsx)(l.P0.Column,{children:o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h5",{children:N("graphs")}),(0,a.jsxs)("a",{href:q,children:[(0,a.jsx)(l.JO,{className:"highlight--color",icon:"chart-line"})," ",N("historic results")]})]})})]}),(0,a.jsx)(l.P0,{is100:!0,children:(0,a.jsx)(l.P0.Column,{children:(0,a.jsx)(l.NR,{data:e,type:"validator",withTitle:!0})})})]}),(0,a.jsx)("td",{})]})]}):null}));function Vt(e,s=[],t=[],a,n,o){return s.filter((s=>!o.includes(s)&&(!e||t.includes(s)))).map((e=>[e,a.includes(e),n.includes(e)])).sort((([e,,s],[a,,n])=>{const o=t.includes(e),r=t.includes(a);return s===n?o===r?0:o?-1:1:s?-1:1}))}function _t(e){const s=new Array(e.length);for(let t=0;tfunction(e,s,t,a,n){if(!s)return{};const o=_t(s.nextElected),r=_t(s.validators);return{validators:Vt(e,r,n,o,t,[]),waiting:Vt(e,o,n,o,t,r).concat(Vt(e,a,n,[],t,o))}}(r,p,s,x.waitingIds,d)),[s,r,d,p,x]),I=(0,n.useMemo)((()=>N?o?u&&S:k:void 0),[o,N,u,k,S]),A=(0,n.useMemo)((()=>x.validators&&function(e){const s={};for(let t=0,a=e.length;t(0,a.jsx)(Ft,{address:e,filterName:y,hasQueries:t,isElected:s,isFavorite:n,isMain:!o,isPara:m[e],lastBlock:j[e],minCommission:i,nominatedBy:u?.[e],points:v[e],recentlyOnline:h?.[e],toggleFavorite:g,validatorInfo:A?.[e]},e)))})}));var Rt=t(54705);const zt=(0,l.zo)(l.Ty)` + .validator--Account-block-icon { + display: inline-block; + margin-right: 0.75rem; + margin-top: -0.25rem; + vertical-align: middle; + } + + .validator--Summary-authors { + .validator--Account-block-icon+.validator--Account-block-icon { + margin-left: -1.5rem; + } + } + + .percent { + font-size: var(--font-percent-tiny); + } +`,Ht=n.memo((function({className:e="",stakingOverview:s,targets:{counterForNominators:t,inflation:{idealStake:n,inflation:o,stakedFraction:r},nominators:i,waitingIds:c}}){const{t:u}=C(),d=(0,a.jsx)("span",{className:"percent",children:"%"});return(0,a.jsxs)(zt,{className:e,children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(l.Jy,{label:u("validators"),children:s?(0,a.jsxs)(a.Fragment,{children:[(0,S.u)(s.validators.length)," / ",(0,S.u)(s.validatorCount)]}):(0,a.jsx)("span",{className:"--tmp",children:"999 / 999"})}),(0,a.jsx)(l.Jy,{className:"media--900",label:u("waiting"),children:c?(0,S.u)(c.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(l.Jy,{className:"media--1000",label:u(t?"active / nominators":"nominators"),children:i?(0,a.jsxs)(a.Fragment,{children:[(0,S.u)(i.length),t&&(0,a.jsxs)(a.Fragment,{children:[" / ",(0,S.u)(t)]})]}):(0,a.jsx)("span",{className:"--tmp",children:"999 / 999"})})]}),(0,a.jsxs)("section",{children:[n>0&&Number.isFinite(n)&&(0,a.jsx)(l.Jy,{className:"media--1400",label:u("ideal staked"),children:(0,a.jsxs)(a.Fragment,{children:[(100*n).toFixed(1),d]})}),r>0&&(0,a.jsx)(l.Jy,{className:"media--1300",label:u("staked"),children:(0,a.jsxs)(a.Fragment,{children:[(100*r).toFixed(1),d]})}),o>0&&Number.isFinite(o)&&(0,a.jsx)(l.Jy,{className:"media--1200",label:u("inflation"),children:(0,a.jsxs)(a.Fragment,{children:[o.toFixed(1),d]})})]}),(0,a.jsx)("section",{children:(0,a.jsx)(Rt.Z,{})})]})})),$t={},Lt={},Bt={},Zt=n.memo((function({className:e="",favorites:s,hasAccounts:t,hasQueries:o,minCommission:r,nominatedBy:i,ownStashes:u,paraValidators:d,stakingOverview:h,targets:p,toggleFavorite:x,toggleLedger:g,toggleNominatedBy:b}){const{t:f}=C(),{api:j}=(0,c.h)(),{byAuthor:v,eraPoints:y}=(0,wt.E)(),[w,N]=(0,n.useState)(0),[k,S]=(0,n.useState)(1),I=(0,m.W7)(j.derive.imOnline?.receivedHeartbeats),A=(0,n.useCallback)((e=>{e&&b(),N(e)}),[b]),P=(0,n.useRef)([{text:f("Own validators"),value:"mine"},{text:f("All validators"),value:"all"}]),E=(0,n.useRef)([{text:f("Active"),value:"active"},{text:f("Waiting"),value:"waiting"}]),M=(0,n.useMemo)((()=>u?.map((({stashId:e})=>e))),[u]);(0,n.useEffect)((()=>{g&&g()}),[g]);const T=0===k;return(0,a.jsxs)("div",{className:`${e} staking--Overview`,children:[(0,a.jsx)(Ht,{stakingOverview:h,targets:p}),t&&0===u?.length&&(0,a.jsx)(Nt,{}),(0,a.jsxs)(l.zx.Group,{children:[(0,a.jsx)(l.tX,{onChange:S,options:P.current,value:k}),(0,a.jsx)(l.tX,{onChange:A,options:E.current,value:w})]}),(0,a.jsx)(Ot,{byAuthor:0===w?v:Lt,eraPoints:0===w?y:Bt,favorites:s,hasQueries:o,isIntentions:1===w,isOwn:T,minCommission:0===w?r:void 0,nominatedBy:1===w?i:void 0,ownStashIds:M,paraValidators:0===w&&d||$t,recentlyOnline:0===w?I:void 0,stakingOverview:h,targets:p,toggleFavorite:x},w)]})})),Wt=(0,I.e)("useNominations",(function(e=!0){const{api:s}=(0,c.h)(),t=(0,m.W7)(e&&s.query.staking.nominators.entries);return(0,n.useMemo)((()=>t&&function(e){const s={};for(let t=0,a=e.length;t({activeEra:e,eraLength:s,lastEra:e.isZero()?v.nw:e.sub(v.If),sessionLength:t})},Xt={defaultValue:{},transform:([e,s,t,a,n,o,r,i])=>({counterForNominators:s,counterForValidators:t,historyDepth:e,maxNominatorsCount:a&&a.isSome?a.unwrap():void 0,maxValidatorsCount:n&&n.isSome?n.unwrap():void 0,minNominatorBond:o,minValidatorBond:r,totalIssuance:i})};function ea(e){return(s,t)=>(s[e]=t+1,s)}function sa(e){return!e.nextElected}function ta(e){const s=[];return e.filter((({accountId:e})=>{const t=e.toString();return!s.includes(t)&&(s.push(t),!0)})).sort(((e,s)=>s.bondOther.cmp(e.bondOther))).map(ea("rankBondOther")).sort(((e,s)=>s.bondOwn.cmp(e.bondOwn))).map(ea("rankBondOwn")).sort(((e,s)=>s.bondTotal.cmp(e.bondTotal))).map(ea("rankBondTotal")).sort(((e,s)=>e.stakedReturnCmp-s.stakedReturnCmp)).map(ea("rankReward")).sort(((e,s)=>s.stakedReturnCmp-e.stakedReturnCmp||e.commissionPer-s.commissionPer||s.rankBondTotal-e.rankBondTotal)).map(ea("rankOverall")).sort(((e,s)=>e.isFavorite===s.isFavorite?0:e.isFavorite?-1:1))}function aa(e,s,t,a,{activeEra:n,eraLength:o,lastEra:r,sessionLength:i},l,c){const u={},d=e.createType("Exposure"),m=l&&r.sub(l).iadd(v.If),h=new Array(t.info.length);for(let l=0;l")})=>{const a=t.unwrap();return s.isZero()||a.lt(s)?a:s}),v.nw),w=p.toString(),N=r.isZero()?void 0:g.claimedRewards[g.claimedRewards.length-1];h[l]={accountId:p,bondOther:j.sub(f),bondOwn:f,bondShare:0,bondTotal:j,commissionPer:b.commission.unwrap().toNumber()/1e7,exposure:x,isActive:!y,isBlocking:!(!b.blocked||!b.blocked.isTrue),isElected:!sa(t)&&t.nextElected.some((e=>e.eq(p))),isFavorite:a.includes(w),isNominating:(x.others||[]).reduce(((e,t)=>{const a=t.who.toString();return u[a]=(u[a]||v.nw).add(t.value?.toBn()||v.nw),e||s.includes(a)}),s.includes(w)),key:w,knownLength:n.sub(g.claimedRewards[0]||n),lastPayout:m&&N&&N.gt(m)&&!i.eq(v.If)?r.sub(N).mul(o):void 0,minNominated:C,numNominators:(x.others||[]).length,numRecentPayouts:m?g.claimedRewards.filter((e=>e.gte(m))).length:0,rankBondOther:0,rankBondOwn:0,rankBondTotal:0,rankNumNominators:0,rankOverall:0,rankReward:0,skipRewards:y,stakedReturn:0,stakedReturnCmp:0,validatorPrefs:b,withReturns:c}}return[h,u]}function na(e,s){const t=s.avgStaked,a=s.validators;return a?(t&&!t.isZero()&&a.forEach((s=>{if(!s.skipRewards&&s.withReturns){const a=t.mul(v.S8).imuln(e.stakedReturn).div(s.bondTotal);s.stakedReturn=(a.gt(v.Ew)?v.Ew:a).toNumber()/v.S8.toNumber(),s.stakedReturnCmp=s.stakedReturn*(100-s.commissionPer)/100}})),{...s,validators:ta(a)}):s}const oa=(0,I.e)("useSortedTargets",(function(e,s){const{api:t}=(0,c.h)(),{allAccounts:a}=(0,u.x)(),{counterForNominators:o,counterForValidators:r,historyDepth:i,maxNominatorsCount:l,maxValidatorsCount:d,minNominatorBond:p,minValidatorBond:x,totalIssuance:g}=(0,h.L)([t.query.staking.historyDepth,t.query.staking.counterForNominators,t.query.staking.counterForValidators,t.query.staking.maxNominatorsCount,t.query.staking.maxValidatorsCount,t.query.staking.minNominatorBond,t.query.staking.minValidatorBond,t.query.balances?.totalIssuance],Xt),b=(0,m.W7)(t.derive.staking.electedInfo,[{...Yt,withLedger:s}]),f=(0,m.W7)(t.derive.staking.waitingInfo,[{...Qt,withLedger:s}]),y=(0,m.W7)(t.derive.session.info,void 0,Kt),C=(0,n.useMemo)((()=>b&&y&&g&&f?function(e,s,t,a,n,o,r,i){const[l,c]=aa(e,s,t,n,r,i,!0),[u]=aa(e,s,a,n,r),d=l.filter((({isActive:e})=>e)).map((({bondTotal:e})=>e)).sort(((e,s)=>e.cmp(s))),m=d.reduce(((e,s)=>e.iadd(s)),new(j())(0)),h=m.divn(d.length),p=Object.values(c).reduce(((e,s)=>e.isZero()||s.lt(e)?s:e),v.nw),x=(0,Jt.a)([l,u]),g=x.map((({commissionPer:e})=>e)).sort(((e,s)=>e-s)),b=Math.floor(g.length/2),f=g.length?g.length%2?g[b]:(g[b-1]+g[b])/2:0,y=u.map((({key:e})=>e)),C=(0,Jt.a)([l.map((({key:e})=>e)),y]),w=(0,Jt.a)([l.filter((({isBlocking:e})=>!e)).map((({key:e})=>e)),u.filter((({isBlocking:e})=>!e)).map((({key:e})=>e))]);return{avgStaked:h,lastEra:r.lastEra,lowStaked:d[0]||v.nw,medianComm:f,minNominated:p,nominateIds:w,nominators:Object.keys(c),totalIssuance:o,totalStaked:m,validatorIds:C,validators:x,waitingIds:y}}(t,a,b,f,e,g,y,t.consts.staking.historyDepth||i):Gt),[t,a,b,e,i,y,g,f]),w=(0,Ut.V)(C?.totalStaked);return(0,n.useMemo)((()=>({counterForNominators:o,counterForValidators:r,historyDepth:t.consts.staking.historyDepth||i,inflation:w,maxNominatorsCount:l,maxValidatorsCount:d,medianComm:0,minNominated:v.nw,minNominatorBond:p,minValidatorBond:x,...w?.stakedReturn?na(w,C):C})),[t,C,o,r,i,w,l,d,p,x])})),ra=["actions","payout"],ia={defaultValue:[!1,void 0,{}],transform:([e,s,t,a])=>[!!e&&e.isOpen,s&&!s.isZero()?s:void 0,t&&a?a.reduce(((e,s)=>({...e,[t[s.toNumber()].toString()]:!0})),{}):{}]},la=l.zo.main` + .staking--Chart { + margin-top: 1.5rem; + + h1 { + margin-bottom: 0.5rem; + } + + .ui--Spinner { + margin: 2.5rem auto; + } + } + + .staking--optionsBar { + margin: 0.5rem 0 1rem; + text-align: center; + white-space: normal; + + .staking--buttonToggle { + display: inline-block; + margin-right: 1rem; + margin-top: 0.5rem; + } + } + + .ui--Expander.stakeOver { + .ui--Expander-summary { + color: var(--color-error); + } + } +`,ca=n.memo((function({basePath:e,className:s=""}){const{t}=C(),{api:b}=(0,c.h)(),{areAccountsLoaded:f,hasAccounts:j}=(0,u.x)(),{pathname:v}=(0,o.TH)(),[y,w]=(0,n.useState)(!1),[N,k]=(0,d.r)(Q),[S,I]=(0,n.useState)(!1),A=Wt(S),P=(0,m.W7)(b.derive.staking.overview),[E,M,T]=(0,h.L)([b.query.staking.eraElectionStatus,b.query.staking.minCommission,b.query.session.validators,(b.query.parasShared||b.query.shared)?.activeValidatorIndices],ia),D=(0,i.Z)(),F=(0,p.w)(),V=(0,x.g)(),_=oa(N,y),q=(0,n.useMemo)((()=>j&&!!b.query.imOnline?.authoredBlocks&&!!b.query.staking.activeEra),[b,j]),O=(0,n.useMemo)((()=>j&&!!F&&0!==F.length),[j,F]),R=(0,n.useMemo)((()=>(F||[]).filter((({isStashValidating:e})=>e))),[F]),z=(0,n.useCallback)((()=>w(!0)),[]),H=(0,n.useCallback)((()=>I(!0)),[]),$=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:t("Overview")},{name:"actions",text:t("Accounts")},O&&(0,g.m)(b.query.staking.activeEra)&&{name:"payout",text:t("Payouts")},(0,g.m)(b.query.nominationPools?.minCreateBond)&&{name:"pools",text:t("Pools")},{alias:"returns",name:"targets",text:t("Targets")},O&&(0,g.m)((b.query.voterBagsList||b.query.bagsList||b.query.voterList)?.counterForListNodes)&&{name:"bags",text:t("Bags")},{count:V.reduce(((e,[,s])=>e+s.length),0),name:"slashes",text:t("Slashes")},{hasParams:!0,name:"query",text:t("Validator stats")}].filter((e=>!!e))),[b,O,V,t]);return(0,a.jsxs)(la,{className:`${s} staking--App`,children:[(0,a.jsx)(l.mQ,{basePath:e,hidden:f&&!j?ra:void 0,items:$}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(ms,{ownStashes:F}),path:"bags"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Ss,{historyDepth:_.historyDepth,isInElection:E,ownPools:D,ownValidators:R}),path:"payout"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(r.Z,{ownPools:D}),path:"pools"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)($s,{}),path:"query/:value?"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Gs,{ownStashes:F,slashes:V}),path:"slashes"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Ct,{isInElection:E,nominatedBy:A,ownStashes:F,stakingOverview:P,targets:_,toggleFavorite:k,toggleLedger:z,toggleNominatedBy:H}),path:"targets"})]})}),(0,a.jsx)(We,{className:v===`${e}/actions`?"":"--hidden",isInElection:E,minCommission:M,ownPools:D,ownStashes:F,targets:_}),(0,a.jsx)(Zt,{className:e===v?"":"--hidden",favorites:N,hasAccounts:j,hasQueries:q,minCommission:M,nominatedBy:A,ownStashes:F,paraValidators:T,stakingOverview:P,targets:_,toggleFavorite:k,toggleNominatedBy:H})]})}))},87292:(e,s,t)=>{t.d(s,{Z:()=>l});var a=t(52322),n=t(2784),o=t(64348),r=t(90760);const i=o.zo.div` + font-size: var(--font-size-small); + padding: 1rem 0.5rem; + text-align: center; + + .ui--Badge, .ui--Tag { + margin-right: 0.5rem; + } + + span { + vertical-align: middle; + + * { + vertical-align: middle; + } + + + span { + margin-left: 1rem; + } + } +`,l=n.memo((function({className:e,isRelay:s,minCommission:t}){const{t:n}=(0,r.$)();return(0,a.jsxs)(i,{className:e,children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"blue",icon:"chevron-right"}),(0,a.jsx)("span",{children:n("Next session")})]}),t&&(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"red",icon:"cancel"}),(0,a.jsx)("span",{children:n("Chilled")})]}),s&&(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"purple",icon:"vector-square"}),(0,a.jsx)("span",{children:n("Para validator")})]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"green",info:"5"}),(0,a.jsx)("span",{children:n("Produced blocks")})]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"green",icon:"envelope"}),(0,a.jsx)("span",{children:n("Online message")})]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"green",icon:"hand-paper"}),(0,a.jsx)("span",{children:n("Nominating")})]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"red",icon:"balance-scale-right"}),(0,a.jsx)("span",{children:n("Oversubscribed")})]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"red",icon:"skull-crossbones"}),(0,a.jsx)("span",{children:n("Slashed")})]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Ct,{color:"red",icon:"user-slash"}),(0,a.jsx)("span",{children:n("Blocks nominations")})]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Vp,{color:"lightgrey",label:"1,220"}),(0,a.jsx)("span",{children:n("Era points")})]})]})}))},75030:(e,s,t)=>{t.d(s,{Z:()=>z});var a=t(52322),n=t(2784),o=t(64348),r=t(95209),i=t(90760),l=t(90778),c=t(38894),u=t(52107),d=t(63985);const m=n.memo((function({className:e,isDisabled:s,ownAccounts:t,params:{minCreateBond:r,minNominatorBond:m,nextPoolId:h}}){const{t:p}=(0,i.$)(),{api:x}=(0,l.h)(),[g,b]=(0,c.O)(),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(),[C,w]=(0,n.useState)(""),N=(0,n.useMemo)((()=>r&&m&&(0,u.x)(r,m,x.consts.balances.existentialDeposit)),[x,r,m]),k=(0,d.Z)(f,v,N),S=(0,n.useMemo)((()=>!C||C.length<3||C.length>32),[C]),I=(0,n.useMemo)((()=>v&&f&&!k&&h?x.tx.utility.batch([x.tx.nominationPools.create(v,f,f,f),x.tx.nominationPools.setMetadata(h,C)]):null),[x,f,v,k,C,h]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"plus",isDisabled:s||!N,label:p("Add pool"),onClick:b}),g&&(0,a.jsxs)(o.u_,{className:e,header:p("Create nomination pool"),onClose:b,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:p("The origin account will also be set as the pool admin, nominator and state toggler."),children:(0,a.jsx)(o.rp,{filter:t,label:p("create pool from"),onChange:j,type:"account",value:f,withExclude:!0})}),(0,a.jsx)(o.u_.Columns,{hint:p("The initial value to assign to the pool. It is set to the maximum of the minimum bond and the minium nomination value."),children:(0,a.jsx)(o.H,{autoFocus:!0,defaultValue:N,isError:k,label:p("initial value"),onChange:y})}),(0,a.jsx)(o.u_.Columns,{hint:p("The metadata description to set for this pool"),children:(0,a.jsx)(o.II,{isError:S,label:p("description"),maxLength:32,onChange:w})}),(0,a.jsx)(o.u_.Columns,{hint:p("The id that will be assigned to this nomination pool."),children:(0,a.jsx)(o.Rn,{defaultValue:h,isDisabled:!0,label:p("pool id")})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:f,extrinsic:I,icon:"plus",isDisabled:!f||k||S,label:p("Create"),onStart:b})})]})]})}));var h=t(58607);const p=n.memo((function({className:e,isDisabled:s,ownAccounts:t,params:{minMemberBond:r},poolId:u}){const{t:m}=(0,i.$)(),{api:h}=(0,l.h)(),[p,x]=(0,c.O)(),[g,b]=(0,n.useState)(null),[f,j]=(0,n.useState)(),v=(0,d.Z)(g,f,r);return s?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.zx,{icon:"plus",isDisabled:!r,label:m("Join"),onClick:x}),p&&(0,a.jsxs)(o.u_,{className:e,header:m("Join nomination pool"),onClose:x,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:m("The account that will join the pool."),children:(0,a.jsx)(o.rp,{filter:t,label:m("join pool from"),onChange:b,type:"account",value:g,withExclude:!0})}),(0,a.jsx)(o.u_.Columns,{hint:m("The initial value to assign to the pool. It is set to the minimum value required to join a pool."),children:(0,a.jsx)(o.H,{autoFocus:!0,defaultValue:r,isError:v,label:m("initial value"),onChange:j})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:g,icon:"plus",isDisabled:!g||v,label:m("Join"),onStart:x,params:[f,u],tx:h.tx.nominationPools.join})})]})]})}));var x=t(19042);const g=o.zo.tr` + .label-column-right, + .label-column-left{ + display: flex; + align-items: center; + + .label { + width: 50%; + } + } + + .label { + text-align: right; + padding: 0 1.7rem 0 0; + line-height: normal; + color: var(--color-label); + text-transform: lowercase; + } + + .clamp { + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + box-orient: vertical; + display: -webkit-box; + line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; + } +`,b=n.memo((function({className:e="",members:s,ownAccounts:t,params:r,poolId:l}){const{t:u}=(0,i.$)(),d=(0,x.Z)(l),[m,b]=(0,c.O)(!1),f=(0,n.useCallback)((()=>s.map((({accountId:e,member:s},t)=>(0,a.jsx)(o.ax,{balance:s.points,value:e,withBalance:!0,withShrink:!0},`${t}:${e}`)))),[s]),j=(0,n.useCallback)((()=>d?.nominating.map(((e,s)=>(0,a.jsx)(o.ax,{value:e,withShrink:!0},`${s}:${e}`)))),[d]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(g,{className:`${e} isFirst isExpanded ${m?"":"isLast"}`,children:[(0,a.jsx)(o.iA.Column.Id,{value:l}),(0,a.jsx)("td",{className:"start",children:(0,a.jsx)("div",{className:m?"":"clamp",children:d?d.metadata:(0,a.jsx)("span",{className:"--tmp",children:"This is a pool placeholder"})})}),(0,a.jsx)("td",{className:"number media--1100",children:d?d.bonded.state.type:(0,a.jsx)("span",{className:"--tmp",children:"Destroying"})}),(0,a.jsx)(o.iA.Column.Balance,{value:d?.bonded.points,withLoading:!0}),(0,a.jsx)("td",{className:"number media--1400",children:d&&!d.rewardClaimable.isZero()&&(0,a.jsx)(h.Z,{value:d.rewardClaimable})}),(0,a.jsx)("td",{className:"number",children:d&&0!==d.nominating.length&&(0,a.jsx)(o.n0,{className:"media--1300",empty:u("No nominees"),renderChildren:j,summary:u("Nominees ({{count}})",{replace:{count:d.nominating.length}})})}),(0,a.jsx)("td",{className:"number",children:s&&0!==s.length&&(0,a.jsx)(o.n0,{className:"media--1200",empty:u("No members"),renderChildren:f,summary:u("Members ({{count}})",{replace:{count:s.length}})})}),(0,a.jsx)("td",{className:"button",children:d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{isDisabled:!d.bonded.state.isOpen||!!r.maxMembersPerPool&&!d.bonded.memberCounter.ltn(r.maxMembersPerPool),ownAccounts:t,params:r,poolId:l}),(0,a.jsx)(o.Vh,{expanded:m,onClick:b})]}):(0,a.jsx)(o.$j,{noLabel:!0})})]}),d&&m&&(0,a.jsxs)(g,{className:`${e} isExpanded isLast`,children:[(0,a.jsxs)("td",{colSpan:4,children:[(0,a.jsxs)("div",{className:"label-column-right",children:[(0,a.jsx)("div",{className:"label",children:u("creator")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(o.ax,{value:d.bonded.roles.depositor})})]}),d.bonded.roles.root.isSome&&(0,a.jsxs)("div",{className:"label-column-right",children:[(0,a.jsx)("div",{className:"label",children:u("root")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(o.ax,{value:d.bonded.roles.root.unwrap()})})]}),d.bonded.roles.nominator.isSome&&(0,a.jsxs)("div",{className:"label-column-right",children:[(0,a.jsx)("div",{className:"label",children:u("nominator")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(o.ax,{value:d.bonded.roles.nominator.unwrap()})})]}),d.bonded.roles.stateToggler?.isSome&&(0,a.jsxs)("div",{className:"label-column-right",children:[(0,a.jsx)("div",{className:"label",children:u("toggler")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(o.ax,{value:d.bonded.roles.stateToggler.unwrap()})})]})]}),(0,a.jsxs)("td",{colSpan:4,children:[(0,a.jsxs)("div",{className:"label-column-right",children:[(0,a.jsx)("div",{className:"label",children:u("stash")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(o.ax,{value:d.stashId})})]}),(0,a.jsxs)("div",{className:"label-column-right",children:[(0,a.jsx)("div",{className:"label",children:u("rewards")}),(0,a.jsx)("div",{className:"inline-balance",children:(0,a.jsx)(o.ax,{value:d.rewardId})})]})]})]})]})}));var f=t(51240),j=t(39824),v=t(9118),y=t(11677);const C=[],w={transform:e=>e.reduce(((e,[{args:[s]},t])=>{if(t.isSome){const a=t.unwrap(),n=a.poolId.toString();e[n]||(e[n]=[]),e[n].push({accountId:s.toString(),member:a})}return e}),{})},N={transform:([[e],s])=>e.filter(((e,t)=>s[t].isSome)).map(((e,t)=>({accountId:e.toString(),member:s[t].unwrap()}))),withParamsTransform:!0};function k(e){const s=[];return e.forEach((({event:{data:e,method:t}})=>{if("Bonded"===t){const[t,,,a]=e;a.isTrue&&s.push(t)}})),{added:s,removed:[]}}const S=(0,y.e)("useMembers",(function(){const{api:e}=(0,l.h)(),[s,t]=(0,n.useState)(),a=(0,f.t)(e.query.nominationPools.poolMembers,[],w),o=(0,j.N)([e.events.nominationPools.Bonded],k,C),r=(0,v.W7)(o&&0!==o.length&&e.query.nominationPools.poolMembers.multi,[o],N);return(0,n.useEffect)((()=>{a&&t(a)}),[a]),(0,n.useEffect)((()=>{r&&t((e=>e&&function(e,s){return s.reduce(((e,s)=>{const t=s.member.poolId.toString(),a=[];return e[t]&&e[t].forEach((e=>{e.accountId!==s.accountId&&a.push(e)})),a.push(s),e[t]=a,e}),{...e})}(e,r)))}),[r]),s})),I=n.memo((function({className:e,ids:s,ownPools:t,params:l}){const{t:c}=(0,i.$)(),u=S(),[d,h]=(0,n.useState)((()=>t?.length?0:1)),p=(0,n.useMemo)((()=>t&&(0,r.a)(t.map((({members:e})=>Object.keys(e))))),[t]),x=(0,n.useMemo)((()=>!s||!!l.maxPools&&s.length>l.maxPools),[s,l]),g=(0,n.useMemo)((()=>t&&s?d?s:s.filter((e=>t.some((({poolId:s})=>e.eq(s))))):void 0),[s,t,d]),f=(0,n.useMemo)((()=>[[c("pools"),"start",2],[c("state"),"media--1100"],[c("points")],[c("claimable"),"media--1400"],[void 0,void 0,3]]),[c]),j=(0,n.useRef)([{text:c("Own pools"),value:"mine"},{text:c("All pools"),value:"all"}]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.zx.Group,{children:[(0,a.jsx)(o.tX,{onChange:h,options:j.current,value:d}),(0,a.jsx)(m,{isDisabled:x,ownAccounts:p,params:l})]}),(0,a.jsx)(o.iA,{className:e,empty:u&&g&&c("No available nomination pools"),emptySpinner:c("Retrieving nomination pools"),header:f,children:u&&g?.map((e=>(0,a.jsx)(b,{members:u[e.toString()],ownAccounts:p,params:l,poolId:e},e.toString())))})]})}));var A=t(65968),P=t(14681);const E=n.memo((function({className:e,params:{maxMembers:s,maxMembersPerPool:t,maxPools:n},poolCount:r}){const{t:l}=(0,i.$)();return(0,a.jsxs)(o.Ty,{className:e,children:[(0,a.jsx)(o.Jy,{label:l("pools"),children:(0,A.h)(r)&&(0,a.jsxs)(a.Fragment,{children:[(0,P.u)(r),n>0&&(0,a.jsxs)(a.Fragment,{children:[" / ",(0,P.u)(n)]})]})}),(0,a.jsxs)("section",{children:[s>0&&(0,a.jsx)(o.Jy,{label:l("max. members"),children:(0,P.u)(s)}),t>0&&(0,a.jsx)(o.Jy,{label:l("max. members / pool"),children:(0,P.u)(t)})]})]})}));var M=t(65857),T=t(54890),D=t(95292);const F={defaultValue:{lastPoolId:D.nw,maxMembers:0,maxMembersPerPool:0,maxPools:0,nextPoolId:D.If},transform:([e,s,t,a,n,o,r])=>({lastPoolId:e,maxMembers:s.unwrapOr(D.nw).toNumber(),maxMembersPerPool:t.unwrapOr(D.nw).toNumber(),maxPools:a.unwrapOr(D.nw).toNumber(),minCreateBond:n,minJoinBond:o,minMemberBond:o,minNominatorBond:r,nextPoolId:e.add(D.If)})},V=(0,y.e)("useParams",(function(){const{api:e}=(0,l.h)();return(0,T.L)([e.query.nominationPools.lastPoolId,e.query.nominationPools.maxPoolMembers,e.query.nominationPools.maxPoolMembersPerPool,e.query.nominationPools.maxPools,e.query.nominationPools.minCreateBond,e.query.nominationPools.minJoinBond,e.query.staking.minNominatorBond],F)}));var _=t(12298);const q={transform:e=>e.map((({args:[e]})=>e)).sort(((e,s)=>e.cmp(s)))};function O(e){const s=[],t=[];return e.forEach((({event:{data:e,method:a}})=>{"Created"===a?s.push(e[1]):t.push(e[0])})),{added:s,removed:t}}const R=(0,y.e)("usePoolIds",(function(){const{api:e}=(0,l.h)(),s=(0,_.k)(e.query.nominationPools.bondedPools,[],q);return(0,j.N)([e.events.nominationPools.Created,e.events.nominationPools.Destroyed],O,s)})),z=n.memo((function({className:e,ownPools:s}){const t=R(),n=(0,M.Z)(),o=V();return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(E,{params:o,poolCount:t?.length}),(0,a.jsx)(I,{ids:t,ownPools:n||s,params:o})]})}))},63985:(e,s,t)=>{t.d(s,{Z:()=>r});var a=t(2784),n=t(90778),o=t(9118);const r=(0,t(11677).e)("useAmountError",(function(e,s,t){const{api:r}=(0,n.h)(),i=(0,o.W7)(!!e&&r.derive.balances.all,[e]);return(0,a.useMemo)((()=>!s||s.isZero()||!t||t.gt(s)||!!i&&s.gt(i.availableBalance.sub(r.consts.balances.existentialDeposit))),[r,s,i,t])}))},65857:(e,s,t)=>{t.d(s,{Z:()=>u});var a=t(2784),n=t(90778),o=t(34814),r=t(9118),i=t(11677),l=t(43002);const c={transform:([[e],s])=>{const t=[];for(let a=0;ae.eq(n.poolId)));o||(o={members:{},poolId:n.poolId},t.push(o)),o.members[e[a]]=n}return t},withParamsTransform:!0},u=(0,i.e)("useOwnPools",(function(){const{api:e}=(0,n.h)(),{allAccounts:s}=(0,o.x)(),t=(0,r.W7)(e.query.nominationPools?.poolMembers.multi,[s],c);return(0,a.useMemo)((()=>t?.map((s=>({...s,...(0,l.i)(e,s.poolId)})))),[e,t])}))},43002:(e,s,t)=>{t.d(s,{Z:()=>p,i:()=>h});var a=t(2784),n=t(90778),o=t(11677),r=t(64021),i=t(51330),l=t(57928);const c=new Uint8Array(32),u=(0,r.d)("modl"),d={bitLength:32,isLe:!0};function m(e,s,t,a){return e.registry.createType("AccountId32",(0,i.e)(u,s,new Uint8Array([a]),(0,l.a)(t,d),c)).toString()}function h(e,s){const t=e.consts.nominationPools.palletId.toU8a();return{rewardId:m(e,t,s,1),stashId:m(e,t,s,0)}}const p=(0,o.e)("usePoolAccounts",(function(e){const{api:s}=(0,n.h)();return(0,a.useMemo)((()=>h(s,e)),[s,e])}))},19042:(e,s,t)=>{t.d(s,{Z:()=>d});var a=t(2784),n=t(90778),o=t(54890),r=t(11677),i=t(52107),l=t(95292),c=t(43002);const u={defaultValue:null,transform:([e,s,t,a,n])=>{return e.isSome&&t.isSome?{bonded:e.unwrap(),metadata:s.length?(o=s.isUtf8?s.toUtf8():s.toString(),o.replace(/[^\x20-\x7E]/g,"")):null,nominating:a.unwrapOr({targets:[]}).targets.map((e=>e.toString())),reward:t.unwrap(),rewardClaimable:n.data.free}:null;var o}},d=(0,r.e)("usePoolInfo",(function(e){const{api:s}=(0,n.h)(),t=(0,c.Z)(e),r=(0,o.L)([[s.query.nominationPools.bondedPools,e],[s.query.nominationPools.metadata,e],[s.query.nominationPools.rewardPools,e],[s.query.staking.nominators,t.stashId],[s.query.system.account,t.rewardId]],u);return(0,a.useMemo)((()=>r&&{...t,...r,rewardClaimable:(0,i.x)(l.nw,r.rewardClaimable.sub(s.consts.balances.existentialDeposit))}),[s,r,t])}))},97473:(e,s,t)=>{t.d(s,{Z:()=>pe});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(54131),c=t(33661),u=t(75030),d=t(87292),m=t(90760),h=t(9118),p=t(11677),x=t(33403);const g={useExposure:{},useHeartbeat:{}},b={useElectedValidators:{},usePoints:{},useValidatorsActive:{},useValidatorsAll:{},useValidatorsWaiting:{}};function f(e,s,t){return(0,n.useEffect)((()=>{t&&(g[e][s]={value:t})}),[s,e,t]),t||g[e][s]?.value}function j(e,s){return(0,n.useEffect)((()=>{s&&(b[e]={value:s})}),[e,s]),s||b[e]?.value}var v=t(34814),y=t(12298);const C={transform:e=>e.map((({args:[,e]})=>e.toString()))},w=(0,p.e)("useElectedValidators",(function({currentEra:e}){const{api:s}=(0,i.h)(),t=(0,n.useMemo)((()=>e&&[e]),[e]);return j("useElectedValidators",(0,y.k)(t&&s.query.staking.erasStakers,t,C))}));function N(e,s){return e.isFavorite===s.isFavorite?e.isOwned===s.isOwned?e.isElected===s.isElected?0:e.isElected?-1:1:e.isOwned?-1:1:e.isFavorite?-1:1}const k=(0,p.e)("useTaggedValidators",(function(e,s,t){const{allAccounts:a}=(0,v.x)(),o=w(s),r=(0,n.useMemo)((()=>o&&t&&function(e,s){return e.map((e=>{const t=s.includes(e.stashId);return e.isElected!==t?(0,x.Z)({},e,{isElected:t}):e}))}(t,o)),[o,t]);return(0,n.useMemo)((()=>r&&function(e,s,t){return t.map((t=>{const a=s.includes(t.stashId),n=e.includes(t.stashId);return t.isFavorite!==a||t.isOwned!==n?(0,x.Z)({},t,{isFavorite:a,isOwned:n}):t})).sort(N)}(a,e,r)),[a,e,r])})),S={transform:e=>e.map(((e,s)=>{const t=e.toString();return{isElected:!1,isFavorite:!1,isOwned:!1,key:`${t}:${s}`,stashId:t,stashIndex:s}}))},I={transform:e=>e.map((e=>e.toNumber()))},A=(0,p.e)("useValidatorsActive",(function(e,s){const{api:t}=(0,i.h)(),a=(0,h.W7)(t.query.session.validators,void 0,S),o=(0,h.W7)((t.query.parasShared||t.query.shared)?.activeValidatorIndices,void 0,I),r=(0,n.useMemo)((()=>o&&a?a.map(((e,s)=>o.includes(s)?(0,x.Z)({isPara:!0},e):e)):a),[o,a]);return j("useValidatorsActive",k(e,s,r))}));var P=t(47623),E=t(38894),M=t(58607),T=t(14681),D=t(48801),F=t.n(D);const V={transform:({others:e,own:s,total:t})=>({others:e.map((({value:e,who:s})=>({value:e.unwrap(),who:s.toString()}))).sort(((e,s)=>s.value.cmp(e.value))),own:s.unwrap(),total:t.unwrap()})},_=(0,p.e)("useExposure",(function({stashId:e},{activeEra:s}){const{api:t}=(0,i.h)(),a=(0,n.useMemo)((()=>s&&[s,e]),[s,e]),o=(0,h.W7)(a&&t.query.staking.erasStakers,a,V),r=(0,h.W7)(a&&t.query.staking.erasStakersClipped,a,V),l=(0,n.useMemo)((()=>o&&r&&function(e,s){let t;const a=e.others.filter((({who:e})=>!s.others.find((s=>e===s.who))));return a.length&&(t={others:a,total:a.reduce(((e,{value:s})=>e.iadd(s)),new(F())(0))}),{clipped:s,exposure:e,waiting:t}}(o,r)),[r,o]);return f("useExposure",e,l)}));var q=t(65968),O=t(47538);const R={},z={transform:e=>e.toNumber()},H={transform:e=>e.isSome},$=(0,p.e)("useHeartbeat",(function({stashId:e,stashIndex:s},{currentSession:t}){const{api:a}=(0,i.h)(),o=(0,n.useMemo)((()=>-1===s?void 0:t&&{authoredBlocks:[t,e],receivedHeartbeats:[t,s]}),[t,e,s]),r=(0,h.W7)(o&&a.query.imOnline.authoredBlocks,o?.authoredBlocks,z),l=(0,h.W7)(o&&a.query.imOnline.receivedHeartbeats,o?.receivedHeartbeats,H),c=(0,n.useMemo)((()=>(0,q.h)(r)&&(0,O.j)(l)&&{authoredBlocks:r,isOnline:!(!r&&!l)}),[r,l]);return f("useHeartbeat",e,c)||R})),L=n.memo((function({children:e,className:s="",isExpanded:t}){return t?(0,a.jsxs)("tr",{className:`${s} isExpanded isLast`,children:[(0,a.jsx)("td",{}),(0,a.jsx)("td",{}),e,(0,a.jsx)("td",{})]}):null})),B=n.memo((function({children:e,className:s="",isExpanded:t}){return(0,a.jsxs)("tr",{className:`${s} isExpanded ${t?"":"isLast"} packedTop`,children:[(0,a.jsx)("td",{}),e,(0,a.jsx)("td",{})]})})),Z=r.zo.div` + .authoredBlocks { + vertical-align: top; + font-size: var(--font-percent-tiny); + } +`,W=n.memo((function({className:e,heartbeat:{authoredBlocks:s,isOnline:t}={},isChilled:o,nominators:i,validator:{isElected:l,isPara:c}}){const{allAccounts:u}=(0,v.x)(),d=(0,n.useMemo)((()=>i&&i.some((e=>u.includes(e)))),[u,i]),m=(0,a.jsx)(r.Ct,{className:"opaque",color:"gray"});return(0,a.jsxs)(Z,{className:e,children:[d?(0,a.jsx)(r.Ct,{color:"green",icon:"hand-paper"}):m,c?(0,a.jsx)(r.Ct,{color:"purple",icon:"vector-square"}):m,o?(0,a.jsx)(r.Ct,{color:"red",icon:"cancel"}):l?(0,a.jsx)(r.Ct,{color:"blue",icon:"chevron-right"}):m,t?s?(0,a.jsx)(r.Ct,{color:"green",info:(0,a.jsx)("span",{className:"authoredBlocks",children:s})}):(0,a.jsx)(r.Ct,{color:"green",icon:"envelope"}):m]})})),U=n.memo((function({children:e,className:s="",heartbeat:t,isExpanded:n,toggleExpanded:o,toggleFavorite:i,validator:l}){return(0,a.jsxs)("tr",{className:`${s} isExpanded isFirst packedBottom`,children:[(0,a.jsx)(r.iA.Column.Favorite,{address:l.stashId,isFavorite:l.isFavorite,toggle:i}),(0,a.jsx)("td",{className:"statusInfo",rowSpan:2,children:(0,a.jsx)(W,{heartbeat:t,validator:l})}),(0,a.jsxs)("td",{className:"address relative all",children:[(0,a.jsx)(r.N,{value:l.stashId}),e]}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:n,toggle:o})]})}));function J({className:e=""}){return(0,a.jsx)("td",{className:e})}const G=n.memo((function({className:e="",points:s,sessionInfo:t,toggleFavorite:o,validator:i}){const[l,c]=(0,E.O)(),u=(0,n.useRef)({counter:0,points:0}),d=_(i,t),m=$(i,t),h=(0,n.useMemo)((()=>s&&u.current.points!==s?(u.current.points=s,u.current.counter=(u.current.counter+1)%25,`greyAnim-${u.current.counter}`):""),[s,u]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(U,{className:e,heartbeat:m,isExpanded:l,toggleExpanded:c,toggleFavorite:o,validator:i,children:s&&(0,a.jsx)(r.Vp,{className:`${h} absolute`,color:"lightgrey",label:(0,T.u)(s)})}),(0,a.jsx)(B,{className:e,isExpanded:l,children:(0,a.jsx)(r.iA.Column.Balance,{className:"relative",label:d?.waiting&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"("}),(0,a.jsx)(M.Z,{value:d.waiting.total}),(0,a.jsxs)("span",{children:[", ",d.waiting.others.length,")"]})]}),value:d?.clipped?.total,withLoading:!0})}),(0,a.jsx)(L,{className:e,isExpanded:l,children:(0,a.jsx)(J,{validator:i})})]})})),Y=n.memo((function({className:e="",legend:s,points:t,sessionInfo:o,toggleFavorite:i,validatorsActive:l}){const{t:c}=(0,m.$)(),u=(0,P.q)(),d=(0,n.useRef)([[c("validators"),"start",4]]);return(0,a.jsx)(r.iA,{className:e,empty:u&&l&&c("No session validators found"),emptySpinner:c("Retrieving session validators"),header:d.current,isSplit:!0,legend:s,children:u&&l?.map((e=>(0,a.jsx)(G,{points:t?.[e.stashId],sessionInfo:o,toggleFavorite:i,validator:e},e.key)))})}));var Q=t(39824);const K=[],X={transform:e=>e.map((({args:[e]})=>e))};function ee(e){const s=[],t=[];return e.forEach((({event:{data:[e],method:a}})=>{"Bonded"===a?s.push(e):t.push(e)})),{added:s,removed:t}}const se=(0,p.e)("useValidatorsAll",(function(e,s){const{api:t}=(0,i.h)(),a=(0,y.k)(t.query.staking.validators,K,X),o=(0,Q.N)([t.events.staking.Bonded],ee,a),r=(0,n.useMemo)((()=>function(e){return e?.map((e=>{const s=e.toString();return{isElected:!1,isFavorite:!1,isOwned:!1,key:`${s}::-1`,stashId:s,stashIndex:-1}}))}(o)),[o]);return j("useValidatorsAll",k(e,s,r))})),te=(0,p.e)("useValidatorsWaiting",(function(e,s,t){const a=se(e,s);return j("useValidatorsWaiting",(0,n.useMemo)((()=>{return a&&t&&(e=t,a.filter((({stashId:s})=>!e.some((e=>e.stashId===s)))));var e}),[t,a]))}));function ae({className:e=""}){return(0,a.jsx)("td",{className:e})}const ne=n.memo((function({className:e="",toggleFavorite:s,validator:t}){const[n,o]=(0,E.O)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(U,{className:e,isExpanded:n,toggleExpanded:o,toggleFavorite:s,validator:t}),(0,a.jsx)(B,{className:e,isExpanded:n,children:(0,a.jsx)("td",{})}),(0,a.jsx)(L,{className:e,isExpanded:n,children:(0,a.jsx)(ae,{validator:t})})]})})),oe=n.memo((function({className:e="",favorites:s,legend:t,sessionInfo:o,toggleFavorite:i,validatorsActive:l}){const{t:c}=(0,m.$)(),u=(0,P.q)(),d=te(s,o,l),h=(0,n.useRef)([[c("waiting"),"start",4]]);return(0,a.jsx)(r.iA,{className:e,empty:u&&d&&c("No waiting validators found"),emptySpinner:c("Retrieving waiting validators"),header:h.current,isSplit:!0,legend:t,children:u&&d?.map((e=>(0,a.jsx)(ne,{toggleFavorite:i,validator:e},e.key)))})}));var re=t(95292);const ie={transform:({individual:e})=>[...e.entries()].filter((([,e])=>e.gt(re.nw))).reduce(((e,[s,t])=>(e[s.toString()]=t.toNumber(),e)),{})},le=(0,p.e)("usePoints",(function({activeEra:e}){const{api:s}=(0,i.h)(),t=(0,n.useMemo)((()=>e&&[e]),[e]);return j("usePoints",(0,h.W7)(t&&s.query.staking.erasRewardPoints,t,ie))})),ce=r.zo.div` + .ui--Table table { + td.statusInfo { + padding: 0 0 0 0.5rem; + vertical-align: middle; + + > div { + display: inline-block; + max-width: 3.6rem; + min-width: 3.6rem; + + .ui--Badge { + margin: 0.125rem; + + &.opaque { + opacity: var(--opacity-gray); + } + } + } + + + td.address { + padding-left: 0.5rem; + } + } + } +`,ue=n.memo((function({className:e="",favorites:s,isRelay:t,sessionInfo:o,toggleFavorite:i}){const{t:l}=(0,m.$)(),[c,u]=(0,n.useState)(0),h=A(s,o),p=le(o),x=(0,n.useRef)([{text:l("Active"),value:"active"},{text:l("Waiting"),value:"waiting"}]),g=(0,a.jsx)(d.Z,{isRelay:t});return(0,a.jsxs)(ce,{className:e,children:[(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.tX,{onChange:u,options:x.current,value:c})}),0===c?(0,a.jsx)(Y,{legend:g,points:p,sessionInfo:o,toggleFavorite:i,validatorsActive:h}):(0,a.jsx)(oe,{favorites:s,legend:g,sessionInfo:o,toggleFavorite:i,validatorsActive:h})]})})),de={transform:e=>e.isSome?e.unwrap().index:null},me={transform:e=>e.unwrapOr(null)},he=(0,p.e)("useSessionInfo",(function(){const{api:e}=(0,i.h)(),s=(0,h.W7)(e.query.staking.activeEra,void 0,de),t=(0,h.W7)(e.query.staking.currentEra,void 0,me),a=(0,h.W7)(e.query.session.currentIndex);return(0,n.useMemo)((()=>({activeEra:s,currentEra:t,currentSession:a})),[s,t,a])})),pe=n.memo((function({basePath:e}){const{t:s}=(0,m.$)(),{api:t}=(0,i.h)();(0,n.useEffect)((()=>()=>{!function(){for(const e of Object.keys(g))g[e]={};for(const e of Object.keys(b))b[e]={}}()}),[]);const[d,h]=(0,l.r)("staking:favorites"),p=he(),x=(0,n.useMemo)((()=>!!(t.query.parasShared||t.query.shared)?.activeValidatorIndices),[t]),f=(0,n.useRef)([{isRoot:!0,name:"sign",text:s("Validators")},(0,c.m)(t.query.nominationPools?.minCreateBond)&&{name:"pools",text:s("Pools")}]);return(0,a.jsxs)("main",{className:"staking--App",children:[(0,a.jsx)(r.mQ,{basePath:e,items:f.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(u.Z,{}),path:"pools"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(ue,{favorites:d,isRelay:x,sessionInfo:p,toggleFavorite:h}),index:!0})]})})]})}))},90760:(e,s,t)=>{t.d(s,{$:()=>n});var a=t(61349);function n(){return(0,a.$G)("app-staking")}},46717:(e,s,t)=>{t.d(s,{Z:()=>B});var a=t(52322),n=t(2784),o=t(64348),r=t(73557),i=t(61349);function l(){return(0,i.$G)("app-storage")}var c=t(90778);const u=n.memo((function({onAdd:e}){const{t:s}=l(),{api:t}=(0,c.h)(),[r]=(0,n.useState)((()=>{const e=Object.keys(t.consts)[0],s=Object.keys(t.consts[e])[0];return{meta:t.consts[e][s].meta,method:s,section:e}})),[i,u]=(0,n.useState)(r),d=(0,n.useCallback)((()=>e({isConst:!0,key:i})),[e,i]);return(0,a.jsxs)("section",{className:"storage--actionrow",children:[(0,a.jsx)("div",{className:"storage--actionrow-value",children:(0,a.jsx)(o.eV,{defaultValue:r,label:s("selected constant query"),onChange:u})}),(0,a.jsx)("div",{className:"storage--actionrow-buttons",children:(0,a.jsx)(o.zx,{icon:"plus",onClick:d})})]})}));var d=t(86353),m=t(6046),h=t(44055),p=t(23601),x=t(1346),g=t(17751),b=t(55858),f=t(84789),j=t(74076);function v({creator:{meta:{type:e}}},s){return s.reduce(((e,s)=>e&&!(0,x.o)(s)&&!(0,x.o)(s.value)&&s.isValid),s.length===(e.isPlain?0:e.asMap.hashers.length))}function y(e,s,t){let a=[];if(s.isMap){const{hashers:t,key:n}=s.asMap;a=1===t.length?[(0,h.I)(e.lookup,n)]:e.lookup.getSiType(n).def.asTuple.map((s=>(0,h.I)(e.lookup,s)))}return a.map(((e,s)=>{let n;return t&&s===a.length-1?(n=(0,m.s)(`Option<${e}>`),n.withOptionActive=!0):n=(0,m.s)(e),{name:void 0,type:n}}))}function C(e,s){const t=s.filter((({value:t},a)=>!e||a!==s.length-1||!(0,g.F)(t)));return[t,t.length===s.length]}const w=o.zo.section` + .ui--Column:last-child .ui--Labelled { + padding-left: 0.5rem; + + label { + left: 2.05rem; /* 3.55 - 1.5 (diff from padding above) */ + } + } +`,N=n.memo((function({className:e="",onAdd:s}){const{t}=l(),{api:r}=(0,c.h)(),[{defaultValues:i,isIterable:u,key:m,params:h},x]=(0,n.useState)((()=>({defaultValues:void 0,isHeadKey:!0,isIterable:!1,key:r.query.timestamp?.now||r.query.system.events,params:[]}))),[{isValid:g,values:N},k]=(0,n.useState)((()=>({isValid:!0,values:[]}))),[{blockHash:S,textHash:I},A]=(0,n.useState)({blockHash:null,textHash:""}),P=(0,n.useMemo)((()=>r.query.timestamp?.now||r.query.system?.events||r.query.substrate.changesTrieConfig),[r]),[E,M,T]=(0,n.useMemo)((()=>{if(g)try{const[e]=C(u,N),s=e.map((({value:e})=>e)),t=s.length!==(m.creator.meta.type.isPlain?0:m.creator.meta.type.asMap.hashers.length);return[t,t&&m.creator.iterKey?m.creator.iterKey(...s).toHex():(0,b.c)((0,f.o)(m.creator(...s))[1]),t?null:m.creator.inspect(...s)]}catch{}return[!1,"0x",null]}),[u,g,m,N]),D=(0,n.useCallback)((()=>{const[e,t]=C(u,N);g&&s({blockHash:t?S:null,isConst:!1,key:m,params:e})}),[S,u,g,m,s,N]),F=(0,n.useCallback)((e=>A({blockHash:(0,j.vq)(e,256)?e:null,textHash:e})),[]),V=(0,n.useCallback)((e=>k({isValid:v(m,e),values:e})),[m]),_=(0,n.useCallback)((e=>{x(function(e,s){const{creator:{meta:{type:t},section:a}}=s,n=function(e,s){if(s.isPlain)return!0;const{hashers:t,key:a}=s.asMap;if(1===t.length)return e.lookup.getTypeDef(a).info!==p.u.Option;const n=e.lookup.getSiType(a).def.asTuple;return e.lookup.getTypeDef(n[n.length-1]).info!==p.u.Option}(e.registry,t);return{defaultValues:"session"===a&&t.isMap&&e.consts.session?.dedupKeyPrefix?[{isValid:!0,value:e.consts.session.dedupKeyPrefix.toHex()}]:null,isIterable:n,key:s,params:y(e.registry,t,n)}}(r,e)),V([])}),[V,r]),q=(0,n.useMemo)((()=>!!g&&C(u,N)[1]),[u,g,N]),{creator:{method:O,section:R}}=m;return(0,a.jsxs)(w,{className:`${e} storage--actionrow`,children:[(0,a.jsxs)("div",{className:"storage--actionrow-value",children:[(0,a.jsx)(o.nU,{defaultValue:P,label:t("selected state query"),onChange:_}),(0,a.jsx)(d.ZP,{onChange:V,onEnter:D,params:h,values:i},`${R}.${O}:params`),(0,a.jsx)(o.II,{isDisabled:!g||!q,isError:!!I&&!S,label:t("blockhash to query at"),onChange:F,placeholder:t("0x...")}),(0,a.jsxs)(o.P0,{className:"keyColumar",isPadded:!1,children:[(0,a.jsx)(o.P0.Column,{children:(0,a.jsx)(o.r_,{isDisabled:!0,label:t(E?"encoded partial key":"encoded storage key"),value:M,withCopy:!0})}),(0,a.jsx)(o.P0.Column,{children:(0,a.jsx)(o.R2,{inspect:T,label:t("encoded key details")})})]})]}),(0,a.jsx)("div",{className:"storage--actionrow-buttons",children:(0,a.jsx)(o.zx,{icon:"plus",isDisabled:!g,onClick:D})})]})}));var k=t(46610),S=t(88311);const I=n.memo((function({onAdd:e}){const{t:s}=l(),[{isValid:t,key:r},i]=(0,n.useState)((()=>({isValid:!1,key:new Uint8Array([])}))),c=(0,n.useCallback)((()=>{t&&e({isConst:!1,key:r})}),[t,r,e]),u=(0,n.useCallback)((e=>{const s=(0,k.Y)(e);i({isValid:0!==s.length,key:(0,S.N)(s)})}),[]);return(0,a.jsxs)("section",{className:"storage--actionrow",children:[(0,a.jsx)("div",{className:"storage--actionrow-value",children:(0,a.jsx)(o.II,{autoFocus:!0,label:s("hex-encoded storage key"),onChange:u,onEnter:c})}),(0,a.jsx)("div",{className:"storage--actionrow-buttons",children:(0,a.jsx)(o.zx,{icon:"plus",isDisabled:!t,onClick:c})})]})}));let A=-1;const P=n.memo((function({basePath:e,onAdd:s}){const{t}=l(),i=(0,n.useRef)([{isRoot:!0,name:"modules",text:t("Storage")},{name:"constants",text:t("Constants")},{name:"raw",text:t("Raw storage")}]),c=(0,n.useCallback)((e=>s({...e,id:++A})),[s]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.mQ,{basePath:e,items:i.current}),(0,a.jsx)(r.Z5,{children:(0,a.jsxs)(r.AW,{path:e,children:[(0,a.jsx)(r.AW,{element:(0,a.jsx)(u,{onAdd:c}),path:"constants"}),(0,a.jsx)(r.AW,{element:(0,a.jsx)(I,{onAdd:c}),path:"raw"}),(0,a.jsx)(r.AW,{element:(0,a.jsx)(N,{onAdd:c}),index:!0})]})})]})}));var E=t(69356),M=t(83488),T=t(19729),D=t(48358),F=t(56623);const V=[];function _(e,s){if(e){const e=s;return`const ${e.section}.${e.method}`}const t=s;if((0,D.U)(t)){const[,e]=(0,f.o)(t);return 58===e[0]?(0,F.z)(e):(0,b.c)(e)}return`${t.creator.section}.${t.creator.method}`}function q(e,{meta:s}){return(0,h.I)(e.lookup,s.type)}function O(e,{creator:{meta:{modifier:s,type:t}}}){const a=(0,T.P)(e,t);return s.isOptional?`Option<${a}>`:a}function R(e,s){const{blockHash:t,id:n,isConst:o,key:r,params:i=[]}=s;if(!V[n]){let n,l;if(o){const{method:s,section:t}=r;n=(0,E.withCallDiv)(`consts.${t}.${s}`,{withIndicator:!0}),l=q(e,r)}else{if((0,D.U)(r))n=(0,E.withCallDiv)("rpc.state.subscribeStorage",{paramName:"params",paramValid:!0,params:[[r]],transform:([e])=>e,withIndicator:!0});else{const e=i.map((({value:e})=>e)),{creator:{meta:{type:s}}}=r,a=s.isPlain?0:s.asMap.hashers.length,o=e.length!==a;n=(0,E.withCallDiv)("subscribe",{paramName:"params",paramValid:!0,params:o?[r.entries,...e]:t?[r.at,t,...e]:[r,...e],withIndicator:!0})}l=r.creator?.meta?O(e,r):"Raw"}const c={className:"ui--output"},u=n((e=>(0,a.jsx)("pre",{children:(0,M.Z)(l,e)})),c);V[s.id]=function(e,s,t,n){return{Component:s,refresh:()=>n((s=>(0,a.jsx)("pre",{children:(0,M.Z)(e,s)})),t),render:e=>n(e,t)}}(l,u,c,n)}return V[n]}const z=o.zo.div` + margin-bottom: 0.25em; + + label { + text-transform: none !important; + } + + .ui.disabled.dropdown.selection { + color: #aaa; + opacity: 1; + } + + .ui--IdentityIcon { + margin: -10px 0; + vertical-align: middle; + } + + pre { + margin: 0; + + .ui--Param-text { + overflow: hidden; + text-overflow: ellipsis; + } + } + + .storage--actionrow-buttons { + margin-top: -0.25rem; /* offset parent spacing for buttons */ + } +`,H=n.memo((function({className:e="",onRemove:s,value:t}){const{api:r}=(0,c.h)(),[{Component:i},l,u]=(0,n.useMemo)((()=>[R(r.registry,t),_(t.isConst,t.key),t.isConst?q(r.registry,t.key):(0,D.U)(t.key)?"Raw":O(r.registry,t.key)]),[r,t]),d=(0,n.useCallback)((()=>{delete V[t.id],s(t.id)}),[s,t]);return i?(0,a.jsxs)(z,{className:`${e} storage--Query storage--actionrow`,children:[(0,a.jsx)("div",{className:"storage--actionrow-value",children:(0,a.jsx)(o.jN,{label:(0,a.jsxs)("div",{className:"storage--actionrow-label",children:[l,": ",u]}),children:(0,a.jsx)(i,{})})}),(0,a.jsx)("div",{className:"storage--actionrow-buttons",children:(0,a.jsx)(o.zx,{icon:"times",onClick:d},"close")})]}):null})),$=n.memo((function({onRemove:e,value:s}){return s?.length?(0,a.jsx)("section",{className:"storage--Queries",children:s.map((s=>(0,a.jsx)(H,{onRemove:e,value:s},s.id)))}):null})),L=o.zo.main` + .storage--actionrow { + align-items: flex-start; + display: flex; + + .ui--Button { + margin: 0.25rem; + } + + &.head { + flex: 1 1 100%; + margin: 0 auto; + max-width: 620px; + } + } + + .storage--actionrow-value { + flex: 1; + min-width: 0; + + .ui--output { + word-break: break-all; + } + } + + .storage--actionrow-buttons { + flex: 0; + padding: 0.5rem 0.25rem; + } +`,B=n.memo((function({basePath:e,className:s=""}){const[t,o]=(0,n.useState)([]),r=(0,n.useCallback)((e=>o((s=>[e,...s]))),[]),i=(0,n.useCallback)((e=>o((s=>s.filter((s=>s.id!==e))))),[]);return(0,a.jsxs)(L,{className:`${s} storage--App`,children:[(0,a.jsx)(P,{basePath:e,onAdd:r}),(0,a.jsx)($,{onRemove:i,value:t})]})}))},54676:(e,s,t)=>{t.d(s,{Z:()=>j});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(74421),l=t(90778),c=t(61349);function u(){return(0,c.$G)("app-sudo")}const d=r.zo.section` + align-items: flex-end; + justify-content: center; + + .summary { + text-align: center; + } + + .sudoInputAddress { + margin: -0.25rem 0.5rem -0.25rem 0; + } + + .sudoLabelled { + align-items: center; + } +`,m=n.memo((function({allAccounts:e,className:s="",isMine:t,sudoKey:o}){const{t:i}=u(),{api:c}=(0,l.h)(),[m,h]=(0,n.useState)(null);(0,n.useEffect)((()=>{o&&!m&&h(o)}),[m,o]);const p=t&&!!m&&m!==o&&e.some((e=>e===m));return(0,a.jsxs)("section",{children:[(0,a.jsx)(d,{className:`${s} ui--row`,children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.rp,{className:"sudoInputAddress",isInput:!0,label:i("sudo key"),onChange:h,type:"all",value:m}),(0,a.jsx)(r.cA,{accountId:o,icon:"sign-in-alt",isDisabled:!t||o===m,label:i("Reassign"),params:[m],tx:c.tx.sudo.setKey})]}):(0,a.jsx)(r.jN,{className:"ui--Dropdown sudoLabelled",label:i("sudo key"),withLabel:!0,children:(0,a.jsx)(r.ax,{value:o})})}),p&&(0,a.jsx)("article",{className:"warning padded",children:(0,a.jsx)("div",{children:i("You will no longer have sudo access")})})]})}));var h=t(38894),p=t(60404),x=t(95292),g=t(33661);const b=r.zo.section` + .sudoToggle { + width: 100%; + text-align: right; + } +`,f=n.memo((function({className:e,isMine:s,sudoKey:t}){const{t:o}=u(),{api:i,apiDefaultTxSudo:c}=(0,l.h)(),[d,m]=(0,h.O)(),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(x.nw),C=(0,n.useCallback)(((e=null)=>j((()=>e))),[]),w=(0,n.useCallback)(((e=x.nw)=>y(e)),[]);return s?(0,a.jsxs)(b,{className:e,children:[(0,a.jsx)(p.Z,{defaultValue:c,label:o("submit the following change"),onChange:C}),(0,g.m)(i.tx.sudo.sudoUncheckedWeight)&&(0,a.jsx)(r.Rn,{isDisabled:!d,isError:v.eq(x.nw),isZeroable:!1,label:o("unchecked weight for this call"),labelExtra:(0,a.jsx)(r.ZD,{className:"sudoToggle",label:o("with weight override"),onChange:m,value:d}),onChange:w,value:v}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(r.cA,{accountId:t,icon:"sign-in-alt",isDisabled:!f||!!d&&v.eq(x.nw),label:o(d?"Submit Sudo Unchecked":"Submit Sudo"),params:d?[f,v]:[f],tx:d?i.tx.sudo.sudoUncheckedWeight:i.tx.sudo.sudo})})]}):(0,a.jsx)("article",{className:"error padded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(r.JO,{icon:"ban"}),o("You do not have access to the current sudo key")]})})})),j=n.memo((function({basePath:e}){const{t:s}=u(),{allAccounts:t,hasSudoKey:l,sudoKey:c}=(0,i.p)(),d=(0,n.useRef)([{isRoot:!0,name:"index",text:s("Sudo access")},{name:"key",text:s("Set sudo key")}]);return(0,a.jsxs)("main",{children:[(0,a.jsx)(r.mQ,{basePath:e,items:d.current}),l?(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(m,{allAccounts:t,isMine:l,sudoKey:c}),path:"key"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(f,{isMine:l,sudoKey:c}),index:!0})]})}):(0,a.jsx)("article",{className:"error padded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(r.JO,{icon:"ban"}),s("You do not have access to the current sudo key")]})})]})}))},95499:(e,s,t)=>{t.d(s,{Z:()=>f});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(70563),c=t(9118),u=t(51985);const d=n.memo((function({className:e="",members:s,prime:t}){const{t:o}=(0,u.$)(),i=(0,n.useRef)([[o("members"),"start",3]]);return(0,a.jsx)(r.iA,{className:e,empty:s&&o("No members found"),header:i.current,isSplit:!0,children:s?.map((e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(r.N,{value:e})}),(0,a.jsx)("td",{children:t===e&&(0,a.jsx)(r.Vp,{color:"green",hover:o("Committee prime member, default voting"),label:o("prime member")})}),(0,a.jsx)("td",{className:"all",children:" "})]},e)))})}));var m=t(14681);const h=n.memo((function({className:e="",members:s,proposalHashes:t,type:n}){const{t:o}=(0,u.$)(),{api:l}=(0,i.h)(),d=(0,c.W7)(l.derive[n].proposalCount);return(0,a.jsxs)(r.Ty,{className:e,children:[(0,a.jsx)(r.Jy,{label:o("members"),children:(0,m.u)(s.length)}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:o("proposals"),children:t?(0,m.u)(t?.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{label:o("total"),children:d?(0,m.u)(d):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]})]})})),p=n.memo((function({className:e="",isMember:s,members:t,prime:n,proposalHashes:o,type:r}){return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(h,{isMember:s,members:t,proposalHashes:o,type:r}),(0,a.jsx)(d,{members:t,prime:n})]})}));var x=t(92858);const g=[],b=["proposals"],f=n.memo((function({basePath:e,className:s,type:t}){const{t:d}=(0,u.$)(),{api:m}=(0,i.h)(),{isMember:h,members:f,prime:j}=(0,l.V)(t),v=(0,c.W7)(m.derive[t].hasProposals),y=(0,c.W7)(m.derive[t].proposalHashes),C=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:d("Overview")},{name:"proposals",text:d("Proposals ({{count}})",{replace:{count:y?.length||0}})}]),[y,d]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,hidden:v?g:b,items:C}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(x.Z,{isMember:h,members:f,prime:j,proposalHashes:y,type:t}),path:"proposals"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(p,{isMember:h,members:f,prime:j,proposalHashes:y,type:t}),index:!0})]})})]})}))},92858:(e,s,t)=>{t.d(s,{Z:()=>S});var a=t(52322),n=t(2784),o=t(64348),r=t(51985),i=t(92914),l=t(90778),c=t(9118),u=t(87660),d=t(81190),m=t(65874),h=t(14681),p=t(38894),x=t(56949),g=t(81661);const b=n.memo((function({hasFailed:e,hash:s,idNumber:t,proposal:i,type:c}){const{t:u}=(0,r.$)(),{api:m}=(0,l.h)(),[h,b]=(0,p.O)(),[f,j]=(0,n.useState)(null),{encodedCallLength:v,weight:y}=(0,x.h7)(i),C=(0,d.m)(c);return C?(0,a.jsxs)(a.Fragment,{children:[h&&(0,a.jsxs)(o.u_,{header:u("Close proposal"),onClose:b,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:u("The proposal that will be affected. Once closed for the current voting round, it would need to be re-submitted for a subsequent voting round."),children:(0,a.jsx)(g.Z,{idNumber:t,proposal:i})}),(0,a.jsx)(o.u_.Columns,{hint:u("The committee account that will apply the close for the current round."),children:(0,a.jsx)(o.rp,{label:u("close from account"),onChange:j,type:"account"})})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:f,isDisabled:!e&&!v,onStart:b,params:4===m.tx[C].close.meta.args.length?e?[s,t,0,0]:[s,t,y,v]:[s,t],tx:m.tx[C].closeOperational||m.tx[C].close})})]}),(0,a.jsx)(o.zx,{icon:"times",label:u("Close"),onClick:b})]}):null}));var f=t(34814);const j=n.memo((function({hash:e,isMember:s,members:t,prime:i,proposalId:c,type:u}){const{t:m}=(0,r.$)(),{api:h}=(0,l.h)(),{hasAccounts:x}=(0,f.x)(),[g,b]=(0,n.useState)(null),[j,v]=(0,p.O)(),y=(0,d.m)(u);return y&&x?(0,a.jsxs)(a.Fragment,{children:[j&&(0,a.jsxs)(o.u_,{header:m("Vote on proposal"),onClose:v,size:"small",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.UE,{filter:t,onChange:b}),g===i&&(0,a.jsx)(o.Pd,{content:m("You are voting with this collective's prime account. The vote will be the default outcome in case of any abstentions.")})]}),(0,a.jsxs)(o.u_.Actions,{children:[(0,a.jsx)(o.cA,{accountId:g,icon:"ban",label:m("Vote Nay"),onStart:v,params:[e,c,!1],tx:h.tx[y].vote}),(0,a.jsx)(o.cA,{accountId:g,icon:"check",label:m("Vote Aye"),onStart:v,params:[e,c,!0],tx:h.tx[y].vote})]})]}),(0,a.jsx)(o.zx,{icon:"check",isDisabled:!s,label:m("Vote"),onClick:v})]}):null})),v=n.memo((function({className:e="",imageHash:s,isMember:t,members:n,prime:r,type:p}){const{api:x}=(0,l.h)(),g=(0,c.W7)(x.derive[p].proposal,[s]),{hasFailed:f,isCloseable:v,isVoteable:y,remainingBlocks:C}=(0,u.I)(g?.votes,n.length,p);if(!(0,d.m)(p)||!g?.votes)return null;const{ayes:w,end:N,index:k,nays:S,threshold:I}=g.votes;return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(o.iA.Column.Id,{value:k}),(0,a.jsx)(i.Z,{imageHash:s,isCollective:!0,proposal:g.proposal}),(0,a.jsxs)("td",{className:"number",children:[(0,h.u)(w.length),"/",(0,h.u)(I)]}),(0,a.jsx)("td",{className:"number together",children:C&&N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{value:C}),"#",(0,h.u)(N)]})}),(0,a.jsx)("td",{className:"address",children:w.map(((e,s)=>(0,a.jsx)(o.ax,{value:e,withBalance:!1},`${s}:${e.toHex()}`)))}),(0,a.jsx)("td",{className:"address",children:S.map(((e,s)=>(0,a.jsx)(o.ax,{value:e,withBalance:!1},`${s}:${e.toHex()}`)))}),(0,a.jsxs)("td",{className:"button",children:[y&&!v&&(0,a.jsx)(j,{hash:s,isMember:t,members:n,prime:r,proposalId:k,type:p}),v&&(0,a.jsx)(b,{hasFailed:f,hash:s,idNumber:k,proposal:g.proposal,type:p})]})]})}));var y=t(65121),C=t(60404),w=t(48801),N=t.n(w);const k=n.memo((function({defaultThreshold:e=.5,defaultValue:s,filter:t,isMember:i,members:c,type:u}){const{t:m}=(0,r.$)(),{api:h,apiDefaultTxSudo:p}=(0,l.h)(),{isOpen:x,onClose:g,onOpen:b}=(0,y.d)(),[f,j]=(0,n.useState)(null),[{proposal:v,proposalLength:w},k]=(0,n.useState)({proposalLength:0}),[[S,I],A]=(0,n.useState)([new(N())(Math.min(c.length,c.length*e+1)),!0]),P=(0,d.m)(u),E=(0,n.useCallback)((e=>!!e&&!e.isZero()&&e.lten(c.length)),[c]),M=(0,n.useCallback)((e=>k({proposal:e,proposalLength:e?.length||0})),[]),T=(0,n.useCallback)((e=>A([e||null,E(e)])),[E]);return P?(0,a.jsxs)(a.Fragment,{children:[x&&(0,a.jsxs)(o.u_,{header:m("Propose a committee motion"),onClose:g,children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.rp,{filter:c,label:m("propose from account"),onChange:j,type:"account",withLabel:!0}),(0,a.jsx)(o.Rn,{className:"medium",isError:!I,label:m("threshold"),onChange:T,placeholder:m("Positive number between 1 and {{count}}",{replace:{count:c.length}}),value:S||void 0}),(0,a.jsx)(C.Z,{defaultValue:s||p,filter:t,label:m("proposal"),onChange:M})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:f,isDisabled:!I||!v,onStart:g,params:3===h.tx[P].propose.meta.args.length?[S,v,w]:[S,v],tx:h.tx[P].propose})})]}),(0,a.jsx)(o.zx,{icon:"plus",isDisabled:!i,label:m("Submit proposal"),onClick:b})]}):null})),S=n.memo((function({className:e="",defaultProposal:s,defaultThreshold:t,filter:i,isMember:l,members:c,prime:u,proposalHashes:d,type:m}){const{t:h}=(0,r.$)(),p=(0,n.useRef)([[h("proposals"),"start",2],[h("threshold")],[h("voting end")],[h("aye"),"address"],[h("nay"),"address"],[]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(o.zx.Group,{children:(0,a.jsx)(k,{defaultThreshold:t,defaultValue:s,filter:i,isMember:l,members:c,type:m})}),(0,a.jsx)(o.iA,{empty:d&&h("No committee proposals"),header:p.current,children:d?.map((e=>(0,a.jsx)(v,{imageHash:e,isMember:l,members:c,prime:u,type:m},e.toHex())))})]})}))},75509:(e,s,t)=>{t.d(s,{Z:()=>r});var a=t(52322),n=t(2784),o=t(95499);const r=n.memo((function({basePath:e,className:s}){return(0,a.jsx)(o.Z,{basePath:e,className:s,type:"technicalCommittee"})}))},51985:(e,s,t)=>{t.d(s,{$:()=>n});var a=t(61349);function n(){return(0,a.$G)("app-tech-comm")}},87340:(e,s,t)=>{t.d(s,{Z:()=>i});var a=t(90778),n=t(9118),o=t(11677);const r={transform:e=>e.length},i=(0,o.e)("useCounter",(function(){const{api:e,isApiReady:s}=(0,a.h)();return(0,n.W7)(s&&e.derive.technicalCommittee?.proposals,void 0,r)||0}))},74425:(e,s,t)=>{t.d(s,{Z:()=>J});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(90778),l=t(70563),c=t(33661),u=t(9118),d=t(38894),m=t(95292),h=t(61349);function p(){return(0,h.$G)("app-treasury")}const x=n.memo((function({className:e}){const{t:s}=p(),{api:t}=(0,i.h)(),[o,l]=(0,n.useState)(null),[c,u]=(0,n.useState)(null),[h,x]=(0,d.O)(),[g,b]=(0,n.useState)(),f=g?.gtn(0),[j,v,y]=(0,n.useMemo)((()=>[t.consts.treasury.proposalBondMinimum.toString(),t.consts.treasury.proposalBondMaximum?.isSome?t.consts.treasury.proposalBondMaximum.unwrap().toString():null,`${t.consts.treasury.proposalBond.mul(m.S8).div(m.uy).toNumber().toFixed(2)}%`]),[t]);return(0,a.jsxs)(a.Fragment,{children:[h&&(0,a.jsxs)(r.u_,{className:e,header:s("Submit treasury proposal"),onClose:x,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:s("This account will make the proposal and be responsible for the bond."),children:(0,a.jsx)(r.rp,{label:s("submit with account"),onChange:l,type:"account",withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:s("The beneficiary will receive the full amount if the proposal passes."),children:(0,a.jsx)(r.rp,{label:s("beneficiary"),onChange:u,type:"allPlus"})}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:s("The value is the amount that is being asked for and that will be allocated to the beneficiary if the proposal is approved.")}),v?(0,a.jsx)("p",{children:s("Of the beneficiary amount, no less than the minimum bond amount and no more than maximum on-chain bond would need to be put up as collateral. This is calculated from {{bondPercentage}} of the requested amount.",{replace:{bondPercentage:y}})}):(0,a.jsx)("p",{children:s("Of the beneficiary amount, no less than the minimum bond amount would need to be put up as collateral. This is calculated from {{bondPercentage}} of the requested amount.",{replace:{bondPercentage:y}})})]}),children:[(0,a.jsx)(r.H,{isError:!f,label:s("value"),onChange:b}),(0,a.jsx)(r.qG,{label:s("proposal bond"),children:y}),(0,a.jsx)(r.H,{defaultValue:j,isDisabled:!0,label:s("minimum bond")}),v&&(0,a.jsx)(r.H,{defaultValue:v,isDisabled:!0,label:s("maximum bond")}),(0,a.jsx)(r.Pd,{content:s("Be aware that once submitted the proposal will be put to a vote. If the proposal is rejected due to a lack of info, invalid requirements or non-benefit to the network as a whole, the full bond posted (as describe above) will be lost.")})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:o,icon:"plus",isDisabled:!o||!f,label:s("Submit proposal"),onStart:x,params:[g,c],tx:t.tx.treasury.proposeSpend})})]}),(0,a.jsx)(r.zx,{icon:"plus",label:s("Submit proposal"),onClick:x})]})}));var g=t(30943),b=t(81190);const f=n.memo((function({id:e,isDisabled:s,members:t}){const{t:o}=p(),{api:l}=(0,i.h)(),[c,u]=(0,d.O)(),[m,h]=(0,n.useState)(null),[x,f]=(0,n.useState)("accept"),[{proposal:j,proposalLength:v},y]=(0,n.useState)((()=>({proposalLength:0}))),C=(0,b.m)("council"),w=Math.ceil((t?.length||0)*(0,g.mo)(l)),N=(0,n.useRef)([{text:o("Acceptance proposal to council"),value:"accept"},{text:o("Rejection proposal to council"),value:"reject"}]);return(0,n.useEffect)((()=>{const s="reject"===x?l.tx.treasury.rejectProposal(e):l.tx.treasury.approveProposal(e);y({proposal:s,proposalLength:s.length})}),[l,e,x]),C?(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsxs)(r.u_,{header:o("Send to council"),onClose:u,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o('The council member that is proposing this, submission equates to an "aye" vote.'),children:(0,a.jsx)(r.rp,{filter:t,label:o("submit with council account"),onChange:h,type:"account",withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:o("Proposal can either be to approve or reject this spend. Once approved, the change is applied by either removing the proposal or scheduling payout."),children:(0,a.jsx)(r.Lt,{label:o("council proposal type"),onChange:f,options:N.current,value:x})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,icon:"check",isDisabled:!m||!w,label:o("Send to council"),onStart:u,params:3===l.tx[C].propose.meta.args.length?[w,j,v]:[w,j],tx:l.tx[C].propose})})]}),(0,a.jsx)(r.zx,{icon:"step-forward",isDisabled:s,label:o("To council"),onClick:u})]}):null})),j=n.memo((function({className:e="",isMember:s,members:t,proposal:{council:o,id:l,proposal:u},withSend:m}){const{t:h}=p(),{api:x}=(0,i.h)(),[g,b]=(0,d.O)(!1),j=(0,c.m)(x.tx.council?.propose),v=(0,n.useMemo)((()=>!!o.map((({votes:e})=>e?e.index.toNumber():-1)).filter((e=>-1!==e)).length),[o]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${e} isExpanded isFirst ${g?"":"isLast"}`,children:[(0,a.jsx)(r.iA.Column.Id,{value:l}),(0,a.jsx)("td",{className:"address all",children:(0,a.jsx)(r.N,{value:u.beneficiary})}),(0,a.jsx)(r.iA.Column.Balance,{value:u.value}),(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(r.ax,{balance:u.bond,value:u.proposer,withBalance:!0})}),(0,a.jsx)("td",{className:v?"middle":"button",children:j?v?(0,a.jsx)("a",{href:"#/council/motions",children:h("Voting")}):m&&(0,a.jsx)(f,{id:l,isDisabled:!s,members:t}):null}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:g,toggle:b})]}),(0,a.jsxs)("tr",{className:`${e} ${g?"isExpanded isLast":"isCollapsed"} packedTop`,children:[(0,a.jsx)("td",{}),(0,a.jsx)("td",{className:"columar",colSpan:4,children:(0,a.jsx)(r.P0,{is100:!0,children:(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(r.NR,{data:l,type:"treasury",withTitle:!0})})})}),(0,a.jsx)("td",{})]})]})})),v=n.memo((function({className:e="",isApprovals:s,isMember:t,members:o,proposals:i}){const{t:l}=p(),c=(0,n.useMemo)((()=>[[l(s?"Approved":"Proposals"),"start",2],[],[l("proposer"),"address"],[],[]]),[s,l]);return(0,a.jsx)(r.iA,{className:e,empty:i&&l(s?"No approved proposals":"No pending proposals"),header:c,children:i?.map((e=>(0,a.jsx)(j,{isMember:t,members:o,proposal:e,withSend:!s},e.id.toString())))})}));var y=t(54383),C=t(68920),w=t(58607),N=t(14681);const k=n.memo((function({approvalCount:e,proposalCount:s}){const{t}=p(),{api:o}=(0,i.h)(),l=(0,y.C)(),c=(0,u.W7)(o.query.treasury.proposalCount),{burn:d,pendingBounties:h,pendingProposals:x,spendPeriod:g,value:b}=(0,C._)(),f=(0,n.useMemo)((()=>b?.sub(h).sub(x)),[b,h,x]),j=!(!b||!f);return(0,a.jsxs)(r.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{className:"media--1700",label:t("open"),children:void 0===s?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,N.u)(s)}),(0,a.jsx)(r.Jy,{className:"media--1600",label:t("approved"),children:void 0===e?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,N.u)(e)}),(0,a.jsx)(r.Jy,{className:"media--1400",label:t("total"),children:void 0===c?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,N.u)(c)})]}),(0,a.jsxs)("section",{children:[!x.isZero()&&(0,a.jsx)(r.Jy,{className:"media--1100",label:t("approved"),children:(0,a.jsx)(w.Z,{value:x,withSi:!0})}),!h.isZero()&&(0,a.jsx)(r.Jy,{className:"media--1200",label:t("bounties"),children:(0,a.jsx)(w.Z,{value:h,withSi:!0})}),(0,a.jsx)(r.Jy,{className:"media--1300",label:t("next burn"),children:(0,a.jsx)(w.Z,{className:d?"":"--tmp",value:d||1,withSi:!0})})]}),(0,a.jsx)("section",{children:(0,a.jsx)(r.Jy,{label:t("spendable / available"),progress:{hideValue:!0,isBlurred:!j,total:j?b:m.Jo,value:j?f:m.um},children:(0,a.jsxs)("span",{className:j?"":"--tmp",children:[(0,a.jsx)(w.Z,{value:f||m.um,withSi:!0}),(0,a.jsx)(a.Fragment,{children:" / "}),(0,a.jsx)(w.Z,{value:b||m.Jo,withSi:!0})]})})}),l&&g.gt(m.nw)&&(0,a.jsx)("section",{children:(0,a.jsx)(r.Jy,{label:t("spend period"),progress:{total:g,value:l.mod(g),withTime:!0}})})]})})),S=n.memo((function({className:e,isMember:s,members:t}){const{api:n}=(0,i.h)(),o=(0,u.W7)(n.derive.treasury.proposals);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(k,{approvalCount:o?.approvals.length,proposalCount:o?.proposals.length}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(x,{})}),(0,a.jsx)(v,{isMember:s,members:t,proposals:o?.proposals}),(0,a.jsx)(v,{isApprovals:!0,isMember:s,members:t,proposals:o?.approvals})]})}));var I=t(34814),A=t(79760);const P=n.memo((function({members:e}){const{t:s}=p(),{api:t}=(0,i.h)(),[o,l]=(0,d.O)(),[c,u]=(0,n.useState)(null),[h,x]=(0,n.useState)(null),[g,b]=(0,n.useState)(""),[f,j]=(0,n.useState)(),v=(0,n.useMemo)((()=>Math.min(256,(t.consts.tips||t.consts.treasury)?.maximumReasonLength?.toNumber()||256)),[t]),y=(0,n.useMemo)((()=>!!c&&e.includes(c)),[c,e]),C=!!f&&f.gt(m.nw),w=!!g&&g.length>=5&&g.length<=v;return t.tx.tips.tipNew||t.tx.treasury.tipNew?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",label:s("Propose tip"),onClick:l}),o&&(0,a.jsxs)(r.u_,{header:s("Submit tip request"),onClose:l,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:s("Use this account to request the tip from. This can be a normal or council account."),children:(0,a.jsx)(r.rp,{label:s("submit with account"),onChange:u,type:"account",withLabel:!0})}),(0,a.jsx)(r.u_.Columns,{hint:s("The beneficiary will received the tip as approved by council members."),children:(0,a.jsx)(r.rp,{label:s("beneficiary"),onChange:x,type:"allPlus"})}),(0,a.jsx)(r.u_.Columns,{hint:s("A reason (to be stored-on-chain) as to why the recipient deserves a tip payout."),children:(0,a.jsx)(r.II,{autoFocus:!0,isError:!w,label:s("tip reason"),onChange:b})}),y&&(0,a.jsx)(r.u_.Columns,{hint:s("As a council member, you can suggest an initial value for the tip, each other council member can suggest their own."),children:(0,a.jsx)(r.H,{isError:!C,label:s("tip value"),onChange:j})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:c,icon:"plus",isDisabled:!c||y&&!C||!w,label:s("Propose tip"),onStart:l,params:y?[g,h,f]:[g,h],tx:y?(t.tx.tips||t.tx.treasury).tipNew:(t.tx.tips||t.tx.treasury).reportAwesome})})]})]}):null}));var E=t(65874);const M={transform:({freeBalance:e,reservedBalance:s})=>e.add(s)},T=n.memo((function({defaultId:e,hash:s,isMember:t,isTipped:o,median:l,members:c,recipient:m}){const{t:h}=p(),{api:x}=(0,i.h)(),[g,b]=(0,d.O)(),[f,j]=(0,n.useState)(e),[v,y]=(0,n.useState)(),C=(0,u.W7)(x.derive.balances?.all,[m],M),w=(x.tx.tips||x.tx.treasury).tip;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"check",isDisabled:!t,label:h("Tip"),onClick:b}),(0,a.jsx)(r.cA,{accountId:e,className:"media--1600",icon:"fighter-jet",isDisabled:!t||!o,isIcon:!0,params:[s,l],tx:w,withoutLink:!0}),g&&(0,a.jsxs)(r.u_,{header:h("Submit tip endorsement"),onClose:b,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:h("Your endorsement will be applied for this account."),children:(0,a.jsx)(r.rp,{filter:c,label:h("submit with account"),onChange:j,type:"account",withLabel:!0})}),(0,a.jsxs)(r.u_.Columns,{hint:h("Allocate a suggested tip amount. With enough endorsements, the suggested values are averaged and sent to the beneficiary."),children:[(0,a.jsx)(r.H,{autoFocus:!0,defaultValue:l,isZeroable:!0,label:h("value"),onChange:y}),C&&C.isZero()&&(0,a.jsx)(r.Pd,{content:h("The recipient account has no balance, ensure the tip is more than the existential deposit to create the account.")})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:f,icon:"plus",isDisabled:!f,label:h("Submit tip"),onStart:b,params:[s,v],tx:w})})]})]})}));var D=t(94158);const F={transform:e=>e.isSome?(0,D.r)(e.unwrap().toHex()):null},V=n.memo((function({hash:e}){const{api:s}=(0,i.h)(),t=(0,u.W7)((s.query.tips||s.query.treasury).reasons,[e],F);return(0,a.jsx)("td",{className:"start all",children:t||e.toHex()})})),_=r.zo.tr` + .closingTimer { + display: inline-block; + padding: 0 0.5rem; + } +`,q=n.memo((function({bestNumber:e,className:s="",defaultId:t,hash:o,isMember:l,members:c,onSelect:u,onlyUntipped:d,tip:h}){const{api:x}=(0,i.h)(),{t:g}=p(),{allAccounts:b}=(0,I.x)(),{closesAt:f,finder:j,isFinder:v,isTipped:y,isTipper:C,median:k}=(0,n.useMemo)((()=>function(e,s){const t=e.closes.unwrapOr(null);let a=null,n=null;if(function(e){return!!e?.findersFee}(e))a=e.finder,n=e.deposit;else if(e.finder.isSome){const s=e.finder.unwrap();a=s[0],n=s[1]}const o=e.tips.map((([,e])=>e)).sort(((e,s)=>e.cmp(s))),r=Math.floor(o.length/2),i=o.length?o.length%2?o[r]:o[r-1].add(o[r]).divn(2):m.nw;return{closesAt:t,deposit:n,finder:a,isFinder:!!a&&s.includes(a.toString()),isTipped:!!o.length,isTipper:e.tips.some((([e])=>s.includes(e.toString()))),median:i}}(h,b)),[b,h]),S=(0,n.useMemo)((()=>b.find((e=>c.includes(e)))||null),[b,c]),[A,P]=(0,n.useState)(!1),M=(0,n.useCallback)((()=>h.tips.map((([e,s])=>(0,a.jsx)(r.ax,{balance:s,value:e,withBalance:!0},e.toString())))),[h]);if((0,n.useEffect)((()=>{u(o,A,k)}),[o,A,k,u]),(0,n.useEffect)((()=>{P(l&&!C)}),[l,C]),d&&!f&&C)return null;const{reason:D,tips:F,who:q}=h,O=q.toString();return(0,a.jsxs)(_,{className:s,children:[(0,a.jsx)("td",{className:"address",children:(0,a.jsx)(r.N,{value:q})}),(0,a.jsx)("td",{className:"address media--1400",children:j&&(0,a.jsx)(r.ax,{value:j})}),(0,a.jsx)(V,{hash:D}),(0,a.jsx)("td",{className:"expand media--1100",children:0!==F.length&&(0,a.jsx)(r.n0,{renderChildren:M,summary:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{children:g("Tippers ({{count}})",{replace:{count:F.length}})}),(0,a.jsx)(w.Z,{value:k})]})})}),(0,a.jsxs)("td",{className:"button together",children:[f?e&&f.gt(e)&&(0,a.jsxs)("div",{className:"closingTimer",children:[(0,a.jsx)(E.Z,{value:f.sub(e)}),"#",(0,N.u)(f)]}):j&&v&&(0,a.jsx)(r.cA,{accountId:j,className:"media--1400",icon:"times",label:g("Cancel"),params:[o],tx:(x.tx.tips||x.tx.treasury).retractTip}),f&&e&&!f.gt(e)?(0,a.jsx)(r.cA,{accountId:S,icon:"times",label:g("Close"),params:[o],tx:(x.tx.tips||x.tx.treasury).closeTip}):(0,a.jsx)(T,{defaultId:t,hash:o,isMember:l,isTipped:y,median:k,members:c,recipient:O})]}),(0,a.jsx)("td",{className:"badge media--1700",children:l&&(0,a.jsx)(r.JO,{color:C?"green":"gray",icon:"asterisk"})}),(0,a.jsx)("td",{children:(0,a.jsx)(r.XZ,{isDisabled:!l,onChange:P,value:A})}),(0,a.jsx)("td",{className:"links media--1700",children:(0,a.jsx)(r.NR,{data:o,type:"tip"})})]})})),O={withParams:!0},R=(0,r.zo)(r.iA)` + .tipsFilter { + text-align: right; + + .ui--Toggle { + margin-right: 1rem; + margin-top: 0.75rem; + } + } +`,z=n.memo((function({className:e="",defaultId:s,hashes:t,isMember:o,members:l,onSelectTip:c}){const{t:d}=p(),{api:m}=(0,i.h)(),[h,x]=(0,n.useState)(!1),g=(0,y.C)(),b=(0,u.W7)(t&&(m.query.tips||m.query.treasury).tips.multi,[t],O),f=(0,n.useMemo)((()=>function(e,s){if(!e||!s)return;const[[t],a]=e;return a.map(((e,s)=>[t[s],e.unwrapOr(null)])).filter((e=>s.includes(e[0])&&!!e[1])).sort(((e,s)=>e[1].closes.isNone?s[1].closes.isNone?0:-1:s[1].closes.isSome?s[1].closes.unwrap().cmp(e[1].closes.unwrap()):1))}(b,t)),[t,b]),j=(0,n.useRef)([[d("tips"),"start"],[d("finder"),"address media--1400"],[d("reason"),"start"],[void 0,"media--1100"],[],[void 0,"badge media--1700"],[],[void 0,"media--1700"]]);return(0,a.jsx)(R,{className:e,empty:f&&d("No open tips"),filter:o&&(0,a.jsx)("div",{className:"tipsFilter",children:(0,a.jsx)(r.ZD,{label:d("show only untipped/closing"),onChange:x,value:h})}),header:j.current,children:f?.map((([e,t])=>(0,a.jsx)(q,{bestNumber:g,defaultId:s,hash:e,isMember:o,members:l,onSelect:c,onlyUntipped:h,tip:t},e)))})})),H={quickTips:{},quickTxs:[]},$=n.memo((function({className:e,hashes:s,isMember:t,members:o}){const{t:l}=p(),{allAccounts:c}=(0,I.x)(),{api:u}=(0,i.h)(),[{quickTxs:d},m]=(0,n.useState)(H),h=(0,A.b)(d),x=(0,n.useMemo)((()=>o.find((e=>c.includes(e)))||null),[c,o]),g=(0,n.useCallback)(((e,s,t)=>m((({quickTips:a})=>(a[e]=s?t:null,{quickTips:a,quickTxs:Object.entries(a).map((([e,s])=>s&&(u.tx.tips||u.tx.treasury).tip(e,s))).filter((e=>!!e))})))),[u]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(P,{members:o}),(0,a.jsx)(r.cA,{accountId:x,extrinsic:h,icon:"fighter-jet",isDisabled:!t||!h,label:l("Median tip selected")})]}),(0,a.jsx)(z,{defaultId:x,hashes:s,isMember:t,members:o,onSelectTip:g})]})}));var L=t(24305),B=t(12298),Z=t(11677);const W={transform:e=>e.map((({args:[e]})=>e.toHex()))},U=(0,Z.e)("useTipHashes",(function(){const{api:e}=(0,i.h)(),s=(0,L.b)([e.events.tips?.NewTip,e.events.tips?.TipClosed,e.events.tips?.TipRetracted]);return(0,B.k)((e.query.tips||e.query.treasury)?.tips,[],W,s.blockHash)})),J=n.memo((function({basePath:e}){const{t:s}=p(),{api:t}=(0,i.h)(),{isMember:u,members:d}=(0,l.V)("council"),m=U(),h=(0,n.useMemo)((()=>[{isRoot:!0,name:"overview",text:s("Overview")},(0,c.m)((t.query.tips||t.query.treasury)?.tips)&&{count:m?.length,name:"tips",text:s("Tips")}].filter((e=>!!e))),[t,s,m]);return(0,a.jsxs)("main",{className:"treasury--App",children:[(0,a.jsx)(r.mQ,{basePath:e,items:h}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)($,{hashes:m,isMember:u,members:d}),path:"tips"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(S,{isMember:u,members:d}),index:!0})]})})]})}))},9039:(e,s,t)=>{t.d(s,{Z:()=>i});var a=t(2784),n=t(34814),o=t(90778),r=t(9118);const i=(0,t(11677).e)("useCounter",(function(){const{hasAccounts:e}=(0,n.x)(),{api:s,isApiReady:t}=(0,o.h)(),i=(0,r.W7)(t&&e&&s.derive.treasury?.proposals);return(0,a.useMemo)((()=>i?.proposals.length||0),[i])}))},26822:(e,s,t)=>{t.d(s,{Z:()=>S});var a=t(52322),n=t(2784),o=t(73557),r=t(64348),i=t(35189),l=t(9242),c=t(72570),u=t(90778),d=t(55858),m=t(14681),h=t(61162),p=t(70416),x=t(66850),g=t(94175),b=t(90107),f=t(61349);function j(){return(0,f.$G)("app-utilities")}const v=n.memo((function({className:e}){const{t:s}=j(),{chainSS58:t}=(0,u.h)(),[{inputSS58:o,publicKey:f},v]=(0,n.useState)({inputSS58:42,publicKey:null}),[y,C]=(0,n.useState)(-1),w=(0,n.useCallback)((e=>v(function(e){try{if(e&&(0,h.U)(e)){const s=(0,p.MW)(e),[,,,t]=(0,x.l)(s),a=(0,g.m)(e);return{inputSS58:t,publicKey:(0,d.c)(a)}}}catch{}return{inputSS58:42,publicKey:null}}(e))),[]),N=(0,n.useMemo)((()=>{const e=c.FA.find((({prefix:e})=>e===t));return(0,l.M)(s).map((s=>(0,i.SX)(s,["default"],"empty",-1===s.value?e?` (${e.displayName}, ${t||0})`:` (${t||0})`:` (${s.value})`)))}),[t,s]),k=(0,n.useMemo)((()=>f&&(0,b.m)(f,-1===y?t:y)),[t,y,f]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.bm,{autoFocus:!0,isError:!f,label:s("address to convert"),noConvert:!0,onChange:w})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.Lt,{defaultValue:y,label:s("address prefix"),onChange:C,options:N})}),f&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.qG,{className:"medium",label:s("input ss58 prefix"),value:(0,m.u)(o)})}),k&&(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.bm,{defaultValue:k,isDisabled:!0,label:s("converted address")},k)}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.qG,{className:"full",label:s("hex public key"),value:f})})]})]})}));var y=t(64021),C=t(74076),w=t(48533),N=t(34323);const k=n.memo((function({className:e}){const{t:s}=j(),[{data:t,hash:o,isHexData:i},l]=(0,n.useState)({data:"",hash:(0,N.$)((0,y.d)(""),256),isHexData:!1}),c=(0,n.useCallback)((e=>{const s=(0,C.vq)(e);l({data:e,hash:(0,N.$)(s?(0,w.G)(e):(0,y.d)(e),256),isHexData:s})}),[]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.II,{autoFocus:!0,className:"full",label:s("from the following data"),onChange:c,value:t})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.qG,{className:"medium",label:s("hex input data"),value:s(i?"Yes":"No")})}),(0,a.jsx)("div",{className:"ui--row",children:(0,a.jsx)(r.r_,{className:"full",isHidden:0===o.length,isMonospace:!0,label:s("the resulting hash is"),value:o,withCopy:!0})})]})})),S=n.memo((function({basePath:e,className:s}){const{t}=j(),i=(0,n.useRef)([{isRoot:!0,name:"convert",text:t("Convert address")},{name:"hash",text:t("Hash data")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(r.mQ,{basePath:e,items:i.current}),(0,a.jsx)(o.Z5,{children:(0,a.jsxs)(o.AW,{path:e,children:[(0,a.jsx)(o.AW,{element:(0,a.jsx)(k,{}),path:"hash"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(v,{}),index:!0})]})})]})}))},7644:(e,s,t)=>{t.d(s,{Z:()=>C});var a=t(52322),n=t(2784),o=t(64348),r=t(61349);function i(){return(0,r.$G)("app-whitelist")}var l=t(90778),c=t(12298),u=t(39824),d=t(11677);const m={transform:e=>e.map((({args:[e]})=>e))};function h(e){const s=[],t=[];return e.forEach((({event:{data:[e],method:a}})=>{"CallWhitelisted"===a?s.push(e):t.push(e)})),{added:s,removed:t}}const p=(0,d.e)("useHashes",(function(){const{api:e}=(0,l.h)(),s=(0,c.k)(e.query.whitelist.whitelistedCall,[],m),t=(0,u.N)([e.events.whitelist.CallWhitelisted,e.events.whitelist.WhitelistedCallRemoved],h,s);return(0,n.useMemo)((()=>t?.map((e=>e.toHex()))),[t])}));var x=t(69338),g=t(74525),b=t(31313);const f=n.memo((function({className:e,value:s}){const t=(0,b.CH)(s);return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(g.Z,{value:s}),(0,a.jsx)(x.Z,{value:t})]})}));var j=t(14681);const v=n.memo((function({className:e,hashes:s}){const{t}=i();return(0,a.jsx)(o.Ty,{className:e,children:(0,a.jsx)(o.Jy,{label:t("hashes"),children:void 0===s?(0,a.jsx)("span",{className:"--tmp",children:"99"}):(0,j.u)(s.length)})})})),y=n.memo((function({className:e}){const{t:s}=i(),t=p(),r=(0,n.useRef)([[s("calls"),"start"],[void 0,"all"],[void 0,"media--1300"]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(v,{hashes:t}),(0,a.jsx)(o.iA,{className:e,empty:t&&s("No call hashes found"),header:r.current,children:t?.map((e=>(0,a.jsx)(f,{value:e},e)))})]})})),C=n.memo((function({basePath:e,className:s}){const{t}=i(),r=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")}]);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:r.current}),(0,a.jsx)(y,{})]})}))}}]); \ No newline at end of file