| 1 |
(()=>{"use strict";const t=window.React,e=window.ReactDOM,r="bBlocks3DViewer",n=window.ReactJSXRuntime,o=({attributes:t,id:e})=>{const{alignment:o,width:s,height:i}=t,a=`#${e} .${r}`;return(0,n.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${a}{\n\t\t\ttext-align: ${o};\n\t\t}\n\t\t${a} model-viewer{\n\t\t\twidth: ${["0px","0%","0em"].includes(s)?"auto":s};\n\t\t\theight: ${["0px","0%","0em"].includes(i)?"350px":i};\n\t\t}\n\t\t`.replace(/\s+/g," ")}})},s=(0,t.forwardRef)((({attributes:t},e)=>{const{sourceType:o,model:s,modelLink:i,isTouchMove:a,isZoom:d,loadingType:l}=t,c=a?{"camera-controls":""}:{},u=d?{}:{"disable-zoom":""};return(0,n.jsx)("div",{className:r,ref:e,children:(0,n.jsx)("model-viewer",{src:"upload"===o?s?.url:i,alt:"upload"===o?s?.title:"",loading:l,"auto-rotate":!0,...c,...u})})}));document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-td-viewer").forEach((t=>{const r=JSON.parse(t.dataset.attributes);(0,e.createRoot)(t).render((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o,{attributes:r,id:t.id}),(0,n.jsx)(i,{attributes:r})]})),t?.removeAttribute("data-attributes")}))}));const i=({attributes:e})=>{const r=(0,t.useRef)(null);return(0,n.jsx)(s,{attributes:e,ref:r})}})(); |