"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[3891],{63891:(e,t,a)=>{a.r(t),a.d(t,{default:()=>m}),a(43617),a(81975),a(93991);var l=a(36418),o=a.n(l),n=a(14778),s=a(85406),r=a(14696),i=a(37266);const c=e=>{let{content:t}=e;const a=(0,n.useIntl)(),s=(0,l.useRef)(null),[r,c]=(0,l.useState)(!1),[d,m]=(0,l.useState)(!1),u=()=>{c(!0),s.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(i.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:s,src:t.videoUrl,poster:t.videoPoster,controls:r&&d,loop:!0,"data-testid":"video-element",onClick:()=>{r||u()},onPause:()=>{c(!1)},onPlay:()=>c(!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 d=a(35561);const m=e=>{let{show:t,onClose:a,contentData:i}=e;const m=(0,n.useIntl)(),[u,v]=(0,l.useState)(0),p=i||d.j.filter((e=>"mission-ops"===e.useCase)),g=(0,l.useCallback)((()=>{v((e=>Math.max(0,e-1)))}),[]),_=(0,l.useCallback)((()=>{v((e=>Math.min(p.length-1,e+1)))}),[p.length]),w=(0,l.useCallback)((()=>{a()}),[a]),b=0===u,f=u===p.length-1;if(0===p.length)return null;const E=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"},p.map(((e,t)=>o().createElement("div",{key:`dot-${t}`,className:"preview-modal-controller__dot "+(t===u?"preview-modal-controller__dot--active":"")})))),o().createElement("span",{className:"preview-modal-controller__page-counter"},u+1,"/",p.length)),o().createElement("div",{className:"preview-modal-controller__navigation-buttons"},b&&o().createElement("button",{className:"btn btn-quaternary",onClick:w},m.formatMessage({id:"cloud_preview_modal.skip",defaultMessage:"Skip for now"})),!b&&o().createElement("button",{className:"btn btn-tertiary",onClick:g},o().createElement(s.ArrowLeftIcon,{size:18}),m.formatMessage({id:"cloud_preview_modal.previous",defaultMessage:"Previous"})),o().createElement("button",{className:"btn btn-primary",onClick:f?a:_},f?m.formatMessage({id:"cloud_preview_modal.done",defaultMessage:"Finish"}):o().createElement(o().Fragment,null,m.formatMessage({id:"cloud_preview_modal.next",defaultMessage:"Next"}),o().createElement(s.ArrowRightIcon,{size:18})))));return o().createElement(r.zW,{show:t,onHide:a,compassDesign:!0,enforceFocus:!0,ariaLabel:m.formatMessage({id:"cloud_preview_modal.aria_label",defaultMessage:"Cloud Preview Introduction"}),showHeader:!0,showCloseButton:!0,bodyPadding:!0,footerContent:E,className:"preview-modal-controller"},o().createElement(c,{content:p[u]}))}}}]);
//# sourceMappingURL=3891.da82b9e59583e7ca8c5c.js.map