import e from"react";import{LayoutVariant as o}from"@redocly/config";import{usePageSharedData as a}from"../../providers/page-data/hooks";function S(){const{document:i}=a("AsyncApiDefinition")||{},{definition:c,options:t={}}=a("openAPIDocsStore")||{},l=a("graphQlSettings")??"",r=c&&t||i||l.length>0,[n,s]=e.useState(t.layout||o.THREE_PANEL),[f,p]=e.useState(!1),[u,y]=e.useState(!1);e.useEffect(()=>{u||s(t.layout||o.THREE_PANEL)},[t.layout,u]);function h(){s(n===o.STACKED?o.THREE_PANEL:o.STACKED),y(!0)}function C(){p(E=>!E)}return{onChangeViewClick:h,onChangeCollapseSidebarClick:C,showChangeLayoutButton:t.showChangeLayoutButton||!0,layout:n,collapsedSidebar:f,isApiDocs:r}}export{S as useActions};
