import{j as n}from"./jsx-runtime-D_zvdyIk.js";import"./chunk-QMGIS6GS-CBZUm-7V.js";import{F as G,m as l,I as N,u as $,k as j,j as w,h as C,i as F,G as P,B as v}from"./polymorphic-factory-EW0USS3V.js";import{p as B}from"./px-CiO0pVtX.js";import{a as V}from"./get-sorted-breakpoints-CWbmZd_q.js";function f(s){return typeof s=="object"&&s!==null?"base"in s?s.base:void 0:s}function I({spacing:s,verticalSpacing:o,cols:t,selector:d}){var r;const m=$(),a=o===void 0?s:o,c=G({"--sg-spacing-x":l(f(s)),"--sg-spacing-y":l(f(a)),"--sg-cols":(r=f(t))==null?void 0:r.toString()}),u=j(m.breakpoints).reduce((e,i)=>(e[i]||(e[i]={}),typeof s=="object"&&s[i]!==void 0&&(e[i]["--sg-spacing-x"]=l(s[i])),typeof a=="object"&&a[i]!==void 0&&(e[i]["--sg-spacing-y"]=l(a[i])),typeof t=="object"&&t[i]!==void 0&&(e[i]["--sg-cols"]=t[i]),e),{}),y=V(j(u),m.breakpoints).filter(e=>j(u[e.value]).length>0).map(e=>({query:`(min-width: ${m.breakpoints[e.value]})`,styles:u[e.value]}));return n.jsx(N,{styles:c,media:y,selector:d})}function S(s){return typeof s=="object"&&s!==null?j(s):[]}function M(s){return s.sort((o,t)=>B(o)-B(t))}function R({spacing:s,verticalSpacing:o,cols:t}){const d=Array.from(new Set([...S(s),...S(o),...S(t)]));return M(d)}function A({spacing:s,verticalSpacing:o,cols:t,selector:d}){var y;const m=o===void 0?s:o,a=G({"--sg-spacing-x":l(f(s)),"--sg-spacing-y":l(f(m)),"--sg-cols":(y=f(t))==null?void 0:y.toString()}),c=R({spacing:s,verticalSpacing:o,cols:t}),u=c.reduce((r,e)=>(r[e]||(r[e]={}),typeof s=="object"&&s[e]!==void 0&&(r[e]["--sg-spacing-x"]=l(s[e])),typeof m=="object"&&m[e]!==void 0&&(r[e]["--sg-spacing-y"]=l(m[e])),typeof t=="object"&&t[e]!==void 0&&(r[e]["--sg-cols"]=t[e]),r),{}),g=c.map(r=>({query:`simple-grid (min-width: ${r})`,styles:u[r]}));return n.jsx(N,{styles:a,container:g,selector:d})}var q={container:"m_925c2d2c",root:"m_2415a157"};const E={cols:1,spacing:"md",type:"media"},_=w((s,o)=>{const t=C("SimpleGrid",E,s),{classNames:d,className:m,style:a,styles:c,unstyled:u,vars:g,cols:y,verticalSpacing:r,spacing:e,type:i,...h}=t,x=F({name:"SimpleGrid",classes:q,props:t,className:m,style:a,classNames:d,styles:c,unstyled:u,vars:g}),p=P();return i==="container"?n.jsxs(n.Fragment,{children:[n.jsx(A,{...t,selector:`.${p}`}),n.jsx("div",{...x("container"),children:n.jsx(v,{ref:o,...x("root",{className:p}),...h})})]}):n.jsxs(n.Fragment,{children:[n.jsx(I,{...t,selector:`.${p}`}),n.jsx(v,{ref:o,...x("root",{className:p}),...h})]})});_.classes=q;_.displayName="@mantine/core/SimpleGrid";export{_ as S};
