import{dh as F,di as H,dj as I,r as G,dk as J,dl as Q,j as V,v as X,w as Y,m as Z,f as v,df as ee}from"./index-e972fa8e.js";import{i as ne}from"./isMuiElement-fab695f8.js";const te=(e,n)=>e.filter(r=>n.includes(r)),S=(e,n,r)=>{const o=e.keys[0];Array.isArray(n)?n.forEach((s,t)=>{r((i,p)=>{t<=e.keys.length-1&&(t===0?Object.assign(i,p):i[e.up(e.keys[t])]=p)},s)}):n&&typeof n=="object"?(Object.keys(n).length>e.keys.length?e.keys:te(e.keys,Object.keys(n))).forEach(t=>{if(e.keys.includes(t)){const i=n[t];i!==void 0&&r((p,c)=>{o===t?Object.assign(p,c):p[e.up(t)]=c},i)}}):(typeof n=="number"||typeof n=="string")&&r((s,t)=>{Object.assign(s,t)},n)};function $(e){return`--Grid-${e}Spacing`}function b(e){return`--Grid-parent-${e}Spacing`}const E="--Grid-columns",y="--Grid-parent-columns",re=({theme:e,ownerState:n})=>{const r={};return S(e.breakpoints,n.size,(o,s)=>{let t={};s==="grow"&&(t={flexBasis:0,flexGrow:1,maxWidth:"100%"}),s==="auto"&&(t={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof s=="number"&&(t={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${s} / var(${y}) - (var(${y}) - ${s}) * (var(${b("column")}) / var(${y})))`}),o(r,t)}),r},se=({theme:e,ownerState:n})=>{const r={};return S(e.breakpoints,n.offset,(o,s)=>{let t={};s==="auto"&&(t={marginLeft:"auto"}),typeof s=="number"&&(t={marginLeft:s===0?"0px":`calc(100% * ${s} / var(${y}) + var(${b("column")}) * ${s} / var(${y}))`}),o(r,t)}),r},oe=({theme:e,ownerState:n})=>{if(!n.container)return{};const r={[E]:12};return S(e.breakpoints,n.columns,(o,s)=>{const t=s??12;o(r,{[E]:t,"> *":{[y]:t}})}),r},ie=({theme:e,ownerState:n})=>{if(!n.container)return{};const r={};return S(e.breakpoints,n.rowSpacing,(o,s)=>{var i;const t=typeof s=="string"?s:(i=e.spacing)==null?void 0:i.call(e,s);o(r,{[$("row")]:t,"> *":{[b("row")]:t}})}),r},ce=({theme:e,ownerState:n})=>{if(!n.container)return{};const r={};return S(e.breakpoints,n.columnSpacing,(o,s)=>{var i;const t=typeof s=="string"?s:(i=e.spacing)==null?void 0:i.call(e,s);o(r,{[$("column")]:t,"> *":{[b("column")]:t}})}),r},ae=({theme:e,ownerState:n})=>{if(!n.container)return{};const r={};return S(e.breakpoints,n.direction,(o,s)=>{o(r,{flexDirection:s})}),r},fe=({ownerState:e})=>({minWidth:0,boxSizing:"border-box",...e.container&&{display:"flex",flexWrap:"wrap",...e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},gap:`var(${$("row")}) var(${$("column")})`}}),le=e=>{const n=[];return Object.entries(e).forEach(([r,o])=>{o!==!1&&o!==void 0&&n.push(`grid-${r}-${String(o)}`)}),n},ue=(e,n="xs")=>{function r(o){return o===void 0?!1:typeof o=="string"&&!Number.isNaN(Number(o))||typeof o=="number"&&o>0}if(r(e))return[`spacing-${n}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const o=[];return Object.entries(e).forEach(([s,t])=>{r(t)&&o.push(`spacing-${s}-${String(t)}`)}),o}return[]},pe=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([n,r])=>`direction-${n}-${r}`):[`direction-xs-${String(e)}`],de=F(),me=H("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,n)=>n.root});function ge(e){return I({props:e,name:"MuiGrid",defaultTheme:de})}function ye(e={}){const{createStyledComponent:n=me,useThemeProps:r=ge,componentName:o="MuiGrid"}=e,s=(c,a)=>{const{container:m,direction:l,spacing:u,wrap:f,size:x}=c,w={root:["root",m&&"container",f!=="wrap"&&`wrap-xs-${String(f)}`,...pe(l),...le(x),...m?ue(u,a.breakpoints.keys[0]):[]]};return Y(w,j=>Z(o,j),{})};function t(c,a,m=()=>!0){const l={};return c===null||(Array.isArray(c)?c.forEach((u,f)=>{u!==null&&m(u)&&a.keys[f]&&(l[a.keys[f]]=u)}):typeof c=="object"?Object.keys(c).forEach(u=>{const f=c[u];f!=null&&m(f)&&(l[u]=f)}):l[a.keys[0]]=c),l}const i=n(oe,ce,ie,re,ae,fe,se),p=G.forwardRef(function(a,m){const l=J(),u=r(a),f=Q(u),{className:x,children:w,columns:j=12,container:h=!1,component:O="div",direction:P="row",wrap:R="wrap",size:z={},offset:T={},spacing:k=0,rowSpacing:M=k,columnSpacing:A=k,unstable_level:g=0,...B}=f,W=t(z,l.breakpoints,d=>d!==!1),D=t(T,l.breakpoints),_=a.columns??(g?void 0:j),L=a.spacing??(g?void 0:k),K=a.rowSpacing??a.spacing??(g?void 0:M),U=a.columnSpacing??a.spacing??(g?void 0:A),C={...f,level:g,columns:_,container:h,direction:P,wrap:R,spacing:L,rowSpacing:K,columnSpacing:U,size:W,offset:D},q=s(C,l);return V.jsx(i,{ref:m,as:O,ownerState:C,className:X(q.root,x),...B,children:G.Children.map(w,d=>{var N;return G.isValidElement(d)&&ne(d,["Grid"])&&h&&d.props.container?G.cloneElement(d,{unstable_level:((N=d.props)==null?void 0:N.unstable_level)??g+1}):d})})});return p.muiName="Grid",p}const Se=ye({createStyledComponent:v("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,n)=>n.root}),componentName:"MuiGrid2",useThemeProps:e=>ee({props:e,name:"MuiGrid2"})}),be=Se;export{be as G};
