PageSourceSearch

https://kyberswap.com/assets/index-23fba41e.js

js kyberswap.com collected 2026-10-01 11:49:25 UTC 31,992 bytes, 1 lines download raw bytes

1import{r as c,c4 as K,eR as P,O as H,e7 as Ye,e5 as ae,e4 as fe,j as e,au as be,aS as j,aT as f,eS as _e,V as o,el as ke,eL as Te,eT as ee,X as ie,eU as He,ac as v,c8 as k,aO as ve,a1 as C,eE as he,eV as Fe,eo as $e,eW as se,eK as Z,cI as Se,eA as re,dw as Ge,cD as de,eX as We,eN as Ze,aN as te,eG as Ie,aC as W,ad as Ae,ex as Me,eY as _,aZ as ue,eZ as Oe,e_ as Ue,R as Le,Y as Pe,e$ as qe,f0 as Qe,aK as Je,cc as Xe,en as es,f1 as ss,f2 as ts,cf as as,f3 as Y,eI as ns,eJ as is,eO as xe,aE as ye,f4 as J,eF as rs,cd as ls,ck as os,cl as cs}from"./index-23810fa3.js";import{T as je}from"./TimerCountdown-c7b0f6ca.js";import{K as De}from"./kncLogo-69203704.js";import{L as ds,H as xs,Y as ms}from"./YourTransactionsModal-c7a8fc89.js";import{R as hs,a as us}from"./RadioButtonUnchecked-6c24b030.js";import{h as js}from"./colorAlpha-e09c73db.js";import"./clock-c6be9105.js";function ge(){return ge=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(s[t]=i[t])}return s},ge.apply(this,arguments)}function gs(s,a){if(s==null)return{};var i=ps(s,a),t,r;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);for(r=0;r<l.length;r++)t=l[r],!(a.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(s,t)&&(i[t]=s[t])}return i}function ps(s,a){if(s==null)return{};var i={},t=Object.keys(s),r,l;for(l=0;l<t.length;l++)r=t[l],!(a.indexOf(r)>=0)&&(i[r]=s[r]);return i}var we=c.forwardRef(function(s,a){var i=s.color,t=i===void 0?"currentColor":i,r=s.size,l=r===void 0?24:r,n=gs(s,["color","size"]);return K.createElement("svg",ge({ref:a,xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n),K.createElement("polyline",{points:"9 11 12 14 22 4"}),K.createElement("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"}))});we.propTypes={color:P.string,size:P.oneOfType([P.string,P.number])};we.displayName="CheckSquare";const fs=we;function pe(){return pe=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(s[t]=i[t])}return s},pe.apply(this,arguments)}function bs(s,a){if(s==null)return{};var i=_s(s,a),t,r;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);for(r=0;r<l.length;r++)t=l[r],!(a.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(s,t)&&(i[t]=s[t])}return i}function _s(s,a){if(s==null)return{};var i={},t=Object.keys(s),r,l;for(l=0;l<t.length;l++)r=t[l],!(a.indexOf(r)>=0)&&(i[r]=s[r]);return i}var Ne=c.forwardRef(function(s,a){var i=s.color,t=i===void 0?"currentColor":i,r=s.size,l=r===void 0?24:r,n=bs(s,["color","size"]);return K.createElement("svg",pe({ref:a,xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n),K.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}))});Ne.propTypes={color:P.string,size:P.oneOfType([P.string,P.number])};Ne.displayName="Square";const vs=Ne,ws="/assets/luxury-green-background-small-9a29aef7.jpg";function Ns({amount:s,onConfirmClaim:a}){const{account:i}=H(),t=Ye(ae.KYBER_DAO_CLAIM),r=fe(ae.KYBER_DAO_CLAIM);return e.jsx(be,{isOpen:t,onDismiss:r,children:e.jsxs(j,{className:"gap-4 p-6",children:[e.jsxs(f,{className:"items-center justify-between gap-4",children:[e.jsx(_e,{children:e.jsx(o,{id:"Q0p68l"})}),e.jsx(ke,{onClick:r})]}),e.jsxs(j,{className:"gap-2 rounded-lg border-0 bg-buttonBlack p-3 text-sm text-subText outline-none",children:[e.jsx("span",{className:"text-xs",children:e.jsx(o,{id:"UgFbtv"})}),e.jsx("span",{className:"text-border",children:i})]}),e.jsx(Te,{children:e.jsx(o,{id:"7knONb"})}),e.jsxs(f,{className:"items-center gap-2",children:[e.jsx(De,{size:28})," ",e.jsxs(ee,{className:"text-2xl",children:[s," KNC"]})]}),e.jsx(ie,{onClick:a,children:"Claim"})]})})}function Cs({size:s}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:s||"20",height:s||"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M9.89551 14.875C10.1316 14.875 10.34 14.7882 10.5205 14.6146C10.7011 14.441 10.7913 14.2292 10.7913 13.9792C10.7913 13.7431 10.7045 13.5382 10.5309 13.3646C10.3573 13.191 10.1455 13.1042 9.89551 13.1042C9.6594 13.1042 9.45454 13.191 9.28092 13.3646C9.10731 13.5382 9.02051 13.7431 9.02051 13.9792C9.02051 14.2292 9.10731 14.441 9.28092 14.6146C9.45454 14.7882 9.6594 14.875 9.89551 14.875ZM9.12467 11.7917H10.4788C10.4788 11.4028 10.5448 11.
10625 10.6768 10.7708C10.8087 10.4792 11.0622 10.1597 11.4372 9.8125C11.8261 9.40972 12.1143 9.03125 12.3018 8.67708C12.4893 8.32292 12.583 7.93056 12.583 7.5C12.583 6.73611 12.34 6.13889 11.8538 5.70833C11.3677 5.27778 10.7288 5.0625 9.93717 5.0625C9.20106 5.0625 8.57259 5.25347 8.05176 5.63542C7.53092 6.01736 7.15245 6.51389 6.91634 7.125L8.20801 7.64583C8.40245 7.28472 8.63509 6.99653 8.90592 6.78125C9.17676 6.56597 9.52051 6.45833 9.93717 6.45833C10.3261 6.45833 10.6316 6.5625 10.8538 6.77083C11.0761 6.97917 11.1872 7.25 11.1872 7.58333C11.1872 7.84722 11.1108 8.09722 10.958 8.33333C10.8052 8.56944 10.59 8.82639 10.3122 9.10417C9.77051 9.63194 9.43717 10.0625 9.31217 10.3958C9.18717 10.7292 9.12467 11.1944 9.12467 11.7917ZM3.85384 17.7917C3.4094 17.7917 3.02398 17.6285 2.69759 17.3021C2.3712 16.9757 2.20801 16.5903 2.20801 16.1458V3.85417C2.20801 3.39583 2.3712 3.00347 2.69759 2.67708C3.02398 2.35069 3.4094 2.1875 3.85384 2.1875H16.1455C16.6038 2.1875 16.9962 2.35069 17.3226 2.67708C17.649 3.00347 17.8122 3.39583 17.8122 3.85417V16.1458C17.8122 16.5903 17.649 16.9757 17.3226 17.3021C16.9962 17.6285 16.6038 17.7917 16.1455 17.7917H3.85384Z",fill:"currentColor"})})}function ys({size:s}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s||"20",height:s||"20",viewBox:"0 0 20 20",fill:"none",children:[e.jsx("g",{clipPath:"url(#clip0_943_7035)",children:e.jsx("path",{d:"M16.6665 4.99935H15.8332V11.666C15.8332 12.1243 15.4582 12.4993 14.9998 12.4993H4.99984V13.3327C4.99984 14.2493 5.74984 14.9993 6.6665 14.9993H14.9998L18.3332 18.3327V6.66602C18.3332 5.74935 17.5832 4.99935 16.6665 4.99935ZM14.1665 9.16602V3.33268C14.1665 2.41602 13.4165 1.66602 12.4998 1.66602H3.33317C2.4165 1.66602 1.6665 2.41602 1.6665 3.33268V14.166L4.99984 10.8327H12.4998C13.4165 10.8327 14.1665 10.0827 14.1665 9.16602Z",fill:"currentColor"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_943_7035",children:e.jsx("rect",{width:s||"20",height:s||"20",fill:"white"})})})]})}function ks({size:s=160}){const a=`0 ${s>=200?"3px":"2px"} 0 0 var(--ks-primary)`;return e.jsx("div",{className:"inline-block overflow-hidden bg-transparent",style:{width:s,height:s},children:e.jsxs("div",{className:"relative flex size-full items-center justify-center [backface-visibility:hidden] [transform-origin:0_0] [transform:translateZ(0)_scale(1)] [&>div]:absolute [&>div]:box-content [&>div]:animate-spin [&>div]:rounded-full",style:{"--dot-size":`${s*.8}px`,"--dot-offset":`${s*.1}px`,"--dot-origin-x":`${s*.4}px`,"--dot-origin-y":`${s*.41}px`,"--dot-shadow":a},children:[e.jsx("div",{style:{width:"var(--dot-size)",height:"var(--dot-size)",top:"var(--dot-offset)",left:"var(--dot-offset)",boxShadow:"var(--dot-shadow)",transformOrigin:"var(--dot-origin-x) var(--dot-origin-y)"}}),e.jsx("div",{style:{width:"var(--dot-size)",height:"var(--dot-size)",top:"var(--dot-offset)",left:"var(--dot-offset)",boxShadow:"var(--dot-shadow)",transformOrigin:"var(--dot-origin-x) var(--dot-origin-y)"}}),e.jsx("img",{src:He,width:"30%",alt:""})]})})}const ne={19:{1:"Base - KNC-USDC & KNC-ETH"}},Ts="after:absolute after:inset-0 after:bg-[image:linear-gradient(-45deg,rgba(0,0,0,0.1)_28%,transparent_28%,transparent_50%,rgba(0,0,0,0.1)_50%,rgba(0,0,0,0.1)_78%,transparent_78%,transparent)] after:bg-[length:25px_25px] after:[animation:ks-stripe-move_1.5s_linear_infinite] after:content-['']";function Ss({checked:s,percent:a=40,title:i,type:t="Finished",onOptionClick:r,isCheckBox:l,disabled:n,proposalId:m,id:x}){var d;const h=parseFloat(a.toFixed(2)||"0"),b=(d=ne[m])==null?void 0:d[x];return e.jsxs("div",{onClick:()=>!n&&(r==null?void 0:r()),className:v("relative flex min-h-9 w-full select-none items-center justify-between overflow-hidden rounded bg-buttonBlack p-2.5",t==="Pending"&&"text-subText",!n&&"cursor-pointer hover:brightness-110"),children:[e.jsx("div",{className:"z-[4] w-full",children:e.jsxs(k,{className:"z-[1] items-center",children:[e.jsx(ve,{text:t==="Pending"&&C._({id:"Qsh7ZS"}),placement:"top",width:"fit-content",children:e.jsxs(he,{className:"gap-2 overflow-hidden break-words text-xs",children:[e.jsxs("div",{className:"w-[18px] [&>svg]:block",children:[l?s?e.jsx(fs,{size:18}):e.jsx(vs,{size:18}):s?e.jsx(hs,{}):e.jsx(us,{})," "]}),e.jsx("span",{children:`${x}. ${b||i}`})]})}),e.jsxs("span",{className:"px-1 text-xs",children:[h,"%"]})]})}),t==="Active"&&e.jsx("div",{className:"absolute inset-y-0 left-0 z-0 rounded bg-primary",style:{width:`${a||0}%`}}),t==="Choosing"&&e.jsx("div",{className:v("absolute inset-y-0 left-0 z-0 w-full rounded bg-darkerGreen",Ts)}),t==="Finished"&&e.jsx("div",{className:"absolute inset-y-0 left-0 z-0 rounded bg-primary-20",style:{width:`${a||0}%`}})]})}const Be="/assets/gold_icon-effd362c.svg",As="linear-gradient(180deg, rgba(41, 41, 41, 0) 0%, rgba(41, 41, 41, 0.12) 54.69%, rgba(41, 41, 41, 0.7) 100%), linear-gradient(90deg, rgba(228, 181, 86, 0.25) 0%, rgba(241, 192, 94, 0.127155) 69.27%, rgba(255, 204, 102, 0) 100%)",
1Ee=({isWonOption:s,hasHoverStyle:a,children:i,className:t,onClick:r,style:l})=>e.jsx("div",{onClick:r,style:s?{background:As,...l}:l,className:v("overflow-hidden rounded-2xl border border-border bg-buttonBlack transition-all duration-100",a&&"cursor-pointer hover:shadow-[0_2px_5px_2px_var(--ks-buttonBlack)] hover:brightness-125",t),children:i}),Ke=({children:s})=>e.jsx(k,{className:"text-xs text-subText [&>*:last-child]:text-right [&>*:nth-child(2)]:text-center [&>*]:flex-1",children:s}),Re=({children:s})=>e.jsx(k,{className:"py-1.5 text-xs [&>*:last-child]:text-right [&>*:nth-child(2)]:text-center [&>*]:flex-1",children:s}),Ms=({isOpen:s,onDismiss:a,participants:i,isWonOption:t,sumPower:r,option:l})=>e.jsx(be,{isOpen:s,onDismiss:a,children:e.jsxs(Ee,{isWonOption:t,className:"w-full",children:[e.jsxs(k,{className:"gap-4 p-4",children:[e.jsxs(f,{className:"min-w-0 items-center gap-2",children:[t&&e.jsx("img",{alt:"gold-medal",src:Be}),e.jsx("span",{className:"overflow-hidden text-ellipsis",children:l})]}),e.jsx("span",{className:"shrink-0",children:r?Math.round(r).toLocaleString():"--"})]}),e.jsx(Z,{}),e.jsx("div",{className:"px-4 py-3",children:e.jsxs(Ke,{children:[e.jsx("span",{children:e.jsx(o,{id:"sb9Y58"})}),e.jsx("span",{children:e.jsx(o,{id:"hehnjM"})})]})}),e.jsx(Z,{}),e.jsx("div",{className:"select-none overflow-auto px-4 py-3",style:{height:"fit-content",maxHeight:"70vh",minHeight:"200px"},children:i.map(n=>e.jsxs(Re,{children:[e.jsx("span",{children:n.staker_name||n.staker}),e.jsx("span",{className:"text-subText",children:n.power})]},n.staker))})]})});function Os({proposalId:s}){const[a,i]=c.useState(null),{data:t}=Fe.useGetProposalByIdQuery({id:s},{skip:!s}),r=c.useMemo(()=>{var m;if((m=t==null?void 0:t.vote_stats)!=null&&m.votes)return t.vote_stats.votes.slice().sort((x,h)=>BigInt(x.power)>BigInt(h.power)?-1:1).map(x=>({...x,staker:x.staker.slice(0,9)+"..."+x.staker.slice(-4),power:Math.floor(parseFloat($e(x.power,18))).toLocaleString()}))},[t]),l=t==null?void 0:t.options.map((m,x)=>{var h;return((h=s?ne[s]:{})==null?void 0:h[x])||m}),n=c.useMemo(()=>l?l.some(m=>m.length>30):!1,[l]);return e.jsx("div",{className:"grid grid-cols-1 items-start gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:l&&r?l.map((m,x)=>{var A,T,M;const h=(A=t==null?void 0:t.vote_stats.options.find(g=>g.option===x))==null?void 0:A.vote_count,b=(t==null?void 0:t.proposal_type)===se.BinaryProposal&&((T=t==null?void 0:t.vote_stats)==null?void 0:T.options.reduce((g,R)=>R.vote_count>g.vote_count?R:g).option)===x,d=r.filter(g=>g.option===x),y=s?(M=ne[s])==null?void 0:M[x]:void 0;return e.jsxs(Ee,{isWonOption:b,onClick:()=>i(x),hasHoverStyle:!0,children:[e.jsxs(k,{className:"gap-4 p-4",children:[e.jsxs(f,{className:"min-w-0 items-center gap-2",children:[b&&e.jsx("img",{alt:"gold-medal",src:Be}),e.jsx("span",{className:v("overflow-hidden text-ellipsis",n?"text-sm":"text-base"),children:y||m})]}),e.jsx("span",{className:v("shrink-0",n?"text-sm":"text-base"),children:h?Math.round(h).toLocaleString():"--"})]}),e.jsx(Z,{}),e.jsx("div",{className:"px-4 py-3",children:e.jsxs(Ke,{children:[e.jsx("span",{children:e.jsx(o,{id:"sb9Y58"})}),e.jsx("span",{children:e.jsx(o,{id:"hehnjM"})})]})}),e.jsx(Z,{}),e.jsxs(j,{className:"h-40 select-none overflow-auto px-4 py-3 max-sm:h-32",children:[d.slice(0,5).map(g=>e.jsxs(Re,{children:[e.jsx("span",{children:g.staker_name||g.staker}),e.jsx("span",{className:"text-subText",children:g.power})]},g.staker)),d.length>5&&e.jsx(Se,{className:"justify-center pt-2",children:e.jsx("span",{className:"text-xs text-primary",children:"View more"})})]}),e.jsx(Ms,{participants:d,isOpen:x===a,onDismiss:()=>i(null),isWonOption:b,sumPower:h,option:m})]},m)}):null})}function Ls(s,a,i){const t=Math.floor((i-a)/s),r=a+t*s;return{epochNumber:t,epochStartTimestamp:r}}const L=({children:s})=>e.jsx(k,{className:"py-1.5 text-xs",children:s});function Ps({proposal:s}){const{account:a}=H(),{stakerInfo:i,daoInfo:t}=re(),r=c.useMemo(()=>i?(i.delegate.toLowerCase()===(a==null?void 0:a.toLowerCase())?i.stake_amount:0)+i.delegated_stake_amount:0,[i,a]),l=new Ge(s.max_voting_power,de.exponentiate(de.BigInt(10),de.BigInt(18))).multiply(s.executor_minimum_quorum).divide(We),{epochNumber:n,epochStartTimestamp:m}=Ls((t==null?void 0:t.epoch_period_in_seconds)??0,(t==null?void 0:t.first_epoch_start_timestamp)??0,s.start_timestamp);return e.jsxs(j,{className:"overflow-hidden rounded-2xl border border-border bg-buttonBlack",children:[e.jsx(Ze,{className:"p-4",children:e.jsx(o,{id:"yHbuPD"})}),e.jsx(Z,{}),e.jsxs(j,{className:"px-4 py-3",children:[e.jsxs(L,{children:[e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"6GCMla"})}),e.jsx("span",{className:"text-text",children:s.proposal_type})]}),e.jsxs(L,{children:[e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"D3iCkb"})}),e.jsx("span",{className:"text-text",children:te(s.start_timestamp*1e3).format("DD MMMM YYYY")})]}),e.jsxs(L,{children:[e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"VFv2ZC"})}),e.jsx("span",{className:"text-text",children:te(s.end_timestamp*1e3).format("DD MMMM YYYY")})]}),e.jsxs(L,{children:[e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"kuwWbi"})}),e.jsx("span",{className:"text-text",children:s.vote_stats.total_address_count})]}),e.jsxs(L,{children:[e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"7r4ubk"})}),e.jsx("span",{className:"text-text",children:Math.floor(s.vote_stats.total_vote_count).toLocaleStr
1ing()})]}),e.jsxs(L,{children:[e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"MK0Z7u",values:{epochNumber:n}})}),e.jsx("span",{className:"text-text",children:te(m*1e3).format("DD MMMM YYYY")})]}),e.jsxs(L,{children:[e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"U2GebD"})}),s.vote_stats.quorum_status===1?e.jsx("span",{className:"text-text",children:e.jsx(o,{id:"7T/o5R"})}):e.jsx(ve,{text:`Total amount required: ${Math.floor(+l.toFixed(0)).toLocaleString()} KNC`,placement:"bottom",width:"fit-content",children:e.jsxs(Se,{className:"w-fit gap-2 text-warning",children:[e.jsx(Ie,{size:"16",solid:!0}),e.jsx("span",{className:"font-medium text-warning",children:e.jsx(o,{id:"cuCuxw"})})]})})]}),e.jsxs(L,{children:[e.jsxs("span",{className:"text-subText",children:[e.jsx(o,{id:"xNskUJ"})," ",e.jsx(W,{placement:"top",text:"Your KIP Voting Power is calculated by [Your Staked KNC] / [Total Voted KNC in this KIP] * 100%."})]}),e.jsxs("span",{className:"text-text",children:[r>0&&s.vote_stats.total_vote_count>0?+(r/s.vote_stats.total_vote_count*100).toPrecision(4):s.vote_stats.total_vote_count===0?100:0,"%"]})]})]})]})}function Ds({isShow:s,toggle:a,options:i,title:t,onVoteConfirm:r}){return e.jsx(be,{isOpen:s,onDismiss:a,children:e.jsxs(j,{className:"gap-4 p-5",children:[e.jsxs(f,{className:"items-center justify-between gap-4",children:[e.jsx(_e,{children:e.jsx(o,{id:"lQXQKs"})}),e.jsx(ke,{onClick:a})]}),e.jsx(Te,{className:"text-subText [&_b]:font-medium [&_b]:text-text",children:e.jsx(o,{id:"TjsZ5Q",values:{options:i,title:t},components:{0:e.jsx("b",{}),1:e.jsx("b",{})}})}),e.jsx(ie,{onClick:r,children:"Vote"})]})})}const ze=({className:s,...a})=>e.jsx("div",{className:v("flex h-5 items-center justify-center rounded-lg px-3 py-1 text-xs",s),...a}),Bs=({color:s,className:a,...i})=>e.jsx(ze,{className:v("cursor-pointer hover:brightness-75",!s&&"bg-buttonBlack text-subText",a),style:s?{color:s,backgroundColor:js(s,.2)}:void 0,...i}),Es=({children:s})=>e.jsx(ze,{className:"bg-buttonBlack text-subText",children:s}),Ks=({status:s,onVoteClick:a,errorMessage:i,voted:t})=>{const{account:r}=H(),l=Le(),n=c.useRef(!0);return c.useEffect(()=>{const m=setTimeout(()=>{n.current=!1},1500);return()=>{clearTimeout(m)}},[]),e.jsx(e.Fragment,{children:s===_.Active?r?e.jsx("div",{className:"w-full sm:w-52",children:e.jsx(ie,{width:"100%",fontWeight:500,fontSize:"14px",onClick:a,disabled:n.current||!!i,children:i&&!n.current?i:t?e.jsx(o,{id:"uuj+T0"}):e.jsx(o,{id:"1G1y32"})})}):e.jsx("div",{className:"w-full sm:w-52",children:e.jsx(Pe,{width:"100%",onClick:l,children:e.jsx(o,{id:"iSLIjg"})})}):e.jsx(e.Fragment,{})})},Rs=[14,15,17,18,19,20,22];function zs({proposal:s,onBadgeClick:a,voteCallback:i}){var F;const t=Ae(),{account:r}=H(),{votesInfo:l,stakerInfo:n}=re(),m=n?(n.delegate.toLowerCase()===(r==null?void 0:r.toLowerCase())?n.stake_amount:0)+n.delegated_stake_amount:0,x=!!n&&n.delegate.toLowerCase()!==(r==null?void 0:r.toLowerCase()),[h,b]=c.useState(!1),[d,y]=c.useState([]),[A,T]=c.useState(null),[M,g]=c.useState(!1);c.useEffect(()=>{x?T(C._({id:"VbCFBZ"})):m?(d==null?void 0:d.length)===0?T(C._({id:"7oehSn"})):T(null):T(C._({id:"zKxGU0"}))},[d.length,n==null?void 0:n.stake_amount,x,m]);const R=()=>{switch(s.status){case _.Pending:return t.warning;case _.Active:return t.blue;case _.Approved:case _.Executed:return t.primary;case _.Canceled:case _.Failed:return t.red;default:return t.blue}},{switchToEthereum:O}=Me(),le=c.useCallback(()=>{O(C._({id:"Ao7rLa"})).then(()=>{d.length>0&&g(!0)}).catch(()=>{})},[O,g,d]),D=c.useCallback(()=>{g(!1),d.length>0&&(i==null||i(s.proposal_id,d.map(u=>u+1).reduce((u,p)=>u+=1<<p-1,0)).then(()=>{y([])}).catch(u=>{T(u.message)}))},[d,s.proposal_id,i]),w=c.useMemo(()=>l==null?void 0:l.find(u=>u.proposal_id===s.proposal_id),[l,s.proposal_id]);c.useEffect(()=>{y([])},[w]);const B=Rs.includes(s.proposal_id),I=c.useCallback(u=>{if(s.proposal_type===se.BinaryProposal||B)y([u]);else if(s.proposal_type===se.GenericProposal)if(d.length===0)y([u]);else{const p=[...d],N=p.indexOf(u);N!==-1?p.splice(N,N+1):p.push(u),y(p)}},[s.proposal_type,y,d,B]),S=s.status===_.Active,U=c.useMemo(()=>{const u=s.options.length>2;return e.jsx("div",{className:v("grid grid-cols-1 gap-4",u?"sm:grid-cols-2 lg:grid-cols-3":"md:grid-cols-2"),children:s.options.map((p,N)=>{var q,G,Q;const $=((q=w==null?void 0:w.options)==null?void 0:q.includes(N))||!1,z=(Q=(G=s==null?void 0:s.vote_stats)==null?void 0:G.options)==null?void 0:Q.find(oe=>oe.option===N);return e.jsx(Ss,{disabled:!S,percent:z?z.vote_count/s.vote_stats.total_vote_count*100:0,title:p,checked:(d==null?void 0:d.includes(N))||$,onOptionClick:()=>I(N),type:s.status===_.Pending?"Pending":d!=null&&d.includes(N)?"Choosing":$?"Active":"Finished",isCheckBox:s.proposal_type===se.GenericProposal&&!B,proposalId:s.proposal_id,id:N},p)})})},[s,d,w==null?void 0:w.options,I,S,B]);return e.jsxs(j,{className:"gap-4 overflow-hidden rounded-2xl bg-background p-4 shadow-[0px_2px_34px_rgba(0,0,0,0.0467931)] sm:p-6",style:{contentVisibility:"auto",containIntrinsicSize:"60px"},children:[e.jsxs(j,{className:"z-[1] gap-4 bg-background",children:[e.jsxs(k,{children:[e.jsx("span",{children:s.title}),e.jsx(ue,{className:"size-6 cursor-pointer rounded-full bg-subText-20 text-subText hover:bg-subText-40",onClick:()=>b(u=>!u),children:e.jsx(Oe,{size:20,style:{transition:"all 0.2s ease",transform:h?"rotate(180deg)":void 0}})})]}),e.jsxs(f,{className:"items-center justify-between gap-4 max-sm:flex-col max-sm:items-start",children:[e.jsxs(f,{className:"flex-wrap gap-2",children:[e.jsx(Bs,{color:R(),onClick:()=>a==null?void 0:a(s.status),children:s.status}),e.jsxs(Es,{children:["ID #",s.proposal_id]})]}),S&&e.jsxs(f,{className:"shrink-0 items-center gap-2",children:[e.jsx("span",{className:"text-xs text-subText",children:e.jsx(o,{id:"8nbhXc"})}),e.jsx(je,{endTime:s.end_timestamp})]})]}),(h||S)&&U,e.jsx(f,{className:"items-center justify-between gap-4 max-sm:flex-col max-sm:items-start",children:S?e.jsx(Ks,{status:s.status,onVoteClick:le,errorMessage:A,voted:!!(w!=null&&w.options)&&w.options.length>0}):s.status===_.Pending?e.jsxs(f,{className:"items-center gap-2",children:[e.jsx("span",{className:"text-xs text-subText",children:e.jsx(o,{id:"PiKJ9+"})}),e.jsx(je,{endTime:s.start_timestamp})]}):e.jsxs("span",{className:"text-xs text-subText",children:["Ended ",te(s.end_timestamp*1e3).format("DD MMM YYYY")]})})]}),h&&e.jsxs(j,{className:"z-0 gap-8 pt-4 transition-all duration-200",children:[e.jsxs("div",{className:"grid items-start gap-4 lg:grid-cols-[minmax(0,1fr)_368px]",children:[e.jsxs(j,{className:"gap-4",children:[(s==null?void 0:s.link)&&s.link!=="0x0"&&e.jsxs("a",{href:(F=s.link)!=null&&F.startsWith("http")?s.link:"http://"+s.link,className:"flex w-fit items-center gap-2 text-sm",target:"_blank",rel:"noreferrer",children:[e.jsx(ds,{size:14}),e.jsx("span",{children:e.jsx(o,{id:"j3Cc3u"})})]}),e.jsx("p",{className:"break-words text-base text-subText",dangerouslySetInnerHTML:{__html:Ue(s.desc.replaceAll("\\n","").replaceAll("\\r",""))}})]}),e.jsx(Ps,{proposal:s})]}),e.jsx(Os,{proposalId:s.proposal_id})]}),s.status===_.Active&&e.jsx(Ds,{isShow:M,title:s.title,toggle:()=>g(!1),options:d.length>0?d.map(u=>{var p;return((p=ne[s.proposal_id])==null?void 0:p[u])||s.options[u]}).join(", "):"",onVoteConfirm:D})]})}const Vs=K.memo(zs);function Ys({search:s,setSearch:a}){return e.jsxs("div",{className:"relative flex h-9 w-full items-center gap-2 rounded-full bg-background px-3 text-sm font-medium text-border sm:max-w-sm",children:[e.jsx("input",{placeholder:C._({id:"aCmWRP"}),value:s,onChange:i=>a==null?void 0:a(i.target.value),className:"min-w-0 flex-1 border-none bg-transparent text-subText outline-none placeholder:text-border"}),e.jsx(qe,{})]})}function Hs({status:s,setStatus:a}){const[i,t]=c.useState(!1),r=c.useRef(null);return Qe(r,()=>t(!1)),e.jsxs("div",{ref:r,className:"relative w-full sm:w-36",children:[e.jsxs("div",{onClick:()=>t(l=>!l),className:"relative z-[101] flex h-9 w-full cursor-pointer items-center justify-between rounded-full bg-background px-3 py-2 text-sm font-medium text-border hover:brightness-110",children:[e.jsx("span",{className:v(!!s&&s!=="All"&&"text-text"),children:s||"All"}),e.jsx(Oe,{size:16})]}),e.jsxs("div",{className:v("absolute left-0 z-[100] flex w-full flex-col overflow-hidden rounded-lg bg-tableHeader p-2 text-sm font-medium text-subText transition-all duration-200 ease-linear",i?"top-[calc(100%+4px)] max-h-96 opacity-100":"top-0 max-h-0 opacity-0"),children:[e.jsx("div",{onClick:()=>{t(!1),a==null||a("")},className:v("cursor-pointer rounded px-2 py-1.5 hover:bg-buttonGray",!s&&"text-primary"),children:e.jsx(o,{id:"N40H+G"})},"All"),Object.values(_).map(l=>e.jsx("div",{onClick:()=>{t(!1),a==null||a(l)},className:v("cursor-pointer rounded px-2 py-1.5 hover:bg-buttonGray",l===s&&"text-primary"),children:l},l))]})]})}function Fs({voteCallback:s}){const{account:a}=H(),{proposals:i}=re(),[t,r]=c.useState(),[l,n]=c.useState(),m=c.useMemo(()=>(i==null?void 0:i.filter(h=>t?h.status===t:l?h.title.toLowerCase().includes(l.toLowerCase()):!0).sort((h,b)=>b.proposal_id-h.proposal_id).sort((h,b)=>h.status===_.Active?-1:b.status===_.Active?1:0))||[],[i,t,l]),x=fe(ae.YOUR_TRANSACTIONS_STAKE_KNC);return e.jsxs(j,{className:"items-stretch gap-4",children:[e.jsxs(f,{className:"items-center justify-between gap-4",children:[e.jsx(_e,{className:"text-primary",children:e.jsx(o,{id:"81RIiP"})}),e.jsxs(f,{className:"gap-8",children:[a&&e.jsxs("button",{onClick:x,className:"flex cursor-pointer items-center gap-2 border-none bg-transparent text-sm text-subText hover:brightness-125",children:[e.jsx(xs,{}),e.jsx("span",{className:"max-sm:hidden",children:e.jsx(o,{id:"0caMy7"})})]}),e.jsxs("a",{href:"https://gov.kyber.org/",target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 text-sm text-subText hover:brightness-125",children:[e.jsx(ys,{}),e.jsx("span",{className:"max-sm:hidden",children:e.jsx(o,{id:"7AtLTK"})})]}),e.jsxs("a",{href:"https://docs.kyberswap.com/kyber-dao/kyber-dao-introduction",target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 text-sm text-subText hover:brightness-125",children:[e.jsx(Cs,{}),e.jsx("span",{className:"max-sm:hidden",children:e.jsx(o,{id:"/lDBHm"})})]})]})]}),e.jsxs(f,{className:"items-center justify-between gap-4 max-sm:flex-col",children:[e.jsx(Hs,{status:t,setStatus:r}),e.jsx(Ys,{search:l,setSearch:n})]}),i?m.length>0?m.map(h=>e.jsx(Vs,{proposal:h,onBadgeClick:r,voteCallback:s},h.proposal_id.toString())):e.jsxs(ue,{className:"h-52 gap-4 text-subText",children:[e.jsx(Je,{size:24,className:"text-subText"}),e.jsx("span",{className:"text-subText",children:e.jsx(o,{id:"zoU4+G"})})]}):e.jsx(ue,{className:"h-52 gap-4 text-subText",children:e.jsx(ks,{})}),e.jsx(ms,{})]})}
1const $s=K.memo(Fs),me=({hasGreenBackground:s,children:a})=>e.jsx(j,{className:"min-w-0 rounded-2xl bg-buttonGray/70 p-5",style:s?{backgroundImage:`url('${ws}')`,backgroundSize:"cover"}:void 0,children:a}),X=s=>s===void 0?"--":s===0?"0%":s<1e-4?"<0.0001 %":s<1?s.toFixed(4)+" %":s.toPrecision(4)+" %";function Js(){var Ce;const s=Ae(),{account:a}=H(),{trackingHandler:i}=Xe(),{daoInfo:t,remainingCumulativeAmount:r,claimedRewardAmount:l,stakerInfo:n,stakerInfoNextEpoch:m}=re(),x=es(),h=ss(),{vote:b}=ts(),{switchToEthereum:d}=Me(),y=!!r&&r!==0n,A=fe(ae.KYBER_DAO_CLAIM),T=Le(),[M,g]=c.useState(0),[R,O]=c.useState(!1),[le,D]=c.useState(!1),[w,B]=c.useState(""),[I,S]=c.useState(void 0),[U,F]=c.useState(void 0),u=n?(n==null?void 0:n.stake_amount)+(n==null?void 0:n.pending_stake_amount):0,p=c.useMemo(()=>n?(n.delegate.toLowerCase()===(a==null?void 0:a.toLowerCase())?n.stake_amount:0)+n.delegated_stake_amount:0,[n,a]),N=c.useMemo(()=>m?(m.delegate.toLowerCase()===(a==null?void 0:a.toLowerCase())?m.stake_amount:0)+m.delegated_stake_amount:0,[m,a]),$=n&&n.stake_amount>0,z=n&&n.pending_stake_amount>0,q=n&&n.delegated_stake_amount>0,G=n&&a?((Ce=n.delegate)==null?void 0:Ce.toLowerCase())!==a.toLowerCase():!1,Q=c.useCallback(()=>{d(C._({id:"UjiJd0"})).then(()=>{i(as.KYBER_DAO_CLAIM_CLICK),A()}).catch(()=>{})},[A,i,d]),oe=c.useCallback(async()=>{const ce=Y(r);B(C._({id:"rAR3jR",values:{amount:ce}})),O(!0),D(!0),A();try{const E=await h();S(E)}catch(E){F(E==null?void 0:E.message),S(void 0)}finally{D(!1)}},[h,r,A]),Ve=c.useCallback(async(ce,E)=>{B(C._({id:"ZeWIoC"})),O(!0),D(!0);try{const V=await b(ce,E);return D(!1),S(V),!0}catch(V){throw O(!1),D(!1),F(V==null?void 0:V.message),S(void 0),V}},[b]);return e.jsxs(ns,{children:[e.jsx(is,{title:e.jsx(o,{id:"gNaKXf"}),children:e.jsxs(f,{className:"items-center gap-2",children:[e.jsx(De,{size:20}),e.jsxs("span",{className:"text-base",children:["KNC: $",x?(+x).toPrecision(4):"--"]})]})}),e.jsxs("div",{className:"grid w-full gap-4 md:grid-cols-3",children:[e.jsx(me,{children:e.jsxs(j,{className:"gap-4",children:[e.jsx(xe,{children:e.jsx(o,{id:"utu2O4"})}),e.jsxs(j,{className:"gap-2",children:[e.jsx(ee,{children:t?ye(Math.round(t.total_staked),{significantDigits:6})+" KNC":"--"}),e.jsx(J,{children:t&&x?"~"+ye(+x*Math.round(t.total_staked),{significantDigits:6})+" USD":""})]})]})}),e.jsx(me,{children:e.jsxs(j,{className:"gap-4",children:[e.jsxs(xe,{children:[e.jsx(o,{id:"AUji8Z"})," ",e.jsx(W,{fontSize:12,placement:"top",text:C._({id:"0gEzei"})})]}),e.jsxs(j,{className:"gap-2",children:[e.jsxs(k,{children:[e.jsxs(he,{children:[e.jsxs("span",{className:"text-xl font-medium",style:{color:z&&!$?s.border:s.text},children:[X((t==null?void 0:t.total_staked)&&p&&p/t.total_staked*100),z&&$||q?e.jsx(W,{fontSize:12,placement:"top",width:"fit-content",className:"text-warning",size:14,text:e.jsxs(j,{className:"gap-2",children:[e.jsx("span",{className:"block w-64 text-subText",children:z?e.jsx(o,{id:"Eeulm/"}):e.jsx(o,{id:"omvBoA"})}),e.jsx("span",{className:"text-text",children:e.jsx(o,{id:"lvcHiT",values:{0:X(p&&(t==null?void 0:t.total_staked)&&p/t.total_staked*100)}})}),n!=null&&n.delegated_stake_amount?e.jsx("span",{className:"text-text",children:e.jsx(o,{id:"1lIIMG",values:{0:X((n==null?void 0:n.delegated_stake_amount)&&(t==null?void 0:t.total_staked)&&(n==null?void 0:n.delegated_stake_amount)/t.total_staked*100)}})}):null,e.jsx("span",{className:"text-warning",children:e.jsx(o,{id:"Zz3wM2",values:{0:X(N&&(t==null?void 0:t.total_staked)&&N/t.total_staked*100)}})})]})}):null,u&&(n==null?void 0:n.stake_amount)===0&&!G?e.jsx(W,{fontSize:12,size:14,className:"text-subText",placement:"top",text:C._({id:"XA82Zw"})}):null]}),u?null:e.jsx(W,{placement:"top",fontSize:12,text:C._({id:"vyugZq"})})]}),G&&e.jsx(ve,{text:C._({id:"jDQopj"}),placement:"top",children:e.jsxs(he,{className:"gap-2 text-subText",children:[e.jsx(rs,{size:14}),e.jsx("span",{className:"text-xs",children:(n==null?void 0:n.delegate.slice(0,5))+"..."+(n==null?void 0:n.delegate.slice(-4))})]})})]}),e.jsxs(k,{children:[e.jsx(J,{children:u?(+u.toFixed(2)).toLocaleStr
1ing()+" KNC Staked":"--"}),e.jsx(ls,{to:"/kyberdao/stake-knc",className:"whitespace-nowrap text-xs",children:e.jsx(o,{id:"evygTy"})})]})]})]})}),e.jsx(me,{hasGreenBackground:y,children:e.jsxs(j,{className:"h-full justify-between gap-4",children:[e.jsxs(xe,{children:[e.jsx("span",{className:v("cursor-pointer hover:brightness-125",M===0&&"text-primary"),onClick:()=>g(0),children:e.jsx(o,{id:"uiEhIw"})})," ","|"," ",e.jsx("span",{className:v("cursor-pointer hover:brightness-125",M===1&&"text-primary"),onClick:()=>g(1),children:e.jsx(o,{id:"v+ijb6"})})]}),a?M===0?e.jsxs(k,{children:[e.jsxs(j,{className:"gap-2",children:[e.jsxs(ee,{children:[Y(r,void 0,2)," KNC"]}),e.jsxs(J,{children:[(+(+Y(r)*+(x||"0")).toFixed(2)).toLocaleString()," ","USD"]})]}),e.jsx(ie,{width:"75px",disabled:!y,style:{filter:"drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.16))"},onClick:Q,children:e.jsx(o,{id:"hom7qf"})})]}):e.jsx(k,{children:e.jsxs(j,{className:"gap-2",children:[e.jsxs(ee,{children:[(+Y(l,void 0,2)).toLocaleString()," KNC"]}),e.jsxs(J,{children:[(+(+Y(l)*+(x||0)).toFixed(2)).toLocaleString()," USD"]})]})}):e.jsx(Pe,{onClick:T,children:e.jsx(o,{id:"iSLIjg"})})]})})]}),e.jsxs(j,{className:"gap-2 text-xs",children:[e.jsxs(f,{className:"items-center gap-2 max-sm:flex-col max-sm:items-start",children:[e.jsxs(f,{className:"items-center gap-2",children:[e.jsx("span",{children:e.jsx(o,{id:"ph9BBh",values:{0:t?t.current_epoch:"--"}})}),t&&e.jsx(je,{endTime:t.first_epoch_start_timestamp+t.current_epoch*t.epoch_period_in_seconds})]}),e.jsx("span",{children:e.jsx(o,{id:"8kOhCN"})})]}),e.jsx("span",{className:"text-xs italic text-subText max-sm:hidden",children:e.jsx(o,{id:"GJKhE8"})})]}),e.jsx($s,{voteCallback:Ve}),e.jsx(Ns,{amount:Y(r),onConfirmClaim:oe}),e.jsx(os,{isOpen:R,onDismiss:()=>O(!1),attemptingTxn:le,hash:I,pendingText:w,content:()=>U?e.jsx(cs,{message:U,onDismiss:()=>O(!1)}):e.jsx(e.Fragment,{})})]})}export{Js as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.