import*as r from"react";import{composeRefs as e}from"../../react-compose-refs/dist/index.js";import{jsx as n,Fragment as t}from"react/jsx-runtime";var i=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),a=s.find(c);if(a){const e=a.props.children,i=s.map((n=>n===a?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:n));return n(l,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n(l,{...o,ref:t,children:i})}));i.displayName="Slot";var l=r.forwardRef(((n,t)=>{const{children:i,...l}=n;if(r.isValidElement(i)){const n=function(r){let e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;if(n)return r.ref;if(e=Object.getOwnPropertyDescriptor(r,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n)return r.props.ref;return r.props.ref||r.ref}(i),o=function(r,e){const n={...e};for(const t in e){const i=r[t],l=e[t];/^on[A-Z]/.test(t)?i&&l?n[t]=(...r)=>{l(...r),i(...r)}:i&&(n[t]=i):"style"===t?n[t]={...i,...l}:"className"===t&&(n[t]=[i,l].filter(Boolean).join(" "))}return{...r,...n}}(l,i.props);return i.type!==r.Fragment&&(o.ref=t?e(t,n):n),r.cloneElement(i,o)}return r.Children.count(i)>1?r.Children.only(null):null}));l.displayName="SlotClone";var o=({children:r})=>n(t,{children:r});function c(e){return r.isValidElement(e)&&e.type===o}export{i as Slot,o as Slottable};
//# sourceMappingURL=index.js.map
