import{aI as x,M as m,E as h,r as v,ao as t,fq as g,v as C,ba as b,bp as j,fy as y,o as k,bv as f,aQ as R,at as T,a_ as z,d7 as w}from"./app-k0jcl5PQ.js";import{R as A}from"./BNuOjrBr.chunk.js";import{T as P}from"./WCBjpMHJ.chunk.js";import{D as S}from"./CGYNvpr2.chunk.js";import{R as $}from"./CW-zLlXC.chunk.js";const N="_imageStyle_12z26_1",B="_item_12z26_6",U="_dashboard_12z26_10",E="_playPage_12z26_25",I="_aspectRatio_12z26_34",L="_outerContainer_12z26_39",M="_innerContainer_12z26_46",D="_actions_12z26_46",H="_titleBelow_12z26_56",F="_thumbnailContainer_12z26_59",G="_titleAbove_12z26_62",O="_teacherPack_12z26_65",q="_text_12z26_68",Q="_hoverState_12z26_71",W="_atomGuide_12z26_74",J="_studentActivity_12z26_83",K="_additionalMaterials_12z26_92",V="_userUploaded_12z26_101",X="_download_12z26_116",a={imageStyle:N,item:B,dashboard:U,playPage:E,aspectRatio:I,outerContainer:L,innerContainer:M,actions:D,titleBelow:H,thumbnailContainer:F,titleAbove:G,teacherPack:O,text:q,hoverState:Q,atomGuide:W,studentActivity:J,additionalMaterials:K,userUploaded:V,download:X};function Y(e){switch(e){case"atom-guide":return a.atomGuide;case"student-activity":return a.studentActivity;case"teacher-pack":return a.teacherPack;case"additional-materials":return a.additionalMaterials;default:return a.userUploaded}}function Z(e,n){var o;const r=j();return n==="public"?!0:r.xs||r.sm||e.type!=="resource"||!("metadata"in e)?!1:e.metadata.type===y.Image?!0:e.metadata.type===y.Pdf?!!e.url:!!((o=e.pdf)!=null&&o.url)}c.defaultProps={preloadImage:!0,actionBehaviour:"normal"};function c(e){var d,l,s;let n=null;"metadata"in e.data&&(n=e.data.metadata);const r=f.isType(e.data,m.Resource);function o(i){var _;let u=`
      d-flex flex-column align-items-center justify-content-end rounded-3 h-100
      position-relative ${Y(i)} ${a.innerContainer}`;return(_=e.theme)!=null&&_.containerClass?u+=` ${e.theme.containerClass}`:u+=" pt-3 px-3",e.applyHoverState&&(u+=` ${a.hoverState}`),u}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:a.aspectRatio,children:t.jsx("div",{className:a.outerContainer,children:t.jsxs("div",{className:o(n==null?void 0:n.resourceType),children:[e.titlePosition==="above"&&t.jsx(R,{title:e.data.name,children:t.jsx("h3",{className:`text-center text-break h5 mb-3 ${a.text}`,children:t.jsx("span",{className:"clamp-1",children:e.data.name})})}),t.jsx("div",{className:`
              ${((d=e.theme)==null?void 0:d.thumbnailContainerClass)??""} w-75 overflow-hidden 
              ${a.thumbnailContainer} ${e.titlePosition==="above"?a.titleAbove:""} 
              ${a.imageStyle}
            `,children:t.jsx(A,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})}),r&&e.onClickDownload&&e.actionBehaviour==="normal"&&t.jsx("div",{className:a.actions,children:t.jsx(T,{onClick:i=>e.onClickDownload(i,e.data),className:`${a.download} d-flex align-items-center justify-content-center`,children:t.jsx(z,{svg:S})})}),!e.hideTypeBadge&&r&&t.jsx(P,{typeId:m.Resource})]})})}),e.titlePosition==="below"&&t.jsxs("div",{className:`mt-1 ${a.titleBelow}`,children:[f.isType(e.data,m.Resource)&&!!((s=(l=e.data)==null?void 0:l.metadata)!=null&&s.resourceType)&&t.jsx(w,{children:$.getResourceTypeName(e.data.metadata.resourceType)}),t.jsx("h3",{className:"h6 clamp-2",children:e.data.name})]})]})}const ie=x.memo(function(e){const n=Z(e.data,e.actionBehaviour);function r(){return e.location==="play-page"?a.playPage:a.dashboard}const o={...e.analyticsData,...e.data},d={...e.analyticsOptions,actionType:v.Click,entity:e.data.typeId===m.Resource?h.Resource:h.Link};function l(){k.logUserAction(o,d)}const s={...e,applyHoverState:n||!!e.data.url};return t.jsx("div",{className:`px-1 flex-shrink-0 ${a.item} ${r()} ${g.RESOURCE_ITEM_SELECTOR}`,children:(()=>{const i="d-block no-decoration";return e.data.type==="link"?t.jsx("a",{href:e.data.url,target:"_blank",className:i,onClick:l,children:t.jsx(c,{...s})}):n?e.actionBehaviour==="public"?t.jsx("div",{className:`${i} cursor-pointer d-inline`,onClick:()=>{l(),C.trigger(e.getAppLink(e.data))},children:t.jsx(c,{...s})}):t.jsx(b,{appLink:e.getAppLink(e.data),className:i,analyticsData:o,analyticsOptions:d,children:t.jsx(c,{...s})}):e.data.url?t.jsx("a",{href:e.data.url,className:i,onClick:l,children:t.jsx(c,{...s})}):t.jsx("div",{className:i,children:t.jsx(c,{...s})})})()})});export{ie as R,c as a};
//# sourceMappingURL=Dsub6O-d.chunk.js.map
