import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useMemo}from"react";import styled from"styled-components";import{Button,MaximizeIcon}from"@redocly/theme";import{useAtom}from"jotai/index";import{operationStore}from"../../jotai/operation";export const ExpandAllButton=({operationPointer:t,type:e})=>{const[o,n]=useAtom(operationStore(t)),s=useMemo((()=>Object.values(o[e].expandedFields).includes(!1)),[o,e]);if(!Object.keys(o[e].expandedFields).length)return null;return _jsxs(StyledButton,{icon:_jsx(MaximizeIcon,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:()=>{n((t=>{const o={};for(const n in t[e].expandedFields)o[n]=s;return Object.assign(Object.assign({},t),{[e]:{expandedFields:o}})}))},children:[s?"Expand":"Collapse"," all"]})};const StyledButton=styled(Button)`
  margin-left: auto;
`;
//# sourceMappingURL=ExpandAllButton.js.map