"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),c=require("@devgateway/wp-react-lib"),z=require("../connected-templates/PostIntro.js"),I=require("react"),u=require("semantic-ui-react"),h=require("pure-react-carousel"),O=require("./timeline.js"),U=r=>{let a=0;const{posts:i,height:o,interval:s,autoSwitch:n,currentSlide:l}=r;return e.jsx(h.CarouselProvider,{currentSlide:l,interval:s,isPlaying:n,totalSlides:i.length,children:e.jsx(h.Slider,{style:{height:`${o}px`},tag:"ul",children:i.map(d=>e.jsx(h.Slide,{index:a++,tag:"li",children:e.jsx(z.default,{post:d,fluid:!0})}))})})},W=r=>{const{"data-type":a,"data-taxonomy":i,"data-categories":o,"data-count":s,"data-height":n,"data-line-color":l="#000","data-config":d="{}","data-position":x="middle","data-line-width":S="1","data-margin-left":f=50,"data-margin-top":j=25,"data-margin-right":C=50,"data-margin-bottom":P=25,"data-font-size":q=14,"data-title-width":y=100,"data-subtitle-width":R=50,editing:g,parent:w,unique:b}=r,[m,v]=I.useState([0]),p=t=>g?t:decodeURIComponent(t),N=t=>JSON.parse(p(t)),_={marginLeft:f,marginTop:j,marginRight:C,marginBottom:P,lineWidth:S,height:150,position:x,lineColor:p(l),config:JSON.parse(decodeURIComponent(d)),fontSize:q,titleWidth:y,subtitleWidth:R};return e.jsx(u.Container,{style:{height:`${n}px`},className:"viz new-time-line ",fluid:!0,children:e.jsxs(c.PostProvider,{type:a,taxonomy:i,categories:N(o),store:"carousel_"+w+"_"+b,page:1,perPage:s,children:[e.jsx(u.Container,{className:"carousel-section",children:e.jsx(c.PostConsumer,{children:e.jsx(U,{currentSlide:m,height:n-250,interval:5,autoSwitch:!1})})}),e.jsx(u.Container,{className:"time-line-section",children:e.jsx(c.PostConsumer,{children:e.jsx(O.default,{currentSlide:m,onSelectSlide:t=>{v(t)},..._})})})]})})};exports.default=W;
