"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[3891],{63891:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u}),a(43617),a(81975),a(93991);var l=a(36418),o=a.n(l),s=a(14778),n=a(85406),r=a(14696),i=a(14891),c=a(37266);const d=e=>{let{content:t}=e;const a=(0,s.useIntl)(),n=(0,l.useRef)(null),[r,i]=(0,l.useState)(!1),[d,m]=(0,l.useState)(!1),u=()=>{i(!0),n.current?.play()};return o().createElement("div",{className:"preview-modal-content"},t.skuLabel&&t.skuLabel.defaultMessage&&o().createElement("div",{className:"preview-modal-content__sku-label"},o().createElement(c.A,{className:"preview-modal-content__sku-label-logo"}),o().createElement("span",null,a.formatMessage(t.skuLabel))),o().createElement("h2",{className:"preview-modal-content__title"},a.formatMessage(t.title)),o().createElement("div",{className:"preview-modal-content__subtitle"},a.formatMessage(t.subtitle)),t.videoUrl&&o().createElement("div",{className:"preview-modal-content__media-container"},t.videoUrl?t.videoUrl.endsWith(".mp4")||t.videoUrl.endsWith(".webm")||t.videoUrl.endsWith(".mov")?o().createElement("div",{className:"custom-video-wrapper",onMouseEnter:()=>r&&m(!0),onMouseLeave:()=>m(!1)},o().createElement("video",{ref:n,src:t.videoUrl,poster:t.videoPoster,controls:r&&d,loop:!0,"data-testid":"video-element",onClick:()=>{r||u()},onPause:()=>{i(!1)},onPlay:()=>i(!0)},o().createElement("track",{kind:"captions"})),!r&&o().createElement("button",{className:"custom-play-button",onClick:u,"aria-label":a.formatMessage({id:"cloud_preview_modal.play_video",defaultMessage:"Play video"})},o().createElement("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none"},o().createElement("circle",{cx:"24",cy:"24",r:"24",fill:"rgba(255,255,255,0.9)"}),o().createElement("polygon",{points:"20,16 34,24 20,32",fill:"#1e3a8a"})))):(t.videoUrl.endsWith(".jpg")||t.videoUrl.endsWith(".jpeg")||t.videoUrl.endsWith(".png")||t.videoUrl.endsWith(".gif")||t.videoUrl.endsWith(".webp"),o().createElement("img",{src:t.videoUrl,alt:a.formatMessage(t.title)})):null))};var m=a(35561);const u=e=>{let{show:t,onClose:a,contentData:c}=e;const u=(0,s.useIntl)(),[v,p]=(0,l.useState)(0),g=c||m.j.filter((e=>"mission-ops"===e.useCase)),_=(0,l.useCallback)((()=>{p((e=>Math.max(0,e-1)))}),[]),w=(0,l.useCallback)((()=>{p((e=>Math.min(g.length-1,e+1)))}),[g.length]),f=(0,l.useCallback)((()=>{a()}),[a]),h=0===v,E=v===g.length-1;if(0===g.length)return null;const b=o().createElement("div",{className:"preview-modal-controller__footer"},o().createElement("div",{className:"preview-modal-controller__pagination"},o().createElement("div",{className:"preview-modal-controller__pagination-dots","data-testid":"pagination-dots"},g.map(((e,t)=>o().createElement("div",{key:`dot-${t}`,className:"preview-modal-controller__dot "+(t===v?"preview-modal-controller__dot--active":"")})))),o().createElement("span",{className:"preview-modal-controller__page-counter"},v+1,"/",g.length)),o().createElement("div",{className:"preview-modal-controller__navigation-buttons"},h&&o().createElement(i.Button,{emphasis:"quaternary",onClick:f},u.formatMessage({id:"cloud_preview_modal.skip",defaultMessage:"Skip for now"})),!h&&o().createElement(i.Button,{emphasis:"tertiary",onClick:_},o().createElement(n.ArrowLeftIcon,{size:18}),u.formatMessage({id:"cloud_preview_modal.previous",defaultMessage:"Previous"})),o().createElement(i.Button,{emphasis:"primary",onClick:E?a:w},E?u.formatMessage({id:"cloud_preview_modal.done",defaultMessage:"Finish"}):o().createElement(o().Fragment,null,u.formatMessage({id:"cloud_preview_modal.next",defaultMessage:"Next"}),o().createElement(n.ArrowRightIcon,{size:18})))));return o().createElement(r.zW,{show:t,onHide:a,compassDesign:!0,enforceFocus:!0,ariaLabel:u.formatMessage({id:"cloud_preview_modal.aria_label",defaultMessage:"Cloud Preview Introduction"}),showHeader:!0,showCloseButton:!0,bodyPadding:!0,footerContent:b,className:"preview-modal-controller"},o().createElement(d,{content:g[v]}))}}}]);
//# sourceMappingURL=3891.3ece57b7f49563c93394.js.map