sui-explorer-local
Version:
Local Sui Explorer
2 lines (1 loc) • 1.23 kB
JavaScript
import{_ as d}from"./extends-98964cd2.js";import{r as n}from"./index-76fb7be0.js";function $(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function u(...e){return t=>e.forEach(r=>$(r,t))}function C(...e){return n.useCallback(u(...e),e)}const p=n.forwardRef((e,t)=>{const{children:r,...l}=e,c=n.Children.toArray(r),o=c.find(h);if(o){const i=o.props.children,s=c.map(a=>a===o?n.Children.count(i)>1?n.Children.only(null):n.isValidElement(i)?i.props.children:null:a);return n.createElement(f,d({},l,{ref:t}),n.isValidElement(i)?n.cloneElement(i,void 0,s):null)}return n.createElement(f,d({},l,{ref:t}),r)});p.displayName="Slot";const f=n.forwardRef((e,t)=>{const{children:r,...l}=e;return n.isValidElement(r)?n.cloneElement(r,{...E(l,r.props),ref:t?u(t,r.ref):r.ref}):n.Children.count(r)>1?n.Children.only(null):null});f.displayName="SlotClone";const m=({children:e})=>n.createElement(n.Fragment,null,e);function h(e){return n.isValidElement(e)&&e.type===m}function E(e,t){const r={...t};for(const l in t){const c=e[l],o=t[l];/^on[A-Z]/.test(l)?c&&o?r[l]=(...s)=>{o(...s),c(...s)}:c&&(r[l]=c):l==="style"?r[l]={...c,...o}:l==="className"&&(r[l]=[c,o].filter(Boolean).join(" "))}return{...e,...r}}export{C as $,p as a,u as b};