import{X as n,j as e,S as s,o as b,aO as w}from"./vendor-mui-CBBEb17G.js";import{a as d}from"./vendor-react-BBazpZul.js";import{e as y,dR as k,ax as S,ao as m,c as a,c$ as I,dr as C}from"./index-DdWwwZXu.js";import"./vendor-utils-BveVE6Uf.js";const D=({children:o,loading:c,onSearch:r})=>{var l;const[h,i]=d.useState(!1),{userType:u}=y(j=>j.user),x=k(),p=n(x.breakpoints.up("md")),f=n("(max-width:1366px)"),g=n("(max-height:768px)"),t=d.useRef(null);return S("Enter",()=>r()),(l=t==null?void 0:t.current)==null||l.clientWidth,e.jsx(e.Fragment,{children:p?e.jsxs(s,{ref:t,spacing:1,className:a("relative h-full p-3 !overflow-y-auto !overflow-x-hidden border-l bg-slate-50",f&&g&&"!mb-[120px]"),children:[o,e.jsx(s,{className:a("items-center justify-center !sticky !-bottom-3 !z-10 bg-slate-50"),children:e.jsx(m,{fullWidth:!0,onClick:r,loading:c,className:a(+u===I.accountant&&"!bg-[#40849d]"),children:"جستجو"})})]}):e.jsxs(e.Fragment,{children:[e.jsx(s,{width:"100%",alignItems:"center",justifyContent:"center",paddingLeft:1.5,children:e.jsx(b,{onClick:()=>i(!0),sx:{zIndex:999,borderRight:"2px solid blue",background:"#4ebcf5",borderRadius:"0 50% 50% 0","&:hover":{background:"#4ebcf5"}},children:e.jsx(C,{fontSize:"large",color:"primary"})})}),e.jsx(w,{anchor:"right",open:h,onClose:()=>i(!1),children:e.jsx(s,{width:"270px",direction:"row",alignItems:"center",children:e.jsxs(s,{padding:1.5,className:"!space-y-3",children:[o,e.jsx(s,{alignItems:"center",children:e.jsx(m,{style:{width:"50%"},onClick:r,loading:c,children:"جستجو"})})]})})})]})})};export{D as S};
