diff --git a/comm.c665fded6ee4c85d.js b/comm.82cfedac0b05d10b.js similarity index 84% rename from comm.c665fded6ee4c85d.js rename to comm.82cfedac0b05d10b.js index 6fb9ef328dec..bd5383e928b1 100644 --- a/comm.c665fded6ee4c85d.js +++ b/comm.82cfedac0b05d10b.js @@ -259,7 +259,51 @@ } } } -`,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` +`,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})}))},79169:(e,t,n)=>{n.d(t,{Z:()=>r});var a=n(52322),s=n(2784);const i=n(21779).z.div` + width: 100%; + .progress-container { + display: flex; + height: 1rem; + background-color: #e0e0e0; + border-radius: 0.5rem; + overflow: hidden; + position: relative; + } + + .progress-segment { + position: relative; + background-color: transparent; + height: 100%; + display: flex; + align-items: center; + } + + .progress-bar { + background-color: #007bff; + height: 100%; + transition: width 0.3s ease; + } + + .marker { + position: absolute; + left: 0; + top: -0.5rem; + width: 2px; + height: 1.5rem; + background-color: #000000; + } + + .labels { + display: flex; + justify-content: space-between; + margin-top: 0.5rem; + } + + .label { + text-align: center; + font-size: 0.875rem; + } +`,r=s.memo((function({sections:e}){const t=e?.reduce(((e,t)=>e+t.total),0);return(0,a.jsxs)(i,{children:[(0,a.jsx)("div",{className:"progress-container",children:e?.map(((e,n)=>{const s=e.total/t*100,i=e.value/e.total*100;return(0,a.jsxs)("div",{className:"progress-segment",style:{width:`${s}%`},children:[(0,a.jsx)("div",{className:"progress-bar",style:{width:`${i}%`}}),(0,a.jsx)("div",{className:"marker"})]},n)}))}),(0,a.jsx)("div",{className:"labels",children:e.map(((t,n)=>(0,a.jsx)("div",{className:"label",style:{width:100/e.length+"%"},children:t.label},n)))})]})}))},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 { @@ -1196,7 +1240,7 @@ } } } -`,$e=s.memo((function({address:e,className:t}){const{t:n}=(0,R.$)();return(0,a.jsxs)(Re,{className:t,children:[(0,a.jsx)("div",{className:"ui--AddressMenu-sectionHeader",children:n("balance")}),(0,a.jsx)(ze,{address:e,className:"balanceExpander",withBalance:Ze,withLabel:!0},e)]})}));var qe=n(11677);const He=(0,qe.e)("useRegistrars",(function(e){const{apiIdentity:t}=(0,l.h)(),{allAccounts:n,hasAccounts:a}=(0,fe.x)(),i=(0,be.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 Ue=n(19008),We=n(52953),Oe=n(74076),Qe=n(9652),Ge=n(51304),Je=n(16039),Ke=n(47025);function Ye(e){return!(!e||!e.toHuman)}const Xe=s.memo((function({className:e="",forceIconType:t,prefix:n,size:i=24,theme:r,value:o}){const{apiEndpoint:c,isEthereum:d,specName:u,systemName:m}=(0,l.h)(),{t:h}=(0,R.$)(),{queueAction:p}=(0,Ae.L)(),g=r||function(e,t,n){return"default"===Je.X.icon&&(e?.ui?.identityIcon||(0,Qe.t)(t,n))||Je.X.icon}(c,m,u),f="robohash"===g?Ke.Z:void 0,b=(0,s.useCallback)((e=>p({account:e,action:h("clipboard"),message:h("address copied"),status:"queued"})),[p,h]);return(0,a.jsx)(Ge.ZP,{Custom:f,className:`ui--Identicon-React-Base ${e}`,onCopy:b,prefix:n,size:i,theme:t||(d?"ethereum":g),value:Ye(o)?o.toString():o})}));var _e=n(36609);function et({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)),ie.nw).gtn(0);t&&(s=e.map(((e,t)=>(0,a.jsx)(ne.Z,{value:e},t))))}return(0,a.jsx)(ne.Z,{className:`${e} ui--Balance`,label:t,value:Array.isArray(n)?n[0]:n,children:s&&(0,a.jsxs)("span",{children:[" (+",s,")"]})})}const tt=s.memo((function(e){const{balance:t,className:n="",label:s,params:i}=e;return i?t?(0,a.jsx)(a.Fragment,{children:et({className:n,label:s,value:t})}):(0,a.jsx)(_e.Z,{className:`${n} ui--Balance`,label:s,params:i}):null})),nt={transform:e=>e.unwrapOr(null)},at={transform:e=>e.unwrapOr(null)},st=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,l.h)(),r=(0,be.W7)(i.query.staking?.bonded,[s],nt),o=(0,be.W7)(r&&i.query.staking?.ledger,[r],at);return(0,a.jsx)(ne.Z,{className:t,label:n,value:o?.active,children:e})})),it=s.memo((function(e){const{bonded:t,className:n="",label:s,params:i}=e;return i?t?(0,a.jsx)(a.Fragment,{children:et({className:n,label:s,value:t})}):(0,a.jsx)(st,{className:`${n} ui--Bonded`,label:s,params:i}):null})),rt=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,l.h)(),r=(0,be.W7)(i.derive.council.votesOf,[s]);return r?.stake.gtn(0)?(0,a.jsx)(ne.Z,{className:t,label:n,value:r?.stake,children:e}):null})),ot=s.memo((function({className:e="",label:t,params:n}){return n?(0,a.jsx)(rt,{className:`${e} ui--LockedVote`,label:t,params:n}):null})),lt=y.z.div` +`,$e=s.memo((function({address:e,className:t}){const{t:n}=(0,R.$)();return(0,a.jsxs)(Re,{className:t,children:[(0,a.jsx)("div",{className:"ui--AddressMenu-sectionHeader",children:n("balance")}),(0,a.jsx)(ze,{address:e,className:"balanceExpander",withBalance:Ze,withLabel:!0},e)]})}));var qe=n(11677);const He=(0,qe.e)("useRegistrars",(function(e){const{apiIdentity:t}=(0,l.h)(),{allAccounts:n,hasAccounts:a}=(0,fe.x)(),i=(0,be.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 Ue=n(19008),We=n(28097),Oe=n(74076),Qe=n(9652),Ge=n(51304),Je=n(16039),Ke=n(47025);function Ye(e){return!(!e||!e.toHuman)}const Xe=s.memo((function({className:e="",forceIconType:t,prefix:n,size:i=24,theme:r,value:o}){const{apiEndpoint:c,isEthereum:d,specName:u,systemName:m}=(0,l.h)(),{t:h}=(0,R.$)(),{queueAction:p}=(0,Ae.L)(),g=r||function(e,t,n){return"default"===Je.X.icon&&(e?.ui?.identityIcon||(0,Qe.t)(t,n))||Je.X.icon}(c,m,u),f="robohash"===g?Ke.Z:void 0,b=(0,s.useCallback)((e=>p({account:e,action:h("clipboard"),message:h("address copied"),status:"queued"})),[p,h]);return(0,a.jsx)(Ge.ZP,{Custom:f,className:`ui--Identicon-React-Base ${e}`,onCopy:b,prefix:n,size:i,theme:t||(d?"ethereum":g),value:Ye(o)?o.toString():o})}));var _e=n(36609);function et({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)),ie.nw).gtn(0);t&&(s=e.map(((e,t)=>(0,a.jsx)(ne.Z,{value:e},t))))}return(0,a.jsx)(ne.Z,{className:`${e} ui--Balance`,label:t,value:Array.isArray(n)?n[0]:n,children:s&&(0,a.jsxs)("span",{children:[" (+",s,")"]})})}const tt=s.memo((function(e){const{balance:t,className:n="",label:s,params:i}=e;return i?t?(0,a.jsx)(a.Fragment,{children:et({className:n,label:s,value:t})}):(0,a.jsx)(_e.Z,{className:`${n} ui--Balance`,label:s,params:i}):null})),nt={transform:e=>e.unwrapOr(null)},at={transform:e=>e.unwrapOr(null)},st=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,l.h)(),r=(0,be.W7)(i.query.staking?.bonded,[s],nt),o=(0,be.W7)(r&&i.query.staking?.ledger,[r],at);return(0,a.jsx)(ne.Z,{className:t,label:n,value:o?.active,children:e})})),it=s.memo((function(e){const{bonded:t,className:n="",label:s,params:i}=e;return i?t?(0,a.jsx)(a.Fragment,{children:et({className:n,label:s,value:t})}):(0,a.jsx)(st,{className:`${n} ui--Bonded`,label:s,params:i}):null})),rt=s.memo((function({children:e,className:t="",label:n,params:s}){const{api:i}=(0,l.h)(),r=(0,be.W7)(i.derive.council.votesOf,[s]);return r?.stake.gtn(0)?(0,a.jsx)(ne.Z,{className:t,label:n,value:r?.stake,children:e}):null})),ot=s.memo((function({className:e="",label:t,params:n}){return n?(0,a.jsx)(rt,{className:`${e} ui--LockedVote`,label:t,params:n}):null})),lt=y.z.div` overflow-x: hidden; padding: 0 0.25rem 0 1rem; text-align: left; @@ -3443,7 +3487,7 @@ border-radius: 0.15rem; background: linear-gradient(90.43deg, #FF8B00 0%, #FFBB50 112.75%); } -`,Mr=s.memo((function({className:e="",value:t}){const{t:n}=(0,R.$)(),s={width:100*function(e){const t=Tr().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")]})})),Fr=y.z.div` +`,Mr=s.memo((function({className:e="",value:t}){const{t:n}=(0,R.$)(),s={width:100*function(e){const t=Tr().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")]})}));n(79169);const Fr=y.z.div` position: relative; display: flex; flex-direction: row; @@ -3907,7 +3951,7 @@ height: 20px; background-color: ${e=>e.color}; margin-right: 10px; -`,fo=s.memo((function({data:e}){const t=2*Math.PI*50,n=e.reduce(((e,t)=>e+t.value),0);let s=0;return n?(0,a.jsxs)(uo,{children:[(0,a.jsx)(mo,{children:(0,a.jsxs)("svg",{height:100,viewBox:"0 0 100 100",width:100,children:[(0,a.jsx)("circle",{cx:50,cy:50,fill:"none",r:42.5,stroke:"#f0f0f0",strokeWidth:15}),e.map(((e,i)=>{const r=e.value/n*100,o=r/100*t,l=s/100*t;return s+=r,(0,a.jsx)("circle",{cx:50,cy:50,fill:"none",r:42.5,stroke:e.color,strokeDasharray:`${o} ${t-o}`,strokeDashoffset:-l,strokeWidth:15,transform:"rotate(-90 50 50)",children:(0,a.jsx)("title",{children:`${e.label}: ${r.toFixed(2)}%`})},i)}))]})}),(0,a.jsx)(ho,{children:e.map(((e,t)=>(0,a.jsxs)(po,{children:[(0,a.jsx)(go,{color:e.color}),(0,a.jsx)("span",{children:`${e.label}: ${(e.value/n*100).toFixed(2)}%`})]},t)))})]}):(0,a.jsx)(a.Fragment,{})})),bo=s.memo((function({className:e="",filter:t,onChange:n}){const{t:s}=(0,R.$)();return(0,a.jsx)(Tn,{className:e,filter:t,label:s("vote with account"),onChange:n,type:"account",withLabel:!0})})),xo=s.memo((function({children:e,className:t="",isReferenda:n,label:s,params:i}){const{api:r}=(0,l.h)(),o=(0,be.W7)(r.derive.balances?.all,[i]);return(0,a.jsx)(ne.Z,{className:t,label:s,value:n&&r.query.convictionVoting&&o?o.votingBalance.add(o.reservedBalance):o?.votingBalance,children:e})})),Ao=["pyconvot","democrac","phrelect"],vo=s.memo((function({accountId:e,autoFocus:t,isReferenda:n,label:i,noDefault:r,onChange:o}){const{t:c}=(0,R.$)(),{api:d}=(0,l.h)(),u=(0,be.W7)(d.derive.balances?.all,[e]),[{defaultValue:m,maxValue:h,selectedId:p,value:g},f]=(0,s.useState)({defaultValue:ie.nw,maxValue:ie.nw,value:ie.nw});(0,s.useEffect)((()=>{u&&u.accountId.eq(e)&&f((t=>t.selectedId!==e?function(e,t,n,a,s,i){const r=a.lockedBreakdown.sort(((e,t)=>t.amount.cmp(e.amount))).sort(((e,t)=>{if(!e.id.eq(t.id))for(let n=0,a=Ao.length;ne)),o=i&&e.query.convictionVoting?a.votingBalance.add(a.reservedBalance):a.votingBalance;let l=r[0]||a.lockedBalance;if(n)l=ie.nw;else if(l.isZero()){let e=o.sub(s);for(let t=0;t<3;t++)e.gt(s)&&(l=e,e=e.sub(s))}return{defaultValue:l,maxValue:o,selectedId:t,value:l}}(d,e,r,u,d.consts.balances.existentialDeposit,!!n):t))}),[u,e,d,n,r]),(0,s.useEffect)((()=>{o(g)}),[o,g]);const b=(0,s.useCallback)((t=>f((n=>n.selectedId===e&&t&&!t.eq(n.value)?{...n,value:t}:n))),[e]),x=e!==p;return(0,a.jsx)(ca.Z,{autoFocus:t,defaultValue:x?void 0:m,isDisabled:x,isZeroable:!0,label:i||c("vote value"),labelExtra:(0,a.jsx)(xo,{isReferenda:n,label:(0,a.jsx)("label",{children:c("voting balance")}),params:e}),maxValue:h,onChange:b})}));var wo=n(72152)},21779:(e,t,n)=>{n.d(t,{z:()=>a.zo});var a=n(31383)},37731:(e,t,n)=>{n.d(t,{Z:()=>g,B:()=>c});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)}},14081:(e,t,n)=>{n.d(t,{L:()=>s});var a=n(69187);function s(e,t=null){let n;try{const s=a.Nn.getAddress(e,t);n=s?.meta}catch{}return n||{}}},73477:(e,t,n)=>{n.d(t,{r7:()=>i,xW:()=>r,C9:()=>o,Ly:()=>l.L,s2:()=>c,oX:()=>m,Hc:()=>f});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}const r=(e,t)=>e.filter((e=>e.value?.toString().toLowerCase().includes(t.toLowerCase())));function o(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":t.meta.isLocal?"chopsticks":"qr":t.type}catch{}return"unknown"}var l=n(14081);function c(e,t=null,n){const a=(0,l.L)(e,t);return a.name?[!1,!1,a.name.toUpperCase()]:n?[!1,!0,n.toUpperCase()]:[!0,!1,e]}var d=n(98083),u=n(95267);function m(e){if(!e)return null;let t;const n=(0,l.L)(e,"contract");try{const e=n.contract&&JSON.parse(n.contract.abi);t=new d.P(e,u.statics.api.registry.getChainProperties())}catch(e){console.error(e)}return t||null}var h=n(74076),p=n(48533),g=n(73493);function f(e,t=!1,n){if(e)try{const s=(0,h.vq)(e)?(0,p.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,g.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]}){return e?e.isIncomplete?`error: ${e.asIncomplete.error.type}`:null:i}},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(73477),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]),k=(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]),j=(0,s.useCallback)((e=>y({...e})),[y]),N=(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]),C=(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))]),k(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)}),[k,p]),S=(0,s.useMemo)((()=>({queueAction:k,queueExtrinsic:j,queuePayload:N,queueRpc:C,queueSetTxStatus:E,stqueue:t,txqueue:i})),[k,j,N,C,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,{I:()=>s,LD:()=>o,SB:()=>r,VU:()=>i,n6:()=>a});const a="Discord";var s;!function(e){e[e.Reservation=0]="Reservation",e[e.Lease=1]="Lease",e[e["Bulk Coretime"]=2]="Bulk Coretime",e[e["On Demand"]=3]="On Demand"}(s||(s={}));const i={Eligible:"eligible",None:"-",Renewed:"renewed"},r={BlockTime:6e3,BlocksPerTimeslice:80},o={BlocksPerTimeslice:40}},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,apiIdentity:o,apiSystemPeople:d}=(0,l.h)(),{accounts:{isAccount:f},addresses:{isAddress:b}}=(0,h.i)(),x=(0,m.Y)(e),A=u(e),v=(0,c.W7)(n.query.staking?.nominators,[e]),w=(0,c.W7)(n.query.staking?.validators,[e]),[y,k]=(0,a.useState)(void 0),[j,N]=(0,a.useState)([]),[C,E]=(0,a.useState)(""),[S,I]=(0,a.useState)(null),[B,D]=(0,a.useState)(),[L,P]=(0,a.useState)(g),[T,V]=(0,a.useState)(),[M,F,z]=(0,p.O)(),[Z,R,$]=(0,p.O)();(0,a.useEffect)((()=>{w&&P((e=>({...e,isValidator:!w.isEmpty})))}),[w]),(0,a.useEffect)((()=>{v&&P((e=>({...e,isNominator:!v.isEmpty})))}),[v]),(0,a.useEffect)((()=>{A&&P((e=>({...e,...A})))}),[A]),(0,a.useEffect)((()=>{const{accountIndex:e,identity:t,nickname:n}=x||{},a=e?.toString();let s;if(k((e=>e!==a?a:e)),(0,i.m)(o.query.identity?.identityOf)?t?.display&&(s=t.display):n&&(s=n),E(s||""),t){const e=t.judgements.filter((([,e])=>!e.isFeePaid)),n=e.some((([,e])=>e.isKnownGood));D({...t,isExistent:!!t.display,isKnownGood:n,judgements:e,waitCount:t.judgements.length-e.length})}else D(void 0)}),[x,n,d,o]),(0,a.useEffect)((()=>{if(e)try{const t=s.Nn.getAccount(e)||s.Nn.getAddress(e),n=f(e),a=b(e);I(t?.meta.genesisHash||null),P((s=>({...s,isDevelopment:t?.meta.isTesting||!1,isEditable:!(B?.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),E(t?.meta.name||""),N(t?.meta.tags?.sort()||[])}catch{}}),[B,f,b,e]);const q=(0,a.useCallback)((()=>{M&&F();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,M,C,F,e]),H=(0,a.useCallback)((()=>{const n={tags:j,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,j,e]),U=(0,a.useCallback)((()=>{M&&F(),Z&&R();try{e&&s.Nn.forgetAddress(e)}catch(e){console.error(e)}}),[M,Z,F,R,e]),W=(0,a.useCallback)((t=>{if(e){const n=s.Nn.getPair(e);n&&s.Nn.saveAccountMeta(n,{...n.meta,genesisHash:t}),I(t)}}),[e]),O=(0,a.useCallback)((e=>N(e.sort())),[]),Q=(0,a.useCallback)((()=>M||Z),[M,Z]);return(0,a.useMemo)((()=>({accountIndex:y,flags:L,genesisHash:S,identity:B,isEditing:Q,isEditingName:M,isEditingTags:Z,isNull:!e,meta:T,name:C,onForgetAddress:U,onSaveName:q,onSaveTags:H,onSetGenesisHash:W,setIsEditingName:z,setIsEditingTags:$,setName:E,setTags:O,tags:j,toggleIsEditingName:F,toggleIsEditingTags:R})),[y,L,S,B,Q,M,Z,T,C,U,q,H,W,z,$,E,O,j,F,R,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(42582),r=n(76833),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:()=>p});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),u=n(9118);const m=s.D_.div(s.um),h=new(r())(6e3),p=(0,l.e)("useBlockInterval",(function(e){const{api:t}=(0,c.h)(),n=e||t,i=(0,u.W7)(n.call.auraApi?.slotDuration&&n.call.auraApi.slotDuration,[]),r=(0,u.W7)(n.call.babeApi?.configuration&&n.call.babeApi.configuration,[],{transform:e=>e?.slotDuration});return(0,a.useMemo)((()=>(i||r)??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(m)?e.consts.timestamp.minimumPeriod.mul(s.um):e.query.parachainSystem?e.consts.aura?.slotDuration??h.mul(s.um):h))}(n)),[i,r,n])}))},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])}))},10807:(e,t,n)=>{n.d(t,{f:()=>i});var a=n(2784),s=n(9118);const i=(0,n(11677).e)("useBrokerConfig",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker.configuration),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&n.isSome&&n.toJSON()&&r(function(e){const t=e.unwrap();return{advanceNotice:t.advanceNotice?.toNumber(),contributionTimeout:t.contributionTimeout?.toNumber(),idealBulkProportion:t.idealBulkProportion,interludeLength:t.interludeLength?.toNumber(),leadinLength:t.leadinLength?.toNumber(),limitCoresOffered:t.limitCoresOffered?.isSome?t.limitCoresOffered?.unwrap().toNumber():0,regionLength:t.regionLength?.toNumber(),renewalBump:t.renewalBump}}(n))}),[n]),i}))},62353:(e,t,n)=>{n.d(t,{i:()=>i});var a=n(2784),s=n(9118);const i=(0,n(11677).e)("useBrokerLeases",(function(e,t){const n=(0,s.W7)(t&&e?.query?.broker?.leases),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&r(n.map(((e,t)=>({core:t,task:e.task.toString(),until:e.until.toNumber()}))))}),[n]),i}))},61314:(e,t,n)=>{n.d(t,{m:()=>o});var a=n(2784),s=n(9118),i=n(11677),r=n(33388);const o=(0,i.e)("useBrokerReservations",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker.reservations),[i,o]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&o(n.map((e=>({mask:(0,r.Pq)(e[0]?.mask),maskBits:(0,r.Pq)(e[0]?.mask)?.length??0,task:e[0]?.assignment?.isTask?e[0]?.assignment?.asTask.toString():e[0]?.assignment?.isPool?"Pool":""}))))}),[n]),i}))},69953:(e,t,n)=>{n.d(t,{i:()=>l});var a=n(2784),s=n(9118),i=n(11677),r=n(48801),o=n.n(r);const l=(0,i.e)("useBrokerSalesInfo",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker.saleInfo),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&n.isSome&&n.toJSON()&&r(function(e){const t=e.unwrap();return{coresOffered:t.coresOffered?.toNumber(),coresSold:t.coresSold?.toNumber(),endPrice:t.endPrice,firstCore:t.firstCore?.toNumber(),idealCoresSold:t.idealCoresSold?.toNumber(),leadinLength:t.leadinLength?.toNumber(),regionBegin:t.regionBegin?.toNumber(),regionEnd:t.regionEnd?.toNumber(),saleStart:t.saleStart?.toNumber(),selloutPrice:t.selloutPrice?.isSome?t.selloutPrice?.unwrap():new(o())(0)}}(n))}),[n]),i}))},71756:(e,t,n)=>{n.d(t,{c:()=>i});var a=n(2784),s=n(9118);const i=(0,n(11677).e)("useBrokerStatus",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker?.status),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{if(n&&n.isSome){const e=n.unwrap();r({coreCount:e.coreCount?.toNumber(),lastCommittedTimeslice:e.lastCommittedTimeslice?.toNumber(),lastTimeslice:e.lastTimeslice?.toNumber(),privatePoolSize:e.privatePoolSize?.toNumber(),systemPoolSize:e.systemPoolSize?.toNumber()})}}),[n]),i}))},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])}))},71566:(e,t,n)=>{n.d(t,{F:()=>N});var a=n(2784),s=n(90778),i=n(71756),r=n(62353),o=n(61314),l=n(69953),c=n(59653),d=n(22955),u=n(10807),m=n(26309),h=n(12298),p=n(9118),g=n(11677),f=n(48801),b=n.n(f);const x={transform:e=>e.map((({args:[e]})=>e))},A=(0,g.e)("useCoreDescriptor",(function(e,t){const n=(0,h.k)(t&&e.query.coretimeAssignmentProvider.coreDescriptors,[],x),s=n?.map(((e,t)=>t));s?.pop();const i=(0,p.W7)(t&&e.query.coretimeAssignmentProvider.coreDescriptors.multi,[s],{withParams:!0}),[r,o]=(0,a.useState)();return(0,a.useEffect)((()=>{i&&o(i[0][0].map(((e,t)=>function(e,t){const n=e?.currentWork.isSome?e.currentWork.unwrap():null,a=e?.queue.isSome?e.queue.unwrap():null,s=n?.assignments||[];return{core:t,info:{currentWork:{assignments:s?.map((e=>({isPool:e[0]?.isPool,isTask:e[0]?.isTask,ratio:e[1]?.ratio.toNumber(),remaining:e[1]?.remaining.toNumber(),task:e[0]?.isTask?e[0]?.asTask.toString():e[0]?.isPool?"Pool":"Idle"}))),endHint:n?.endHint.isSome?n?.endHint?.unwrap().toBn():null,pos:n?.pos.toNumber()||0,step:n?.step.toNumber()||0},queue:{first:a?.first.toBn()||new(b())(0),last:a?.last.toBn()||new(b())(0)}}}}(i[1][t],e))))}),[i]),r}));var v=n(52953),w=n(95292),y=n(33388);const k={transform:e=>e.map((({args:[e]})=>e))},j=(0,g.e)("useBrokerPotentialRenewals",(function(e,t){const n=(0,h.k)(t&&e?.query.broker.potentialRenewals,[],k),s=(0,p.W7)(t&&e?.query.broker.potentialRenewals.multi,[n],{withParams:!0}),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{if(!s)return;const e=s[0][0].map(((e,t)=>function(e,t){const n=e.isSome?e.unwrap():null;let a=[],s="";if(!n)return;const i=n?.completion;if(i?.isComplete){const e=i?.asComplete[0];s=e.assignment.isTask?e?.assignment.asTask.toString():e?.assignment.isPool?"Pool":"Idle",a=(0,y.Pq)(e.mask)}else i?.isPartial?(a=(0,y.Pq)(i?.asPartial),s=""):a=[];return{completion:i?.type,core:t?.core.toNumber(),mask:a,maskBits:a?.length,price:n?.price.toBn()||w.nw,task:s,when:t?.when.toNumber()}}(s[1][t],e)));r(e.filter((e=>!!e)))}),[s]),i})),N=(0,g.e)("useCoretimeInformation",(function(e,t){const{apiCoretime:n,isApiReady:h}=(0,s.h)(),[p,g]=(0,a.useState)([]),[f,x]=(0,a.useState)([]),w=(0,i.c)(n,h),y=(0,r.i)(n,h),k=(0,o.m)(n,h),N=(0,l.i)(n,h),C=(0,c.E)(n,h),E=(0,d.b)(n,h),S=(0,u.f)(n,h),I=j(n,h),B=(0,m.e)(n),D=A(e,t),L=(0,a.useMemo)((()=>D&&[...new Set(D?.map((e=>e.info.currentWork.assignments.map((e=>e.task)))).flat().filter((e=>"Pool"!==e)))]),[D]),P=(0,a.useMemo)((()=>{if(!N||!S||!w)return!1;const e=new(b())(N?.regionBegin).sub(new(b())(S.regionLength)),t=new(b())(S?.interludeLength).div(new(b())(v.LD.BlocksPerTimeslice));return e.add(t).gte(new(b())(w?.lastCommittedTimeslice))}),[w,N,S]),T=(0,a.useMemo)((()=>P&&S&&N?I?.filter((e=>e.when.toString()===N?.regionBegin.toString())):[]),[I,N,S,P]),[V,M]=(0,a.useState)();return(0,a.useEffect)((()=>{if(L?.length&&I?.length&&!f.length){const e=L.map((e=>Number(e))),t=I?.map((e=>Number(e.task))),n=[...new Set(e.concat(t))];n?.length>e.length?x(n.sort(((e,t)=>e-t))):x(e)}}),[I,L,f]),(0,a.useEffect)((()=>{if(C?.length&&g(C),D?.length&&!C?.length){const e=D?.map((e=>({core:-1,info:e.info.currentWork.assignments.map((e=>({isPool:e.isPool,isTask:e.isTask,mask:[],maskBits:0,task:e.task})))})));g(e)}}),[C,D]),(0,a.useEffect)((()=>{if(!p?.length||!y?.length||!k?.length)return;const e={};f?.forEach((t=>{const n=t.toString(),a=y?.find((e=>e.task===n)),s=k?.find((e=>e.task===n)),i=p?.filter((e=>e.info.task===n)),r=i.map((e=>{const t=E?.filter((t=>t.core===e?.core&&t.info.task.toString()===n)),i=((e,t,n)=>n?v.I["On Demand"]:t?v.I.Reservation:e?v.I.Lease:v.I["Bulk Coretime"])(a,s,e?.info.isPool??!1),r=i===v.I["Bulk Coretime"]&&t?.find((t=>t.core===e?.core)),o=T?.find((e=>e.task.toString()===n));return{chainRenewedCore:r,renewal:o,renewalStatus:r?v.VU.Renewed:o?v.VU.Eligible:v.VU.None,type:i,workload:e,workplan:t}}));e[t.toString()]={id:t,lease:a,reservation:s,workTaskInfo:r}})),e&&S&&B&&N&&w&&M({chainInfo:e,config:S,region:B,salesInfo:N,status:w,taskIds:f})}),[f,p,T,N,y,k,B,w,S,E]),V}))},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(90778),i=n(9118);const r=(0,a.e)("useDeriveAccountInfo",(function(e){const{apiIdentity:t}=(0,s.h)();return(0,i.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}))},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:()=>v});var a=n(2784),s=n(17346),i=n(97772),r=n(70392),o=n(7404),l=n(16039),c=n(48731),d=n(11677),u=n(90778);const m={hasLedgerChain:!1,hasWebUsb:!1,isLedgerCapable:!1,isLedgerEnabled:!1},h=!!window.USB,p=Object.keys(r.A).filter((e=>o.Y[e])),g=p.reduce(((e,t)=>[...e,...r.A[t]]),[]);let f,b=null,x=null;function A(e){const t=g.includes(e.genesisHash.toHex()),n=h&&t;return{hasLedgerChain:t,hasWebUsb:h,isLedgerCapable:n,isLedgerEnabled:n&&"none"!==l.X.ledgerConn}}const v=(0,d.e)("useLedger",(function(){const{api:e,isApiReady:t}=(0,u.h)(),n=(0,a.useCallback)((()=>function(e){const t=l.X.get().ledgerConn,n=l.X.get().ledgerApp;if(!b||x!==t||n!==f){const a=e.genesisHash.toHex(),l=p.find((e=>r.A[e].includes(a)));(0,c.hu)(l,`Unable to find a known Ledger config for genesisHash ${a}`),b="generic"===n?new s.T(t,l,o.Y.polkadot):"migration"===n?new s.T(t,l,o.Y[l]):"chainSpecific"===n?new i.P(t,l):new s.T(t,l,o.Y.polkadot),x=t,f=n}return b}(e)),[e]);return(0,a.useMemo)((()=>({...t?A(e):m,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])}},6688:(e,t,n)=>{n.d(t,{O:()=>i,V:()=>o});var a=n(2784),s=n(74065);function i(e){if(!e)return"";if(e.toLowerCase().startsWith("http"))return e;const t=e.match(/Qm[A-Za-z0-9]{44}(?![A-Za-z0-9])/);if(null!==t)return t[0];const n=e.match(/[a-z0-9]{59}(?![A-Za-z0-9])/);return null!==n?n[0]:""}const r=new Map;function o(e,t){const n=(0,s.X)(),[o,l]=(0,a.useState)(),c=(0,a.useMemo)((()=>{if(e)return e.map((e=>i(e))).filter((e=>!!e))}),[e]);return(0,a.useEffect)((()=>{n.current&&c&&async function(e){const t=new Map,n=e.map((e=>{if(r.has(e))return t.set(e,r.get(e)),Promise.resolve();const n=e.startsWith("http")?e:`https://ipfs.io/ipfs/${e}`;return fetch(n).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}},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]),k=(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((({claimedRewardsEras:e,stakingLedger:t,stashId:s})=>{if(t){const i=n.filter((n=>!function(e,t){return(e.legacyClaimedRewards||e.claimedRewards||[]).concat(t?.toArray()||[])}(t,e).some((e=>n.eq(e)))));i.length&&a.push({eras:i,stashId:s})}})),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&&k&&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,isClaimed:!1,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,k))}),[i,y,k,h,t,b]),A}))},12213:(e,t,n)=>{n.d(t,{w:()=>h});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={withClaimedRewardsEras:!0,withDestination:!0,withLedger:!0,withNominations:!0,withPrefs:!0},h=(0,r.e)("useOwnStashInfos",(function(){const{api:e}=(0,l.h)(),{allAccounts:t}=(0,o.x)(),n=(0,c.X)(),r=(0,d.y)(),[h,p]=(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,m],[e.query.staking.validators.multi,a]];e.combineLatest(s,(([e,t])=>{n.current&&r.length===e.length&&r.length===t.length&&p(r.reduce(((n,[a,s],i)=>({...n,[a]:[s,e[i],t[i]]})),{}))})).then((e=>{t=e})).catch(console.error)}else n.current&&p({});return()=>{t&&t()}}),[e,n,r]),(0,a.useMemo)((()=>r&&h&&r.length===Object.keys(h).length?r.filter((([e])=>h[e])).map((([e])=>function(e,t,[n,{claimedRewardsEras:a,controllerId:r,exposureMeta:o,exposurePaged:l,nextSessionIds:c,nominators:d,rewardDestination:m,sessionIds:h,stakingLedger:p,validatorPrefs:g},f]){const b=!!d?.length,x=!(Array.isArray(f)?f[1].isEmpty:f.isEmpty),A=c instanceof Map?[...c.values()]:c,v=(0,s.e)(...A.map((e=>e.toU8a()))),w=h instanceof Map?[...h.values()]:h,y=(0,s.e)(...w.map((e=>e.toU8a()))),k=u(r);return{claimedRewardsEras:a,controllerId:k,destination:m,exposureMeta:o,exposurePaged:l,hexSessionIdNext:(0,i.c)(v,48),hexSessionIdQueue:(0,i.c)(y.length?y:v,48),isLoading:!1,isOwnController:t.includes(k||""),isOwnStash:n,isStashNominating:b,isStashValidating:x,nominating:d?.map(u),sessionIds:(A.length?A:w).map(u),stakingLedger:p,stashId:e,validatorPrefs:g}}(e,t,h[e]))):void 0),[t,r,h])}))},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(33318),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(33403),p=n(14681),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),status:null}}}function x(e,t,n){const a=(0,c.U)(n)?n:n.unwrapOr(null),s=e=>(0,h.Z)({},t,{isCompleted:!0,...e});if(!a)return s({proposalWarning:"No preimage bytes found"});try{const t=e.tx(a.toString()),n=e.createType("Call",t.method);if(t.toHex()===a.toString())return s({proposal:n})}catch{}try{const n=e.registry.createType("Call",a),i=n.encodedLength;if(t.proposalLength){const e=t.proposalLength.toNumber();return s({proposal:n,proposalWarning:i!==e?`Decoded call length does not match on-chain stored preimage length (${(0,p.u)(i)} bytes vs ${(0,p.u)(e)} bytes)`:null})}return s({proposal:n,proposalLength:new(m())(i)})}catch(e){console.error(e)}return s({proposalError:"Unable to decode preimage bytes into a valid Call"})}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),d=(0,i.W7)(!n&&r&&t.query.preimage?.requestStatusFor,r),u=c?.isSome?c:d,{paramsBytes:m,resultPreimageFor:p}=(0,a.useMemo)((()=>l&&u?function(e,t){const n=(0,h.Z)({},e,{status:t.unwrapOr(null)});if(n.status)if(n.status.isRequested){const e=n.status.asRequested;e instanceof o.W||(n.count=e.count.toNumber(),n.deposit=A(e.maybeTicket?e.maybeTicket.unwrapOr(null):e.deposit.unwrapOr(null)),n.proposalLength=e.maybeLen?e.maybeLen.unwrapOr(g.nw):e.len.unwrapOr(g.nw))}else if(n.status.isUnrequested){const e=n.status.asUnrequested;e instanceof o.W?n.deposit=A(e.unwrapOr(null)):(n.deposit=A(e.ticket||e.deposit),n.proposalLength=e.len)}else console.error(`Unhandled PalletPreimageRequestStatus type: ${n.status.type}`);return{paramsBytes:n.isHashParam?[n.proposalHash]:[[n.proposalHash,n.proposalLength||g.nw]],resultPreimageFor:n}}(l,u):{}),[u,l]),f=(0,i.W7)(m&&t.query.preimage?.preimageFor,m);return(0,a.useMemo)((()=>p?f?x(t,p,f):p:l?n?x(t,l,n):l:void 0),[t,n,f,l,p])}))},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)}))},26309:(e,t,n)=>{n.d(t,{e:()=>l});var a=n(2784),s=n(12298),i=n(9118),r=n(11677);const o={transform:e=>e.map((({args:[e]})=>e))},l=(0,r.e)("useRegions",(function(e){const t=(0,s.k)(e?.query?.broker.regions,[],o),n=(0,i.W7)(e?.query?.broker.regions.multi,[t],{withParams:!0}),[r,l]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&n[0][0].length>0&&l(n[0][0].map(((e,t)=>{return a=e.core.toNumber(),s=e.begin.toNumber(),i=n[1][t].unwrap().end.toNumber(),r=n[1][t].unwrap().owner.toString(),o=n[1][t].unwrap().paid.toString(),{core:a,end:i,mask:e.mask.toHex(),owner:r,paid:o,start:s};var a,s,i,r,o})))}),[n]),r}))},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{apiIdentity: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(33318),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:{proofSize:s.nw,refTime:t}}}const t=e.toBn();return{v1Weight:t,v2Weight:{proofSize:s.nw,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}))},59653:(e,t,n)=>{n.d(t,{E:()=>c});var a=n(2784),s=n(12298),i=n(9118),r=n(11677),o=n(33388);const l={transform:e=>e.map((({args:[e]})=>e))},c=(0,r.e)("useWorkloadInfos",(function(e,t){const n=(0,s.k)(t&&e?.query.broker.workload,[],l),r=(0,i.W7)(t&&e?.query.broker.workload.multi,[n],{withParams:!0}),[c,d]=(0,a.useState)();return(0,a.useEffect)((()=>{if(!r?.[0]?.[0])return;const e=r[0][0];var t;d((t=e.map(((e,t)=>function(e,t){const n=(0,o.Pq)(e[0]?.mask),a=e[0].assignment;return{core:t,info:{isPool:a.isPool,isTask:a.isTask,mask:n,maskBits:n.length,task:a.isTask?a.asTask.toString():a.isPool?"Pool":"Idle"}}}(r[1][t],e.toNumber()))))?(Array.isArray(t)?t:[t]).sort(((e,t)=>e.core-t.core)):[])}),[r]),c}))},22955:(e,t,n)=>{n.d(t,{b:()=>c});var a=n(2784),s=n(12298),i=n(9118),r=n(11677),o=n(33388);const l={transform:e=>e.map((({args:[e,t]})=>[e,t]))},c=(0,r.e)("useWorkplanInfos",(function(e,t){const n=(0,s.k)(t&&e?.query.broker.workplan,[],l),r=n?.map((e=>e[0])),c=(0,i.W7)(t&&e?.query.broker.workplan.multi,[r],{withParams:!0}),[d,u]=(0,a.useState)();return(0,a.useEffect)((()=>{if(!c?.[1]||!c[0]?.[0])return;const e=c[0][0];var t;u((t=e.map(((e,t)=>function(e,t,n){const a=(0,o.Pq)(e[0]?.mask),s=e[0].assignment;return{core:t,info:{isPool:s.isPool,isTask:s.isTask,mask:a,maskBits:a.length,task:s.isTask?s.asTask.toString():s.isPool?"Pool":"Idle"},timeslice:n}}(c[1][t].unwrap(),e[1].toNumber(),e[0].toNumber()))))?(Array.isArray(t)?t:[t]).sort(((e,t)=>e.core-t.core)):[])}),[c]),d}))},33388:(e,t,n)=>{function a(e){if(!e)return[];const t=e.toHex().slice(2).split(""),n=[];return t.forEach((e=>{var t;(t=e,parseInt(t,16).toString(2)).split("").forEach((e=>n.push(e)))})),n.filter((e=>"1"===e)),n}n.d(t,{Pq:()=>a})},37245:(e,t,n)=>{n.d(t,{Z:()=>r});var a=n(52322),s=n(2784);const i=n(48630).zo.div` +`,fo=s.memo((function({data:e}){const t=2*Math.PI*50,n=e.reduce(((e,t)=>e+t.value),0);let s=0;return n?(0,a.jsxs)(uo,{children:[(0,a.jsx)(mo,{children:(0,a.jsxs)("svg",{height:100,viewBox:"0 0 100 100",width:100,children:[(0,a.jsx)("circle",{cx:50,cy:50,fill:"none",r:42.5,stroke:"#f0f0f0",strokeWidth:15}),e.map(((e,i)=>{const r=e.value/n*100,o=r/100*t,l=s/100*t;return s+=r,(0,a.jsx)("circle",{cx:50,cy:50,fill:"none",r:42.5,stroke:e.color,strokeDasharray:`${o} ${t-o}`,strokeDashoffset:-l,strokeWidth:15,transform:"rotate(-90 50 50)",children:(0,a.jsx)("title",{children:`${e.label}: ${r.toFixed(2)}%`})},i)}))]})}),(0,a.jsx)(ho,{children:e.map(((e,t)=>(0,a.jsxs)(po,{children:[(0,a.jsx)(go,{color:e.color}),(0,a.jsx)("span",{children:`${e.label}: ${(e.value/n*100).toFixed(2)}%`})]},t)))})]}):(0,a.jsx)(a.Fragment,{})})),bo=s.memo((function({className:e="",filter:t,onChange:n}){const{t:s}=(0,R.$)();return(0,a.jsx)(Tn,{className:e,filter:t,label:s("vote with account"),onChange:n,type:"account",withLabel:!0})})),xo=s.memo((function({children:e,className:t="",isReferenda:n,label:s,params:i}){const{api:r}=(0,l.h)(),o=(0,be.W7)(r.derive.balances?.all,[i]);return(0,a.jsx)(ne.Z,{className:t,label:s,value:n&&r.query.convictionVoting&&o?o.votingBalance.add(o.reservedBalance):o?.votingBalance,children:e})})),Ao=["pyconvot","democrac","phrelect"],vo=s.memo((function({accountId:e,autoFocus:t,isReferenda:n,label:i,noDefault:r,onChange:o}){const{t:c}=(0,R.$)(),{api:d}=(0,l.h)(),u=(0,be.W7)(d.derive.balances?.all,[e]),[{defaultValue:m,maxValue:h,selectedId:p,value:g},f]=(0,s.useState)({defaultValue:ie.nw,maxValue:ie.nw,value:ie.nw});(0,s.useEffect)((()=>{u&&u.accountId.eq(e)&&f((t=>t.selectedId!==e?function(e,t,n,a,s,i){const r=a.lockedBreakdown.sort(((e,t)=>t.amount.cmp(e.amount))).sort(((e,t)=>{if(!e.id.eq(t.id))for(let n=0,a=Ao.length;ne)),o=i&&e.query.convictionVoting?a.votingBalance.add(a.reservedBalance):a.votingBalance;let l=r[0]||a.lockedBalance;if(n)l=ie.nw;else if(l.isZero()){let e=o.sub(s);for(let t=0;t<3;t++)e.gt(s)&&(l=e,e=e.sub(s))}return{defaultValue:l,maxValue:o,selectedId:t,value:l}}(d,e,r,u,d.consts.balances.existentialDeposit,!!n):t))}),[u,e,d,n,r]),(0,s.useEffect)((()=>{o(g)}),[o,g]);const b=(0,s.useCallback)((t=>f((n=>n.selectedId===e&&t&&!t.eq(n.value)?{...n,value:t}:n))),[e]),x=e!==p;return(0,a.jsx)(ca.Z,{autoFocus:t,defaultValue:x?void 0:m,isDisabled:x,isZeroable:!0,label:i||c("vote value"),labelExtra:(0,a.jsx)(xo,{isReferenda:n,label:(0,a.jsx)("label",{children:c("voting balance")}),params:e}),maxValue:h,onChange:b})}));var wo=n(72152)},21779:(e,t,n)=>{n.d(t,{z:()=>a.zo});var a=n(31383)},37731:(e,t,n)=>{n.d(t,{Z:()=>g,B:()=>c});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)}},14081:(e,t,n)=>{n.d(t,{L:()=>s});var a=n(69187);function s(e,t=null){let n;try{const s=a.Nn.getAddress(e,t);n=s?.meta}catch{}return n||{}}},73477:(e,t,n)=>{n.d(t,{r7:()=>i,xW:()=>r,C9:()=>o,Ly:()=>l.L,s2:()=>c,oX:()=>m,Hc:()=>f});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}const r=(e,t)=>e.filter((e=>e.value?.toString().toLowerCase().includes(t.toLowerCase())));function o(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":t.meta.isLocal?"chopsticks":"qr":t.type}catch{}return"unknown"}var l=n(14081);function c(e,t=null,n){const a=(0,l.L)(e,t);return a.name?[!1,!1,a.name.toUpperCase()]:n?[!1,!0,n.toUpperCase()]:[!0,!1,e]}var d=n(98083),u=n(95267);function m(e){if(!e)return null;let t;const n=(0,l.L)(e,"contract");try{const e=n.contract&&JSON.parse(n.contract.abi);t=new d.P(e,u.statics.api.registry.getChainProperties())}catch(e){console.error(e)}return t||null}var h=n(74076),p=n(48533),g=n(73493);function f(e,t=!1,n){if(e)try{const s=(0,h.vq)(e)?(0,p.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,g.K)(s):a.Nn.encodeAddress(s)}catch{}}},28097:(e,t,n)=>{n.d(t,{I:()=>s,VU:()=>i,n6:()=>a});const a="Discord";var s;!function(e){e[e.Reservation=0]="Reservation",e[e.Lease=1]="Lease",e[e["Bulk Coretime"]=2]="Bulk Coretime",e[e["On Demand"]=3]="On Demand"}(s||(s={}));const i={Eligible:"eligible",None:"-",Renewed:"renewed"}},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]}){return e?e.isIncomplete?`error: ${e.asIncomplete.error.type}`:null:i}},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(73477),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]),k=(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]),j=(0,s.useCallback)((e=>y({...e})),[y]),N=(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]),C=(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))]),k(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)}),[k,p]),S=(0,s.useMemo)((()=>({queueAction:k,queueExtrinsic:j,queuePayload:N,queueRpc:C,queueSetTxStatus:E,stqueue:t,txqueue:i})),[k,j,N,C,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})}},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,apiIdentity:o,apiSystemPeople:d}=(0,l.h)(),{accounts:{isAccount:f},addresses:{isAddress:b}}=(0,h.i)(),x=(0,m.Y)(e),A=u(e),v=(0,c.W7)(n.query.staking?.nominators,[e]),w=(0,c.W7)(n.query.staking?.validators,[e]),[y,k]=(0,a.useState)(void 0),[j,N]=(0,a.useState)([]),[C,E]=(0,a.useState)(""),[S,I]=(0,a.useState)(null),[B,D]=(0,a.useState)(),[L,P]=(0,a.useState)(g),[T,V]=(0,a.useState)(),[M,F,z]=(0,p.O)(),[Z,R,$]=(0,p.O)();(0,a.useEffect)((()=>{w&&P((e=>({...e,isValidator:!w.isEmpty})))}),[w]),(0,a.useEffect)((()=>{v&&P((e=>({...e,isNominator:!v.isEmpty})))}),[v]),(0,a.useEffect)((()=>{A&&P((e=>({...e,...A})))}),[A]),(0,a.useEffect)((()=>{const{accountIndex:e,identity:t,nickname:n}=x||{},a=e?.toString();let s;if(k((e=>e!==a?a:e)),(0,i.m)(o.query.identity?.identityOf)?t?.display&&(s=t.display):n&&(s=n),E(s||""),t){const e=t.judgements.filter((([,e])=>!e.isFeePaid)),n=e.some((([,e])=>e.isKnownGood));D({...t,isExistent:!!t.display,isKnownGood:n,judgements:e,waitCount:t.judgements.length-e.length})}else D(void 0)}),[x,n,d,o]),(0,a.useEffect)((()=>{if(e)try{const t=s.Nn.getAccount(e)||s.Nn.getAddress(e),n=f(e),a=b(e);I(t?.meta.genesisHash||null),P((s=>({...s,isDevelopment:t?.meta.isTesting||!1,isEditable:!(B?.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),E(t?.meta.name||""),N(t?.meta.tags?.sort()||[])}catch{}}),[B,f,b,e]);const q=(0,a.useCallback)((()=>{M&&F();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,M,C,F,e]),H=(0,a.useCallback)((()=>{const n={tags:j,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,j,e]),U=(0,a.useCallback)((()=>{M&&F(),Z&&R();try{e&&s.Nn.forgetAddress(e)}catch(e){console.error(e)}}),[M,Z,F,R,e]),W=(0,a.useCallback)((t=>{if(e){const n=s.Nn.getPair(e);n&&s.Nn.saveAccountMeta(n,{...n.meta,genesisHash:t}),I(t)}}),[e]),O=(0,a.useCallback)((e=>N(e.sort())),[]),Q=(0,a.useCallback)((()=>M||Z),[M,Z]);return(0,a.useMemo)((()=>({accountIndex:y,flags:L,genesisHash:S,identity:B,isEditing:Q,isEditingName:M,isEditingTags:Z,isNull:!e,meta:T,name:C,onForgetAddress:U,onSaveName:q,onSaveTags:H,onSetGenesisHash:W,setIsEditingName:z,setIsEditingTags:$,setName:E,setTags:O,tags:j,toggleIsEditingName:F,toggleIsEditingTags:R})),[y,L,S,B,Q,M,Z,T,C,U,q,H,W,z,$,E,O,j,F,R,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(42582),r=n(76833),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:()=>p});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),u=n(9118);const m=s.D_.div(s.um),h=new(r())(6e3),p=(0,l.e)("useBlockInterval",(function(e){const{api:t}=(0,c.h)(),n=e||t,i=(0,u.W7)(n.call.auraApi?.slotDuration&&n.call.auraApi.slotDuration,[]),r=(0,u.W7)(n.call.babeApi?.configuration&&n.call.babeApi.configuration,[],{transform:e=>e?.slotDuration});return(0,a.useMemo)((()=>(i||r)??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(m)?e.consts.timestamp.minimumPeriod.mul(s.um):e.query.parachainSystem?e.consts.aura?.slotDuration??h.mul(s.um):h))}(n)),[i,r,n])}))},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])}))},10807:(e,t,n)=>{n.d(t,{f:()=>i});var a=n(2784),s=n(9118);const i=(0,n(11677).e)("useBrokerConfig",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker.configuration),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&n.isSome&&n.toJSON()&&r(function(e){const t=e.unwrap();return{advanceNotice:t.advanceNotice?.toNumber(),contributionTimeout:t.contributionTimeout?.toNumber(),idealBulkProportion:t.idealBulkProportion,interludeLength:t.interludeLength?.toNumber(),leadinLength:t.leadinLength?.toNumber(),limitCoresOffered:t.limitCoresOffered?.isSome?t.limitCoresOffered?.unwrap().toNumber():0,regionLength:t.regionLength?.toNumber(),renewalBump:t.renewalBump}}(n))}),[n]),i}))},62353:(e,t,n)=>{n.d(t,{i:()=>i});var a=n(2784),s=n(9118);const i=(0,n(11677).e)("useBrokerLeases",(function(e,t){const n=(0,s.W7)(t&&e?.query?.broker?.leases),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&r(n.map(((e,t)=>({core:t,task:e.task.toString(),until:e.until.toNumber()}))))}),[n]),i}))},61314:(e,t,n)=>{n.d(t,{m:()=>o});var a=n(2784),s=n(9118),i=n(11677),r=n(33388);const o=(0,i.e)("useBrokerReservations",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker.reservations),[i,o]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&o(n.map((e=>({mask:(0,r.Pq)(e[0]?.mask),maskBits:(0,r.Pq)(e[0]?.mask)?.length??0,task:e[0]?.assignment?.isTask?e[0]?.assignment?.asTask.toString():e[0]?.assignment?.isPool?"Pool":""}))))}),[n]),i}))},69953:(e,t,n)=>{n.d(t,{i:()=>l});var a=n(2784),s=n(9118),i=n(11677),r=n(48801),o=n.n(r);const l=(0,i.e)("useBrokerSalesInfo",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker.saleInfo),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&n.isSome&&n.toJSON()&&r(function(e){const t=e.unwrap();return{coresOffered:t.coresOffered?.toNumber(),coresSold:t.coresSold?.toNumber(),endPrice:t.endPrice,firstCore:t.firstCore?.toNumber(),idealCoresSold:t.idealCoresSold?.toNumber(),leadinLength:t.leadinLength?.toNumber(),regionBegin:t.regionBegin?.toNumber(),regionEnd:t.regionEnd?.toNumber(),saleStart:t.saleStart?.toNumber(),selloutPrice:t.selloutPrice?.isSome?t.selloutPrice?.unwrap():new(o())(0)}}(n))}),[n]),i}))},71756:(e,t,n)=>{n.d(t,{c:()=>i});var a=n(2784),s=n(9118);const i=(0,n(11677).e)("useBrokerStatus",(function(e,t){const n=(0,s.W7)(t&&e?.query.broker?.status),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{if(n&&n.isSome){const e=n.unwrap();r({coreCount:e.coreCount?.toNumber(),lastCommittedTimeslice:e.lastCommittedTimeslice?.toNumber(),lastTimeslice:e.lastTimeslice?.toNumber(),privatePoolSize:e.privatePoolSize?.toNumber(),systemPoolSize:e.systemPoolSize?.toNumber()})}}),[n]),i}))},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])}))},69031:(e,t,n)=>{n.d(t,{e:()=>c});var a=n(2784),s=n(90778),i=n(97794),r=n(95292),o=n(48801),l=n.n(o);const c=(0,n(11677).e)("useCoretimeConsts",(function(){const{api:e,apiCoretime:t,isApiReady:n}=(0,s.h)(),[o,c]=(0,a.useState)(),[d]=(0,i.h)(r.If,e),u=t?.consts.aura?.slotDuration,m=t?.consts.broker?.timeslicePeriod;return(0,a.useEffect)((()=>{if(!(n&&d&&u&&m))return;const e=new(l())(u.toString()),t=new(l())(m),a=e.div(new(l())(d)),s=a.gtn(0)?t.div(a):r.nw;c({coretime:{blocksPerTimeslice:s.toNumber(),blocktimeMs:e.toNumber()},relay:{blocksPerTimeslice:t.toNumber(),blocktimeMs:d}})}),[n,d,u,m]),o}))},71566:(e,t,n)=>{n.d(t,{F:()=>C});var a=n(2784),s=n(90778),i=n(71756),r=n(62353),o=n(61314),l=n(69953),c=n(59653),d=n(22955),u=n(10807),m=n(26309),h=n(12298),p=n(9118),g=n(11677),f=n(48801),b=n.n(f);const x={transform:e=>e.map((({args:[e]})=>e))},A=(0,g.e)("useCoreDescriptor",(function(e,t){const n=(0,h.k)(t&&e.query.coretimeAssignmentProvider.coreDescriptors,[],x),s=n?.map(((e,t)=>t));s?.pop();const i=(0,p.W7)(t&&e.query.coretimeAssignmentProvider.coreDescriptors.multi,[s],{withParams:!0}),[r,o]=(0,a.useState)();return(0,a.useEffect)((()=>{i&&o(i[0][0].map(((e,t)=>function(e,t){const n=e?.currentWork.isSome?e.currentWork.unwrap():null,a=e?.queue.isSome?e.queue.unwrap():null,s=n?.assignments||[];return{core:t,info:{currentWork:{assignments:s?.map((e=>({isPool:e[0]?.isPool,isTask:e[0]?.isTask,ratio:e[1]?.ratio.toNumber(),remaining:e[1]?.remaining.toNumber(),task:e[0]?.isTask?e[0]?.asTask.toString():e[0]?.isPool?"Pool":"Idle"}))),endHint:n?.endHint.isSome?n?.endHint?.unwrap().toBn():null,pos:n?.pos.toNumber()||0,step:n?.step.toNumber()||0},queue:{first:a?.first.toBn()||new(b())(0),last:a?.last.toBn()||new(b())(0)}}}}(i[1][t],e))))}),[i]),r}));var v=n(95292),w=n(28097),y=n(33388);const k={transform:e=>e.map((({args:[e]})=>e))},j=(0,g.e)("useBrokerPotentialRenewals",(function(e,t){const n=(0,h.k)(t&&e?.query.broker.potentialRenewals,[],k),s=(0,p.W7)(t&&e?.query.broker.potentialRenewals.multi,[n],{withParams:!0}),[i,r]=(0,a.useState)();return(0,a.useEffect)((()=>{if(!s)return;const e=s[0][0].map(((e,t)=>function(e,t){const n=e.isSome?e.unwrap():null;let a=[],s="";if(!n)return;const i=n?.completion;if(i?.isComplete){const e=i?.asComplete[0];s=e.assignment.isTask?e?.assignment.asTask.toString():e?.assignment.isPool?"Pool":"Idle",a=(0,y.Pq)(e.mask)}else i?.isPartial?(a=(0,y.Pq)(i?.asPartial),s=""):a=[];return{completion:i?.type,core:t?.core.toNumber(),mask:a,maskBits:a?.length,price:n?.price.toBn()||v.nw,task:s,when:t?.when.toNumber()}}(s[1][t],e)));r(e.filter((e=>!!e)))}),[s]),i}));var N=n(69031);const C=(0,g.e)("useCoretimeInformation",(function(e,t){const{apiCoretime:n,isApiReady:h}=(0,s.h)(),[p,g]=(0,a.useState)([]),[f,x]=(0,a.useState)([]),[y,k]=(0,a.useState)(),C=(0,i.c)(n,h),E=(0,r.i)(n,h),S=(0,o.m)(n,h),I=(0,l.i)(n,h),B=(0,c.E)(n,h),D=(0,d.b)(n,h),L=(0,u.f)(n,h),P=j(n,h),T=(0,m.e)(n),V=(0,N.e)();(0,a.useEffect)((()=>{V?.coretime.blocksPerTimeslice&&k(new(b())(V.coretime.blocksPerTimeslice))}),[V]);const M=A(e,t),F=(0,a.useMemo)((()=>M&&[...new Set(M?.map((e=>e.info.currentWork.assignments.map((e=>e.task)))).flat().filter((e=>"Pool"!==e)))]),[M]),z=(0,a.useMemo)((()=>{if(!(I&&L&&C&&y))return!1;const e=new(b())(I?.regionBegin).sub(new(b())(L.regionLength)),t=y.gt(v.nw)?new(b())(L?.interludeLength).div(y):v.nw;return e.add(t).gte(new(b())(C?.lastCommittedTimeslice))}),[C,I,L,y]),Z=(0,a.useMemo)((()=>z&&L&&I?P?.filter((e=>e.when.toString()===I?.regionBegin.toString())):[]),[P,I,L,z]),[R,$]=(0,a.useState)();return(0,a.useEffect)((()=>{if(F?.length&&!f.length){const e=F.map((e=>Number(e))),t=P?.map((e=>Number(e.task)));if(t){const n=[...new Set(e.concat(t))];if(n?.length>e.length)return void x(n.sort(((e,t)=>e-t)))}x(e)}}),[P,F,f]),(0,a.useEffect)((()=>{if(B?.length&&g(B),M?.length&&!B?.length){const e=M?.map((e=>({core:-1,info:e.info.currentWork.assignments.map((e=>({isPool:e.isPool,isTask:e.isTask,mask:[],maskBits:0,task:e.task})))})));g(e)}}),[B,M]),(0,a.useEffect)((()=>{if(!p?.length||!S?.length)return;const e={};f?.forEach((t=>{const n=t.toString(),a=E?.length?E?.find((e=>e.task===n)):void 0,s=S?.find((e=>e.task===n)),i=p?.filter((e=>e.info.task===n)),r=i.map((e=>{const t=D?.filter((t=>t.core===e?.core&&t.info.task.toString()===n)),i=((e,t,n)=>n?w.I["On Demand"]:t?w.I.Reservation:e?w.I.Lease:w.I["Bulk Coretime"])(a,s,e?.info.isPool??!1),r=i===w.I["Bulk Coretime"]&&t?.find((t=>t.core===e?.core)),o=Z?.find((e=>e.task.toString()===n));return{chainRenewedCore:r,renewal:o,renewalStatus:r?w.VU.Renewed:o?w.VU.Eligible:w.VU.None,type:i,workload:e,workplan:t}}));e[t.toString()]={id:t,lease:a,reservation:s,workTaskInfo:r}})),e&&L&&T&&I&&C&&V&&$({chainInfo:e,config:L,constants:V,region:T,salesInfo:I,status:C,taskIds:f})}),[L,V,f,p,Z,I,E,S,T,C,D]),R}))},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(90778),i=n(9118);const r=(0,a.e)("useDeriveAccountInfo",(function(e){const{apiIdentity:t}=(0,s.h)();return(0,i.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}))},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:()=>v});var a=n(2784),s=n(17346),i=n(97772),r=n(70392),o=n(7404),l=n(16039),c=n(48731),d=n(11677),u=n(90778);const m={hasLedgerChain:!1,hasWebUsb:!1,isLedgerCapable:!1,isLedgerEnabled:!1},h=!!window.USB,p=Object.keys(r.A).filter((e=>o.Y[e])),g=p.reduce(((e,t)=>[...e,...r.A[t]]),[]);let f,b=null,x=null;function A(e){const t=g.includes(e.genesisHash.toHex()),n=h&&t;return{hasLedgerChain:t,hasWebUsb:h,isLedgerCapable:n,isLedgerEnabled:n&&"none"!==l.X.ledgerConn}}const v=(0,d.e)("useLedger",(function(){const{api:e,isApiReady:t}=(0,u.h)(),n=(0,a.useCallback)((()=>function(e){const t=l.X.get().ledgerConn,n=l.X.get().ledgerApp;if(!b||x!==t||n!==f){const a=e.genesisHash.toHex(),l=p.find((e=>r.A[e].includes(a)));(0,c.hu)(l,`Unable to find a known Ledger config for genesisHash ${a}`),b="generic"===n?new s.T(t,l,o.Y.polkadot):"migration"===n?new s.T(t,l,o.Y[l]):"chainSpecific"===n?new i.P(t,l):new s.T(t,l,o.Y.polkadot),x=t,f=n}return b}(e)),[e]);return(0,a.useMemo)((()=>({...t?A(e):m,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])}},6688:(e,t,n)=>{n.d(t,{O:()=>i,V:()=>o});var a=n(2784),s=n(74065);function i(e){if(!e)return"";if(e.toLowerCase().startsWith("http"))return e;const t=e.match(/Qm[A-Za-z0-9]{44}(?![A-Za-z0-9])/);if(null!==t)return t[0];const n=e.match(/[a-z0-9]{59}(?![A-Za-z0-9])/);return null!==n?n[0]:""}const r=new Map;function o(e,t){const n=(0,s.X)(),[o,l]=(0,a.useState)(),c=(0,a.useMemo)((()=>{if(e)return e.map((e=>i(e))).filter((e=>!!e))}),[e]);return(0,a.useEffect)((()=>{n.current&&c&&async function(e){const t=new Map,n=e.map((e=>{if(r.has(e))return t.set(e,r.get(e)),Promise.resolve();const n=e.startsWith("http")?e:`https://ipfs.io/ipfs/${e}`;return fetch(n).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}},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]),k=(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((({claimedRewardsEras:e,stakingLedger:t,stashId:s})=>{if(t){const i=n.filter((n=>!function(e,t){return(e.legacyClaimedRewards||e.claimedRewards||[]).concat(t?.toArray()||[])}(t,e).some((e=>n.eq(e)))));i.length&&a.push({eras:i,stashId:s})}})),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&&k&&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,isClaimed:!1,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,k))}),[i,y,k,h,t,b]),A}))},12213:(e,t,n)=>{n.d(t,{w:()=>h});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={withClaimedRewardsEras:!0,withDestination:!0,withLedger:!0,withNominations:!0,withPrefs:!0},h=(0,r.e)("useOwnStashInfos",(function(){const{api:e}=(0,l.h)(),{allAccounts:t}=(0,o.x)(),n=(0,c.X)(),r=(0,d.y)(),[h,p]=(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,m],[e.query.staking.validators.multi,a]];e.combineLatest(s,(([e,t])=>{n.current&&r.length===e.length&&r.length===t.length&&p(r.reduce(((n,[a,s],i)=>({...n,[a]:[s,e[i],t[i]]})),{}))})).then((e=>{t=e})).catch(console.error)}else n.current&&p({});return()=>{t&&t()}}),[e,n,r]),(0,a.useMemo)((()=>r&&h&&r.length===Object.keys(h).length?r.filter((([e])=>h[e])).map((([e])=>function(e,t,[n,{claimedRewardsEras:a,controllerId:r,exposureMeta:o,exposurePaged:l,nextSessionIds:c,nominators:d,rewardDestination:m,sessionIds:h,stakingLedger:p,validatorPrefs:g},f]){const b=!!d?.length,x=!(Array.isArray(f)?f[1].isEmpty:f.isEmpty),A=c instanceof Map?[...c.values()]:c,v=(0,s.e)(...A.map((e=>e.toU8a()))),w=h instanceof Map?[...h.values()]:h,y=(0,s.e)(...w.map((e=>e.toU8a()))),k=u(r);return{claimedRewardsEras:a,controllerId:k,destination:m,exposureMeta:o,exposurePaged:l,hexSessionIdNext:(0,i.c)(v,48),hexSessionIdQueue:(0,i.c)(y.length?y:v,48),isLoading:!1,isOwnController:t.includes(k||""),isOwnStash:n,isStashNominating:b,isStashValidating:x,nominating:d?.map(u),sessionIds:(A.length?A:w).map(u),stakingLedger:p,stashId:e,validatorPrefs:g}}(e,t,h[e]))):void 0),[t,r,h])}))},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(33318),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(33403),p=n(14681),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),status:null}}}function x(e,t,n){const a=(0,c.U)(n)?n:n.unwrapOr(null),s=e=>(0,h.Z)({},t,{isCompleted:!0,...e});if(!a)return s({proposalWarning:"No preimage bytes found"});try{const t=e.tx(a.toString()),n=e.createType("Call",t.method);if(t.toHex()===a.toString())return s({proposal:n})}catch{}try{const n=e.registry.createType("Call",a),i=n.encodedLength;if(t.proposalLength){const e=t.proposalLength.toNumber();return s({proposal:n,proposalWarning:i!==e?`Decoded call length does not match on-chain stored preimage length (${(0,p.u)(i)} bytes vs ${(0,p.u)(e)} bytes)`:null})}return s({proposal:n,proposalLength:new(m())(i)})}catch(e){console.error(e)}return s({proposalError:"Unable to decode preimage bytes into a valid Call"})}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),d=(0,i.W7)(!n&&r&&t.query.preimage?.requestStatusFor,r),u=c?.isSome?c:d,{paramsBytes:m,resultPreimageFor:p}=(0,a.useMemo)((()=>l&&u?function(e,t){const n=(0,h.Z)({},e,{status:t.unwrapOr(null)});if(n.status)if(n.status.isRequested){const e=n.status.asRequested;e instanceof o.W||(n.count=e.count.toNumber(),n.deposit=A(e.maybeTicket?e.maybeTicket.unwrapOr(null):e.deposit.unwrapOr(null)),n.proposalLength=e.maybeLen?e.maybeLen.unwrapOr(g.nw):e.len.unwrapOr(g.nw))}else if(n.status.isUnrequested){const e=n.status.asUnrequested;e instanceof o.W?n.deposit=A(e.unwrapOr(null)):(n.deposit=A(e.ticket||e.deposit),n.proposalLength=e.len)}else console.error(`Unhandled PalletPreimageRequestStatus type: ${n.status.type}`);return{paramsBytes:n.isHashParam?[n.proposalHash]:[[n.proposalHash,n.proposalLength||g.nw]],resultPreimageFor:n}}(l,u):{}),[u,l]),f=(0,i.W7)(m&&t.query.preimage?.preimageFor,m);return(0,a.useMemo)((()=>p?f?x(t,p,f):p:l?n?x(t,l,n):l:void 0),[t,n,f,l,p])}))},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)}))},26309:(e,t,n)=>{n.d(t,{e:()=>l});var a=n(2784),s=n(12298),i=n(9118),r=n(11677);const o={transform:e=>e.map((({args:[e]})=>e))},l=(0,r.e)("useRegions",(function(e){const t=(0,s.k)(e?.query?.broker.regions,[],o),n=(0,i.W7)(e?.query?.broker.regions.multi,[t],{withParams:!0}),[r,l]=(0,a.useState)();return(0,a.useEffect)((()=>{n&&n[0][0].length>0&&l(n[0][0].map(((e,t)=>{return a=e.core.toNumber(),s=e.begin.toNumber(),i=n[1][t].unwrap().end.toNumber(),r=n[1][t].unwrap().owner.toString(),o=n[1][t].unwrap().paid.toString(),{core:a,end:i,mask:e.mask.toHex(),owner:r,paid:o,start:s};var a,s,i,r,o})))}),[n]),r}))},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{apiIdentity: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(33318),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:{proofSize:s.nw,refTime:t}}}const t=e.toBn();return{v1Weight:t,v2Weight:{proofSize:s.nw,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}))},59653:(e,t,n)=>{n.d(t,{E:()=>c});var a=n(2784),s=n(12298),i=n(9118),r=n(11677),o=n(33388);const l={transform:e=>e.map((({args:[e]})=>e))},c=(0,r.e)("useWorkloadInfos",(function(e,t){const n=(0,s.k)(t&&e?.query.broker.workload,[],l),r=(0,i.W7)(t&&e?.query.broker.workload.multi,[n],{withParams:!0}),[c,d]=(0,a.useState)();return(0,a.useEffect)((()=>{if(!r?.[0]?.[0])return;const e=r[0][0];var t;d((t=e.map(((e,t)=>function(e,t){const n=(0,o.Pq)(e[0]?.mask),a=e[0].assignment;return{core:t,info:{isPool:a.isPool,isTask:a.isTask,mask:n,maskBits:n.length,task:a.isTask?a.asTask.toString():a.isPool?"Pool":"Idle"}}}(r[1][t],e.toNumber()))))?(Array.isArray(t)?t:[t]).sort(((e,t)=>e.core-t.core)):[])}),[r]),c}))},22955:(e,t,n)=>{n.d(t,{b:()=>c});var a=n(2784),s=n(12298),i=n(9118),r=n(11677),o=n(33388);const l={transform:e=>e.map((({args:[e,t]})=>[e,t]))},c=(0,r.e)("useWorkplanInfos",(function(e,t){const n=(0,s.k)(t&&e?.query.broker.workplan,[],l),r=n?.map((e=>e[0])),c=(0,i.W7)(t&&e?.query.broker.workplan.multi,[r],{withParams:!0}),[d,u]=(0,a.useState)();return(0,a.useEffect)((()=>{if(!c?.[1]||!c[0]?.[0])return;const e=c[0][0];var t;u((t=e.map(((e,t)=>function(e,t,n){const a=(0,o.Pq)(e[0]?.mask),s=e[0].assignment;return{core:t,info:{isPool:s.isPool,isTask:s.isTask,mask:a,maskBits:a.length,task:s.isTask?s.asTask.toString():s.isPool?"Pool":"Idle"},timeslice:n}}(c[1][t].unwrap(),e[1].toNumber(),e[0].toNumber()))))?(Array.isArray(t)?t:[t]).sort(((e,t)=>e.core-t.core)):[])}),[c]),d}))},33388:(e,t,n)=>{function a(e){if(!e)return[];const t=e.toHex().slice(2).split(""),n=[];return t.forEach((e=>{var t;(t=e,parseInt(t,16).toString(2)).split("").forEach((e=>n.push(e)))})),n.filter((e=>"1"===e)),n}n.d(t,{Pq:()=>a})},37245:(e,t,n)=>{n.d(t,{Z:()=>r});var a=n(52322),s=n(2784);const i=n(48630).zo.div` &.withBorder { padding-left: 2rem; diff --git a/index.html b/index.html index e2a43737830d..5337d2f735d3 100644 --- a/index.html +++ b/index.html @@ -124,7 +124,7 @@ opacity: 0.15; } - +
diff --git a/locales/en/app-coretime.json b/locales/en/app-coretime.json index 7a3a06c0d162..d5fa1bc75d52 100644 --- a/locales/en/app-coretime.json +++ b/locales/en/app-coretime.json @@ -1,5 +1,12 @@ { + "Blocks (relay)": "Blocks (relay)", + "Blocks(coretime)": "Blocks(coretime)", + "Dates": "Dates", "Overview": "Overview", + "Pick a sale number": "Pick a sale number", + "Purchase a core": "Purchase a core", + "Sale": "Sale", + "Timeslices": "Timeslices", "core number": "core number", "cores sold": "cores sold", "cycle dates": "cycle dates", @@ -8,11 +15,16 @@ "cycle ts": "cycle ts", "end": "end", "last block": "last block", + "last timeslice": "last timeslice", "name": "name", "other cores": "other cores", "parachains": "parachains", "renewal": "renewal", "renewal price": "renewal price", + "sale end": "sale end", + "sale number": "sale number", + "sale progress": "sale progress", + "sold/offered": "sold/offered", "timeslice": "timeslice", "type": "type" } \ No newline at end of file diff --git a/locales/en/translation.json b/locales/en/translation.json index 1b7056a4c389..d236231829cf 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -124,7 +124,9 @@ "Bid to join": "", "Bid via Proxy": "", "Block details": "", + "Blocks (relay)": "", "Blocks nominations": "", + "Blocks(coretime)": "", "Bond": "", "Bond & Nominate": "", "Bond & Validate": "", @@ -218,6 +220,7 @@ "Custom index": "", "DCF": "", "Dark theme": "", + "Dates": "", "Deciding": "", "Decimals": "", "Decision deposit": "", @@ -527,6 +530,7 @@ "Payouts ({{count}})": "", "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.": "", "Pending call hashes": "", + "Pick a sale number": "", "Place bid": "", "Place decision deposit": "", "Place deposit": "", @@ -571,6 +575,7 @@ "Proxied": "", "Proxied account has no owned proxies": "", "Proxy overview": "", + "Purchase a core": "", "Raw seed": "", "Raw storage": "", "Read": "", @@ -622,6 +627,7 @@ "Reward implementer": "", "Reward the bounty to an implementer's account. The implementer will be able to claim the funds after a delay period.": "", "Rewards (once paid) can be deposited to either the stash or controller, with different effects.": "", + "Sale": "", "Save": "", "Save & Reload": "", "Save delegation": "", @@ -974,6 +980,7 @@ "This pubic key is what will be visible in your queued keys list. It is generated based on the seed and the crypto used.": "", "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.": "", "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.": "", + "Timeslices": "", "Tip": "", "Tip (optional)": "", "Tippers ({{count}})": "", @@ -1478,6 +1485,7 @@ "last events": "", "last period": "", "last reward": "", + "last timeslice": "", "latest": "", "launch period": "", "lease period": "", @@ -1686,6 +1694,9 @@ "rotation": "", "rule": "", "runners up": "", + "sale end": "", + "sale number": "", + "sale progress": "", "scheduled": "", "seats": "", "secret": "", @@ -1720,6 +1731,7 @@ "signature {{type}}": "", "skeptic": "", "society head": "", + "sold/offered": "", "somebody@example.com": "", "sort by": "", "spend period": "", diff --git a/main.173353315c253547.js b/main.2393d63b2782a24c.js similarity index 70% rename from main.173353315c253547.js rename to main.2393d63b2782a24c.js index 6856038f8743..e1a5bb740ade 100644 --- a/main.173353315c253547.js +++ b/main.2393d63b2782a24c.js @@ -1,4 +1,4 @@ -(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[179],{83073:(e,n,t)=>{"use strict";var r=t(52322),i=t(46157),o=t(48834).Buffer;try{3===o.from([1,2,3]).length&&(i.Ur.Buffer=o)}catch{}var s=t(85168),a=t(23729),l=t.n(a),c=t(33318),d=t(83337),p=t(16039),u=t(48731);const m=function(){const e=s.Z.parse(location.href.split("?")[1]);if(e.rpc){(0,u.hu)(!Array.isArray(e.rpc),"Invalid WS endpoint specified");const n=decodeURIComponent(e.rpc.split("#")[0]);return(0,u.hu)(n.startsWith("ws://")||n.startsWith("wss://")||n.startsWith("light://"),"Non-prefixed ws/wss/light url"),n}const n=(0,c.Rf)((()=>"")),{ipnsChain:t}=(0,d.K)();if(t){const e=n.find((({dnslink:e})=>e===t));if(e)return e.value}const r=l().get("settings")||{},i=n.find((({value:e})=>!!e));return[r.apiUrl,void 0].includes(p.X.apiUrl)?p.X.apiUrl:i?i.value:"ws://127.0.0.1:9944"}();p.X.set({apiUrl:m}),function(e){e.startsWith("light://")?console.log("Light endpoint=",e.replace("light://","")):console.log("WS endpoint=",e)}(m),t(94953);var g=t(2784),h=t(17029),f=t(39857),x=t(31383),v=t(57139),y=t(87561),b=t(3773),k=t(68944),w=t(57120),C=t(44028),A=t(91012),j=t(48630),N=t(37731),I=t(3663),S=t(90778),Z=t(4984),R=t(73557),$=t(73501),U=t(10189);function q(e){return{Component:$.Z,display:{needsApi:[]},group:"accounts",icon:"users",name:"accounts",text:e("nav.accounts","Accounts",{ns:"apps-routing"}),useCounter:U.Z}}var T=t(28096);function z(e){return{Component:T.Z,display:{needsApi:[]},group:"accounts",icon:"address-card",name:"addresses",text:e("nav.addresses","Address book",{ns:"apps-routing"})}}var E=t(49307),W=t(58370);function O(e){return{Component:E.Z,display:{needsApi:["tx.alliance.joinAlliance"]},group:"governance",icon:"people-group",name:"alliance",text:e("nav.alliance","Alliance",{ns:"apps-routing"}),useCounter:W.Z}}var P=t(18760),M=t(80901);function B(e){return{Component:P.Z,display:{needsApi:["tx.ambassadorCollective.vote","tx.ambassadorReferenda.submit","consts.ambassadorReferenda.tracks"]},group:"governance",icon:"user-friends",name:"ambassador",text:e("nav.ambassador","Ambassador",{ns:"apps-routing"}),useCounter:M.Z}}var F=t(39559);function D(e){return{Component:F.Z,display:{needsApi:["tx.assets.setMetadata","tx.assets.transferKeepAlive"]},group:"network",icon:"shopping-basket",name:"assets",text:e("nav.assets","Assets",{ns:"apps-routing"})}}var H=t(95039),L=t(19739);function X(e){return{Component:H.Z,display:{needsApi:[["tx.bounties.proposeBounty","tx.treasury.proposeBounty"]]},group:"governance",icon:"coins",name:"bounties",text:e("nav.bounties","Bounties",{ns:"apps-routing"}),useCounter:L.Z}}var J=t(22887);function V(e){return{Component:J.Z,display:{needsApi:["query.broker.status"],needsApiInstances:!0},group:"network",icon:"flask",name:"broker",text:e("nav.broker","Coretime Broker (Experimental)",{ns:"app-broker"})}}var _=t(6742);function G(e){return{Component:_.Z,display:{needsApi:[]},group:"network",icon:"calendar-alt",name:"calendar",text:e("nav.calendar","Event calendar",{ns:"apps-routing"})}}var K=t(75798),Y=t(73352),Q=t(31725),ee=t(84195),ne=t(48834).Buffer;function te(){try{if(!ne.from([1,2,3])?.length)return console.error("ERROR: Unable to construct Buffer object for claims module"),!1;if(!Q.cR||!ne.isBuffer((0,ee.Y)(new Uint8Array([1,2,3]))))return console.error("ERROR: Unable to use u8aToBuffer for claims module"),!1}catch{return console.error("ERROR: Fatal error in working with Buffer module"),!1}return!0}function re(e){return{Component:K.Z,display:{needsAccounts:!0,needsApi:["tx.claims.mintClaim"],needsApiCheck:te},group:"accounts",icon:"star",name:"claims",text:e("nav.claims","Claim Tokens",{ns:"apps-routing"}),useCounter:Y.Z}}var ie=t(2799);function oe(e){return{Component:ie.Z,display:{needsApi:["query.collatorSelection.candidacyBond"]},group:"network",icon:"timeline",name:"collators",text:e("nav.collator","Collators",{ns:"apps-routing"})}}var se=t(22516);function ae(e){try{return(0,u.k8)(6===e.tx.contracts.instantiateWithCode.meta.args.length,"Invalid args")}catch{return console.warn("Contract interface does not support storageDepositLimit, disabling route"),!1}}function le(e){return{Component:se.Z,display:{needsAccounts:!0,needsApi:["tx.contracts.instantiateWithCode"],needsApiCheck:ae},group:"developer",icon:"compress",name:"contracts",text:e("nav.contracts","Contracts",{ns:"apps-routing"})}}var ce=t(1642);function de(e){return{Component:ce.Z,display:{needsApi:["query.coretimeAssignmentProvider.coreDescriptors"],needsApiInstances:!0},group:"network",icon:"flask",name:"coretime",text:e("nav.coretime","Coretime (Experimental)",{ns:"apps-routing"})}}var pe=t(18324),ue=t(40740);function me(e){return{Component:pe.Z,display:{needsApi:["query.council.prime"],needsApiInstances:!0},group:"governance",icon:"building",name:"council",text:e("nav.council","Council",{ns:"apps-routing"}),useCounter:ue.Z}}var ge=t(50472),he=t(61491);function fe(e){try{return e.tx.democracy.vote(1,{Standard:{balance:1,vote:{aye:!0,conviction:1}}}),!0}catch{return console.warn("Unable to create referendum vote transaction, disabling democracy route"),!1}}function xe(e){return{Component:ge.Z,display:{needsApi:["tx.democracy.propose"],needsApiCheck:fe},group:"governance",icon:"calendar-check",name:"democracy",text:e("nav.democracy","Democracy",{ns:"apps-routing"}),useCounter:he.Z}}var ve=t(51406);function ye(e){return{Component:ve.Z,display:{needsApi:[]},group:"network",icon:"braille",name:"explorer",text:e("nav.explorer","Explorer",{ns:"apps-routing"})}}var be=t(38080);function ke(e){return{Component:be.Z,display:{needsAccounts:!0,needsApi:[]},group:"developer",icon:"envelope-open-text",name:"extrinsics",text:e("nav.extrinsics","Extrinsics",{ns:"apps-routing"})}}var we=t(58064),Ce=t(16472);function Ae(e){return{Component:we.Z,display:{needsApi:["tx.fellowshipCollective.vote","tx.fellowshipReferenda.submit","consts.fellowshipReferenda.tracks"]},group:"governance",icon:"people-arrows",name:"fellowship",text:e("nav.fellowship","Fellowship",{ns:"apps-routing"}),useCounter:Ce.Z}}var je=t(31043);function Ne(e){return{Component:je.Z,display:{needsAccounts:!0,needsApi:[]},group:"developer",icon:"file",name:"files",text:e("nav.files","Files (IPFS)",{ns:"apps-routing"})}}var Ie=t(79865);function Se(e){return{Component:Ie.Z,display:{needsApi:["tx.gilt.placeBid","query.proxy.proxies"]},group:"network",icon:"leaf",name:"gilt",text:e("nav.gilt","Gilt",{ns:"apps-routing"})}}var Ze=t(30145);function Re(e){return{Component:Ze.Z,display:{needsApi:[]},group:"developer",icon:"code",name:"js",text:e("nav.js","JavaScript",{ns:"apps-routing"})}}var $e=t(51213),Ue=t(16743);function qe(e){return{Component:$e.Z,display:{needsAccounts:!0,needsApi:["query.membership.members"]},group:"governance",icon:"people-carry",name:"membership",text:e("nav.membership","Membership",{ns:"apps-routing"}),useCounter:Ue.Z}}var Te=t(50313);function ze(e){return{Component:Te.Z,display:{needsApi:["tx.uniques.create"]},group:"network",icon:"shopping-cart",name:"nfts",text:e("nav.nfts","NFTs",{ns:"apps-routing"})}}var Ee=t(90992);function We(e){return{Component:Ee.Z,display:{needsApi:["tx.nis.placeBid","query.proxy.proxies"]},group:"network",icon:"leaf",name:"nis",text:e("nav.nis","Non-interactive Staking",{ns:"apps-routing"})}}var Oe=t(93242);function Pe(e){return{Component:Oe.Z,display:{needsApi:[["query.paras.parachains"]]},group:"network",icon:"link",name:"parachains",text:e("nav.parachains","Parachains",{ns:"apps-routing"})}}var Me=t(94349);function Be(e){return{Component:Me.Z,display:{needsAccounts:!0,needsApi:["tx.poll.vote"]},group:"governance",icon:"podcast",name:"poll",text:e("nav.poll","Token poll",{ns:"apps-routing"})}}var Fe=t(20600);function De(e){return{Component:Fe.Z,display:{needsAccounts:!0,needsApi:["query.preimage.statusFor","tx.preimage.notePreimage"]},group:"governance",icon:"panorama",name:"preimages",text:e("nav.preimages","Preimages",{ns:"apps-routing"})}}var He=t(41857),Le=t(76288);function Xe(e){return{Component:He.Z,display:{needsAccounts:!0,needsApi:["tx.rankedCollective.vote","tx.rankedPolls.submit"]},group:"governance",icon:"people-arrows",name:"ranked",text:e("nav.ranked","Ranked collective",{ns:"apps-routing"}),useCounter:Le.Z}}var Je=t(89139),Ve=t(1398);function _e(e){return{Component:Je.Z,display:{needsApi:["tx.referenda.submit","tx.convictionVoting.vote","consts.referenda.tracks"]},group:"governance",icon:"person-booth",name:"referenda",text:e("nav.referenda","Referenda",{ns:"apps-routing"}),useCounter:Ve.Z}}var Ge=t(6583);function Ke(e){return{Component:Ge.Z,display:{needsApi:[]},group:"developer",icon:"network-wired",name:"rpc",text:e("nav.rpc","RPC calls",{ns:"apps-routing"})}}var Ye=t(39117);function Qe(e){return{Component:Ye.Z,display:{needsApi:[]},group:"developer",icon:"arrows-to-circle",name:"runtime",text:e("nav.runtime","Runtime calls",{ns:"apps-routing"})}}var en=t(14673);function nn(e){return{Component:en.Z,display:{needsApi:["query.scheduler.agenda"]},group:"network",icon:"clock",name:"scheduler",text:e("nav.scheduler","Scheduler",{ns:"apps-routing"})}}var tn=t(32785),rn=t(76075);function on(e){return{Component:tn.Z,display:{},group:"settings",icon:"cogs",name:"settings",text:e("nav.settings","Settings",{ns:"apps-routing"}),useCounter:rn.Z}}var sn=t(24569);function an(e){return{Component:sn.Z,display:{needsAccounts:!0,needsApi:[]},group:"developer",icon:"signature",name:"signing",text:e("nav.signing","Sign and verify",{ns:"apps-routing"})}}var ln=t(96246),cn=t(58900);function dn(e){return{Component:ln.Z,display:{needsAccounts:!0,needsApi:["query.society.pot"]},group:"network",icon:"hand-spock",name:"society",text:e("nav.society","Society",{ns:"apps-routing"}),useCounter:cn.Z}}var pn=t(11337),un=t(56949),mn=t(19729),gn=t(95292);function hn(e){try{const{nominatorCount:n,own:t,pageCount:r,total:i}=e.registry.createType((0,mn.P)(e.registry,e.query.staking.erasStakersOverview.creator.meta.type),{nominatorCount:gn.If,own:gn.If,pageCount:gn.If,total:gn.If});(0,u.hu)(i&&t&&n&&r&&i.eq(gn.If)&&t.eq(gn.If),"Needs a known Exposure type")}catch{return console.warn("Unable to create known-shape Exposure type, disabling staking route"),!1}try{if(3===e.tx.staking.bond.meta.args.length)e.tx.staking.bond(un.TS,gn.If,{Account:un.TS});else{if(2!==e.tx.staking.bond.meta.args.length)return!1;e.tx.staking.bond(gn.If,{Account:un.TS})}}catch{return console.warn("Unable to create staking bond transaction, disabling staking route"),!1}try{const n=e.registry.createType((0,mn.P)(e.registry,e.query.staking.claimedRewards.creator.meta.type),[0]);(0,u.hu)(n.eq([0]),"Needs a legacyClaimedRewards array")}catch{return console.warn("No known legacyClaimedRewards or claimedRewards inside staking ledger, disabling staking route"),!1}return!0}function fn(e){return{Component:pn.Z,display:{needsApi:["query.staking.erasStakersOverview","tx.staking.bond"],needsApiCheck:hn},group:"network",icon:"certificate",name:"staking",text:e("nav.staking","Staking",{ns:"apps-routing"})}}var xn=t(97473);function vn(e){try{const{others:[{value:n,who:t}],own:r,total:i}=e.registry.createType((0,mn.P)(e.registry,e.query.staking.erasStakers.creator.meta.type),{others:[{value:gn.If,who:un.TS}],own:gn.If,total:gn.If});(0,u.hu)(i&&r&&n&&t&&i.eq(gn.If)&&r.eq(gn.If)&&n.eq(gn.If),"Needs a known Exposure type")}catch{return console.warn("Unable to create known-shape Exposure type, disabling staking route"),!1}try{if(3===e.tx.staking.bond.meta.args.length)e.tx.staking.bond(un.TS,gn.If,{Account:un.TS});else{if(2!==e.tx.staking.bond.meta.args.length)return!1;e.tx.staking.bond(gn.If,{Account:un.TS})}}catch{return console.warn("Unable to create staking bond transaction, disabling staking route"),!1}return!0}function yn(e){return{Component:xn.Z,display:{isHidden:!0,needsApi:["query.session.validators","query.staking.erasStakers","tx.staking.bond"],needsApiCheck:vn},group:"network",icon:"certificate",name:"test-staking",text:e("nav.staking","Staking",{ns:"apps-routing"})}}var bn=t(77854);function kn(e){if("function"==typeof e.query.staking.erasStakersOverview)return!1;try{const{others:[{value:n,who:t}],own:r,total:i}=e.registry.createType((0,mn.P)(e.registry,e.query.staking.erasStakers.creator.meta.type),{others:[{value:gn.If,who:un.TS}],own:gn.If,total:gn.If});(0,u.hu)(i&&r&&n&&t&&i.eq(gn.If)&&r.eq(gn.If)&&n.eq(gn.If),"Needs a known Exposure type")}catch{return console.warn("Unable to create known-shape Exposure type, disabling staking route"),!1}try{if(3===e.tx.staking.bond.meta.args.length)e.tx.staking.bond(un.TS,gn.If,{Account:un.TS});else{if(2!==e.tx.staking.bond.meta.args.length)return!1;e.tx.staking.bond(gn.If,{Account:un.TS})}}catch{return console.warn("Unable to create staking bond transaction, disabling staking route"),!1}try{const n=e.registry.createType((0,mn.P)(e.registry,e.query.staking.ledger.creator.meta.type),{claimedRewards:[1,2,3]});if(n.claimedRewards)(0,u.hu)(n.claimedRewards.eq([1,2,3]),"Needs a claimedRewards array");else{const n=e.registry.createType((0,mn.P)(e.registry,e.query.staking.ledger.creator.meta.type),{legacyClaimedRewards:[1,2,3]});(0,u.hu)(n.legacyClaimedRewards.eq([1,2,3]),"Needs a legacyClaimedRewards array")}}catch{return console.warn("No known legacyClaimedRewards or claimedRewards inside staking ledger, disabling staking route"),!1}return!0}function wn(e){return{Component:bn.Z,display:{needsApi:["query.staking.erasStakers","tx.staking.bond"],needsApiCheck:kn},group:"network",icon:"certificate",name:"legacy-staking",text:e("nav.staking","Staking",{ns:"apps-routing"})}}var Cn=t(46717);function An(e){return{Component:Cn.Z,display:{needsApi:[]},group:"developer",icon:"database",name:"chainstate",text:e("nav.storage","Chain state",{ns:"apps-routing"})}}var jn=t(54676);function Nn(e){return{Component:jn.Z,display:{needsAccounts:!0,needsApi:["tx.sudo.setKey"],needsSudo:!0},group:"developer",icon:"unlock",name:"sudo",text:e("nav.sudo","Sudo",{ns:"apps-routing"})}}var In=t(75509),Sn=t(87340);function Zn(e){return{Component:In.Z,display:{needsAccounts:!0,needsApi:["query.technicalCommittee.members"],needsApiInstances:!0},group:"governance",icon:"microchip",name:"techcomm",text:e("nav.tech-comm","Tech. comm.",{ns:"apps-routing"}),useCounter:Sn.Z}}var Rn=t(9847);function $n(e){return{Component:Rn.Z,Modal:Rn.Z,display:{isHidden:!1,needsAccounts:!0,needsApi:[["tx.xcm.teleportAssets","tx.xcmPallet.teleportAssets","tx.polkadotXcm.teleportAssets","tx.xcm.limitedTeleportAssets","tx.xcmPallet.limitedTeleportAssets","tx.polkadotXcm.limitedTeleportAssets"]],needsTeleport:!0},group:"accounts",icon:"share-square",name:"teleport",text:e("nav.teleport","Teleport",{ns:"apps-routing"})}}function Un(e){return{Component:j.Zd,Modal:j.Zd,display:{isHidden:!1,needsAccounts:!0,needsApi:["tx.balances.transferKeepAlive"]},group:"accounts",icon:"paper-plane",name:"transfer",text:e("nav.transfer","Transfer",{ns:"apps-routing"})}}var qn=t(74425),Tn=t(9039);function zn(e){return{Component:qn.Z,display:{needsApi:["query.treasury.proposals"]},group:"governance",icon:"gem",name:"treasury",text:e("nav.treasury","Treasury",{ns:"apps-routing"}),useCounter:Tn.Z}}var En=t(27008);function Wn(e){return{Component:En.Z,display:{needsApi:[]},group:"developer",icon:"wrench",name:"utilities",text:e("nav.utilities","Utilities",{ns:"apps-routing"})}}var On=t(7644);function Pn(e){return{Component:On.Z,display:{needsAccounts:!0,needsApi:["tx.whitelist.removeWhitelistedCall"]},group:"governance",icon:"list-check",name:"whitelist",text:e("nav.whitelist","Whitelist",{ns:"apps-routing"})}}function Mn(e){return[q(e),z(e),ye(e),re(e),Be(e),Un(e),$n(e),fn(e),yn(e),wn(e),oe(e),V(e),de(e),_e(e),qe(e),O(e),B(e),Ae(e),Xe(e),De(e),Pn(e),xe(e),me(e),Zn(e),zn(e),X(e),Pe(e),D(e),ze(e),dn(e),We(e),Se(e),nn(e),G(e),le(e),An(e),ke(e),Ke(e),Qe(e),an(e),Nn(e),Ne(e),Re(e),Wn(e),on(e)]}var Bn=t(86135),Fn=t(59149),Dn=t(82671),Hn=t(33661);function Ln(e,n,t){const[r,i,o]=n.split("."),[s]=t&&e.registry.getModuleInstances(e.runtimeVersion.specName.toString(),i)||[i],a=e[r][s]?s:i;try{return"consts"===r?(0,Dn.K)(e[r][a][o]):(0,Hn.m)(e[r][a][o])}catch{return!1}}function Xn(e,n,t=!1,r){if(!n)return[];const i=n.filter((n=>!(Array.isArray(n)?n.reduce(((n,r)=>n||Ln(e,r,t)),!1):Ln(e,n,t))));return i.length||!r||r(e)?i:["needsApiCheck"]}var Jn=t(61349);function Vn(){return(0,Jn.$G)("apps")}const _n=g.memo((function({basePath:e,missingApis:n=[]}){return console.log(`Redirecting from route "${e}" to "/explorer"${n.length?`, missing the following APIs: ${JSON.stringify(n)}`:""}`),(0,r.jsx)(R.Fg,{to:"/explorer"})}));var Gn=t(34814),Kn=t(9118),Yn=t(64021),Qn=t(69516);let et;const nt=g.memo((function({optionsAll:e}){const{queueAction:n}=(0,Bn.L)(),{api:t,isApiReady:i}=(0,S.h)(),{allAccounts:o}=(0,Gn.x)(),{t:s}=Vn(),a=(0,Kn.W7)(i&&t.query.system?.events);return(0,g.useEffect)((()=>{const t=function(e,n,t,r){const i=(0,Qn.R)((0,Yn.d)(JSON.stringify(r)));return t&&r&&i!==et?(et=i,r.map((({event:{data:t,method:r,section:i}})=>{if("balances"===i&&"Transfer"===r){const o=t[1].toString();if(e.includes(o))return{account:o,action:`${i}.${r}`,message:n("transfer received"),status:"event"}}else if("democracy"===i){const e=t[0].toString();return{action:`${i}.${r}`,message:n("update on #{{index}}",{replace:{index:e}}),status:"event"}}return null})).filter((e=>!!e))):null}(o,s,e,a);t&&n(t)}),[o,a,e,n,s]),(0,r.jsx)(j.qb,{})})),tt={Component:_n,display:{},group:"settings",icon:"times",isIgnored:!1,name:"unknown",text:"Unknown"},rt=j.zo.div` +(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[179],{83073:(e,n,t)=>{"use strict";var r=t(52322),i=t(46157),o=t(48834).Buffer;try{3===o.from([1,2,3]).length&&(i.Ur.Buffer=o)}catch{}var s=t(85168),a=t(23729),l=t.n(a),c=t(33318),d=t(83337),p=t(16039),u=t(48731);const m=function(){const e=s.Z.parse(location.href.split("?")[1]);if(e.rpc){(0,u.hu)(!Array.isArray(e.rpc),"Invalid WS endpoint specified");const n=decodeURIComponent(e.rpc.split("#")[0]);return(0,u.hu)(n.startsWith("ws://")||n.startsWith("wss://")||n.startsWith("light://"),"Non-prefixed ws/wss/light url"),n}const n=(0,c.Rf)((()=>"")),{ipnsChain:t}=(0,d.K)();if(t){const e=n.find((({dnslink:e})=>e===t));if(e)return e.value}const r=l().get("settings")||{},i=n.find((({value:e})=>!!e));return[r.apiUrl,void 0].includes(p.X.apiUrl)?p.X.apiUrl:i?i.value:"ws://127.0.0.1:9944"}();p.X.set({apiUrl:m}),function(e){e.startsWith("light://")?console.log("Light endpoint=",e.replace("light://","")):console.log("WS endpoint=",e)}(m),t(94953);var g=t(2784),h=t(17029),f=t(39857),x=t(31383),v=t(57139),y=t(87561),b=t(3773),k=t(68944),w=t(57120),C=t(44028),A=t(91012),j=t(48630),N=t(37731),I=t(3663),S=t(90778),Z=t(4984),R=t(73557),$=t(73501),U=t(10189);function q(e){return{Component:$.Z,display:{needsApi:[]},group:"accounts",icon:"users",name:"accounts",text:e("nav.accounts","Accounts",{ns:"apps-routing"}),useCounter:U.Z}}var T=t(28096);function z(e){return{Component:T.Z,display:{needsApi:[]},group:"accounts",icon:"address-card",name:"addresses",text:e("nav.addresses","Address book",{ns:"apps-routing"})}}var E=t(49307),W=t(58370);function O(e){return{Component:E.Z,display:{needsApi:["tx.alliance.joinAlliance"]},group:"governance",icon:"people-group",name:"alliance",text:e("nav.alliance","Alliance",{ns:"apps-routing"}),useCounter:W.Z}}var P=t(18760),M=t(80901);function B(e){return{Component:P.Z,display:{needsApi:["tx.ambassadorCollective.vote","tx.ambassadorReferenda.submit","consts.ambassadorReferenda.tracks"]},group:"governance",icon:"user-friends",name:"ambassador",text:e("nav.ambassador","Ambassador",{ns:"apps-routing"}),useCounter:M.Z}}var F=t(39559);function D(e){return{Component:F.Z,display:{needsApi:["tx.assets.setMetadata","tx.assets.transferKeepAlive"]},group:"network",icon:"shopping-basket",name:"assets",text:e("nav.assets","Assets",{ns:"apps-routing"})}}var H=t(95039),L=t(19739);function X(e){return{Component:H.Z,display:{needsApi:[["tx.bounties.proposeBounty","tx.treasury.proposeBounty"]]},group:"governance",icon:"coins",name:"bounties",text:e("nav.bounties","Bounties",{ns:"apps-routing"}),useCounter:L.Z}}var J=t(39372);function V(e){return{Component:J.Z,display:{needsApi:["query.broker.status"],needsApiInstances:!0},group:"network",icon:"flask",name:"broker",text:e("nav.broker","Coretime Broker (Experimental)",{ns:"app-broker"})}}var _=t(6742);function G(e){return{Component:_.Z,display:{needsApi:[]},group:"network",icon:"calendar-alt",name:"calendar",text:e("nav.calendar","Event calendar",{ns:"apps-routing"})}}var K=t(75798),Y=t(73352),Q=t(31725),ee=t(84195),ne=t(48834).Buffer;function te(){try{if(!ne.from([1,2,3])?.length)return console.error("ERROR: Unable to construct Buffer object for claims module"),!1;if(!Q.cR||!ne.isBuffer((0,ee.Y)(new Uint8Array([1,2,3]))))return console.error("ERROR: Unable to use u8aToBuffer for claims module"),!1}catch{return console.error("ERROR: Fatal error in working with Buffer module"),!1}return!0}function re(e){return{Component:K.Z,display:{needsAccounts:!0,needsApi:["tx.claims.mintClaim"],needsApiCheck:te},group:"accounts",icon:"star",name:"claims",text:e("nav.claims","Claim Tokens",{ns:"apps-routing"}),useCounter:Y.Z}}var ie=t(2799);function oe(e){return{Component:ie.Z,display:{needsApi:["query.collatorSelection.candidacyBond"]},group:"network",icon:"timeline",name:"collators",text:e("nav.collator","Collators",{ns:"apps-routing"})}}var se=t(22516);function ae(e){try{return(0,u.k8)(6===e.tx.contracts.instantiateWithCode.meta.args.length,"Invalid args")}catch{return console.warn("Contract interface does not support storageDepositLimit, disabling route"),!1}}function le(e){return{Component:se.Z,display:{needsAccounts:!0,needsApi:["tx.contracts.instantiateWithCode"],needsApiCheck:ae},group:"developer",icon:"compress",name:"contracts",text:e("nav.contracts","Contracts",{ns:"apps-routing"})}}var ce=t(39380);function de(e){return{Component:ce.Z,display:{needsApi:["query.coretimeAssignmentProvider.coreDescriptors"],needsApiInstances:!0},group:"network",icon:"flask",name:"coretime",text:e("nav.coretime","Coretime (Experimental)",{ns:"apps-routing"})}}var pe=t(18324),ue=t(40740);function me(e){return{Component:pe.Z,display:{needsApi:["query.council.prime"],needsApiInstances:!0},group:"governance",icon:"building",name:"council",text:e("nav.council","Council",{ns:"apps-routing"}),useCounter:ue.Z}}var ge=t(50472),he=t(61491);function fe(e){try{return e.tx.democracy.vote(1,{Standard:{balance:1,vote:{aye:!0,conviction:1}}}),!0}catch{return console.warn("Unable to create referendum vote transaction, disabling democracy route"),!1}}function xe(e){return{Component:ge.Z,display:{needsApi:["tx.democracy.propose"],needsApiCheck:fe},group:"governance",icon:"calendar-check",name:"democracy",text:e("nav.democracy","Democracy",{ns:"apps-routing"}),useCounter:he.Z}}var ve=t(51406);function ye(e){return{Component:ve.Z,display:{needsApi:[]},group:"network",icon:"braille",name:"explorer",text:e("nav.explorer","Explorer",{ns:"apps-routing"})}}var be=t(38080);function ke(e){return{Component:be.Z,display:{needsAccounts:!0,needsApi:[]},group:"developer",icon:"envelope-open-text",name:"extrinsics",text:e("nav.extrinsics","Extrinsics",{ns:"apps-routing"})}}var we=t(58064),Ce=t(16472);function Ae(e){return{Component:we.Z,display:{needsApi:["tx.fellowshipCollective.vote","tx.fellowshipReferenda.submit","consts.fellowshipReferenda.tracks"]},group:"governance",icon:"people-arrows",name:"fellowship",text:e("nav.fellowship","Fellowship",{ns:"apps-routing"}),useCounter:Ce.Z}}var je=t(31043);function Ne(e){return{Component:je.Z,display:{needsAccounts:!0,needsApi:[]},group:"developer",icon:"file",name:"files",text:e("nav.files","Files (IPFS)",{ns:"apps-routing"})}}var Ie=t(79865);function Se(e){return{Component:Ie.Z,display:{needsApi:["tx.gilt.placeBid","query.proxy.proxies"]},group:"network",icon:"leaf",name:"gilt",text:e("nav.gilt","Gilt",{ns:"apps-routing"})}}var Ze=t(30145);function Re(e){return{Component:Ze.Z,display:{needsApi:[]},group:"developer",icon:"code",name:"js",text:e("nav.js","JavaScript",{ns:"apps-routing"})}}var $e=t(51213),Ue=t(16743);function qe(e){return{Component:$e.Z,display:{needsAccounts:!0,needsApi:["query.membership.members"]},group:"governance",icon:"people-carry",name:"membership",text:e("nav.membership","Membership",{ns:"apps-routing"}),useCounter:Ue.Z}}var Te=t(50313);function ze(e){return{Component:Te.Z,display:{needsApi:["tx.uniques.create"]},group:"network",icon:"shopping-cart",name:"nfts",text:e("nav.nfts","NFTs",{ns:"apps-routing"})}}var Ee=t(90992);function We(e){return{Component:Ee.Z,display:{needsApi:["tx.nis.placeBid","query.proxy.proxies"]},group:"network",icon:"leaf",name:"nis",text:e("nav.nis","Non-interactive Staking",{ns:"apps-routing"})}}var Oe=t(93242);function Pe(e){return{Component:Oe.Z,display:{needsApi:[["query.paras.parachains"]]},group:"network",icon:"link",name:"parachains",text:e("nav.parachains","Parachains",{ns:"apps-routing"})}}var Me=t(94349);function Be(e){return{Component:Me.Z,display:{needsAccounts:!0,needsApi:["tx.poll.vote"]},group:"governance",icon:"podcast",name:"poll",text:e("nav.poll","Token poll",{ns:"apps-routing"})}}var Fe=t(20600);function De(e){return{Component:Fe.Z,display:{needsAccounts:!0,needsApi:["query.preimage.statusFor","tx.preimage.notePreimage"]},group:"governance",icon:"panorama",name:"preimages",text:e("nav.preimages","Preimages",{ns:"apps-routing"})}}var He=t(41857),Le=t(76288);function Xe(e){return{Component:He.Z,display:{needsAccounts:!0,needsApi:["tx.rankedCollective.vote","tx.rankedPolls.submit"]},group:"governance",icon:"people-arrows",name:"ranked",text:e("nav.ranked","Ranked collective",{ns:"apps-routing"}),useCounter:Le.Z}}var Je=t(89139),Ve=t(1398);function _e(e){return{Component:Je.Z,display:{needsApi:["tx.referenda.submit","tx.convictionVoting.vote","consts.referenda.tracks"]},group:"governance",icon:"person-booth",name:"referenda",text:e("nav.referenda","Referenda",{ns:"apps-routing"}),useCounter:Ve.Z}}var Ge=t(6583);function Ke(e){return{Component:Ge.Z,display:{needsApi:[]},group:"developer",icon:"network-wired",name:"rpc",text:e("nav.rpc","RPC calls",{ns:"apps-routing"})}}var Ye=t(39117);function Qe(e){return{Component:Ye.Z,display:{needsApi:[]},group:"developer",icon:"arrows-to-circle",name:"runtime",text:e("nav.runtime","Runtime calls",{ns:"apps-routing"})}}var en=t(14673);function nn(e){return{Component:en.Z,display:{needsApi:["query.scheduler.agenda"]},group:"network",icon:"clock",name:"scheduler",text:e("nav.scheduler","Scheduler",{ns:"apps-routing"})}}var tn=t(32785),rn=t(76075);function on(e){return{Component:tn.Z,display:{},group:"settings",icon:"cogs",name:"settings",text:e("nav.settings","Settings",{ns:"apps-routing"}),useCounter:rn.Z}}var sn=t(24569);function an(e){return{Component:sn.Z,display:{needsAccounts:!0,needsApi:[]},group:"developer",icon:"signature",name:"signing",text:e("nav.signing","Sign and verify",{ns:"apps-routing"})}}var ln=t(96246),cn=t(58900);function dn(e){return{Component:ln.Z,display:{needsAccounts:!0,needsApi:["query.society.pot"]},group:"network",icon:"hand-spock",name:"society",text:e("nav.society","Society",{ns:"apps-routing"}),useCounter:cn.Z}}var pn=t(11337),un=t(56949),mn=t(19729),gn=t(95292);function hn(e){try{const{nominatorCount:n,own:t,pageCount:r,total:i}=e.registry.createType((0,mn.P)(e.registry,e.query.staking.erasStakersOverview.creator.meta.type),{nominatorCount:gn.If,own:gn.If,pageCount:gn.If,total:gn.If});(0,u.hu)(i&&t&&n&&r&&i.eq(gn.If)&&t.eq(gn.If),"Needs a known Exposure type")}catch{return console.warn("Unable to create known-shape Exposure type, disabling staking route"),!1}try{if(3===e.tx.staking.bond.meta.args.length)e.tx.staking.bond(un.TS,gn.If,{Account:un.TS});else{if(2!==e.tx.staking.bond.meta.args.length)return!1;e.tx.staking.bond(gn.If,{Account:un.TS})}}catch{return console.warn("Unable to create staking bond transaction, disabling staking route"),!1}try{const n=e.registry.createType((0,mn.P)(e.registry,e.query.staking.claimedRewards.creator.meta.type),[0]);(0,u.hu)(n.eq([0]),"Needs a legacyClaimedRewards array")}catch{return console.warn("No known legacyClaimedRewards or claimedRewards inside staking ledger, disabling staking route"),!1}return!0}function fn(e){return{Component:pn.Z,display:{needsApi:["query.staking.erasStakersOverview","tx.staking.bond"],needsApiCheck:hn},group:"network",icon:"certificate",name:"staking",text:e("nav.staking","Staking",{ns:"apps-routing"})}}var xn=t(97473);function vn(e){try{const{others:[{value:n,who:t}],own:r,total:i}=e.registry.createType((0,mn.P)(e.registry,e.query.staking.erasStakers.creator.meta.type),{others:[{value:gn.If,who:un.TS}],own:gn.If,total:gn.If});(0,u.hu)(i&&r&&n&&t&&i.eq(gn.If)&&r.eq(gn.If)&&n.eq(gn.If),"Needs a known Exposure type")}catch{return console.warn("Unable to create known-shape Exposure type, disabling staking route"),!1}try{if(3===e.tx.staking.bond.meta.args.length)e.tx.staking.bond(un.TS,gn.If,{Account:un.TS});else{if(2!==e.tx.staking.bond.meta.args.length)return!1;e.tx.staking.bond(gn.If,{Account:un.TS})}}catch{return console.warn("Unable to create staking bond transaction, disabling staking route"),!1}return!0}function yn(e){return{Component:xn.Z,display:{isHidden:!0,needsApi:["query.session.validators","query.staking.erasStakers","tx.staking.bond"],needsApiCheck:vn},group:"network",icon:"certificate",name:"test-staking",text:e("nav.staking","Staking",{ns:"apps-routing"})}}var bn=t(77854);function kn(e){if("function"==typeof e.query.staking.erasStakersOverview)return!1;try{const{others:[{value:n,who:t}],own:r,total:i}=e.registry.createType((0,mn.P)(e.registry,e.query.staking.erasStakers.creator.meta.type),{others:[{value:gn.If,who:un.TS}],own:gn.If,total:gn.If});(0,u.hu)(i&&r&&n&&t&&i.eq(gn.If)&&r.eq(gn.If)&&n.eq(gn.If),"Needs a known Exposure type")}catch{return console.warn("Unable to create known-shape Exposure type, disabling staking route"),!1}try{if(3===e.tx.staking.bond.meta.args.length)e.tx.staking.bond(un.TS,gn.If,{Account:un.TS});else{if(2!==e.tx.staking.bond.meta.args.length)return!1;e.tx.staking.bond(gn.If,{Account:un.TS})}}catch{return console.warn("Unable to create staking bond transaction, disabling staking route"),!1}try{const n=e.registry.createType((0,mn.P)(e.registry,e.query.staking.ledger.creator.meta.type),{claimedRewards:[1,2,3]});if(n.claimedRewards)(0,u.hu)(n.claimedRewards.eq([1,2,3]),"Needs a claimedRewards array");else{const n=e.registry.createType((0,mn.P)(e.registry,e.query.staking.ledger.creator.meta.type),{legacyClaimedRewards:[1,2,3]});(0,u.hu)(n.legacyClaimedRewards.eq([1,2,3]),"Needs a legacyClaimedRewards array")}}catch{return console.warn("No known legacyClaimedRewards or claimedRewards inside staking ledger, disabling staking route"),!1}return!0}function wn(e){return{Component:bn.Z,display:{needsApi:["query.staking.erasStakers","tx.staking.bond"],needsApiCheck:kn},group:"network",icon:"certificate",name:"legacy-staking",text:e("nav.staking","Staking",{ns:"apps-routing"})}}var Cn=t(46717);function An(e){return{Component:Cn.Z,display:{needsApi:[]},group:"developer",icon:"database",name:"chainstate",text:e("nav.storage","Chain state",{ns:"apps-routing"})}}var jn=t(54676);function Nn(e){return{Component:jn.Z,display:{needsAccounts:!0,needsApi:["tx.sudo.setKey"],needsSudo:!0},group:"developer",icon:"unlock",name:"sudo",text:e("nav.sudo","Sudo",{ns:"apps-routing"})}}var In=t(75509),Sn=t(87340);function Zn(e){return{Component:In.Z,display:{needsAccounts:!0,needsApi:["query.technicalCommittee.members"],needsApiInstances:!0},group:"governance",icon:"microchip",name:"techcomm",text:e("nav.tech-comm","Tech. comm.",{ns:"apps-routing"}),useCounter:Sn.Z}}var Rn=t(9847);function $n(e){return{Component:Rn.Z,Modal:Rn.Z,display:{isHidden:!1,needsAccounts:!0,needsApi:[["tx.xcm.teleportAssets","tx.xcmPallet.teleportAssets","tx.polkadotXcm.teleportAssets","tx.xcm.limitedTeleportAssets","tx.xcmPallet.limitedTeleportAssets","tx.polkadotXcm.limitedTeleportAssets"]],needsTeleport:!0},group:"accounts",icon:"share-square",name:"teleport",text:e("nav.teleport","Teleport",{ns:"apps-routing"})}}function Un(e){return{Component:j.Zd,Modal:j.Zd,display:{isHidden:!1,needsAccounts:!0,needsApi:["tx.balances.transferKeepAlive"]},group:"accounts",icon:"paper-plane",name:"transfer",text:e("nav.transfer","Transfer",{ns:"apps-routing"})}}var qn=t(74425),Tn=t(9039);function zn(e){return{Component:qn.Z,display:{needsApi:["query.treasury.proposals"]},group:"governance",icon:"gem",name:"treasury",text:e("nav.treasury","Treasury",{ns:"apps-routing"}),useCounter:Tn.Z}}var En=t(27008);function Wn(e){return{Component:En.Z,display:{needsApi:[]},group:"developer",icon:"wrench",name:"utilities",text:e("nav.utilities","Utilities",{ns:"apps-routing"})}}var On=t(7644);function Pn(e){return{Component:On.Z,display:{needsAccounts:!0,needsApi:["tx.whitelist.removeWhitelistedCall"]},group:"governance",icon:"list-check",name:"whitelist",text:e("nav.whitelist","Whitelist",{ns:"apps-routing"})}}function Mn(e){return[q(e),z(e),ye(e),re(e),Be(e),Un(e),$n(e),fn(e),yn(e),wn(e),oe(e),V(e),de(e),_e(e),qe(e),O(e),B(e),Ae(e),Xe(e),De(e),Pn(e),xe(e),me(e),Zn(e),zn(e),X(e),Pe(e),D(e),ze(e),dn(e),We(e),Se(e),nn(e),G(e),le(e),An(e),ke(e),Ke(e),Qe(e),an(e),Nn(e),Ne(e),Re(e),Wn(e),on(e)]}var Bn=t(86135),Fn=t(59149),Dn=t(82671),Hn=t(33661);function Ln(e,n,t){const[r,i,o]=n.split("."),[s]=t&&e.registry.getModuleInstances(e.runtimeVersion.specName.toString(),i)||[i],a=e[r][s]?s:i;try{return"consts"===r?(0,Dn.K)(e[r][a][o]):(0,Hn.m)(e[r][a][o])}catch{return!1}}function Xn(e,n,t=!1,r){if(!n)return[];const i=n.filter((n=>!(Array.isArray(n)?n.reduce(((n,r)=>n||Ln(e,r,t)),!1):Ln(e,n,t))));return i.length||!r||r(e)?i:["needsApiCheck"]}var Jn=t(61349);function Vn(){return(0,Jn.$G)("apps")}const _n=g.memo((function({basePath:e,missingApis:n=[]}){return console.log(`Redirecting from route "${e}" to "/explorer"${n.length?`, missing the following APIs: ${JSON.stringify(n)}`:""}`),(0,r.jsx)(R.Fg,{to:"/explorer"})}));var Gn=t(34814),Kn=t(9118),Yn=t(64021),Qn=t(69516);let et;const nt=g.memo((function({optionsAll:e}){const{queueAction:n}=(0,Bn.L)(),{api:t,isApiReady:i}=(0,S.h)(),{allAccounts:o}=(0,Gn.x)(),{t:s}=Vn(),a=(0,Kn.W7)(i&&t.query.system?.events);return(0,g.useEffect)((()=>{const t=function(e,n,t,r){const i=(0,Qn.R)((0,Yn.d)(JSON.stringify(r)));return t&&r&&i!==et?(et=i,r.map((({event:{data:t,method:r,section:i}})=>{if("balances"===i&&"Transfer"===r){const o=t[1].toString();if(e.includes(o))return{account:o,action:`${i}.${r}`,message:n("transfer received"),status:"event"}}else if("democracy"===i){const e=t[0].toString();return{action:`${i}.${r}`,message:n("update on #{{index}}",{replace:{index:e}}),status:"event"}}return null})).filter((e=>!!e))):null}(o,s,e,a);t&&n(t)}),[o,a,e,n,s]),(0,r.jsx)(j.qb,{})})),tt={Component:_n,display:{},group:"settings",icon:"times",isIgnored:!1,name:"unknown",text:"Unknown"},rt=j.zo.div` flex-grow: 1; overflow: hidden auto; padding: 0 0 1rem 0; @@ -308,7 +308,7 @@ } } } -`,Ut=g.memo((function({className:e="",isActive:n,name:t,routes:i}){return 1===i.length&&"settings"===i[0].group?(0,r.jsx)(St,{className:n?"isActive":"",classNameText:"smallHide",isToplevel:!0,route:i[0]}):(0,r.jsxs)($t,{className:`${e} ${n?"isActive":""}`,children:[(0,r.jsxs)("div",{className:"groupHdr "+(n?"":"highlight--color-contrast"),children:[(0,r.jsx)("span",{className:"smallHide",children:t}),(0,r.jsx)(j.JO,{className:"smallShow",icon:i[0].icon}),(0,r.jsx)(j.JO,{icon:"caret-down"})]}),(0,r.jsx)("ul",{className:"groupMenu",children:i.map((e=>(0,r.jsx)(St,{route:e},e.name)))})]})}));var qt=t(39082),Tt=t(52727);const zt=`apps v${"0.146.2-23-x".replace("-x","")}`,Et=j.zo.div` +`,Ut=g.memo((function({className:e="",isActive:n,name:t,routes:i}){return 1===i.length&&"settings"===i[0].group?(0,r.jsx)(St,{className:n?"isActive":"",classNameText:"smallHide",isToplevel:!0,route:i[0]}):(0,r.jsxs)($t,{className:`${e} ${n?"isActive":""}`,children:[(0,r.jsxs)("div",{className:"groupHdr "+(n?"":"highlight--color-contrast"),children:[(0,r.jsx)("span",{className:"smallHide",children:t}),(0,r.jsx)(j.JO,{className:"smallShow",icon:i[0].icon}),(0,r.jsx)(j.JO,{icon:"caret-down"})]}),(0,r.jsx)("ul",{className:"groupMenu",children:i.map((e=>(0,r.jsx)(St,{route:e},e.name)))})]})}));var qt=t(39082),Tt=t(52727);const zt=`apps v${"0.146.2-24-x".replace("-x","")}`,Et=j.zo.div` background: transparent; font-size: var(--font-size-tiny); line-height: 1.2; diff --git a/page.61ba319a0c5ec420.js b/page.a8f559324beb317f.js similarity index 79% rename from page.61ba319a0c5ec420.js rename to page.a8f559324beb317f.js index 772fe590dfdf..6741894623bc 100644 --- a/page.61ba319a0c5ec420.js +++ b/page.a8f559324beb317f.js @@ -1,8 +1,8 @@ -"use strict";(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[8484],{73501:(e,s,t)=>{t.d(s,{Z:()=>nt});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(34814),l=t(83337),c=t(73477),u=t(90778),d=t(45479),h=t(38894),m=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),k=t(74076),N=t(17965),S=t(81503),A=t(6851),E=t(21924),I=t(57594),T=t(52926),D=t(46186),P=t(61349);function M(){return(0,P.$G)("app-accounts")}var z=t(46782),F=t.n(z),L=t(41186);function V(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 _({json:e,pair:s}){F().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,L.getEnvironment)()&&_(s),_(s),r.rp.setLastValue("account",a)}catch(e){t.status="error",t.message=e.message}return t}const H=["parent","name","date","balances"];function $({onChange:e,onEnter:s}){const{t}=M(),[{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 h=(0,n.useCallback)((e=>{l({isPass1Valid:b.Nn.isPassValid(e),password1:e}),d({isPass2Valid:b.Nn.isPassValid(u)&&u===e,password2:u})}),[u]),m=(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:h,onEnter:s,value:i}),(0,a.jsx)(r.ro,{className:"full",isError:!c,label:t("password (repeat)"),onChange:m,onEnter:s,value:u}),(0,a.jsx)(r.YV,{value:i})]})}const B=n.memo((({name:{isNameValid:e,name:s},onCommit:t,setName:o,setPassword:i})=>{const{t:l}=M(),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)($,{onChange:u,onEnter:t})]})})),O=n.memo((function({address:e,derivePath:s,name:t,pairType:n,seed:o}){const{t:i}=M(),l=o?.split(" "),c=(0,k.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("")})]})})})),q="m/44'/60'/0'/0/0",W=n.memo((function({className:e,derivePath:s,deriveValidation:t,onChange:o,seedType:i}){const{t:l}=M(),[c,u]=(0,n.useState)(0),[d,m]=(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,h.O)(),[b,f]=(0,h.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:m,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:q,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 Z=t(72570),U=t(77004);const J=r.zo.article` +"use strict";(("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps=("undefined"!=typeof self?self:this).webpackChunk_polkadot_apps||[]).push([[8484],{73501:(e,s,t)=>{t.d(s,{Z:()=>nt});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(34814),l=t(83337),c=t(73477),u=t(90778),d=t(45479),h=t(38894),m=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),k=t(74076),N=t(17965),S=t(81503),A=t(6851),I=t(21924),E=t(57594),T=t(52926),D=t(46186),P=t(61349);function M(){return(0,P.$G)("app-accounts")}var z=t(46782),F=t.n(z),L=t(41186);function V(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 _({json:e,pair:s}){F().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,L.getEnvironment)()&&_(s),_(s),r.rp.setLastValue("account",a)}catch(e){t.status="error",t.message=e.message}return t}const $=["parent","name","date","balances"];function H({onChange:e,onEnter:s}){const{t}=M(),[{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 h=(0,n.useCallback)((e=>{l({isPass1Valid:b.Nn.isPassValid(e),password1:e}),d({isPass2Valid:b.Nn.isPassValid(u)&&u===e,password2:u})}),[u]),m=(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:h,onEnter:s,value:i}),(0,a.jsx)(r.ro,{className:"full",isError:!c,label:t("password (repeat)"),onChange:m,onEnter:s,value:u}),(0,a.jsx)(r.YV,{value:i})]})}const B=n.memo((({name:{isNameValid:e,name:s},onCommit:t,setName:o,setPassword:i})=>{const{t:l}=M(),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})]})})),O=n.memo((function({address:e,derivePath:s,name:t,pairType:n,seed:o}){const{t:i}=M(),l=o?.split(" "),c=(0,k.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("")})]})})})),W="m/44'/60'/0'/0/0",q=n.memo((function({className:e,derivePath:s,deriveValidation:t,onChange:o,seedType:i}){const{t:l}=M(),[c,u]=(0,n.useState)(0),[d,m]=(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,h.O)(),[b,f]=(0,h.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:m,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:W,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 Z=t(72570),U=t(77004);const J=r.zo.article` .box { padding: 0 0.5rem; } -`,G=n.memo((function({children:e,className:s="",type:t}){return(0,a.jsx)(J,{className:`${s} ${t} centered`,children:(0,a.jsx)("div",{className:"box",children:e})})})),Y=(0,U.h)(20),Q=n.memo((function({className:e,onClose:s}){const{t}=M(),{api:o}=(0,u.h)(),{getLedger:i}=(0,d.c)(),[l,c]=(0,n.useState)(0),[h,m]=(0,n.useState)(0),[p,x]=(0,n.useState)(null),[{isNameValid:g,name:j},v]=(0,n.useState)({isNameValid:!1,name:""}),[y,C]=(0,n.useState)(!1),w=(0,n.useRef)(Y.map((e=>({text:t("Account type {{index}}",{replace:{index:e}}),value:e})))),k=(0,n.useRef)(Y.map((e=>({text:t("Address index {{index}}",{replace:{index:e}}),value:e})))),N=(0,n.useCallback)((e=>v({isNameValid:!!e.trim(),name:e})),[]),S=(0,n.useCallback)((()=>{x(null),C(!0),async function(e,s,t,a,n,o){let r;const i=f.X.get().ledgerApp;r="migration"===i||"generic"===i?(await s().getAddress(o,!1,a,n)).address:(await s().getAddress(!1,a,n)).address,b.Nn.addHardware(r,"ledger",{accountOffset:a,addressOffset:n,genesisHash:e.genesisHash.toHex(),name:t||`ledger ${a}/${n}`})}(o,i,j,l,h,o.consts.system.ss58Prefix.toNumber()).then((()=>s())).catch((e=>{console.error(e),C(!1),x(e)}))}),[l,h,o,i,j,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:j})}),(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:w.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:m,options:k.current,value:h}),p&&(0,a.jsx)(r.oy,{content:p.message})]})]}),(0,a.jsx)(G,{type:"warning",children:(0,a.jsx)("p",{children:`You are using the Ledger ${f.X.ledgerApp.toUpperCase()} App. If you would like to switch it, please go the "manage ledger app" in the settings.`})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isBusy:y,isDisabled:!g,label:t("Save"),onClick:S})})]})})),X=Z.uG.filter((({hasLedgerSupport:e})=>e)),K=n.memo((function({className:e,onChange:s,seedType:t}){const{t:o}=M(),[i,l]=(0,n.useState)(0),[c,u]=(0,n.useState)(0),[d,h]=(0,n.useState)("polkadot"),m=(0,n.useRef)(X.map((({displayName:e,network:s})=>({text:e,value:s})))),p=(0,n.useRef)(Y.map((e=>({text:o("Account type {{index}}",{replace:{index:e}}),value:e})))),x=(0,n.useRef)(Y.map((e=>({text:o("Address index {{index}}",{replace:{index:e}}),value:e}))));return(0,n.useEffect)((()=>{const e=X.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:h,options:m.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.")})})})),ee=navigator.userAgent.toLowerCase().indexOf(" electron/")>-1,se=n.memo((function(){const{t:e}=M();return ee?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 te(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 ae(e,s,t){return b.Nn.createFromUri(te(e,s,t),{},"ed25519-ledger"===t?"ed25519":t).address}function ne(e,s,t,a="sr25519"){const n=function(e,s){switch(s){case"bip":return(0,I._)();case"dev":return y.g;default:return e||(0,w.c)((0,T.F)())}}(e,t);return{address:ae(n,s,a),derivePath:s,deriveValidation:void 0,isSeedValid:!0,pairType:a,seed:n,seedType:t}}function oe(e,s,t,a){let n=null,o=function(e,s,t,a){try{const{password:n,path:o}=(0,A.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,E.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,k.vq)(e)&&66===e.length}(e)}(e);else{const s=e.split(" ");"ed25519-ledger"===a&&25===s.length?(s.pop(),r=(0,D.S)(s.join(" "))):r=(0,D.S)(e)}if(!o?.error&&r)try{n=ae(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 re=(0,r.zo)(r.u_)` +`,G=n.memo((function({children:e,className:s="",type:t}){return(0,a.jsx)(J,{className:`${s} ${t} centered`,children:(0,a.jsx)("div",{className:"box",children:e})})})),Y=(0,U.h)(20),Q=n.memo((function({className:e,onClose:s}){const{t}=M(),{api:o}=(0,u.h)(),{getLedger:i}=(0,d.c)(),[l,c]=(0,n.useState)(0),[h,m]=(0,n.useState)(0),[p,x]=(0,n.useState)(null),[{isNameValid:g,name:j},v]=(0,n.useState)({isNameValid:!1,name:""}),[y,C]=(0,n.useState)(!1),w=(0,n.useRef)(Y.map((e=>({text:t("Account type {{index}}",{replace:{index:e}}),value:e})))),k=(0,n.useRef)(Y.map((e=>({text:t("Address index {{index}}",{replace:{index:e}}),value:e})))),N=(0,n.useCallback)((e=>v({isNameValid:!!e.trim(),name:e})),[]),S=(0,n.useCallback)((()=>{x(null),C(!0),async function(e,s,t,a,n,o){let r;const i=f.X.get().ledgerApp;r="migration"===i||"generic"===i?(await s().getAddress(o,!1,a,n)).address:(await s().getAddress(!1,a,n)).address,b.Nn.addHardware(r,"ledger",{accountOffset:a,addressOffset:n,genesisHash:e.genesisHash.toHex(),name:t||`ledger ${a}/${n}`})}(o,i,j,l,h,o.consts.system.ss58Prefix.toNumber()).then((()=>s())).catch((e=>{console.error(e),C(!1),x(e)}))}),[l,h,o,i,j,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:j})}),(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:w.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:m,options:k.current,value:h}),p&&(0,a.jsx)(r.oy,{content:p.message})]})]}),(0,a.jsx)(G,{type:"warning",children:(0,a.jsx)("p",{children:`You are using the Ledger ${f.X.ledgerApp.toUpperCase()} App. If you would like to switch it, please go the "manage ledger app" in the settings.`})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isBusy:y,isDisabled:!g,label:t("Save"),onClick:S})})]})})),X=Z.uG.filter((({hasLedgerSupport:e})=>e)),K=n.memo((function({className:e,onChange:s,seedType:t}){const{t:o}=M(),[i,l]=(0,n.useState)(0),[c,u]=(0,n.useState)(0),[d,h]=(0,n.useState)("polkadot"),m=(0,n.useRef)(X.map((({displayName:e,network:s})=>({text:e,value:s})))),p=(0,n.useRef)(Y.map((e=>({text:o("Account type {{index}}",{replace:{index:e}}),value:e})))),x=(0,n.useRef)(Y.map((e=>({text:o("Address index {{index}}",{replace:{index:e}}),value:e}))));return(0,n.useEffect)((()=>{const e=X.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:h,options:m.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.")})})})),ee=navigator.userAgent.toLowerCase().indexOf(" electron/")>-1,se=n.memo((function(){const{t:e}=M();return ee?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 te(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 ae(e,s,t){return b.Nn.createFromUri(te(e,s,t),{},"ed25519-ledger"===t?"ed25519":t).address}function ne(e,s,t,a="sr25519"){const n=function(e,s){switch(s){case"bip":return(0,E._)();case"dev":return y.g;default:return e||(0,w.c)((0,T.F)())}}(e,t);return{address:ae(n,s,a),derivePath:s,deriveValidation:void 0,isSeedValid:!0,pairType:a,seed:n,seedType:t}}function oe(e,s,t,a){let n=null,o=function(e,s,t,a){try{const{password:n,path:o}=(0,A.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,I.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,k.vq)(e)&&66===e.length}(e)}(e);else{const s=e.split(" ");"ed25519-ledger"===a&&25===s.length?(s.pop(),r=(0,D.S)(s.join(" "))):r=(0,D.S)(e)}if(!o?.error&&r)try{n=ae(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 re=(0,r.zo)(r.u_)` .accounts--Creator-advanced { margin-top: 1rem; overflow: visible; @@ -34,22 +34,22 @@ } } } -`,ie=n.memo((function({className:e="",onClose:s,onStatusChange:t,seed:o,type:i}){const{t:l}=M(),{api:c,isDevelopment:h,isEthereum:m}=(0,u.h)(),{isLedgerEnabled:p}=(0,d.c)(),[{address:x,derivePath:g,deriveValidation:j,isSeedValid:v,pairType:y,seed:w,seedType:k},S]=(0,n.useState)((()=>ne(o,m?q:"",o?"raw":"bip",m?"ethereum":i))),[A,E]=(0,n.useState)(!1),[I,T,D]=(0,C.t)(),[P,z]=(0,n.useState)(!1),[{isNameValid:F,name:L},V]=(0,n.useState)((()=>({isNameValid:!1,name:""}))),[{isPasswordValid:_,password:H},$]=(0,n.useState)((()=>({isPasswordValid:!1,password:""}))),Z=!!x&&A&&!j?.error&&v,U=F&&_,J=Z&&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.')}),Y=(0,n.useRef)((h?[{text:l("Development"),value:"dev"}]:[]).concat({text:l("Mnemonic"),value:"bip"},m?{text:l("Private Key"),value:"raw"}:{text:l("Raw seed"),value:"raw"})),Q=(0,n.useCallback)((e=>S(oe(w,e,k,y))),[y,w,k]),X=(0,n.useCallback)((e=>S(oe(e,g,k,y))),[g,y,k]),ee=(0,n.useCallback)((e=>S(oe(w,m?q:"",k,e))),[w,k,m]),ae=(0,n.useCallback)((e=>{e!==k&&S(ne(null,g,e,y))}),[g,y,k]),ie=(0,n.useCallback)((()=>E(!A)),[A]),le=(0,n.useCallback)((()=>{J&&(z(!0),(0,N.Y)((()=>{const e={genesisHash:h?void 0:c.genesisHash.toHex(),isHardware:!1,name:L.trim()},a=function(e,s,t,{genesisHash:a,name:n,tags:o=[]},r,i){return R((()=>b.Nn.addUri(te(e,s,t),r,{genesisHash:a,isHardware:!1,name:n,tags:o},"ed25519-ledger"===t?"ed25519":t)),i)}(w,g,y,e,H,l("created account"));t(a),z(!1),s()})))}),[c,g,h,J,L,s,t,y,H,w,l]);return(0,a.jsxs)(re,{className:e,header:l("Add an account via seed {{step}}/{{STEPS_COUNT}}",{replace:{STEPS_COUNT:3,step:I}}),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:L,fullLength:!0,isEditableName:!1,noDefaultNameOpacity:!0,value:v&&x||null})}),1===I&&(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"===k,label:l("bip"===k?"mnemonic seed":"dev"===k?"development seed":m?"ethereum private key":"seed (hex or string)"),onChange:X,seed:w,withLabel:!0,children:[(0,a.jsx)(r.qi,{className:"copyMoved",type:"bip"===k?l("mnemonic"):"raw"===k?m?l("private key"):"seed":l("raw seed"),value:w}),(0,a.jsx)(r.Lt,{defaultValue:k,isButton:!0,onChange:ae,options:Y.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:ee,options:m?f.X.availableCryptosEth:p?f.X.availableCryptosLedger:f.X.availableCryptos,tabIndex:-1})}),"ed25519-ledger"===y?(0,a.jsx)(K,{onChange:Q,seedType:k}):"ethereum"===y?(0,a.jsx)(W,{derivePath:g,deriveValidation:j,onChange:Q,seed:w,seedType:k}):(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"===k,isError:!!j?.error,label:l("secret derivation path"),onChange:Q,placeholder:l("raw"===k?"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)(se,{}),(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:A})})]})]}),2===I&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(B,{name:{isNameValid:F,name:L},onCommit:le,setName:V,setPassword:$}),";",(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(se,{})})]}),3===I&&x&&(0,a.jsx)(O,{derivePath:g,isBusy:P,pairType:"ed25519-ledger"===y?"ed25519":y,seed:w})]}),(0,a.jsxs)(r.u_.Actions,{children:[1===I&&(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"step-forward",isDisabled:!Z,label:l("Next"),onClick:T}),2===I&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:l("Prev"),onClick:D}),(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"step-forward",isDisabled:!U,label:l("Next"),onClick:T})]}),3===I&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:l("Prev"),onClick:D}),(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"plus",isBusy:P,label:l("Save"),onClick:le})]})]})]})}));var le=t(56623),ce=t(48731);const ue=["application/json","text/plain"],de=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=M(),{api:i,isDevelopment:l,isEthereum:c}=(0,u.h)(),[d,h]=(0,n.useState)(!1),[m,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)((()=>!!m?.meta.genesisHash&&m.meta.genesisHash!==y),[y,m]),w=(0,n.useCallback)((e=>p(function(e,s,t,a){try{const s=b.Nn.createFromJson(JSON.parse((0,le.z)(e)),{genesisHash:a});return t?(0,ce.hu)("ethereum"===s.type,"JSON File does not contain an ethereum type key pair"):(0,ce.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]),k=(0,n.useCallback)((e=>v({isPassValid:b.Nn.isPassValid(e),password:e})),[]),S=(0,n.useCallback)((()=>{m&&(h(!0),(0,N.Y)((()=>{const e={action:"restore"};try{b.Nn.addPair(m,j),e.status="success",e.account=m.address,e.message=o("account restored"),r.rp.setLastValue("account",m.address)}catch(s){v((e=>({...e,isPassValid:!1}))),e.status="error",e.message=s.message,console.error(s)}h(!1),t(e),"error"!==e.status&&s()})))}),[s,t,m,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:m?.meta.name||null,noDefaultNameOpacity:!0,value:m?.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:ue,className:"full",isError:!m,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:k,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)(se,{})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"sync",isBusy:d,isDisabled:!m||!f,label:o("Restore"),onClick:S})})]})})),he=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=M(),[{isNameValid:i,name:l},c]=(0,n.useState)({isNameValid:!1,name:""}),[u,d]=(0,n.useState)(null),h=(0,n.useCallback)((()=>{if(!u)return;const e={name:l.trim()},a=function(e,{name:s}){const t={action:"create"};try{b.Nn.addExternal(e,{isLocal:!0,name:s,tags:["local"]}),t.account=e,t.status="success",t.message="Local account created."}catch(e){t.status="error",t.message=e.message}return t}(u,e);t(a),s()}),[u,l,s,t]),m=(0,n.useCallback)((e=>c({isNameValid:e.trim().length>=3,name:e})),[]),p=i&&!!u;return(0,a.jsxs)(r.u_,{className:e,header:o("Add a mock account to chopsticks"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("Any address, this can override other accounts"),children:(0,a.jsx)(r.bm,{autoFocus:!0,label:o("address"),onChange:d,placeholder:o("e.g. 5Gg3...")})}),(0,a.jsx)(r.u_.Columns,{hint:o("The name for this account"),children:(0,a.jsx)(r.II,{className:"full",isError:!i,label:o("name"),onChange:m,placeholder:o("local account name")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!p,label:o("Add"),onClick:h})})]})}));var me=t(48801),pe=t.n(me),xe=t(5122),ge=t(37146),be=t(11677);function fe(e,s,t){return s.reduce(((e,s)=>(s===t||e.includes(s)||e.push(s),e)),e)}const je=(0,be.e)("useKnownAddresses",(function(e){const{accounts:{allAccounts:s},addresses:{allAddresses:t}}=(0,ge.i)();return(0,n.useMemo)((()=>fe(fe([],s,e),t,e)),[s,t,e])})),ve=new(pe())(2),ye=["application/json"],Ce=(0,r.zo)(r.u_)` +`,ie=n.memo((function({className:e="",onClose:s,onStatusChange:t,seed:o,type:i}){const{t:l}=M(),{api:c,isDevelopment:h,isEthereum:m}=(0,u.h)(),{isLedgerEnabled:p}=(0,d.c)(),[{address:x,derivePath:g,deriveValidation:j,isSeedValid:v,pairType:y,seed:w,seedType:k},S]=(0,n.useState)((()=>ne(o,m?W:"",o?"raw":"bip",m?"ethereum":i))),[A,I]=(0,n.useState)(!1),[E,T,D]=(0,C.t)(),[P,z]=(0,n.useState)(!1),[{isNameValid:F,name:L},V]=(0,n.useState)((()=>({isNameValid:!1,name:""}))),[{isPasswordValid:_,password:$},H]=(0,n.useState)((()=>({isPasswordValid:!1,password:""}))),Z=!!x&&A&&!j?.error&&v,U=F&&_,J=Z&&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.')}),Y=(0,n.useRef)((h?[{text:l("Development"),value:"dev"}]:[]).concat({text:l("Mnemonic"),value:"bip"},m?{text:l("Private Key"),value:"raw"}:{text:l("Raw seed"),value:"raw"})),Q=(0,n.useCallback)((e=>S(oe(w,e,k,y))),[y,w,k]),X=(0,n.useCallback)((e=>S(oe(e,g,k,y))),[g,y,k]),ee=(0,n.useCallback)((e=>S(oe(w,m?W:"",k,e))),[w,k,m]),ae=(0,n.useCallback)((e=>{e!==k&&S(ne(null,g,e,y))}),[g,y,k]),ie=(0,n.useCallback)((()=>I(!A)),[A]),le=(0,n.useCallback)((()=>{J&&(z(!0),(0,N.Y)((()=>{const e={genesisHash:h?void 0:c.genesisHash.toHex(),isHardware:!1,name:L.trim()},a=function(e,s,t,{genesisHash:a,name:n,tags:o=[]},r,i){return R((()=>b.Nn.addUri(te(e,s,t),r,{genesisHash:a,isHardware:!1,name:n,tags:o},"ed25519-ledger"===t?"ed25519":t)),i)}(w,g,y,e,$,l("created account"));t(a),z(!1),s()})))}),[c,g,h,J,L,s,t,y,$,w,l]);return(0,a.jsxs)(re,{className:e,header:l("Add an account via seed {{step}}/{{STEPS_COUNT}}",{replace:{STEPS_COUNT:3,step:E}}),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:L,fullLength:!0,isEditableName:!1,noDefaultNameOpacity:!0,value:v&&x||null})}),1===E&&(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"===k,label:l("bip"===k?"mnemonic seed":"dev"===k?"development seed":m?"ethereum private key":"seed (hex or string)"),onChange:X,seed:w,withLabel:!0,children:[(0,a.jsx)(r.qi,{className:"copyMoved",type:"bip"===k?l("mnemonic"):"raw"===k?m?l("private key"):"seed":l("raw seed"),value:w}),(0,a.jsx)(r.Lt,{defaultValue:k,isButton:!0,onChange:ae,options:Y.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:ee,options:m?f.X.availableCryptosEth:p?f.X.availableCryptosLedger:f.X.availableCryptos,tabIndex:-1})}),"ed25519-ledger"===y?(0,a.jsx)(K,{onChange:Q,seedType:k}):"ethereum"===y?(0,a.jsx)(q,{derivePath:g,deriveValidation:j,onChange:Q,seed:w,seedType:k}):(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"===k,isError:!!j?.error,label:l("secret derivation path"),onChange:Q,placeholder:l("raw"===k?"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)(se,{}),(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:A})})]})]}),2===E&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(B,{name:{isNameValid:F,name:L},onCommit:le,setName:V,setPassword:H}),";",(0,a.jsx)(r.u_.Columns,{children:(0,a.jsx)(se,{})})]}),3===E&&x&&(0,a.jsx)(O,{derivePath:g,isBusy:P,pairType:"ed25519-ledger"===y?"ed25519":y,seed:w})]}),(0,a.jsxs)(r.u_.Actions,{children:[1===E&&(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"step-forward",isDisabled:!Z,label:l("Next"),onClick:T}),2===E&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:l("Prev"),onClick:D}),(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"step-forward",isDisabled:!U,label:l("Next"),onClick:T})]}),3===E&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:l("Prev"),onClick:D}),(0,a.jsx)(r.zx,{activeOnEnter:!0,icon:"plus",isBusy:P,label:l("Save"),onClick:le})]})]})]})}));var le=t(56623),ce=t(48731);const ue=["application/json","text/plain"],de=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=M(),{api:i,isDevelopment:l,isEthereum:c}=(0,u.h)(),[d,h]=(0,n.useState)(!1),[m,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)((()=>!!m?.meta.genesisHash&&m.meta.genesisHash!==y),[y,m]),w=(0,n.useCallback)((e=>p(function(e,s,t,a){try{const s=b.Nn.createFromJson(JSON.parse((0,le.z)(e)),{genesisHash:a});return t?(0,ce.hu)("ethereum"===s.type,"JSON File does not contain an ethereum type key pair"):(0,ce.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]),k=(0,n.useCallback)((e=>v({isPassValid:b.Nn.isPassValid(e),password:e})),[]),S=(0,n.useCallback)((()=>{m&&(h(!0),(0,N.Y)((()=>{const e={action:"restore"};try{b.Nn.addPair(m,j),e.status="success",e.account=m.address,e.message=o("account restored"),r.rp.setLastValue("account",m.address)}catch(s){v((e=>({...e,isPassValid:!1}))),e.status="error",e.message=s.message,console.error(s)}h(!1),t(e),"error"!==e.status&&s()})))}),[s,t,m,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:m?.meta.name||null,noDefaultNameOpacity:!0,value:m?.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:ue,className:"full",isError:!m,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:k,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)(se,{})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"sync",isBusy:d,isDisabled:!m||!f,label:o("Restore"),onClick:S})})]})})),he=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=M(),[{isNameValid:i,name:l},c]=(0,n.useState)({isNameValid:!1,name:""}),[u,d]=(0,n.useState)(null),h=(0,n.useCallback)((()=>{if(!u)return;const e={name:l.trim()},a=function(e,{name:s}){const t={action:"create"};try{b.Nn.addExternal(e,{isLocal:!0,name:s,tags:["local"]}),t.account=e,t.status="success",t.message="Local account created."}catch(e){t.status="error",t.message=e.message}return t}(u,e);t(a),s()}),[u,l,s,t]),m=(0,n.useCallback)((e=>c({isNameValid:e.trim().length>=3,name:e})),[]),p=i&&!!u;return(0,a.jsxs)(r.u_,{className:e,header:o("Add a mock account to chopsticks"),onClose:s,size:"large",children:[(0,a.jsxs)(r.u_.Content,{children:[(0,a.jsx)(r.u_.Columns,{hint:o("Any address, this can override other accounts"),children:(0,a.jsx)(r.bm,{autoFocus:!0,label:o("address"),onChange:d,placeholder:o("e.g. 5Gg3...")})}),(0,a.jsx)(r.u_.Columns,{hint:o("The name for this account"),children:(0,a.jsx)(r.II,{className:"full",isError:!i,label:o("name"),onChange:m,placeholder:o("local account name")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!p,label:o("Add"),onClick:h})})]})}));var me=t(48801),pe=t.n(me),xe=t(5122),ge=t(37146),be=t(11677);function fe(e,s,t){return s.reduce(((e,s)=>(s===t||e.includes(s)||e.push(s),e)),e)}const je=(0,be.e)("useKnownAddresses",(function(e){const{accounts:{allAccounts:s},addresses:{allAddresses:t}}=(0,ge.i)();return(0,n.useMemo)((()=>fe(fe([],s,e),t,e)),[s,t,e])})),ve=new(pe())(2),ye=["application/json"],Ce=(0,r.zo)(r.u_)` .signaturesFileToggle { width: 100%; text-align: right; } -`,we=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{api:o,isDevelopment:i}=(0,u.h)(),{t:l}=M(),c=je(),[{isNameValid:d,name:h},m]=(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:k},N]=(0,n.useState)({isThresholdValid:!0,threshold:ve}),S=(0,n.useCallback)((()=>{const e={genesisHash:i?void 0:o.genesisHash.toHex(),name:h.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,k,e,l("created multisig"));t(a),s()}),[o.genesisHash,i,h,s,t,j,l,k]),A=(0,n.useCallback)((e=>m({isNameValid:e.trim().length>=3,name:e})),[]),E=(0,n.useCallback)((e=>e&&N({isThresholdValid:e.gte(ve)&&e.lten(j.length),threshold:e})),[j]),I=(0,n.useCallback)((e=>{const s=function(e){let s,t="";try{s=JSON.parse((0,le.z)(e)),(0,ce.hu)(Array.isArray(s)&&!!s.length,"JSON file should contain an array of signatories"),s=s.filter((e=>(0,xe.Y)(e))),s=[...new Set(s)],(0,ce.hu)(s.length<=100,"Maximum you can have 100 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]),T=(0,n.useCallback)((()=>{f({isUploadedFileValid:p,uploadedFileError:x,uploadedSignatories:[]})}),[x,p]),D=(0,n.useCallback)((e=>{T(),v(e)}),[T]),P=d&&w;return(0,a.jsxs)(Ce,{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:100,onChange:D,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:ye,className:"full",clearContent:!g.length&&p,isError:!p,label:l("upload signatories list"),onChange:I,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:T}),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:E,value:k})}),(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:A,placeholder:l("multisig name")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!P,label:l("Create"),onClick:S})})]})}));var ke=t(74065);function Ne(e,s,t,a=j.nw){const n=s.toString();return{address:n,delay:a,isOwned:e.includes(n),type:t}}const Se=(0,be.e)("useProxies",(function(e){const{api:s}=(0,u.h)(),{allAccounts:t}=(0,i.x)(),a=(0,ke.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})=>Ne(t,s,a,e))):e.map((([e,s])=>Ne(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})),Ae=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{api:o,isDevelopment:i}=(0,u.h)(),{t:l}=M(),[{isNameValid:c,name:d},h]=(0,n.useState)({isNameValid:!1,name:""}),[m,p]=(0,n.useState)(null),x=Se(m),g=(0,n.useCallback)((()=>{if(m){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}(m,e,l("added proxy"));t(a),s()}}),[o.genesisHash,i,d,s,t,m,l]),f=(0,n.useCallback)((e=>h({isNameValid:e.trim().length>=3,name:e})),[]),j=c&&!!m&&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})})]})})),Ee=(0,r.zo)(r.u_)` +`,we=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{api:o,isDevelopment:i}=(0,u.h)(),{t:l}=M(),c=je(),[{isNameValid:d,name:h},m]=(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:k},N]=(0,n.useState)({isThresholdValid:!0,threshold:ve}),S=(0,n.useCallback)((()=>{const e={genesisHash:i?void 0:o.genesisHash.toHex(),name:h.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,k,e,l("created multisig"));t(a),s()}),[o.genesisHash,i,h,s,t,j,l,k]),A=(0,n.useCallback)((e=>m({isNameValid:e.trim().length>=3,name:e})),[]),I=(0,n.useCallback)((e=>e&&N({isThresholdValid:e.gte(ve)&&e.lten(j.length),threshold:e})),[j]),E=(0,n.useCallback)((e=>{const s=function(e){let s,t="";try{s=JSON.parse((0,le.z)(e)),(0,ce.hu)(Array.isArray(s)&&!!s.length,"JSON file should contain an array of signatories"),s=s.filter((e=>(0,xe.Y)(e))),s=[...new Set(s)],(0,ce.hu)(s.length<=100,"Maximum you can have 100 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]),T=(0,n.useCallback)((()=>{f({isUploadedFileValid:p,uploadedFileError:x,uploadedSignatories:[]})}),[x,p]),D=(0,n.useCallback)((e=>{T(),v(e)}),[T]),P=d&&w;return(0,a.jsxs)(Ce,{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:100,onChange:D,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:ye,className:"full",clearContent:!g.length&&p,isError:!p,label:l("upload signatories list"),onChange:E,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:T}),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:I,value:k})}),(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:A,placeholder:l("multisig name")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!P,label:l("Create"),onClick:S})})]})}));var ke=t(74065);function Ne(e,s,t,a=j.nw){const n=s.toString();return{address:n,delay:a,isOwned:e.includes(n),type:t}}const Se=(0,be.e)("useProxies",(function(e){const{api:s}=(0,u.h)(),{allAccounts:t}=(0,i.x)(),a=(0,ke.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})=>Ne(t,s,a,e))):e.map((([e,s])=>Ne(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})),Ae=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{api:o,isDevelopment:i}=(0,u.h)(),{t:l}=M(),[{isNameValid:c,name:d},h]=(0,n.useState)({isNameValid:!1,name:""}),[m,p]=(0,n.useState)(null),x=Se(m),g=(0,n.useCallback)((()=>{if(m){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}(m,e,l("added proxy"));t(a),s()}}),[o.genesisHash,i,d,s,t,m,l]),f=(0,n.useCallback)((e=>h({isNameValid:e.trim().length>=3,name:e})),[]),j=c&&!!m&&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})})]})})),Ie=(0,r.zo)(r.u_)` .qr-wrapper { margin: 0 auto; max-width: 30rem; } -`,Ie=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=M(),{api:i,isEthereum:c}=(0,u.h)(),{isIpfs:d}=(0,l.g)(),[{isNameValid:h,name:m},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:""}),k=!!x&&h&&(g||y),N=(0,n.useMemo)((()=>!!f&&!!f.genesisHash&&!i.genesisHash.eq(f.genesisHash)),[f,i]),S=(0,n.useCallback)((e=>p({isNameValid:!!e.trim(),name:e})),[]),A=(0,n.useCallback)(((e,s)=>w({isPasswordValid:s,password:e})),[]),E=(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]),I=(0,n.useCallback)((e=>{v({address:"",isAddress:!1,scanned:null,warning:e.message})}),[]),T=(0,n.useCallback)((()=>{if(!f||!k)return;const{content:e,isAddress:a}=f,n={genesisHash:f.genesisHash||i.genesisHash.toHex(),name:m.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,k,m,s,t,C,f,c,o]);return(0,a.jsxs)(Ee,{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:m,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:!h,label:o("name"),onChange:S,onEnter:T,value:m}),N&&(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)($,{onChange:A,onEnter:T})]}):(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:I,onScan:E})}),j&&(0,a.jsx)(r.Pd,{content:j})]})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!f||!k||!g&&d,label:o("Save"),onClick:T})})]})}));var Te=t(15336),De=t(86135),Pe=t(54383),Me=t(83696),ze=t(78627),Fe=t(9118),Le=t(37198),Ve=t(14681),_e=t(92730);const Re=n.memo((function({address:e,onClose:s}){const{t}=M(),[o,i]=(0,n.useState)(!1),[{isPassTouched:l,password:c},u]=(0,n.useState)({isPassTouched:!1,password:""}),[d,h]=(0,n.useState)(!1),m=!d&&b.Nn.isPassValid(c),p=(0,n.useCallback)((e=>{h(!1),u({isPassTouched:!0,password:e})}),[]),x=(0,n.useCallback)((()=>{i(!0),(0,N.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"});F().saveAs(a,`${e}.json`)}catch(e){return h(!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&&!m,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:!m,label:t("Download"),onClick:x})})]})})),He=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=M(),[i,l]=(0,n.useState)(!1),[c,u]=(0,n.useState)({isValid:!1,password:""}),[d,h]=(0,n.useState)({isValid:!1,password:""}),[{isOldValid:m,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=>h({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,N.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 h((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:!m,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||!m,label:o("Change"),onClick:v})})]})}));var $e=t(36609);const Be=n.memo((function({amount:e,delegatingAccount:s,onError:t}){const{t:o}=M(),{api:i}=(0,u.h)(),l=(0,Fe.W7)(i.derive.balances?.all,[s]),[{error:c,warning:d},h]=(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.")),h((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})),Oe=n.memo((function({onClose:e,previousAmount:s,previousConviction:t,previousDelegatedAccount:o,previousDelegatingAccount:i}){const{t:l}=M(),{api:c}=(0,u.h)(),[d,h]=(0,n.useState)(null),[m]=(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),k=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)($e.Z,{label:(0,a.jsx)("span",{className:"label",children:l("balance")}),params:g}),maxValue:m,onChange:x,value:p}),(0,a.jsx)(Be,{amount:p,delegatingAccount:g,onError:h}),(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||!k,label:l(o?"Save delegation":"Delegate"),onStart:e,params:[f,C,p],tx:c.tx.democracy.delegate})]})]})}));var qe=t(27421),We=t(55736);const Ze=n.memo((function({className:e="",from:s,onClose:t}){const{t:o}=M(),{api:i,isDevelopment:l}=(0,u.h)(),{queueAction:c}=(0,De.L)(),[d]=(0,n.useState)((()=>b.Nn.getPair(s))),[m,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},k]=(0,n.useState)({address:null,deriveError:null}),[S,A]=(0,h.O)(),[{isLocked:E,lockedError:I},T]=(0,n.useState)({isLocked:d.isLocked,lockedError:null}),[{isRootValid:D,rootPass:P},z]=(0,n.useState)({isRootValid:!1,rootPass:""}),[F,L]=(0,n.useState)(""),V=(0,qe.N)(F),_=!!C&&!w&&x&&j;(0,n.useEffect)((()=>{T({isLocked:d.isLocked,lockedError:null})}),[d]),(0,n.useEffect)((()=>{!E&&k((()=>{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,We.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}(V,d.type);return s||(e=d.derive(V).address),{address:e,deriveError:s}}))}),[V,E,d]);const H=(0,n.useCallback)((e=>{z({isRootValid:!!e,rootPass:e}),T((({isLocked:e})=>({isLocked:e,lockedError:null})))}),[]),$=(0,n.useCallback)((()=>{p(!0),(0,N.Y)((()=>{try{d.decodePkcs8(P),T({isLocked:d.isLocked,lockedError:null})}catch(e){console.error(e),T({isLocked:!0,lockedError:e.message})}p(!1)}))}),[P,d]),q=(0,n.useCallback)((()=>{_&&(p(!0),(0,N.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,F,g,v,o("created account"),l?void 0:i.genesisHash.toHex());c(e),p(!1),t()})))}),[i,l,_,g,t,v,c,d,F,o]),W=(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)(O,{address:C,derivePath:F,isBusy:m,name:g,pairType:d.type}):(0,a.jsxs)(r.u_.Content,{children:[E&&(0,a.jsxs)(a.Fragment,{children:[W,(0,a.jsx)(r.ro,{autoFocus:!0,isError:!!I,label:o("password"),onChange:H,value:P})]}),!E&&(0,a.jsxs)(r.mV,{defaultName:g,noDefaultNameOpacity:!0,value:w?"":C,children:[W,(0,a.jsx)(r.II,{autoFocus:!0,label:o("derivation path"),onChange:L,placeholder:o("//hard/soft")}),w&&(0,a.jsx)(r.oy,{content:w}),(0,a.jsx)(B,{name:{isNameValid:x,name:g},onCommit:q,setName:f,setPassword:y}),";"]})]}),(0,a.jsx)(r.u_.Actions,{children:E?(0,a.jsx)(r.zx,{icon:"lock",isBusy:m,isDisabled:!D,label:o("Unlock"),onClick:$}):S?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:o("Prev"),onClick:A}),(0,a.jsx)(r.zx,{icon:"plus",isBusy:m,label:o("Save"),onClick:q})]}):(0,a.jsx)(r.zx,{icon:"step-forward",isDisabled:!_,label:o("Next"),onClick:A})})]})}));var Ue=t(52953);const Je=[" ","\t"];function Ge(e,s,t){e&&e.isRaw&&(s&&s(!0),t((0,le.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}=M(),{apiIdentity:i,enableIdentity:l,specName:d}=(0,u.h)(),h=(0,Fe.W7)(i.query.identity.identityOf,[e]),[{okAll:m,okDiscord:p,okDisplay:x,okEmail:g,okGithub:b,okLegal:f,okMatrix:j,okRiot:v,okTwitter:y,okWeb:C},w]=(0,n.useState)({okAll:!1}),[k,N]=(0,n.useState)({}),[S,A]=(0,n.useState)({}),[E,I]=(0,n.useState)(!1),[T,D]=(0,n.useState)(!1),[P,z]=(0,n.useState)(!1),[F,L]=(0,n.useState)(!1),[V,_]=(0,n.useState)(!1),[R,H]=(0,n.useState)(!1),[$,B]=(0,n.useState)(!1),[O,q]=(0,n.useState)(!1),[W,Z]=(0,n.useState)((()=>((0,c.Ly)(e).name||"").replace(/\(.*\)/,"").trim())),[U,J]=(0,n.useState)(""),[G,Y]=(0,n.useState)(""),[Q,X]=(0,n.useState)(""),[K,ee]=(0,n.useState)(""),[se,te]=(0,n.useState)(""),[ae,ne]=(0,n.useState)(""),[oe,re]=(0,n.useState)(""),[ie,ce]=(0,n.useState)(""),[ue,de]=(0,n.useState)(!1),[he,me]=(0,n.useState)(!d.includes("people-")),[pe,xe]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{if(h&&h.isSome){const e=h.unwrap(),s=Array.isArray(e)?e[0].info:e.info;if(pe){Ge(s.display,null,Z),Ge(s.email,I,J),Ge(s.legal,D,Y),Ge(s.riot,z,X),Ge(s.twitter,H,ne),Ge(s.matrix,L,ee),Ge(s.github,_,te),Ge(s.web,q,ce);const e=he?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&&i.isRaw&&Ge(i,a,n),i}(i,s,Ue.n6,B,re):function(e,s,t){return e.discord&&!e.discord.isNone&&(s&&s(!0),t((0,le.z)(e.discord.asRaw.toU8a(!0)))),e.discord}(s,B,re);(he?[s.display,s.email,s.legal,s.riot,s.twitter,e,s.web]:[s.display,s.email,s.github,s.legal,s.matrix,s.twitter,e,s.web]).some((e=>!(!e||!e.isRaw||(de(!0),0))))}else s.riot?me(!0):me(!1),xe(!0)}}),[h,i,he,pe]),(0,n.useEffect)((()=>{const e=Ye(!0,W,1,[],[],[]),s=Ye(E,U,3,["@"],Je,[]),t=Ye(T,G,1,[],[],[]),a=Ye(F,K,6,[":"],Je,["@","~"]),n=Ye(P,Q,6,[":"],Je,["@","~"]),o=Ye(R,ae,3,[],Je,["@"]),r=Ye($,oe,3,[],Je,[]),i=Ye(V,se,3,[],Je,[]),l=Ye(O,ie,8,["."],Je,["https://","http://"]);w({okAll:e&&s&&t&&n&&o&&r&&l,okDiscord:r,okDisplay:e,okEmail:s,okGithub:i,okLegal:t,okMatrix:a,okRiot:n,okTwitter:o,okWeb:l}),he?N({additional:[r&&$?[{raw:Ue.n6},{raw:oe}]:null].filter((e=>!!e)),display:{[e?"raw":"none"]:W||null},email:{[s&&E?"raw":"none"]:s&&E?U:null},legal:{[t&&T?"raw":"none"]:t&&T?G:null},riot:{[n&&P?"raw":"none"]:n&&P?Q:null},twitter:{[o&&R?"raw":"none"]:o&&R?ae:null},web:{[l&&O?"raw":"none"]:l&&O?ie:null}}):A({discord:{[r&&$?"raw":"none"]:r&&$?oe:null},display:{[e?"raw":"none"]:W||null},email:{[s&&E?"raw":"none"]:s&&E?U:null},github:{[i&&V?"raw":"none"]:i&&V?se:null},legal:{[t&&T?"raw":"none"]:t&&T?G:null},matrix:{[a&&F?"raw":"none"]:a&&F?K:null},twitter:{[o&&R?"raw":"none"]:o&&R?ae:null},web:{[l&&O?"raw":"none"]:l&&O?ie:null}})}),[E,T,P,R,$,O,F,V,W,U,G,Q,ae,oe,ie,K,se,he]),(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:!x,label:o("display name"),maxLength:32,onChange:Z,placeholder:o("My On-Chain Name"),value:W}),(0,a.jsx)(r.II,{isDisabled:!T,isError:!f,label:o("legal name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:D,value:T}),maxLength:32,onChange:Y,placeholder:o("Full Legal Name"),value:T?G:""}),(0,a.jsx)(r.II,{isDisabled:!E,isError:!g,label:o("email"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:I,value:E}),maxLength:32,onChange:J,placeholder:o("somebody@example.com"),value:E?U:""}),(0,a.jsx)(r.II,{isDisabled:!O,isError:!C,label:o("web"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:q,value:O}),maxLength:32,onChange:ce,placeholder:o("https://example.com"),value:O?ie:""}),(0,a.jsx)(r.II,{isDisabled:!R,isError:!y,label:o("twitter"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:H,value:R}),onChange:ne,placeholder:o("@YourTwitterName"),value:R?ae:""}),(0,a.jsx)(r.II,{isDisabled:!$,isError:!p,label:o("discord"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:B,value:$}),onChange:re,placeholder:o("YourDiscordHandle"),value:$?oe:""}),he?(0,a.jsx)(r.II,{isDisabled:!P,isError:!v,label:o("riot name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:z,value:P}),maxLength:32,onChange:X,placeholder:o("@yourname:matrix.org"),value:P?Q:""}):(0,a.jsx)(r.II,{isDisabled:!F,isError:!j,label:o("matrix name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:L,value:F}),maxLength:32,onChange:ee,placeholder:o("@yourname:matrix.org"),value:F?K:""}),he?(0,a.jsx)("div",{}):(0,a.jsx)(r.II,{isDisabled:!V,isError:!b,label:o("Github name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:_,value:V}),maxLength:32,onChange:te,placeholder:o("YourGithubHandle"),value:V?se:""}),(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:!l||!ue,label:o("Clear Identity"),onStart:t,tx:i.tx.identity.clearIdentity}),(0,a.jsx)(r.cA,{accountId:e,isDisabled:!l||!m,label:o("Set Identity"),onStart:t,params:[he?k:S],tx:i.tx.identity.setIdentity})]})]})}));var Xe=t(19008);const Ke=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}=M(),{apiIdentity:l,enableIdentity:c}=(0,u.h)(),{allAccounts:d}=(0,i.x)(),h=(0,Xe.x)(e),m=(0,Fe.W7)(h&&0!==h.length&&l.query.identity.superOf.multi,[h],es),[p,x]=(0,n.useState)();(0,n.useEffect)((()=>{m?x(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,le.z)(s.asRaw)])}return e}),[])}(m)):h&&!h.length&&x([])}),[d,h,m]);const g=(0,n.useCallback)((()=>x((e=>e?.concat([[d[0],""]])))),[d]),b=(0,n.useCallback)((()=>x((e=>e?.slice(0,e.length-1)))),[]),f=(0,n.useCallback)(((e,s)=>x((t=>(t||[]).map((([t,a],n)=>[e===n?s:t,a]))))),[]),j=(0,n.useCallback)(((e,s)=>x((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:p?(0,a.jsxs)("div",{children:[p.length?p.map((([e,s],t)=>(0,a.jsx)(Ke,{address:e,index:t,name:s,setAddress:f,setName:j,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:g}),(0,a.jsx)(r.zx,{icon:"minus",isDisabled:0===p.length,label:o("Remove sub"),onClick:b})]})]}):(0,a.jsx)(r.$j,{label:o("Retrieving sub-identities")})}),(0,a.jsx)(r.u_.Actions,{children:p&&(0,a.jsx)(r.cA,{accountId:e,isDisabled:!c||p.some((([e,s])=>!e||!s)),label:o("Set Subs"),onStart:t,params:[p.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_)` +`,Ee=n.memo((function({className:e="",onClose:s,onStatusChange:t}){const{t:o}=M(),{api:i,isEthereum:c}=(0,u.h)(),{isIpfs:d}=(0,l.g)(),[{isNameValid:h,name:m},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:""}),k=!!x&&h&&(g||y),N=(0,n.useMemo)((()=>!!f&&!!f.genesisHash&&!i.genesisHash.eq(f.genesisHash)),[f,i]),S=(0,n.useCallback)((e=>p({isNameValid:!!e.trim(),name:e})),[]),A=(0,n.useCallback)(((e,s)=>w({isPasswordValid:s,password:e})),[]),I=(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]),E=(0,n.useCallback)((e=>{v({address:"",isAddress:!1,scanned:null,warning:e.message})}),[]),T=(0,n.useCallback)((()=>{if(!f||!k)return;const{content:e,isAddress:a}=f,n={genesisHash:f.genesisHash||i.genesisHash.toHex(),name:m.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,k,m,s,t,C,f,c,o]);return(0,a.jsxs)(Ie,{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:m,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:!h,label:o("name"),onChange:S,onEnter:T,value:m}),N&&(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:A,onEnter:T})]}):(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:E,onScan:I})}),j&&(0,a.jsx)(r.Pd,{content:j})]})}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!f||!k||!g&&d,label:o("Save"),onClick:T})})]})}));var Te=t(15336),De=t(86135),Pe=t(54383),Me=t(83696),ze=t(78627),Fe=t(9118),Le=t(37198),Ve=t(14681),_e=t(92730);const Re=n.memo((function({address:e,onClose:s}){const{t}=M(),[o,i]=(0,n.useState)(!1),[{isPassTouched:l,password:c},u]=(0,n.useState)({isPassTouched:!1,password:""}),[d,h]=(0,n.useState)(!1),m=!d&&b.Nn.isPassValid(c),p=(0,n.useCallback)((e=>{h(!1),u({isPassTouched:!0,password:e})}),[]),x=(0,n.useCallback)((()=>{i(!0),(0,N.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"});F().saveAs(a,`${e}.json`)}catch(e){return h(!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&&!m,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:!m,label:t("Download"),onClick:x})})]})})),$e=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=M(),[i,l]=(0,n.useState)(!1),[c,u]=(0,n.useState)({isValid:!1,password:""}),[d,h]=(0,n.useState)({isValid:!1,password:""}),[{isOldValid:m,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=>h({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,N.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 h((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:!m,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||!m,label:o("Change"),onClick:v})})]})}));var He=t(36609);const Be=n.memo((function({amount:e,delegatingAccount:s,onError:t}){const{t:o}=M(),{api:i}=(0,u.h)(),l=(0,Fe.W7)(i.derive.balances?.all,[s]),[{error:c,warning:d},h]=(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.")),h((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})),Oe=n.memo((function({onClose:e,previousAmount:s,previousConviction:t,previousDelegatedAccount:o,previousDelegatingAccount:i}){const{t:l}=M(),{api:c}=(0,u.h)(),[d,h]=(0,n.useState)(null),[m]=(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),k=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:m,onChange:x,value:p}),(0,a.jsx)(Be,{amount:p,delegatingAccount:g,onError:h}),(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||!k,label:l(o?"Save delegation":"Delegate"),onStart:e,params:[f,C,p],tx:c.tx.democracy.delegate})]})]})}));var We=t(27421),qe=t(55736);const Ze=n.memo((function({className:e="",from:s,onClose:t}){const{t:o}=M(),{api:i,isDevelopment:l}=(0,u.h)(),{queueAction:c}=(0,De.L)(),[d]=(0,n.useState)((()=>b.Nn.getPair(s))),[m,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},k]=(0,n.useState)({address:null,deriveError:null}),[S,A]=(0,h.O)(),[{isLocked:I,lockedError:E},T]=(0,n.useState)({isLocked:d.isLocked,lockedError:null}),[{isRootValid:D,rootPass:P},z]=(0,n.useState)({isRootValid:!1,rootPass:""}),[F,L]=(0,n.useState)(""),V=(0,We.N)(F),_=!!C&&!w&&x&&j;(0,n.useEffect)((()=>{T({isLocked:d.isLocked,lockedError:null})}),[d]),(0,n.useEffect)((()=>{!I&&k((()=>{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,qe.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}(V,d.type);return s||(e=d.derive(V).address),{address:e,deriveError:s}}))}),[V,I,d]);const $=(0,n.useCallback)((e=>{z({isRootValid:!!e,rootPass:e}),T((({isLocked:e})=>({isLocked:e,lockedError:null})))}),[]),H=(0,n.useCallback)((()=>{p(!0),(0,N.Y)((()=>{try{d.decodePkcs8(P),T({isLocked:d.isLocked,lockedError:null})}catch(e){console.error(e),T({isLocked:!0,lockedError:e.message})}p(!1)}))}),[P,d]),W=(0,n.useCallback)((()=>{_&&(p(!0),(0,N.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,F,g,v,o("created account"),l?void 0:i.genesisHash.toHex());c(e),p(!1),t()})))}),[i,l,_,g,t,v,c,d,F,o]),q=(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)(O,{address:C,derivePath:F,isBusy:m,name:g,pairType:d.type}):(0,a.jsxs)(r.u_.Content,{children:[I&&(0,a.jsxs)(a.Fragment,{children:[q,(0,a.jsx)(r.ro,{autoFocus:!0,isError:!!E,label:o("password"),onChange:$,value:P})]}),!I&&(0,a.jsxs)(r.mV,{defaultName:g,noDefaultNameOpacity:!0,value:w?"":C,children:[q,(0,a.jsx)(r.II,{autoFocus:!0,label:o("derivation path"),onChange:L,placeholder:o("//hard/soft")}),w&&(0,a.jsx)(r.oy,{content:w}),(0,a.jsx)(B,{name:{isNameValid:x,name:g},onCommit:W,setName:f,setPassword:y}),";"]})]}),(0,a.jsx)(r.u_.Actions,{children:I?(0,a.jsx)(r.zx,{icon:"lock",isBusy:m,isDisabled:!D,label:o("Unlock"),onClick:H}):S?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"step-backward",label:o("Prev"),onClick:A}),(0,a.jsx)(r.zx,{icon:"plus",isBusy:m,label:o("Save"),onClick:W})]}):(0,a.jsx)(r.zx,{icon:"step-forward",isDisabled:!_,label:o("Next"),onClick:A})})]})}));var Ue=t(28097);const Je=[" ","\t"];function Ge(e,s,t){e&&e.isRaw&&(s&&s(!0),t((0,le.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}=M(),{apiIdentity:i,enableIdentity:l,specName:d}=(0,u.h)(),h=(0,Fe.W7)(i.query.identity.identityOf,[e]),[{okAll:m,okDiscord:p,okDisplay:x,okEmail:g,okGithub:b,okLegal:f,okMatrix:j,okRiot:v,okTwitter:y,okWeb:C},w]=(0,n.useState)({okAll:!1}),[k,N]=(0,n.useState)({}),[S,A]=(0,n.useState)({}),[I,E]=(0,n.useState)(!1),[T,D]=(0,n.useState)(!1),[P,z]=(0,n.useState)(!1),[F,L]=(0,n.useState)(!1),[V,_]=(0,n.useState)(!1),[R,$]=(0,n.useState)(!1),[H,B]=(0,n.useState)(!1),[O,W]=(0,n.useState)(!1),[q,Z]=(0,n.useState)((()=>((0,c.Ly)(e).name||"").replace(/\(.*\)/,"").trim())),[U,J]=(0,n.useState)(""),[G,Y]=(0,n.useState)(""),[Q,X]=(0,n.useState)(""),[K,ee]=(0,n.useState)(""),[se,te]=(0,n.useState)(""),[ae,ne]=(0,n.useState)(""),[oe,re]=(0,n.useState)(""),[ie,ce]=(0,n.useState)(""),[ue,de]=(0,n.useState)(!1),[he,me]=(0,n.useState)(!d.includes("people-")),[pe,xe]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{if(h&&h.isSome){const e=h.unwrap(),s=Array.isArray(e)?e[0].info:e.info;if(pe){Ge(s.display,null,Z),Ge(s.email,E,J),Ge(s.legal,D,Y),Ge(s.riot,z,X),Ge(s.twitter,$,ne),Ge(s.matrix,L,ee),Ge(s.github,_,te),Ge(s.web,W,ce);const e=he?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&&i.isRaw&&Ge(i,a,n),i}(i,s,Ue.n6,B,re):function(e,s,t){return e.discord&&!e.discord.isNone&&(s&&s(!0),t((0,le.z)(e.discord.asRaw.toU8a(!0)))),e.discord}(s,B,re);(he?[s.display,s.email,s.legal,s.riot,s.twitter,e,s.web]:[s.display,s.email,s.github,s.legal,s.matrix,s.twitter,e,s.web]).some((e=>!(!e||!e.isRaw||(de(!0),0))))}else s.riot?me(!0):me(!1),xe(!0)}}),[h,i,he,pe]),(0,n.useEffect)((()=>{const e=Ye(!0,q,1,[],[],[]),s=Ye(I,U,3,["@"],Je,[]),t=Ye(T,G,1,[],[],[]),a=Ye(F,K,6,[":"],Je,["@","~"]),n=Ye(P,Q,6,[":"],Je,["@","~"]),o=Ye(R,ae,3,[],Je,["@"]),r=Ye(H,oe,3,[],Je,[]),i=Ye(V,se,3,[],Je,[]),l=Ye(O,ie,8,["."],Je,["https://","http://"]);w({okAll:e&&s&&t&&n&&o&&r&&l,okDiscord:r,okDisplay:e,okEmail:s,okGithub:i,okLegal:t,okMatrix:a,okRiot:n,okTwitter:o,okWeb:l}),he?N({additional:[r&&H?[{raw:Ue.n6},{raw:oe}]:null].filter((e=>!!e)),display:{[e?"raw":"none"]:q||null},email:{[s&&I?"raw":"none"]:s&&I?U:null},legal:{[t&&T?"raw":"none"]:t&&T?G:null},riot:{[n&&P?"raw":"none"]:n&&P?Q:null},twitter:{[o&&R?"raw":"none"]:o&&R?ae:null},web:{[l&&O?"raw":"none"]:l&&O?ie:null}}):A({discord:{[r&&H?"raw":"none"]:r&&H?oe:null},display:{[e?"raw":"none"]:q||null},email:{[s&&I?"raw":"none"]:s&&I?U:null},github:{[i&&V?"raw":"none"]:i&&V?se:null},legal:{[t&&T?"raw":"none"]:t&&T?G:null},matrix:{[a&&F?"raw":"none"]:a&&F?K:null},twitter:{[o&&R?"raw":"none"]:o&&R?ae:null},web:{[l&&O?"raw":"none"]:l&&O?ie:null}})}),[I,T,P,R,H,O,F,V,q,U,G,Q,ae,oe,ie,K,se,he]),(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:!x,label:o("display name"),maxLength:32,onChange:Z,placeholder:o("My On-Chain Name"),value:q}),(0,a.jsx)(r.II,{isDisabled:!T,isError:!f,label:o("legal name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:D,value:T}),maxLength:32,onChange:Y,placeholder:o("Full Legal Name"),value:T?G:""}),(0,a.jsx)(r.II,{isDisabled:!I,isError:!g,label:o("email"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:E,value:I}),maxLength:32,onChange:J,placeholder:o("somebody@example.com"),value:I?U:""}),(0,a.jsx)(r.II,{isDisabled:!O,isError:!C,label:o("web"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:W,value:O}),maxLength:32,onChange:ce,placeholder:o("https://example.com"),value:O?ie:""}),(0,a.jsx)(r.II,{isDisabled:!R,isError:!y,label:o("twitter"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:$,value:R}),onChange:ne,placeholder:o("@YourTwitterName"),value:R?ae:""}),(0,a.jsx)(r.II,{isDisabled:!H,isError:!p,label:o("discord"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:B,value:H}),onChange:re,placeholder:o("YourDiscordHandle"),value:H?oe:""}),he?(0,a.jsx)(r.II,{isDisabled:!P,isError:!v,label:o("riot name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:z,value:P}),maxLength:32,onChange:X,placeholder:o("@yourname:matrix.org"),value:P?Q:""}):(0,a.jsx)(r.II,{isDisabled:!F,isError:!j,label:o("matrix name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:L,value:F}),maxLength:32,onChange:ee,placeholder:o("@yourname:matrix.org"),value:F?K:""}),he?(0,a.jsx)("div",{}):(0,a.jsx)(r.II,{isDisabled:!V,isError:!b,label:o("Github name"),labelExtra:(0,a.jsx)(r.ZD,{label:o("include field"),onChange:_,value:V}),maxLength:32,onChange:te,placeholder:o("YourGithubHandle"),value:V?se:""}),(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:!l||!ue,label:o("Clear Identity"),onStart:t,tx:i.tx.identity.clearIdentity}),(0,a.jsx)(r.cA,{accountId:e,isDisabled:!l||!m,label:o("Set Identity"),onStart:t,params:[he?k:S],tx:i.tx.identity.setIdentity})]})]})}));var Xe=t(19008);const Ke=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}=M(),{apiIdentity:l,enableIdentity:c}=(0,u.h)(),{allAccounts:d}=(0,i.x)(),h=(0,Xe.x)(e),m=(0,Fe.W7)(h&&0!==h.length&&l.query.identity.superOf.multi,[h],es),[p,x]=(0,n.useState)();(0,n.useEffect)((()=>{m?x(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,le.z)(s.asRaw)])}return e}),[])}(m)):h&&!h.length&&x([])}),[d,h,m]);const g=(0,n.useCallback)((()=>x((e=>e?.concat([[d[0],""]])))),[d]),b=(0,n.useCallback)((()=>x((e=>e?.slice(0,e.length-1)))),[]),f=(0,n.useCallback)(((e,s)=>x((t=>(t||[]).map((([t,a],n)=>[e===n?s:t,a]))))),[]),j=(0,n.useCallback)(((e,s)=>x((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:p?(0,a.jsxs)("div",{children:[p.length?p.map((([e,s],t)=>(0,a.jsx)(Ke,{address:e,index:t,name:s,setAddress:f,setName:j,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:g}),(0,a.jsx)(r.zx,{icon:"minus",isDisabled:0===p.length,label:o("Remove sub"),onClick:b})]})]}):(0,a.jsx)(r.$j,{label:o("Retrieving sub-identities")})}),(0,a.jsx)(r.u_.Actions,{children:p&&(0,a.jsx)(r.cA,{accountId:e,isDisabled:!c||p.some((([e,s])=>!e||!s)),label:o("Set Subs"),onStart:t,params:[p.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}=M(),{api:d}=(0,u.h)(),{allAccounts:h}=(0,i.x)(),[m,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:N},S]=(0,n.useState)((()=>({isMultiCall:!1,multisig:null}))),[A,E]=(0,n.useState)(!0),[I,T]=(0,n.useState)([]),[D,P]=(0,n.useState)(null),[z,F]=(0,n.useState)([]),[L,V]=(0,n.useState)("aye"),[_,R]=(0,n.useState)(null),H=(0,n.useRef)([{text:c("Approve this call hash"),value:"aye"},{text:c("Cancel this call hash"),value:"nay"}]),$=(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)((()=>{T(l.map((e=>d.createType("AccountId",e))).filter((e=>!D||!e.eq(D))))}),[d,D,l]),(0,n.useEffect)((()=>{const e=N&&N.approvals.length>=o;F(l.map((e=>d.createType("AccountId",e).toString())).filter((s=>h.some((e=>e===s))&&N&&("nay"===L?N.depositor.eq(s):e||!N.approvals.some((e=>e.eq(s)))))))}),[d,h,N,o,L,l]),(0,n.useEffect)((()=>{if(m)try{(0,ce.hu)((0,k.vq)(m),"Hex call data required");const e=d.createType("Call",m);(0,ce.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,m,y]),(0,n.useEffect)((()=>{const e=d.tx.multisig||d.tx.utility;R((()=>y&&N?"aye"===L?w&&A?x?5===e.asMulti.meta.args.length?e.asMulti(o,I,N.when,x.toHex(),v):6===e.asMulti.meta.args.length?e.asMulti(o,I,N.when,x.toHex(),!1,v):e.asMulti(o,I,N.when,x):null:5===e.approveAsMulti.meta.args.length?e.approveAsMulti(o,I,N.when,y,v):e.approveAsMulti(o,I,N.when,y):e.cancelAsMulti(o,I,N.when,y):null))}),[d,x,y,A,w,I,N,o,L,v]);const B="aye"===L;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:$.length}}),onChange:C,options:$,value:y})}),N&&(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:N.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:N.approvals.length,threshold:o}}),children:N.approvals.map((e=>(0,a.jsx)(r.ax,{isPadded:!1,value:e},ce.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:V,options:H.current,value:L})}),0!==z.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:z,label:c("signatory"),onChange:P})}),"aye"===L&&w&&(0,a.jsxs)(a.Fragment,{children:[A&&(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:!m||!!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:E,value:A})})]})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:D,extrinsic:_,icon:B?"check":"times",isDisabled:!_||B&&(!z.length||!!x&&!j),label:B?"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}=M(),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 hs({index:e,onChangeAccount:s,onChangeType:t,onRemove:o,proxiedAccount:i,typeOpts:l,value:[c,u]}){const{t:d}=M(),h=(0,n.useCallback)((t=>s(e,t)),[e,s]),m=(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:h,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:m,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 ms(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_)` +`,rs=n.memo((function({className:e="",onClose:s,ongoing:t,threshold:o=0,who:l=[]}){const{t:c}=M(),{api:d}=(0,u.h)(),{allAccounts:h}=(0,i.x)(),[m,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:N},S]=(0,n.useState)((()=>({isMultiCall:!1,multisig:null}))),[A,I]=(0,n.useState)(!0),[E,T]=(0,n.useState)([]),[D,P]=(0,n.useState)(null),[z,F]=(0,n.useState)([]),[L,V]=(0,n.useState)("aye"),[_,R]=(0,n.useState)(null),$=(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)((()=>{T(l.map((e=>d.createType("AccountId",e))).filter((e=>!D||!e.eq(D))))}),[d,D,l]),(0,n.useEffect)((()=>{const e=N&&N.approvals.length>=o;F(l.map((e=>d.createType("AccountId",e).toString())).filter((s=>h.some((e=>e===s))&&N&&("nay"===L?N.depositor.eq(s):e||!N.approvals.some((e=>e.eq(s)))))))}),[d,h,N,o,L,l]),(0,n.useEffect)((()=>{if(m)try{(0,ce.hu)((0,k.vq)(m),"Hex call data required");const e=d.createType("Call",m);(0,ce.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,m,y]),(0,n.useEffect)((()=>{const e=d.tx.multisig||d.tx.utility;R((()=>y&&N?"aye"===L?w&&A?x?5===e.asMulti.meta.args.length?e.asMulti(o,E,N.when,x.toHex(),v):6===e.asMulti.meta.args.length?e.asMulti(o,E,N.when,x.toHex(),!1,v):e.asMulti(o,E,N.when,x):null:5===e.approveAsMulti.meta.args.length?e.approveAsMulti(o,E,N.when,y,v):e.approveAsMulti(o,E,N.when,y):e.cancelAsMulti(o,E,N.when,y):null))}),[d,x,y,A,w,E,N,o,L,v]);const B="aye"===L;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})}),N&&(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:N.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:N.approvals.length,threshold:o}}),children:N.approvals.map((e=>(0,a.jsx)(r.ax,{isPadded:!1,value:e},ce.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:V,options:$.current,value:L})}),0!==z.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:z,label:c("signatory"),onChange:P})}),"aye"===L&&w&&(0,a.jsxs)(a.Fragment,{children:[A&&(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:!m||!!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:I,value:A})})]})]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:D,extrinsic:_,icon:B?"check":"times",isDisabled:!_||B&&(!z.length||!!x&&!j),label:B?"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}=M(),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 hs({index:e,onChangeAccount:s,onChangeType:t,onRemove:o,proxiedAccount:i,typeOpts:l,value:[c,u]}){const{t:d}=M(),h=(0,n.useCallback)((t=>s(e,t)),[e,s]),m=(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:h,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:m,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 ms(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; @@ -65,11 +65,11 @@ padding-top: 0.3rem; } } -`,xs=n.memo((function({className:e,onClose:s,previousProxy:[t]=cs,proxiedAccount:o}){const{t:i}=M(),{api:l}=(0,u.h)(),[c,d]=(0,n.useState)([]),[h,m]=(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+h.length).iadd(l.consts.proxy.proxyDepositBase)),[l,c,h]),C=(0,n.useRef)(function(e){return ms(e).defKeys.map(((e,s)=>({text:e,value:s}))).filter((({text:e})=>!e.startsWith("__Unused")))}(l));(0,n.useEffect)((()=>{m(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,...h]))}),[c,h]);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),ms(l)]]))),[l,g,o]),k=(0,n.useCallback)((e=>j((s=>s.filter(((s,t)=>t!==e))))),[]),N=(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]),A=(0,n.useCallback)(((e,s)=>j((t=>{const a=[...t];return a[e][1]=ms(l,s),a}))),[l]),E=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:N,typeOpts:C.current,value:e},`${e.toString()}-${s}`))),f.map(((e,s)=>(0,a.jsx)(hs,{index:s,onChangeAccount:S,onChangeType:A,onRemove:k,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:E||!c.length&&!h.length,onStart:s})]})]})})),gs=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=M(),{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}=M(),{api:i}=(0,u.h)(),l=je(e),[c,d]=(0,n.useState)(),[h,m]=(0,n.useState)([]),[p,x]=(0,n.useState)(),g=!c,b=!h.length,f=!p||!p.gtn(0)||p.gtn(h.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:m,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)(h),p,c],tx:i.tx.recovery.createRecovery})})]})})),js=n.memo((function({accountDelegating:e,onClose:s}){const{t}=M(),{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,be.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,ke.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&&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},ks={available:!0,bonded:!0,locked:!0,nonce:!0,redeemable:!0,reserved:!0,total:!1,unlocking:!0,vested:!0};function Ns(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(pe())(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 As(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 Es={transform:e=>e.unwrapOr(null)},Is=r.zo.tr` +`,xs=n.memo((function({className:e,onClose:s,previousProxy:[t]=cs,proxiedAccount:o}){const{t:i}=M(),{api:l}=(0,u.h)(),[c,d]=(0,n.useState)([]),[h,m]=(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+h.length).iadd(l.consts.proxy.proxyDepositBase)),[l,c,h]),C=(0,n.useRef)(function(e){return ms(e).defKeys.map(((e,s)=>({text:e,value:s}))).filter((({text:e})=>!e.startsWith("__Unused")))}(l));(0,n.useEffect)((()=>{m(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,...h]))}),[c,h]);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),ms(l)]]))),[l,g,o]),k=(0,n.useCallback)((e=>j((s=>s.filter(((s,t)=>t!==e))))),[]),N=(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]),A=(0,n.useCallback)(((e,s)=>j((t=>{const a=[...t];return a[e][1]=ms(l,s),a}))),[l]),I=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:N,typeOpts:C.current,value:e},`${e.toString()}-${s}`))),f.map(((e,s)=>(0,a.jsx)(hs,{index:s,onChangeAccount:S,onChangeType:A,onRemove:k,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:I||!c.length&&!h.length,onStart:s})]})]})})),gs=n.memo((function({address:e,className:s="",onClose:t}){const{t:o}=M(),{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}=M(),{api:i}=(0,u.h)(),l=je(e),[c,d]=(0,n.useState)(),[h,m]=(0,n.useState)([]),[p,x]=(0,n.useState)(),g=!c,b=!h.length,f=!p||!p.gtn(0)||p.gtn(h.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:m,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)(h),p,c],tx:i.tx.recovery.createRecovery})})]})})),js=n.memo((function({accountDelegating:e,onClose:s}){const{t}=M(),{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,be.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,ke.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&&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},ks={available:!0,bonded:!0,locked:!0,nonce:!0,redeemable:!0,reserved:!0,total:!1,unlocking:!0,vested:!0};function Ns(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(pe())(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 As(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 Is={transform:e=>e.unwrapOr(null)},Es=r.zo.tr` .devBadge { opacity: var(--opacity-light); } -`,Ts=n.memo((function({account:{address:e,meta:s},className:t="",delegation:o,filter:i,isFavorite:l,proxy:c,setBalance:m,toggleFavorite:p}){const{t:x}=M(),[g,y]=(0,h.O)(!1),{queueExtrinsic:C}=(0,De.L)(),{api:w,apiIdentity:k,enableIdentity:N,isDevelopment:S,isEthereum:A}=(0,u.h)(),{getLedger:E}=(0,d.c)(),I=(0,Pe.C)(),T=(0,Me.r)(e),D=(0,ze._)(e),P=(0,Fe.W7)(w.derive.democracy?.locks,[e]),z=(0,Fe.W7)(w.query.recovery?.recoverable,[e],Es),F=Cs(e),L=Se(e),{flags:{isDevelopment:_,isEditable:R,isEthereum:H,isExternal:$,isHardware:B,isInjected:O,isMultisig:q,isProxied:W},genesisHash:Z,identity:U,name:J,onSetGenesisHash:G,tags:Y}=(0,Le.B)(e),Q=(0,Te.Z)("referenda","convictionVoting",e),[{democracyUnlockTx:X},K]=(0,n.useState)({democracyUnlockTx:null,ids:[]}),[{referendaUnlockTx:ee},se]=(0,n.useState)({ids:[],referendaUnlockTx:null}),[te,ae]=(0,n.useState)(null),[ne,oe]=(0,h.O)(),[re,ie]=(0,h.O)(),[le,ce]=(0,h.O)(),[ue,de]=(0,h.O)(),[he,me]=(0,h.O)(),[pe,xe]=(0,h.O)(),[ge,be]=(0,h.O)(),[fe,je]=(0,h.O)(),[ve,ye]=(0,h.O)(),[Ce,we]=(0,h.O)(),[ke,Ne]=(0,h.O)(),[Ae,Ee]=(0,h.O)(),[Ie,$e]=(0,h.O)();(0,n.useEffect)((()=>{T&&(m(e,{bonded:D?.stakingLedger.active?.unwrap()||j.nw,locked:T.lockedBalance,redeemable:D?.redeemable||j.nw,total:T.freeBalance.add(T.reservedBalance),transferable:T.transferable||T.availableBalance,unbonding:Ns(D)}),w.tx.vesting?.vest&&ae((()=>T.vestingLocked.isZero()?null:w.tx.vesting.vest())))}),[e,w,T,m,D]),(0,n.useEffect)((()=>{I&&P&&K((s=>{const t=P.filter((({isFinished:e,unlockAt:s})=>e&&I.gt(s))).map((({referendumId:e})=>e));return JSON.stringify(s.ids)===JSON.stringify(t)?s:{democracyUnlockTx:Ss(w,e,t),ids:t}}))}),[e,w,I,P]),(0,n.useEffect)((()=>{I&&Q&&se((s=>{const t=Q.filter((({endBlock:e})=>e.gt(j.nw)&&I.gt(e))).map((({classId:e,refId:s})=>[e,s]));return JSON.stringify(s.ids)===JSON.stringify(t)?s:{ids:t,referendaUnlockTx:As(w,e,t)}}))}),[e,w,I,Q]);const Be=(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,J,Y)),[J,i,Y]),qe=(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]),We=(0,n.useCallback)((()=>X&&C({accountId:e,extrinsic:X})),[e,X,C]),Ue=(0,n.useCallback)((()=>ee&&C({accountId:e,extrinsic:ee})),[e,ee,C]),Je=(0,n.useCallback)((()=>te&&C({accountId:e,extrinsic:te})),[e,C,te]),Ge=(0,n.useCallback)((()=>{(async function(e,s,t){const a=f.X.get().ledgerApp,n=e();"migration"===a||"generic"===a?await n.getAddress(t,!0,s.accountOffset||0,s.addressOffset||0):await n.getAddress(!0,s.accountOffset||0,s.addressOffset||0)})(E,s,w.consts.system.ss58Prefix.toNumber()).catch((e=>{console.error(`ledger: ${e.message}`)}))}),[E,s,w.consts.system.ss58Prefix]),Ye=(0,n.useMemo)((()=>[V("identityGroup",[(0,v.m)(k.tx.identity?.setIdentity)&&N&&!B&&(0,a.jsx)(r.v2.Item,{icon:"link",label:x("Set on-chain identity"),onClick:de},"identityMain"),(0,v.m)(k.tx.identity?.setSubs)&&N&&U?.display&&!B&&(0,a.jsx)(r.v2.Item,{icon:"vector-square",label:x("Set on-chain sub-identities"),onClick:me},"identitySub"),(0,v.m)(w.tx.democracy?.unlock)&&X&&(0,a.jsx)(r.v2.Item,{icon:"broom",label:x("Clear expired democracy locks"),onClick:We},"clearDemocracy"),(0,v.m)(w.tx.convictionVoting?.unlock)&&ee&&(0,a.jsx)(r.v2.Item,{icon:"broom",label:x("Clear expired referenda locks"),onClick:Ue},"clearReferenda"),(0,v.m)(w.tx.vesting?.vest)&&te&&(0,a.jsx)(r.v2.Item,{icon:"unlock",label:x("Unlock vested amount"),onClick:Je},"vestingVest")],x("Identity")),V("deriveGroup",[!(H||$||B||O||q||A)&&(0,a.jsx)(r.v2.Item,{icon:"download",label:x("Derive account via derivation path"),onClick:ie},"deriveAccount"),B&&(0,a.jsx)(r.v2.Item,{icon:"eye",label:x("Show address on hardware device"),onClick:Ge},"showHwAddress")],x("Derive")),V("backupGroup",[!($||B||O||q||_)&&(0,a.jsx)(r.v2.Item,{icon:"database",label:x("Create a backup file for this account"),onClick:oe},"backupJson"),!($||B||O||q||_)&&(0,a.jsx)(r.v2.Item,{icon:"edit",label:x("Change this account's password"),onClick:je},"changePassword"),!(O||_)&&(0,a.jsx)(r.v2.Item,{icon:"trash-alt",label:x("Forget this account"),onClick:ce},"forgetAccount")],x("Backup")),(0,v.m)(w.tx.recovery?.createRecovery)&&V("reoveryGroup",[!z&&(0,a.jsx)(r.v2.Item,{icon:"redo",label:x("Make recoverable"),onClick:we},"makeRecoverable"),(0,a.jsx)(r.v2.Item,{icon:"screwdriver",label:x("Initiate recovery for another"),onClick:ye},"initRecovery")],x("Recovery")),(0,v.m)(w.tx.multisig?.asMulti)&&q&&V("multisigGroup",[(0,a.jsx)(r.v2.Item,{icon:"file-signature",isDisabled:!F?.length,label:x("Multisig approvals"),onClick:xe},"multisigApprovals")],x("Multisig")),(0,v.m)(w.query.democracy?.votingOf)&&o?.accountDelegated&&V("undelegateGroup",[(0,a.jsx)(r.v2.Item,{icon:"user-edit",label:x("Change democracy delegation"),onClick:Ee},"changeDelegate"),(0,a.jsx)(r.v2.Item,{icon:"user-minus",label:x("Undelegate"),onClick:$e},"undelegate")],x("Undelegate")),V("delegateGroup",[(0,v.m)(w.query.democracy?.votingOf)&&!o?.accountDelegated&&(0,a.jsx)(r.v2.Item,{icon:"user-plus",label:x("Delegate democracy votes"),onClick:Ee},"delegate"),(0,v.m)(w.query.proxy?.proxies)&&(0,a.jsx)(r.v2.Item,{icon:"sitemap",label:c?.[0].length?x("Manage proxies"):x("Add proxy"),onClick:be},"proxy-overview")],x("Delegate")),R&&!S&&V("genesisGroup",[(0,a.jsx)(r.H_,{className:"accounts--network-toggle",genesisHash:Z,onChange:G},"chainlock")])].filter((e=>e))),[We,Ue,Ge,Je,w,k.tx.identity,N,o,X,Z,U,_,S,A,R,H,$,B,O,q,F,G,c,ee,z,x,oe,Ee,ie,ce,de,me,xe,je,be,ye,we,$e,te]);return Be?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(Is,{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}),ne&&(0,a.jsx)(Re,{address:e,onClose:oe},"modal-backup-account"),Ae&&(0,a.jsx)(Oe,{onClose:Ee,previousAmount:o?.amount,previousConviction:o?.conviction,previousDelegatedAccount:o?.accountDelegated,previousDelegatingAccount:e},"modal-delegate"),re&&(0,a.jsx)(Ze,{from:e,onClose:ie},"modal-derive-account"),le&&(0,a.jsx)(r.u5,{address:e,onClose:ce,onForget:qe},"modal-forget-account"),ue&&(0,a.jsx)(Qe,{address:e,onClose:de},"modal-identity-main"),he&&(0,a.jsx)(ss,{address:e,onClose:me},"modal-identity-sub"),fe&&(0,a.jsx)(He,{address:e,onClose:je},"modal-change-pass"),ke&&(0,a.jsx)(r.Zd,{onClose:Ne,senderId:e},"modal-transfer"),ge&&(0,a.jsx)(xs,{onClose:be,previousProxy:c,proxiedAccount:e},"modal-proxy-overview"),q&&pe&&F&&0!==F.length&&(0,a.jsx)(rs,{address:e,onClose:xe,ongoing:F,threshold:s.threshold,who:s.who},"multisig-approve"),ve&&(0,a.jsx)(gs,{address:e,onClose:ye},"recover-account"),Ce&&(0,a.jsx)(fs,{address:e,onClose:we},"recover-setup"),Ie&&(0,a.jsx)(js,{accountDelegating:e,onClose:$e},"modal-delegate"),(0,a.jsxs)("div",{className:"absolute",children:[s.genesisHash?(0,a.jsx)(r.Ct,{color:"transparent"}):_?(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"}),z&&(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:z.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,Ve.u)(z.threshold)})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:x("delay")}),(0,a.jsx)("td",{children:(0,Ve.u)(z.delayPeriod)})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:x("deposit")}),(0,a.jsx)("td",{children:(0,_e.a)(z.deposit)})]})]})})]}),icon:"redo"}),W&&L?.isEmpty&&(0,a.jsx)(r.Ct,{className:"important",hover:x("Proxied account has no owned proxies"),icon:"sitemap",info:"0"}),q&&F&&0!==F.length&&(0,a.jsx)(r.Ct,{className:"important",color:"purple",hover:x("Multisig approvals pending"),hoverAction:x("View pending approvals"),icon:"file-signature",onClick:xe}),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:Ee}),c&&0!==c[0].length&&w.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:be})]})]}),(0,a.jsx)("td",{className:"actions button",children:(0,a.jsxs)(r.zx.Group,{children:[((0,v.m)(w.tx.balances?.transferAllowDeath)||(0,v.m)(w.tx.balances?.transfer))&&(0,a.jsx)(r.zx,{className:"send-button",icon:"paper-plane",label:x("send"),onClick:Ne}),(0,a.jsx)(r.GI,{isDisabled:!Ye.length,value:(0,a.jsx)(r.v2,{children:Ye})})]})}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:g,toggle:y})]}),(0,a.jsxs)(Is,{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:T,withBalance:ws})}),(0,a.jsx)("td",{})]}),(0,a.jsxs)(Is,{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:T,convictionLocks:Q,withBalance:ks}),(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:Y,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 Ds=t(73352);const Ps=n.memo((function(){const e=(0,Ds.Z)(),{t:s}=M();return e?(0,a.jsx)(G,{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 Ms=t(54924),zs=t(76075),Fs=t(79444),Ls=t(345),Vs=t(69356),_s=t(30242);const Rs=(0,Ms.qY)(),Hs=Rs&&Rs.name||null,$s=Hs&&Object.keys(Fs.l).includes(Hs),Bs=(0,Vs.onlyOnWeb)(n.memo((function(){const{t:e}=M(),{hasInjectedAccounts:s}=(0,u.h)(),t=(0,zs.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 $s&&Hs?Ls.LW?s?t?(0,a.jsxs)(G,{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 and to use a Ledger device."):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 and to use a Ledger device.",{replace:{upgradableCount:t}}),e(" This update includes chain metadata and chain properties.")]}),(0,a.jsx)("p",{children:(0,a.jsxs)(P.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)(G,{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)(G,{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,_s.k)(Hs)}})}),(0,a.jsx)("ul",{children:Fs.l[Hs].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 Os=t(58607);const qs=n.memo((function({balance:e,className:s}){const{t}=M();return(0,a.jsxs)(r.Ty,{className:s,children:[(0,a.jsx)(r.Jy,{label:t("total balance"),children:(0,a.jsx)(Os.Z,{className:e?"":"--tmp",value:e?.total||1})}),(0,a.jsx)(r.Jy,{className:"media--900",label:t("total transferable"),children:(0,a.jsx)(Os.Z,{className:e?"":"--tmp",value:e?.transferable||1})}),(0,a.jsx)(r.Jy,{label:t("total locked"),children:(0,a.jsx)(Os.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)(Os.Z,{value:e.bonded})}),e?.redeemable.gtn(0)&&(0,a.jsx)(r.Jy,{className:"media--1500",label:t("redeemable"),children:(0,a.jsx)(Os.Z,{value:e.redeemable})}),e?.unbonding.gtn(0)&&(0,a.jsx)(r.Jy,{className:"media--1300",label:t("unbonding"),children:(0,a.jsx)(Os.Z,{value:e.unbonding})})]})})),Ws={sortBy:"date",sortFromMax:!0},Zs=["accounts","injected","qr","hardware","proxied","multisig","testing","chopsticks"],Us=r.zo.div` +`,Ts=n.memo((function({account:{address:e,meta:s},className:t="",delegation:o,filter:i,isFavorite:l,proxy:c,setBalance:m,toggleFavorite:p}){const{t:x}=M(),[g,y]=(0,h.O)(!1),{queueExtrinsic:C}=(0,De.L)(),{api:w,apiIdentity:k,enableIdentity:N,isDevelopment:S,isEthereum:A}=(0,u.h)(),{getLedger:I}=(0,d.c)(),E=(0,Pe.C)(),T=(0,Me.r)(e),D=(0,ze._)(e),P=(0,Fe.W7)(w.derive.democracy?.locks,[e]),z=(0,Fe.W7)(w.query.recovery?.recoverable,[e],Is),F=Cs(e),L=Se(e),{flags:{isDevelopment:_,isEditable:R,isEthereum:$,isExternal:H,isHardware:B,isInjected:O,isMultisig:W,isProxied:q},genesisHash:Z,identity:U,name:J,onSetGenesisHash:G,tags:Y}=(0,Le.B)(e),Q=(0,Te.Z)("referenda","convictionVoting",e),[{democracyUnlockTx:X},K]=(0,n.useState)({democracyUnlockTx:null,ids:[]}),[{referendaUnlockTx:ee},se]=(0,n.useState)({ids:[],referendaUnlockTx:null}),[te,ae]=(0,n.useState)(null),[ne,oe]=(0,h.O)(),[re,ie]=(0,h.O)(),[le,ce]=(0,h.O)(),[ue,de]=(0,h.O)(),[he,me]=(0,h.O)(),[pe,xe]=(0,h.O)(),[ge,be]=(0,h.O)(),[fe,je]=(0,h.O)(),[ve,ye]=(0,h.O)(),[Ce,we]=(0,h.O)(),[ke,Ne]=(0,h.O)(),[Ae,Ie]=(0,h.O)(),[Ee,He]=(0,h.O)();(0,n.useEffect)((()=>{T&&(m(e,{bonded:D?.stakingLedger.active?.unwrap()||j.nw,locked:T.lockedBalance,redeemable:D?.redeemable||j.nw,total:T.freeBalance.add(T.reservedBalance),transferable:T.transferable||T.availableBalance,unbonding:Ns(D)}),w.tx.vesting?.vest&&ae((()=>T.vestingLocked.isZero()?null:w.tx.vesting.vest())))}),[e,w,T,m,D]),(0,n.useEffect)((()=>{E&&P&&K((s=>{const t=P.filter((({isFinished:e,unlockAt:s})=>e&&E.gt(s))).map((({referendumId:e})=>e));return JSON.stringify(s.ids)===JSON.stringify(t)?s:{democracyUnlockTx:Ss(w,e,t),ids:t}}))}),[e,w,E,P]),(0,n.useEffect)((()=>{E&&Q&&se((s=>{const t=Q.filter((({endBlock:e})=>e.gt(j.nw)&&E.gt(e))).map((({classId:e,refId:s})=>[e,s]));return JSON.stringify(s.ids)===JSON.stringify(t)?s:{ids:t,referendaUnlockTx:As(w,e,t)}}))}),[e,w,E,Q]);const Be=(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,J,Y)),[J,i,Y]),We=(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]),qe=(0,n.useCallback)((()=>X&&C({accountId:e,extrinsic:X})),[e,X,C]),Ue=(0,n.useCallback)((()=>ee&&C({accountId:e,extrinsic:ee})),[e,ee,C]),Je=(0,n.useCallback)((()=>te&&C({accountId:e,extrinsic:te})),[e,C,te]),Ge=(0,n.useCallback)((()=>{(async function(e,s,t){const a=f.X.get().ledgerApp,n=e();"migration"===a||"generic"===a?await n.getAddress(t,!0,s.accountOffset||0,s.addressOffset||0):await n.getAddress(!0,s.accountOffset||0,s.addressOffset||0)})(I,s,w.consts.system.ss58Prefix.toNumber()).catch((e=>{console.error(`ledger: ${e.message}`)}))}),[I,s,w.consts.system.ss58Prefix]),Ye=(0,n.useMemo)((()=>[V("identityGroup",[(0,v.m)(k.tx.identity?.setIdentity)&&N&&!B&&(0,a.jsx)(r.v2.Item,{icon:"link",label:x("Set on-chain identity"),onClick:de},"identityMain"),(0,v.m)(k.tx.identity?.setSubs)&&N&&U?.display&&!B&&(0,a.jsx)(r.v2.Item,{icon:"vector-square",label:x("Set on-chain sub-identities"),onClick:me},"identitySub"),(0,v.m)(w.tx.democracy?.unlock)&&X&&(0,a.jsx)(r.v2.Item,{icon:"broom",label:x("Clear expired democracy locks"),onClick:qe},"clearDemocracy"),(0,v.m)(w.tx.convictionVoting?.unlock)&&ee&&(0,a.jsx)(r.v2.Item,{icon:"broom",label:x("Clear expired referenda locks"),onClick:Ue},"clearReferenda"),(0,v.m)(w.tx.vesting?.vest)&&te&&(0,a.jsx)(r.v2.Item,{icon:"unlock",label:x("Unlock vested amount"),onClick:Je},"vestingVest")],x("Identity")),V("deriveGroup",[!($||H||B||O||W||A)&&(0,a.jsx)(r.v2.Item,{icon:"download",label:x("Derive account via derivation path"),onClick:ie},"deriveAccount"),B&&(0,a.jsx)(r.v2.Item,{icon:"eye",label:x("Show address on hardware device"),onClick:Ge},"showHwAddress")],x("Derive")),V("backupGroup",[!(H||B||O||W||_)&&(0,a.jsx)(r.v2.Item,{icon:"database",label:x("Create a backup file for this account"),onClick:oe},"backupJson"),!(H||B||O||W||_)&&(0,a.jsx)(r.v2.Item,{icon:"edit",label:x("Change this account's password"),onClick:je},"changePassword"),!(O||_)&&(0,a.jsx)(r.v2.Item,{icon:"trash-alt",label:x("Forget this account"),onClick:ce},"forgetAccount")],x("Backup")),(0,v.m)(w.tx.recovery?.createRecovery)&&V("reoveryGroup",[!z&&(0,a.jsx)(r.v2.Item,{icon:"redo",label:x("Make recoverable"),onClick:we},"makeRecoverable"),(0,a.jsx)(r.v2.Item,{icon:"screwdriver",label:x("Initiate recovery for another"),onClick:ye},"initRecovery")],x("Recovery")),(0,v.m)(w.tx.multisig?.asMulti)&&W&&V("multisigGroup",[(0,a.jsx)(r.v2.Item,{icon:"file-signature",isDisabled:!F?.length,label:x("Multisig approvals"),onClick:xe},"multisigApprovals")],x("Multisig")),(0,v.m)(w.query.democracy?.votingOf)&&o?.accountDelegated&&V("undelegateGroup",[(0,a.jsx)(r.v2.Item,{icon:"user-edit",label:x("Change democracy delegation"),onClick:Ie},"changeDelegate"),(0,a.jsx)(r.v2.Item,{icon:"user-minus",label:x("Undelegate"),onClick:He},"undelegate")],x("Undelegate")),V("delegateGroup",[(0,v.m)(w.query.democracy?.votingOf)&&!o?.accountDelegated&&(0,a.jsx)(r.v2.Item,{icon:"user-plus",label:x("Delegate democracy votes"),onClick:Ie},"delegate"),(0,v.m)(w.query.proxy?.proxies)&&(0,a.jsx)(r.v2.Item,{icon:"sitemap",label:c?.[0].length?x("Manage proxies"):x("Add proxy"),onClick:be},"proxy-overview")],x("Delegate")),R&&!S&&V("genesisGroup",[(0,a.jsx)(r.H_,{className:"accounts--network-toggle",genesisHash:Z,onChange:G},"chainlock")])].filter((e=>e))),[qe,Ue,Ge,Je,w,k.tx.identity,N,o,X,Z,U,_,S,A,R,$,H,B,O,W,F,G,c,ee,z,x,oe,Ie,ie,ce,de,me,xe,je,be,ye,we,He,te]);return Be?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(Es,{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}),ne&&(0,a.jsx)(Re,{address:e,onClose:oe},"modal-backup-account"),Ae&&(0,a.jsx)(Oe,{onClose:Ie,previousAmount:o?.amount,previousConviction:o?.conviction,previousDelegatedAccount:o?.accountDelegated,previousDelegatingAccount:e},"modal-delegate"),re&&(0,a.jsx)(Ze,{from:e,onClose:ie},"modal-derive-account"),le&&(0,a.jsx)(r.u5,{address:e,onClose:ce,onForget:We},"modal-forget-account"),ue&&(0,a.jsx)(Qe,{address:e,onClose:de},"modal-identity-main"),he&&(0,a.jsx)(ss,{address:e,onClose:me},"modal-identity-sub"),fe&&(0,a.jsx)($e,{address:e,onClose:je},"modal-change-pass"),ke&&(0,a.jsx)(r.Zd,{onClose:Ne,senderId:e},"modal-transfer"),ge&&(0,a.jsx)(xs,{onClose:be,previousProxy:c,proxiedAccount:e},"modal-proxy-overview"),W&&pe&&F&&0!==F.length&&(0,a.jsx)(rs,{address:e,onClose:xe,ongoing:F,threshold:s.threshold,who:s.who},"multisig-approve"),ve&&(0,a.jsx)(gs,{address:e,onClose:ye},"recover-account"),Ce&&(0,a.jsx)(fs,{address:e,onClose:we},"recover-setup"),Ee&&(0,a.jsx)(js,{accountDelegating:e,onClose:He},"modal-delegate"),(0,a.jsxs)("div",{className:"absolute",children:[s.genesisHash?(0,a.jsx)(r.Ct,{color:"transparent"}):_?(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"}),z&&(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:z.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,Ve.u)(z.threshold)})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:x("delay")}),(0,a.jsx)("td",{children:(0,Ve.u)(z.delayPeriod)})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:x("deposit")}),(0,a.jsx)("td",{children:(0,_e.a)(z.deposit)})]})]})})]}),icon:"redo"}),q&&L?.isEmpty&&(0,a.jsx)(r.Ct,{className:"important",hover:x("Proxied account has no owned proxies"),icon:"sitemap",info:"0"}),W&&F&&0!==F.length&&(0,a.jsx)(r.Ct,{className:"important",color:"purple",hover:x("Multisig approvals pending"),hoverAction:x("View pending approvals"),icon:"file-signature",onClick:xe}),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:Ie}),c&&0!==c[0].length&&w.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:be})]})]}),(0,a.jsx)("td",{className:"actions button",children:(0,a.jsxs)(r.zx.Group,{children:[((0,v.m)(w.tx.balances?.transferAllowDeath)||(0,v.m)(w.tx.balances?.transfer))&&(0,a.jsx)(r.zx,{className:"send-button",icon:"paper-plane",label:x("send"),onClick:Ne}),(0,a.jsx)(r.GI,{isDisabled:!Ye.length,value:(0,a.jsx)(r.v2,{children:Ye})})]})}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:g,toggle:y})]}),(0,a.jsxs)(Es,{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:T,withBalance:ws})}),(0,a.jsx)("td",{})]}),(0,a.jsxs)(Es,{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:T,convictionLocks:Q,withBalance:ks}),(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:Y,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 Ds=t(73352);const Ps=n.memo((function(){const e=(0,Ds.Z)(),{t:s}=M();return e?(0,a.jsx)(G,{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 Ms=t(54924),zs=t(76075),Fs=t(79444),Ls=t(345),Vs=t(69356),_s=t(30242);const Rs=(0,Ms.qY)(),$s=Rs&&Rs.name||null,Hs=$s&&Object.keys(Fs.l).includes($s),Bs=(0,Vs.onlyOnWeb)(n.memo((function(){const{t:e}=M(),{hasInjectedAccounts:s}=(0,u.h)(),t=(0,zs.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 Hs&&$s?Ls.LW?s?t?(0,a.jsxs)(G,{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 and to use a Ledger device."):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 and to use a Ledger device.",{replace:{upgradableCount:t}}),e(" This update includes chain metadata and chain properties.")]}),(0,a.jsx)("p",{children:(0,a.jsxs)(P.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)(G,{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)(G,{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,_s.k)($s)}})}),(0,a.jsx)("ul",{children:Fs.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 Os=t(58607);const Ws=n.memo((function({balance:e,className:s}){const{t}=M();return(0,a.jsxs)(r.Ty,{className:s,children:[(0,a.jsx)(r.Jy,{label:t("total balance"),children:(0,a.jsx)(Os.Z,{className:e?"":"--tmp",value:e?.total||1})}),(0,a.jsx)(r.Jy,{className:"media--900",label:t("total transferable"),children:(0,a.jsx)(Os.Z,{className:e?"":"--tmp",value:e?.transferable||1})}),(0,a.jsx)(r.Jy,{label:t("total locked"),children:(0,a.jsx)(Os.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)(Os.Z,{value:e.bonded})}),e?.redeemable.gtn(0)&&(0,a.jsx)(r.Jy,{className:"media--1500",label:t("redeemable"),children:(0,a.jsx)(Os.Z,{value:e.redeemable})}),e?.unbonding.gtn(0)&&(0,a.jsx)(r.Jy,{className:"media--1300",label:t("unbonding"),children:(0,a.jsx)(Os.Z,{value:e.unbonding})})]})})),qs={sortBy:"date",sortFromMax:!0},Zs=["accounts","injected","qr","hardware","proxied","multisig","testing","chopsticks"],Us=r.zo.div` .ui--Dropdown { width: 15rem; } @@ -85,7 +85,7 @@ margin-left: auto; } } -`,Js=n.memo((function({className:e="",onStatusChange:s}){const{t}=M(),{api:o,fork:y,isElectron:C}=(0,u.h)(),{allAccounts:w,hasAccounts:k}=(0,i.x)(),{isIpfs:N}=(0,l.g)(),{isLedgerEnabled:S}=(0,d.c)(),[A,E]=(0,h.O)(),[I,T]=(0,h.O)(),[D,P]=(0,h.O)(),[z,F]=(0,h.O)(),[L,V]=(0,h.O)(),[_,R]=(0,h.O)(),[$,B]=(0,h.O)(),[O,q]=(0,m.r)("accounts:favorites"),[W,Z]=(0,n.useState)({accounts:{}}),[U,J]=(0,n.useState)(""),[G,Y]=(0,n.useState)([]),[{sortBy:X,sortFromMax:K},ee]=(0,n.useState)(Ws),se=(0,p.W)(),te=(0,x.N)(),ae=(0,g.q)(),ne=(0,n.useCallback)((e=>ee((({sortFromMax:s})=>({sortBy:e,sortFromMax:s})))),[]),oe=(0,n.useCallback)((()=>ee((({sortBy:e,sortFromMax:s})=>({sortBy:e,sortFromMax:!s})))),[]),re=(0,n.useRef)(H.map((e=>({text:e,value:e})))),le=(0,n.useCallback)(((e,s)=>Z((({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"),transferable:a("transferable"),unbonding:a("unbonding")}}}))),[]),ce=(0,n.useMemo)((()=>C||!N&&"on"===f.X.get().storage),[C,N]),ue=(0,n.useMemo)((()=>Object.fromEntries(O.map((e=>[e,!0])))),[O]),me=(0,n.useMemo)((()=>(0,v.m)((o.tx.multisig||o.tx.utility)?.approveAsMulti)),[o]),pe=(0,n.useMemo)((()=>(0,v.m)(o.tx.proxy?.addProxy)),[o]),xe=(0,n.useMemo)((()=>w.map(((e,s)=>{const t=se&&se[s]?.isDelegating&&se[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:ue[e??""]??!1}})).filter((e=>!!e.account)).reduce(((e,s)=>(e[s.address]=s,e)),{})),[w,ue,se]),ge=(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")})]})]],chopsticks:[[(0,a.jsxs)(a.Fragment,{children:[t("chopsticks"),(0,a.jsx)("div",{className:"sub",children:t("local accounts added via chopsticks fork")})]})]],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]),be=(0,n.useMemo)((()=>function(e){const s={accounts:[],chopsticks:[],hardware:[],injected:[],multisig:[],proxied:[],qr:[],testing:[]};for(let t=0,a=e.length;tObject.values(xe).reduce(((e,{account:s,address:t,delegation:n,isFavorite:o},r)=>(e[t]=(0,a.jsx)(Ts,{account:s,delegation:n,filter:U,isFavorite:o,proxy:te?.[r],setBalance:le,toggleFavorite:q},t),e)),{})),[xe,U,te,le,q]),je=(0,n.useMemo)((()=>Zs.reduce(((e,s)=>{const t=be[s];return t.length&&(e[s]=t.map((e=>fe[e]))),e}),{})),[be,fe]);return(0,n.useEffect)((()=>{Y((e=>[...e.map((e=>xe[e.address])).filter((e=>!!e)),...Object.keys(xe).filter((s=>!e.find((e=>s===e.address)))).map((e=>xe[e]))]))}),[xe]),(0,n.useEffect)((()=>{Y((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,xe,W.accounts,X,K)))}),[xe,W,X,K]),(0,a.jsxs)(Us,{className:e,children:[A&&(0,a.jsx)(ie,{onClose:E,onStatusChange:s}),I&&(0,a.jsx)(de,{onClose:T,onStatusChange:s}),D&&(0,a.jsx)(Q,{onClose:P}),_&&(0,a.jsx)(he,{onClose:R,onStatusChange:s}),z&&(0,a.jsx)(we,{onClose:F,onStatusChange:s}),L&&(0,a.jsx)(Ae,{onClose:V,onStatusChange:s}),$&&(0,a.jsx)(Ie,{onClose:B,onStatusChange:s}),(0,a.jsx)(Bs,{}),(0,a.jsx)(Ps,{}),(0,a.jsx)(qs,{balance:W.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:X,label:t("sort by"),onChange:ne,onClick:oe,options:re.current,sortDirection:K?"ascending":"descending"}),(0,a.jsx)(r.HS,{filterOn:U,label:t("filter by name or tags"),setFilter:J})]}),(0,a.jsxs)(r.zx.Group,{children:[ce&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.zx,{icon:"plus",label:t("Account"),onClick:E}),(0,a.jsx)(r.zx,{icon:"sync",label:t("From JSON"),onClick:T})]}),(0,a.jsx)(r.zx,{icon:"qrcode",label:t("From Qr"),onClick:B}),S&&(0,a.jsx)(r.zx,{icon:"project-diagram",label:t("From Ledger"),onClick:P}),k&&(0,a.jsxs)(a.Fragment,{children:[me&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Multisig"),onClick:F}),pe&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Proxied"),onClick:V})]}),y&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Local"),onClick:R})]})]}),ae&&G.length?Zs.map((e=>je[e]&&(0,a.jsx)(r.iA,{empty:t("No accounts"),header:ge[e],isSplit:!0,children:je[e]},e))):(0,a.jsx)(r.iA,{empty:ae&&G&&t("You don't have any accounts. Some features are currently hidden and will only become available once you have accounts."),header:ge.accounts})]})}));var Gs=t(61261),Ys=t(76116),Qs=t(22420);const Xs=r.zo.tr` +`,Js=n.memo((function({className:e="",onStatusChange:s}){const{t}=M(),{api:o,fork:y,isElectron:C}=(0,u.h)(),{allAccounts:w,hasAccounts:k}=(0,i.x)(),{isIpfs:N}=(0,l.g)(),{isLedgerEnabled:S}=(0,d.c)(),[A,I]=(0,h.O)(),[E,T]=(0,h.O)(),[D,P]=(0,h.O)(),[z,F]=(0,h.O)(),[L,V]=(0,h.O)(),[_,R]=(0,h.O)(),[H,B]=(0,h.O)(),[O,W]=(0,m.r)("accounts:favorites"),[q,Z]=(0,n.useState)({accounts:{}}),[U,J]=(0,n.useState)(""),[G,Y]=(0,n.useState)([]),[{sortBy:X,sortFromMax:K},ee]=(0,n.useState)(qs),se=(0,p.W)(),te=(0,x.N)(),ae=(0,g.q)(),ne=(0,n.useCallback)((e=>ee((({sortFromMax:s})=>({sortBy:e,sortFromMax:s})))),[]),oe=(0,n.useCallback)((()=>ee((({sortBy:e,sortFromMax:s})=>({sortBy:e,sortFromMax:!s})))),[]),re=(0,n.useRef)($.map((e=>({text:e,value:e})))),le=(0,n.useCallback)(((e,s)=>Z((({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"),transferable:a("transferable"),unbonding:a("unbonding")}}}))),[]),ce=(0,n.useMemo)((()=>C||!N&&"on"===f.X.get().storage),[C,N]),ue=(0,n.useMemo)((()=>Object.fromEntries(O.map((e=>[e,!0])))),[O]),me=(0,n.useMemo)((()=>(0,v.m)((o.tx.multisig||o.tx.utility)?.approveAsMulti)),[o]),pe=(0,n.useMemo)((()=>(0,v.m)(o.tx.proxy?.addProxy)),[o]),xe=(0,n.useMemo)((()=>w.map(((e,s)=>{const t=se&&se[s]?.isDelegating&&se[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:ue[e??""]??!1}})).filter((e=>!!e.account)).reduce(((e,s)=>(e[s.address]=s,e)),{})),[w,ue,se]),ge=(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")})]})]],chopsticks:[[(0,a.jsxs)(a.Fragment,{children:[t("chopsticks"),(0,a.jsx)("div",{className:"sub",children:t("local accounts added via chopsticks fork")})]})]],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]),be=(0,n.useMemo)((()=>function(e){const s={accounts:[],chopsticks:[],hardware:[],injected:[],multisig:[],proxied:[],qr:[],testing:[]};for(let t=0,a=e.length;tObject.values(xe).reduce(((e,{account:s,address:t,delegation:n,isFavorite:o},r)=>(e[t]=(0,a.jsx)(Ts,{account:s,delegation:n,filter:U,isFavorite:o,proxy:te?.[r],setBalance:le,toggleFavorite:W},t),e)),{})),[xe,U,te,le,W]),je=(0,n.useMemo)((()=>Zs.reduce(((e,s)=>{const t=be[s];return t.length&&(e[s]=t.map((e=>fe[e]))),e}),{})),[be,fe]);return(0,n.useEffect)((()=>{Y((e=>[...e.map((e=>xe[e.address])).filter((e=>!!e)),...Object.keys(xe).filter((s=>!e.find((e=>s===e.address)))).map((e=>xe[e]))]))}),[xe]),(0,n.useEffect)((()=>{Y((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,xe,q.accounts,X,K)))}),[xe,q,X,K]),(0,a.jsxs)(Us,{className:e,children:[A&&(0,a.jsx)(ie,{onClose:I,onStatusChange:s}),E&&(0,a.jsx)(de,{onClose:T,onStatusChange:s}),D&&(0,a.jsx)(Q,{onClose:P}),_&&(0,a.jsx)(he,{onClose:R,onStatusChange:s}),z&&(0,a.jsx)(we,{onClose:F,onStatusChange:s}),L&&(0,a.jsx)(Ae,{onClose:V,onStatusChange:s}),H&&(0,a.jsx)(Ee,{onClose:B,onStatusChange:s}),(0,a.jsx)(Bs,{}),(0,a.jsx)(Ps,{}),(0,a.jsx)(Ws,{balance:q.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:X,label:t("sort by"),onChange:ne,onClick:oe,options:re.current,sortDirection:K?"ascending":"descending"}),(0,a.jsx)(r.HS,{filterOn:U,label:t("filter by name or tags"),setFilter:J})]}),(0,a.jsxs)(r.zx.Group,{children:[ce&&(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:T})]}),(0,a.jsx)(r.zx,{icon:"qrcode",label:t("From Qr"),onClick:B}),S&&(0,a.jsx)(r.zx,{icon:"project-diagram",label:t("From Ledger"),onClick:P}),k&&(0,a.jsxs)(a.Fragment,{children:[me&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Multisig"),onClick:F}),pe&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Proxied"),onClick:V})]}),y&&(0,a.jsx)(r.zx,{icon:"plus",label:t("Local"),onClick:R})]})]}),ae&&G.length?Zs.map((e=>je[e]&&(0,a.jsx)(r.iA,{empty:t("No accounts"),header:ge[e],isSplit:!0,children:je[e]},e))):(0,a.jsx)(r.iA,{empty:ae&&G&&t("You don't have any accounts. Some features are currently hidden and will only become available once you have accounts."),header:ge.accounts})]})}));var Gs=t(61261),Ys=t(76116),Qs=t(22420);const Xs=r.zo.tr` text-align: center; &:hover { @@ -134,26 +134,26 @@ opacity: 0.45; text-align: center; } -`,tt=n.memo((function({className:e="",onStatusChange:s}){const{t}=M(),{api:o,isEthereum:i}=(0,u.h)(),l=(0,n.useRef)([]),c=(0,n.useRef)(!1),d=(0,ke.X)(),[h,m]=(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,k]=(0,n.useState)("ed25519"),[S,A]=(0,n.useState)(!0),E=(0,n.useCallback)((()=>m(null)),[]),I=(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(Qs.Z).slice(0,25),startAt:o}}))}),[d]),T=(0,n.useCallback)((()=>{if(!c.current)return I();(0,N.Y)((()=>{d.current&&(25===l.current.length&&I(),l.current.push((0,Gs.Z)({match:y,runs:10,ss58Format:o.registry.chainSS58||0,type:w,withCase:S,withHex:!0})),T())}))}),[I,o,y,d,c,w,S]),D=(0,n.useCallback)((e=>C({isMatchValid:Ys.Z.test(e)&&0!==e.length&&e.length<31,match:e})),[]),P=(0,n.useCallback)((e=>j((s=>({...s,matches:s.matches.filter((s=>s.address!==e))})))),[]),z=(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&&T()}),[T,x]);const F=(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)(st,{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:D,onEnter:z,value:y}),(0,a.jsx)(r.Lt,{className:"medium",isDisabled:x,label:t("case sensitive"),onChange:A,options:et,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:k,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:z})}),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:F,children:b.map((e=>(0,n.createElement)(Ks,{...e,key:e.address,onCreateToggle:m,onRemove:P})))})]}),h&&(0,a.jsx)(ie,{onClose:E,onStatusChange:s,seed:h,type:w})]})})),at=["vanity"],nt=n.memo((function({basePath:e,onStatusChange:s}){const{t}=M(),{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:at,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)(tt,{onStatusChange:s}),path:"vanity"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Js,{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:()=>A});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(81642),l=t(38894),c=t(54131),u=t(47623),d=t(90778),h=t(9118),m=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,h.W7)(!!g&&v&&o.derive.accounts.info,[g]),w=(0,n.useMemo)((()=>v&&l&&!!C?.accountId),[v,l,C]),k=(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=m.Nn.decodeAddress(e);s=m.Nn.encodeAddress(t),n=32===t.length}if(!t){const e=m.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]),N=(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();m.Nn.saveAddress(e,{genesisHash:m.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:k,onEnter:S,placeholder:t("new address"),value:f}),(0,a.jsx)(r.II,{className:"full",isError:!l,label:t("name"),onChange:N,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},k=n.memo((function({address:e,className:s="",filter:t,isFavorite:o,toggleFavorite:i}){const{t:c}=b(),u=(0,d.h)(),h=(0,j.Y)(e),p=(0,v.r)(e),[x,g]=(0,n.useState)([]),[f,k]=(0,n.useState)(""),[N,S]=(0,n.useState)(null),[A,E]=(0,n.useState)(null),[I,T]=(0,n.useState)(!1),[D,P]=(0,n.useState)(!1),[M,z]=(0,n.useState)(!0),[F,L]=(0,l.O)(!1),V=(0,n.useCallback)((e=>g(e.sort())),[]);(0,n.useEffect)((()=>{const s=m.Nn.getAddress(e);S(s||null),E(s?.meta.genesisHash||null)}),[]),(0,n.useEffect)((()=>{const{identity:e,nickname:s}=h||{};(0,y.m)(u.apiIdentity.query.identity?.identityOf)?e?.display&&k(e.display):s&&k(s)}),[u,h]),(0,n.useEffect)((()=>{const s=m.Nn.getAddress(e);V(s?.meta?.tags||[]),k(s?.meta?.name||"")}),[V,e]),(0,n.useEffect)((()=>{if(0===t.length)z(!0);else{const e=t.toLowerCase();z(x.reduce(((s,t)=>s||t.toLowerCase().includes(e)),f.toLowerCase().includes(e)))}}),[f,t,x]);const _=(0,n.useCallback)((s=>{E(s);const t=m.Nn.getAddress(e);t&&m.Nn.saveAddress(e,{...t.meta,genesisHash:s}),E(s)}),[e]),R=(0,n.useCallback)((()=>T(!I)),[I]),H=(0,n.useCallback)((()=>P(!D)),[D]),$=(0,n.useCallback)((()=>{if(e){const s={account:e,action:"forget"};try{m.Nn.forgetAddress(e),s.status="success",s.message=c("address forgotten")}catch(e){s.status="error",s.message=e.message}}}),[e,c]);if(!M)return null;const B=(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:A,onChange:_})]})]});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&&N&&(0,a.jsxs)(a.Fragment,{children:[I&&(0,a.jsx)(r.u5,{address:N.address,mode:"address",onClose:R,onForget:$},"modal-forget-account"),D&&(0,a.jsx)(r.Zd,{onClose:H,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?.transferAllowDeath)||(0,y.m)(u.api.tx.balances?.transfer))&&(0,a.jsx)(r.zx,{className:"send-button",icon:"paper-plane",label:c("send"),onClick:H},"send"),(0,a.jsx)(r.GI,{value:B})]})}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:F,toggle:L})]}),(0,a.jsxs)("tr",{className:`${s} isExpanded ${F?"":"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} ${F?"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",{})]})]})})),N=r.zo.div` +`,tt=n.memo((function({className:e="",onStatusChange:s}){const{t}=M(),{api:o,isEthereum:i}=(0,u.h)(),l=(0,n.useRef)([]),c=(0,n.useRef)(!1),d=(0,ke.X)(),[h,m]=(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,k]=(0,n.useState)("ed25519"),[S,A]=(0,n.useState)(!0),I=(0,n.useCallback)((()=>m(null)),[]),E=(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(Qs.Z).slice(0,25),startAt:o}}))}),[d]),T=(0,n.useCallback)((()=>{if(!c.current)return E();(0,N.Y)((()=>{d.current&&(25===l.current.length&&E(),l.current.push((0,Gs.Z)({match:y,runs:10,ss58Format:o.registry.chainSS58||0,type:w,withCase:S,withHex:!0})),T())}))}),[E,o,y,d,c,w,S]),D=(0,n.useCallback)((e=>C({isMatchValid:Ys.Z.test(e)&&0!==e.length&&e.length<31,match:e})),[]),P=(0,n.useCallback)((e=>j((s=>({...s,matches:s.matches.filter((s=>s.address!==e))})))),[]),z=(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&&T()}),[T,x]);const F=(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)(st,{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:D,onEnter:z,value:y}),(0,a.jsx)(r.Lt,{className:"medium",isDisabled:x,label:t("case sensitive"),onChange:A,options:et,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:k,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:z})}),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:F,children:b.map((e=>(0,n.createElement)(Ks,{...e,key:e.address,onCreateToggle:m,onRemove:P})))})]}),h&&(0,a.jsx)(ie,{onClose:I,onStatusChange:s,seed:h,type:w})]})})),at=["vanity"],nt=n.memo((function({basePath:e,onStatusChange:s}){const{t}=M(),{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:at,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)(tt,{onStatusChange:s}),path:"vanity"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Js,{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:()=>A});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(81642),l=t(38894),c=t(54131),u=t(47623),d=t(90778),h=t(9118),m=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,h.W7)(!!g&&v&&o.derive.accounts.info,[g]),w=(0,n.useMemo)((()=>v&&l&&!!C?.accountId),[v,l,C]),k=(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=m.Nn.decodeAddress(e);s=m.Nn.encodeAddress(t),n=32===t.length}if(!t){const e=m.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]),N=(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();m.Nn.saveAddress(e,{genesisHash:m.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:k,onEnter:S,placeholder:t("new address"),value:f}),(0,a.jsx)(r.II,{className:"full",isError:!l,label:t("name"),onChange:N,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},k=n.memo((function({address:e,className:s="",filter:t,isFavorite:o,toggleFavorite:i}){const{t:c}=b(),u=(0,d.h)(),h=(0,j.Y)(e),p=(0,v.r)(e),[x,g]=(0,n.useState)([]),[f,k]=(0,n.useState)(""),[N,S]=(0,n.useState)(null),[A,I]=(0,n.useState)(null),[E,T]=(0,n.useState)(!1),[D,P]=(0,n.useState)(!1),[M,z]=(0,n.useState)(!0),[F,L]=(0,l.O)(!1),V=(0,n.useCallback)((e=>g(e.sort())),[]);(0,n.useEffect)((()=>{const s=m.Nn.getAddress(e);S(s||null),I(s?.meta.genesisHash||null)}),[]),(0,n.useEffect)((()=>{const{identity:e,nickname:s}=h||{};(0,y.m)(u.apiIdentity.query.identity?.identityOf)?e?.display&&k(e.display):s&&k(s)}),[u,h]),(0,n.useEffect)((()=>{const s=m.Nn.getAddress(e);V(s?.meta?.tags||[]),k(s?.meta?.name||"")}),[V,e]),(0,n.useEffect)((()=>{if(0===t.length)z(!0);else{const e=t.toLowerCase();z(x.reduce(((s,t)=>s||t.toLowerCase().includes(e)),f.toLowerCase().includes(e)))}}),[f,t,x]);const _=(0,n.useCallback)((s=>{I(s);const t=m.Nn.getAddress(e);t&&m.Nn.saveAddress(e,{...t.meta,genesisHash:s}),I(s)}),[e]),R=(0,n.useCallback)((()=>T(!E)),[E]),$=(0,n.useCallback)((()=>P(!D)),[D]),H=(0,n.useCallback)((()=>{if(e){const s={account:e,action:"forget"};try{m.Nn.forgetAddress(e),s.status="success",s.message=c("address forgotten")}catch(e){s.status="error",s.message=e.message}}}),[e,c]);if(!M)return null;const B=(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:A,onChange:_})]})]});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&&N&&(0,a.jsxs)(a.Fragment,{children:[E&&(0,a.jsx)(r.u5,{address:N.address,mode:"address",onClose:R,onForget:H},"modal-forget-account"),D&&(0,a.jsx)(r.Zd,{onClose:$,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?.transferAllowDeath)||(0,y.m)(u.api.tx.balances?.transfer))&&(0,a.jsx)(r.zx,{className:"send-button",icon:"paper-plane",label:c("send"),onClick:$},"send"),(0,a.jsx)(r.GI,{value:B})]})}),(0,a.jsx)(r.iA.Column.Expand,{isExpanded:F,toggle:L})]}),(0,a.jsxs)("tr",{className:`${s} isExpanded ${F?"":"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} ${F?"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",{})]})]})})),N=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,h]=(0,l.O)(!1),[m,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:m.includes(e)}))).sort(((e,s)=>e.isFavorite===s.isFavorite?0:s.isFavorite?1:-1)))}),[o,m]),(0,a.jsxs)(N,{className:e,children:[d&&(0,a.jsx)(f,{onClose:h,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:h})})]}),(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)(k,{address:e,filter:j,isFavorite:s,toggleFavorite:p},e)))})]})})),A=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:()=>B});var a=t(52322),n=t(2784),o=t(73557),r=t(92858),i=t(48630),l=t(90778),c=t(9118),u=t(70563),d=t(61349);function h(){return(0,d.$G)("app-alliance")}var m=t(62837);const p=n.memo((function({className:e,value:{cid:{codec:s,hash_:{code:t},version:n},ipfs:o}}){const r=(0,m.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}=h(),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}=h(),{api:c}=(0,l.h)(),{allAccounts:u}=(0,f.x)(),[d,m]=(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:m,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}=h(),{api:d}=(0,l.h)(),{allAccounts:m}=(0,f.x)(),p=C(t),{queueExtrinsic:x}=(0,v.L)(),g=!!d.tx.alliance.giveRetirementNotice,b=(0,n.useMemo)((()=>m.includes(t)),[m,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 k=t(14681);const N=n.memo((function({className:e,members:s,rule:t}){const{t:n}=h(),o=(0,m.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,k.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}=h(),[u,d]=(0,g.O)(),m=(0,b.C)(),p=(0,n.useRef)([[c("members"),"start",3]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(N,{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:m,info:e,isPrime:t===e.accountId,isVoter:!!l&&l.includes(e.accountId)},e.accountId)))})]})})),A=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})})})})),E=n.memo((function({className:e,value:s}){return(0,a.jsx)("tr",{className:e,children:(0,a.jsx)("td",{className:"start all",children:s})})})),I=n.memo((function({className:e,unscrupulous:s}){const{t}=h(),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)(A,{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)(E,{value:e},e)))})]})}));var T=t(67292);function D(e){return{cid:e,ipfs:(0,T.c)(e),key:e.toHex()}}const P={transform:e=>e.map(D)},M=(0,y.e)("useAnnouncements",(function(){const{api:e}=(0,l.h)();return(0,c.W7)(e.query.alliance.announcements,[],P)})),z=["Retiring","Ally","Fellow"],F=(0,y.e)("useMembers",(function(){const{api:e}=(0,l.h)(),[s,t]=(0,n.useState)(),a=(0,c.W7)(e.query.alliance.members,[z[0]]),o=(0,c.W7)(e.query.alliance.members,[z[1]]),r=(0,c.W7)(e.query.alliance.members,[z[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})),L={transform:e=>e.isSome?{cid:D(e.unwrap()),hasRule:!0}:{cid:null,hasRule:!1}},V=(0,y.e)("useRule",(function(){const{api:e}=(0,l.h)();return(0,c.W7)(e.query.alliance.rule,[],L)}));function _(e){return e.map((e=>e.toString()))}const R={transform:e=>_(e)},H={transform:e=>_(e.filter((e=>e.isAscii)))},$=(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,[],H);return(0,n.useMemo)((()=>s&&t&&{accounts:s,websites:t}),[s,t])})),B=n.memo((function({basePath:e,className:s}){const{t}=h(),{api:d}=(0,l.h)(),m=(0,c.W7)(d.derive.alliance.proposalHashes),{isMember:p,members:g,prime:b}=(0,u.V)("alliance"),f=M(),j=F(),v=V(),y=$(),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:m?.length||0}})},{name:"announcements",text:t("Announcements ({{count}})",{replace:{count:f?.length||0}})},{name:"unscrupulous",text:t("Unscrupulous")}]),[f,m,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:m,type:"alliance"}),path:"motions"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(I,{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])}))},18760:(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:"ambassadorCollective",palletPoll:"ambassadorReferenda"})}))},80901:(e,s,t)=>{t.d(s,{Z:()=>n});var a=t(1398);const n=(0,t(11677).e)("useCounter",(function(){return(0,a.E)("ambassadorReferenda")}))},39559:(e,s,t)=>{t.d(s,{Z:()=>J});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(34814),l=t(95292),c=t(14681),u=t(61349);function d(){return(0,u.$G)("app-assets")}var h=t(58607),m=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,m.h)(),[h,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}),h&&(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:m}=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:m(s?.isTrue?"Yes":"No")}),(0,a.jsx)("td",{className:"start",children:n?n.isTrue?m("Yes"):m("No"):t?.toString()}),(0,a.jsx)("td",{className:"number all",children:(0,a.jsx)(h.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,m.h)(),{allAccounts:t}=(0,i.x)(),a=(0,n.useMemo)((()=>[t.map((s=>[e,s])).filter((e=>!!e[0]))]),[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` +`,S=n.memo((function({className:e="",onStatusChange:s}){const{t}=b(),{allAddresses:o}=(0,i.J)(),[d,h]=(0,l.O)(!1),[m,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:m.includes(e)}))).sort(((e,s)=>e.isFavorite===s.isFavorite?0:s.isFavorite?1:-1)))}),[o,m]),(0,a.jsxs)(N,{className:e,children:[d&&(0,a.jsx)(f,{onClose:h,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:h})})]}),(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)(k,{address:e,filter:j,isFavorite:s,toggleFavorite:p},e)))})]})})),A=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:()=>B});var a=t(52322),n=t(2784),o=t(73557),r=t(92858),i=t(48630),l=t(90778),c=t(9118),u=t(70563),d=t(61349);function h(){return(0,d.$G)("app-alliance")}var m=t(62837);const p=n.memo((function({className:e,value:{cid:{codec:s,hash_:{code:t},version:n},ipfs:o}}){const r=(0,m.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}=h(),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}=h(),{api:c}=(0,l.h)(),{allAccounts:u}=(0,f.x)(),[d,m]=(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:m,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}=h(),{api:d}=(0,l.h)(),{allAccounts:m}=(0,f.x)(),p=C(t),{queueExtrinsic:x}=(0,v.L)(),g=!!d.tx.alliance.giveRetirementNotice,b=(0,n.useMemo)((()=>m.includes(t)),[m,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 k=t(14681);const N=n.memo((function({className:e,members:s,rule:t}){const{t:n}=h(),o=(0,m.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,k.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}=h(),[u,d]=(0,g.O)(),m=(0,b.C)(),p=(0,n.useRef)([[c("members"),"start",3]]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(N,{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:m,info:e,isPrime:t===e.accountId,isVoter:!!l&&l.includes(e.accountId)},e.accountId)))})]})})),A=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})})})})),I=n.memo((function({className:e,value:s}){return(0,a.jsx)("tr",{className:e,children:(0,a.jsx)("td",{className:"start all",children:s})})})),E=n.memo((function({className:e,unscrupulous:s}){const{t}=h(),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)(A,{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)(I,{value:e},e)))})]})}));var T=t(67292);function D(e){return{cid:e,ipfs:(0,T.c)(e),key:e.toHex()}}const P={transform:e=>e.map(D)},M=(0,y.e)("useAnnouncements",(function(){const{api:e}=(0,l.h)();return(0,c.W7)(e.query.alliance.announcements,[],P)})),z=["Retiring","Ally","Fellow"],F=(0,y.e)("useMembers",(function(){const{api:e}=(0,l.h)(),[s,t]=(0,n.useState)(),a=(0,c.W7)(e.query.alliance.members,[z[0]]),o=(0,c.W7)(e.query.alliance.members,[z[1]]),r=(0,c.W7)(e.query.alliance.members,[z[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})),L={transform:e=>e.isSome?{cid:D(e.unwrap()),hasRule:!0}:{cid:null,hasRule:!1}},V=(0,y.e)("useRule",(function(){const{api:e}=(0,l.h)();return(0,c.W7)(e.query.alliance.rule,[],L)}));function _(e){return e.map((e=>e.toString()))}const R={transform:e=>_(e)},$={transform:e=>_(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,[],$);return(0,n.useMemo)((()=>s&&t&&{accounts:s,websites:t}),[s,t])})),B=n.memo((function({basePath:e,className:s}){const{t}=h(),{api:d}=(0,l.h)(),m=(0,c.W7)(d.derive.alliance.proposalHashes),{isMember:p,members:g,prime:b}=(0,u.V)("alliance"),f=M(),j=F(),v=V(),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:m?.length||0}})},{name:"announcements",text:t("Announcements ({{count}})",{replace:{count:f?.length||0}})},{name:"unscrupulous",text:t("Unscrupulous")}]),[f,m,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:m,type:"alliance"}),path:"motions"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(E,{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])}))},18760:(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:"ambassadorCollective",palletPoll:"ambassadorReferenda"})}))},80901:(e,s,t)=>{t.d(s,{Z:()=>n});var a=t(1398);const n=(0,t(11677).e)("useCounter",(function(){return(0,a.E)("ambassadorReferenda")}))},39559:(e,s,t)=>{t.d(s,{Z:()=>J});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(34814),l=t(95292),c=t(14681),u=t(61349);function d(){return(0,u.$G)("app-assets")}var h=t(58607),m=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,m.h)(),[h,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}),h&&(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:m}=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:m(s?.isTrue?"Yes":"No")}),(0,a.jsx)("td",{className:"start",children:n?n.isTrue?m("Yes"):m("No"):t?.toString()}),(0,a.jsx)("td",{className:"number all",children:(0,a.jsx)(h.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,m.h)(),{allAccounts:t}=(0,i.x)(),a=(0,n.useMemo)((()=>[t.map((s=>[e,s])).filter((e=>!!e[0]))]),[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),h=v(l?.id),m=Number.MAX_SAFE_INTEGER.toString().length,p=(0,n.useRef)([[t("accounts"),"start"],[t("frozen"),"start"],[t("sufficient"),"start"],[],[]]),x=(0,n.useMemo)((()=>s.filter((e=>!(!e.details||!e.metadata||e.details.supply.isZero()))).sort(((e,s)=>e.id.cmp(s.id)))),[s]),b=(0,n.useMemo)((()=>x.map((({id:e,metadata:s})=>({text:`${s.name.toUtf8()} (${(0,c.u)(e)})`,value:e.toString().lengthl?[l.metadata.decimals.toNumber(),l.metadata.symbol.toUtf8().toUpperCase()]:[0,"NONE"]),[l]),j=(0,n.useCallback)(((e,s)=>e.filter((e=>{const{text:t,value:a}=e;return parseInt(s)===a||t.includes(s)}))),[]);return(0,n.useEffect)((()=>{u((()=>o>=0?x.find((({id:e})=>e.toString()===o.toString()))??null:null))}),[x,o]),(0,a.jsx)(y,{className:e,children:(0,a.jsx)(r.iA,{empty:l&&h&&t("No accounts with balances found for the asset"),filter:b.length?(0,a.jsx)(r.Lt,{isFull:!0,label:t("the asset to query for balances"),onChange:i,onSearch:j,options:b,value:o}):void 0,header:p.current,children:l&&h?.map((({account:e,accountId:s})=>(0,a.jsx)(g,{account:e,accountId:s,assetId:l.id,minBalance:l.details.minBalance,siFormat:f},s)))})})}));var w=t(98551),k=t(79760);const N=n.memo((function({assetIds:e,className:s="",defaultValue:t,onChange:o,openId:i}){const{t:c}=d(),{api:u}=(0,m.h)(),[h]=(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,k]=(0,n.useState)((()=>t?.assetSymbol)),[N,S]=(0,n.useState)(),[A,E]=(0,n.useMemo)((()=>j&&w?[j.toNumber(),w.toUpperCase()]:[0,"NONE"]),[j,w]),I=(0,n.useMemo)((()=>!!j&&j.lten(20)),[j]),T=(0,n.useMemo)((()=>!!y&&y.length>=3&&y.length<=32),[y]),D=(0,n.useMemo)((()=>!!w&&w.length>=3&&w.length<=7),[w]),P=(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&&P&&T&&D&&I&&x&&N&&!N.isZero()?{accountId:x,assetDecimals:j,assetId:b,assetName:y,assetSymbol:w,minBalance:N}:null)}),[u,x,j,b,e,y,w,P,T,D,I,N,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:h?.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:h?.assetName,isError:!T,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:h?.assetSymbol,isError:!D,label:c("asset symbol"),onChange:k})}),(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:h?.assetDecimals,isError:!I,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:h?.minBalance,isZeroable:!1,label:c("minimum balance"),onChange:S,siDecimals:A,siSymbol:E})}),(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:h?.assetId||p,isError:!P,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,m.h)(),[c]=(0,n.useState)((()=>t)),[u,h]=(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:h,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"})})]})})),A={type:"all"},E=n.memo((function({assetIds:e,className:s,onClose:t,openId:o}){const{t:i}=d(),{api:l}=(0,m.h)(),[c,u,h]=(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,k.b)(y,A);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)(N,{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:h}),(0,a.jsx)(r.cA,{accountId:p?.accountId,extrinsic:C,icon:"plus",label:i("Create"),onStart:t})]})]})]})})),I=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)(E,{assetIds:e,className:s,onClose:c,openId:t})]})})),T=n.memo((function({className:e,details:{issuer:s,minBalance:t},id:o,metadata:i,onClose:l}){const{t:c}=d(),{api:u}=(0,m.h)(),[h,p]=(0,n.useState)(),[x,g]=(0,n.useState)(null),b=(0,n.useMemo)((()=>h&&h.gte(t)),[h,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,h],tx:u.tx.assets.mint})})]})})),D=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)(T,{className:e,details:s,id:t,metadata:n,onClose:l})]})})),P=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)(h.Z,{format:l,value:s.supply})}),(0,a.jsx)("td",{className:"button",children:s&&i&&o&&(0,a.jsx)(D,{details:s,id:t,metadata:i})})]})})),M=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)(P,{value:e},e.key)))})})),z=(0,r.zo)(r.lm)` +`,C=n.memo((function({className:e,infos:s=[]}){const{t}=d(),[o,i]=(0,n.useState)(0),[l,u]=(0,n.useState)(null),h=v(l?.id),m=Number.MAX_SAFE_INTEGER.toString().length,p=(0,n.useRef)([[t("accounts"),"start"],[t("frozen"),"start"],[t("sufficient"),"start"],[],[]]),x=(0,n.useMemo)((()=>s.filter((e=>!(!e.details||!e.metadata||e.details.supply.isZero()))).sort(((e,s)=>e.id.cmp(s.id)))),[s]),b=(0,n.useMemo)((()=>x.map((({id:e,metadata:s})=>({text:`${s.name.toUtf8()} (${(0,c.u)(e)})`,value:e.toString().lengthl?[l.metadata.decimals.toNumber(),l.metadata.symbol.toUtf8().toUpperCase()]:[0,"NONE"]),[l]),j=(0,n.useCallback)(((e,s)=>e.filter((e=>{const{text:t,value:a}=e;return parseInt(s)===a||t.includes(s)}))),[]);return(0,n.useEffect)((()=>{u((()=>o>=0?x.find((({id:e})=>e.toString()===o.toString()))??null:null))}),[x,o]),(0,a.jsx)(y,{className:e,children:(0,a.jsx)(r.iA,{empty:l&&h&&t("No accounts with balances found for the asset"),filter:b.length?(0,a.jsx)(r.Lt,{isFull:!0,label:t("the asset to query for balances"),onChange:i,onSearch:j,options:b,value:o}):void 0,header:p.current,children:l&&h?.map((({account:e,accountId:s})=>(0,a.jsx)(g,{account:e,accountId:s,assetId:l.id,minBalance:l.details.minBalance,siFormat:f},s)))})})}));var w=t(98551),k=t(79760);const N=n.memo((function({assetIds:e,className:s="",defaultValue:t,onChange:o,openId:i}){const{t:c}=d(),{api:u}=(0,m.h)(),[h]=(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,k]=(0,n.useState)((()=>t?.assetSymbol)),[N,S]=(0,n.useState)(),[A,I]=(0,n.useMemo)((()=>j&&w?[j.toNumber(),w.toUpperCase()]:[0,"NONE"]),[j,w]),E=(0,n.useMemo)((()=>!!j&&j.lten(20)),[j]),T=(0,n.useMemo)((()=>!!y&&y.length>=3&&y.length<=32),[y]),D=(0,n.useMemo)((()=>!!w&&w.length>=3&&w.length<=7),[w]),P=(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&&P&&T&&D&&E&&x&&N&&!N.isZero()?{accountId:x,assetDecimals:j,assetId:b,assetName:y,assetSymbol:w,minBalance:N}:null)}),[u,x,j,b,e,y,w,P,T,D,E,N,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:h?.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:h?.assetName,isError:!T,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:h?.assetSymbol,isError:!D,label:c("asset symbol"),onChange:k})}),(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:h?.assetDecimals,isError:!E,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:h?.minBalance,isZeroable:!1,label:c("minimum balance"),onChange:S,siDecimals:A,siSymbol:I})}),(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:h?.assetId||p,isError:!P,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,m.h)(),[c]=(0,n.useState)((()=>t)),[u,h]=(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:h,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"})})]})})),A={type:"all"},I=n.memo((function({assetIds:e,className:s,onClose:t,openId:o}){const{t:i}=d(),{api:l}=(0,m.h)(),[c,u,h]=(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,k.b)(y,A);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)(N,{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:h}),(0,a.jsx)(r.cA,{accountId:p?.accountId,extrinsic:C,icon:"plus",label:i("Create"),onStart:t})]})]})]})})),E=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)(I,{assetIds:e,className:s,onClose:c,openId:t})]})})),T=n.memo((function({className:e,details:{issuer:s,minBalance:t},id:o,metadata:i,onClose:l}){const{t:c}=d(),{api:u}=(0,m.h)(),[h,p]=(0,n.useState)(),[x,g]=(0,n.useState)(null),b=(0,n.useMemo)((()=>h&&h.gte(t)),[h,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,h],tx:u.tx.assets.mint})})]})})),D=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)(T,{className:e,details:s,id:t,metadata:n,onClose:l})]})})),P=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)(h.Z,{format:l,value:s.supply})}),(0,a.jsx)("td",{className:"button",children:s&&i&&o&&(0,a.jsx)(D,{details:s,id:t,metadata:i})})]})})),M=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)(P,{value:e},e.key)))})})),z=(0,r.zo)(r.lm)` .asset--query { width: 20em; } -`,F=n.memo((function({className:e="",onQuery:s}){const{t}=d(),[o,i]=(0,n.useState)(""),l=(0,n.useCallback)((e=>i(e)),[]),c=(0,n.useCallback)((()=>{s&&s(o)}),[o,s]);return(0,a.jsx)(z,{className:`${e} ui--FilterOverlay hasOwnMaxWidth`,children:(0,a.jsx)(r.II,{className:"asset--query",onChange:l,onEnter:c,placeholder:t("asset id or name to query"),withLabel:!1,children:(0,a.jsx)(r.zx,{icon:"play",onClick:c})})})})),L=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:o}){const[i,l]=(0,n.useState)(""),c=i?t?.filter((({key:e,metadata:s})=>e===i||s?.name.toUtf8().includes(i))):t;return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(L,{numAssets:s?.length}),(0,a.jsx)(F,{onQuery:l}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(I,{assetIds:s,openId:o})}),(0,a.jsx)(M,{infos:c})]})}));var _=t(12298),R=t(39824);const H=[],$={transform:e=>e.map((({args:[e]})=>e))};function B(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 O=(0,f.e)("useAssetIds",(function(){const{api:e}=(0,m.h)(),s=(0,_.k)(e.query.assets.asset,H,$);return(0,R.N)([e.events.assets.Created,e.events.assets.Destroyed,e.events.assets.ForceCreated],B,s)})),q={isAdminMe:!1,isFreezerMe:!1,isIssuerMe:!1,isOwnerMe:!1},W={withParams:!0};function Z(e,s){const t=s.toString();return e.some((e=>e===t))}const U=(0,f.e)("useAssetInfos",(function(e){const{api:s}=(0,m.h)(),{allAccounts:t}=(0,i.x)(),a=(0,b.W7)(s.query.assets.metadata.multi,[e],W),o=(0,b.W7)(s.query.assets.asset.multi,[e],W),[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:Z(e,n.admin),isFreezerMe:Z(e,n.freezer),isIssuerMe:Z(e,n.issuer),isOwnerMe:Z(e,n.owner)}:q,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})),J=n.memo((function({basePath:e,className:s}){const{t}=d(),{hasAccounts:c}=(0,i.x)(),u=O(),h=U(u),m=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")},{name:"balances",text:t("Balances")}]),p=(0,n.useMemo)((()=>c&&h&&h.some((({details:e,metadata:s})=>!(!e||!s)))?[]:["balances"]),[c,h]),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: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:h}),path:"balances"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(V,{ids:u,infos:h,openId:x}),index:!0})]})})]})}))},95039:(e,s,t)=>{t.d(s,{Z:()=>ve});var a=t(52322),n=t(2784),o=t(48630),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 h=t(38894),m=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,h.O)(),[m,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,m],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:m}=d(),[p,x]=(0,h.O)(),b=(0,n.useMemo)((()=>{return e=m,t.mul(e).div(u.uy);var e}),[t,m]);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 k=t(30943),N=t(81190),S=t(48801),A=t.n(S);const E=["approveBounty","closeBounty"],I=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"),m=(0,N.m)("council"),{approveBounty:p,closeBounty:x}=d(),[b,j]=(0,h.O)(),[y,C]=(0,n.useState)(null),[w,S]=(0,n.useState)();(0,n.useEffect)((()=>{u&&S(new(A())(Math.ceil(u.length*(0,k.mo)(l))))}),[l,u]);const I=(0,n.useRef)(p(s)),T=(0,n.useRef)(x(s)),D=(0,n.useMemo)((()=>0!==t?.filter((({proposal:e})=>e&&E.includes(e.method))).length),[t]);return c&&!D&&m?(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,I.current,I.current.length],tx:l.tx[m].propose}),(0,a.jsx)(o.cA,{accountId:y,icon:"ban",isDisabled:!1,label:i("Reject"),onStart:j,params:[w,T.current,T.current.length],tx:l.tx[m].propose})]})]})]}):null})),T=["proposeCurator"],D=n.memo((function({description:e,index:s,proposals:t,value:i}){const{t:l}=f(),{api:c}=(0,r.h)(),{isMember:u,members:m}=(0,v.V)("council"),p=(0,N.m)("council"),{proposeCurator:x}=d(),[b,j]=(0,h.O)(),[y,C]=(0,n.useState)(null),[w,S]=(0,n.useState)(null),[E,I]=(0,n.useState)(),[D,P]=(0,n.useState)(),[M,z]=(0,n.useState)(!1);(0,n.useEffect)((()=>{m&&I(new(A())(Math.ceil(m.length*(0,k.mo)(c))))}),[c,m]);const F=(0,n.useMemo)((()=>w&&x(s,w,D)),[w,D,s,x]),L=(0,n.useMemo)((()=>0!==t?.filter((({proposal:e})=>e&&T.includes(e.method))).length),[t]);return(0,n.useEffect)((()=>{z(!!D&&!!i?.gt(D))}),[i,D]),u&&!L&&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:m,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:!M,isZeroable:!0,label:l("curator's fee"),onChange:P,value:D}),!M&&(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:!M,label:l("Propose curator"),onStart:j,params:[E,F,F?.length],tx:c.tx[p].propose})})]})]}):null}));function P({bestNumber:e,description:s,fee:t,index:o,proposals:r,status:i,value:l}){const{beneficiary:c,curator:u,unlockAt:d}=p(i),h=(0,n.useMemo)((()=>d?.sub(e)),[e,d]);return(0,a.jsxs)(a.Fragment,{children:[i.isProposed&&(0,a.jsx)(I,{description:s,index:o,proposals:r}),i.isFunded&&(0,a.jsx)(D,{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&&h&&(0,a.jsx)(w,{beneficiaryId:c,index:o,payoutDue:h}),i.isActive&&u&&(0,a.jsx)(j,{curatorId:u,description:s,index:o})]})}const M=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})})]})})),z=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,N.m)("council"),{closeBounty:h}=d(),[m,p]=(0,n.useState)(null),[x,b]=(0,n.useState)();(0,n.useEffect)((()=>{c&&b(new(A())(Math.ceil(c.length*(0,k.mo)(l))))}),[l,c]);const j=(0,n.useRef)(h(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:m,icon:"ban",isDisabled:!1,label:i("Close Bounty"),onStart:t,params:[x,j.current,j.current.length],tx:l.tx[u].propose})})]}):null}));var F=t(97794);const L=n.memo((function({curatorId:e,description:s,index:t,toggleOpen:r}){const{t:i}=f(),{bountyUpdatePeriod:l,extendBountyExpiry:c}=d(),[u,h]=(0,n.useState)(""),[m,p]=(0,F.h)(l),x=(0,n.useCallback)((e=>{h(e)}),[]),b=(0,n.useMemo)((()=>l&&function(e,s){return new Date(Date.now()+e.muln(s).toNumber())}(l,m)),[l,m]);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})})]})})})),V=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})})]})})),_=n.memo((function({action:e,curatorId:s,description:t,index:i,toggleOpen:l}){const{t:c}=f(),{api:u}=(0,r.h)(),{members:h}=(0,v.V)("council"),m=(0,N.m)("council"),{unassignCurator:p}=d(),[b,j]=(0,n.useState)(null),[y,C]=(0,n.useState)(),{allAccounts:w}=(0,x.x)();(0,n.useEffect)((()=>{h&&C(new(A())(Math.ceil(h.length*(0,k.mo)(u))))}),[u,h]);const S=(0,n.useMemo)((()=>p(i)),[i,p]),E=(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:h,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:m&&u.tx[m].propose},UnassignCurator:{filter:h,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:m&&u.tx[m].propose}})),[c,i,p,u,w,m,h,y,S]),{filter:I,params:T,proposingAccountTip:D,tip:P,title:M,tx:z}=E[e];return z?(0,a.jsxs)(o.u_,{header:`${M} - "${g(t,30)}"`,onClose:l,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:D,children:(0,a.jsx)(o.rp,{filter:I,label:c("proposing account"),onChange:j,type:"account",withLabel:!0})}),(0,a.jsx)(o.u_.Columns,{hint:P,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:T,tx:z})})]}):null})),R=n.memo((function({bestNumber:e,className:s,description:t,index:r,proposals:i,status:l}){const[c,d]=(0,h.O)(),[m,x]=(0,h.O)(),[g,b]=(0,h.O)(),[j,C]=(0,h.O)(),[w,k]=(0,h.O)(),[N,S]=(0,n.useState)(),{t:A}=f(),{isMember:E}=(0,v.V)("council"),{curator:I,updateDue:T}=p(l),{isCurator:D,roles:P}=y(I),F=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}(P,l,(0,n.useMemo)((()=>T?.sub(e)),[e,T])),R=(0,n.useRef)({SlashCuratorAction:A("Slash curator"),SlashCuratorMotion:A("Slash curator (Council)"),UnassignCurator:A("Unassign curator")}),H=(0,n.useMemo)((()=>i?.find((({proposal:e})=>e&&"closeBounty"===e.method))),[i]),$=(0,n.useMemo)((()=>i?.find((({proposal:e})=>e&&"unassignCurator"===e.method))),[i]),B=(l.isFunded||l.isActive||l.isCuratorProposed)&&E&&!H,O=l.isCuratorProposed&&D,q=l.isActive&&D,W=l.isActive&&D,Z=(l.isCuratorProposed||l.isActive||l.isPendingPayout)&&!$&&0!==F.length,U=!(B||O||W||Z||q),J=(0,n.useCallback)((e=>()=>{S(e),b()}),[b]);return U?null:(0,a.jsxs)("div",{className:s,children:[c&&(0,a.jsx)(z,{description:t,index:r,toggleOpen:d}),m&&I&&(0,a.jsx)(M,{curatorId:I,description:t,index:r,toggleOpen:x}),j&&I&&(0,a.jsx)(L,{curatorId:I,description:t,index:r,toggleOpen:C}),w&&I&&(0,a.jsx)(V,{curatorId:I,description:t,index:r,toggleOpen:k}),g&&I&&N&&(0,a.jsx)(_,{action:N,curatorId:I,description:t,index:r,toggleOpen:b}),(0,a.jsx)(o.GI,{value:(0,a.jsxs)(o.v2,{className:"settings-menu",children:[B&&(0,a.jsx)(o.v2.Item,{label:A("Close"),onClick:d},"closeBounty"),O&&(0,a.jsx)(o.v2.Item,{label:A("Reject curator"),onClick:x},"rejectCurator"),W&&(0,a.jsx)(o.v2.Item,{label:A("Extend expiry"),onClick:C},"extendExpiry"),q&&(0,a.jsx)(o.v2.Item,{label:A("Give up"),onClick:k},"giveUpCurator"),Z&&F.map((e=>(0,a.jsx)(o.v2.Item,{label:R.current[e],onClick:J(e)},e)))]})})]})})),H=o.zo.div` +`,F=n.memo((function({className:e="",onQuery:s}){const{t}=d(),[o,i]=(0,n.useState)(""),l=(0,n.useCallback)((e=>i(e)),[]),c=(0,n.useCallback)((()=>{s&&s(o)}),[o,s]);return(0,a.jsx)(z,{className:`${e} ui--FilterOverlay hasOwnMaxWidth`,children:(0,a.jsx)(r.II,{className:"asset--query",onChange:l,onEnter:c,placeholder:t("asset id or name to query"),withLabel:!1,children:(0,a.jsx)(r.zx,{icon:"play",onClick:c})})})})),L=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:o}){const[i,l]=(0,n.useState)(""),c=i?t?.filter((({key:e,metadata:s})=>e===i||s?.name.toUtf8().includes(i))):t;return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(L,{numAssets:s?.length}),(0,a.jsx)(F,{onQuery:l}),(0,a.jsx)(r.zx.Group,{children:(0,a.jsx)(E,{assetIds:s,openId:o})}),(0,a.jsx)(M,{infos:c})]})}));var _=t(12298),R=t(39824);const $=[],H={transform:e=>e.map((({args:[e]})=>e))};function B(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 O=(0,f.e)("useAssetIds",(function(){const{api:e}=(0,m.h)(),s=(0,_.k)(e.query.assets.asset,$,H);return(0,R.N)([e.events.assets.Created,e.events.assets.Destroyed,e.events.assets.ForceCreated],B,s)})),W={isAdminMe:!1,isFreezerMe:!1,isIssuerMe:!1,isOwnerMe:!1},q={withParams:!0};function Z(e,s){const t=s.toString();return e.some((e=>e===t))}const U=(0,f.e)("useAssetInfos",(function(e){const{api:s}=(0,m.h)(),{allAccounts:t}=(0,i.x)(),a=(0,b.W7)(s.query.assets.metadata.multi,[e],q),o=(0,b.W7)(s.query.assets.asset.multi,[e],q),[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:Z(e,n.admin),isFreezerMe:Z(e,n.freezer),isIssuerMe:Z(e,n.issuer),isOwnerMe:Z(e,n.owner)}:W,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})),J=n.memo((function({basePath:e,className:s}){const{t}=d(),{hasAccounts:c}=(0,i.x)(),u=O(),h=U(u),m=(0,n.useRef)([{isRoot:!0,name:"overview",text:t("Overview")},{name:"balances",text:t("Balances")}]),p=(0,n.useMemo)((()=>c&&h&&h.some((({details:e,metadata:s})=>!(!e||!s)))?[]:["balances"]),[c,h]),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: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:h}),path:"balances"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(V,{ids:u,infos:h,openId:x}),index:!0})]})})]})}))},95039:(e,s,t)=>{t.d(s,{Z:()=>ve});var a=t(52322),n=t(2784),o=t(48630),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 h=t(38894),m=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,h.O)(),[m,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,m],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:m}=d(),[p,x]=(0,h.O)(),b=(0,n.useMemo)((()=>{return e=m,t.mul(e).div(u.uy);var e}),[t,m]);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 k=t(30943),N=t(81190),S=t(48801),A=t.n(S);const I=["approveBounty","closeBounty"],E=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"),m=(0,N.m)("council"),{approveBounty:p,closeBounty:x}=d(),[b,j]=(0,h.O)(),[y,C]=(0,n.useState)(null),[w,S]=(0,n.useState)();(0,n.useEffect)((()=>{u&&S(new(A())(Math.ceil(u.length*(0,k.mo)(l))))}),[l,u]);const E=(0,n.useRef)(p(s)),T=(0,n.useRef)(x(s)),D=(0,n.useMemo)((()=>0!==t?.filter((({proposal:e})=>e&&I.includes(e.method))).length),[t]);return c&&!D&&m?(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,E.current,E.current.length],tx:l.tx[m].propose}),(0,a.jsx)(o.cA,{accountId:y,icon:"ban",isDisabled:!1,label:i("Reject"),onStart:j,params:[w,T.current,T.current.length],tx:l.tx[m].propose})]})]})]}):null})),T=["proposeCurator"],D=n.memo((function({description:e,index:s,proposals:t,value:i}){const{t:l}=f(),{api:c}=(0,r.h)(),{isMember:u,members:m}=(0,v.V)("council"),p=(0,N.m)("council"),{proposeCurator:x}=d(),[b,j]=(0,h.O)(),[y,C]=(0,n.useState)(null),[w,S]=(0,n.useState)(null),[I,E]=(0,n.useState)(),[D,P]=(0,n.useState)(),[M,z]=(0,n.useState)(!1);(0,n.useEffect)((()=>{m&&E(new(A())(Math.ceil(m.length*(0,k.mo)(c))))}),[c,m]);const F=(0,n.useMemo)((()=>w&&x(s,w,D)),[w,D,s,x]),L=(0,n.useMemo)((()=>0!==t?.filter((({proposal:e})=>e&&T.includes(e.method))).length),[t]);return(0,n.useEffect)((()=>{z(!!D&&!!i?.gt(D))}),[i,D]),u&&!L&&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:m,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:!M,isZeroable:!0,label:l("curator's fee"),onChange:P,value:D}),!M&&(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:!M,label:l("Propose curator"),onStart:j,params:[I,F,F?.length],tx:c.tx[p].propose})})]})]}):null}));function P({bestNumber:e,description:s,fee:t,index:o,proposals:r,status:i,value:l}){const{beneficiary:c,curator:u,unlockAt:d}=p(i),h=(0,n.useMemo)((()=>d?.sub(e)),[e,d]);return(0,a.jsxs)(a.Fragment,{children:[i.isProposed&&(0,a.jsx)(E,{description:s,index:o,proposals:r}),i.isFunded&&(0,a.jsx)(D,{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&&h&&(0,a.jsx)(w,{beneficiaryId:c,index:o,payoutDue:h}),i.isActive&&u&&(0,a.jsx)(j,{curatorId:u,description:s,index:o})]})}const M=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})})]})})),z=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,N.m)("council"),{closeBounty:h}=d(),[m,p]=(0,n.useState)(null),[x,b]=(0,n.useState)();(0,n.useEffect)((()=>{c&&b(new(A())(Math.ceil(c.length*(0,k.mo)(l))))}),[l,c]);const j=(0,n.useRef)(h(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:m,icon:"ban",isDisabled:!1,label:i("Close Bounty"),onStart:t,params:[x,j.current,j.current.length],tx:l.tx[u].propose})})]}):null}));var F=t(97794);const L=n.memo((function({curatorId:e,description:s,index:t,toggleOpen:r}){const{t:i}=f(),{bountyUpdatePeriod:l,extendBountyExpiry:c}=d(),[u,h]=(0,n.useState)(""),[m,p]=(0,F.h)(l),x=(0,n.useCallback)((e=>{h(e)}),[]),b=(0,n.useMemo)((()=>l&&function(e,s){return new Date(Date.now()+e.muln(s).toNumber())}(l,m)),[l,m]);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})})]})})})),V=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})})]})})),_=n.memo((function({action:e,curatorId:s,description:t,index:i,toggleOpen:l}){const{t:c}=f(),{api:u}=(0,r.h)(),{members:h}=(0,v.V)("council"),m=(0,N.m)("council"),{unassignCurator:p}=d(),[b,j]=(0,n.useState)(null),[y,C]=(0,n.useState)(),{allAccounts:w}=(0,x.x)();(0,n.useEffect)((()=>{h&&C(new(A())(Math.ceil(h.length*(0,k.mo)(u))))}),[u,h]);const S=(0,n.useMemo)((()=>p(i)),[i,p]),I=(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:h,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:m&&u.tx[m].propose},UnassignCurator:{filter:h,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:m&&u.tx[m].propose}})),[c,i,p,u,w,m,h,y,S]),{filter:E,params:T,proposingAccountTip:D,tip:P,title:M,tx:z}=I[e];return z?(0,a.jsxs)(o.u_,{header:`${M} - "${g(t,30)}"`,onClose:l,size:"large",children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.u_.Columns,{hint:D,children:(0,a.jsx)(o.rp,{filter:E,label:c("proposing account"),onChange:j,type:"account",withLabel:!0})}),(0,a.jsx)(o.u_.Columns,{hint:P,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:T,tx:z})})]}):null})),R=n.memo((function({bestNumber:e,className:s,description:t,index:r,proposals:i,status:l}){const[c,d]=(0,h.O)(),[m,x]=(0,h.O)(),[g,b]=(0,h.O)(),[j,C]=(0,h.O)(),[w,k]=(0,h.O)(),[N,S]=(0,n.useState)(),{t:A}=f(),{isMember:I}=(0,v.V)("council"),{curator:E,updateDue:T}=p(l),{isCurator:D,roles:P}=y(E),F=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}(P,l,(0,n.useMemo)((()=>T?.sub(e)),[e,T])),R=(0,n.useRef)({SlashCuratorAction:A("Slash curator"),SlashCuratorMotion:A("Slash curator (Council)"),UnassignCurator:A("Unassign curator")}),$=(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]),B=(l.isFunded||l.isActive||l.isCuratorProposed)&&I&&!$,O=l.isCuratorProposed&&D,W=l.isActive&&D,q=l.isActive&&D,Z=(l.isCuratorProposed||l.isActive||l.isPendingPayout)&&!H&&0!==F.length,U=!(B||O||q||Z||W),J=(0,n.useCallback)((e=>()=>{S(e),b()}),[b]);return U?null:(0,a.jsxs)("div",{className:s,children:[c&&(0,a.jsx)(z,{description:t,index:r,toggleOpen:d}),m&&E&&(0,a.jsx)(M,{curatorId:E,description:t,index:r,toggleOpen:x}),j&&E&&(0,a.jsx)(L,{curatorId:E,description:t,index:r,toggleOpen:C}),w&&E&&(0,a.jsx)(V,{curatorId:E,description:t,index:r,toggleOpen:k}),g&&E&&N&&(0,a.jsx)(_,{action:N,curatorId:E,description:t,index:r,toggleOpen:b}),(0,a.jsx)(o.GI,{value:(0,a.jsxs)(o.v2,{className:"settings-menu",children:[B&&(0,a.jsx)(o.v2.Item,{label:A("Close"),onClick:d},"closeBounty"),O&&(0,a.jsx)(o.v2.Item,{label:A("Reject curator"),onClick:x},"rejectCurator"),q&&(0,a.jsx)(o.v2.Item,{label:A("Extend expiry"),onClick:C},"extendExpiry"),W&&(0,a.jsx)(o.v2.Item,{label:A("Give up"),onClick:k},"giveUpCurator"),Z&&F.map((e=>(0,a.jsx)(o.v2.Item,{label:R.current[e],onClick:J(e)},e)))]})})]})})),$=o.zo.div` margin-top: 0.28rem; font-size: var(--font-size-tiny); line-height: 0.85rem; color: var(--color-label); -`,$=n.memo((function({className:e="",dataTestId:s="",description:t}){return(0,a.jsx)(H,{className:e,"data-testid":s,children:t})})),B={Active:["closeBounty","unassignCurator"],Approved:[],CuratorProposed:["closeBounty","unassignCurator"],Funded:["proposeCurator","closeBounty"],PendingPayout:["unassignCurator"],Proposed:["approveBounty","closeBounty"]};function O(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 B[e.type]}(s).find((e=>t.includes(e)))}(e,s))??null}const q=o.zo.div` +`,H=n.memo((function({className:e="",dataTestId:s="",description:t}){return(0,a.jsx)($,{className:e,"data-testid":s,children:t})})),B={Active:["closeBounty","unassignCurator"],Approved:[],CuratorProposed:["closeBounty","unassignCurator"],Funded:["proposeCurator","closeBounty"],PendingPayout:["unassignCurator"],Proposed:["approveBounty","closeBounty"]};function O(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 B[e.type]}(s).find((e=>t.includes(e)))}(e,s))??null}const W=o.zo.div` margin-left: 0.2rem; -`,W=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)(q,{className:e,"data-testid":"voting-description",children:r&&l.current[r]&&(0,a.jsx)(o.ob,{help:l.current[r]})})})),Z=o.zo.a` +`,q=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)(W,{className:e,"data-testid":"voting-description",children:r&&l.current[r]&&(0,a.jsx)(o.ob,{help:l.current[r]})})})),Z=o.zo.a` line-height: 0.85rem; font-size: var(--font-size-tiny); text-decoration: underline; @@ -175,7 +175,7 @@ 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)(W,{proposal:s,status:t})]})]})})})),Y=n.memo((function({beneficiary:e,proposals:s,status:t}){const{t:r}=f(),i=(0,n.useMemo)((()=>s&&O(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)($,{description:r("Beneficiary")})]})]})})),Q=o.zo.div` +`,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)(q,{proposal:s,status:t})]})]})})})),Y=n.memo((function({beneficiary:e,proposals:s,status:t}){const{t:r}=f(),i=(0,n.useMemo)((()=>s&&O(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); @@ -199,7 +199,7 @@ `,X=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})]})})),K=new(A())("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),h=c??K;return(0,a.jsxs)("div",{children:[s?.lte(u.nw)&&(0,a.jsx)(X,{description:o("Update overdue"),type:"warning"}),s?.lt(h)&&s?.gt(u.nw)&&(0,a.jsx)(X,{description:o("Close deadline"),type:"warning"}),t.isApproved&&(0,a.jsx)(X,{description:o("Waiting for Bounty Funding"),type:"info"}),t.isCuratorProposed&&(0,a.jsx)(X,{description:o("Waiting for Curator's acceptance"),type:"info"}),l?.lt(u.nw)&&(0,a.jsx)(X,{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)($,{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` +`,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 { @@ -288,7 +288,7 @@ 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,h.O)(!1),{bond:x,curatorDeposit:g,fee:b,proposer:j,status:v,value:y}=s,{beneficiary:C,bountyStatus:w,curator:k,unlockAt:N,updateDue:S}=p(v),A=(0,n.useMemo)((()=>S?.sub(e)),[e,S]),E=(0,n.useMemo)((()=>N?.sub(e)),[e,N]),I=(0,n.useMemo)((()=>{if(k)return{curator:k,isFromProposal:!1};const e=l&&O(l,v);return"proposeCurator"===e?.proposal?.method?{curator:e.proposal.args[1],isFromProposal:!0}:null}),[k,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:I&&(0,a.jsx)(ae,{curator:I.curator,isFromProposal:I.isFromProposal})}),(0,a.jsxs)("td",{children:[E&&N&&(0,a.jsx)(re,{dueBlocks:E,endBlock:N,label:c("payout")}),A&&S&&(0,a.jsx)(re,{dueBlocks:A,endBlock:S,label:c("update")}),(0,a.jsx)(ee,{bestNumber:e,blocksUntilUpdate:A,status:v}),(0,a.jsx)(P,{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)(m.Z,{value:x})})]}),k&&(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)(m.Z,{value:b})})]}),(0,a.jsx)("div",{className:"column",children:k&&!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)(m.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 he(e){return new Blob([e]).size}const me=(0,c.e)("useBalance",(function(e){const{api:s}=(0,r.h)(),t=(0,i.W7)(s.derive.balances?.all,[e]);return t?.transferable||t?.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),m=me(c),[p,x]=(0,n.useState)(""),[g,b]=(0,n.useState)(s),[j,v]=(0,n.useState)(pe),[y,C]=(0,h.O)(),[w,k]=(0,n.useState)(!1),[N,S]=(0,n.useState)(!1),[A,E]=(0,n.useState)(!1);(0,n.useEffect)((()=>{k(p?.length>=1&&he(p)<=i)}),[i,p]),(0,n.useEffect)((()=>{S(!!j?.gte(t))}),[t,j]),(0,n.useEffect)((()=>{E(!!m?.gte(g))}),[m,g]);const I=A&&w&&N,T=(0,n.useCallback)((e=>{var t,a;x(e),b((t=e,a=r,s.add(a.muln(he(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:T,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:!N,isZeroable:!0,label:e("bounty requested allocation"),onChange:v,value:j}),!N&&!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:!A,label:e("submit with account"),onChange:u,type:"account",withLabel:!0}),!A&&(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||!I,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(A())(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)(m.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` +`,de=n.memo((function({bestNumber:e,bounty:s,className:t="",description:r,index:i,proposals:l}){const{t:c}=f(),[u,d]=(0,h.O)(!1),{bond:x,curatorDeposit:g,fee:b,proposer:j,status:v,value:y}=s,{beneficiary:C,bountyStatus:w,curator:k,unlockAt:N,updateDue:S}=p(v),A=(0,n.useMemo)((()=>S?.sub(e)),[e,S]),I=(0,n.useMemo)((()=>N?.sub(e)),[e,N]),E=(0,n.useMemo)((()=>{if(k)return{curator:k,isFromProposal:!1};const e=l&&O(l,v);return"proposeCurator"===e?.proposal?.method?{curator:e.proposal.args[1],isFromProposal:!0}:null}),[k,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:E&&(0,a.jsx)(ae,{curator:E.curator,isFromProposal:E.isFromProposal})}),(0,a.jsxs)("td",{children:[I&&N&&(0,a.jsx)(re,{dueBlocks:I,endBlock:N,label:c("payout")}),A&&S&&(0,a.jsx)(re,{dueBlocks:A,endBlock:S,label:c("update")}),(0,a.jsx)(ee,{bestNumber:e,blocksUntilUpdate:A,status:v}),(0,a.jsx)(P,{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)(m.Z,{value:x})})]}),k&&(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)(m.Z,{value:b})})]}),(0,a.jsx)("div",{className:"column",children:k&&!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)(m.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 he(e){return new Blob([e]).size}const me=(0,c.e)("useBalance",(function(e){const{api:s}=(0,r.h)(),t=(0,i.W7)(s.derive.balances?.all,[e]);return t?.transferable||t?.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),m=me(c),[p,x]=(0,n.useState)(""),[g,b]=(0,n.useState)(s),[j,v]=(0,n.useState)(pe),[y,C]=(0,h.O)(),[w,k]=(0,n.useState)(!1),[N,S]=(0,n.useState)(!1),[A,I]=(0,n.useState)(!1);(0,n.useEffect)((()=>{k(p?.length>=1&&he(p)<=i)}),[i,p]),(0,n.useEffect)((()=>{S(!!j?.gte(t))}),[t,j]),(0,n.useEffect)((()=>{I(!!m?.gte(g))}),[m,g]);const E=A&&w&&N,T=(0,n.useCallback)((e=>{var t,a;x(e),b((t=e,a=r,s.add(a.muln(he(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:T,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:!N,isZeroable:!0,label:e("bounty requested allocation"),onChange:v,value:j}),!N&&!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:!A,label:e("submit with account"),onChange:u,type:"account",withLabel:!0}),!A&&(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||!E,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(A())(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)(m.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 { @@ -310,7 +310,7 @@ 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])}))},22887:(e,s,t)=>{t.d(s,{Z:()=>U});var a,n=t(52322),o=t(2784),r=t(48630),i=t(90778),l=t(71756),c=t(59653),u=t(22955),d=t(61314),h=t(62353),m=t(52953),p=t(48801),x=t.n(p);!function(e){e[e.Reservation=0]="Reservation",e[e.Lease=1]="Lease",e[e["Bulk Coretime"]=2]="Bulk Coretime",e[e["On Demand"]=3]="On Demand"}(a||(a={}));const g=(e,s)=>{if(!s||!e)return console.error("Invalid input: one or more inputs are missing"),null;const t=(new Date).getTime();try{const n=new(x())(m.SB.BlockTime),o=new(x())(m.SB.BlocksPerTimeslice),r=new(x())(s),i=new(x())(t),l=new(x())(e).mul(o).sub(r).mul(n),c=i.add(l);return`${(a=new Date(c.toNumber())).getDate()} ${a.toLocaleString("default",{month:"short"})} ${a.getFullYear()}`}catch(e){return console.error("Error in calculation:",e),null}var a};function b(e,s,t,n,{regionBegin:o,regionEnd:r},i){return e.map((e=>{const l={core:s,maskBits:e?.info?.maskBits,task:e?.info?.task,type:e?.type},c=80*n;let u;l.type=e.type;let d=null;return e.type===a.Lease?u=Math.floor(e.lastBlock/i)*i:(d=t?.start?.toString()??o,u=t?.end?.toString()??r),l.owner=t?.owner.toString(),l.start=d?g(d,c):null,l.end=u?g(u,c):null,l.endBlock=u?80*Number(u):0,"timeslice"in e&&!d&&(d=g(e.timeslice,c)??null),l}))}const f=e=>(e||[]).reduce(((e,s)=>(e[Number(s.task)]=s,e)),{});var j=t(10807),v=t(61349);function y(){return(0,v.$G)("app-broker")}var C=t(69953),w=t(9118),k=t(38894),N=t(26309);const S={[a.Reservation]:"orange",[a.Lease]:"blue",[a["Bulk Coretime"]]:"pink",[a["On Demand"]]:"green"},A=r.zo.td` +`,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])}))},39372:(e,s,t)=>{t.d(s,{Z:()=>U});var a=t(52322),n=t(2784),o=t(48630),r=t(90778),i=t(71756),l=t(59653),c=t(22955),u=t(61314),d=t(62353),h=t(28097),m=t(48801),p=t.n(m);const x=(e,s,{blocksPerTimeslice:t,blocktimeMs:a}={blocksPerTimeslice:0,blocktimeMs:0})=>{if(!s||!e)return console.error("Invalid input: one or more inputs are missing"),null;const n=(new Date).getTime();try{const r=new(p())(a),i=new(p())(t),l=new(p())(s),c=new(p())(n),u=new(p())(e).mul(i).sub(l).mul(r),d=c.add(u);return`${(o=new Date(d.toNumber())).getDate()} ${o.toLocaleString("default",{month:"short"})} ${o.getFullYear()}`}catch(e){return console.error("Error in calculation:",e),null}var o};function g(e,s,t,a,{regionBegin:n,regionEnd:o},r,i={blocksPerTimeslice:0,blocktimeMs:0}){return e.map((e=>{const l={core:s,maskBits:e?.info?.maskBits,task:e?.info?.task,type:e?.type},c=80*a;let u;l.type=e.type;let d=null;return e.type===h.I.Lease?u=Math.floor(e.lastBlock/r)*r:(d=t?.start?.toString()??n,u=t?.end?.toString()??o),l.owner=t?.owner.toString(),l.start=d?x(d,c,i):null,l.end=u?x(u,c,i):null,l.endBlock=u?80*Number(u):0,"timeslice"in e&&!d&&(d=x(e.timeslice,c,i)??null),l}))}const b=e=>(e||[]).reduce(((e,s)=>(e[Number(s.task)]=s,e)),{});var f=t(10807),j=t(61349);function v(){return(0,j.$G)("app-broker")}var y=t(69953),C=t(9118),w=t(38894),k=t(26309),N=t(69031);const S={[h.I.Reservation]:"orange",[h.I.Lease]:"blue",[h.I["Bulk Coretime"]]:"pink",[h.I["On Demand"]]:"green"},A=o.zo.td` width: 150px; vertical-align: top; @@ -323,22 +323,22 @@ /* Tablet */ ${e=>"tablet"===e.hide||"both"===e.hide?"display: none;":""} } -`,E=({header:e,hide:s,value:t})=>(0,n.jsxs)(A,{hide:s,children:[(0,n.jsx)("h5",{style:{opacity:"0.6"},children:e}),(0,n.jsx)("p",{children:t||(0,n.jsx)(n.Fragment,{children:" "})})]}),I=o.memo((function({data:e}){if(!e.task)return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("td",{style:{width:200},children:"no task"}),(0,n.jsx)("td",{colSpan:6})]});switch(e.type){case a.Reservation:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E,{header:"Task",value:e.task}),(0,n.jsx)(E,{header:"Blocks per timeslice",value:e.maskBits}),(0,n.jsx)("td",{children:(0,n.jsx)(r.Vp,{color:S[e.type],label:Object.values(a)[e.type]})}),(0,n.jsx)("td",{colSpan:4})]});case a.Lease:case a["On Demand"]:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E,{header:"Task",value:e.task}),(0,n.jsx)(E,{header:"Blocks per timeslice",value:e.maskBits}),(0,n.jsx)(E,{header:"Start",hide:"both",value:e.start}),(0,n.jsx)(E,{header:"End",hide:"both",value:e.end}),(0,n.jsx)(E,{header:"Last block",value:e.endBlock}),(0,n.jsxs)(A,{hide:"mobile",children:[(0,n.jsx)("h5",{style:{opacity:"0.6"},children:"type"}),(0,n.jsx)(r.Vp,{color:S[e.type],label:Object.values(a)[e.type]})]}),(0,n.jsx)("td",{colSpan:1})]});default:return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(E,{header:"Task",value:e.task}),(0,n.jsx)(E,{header:"Blocks per timeslice",value:e.maskBits}),(0,n.jsx)(E,{header:"Start",hide:"both",value:e.start}),(0,n.jsx)(E,{header:"End",hide:"both",value:e.end}),(0,n.jsx)(E,{header:"Last block",value:e.endBlock}),(0,n.jsxs)(A,{hide:"mobile",children:[(0,n.jsx)("h5",{style:{opacity:"0.6"},children:"type"}),(0,n.jsx)(r.Vp,{color:S[a["Bulk Coretime"]],label:"Bulk Coretime"})]}),e.owner?(0,n.jsxs)(A,{hide:"mobile",children:[(0,n.jsx)("h5",{style:{opacity:"0.6"},children:"Owner"}),(0,n.jsx)(r.ax,{isPadded:!1,value:e.owner},e.owner)]}):(0,n.jsx)("td",{})]})}})),T=o.memo((function({isExpanded:e,workplanData:s}){return s?(0,n.jsx)(n.Fragment,{children:s&&(0,n.jsxs)("tr",{className:" "+(e?"isExpanded isLast":"isCollapsed"),children:[(0,n.jsx)(I,{data:s}),(0,n.jsx)("td",{})]},s.core)}):(0,n.jsxs)("tr",{className:" "+(e?"isExpanded isLast":"isCollapsed"),style:{minHeight:"100px"},children:[(0,n.jsxs)("td",{children:[" ",(0,n.jsx)(r.$j,{})," "]}),(0,n.jsx)("td",{colSpan:6})]})})),D=o.memo((function({api:e,config:s,core:t,workload:a,workplan:l}){const{isApiReady:c}=(0,i.h)(),u=(0,C.i)(e,c),d=(0,w.W7)(c&&e.query.broker?.status),[h,m]=(0,k.O)(!1),[p,x]=(0,o.useState)(),[g,f]=(0,o.useState)(),j=(0,o.useMemo)((()=>d?.isSome?d.unwrap().lastCommittedTimeslice.toNumber():0),[d]),v=(0,N.e)(e),y=(0,o.useMemo)((()=>v?.find((e=>e.core===t&&e.start<=j&&e.end>j))),[v,t,j]);(0,o.useEffect)((()=>{if(!a?.length||!u)return x([{core:t}]);x(b(a,t,y,j,{regionBegin:u.regionBegin-s.regionLength,regionEnd:u.regionEnd-s.regionLength},s.regionLength))}),[a,y,j,t,u,s]),(0,o.useEffect)((()=>{l?.length&&u&&f(b(l,t,y,j,u,s.regionLength))}),[l,y,j,t,u,s]);const S=l?.length;return(0,n.jsxs)(n.Fragment,{children:[!!p&&(0,n.jsx)("tr",{className:"isExpanded isFirst "+(h?"":"isLast"),children:p.map((e=>(0,n.jsxs)(o.Fragment,{children:[(0,n.jsx)(I,{data:e}),(0,n.jsxs)("td",{style:{paddingRight:"2rem",textAlign:"right",verticalAlign:"top"},children:[(0,n.jsxs)("h5",{style:{opacity:"0.6"},children:["Workplan ",l?.length?`(${l?.length})`:""]}),!!S&&(0,n.jsx)(r.Vh,{expanded:h,onClick:m}),!S&&"none"]})]},`${e.endBlock}${e.core}`)))},t),h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{style:{fontWeight:700,paddingTop:"2rem",width:150},children:"workplans"}),(0,n.jsx)("td",{colSpan:7})]}),g?.map((e=>(0,n.jsx)(T,{currentTimeSlice:j,isExpanded:h,region:y,workplanData:e},e.core)))]})]})})),P=o.memo((function({api:e,config:s,core:t,workload:a,workplan:i}){const{t:l}=y(),c=(0,o.useRef)([[l("core")]]),u=[[(0,n.jsxs)("div",{children:[c.current," ",t," ",(0,n.jsx)("span",{})]},`header${t}`),"core",8,void 0]];return(0,n.jsx)(r.iA,{emptySpinner:!0,header:u,isSplit:!1,children:(0,n.jsx)(D,{api:e,config:s,core:t,workload:a,workplan:i},t)},t)})),M=o.memo((function({api:e,data:s,isApiReady:t}){const a=(0,j.f)(e,t);return(0,n.jsx)(n.Fragment,{children:a&&s?.map((s=>(0,n.jsx)(P,{api:e,config:a,core:s?.core,workload:s?.workload,workplan:s?.workplan},s?.core)))})}));var z=t(27421);const F=r.zo.div` +`,I=({header:e,hide:s,value:t})=>(0,a.jsxs)(A,{hide:s,children:[(0,a.jsx)("h5",{style:{opacity:"0.6"},children:e}),(0,a.jsx)("p",{children:t||(0,a.jsx)(a.Fragment,{children:" "})})]}),E=n.memo((function({data:e}){if(!e.task)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{style:{width:200},children:"no task"}),(0,a.jsx)("td",{colSpan:6})]});switch(e.type){case h.I.Reservation:return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(I,{header:"Task",value:e.task}),(0,a.jsx)(I,{header:"Blocks per timeslice",value:e.maskBits}),(0,a.jsx)("td",{children:(0,a.jsx)(o.Vp,{color:S[e.type],label:Object.values(h.I)[e.type]})}),(0,a.jsx)("td",{colSpan:4})]});case h.I.Lease:case h.I["On Demand"]:return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(I,{header:"Task",value:e.task}),(0,a.jsx)(I,{header:"Blocks per timeslice",value:e.maskBits}),(0,a.jsx)(I,{header:"Start",hide:"both",value:e.start}),(0,a.jsx)(I,{header:"End",hide:"both",value:e.end}),(0,a.jsx)(I,{header:"Last block",value:e.endBlock}),(0,a.jsxs)(A,{hide:"mobile",children:[(0,a.jsx)("h5",{style:{opacity:"0.6"},children:"type"}),(0,a.jsx)(o.Vp,{color:S[e.type],label:Object.values(h.I)[e.type]})]}),(0,a.jsx)("td",{colSpan:1})]});default:return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(I,{header:"Task",value:e.task}),(0,a.jsx)(I,{header:"Blocks per timeslice",value:e.maskBits}),(0,a.jsx)(I,{header:"Start",hide:"both",value:e.start}),(0,a.jsx)(I,{header:"End",hide:"both",value:e.end}),(0,a.jsx)(I,{header:"Last block",value:e.endBlock}),(0,a.jsxs)(A,{hide:"mobile",children:[(0,a.jsx)("h5",{style:{opacity:"0.6"},children:"type"}),(0,a.jsx)(o.Vp,{color:S[h.I["Bulk Coretime"]],label:"Bulk Coretime"})]}),e.owner?(0,a.jsxs)(A,{hide:"mobile",children:[(0,a.jsx)("h5",{style:{opacity:"0.6"},children:"Owner"}),(0,a.jsx)(o.ax,{isPadded:!1,value:e.owner},e.owner)]}):(0,a.jsx)("td",{})]})}})),T=n.memo((function({isExpanded:e,workplanData:s}){return s?(0,a.jsx)(a.Fragment,{children:s&&(0,a.jsxs)("tr",{className:" "+(e?"isExpanded isLast":"isCollapsed"),children:[(0,a.jsx)(E,{data:s}),(0,a.jsx)("td",{})]},s.core)}):(0,a.jsxs)("tr",{className:" "+(e?"isExpanded isLast":"isCollapsed"),style:{minHeight:"100px"},children:[(0,a.jsxs)("td",{children:[" ",(0,a.jsx)(o.$j,{})," "]}),(0,a.jsx)("td",{colSpan:6})]})})),D=n.memo((function({api:e,config:s,core:t,workload:i,workplan:l}){const{isApiReady:c}=(0,r.h)(),u=(0,y.i)(e,c),d=(0,N.e)(),h=(0,C.W7)(c&&e.query.broker?.status),[m,p]=(0,w.O)(!1),[x,b]=(0,n.useState)(),[f,j]=(0,n.useState)(),v=(0,n.useMemo)((()=>h?.isSome?h.unwrap().lastCommittedTimeslice.toNumber():0),[h]),S=(0,k.e)(e),A=(0,n.useMemo)((()=>S?.find((e=>e.core===t&&e.start<=v&&e.end>v))),[S,t,v]);(0,n.useEffect)((()=>{if(!i?.length||!u)return b([{core:t}]);b(g(i,t,A,v,{regionBegin:u.regionBegin-s.regionLength,regionEnd:u.regionEnd-s.regionLength},s.regionLength,d?.relay))}),[i,A,v,t,u,s,d]),(0,n.useEffect)((()=>{l?.length&&u&&j(g(l,t,A,v,{regionBegin:u.regionBegin-s.regionLength,regionEnd:u.regionEnd-s.regionLength},s.regionLength,d?.relay))}),[l,A,v,t,u,s,d]);const I=l?.length;return(0,a.jsxs)(a.Fragment,{children:[!!x&&(0,a.jsx)("tr",{className:"isExpanded isFirst "+(m?"":"isLast"),children:x.map((e=>(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(E,{data:e}),(0,a.jsxs)("td",{style:{paddingRight:"2rem",textAlign:"right",verticalAlign:"top"},children:[(0,a.jsxs)("h5",{style:{opacity:"0.6"},children:["Workplan ",l?.length?`(${l?.length})`:""]}),!!I&&(0,a.jsx)(o.Vh,{expanded:m,onClick:p}),!I&&"none"]})]},`${e.endBlock}${e.core}`)))},t),m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{style:{fontWeight:700,paddingTop:"2rem",width:150},children:"workplans"}),(0,a.jsx)("td",{colSpan:7})]}),f?.map((e=>(0,a.jsx)(T,{currentTimeSlice:v,isExpanded:m,region:A,workplanData:e},e.core)))]})]})})),P=n.memo((function({api:e,config:s,core:t,workload:r,workplan:i}){const{t:l}=v(),c=(0,n.useRef)([[l("core")]]),u=[[(0,a.jsxs)("div",{children:[c.current," ",t," ",(0,a.jsx)("span",{})]},`header${t}`),"core",8,void 0]];return(0,a.jsx)(o.iA,{emptySpinner:!0,header:u,isSplit:!1,children:(0,a.jsx)(D,{api:e,config:s,core:t,workload:r,workplan:i},t)},t)})),M=n.memo((function({api:e,data:s,isApiReady:t}){const n=(0,f.f)(e,t);return(0,a.jsx)(a.Fragment,{children:n&&s?.map((s=>(0,a.jsx)(P,{api:e,config:n,core:s?.core,workload:s?.workload,workplan:s?.workplan},s?.core)))})}));var z=t(27421);const F=o.zo.div` @media (max-width: 768px) { max-width: 100%: } -`,L=o.memo((function({data:e,onFilter:s}){const[t,a]=(0,o.useState)(-1),[i,l]=(0,o.useState)(""),c=(0,o.useMemo)((()=>e?.length?Array.from({length:e.length||0},((e,s)=>s)):[]),[e]),{t:u}=y(),d=(0,z.N)(i),h=(0,o.useMemo)((()=>c&&[{text:u("All active/available cores"),value:-1}].concat(c.map((e=>({text:`Core ${e}`,value:e}))).filter((e=>!!e.text)))),[c,u]);(0,o.useEffect)((()=>{if(!e)return;const a=((e,s,t)=>e?s.filter((({workload:s})=>!!s?.filter((({info:s})=>s.task===e)).length)):-1===t?s:s.filter((e=>e.core===t)))(d,e,t);s(a)}),[e,t,d,s]);const m=(0,o.useCallback)((e=>{a(e),l("")}),[]),p=(0,o.useCallback)((e=>{l(e),a(-1)}),[]);return(0,n.jsxs)(F,{style:{display:"flex",flexDirection:"column",gap:"1rem",marginBottom:"1.5rem",maxWidth:"300px"},children:[(0,n.jsx)(r.Lt,{className:"isSmall",label:u("selected core"),onChange:m,options:h,value:t}),(0,n.jsx)("div",{style:{minWidth:"150px"},children:(0,n.jsx)(r.II,{className:"full isSmall",label:u("parachain id"),onChange:p,placeholder:u("parachain id"),value:i})})]})}));var V=t(37731),_=t(95292);const R=o.memo((function({children:e,className:s}){const{api:t}=(0,i.h)(),a=(0,w.W7)(t.query.broker?.configuration),o=a?.toJSON()?.regionLength;return(0,n.jsxs)("div",{className:s,children:[o?.toString()||"-",e]})})),H=o.memo((function({children:e,className:s}){const{api:t,isApiReady:a}=(0,i.h)(),o=(0,l.c)(t,a);return(0,n.jsxs)("div",{className:s,children:[o?.lastTimeslice||"-",e]})})),$=o.memo((function({children:e,className:s}){const{api:t}=(0,i.h)(),a=t.consts.broker?.timeslicePeriod;return(0,n.jsxs)("div",{className:s,children:[a?.toString(),e]})})),B=r.zo.div` +`,L=n.memo((function({data:e,onFilter:s}){const[t,r]=(0,n.useState)(-1),[i,l]=(0,n.useState)(""),c=(0,n.useMemo)((()=>e?.length?Array.from({length:e.length||0},((e,s)=>s)):[]),[e]),{t:u}=v(),d=(0,z.N)(i),h=(0,n.useMemo)((()=>c&&[{text:u("All active/available cores"),value:-1}].concat(c.map((e=>({text:`Core ${e}`,value:e}))).filter((e=>!!e.text)))),[c,u]);(0,n.useEffect)((()=>{if(!e)return;const a=((e,s,t)=>e?s.filter((({workload:s})=>!!s?.filter((({info:s})=>s.task===e)).length)):-1===t?s:s.filter((e=>e.core===t)))(d,e,t);s(a)}),[e,t,d,s]);const m=(0,n.useCallback)((e=>{r(e),l("")}),[]),p=(0,n.useCallback)((e=>{l(e),r(-1)}),[]);return(0,a.jsxs)(F,{style:{display:"flex",flexDirection:"column",gap:"1rem",marginBottom:"1.5rem",maxWidth:"300px"},children:[(0,a.jsx)(o.Lt,{className:"isSmall",label:u("selected core"),onChange:m,options:h,value:t}),(0,a.jsx)("div",{style:{minWidth:"150px"},children:(0,a.jsx)(o.II,{className:"full isSmall",label:u("parachain id"),onChange:p,placeholder:u("parachain id"),value:i})})]})}));var V=t(37731),_=t(95292);const R=n.memo((function({children:e,className:s}){const{api:t}=(0,r.h)(),n=(0,C.W7)(t.query.broker?.configuration),o=n?.toJSON()?.regionLength;return(0,a.jsxs)("div",{className:s,children:[o?.toString()||"-",e]})})),$=n.memo((function({children:e,className:s}){const{api:t,isApiReady:n}=(0,r.h)(),o=(0,i.c)(t,n);return(0,a.jsxs)("div",{className:s,children:[o?.lastTimeslice||"-",e]})})),H=n.memo((function({children:e,className:s}){const{api:t}=(0,r.h)(),n=t.consts.broker?.timeslicePeriod;return(0,a.jsxs)("div",{className:s,children:[n?.toString(),e]})})),B=o.zo.div` display: flex; flex-wrap: wrap; gap: 1rem; -`,O=r.zo.section` +`,O=o.zo.section` display: flex; gap: 1rem; @media (max-width: 768px) { flex-direction: column; margin-bottom: 2rem } -`,q=o.memo((function({coreCount:e,workloadInfos:s}){const{t}=y(),{api:a,apiEndpoint:c,isApiReady:u}=(0,i.h)(),d=c?.ui.color||V.B,{idles:h,pools:m,tasks:p}=o.useMemo((()=>function(e,s){if(!e||!s)return{idles:0,pools:0,tasks:0};const{pools:t,tasks:a}=s.reduce(((e,{info:s})=>(s.isTask?e.tasks+=1:s.isPool&&(e.pools+=1),e)),{pools:0,tasks:0});return{idles:Number(e)-(t+a),pools:t,tasks:a}}(e,s)),[e,s]),b=(0,C.i)(a,u),f=(0,j.f)(a,u),v=(0,l.c)(a,u),w=(0,o.useMemo)((()=>b&&f&&b?.regionEnd-f?.regionLength),[b,f]),k=(0,o.useMemo)((()=>w&&f&&w-f?.regionLength),[w,f]);return(0,n.jsxs)(r.Ty,{children:[(0,n.jsxs)(O,{style:{display:"flex"},children:[a.query.broker&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(B,{children:[(0,n.jsx)(r.Jy,{label:t("timeslice (ts)"),children:(0,n.jsx)(H,{})}),(0,n.jsx)(r.Jy,{label:t("block per ts"),children:(0,n.jsx)($,{})}),(0,n.jsx)(r.Jy,{label:t("region (ts)"),children:(0,n.jsx)(R,{})}),(0,n.jsx)(r.Jy,{label:t("total cores"),children:e}),(0,n.jsx)(r.Jy,{label:t("cores sold/offered"),children:(0,n.jsxs)("div",{children:[b?.coresSold," / ",b?.coresOffered]})}),(0,n.jsx)(r.Jy,{label:t("cycle progress"),progress:{isBlurred:!1,total:new(x())(f?.regionLength||0),value:f?.regionLength&&w&&v&&new(x())(f?.regionLength-(w-v?.lastTimeslice))||_.nw,withTime:!1}})]})}),(0,n.jsx)("div",{className:"media--1400",style:{marginLeft:"2rem"},children:(0,n.jsx)(r.us,{data:[{color:"#FFFFFF",label:"Idle",value:h},{color:"#04AA6D",label:"Pools",value:m},{color:d,label:"Tasks",value:p}]})})]}),(0,n.jsx)("section",{children:v&&k&&w&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.Jy,{className:"media--1200",label:t("cycle dates"),children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontSize:"14px"},children:g(k,80*v?.lastTimeslice)}),(0,n.jsx)("div",{style:{fontSize:"14px"},children:g(w,80*v?.lastTimeslice)})]})}),(0,n.jsx)(r.Jy,{className:"media--1200",label:t("cycle ts"),children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontSize:"14px"},children:k}),(0,n.jsx)("div",{style:{fontSize:"14px"},children:w})]})})]})})]})})),W=(e,s,t)=>{return{...e,lastBlock:s[e?.info.task]?.until||0,maskBits:e.info.maskBits,task:e.info.task,type:(n=s[e.info.task],o=t[e.info.task],r=e.info.isPool,r?a["On Demand"]:o?a.Reservation:n?a.Lease:a["Bulk Coretime"])};var n,o,r},Z=o.memo((function({className:e}){const{api:s,apiEndpoint:t,isApiReady:a}=(0,i.h)(),[r,m]=(0,o.useState)([]),[p,x]=(0,o.useState)(),g=(0,l.c)(s,a),b=(0,c.E)(s,a),j=(0,u.b)(s,a),v=(0,d.m)(s,a),y=(0,h.i)(s,a),C=(0,o.useMemo)((()=>y?f(y):[]),[y]),w=(0,o.useMemo)((()=>v?f(v):[]),[v]);return(0,o.useEffect)((()=>{j&&b&&g?.coreCount&&m(((e,s,t,a,n)=>Array.from({length:e},((e,o)=>{var r;return{core:o,workload:t?.length?(r=t,r.filter((e=>e.core===o)).map((e=>W(e,a,n)))):[],workplan:s?.length?(e=>e.filter((e=>e.core===o)).map((e=>({...W(e,a,n),timeslice:e.timeslice}))))(s):[]}})))(Number(g?.coreCount),j,b,C,w))}),[j,b,C,w,g]),(0,n.jsxs)("div",{className:e,children:[(0,n.jsx)(q,{apiEndpoint:t,coreCount:g?.coreCount.toString()||"-",workloadInfos:b}),!!r?.length&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(L,{data:r,onFilter:x}),!!p&&(0,n.jsx)(M,{api:s,data:p,isApiReady:a})]}),!r?.length&&(0,n.jsx)("p",{style:{marginLeft:"22px",marginTop:"3rem",opacity:.7},children:" No data currently available"})]})})),U=o.memo((function({basePath:e,className:s}){const{t}=y(),a=(0,o.useRef)(function(e){return[{isRoot:!0,name:"overview",text:e("Overview")}]}(t));return(0,n.jsxs)("main",{className:s,children:[(0,n.jsx)(r.mQ,{basePath:e,items:a.current}),(0,n.jsx)(Z,{})]})}))},6742:(e,s,t)=>{t.d(s,{Z:()=>W});var a=t(52322),n=t(2784),o=t(48630);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 h(e){const s=new Date(e);return s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0),s}function m(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=h(e);t.setDate(1);const a=m(t),n=h(s),o=m(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` +`,W=n.memo((function({coreCount:e,workloadInfos:s}){const{t}=v(),{api:l,apiEndpoint:c,isApiReady:u}=(0,r.h)(),d=(0,N.e)(),h=c?.ui.color||V.B,{idles:m,pools:g,tasks:b}=n.useMemo((()=>function(e,s){if(!e||!s)return{idles:0,pools:0,tasks:0};const{pools:t,tasks:a}=s.reduce(((e,{info:s})=>(s.isTask?e.tasks+=1:s.isPool&&(e.pools+=1),e)),{pools:0,tasks:0});return{idles:Number(e)-(t+a),pools:t,tasks:a}}(e,s)),[e,s]),j=(0,y.i)(l,u),C=(0,f.f)(l,u),w=(0,i.c)(l,u),k=(0,n.useMemo)((()=>j&&C&&j?.regionEnd-C?.regionLength),[j,C]),S=(0,n.useMemo)((()=>k&&C&&k-C?.regionLength),[k,C]);return(0,a.jsxs)(o.Ty,{children:[(0,a.jsxs)(O,{style:{display:"flex"},children:[l.query.broker&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(B,{children:[(0,a.jsx)(o.Jy,{label:t("timeslice (ts)"),children:(0,a.jsx)($,{})}),(0,a.jsx)(o.Jy,{label:t("block per ts"),children:(0,a.jsx)(H,{})}),(0,a.jsx)(o.Jy,{label:t("region (ts)"),children:(0,a.jsx)(R,{})}),(0,a.jsx)(o.Jy,{label:t("total cores"),children:e}),(0,a.jsx)(o.Jy,{label:t("cores sold/offered"),children:(0,a.jsxs)("div",{children:[j?.coresSold," / ",j?.coresOffered]})}),(0,a.jsx)(o.Jy,{label:t("cycle progress"),progress:{isBlurred:!1,total:new(p())(C?.regionLength||0),value:C?.regionLength&&k&&w&&new(p())(C?.regionLength-(k-w?.lastTimeslice))||_.nw,withTime:!1}})]})}),(0,a.jsx)("div",{className:"media--1400",style:{marginLeft:"2rem"},children:(0,a.jsx)(o.us,{data:[{color:"#FFFFFF",label:"Idle",value:m},{color:"#04AA6D",label:"Pools",value:g},{color:h,label:"Tasks",value:b}]})})]}),(0,a.jsx)("section",{children:w&&S&&k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Jy,{className:"media--1200",label:t("cycle dates"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:x(S,80*w?.lastTimeslice,d?.relay)}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:x(k,80*w?.lastTimeslice,d?.relay)})]})}),(0,a.jsx)(o.Jy,{className:"media--1200",label:t("cycle ts"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:S}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:k})]})})]})})]})})),q=(e,s,t)=>{return{...e,lastBlock:s[e?.info.task]?.until||0,maskBits:e.info.maskBits,task:e.info.task,type:(a=s[e.info.task],n=t[e.info.task],o=e.info.isPool,o?h.I["On Demand"]:n?h.I.Reservation:a?h.I.Lease:h.I["Bulk Coretime"])};var a,n,o},Z=n.memo((function({className:e}){const{api:s,apiEndpoint:t,isApiReady:o}=(0,r.h)(),[h,m]=(0,n.useState)([]),[p,x]=(0,n.useState)(),g=(0,i.c)(s,o),f=(0,l.E)(s,o),j=(0,c.b)(s,o),v=(0,u.m)(s,o),y=(0,d.i)(s,o),C=(0,n.useMemo)((()=>y?b(y):[]),[y]),w=(0,n.useMemo)((()=>v?b(v):[]),[v]);return(0,n.useEffect)((()=>{j&&f&&g?.coreCount&&m(((e,s,t,a,n)=>Array.from({length:e},((e,o)=>{var r;return{core:o,workload:t?.length?(r=t,r.filter((e=>e.core===o)).map((e=>q(e,a,n)))):[],workplan:s?.length?(e=>e.filter((e=>e.core===o)).map((e=>({...q(e,a,n),timeslice:e.timeslice}))))(s):[]}})))(Number(g?.coreCount),j,f,C,w))}),[j,f,C,w,g]),(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(W,{apiEndpoint:t,coreCount:g?.coreCount.toString()||"-",workloadInfos:f}),!!h?.length&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{data:h,onFilter:x}),!!p&&(0,a.jsx)(M,{api:s,data:p,isApiReady:o})]}),!h?.length&&(0,a.jsx)("p",{style:{marginLeft:"22px",marginTop:"3rem",opacity:.7},children:" No data currently available"})]})})),U=n.memo((function({basePath:e,className:s}){const{t}=v(),r=(0,n.useRef)(function(e){return[{isRoot:!0,name:"overview",text:e("Overview")}]}(t));return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:r.current}),(0,a.jsx)(Z,{})]})}))},6742:(e,s,t)=>{t.d(s,{Z:()=>q});var a=t(52322),n=t(2784),o=t(48630);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 h(e){const s=new Date(e);return s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0),s}function m(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=h(e);t.setDate(1);const a=m(t),n=h(s),o=m(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; @@ -440,7 +440,7 @@ .hoursContainer { z-index: 1; } -`,S=n.memo((function({className:e,date:s,hasNextDay:t,now:r,scheduled:l,setNextDay:c,setPrevDay:u,setView:h}){const{t:m}=d(),p=(0,n.useRef)(i.map((e=>m(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)((()=>h(!0)),[h]);return(0,a.jsxs)(N,{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:k.map(((e,t)=>(0,a.jsx)(C,{date:s,hour:e,index:t,minutes:x&&g===t?b:0,scheduled:l},e)))})]})})),A=864e5,E=o.zo.div` +`,S=n.memo((function({className:e,date:s,hasNextDay:t,now:r,scheduled:l,setNextDay:c,setPrevDay:u,setView:h}){const{t:m}=d(),p=(0,n.useRef)(i.map((e=>m(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)((()=>h(!0)),[h]);return(0,a.jsxs)(N,{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:k.map(((e,t)=>(0,a.jsx)(C,{date:s,hour:e,index:t,minutes:x&&g===t?b:0,scheduled:l},e)))})]})})),A=864e5,I=o.zo.div` background-color: transparent; border: 1px solid transparent; border-radius: 50%; @@ -483,7 +483,7 @@ display: none; } } -`,I=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)*A,a=e+A;return i.some((({dateTime:s})=>s>=e&&s{!r&&l(t)}),[t,r,l]);return(0,a.jsxs)(E,{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"})]})})),T=o.zo.div` +`,E=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)*A,a=e+A;return i.some((({dateTime:s})=>s>=e&&s{!r&&l(t)}),[t,r,l]);return(0,a.jsxs)(I,{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"})]})})),T=o.zo.div` flex: 0; max-width: max-content; @@ -525,7 +525,7 @@ justify-content: space-between; } } -`,D=n.memo((function({className:e,hasNextMonth:s,lastDay:t,now:l,scheduled:c,setDay:u,setNextMonth:h,setPrevMonth:m,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,k,N]=(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)(T,{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&&(N||k),onClick:m}),(0,a.jsx)(o.zx,{icon:"chevron-right",isDisabled:!s,onClick:h})]})]}),(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)(I,{dateMonth:p,day:e,isCurrent:y&&C&&e===x.getDate(),isDisabled:w&&(N||k&&l.getDate()>e)||!s&&e>t,scheduled:c,setDay:u},e)))})]})]})})),P=o.zo.div` +`,D=n.memo((function({className:e,hasNextMonth:s,lastDay:t,now:l,scheduled:c,setDay:u,setNextMonth:h,setPrevMonth:m,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,k,N]=(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)(T,{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&&(N||k),onClick:m}),(0,a.jsx)(o.zx,{icon:"chevron-right",isDisabled:!s,onClick:h})]})]}),(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)(E,{dateMonth:p,day:e,isCurrent:y&&C&&e===x.getDate(),isDisabled:w&&(N||k&&l.getDate()>e)||!s&&e>t,scheduled:c,setDay:u},e)))})]})]})})),P=o.zo.div` flex: 0; max-width: max-content; @@ -540,7 +540,7 @@ .allEventsWrapper { padding-inline-start: 10px; } -`,M=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)(P,{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 z=t(31132),F=t(90778),L=t(56360),V=t(54383),_=t(9118),R=t(11677),H=t(95292);function $(e,s){const t=new Date(Date.now()+e.mul(s).toNumber());return{date:t,dateTime:t.getTime()}}function B(e,s){return s.reduce(((e,[s,t])=>e.filter((({type:e})=>e!==s)).concat(...t.map((e=>(e.type=s,e))))),e)}const O=(0,R.e)("useScheduled",(function(){const{api:e}=(0,F.h)(),s=(0,L.n)(),t=(0,V.C)(),a=(0,z.f)(),o=(0,_.W7)(e.query.auctions?.auctionInfo),r=(0,_.W7)(e.derive.council?.proposals),i=(0,_.W7)(e.derive.democracy?.dispatchQueue),l=(0,_.W7)(e.derive.democracy?.referendums),c=(0,_.W7)(e.query.scheduler?.agenda?.entries),u=(0,_.W7)(e.derive.session?.progress),d=(0,_.W7)(e.query.staking?.unappliedSlashes.entries),[h,m]=(0,n.useState)([]);return(0,n.useEffect)((()=>{t&&i&&m((e=>B(e,function(e,s,t){return t.map((({at:t,index:a})=>{const n=t.sub(e);return["democracyDispatch",[{...$(n,s),blockNumber:t,blocks:n,info:a}]]}))}(t,s,i))))}),[t,s,i]),(0,n.useEffect)((()=>{t&&r&&m((e=>B(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{...$(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&&m((e=>B(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(H.If);return t.push(["referendumVote",[{...$(r,s),blockNumber:e.add(r),blocks:r,info:a}]]),t.push(["referendumDispatch",[{...$(o,s),blockNumber:e.add(o),blocks:o,info:a,isPending:!0}]]),t}),[])}(t,s,l))))}),[t,s,l]),(0,n.useEffect)((()=>{t&&c&&m((e=>B(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({...$(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(H.If)&&m((a=>B(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(H.If).imul(t.eraLength).iadd(t.eraProgress),r=i.sub(o);return{...$(r,s),blockNumber:e.add(r),blocks:r,info:n}})):[];return[["stakingEpoch",[{...$(r,s),blockNumber:e.add(r),blocks:r,info:t.currentIndex.add(H.If)}]],["stakingEra",[{...$(o,s),blockNumber:e.add(o),blocks:o,info:t.activeEra.add(H.If)}]],["stakingSlash",l]]}(t,s,u,d||[],e.consts.staking?.slashDeferDuration))))}),[e,t,s,u,d]),(0,n.useEffect)((()=>{t&&o?.isSome&&m((e=>B(e,function(e,s,t,[a,n]){const o=n.sub(e);return[["parachainAuction",[{...$(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&&m((a=>B(a,function(e,s,t){return t.map((([t,a,n=H.nw,o=H.nw])=>{if(!a)return[t,[]];const r=e.sub(o),i=a.sub(r.mod(a));return[t,[{...$(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,H.If,e.consts.slots?.leaseOffset],["societyChallenge",e.consts.society?.challengePeriod],["societyRotate",e.consts.society?.rotationPeriod],["treasurySpend",e.consts.treasury?.spendPeriod]]))))}),[e,t,s]),h})),q=o.zo.main` +`,M=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)(P,{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 z=t(31132),F=t(90778),L=t(56360),V=t(54383),_=t(9118),R=t(11677),$=t(95292);function H(e,s){const t=new Date(Date.now()+e.mul(s).toNumber());return{date:t,dateTime:t.getTime()}}function B(e,s){return s.reduce(((e,[s,t])=>e.filter((({type:e})=>e!==s)).concat(...t.map((e=>(e.type=s,e))))),e)}const O=(0,R.e)("useScheduled",(function(){const{api:e}=(0,F.h)(),s=(0,L.n)(),t=(0,V.C)(),a=(0,z.f)(),o=(0,_.W7)(e.query.auctions?.auctionInfo),r=(0,_.W7)(e.derive.council?.proposals),i=(0,_.W7)(e.derive.democracy?.dispatchQueue),l=(0,_.W7)(e.derive.democracy?.referendums),c=(0,_.W7)(e.query.scheduler?.agenda?.entries),u=(0,_.W7)(e.derive.session?.progress),d=(0,_.W7)(e.query.staking?.unappliedSlashes.entries),[h,m]=(0,n.useState)([]);return(0,n.useEffect)((()=>{t&&i&&m((e=>B(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&&m((e=>B(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&&m((e=>B(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($.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&&m((e=>B(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($.If)&&m((a=>B(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($.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($.If)}]],["stakingEra",[{...H(o,s),blockNumber:e.add(o),blocks:o,info:t.activeEra.add($.If)}]],["stakingSlash",l]]}(t,s,u,d||[],e.consts.staking?.slashDeferDuration))))}),[e,t,s,u,d]),(0,n.useEffect)((()=>{t&&o?.isSome&&m((e=>B(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&&m((a=>B(a,function(e,s,t){return t.map((([t,a,n=$.nw,o=$.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,$.If,e.consts.slots?.leaseOffset],["societyChallenge",e.consts.society?.challengePeriod],["societyRotate",e.consts.society?.rotationPeriod],["treasurySpend",e.consts.treasury?.spendPeriod]]))))}),[e,t,s]),h})),W=o.zo.main` .calendarFlex { align-items: flex-start; display: flex; @@ -590,7 +590,7 @@ } } } -`,W=n.memo((function({basePath:e,className:s}){const{t}=d(),r=O(),[i,l]=(0,n.useState)((()=>new Date)),[c,u]=(0,n.useState)((()=>p(i,i))),[h,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(m(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)}))),[]),k=(0,n.useCallback)((e=>u((({dateMonth:s})=>{const t=new Date(s);return t.setDate(e),p(t,t)}))),[]),N=(0,n.useCallback)((e=>x(e)),[]);return(0,a.jsxs)(q,{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:g.current}),(0,a.jsxs)("div",{className:"calendarFlex",children:[(0,a.jsx)(D,{hasNextMonth:b,lastDay:j,now:i,scheduled:r,setDay:k,setNextMonth:v,setPrevMonth:y,state:c}),(0,a.jsx)("div",{className:"wrapper-style",children:h?(0,a.jsx)(M,{className:"upcoming-events",scheduled:r,setView:N}):(0,a.jsx)(S,{date:c.dateSelected,hasNextDay:f,now:i,scheduled:r,setNextDay:C,setPrevDay:w,setView:N})})]})]})}))},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(48630),c=t(50265),u=t(90778),d=t(9118),h=t(56623),m=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),k=t(48533),N=t(48731),S=t(51330),A=t(85508);function E(e){const s=e.toLowerCase(),t=(0,A.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 I(e,{recovery:s,signature:t}){const a=function(e){const s=(0,C.d)(`Ethereum Signed Message:\n${e.length.toString()}${e}`),t=(0,A.ij)(s);return(0,w.Y)(t)}(e),n=v().recover(a,t,s);return o=v().publicKeyConvert(n,!1).subarray(1),E(`0x${(0,A.Cl)(o).slice(-40)}`);var o}function T(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 D(e,s,t,a,n,o){return a?o||!n?{params:[t,a],tx:e.tx.claims.claim}:{params:[t,a,T(s,n)?.sentence],tx:e.tx.claims.claimAttest}:{}}const P="\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",M=l.zo.div`${P}`,z=n.memo((function({accountId:e,className:s="",ethereumAddress:t,ethereumSignature:o,isOldClaimProcess:r,onSuccess:i,statementKind:c}){const{t:d}=f(),{api:h,systemChain:m}=(0,u.h)(),[p,x]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1);if((0,n.useEffect)((()=>{t&&(v(!0),h.query.claims.claims(t).then((e=>{x(e.unwrapOr(b.nw)),v(!1)})).catch((e=>{console.error(e),v(!1)})))}),[h,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)(M,{className:s,children:[d("Your Ethereum account"),(0,a.jsx)("h2",{children:E(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,...D(h,m,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 F({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=l.zo.div` +`,q=n.memo((function({basePath:e,className:s}){const{t}=d(),r=O(),[i,l]=(0,n.useState)((()=>new Date)),[c,u]=(0,n.useState)((()=>p(i,i))),[h,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(m(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)}))),[]),k=(0,n.useCallback)((e=>u((({dateMonth:s})=>{const t=new Date(s);return t.setDate(e),p(t,t)}))),[]),N=(0,n.useCallback)((e=>x(e)),[]);return(0,a.jsxs)(W,{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:g.current}),(0,a.jsxs)("div",{className:"calendarFlex",children:[(0,a.jsx)(D,{hasNextMonth:b,lastDay:j,now:i,scheduled:r,setDay:k,setNextMonth:v,setPrevMonth:y,state:c}),(0,a.jsx)("div",{className:"wrapper-style",children:h?(0,a.jsx)(M,{className:"upcoming-events",scheduled:r,setView:N}):(0,a.jsx)(S,{date:c.dateSelected,hasNextDay:f,now:i,scheduled:r,setNextDay:C,setPrevDay:w,setView:N})})]})]})}))},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(48630),c=t(50265),u=t(90778),d=t(9118),h=t(56623),m=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),k=t(48533),N=t(48731),S=t(51330),A=t(85508);function I(e){const s=e.toLowerCase(),t=(0,A.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 E(e,{recovery:s,signature:t}){const a=function(e){const s=(0,C.d)(`Ethereum Signed Message:\n${e.length.toString()}${e}`),t=(0,A.ij)(s);return(0,w.Y)(t)}(e),n=v().recover(a,t,s);return o=v().publicKeyConvert(n,!1).subarray(1),I(`0x${(0,A.Cl)(o).slice(-40)}`);var o}function T(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 D(e,s,t,a,n,o){return a?o||!n?{params:[t,a],tx:e.tx.claims.claim}:{params:[t,a,T(s,n)?.sentence],tx:e.tx.claims.claimAttest}:{}}const P="\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",M=l.zo.div`${P}`,z=n.memo((function({accountId:e,className:s="",ethereumAddress:t,ethereumSignature:o,isOldClaimProcess:r,onSuccess:i,statementKind:c}){const{t:d}=f(),{api:h,systemChain:m}=(0,u.h)(),[p,x]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1);if((0,n.useEffect)((()=>{t&&(v(!0),h.query.claims.claims(t).then((e=>{x(e.unwrapOr(b.nw)),v(!1)})).catch((e=>{console.error(e),v(!1)})))}),[h,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)(M,{className:s,children:[d("Your Ethereum account"),(0,a.jsx)("h2",{children:I(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,...D(h,m,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 F({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=l.zo.div` .statement{ border: 1px solid #c2c2c2; background: #f2f2f2; @@ -614,7 +614,7 @@ .statementUrl{ margin-left: 0.3rem } -`,V=n.memo((function({className:e,kind:s,systemChain:t}){const{t:n}=f(),o=T(t,s)?.url;return o?(0,a.jsxs)(L,{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)(F,{statementUrl:o,systemChain:t})})]}):null})),_=l.zo.div`${P}`,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:h}=(0,u.h)(),[m,p]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1);(0,n.useEffect)((()=>{t&&(v(!0),h.query.claims.claims(t).then((e=>{p(e.unwrapOr(b.nw)),v(!1)})).catch((e=>{console.error(e),v(!1)})))}),[h,t]);const y=(0,n.useMemo)((()=>T(i,r)?.sentence),[i,r]);if(j||!m)return null;const C=m.isZero();return C||!y?(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)(_,{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)(_,{className:s,children:[(0,a.jsx)(V,{kind:r,systemChain:i}),(0,a.jsx)("h2",{children:(0,a.jsx)(g.Z,{label:d("Account balance:"),value:m})}),(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:h.tx.claims.attest})})]})}):(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)(_,{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:m})})]})})}));var H=t(15153);const $=l.zo.div` +`,V=n.memo((function({className:e,kind:s,systemChain:t}){const{t:n}=f(),o=T(t,s)?.url;return o?(0,a.jsxs)(L,{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)(F,{statementUrl:o,systemChain:t})})]}):null})),_=l.zo.div`${P}`,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:h}=(0,u.h)(),[m,p]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1);(0,n.useEffect)((()=>{t&&(v(!0),h.query.claims.claims(t).then((e=>{p(e.unwrapOr(b.nw)),v(!1)})).catch((e=>{console.error(e),v(!1)})))}),[h,t]);const y=(0,n.useMemo)((()=>T(i,r)?.sentence),[i,r]);if(j||!m)return null;const C=m.isZero();return C||!y?(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)(_,{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)(_,{className:s,children:[(0,a.jsx)(V,{kind:r,systemChain:i}),(0,a.jsx)("h2",{children:(0,a.jsx)(g.Z,{label:d("Account balance:"),value:m})}),(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:h.tx.claims.attest})})]})}):(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)(_,{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:m})})]})})}));var $=t(15153);const H=l.zo.div` font-size: var(--font-size-h3); display: flex; flex-direction: column; @@ -626,7 +626,7 @@ .ui--AddressMini-address { max-width: 20rem; } -`,B=n.memo((function({className:e}){const{t:s}=f(),t=(0,H.Z)();return t.length?(0,a.jsx)(l.Zb,{isError:!0,children:(0,a.jsxs)($,{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 O;!function(e){e[e.Account=0]="Account",e[e.ETHAddress=1]="ETHAddress",e[e.Sign=2]="Sign",e[e.Claim=3]="Claim"}(O||(O={}));const q="PRECLAIMS_LOADING",W=l.zo.pre` +`,B=n.memo((function({className:e}){const{t:s}=f(),t=(0,$.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 O;!function(e){e[e.Account=0]="Account",e[e.ETHAddress=1]="ETHAddress",e[e.Sign=2]="Sign",e[e.Claim=3]="Claim"}(O||(O={}));const W="PRECLAIMS_LOADING",q=l.zo.pre` cursor: copy; font: var(--font-mono); border: 1px dashed #c2c2c2; @@ -656,7 +656,7 @@ &:-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)(O.Account),[C,A]=(0,n.useState)(null),{api:E,systemChain:D}=(0,u.h)(),{t:P}=f(),[M,F]=(0,n.useState)(q),L=!!M&&M!==q,_=(0,n.useRef)([{isRoot:!0,name:"create",text:P("Claim tokens")}]);(0,n.useEffect)((()=>{if(C){if(v(O.Account),x(null),F(q),!E.query.claims||!E.query.claims.preclaims)return F(null);E.query.claims.preclaims(C).then((e=>{const s=e.unwrapOr(null)?.toString();x(s),F(s)})).catch((e=>{console.error(e),F(null)}))}}),[C,E.query.claims,E.query.claims.preclaims]);const H=!E.tx.claims.claimAttest;(0,n.useEffect)((()=>{s&&setTimeout((()=>{t(!1)}),1e3)}),[s]);const $=(0,n.useCallback)((()=>{v(O.Account)}),[]),J=(0,n.useCallback)((()=>{v(O.Sign)}),[]),G=(0,n.useCallback)((()=>{v(O.Claim)}),[]),Y=(0,n.useCallback)((()=>{L?G():o||H?J():v(O.ETHAddress)}),[o,G,J,L,H]),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,k.G)(e);(0,N.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,N.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",I(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)}),[]),X=(0,n.useCallback)((e=>{x(e.trim())}),[]),K=(0,n.useCallback)((()=>{t(!0)}),[]),ee=(0,d.W7)(!L&&!H&&!!o&&E.query.claims.signing,[o],U),se=T(D,ee)?.sentence||"",te=(0,h.z)(E.consts.claims.prefix.toU8a(!0)),ae=C?`${te}${(0,m.c)((0,p.m)(C),-1,!1)}${se}`:"";return(0,a.jsxs)("main",{children:[(0,a.jsx)(l.mQ,{basePath:e,items:_.current}),!H&&(0,a.jsx)(B,{}),(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:P("1. Select your {{chain}} account",{replace:{chain:D}})}),(0,a.jsx)(l.rp,{defaultValue:C,label:P("claim to account"),onChange:A,type:"all"}),j===O.Account&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:M===q,label:P(M===q?"Loading":"Continue"),onClick:Y})})]}),j>=O.ETHAddress&&!L&&!H&&(0,a.jsxs)(l.Zb,{withBottomMargin:!0,children:[(0,a.jsx)("h2",{children:P("2. Enter the ETH address from the sale.")}),(0,a.jsx)(l.II,{autoFocus:!0,className:"full",label:P("Pre-sale ethereum address"),onChange:X,value:o||""}),j===O.ETHAddress&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:!o,label:P("Continue"),onClick:J})})]}),j>=O.Sign&&!L&&(0,a.jsxs)(l.Zb,{children:[(0,a.jsx)("h2",{children:P("{{step}}. Sign with your ETH address",{replace:{step:H?"2":"3"}})}),!H&&(0,a.jsx)(V,{kind:ee,systemChain:D}),(0,a.jsx)("div",{children:P("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:K,text:ae,children:(0,a.jsx)(W,{"data-for":"tx-payload","data-tip":!0,children:ae})}),(0,a.jsx)(l.u,{place:"right",text:P(s?"copied":"click to copy"),trigger:"tx-payload"}),(0,a.jsx)("div",{children:P("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)(Z,{onChange:Q,placeholder:`{\n "address": "0x ...",\n "msg": "${te}:...",\n "sig": "0x ...",\n "version": "2"\n}`,rows:10}),j===O.Sign&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:!C||!g,label:P("Confirm claim"),onClick:G})})]})]}),(0,a.jsx)(l.P0.Column,{children:C&&j>=O.Claim&&(L?(0,a.jsx)(R,{accountId:C,ethereumAddress:o,onSuccess:$,statementKind:ee,systemChain:D}):(0,a.jsx)(z,{accountId:C,ethereumAddress:o,ethereumSignature:g,isOldClaimProcess:H,onSuccess:$,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(48630),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),h=t(61349);function m(){return(0,h.$G)("app-collator")}const p=n.memo((function({className:e}){const{t:s}=m(),{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=e.query.collatorSelection.candidates||e.query.collatorSelection.candidateList,r=(0,d.W7)(e.query.collatorSelection.invulnerables,[],g),i=(0,d.W7)(o,[],b),l=(0,d.W7)(a&&e.query.collatorSelection.lastAuthoredBlock?.multi,[a],f);return(0,n.useEffect)((()=>r&&i&&t((()=>[...r,...i]))),[i,r]),(0,n.useEffect)((()=>l&&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,l)))),[l]),s})),v=n.memo((function({className:e}){const{t:s}=m(),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}=m(),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:()=>$e});var a=t(52322),n=t(2784),o=t(48630),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),h=t(9118),m=t(14681),p=t(83488),x=t(67557);const g=o.zo.div` +`,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)(O.Account),[C,A]=(0,n.useState)(null),{api:I,systemChain:D}=(0,u.h)(),{t:P}=f(),[M,F]=(0,n.useState)(W),L=!!M&&M!==W,_=(0,n.useRef)([{isRoot:!0,name:"create",text:P("Claim tokens")}]);(0,n.useEffect)((()=>{if(C){if(v(O.Account),x(null),F(W),!I.query.claims||!I.query.claims.preclaims)return F(null);I.query.claims.preclaims(C).then((e=>{const s=e.unwrapOr(null)?.toString();x(s),F(s)})).catch((e=>{console.error(e),F(null)}))}}),[C,I.query.claims,I.query.claims.preclaims]);const $=!I.tx.claims.claimAttest;(0,n.useEffect)((()=>{s&&setTimeout((()=>{t(!1)}),1e3)}),[s]);const H=(0,n.useCallback)((()=>{v(O.Account)}),[]),J=(0,n.useCallback)((()=>{v(O.Sign)}),[]),G=(0,n.useCallback)((()=>{v(O.Claim)}),[]),Y=(0,n.useCallback)((()=>{L?G():o||$?J():v(O.ETHAddress)}),[o,G,J,L,$]),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,k.G)(e);(0,N.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,N.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",E(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)}),[]),X=(0,n.useCallback)((e=>{x(e.trim())}),[]),K=(0,n.useCallback)((()=>{t(!0)}),[]),ee=(0,d.W7)(!L&&!$&&!!o&&I.query.claims.signing,[o],U),se=T(D,ee)?.sentence||"",te=(0,h.z)(I.consts.claims.prefix.toU8a(!0)),ae=C?`${te}${(0,m.c)((0,p.m)(C),-1,!1)}${se}`:"";return(0,a.jsxs)("main",{children:[(0,a.jsx)(l.mQ,{basePath:e,items:_.current}),!$&&(0,a.jsx)(B,{}),(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:P("1. Select your {{chain}} account",{replace:{chain:D}})}),(0,a.jsx)(l.rp,{defaultValue:C,label:P("claim to account"),onChange:A,type:"all"}),j===O.Account&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:M===W,label:P(M===W?"Loading":"Continue"),onClick:Y})})]}),j>=O.ETHAddress&&!L&&!$&&(0,a.jsxs)(l.Zb,{withBottomMargin:!0,children:[(0,a.jsx)("h2",{children:P("2. Enter the ETH address from the sale.")}),(0,a.jsx)(l.II,{autoFocus:!0,className:"full",label:P("Pre-sale ethereum address"),onChange:X,value:o||""}),j===O.ETHAddress&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:!o,label:P("Continue"),onClick:J})})]}),j>=O.Sign&&!L&&(0,a.jsxs)(l.Zb,{children:[(0,a.jsx)("h2",{children:P("{{step}}. Sign with your ETH address",{replace:{step:$?"2":"3"}})}),!$&&(0,a.jsx)(V,{kind:ee,systemChain:D}),(0,a.jsx)("div",{children:P("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:K,text:ae,children:(0,a.jsx)(q,{"data-for":"tx-payload","data-tip":!0,children:ae})}),(0,a.jsx)(l.u,{place:"right",text:P(s?"copied":"click to copy"),trigger:"tx-payload"}),(0,a.jsx)("div",{children:P("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)(Z,{onChange:Q,placeholder:`{\n "address": "0x ...",\n "msg": "${te}:...",\n "sig": "0x ...",\n "version": "2"\n}`,rows:10}),j===O.Sign&&(0,a.jsx)(l.zx.Group,{children:(0,a.jsx)(l.zx,{icon:"sign-in-alt",isDisabled:!C||!g,label:P("Confirm claim"),onClick:G})})]})]}),(0,a.jsx)(l.P0.Column,{children:C&&j>=O.Claim&&(L?(0,a.jsx)(R,{accountId:C,ethereumAddress:o,onSuccess:H,statementKind:ee,systemChain:D}):(0,a.jsx)(z,{accountId:C,ethereumAddress:o,ethereumSignature:g,isOldClaimProcess:$,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(48630),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),h=t(61349);function m(){return(0,h.$G)("app-collator")}const p=n.memo((function({className:e}){const{t:s}=m(),{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=e.query.collatorSelection.candidates||e.query.collatorSelection.candidateList,r=(0,d.W7)(e.query.collatorSelection.invulnerables,[],g),i=(0,d.W7)(o,[],b),l=(0,d.W7)(a&&e.query.collatorSelection.lastAuthoredBlock?.multi,[a],f);return(0,n.useEffect)((()=>r&&i&&t((()=>[...r,...i]))),[i,r]),(0,n.useEffect)((()=>l&&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,l)))),[l]),s})),v=n.memo((function({className:e}){const{t:s}=m(),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}=m(),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(48630),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),h=t(9118),m=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; @@ -719,7 +719,7 @@ padding: 1rem 1rem 0.5rem; width: 100%; } -`,k=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:k}=c(),{api:N}=(0,d.h)(),S=(0,h.W7)(s&&N.query.contracts.contractInfoOf,[s?.address]),[A,E]=(0,n.useState)(!1),[I,T]=(0,n.useState)([]),D=(0,n.useCallback)((e=>{u&&E(e)}),[u]),P=(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(T).catch(console.error)}),[s,i,S]);(0,n.useEffect)((()=>{(A||g)&&S&&s&&P()}),[P,s,A,S,g]);const M=(0,n.useCallback)(((e,s)=>{}),[]),z=(0,n.useCallback)((e=>p&&p(e,M)),[M,p]);return(0,a.jsxs)(w,{className:`${e} ui--Messages ${l?"isLabelled":""}`,children:[b&&(0,a.jsx)(o.xH,{summary:k("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:D,summary:k("Messages ({{count}})",{replace:{count:i.length}}),children:C(i).map((([e,s])=>(0,a.jsx)(v,{index:s,lastResult:I[s],message:e,onSelect:z},s)))}),j&&0!==r.wasm.length&&(0,a.jsx)("div",{children:k("{{size}} WASM bytes",{replace:{size:(0,m.u)(r.wasm.length)}})})]})})),N=()=>{},S=n.memo((function({className:e,contractAbi:s,errorText:t,isDisabled:n,isError:r,isFull:i,isValid:l,label:u,onChange:d,onRemove:h=N,onSelectConstructor:m,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:h&&(0,a.jsx)(o.JH,{icon:"trash",label:f("Remove ABI"),onClick:h}),withLabel:x,children:(0,a.jsx)(k,{contractAbi:s,isLabelled:x,onSelectConstructor:m,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 A=t(30686),E=t(23729),I=t.n(E),T=t(98083),D=t(95267),P=t(54371);const M="code:";class z extends A.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,P.H)(e)?D.statics.api.registry.createType("Hash",e):e).toHex(),a=this.getCode(t),n={...a?a.json:{},...s,codeHash:t,genesisHash:D.statics.api.genesisHash.toHex(),whenCreated:a?.json.whenCreated||Date.now()},o=`${M}${n.codeHash}`;I().set(o,n),this.addCode(o,n)}forgetCode(e){this.removeCode(`${M}${e}`,e)}loadAll(e){try{const s=D.statics.api.genesisHash.toHex();I().each(((e,t)=>{e&&e.genesisHash===s&&t.startsWith(M)&&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 T.P(s.abi,D.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],I().remove(e),this.emit("removed-code")}catch(e){console.error(e)}}}const F=new z;var L=t(11677),V=t(56623);function _(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},H=(0,L.e)("useAbi",(function(e=[null,null],s=null,t=!1){const[a,o]=(0,n.useState)((()=>_(e,t)));return(0,n.useEffect)((()=>o((s=>e[0]&&s.abi!==e[0]?_(e,t):s))),[e,t]),{...a,onChangeAbi:(0,n.useCallback)(((e,t)=>{const a=(0,V.z)(e);try{o({abi:a,abiName:t.replace(".contract","").replace(".json","").replace("_"," "),contractAbi:new T.P(a,D.statics.api.registry.getChainProperties()),errorText:null,isAbiError:!1,isAbiSupplied:!0,isAbiValid:!0}),s&&F.saveCode(s,{abi:a})}catch(e){console.error(e),o({...R,errorText:e.message})}}),[s]),onRemoveAbi:(0,n.useCallback)((()=>{o(R),s&&F.saveCode(s,{abi:null})}),[s])}}));var $=t(74076);const B=n.memo((function({codeHash:e,onChange:s}){const{api:t}=(0,d.h)(),{t:r}=c(),i=(0,h.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,$.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")})})),O=n.memo((function({onClose:e}){const{t:s}=c(),[t,r]=(0,n.useState)(""),[l,d]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),{abi:p,contractAbi:x,errorText:g,isAbiError:b,isAbiSupplied:f,isAbiValid:j,onChangeAbi:v,onRemoveAbi:y}=H(),C=(0,n.useCallback)((()=>{t&&h&&(F.saveCode(t,{abi:p,name:h,tags:[]}),e())}),[p,t,h,e]),w=!(0,i.F)(h)&&h.length>0,k=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)(B,{codeHash:t,onChange:d}),(0,a.jsx)(u,{isError:!w,onChange:m,value:h||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:!k,label:s("Save"),onClick:C})})]})}));var q=t(16613);const W="",Z=(0,o.zo)(q.Z)` +`,k=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:k}=c(),{api:N}=(0,d.h)(),S=(0,h.W7)(s&&N.query.contracts.contractInfoOf,[s?.address]),[A,I]=(0,n.useState)(!1),[E,T]=(0,n.useState)([]),D=(0,n.useCallback)((e=>{u&&I(e)}),[u]),P=(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(T).catch(console.error)}),[s,i,S]);(0,n.useEffect)((()=>{(A||g)&&S&&s&&P()}),[P,s,A,S,g]);const M=(0,n.useCallback)(((e,s)=>{}),[]),z=(0,n.useCallback)((e=>p&&p(e,M)),[M,p]);return(0,a.jsxs)(w,{className:`${e} ui--Messages ${l?"isLabelled":""}`,children:[b&&(0,a.jsx)(o.xH,{summary:k("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:D,summary:k("Messages ({{count}})",{replace:{count:i.length}}),children:C(i).map((([e,s])=>(0,a.jsx)(v,{index:s,lastResult:E[s],message:e,onSelect:z},s)))}),j&&0!==r.wasm.length&&(0,a.jsx)("div",{children:k("{{size}} WASM bytes",{replace:{size:(0,m.u)(r.wasm.length)}})})]})})),N=()=>{},S=n.memo((function({className:e,contractAbi:s,errorText:t,isDisabled:n,isError:r,isFull:i,isValid:l,label:u,onChange:d,onRemove:h=N,onSelectConstructor:m,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:h&&(0,a.jsx)(o.JH,{icon:"trash",label:f("Remove ABI"),onClick:h}),withLabel:x,children:(0,a.jsx)(k,{contractAbi:s,isLabelled:x,onSelectConstructor:m,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 A=t(30686),I=t(23729),E=t.n(I),T=t(98083),D=t(95267),P=t(54371);const M="code:";class z extends A.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,P.H)(e)?D.statics.api.registry.createType("Hash",e):e).toHex(),a=this.getCode(t),n={...a?a.json:{},...s,codeHash:t,genesisHash:D.statics.api.genesisHash.toHex(),whenCreated:a?.json.whenCreated||Date.now()},o=`${M}${n.codeHash}`;E().set(o,n),this.addCode(o,n)}forgetCode(e){this.removeCode(`${M}${e}`,e)}loadAll(e){try{const s=D.statics.api.genesisHash.toHex();E().each(((e,t)=>{e&&e.genesisHash===s&&t.startsWith(M)&&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 T.P(s.abi,D.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],E().remove(e),this.emit("removed-code")}catch(e){console.error(e)}}}const F=new z;var L=t(11677),V=t(56623);function _(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},$=(0,L.e)("useAbi",(function(e=[null,null],s=null,t=!1){const[a,o]=(0,n.useState)((()=>_(e,t)));return(0,n.useEffect)((()=>o((s=>e[0]&&s.abi!==e[0]?_(e,t):s))),[e,t]),{...a,onChangeAbi:(0,n.useCallback)(((e,t)=>{const a=(0,V.z)(e);try{o({abi:a,abiName:t.replace(".contract","").replace(".json","").replace("_"," "),contractAbi:new T.P(a,D.statics.api.registry.getChainProperties()),errorText:null,isAbiError:!1,isAbiSupplied:!0,isAbiValid:!0}),s&&F.saveCode(s,{abi:a})}catch(e){console.error(e),o({...R,errorText:e.message})}}),[s]),onRemoveAbi:(0,n.useCallback)((()=>{o(R),s&&F.saveCode(s,{abi:null})}),[s])}}));var H=t(74076);const B=n.memo((function({codeHash:e,onChange:s}){const{api:t}=(0,d.h)(),{t:r}=c(),i=(0,h.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")})})),O=n.memo((function({onClose:e}){const{t:s}=c(),[t,r]=(0,n.useState)(""),[l,d]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),{abi:p,contractAbi:x,errorText:g,isAbiError:b,isAbiSupplied:f,isAbiValid:j,onChangeAbi:v,onRemoveAbi:y}=$(),C=(0,n.useCallback)((()=>{t&&h&&(F.saveCode(t,{abi:p,name:h,tags:[]}),e())}),[p,t,h,e]),w=!(0,i.F)(h)&&h.length>0,k=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)(B,{codeHash:t,onChange:d}),(0,a.jsx)(u,{isError:!w,onChange:m,value:h||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:!k,label:s("Save"),onClick:C})})]})}));var W=t(16613);const q="",Z=(0,o.zo)(W.Z)` .ui--CodeRow-icon { margin-right: -0.5em; background: #eee; @@ -731,7 +731,7 @@ 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||W),[d,h]=(0,n.useState)(r.tags||[]),[m,p]=(0,n.useState)(r.codeHash||"0x");(0,n.useEffect)((()=>{u(r.name||W),h(r.tags||[]),p(r.codeHash||"0x")}),[r]);const x=(0,n.useCallback)((()=>{c.trim()&&m&&F.saveCode(m,{name:c})}),[m,c]),g=(0,n.useCallback)((()=>{m&&F.saveCode(m,{tags:d})}),[m,d]);return(0,a.jsx)(Z,{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:h,onSaveName:x,onSaveTags:g,tags:l?d:void 0,children:s})})),J=o.zo.tr` +`,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||q),[d,h]=(0,n.useState)(r.tags||[]),[m,p]=(0,n.useState)(r.codeHash||"0x");(0,n.useEffect)((()=>{u(r.name||q),h(r.tags||[]),p(r.codeHash||"0x")}),[r]);const x=(0,n.useCallback)((()=>{c.trim()&&m&&F.saveCode(m,{name:c})}),[m,c]),g=(0,n.useCallback)((()=>{m&&F.saveCode(m,{tags:d})}),[m,d]);return(0,a.jsx)(Z,{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:h,onSaveName:x,onSaveTags:g,tags:l?d:void 0,children:s})})),J=o.zo.tr` .codeHash { div { display: inline; @@ -742,7 +742,7 @@ } } } -`,G=n.memo((function({className:e,code:s,onShowDeploy:t}){const{t:i}=c(),{api:l}=(0,d.h)(),u=(0,h.W7)(l.query.contracts.pristineCode||l.query.contracts.codeStorage,[s.json.codeHash]),[m,p]=(0,r.O)(),{contractAbi:x}=H([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{F.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}),m&&(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)(k,{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:F.getAllCode().map((s=>(0,a.jsx)(G,{code:s,onShowDeploy:e},s.json.codeHash)))})}));var Q=t(75768),X=t(58800),K=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(89176);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:h,percentage:m,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]),k=(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&&k&&f(k)}),[k,f,v]),(0,n.useEffect)((()=>{x(v&&!!r)}),[r,x,v]);const N=!!C&&v;return(0,a.jsx)("div",{className:e,children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Rn,{defaultValue:w&&N?w.toString():void 0,isDisabled:N,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:N?void 0:b,value:N?void 0:r&&v?ne.nw:h,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:k&&N?k.toString():void 0,isDisabled:N,isError:!l,isZeroable:r,label:!k||r&&v?j("max ProofSize allowed"):j("max ProofSize allowed ({{estimatedProofSize}} estimated)",{replace:{estimatedProofSize:k.toString()}}),onChange:N?void 0:f,value:N?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:m.toFixed(2)}})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Rn,{defaultValue:C&&N?C.toString():void 0,isDisabled:N,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:N?void 0:g,value:N?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:m.toFixed(2)}})]})]})})}));var ue=t(56360),de=t(56949);const he=(0,L.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,h]=(0,n.useState)(!1),m=(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:h,setMegaGas:m,setMegaRefTime:p,setProofSize:x,weight:i,weightV2:c}}),[e,s,u,t,a,r,l,h,m,p,x])})),me=n.memo((function({onClose:e}){const{t:s}=c(),{api:t}=(0,d.h)(),[r,l]=(0,X.F)(),[h,m,p]=(0,K.t)(),[[x,g],f]=(0,n.useState)([null,null]),[j,v]=(0,n.useState)(0),[y,C,w]=(0,ee.Y)(ne.nw),[k,N]=(0,n.useState)([]),[[A,E],I]=(0,n.useState)([null,!1]),[T,D,P]=(0,se.n)(),{abiName:M,contractAbi:z,errorText:L,isAbiError:V,isAbiSupplied:_,isAbiValid:R,onChangeAbi:$,onRemoveAbi:B}=H(),O=he(),q=(0,n.useMemo)((()=>R&&E&&A&&z?new Q.wi(t,z,A):null),[t,z,R,E,A]),W=(0,n.useMemo)((()=>z?z.constructors.map(((e,s)=>({info:e.identifier,key:e.identifier,text:(0,a.jsx)(b,{asConstructor:!0,message:e}),value:s}))):[]),[z]);(0,n.useEffect)((()=>{v(0)}),[W]),(0,n.useEffect)((()=>{N([])}),[z,j]),(0,n.useEffect)((()=>{I(z&&(0,oe.F)(z.info.source.wasm)?[z.info.source.wasm,!0]:[null,!1])}),[z]),(0,n.useEffect)((()=>{M&&P(M)}),[M,P]),(0,n.useEffect)((()=>{(async function(){let e=null,s=null;try{if(q&&z?.constructors[j]?.method&&y&&r){const s=[r,z?.constructors[j].isPayable?t.registry.createType("Balance",y):t.registry.createType("Balance",ne.nw),O.weightV2,null,{Upload:t.registry.createType("Raw",A)},z?.constructors[j]?.toU8a(k),""],a=await t.call.contractsApi.instantiate(...s);e=q.tx[z.constructors[j].method]({gasLimit:a.gasRequired,storageDepositLimit:a.storageDeposit.isCharge?a.storageDeposit.asCharge:null,value:z?.constructors[j].isPayable?y:void 0},...k)}}catch(e){s=e.message}f((()=>[e,s]))})().catch((e=>console.error(e)))}),[r,A,t,q,z,j,y,k,O]);const Z=(0,n.useCallback)(((e,s)=>{I([e,(0,oe.F)(e)]),P(s.replace(".wasm","").replace("_"," "))}),[P]),U=(0,n.useCallback)((e=>{e.blueprint&&F.saveCode(e.blueprint.codeHash,{abi:(0,re.P)(e.blueprint.abi.json),name:T||"<>",tags:[]}),e.contract&&ae.Nn.saveContract(e.contract.address.toString(),{contract:{abi:(0,re.P)(e.contract.abi.json),genesisHash:t.genesisHash.toHex()},name:T||"<>",tags:[]})}),[t,T]),J=!!r&&!(0,i.F)(T)&&D&&E&&_&&R&&!!x&&2===h,G=V||!_;return(0,a.jsxs)(o.u_,{header:s("Upload & deploy code {{info}}",{replace:{info:`${h}/2`}}),onClose:e,children:[(0,a.jsxs)(o.u_.Content,{children:[1===h&&(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("transferable"),params:r}),onChange:l,type:"account",value:r}),(0,a.jsx)(S,{contractAbi:z,errorText:L,isError:G,isSupplied:_,isValid:R,label:s("json for either ABI or .contract bundle"),onChange:$,onRemove:B,withWasm:!0}),!G&&z&&(0,a.jsxs)(a.Fragment,{children:[!z.info.source.wasm.length&&(0,a.jsx)(o.ht,{isError:!E,label:s("compiled contract WASM"),onChange:Z,placeholder:A&&!E&&s("The code is not recognized as being in valid WASM format")}),(0,a.jsx)(u,{isError:!D,onChange:P,value:T||void 0})]})]}),2===h&&z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Lt,{isDisabled:z.constructors.length<=1,label:s("deployment constructor"),onChange:v,options:W,value:j}),(0,a.jsx)(le,{onChange:N,params:z.constructors[j].args,registry:z.registry}),z.constructors[j].isPayable&&(0,a.jsx)(o.H,{isError:!C,isZeroable:!0,label:s("value"),onChange:w,value:y}),(0,a.jsx)(ce,{weight:O}),g&&(0,a.jsx)(o.oy,{content:g})]})]}),(0,a.jsxs)(o.u_.Actions,{children:[1===h?(0,a.jsx)(o.zx,{icon:"step-forward",isDisabled:!q||!z,label:s("Next"),onClick:m}):(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,L.e)("useCodes",(function(){const e=(0,pe.X)(),[s,t]=(0,n.useState)(xe);return(0,n.useEffect)((()=>{const s=()=>{e.current&&t({allCodes:F.getAllCode(),codeTrigger:Date.now()})};F.on("new-code",s),F.on("removed-code",s),F.loadAll(s)}),[]),s}));var be=t(17965);const fe={allContracts:[],hasContracts:!1,isContract:()=>!1},je=(0,L.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,h.W7)(r.query.contracts.contractInfoOf,[e]),[l,u]=(0,n.useState)(!1),[m,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&&m)}),[l,m,s]),m||!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,h]=(0,n.useState)(!1),[m,p,x]=(0,se.n)("New Contract"),{abi:g,contractAbi:b,errorText:f,isAbiError:j,isAbiSupplied:v,isAbiValid:y,onChangeAbi:C,onRemoveAbi:w}=H([null,null],null,!0),k=(0,n.useCallback)((()=>{const s={action:"create"};if(r&&g&&m)try{const a={contract:{abi:g,genesisHash:t.genesisHash.toHex()},name:m,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,m,e]),N=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:m,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:h}),(0,a.jsx)(u,{isContract:!0,isError:!p,onChange:x,value:m||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:!N,label:s("Save"),onClick:k})})]})}));var Ce=t(27421),we=t(48801),ke=t.n(we);const Ne=o.zo.div` +`,G=n.memo((function({className:e,code:s,onShowDeploy:t}){const{t:i}=c(),{api:l}=(0,d.h)(),u=(0,h.W7)(l.query.contracts.pristineCode||l.query.contracts.codeStorage,[s.json.codeHash]),[m,p]=(0,r.O)(),{contractAbi:x}=$([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{F.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}),m&&(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)(k,{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:F.getAllCode().map((s=>(0,a.jsx)(G,{code:s,onShowDeploy:e},s.json.codeHash)))})}));var Q=t(75768),X=t(58800),K=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(89176);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:h,percentage:m,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]),k=(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&&k&&f(k)}),[k,f,v]),(0,n.useEffect)((()=>{x(v&&!!r)}),[r,x,v]);const N=!!C&&v;return(0,a.jsx)("div",{className:e,children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Rn,{defaultValue:w&&N?w.toString():void 0,isDisabled:N,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:N?void 0:b,value:N?void 0:r&&v?ne.nw:h,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:k&&N?k.toString():void 0,isDisabled:N,isError:!l,isZeroable:r,label:!k||r&&v?j("max ProofSize allowed"):j("max ProofSize allowed ({{estimatedProofSize}} estimated)",{replace:{estimatedProofSize:k.toString()}}),onChange:N?void 0:f,value:N?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:m.toFixed(2)}})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Rn,{defaultValue:C&&N?C.toString():void 0,isDisabled:N,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:N?void 0:g,value:N?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:m.toFixed(2)}})]})]})})}));var ue=t(56360),de=t(56949);const he=(0,L.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,h]=(0,n.useState)(!1),m=(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:h,setMegaGas:m,setMegaRefTime:p,setProofSize:x,weight:i,weightV2:c}}),[e,s,u,t,a,r,l,h,m,p,x])})),me=n.memo((function({onClose:e}){const{t:s}=c(),{api:t}=(0,d.h)(),[r,l]=(0,X.F)(),[h,m,p]=(0,K.t)(),[[x,g],f]=(0,n.useState)([null,null]),[j,v]=(0,n.useState)(0),[y,C,w]=(0,ee.Y)(ne.nw),[k,N]=(0,n.useState)([]),[[A,I],E]=(0,n.useState)([null,!1]),[T,D,P]=(0,se.n)(),{abiName:M,contractAbi:z,errorText:L,isAbiError:V,isAbiSupplied:_,isAbiValid:R,onChangeAbi:H,onRemoveAbi:B}=$(),O=he(),W=(0,n.useMemo)((()=>R&&I&&A&&z?new Q.wi(t,z,A):null),[t,z,R,I,A]),q=(0,n.useMemo)((()=>z?z.constructors.map(((e,s)=>({info:e.identifier,key:e.identifier,text:(0,a.jsx)(b,{asConstructor:!0,message:e}),value:s}))):[]),[z]);(0,n.useEffect)((()=>{v(0)}),[q]),(0,n.useEffect)((()=>{N([])}),[z,j]),(0,n.useEffect)((()=>{E(z&&(0,oe.F)(z.info.source.wasm)?[z.info.source.wasm,!0]:[null,!1])}),[z]),(0,n.useEffect)((()=>{M&&P(M)}),[M,P]),(0,n.useEffect)((()=>{(async function(){let e=null,s=null;try{if(W&&z?.constructors[j]?.method&&y&&r){const s=[r,z?.constructors[j].isPayable?t.registry.createType("Balance",y):t.registry.createType("Balance",ne.nw),O.weightV2,null,{Upload:t.registry.createType("Raw",A)},z?.constructors[j]?.toU8a(k),""],a=await t.call.contractsApi.instantiate(...s);e=W.tx[z.constructors[j].method]({gasLimit:a.gasRequired,storageDepositLimit:a.storageDeposit.isCharge?a.storageDeposit.asCharge:null,value:z?.constructors[j].isPayable?y:void 0},...k)}}catch(e){s=e.message}f((()=>[e,s]))})().catch((e=>console.error(e)))}),[r,A,t,W,z,j,y,k,O]);const Z=(0,n.useCallback)(((e,s)=>{E([e,(0,oe.F)(e)]),P(s.replace(".wasm","").replace("_"," "))}),[P]),U=(0,n.useCallback)((e=>{e.blueprint&&F.saveCode(e.blueprint.codeHash,{abi:(0,re.P)(e.blueprint.abi.json),name:T||"<>",tags:[]}),e.contract&&ae.Nn.saveContract(e.contract.address.toString(),{contract:{abi:(0,re.P)(e.contract.abi.json),genesisHash:t.genesisHash.toHex()},name:T||"<>",tags:[]})}),[t,T]),J=!!r&&!(0,i.F)(T)&&D&&I&&_&&R&&!!x&&2===h,G=V||!_;return(0,a.jsxs)(o.u_,{header:s("Upload & deploy code {{info}}",{replace:{info:`${h}/2`}}),onClose:e,children:[(0,a.jsxs)(o.u_.Content,{children:[1===h&&(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("transferable"),params:r}),onChange:l,type:"account",value:r}),(0,a.jsx)(S,{contractAbi:z,errorText:L,isError:G,isSupplied:_,isValid:R,label:s("json for either ABI or .contract bundle"),onChange:H,onRemove:B,withWasm:!0}),!G&&z&&(0,a.jsxs)(a.Fragment,{children:[!z.info.source.wasm.length&&(0,a.jsx)(o.ht,{isError:!I,label:s("compiled contract WASM"),onChange:Z,placeholder:A&&!I&&s("The code is not recognized as being in valid WASM format")}),(0,a.jsx)(u,{isError:!D,onChange:P,value:T||void 0})]})]}),2===h&&z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Lt,{isDisabled:z.constructors.length<=1,label:s("deployment constructor"),onChange:v,options:q,value:j}),(0,a.jsx)(le,{onChange:N,params:z.constructors[j].args,registry:z.registry}),z.constructors[j].isPayable&&(0,a.jsx)(o.H,{isError:!C,isZeroable:!0,label:s("value"),onChange:w,value:y}),(0,a.jsx)(ce,{weight:O}),g&&(0,a.jsx)(o.oy,{content:g})]})]}),(0,a.jsxs)(o.u_.Actions,{children:[1===h?(0,a.jsx)(o.zx,{icon:"step-forward",isDisabled:!W||!z,label:s("Next"),onClick:m}):(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,L.e)("useCodes",(function(){const e=(0,pe.X)(),[s,t]=(0,n.useState)(xe);return(0,n.useEffect)((()=>{const s=()=>{e.current&&t({allCodes:F.getAllCode(),codeTrigger:Date.now()})};F.on("new-code",s),F.on("removed-code",s),F.loadAll(s)}),[]),s}));var be=t(17965);const fe={allContracts:[],hasContracts:!1,isContract:()=>!1},je=(0,L.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,h.W7)(r.query.contracts.contractInfoOf,[e]),[l,u]=(0,n.useState)(!1),[m,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&&m)}),[l,m,s]),m||!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,h]=(0,n.useState)(!1),[m,p,x]=(0,se.n)("New Contract"),{abi:g,contractAbi:b,errorText:f,isAbiError:j,isAbiSupplied:v,isAbiValid:y,onChangeAbi:C,onRemoveAbi:w}=$([null,null],null,!0),k=(0,n.useCallback)((()=>{const s={action:"create"};if(r&&g&&m)try{const a={contract:{abi:g,genesisHash:t.genesisHash.toHex()},name:m,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,m,e]),N=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:m,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:h}),(0,a.jsx)(u,{isContract:!0,isError:!p,onChange:x,value:m||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:!N,label:s("Save"),onClick:k})})]})}));var Ce=t(27421),we=t(48801),ke=t.n(we);const Ne=o.zo.div` align-items: center; display: flex; @@ -750,7 +750,7 @@ 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)(Ne,{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 Ae=t(73477);const Ee=new(ke())(5e12).isub(ne.If),Ie=(0,o.zo)(o.u_)` +`,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)(Ne,{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 Ae=t(73477);const Ie=new(ke())(5e12).isub(ne.If),Ee=(0,o.zo)(o.u_)` .rpc-toggle { margin-top: 1rem; display: flex; @@ -764,33 +764,33 @@ .outcomes { margin-top: 1rem; } -`,Te=n.memo((function({className:e="",contract:s,messageIndex:t,onCallResult:i,onChangeMessage:l,onClose:u}){const{t:h}=c(),{api:m}=(0,d.h)(),p=s.abi.messages[t],[x,g]=(0,X.F)(),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[C,w,k]=(0,ee.Y)(ne.nw),[N,S]=(0,n.useState)([]),[A,E]=(0,n.useState)(null),[I,T]=(0,n.useState)([]),[D,P]=(0,r.O)(),M=he(),z=(0,Ce.N)(C),F=(0,Ce.N)(I);(0,n.useEffect)((()=>{j(null),y(null),T([])}),[s,t]),(0,n.useEffect)((()=>{(async function(){if(x&&C&&p.isMutating){const e=[x,s.address,p.isPayable?m.registry.createType("Balance",C):m.registry.createType("Balance",ne.nw),M.weightV2,null,p.toU8a(I)],t=await m.call.contractsApi.call(...e);E((()=>{try{return s.tx[p.method]({gasLimit:t.gasRequired,storageDepositLimit:t.storageDeposit.isCharge?t.storageDeposit.asCharge:null,value:p.isPayable?C:0},...I)}catch{return null}}))}})().catch((e=>console.error(e)))}),[m,x,s,p,C,M,I]),(0,n.useEffect)((()=>{x&&p&&F&&z&&s.query[p.method](x,{gasLimit:-1,storageDepositLimit:null,value:p.isPayable?z:0},...F).then((({gasRequired:e,result:s})=>{M.isWeightV2?y(s.isOk?m.registry.createType("WeightV2",e):null):j(s.isOk?e.refTime.toBn():null)})).catch((()=>{j(null),y(null)}))}),[m,x,s,p,F,z,M.isWeightV2]);const L=(0,n.useCallback)((()=>{x&&p&&C&&M&&s.query[p.method](x,{gasLimit:M.isWeightV2?M.weightV2:M.isEmpty?-1:M.weight,storageDepositLimit:null,value:p.isPayable?C:0},...I).then((e=>{S([{...e,from:x,message:p,params:I,when:new Date},...N]),i&&i(t,e)})).catch((e=>{console.error(e),i&&i(t)}))}),[x,s.query,p,t,i,N,I,C,M]),V=(0,n.useCallback)((e=>()=>S([...N.filter(((s,t)=>t!==e))])),[N]),_=!!(x&&M.isValid&&w),R=D||!p.isMutating&&!p.isPayable;return(0,a.jsxs)(Ie,{className:`${e} app--contracts-Modal`,header:h("Call a contract"),onClose:u,children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.rp,{isDisabled:!0,label:h("contract to use"),type:"contract",value:s.address}),(0,a.jsx)(o.rp,{defaultValue:x,label:h("call from account"),labelExtra:(0,a.jsx)(te.Z,{label:h("transferable"),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:h("message to send"),onChange:l,options:(H=s,H?.abi.messages.map(((e,s)=>({key:e.identifier,text:(0,a.jsx)(b,{message:e}),value:s})))||[]),value:t}),(0,a.jsx)(le,{onChange:T,params:p?p.args:void 0,registry:s.abi.registry})]}),p.isPayable&&(0,a.jsx)(o.H,{isError:!w,isZeroable:!0,label:h("value"),onChange:k,value:C}),(0,a.jsx)(ce,{estimatedWeight:p.isMutating?f:Ee,estimatedWeightV2:p.isMutating?v:m.registry.createType("WeightV2",{proofSize:new(ke())(1e6),refTIme:Ee}),isCall:!p.isMutating,weight:M}),p.isMutating&&(0,a.jsx)(o.ZD,{className:"rpc-toggle",label:h("read contract only, no execution"),onChange:P,value:D}),N.length>0&&(0,a.jsx)(o.xH,{className:"outcomes",isOpen:!0,summary:h("Call results"),children:N.map(((e,s)=>(0,a.jsx)(Se,{onClear:V(s),outcome:e},`outcome-${s}`)))})]}),(0,a.jsx)(o.u_.Actions,{children:R?(0,a.jsx)(o.zx,{icon:"sign-in-alt",isDisabled:!_,label:h("Read"),onClick:L}):(0,a.jsx)(o.cA,{accountId:x,extrinsic:A,icon:"sign-in-alt",isDisabled:!_||!A,label:h("Execute"),onStart:u})})]});var H}));var De=t(1346);function Pe(e){return e.unwrapOr(null)}const Me=o.zo.tr` +`,Te=n.memo((function({className:e="",contract:s,messageIndex:t,onCallResult:i,onChangeMessage:l,onClose:u}){const{t:h}=c(),{api:m}=(0,d.h)(),p=s.abi.messages[t],[x,g]=(0,X.F)(),[f,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[C,w,k]=(0,ee.Y)(ne.nw),[N,S]=(0,n.useState)([]),[A,I]=(0,n.useState)(null),[E,T]=(0,n.useState)([]),[D,P]=(0,r.O)(),M=he(),z=(0,Ce.N)(C),F=(0,Ce.N)(E);(0,n.useEffect)((()=>{j(null),y(null),T([])}),[s,t]),(0,n.useEffect)((()=>{(async function(){if(x&&C&&p.isMutating){const e=[x,s.address,p.isPayable?m.registry.createType("Balance",C):m.registry.createType("Balance",ne.nw),M.weightV2,null,p.toU8a(E)],t=await m.call.contractsApi.call(...e);I((()=>{try{return s.tx[p.method]({gasLimit:t.gasRequired,storageDepositLimit:t.storageDeposit.isCharge?t.storageDeposit.asCharge:null,value:p.isPayable?C:0},...E)}catch{return null}}))}})().catch((e=>console.error(e)))}),[m,x,s,p,C,M,E]),(0,n.useEffect)((()=>{x&&p&&F&&z&&s.query[p.method](x,{gasLimit:-1,storageDepositLimit:null,value:p.isPayable?z:0},...F).then((({gasRequired:e,result:s})=>{M.isWeightV2?y(s.isOk?m.registry.createType("WeightV2",e):null):j(s.isOk?e.refTime.toBn():null)})).catch((()=>{j(null),y(null)}))}),[m,x,s,p,F,z,M.isWeightV2]);const L=(0,n.useCallback)((()=>{x&&p&&C&&M&&s.query[p.method](x,{gasLimit:M.isWeightV2?M.weightV2:M.isEmpty?-1:M.weight,storageDepositLimit:null,value:p.isPayable?C:0},...E).then((e=>{S([{...e,from:x,message:p,params:E,when:new Date},...N]),i&&i(t,e)})).catch((e=>{console.error(e),i&&i(t)}))}),[x,s.query,p,t,i,N,E,C,M]),V=(0,n.useCallback)((e=>()=>S([...N.filter(((s,t)=>t!==e))])),[N]),_=!!(x&&M.isValid&&w),R=D||!p.isMutating&&!p.isPayable;return(0,a.jsxs)(Ee,{className:`${e} app--contracts-Modal`,header:h("Call a contract"),onClose:u,children:[(0,a.jsxs)(o.u_.Content,{children:[(0,a.jsx)(o.rp,{isDisabled:!0,label:h("contract to use"),type:"contract",value:s.address}),(0,a.jsx)(o.rp,{defaultValue:x,label:h("call from account"),labelExtra:(0,a.jsx)(te.Z,{label:h("transferable"),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:h("message to send"),onChange:l,options:($=s,$?.abi.messages.map(((e,s)=>({key:e.identifier,text:(0,a.jsx)(b,{message:e}),value:s})))||[]),value:t}),(0,a.jsx)(le,{onChange:T,params:p?p.args:void 0,registry:s.abi.registry})]}),p.isPayable&&(0,a.jsx)(o.H,{isError:!w,isZeroable:!0,label:h("value"),onChange:k,value:C}),(0,a.jsx)(ce,{estimatedWeight:p.isMutating?f:Ie,estimatedWeightV2:p.isMutating?v:m.registry.createType("WeightV2",{proofSize:new(ke())(1e6),refTIme:Ie}),isCall:!p.isMutating,weight:M}),p.isMutating&&(0,a.jsx)(o.ZD,{className:"rpc-toggle",label:h("read contract only, no execution"),onChange:P,value:D}),N.length>0&&(0,a.jsx)(o.xH,{className:"outcomes",isOpen:!0,summary:h("Call results"),children:N.map(((e,s)=>(0,a.jsx)(Se,{onClear:V(s),outcome:e},`outcome-${s}`)))})]}),(0,a.jsx)(o.u_.Actions,{children:R?(0,a.jsx)(o.zx,{icon:"sign-in-alt",isDisabled:!_,label:h("Read"),onClick:L}):(0,a.jsx)(o.cA,{accountId:x,extrinsic:A,icon:"sign-in-alt",isDisabled:!_||!A,label:h("Execute"),onStart:u})})]});var $}));var De=t(1346);function Pe(e){return e.unwrapOr(null)}const Me=o.zo.tr` td.top a+a { margin-left: 0.75rem; } -`,ze=n.memo((function({className:e,contract:s,index:t,links:i,onCall:l}){const{t:u}=c(),{api:m}=(0,d.h)(),p=(0,h.W7)(m.query.contracts.contractInfoOf,[s.address],{transform:Pe}),[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)(Me,{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)(k,{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,De.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 Fe=n.memo((function({contracts:e}){const{t:s}=c(),{api:t}=(0,d.h)(),r=(0,h.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,m.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,Ae.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})))),[]),k=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)(ze,{contract:e,index:s,links:b[e.address.toString()],onCall:C},e.address.toString())))}),x&&k&&(0,a.jsx)(Te,{contract:k,messageIndex:l,onCallResult:u,onChangeMessage:w,onClose:y})]})}));var Le=t(52926);const Ve=n.memo((function({codeHash:e,constructorIndex:s=0,onClose:t,setConstructorIndex:r}){const{t:i}=c(),{api:l}=(0,d.h)(),[h,m]=(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,k]=(0,n.useState)((()=>(0,Le.f)())),[N,A]=(0,n.useState)(!1),E=he();(0,n.useEffect)((()=>{C([])}),[s]);const I=(0,n.useMemo)((()=>F.getCode(e)),[e]),[T,D,P]=(0,se.n)(I?.json.name),{contractAbi:M,errorText:z,isAbiError:L,isAbiSupplied:V,isAbiValid:_,onChangeAbi:R,onRemoveAbi:B}=H([I?.json.abi,I?.contractAbi],e,!0),O=(0,n.useMemo)((()=>_&&e&&M?new Q.b8(l,M,e):null),[l,e,M,_]),q=(0,n.useMemo)((()=>M?M.constructors.map(((e,s)=>({info:e.identifier,key:e.identifier,text:(0,a.jsx)(b,{asConstructor:!0,message:e}),value:s}))):[]),[M]);(0,n.useEffect)((()=>{f&&m((()=>{if(O&&M?.constructors[s]?.method)try{return O.tx[M.constructors[s].method]({gasLimit:E.isWeightV2?E.weightV2:E.weight,salt:N?w:null,storageDepositLimit:null,value:M?.constructors[s].isPayable?f:void 0},...y)}catch{return null}return null}))}),[O,M,s,f,y,w,E,N]);const W=(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:T||void 0,tags:[]}),t&&t())}),[l,T,t]),Z=!N||w&&(!w.startsWith("0x")||(0,$.vq)(w)),U=D&&j&&E.isValid&&x&&Z;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("transferable"),params:p}),onChange:g,type:"account",value:p}),(0,a.jsx)(u,{isContract:!0,isError:!D,onChange:P,value:T||""}),!V&&(0,a.jsx)(S,{contractAbi:M,errorText:z,isError:L,isSupplied:V,isValid:_,onChange:R,onRemove:B}),M&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Lt,{isDisabled:M.constructors.length<=1,label:i("deployment constructor"),onChange:r,options:q,value:s}),(0,a.jsx)(le,{onChange:C,params:M.constructors[s]?.args,registry:M.registry})]}),M?.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:!N,label:i("unique deployment salt"),labelExtra:(0,a.jsx)(o.ZD,{label:i("use deployment salt"),onChange:A,value:N}),onChange:k,placeholder:i("0x prefixed hex, e.g. 0x1234 or ascii data"),value:N?w:i("")}),(0,a.jsx)(ce,{weight:E})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:p,extrinsic:h,icon:"upload",isDisabled:!U||!h,label:i("Deploy"),onClick:t,onSuccess:W,withSpinner:!0})})]})})),_e=n.memo((function({trigger:e}){const{t:s}=c(),{api:t}=(0,d.h)(),r=(0,h.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,m.u)(r)})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(o.Jy,{label:s("code hashes"),children:(0,m.u)(u)}),(0,a.jsx)(o.Jy,{label:s("contracts"),children:(0,m.u)(i)})]})]})})),Re=o.zo.div` +`,ze=n.memo((function({className:e,contract:s,index:t,links:i,onCall:l}){const{t:u}=c(),{api:m}=(0,d.h)(),p=(0,h.W7)(m.query.contracts.contractInfoOf,[s.address],{transform:Pe}),[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)(Me,{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)(k,{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,De.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 Fe=n.memo((function({contracts:e}){const{t:s}=c(),{api:t}=(0,d.h)(),r=(0,h.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,m.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,Ae.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})))),[]),k=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)(ze,{contract:e,index:s,links:b[e.address.toString()],onCall:C},e.address.toString())))}),x&&k&&(0,a.jsx)(Te,{contract:k,messageIndex:l,onCallResult:u,onChangeMessage:w,onClose:y})]})}));var Le=t(52926);const Ve=n.memo((function({codeHash:e,constructorIndex:s=0,onClose:t,setConstructorIndex:r}){const{t:i}=c(),{api:l}=(0,d.h)(),[h,m]=(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,k]=(0,n.useState)((()=>(0,Le.f)())),[N,A]=(0,n.useState)(!1),I=he();(0,n.useEffect)((()=>{C([])}),[s]);const E=(0,n.useMemo)((()=>F.getCode(e)),[e]),[T,D,P]=(0,se.n)(E?.json.name),{contractAbi:M,errorText:z,isAbiError:L,isAbiSupplied:V,isAbiValid:_,onChangeAbi:R,onRemoveAbi:B}=$([E?.json.abi,E?.contractAbi],e,!0),O=(0,n.useMemo)((()=>_&&e&&M?new Q.b8(l,M,e):null),[l,e,M,_]),W=(0,n.useMemo)((()=>M?M.constructors.map(((e,s)=>({info:e.identifier,key:e.identifier,text:(0,a.jsx)(b,{asConstructor:!0,message:e}),value:s}))):[]),[M]);(0,n.useEffect)((()=>{f&&m((()=>{if(O&&M?.constructors[s]?.method)try{return O.tx[M.constructors[s].method]({gasLimit:I.isWeightV2?I.weightV2:I.weight,salt:N?w:null,storageDepositLimit:null,value:M?.constructors[s].isPayable?f:void 0},...y)}catch{return null}return null}))}),[O,M,s,f,y,w,I,N]);const q=(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:T||void 0,tags:[]}),t&&t())}),[l,T,t]),Z=!N||w&&(!w.startsWith("0x")||(0,H.vq)(w)),U=D&&j&&I.isValid&&x&&Z;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("transferable"),params:p}),onChange:g,type:"account",value:p}),(0,a.jsx)(u,{isContract:!0,isError:!D,onChange:P,value:T||""}),!V&&(0,a.jsx)(S,{contractAbi:M,errorText:z,isError:L,isSupplied:V,isValid:_,onChange:R,onRemove:B}),M&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Lt,{isDisabled:M.constructors.length<=1,label:i("deployment constructor"),onChange:r,options:W,value:s}),(0,a.jsx)(le,{onChange:C,params:M.constructors[s]?.args,registry:M.registry})]}),M?.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:!N,label:i("unique deployment salt"),labelExtra:(0,a.jsx)(o.ZD,{label:i("use deployment salt"),onChange:A,value:N}),onChange:k,placeholder:i("0x prefixed hex, e.g. 0x1234 or ascii data"),value:N?w:i("")}),(0,a.jsx)(ce,{weight:I})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.cA,{accountId:p,extrinsic:h,icon:"upload",isDisabled:!U||!h,label:i("Deploy"),onClick:t,onSuccess:q,withSpinner:!0})})]})})),_e=n.memo((function({trigger:e}){const{t:s}=c(),{api:t}=(0,d.h)(),r=(0,h.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,m.u)(r)})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(o.Jy,{label:s("code hashes"),children:(0,m.u)(u)}),(0,a.jsx)(o.Jy,{label:s("contracts"),children:(0,m.u)(i)})]})]})})),Re=o.zo.div` .ui--Table td > article { background: transparent; border: none; margin: 0; padding: 0; } -`,He=n.memo((function({className:e=""}){const{t:s}=c(),{allCodes:t,codeTrigger:i}=ge(),{allContracts:l}=je(),[u,d]=(0,r.O)(),[h,m,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),m()}),[t,m]),k=(0,n.useCallback)((()=>p(!1)),[p]);return(0,a.jsxs)(Re,{className:e,children:[(0,a.jsx)(_e,{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)(Fe,{contracts:l,updated:i}),(0,a.jsx)(Y,{onShowDeploy:w,updated:i}),j&&h&&(0,a.jsx)(Ve,{codeHash:j,constructorIndex:y,onClose:k,setConstructorIndex:C}),b&&(0,a.jsx)(me,{onClose:f}),x&&(0,a.jsx)(O,{onClose:g}),u&&(0,a.jsx)(ye,{onClose:d})]})})),$e=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)(He,{})]})}))},1642:(e,s,t)=>{t.d(s,{Z:()=>A});var a=t(52322),n=t(2784),o=t(48630),r=t(90778),i=t(71566),l=t(9118),c=t(48801),u=t.n(c),d=t(61349);function h(){return(0,d.$G)("app-coretime")}var m=t(52953);const p={kusama:285768,polkadot:282525},x=(e,s)=>{if(!s||!e)return console.error("Invalid input: one or more inputs are missing"),null;const t=(new Date).getTime();try{const n=new(u())(m.SB.BlockTime),o=new(u())(m.SB.BlocksPerTimeslice),r=new(u())(s),i=new(u())(t),l=new(u())(e).mul(o).sub(r).mul(n),c=i.add(l);return`${(a=new Date(c.toNumber())).getDate()} ${a.toLocaleString("default",{month:"short"})} ${a.getFullYear()}`}catch(e){return console.error("Error in calculation:",e),null}var a},g=n.memo((function({api:e,config:s,parachainCount:t,saleInfo:r,status:i}){const{t:c}=h(),d=r.regionEnd-s.regionLength,m=r.regionEnd-2*s.regionLength,g=(0,l.W7)(e?.rpc.system.chain)?.toString().toLowerCase(),b=(0,n.useMemo)((()=>g&&d&&Math.floor((d-p[g])/s.regionLength)),[d,g,s]);return(0,a.jsxs)(o.Ty,{children:[(0,a.jsxs)("section",{children:[(0,a.jsx)(o.Jy,{label:c("timeslice"),children:i?.lastTimeslice}),(0,a.jsx)(o.Jy,{label:c("cores sold"),children:`${r?.coresSold} / ${r?.coresOffered}`}),(0,a.jsx)(o.Jy,{label:c("parachains"),children:t&&t}),i&&(0,a.jsx)(o.Jy,{label:c("cycle number"),children:(0,a.jsx)("div",{children:b})}),s&&i&&(0,a.jsx)(o.Jy,{className:"media--800",label:c("cycle progress"),progress:{isBlurred:!1,total:new(u())(s?.regionLength),value:new(u())(s?.regionLength-(d-i.lastTimeslice)),withTime:!1}})]}),(0,a.jsxs)("section",{className:"media--1200",children:[i&&(0,a.jsx)(o.Jy,{label:c("cycle dates"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:x(m,80*i?.lastTimeslice)}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:x(d,80*i?.lastTimeslice)})]})}),i&&(0,a.jsx)(o.Jy,{label:c("cycle ts"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:m}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:d})]})})]})]})}));var b,f,j=t(38894),v=t(14681),y=t(92730);(f=b||(b={}))[f.Reservation=0]="Reservation",f[f.Lease=1]="Lease",f[f["Bulk Coretime"]=2]="Bulk Coretime",f[f["On Demand"]=3]="On Demand";const C={[b.Reservation]:"orange",[b.Lease]:"blue",[b["Bulk Coretime"]]:"pink"},w=o.zo.td` +`,$e=n.memo((function({className:e=""}){const{t:s}=c(),{allCodes:t,codeTrigger:i}=ge(),{allContracts:l}=je(),[u,d]=(0,r.O)(),[h,m,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),m()}),[t,m]),k=(0,n.useCallback)((()=>p(!1)),[p]);return(0,a.jsxs)(Re,{className:e,children:[(0,a.jsx)(_e,{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)(Fe,{contracts:l,updated:i}),(0,a.jsx)(Y,{onShowDeploy:w,updated:i}),j&&h&&(0,a.jsx)(Ve,{codeHash:j,constructorIndex:y,onClose:k,setConstructorIndex:C}),b&&(0,a.jsx)(me,{onClose:f}),x&&(0,a.jsx)(O,{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)($e,{})]})}))},39380:(e,s,t)=>{t.d(s,{Z:()=>W});var a=t(52322),n=t(2784),o=t(90778),r=t(71566),i=t(48801),l=t.n(i);const c={coretime:{kusama:86947,"paseo testnet":22316,polkadot:100988,westend:7363}},u={coretime:{kusama:285768,"paseo testnet":38469,polkadot:282525,westend:245402}},d=(e,s,{blocksPerTimeslice:t,blocktimeMs:a})=>{if(!s||!e)return console.error("Invalid input: one or more inputs are missing"),null;try{const o=new(l())(Date.now()),r=new(l())(a),i=new(l())(t),c=new(l())(Number(e)).mul(i),u=new(l())(s),d=c.sub(u).mul(r),h=o.add(d);return`${(n=new Date(h.toNumber())).getDate()} ${n.toLocaleString("default",{month:"short"})} ${n.getFullYear()}`}catch(e){return console.error("Error in calculation:",e),null}var n},h=e=>({blocks:{coretime:s=>s*e.coretime.blocksPerTimeslice,relay:s=>s*e.relay.blocksPerTimeslice},timeslices:{coretime:s=>s/e.coretime.blocksPerTimeslice,relay:s=>s/e.relay.blocksPerTimeslice}}),m=(e,s)=>({currentRegionEnd:e.regionBegin,currentRegionStart:e.regionBegin-s}),p=(0,n.createContext)({coretimeInfo:null,get:null}),x=({api:e,children:s,isApiReady:t})=>{const o=(0,r.F)(e,t),i=(0,n.useMemo)((()=>o?.constants?h(o.constants):null),[o?.constants]),l=(0,n.useMemo)((()=>({coretimeInfo:o??null,get:i})),[o,i]);return(0,a.jsx)(p.Provider,{value:l,children:s})},g=()=>(0,n.useContext)(p);var b=t(73557),f=t(48630),j=t(9118),v=t(38894),y=t(28097),C=t(14681),w=t(92730);const k={[y.I.Reservation]:"orange",[y.I.Lease]:"blue",[y.I["Bulk Coretime"]]:"pink"},N=f.zo.td` && { background-color: ${({$p:e})=>e?"#F9FAFB":void 0}; } -`,k=n.memo((function({chainRecord:e,highlight:s=!1,id:t,lastCommittedTimeslice:r,lease:i,regionBegin:l,regionEnd:c}){const d=e.renewalStatus===m.VU.Renewed?c:l,h=i?.until||d,p=!!h&&Object.values(b)[e.type]!==b.Reservation;return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(w,{$p:s,children:t}),(0,a.jsx)(w,{$p:s,className:"media--800",children:(0,a.jsx)(o.f,{id:new(u())(t)})}),(0,a.jsx)(w,{$p:s,children:e?.workload?.core}),(0,a.jsx)(w,{$p:s,children:(0,a.jsx)(o.Vp,{color:C[e.type],label:Object.values(b)[e.type]})}),(0,a.jsx)(w,{$p:s,className:"media--800",children:p&&(0,v.u)(80*h).toString()}),(0,a.jsx)(w,{$p:s,className:"media--1000",children:p&&x(h,80*r)}),(0,a.jsx)(w,{$p:s,className:"media--1200",children:e?.renewalStatus}),(0,a.jsx)(w,{$p:s,className:"media--1200",children:e?.renewal?(0,y.a)(e.renewal?.price.toString()):""}),s&&(0,a.jsx)(w,{$p:s})]},`${t}`)})),N=n.memo((function({chain:e,lastCommittedTimeslice:s,regionBegin:t,regionEnd:n}){const[r,i]=(0,j.O)(!1),l=e.workTaskInfo,c=e.workTaskInfo[0],u=l.length>1,d=l.slice(1);if(!c)return(0,a.jsx)(a.Fragment,{});const h=(l,c,d=!1)=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k,{chainRecord:l,highlight:d,id:e.id,lastCommittedTimeslice:s,lease:e.lease,regionBegin:t,regionEnd:n}),0===c&&(0,a.jsx)("td",{style:{paddingRight:"2rem",textAlign:"right",verticalAlign:"top"},children:!!u&&(0,a.jsx)(o.Vh,{expanded:r,onClick:i})})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("tr",{className:"isExpanded isFirst "+(r?"":"isLast"),children:h(c,0)},e.id),r&&d?.map(((s,t)=>(0,a.jsx)("tr",{children:h(s,t+1,!0)},`${e.id}${t}`)))]})})),S=n.memo((function({coretimeInfo:e}){const{t:s}=h(),t=(0,n.useRef)([[s("parachains"),"start"],[s("name"),"start media--800"],[s("core number"),"start"],[s("type"),"start"],[s("last block"),"start media--800"],[s("end"),"start media--1000"],[s("renewal"),"start media--1200"],[s("renewal price"),"start media--1200"],[s("other cores"),"end"]]);return(0,a.jsx)(o.iA,{emptySpinner:!1,header:t.current,isSplit:!1,children:e?.taskIds?.map((s=>{const t=e.chainInfo[s];return(0,a.jsx)(N,{chain:t,lastCommittedTimeslice:e.status.lastCommittedTimeslice,regionBegin:e.salesInfo.regionBegin,regionEnd:e.salesInfo.regionEnd},t.id)}))})})),A=n.memo((function({basePath:e,className:s}){const{t}=h(),{api:l,isApiReady:c}=(0,r.h)(),u=(0,n.useRef)(function(e){return[{isRoot:!0,name:"overview",text:e("Overview")}]}(t)),d=(0,i.F)(l,c);return(0,a.jsxs)("main",{className:s,children:[(0,a.jsx)(o.mQ,{basePath:e,items:u.current}),d&&(0,a.jsx)(g,{api:c?l:null,config:d?.config,parachainCount:d.taskIds?.length||0,region:d?.region,saleInfo:d?.salesInfo,status:d?.status}),!!d&&(0,a.jsx)(S,{coretimeInfo:d})]})}))},18324:(e,s,t)=>{t.d(s,{Z:()=>X});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(90778),l=t(9118),c=t(70563),u=t(61349);function d(){return(0,u.$G)("app-council")}var h=t(92914),m=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,h]=(0,f.O)(),[m,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:h,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:m,isDisabled:!e&&!g,onStart:h,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:h})]}):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:h}=(0,i.h)(),{hasAccounts:p}=(0,m.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:h.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:h.tx[C].vote})]})]}),(0,a.jsx)(r.zx,{icon:"check-to-slot",isDisabled:t,label:u("Vote"),onClick:b})]})})),k=n.memo((function({className:e="",isMember:s,members:t,motion:{hash:o,proposal:i,votes:l},prime:c}){const{allAccounts:u}=(0,m.x)(),{hasFailed:d,isCloseable:f,isVoteable:j,remainingBlocks:v}=(0,p.I)(l,t.length,"council"),k=(0,x.m)("council"),{hasVoted:N,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||!k)return null;const{ayes:A,end:E,index:I,nays:T,threshold:D}=l;return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:I}),(0,a.jsx)(h.Z,{imageHash:o,isCollective:!0,proposal:i}),(0,a.jsx)("td",{className:"number together",children:(0,b.u)(D)}),(0,a.jsx)("td",{className:"number together",children:v&&E&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{value:v}),"#",(0,b.u)(E)]})}),(0,a.jsxs)("td",{className:"expand",children:[(0,a.jsx)(C,{isAye:!0,members:t,threshold:D,votes:A}),(0,a.jsx)(C,{members:t,threshold:D,votes:T})]}),(0,a.jsxs)("td",{className:"button",children:[j&&!f&&(0,a.jsx)(w,{hash:o,idNumber:I,isDisabled:!s,members:t,prime:c,proposal:i}),f&&(0,a.jsx)(y,{hasFailed:d,hash:o,idNumber:I,proposal:i})]}),(0,a.jsx)("td",{className:"badge",children:s&&(0,a.jsx)(r.JO,{color:N?S?"green":"red":"gray",icon:"asterisk"})}),(0,a.jsx)("td",{className:"links",children:(0,a.jsx)(r.NR,{data:I,hash:o.toString(),type:"council"})})]})}));var N=t(30943),S=t(31313),A=t(95292),E=t(33661),I=t(74076);const T=n.memo((function({className:e="",isMember:s,members:t}){const{t:o}=d(),{api:l}=(0,i.h)(),[c,u]=(0,f.O)(),[h,m]=(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:k},T]=(0,n.useState)({imageLen:A.nw,isImageLenValid:!1}),D=(0,x.m)("council"),P=(0,S.CH)(j),M=Math.min(t.length,Math.ceil((t.length||0)*(0,N.d)(l))),z=(0,n.useMemo)((()=>(0,E.m)(l.tx.preimage?.notePreimage)&&!(0,E.m)(l.tx.democracy?.notePreimage)),[l]),F=(0,n.useCallback)((e=>y({hash:e,isHashValid:(0,I.vq)(e,256)})),[]),L=(0,n.useCallback)((e=>{e&&T((s=>({imageLen:e,imageLenDefault:s.imageLenDefault,isImageLenValid:!e.isZero()})))}),[]);return(0,n.useEffect)((()=>{P?.proposalLength&&T((e=>({imageLen:e.imageLen,imageLenDefault:P.proposalLength,isImageLenValid:e.isImageLenValid})))}),[P]),(0,n.useEffect)((()=>{if(v&&j){const e=z?P&&l.tx.democracy.externalProposeMajority({Lookup:{hash:P.proposalHash,len:P.proposalLength||C}}):l.tx.democracy.externalProposeMajority(j);if(e)return b({proposal:e,proposalLength:e.encodedLength||0})}b({proposal:null,proposalLength:0})}),[l,j,z,v,C,P]),D?(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:m,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:F,value:j}),z&&(0,a.jsx)(r.Rn,{defaultValue:w,isDisabled:!!P?.proposalLength&&!P?.proposalLength.isZero()&&v&&k,isError:!k,label:o("preimage length"),onChange:L,value:C},"inputLength")]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,icon:"plus",isDisabled:!M||!t.includes(h||"")||!p||z&&!k,label:o("Propose"),onStart:u,params:3===l.tx[D].propose.meta.args.length?[M,p,g]:[M,p],tx:l.tx[D].propose})})]})]}):null}));var D=t(60404),P=t(48801),M=t.n(P);const z=n.memo((function({isMember:e,members:s}){const{t}=d(),{api:o,apiDefaultTxSudo:l}=(0,i.h)(),[c,u]=(0,f.O)(),[h,m]=(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(M())(Math.min(s.length,Math.ceil(s.length*(0,N.d)(o))))})}),[o,s]);const w=(0,n.useCallback)((e=>b({proposal:e,proposalLength:e?.encodedLength||0})),[]),k=(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:m,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:k,placeholder:t("Positive number between 1 and {{memberCount}}",{replace:{memberCount:s.length}}),value:v||A.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)(D.Z,{defaultValue:l,label:t("proposal"),onChange:w})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,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 F=t(43223);const L=n.memo((function({className:e="",isMember:s,members:t}){const{t:o}=d(),{api:l}=(0,i.h)(),c=(0,F.g)(),[u,h]=(0,f.O)(),[m,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,N.FK)(l)),k=(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:h}),u&&(0,a.jsxs)(r.u_,{className:e,header:o("Revert pending slashes"),onClose:h,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:k.length?(0,a.jsx)(r.Lt,{defaultValue:k[0].value,label:o("the era to cancel for"),onChange:y,options:k}):(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:m,icon:"sync",isDisabled:!w||!t.includes(m||"")||!g,label:o("Revert"),onStart:h,params:3===l.tx[C].propose.meta.args.length?[w,g,b]:[w,g],tx:l.tx[C].propose})})]})]}):null})),V=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)(z,{isMember:i,members:l}),(0,a.jsx)(T,{isMember:i,members:l}),(0,a.jsx)(L,{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)(k,{isMember:i,members:l,motion:e,prime:t},e.hash.toHex())))})]})}));var _=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 H=t(58607);const $=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)(H.Z,{className:e&&s?"":"--tmp",value:e})})})})})),B=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)($,{balance:s,voters:i})]})})),O=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)(B,{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)(B,{address:s,hasElections:!1,voters:e[s.toString()]},s.toString())))})]})})),q=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)(B,{address:s,balance:t,hasElections:o,isPrime:i?.eq(s),voters:e[s.toString()]},s.toString())))})}));var W=t(65121);const Z=n.memo((function({electionsInfo:e}){const{api:s}=(0,i.h)(),{t}=d(),[o,l]=(0,n.useState)(null),{isOpen:c,onClose:u,onOpen:h}=(0,W.d)(),m=R();return m?(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[m]&&(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[m]?.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[m].submitCandidacy.meta.args.length?[e?.candidates.length]:[],tx:s.tx[m].submitCandidacy})})]}),(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!e,label:t("Submit candidacy"),onClick:h})]}):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(A.nw)&&(0,a.jsx)("section",{children:(0,a.jsx)(r.Jy,{label:o("term progress"),progress:{total:t&&e?t.termDuration:A.Jo,value:t&&e?e.mod(t.termDuration):A.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),[h,m]=(0,n.useState)([]),[p,x]=(0,n.useState)([]),[g,b]=(0,n.useState)([]),[j,v]=(0,n.useState)(A.nw),y=R();(0,n.useEffect)((()=>{if(e){const{candidates:s,members:t,runnersUp:a}=e;m(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=>h.includes(e))))})).catch(console.error)}),[t,c,h]);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===h.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:h,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,_.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)(Z,{electionsInfo:o})]}),(0,a.jsx)(q,{allVotes:c,electionsInfo:o,hasElections:d,prime:s}),d&&(0,a.jsx)(O,{allVotes:c,electionsInfo:o,hasElections:d})]})}));var Q=t(40740);const X=n.memo((function({basePath:e,className:s}){const{t}=d(),{api:c}=(0,i.h)(),{pathname:u}=(0,o.TH)(),h=(0,Q.Z)(),m=(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:h,name:"motions",text:t("Motions")}]),[h,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)(V,{motions:p,prime:m}),path:"motions"})})}),(0,a.jsx)(Y,{className:[e,`${e}/candidates`].includes(u)?"":"--hidden",prime:m})]})}))},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(48630),r=t(90778),i=t(60404),l=t(67609),c=t(48801),u=t.n(c),d=t(95292),h=t(54371),m=t(18608),p=t(6987);const x=(0,m.$)(""),g=(0,o.zo)(o.u_)` +`,S=n.memo((function({chainRecord:e,highlight:s=!1,id:t,lastCommittedTimeslice:o,lease:r,regionBegin:i,regionEnd:c}){const u=e.renewalStatus===y.VU.Renewed?c:i,h=r?.until||u,m=!!h&&Object.values(y.I)[e.type]!==y.I.Reservation,{coretimeInfo:p,get:x}=g();return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(N,{$p:s,children:t}),(0,a.jsx)(N,{$p:s,className:"media--800",children:(0,a.jsx)(f.f,{id:new(l())(t)})}),(0,a.jsx)(N,{$p:s,children:e?.workload?.core}),(0,a.jsx)(N,{$p:s,children:(0,a.jsx)(f.Vp,{color:k[e.type],label:Object.values(y.I)[e.type]})}),(0,a.jsx)(N,{$p:s,className:"media--800",children:m&&x&&(0,C.u)(x.blocks.relay(h)).toString()}),(0,a.jsx)(N,{$p:s,className:"media--1000",children:m&&x&&p&&d(h,x.blocks.relay(o),p?.constants?.relay)}),(0,a.jsx)(N,{$p:s,className:"media--1200",children:e?.renewalStatus}),(0,a.jsx)(N,{$p:s,className:"media--1200",children:e?.renewal?(0,w.a)(e.renewal?.price.toString()):""}),s&&(0,a.jsx)(N,{$p:s})]},`${t}`)})),A=n.memo((function({chain:e,lastCommittedTimeslice:s,regionBegin:t,regionEnd:n}){const[o,r]=(0,v.O)(!1),i=e.workTaskInfo,l=e.workTaskInfo[0],c=i.length>1,u=i.slice(1);if(!l)return(0,a.jsx)(a.Fragment,{});const d=(i,l,u=!1)=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S,{chainRecord:i,highlight:u,id:e.id,lastCommittedTimeslice:s,lease:e.lease,regionBegin:t,regionEnd:n}),0===l&&(0,a.jsx)("td",{style:{paddingRight:"2rem",textAlign:"right",verticalAlign:"top"},children:!!c&&(0,a.jsx)(f.Vh,{expanded:o,onClick:r})})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("tr",{className:"isExpanded isFirst "+(o?"":"isLast"),children:d(l,0)},e.id),o&&u?.map(((s,t)=>(0,a.jsx)("tr",{children:d(s,t+1,!0)},`${e.id}${t}`)))]})}));var I=t(61349);function E(){return(0,I.$G)("app-coretime")}const T=n.memo((function({coretimeInfo:e}){const{t:s}=E(),t=(0,n.useRef)([[s("parachains"),"start"],[s("name"),"start media--800"],[s("core number"),"start"],[s("type"),"start"],[s("last block"),"start media--800"],[s("end"),"start media--1000"],[s("renewal"),"start media--1200"],[s("renewal price"),"start media--1200"],[s("other cores"),"end"]]);return(0,a.jsx)(f.iA,{emptySpinner:!1,header:t.current,isSplit:!1,children:e?.taskIds?.map((s=>{const t=e.chainInfo[s];return(0,a.jsx)(A,{chain:t,lastCommittedTimeslice:e.status.lastCommittedTimeslice,regionBegin:e.salesInfo.regionBegin,regionEnd:e.salesInfo.regionEnd},t.id)}))})})),D=n.memo((function({chainName:e,config:s,constants:t,parachainCount:o,saleInfo:r,status:i}){const{t:c}=E(),h=r.regionEnd-s.regionLength,m=r.regionEnd-2*s.regionLength,{get:p}=g(),x=(0,n.useMemo)((()=>{if(e&&h)return Math.floor((h-u.coretime[e])/s.regionLength)}),[h,e,s]);return(0,a.jsxs)(f.Ty,{children:[(0,a.jsxs)("section",{children:[i&&(0,a.jsx)(f.Jy,{label:c("sale number"),children:(0,a.jsx)("div",{children:x})}),(0,a.jsx)(f.Jy,{label:c("timeslice"),children:i?.lastTimeslice}),(0,a.jsx)(f.Jy,{label:c("parachains"),children:o&&o}),s&&i&&(0,a.jsx)(f.Jy,{className:"media--800",label:c("cycle progress"),progress:{isBlurred:!1,total:new(l())(s?.regionLength),value:new(l())(s?.regionLength-(h-i.lastTimeslice)),withTime:!1}})]}),(0,a.jsxs)("section",{className:"media--1200",children:[i&&(0,a.jsx)(f.Jy,{label:c("cycle dates"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:p&&d(m,p.blocks.relay(i?.lastTimeslice),t.relay)}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:p&&d(h,p.blocks.relay(i?.lastTimeslice),t.relay)})]})}),i&&(0,a.jsx)(f.Jy,{label:c("cycle ts"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:m}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:h})]})})]})]})})),P=n.memo((function({chainName:e,className:s}){const{coretimeInfo:t}=g();return(0,a.jsxs)("main",{className:s,children:[t&&(0,a.jsx)(D,{chainName:e,config:t?.config,constants:t?.constants,parachainCount:t.taskIds?.length||0,region:t?.region,saleInfo:t?.salesInfo,status:t?.status}),!!t&&(0,a.jsx)(T,{coretimeInfo:t})]})}));var M=t(79169);const z="Fixed Price",F="Price Discovery",L="Renewals",V=new(l())(1e4),_=(e,s,t)=>s&&e?Math.ceil((e-u.coretime[s])/t.regionLength):-1,R=(e,s,t,a)=>{const n=e-s;return n-1?t:"-"})}),(0,a.jsx)(f.Jy,{label:r("sold/offered"),children:`${n?.coresSold} / ${n?.coresOffered}`}),(0,a.jsx)(f.Jy,{label:r("sale end"),children:(0,a.jsx)("div",{children:h})}),(0,a.jsx)(f.Jy,{label:r("last block"),children:(0,a.jsx)("div",{children:u&&(0,C.u)(u.blocks.relay(i))})}),(0,a.jsx)(f.Jy,{label:r("last timeslice"),children:(0,a.jsx)("div",{children:(0,C.u)(i)})}),e&&o&&(0,a.jsx)(f.Jy,{className:"media--800",label:r("sale progress"),progress:{isBlurred:!1,total:new(l())(e?.regionLength),value:new(l())(e?.regionLength-(i-o.lastTimeslice)),withTime:!1}})]}),(0,a.jsxs)("section",{className:"media--1200",children:[o&&(0,a.jsx)(f.Jy,{label:r("cycle dates"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:p}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:h})]})}),o&&(0,a.jsx)(f.Jy,{label:r("cycle ts"),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"14px"},children:c}),(0,a.jsx)("div",{style:{fontSize:"14px"},children:i})]})})]})]})})),B=function({chainName:e}){const{coretimeInfo:s,get:t}=g(),{api:r,apiCoretime:i,isApiReady:u}=(0,o.h)(),{t:p}=E(),x=s?.salesInfo?.regionBegin,b=s?.status?.lastTimeslice,v=(0,j.W7)(i.derive.chain.bestNumberFinalized),y=(0,n.useMemo)((()=>t&&v&&((e,s)=>{if(!s||!e)return new(l())(0);const{endPrice:t,leadinLength:a,saleStart:n}=s,o=new(l())(e),r=new(l())(n),i=new(l())(a),c=o.sub(r);return(e=>{const s=V.div(new(l())(2));return e.lte(s)?V.mul(new(l())(100)).sub(e.mul(new(l())(180))):V.mul(new(l())(19)).sub(e.mul(new(l())(18)))})((c.lt(i)?c:i).mul(new(l())(1e4)).div(i)).mul(t).div(V)})(v.toNumber(),s?.salesInfo)),[s?.salesInfo,t,v]),k=s&&((e,s,t,a,n)=>{const o=h(n),r=o.timeslices.coretime(s.interludeLength),i=o.timeslices.coretime(s.leadinLength),{currentRegionEnd:l,currentRegionStart:c}=m(e,s.regionLength),u=((e,s,t,a,n,o)=>{const r=e+t,i=r+a,l=i+(s-t-a),c=h(o);return{config:{[L]:{lastBlock:c.blocks.relay(r),lastTimeslice:r},[F]:{lastBlock:c.blocks.relay(i),lastTimeslice:i},[z]:{lastBlock:c.blocks.relay(l),lastTimeslice:l}},currentPhaseName:R(n,e,t,a)}})(c,s.regionLength,r,i,a,n),d=_(l,t,s);return{currentRegion:{end:{blocks:o.blocks.relay(l),ts:l},start:{blocks:o.blocks.relay(c),ts:c}},cycleNumber:_(l,t,s),interlude:{blocks:s.interludeLength,ts:r},leadin:{blocks:s.leadinLength,ts:i},phaseConfig:u,regionNumber:d-1}})(s.salesInfo,s.config,e,b??0,s.constants),N=(0,n.useMemo)((()=>k?.phaseConfig?.currentPhaseName),[k]),[S,A]=(0,n.useState)(-1),[I,T]=(0,n.useState)(null),D=(0,n.useMemo)((()=>[{text:p("Pick a sale number"),value:-1},...Array.from({length:k?.cycleNumber??0},((e,s)=>({text:`sale #${s+1}`,value:s}))).reverse()]),[k,p]),P=(0,n.useMemo)((()=>k&&x&&((e,s,t,a,n)=>{if(!(e&&s&&t&&a&&n))return[];const o=e-s;return[{label:L,total:t,value:Math.min(o,t)},{label:F,total:a,value:Math.min(Math.max(o-t,0),a)},{label:z,total:n-s-t-a,value:Math.max(o-t-a,0)}]})(b,k.currentRegion.start.ts,k.interlude.ts,k.leadin.ts,x)),[k,b,x]),B=(0,n.useCallback)((a=>{A(a),-1===a?T(null):t&&k&&T(function(e,s,t,a,n,o,r){if(-1===e)return null;const i=h(r),l=i.blocks.relay(n),u=o.currentRegion.start.blocks-l*(s-e-1),m=u+l,p=i.timeslices.relay(u),x=i.timeslices.relay(m),g=c.coretime[a]+i.blocks.coretime(e*n);return{coretime:{end:{block:g+i.blocks.coretime(n)},start:{block:g}},date:{end:d(x,t,r.relay),start:d(p,t,r.relay)},relay:{end:{block:m,ts:x},start:{block:u,ts:p}},saleNumber:e}}(a,k?.cycleNumber,t.blocks.relay(s.status.lastTimeslice),e,s.config.regionLength,k,s.constants))}),[t,k,s,e]),O=(0,n.useCallback)((()=>{I&&window.open(((e,s,t,a="broker",n="purchase")=>`https://coretime-${t}.subscan.io/extrinsic?page=1&time_dimension=block&page_size=25&module=${a}&signed=all&call=${n}&block_start=${e}&block_end=${s}`)(I.coretime.start.block,I.coretime.end.block,e))}),[I,e]);return(0,a.jsxs)("div",{children:[s&&k&&(0,a.jsx)(H,{api:u?r:null,config:s?.config,constants:s?.constants,cycleNumber:k?.cycleNumber,region:s?.region,saleInfo:s?.salesInfo,status:s?.status}),(0,a.jsxs)("div",{style:{alignItems:"stretch",display:"grid",flexFlow:"1",gap:"2rem",gridTemplateColumns:"1fr 3fr",gridTemplateRows:"auto auto",marginTop:"4rem"},children:[(0,a.jsx)("div",{style:{backgroundColor:"white",borderRadius:"4px",display:"flex",flexDirection:"column",justifyItems:"center",justifySelf:"right",padding:"24px",width:"fit-content"},children:(0,a.jsx)(f.Ty,{className:"isSmall",children:N===L?(0,a.jsx)("b",{children:"Cores cannot be purchased now"}):(0,a.jsx)(f.Jy,{label:"current price",children:y&&(0,w.a)(y)})})}),(0,a.jsxs)("div",{style:{backgroundColor:"white",borderRadius:"4px",justifySelf:"left",padding:"24px",width:"fit-content"},children:[(0,a.jsxs)(f.Ty,{children:[(0,a.jsxs)("section",{children:[N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Jy,{label:"current phase",children:N}),(0,a.jsx)(f.Jy,{label:"current phase end",children:t&&s&&k?.phaseConfig&&d(k.phaseConfig.config[N].lastTimeslice,t.blocks.relay(s?.status.lastTimeslice),s.constants.relay)}),(0,a.jsx)(f.Jy,{label:"last block",children:(0,C.u)(k?.phaseConfig?.config[N].lastBlock)})]}),(0,a.jsx)(f.Jy,{label:"fixed price",children:(0,w.a)(s?.salesInfo.endPrice)})]}),(0,a.jsx)("section",{})]}),(0,a.jsx)(M.Z,{sections:P??[]})]}),(0,a.jsxs)("div",{style:{backgroundColor:"white",borderRadius:"4px",gridColumn:"1 / -1",justifySelf:"center",padding:"24px",width:"100%"},children:[(0,a.jsx)("h2",{children:"Interlude + sale data"}),(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",marginBottom:"1.5rem",maxWidth:"300px"},children:(0,a.jsx)(f.Lt,{className:"isSmall",onChange:B,options:D,value:S})}),S>-1&&!!I&&(0,a.jsx)("div",{style:{minWidth:"200px"},children:(0,a.jsx)($,{saleDetails:I})}),S>-1&&!!I&&(0,a.jsxs)("div",{style:{minWidth:"200px"},children:[(0,a.jsx)("h2",{children:"Query sale transactions"}),(0,a.jsxs)("p",{style:{marginTop:"1rem"},children:["We do not index transactions ourselves but you can query historical transactions on Subscan. ",(0,a.jsx)("br",{}),"The button below will open a new tab with the correct query parameters for the chosen sale."]}),(0,a.jsx)(f.zx,{isBasic:!0,label:p(`Query Subscan for sale #${S+1}`),onClick:O})]})]})]})]})]})},O=n.memo((function({api:e,basePath:s,className:t,isApiReady:o}){const{t:r}=E(),i=(0,n.useRef)(function(e){return[{isRoot:!0,name:"overview",text:e("Overview")},{name:"sale",text:e("Sale")}]}(r)),l=(0,j.W7)(o&&e?.rpc.system.chain)?.toString().toLowerCase();return(0,a.jsxs)("main",{className:t,children:[(0,a.jsx)(f.mQ,{basePath:s,items:i.current}),(0,a.jsx)(b.Z5,{children:(0,a.jsxs)(b.AW,{path:s,children:[(0,a.jsx)(b.AW,{element:(0,a.jsx)(P,{chainName:l}),index:!0}),(0,a.jsx)(b.AW,{element:(0,a.jsx)(B,{chainName:l}),path:"sale"})]})})]})})),W=n.memo((function({basePath:e,className:s}){const{api:t,isApiReady:n}=(0,o.h)();return(0,a.jsx)(x,{api:t,isApiReady:n,children:(0,a.jsx)(O,{api:t,basePath:e,className:s,isApiReady:n})})}))},18324:(e,s,t)=>{t.d(s,{Z:()=>X});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(90778),l=t(9118),c=t(70563),u=t(61349);function d(){return(0,u.$G)("app-council")}var h=t(92914),m=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,h]=(0,f.O)(),[m,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:h,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:m,isDisabled:!e&&!g,onStart:h,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:h})]}):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:h}=(0,i.h)(),{hasAccounts:p}=(0,m.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:h.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:h.tx[C].vote})]})]}),(0,a.jsx)(r.zx,{icon:"check-to-slot",isDisabled:t,label:u("Vote"),onClick:b})]})})),k=n.memo((function({className:e="",isMember:s,members:t,motion:{hash:o,proposal:i,votes:l},prime:c}){const{allAccounts:u}=(0,m.x)(),{hasFailed:d,isCloseable:f,isVoteable:j,remainingBlocks:v}=(0,p.I)(l,t.length,"council"),k=(0,x.m)("council"),{hasVoted:N,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||!k)return null;const{ayes:A,end:I,index:E,nays:T,threshold:D}=l;return(0,a.jsxs)("tr",{className:e,children:[(0,a.jsx)(r.iA.Column.Id,{value:E}),(0,a.jsx)(h.Z,{imageHash:o,isCollective:!0,proposal:i}),(0,a.jsx)("td",{className:"number together",children:(0,b.u)(D)}),(0,a.jsx)("td",{className:"number together",children:v&&I&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{value:v}),"#",(0,b.u)(I)]})}),(0,a.jsxs)("td",{className:"expand",children:[(0,a.jsx)(C,{isAye:!0,members:t,threshold:D,votes:A}),(0,a.jsx)(C,{members:t,threshold:D,votes:T})]}),(0,a.jsxs)("td",{className:"button",children:[j&&!f&&(0,a.jsx)(w,{hash:o,idNumber:E,isDisabled:!s,members:t,prime:c,proposal:i}),f&&(0,a.jsx)(y,{hasFailed:d,hash:o,idNumber:E,proposal:i})]}),(0,a.jsx)("td",{className:"badge",children:s&&(0,a.jsx)(r.JO,{color:N?S?"green":"red":"gray",icon:"asterisk"})}),(0,a.jsx)("td",{className:"links",children:(0,a.jsx)(r.NR,{data:E,hash:o.toString(),type:"council"})})]})}));var N=t(30943),S=t(31313),A=t(95292),I=t(33661),E=t(74076);const T=n.memo((function({className:e="",isMember:s,members:t}){const{t:o}=d(),{api:l}=(0,i.h)(),[c,u]=(0,f.O)(),[h,m]=(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:k},T]=(0,n.useState)({imageLen:A.nw,isImageLenValid:!1}),D=(0,x.m)("council"),P=(0,S.CH)(j),M=Math.min(t.length,Math.ceil((t.length||0)*(0,N.d)(l))),z=(0,n.useMemo)((()=>(0,I.m)(l.tx.preimage?.notePreimage)&&!(0,I.m)(l.tx.democracy?.notePreimage)),[l]),F=(0,n.useCallback)((e=>y({hash:e,isHashValid:(0,E.vq)(e,256)})),[]),L=(0,n.useCallback)((e=>{e&&T((s=>({imageLen:e,imageLenDefault:s.imageLenDefault,isImageLenValid:!e.isZero()})))}),[]);return(0,n.useEffect)((()=>{P?.proposalLength&&T((e=>({imageLen:e.imageLen,imageLenDefault:P.proposalLength,isImageLenValid:e.isImageLenValid})))}),[P]),(0,n.useEffect)((()=>{if(v&&j){const e=z?P&&l.tx.democracy.externalProposeMajority({Lookup:{hash:P.proposalHash,len:P.proposalLength||C}}):l.tx.democracy.externalProposeMajority(j);if(e)return b({proposal:e,proposalLength:e.encodedLength||0})}b({proposal:null,proposalLength:0})}),[l,j,z,v,C,P]),D?(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:m,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:F,value:j}),z&&(0,a.jsx)(r.Rn,{defaultValue:w,isDisabled:!!P?.proposalLength&&!P?.proposalLength.isZero()&&v&&k,isError:!k,label:o("preimage length"),onChange:L,value:C},"inputLength")]})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,icon:"plus",isDisabled:!M||!t.includes(h||"")||!p||z&&!k,label:o("Propose"),onStart:u,params:3===l.tx[D].propose.meta.args.length?[M,p,g]:[M,p],tx:l.tx[D].propose})})]})]}):null}));var D=t(60404),P=t(48801),M=t.n(P);const z=n.memo((function({isMember:e,members:s}){const{t}=d(),{api:o,apiDefaultTxSudo:l}=(0,i.h)(),[c,u]=(0,f.O)(),[h,m]=(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(M())(Math.min(s.length,Math.ceil(s.length*(0,N.d)(o))))})}),[o,s]);const w=(0,n.useCallback)((e=>b({proposal:e,proposalLength:e?.encodedLength||0})),[]),k=(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:m,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:k,placeholder:t("Positive number between 1 and {{memberCount}}",{replace:{memberCount:s.length}}),value:v||A.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)(D.Z,{defaultValue:l,label:t("proposal"),onChange:w})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:h,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 F=t(43223);const L=n.memo((function({className:e="",isMember:s,members:t}){const{t:o}=d(),{api:l}=(0,i.h)(),c=(0,F.g)(),[u,h]=(0,f.O)(),[m,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,N.FK)(l)),k=(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:h}),u&&(0,a.jsxs)(r.u_,{className:e,header:o("Revert pending slashes"),onClose:h,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:k.length?(0,a.jsx)(r.Lt,{defaultValue:k[0].value,label:o("the era to cancel for"),onChange:y,options:k}):(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:m,icon:"sync",isDisabled:!w||!t.includes(m||"")||!g,label:o("Revert"),onStart:h,params:3===l.tx[C].propose.meta.args.length?[w,g,b]:[w,g],tx:l.tx[C].propose})})]})]}):null})),V=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)(z,{isMember:i,members:l}),(0,a.jsx)(T,{isMember:i,members:l}),(0,a.jsx)(L,{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)(k,{isMember:i,members:l,motion:e,prime:t},e.hash.toHex())))})]})}));var _=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 $=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,{className:e&&s?"":"--tmp",value:e})})})})})),B=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})]})})),O=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)(B,{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)(B,{address:s,hasElections:!1,voters:e[s.toString()]},s.toString())))})]})})),W=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)(B,{address:s,balance:t,hasElections:o,isPrime:i?.eq(s),voters:e[s.toString()]},s.toString())))})}));var q=t(65121);const Z=n.memo((function({electionsInfo:e}){const{api:s}=(0,i.h)(),{t}=d(),[o,l]=(0,n.useState)(null),{isOpen:c,onClose:u,onOpen:h}=(0,q.d)(),m=R();return m?(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[m]&&(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[m]?.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[m].submitCandidacy.meta.args.length?[e?.candidates.length]:[],tx:s.tx[m].submitCandidacy})})]}),(0,a.jsx)(r.zx,{icon:"plus",isDisabled:!e,label:t("Submit candidacy"),onClick:h})]}):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(A.nw)&&(0,a.jsx)("section",{children:(0,a.jsx)(r.Jy,{label:o("term progress"),progress:{total:t&&e?t.termDuration:A.Jo,value:t&&e?e.mod(t.termDuration):A.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),[h,m]=(0,n.useState)([]),[p,x]=(0,n.useState)([]),[g,b]=(0,n.useState)([]),[j,v]=(0,n.useState)(A.nw),y=R();(0,n.useEffect)((()=>{if(e){const{candidates:s,members:t,runnersUp:a}=e;m(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=>h.includes(e))))})).catch(console.error)}),[t,c,h]);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===h.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:h,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,_.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)(Z,{electionsInfo:o})]}),(0,a.jsx)(W,{allVotes:c,electionsInfo:o,hasElections:d,prime:s}),d&&(0,a.jsx)(O,{allVotes:c,electionsInfo:o,hasElections:d})]})}));var Q=t(40740);const X=n.memo((function({basePath:e,className:s}){const{t}=d(),{api:c}=(0,i.h)(),{pathname:u}=(0,o.TH)(),h=(0,Q.Z)(),m=(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:h,name:"motions",text:t("Motions")}]),[h,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)(V,{motions:p,prime:m}),path:"motions"})})}),(0,a.jsx)(Y,{className:[e,`${e}/candidates`].includes(u)?"":"--hidden",prime:m})]})}))},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(48630),r=t(90778),i=t(60404),l=t(67609),c=t(48801),u=t.n(c),d=t(95292),h=t(54371),m=t(18608),p=t(6987);const x=(0,m.$)(""),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:k},N]=(0,n.useState)({encodedHash:x,encodedProposal:"",storageFee:null}),[S,A]=(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;N({encodedHash:(0,m.$)(e),encodedProposal:e,storageFee:s})}),[f,S]);const E=(0,n.useMemo)((()=>!s||((0,h.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("transferable")}),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:A}),(0,a.jsx)(o.qG,{label:b("preimage hash"),value:C,withCopy:!0})]}),!t&&k&&(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:k,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&&E&&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(48630),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(48630),r=t(90778),i=t(31313),l=t(15991),c=t(6987),u=t(9118),d=t(37245);const h=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 m=t(89176),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:h,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)(m.ZP,{isDisabled:!0,params:h,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` +`,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:k},N]=(0,n.useState)({encodedHash:x,encodedProposal:"",storageFee:null}),[S,A]=(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;N({encodedHash:(0,m.$)(e),encodedProposal:e,storageFee:s})}),[f,S]);const I=(0,n.useMemo)((()=>!s||((0,h.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("transferable")}),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:A}),(0,a.jsx)(o.qG,{label:b("preimage hash"),value:C,withCopy:!0})]}),!t&&k&&(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:k,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&&I&&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(48630),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(48630),r=t(90778),i=t(31313),l=t(15991),c=t(6987),u=t(9118),d=t(37245);const h=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 m=t(89176),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:h,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)(m.ZP,{isDisabled:!0,params:h,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),m=t||u.query.democracy?.preimages?n:d?.proposal;if(!m){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}=m.registry.findMetaCall(m.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:m,withHash:!g&&!y,children:[y&&(0,a.jsx)(h,{value:m.args[0]}),g&&(0,a.jsx)(b,{value:m.args[0]})]})})}))},50472:(e,s,t)=>{t.d(s,{Z:()=>le});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(90778),l=t(38894),c=t(9118),u=t(6987),d=t(70563),h=t(30943),m=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),[k,N]=(0,n.useState)(d.consts.democracy.fastTrackVotingPeriod||f),[{proposal:S,proposalLength:A},E]=(0,n.useState)((()=>({proposalLength:0}))),[I,T]=(0,l.O)(!0),D=(0,m.m)("technicalCommittee"),P=(0,c.W7)(D&&d.query[D].proposalCount),M=(0,n.useMemo)((()=>new(x())(Math.ceil(s.length*(0,h.A_)(d,!k||d.consts.democracy.fastTrackVotingPeriod.lte(k))))),[d,s,k]),z=(0,n.useMemo)((()=>{if(!(D&&S&&P&&d.tx.utility))return null;const e=3===d.tx[D].propose.meta.args.length?d.tx[D].propose(M,S,A):d.tx[D].propose(M,S);return I&&s.length>1?d.tx.utility.batch([e,d.tx[D].vote(S.method.hash,P,!0)]):e}),[d,s,M,D,S,P,A,I]);return(0,n.useEffect)((()=>{const s=C&&!C.isZero()&&k&&!k.isZero()?d.tx.democracy.fastTrack(e,k,C):null;E({proposal:s,proposalLength:s?.length||0})}),[d,C,e,s,k]),D&&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:N,value:k}),(0,a.jsx)(r.Rn,{isZeroable:!1,label:o("delay"),onChange:w,value:C}),(0,a.jsx)(r.Rn,{defaultValue:M,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:T,value:I})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:v,extrinsic:z,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 k=t(10842),N=t(58607),S=t(34814),A=t(81661);const E=n.memo((function({deposit:e,depositors:s,image:t,proposalId:o}){const{t:c}=(0,u.$)(),{hasAccounts:d}=(0,S.x)(),{api:h}=(0,i.h)(),[m,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)(A.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||h.consts.democracy.minimumDeposit,isDisabled:!0,label:c("deposit required")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,icon:"sign-in-alt",isDisabled:!m,label:c("Endorse"),onStart:g,params:2===h.tx.democracy.second.meta.args.length?[o,s.length]:[o],tx:h.tx.democracy.second})})]}),(0,a.jsx)(r.zx,{icon:"toggle-off",label:c("Endorse"),onClick:g})]}):null})),I=n.memo((function({className:e="",value:{balance:s,image:t,imageHash:o,index:i,proposer:c,seconds:d}}){const{t:h}=(0,u.$)(),[m,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 ${m?"":"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)(N.Z,{value:s})}),(0,a.jsx)("td",{className:"expand",children:0!==x.length&&(0,a.jsx)(r.n0,{empty:x&&h("No endorsements"),renderChildren:g,summary:h("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)(E,{deposit:s,depositors:d||[],image:t,proposalId:i}),(0,a.jsx)(r.Vh,{expanded:m,onClick:p})]})})]}),(0,a.jsxs)("tr",{className:`${e} ${m?"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})})})})]})]})})),T=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)(I,{value:e},e.index.toString())))})}));var D=t(31313),P=t(67609),M=t(95292),z=t(74076),F=t(33661);const L=n.memo((function({className:e="",onClose:s}){const{t}=(0,u.$)(),{api:o}=(0,i.h)(),[l,d]=(0,n.useState)(null),[h,m]=(0,n.useState)(),[{imageHash:p,isImageHashValid:x},g]=(0,n.useState)({imageHash:null,isImageHashValid:!1}),[{imageLen:b,imageLenDefault:f,isImageLenValid:j},v]=(0,n.useState)({imageLen:M.nw,isImageLenValid:!1}),y=(0,c.W7)(o.query.democracy.publicProps),C=(0,D.CH)(p);(0,n.useEffect)((()=>{C?.proposalLength&&v((e=>({imageLen:e.imageLen,imageLenDefault:C.proposalLength,isImageLenValid:e.isImageLenValid})))}),[C]);const w=(0,n.useCallback)((e=>g({imageHash:e,isImageHashValid:(0,z.vq)(e,256)})),[]),k=(0,n.useCallback)((e=>{e&&v((s=>({imageLen:e,imageLenDefault:s.imageLenDefault,isImageLenValid:!e.isZero()})))}),[]),N=h?.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)(P.Z,{label:(0,a.jsx)("span",{className:"label",children:t("transferable")}),params:l}),onChange:d,type:"account"})}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("The hash of the preimage for the proposal as previously submitted or intended.")}),(0,a.jsx)("p",{children:t("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:!x,label:t("preimage hash"),onChange:w,value:p||""}),(0,a.jsx)(r.Rn,{defaultValue:f,isDisabled:!!C?.proposalLength&&!C?.proposalLength.isZero()&&x&&j,isError:!j,label:t("preimage length"),onChange:k,value:b},"inputLength")]}),(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:!N,label:t("locked balance"),onChange:m}),(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:!h||!N||!x||!l||!y||(0,F.m)(o.tx.preimage?.notePreimage)&&!(0,F.m)(o.tx.democracy?.notePreimage)&&!C,label:t("Submit proposal"),onStart:s,params:3===o.tx.democracy.propose.meta.args.length?[p,h,y?.length]:(0,F.m)(o.tx.preimage?.notePreimage)&&!(0,F.m)(o.tx.democracy?.notePreimage)?[C&&{Lookup:{hash:C.proposalHash,len:b}},h]:[p,h],tx:o.tx.democracy.propose})})]})}));var V=t(54383),_=t(65874),R=t(14681),H=t(47538),$=t(11677),B=t(15938);const O=new(x())(-1),q=new(x())(2);function W(e,s,t,a,n,o){const r=1===o?M.If:O,i=t.add(a),l=M.If.muln(10*n).mul(i).div(M.aP);return[i,e.add(r.mul(i)),x().max(M.nw,s.add(r.mul(l)))]}function Z(e,s,{votedAye:t,votedNay:a,votedTotal:n},o,r,i){for(;;){const[l,c,u]=W(t,n,r,i,o?0:1,o?-1:1);if((0,B.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]=W(a,n,r,i,o?1:0,o?1:-1);if((0,B.Pc)(e,s,{votedAye:t,votedNay:c,votedTotal:u})!==o)return r;r=l}}const J=(0,$.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:M.nw,changeNay:M.nw});return(0,n.useEffect)((()=>{r&&u(function(e,s,t){const a=(0,B.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()?M.nw:e,changeNay:t.votedAye.isZero()?M.nw:e}}let n=M.nw,o=M.nw,r=t.votedTotal.div(q);for(;!r.isZero();){n=Z(e,s,t,a,n,r),o=U(e,s,t,a,o,r);const i=r.div(q);i.isZero()&&(n=n.add(r),o=o.add(r)),r=i}return{changeAye:t.votedNay.isZero()?M.nw:a?x().min(n,t.votedAye):n,changeNay:t.votedAye.isZero()?M.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})})),X=[1,10,20,30,40,50,60],K=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(X[e.vote.conviction.toNumber()]).div(M.aP);return s.balance.muln(X[s.vote.conviction.toNumber()]).div(M.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)(N.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,h]=(0,n.useState)(null),[m,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&&!m;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)(A.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:h})}),(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:m,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:m,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:h,isPassing:m,status:p,voteCountAye:g,voteCountNay:b,votedAye:f,votedNay:j,votedTotal:C}}){const{t:w}=(0,u.$)(),{api:k}=(0,i.h)(),{allAccounts:N}=(0,S.x)(),A=(0,V.C)(),[E,I]=(0,l.O)(!1),T=(0,c.W7)(k.query.balances?.totalIssuance),{changeAye:D,changeNay:P}=J(p.threshold,f,j,C),z=(0,n.useMemo)((()=>p.threshold.type.toString().replace("majority"," majority ")),[p]),F=f.add(j),[L,{hasVoted:$,hasVotedAye:B}]=(0,n.useMemo)((()=>{if(T){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})=>N.includes(e.toString())));return[{aye:C.isZero()?"":`${se(e,C)}%`,nay:C.isZero()?"":`${se(a,C)}%`,turnout:`${se(C,T)}%`},{hasVoted:n||t.some((({accountId:e})=>N.includes(e.toString()))),hasVotedAye:n}]}return[null,{hasVoted:!1,hasVotedAye:!1}]}),[N,s,t,T,C]);if(!A||p.end.sub(A).lten(0))return null;const O=p.end.add(p.delay),q=p.end.sub(A).isub(M.If);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${e} isExpanded isFirst ${E?"":"isLast"}`,children:[(0,a.jsx)(r.iA.Column.Id,{value:h}),(0,a.jsx)(y.Z,{imageHash:d,proposal:o?.proposal}),(0,a.jsxs)("td",{className:"number together media--1200",children:[(0,a.jsx)(_.Z,{value:q}),w("{{blocks}} blocks",{replace:{blocks:(0,R.u)(q)}})]}),(0,a.jsxs)("td",{className:"number together media--1400",children:[(0,a.jsx)(_.Z,{value:O.sub(A)}),"#",(0,R.u)(O)]}),(0,a.jsx)("td",{className:"number together media--1400",children:L&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{children:L.turnout})})}),(0,a.jsx)("td",{className:"badge",children:(0,H.j)(m)&&(0,a.jsx)(r.Ct,{color:m?"green":"red",hover:w(m?"{{threshold}}, passing":"{{threshold}}, not passing",{replace:{threshold:z}}),icon:m?"check":"times"})}),(0,a.jsxs)("td",{className:"expand",children:[(0,a.jsx)(K,{change:D,count:g,isAye:!0,isWinning:m,total:f,votes:s}),(0,a.jsx)(K,{change:P,count:b,isAye:!1,isWinning:!m,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:$?B?"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:h}),(0,a.jsx)(r.Vh,{expanded:E,onClick:I})]})})]}),(0,a.jsxs)("tr",{className:`${e} ${E?"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:h,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,V.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(M.If):t.consts.democracy.launchPeriod.mul(M.um).div(M.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,h]=(0,l.O)(),m=(0,c.W7)(t.derive.democracy.referendums);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(re,{referendumCount:m?.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:h})]}),n&&(0,a.jsx)(k.Z,{onClose:o}),d&&(0,a.jsx)(L,{onClose:h}),(0,a.jsx)(ae,{referendums:m}),(0,a.jsx)(T,{}),(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,h]=(0,a.useState)(0);return(0,a.useEffect)((()=>{l.current&&h((c?.length||0)+(u?.length||0))}),[l,c,u]),d}))},54705:(e,s,t)=>{t.d(s,{Z:()=>h});var a=t(52322),n=t(2784),o=t(48630),r=t(90778),i=t(9118),l=t(53598),c=t(95292),u=t(14681),d=t(88057);const h=n.memo((function({className:e,withEra:s=!0,withSession:t=!0}){const{t:n}=(0,d.$)(),{api:h}=(0,r.h)(),m=(0,i.W7)(h.derive.session?.progress),p=(0,i.W7)(h.query.staking?.forceEra),x=n("era"),g=h.query.babe?n("epoch"):n("session"),b=m?.activeEraStart.unwrapOr(null);return(0,a.jsx)(a.Fragment,{children:h.derive.session&&(0,a.jsxs)(a.Fragment,{children:[t&&(h.query.babe?(0,a.jsx)(o.Jy,{className:e,label:g,progress:{isBlurred:!m,total:m?.sessionLength||c.Jo,value:m?.sessionProgress||c.um,withTime:!0}}):(0,a.jsxs)(o.Jy,{label:g,children:["#",m?(0,u.u)(m.currentIndex):(0,a.jsx)("span",{className:"--tmp",children:"123"}),s&&b&&(0,a.jsx)("div",{className:"isSecondary",children:" "})]})),s&&(h.query.babe?(0,a.jsx)(o.Jy,{className:e,label:x,progress:{isBlurred:!(m&&p),total:m&&p?p.isForceAlways?m.sessionLength:m.eraLength:c.Jo,value:m&&p?p.isForceAlways?m.sessionProgress:m.eraProgress:c.um,withTime:!0}}):(0,a.jsxs)(o.Jy,{className:e,label:x,children:["#",m?(0,u.u)(m.activeEra):(0,a.jsx)("span",{className:"--tmp",children:"123"}),b&&(0,a.jsxs)(l.Z,{className:(m?"":"--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(48630),i=t(90778),l=t(75387),c=t(67405),u=t(33661),d=t(47297),h=t(14681);const m={aspectRatio:6,maintainAspectRatio:!0},p=r.zo.div` +`,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),m=t||u.query.democracy?.preimages?n:d?.proposal;if(!m){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}=m.registry.findMetaCall(m.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:m,withHash:!g&&!y,children:[y&&(0,a.jsx)(h,{value:m.args[0]}),g&&(0,a.jsx)(b,{value:m.args[0]})]})})}))},50472:(e,s,t)=>{t.d(s,{Z:()=>le});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(90778),l=t(38894),c=t(9118),u=t(6987),d=t(70563),h=t(30943),m=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),[k,N]=(0,n.useState)(d.consts.democracy.fastTrackVotingPeriod||f),[{proposal:S,proposalLength:A},I]=(0,n.useState)((()=>({proposalLength:0}))),[E,T]=(0,l.O)(!0),D=(0,m.m)("technicalCommittee"),P=(0,c.W7)(D&&d.query[D].proposalCount),M=(0,n.useMemo)((()=>new(x())(Math.ceil(s.length*(0,h.A_)(d,!k||d.consts.democracy.fastTrackVotingPeriod.lte(k))))),[d,s,k]),z=(0,n.useMemo)((()=>{if(!(D&&S&&P&&d.tx.utility))return null;const e=3===d.tx[D].propose.meta.args.length?d.tx[D].propose(M,S,A):d.tx[D].propose(M,S);return E&&s.length>1?d.tx.utility.batch([e,d.tx[D].vote(S.method.hash,P,!0)]):e}),[d,s,M,D,S,P,A,E]);return(0,n.useEffect)((()=>{const s=C&&!C.isZero()&&k&&!k.isZero()?d.tx.democracy.fastTrack(e,k,C):null;I({proposal:s,proposalLength:s?.length||0})}),[d,C,e,s,k]),D&&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:N,value:k}),(0,a.jsx)(r.Rn,{isZeroable:!1,label:o("delay"),onChange:w,value:C}),(0,a.jsx)(r.Rn,{defaultValue:M,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:T,value:E})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:v,extrinsic:z,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 k=t(10842),N=t(58607),S=t(34814),A=t(81661);const I=n.memo((function({deposit:e,depositors:s,image:t,proposalId:o}){const{t:c}=(0,u.$)(),{hasAccounts:d}=(0,S.x)(),{api:h}=(0,i.h)(),[m,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)(A.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||h.consts.democracy.minimumDeposit,isDisabled:!0,label:c("deposit required")})})]}),(0,a.jsx)(r.u_.Actions,{children:(0,a.jsx)(r.cA,{accountId:m,icon:"sign-in-alt",isDisabled:!m,label:c("Endorse"),onStart:g,params:2===h.tx.democracy.second.meta.args.length?[o,s.length]:[o],tx:h.tx.democracy.second})})]}),(0,a.jsx)(r.zx,{icon:"toggle-off",label:c("Endorse"),onClick:g})]}):null})),E=n.memo((function({className:e="",value:{balance:s,image:t,imageHash:o,index:i,proposer:c,seconds:d}}){const{t:h}=(0,u.$)(),[m,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 ${m?"":"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)(N.Z,{value:s})}),(0,a.jsx)("td",{className:"expand",children:0!==x.length&&(0,a.jsx)(r.n0,{empty:x&&h("No endorsements"),renderChildren:g,summary:h("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)(I,{deposit:s,depositors:d||[],image:t,proposalId:i}),(0,a.jsx)(r.Vh,{expanded:m,onClick:p})]})})]}),(0,a.jsxs)("tr",{className:`${e} ${m?"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})})})})]})]})})),T=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)(E,{value:e},e.index.toString())))})}));var D=t(31313),P=t(67609),M=t(95292),z=t(74076),F=t(33661);const L=n.memo((function({className:e="",onClose:s}){const{t}=(0,u.$)(),{api:o}=(0,i.h)(),[l,d]=(0,n.useState)(null),[h,m]=(0,n.useState)(),[{imageHash:p,isImageHashValid:x},g]=(0,n.useState)({imageHash:null,isImageHashValid:!1}),[{imageLen:b,imageLenDefault:f,isImageLenValid:j},v]=(0,n.useState)({imageLen:M.nw,isImageLenValid:!1}),y=(0,c.W7)(o.query.democracy.publicProps),C=(0,D.CH)(p);(0,n.useEffect)((()=>{C?.proposalLength&&v((e=>({imageLen:e.imageLen,imageLenDefault:C.proposalLength,isImageLenValid:e.isImageLenValid})))}),[C]);const w=(0,n.useCallback)((e=>g({imageHash:e,isImageHashValid:(0,z.vq)(e,256)})),[]),k=(0,n.useCallback)((e=>{e&&v((s=>({imageLen:e,imageLenDefault:s.imageLenDefault,isImageLenValid:!e.isZero()})))}),[]),N=h?.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)(P.Z,{label:(0,a.jsx)("span",{className:"label",children:t("transferable")}),params:l}),onChange:d,type:"account"})}),(0,a.jsxs)(r.u_.Columns,{hint:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{children:t("The hash of the preimage for the proposal as previously submitted or intended.")}),(0,a.jsx)("p",{children:t("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:!x,label:t("preimage hash"),onChange:w,value:p||""}),(0,a.jsx)(r.Rn,{defaultValue:f,isDisabled:!!C?.proposalLength&&!C?.proposalLength.isZero()&&x&&j,isError:!j,label:t("preimage length"),onChange:k,value:b},"inputLength")]}),(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:!N,label:t("locked balance"),onChange:m}),(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:!h||!N||!x||!l||!y||(0,F.m)(o.tx.preimage?.notePreimage)&&!(0,F.m)(o.tx.democracy?.notePreimage)&&!C,label:t("Submit proposal"),onStart:s,params:3===o.tx.democracy.propose.meta.args.length?[p,h,y?.length]:(0,F.m)(o.tx.preimage?.notePreimage)&&!(0,F.m)(o.tx.democracy?.notePreimage)?[C&&{Lookup:{hash:C.proposalHash,len:b}},h]:[p,h],tx:o.tx.democracy.propose})})]})}));var V=t(54383),_=t(65874),R=t(14681),$=t(47538),H=t(11677),B=t(15938);const O=new(x())(-1),W=new(x())(2);function q(e,s,t,a,n,o){const r=1===o?M.If:O,i=t.add(a),l=M.If.muln(10*n).mul(i).div(M.aP);return[i,e.add(r.mul(i)),x().max(M.nw,s.add(r.mul(l)))]}function Z(e,s,{votedAye:t,votedNay:a,votedTotal:n},o,r,i){for(;;){const[l,c,u]=q(t,n,r,i,o?0:1,o?-1:1);if((0,B.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]=q(a,n,r,i,o?1:0,o?1:-1);if((0,B.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:M.nw,changeNay:M.nw});return(0,n.useEffect)((()=>{r&&u(function(e,s,t){const a=(0,B.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()?M.nw:e,changeNay:t.votedAye.isZero()?M.nw:e}}let n=M.nw,o=M.nw,r=t.votedTotal.div(W);for(;!r.isZero();){n=Z(e,s,t,a,n,r),o=U(e,s,t,a,o,r);const i=r.div(W);i.isZero()&&(n=n.add(r),o=o.add(r)),r=i}return{changeAye:t.votedNay.isZero()?M.nw:a?x().min(n,t.votedAye):n,changeNay:t.votedAye.isZero()?M.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})})),X=[1,10,20,30,40,50,60],K=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(X[e.vote.conviction.toNumber()]).div(M.aP);return s.balance.muln(X[s.vote.conviction.toNumber()]).div(M.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)(N.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,h]=(0,n.useState)(null),[m,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&&!m;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)(A.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:h})}),(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:m,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:m,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:h,isPassing:m,status:p,voteCountAye:g,voteCountNay:b,votedAye:f,votedNay:j,votedTotal:C}}){const{t:w}=(0,u.$)(),{api:k}=(0,i.h)(),{allAccounts:N}=(0,S.x)(),A=(0,V.C)(),[I,E]=(0,l.O)(!1),T=(0,c.W7)(k.query.balances?.totalIssuance),{changeAye:D,changeNay:P}=J(p.threshold,f,j,C),z=(0,n.useMemo)((()=>p.threshold.type.toString().replace("majority"," majority ")),[p]),F=f.add(j),[L,{hasVoted:H,hasVotedAye:B}]=(0,n.useMemo)((()=>{if(T){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})=>N.includes(e.toString())));return[{aye:C.isZero()?"":`${se(e,C)}%`,nay:C.isZero()?"":`${se(a,C)}%`,turnout:`${se(C,T)}%`},{hasVoted:n||t.some((({accountId:e})=>N.includes(e.toString()))),hasVotedAye:n}]}return[null,{hasVoted:!1,hasVotedAye:!1}]}),[N,s,t,T,C]);if(!A||p.end.sub(A).lten(0))return null;const O=p.end.add(p.delay),W=p.end.sub(A).isub(M.If);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:`${e} isExpanded isFirst ${I?"":"isLast"}`,children:[(0,a.jsx)(r.iA.Column.Id,{value:h}),(0,a.jsx)(y.Z,{imageHash:d,proposal:o?.proposal}),(0,a.jsxs)("td",{className:"number together media--1200",children:[(0,a.jsx)(_.Z,{value:W}),w("{{blocks}} blocks",{replace:{blocks:(0,R.u)(W)}})]}),(0,a.jsxs)("td",{className:"number together media--1400",children:[(0,a.jsx)(_.Z,{value:O.sub(A)}),"#",(0,R.u)(O)]}),(0,a.jsx)("td",{className:"number together media--1400",children:L&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{children:L.turnout})})}),(0,a.jsx)("td",{className:"badge",children:(0,$.j)(m)&&(0,a.jsx)(r.Ct,{color:m?"green":"red",hover:w(m?"{{threshold}}, passing":"{{threshold}}, not passing",{replace:{threshold:z}}),icon:m?"check":"times"})}),(0,a.jsxs)("td",{className:"expand",children:[(0,a.jsx)(K,{change:D,count:g,isAye:!0,isWinning:m,total:f,votes:s}),(0,a.jsx)(K,{change:P,count:b,isAye:!1,isWinning:!m,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?B?"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:h}),(0,a.jsx)(r.Vh,{expanded:I,onClick:E})]})})]}),(0,a.jsxs)("tr",{className:`${e} ${I?"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:h,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,V.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(M.If):t.consts.democracy.launchPeriod.mul(M.um).div(M.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,h]=(0,l.O)(),m=(0,c.W7)(t.derive.democracy.referendums);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(re,{referendumCount:m?.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:h})]}),n&&(0,a.jsx)(k.Z,{onClose:o}),d&&(0,a.jsx)(L,{onClose:h}),(0,a.jsx)(ae,{referendums:m}),(0,a.jsx)(T,{}),(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,h]=(0,a.useState)(0);return(0,a.useEffect)((()=>{l.current&&h((c?.length||0)+(u?.length||0))}),[l,c,u]),d}))},54705:(e,s,t)=>{t.d(s,{Z:()=>h});var a=t(52322),n=t(2784),o=t(48630),r=t(90778),i=t(9118),l=t(53598),c=t(95292),u=t(14681),d=t(88057);const h=n.memo((function({className:e,withEra:s=!0,withSession:t=!0}){const{t:n}=(0,d.$)(),{api:h}=(0,r.h)(),m=(0,i.W7)(h.derive.session?.progress),p=(0,i.W7)(h.query.staking?.forceEra),x=n("era"),g=h.query.babe?n("epoch"):n("session"),b=m?.activeEraStart.unwrapOr(null);return(0,a.jsx)(a.Fragment,{children:h.derive.session&&(0,a.jsxs)(a.Fragment,{children:[t&&(h.query.babe?(0,a.jsx)(o.Jy,{className:e,label:g,progress:{isBlurred:!m,total:m?.sessionLength||c.Jo,value:m?.sessionProgress||c.um,withTime:!0}}):(0,a.jsxs)(o.Jy,{label:g,children:["#",m?(0,u.u)(m.currentIndex):(0,a.jsx)("span",{className:"--tmp",children:"123"}),s&&b&&(0,a.jsx)("div",{className:"isSecondary",children:" "})]})),s&&(h.query.babe?(0,a.jsx)(o.Jy,{className:e,label:x,progress:{isBlurred:!(m&&p),total:m&&p?p.isForceAlways?m.sessionLength:m.eraLength:c.Jo,value:m&&p?p.isForceAlways?m.sessionProgress:m.eraProgress:c.um,withTime:!0}}):(0,a.jsxs)(o.Jy,{className:e,label:x,children:["#",m?(0,u.u)(m.activeEra):(0,a.jsx)("span",{className:"--tmp",children:"123"}),b&&(0,a.jsxs)(l.Z,{className:(m?"":"--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(48630),i=t(90778),l=t(75387),c=t(67405),u=t(33661),d=t(47297),h=t(14681);const m={aspectRatio:6,maintainAspectRatio:!0},p=r.zo.div` background: var(--bg-table); border: 1px solid var(--border-table); border-radius: 0.25rem; @@ -811,7 +811,7 @@ .explorer--query { width: 20em; } -`,S=n.memo((function({className:e="",value:s}){const{t}=(0,g.$)(),[{isValid:o,value:i},l]=(0,n.useState)((()=>k(s||""))),c=(0,n.useCallback)((e=>l(k(e))),[]),u=(0,n.useCallback)((()=>{o&&0!==i.length&&(window.location.hash=`/explorer/query/${i}`)}),[o,i]);return(0,a.jsx)(N,{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 A=t(39857),E=t(74065),I=t(56949),T=t(98202);const D=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)(T.Z,{className:"details",eventName:t,value:s,withExpander:!0}):null})})),P=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)(D,{value:r}),t&&(0,a.jsxs)("div",{className:"absolute --digits",children:[1!==n.length&&(0,a.jsxs)("span",{children:[(0,h.u)(n.length),"x "]}),(0,a.jsxs)(A.rU,{to:`/explorer/query/${s||""}`,children:[(0,h.u)(t),"-",n[0].toString().padStart(2,"0")]})]})]})},o)}(o,e)))})}));var M=t(15991),z=t(48801),F=t.n(z);const L=new(F())(1e4),V=r.zo.tr` +`,S=n.memo((function({className:e="",value:s}){const{t}=(0,g.$)(),[{isValid:o,value:i},l]=(0,n.useState)((()=>k(s||""))),c=(0,n.useCallback)((e=>l(k(e))),[]),u=(0,n.useCallback)((()=>{o&&0!==i.length&&(window.location.hash=`/explorer/query/${i}`)}),[o,i]);return(0,a.jsx)(N,{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 A=t(39857),I=t(74065),E=t(56949),T=t(98202);const D=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)(T.Z,{className:"details",eventName:t,value:s,withExpander:!0}):null})})),P=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)(D,{value:r}),t&&(0,a.jsxs)("div",{className:"absolute --digits",children:[1!==n.length&&(0,a.jsxs)("span",{children:[(0,h.u)(n.length),"x "]}),(0,a.jsxs)(A.rU,{to:`/explorer/query/${s||""}`,children:[(0,h.u)(t),"-",n[0].toString().padStart(2,"0")]})]})]})},o)}(o,e)))})}));var M=t(15991),z=t(48801),F=t.n(z);const L=new(F())(1e4),V=r.zo.tr` .explorer--BlockByHash-event+.explorer--BlockByHash-event { margin-top: 0.75rem; } @@ -836,7 +836,7 @@ text-overflow: ellipsis; white-space: nowrap; } -`,_=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:m,section:p}=(0,n.useMemo)((()=>l.registry.findMetaCall(l.callIndex)),[l]),x=(0,n.useMemo)((()=>"timestamp"===p&&"set"===m?new Date(l.args[0].unwrap().toNumber()):void 0),[m,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,h.u)(s[1]),startAt:(0,h.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,I.ZQ)(o.weight);return[o,r?.v1Weight,r&&t?r.v1Weight.mul(L).div(t).toNumber()/100:0,a]}(o,t,i)),[o,t,i]);return(0,a.jsxs)(V,{className:s,children:[(0,a.jsxs)("td",{className:"top",colSpan:2,children:[(0,a.jsx)(M.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)(D,{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,h.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,h.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)(_,{blockNumber:e,events:t,index:n,maxBlockWeight:i,value:s,withLink:c},`extrinsic:${n}`)))})}));var H=t(89176),$=t(6046);function B(e){const s=e.Types.map((e=>({type:(0,$.s)(e)}))),t=e.toArray().map((e=>({isValid:!0,value:e})));return(0,a.jsx)(H.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}const O=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:B(e)})})},`justification:${s}`)))}):null}));var q=t(45409),W=t(71285),Z=t(54436),U=t(49754);function J(e){return e.value instanceof q.A?function(e){const s=Object.entries(e.Type).map((([e,s])=>({name:e,type:(0,$.s)(s)}))),t=e.toArray().map((e=>({isValid:!0,value:e})));return(0,a.jsx)(H.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}(e.value):e.value instanceof W.p?function(e){const s=e.Types.map((e=>({type:(0,$.s)(e)}))),t=e.toArray().map((e=>({isValid:!0,value:e})));return(0,a.jsx)(H.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}(e.value):e.value instanceof Z.B?function(e){const s=(0,$.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)(H.ZP,{isDisabled:!0,params:n,values:t,withExpander:!0})}(e.value):e.value instanceof U.N?(s=e.value,(0,a.jsx)(H.ZP,{isDisabled:!0,params:[{type:(0,$.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 X=n.memo((function({events:e,maxBlockWeight:s,maxProofSize:t,signedBlock:o}){const{t:l}=(0,g.$)(),{api:c}=(0,i.h)(),[u,d,m,p]=(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,I.ZQ)(("ExtrinsicSuccess"===n?a[0]:a[1]).weight).v1Weight):t,"system"===o&&["ExtrinsicFailed","ExtrinsicSuccess"].includes(n)?(0,I.ZQ)(("ExtrinsicSuccess"===n?a[0]:a[1]).weight).v2Weight.proofSize.toBn():Q.nw]),[new(F())(0),new(F())(0),new(F())(0),new(F())(0)]):[]}(e)),[e]);return(0,a.jsxs)(r.Ty,{children:[(0,a.jsx)("section",{children:c.query.balances&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{label:l("deposits"),children:(0,a.jsx)(Y.Z,{className:u?"":"--tmp",value:u||Q.If})}),(0,a.jsx)(r.Jy,{className:"media--1000",label:l("transfers"),children:(0,a.jsx)(Y.Z,{className:d?"":"--tmp",value:d||Q.If})})]})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:l("block weight"),progress:{hideValue:!0,isBlurred:!(s&&m),total:s&&m?s:Q.Jo,value:s&&m?m:Q.um},children:m?(0,h.u)(m):(0,a.jsx)("span",{className:"--tmp",children:"999,999,999"})}),t&&p&&(0,a.jsx)(r.Jy,{label:l("proof size"),progress:{hideValue:!0,isBlurred:!1,total:t,value:p},children:(0,h.u)(p)})]}),(0,a.jsxs)("section",{className:"media--900",children:[(0,a.jsx)(r.Jy,{label:l("event count"),children:e?(0,h.u)(e.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{label:l("extrinsic count"),children:o?(0,h.u)(o.block.extrinsics.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]})]})})),K=[["...","start",6]],ee=n.memo((function({className:e="",error:s,value:t}){const{t:o}=(0,g.$)(),{api:l}=(0,i.h)(),c=(0,E.X)(),[{events:u,getBlock:d,getHeader:m,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,I.ZQ)(l.consts.system.blockWeights.maxBlock).v2Weight]),[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 k=(0,n.useMemo)((()=>m?[[(0,h.u)(m.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"]]:K),[m,p,o]),N=m?.number.unwrap(),S=m?.parentHash.toHex(),T=!m?.parentHash.isEmpty;return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(X,{events:u,maxBlockWeight:C.refTime.toBn(),maxProofSize:C.proofSize.toBn(),signedBlock:d}),(0,a.jsx)(r.iA,{header:k,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&&m&&!d.isEmpty&&!m.isEmpty&&(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address",children:m.author&&(0,a.jsx)(r.N,{value:m.author})}),(0,a.jsx)("td",{className:"hash overflow",children:m.hash.toHex()}),(0,a.jsx)("td",{className:"hash overflow",children:T?(0,a.jsx)(A.rU,{to:`/explorer/query/${S||""}`,children:S}):S}),(0,a.jsx)("td",{className:"hash overflow media--1300",children:m.extrinsicsRoot.toHex()}),(0,a.jsx)("td",{className:"hash overflow media--1200",children:m.stateRoot.toHex()}),(0,a.jsx)("td",{className:"media--1000",children:t&&(0,a.jsx)(r.NR,{data:t,type:"block"})})]})}),d&&m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R,{blockNumber:N,events:u,maxBlockWeight:C.refTime.toBn(),value:d.block.extrinsics,withLink:y}),(0,a.jsxs)(r.P0,{children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(P,{error:j,eventClassName:"explorer--BlockByHash-block",events:w,label:o("system events")})}),(0,a.jsxs)(r.P0.Column,{children:[(0,a.jsx)(G,{value:m.digest.logs}),(0,a.jsx)(O,{value:d.justifications})]})]})]})]})})),se=n.memo((function({value:e}){const{api:s}=(0,i.h)(),[t,o]=(0,n.useState)(null),r=(0,E.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 he=(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])})),me=["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` +`,_=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:m,section:p}=(0,n.useMemo)((()=>l.registry.findMetaCall(l.callIndex)),[l]),x=(0,n.useMemo)((()=>"timestamp"===p&&"set"===m?new Date(l.args[0].unwrap().toNumber()):void 0),[m,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,h.u)(s[1]),startAt:(0,h.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,E.ZQ)(o.weight);return[o,r?.v1Weight,r&&t?r.v1Weight.mul(L).div(t).toNumber()/100:0,a]}(o,t,i)),[o,t,i]);return(0,a.jsxs)(V,{className:s,children:[(0,a.jsxs)("td",{className:"top",colSpan:2,children:[(0,a.jsx)(M.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)(D,{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,h.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,h.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)(_,{blockNumber:e,events:t,index:n,maxBlockWeight:i,value:s,withLink:c},`extrinsic:${n}`)))})}));var $=t(89176),H=t(6046);function B(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)($.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}const O=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:B(e)})})},`justification:${s}`)))}):null}));var W=t(45409),q=t(71285),Z=t(54436),U=t(49754);function J(e){return e.value instanceof W.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)($.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}(e.value):e.value instanceof q.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)($.ZP,{isDisabled:!0,params:s,values:t,withExpander:!0})}(e.value):e.value instanceof Z.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)($.ZP,{isDisabled:!0,params:n,values:t,withExpander:!0})}(e.value):e.value instanceof U.N?(s=e.value,(0,a.jsx)($.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 X=n.memo((function({events:e,maxBlockWeight:s,maxProofSize:t,signedBlock:o}){const{t:l}=(0,g.$)(),{api:c}=(0,i.h)(),[u,d,m,p]=(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,E.ZQ)(("ExtrinsicSuccess"===n?a[0]:a[1]).weight).v1Weight):t,"system"===o&&["ExtrinsicFailed","ExtrinsicSuccess"].includes(n)?(0,E.ZQ)(("ExtrinsicSuccess"===n?a[0]:a[1]).weight).v2Weight.proofSize.toBn():Q.nw]),[new(F())(0),new(F())(0),new(F())(0),new(F())(0)]):[]}(e)),[e]);return(0,a.jsxs)(r.Ty,{children:[(0,a.jsx)("section",{children:c.query.balances&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Jy,{label:l("deposits"),children:(0,a.jsx)(Y.Z,{className:u?"":"--tmp",value:u||Q.If})}),(0,a.jsx)(r.Jy,{className:"media--1000",label:l("transfers"),children:(0,a.jsx)(Y.Z,{className:d?"":"--tmp",value:d||Q.If})})]})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:l("block weight"),progress:{hideValue:!0,isBlurred:!(s&&m),total:s&&m?s:Q.Jo,value:s&&m?m:Q.um},children:m?(0,h.u)(m):(0,a.jsx)("span",{className:"--tmp",children:"999,999,999"})}),t&&p&&(0,a.jsx)(r.Jy,{label:l("proof size"),progress:{hideValue:!0,isBlurred:!1,total:t,value:p},children:(0,h.u)(p)})]}),(0,a.jsxs)("section",{className:"media--900",children:[(0,a.jsx)(r.Jy,{label:l("event count"),children:e?(0,h.u)(e.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})}),(0,a.jsx)(r.Jy,{label:l("extrinsic count"),children:o?(0,h.u)(o.block.extrinsics.length):(0,a.jsx)("span",{className:"--tmp",children:"99"})})]})]})})),K=[["...","start",6]],ee=n.memo((function({className:e="",error:s,value:t}){const{t:o}=(0,g.$)(),{api:l}=(0,i.h)(),c=(0,I.X)(),[{events:u,getBlock:d,getHeader:m,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,E.ZQ)(l.consts.system.blockWeights.maxBlock).v2Weight]),[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 k=(0,n.useMemo)((()=>m?[[(0,h.u)(m.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"]]:K),[m,p,o]),N=m?.number.unwrap(),S=m?.parentHash.toHex(),T=!m?.parentHash.isEmpty;return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(X,{events:u,maxBlockWeight:C.refTime.toBn(),maxProofSize:C.proofSize.toBn(),signedBlock:d}),(0,a.jsx)(r.iA,{header:k,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&&m&&!d.isEmpty&&!m.isEmpty&&(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"address",children:m.author&&(0,a.jsx)(r.N,{value:m.author})}),(0,a.jsx)("td",{className:"hash overflow",children:m.hash.toHex()}),(0,a.jsx)("td",{className:"hash overflow",children:T?(0,a.jsx)(A.rU,{to:`/explorer/query/${S||""}`,children:S}):S}),(0,a.jsx)("td",{className:"hash overflow media--1300",children:m.extrinsicsRoot.toHex()}),(0,a.jsx)("td",{className:"hash overflow media--1200",children:m.stateRoot.toHex()}),(0,a.jsx)("td",{className:"media--1000",children:t&&(0,a.jsx)(r.NR,{data:t,type:"block"})})]})}),d&&m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R,{blockNumber:N,events:u,maxBlockWeight:C.refTime.toBn(),value:d.block.extrinsics,withLink:y}),(0,a.jsxs)(r.P0,{children:[(0,a.jsx)(r.P0.Column,{children:(0,a.jsx)(P,{error:j,eventClassName:"explorer--BlockByHash-block",events:w,label:o("system events")})}),(0,a.jsxs)(r.P0.Column,{children:[(0,a.jsx)(G,{value:m.digest.logs}),(0,a.jsx)(O,{value:d.justifications})]})]})]})]})})),se=n.memo((function({value:e}){const{api:s}=(0,i.h)(),[t,o]=(0,n.useState)(null),r=(0,I.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 he=(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])})),me=["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); @@ -865,7 +865,7 @@ 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,h.u)(s)})]},t)))})}));var ye=t(53598),Ce=t(95689);const we={extrinsics:null,health:null,peers:null},ke=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,h.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,h.u)(l)}),(0,a.jsx)(r.Jy,{label:i("our best"),children:(0,a.jsx)(Ce.Z,{})})]})]})})),Ne=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)(ke,{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 Ae(e){return e.reduce(((e,{arr:s,hdr:t})=>(t.height=t.isEmpty?0:1+Ae(s),Math.max(e,t.height))),0)}function Ee({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 Ie(e){return e.length?Ie(e.reduce(((e,{arr:s})=>e.concat(...s)),[])).concat({bn:e.reduce(((e,{hdr:{bn:s}})=>e||s),""),cols:e.map(Ee)}):[]}function Te(e,s,t,a,n=!1){return{author:a,bn:e,hash:s,height:0,isEmpty:n,isFinalized:!1,parent:t,width:0}}function De(){return{arr:[],hdr:Te(""," "," ",null,!0)}}function Pe(e){e.some((({arr:e})=>0!==e.length))&&(e.filter((({arr:e})=>0===e.length)).forEach((({arr:e})=>e.push(De()))),Pe(e.reduce(((e,{arr:s})=>e.concat(...s)),[])))}function Me(e){return!(!e[0]||e[0].isEmpty)&&e.reduce(((e,s,t)=>(0===t||!!s.isEmpty)&&e),!0)}function ze({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 Fe(e){const s=e.length-1;let t=!1;return e.map((({bn:n,cols:o},r)=>{if(0!==r&&r!==s&&Me(o)){if(t)return null;if(Me(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(ze)]},n)}))}const Le=r.zo.div` +`,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,h.u)(s)})]},t)))})}));var ye=t(53598),Ce=t(95689);const we={extrinsics:null,health:null,peers:null},ke=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,h.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,h.u)(l)}),(0,a.jsx)(r.Jy,{label:i("our best"),children:(0,a.jsx)(Ce.Z,{})})]})]})})),Ne=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)(ke,{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 Ae(e){return e.reduce(((e,{arr:s,hdr:t})=>(t.height=t.isEmpty?0:1+Ae(s),Math.max(e,t.height))),0)}function Ie({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 Ee(e){return e.length?Ee(e.reduce(((e,{arr:s})=>e.concat(...s)),[])).concat({bn:e.reduce(((e,{hdr:{bn:s}})=>e||s),""),cols:e.map(Ie)}):[]}function Te(e,s,t,a,n=!1){return{author:a,bn:e,hash:s,height:0,isEmpty:n,isFinalized:!1,parent:t,width:0}}function De(){return{arr:[],hdr:Te(""," "," ",null,!0)}}function Pe(e){e.some((({arr:e})=>0!==e.length))&&(e.filter((({arr:e})=>0===e.length)).forEach((({arr:e})=>e.push(De()))),Pe(e.reduce(((e,{arr:s})=>e.concat(...s)),[])))}function Me(e){return!(!e[0]||e[0].isEmpty)&&e.reduce(((e,s,t)=>(0===t||!!s.isEmpty)&&e),!0)}function ze({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 Fe(e){const s=e.length-1;let t=!1;return e.map((({bn:n,cols:o},r)=>{if(0!==r&&r!==s&&Me(o)){if(t)return null;if(Me(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(ze)]},n)}))}const Le=r.zo.div` margin-bottom: 1.5rem; table { @@ -934,7 +934,7 @@ } } } -`,Ve=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),m=(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=Ae(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=De();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)})),Pe(e.arr),e.hdr.height=Ae(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,h.u)(e.number),a=e.hash.toHex(),n=e.parentHash.toHex();let o=!1;if(m.current||(m.current=s),!d.current.has(a)){if(m.current===s&&c.current.get("root").push(a),d.current.set(a,Te(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)&&m.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)(Le,{className:e,children:[(0,a.jsx)(r.Ty,{children:(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("blocks"),children:(0,h.u)(u.current.numBlocks)}),(0,a.jsx)(r.Jy,{label:s("forks"),children:(0,h.u)(u.current.numForks)})]})}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:Fe(Ie(o.arr))})})]}):null})),_e=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)(A.rU,{to:`/explorer/query/${s}`,children:(0,h.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)(_e,{value:e},e.number.toString())))})}));var He=t(67634),$e=t(65874),Be=t(79608),Oe=t(96916),qe=t(26839),We=t(54705);const Ze=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)(He.Z,{})}),(0,a.jsx)(r.Jy,{className:"media--800",label:s("target"),children:(0,a.jsx)($e.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)(Be.Z,{})}),!!t.query.balances.inactiveIssuance&&(0,a.jsx)(r.Jy,{className:"media--1300",label:s("inactive issuance"),children:(0,a.jsx)(Oe.Z,{})})]})]}),(0,a.jsx)("section",{className:"media--1100",children:(0,a.jsx)(We.Z,{withEra:!1})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{className:"media--1400",label:s("last events"),children:(0,h.u)(e)}),t.query.grandpa&&(0,a.jsx)(r.Jy,{label:s("finalized"),children:(0,a.jsx)(qe.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)(Ze,{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)(P,{events:s})})]})]})})),Je=n.memo((function({basePath:e,className:s}){const{t}=(0,g.$)(),{api:d}=(0,i.h)(),{lastHeaders:h}=(0,l.E)(),{eventCount:m,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)(Ve,{}),path:"forks"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(be,{}),path:"latency"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Ne,{}),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:m,events:p,headers:h}),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:()=>N});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(90778),l=t(98988),c=t(48731),u=t(74076),d=t(51330),h=t(57198),m=t(65417),p=t(55858),x=t(61349);function g(){return(0,x.$G)("app-extrinsics")}const b=(0,r.zo)(r.P0)` +`,Ve=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),m=(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=Ae(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=De();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)})),Pe(e.arr),e.hdr.height=Ae(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,h.u)(e.number),a=e.hash.toHex(),n=e.parentHash.toHex();let o=!1;if(m.current||(m.current=s),!d.current.has(a)){if(m.current===s&&c.current.get("root").push(a),d.current.set(a,Te(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)&&m.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)(Le,{className:e,children:[(0,a.jsx)(r.Ty,{children:(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{label:s("blocks"),children:(0,h.u)(u.current.numBlocks)}),(0,a.jsx)(r.Jy,{label:s("forks"),children:(0,h.u)(u.current.numForks)})]})}),(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:Fe(Ee(o.arr))})})]}):null})),_e=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)(A.rU,{to:`/explorer/query/${s}`,children:(0,h.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)(_e,{value:e},e.number.toString())))})}));var $e=t(67634),He=t(65874),Be=t(79608),Oe=t(96916),We=t(26839),qe=t(54705);const Ze=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)($e.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)(Be.Z,{})}),!!t.query.balances.inactiveIssuance&&(0,a.jsx)(r.Jy,{className:"media--1300",label:s("inactive issuance"),children:(0,a.jsx)(Oe.Z,{})})]})]}),(0,a.jsx)("section",{className:"media--1100",children:(0,a.jsx)(qe.Z,{withEra:!1})}),(0,a.jsxs)("section",{children:[(0,a.jsx)(r.Jy,{className:"media--1400",label:s("last events"),children:(0,h.u)(e)}),t.query.grandpa&&(0,a.jsx)(r.Jy,{label:s("finalized"),children:(0,a.jsx)(We.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)(Ze,{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)(P,{events:s})})]})]})})),Je=n.memo((function({basePath:e,className:s}){const{t}=(0,g.$)(),{api:d}=(0,i.h)(),{lastHeaders:h}=(0,l.E)(),{eventCount:m,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)(Ve,{}),path:"forks"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(be,{}),path:"latency"}),(0,a.jsx)(o.AW,{element:(0,a.jsx)(Ne,{}),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:m,events:p,headers:h}),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:()=>N});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),i=t(90778),l=t(98988),c=t(48731),u=t(74076),d=t(51330),h=t(57198),m=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; @@ -950,7 +950,7 @@ .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:k,extrinsicFn:N,extrinsicKey:S,extrinsicPayload:A,isCall:E},I]=(0,n.useState)(j),T=(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,h.Y)(s.encodedLength),e);a=y.createType("ExtrinsicPayload",t),(0,c.hu)((0,m.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)),I({...j,decoded:n,extrinsicCall:s,extrinsicFn:l,extrinsicHex:e,extrinsicKey:p,extrinsicPayload:a,isCall:o}),t({call:s,fn:l,hex:e})}catch(e){I({...j,extrinsicError:e.message}),t(null)}}),[y,t]);return(0,a.jsxs)(v,{className:e,children:[(0,a.jsx)(r.II,{defaultValue:x,isError:!N,label:b("hex-encoded call"),onChange:T,placeholder:b("0x...")}),k&&(0,a.jsx)(r.oy,{content:k}),N&&w&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.UT,{defaultValue:N,isDisabled:!0,label:b("decoded call")},`extrinsicKey:${S}`),(0,a.jsx)(l.Z,{className:"details",value:w})]}),(0,a.jsx)(f,{extrinsic:C,isCall:E,payload:A,withData:!1})]})}));var C=t(60404),w=t(36609);const k=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),[h,m]=(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=>m((()=>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:h,isCall:!0}),u&&!h&&(0,a.jsx)(r.oy,{content:u}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.cA,{extrinsic:h,icon:"sign-in-alt",isUnsigned:!0,label:t("Submit Unsigned"),withSpinner:!0}),(0,a.jsx)(r.cA,{accountId:l,extrinsic:h,icon:"sign-in-alt",label:t("Submit Transaction")})]})]})})),N=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)(k,{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:()=>V});var a=t(52322),n=t(2784),o=t(48630),r=t(46782),i=t.n(r),l=t(86135),c=t(23729),u=t.n(c);const d={files:[],isLoad:!0};var h=t(61349);function m(){return(0,h.$G)("app-files")}var p=t(60418),x=t(345),g=t(69187),b=t(33661),f=t(17965),j=t(54827),v=t(55858),y=t(64021);const C=o.zo.div` +`,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:k,extrinsicFn:N,extrinsicKey:S,extrinsicPayload:A,isCall:I},E]=(0,n.useState)(j),T=(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,h.Y)(s.encodedLength),e);a=y.createType("ExtrinsicPayload",t),(0,c.hu)((0,m.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)),E({...j,decoded:n,extrinsicCall:s,extrinsicFn:l,extrinsicHex:e,extrinsicKey:p,extrinsicPayload:a,isCall:o}),t({call:s,fn:l,hex:e})}catch(e){E({...j,extrinsicError:e.message}),t(null)}}),[y,t]);return(0,a.jsxs)(v,{className:e,children:[(0,a.jsx)(r.II,{defaultValue:x,isError:!N,label:b("hex-encoded call"),onChange:T,placeholder:b("0x...")}),k&&(0,a.jsx)(r.oy,{content:k}),N&&w&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.UT,{defaultValue:N,isDisabled:!0,label:b("decoded call")},`extrinsicKey:${S}`),(0,a.jsx)(l.Z,{className:"details",value:w})]}),(0,a.jsx)(f,{extrinsic:C,isCall:I,payload:A,withData:!1})]})}));var C=t(60404),w=t(36609);const k=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),[h,m]=(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=>m((()=>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:h,isCall:!0}),u&&!h&&(0,a.jsx)(r.oy,{content:u}),(0,a.jsxs)(r.zx.Group,{children:[(0,a.jsx)(r.cA,{extrinsic:h,icon:"sign-in-alt",isUnsigned:!0,label:t("Submit Unsigned"),withSpinner:!0}),(0,a.jsx)(r.cA,{accountId:l,extrinsic:h,icon:"sign-in-alt",label:t("Submit Transaction")})]})]})})),N=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)(k,{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:()=>V});var a=t(52322),n=t(2784),o=t(48630),r=t(46782),i=t.n(r),l=t(86135),c=t(23729),u=t.n(c);const d={files:[],isLoad:!0};var h=t(61349);function m(){return(0,h.$G)("app-files")}var p=t(60418),x=t(345),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; @@ -984,7 +984,7 @@ margin-top: 2rem; width: calc(100% - 2rem); } -`,E=n.memo((function({className:e,file:s,onClose:t=N,onSuccess:r=N}){const{t:i}=m(),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]),[h,C]=(0,n.useState)(d[0]),[E,I]=(0,n.useState)((()=>g.Nn.getPairs()[0]||null)),[T,D]=(0,n.useState)(""),[{isInjected:P},M]=(0,n.useState)({isExternal:!1,isHardware:!1,isInjected:!1}),[z,F]=(0,n.useState)(!1),[{isUsable:L,signer:V},_]=(0,n.useState)({isUsable:!0,signer:null}),[R,H]=(0,n.useState)(""),[$,B]=(0,n.useState)(!1),O=(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]),[q,W]=(0,n.useState)(""),Z=O?i("Do not upload files larger than 100MB!"):q,[U,J]=(0,n.useState)({progress:0,up:!1}),[G,Y]=(0,n.useState)(null),Q=(0,n.useCallback)((e=>{e&&(D(e),I(g.Nn.getPair(e)))}),[D,I]);(0,n.useEffect)((()=>{const e=E?.meta||{},s=e.isExternal||!1,t=e.isHardware||!1,a=e.isInjected||!1,n=!(s||t||a);M({isExternal:s,isHardware:t,isInjected:a}),F(!a&&(E&&E.isLocked||!1)),_({isUsable:n,signer:null}),e.source&&a&&(0,x.R0)(e.source).catch((()=>null)).then((e=>_({isUsable:(0,b.m)(e?.signer?.signRaw),signer:e?.signer||null}))).catch(console.error)}),[E]);const X=(0,n.useCallback)((()=>new Promise(((e,s)=>{(0,f.Y)((()=>{try{E.decodePkcs8(R),e(1)}catch(e){s(e)}}))}))),[E,R]),K=(0,n.useCallback)((()=>{G&&G.cancel(),t()}),[G,t]),ee=(0,n.useCallback)((async()=>{if(W(""),L&&E)try{B(!0),z&&await X();let e="";e=V&&(0,b.m)(V.signRaw)?(await V.signRaw({address:E.address,data:(0,j.$)(E.address),type:"bytes"})).signature:(0,v.c)(E.sign((0,y.d)(E.address)));const t=`${E.address}:${e}`,a=k.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 m;if("string"==typeof d.data){const e=d.data.replace(/}\n{/g,"},{"),s=JSON.parse(`[${e}]`),t=s.length-1;m=s[t],delete s[t],m.items=s}else m=d.data;console.info("upResult:",d),Y(null),J({progress:100,up:!1});const x=h.value;await p.Z.request({data:{cid:m.Hash,name:m.Name},headers:{Authorization:o},method:"POST",url:`${x}/psa/pins`}),r({...m,PinEndpoint:x,UpEndpoint:u})}catch(e){J({progress:0,up:!1}),B(!1),console.error(e),W(e.message)}}),[s,X,V,z,L,E,h,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)(A,{className:e,header:i("Upload File"),onClose:K,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:$,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:h.value})}),(0,a.jsxs)(o.u_.Columns,{children:[(0,a.jsx)(o.rp,{defaultValue:T,isDisabled:$,label:i("Please choose account"),labelExtra:(0,a.jsx)(o.Kc,{label:i("transferable"),params:T}),onChange:Q,type:"account"}),!U.up&&z&&!P&&(0,a.jsx)(o.ro,{isError:!1,label:i("password"),onChange:H,value:R}),(0,a.jsx)(w,{className:"progress",progress:U.progress}),Z&&(0,a.jsx)(o.oy,{content:Z})]})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.zx,{icon:"arrow-circle-up",isBusy:$,isDisabled:O,label:i("Sign and Upload"),onClick:ee})})]})})),I=(0,o.zo)(o.qi)` +`,I=n.memo((function({className:e,file:s,onClose:t=N,onSuccess:r=N}){const{t:i}=m(),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]),[h,C]=(0,n.useState)(d[0]),[I,E]=(0,n.useState)((()=>g.Nn.getPairs()[0]||null)),[T,D]=(0,n.useState)(""),[{isInjected:P},M]=(0,n.useState)({isExternal:!1,isHardware:!1,isInjected:!1}),[z,F]=(0,n.useState)(!1),[{isUsable:L,signer:V},_]=(0,n.useState)({isUsable:!0,signer:null}),[R,$]=(0,n.useState)(""),[H,B]=(0,n.useState)(!1),O=(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]),[W,q]=(0,n.useState)(""),Z=O?i("Do not upload files larger than 100MB!"):W,[U,J]=(0,n.useState)({progress:0,up:!1}),[G,Y]=(0,n.useState)(null),Q=(0,n.useCallback)((e=>{e&&(D(e),E(g.Nn.getPair(e)))}),[D,E]);(0,n.useEffect)((()=>{const e=I?.meta||{},s=e.isExternal||!1,t=e.isHardware||!1,a=e.isInjected||!1,n=!(s||t||a);M({isExternal:s,isHardware:t,isInjected:a}),F(!a&&(I&&I.isLocked||!1)),_({isUsable:n,signer:null}),e.source&&a&&(0,x.R0)(e.source).catch((()=>null)).then((e=>_({isUsable:(0,b.m)(e?.signer?.signRaw),signer:e?.signer||null}))).catch(console.error)}),[I]);const X=(0,n.useCallback)((()=>new Promise(((e,s)=>{(0,f.Y)((()=>{try{I.decodePkcs8(R),e(1)}catch(e){s(e)}}))}))),[I,R]),K=(0,n.useCallback)((()=>{G&&G.cancel(),t()}),[G,t]),ee=(0,n.useCallback)((async()=>{if(q(""),L&&I)try{B(!0),z&&await X();let e="";e=V&&(0,b.m)(V.signRaw)?(await V.signRaw({address:I.address,data:(0,j.$)(I.address),type:"bytes"})).signature:(0,v.c)(I.sign((0,y.d)(I.address)));const t=`${I.address}:${e}`,a=k.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 m;if("string"==typeof d.data){const e=d.data.replace(/}\n{/g,"},{"),s=JSON.parse(`[${e}]`),t=s.length-1;m=s[t],delete s[t],m.items=s}else m=d.data;console.info("upResult:",d),Y(null),J({progress:100,up:!1});const x=h.value;await p.Z.request({data:{cid:m.Hash,name:m.Name},headers:{Authorization:o},method:"POST",url:`${x}/psa/pins`}),r({...m,PinEndpoint:x,UpEndpoint:u})}catch(e){J({progress:0,up:!1}),B(!1),console.error(e),q(e.message)}}),[s,X,V,z,L,I,h,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)(A,{className:e,header:i("Upload File"),onClose:K,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:h.value})}),(0,a.jsxs)(o.u_.Columns,{children:[(0,a.jsx)(o.rp,{defaultValue:T,isDisabled:H,label:i("Please choose account"),labelExtra:(0,a.jsx)(o.Kc,{label:i("transferable"),params:T}),onChange:Q,type:"account"}),!U.up&&z&&!P&&(0,a.jsx)(o.ro,{isError:!1,label:i("password"),onChange:$,value:R}),(0,a.jsx)(w,{className:"progress",progress:U.progress}),Z&&(0,a.jsx)(o.oy,{content:Z})]})]}),(0,a.jsx)(o.u_.Actions,{children:(0,a.jsx)(o.zx,{icon:"arrow-circle-up",isBusy:H,isDisabled:O,label:i("Sign and Upload"),onClick:ee})})]})})),E=(0,o.zo)(o.qi)` .copySpan { display: none; } @@ -1040,7 +1040,7 @@ } } } -`,L=n.memo((function({className:e}){const{t:s}=m(),{queueAction:t}=(0,l.L)(),[r,c]=(0,n.useState)(!1),h=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]),k=(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=h.files.filter((e=>!n[e.Hash]));h.setFiles([...a,...o]),y(s("Import Success"),"success")}}catch{y(s("file content error"),"error")}}),[h,y,s]),N=(0,n.useCallback)((()=>{c(!1)}),[]),S=(0,n.useCallback)((e=>{c(!1);const s=h.files.filter((s=>s.Hash!==e.Hash));h.setFiles([e,...s])}),[h]),A=(0,n.useCallback)((()=>{const e=new Blob([JSON.stringify(h.files)],{type:"application/json; charset=utf-8"});i().saveAs(e,"files.json")}),[h]);return(0,a.jsxs)(F,{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:k,ref:C,style:{display:"none"},type:"file"}),p&&r&&(0,a.jsx)(E,{file:p,onClose:N,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:z}),(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:A})]}),(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:h.files.map(((e,t)=>(0,a.jsxs)(T,{children:[(0,a.jsxs)("td",{className:"",colSpan:2,children:[e.items&&(0,a.jsx)(o.JO,{className:"highlight--color",icon:"folder"}),D(e.Name)]}),(0,a.jsx)("td",{className:"end",colSpan:2,children:e.Hash}),(0,a.jsx)("td",{className:"",colSpan:1,children:(0,a.jsx)(I,{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/status/"+e.Hash,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:M(e)}),(0,a.jsx)(I,{value:P(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.")})]})})),V=n.memo((function({basePath:e,className:s}){const{t}=m(),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)(L,{})]})}))},79865:(e,s,t)=>{t.d(s,{Z:()=>T});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),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 h=t(38894),m=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,h.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]),k=Object.keys(t),N=!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:!k.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:k,label:o("use proxied account"),labelExtra:(0,a.jsx)(m.Z,{label:(0,a.jsx)("span",{className:"label",children:o("transferable")}),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:N,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:N||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 k=new(t.n(w)())(1e4),N=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(k).imul(p.S8).div(p.Wi).toNumber()/1e4).toFixed(2),"%"]}),(0,a.jsxs)(r.Jy,{label:n("target"),children:[(e.target.mul(k).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 A={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()))})},E=(0,u.e)("useInfo",(function(){const{api:e}=(0,i.h)(),s=(0,S.L)([e.query.gilt.activeTotal,e.query.gilt.queueTotals],A);return(0,n.useMemo)((()=>({info:s})),[s])})),I=n.memo((function({className:e}){const s=d(),{info:t}=E(),o=(0,n.useMemo)((()=>!t?.activeTotal||t.activeTotal.target.isZero()),[t]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(N,{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})]})})),T=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})})})]})}))},30145:(e,s,t)=>{t.d(s,{Z:()=>M});var a=t(52322),n=t(2784),o=t(48630),r=t(90778),i=t(38894),l=t(51024),c=t(64332),u=t(63436),d=t(86674);const h={children:"Storage",color:"blue",size:"tiny"},m=[{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:h,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:h,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:h,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:h,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:h,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:h,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 transfer.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,h]=(0,n.useState)(""),m=(0,n.useCallback)((e=>h(e)),[]),p=(0,n.useCallback)((()=>{h("")}),[]),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:m,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(),k=({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)}},N=o.zo.article` +`,L=n.memo((function({className:e}){const{t:s}=m(),{queueAction:t}=(0,l.L)(),[r,c]=(0,n.useState)(!1),h=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]),k=(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=h.files.filter((e=>!n[e.Hash]));h.setFiles([...a,...o]),y(s("Import Success"),"success")}}catch{y(s("file content error"),"error")}}),[h,y,s]),N=(0,n.useCallback)((()=>{c(!1)}),[]),S=(0,n.useCallback)((e=>{c(!1);const s=h.files.filter((s=>s.Hash!==e.Hash));h.setFiles([e,...s])}),[h]),A=(0,n.useCallback)((()=>{const e=new Blob([JSON.stringify(h.files)],{type:"application/json; charset=utf-8"});i().saveAs(e,"files.json")}),[h]);return(0,a.jsxs)(F,{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:k,ref:C,style:{display:"none"},type:"file"}),p&&r&&(0,a.jsx)(I,{file:p,onClose:N,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:z}),(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:A})]}),(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:h.files.map(((e,t)=>(0,a.jsxs)(T,{children:[(0,a.jsxs)("td",{className:"",colSpan:2,children:[e.items&&(0,a.jsx)(o.JO,{className:"highlight--color",icon:"folder"}),D(e.Name)]}),(0,a.jsx)("td",{className:"end",colSpan:2,children:e.Hash}),(0,a.jsx)("td",{className:"",colSpan:1,children:(0,a.jsx)(E,{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/status/"+e.Hash,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:M(e)}),(0,a.jsx)(E,{value:P(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.")})]})})),V=n.memo((function({basePath:e,className:s}){const{t}=m(),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)(L,{})]})}))},79865:(e,s,t)=>{t.d(s,{Z:()=>T});var a=t(52322),n=t(2784),o=t(73557),r=t(48630),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 h=t(38894),m=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,h.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]),k=Object.keys(t),N=!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:!k.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:k,label:o("use proxied account"),labelExtra:(0,a.jsx)(m.Z,{label:(0,a.jsx)("span",{className:"label",children:o("transferable")}),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:N,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:N||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 k=new(t.n(w)())(1e4),N=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(k).imul(p.S8).div(p.Wi).toNumber()/1e4).toFixed(2),"%"]}),(0,a.jsxs)(r.Jy,{label:n("target"),children:[(e.target.mul(k).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 A={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()))})},I=(0,u.e)("useInfo",(function(){const{api:e}=(0,i.h)(),s=(0,S.L)([e.query.gilt.activeTotal,e.query.gilt.queueTotals],A);return(0,n.useMemo)((()=>({info:s})),[s])})),E=n.memo((function({className:e}){const s=d(),{info:t}=I(),o=(0,n.useMemo)((()=>!t?.activeTotal||t.activeTotal.target.isZero()),[t]);return(0,a.jsxs)("div",{className:e,children:[(0,a.jsx)(N,{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})]})})),T=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)(E,{}),index:!0})})})]})}))},30145:(e,s,t)=>{t.d(s,{Z:()=>M});var a=t(52322),n=t(2784),o=t(48630),r=t(90778),i=t(38894),l=t(51024),c=t(64332),u=t(63436),d=t(86674);const h={children:"Storage",color:"blue",size:"tiny"},m=[{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:h,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:h,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:h,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:h,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:h,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:h,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 transfer.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,h]=(0,n.useState)(""),m=(0,n.useCallback)((e=>h(e)),[]),p=(0,n.useCallback)((()=>{h("")}),[]),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:m,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(),k=({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)}},N=o.zo.article` background-color: #4e4e4e; color: #ffffff; display: flex; @@ -1077,7 +1077,7 @@ color: #f88; } } -`,S=n.memo((function({children:e,className:s="",logs:t}){return(0,a.jsxs)(N,{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(k)})})}),e]})})),A=["atob","btoa"],E={Atomics:null,Bluetooth:null,Clipboard:null,Document:null,Function:null,Location:null,ServiceWorker:null,SharedWorker:null,USB:null,global:null,window:null},I=JSON.parse(JSON.stringify(m));let T=!1;const D=o.zo.main` +`,S=n.memo((function({children:e,className:s="",logs:t}){return(0,a.jsxs)(N,{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(k)})})}),e]})})),A=["atob","btoa"],I={Atomics:null,Bluetooth:null,Clipboard:null,Document:null,Function:null,Location:null,ServiceWorker:null,SharedWorker:null,USB:null,global:null,window:null},E=JSON.parse(JSON.stringify(m));let T=!1;const D=o.zo.main` display: flex; flex-direction: column; height: 100vh; @@ -1196,4 +1196,4 @@ margin-bottom: 0; } } -`,P=n.memo((function({basePath:e,className:s=""}){const{t}=x(),h=(0,r.h)(),m=(0,n.useRef)(null),[p,v]=(0,n.useState)(""),[y,C]=(0,n.useState)(!1),[w,k]=(0,n.useState)(!1),[N,P]=(0,i.O)(!0),[M,z]=(0,n.useState)([]),[F,L]=(0,n.useState)([]),[V,_]=(0,n.useState)([]),[R,H]=(0,n.useState)(I[0]),$=(0,n.useRef)([{isRoot:!0,name:"playground",text:t("Console")}]);(0,n.useEffect)((()=>{T||(I.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`}(h.isDevelopment)}${e.code}`})),T=!0);const e={examples:localStorage.getItem(b),selectedValue:localStorage.getItem(f)},s=e.examples?JSON.parse(e.examples):[],t=[...s,...I],a=t.find((s=>s.value===e.selectedValue));z(s),C(a&&"custom"===a.type||!1),_(t),H(a||I[0])}),[]),(0,n.useEffect)((()=>{v(R.code)}),[R]);const B=(0,n.useCallback)((()=>L([])),[]),O=(0,n.useCallback)(((e,s)=>{F.push({args:s,type:e}),L(F.slice(0))}),[F]),q=(0,n.useCallback)((()=>{m.current&&(m.current.api.disconnect().catch(console.error),m.current=null),k(!1)}),[]),W=(0,n.useCallback)((()=>{(async function(){k(!0),B(),m.current=function({api:e,isDevelopment:s},t,a){return{...Object.keys(window).filter((e=>!e.includes("-")&&!A.includes(e))).reduce(((e,s)=>(e[s]=null,e)),{...E}),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}}(h,k,O),await m.current.api.isReady;try{const e=`(async ({${Object.keys(m.current).sort().join(",")}}) => { try { ${p} \n } catch (error) { console.error(error); setIsRunning(false); } })(injected);`;new Function("injected",e).bind({},m.current)()}catch(e){m.current.console.error(e)}k(!1)})().catch(console.error)}),[B,O,h,p]),Z=(0,n.useCallback)((e=>{if(q(),e.length){const s=V.find((s=>s.value===e));s&&(localStorage.setItem(f,e),B(),C("custom"===s.type),H(s))}}),[B,q,V]),U=(0,n.useCallback)((()=>{const e=M.filter((e=>e.value!==R.value)),s=[...e,...I];z(e),C("custom"===s[0].type),_(s),Z(s[0].value),localStorage.setItem(b,JSON.stringify(e))}),[Z,M,R.value]),J=(0,n.useCallback)((e=>{const s={code:p,label:j,text:e,type:"custom",value:`custom-${Date.now()}`},t=[s,...M,...I];localStorage.setItem(b,JSON.stringify([s,...M])),z([s,...M]),C(!0),_(t),H(s)}),[p,M]),G="custom"===R.type?R.text:void 0;return(0,a.jsxs)(D,{className:`${s} js--App`,children:[(0,a.jsx)(o.mQ,{basePath:e,items:$.current}),(0,a.jsx)("section",{className:"js--Selection",children:(0,a.jsx)(o.Lt,{className:"js--Dropdown",isFull:!0,label:t("Select example"),onChange:Z,options:V,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:W,saveSnippet:J,snippetName:G,stopJs:q}),(0,a.jsx)(o.ML,{code:p,onEdit:v})]}),(0,a.jsx)(S,{className:"js--Output",logs:F,children:(0,a.jsx)(o.zx,{className:"action-button",icon:"eraser",onClick:B})})]}),N&&(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:P})})]})})]})})),M=n.memo((function(e){return(0,a.jsx)(P,{...e})}))}}]); \ No newline at end of file +`,P=n.memo((function({basePath:e,className:s=""}){const{t}=x(),h=(0,r.h)(),m=(0,n.useRef)(null),[p,v]=(0,n.useState)(""),[y,C]=(0,n.useState)(!1),[w,k]=(0,n.useState)(!1),[N,P]=(0,i.O)(!0),[M,z]=(0,n.useState)([]),[F,L]=(0,n.useState)([]),[V,_]=(0,n.useState)([]),[R,$]=(0,n.useState)(E[0]),H=(0,n.useRef)([{isRoot:!0,name:"playground",text:t("Console")}]);(0,n.useEffect)((()=>{T||(E.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`}(h.isDevelopment)}${e.code}`})),T=!0);const e={examples:localStorage.getItem(b),selectedValue:localStorage.getItem(f)},s=e.examples?JSON.parse(e.examples):[],t=[...s,...E],a=t.find((s=>s.value===e.selectedValue));z(s),C(a&&"custom"===a.type||!1),_(t),$(a||E[0])}),[]),(0,n.useEffect)((()=>{v(R.code)}),[R]);const B=(0,n.useCallback)((()=>L([])),[]),O=(0,n.useCallback)(((e,s)=>{F.push({args:s,type:e}),L(F.slice(0))}),[F]),W=(0,n.useCallback)((()=>{m.current&&(m.current.api.disconnect().catch(console.error),m.current=null),k(!1)}),[]),q=(0,n.useCallback)((()=>{(async function(){k(!0),B(),m.current=function({api:e,isDevelopment:s},t,a){return{...Object.keys(window).filter((e=>!e.includes("-")&&!A.includes(e))).reduce(((e,s)=>(e[s]=null,e)),{...I}),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}}(h,k,O),await m.current.api.isReady;try{const e=`(async ({${Object.keys(m.current).sort().join(",")}}) => { try { ${p} \n } catch (error) { console.error(error); setIsRunning(false); } })(injected);`;new Function("injected",e).bind({},m.current)()}catch(e){m.current.console.error(e)}k(!1)})().catch(console.error)}),[B,O,h,p]),Z=(0,n.useCallback)((e=>{if(W(),e.length){const s=V.find((s=>s.value===e));s&&(localStorage.setItem(f,e),B(),C("custom"===s.type),$(s))}}),[B,W,V]),U=(0,n.useCallback)((()=>{const e=M.filter((e=>e.value!==R.value)),s=[...e,...E];z(e),C("custom"===s[0].type),_(s),Z(s[0].value),localStorage.setItem(b,JSON.stringify(e))}),[Z,M,R.value]),J=(0,n.useCallback)((e=>{const s={code:p,label:j,text:e,type:"custom",value:`custom-${Date.now()}`},t=[s,...M,...E];localStorage.setItem(b,JSON.stringify([s,...M])),z([s,...M]),C(!0),_(t),$(s)}),[p,M]),G="custom"===R.type?R.text:void 0;return(0,a.jsxs)(D,{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:Z,options:V,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:q,saveSnippet:J,snippetName:G,stopJs:W}),(0,a.jsx)(o.ML,{code:p,onEdit:v})]}),(0,a.jsx)(S,{className:"js--Output",logs:F,children:(0,a.jsx)(o.zx,{className:"action-button",icon:"eraser",onClick:B})})]}),N&&(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:P})})]})})]})})),M=n.memo((function(e){return(0,a.jsx)(P,{...e})}))}}]); \ No newline at end of file