import e,{useEffect as t,useState as r}from"react";import n from"../../node_modules/next/router.js";import{getLastNumberOfString as i}from"../../utils/string.js";import"../../node_modules/react-redux/es/index.js";import{Paragraph as a}from"../Typography/Paragraph/Paragraph.js";import"../Typography/Paragraph/Paragraph-utils.js";import{NewEventHeaderContainer as o}from"./news-event-header-container.js";import{NewsEventItemContainer as s}from"./news-event-item-container.js";import m from"../../node_modules/react-image-masonry/build/index.js";import{useSelector as l}from"../../node_modules/react-redux/es/hooks/useSelector.js";import{useDispatch as d}from"../../node_modules/react-redux/es/hooks/useDispatch.js";function u(u){var c=n.useRouter(),p=l(u.selectArticle),g=l(u.selectPage),f=d(),h=i(c.asPath),w=p?p.fullContent:"";t((function(){var e,t;h&&!g&&f(u.fetchArticle((e=u.apiUrl,t=e.indexOf(".com"),e.substr(0,t+4)+"/api/news-and-events/article/"+h)))}),[f,h]);var j=r(window.innerWidth),x=j[0],v=j[1];return t((function(){window.addEventListener("resize",(function(){v(window.innerWidth)}))})),e.createElement(e.Fragment,null,e.createElement(o,{title:p?p.title:"",imageSrc:p&&p.images&&p.images.length>1?p.images[0]:""}),e.createElement(s,{filledIn:p&&p.publication?p.publication.name:"",filledInUrl:u.apiUrl,relatedCategories:"unknown",relatedCategoriesLink:"unknown",publishedOn:p?p.publish_date:""},e.createElement(a,{content:w,align:"left",fontSize:"1.3125rem",lineHeight:"30.03px",fontFamily:"Bressay, Sukhumvit Set",letterSpacing:"0",textTransform:"normal",lumo:"primary-dark"}),p&&p.images&&p.images.length>1?e.createElement(m,{imageUrls:p.images,numCols:x<600?1:2,containerWidth:"100%"}):e.createElement("img",{src:p&&p.images?p.images[0]:""})))}export default u;
//# sourceMappingURL=NewsEventItem.js.map
