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