import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{bi as t}from"./shared-0-C4kdVF7Y.js";import{Mi as s,ki as r}from"./vendor-frame-CwiylG4Y.js";import{gp as o,hp as i}from"./shared-1-3-6x7RKF.js";import{fo as a}from"./shared-6-Cf_fMhRZ.js";import{J as n,X as c,lt as l}from"./shared-frame-DbQbH4Yr.js";import{w as m}from"./vendor-all-3-CWo5e8Lw.js";import{t as d}from"./cc3ddf513-nvsaALAX.js";var f=e(s()),p=r();function u({title:e,body:s,buttonText:r,imageUrl:u,imageUrlDark:h,href:k,isExternal:b,onClick:v,onDismiss:j,analyticsEvents:x}){const g=c(50),y=l(),{track:w}=t(),C=b??/^https?:\/\//i.test(k),D=(0,f.useRef)(!1);(0,f.useEffect)(()=>{x?.shown&&!D.current&&(D.current=!0,w({event_key:x.shown,action:"shown"}))},[w,x?.shown]);const E=(0,f.useCallback)(e=>{x?.clicked&&w({event_key:x.clicked,action:"clicked"}),v(e),C&&!e.defaultPrevented&&(e.preventDefault(),o({href:k,features:"noopener,noreferrer"}))},[v,w,x?.clicked,C,k]),U=(0,f.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),x?.dismissed&&w({event_key:x.dismissed,action:"dismissed"}),j()},[j,w,x?.dismissed]),_=(0,f.useCallback)(()=>{},[]),B=(0,f.useMemo)(()=>({title:e,body:s,buttonText:r,buttonHref:k,imageUrl:"dark"===y&&h?h:u}),[e,s,r,k,u,h,y]);return(0,p.jsx)(m.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"fixed bottom-10 right-10",style:{zIndex:g},children:(0,p.jsx)(n,{children:(0,p.jsx)(i,{href:k,webBehavior:C?"new-tab":"navigate",desktopBehavior:C?"open-in-browser":"navigate",rel:"noreferrer",onClick:E,className:"block cursor-pointer",children:(0,p.jsx)(d,{content:B,onCtaClick:_,onDismiss:U,ImageComponent:a})})})})}export{u as t};