| 1 |
(()=>{"use strict";const t=window.React,e=window.ReactDOM,r="bBlocksVideo",s=window.ReactJSXRuntime,o=({attributes:t,id:e})=>{const{width:o,radius:n}=t;return(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t#${e} .${r}{\n\t\t\twidth: ${["0px","0%","0em"].includes(o)?"100%":o};\n\t\t\tborder-radius: ${n};\n\t\t}\n\t\t`.replace(/\s+/g," ")}})},n=t=>{const e=[];return Object.keys(t).map((r=>{t[r]&&e.push(r)})),e};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-video").forEach((t=>{const r=JSON.parse(t.dataset.attributes);(0,e.createRoot)(t).render((0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{attributes:r,id:t.id}),(0,s.jsx)(a,{attributes:r})]})),t?.removeAttribute("data-attributes")}))}));const a=({attributes:e})=>{const{source:o,poster:a,controls:d,repeat:c,autoplay:i,muted:l,resetOnEnd:u,autoHideControl:p}=e,b=(0,t.useRef)(null);return(0,t.useEffect)((()=>{new Plyr(b.current,{controls:n(d),clickToPlay:!1,loop:{active:c},muted:l,autoplay:i,resetOnEnd:u,hideControls:p})}),[]),(0,s.jsx)("div",{className:r,children:(0,s.jsx)("div",{className:"videoWrapper",children:(0,s.jsxs)("video",{controls:!0,playsInline:!0,"data-poster":a,preload:"metadata",ref:b,children:["Your browser does not support the video tag.",(0,s.jsx)("source",{src:o,type:"video/mp4"})]})})})}})(); |