@canton-network/example-portfolio 0.18.2 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{g as R,a as A,r as v,u as P,j as g,c as M,b as F,s as y,G as I,ad as $,ae as j,d as K,E as k}from"./index--XTC7grR.js";function L(t){return String(t).match(/[\d.\-+]*\s*(.*)/)[1]||""}function W(t){return parseFloat(t)}function G(t){return R("MuiSkeleton",t)}A("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);const H=t=>{const{classes:e,variant:a,animation:o,hasChildren:r,width:n,height:i}=t;return F({root:["root",a,o,r&&"withChildren",r&&!n&&"fitContent",r&&!i&&"heightAuto"]},G,e)},w=j`
1
+ import{g as R,a as A,r as v,u as P,j as g,c as M,b as F,s as y,G as I,ad as $,ae as j,d as K,E as k}from"./index-ChW8dX2O.js";function L(t){return String(t).match(/[\d.\-+]*\s*(.*)/)[1]||""}function W(t){return parseFloat(t)}function G(t){return R("MuiSkeleton",t)}A("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);const H=t=>{const{classes:e,variant:a,animation:o,hasChildren:r,width:n,height:i}=t;return F({root:["root",a,o,r&&"withChildren",r&&!n&&"fitContent",r&&!i&&"heightAuto"]},G,e)},w=j`
2
2
  0% {
3
3
  opacity: 1;
4
4
  }
@@ -1,2 +1,2 @@
1
- import{r as c,g as y,a as v,u as f,j as p,c as C,b as T,s as x,G as k,F as g}from"./index--XTC7grR.js";const D=c.createContext();function E(o){return y("MuiTable",o)}v("MuiTable",["root","stickyHeader"]);const W=o=>{const{classes:e,stickyHeader:t}=o;return T({root:["root",t&&"stickyHeader"]},E,e)},F=x("table",{name:"MuiTable",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,t.stickyHeader&&e.stickyHeader]}})(k(({theme:o})=>({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":{...o.typography.body2,padding:o.spacing(2),color:(o.vars||o).palette.text.secondary,textAlign:"left",captionSide:"bottom"},variants:[{props:({ownerState:e})=>e.stickyHeader,style:{borderCollapse:"separate"}}]}))),j="table",no=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTable"}),{className:n,component:a=j,padding:l="normal",size:r="medium",stickyHeader:i=!1,...u}=s,d={...s,component:a,padding:l,size:r,stickyHeader:i},w=W(d),H=c.useMemo(()=>({padding:l,size:r,stickyHeader:i}),[l,r,i]);return p.jsx(D.Provider,{value:H,children:p.jsx(F,{as:a,role:a===j?null:"table",ref:t,className:C(w.root,n),ownerState:d,...u})})}),M=c.createContext();function G(o){return y("MuiTableBody",o)}v("MuiTableBody",["root"]);const I=o=>{const{classes:e}=o;return T({root:["root"]},G,e)},J=x("tbody",{name:"MuiTableBody",slot:"Root"})({display:"table-row-group"}),L={variant:"body"},N="tbody",io=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTableBody"}),{className:n,component:a=N,...l}=s,r={...s,component:a},i=I(r);return p.jsx(M.Provider,{value:L,children:p.jsx(J,{className:C(i.root,n),as:a,ref:t,role:a===N?null:"rowgroup",ownerState:r,...l})})});function X(o){return y("MuiTableCell",o)}const q=v("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]),K=o=>{const{classes:e,variant:t,align:s,padding:n,size:a,stickyHeader:l}=o,r={root:["root",t,l&&"stickyHeader",s!=="inherit"&&`align${g(s)}`,n!=="normal"&&`padding${g(n)}`,`size${g(a)}`]};return T(r,X,e)},Q=x("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,e[t.variant],e[`size${g(t.size)}`],t.padding!=="normal"&&e[`padding${g(t.padding)}`],t.align!=="inherit"&&e[`align${g(t.align)}`],t.stickyHeader&&e.stickyHeader]}})(k(({theme:o})=>({...o.typography.body2,display:"table-cell",verticalAlign:"inherit",borderBottom:o.vars?`1px solid ${o.vars.palette.TableCell.border}`:`1px solid
1
+ import{r as c,g as y,a as v,u as f,j as p,c as C,b as T,s as x,G as k,F as g}from"./index-ChW8dX2O.js";const D=c.createContext();function E(o){return y("MuiTable",o)}v("MuiTable",["root","stickyHeader"]);const W=o=>{const{classes:e,stickyHeader:t}=o;return T({root:["root",t&&"stickyHeader"]},E,e)},F=x("table",{name:"MuiTable",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,t.stickyHeader&&e.stickyHeader]}})(k(({theme:o})=>({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":{...o.typography.body2,padding:o.spacing(2),color:(o.vars||o).palette.text.secondary,textAlign:"left",captionSide:"bottom"},variants:[{props:({ownerState:e})=>e.stickyHeader,style:{borderCollapse:"separate"}}]}))),j="table",no=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTable"}),{className:n,component:a=j,padding:l="normal",size:r="medium",stickyHeader:i=!1,...u}=s,d={...s,component:a,padding:l,size:r,stickyHeader:i},w=W(d),H=c.useMemo(()=>({padding:l,size:r,stickyHeader:i}),[l,r,i]);return p.jsx(D.Provider,{value:H,children:p.jsx(F,{as:a,role:a===j?null:"table",ref:t,className:C(w.root,n),ownerState:d,...u})})}),M=c.createContext();function G(o){return y("MuiTableBody",o)}v("MuiTableBody",["root"]);const I=o=>{const{classes:e}=o;return T({root:["root"]},G,e)},J=x("tbody",{name:"MuiTableBody",slot:"Root"})({display:"table-row-group"}),L={variant:"body"},N="tbody",io=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTableBody"}),{className:n,component:a=N,...l}=s,r={...s,component:a},i=I(r);return p.jsx(M.Provider,{value:L,children:p.jsx(J,{className:C(i.root,n),as:a,ref:t,role:a===N?null:"rowgroup",ownerState:r,...l})})});function X(o){return y("MuiTableCell",o)}const q=v("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]),K=o=>{const{classes:e,variant:t,align:s,padding:n,size:a,stickyHeader:l}=o,r={root:["root",t,l&&"stickyHeader",s!=="inherit"&&`align${g(s)}`,n!=="normal"&&`padding${g(n)}`,`size${g(a)}`]};return T(r,X,e)},Q=x("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,e[t.variant],e[`size${g(t.size)}`],t.padding!=="normal"&&e[`padding${g(t.padding)}`],t.align!=="inherit"&&e[`align${g(t.align)}`],t.stickyHeader&&e.stickyHeader]}})(k(({theme:o})=>({...o.typography.body2,display:"table-cell",verticalAlign:"inherit",borderBottom:o.vars?`1px solid ${o.vars.palette.TableCell.border}`:`1px solid
2
2
  ${o.palette.mode==="light"?o.lighten(o.alpha(o.palette.divider,1),.88):o.darken(o.alpha(o.palette.divider,1),.68)}`,textAlign:"left",padding:16,variants:[{props:{variant:"head"},style:{color:(o.vars||o).palette.text.primary,lineHeight:o.typography.pxToRem(24),fontWeight:o.typography.fontWeightMedium}},{props:{variant:"body"},style:{color:(o.vars||o).palette.text.primary}},{props:{variant:"footer"},style:{color:(o.vars||o).palette.text.secondary,lineHeight:o.typography.pxToRem(21),fontSize:o.typography.pxToRem(12)}},{props:{size:"small"},style:{padding:"6px 16px",[`&.${q.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}}},{props:{padding:"checkbox"},style:{width:48,padding:"0 0 0 4px"}},{props:{padding:"none"},style:{padding:0}},{props:{align:"left"},style:{textAlign:"left"}},{props:{align:"center"},style:{textAlign:"center"}},{props:{align:"right"},style:{textAlign:"right",flexDirection:"row-reverse"}},{props:{align:"justify"},style:{textAlign:"justify"}},{props:({ownerState:e})=>e.stickyHeader,style:{position:"sticky",top:0,zIndex:2,backgroundColor:(o.vars||o).palette.background.default}}]}))),co=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTableCell"}),{align:n="inherit",className:a,component:l,padding:r,scope:i,size:u,sortDirection:d,variant:w,...H}=s,b=c.useContext(D),m=c.useContext(M),$=m&&m.variant==="head";let R;l?R=l:R=$?"th":"td";let h=i;R==="td"?h=void 0:!h&&$&&(h="col");const z=w||m&&m.variant,S={...s,align:n,component:R,padding:r||(b&&b.padding?b.padding:"normal"),size:u||(b&&b.size?b.size:"medium"),sortDirection:d,stickyHeader:z==="head"&&b&&b.stickyHeader,variant:z},O=K(S);let U=null;return d&&(U=d==="asc"?"ascending":"descending"),p.jsx(Q,{as:R,ref:t,className:C(O.root,a),"aria-sort":U,scope:h,ownerState:S,...H})});function V(o){return y("MuiTableContainer",o)}v("MuiTableContainer",["root"]);const Y=o=>{const{classes:e}=o;return T({root:["root"]},V,e)},Z=x("div",{name:"MuiTableContainer",slot:"Root"})({width:"100%",overflowX:"auto"}),po=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTableContainer"}),{className:n,component:a="div",...l}=s,r={...s,component:a},i=Y(r);return p.jsx(Z,{ref:t,as:a,className:C(i.root,n),ownerState:r,...l})});function _(o){return y("MuiTableHead",o)}v("MuiTableHead",["root"]);const oo=o=>{const{classes:e}=o;return T({root:["root"]},_,e)},eo=x("thead",{name:"MuiTableHead",slot:"Root"})({display:"table-header-group"}),to={variant:"head"},B="thead",uo=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTableHead"}),{className:n,component:a=B,...l}=s,r={...s,component:a},i=oo(r);return p.jsx(M.Provider,{value:to,children:p.jsx(eo,{as:a,className:C(i.root,n),ref:t,role:a===B?null:"rowgroup",ownerState:r,...l})})});function ao(o){return y("MuiTableRow",o)}const P=v("MuiTableRow",["root","selected","hover","head","footer"]),so=o=>{const{classes:e,selected:t,hover:s,head:n,footer:a}=o;return T({root:["root",t&&"selected",s&&"hover",n&&"head",a&&"footer"]},ao,e)},ro=x("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:t}=o;return[e.root,t.head&&e.head,t.footer&&e.footer]}})(k(({theme:o})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${P.hover}:hover`]:{backgroundColor:(o.vars||o).palette.action.hover},[`&.${P.selected}`]:{backgroundColor:o.alpha((o.vars||o).palette.primary.main,(o.vars||o).palette.action.selectedOpacity),"&:hover":{backgroundColor:o.alpha((o.vars||o).palette.primary.main,`${(o.vars||o).palette.action.selectedOpacity} + ${(o.vars||o).palette.action.hoverOpacity}`)}}}))),A="tr",bo=c.forwardRef(function(e,t){const s=f({props:e,name:"MuiTableRow"}),{className:n,component:a=A,hover:l=!1,selected:r=!1,...i}=s,u=c.useContext(M),d={...s,component:a,hover:l,selected:r,head:u&&u.variant==="head",footer:u&&u.variant==="footer"},w=so(d);return p.jsx(ro,{as:a,ref:t,className:C(w.root,n),role:a===A?null:"row",ownerState:d,...i})});export{po as T,no as a,uo as b,bo as c,co as d,io as e};
@@ -1 +1 @@
1
- import{g as _o,a as qo,r as s,u as Jo,_ as Qo,af as Zo,$ as B,a2 as oe,ag as ee,ah as yo,ai as te,a0 as re,aj as pe,c as To,E as z,ak as se,j as n,al as xo,F as vo,b as ne,s as q,G as J,am as bo,d as Po,B as ae,T as ie,I as le}from"./index--XTC7grR.js";function ce(e){return _o("MuiTooltip",e)}const r=qo("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]);function de(e){return Math.round(e*1e5)/1e5}const ue=e=>{const{classes:o,disableInteractive:p,arrow:a,touch:y,placement:d}=e,M={popper:["popper",!p&&"popperInteractive",a&&"popperArrow"],tooltip:["tooltip",a&&"tooltipArrow",y&&"touch",`tooltipPlacement${vo(d.split("-")[0])}`],arrow:["arrow"]};return ne(M,ce,o)},me=q(xo,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.popper,!p.disableInteractive&&o.popperInteractive,p.arrow&&o.popperArrow,!p.open&&o.popperClose]}})(J(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:o})=>!o.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:o})=>!o,style:{pointerEvents:"none"}},{props:({ownerState:o})=>o.arrow,style:{[`&[data-popper-placement*="bottom"] .${r.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${r.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),fe=q("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.tooltip,p.touch&&o.touch,p.arrow&&o.tooltipArrow,o[`tooltipPlacement${vo(p.placement.split("-")[0])}`]]}})(J(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${r.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${r.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${r.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${r.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:o})=>o.arrow,style:{position:"relative",margin:0}},{props:({ownerState:o})=>o.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${de(16/14)}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:o})=>!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:o})=>!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:o})=>!!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:o})=>!!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),he=q("span",{name:"MuiTooltip",slot:"Arrow"})(J(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}})));let A=!1;const wo=new te;let $={x:0,y:0};function N(e,o){return(p,...a)=>{o&&o(p,...a),e(p,...a)}}const ge=s.forwardRef(function(o,p){const a=Jo({props:o,name:"MuiTooltip"}),{arrow:y=!1,children:d,classes:M,components:x={},componentsProps:T={},describeChild:l=!1,disableFocusListener:h=!1,disableHoverListener:O=!1,disableInteractive:W=!1,disableTouchListener:Ro=!1,enterDelay:Q=100,enterNextDelay:Z=0,enterTouchDelay:Co=700,followCursor:D=!1,id:So,leaveDelay:oo=0,leaveTouchDelay:$o=1500,onClose:eo,onOpen:to,open:Mo,placement:ro="bottom",PopperComponent:po,PopperProps:b={},slotProps:u={},slots:Oo={},title:w,TransitionComponent:Io,TransitionProps:Eo,...so}=a,m=s.isValidElement(d)?d:n.jsx("span",{children:d}),no=Qo(),jo=Zo(),[v,ao]=s.useState(),[U,Lo]=s.useState(null),I=s.useRef(!1),V=W||D,io=B(),H=B(),E=B(),lo=B(),[ko,co]=oe({controlled:Mo,default:!1,name:"Tooltip",state:"open"});let c=ko;const G=ee(So),P=s.useRef(),j=yo(()=>{P.current!==void 0&&(document.body.style.WebkitUserSelect=P.current,P.current=void 0),lo.clear()});s.useEffect(()=>j,[j]);const uo=t=>{wo.clear(),A=!0,co(!0),to&&!c&&to(t)},L=yo(t=>{wo.start(800+oo,()=>{A=!1}),co(!1),eo&&c&&eo(t),io.start(no.transitions.duration.shortest,()=>{I.current=!1})}),k=t=>{I.current&&t.type!=="touchstart"||(v&&v.removeAttribute("title"),H.clear(),E.clear(),Q||A&&Z?H.start(A?Z:Q,()=>{uo(t)}):uo(t))},K=t=>{H.clear(),E.start(oo,()=>{L(t)})},[,mo]=s.useState(!1),fo=t=>{bo(t.target)||(mo(!1),K(t))},ho=t=>{v||ao(t.currentTarget),bo(t.target)&&(mo(!0),k(t))},go=t=>{I.current=!0;const f=m.props;f.onTouchStart&&f.onTouchStart(t)},Fo=t=>{go(t),E.clear(),io.clear(),j(),P.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",lo.start(Co,()=>{document.body.style.WebkitUserSelect=P.current,k(t)})},Bo=t=>{m.props.onTouchEnd&&m.props.onTouchEnd(t),j(),E.start($o,()=>{L(t)})};s.useEffect(()=>{if(!c)return;function t(f){f.key==="Escape"&&L(f)}return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[L,c]);const zo=re(pe(m),ao,p);!w&&w!==0&&(c=!1);const X=s.useRef(),Ao=t=>{const f=m.props;f.onMouseMove&&f.onMouseMove(t),$={x:t.clientX,y:t.clientY},X.current&&X.current.update()},R={},Y=typeof w=="string";l?(R.title=!c&&Y&&!O?w:null,R["aria-describedby"]=c?G:null):(R["aria-label"]=Y?w:null,R["aria-labelledby"]=c&&!Y?G:null);const i={...R,...so,...m.props,className:To(so.className,m.props.className),onTouchStart:go,ref:zo,...D?{onMouseMove:Ao}:{}},C={};Ro||(i.onTouchStart=Fo,i.onTouchEnd=Bo),O||(i.onMouseOver=N(k,i.onMouseOver),i.onMouseLeave=N(K,i.onMouseLeave),V||(C.onMouseOver=k,C.onMouseLeave=K)),h||(i.onFocus=N(ho,i.onFocus),i.onBlur=N(fo,i.onBlur),V||(C.onFocus=ho,C.onBlur=fo));const g={...a,isRtl:jo,arrow:y,disableInteractive:V,placement:ro,PopperComponentProp:po,touch:I.current},S=typeof u.popper=="function"?u.popper(g):u.popper,No=s.useMemo(()=>{let t=[{name:"arrow",enabled:!!U,options:{element:U,padding:4}}];return b.popperOptions?.modifiers&&(t=t.concat(b.popperOptions.modifiers)),S?.popperOptions?.modifiers&&(t=t.concat(S.popperOptions.modifiers)),{...b.popperOptions,...S?.popperOptions,modifiers:t}},[U,b.popperOptions,S?.popperOptions]),_=ue(g),Wo=typeof u.transition=="function"?u.transition(g):u.transition,F={slots:{popper:x.Popper,transition:x.Transition??Io,tooltip:x.Tooltip,arrow:x.Arrow,...Oo},slotProps:{arrow:u.arrow??T.arrow,popper:{...b,...S??T.popper},tooltip:u.tooltip??T.tooltip,transition:{...Eo,...Wo??T.transition}}},[Do,Uo]=z("popper",{elementType:me,externalForwardedProps:F,ownerState:g,className:To(_.popper,b?.className)}),[Vo,Ho]=z("transition",{elementType:se,externalForwardedProps:F,ownerState:g}),[Go,Ko]=z("tooltip",{elementType:fe,className:_.tooltip,externalForwardedProps:F,ownerState:g}),[Xo,Yo]=z("arrow",{elementType:he,className:_.arrow,externalForwardedProps:F,ownerState:g,ref:Lo});return n.jsxs(s.Fragment,{children:[s.cloneElement(m,i),n.jsx(Do,{as:po??xo,placement:ro,anchorEl:D?{getBoundingClientRect:()=>({top:$.y,left:$.x,right:$.x,bottom:$.y,width:0,height:0})}:v,popperRef:X,open:v?c:!1,id:G,transition:!0,...C,...Uo,popperOptions:No,children:({TransitionProps:t})=>n.jsx(Vo,{timeout:no.transitions.duration.shorter,...t,...Ho,children:n.jsxs(Go,{...Ko,children:[w,y?n.jsx(Xo,{...Yo}):null]})})})]})}),ye=Po(n.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"})),Te=Po(n.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),we=({value:e,maxLength:o=8})=>{const[p,a]=s.useState(!1),y=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)}catch(l){console.error("Failed to copy:",l)}},d=(l,h)=>l.length<=h?l:`${l.slice(0,h)}...`,M=l=>{const h=l.split("::"),O=h[0]||"",W=h[1]||"";return`${O}::${d(W,o)}`},T=e.includes("::")?M(e):d(e,o);return n.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1},children:[n.jsx(ie,{variant:"body2",component:"span",children:T}),n.jsx(ge,{title:p?"Copied!":"Copy to clipboard",children:n.jsx(le,{size:"small",onClick:y,sx:{p:.5},children:p?n.jsx(Te,{fontSize:"small"}):n.jsx(ye,{fontSize:"small"})})})]})};export{we as C};
1
+ import{g as _o,a as qo,r as s,u as Jo,_ as Qo,af as Zo,$ as B,a2 as oe,ag as ee,ah as yo,ai as te,a0 as re,aj as pe,c as To,E as z,ak as se,j as n,al as xo,F as vo,b as ne,s as q,G as J,am as bo,d as Po,B as ae,T as ie,I as le}from"./index-ChW8dX2O.js";function ce(e){return _o("MuiTooltip",e)}const r=qo("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]);function de(e){return Math.round(e*1e5)/1e5}const ue=e=>{const{classes:o,disableInteractive:p,arrow:a,touch:y,placement:d}=e,M={popper:["popper",!p&&"popperInteractive",a&&"popperArrow"],tooltip:["tooltip",a&&"tooltipArrow",y&&"touch",`tooltipPlacement${vo(d.split("-")[0])}`],arrow:["arrow"]};return ne(M,ce,o)},me=q(xo,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.popper,!p.disableInteractive&&o.popperInteractive,p.arrow&&o.popperArrow,!p.open&&o.popperClose]}})(J(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:o})=>!o.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:o})=>!o,style:{pointerEvents:"none"}},{props:({ownerState:o})=>o.arrow,style:{[`&[data-popper-placement*="bottom"] .${r.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${r.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),fe=q("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.tooltip,p.touch&&o.touch,p.arrow&&o.tooltipArrow,o[`tooltipPlacement${vo(p.placement.split("-")[0])}`]]}})(J(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${r.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${r.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${r.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${r.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:o})=>o.arrow,style:{position:"relative",margin:0}},{props:({ownerState:o})=>o.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${de(16/14)}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:o})=>!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:o})=>!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:o})=>!!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:o})=>!!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),he=q("span",{name:"MuiTooltip",slot:"Arrow"})(J(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}})));let A=!1;const wo=new te;let $={x:0,y:0};function N(e,o){return(p,...a)=>{o&&o(p,...a),e(p,...a)}}const ge=s.forwardRef(function(o,p){const a=Jo({props:o,name:"MuiTooltip"}),{arrow:y=!1,children:d,classes:M,components:x={},componentsProps:T={},describeChild:l=!1,disableFocusListener:h=!1,disableHoverListener:O=!1,disableInteractive:W=!1,disableTouchListener:Ro=!1,enterDelay:Q=100,enterNextDelay:Z=0,enterTouchDelay:Co=700,followCursor:D=!1,id:So,leaveDelay:oo=0,leaveTouchDelay:$o=1500,onClose:eo,onOpen:to,open:Mo,placement:ro="bottom",PopperComponent:po,PopperProps:b={},slotProps:u={},slots:Oo={},title:w,TransitionComponent:Io,TransitionProps:Eo,...so}=a,m=s.isValidElement(d)?d:n.jsx("span",{children:d}),no=Qo(),jo=Zo(),[v,ao]=s.useState(),[U,Lo]=s.useState(null),I=s.useRef(!1),V=W||D,io=B(),H=B(),E=B(),lo=B(),[ko,co]=oe({controlled:Mo,default:!1,name:"Tooltip",state:"open"});let c=ko;const G=ee(So),P=s.useRef(),j=yo(()=>{P.current!==void 0&&(document.body.style.WebkitUserSelect=P.current,P.current=void 0),lo.clear()});s.useEffect(()=>j,[j]);const uo=t=>{wo.clear(),A=!0,co(!0),to&&!c&&to(t)},L=yo(t=>{wo.start(800+oo,()=>{A=!1}),co(!1),eo&&c&&eo(t),io.start(no.transitions.duration.shortest,()=>{I.current=!1})}),k=t=>{I.current&&t.type!=="touchstart"||(v&&v.removeAttribute("title"),H.clear(),E.clear(),Q||A&&Z?H.start(A?Z:Q,()=>{uo(t)}):uo(t))},K=t=>{H.clear(),E.start(oo,()=>{L(t)})},[,mo]=s.useState(!1),fo=t=>{bo(t.target)||(mo(!1),K(t))},ho=t=>{v||ao(t.currentTarget),bo(t.target)&&(mo(!0),k(t))},go=t=>{I.current=!0;const f=m.props;f.onTouchStart&&f.onTouchStart(t)},Fo=t=>{go(t),E.clear(),io.clear(),j(),P.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",lo.start(Co,()=>{document.body.style.WebkitUserSelect=P.current,k(t)})},Bo=t=>{m.props.onTouchEnd&&m.props.onTouchEnd(t),j(),E.start($o,()=>{L(t)})};s.useEffect(()=>{if(!c)return;function t(f){f.key==="Escape"&&L(f)}return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[L,c]);const zo=re(pe(m),ao,p);!w&&w!==0&&(c=!1);const X=s.useRef(),Ao=t=>{const f=m.props;f.onMouseMove&&f.onMouseMove(t),$={x:t.clientX,y:t.clientY},X.current&&X.current.update()},R={},Y=typeof w=="string";l?(R.title=!c&&Y&&!O?w:null,R["aria-describedby"]=c?G:null):(R["aria-label"]=Y?w:null,R["aria-labelledby"]=c&&!Y?G:null);const i={...R,...so,...m.props,className:To(so.className,m.props.className),onTouchStart:go,ref:zo,...D?{onMouseMove:Ao}:{}},C={};Ro||(i.onTouchStart=Fo,i.onTouchEnd=Bo),O||(i.onMouseOver=N(k,i.onMouseOver),i.onMouseLeave=N(K,i.onMouseLeave),V||(C.onMouseOver=k,C.onMouseLeave=K)),h||(i.onFocus=N(ho,i.onFocus),i.onBlur=N(fo,i.onBlur),V||(C.onFocus=ho,C.onBlur=fo));const g={...a,isRtl:jo,arrow:y,disableInteractive:V,placement:ro,PopperComponentProp:po,touch:I.current},S=typeof u.popper=="function"?u.popper(g):u.popper,No=s.useMemo(()=>{let t=[{name:"arrow",enabled:!!U,options:{element:U,padding:4}}];return b.popperOptions?.modifiers&&(t=t.concat(b.popperOptions.modifiers)),S?.popperOptions?.modifiers&&(t=t.concat(S.popperOptions.modifiers)),{...b.popperOptions,...S?.popperOptions,modifiers:t}},[U,b.popperOptions,S?.popperOptions]),_=ue(g),Wo=typeof u.transition=="function"?u.transition(g):u.transition,F={slots:{popper:x.Popper,transition:x.Transition??Io,tooltip:x.Tooltip,arrow:x.Arrow,...Oo},slotProps:{arrow:u.arrow??T.arrow,popper:{...b,...S??T.popper},tooltip:u.tooltip??T.tooltip,transition:{...Eo,...Wo??T.transition}}},[Do,Uo]=z("popper",{elementType:me,externalForwardedProps:F,ownerState:g,className:To(_.popper,b?.className)}),[Vo,Ho]=z("transition",{elementType:se,externalForwardedProps:F,ownerState:g}),[Go,Ko]=z("tooltip",{elementType:fe,className:_.tooltip,externalForwardedProps:F,ownerState:g}),[Xo,Yo]=z("arrow",{elementType:he,className:_.arrow,externalForwardedProps:F,ownerState:g,ref:Lo});return n.jsxs(s.Fragment,{children:[s.cloneElement(m,i),n.jsx(Do,{as:po??xo,placement:ro,anchorEl:D?{getBoundingClientRect:()=>({top:$.y,left:$.x,right:$.x,bottom:$.y,width:0,height:0})}:v,popperRef:X,open:v?c:!1,id:G,transition:!0,...C,...Uo,popperOptions:No,children:({TransitionProps:t})=>n.jsx(Vo,{timeout:no.transitions.duration.shorter,...t,...Ho,children:n.jsxs(Go,{...Ko,children:[w,y?n.jsx(Xo,{...Yo}):null]})})})]})}),ye=Po(n.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"})),Te=Po(n.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),we=({value:e,maxLength:o=8})=>{const[p,a]=s.useState(!1),y=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)}catch(l){console.error("Failed to copy:",l)}},d=(l,h)=>l.length<=h?l:`${l.slice(0,h)}...`,M=l=>{const h=l.split("::"),O=h[0]||"",W=h[1]||"";return`${O}::${d(W,o)}`},T=e.includes("::")?M(e):d(e,o);return n.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1},children:[n.jsx(ie,{variant:"body2",component:"span",children:T}),n.jsx(ge,{title:p?"Copied!":"Copy to clipboard",children:n.jsx(le,{size:"small",onClick:y,sx:{p:.5},children:p?n.jsx(Te,{fontSize:"small"}):n.jsx(ye,{fontSize:"small"})})})]})};export{we as C};
@@ -1 +1 @@
1
- import{A as ue,Q as ge,C as fe,r as b,g as me,a as be,u as ye,E as Z,c as ve,j as e,F as j,b as je,s as ee,G as Ce,H as Ie,w as Ae,f as We,J as Oe,K as Re,L as Le,M as re,N as ne,T as o,O as te,B as s,R as se,k as A,S as O,P as U,U as T,t as S,V as Se,W as Te,X as ke,v as we,y as G,x as Pe}from"./index--XTC7grR.js";import{c as ze,d as De,u as $e,a as Be,b as Ee}from"./useWithdrawAllocation-Dnpsc_8O.js";import{C as R}from"./copyable-identifier-DwUkznZR.js";import{A as oe,S as X}from"./Avatar-D-MTnORs.js";function Me(n,r){return ue({...n,enabled:!0,suspense:!0,throwOnError:fe,placeholderData:void 0},ge)}function ae(n){const r=b.useRef({});return b.useEffect(()=>{r.current=n}),r.current}function Fe(n){const{badgeContent:r,invisible:t=!1,max:a=99,showZero:d=!1}=n,h=ae({badgeContent:r,max:a});let p=t;t===!1&&r===0&&!d&&(p=!0);const{badgeContent:l,max:c=a}=p?h:n,x=l&&Number(l)>c?`${c}+`:l;return{badgeContent:l,invisible:p,max:c,displayValue:x}}function Ve(n){return me("MuiBadge",n)}const W=be("MuiBadge",["root","badge","dot","standard","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft","invisible","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","overlapRectangular","overlapCircular","anchorOriginTopLeftCircular","anchorOriginTopLeftRectangular","anchorOriginTopRightCircular","anchorOriginTopRightRectangular","anchorOriginBottomLeftCircular","anchorOriginBottomLeftRectangular","anchorOriginBottomRightCircular","anchorOriginBottomRightRectangular"]),V=10,q=4,qe=n=>{const{color:r,anchorOrigin:t,invisible:a,overlap:d,variant:h,classes:p={}}=n,l={root:["root"],badge:["badge",h,a&&"invisible",`anchorOrigin${j(t.vertical)}${j(t.horizontal)}`,`anchorOrigin${j(t.vertical)}${j(t.horizontal)}${j(d)}`,`overlap${j(d)}`,r!=="default"&&`color${j(r)}`]};return je(l,Ve,p)},Ue=ee("span",{name:"MuiBadge",slot:"Root"})({position:"relative",display:"inline-flex",verticalAlign:"middle",flexShrink:0}),Ne=ee("span",{name:"MuiBadge",slot:"Badge",overridesResolver:(n,r)=>{const{ownerState:t}=n;return[r.badge,r[t.variant],r[`anchorOrigin${j(t.anchorOrigin.vertical)}${j(t.anchorOrigin.horizontal)}${j(t.overlap)}`],t.color!=="default"&&r[`color${j(t.color)}`],t.invisible&&r.invisible]}})(Ce(({theme:n})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignContent:"center",alignItems:"center",position:"absolute",boxSizing:"border-box",fontFamily:n.typography.fontFamily,fontWeight:n.typography.fontWeightMedium,fontSize:n.typography.pxToRem(12),minWidth:V*2,lineHeight:1,padding:"0 6px",height:V*2,borderRadius:V,zIndex:1,transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.enteringScreen}),variants:[...Object.entries(n.palette).filter(Ie(["contrastText"])).map(([r])=>({props:{color:r},style:{backgroundColor:(n.vars||n).palette[r].main,color:(n.vars||n).palette[r].contrastText}})),{props:{variant:"dot"},style:{borderRadius:q,height:q*2,minWidth:q*2,padding:0}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{top:0,right:0,transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{bottom:0,right:0,transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{top:0,left:0,transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{bottom:0,left:0,transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{top:"14%",right:"14%",transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{bottom:"14%",right:"14%",transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{top:"14%",left:"14%",transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{bottom:"14%",left:"14%",transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:{invisible:!0},style:{transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.leavingScreen})}}]})));function Y(n){return{vertical:n?.vertical??"top",horizontal:n?.horizontal??"right"}}const Qe=b.forwardRef(function(r,t){const a=ye({props:r,name:"MuiBadge"}),{anchorOrigin:d,className:h,classes:p,component:l,components:c={},componentsProps:x={},children:u,overlap:f="rectangular",color:m="default",invisible:y=!1,max:v=99,badgeContent:L,slots:w,slotProps:P,showZero:k=!1,variant:C="standard",...B}=a,{badgeContent:z,invisible:E,max:M,displayValue:i}=Fe({max:v,invisible:y,badgeContent:L,showZero:k}),g=ae({anchorOrigin:Y(d),color:m,overlap:f,variant:C,badgeContent:L}),I=E||z==null&&C!=="dot",{color:D=m,overlap:ie=f,anchorOrigin:le,variant:K=C}=I?g:a,ce=Y(le),H=K!=="dot"?i:void 0,F={...a,badgeContent:z,invisible:I,max:M,displayValue:H,showZero:k,anchorOrigin:ce,color:D,overlap:ie,variant:K},_=qe(F),J={slots:{root:w?.root??c.Root,badge:w?.badge??c.Badge},slotProps:{root:P?.root??x.root,badge:P?.badge??x.badge}},[de,xe]=Z("root",{elementType:Ue,externalForwardedProps:{...J,...B},ownerState:F,className:ve(_.root,h),ref:t,additionalProps:{as:l}}),[pe,he]=Z("badge",{elementType:Ne,externalForwardedProps:J,ownerState:F,className:_.badge});return e.jsxs(de,{...xe,children:[u,e.jsx(pe,{...he,children:H})]})}),Ke=()=>{const{exerciseTransfer:n}=Ae(),r=We(),t=Oe();return Re({mutationFn:async a=>n({registryUrls:r,...a}),onSuccess:async(a,d)=>{await t.invalidateQueries({queryKey:Le.listPendingTransfers.forParty(d.party)})}})},N=n=>n.currentPartyId===n.receiver,$=n=>N(n)?{label:"Sender",value:n.sender}:{label:"Receiver",value:n.receiver},Q=(n,r)=>n===r.transferLeg.sender,He=(n,r)=>n===r.transferLeg.receiver,_e=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length===0),Je=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length>0),Ze=n=>{const{item:r,open:t,isLoading:a,onClose:d,onAccept:h,onReject:p,onWithdraw:l}=n,c=()=>{a||d()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Transfer Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{display:"flex",gap:3,p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Amount"}),e.jsxs(o,{variant:"h6",fontWeight:"bold",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Transfer Offer"})})]})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Created"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.date})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Expires"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:$(r).label}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:$(r).value,maxLength:60})})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word",lineHeight:1.6,color:"text.primary"},children:r.message})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Contract ID"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:r.id,maxLength:60})})]})]})}),e.jsxs(se,{sx:{px:3,pb:3,gap:2},children:[e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Cancel"}),e.jsx(s,{sx:{flex:1}}),r&&N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outlined",color:"error",sx:{minWidth:100},disabled:a,onClick:()=>p(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Reject"}),e.jsx(A,{variant:"contained",sx:{minWidth:100},disabled:a,onClick:()=>h(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Accept"})]}):e.jsx(A,{variant:"outlined",color:"warning",sx:{minWidth:100},disabled:a,onClick:()=>r&&l(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Withdraw"})]})]})},Ge=n=>{const{item:r,isLoading:t,onClick:a,onAccept:d,onReject:h,onWithdraw:p}=n;return e.jsxs(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.type})]}),e.jsxs(s,{sx:{minWidth:80,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Amount"}),e.jsxs(o,{variant:"body1",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Expires"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:$(r).label}),e.jsx(R,{value:$(r).value})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word"},children:r.message.slice(0,30)+"..."})]})]}),e.jsx(s,{sx:{display:"flex",gap:2},children:N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"contained",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),d()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Accept"}),e.jsx(A,{variant:"outlined",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),h()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Reject"})]}):e.jsx(A,{variant:"outlined",color:"warning",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),p()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"})})]})},Xe=n=>{const{item:r,isLoading:t,onClick:a}=n,d=_e(r),h=Je(r),p=d.length>0,l=h.length>0,c=()=>p&&l?`${d.length} pending, ${h.length} allocated`:p?`${d.length} transfer leg${d.length>1?"s":""} requires allocation`:`${h.length} allocated`;return e.jsx(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:"Allocation"})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Allocate Before"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Transfer Legs"}),e.jsx(o,{variant:"body1",children:r.transferLegs.length})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Status"}),e.jsx(o,{variant:"body1",sx:{color:p?"warning.main":"success.main"},children:c()})]})]})})},Ye=n=>{const{item:r,open:t,isLoading:a,loadingLegId:d,onClose:h,onCreateAllocation:p,onWithdrawAllocation:l}=n,c=()=>{a||h()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Allocation Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Allocation Request"})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Settlement Reference"}),e.jsx(R,{value:r.settlement.settlementRef.id,maxLength:40})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Allocate Before"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Executor"}),e.jsx(R,{value:r.settlement.executor,maxLength:60})]}),e.jsxs(s,{children:[e.jsxs(o,{variant:"subtitle1",fontWeight:"bold",sx:{mb:2},children:["Transfer Legs (",r.transferLegs.length,")"]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:r.transferLegs.map(x=>e.jsx(er,{leg:x,currentPartyId:r.currentPartyId,isLoading:a,isLegLoading:d===x.transferLegId,onCreateAllocation:()=>p(x),onWithdrawAllocation:u=>l(x,u)},x.transferLegId))})]})]})}),e.jsx(se,{sx:{px:3,pb:3,gap:2},children:e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Close"})})]})},er=({leg:n,currentPartyId:r,isLoading:t,isLegLoading:a,onCreateAllocation:d,onWithdrawAllocation:h})=>{const p=Q(r,n),l=He(r,n),c=n.allocations.length>0,x=()=>p&&l?e.jsx(T,{label:"Self-transfer",size:"small",color:"info"}):p?e.jsx(T,{label:"Sender",size:"small",color:"primary"}):l?e.jsx(T,{label:"Receiver",size:"small",color:"secondary"}):e.jsx(T,{label:"Observer",size:"small"});return e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:c?"success.light":"divider",backgroundColor:c?"success.50":"transparent"},children:[e.jsxs(s,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:2},children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(o,{variant:"body2",fontWeight:"medium",children:["Leg: ",n.transferLegId]}),x(),c&&e.jsx(T,{label:"Allocated",size:"small",color:"success"})]}),p&&e.jsx(s,{sx:{display:"flex",gap:1},children:c?n.allocations.map(u=>e.jsx(A,{variant:"outlined",color:"warning",size:"small",disabled:t,onClick:()=>h(u.contractId),children:a?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"},u.contractId)):e.jsx(A,{variant:"contained",size:"small",disabled:t,onClick:d,children:a?e.jsx(O,{size:16,color:"inherit"}):"Create Allocation"})})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:2},children:[e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Amount"}),e.jsxs(o,{variant:"body2",children:[n.transferLeg.amount," ",n.transferLeg.instrumentId.id]})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Sender"}),e.jsx(R,{value:n.transferLeg.sender,maxLength:20})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Receiver"}),e.jsx(R,{value:n.transferLeg.receiver,maxLength:20})]})]})]})},rr=({items:n})=>{const[r,t]=b.useState(null),[a,d]=b.useState(!1),[h,p]=b.useState(null),[l,c]=b.useState(!1),[x,u]=b.useState(null),f=b.useMemo(()=>{if(!h)return null;const i=n.find(g=>g.kind==="allocation"&&g.id===h);return i||null},[n,h]),[m,y]=b.useState(null),v=Ke(),L=ze(),w=De(),P=i=>{t(i),d(!0)},k=()=>{d(!1),t(null)},C=(i,g)=>{y(i.id),v.mutate({party:i.currentPartyId,contractId:i.id,instrumentId:i.instrumentId,instructionChoice:g},{onSuccess:()=>{S.success(`${g} transfer successful`),k()},onError:I=>S.error(`Failed to ${g.toLowerCase()} transfer: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>y(null)})},B=i=>{p(i.id),c(!0)},z=()=>{c(!1),p(null)},E=(i,g)=>{y(i.id),u(g.transferLegId),L.mutate({party:i.currentPartyId,allocationSpecification:{settlement:i.settlement,transferLegId:g.transferLegId,transferLeg:g.transferLeg}},{onSuccess:()=>{S.success("Allocation created successfully")},onError:I=>S.error(`Failed to create allocation: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})},M=(i,g,I)=>{y(i.id),u(g.transferLegId),w.mutate({party:i.currentPartyId,contractId:I,instrumentId:g.transferLeg.instrumentId},{onSuccess:()=>{S.success("Allocation withdrawn successfully")},onError:D=>S.error(`Failed to withdraw allocation: ${D instanceof Error?D.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})};return n.length===0?null:e.jsxs(s,{sx:{mb:6},children:[e.jsxs(s,{sx:{display:"flex",mb:2},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase"},fontWeight:"bold",children:"Action Required"}),e.jsx(Qe,{badgeContent:n.length,color:"error",sx:{ml:2}})]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:n.map(i=>{const g=m===i.id;switch(i.kind){case"allocation":return e.jsx(Xe,{item:i,isLoading:g,onClick:()=>B(i)},i.id);case"transfer":return e.jsx(Ge,{item:i,isLoading:g,onClick:()=>P(i),onAccept:()=>C(i,"Accept"),onReject:()=>C(i,"Reject"),onWithdraw:()=>C(i,"Withdraw")},i.id)}})}),e.jsx(Ze,{item:r,open:a,isLoading:m!==null,onClose:k,onAccept:i=>C(i,"Accept"),onReject:i=>C(i,"Reject"),onWithdraw:i=>C(i,"Withdraw")}),e.jsx(Ye,{item:f,open:l,isLoading:m!==null,loadingLegId:x,onClose:z,onCreateAllocation:i=>f&&E(f,i),onWithdrawAllocation:(i,g)=>f&&M(f,i,g)})]})},nr=({partyId:n,walletName:r,isPrimary:t})=>{const{instruments:a,isLoading:d}=Se(n),h=a.length>0,p=e.jsxs(s,{sx:{p:1,display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center"},children:[e.jsx(oe,{sx:{visibility:"hidden",m:1,height:25,width:25}}),e.jsx(o,{sx:{position:"absolute"},children:"There are currently no assets in this wallet"})]}),l=e.jsxs(s,{sx:{p:1},children:[e.jsx(X,{variant:"rectangular",height:40}),e.jsx(X,{variant:"rectangular",height:40,sx:{mt:1}})]}),c=a.map(x=>e.jsx(tr,{item:x},`${x.instrumentId.admin}::${x.instrumentId.id}`));return e.jsx(Te,{to:"/wallet/$walletId",params:{walletId:n},style:{textDecoration:"none",color:"inherit"},children:e.jsxs(s,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(s,{sx:{mb:1,display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[e.jsx(o,{sx:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"200px"},fontWeight:"bold",color:"secondary",children:r}),t&&e.jsx(T,{label:"Primary",size:"small",color:"primary"})]}),e.jsx(s,{component:U,variant:"outlined",sx:{background:x=>x.palette.mode==="dark"?void 0:x.palette.grey[100],display:"flex",flexDirection:"column",cursor:"pointer",transition:"all 0.2s ease-in-out","&:hover":{borderColor:"primary.main",boxShadow:1}},children:d?l:h?c:p})]})})},tr=({item:n})=>{const r=n.instrument?.symbol??n.instrumentId.id,t=n.instrument?.name??n.instrumentId.id,a=n.lockedAmount!=="0";return e.jsxs(s,{borderRadius:0,sx:{"&:not(:first-of-type)":{borderTop:d=>`1px solid ${d.palette.divider}`},p:1,display:"flex",alignItems:"center"},children:[e.jsx(oe,{sx:{m:1,height:25,width:25},children:r[0]}),e.jsxs(s,{children:[e.jsx(o,{sx:{maxWidth:"100px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},color:"textSecondary",variant:"body2",children:t}),e.jsxs(o,{variant:"body2",fontWeight:"700",children:[n.totalAmount," ",r,a&&e.jsxs(o,{component:"span",variant:"body2",color:"textSecondary",sx:{ml:.5},children:["(",n.availableAmount," available)"]})]})]})]})},sr=()=>{const n=ke().slice().sort((r,t)=>Number(r.primary)-Number(t.primary));return e.jsxs(s,{sx:{mt:1},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase",mb:2},fontWeight:"bold",children:"Wallets"}),e.jsx(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:n.map(r=>e.jsx(nr,{partyId:r.partyId,walletName:r.hint,isPrimary:r.primary},r.partyId))})]})};function cr(){const n=we()?.partyId,r=Me($e(n)),{data:t}=G(Be(n)),{data:a}=G(Ee(n)),d=b.useCallback((l,c)=>JSON.stringify([l.settlementRef.id,l.settlementRef.cid,c]),[]),h=b.useMemo(()=>{const l=new Map;for(const c of t??[]){const{settlement:x,transferLegs:u}=c.interfaceViewValue;for(const f in u){const m=d(x,f);l.set(m,[])}}for(const c of a??[]){const{settlement:x,transferLegId:u}=c.interfaceViewValue.allocation,f=d(x,u);l.has(f)&&l.get(f).push(c)}return l},[t,a,d]),p=b.useMemo(()=>{if(!n)return[];const l=[];if(r.data)for(const c of r.data){const x=c.interfaceViewValue,u=x.transfer,f=x.status,m="tag"in f?f.tag:f.current?.tag,y=u?.meta?.values?.[Pe.MEMO_KEY]??"",v={kind:"transfer",id:c.contractId,currentPartyId:n,tag:m,type:m?.startsWith("Transfer")?"Transfer":m,date:u.requestedAt,expiry:u.executeBefore,message:y,sender:u.sender,receiver:u.receiver,instrumentId:u.instrumentId,amount:u?.amount};l.push(v)}if(t)for(const c of t){const{settlement:x,transferLegs:u}=c.interfaceViewValue,m=Object.entries(u).map(([v,L])=>({transferLegId:v,transferLeg:L,allocations:h.get(d(x,v))??[]})).filter(v=>v.transferLeg.sender===n||v.transferLeg.receiver===n);if(m.length===0)continue;const y={kind:"allocation",id:c.contractId,currentPartyId:n,expiry:x.allocateBefore,settlement:x,transferLegs:m};l.push(y)}return l},[r.data,t,h,n,d]);return e.jsxs(s,{sx:{my:8},children:[e.jsx(o,{variant:"h3",component:"h1",sx:{mb:6},children:"Dashboard"}),e.jsx(rr,{items:p}),e.jsx(sr,{})]})}export{cr as component};
1
+ import{A as ue,Q as ge,C as fe,r as b,g as me,a as be,u as ye,E as Z,c as ve,j as e,F as j,b as je,s as ee,G as Ce,H as Ie,w as Ae,f as We,J as Oe,K as Re,L as Le,M as re,N as ne,T as o,O as te,B as s,R as se,k as A,S as O,P as U,U as T,t as S,V as Se,W as Te,X as ke,v as we,y as G,x as Pe}from"./index-ChW8dX2O.js";import{c as ze,d as De,u as $e,a as Be,b as Ee}from"./useWithdrawAllocation-C7EYo8-G.js";import{C as R}from"./copyable-identifier-C5eRo0sY.js";import{A as oe,S as X}from"./Avatar-BdBBdhFr.js";function Me(n,r){return ue({...n,enabled:!0,suspense:!0,throwOnError:fe,placeholderData:void 0},ge)}function ae(n){const r=b.useRef({});return b.useEffect(()=>{r.current=n}),r.current}function Fe(n){const{badgeContent:r,invisible:t=!1,max:a=99,showZero:d=!1}=n,h=ae({badgeContent:r,max:a});let p=t;t===!1&&r===0&&!d&&(p=!0);const{badgeContent:l,max:c=a}=p?h:n,x=l&&Number(l)>c?`${c}+`:l;return{badgeContent:l,invisible:p,max:c,displayValue:x}}function Ve(n){return me("MuiBadge",n)}const W=be("MuiBadge",["root","badge","dot","standard","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft","invisible","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","overlapRectangular","overlapCircular","anchorOriginTopLeftCircular","anchorOriginTopLeftRectangular","anchorOriginTopRightCircular","anchorOriginTopRightRectangular","anchorOriginBottomLeftCircular","anchorOriginBottomLeftRectangular","anchorOriginBottomRightCircular","anchorOriginBottomRightRectangular"]),V=10,q=4,qe=n=>{const{color:r,anchorOrigin:t,invisible:a,overlap:d,variant:h,classes:p={}}=n,l={root:["root"],badge:["badge",h,a&&"invisible",`anchorOrigin${j(t.vertical)}${j(t.horizontal)}`,`anchorOrigin${j(t.vertical)}${j(t.horizontal)}${j(d)}`,`overlap${j(d)}`,r!=="default"&&`color${j(r)}`]};return je(l,Ve,p)},Ue=ee("span",{name:"MuiBadge",slot:"Root"})({position:"relative",display:"inline-flex",verticalAlign:"middle",flexShrink:0}),Ne=ee("span",{name:"MuiBadge",slot:"Badge",overridesResolver:(n,r)=>{const{ownerState:t}=n;return[r.badge,r[t.variant],r[`anchorOrigin${j(t.anchorOrigin.vertical)}${j(t.anchorOrigin.horizontal)}${j(t.overlap)}`],t.color!=="default"&&r[`color${j(t.color)}`],t.invisible&&r.invisible]}})(Ce(({theme:n})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignContent:"center",alignItems:"center",position:"absolute",boxSizing:"border-box",fontFamily:n.typography.fontFamily,fontWeight:n.typography.fontWeightMedium,fontSize:n.typography.pxToRem(12),minWidth:V*2,lineHeight:1,padding:"0 6px",height:V*2,borderRadius:V,zIndex:1,transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.enteringScreen}),variants:[...Object.entries(n.palette).filter(Ie(["contrastText"])).map(([r])=>({props:{color:r},style:{backgroundColor:(n.vars||n).palette[r].main,color:(n.vars||n).palette[r].contrastText}})),{props:{variant:"dot"},style:{borderRadius:q,height:q*2,minWidth:q*2,padding:0}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{top:0,right:0,transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{bottom:0,right:0,transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{top:0,left:0,transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{bottom:0,left:0,transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{top:"14%",right:"14%",transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{bottom:"14%",right:"14%",transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{top:"14%",left:"14%",transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{bottom:"14%",left:"14%",transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:{invisible:!0},style:{transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.leavingScreen})}}]})));function Y(n){return{vertical:n?.vertical??"top",horizontal:n?.horizontal??"right"}}const Qe=b.forwardRef(function(r,t){const a=ye({props:r,name:"MuiBadge"}),{anchorOrigin:d,className:h,classes:p,component:l,components:c={},componentsProps:x={},children:u,overlap:f="rectangular",color:m="default",invisible:y=!1,max:v=99,badgeContent:L,slots:w,slotProps:P,showZero:k=!1,variant:C="standard",...B}=a,{badgeContent:z,invisible:E,max:M,displayValue:i}=Fe({max:v,invisible:y,badgeContent:L,showZero:k}),g=ae({anchorOrigin:Y(d),color:m,overlap:f,variant:C,badgeContent:L}),I=E||z==null&&C!=="dot",{color:D=m,overlap:ie=f,anchorOrigin:le,variant:K=C}=I?g:a,ce=Y(le),H=K!=="dot"?i:void 0,F={...a,badgeContent:z,invisible:I,max:M,displayValue:H,showZero:k,anchorOrigin:ce,color:D,overlap:ie,variant:K},_=qe(F),J={slots:{root:w?.root??c.Root,badge:w?.badge??c.Badge},slotProps:{root:P?.root??x.root,badge:P?.badge??x.badge}},[de,xe]=Z("root",{elementType:Ue,externalForwardedProps:{...J,...B},ownerState:F,className:ve(_.root,h),ref:t,additionalProps:{as:l}}),[pe,he]=Z("badge",{elementType:Ne,externalForwardedProps:J,ownerState:F,className:_.badge});return e.jsxs(de,{...xe,children:[u,e.jsx(pe,{...he,children:H})]})}),Ke=()=>{const{exerciseTransfer:n}=Ae(),r=We(),t=Oe();return Re({mutationFn:async a=>n({registryUrls:r,...a}),onSuccess:async(a,d)=>{await t.invalidateQueries({queryKey:Le.listPendingTransfers.forParty(d.party)})}})},N=n=>n.currentPartyId===n.receiver,$=n=>N(n)?{label:"Sender",value:n.sender}:{label:"Receiver",value:n.receiver},Q=(n,r)=>n===r.transferLeg.sender,He=(n,r)=>n===r.transferLeg.receiver,_e=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length===0),Je=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length>0),Ze=n=>{const{item:r,open:t,isLoading:a,onClose:d,onAccept:h,onReject:p,onWithdraw:l}=n,c=()=>{a||d()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Transfer Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{display:"flex",gap:3,p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Amount"}),e.jsxs(o,{variant:"h6",fontWeight:"bold",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Transfer Offer"})})]})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Created"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.date})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Expires"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:$(r).label}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:$(r).value,maxLength:60})})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word",lineHeight:1.6,color:"text.primary"},children:r.message})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Contract ID"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:r.id,maxLength:60})})]})]})}),e.jsxs(se,{sx:{px:3,pb:3,gap:2},children:[e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Cancel"}),e.jsx(s,{sx:{flex:1}}),r&&N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outlined",color:"error",sx:{minWidth:100},disabled:a,onClick:()=>p(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Reject"}),e.jsx(A,{variant:"contained",sx:{minWidth:100},disabled:a,onClick:()=>h(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Accept"})]}):e.jsx(A,{variant:"outlined",color:"warning",sx:{minWidth:100},disabled:a,onClick:()=>r&&l(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Withdraw"})]})]})},Ge=n=>{const{item:r,isLoading:t,onClick:a,onAccept:d,onReject:h,onWithdraw:p}=n;return e.jsxs(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.type})]}),e.jsxs(s,{sx:{minWidth:80,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Amount"}),e.jsxs(o,{variant:"body1",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Expires"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:$(r).label}),e.jsx(R,{value:$(r).value})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word"},children:r.message.slice(0,30)+"..."})]})]}),e.jsx(s,{sx:{display:"flex",gap:2},children:N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"contained",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),d()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Accept"}),e.jsx(A,{variant:"outlined",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),h()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Reject"})]}):e.jsx(A,{variant:"outlined",color:"warning",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),p()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"})})]})},Xe=n=>{const{item:r,isLoading:t,onClick:a}=n,d=_e(r),h=Je(r),p=d.length>0,l=h.length>0,c=()=>p&&l?`${d.length} pending, ${h.length} allocated`:p?`${d.length} transfer leg${d.length>1?"s":""} requires allocation`:`${h.length} allocated`;return e.jsx(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:"Allocation"})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Allocate Before"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Transfer Legs"}),e.jsx(o,{variant:"body1",children:r.transferLegs.length})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Status"}),e.jsx(o,{variant:"body1",sx:{color:p?"warning.main":"success.main"},children:c()})]})]})})},Ye=n=>{const{item:r,open:t,isLoading:a,loadingLegId:d,onClose:h,onCreateAllocation:p,onWithdrawAllocation:l}=n,c=()=>{a||h()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Allocation Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Allocation Request"})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Settlement Reference"}),e.jsx(R,{value:r.settlement.settlementRef.id,maxLength:40})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Allocate Before"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Executor"}),e.jsx(R,{value:r.settlement.executor,maxLength:60})]}),e.jsxs(s,{children:[e.jsxs(o,{variant:"subtitle1",fontWeight:"bold",sx:{mb:2},children:["Transfer Legs (",r.transferLegs.length,")"]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:r.transferLegs.map(x=>e.jsx(er,{leg:x,currentPartyId:r.currentPartyId,isLoading:a,isLegLoading:d===x.transferLegId,onCreateAllocation:()=>p(x),onWithdrawAllocation:u=>l(x,u)},x.transferLegId))})]})]})}),e.jsx(se,{sx:{px:3,pb:3,gap:2},children:e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Close"})})]})},er=({leg:n,currentPartyId:r,isLoading:t,isLegLoading:a,onCreateAllocation:d,onWithdrawAllocation:h})=>{const p=Q(r,n),l=He(r,n),c=n.allocations.length>0,x=()=>p&&l?e.jsx(T,{label:"Self-transfer",size:"small",color:"info"}):p?e.jsx(T,{label:"Sender",size:"small",color:"primary"}):l?e.jsx(T,{label:"Receiver",size:"small",color:"secondary"}):e.jsx(T,{label:"Observer",size:"small"});return e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:c?"success.light":"divider",backgroundColor:c?"success.50":"transparent"},children:[e.jsxs(s,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:2},children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(o,{variant:"body2",fontWeight:"medium",children:["Leg: ",n.transferLegId]}),x(),c&&e.jsx(T,{label:"Allocated",size:"small",color:"success"})]}),p&&e.jsx(s,{sx:{display:"flex",gap:1},children:c?n.allocations.map(u=>e.jsx(A,{variant:"outlined",color:"warning",size:"small",disabled:t,onClick:()=>h(u.contractId),children:a?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"},u.contractId)):e.jsx(A,{variant:"contained",size:"small",disabled:t,onClick:d,children:a?e.jsx(O,{size:16,color:"inherit"}):"Create Allocation"})})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:2},children:[e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Amount"}),e.jsxs(o,{variant:"body2",children:[n.transferLeg.amount," ",n.transferLeg.instrumentId.id]})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Sender"}),e.jsx(R,{value:n.transferLeg.sender,maxLength:20})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Receiver"}),e.jsx(R,{value:n.transferLeg.receiver,maxLength:20})]})]})]})},rr=({items:n})=>{const[r,t]=b.useState(null),[a,d]=b.useState(!1),[h,p]=b.useState(null),[l,c]=b.useState(!1),[x,u]=b.useState(null),f=b.useMemo(()=>{if(!h)return null;const i=n.find(g=>g.kind==="allocation"&&g.id===h);return i||null},[n,h]),[m,y]=b.useState(null),v=Ke(),L=ze(),w=De(),P=i=>{t(i),d(!0)},k=()=>{d(!1),t(null)},C=(i,g)=>{y(i.id),v.mutate({party:i.currentPartyId,contractId:i.id,instrumentId:i.instrumentId,instructionChoice:g},{onSuccess:()=>{S.success(`${g} transfer successful`),k()},onError:I=>S.error(`Failed to ${g.toLowerCase()} transfer: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>y(null)})},B=i=>{p(i.id),c(!0)},z=()=>{c(!1),p(null)},E=(i,g)=>{y(i.id),u(g.transferLegId),L.mutate({party:i.currentPartyId,allocationSpecification:{settlement:i.settlement,transferLegId:g.transferLegId,transferLeg:g.transferLeg}},{onSuccess:()=>{S.success("Allocation created successfully")},onError:I=>S.error(`Failed to create allocation: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})},M=(i,g,I)=>{y(i.id),u(g.transferLegId),w.mutate({party:i.currentPartyId,contractId:I,instrumentId:g.transferLeg.instrumentId},{onSuccess:()=>{S.success("Allocation withdrawn successfully")},onError:D=>S.error(`Failed to withdraw allocation: ${D instanceof Error?D.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})};return n.length===0?null:e.jsxs(s,{sx:{mb:6},children:[e.jsxs(s,{sx:{display:"flex",mb:2},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase"},fontWeight:"bold",children:"Action Required"}),e.jsx(Qe,{badgeContent:n.length,color:"error",sx:{ml:2}})]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:n.map(i=>{const g=m===i.id;switch(i.kind){case"allocation":return e.jsx(Xe,{item:i,isLoading:g,onClick:()=>B(i)},i.id);case"transfer":return e.jsx(Ge,{item:i,isLoading:g,onClick:()=>P(i),onAccept:()=>C(i,"Accept"),onReject:()=>C(i,"Reject"),onWithdraw:()=>C(i,"Withdraw")},i.id)}})}),e.jsx(Ze,{item:r,open:a,isLoading:m!==null,onClose:k,onAccept:i=>C(i,"Accept"),onReject:i=>C(i,"Reject"),onWithdraw:i=>C(i,"Withdraw")}),e.jsx(Ye,{item:f,open:l,isLoading:m!==null,loadingLegId:x,onClose:z,onCreateAllocation:i=>f&&E(f,i),onWithdrawAllocation:(i,g)=>f&&M(f,i,g)})]})},nr=({partyId:n,walletName:r,isPrimary:t})=>{const{instruments:a,isLoading:d}=Se(n),h=a.length>0,p=e.jsxs(s,{sx:{p:1,display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center"},children:[e.jsx(oe,{sx:{visibility:"hidden",m:1,height:25,width:25}}),e.jsx(o,{sx:{position:"absolute"},children:"There are currently no assets in this wallet"})]}),l=e.jsxs(s,{sx:{p:1},children:[e.jsx(X,{variant:"rectangular",height:40}),e.jsx(X,{variant:"rectangular",height:40,sx:{mt:1}})]}),c=a.map(x=>e.jsx(tr,{item:x},`${x.instrumentId.admin}::${x.instrumentId.id}`));return e.jsx(Te,{to:"/wallet/$walletId",params:{walletId:n},style:{textDecoration:"none",color:"inherit"},children:e.jsxs(s,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(s,{sx:{mb:1,display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[e.jsx(o,{sx:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"200px"},fontWeight:"bold",color:"secondary",children:r}),t&&e.jsx(T,{label:"Primary",size:"small",color:"primary"})]}),e.jsx(s,{component:U,variant:"outlined",sx:{background:x=>x.palette.mode==="dark"?void 0:x.palette.grey[100],display:"flex",flexDirection:"column",cursor:"pointer",transition:"all 0.2s ease-in-out","&:hover":{borderColor:"primary.main",boxShadow:1}},children:d?l:h?c:p})]})})},tr=({item:n})=>{const r=n.instrument?.symbol??n.instrumentId.id,t=n.instrument?.name??n.instrumentId.id,a=n.lockedAmount!=="0";return e.jsxs(s,{borderRadius:0,sx:{"&:not(:first-of-type)":{borderTop:d=>`1px solid ${d.palette.divider}`},p:1,display:"flex",alignItems:"center"},children:[e.jsx(oe,{sx:{m:1,height:25,width:25},children:r[0]}),e.jsxs(s,{children:[e.jsx(o,{sx:{maxWidth:"100px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},color:"textSecondary",variant:"body2",children:t}),e.jsxs(o,{variant:"body2",fontWeight:"700",children:[n.totalAmount," ",r,a&&e.jsxs(o,{component:"span",variant:"body2",color:"textSecondary",sx:{ml:.5},children:["(",n.availableAmount," available)"]})]})]})]})},sr=()=>{const n=ke().slice().sort((r,t)=>Number(r.primary)-Number(t.primary));return e.jsxs(s,{sx:{mt:1},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase",mb:2},fontWeight:"bold",children:"Wallets"}),e.jsx(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:n.map(r=>e.jsx(nr,{partyId:r.partyId,walletName:r.hint,isPrimary:r.primary},r.partyId))})]})};function cr(){const n=we()?.partyId,r=Me($e(n)),{data:t}=G(Be(n)),{data:a}=G(Ee(n)),d=b.useCallback((l,c)=>JSON.stringify([l.settlementRef.id,l.settlementRef.cid,c]),[]),h=b.useMemo(()=>{const l=new Map;for(const c of t??[]){const{settlement:x,transferLegs:u}=c.interfaceViewValue;for(const f in u){const m=d(x,f);l.set(m,[])}}for(const c of a??[]){const{settlement:x,transferLegId:u}=c.interfaceViewValue.allocation,f=d(x,u);l.has(f)&&l.get(f).push(c)}return l},[t,a,d]),p=b.useMemo(()=>{if(!n)return[];const l=[];if(r.data)for(const c of r.data){const x=c.interfaceViewValue,u=x.transfer,f=x.status,m="tag"in f?f.tag:f.current?.tag,y=u?.meta?.values?.[Pe.MEMO_KEY]??"",v={kind:"transfer",id:c.contractId,currentPartyId:n,tag:m,type:m?.startsWith("Transfer")?"Transfer":m,date:u.requestedAt,expiry:u.executeBefore,message:y,sender:u.sender,receiver:u.receiver,instrumentId:u.instrumentId,amount:u?.amount};l.push(v)}if(t)for(const c of t){const{settlement:x,transferLegs:u}=c.interfaceViewValue,m=Object.entries(u).map(([v,L])=>({transferLegId:v,transferLeg:L,allocations:h.get(d(x,v))??[]})).filter(v=>v.transferLeg.sender===n||v.transferLeg.receiver===n);if(m.length===0)continue;const y={kind:"allocation",id:c.contractId,currentPartyId:n,expiry:x.allocateBefore,settlement:x,transferLegs:m};l.push(y)}return l},[r.data,t,h,n,d]);return e.jsxs(s,{sx:{my:8},children:[e.jsx(o,{variant:"h3",component:"h1",sx:{mb:6},children:"Dashboard"}),e.jsx(rr,{items:p}),e.jsx(sr,{})]})}export{cr as component};