import{_ as e,r as t,j as o,h as r}from"./react-B_SyE9nW.js";import{ac as n,ad as s,ae as a,af as i,ag as c,ah as l,ai as u,aj as m,ak as p,al as d,i as f,am as h,e as y,g as v,an as S,s as w,c as g}from"./index-CGGskqVP.js";import{_ as k}from"./history-CBi_mSPs.js";const b=["ownerState"],j=["variants"],x=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function R(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const A=a(),_=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function T({defaultTheme:e,theme:t,themeId:o}){return r=t,0===Object.keys(r).length?e:t[o]||t;var r}function C(e){return e?(t,o)=>o[e]:null}function F(t,o){let{ownerState:r}=o,n=e(o,b);const s="function"==typeof t?t(k({ownerState:r},n)):t;if(Array.isArray(s))return s.flatMap((e=>F(e,k({ownerState:r},n))));if(s&&"object"==typeof s&&Array.isArray(s.variants)){const{variants:t=[]}=s;let o=e(s,j);return t.forEach((e=>{let t=!0;"function"==typeof e.props?t=e.props(k({ownerState:r},n,r)):Object.keys(e.props).forEach((o=>{(null==r?void 0:r[o])!==e.props[o]&&n[o]!==e.props[o]&&(t=!1)})),t&&(Array.isArray(o)||(o=[o]),o.push("function"==typeof e.style?e.style(k({ownerState:r},n,r)):e.style))})),o}return s}const N=function(t={}){const{themeId:o,defaultTheme:r=A,rootShouldForwardProp:a=R,slotShouldForwardProp:l=R}=t,u=e=>i(k({},e,{theme:T(k({},e,{defaultTheme:r,themeId:o}))}));return u.__mui_systemSx=!0,(t,i={})=>{n(t,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:m,slot:p,skipVariantsResolver:d,skipSx:f,overridesResolver:h=C(_(p))}=i,y=e(i,x),v=void 0!==d?d:p&&"Root"!==p&&"root"!==p||!1,S=f||!1;let w=R;"Root"===p||"root"===p?w=a:p?w=l:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(t)&&(w=void 0);const g=s(t,k({shouldForwardProp:w,label:undefined},y)),b=e=>"function"==typeof e&&e.__emotion_real!==e||c(e)?t=>F(e,k({},t,{theme:T({theme:t.theme,defaultTheme:r,themeId:o})})):e,j=(e,...n)=>{let s=b(e);const a=n?n.map(b):[];m&&h&&a.push((e=>{const t=T(k({},e,{defaultTheme:r,themeId:o}));if(!t.components||!t.components[m]||!t.components[m].styleOverrides)return null;const n=t.components[m].styleOverrides,s={};return Object.entries(n).forEach((([o,r])=>{s[o]=F(r,k({},e,{theme:t}))})),h(e,s)})),m&&!v&&a.push((e=>{var t;const n=T(k({},e,{defaultTheme:r,themeId:o}));return F({variants:null==n||null==(t=n.components)||null==(t=t[m])?void 0:t.variants},k({},e,{theme:n}))})),S||a.push(u);const i=a.length-n.length;if(Array.isArray(e)&&i>0){const t=new Array(i).fill("");s=[...e,...t],s.raw=[...e.raw,...t]}const c=g(s,...a);return t.muiName&&(c.muiName=t.muiName),c};return g.withConfig&&(j.withConfig=g.withConfig),j}}();function O({controlled:e,default:o,name:r,state:n="value"}){const{current:s}=t.useRef(void 0!==e),[a,i]=t.useState(o);return[s?e:a,t.useCallback((e=>{s||i(e)}),[])]}const I=["component","direction","spacing","divider","children","className","useFlexGap"],M=a(),E=N("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root});function P(e){return h({props:e,name:"MuiStack",defaultTheme:M})}function G(e,o){const r=t.Children.toArray(e).filter(Boolean);return r.reduce(((e,n,s)=>(e.push(n),s<r.length-1&&e.push(t.cloneElement(o,{key:`separator-${s}`})),e)),[])}const B=({ownerState:e,theme:t})=>{let o=k({display:"flex",flexDirection:"column"},l({theme:t},u({values:e.direction,breakpoints:t.breakpoints.values}),(e=>({flexDirection:e}))));if(e.spacing){const r=m(t),n=Object.keys(t.breakpoints.values).reduce(((t,o)=>(("object"==typeof e.spacing&&null!=e.spacing[o]||"object"==typeof e.direction&&null!=e.direction[o])&&(t[o]=!0),t)),{}),s=u({values:e.direction,base:n}),a=u({values:e.spacing,base:n});"object"==typeof s&&Object.keys(s).forEach(((e,t,o)=>{if(!s[e]){const r=t>0?s[o[t-1]]:"column";s[e]=r}}));o=p(o,l({theme:t},a,((t,o)=>{return e.useFlexGap?{gap:S(r,t)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${n=o?s[o]:e.direction,{row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"}[n]}`]:S(r,t)}};var n})))}return o=d(t.breakpoints,o),o};const D=function(n={}){const{createStyledComponent:s=E,useThemeProps:a=P,componentName:i="MuiStack"}=n,c=s(B);return t.forwardRef((function(t,n){const s=a(t),l=f(s),{component:u="div",direction:m="column",spacing:p=0,divider:d,children:h,className:S,useFlexGap:w=!1}=l,g=e(l,I),b={direction:m,spacing:p,useFlexGap:w},j=y({root:["root"]},(e=>v(i,e)),{});return o.jsx(c,k({as:u,ownerState:b,ref:n,className:r(j.root,S)},g,{children:d?G(h,d):h}))}))}({createStyledComponent:w("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root}),useThemeProps:e=>g({props:e,name:"MuiStack"})});export{D as S,R as s,O as u};