import{r as e,j as s}from"./vendor-react-Dp9pL_Wn.js";import{aU as a,P as i,w as t,q as r,D as o}from"./c6eedc03a-CsEFTfjy.js";import{u as n}from"./caf7c7e06-DJYXCm3T.js";import{r as c,b as l,c as d,d as m}from"./c62933a29-BojHUSii.js";import{B as u,u as f,e as x,C as p}from"./vendor-ant-cds-bBedrtIN.js";import{av as h}from"./index-DhMXk6CR.js";import{m as v}from"./vendor-motion-EDlUw66k.js";const j=(e,s,a,i)=>"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(e,s),a):i,g=e.memo(({content:e,onCtaClick:t,onDismiss:r,ImageComponent:o})=>{const f=o??b,x=n()()({defaultMessage:"Dismiss",id:"TDaF6J3c1i"}),p=c(e.pictogramName),h=!1===e.pictogramAnimated?void 0:l(e.pictogramName),v=void 0!==p||void 0!==e.imageUrl,g=d(void 0!==p?e.pictogramBackground:void 0),k=m(e.pictogramSize,"sm"),y=void 0!==p?Math.max(99,k+32):99,N=j(e.imageHeight,40,480,y),w=j(e.cardWidth,176,480,190);return s.jsxs("div",{className:"relative rounded-card shadow-panel-lg",style:{width:w,maxWidth:"calc(100vw - 5rem)"},children:[s.jsxs("div",{className:"w-full overflow-hidden rounded-card bg-surface-3 shadow-card-ring",children:[v&&s.jsx("div",{className:"p-2",children:s.jsx("div",{className:`relative overflow-hidden rounded ${g}`,style:{height:N-16},children:void 0!==p?s.jsx("div",{className:"flex h-full w-full items-center justify-center",children:void 0!==h?s.jsx(a,{asset:h,still:p,size:k}):s.jsx(i,{asset:p,size:k})}):void 0!==e.imageUrl?s.jsx(f,{src:e.imageUrl,alt:"",fill:!0,className:"contain"===e.imageFit?"object-contain object-center":"object-cover object-center",priority:!0}):null})}),s.jsxs("div",{className:"flex flex-col gap-md px-md pb-md pt-sm",children:[s.jsxs("div",{className:"flex flex-col gap-sm text-left",children:[s.jsx("p",{className:"text-body font-medium text-primary",children:e.title}),s.jsx("p",{className:"text-caption text-muted",children:e.body})]}),s.jsx(u,{variant:"primary",onClick:t,children:e.buttonText})]})]}),s.jsx("div",{className:"absolute -right-2 -top-2 z-20",children:s.jsx(u,{variant:"secondary",iconOnly:!0,icon:"X",size:"xs","aria-label":x,onClick:r,className:"rounded-full bg-surface-2"})})]})});function b({src:e,alt:a,className:i}){return s.jsx("img",{src:e,alt:a,className:`absolute inset-0 h-full w-full ${i??""}`})}function k({title:a,body:i,buttonText:n,imageUrl:c,imageUrlDark:l,href:d,isExternal:m,onClick:u,onDismiss:j,analyticsEvents:b}){const k=f(50),y=x(),{track:N}=t(),w=m??/^https?:\/\//i.test(d),C=e.useRef(!1);e.useEffect(()=>{b?.shown&&!C.current&&(C.current=!0,N({event_key:b.shown,action:"shown"}))},[N,b?.shown]);const D=e.useCallback(e=>{b?.clicked&&N({event_key:b.clicked,action:"clicked"}),u(e),w&&!e.defaultPrevented&&(e.preventDefault(),r({href:d,features:"noopener,noreferrer"}))},[u,N,b?.clicked,w,d]),U=e.useCallback(e=>{e.preventDefault(),e.stopPropagation(),b?.dismissed&&N({event_key:b.dismissed,action:"dismissed"}),j()},[j,N,b?.dismissed]),z=e.useCallback(()=>{},[]),M=e.useMemo(()=>({title:a,body:i,buttonText:n,buttonHref:d,imageUrl:"dark"===y&&l?l:c}),[a,i,n,d,c,l,y]);return s.jsx(v.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"fixed bottom-10 right-10",style:{zIndex:k},children:s.jsx(p,{children:s.jsx(o,{href:d,webBehavior:w?"new-tab":"navigate",desktopBehavior:w?"open-in-browser":"navigate",rel:"noreferrer",onClick:D,className:"block cursor-pointer",children:s.jsx(g,{content:M,onCtaClick:z,onDismiss:U,ImageComponent:h})})})})}g.displayName="HomeNudgeV1Content";export{k as H,g as a};
