import{a as e,t}from"./react-D0JuimcS.js";import{a as n}from"./utils-Dac180Gn.js";var r=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,i=n,a=(e,t)=>n=>{if(t?.variants==null)return i(e,n?.class,n?.className);let{variants:a,defaultVariants:o}=t,s=Object.keys(a).map(e=>{let t=n?.[e],i=o?.[e];if(t===null)return null;let s=r(t)||r(i);return a[e][s]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return i(e,s,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...c}[t]):{...o,...c}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},o=e(t(),1);function s(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function c(...e){return t=>{let n=!1,r=e.map(e=>{let r=s(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():s(e[t],null)}}}}function l(...e){return o.useCallback(c(...e),e)}function u(e){let t=o.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,s=!1,c=[];y(r)&&typeof C==`function`&&(r=C(r._payload)),o.Children.forEach(r,e=>{if(_(e)){s=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;y(n)&&typeof C==`function`&&(n=C(n._payload)),a=m(t,n),c.push(a?.props?.children)}else c.push(e)}),a?a=o.cloneElement(a,void 0,c):!s&&o.Children.count(r)===1&&o.isValidElement(r)&&(a=r);let u=a?g(a):void 0,d=l(n,u);if(!a){if(r||r===0)throw Error(s?S(e):x(e));return r}let f=h(i,a.props??{});return a.type!==o.Fragment&&(f.ref=n?d:u),o.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}var d=u(`Slot`),f=Symbol.for(`radix.slottable`);function p(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=f,t}var m=(e,t)=>{if(`child`in e.props){let t=e.props.child;return o.isValidElement(t)?o.cloneElement(t,void 0,e.props.children(t.props.children)):null}return o.isValidElement(t)?t:null};function h(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function g(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function _(e){return o.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===f}var v=Symbol.for(`react.lazy`);function y(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===v&&`_payload`in e&&b(e._payload)}function b(e){return typeof e==`object`&&!!e&&`then`in e}var x=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,S=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,C=o.use;export{l as a,c as i,u as n,a as o,p as r,d as t};