"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("@argent/x-shared"),o=require("@chakra-ui/react"),j=require("react"),m=require("react-i18next"),x=require("starknet"),C=require("../CopyTooltip.cjs"),i=require("../typography.generated.cjs"),f=({transactions:r,type:g="INVOKE_FUNCTION"})=>{const{t:d}=m.useTranslation(),{colorMode:s}=o.useColorMode(),t=j.useMemo(()=>s==="dark",[s]);return e.jsxs(o.Box,{borderRadius:"xl",w:"100%",children:[e.jsx(o.Box,{backgroundColor:t?"neutrals.700":"gray.50",px:"3",py:"2.5",borderTopRadius:"xl",children:e.jsx(i.P3,{fontWeight:"bold",color:t?"neutrals.100":"black",children:d("transactionActions.actions")})}),e.jsx(o.Accordion,{allowToggle:!0,backgroundColor:t?"neutrals.300":"white",borderBottomRadius:"xl",children:r==null?void 0:r.map((l,c)=>{var u;return e.jsx(o.AccordionItem,{border:"none",isDisabled:!l.calldata||((u=l.calldata)==null?void 0:u.length)===0,children:({isDisabled:b,isExpanded:y})=>{var h;return e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:e.jsxs(o.AccordionButton,{display:"flex",color:"text-primary",width:"100%",justifyContent:"space-between",outline:"none",px:"3",pb:c!==r.length-1?"3":"3.5",_expanded:{backgroundColor:t?"neutrals.700":"gray.50",pb:"3.5"},disabled:!l.calldata||((h=l.calldata)==null?void 0:h.length)===0,_disabled:{cursor:"auto",opacity:1},_hover:{backgroundColor:b?"":t?"neutrals.700":"gray.50",borderBottomRadius:c===r.length-1&&!y?"xl":"0"},children:[e.jsx(i.P3,{fontWeight:"bold",children:g==="DEPLOY_ACCOUNT"&&r.length===1?d("transactionActions.activateAccount"):a.entryPointToHumanReadable(l.entrypoint)}),e.jsx(i.P3,{fontWeight:"bold",children:a.formatTruncatedAddress(l.contractAddress)})]})}),e.jsxs(o.AccordionPanel,{backgroundColor:t?"neutrals.700":"gray.50",borderBottomRadius:c===r.length-1?"xl":"0",px:"3",pb:"0",children:[e.jsx(o.Divider,{color:"black",opacity:"1"}),e.jsx(o.Flex,{flexDirection:"column",gap:"12px",py:"3.5",children:x.CallData.toCalldata(l.calldata).map((n,p)=>e.jsxs(o.Flex,{justifyContent:"space-between",gap:"2",children:[e.jsxs(i.P3,{fontWeight:"bold",color:"text-primary",children:[d("transactionActions.calldata"),p+1]}),e.jsx(C.CopyTooltip,{copyValue:n,prompt:n,children:e.jsx(o.Box,{_hover:{backgroundColor:t?"neutrals.700":"gray.50",color:"text-primary",cursor:"pointer"},color:"text-primary",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",minWidth:"0",children:e.jsx(i.P3,{fontWeight:"bold",maxWidth:"70%",children:x.num.isHex(n)?a.formatTruncatedAddress(n):n})})})]},p))})]})]})}},c)})})]})};exports.TransactionActions=f;
