| 1 |
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{C as t,k as n,w as r}from"./client-Bw3urp1w.js";import{t as i}from"./react-dom-Bihwyis7.js";var a=t(`coins`,[[`circle`,{cx:`8`,cy:`8`,r:`6`,key:`3yglwk`}],[`path`,{d:`M18.09 10.37A6 6 0 1 1 10.34 18`,key:`t5s6rm`}],[`path`,{d:`M7 6h1v4`,key:`1obek4`}],[`path`,{d:`m16.71 13.88.7.71-2.82 2.82`,key:`1rbuyh`}]]),o=e(n(),1),s=e(i(),1),c=r(),l=256,u=8,d=8;function f({src:e,children:t,className:n,size:r=l}){let i=(0,o.useRef)(null),[a,f]=(0,o.useState)(null),p=(0,o.useCallback)(()=>{if(!e||!window.matchMedia(`(hover: hover) and (pointer: fine)`).matches)return;let t=i.current?.getBoundingClientRect();if(!t)return;let n=t.right+u,a=n+r+d<=window.innerWidth?n:Math.max(d,t.left-u-r),o=Math.max(d,Math.min(t.top,window.innerHeight-r-d));f({left:a,top:o})},[e,r]),m=(0,o.useCallback)(()=>f(null),[]);return(0,o.useEffect)(()=>{if(a)return window.addEventListener(`scroll`,m,!0),()=>window.removeEventListener(`scroll`,m,!0)},[a,m]),(0,c.jsxs)(`div`,{ref:i,className:n,onMouseEnter:p,onMouseLeave:m,children:[t,a&&e&&(0,s.createPortal)((0,c.jsx)(`img`,{src:e,alt:``,"data-testid":`thumbnail-hover-preview`,style:{left:a.left,top:a.top,width:r,height:r},className:`fixed z-[60] pointer-events-none object-cover rounded-lg shadow-2xl border-2 border-bambu-dark-tertiary bg-bambu-dark`}),document.body)]})}export{a as n,f as t};
|