import{A as d,b as w,W as y,X as L,j as x,c as a,a1 as f,a2 as W,a4 as E,G as v}from"./index.BdH_oWMm.js";import{w as C,E as k}from"./withFullScreenWrapper.BSUq8odC.js";const R=d("div",{target:"ehg91i90"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:e.spacing.lg,maxWidth:"100%",width:t?"100%":"fit-content"})),T=d("div",{target:"ehg91i91"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:t?"100%":"auto",flexGrow:t?1:0,">img":{borderRadius:e.radii.default}})),F=d("div",{target:"ehg91i92"})(({theme:e})=>({textAlign:"center",marginTop:e.spacing.xs,wordWrap:"break-word",padding:e.spacing.threeXS})),j=d("a",{target:"ehg91i93"})(({theme:e})=>({display:"block",borderRadius:e.radii.default,overflow:"hidden","&:hover":{opacity:.85},"&:focus-visible":{boxShadow:e.shadows.focusRing}})),G=y.getLogger("ImageList");function H(e,t){if(e){if(e.useStretch)return t;if(e.useContent)return;if(e.pixelWidth)return e.pixelWidth}}const M=({itemKey:e,image:t,imgStyle:s,buildMediaURL:c,handleImageError:o,shouldStretch:g,link:r})=>{const u=E(t.url),l=a("img",{style:s,src:c(t.url),alt:e,onError:o,crossOrigin:u});return x(T,{"data-testid":"stImageContainer",shouldStretch:g,children:[r?a(j,{href:r,target:"_blank",rel:"noreferrer","aria-label":t.caption||r,"data-testid":"stImageLink",children:l}):l,t.caption&&a(F,{"data-testid":"stImageCaption",style:s,children:a(v,{source:t.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]})};function A({element:e,endpoints:t,widthConfig:s,disableFullscreenMode:c}){const{expanded:o,width:g,height:r,expand:u,collapse:l}=L(k),h=g||0,I=H(s,h),p=s?.useStretch??!1,i={};r&&o?(i.maxHeight=r,i.objectFit="contain",i.width="100%"):(i.width=I??"100%",i.maxWidth="100%");const b=m=>{const n=m.currentTarget.src;G.error(`Client Error: Image source error - ${n}`),t.sendClientErrorToHost("Image","Image source failed to load","onerror triggered",n)};return x(f,{width:h,height:r,useContainerWidth:o,topCentered:!0,children:[a(W,{target:f,isFullScreen:o,onExpand:u,onCollapse:l,disableFullscreenMode:c}),a(R,{className:"stImage","data-testid":"stImage",shouldStretch:p,children:e.imgs.map((m,n)=>a(M,{itemKey:n.toString(),image:m,imgStyle:i,buildMediaURL:S=>t.buildMediaURL(S),handleImageError:b,shouldStretch:p,link:e.imgs.length===1?e.link:void 0},n))})]})}const O=C(A),X=w.memo(O);export{X as default};
