Module 299619

1,219 characters · in no known chunk
Dependencies
Required by (2)
Lazily required by (0)none
Requires (2)
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>l});var i=n(627968),r=n(64700),s=n(663675),a=n(621466);let o=e=>{let{alt:t,externalRef:n,autoPlay:o,playOnHover:l,onPlayError:u,responsive:c,mediaLayoutType:d,useReducedMotion:_,...h}=e,f=!_&&!l&&o,E=r.useRef(null);function p(){l&&E?.current?.play()?.catch(e=>{if(null!=u)u(e);else throw e})}function m(){l&&E?.current?.pause()}r.useLayoutEffect(()=>()=>{let{current:e}=E;null!=e&&function(e){e.removeAttribute("src"),Array.from(e.children).forEach(e=>{(0,a.vq)(e,HTMLSourceElement)&&(e.removeAttribute("src"),e.removeAttribute("type")),(0,a.vq)(e,HTMLImageElement)&&e.removeAttribute("src")});try{e.load()}catch(e){}}(e)},[]),r.useLayoutEffect(()=>("function"==typeof n?(n(null),n(E.current)):null!=n&&(n.current=E.current),()=>{"function"==typeof n?n(null):null!=n&&(n.current=null)}),[n,E]);let g=h.tabIndex??(!0===h.controls?0:-1);return(0,i.jsx)("video",{"aria-label":t,ref:E,autoPlay:f,onMouseEnter:p,onMouseLeave:m,onFocus:p,onBlur:m,style:d===s.d.MOSAIC?{width:"100%",height:"100%",maxHeight:"inherit",objectFit:"contain"}:c?{maxWidth:h.width,maxHeight:h.height,width:"100%",height:"100%"}:{},tabIndex:g,...h})},l=r.forwardRef((e,t)=>(0,i.jsx)(o,{...e,externalRef:t}))}