File: /var/www/html/maisonimmobiliare/wp-content/plugins/3d-viewer/dist/3d-viewer-frontend.js
(()=>{"use strict";var e={812:(e,t,r)=>{r.d(t,{Z:()=>E});var n=r(174),a=r.n(n);const o=e=>{let{attributes:t}=e;const{styles:r,uniqueId:a,woo:o,progressBar:i,additional:l}=t,{progressBarColor:c,thumbSize:s="90px"}=r,[d,u]=(0,n.useState)(null);return(0,n.useEffect)((()=>{const e=`\n #${a} {\n width: ${r?.width?.desktop||r.width};\n height: calc(${r?.height?.desktop||r.height} + 100px);\n }\n .pop-up-content-wrap #${a} {\n height: ${r?.height?.desktop||r.height};\n }\n #${a} .select {display: none}\n #${a} .b3dviewer-wrapper {\n height: ${r?.height?.desktop||r.height};\n }\n\n #${a} model-viewer {\n background: ${r?.bgColor} ${r?.bgImage?`url(${r?.bgImage})`:" "} no-repeat center center; \n background-size: cover;\n }\n #${a} model-viewer::part(default-progress-bar) {\n display: ${i?"block":"none"}\n }\n @media screen and (max-width: 768px){\n #${a} {\n width: ${o?"":`${r?.width.tablet||r.width}`};\n height: ${r?.height.tablet||r.height};\n }\n }\n @media screen and (max-width: 480px){\n #${a} {\n width: ${o?"":`${r?.width.mobile||r.width}`};\n height: ${r?.height.mobile||r.height};\n }\n }\n #${a} model-viewer::part(default-progress-bar){\n background: ${c};\n }\n #${a} .slides .slide{\n width: ${s};\n height: ${s};\n padding: calc(${s} * 0.04);\n }\n #${a} .slide-number span{\n font-size: calc(${s} * 0.8);\n }\n ${l?.CSS}\n `.replaceAll(/\n?\s\s/g,"");u(e)}),[a,r,l,i]),React.createElement("style",null,d)},i=e=>{let{element:t}=e;return React.createElement("svg",{onClick:()=>{t&&t.requestFullscreen()},id:"openBtn",width:"24px",height:"24px",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"#f2f2f2",className:"bi bi-arrows-fullscreen"},React.createElement("path",{fillRule:"evenodd",d:"M5.828 10.172a.5.5 0 0 0-.707 0l-4.096 4.096V11.5a.5.5 0 0 0-1 0v3.975a.5.5 0 0 0 .5.5H4.5a.5.5 0 0 0 0-1H1.732l4.096-4.096a.5.5 0 0 0 0-.707zm4.344 0a.5.5 0 0 1 .707 0l4.096 4.096V11.5a.5.5 0 1 1 1 0v3.975a.5.5 0 0 1-.5.5H11.5a.5.5 0 0 1 0-1h2.768l-4.096-4.096a.5.5 0 0 1 0-.707zm0-4.344a.5.5 0 0 0 .707 0l4.096-4.096V4.5a.5.5 0 1 0 1 0V.525a.5.5 0 0 0-.5-.5H11.5a.5.5 0 0 0 0 1h2.768l-4.096 4.096a.5.5 0 0 0 0 .707zm-4.344 0a.5.5 0 0 1-.707 0L1.025 1.732V4.5a.5.5 0 0 1-1 0V.525a.5.5 0 0 1 .5-.5H4.5a.5.5 0 0 1 0 1H1.732l4.096 4.096a.5.5 0 0 1 0 .707z"}))},l=()=>React.createElement("svg",{id:"closeBtn",onClick:function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()},className:"sidebar-open",width:"34px",height:"34px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{fill:"none",stroke:"#f2f2f2",strokeWidth:"2",d:"M7,7 L17,17 M7,17 L17,7"}));var c=r(489);const s=e=>{let{currentItem:t,setCurrentItem:r,models:n}=e;return a().createElement(a().Fragment,null,a().createElement("div",{className:"slideController"},a().createElement("svg",{fill:"#000000",onClick:()=>r(t>0?t-1:t),className:"arrow-left "+(t>0?"":"disabled"),width:"24px",height:"24px",viewBox:"-78.5 0 512 512",xmlns:"http://www.w3.org/2000/svg"},a().createElement("title",null,"left"),a().createElement("path",{d:"M257 64L291 98 128 262 291 426 257 460 61 262 257 64Z"})),a().createElement("svg",{onClick:()=>r(t<n.length-1?t+1:t),fill:"#000000",className:"arrow-right "+(t<n.length-1?"":"disabled"),width:"24px",height:"24px",viewBox:"-77 0 512 512",xmlns:"http://www.w3.org/2000/svg"},a().createElement("title",null,"right"),a().createElement("path",{d:"M98 460L64 426 227 262 64 98 98 64 294 262 98 460Z"}))))},d=r.p+"public/images/envmaps/fishermans_bastion/posx.jpg",u=r.p+"public/images/envmaps/fishermans_bastion/posy.jpg",m=r.p+"public/images/envmaps/fishermans_bastion/posz.jpg",p=r.p+"public/images/envmaps/fishermans_bastion/negx.jpg",w=r.p+"public/images/envmaps/fishermans_bastion/negy.jpg",f=r.p+"public/images/envmaps/fishermans_bastion/negz.jpg";var v=r(751);const g=e=>{let{attributes:t,currentItem:r,setCurrentItem:n,isPagination:o}=e;const{multiple:i,woo:l,models:c}=t;return a().createElement(a().Fragment,null,i&&!l&&o&&a().createElement("div",{className:"slider"},a().createElement("div",{className:"slides"},c.map(((e,t)=>a().createElement("button",{key:t,className:`slide ${t===r?"selected":""} ${e.poster?"":"slide-number"}`,"data-source":e?.modelUrl,"data-poster":e?.poster,onClick:()=>n(t)},e.poster?a().createElement("img",{src:e?.poster}):a().createElement("span",null,t+1)))))))};const b=e=>React.createElement("button",e),h=e=>{const{attributes:t,currentItem:r,setCurrentItem:a,modelSrc:o,setAttributes:i,__:l}=e,{styles:c,models:h,multiple:E,O3DVSettings:y}=t,{isNavigation:R,isPagination:S,camera:$,mouseControl:C}=y,[V,x]=(0,n.useState)(!1),L=(0,n.useRef)(null),A=(0,n.useRef)(null);return(0,n.useEffect)((()=>{if(o)if(A.current?.Destroy(),A.current?.canvas?.remove(),A.current=null,null===A.current){OV.SetExternalLibLocation("../libs");const e=$&&!E?{camera:new OV.Camera(new OV.Coord3D(...Object.values($.eye)),new OV.Coord3D(...Object.values($.center)),new OV.Coord3D(...Object.values($.up)),45)}:{};let t=new OV.EmbeddedViewer(L.current,{...e,backgroundColor:new OV.RGBAColor(255,255,255,255),edgeSettings:new OV.EdgeSettings(!1,new OV.RGBColor(0,0,0),1),environmentSettings:new OV.EnvironmentSettings([d,u,m,p,w,f],!1)});const r=[o];t.LoadModelFromUrlList(r),A.current=t,window.VR=t}else{A.current.LoadModelFromUrlList([o]);const e=new OV.Coord3D(0,0,0);A.current.viewer.SetCamera(new OV.Camera(new OV.Coord3D(0,0,1),e,new OV.Coord3D(0,1,0),45))}return()=>{if(null!==A.current&&null!==L.current&&V){delete A.current.model,A.current.viewer.renderer.resetState(),A.current.viewer.Clear(),A.current.viewer&&delete A.current.viewer;A.current.canvas.getContext("webgl2").getExtension("WEBGL_lose_context").loseContext();const e=A.current.canvas.cloneNode(!0);A.current.canvas.parentNode.replaceChild(e,A.current.canvas),L.current?.removeChild(L.current.children[0]),A.current.canvas?.parentNode?.removeChild(A.current.canvas),A.current.canvas.remove(),A.current=null,x(!1)}}}),[o]),(0,n.useEffect)((()=>{c.bgColor&&A.current?.viewer?.SetBackgroundColor((0,v.$W)(c.bgColor)),setTimeout((()=>{A.current?.viewer?.Resize(L.current.offsetWidth,L.current.offsetHeight)}),10),A.current.viewer.Render(),window.viewer=A.current}),[c,o]),(0,n.useEffect)((()=>{window.addEventListener("resize",(()=>{A.current?.viewer?.Resize(L.current?.offsetWidth,L.current?.offsetHeight)}))}),[]),React.createElement(React.Fragment,null,React.createElement("div",{ref:L,role:"img","aria-label":"Canvas showing the model in the 3D Viewer",className:`${C?"":"DMC"} ${A.current?.modelLoader?.inProgress} relative flex flex-col items-center justify-center p-2 h-72 w-72 border-2 border-black rounded-sm online_3d_viewer`,style:{width:c.width.desktop||c.width,height:c.height.desktop||c.height}},React.createElement(g,{attributes:t,setCurrentItem:a,currentItem:r,isPagination:S}),E&&R&&h.length>1&&React.createElement(s,{currentItem:r,setCurrentItem:a,models:h}),i&&!E&&React.createElement("div",{className:"setDefaultViewContainer"},React.createElement(b,{variant:"primary",className:"setDefaultView button button-primary",onClick:()=>{if(A.current){const t=(e=A.current?.viewer?.GetCamera(),JSON.parse(JSON.stringify(e)));i({O3DVSettings:{...y,camera:t}})}var e}},l($?"Reset Default View":"Set Default View","model-viewer")),$&&React.createElement(React.Fragment,null,React.createElement(b,{variant:"primary",className:"setDefaultView button button-primary",onClick:()=>{A.current?.viewer.SetCamera(new OV.Camera(new OV.Coord3D(...Object.values($.eye)),new OV.Coord3D(...Object.values($.center)),new OV.Coord3D(...Object.values($.up)),45))}},l("See Default View","model-viewer")),React.createElement(b,{variant:"primary",className:"setDefaultView button button-primary",onClick:()=>i({O3DVSettings:{...y,camera:null}})},l("Remove Default View","model-viewer"))))))},E=e=>{let{attributes:t,__:r,setAttributes:a}=e;const[d,u]=(0,n.useState)(!1),{loadingPercentage:m=!1,uniqueId:p,model:w,models:f,fullscreen:v,variant:g,multiple:b,additional:E,exposure:y,selectedAnimation:R,animation:S,autoRotate:$,autoplay:C,rotateAlongX:V,align:x,woo:L,rotationPerSecond:A,preload:k,isPagination:O,isNavigation:_,zoom:N,currentViewer:q="modelViewer",O3DVSettings:D={},loading:I}=t,{isFullscreen:j}=D,[T,B]=(0,n.useState)(0),[F,M]=(0,n.useState)(b?f[T]?.modelUrl:w?.modelUrl),P=(0,n.useRef)(),W=(0,n.useRef)(),z=(0,n.useRef)();(0,n.useEffect)((()=>{M(b?f[T]?.modelUrl:w?.modelUrl)}),[T,b,f,w]),(0,n.useEffect)((()=>{try{new URL(F),u(!0)}catch(e){u(!1)}setTimeout((()=>{(0,c.Z)({animation:S,variant:g,wrapper:P.current?.parentElement})}),10)}),[p,w,f,b,F]),(0,n.useEffect)((()=>{C||P.current?.pause()}),[C]),(0,n.useEffect)((()=>{setTimeout((()=>{if(P.current&&z.current){P.current.animationName=R;z.current.querySelector("select").value=R}}),10)}),[R]),(0,n.useEffect)((()=>{W.current&&(W.current.style.display=g?"inline-block":"none")}),[g]),(0,n.useEffect)((()=>{z.current&&(S&&P.current.loaded?z.current.style.display="inline-block":z.current.style.display="none")}),[S,z]),(0,n.useEffect)((()=>{P.current?.turntableRotation&&P.current.resetTurntableRotation()}),[V]),(0,n.useEffect)((()=>{setTimeout((()=>{const{mouseControl:e,autoplay:r,shadow:n,rotate:a,rotateAlongX:o,rotateAlongY:i,loading:l}=t;P.current&&(e?P.current.setAttribute("camera-controls",""):P.current.removeAttribute("camera-controls"),r?P.current.setAttribute("autoplay",""):P.current.removeAttribute("autoplay"),n?P.current.setAttribute("shadow-intensity","1"):P.current.removeAttribute("shadow-intensity"),n?P.current.setAttribute("shadow-softness","1"):P.current.removeAttribute("shadow-softness"),l?P.current.setAttribute("loading",l):P.current.removeAttribute("loading"),$?(P.current.setAttribute("auto-rotate",""),P.current.setAttribute("rotation-per-second",A+"deg")):P.current.removeAttribute("auto-rotate"),a?P.current.setAttribute("camera-orbit",`${o}deg ${i}deg 105%`):P.current.removeAttribute("camera-orbit"),P.current.setAttribute("reveal",k),P.current.dataset.animation=R,P.current.setAttribute("exposure",y),N?P.current.removeAttribute("disable-zoom"):P.current.setAttribute("disable-zoom","")),setTimeout((()=>{a?P.current?.setAttribute("camera-orbit",`${o}deg ${i}deg 105%`):P.current.removeAttribute("camera-orbit")}),500)}),10)}),[p,t]),(0,n.useEffect)((()=>{if(L){const e=document.querySelector(".variations_form .variations select");e?.addEventListener("change",(function(e){const t=f.find((t=>t.product_variant===e.target.value))||f.find((e=>"all"===e.product_variant))||f?.[0];M(t.modelUrl)})),document.querySelectorAll(".variable-items-wrapper li")?.forEach((e=>e.addEventListener("click",(function(){const t=f.find((t=>t.product_variant===e.dataset?.value))||f.find((e=>"all"===e.product_variant))||f?.[0];M(t.modelUrl)})))),setTimeout((()=>{const e=document.querySelector(".select2-selection__rendered"),t=new MutationObserver((function(t){for(const r of t)if("childList"===r.type&&r.target===e){const t=f.find((t=>t.product_variant===e.innerText))||f.find((e=>"all"===e.product_variant))||f?.[0];M(t.modelUrl)}}));if(e){const r={childList:!0,subtree:!0};t.observe(e,r)}}),1e3)}}),[L]);const H=b?f[0]?.poster:w?.poster;return React.createElement("div",{id:`${p}`,className:`modelViewerBlock b3dviewer align${x} ${L?"woocommerce":""} ${O&&b?"pagination":""}`},React.createElement("div",{id:E?.ID,className:`${E?.Class} b3dviewer-wrapper bp_model_parent `},React.createElement(o,{attributes:t}),F&&d&&React.createElement(React.Fragment,null,"modelViewer"===q?React.createElement("model-viewer",{loading:I||"auto","camera-controls":!0,ref:P,"data-js-focus-visible":!0,"data-decoder":b?f[0]?.decoder:w?.decoder,poster:H?.replace(/https?:/,window.location.protocol),src:F?.replace(/https?:/,window.location.protocol),alt:"A 3D model"},React.createElement("button",{type:"button",slot:"poster",id:"default-poster","aria-label":"A 3D model",style:{backgroundImage:` url("${H?.replace(/https?:/,window.location.protocol)}")`}}),m&&("lazy"===I||P.current)&&!P?.current?.loaded&&React.createElement("div",{className:"percentageWrapper"},React.createElement("div",{className:"overlay"}),React.createElement("span",{className:"percentage"},"0%")),React.createElement("div",{className:"variantWrapper select",ref:W},r("Variant","model-viewer")," ",React.createElement("select",{id:"variant"})),React.createElement("div",{className:"animationWrapper select",ref:z},r("Animations","model-viewer")," ",React.createElement("select",{id:"animations"})),b&&!L&&O&&React.createElement("div",{className:"slider"},React.createElement("div",{className:"slides"},f.map(((e,t)=>React.createElement("button",{key:t,className:`slide ${0===t?"selected":""} ${e.poster?"":"slide-number"}`,"data-source":e?.modelUrl,"data-poster":e?.poster,onClick:()=>B(t)},e.poster?React.createElement("img",{src:e?.poster}):React.createElement("span",null,t+1)))))),b&&_&&f.length>1&&React.createElement(s,{currentItem:T,setCurrentItem:B,models:f})):React.createElement(React.Fragment,null,React.createElement(h,{__:r,setAttributes:a,modelSrc:F,currentItem:T,setCurrentItem:B,model:F,attributes:t}))),""===F&&f[T].poster&&React.createElement(React.Fragment,null,L&&f.length>1&&React.createElement(s,{currentItem:T,setCurrentItem:B,models:f}),React.createElement("img",{src:f[T].poster})),(v&&"modelViewer"===q||"O3DViewer"===q&&j)&&React.createElement(React.Fragment,null,React.createElement(i,{element:document.querySelector(`#${p} .bp_model_parent`)}),React.createElement(l,null))),L&&O&&React.createElement("div",{className:"modelThumbs"},f.map(((e,t)=>React.createElement(React.Fragment,null,e.poster&&React.createElement("img",{className:"thumbsItem "+(t===T?"selected":""),onClick:()=>B(t),src:e.poster}))))))}},489:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(467),a=r(751),o=r(812);window.addEventListener("elementor/frontend/init",(function(){elementorFrontend.hooks.addAction("frontend/element_ready/3dModelViewer.default",(function(e,t){const r=e[0].querySelector(".b3dviewer-wrapper.elementor");modelRenderer({animation:!0,variant:!0,wrapper:r})}))})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelectorAll(".modelViewerBlock");setTimeout((()=>{Object.values(e).map((e=>{const t=e.querySelectorAll("model-viewer")||e.querySelectorAll(".online_3d_viewer"),r=e.querySelector(".progress");t.forEach((e=>{const t=new URL(e?.src||e?.getAttribute("src")||e?.getAttribute("model"));if("DIV"===e.tagName);else{t?.protocol!==location?.protocol&&e?.setAttribute("src",t.href.replace(t?.protocol,location?.protocol)),r&&(e?.addEventListener("progress",(e=>{r.innerHTML=parseInt(100*e.detail.totalProgress)+"%"})),e?.addEventListener("load",(()=>{setTimeout((()=>{r.style.display="none"}),500)}))),e.dataset.items="";const n=document.querySelector(".product-modal-wrap");if(n&&!n?.nextElementSibling?.classList?.contains("entry-summary")&&!n?.nextElementSibling?.classList?.contains("mkd-single-product-summary")){n.style.width="100%";const e=document.querySelector(".showcase-inner .product-information");if(e){const t=n.querySelector("model-viewer");t&&(t.style.height=e.offsetHeight+"px")}}}}))}))}),1e3);let t=document.querySelectorAll(".bp3dmodel-carousel");Object.values(t).map((e=>{e.dataset.fullscreen}))})),jQuery(document).ready((function(e){e(".bp3dmodel-carousel")?.[0]?.slick({slidesToShow:1,slidesToScroll:1,arrows:!0})}));function i(e){return e.replace(/-\d{2,4}x\d{2,4}/g,"")}function l(e){return/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i.test(e)}document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelectorAll(".b3dviewer-wrapper:not(.elementor)");Object.values(e).map((e=>{d({animation:!0,variant:!0,wrapper:e})})),document.querySelectorAll(".bp3dv-model-main")?.forEach((e=>{let t=e.dataset.selector;if(!t||""===t)return!1;let r=document.querySelector(l(t)?`img[src="${t}"]`:t.includes("#")||t.includes(".")?t:`.${t}`);l(t)&&(r||(r=document.querySelector(`img[data-src="${t}"]`)),r||(r=document.querySelector(`img[data-src="${i(t)}"]`)),r||(r=document.querySelector(`img[src="${i(t)}"]`))),r?(r=function(e){let t=e.parentElement;for(;t&&1===t.children.length;)e=t,t=t.parentElement;return e}(r),r?.innerHTML?.includes("<a")&&r.classList.add("bp3dv_a_popup_opener"),r?.innerHTML?.includes("<img")&&"reintest.be"===window.location.host&&r.classList.add("bp3dv_play_icon"),r?.addEventListener("click",(t=>{t.preventDefault(),e.classList.add("model-open")})),r.style.cursor="pointer",e.querySelector(".close-btn").addEventListener("click",(()=>e.classList.remove("model-open"))),e.querySelector(".bg-overlay").addEventListener("click",(()=>e.classList.remove("model-open")))):console.warn("clickable item is not found",t)}))}));const c=e=>{let{attributes:t}=e;if(t)return React.createElement(o.Z,{attributes:t,__:function(e){return e}})};window.addEventListener("elementor/frontend/init",(function(){elementorFrontend.hooks.addAction("frontend/element_ready/3dModelViewer.default",(function(e,t){const r=e[0]?.querySelectorAll(".modelViewerBlock");r?.forEach((e=>{const t={...e.dataset}||{};setTimeout((()=>{Object.keys(e.dataset).map((t=>delete e.dataset[t]))}),10);const r=(0,a.o3)(t.attributes);if(r){const a=t.selector;if(a&&document.querySelector(a)&&(e=document.querySelector(a)).setAttribute("style",`width:${e.offsetWidth}px !important;height:350px`),!r?.currentViewer||"modelViewer"===r.currentViewer){e.setAttribute("data-rendered","true"),(0,n.render)(React.createElement(c,{attributes:r}),e);if(!document.getElementById("bp3d-model-viewer-js")){const e=document.createElement("script");e.type="module",e.id="bp3d-model-viewer-js",e.src=window.bp3dBlock?.modelViewerSrc,document.head.appendChild(e)}}if("O3DViewer"===r.currentViewer)if("undefined"==typeof OV){const t=document.getElementById("bp3d-o3dviewer-js");if(t)t.addEventListener("load",(()=>{(0,n.render)(React.createElement(c,{attributes:r}),e)}));else{const t=document.createElement("script");t.id="bp3d-o3dviewer-js",t.src=window.bp3dBlock?.o3dviewerSrc,document.head.appendChild(t),t.addEventListener("load",(()=>{(0,n.render)(React.createElement(c,{attributes:r}),e)}))}}else(0,n.render)(React.createElement(c,{attributes:r}),e)}}))}))}));const s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e?.parentElement){n&&(e.parentElement.style.display="inline-block"),e.innerHTML="",!t.length&&e.parentElement&&(window.location.href.includes("wp-admin")?t[0]="not available":e.parentElement.style.display="none");for(const n of t){const t=document.createElement("option");t.value=n,t.textContent=n,e.appendChild(t),n===r&&(t.selected=!0)}}};function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{animation:t=!1,variant:r=!1,wrapper:n}=e;if(!n)return;const a=n.querySelector("model-viewer");if(!a)return!1;if(a.src)try{const e=new URL(a.src);e?.protocol!==window.location.protocol&&(a.src=e.href.replace(e.protocol,window.location.protocol))}catch(e){console.warn(e.message,a.src)}const o=a.dataset.animation,i=n.querySelector("#variant"),l=n.querySelector("#animations"),c=n.querySelector(".percentageWrapper"),d=c?.querySelector(".percentage");"interaction"===a.reveal&&c&&(c.style.display="none"),a.addEventListener("load",(()=>{s(i,a.availableVariants,"",r),s(l,a.availableAnimations,o,t),a.animationName=o,setTimeout((()=>{c&&(c.style.display="none")}),100)})),d&&a.addEventListener("progress",(e=>{c.style.display="block",d.innerHTML=parseInt(100*e.detail.totalProgress)+"%"})),i&&i.addEventListener("input",(e=>{a.variantName=e.target.value})),l&&l.addEventListener("input",(e=>{a.animationName=e.target.value}));const u=n.querySelectorAll(".slide");for(const e of u)e.addEventListener("click",(t=>{t.preventDefault(),a.src=e?.dataset?.source,a.poster=e?.dataset?.poster,u.forEach((e=>{e.classList.remove("selected")})),e.classList.add("selected"),i&&(i.innerHTML="")}));document.querySelector(".slider")?.addEventListener("beforexrselect",(e=>{e.preventDefault()}))}window.modelRenderer=d;const u=d},751:(e,t,r)=>{r.d(t,{$W:()=>n,o3:()=>a});r(174);const n=function(e){if("transparent"===e)return{r:255,g:255,b:255,a:0};if(e.includes("rgba")){const t=e.match(/rgba?\((\d+),(\d+),(\d+)(?:,([\d.]+))?\)/);if(t){const[,e,r,n,a=1]=t.map(Number);return{r:e,g:r,b:n,a}}return null}var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e.replace("#",""));return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:parseInt(t[4],16)?parseInt(t[4],16):0===parseInt(t[4],16)?0:255}:null},a=e=>{let t=null;try{t=JSON.parse(e)}catch(e){console.warn(e.message)}return t}},646:(e,t,r)=>{var n=r(467);t.s=n.createRoot,n.hydrateRoot},174:e=>{e.exports=React},467:e=>{e.exports=ReactDOM}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var a=n.length-1;a>-1&&!e;)e=n[a--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e=r(646),t=r(751),n=r(812);const a=e=>{let{attributes:t}=e;if(t)return React.createElement(n.Z,{attributes:t,__:function(e){return e}})};document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelectorAll(".modelViewerBlock");window.domRendered||(window.domRendered=!0,e.forEach((e=>{const r={...e.dataset}||{};setTimeout((()=>{Object.keys(e.dataset).map((t=>delete e.dataset[t]))}),10);const n=(0,t.o3)(r.attributes);if(n){const t=r.selector,a=r.position,i=r.type,{isPagination:l,styles:c}=n,s=document.createElement("div");if(t&&document.querySelector(t)&&(Object.keys(e.dataset).map((t=>delete e.dataset[t])),e=document.querySelector(t)),!n?.currentViewer||"modelViewer"===n.currentViewer){e.setAttribute("data-rendered","true"),s.classList.add("woocimmerce-product-model-viewer-wrapper"),o({div:s,dom:e,position:a,styles:c,isPagination:l,attributes:n,type:i});if(!document.getElementById("bp3d-model-viewer-js")){const e=document.createElement("script");e.type="module",e.id="bp3d-model-viewer-js",e.src=window.bp3dBlock?.modelViewerSrc,document.head.appendChild(e)}}if("O3DViewer"===n.currentViewer){const t=document.getElementById("bp3d-o3dviewer-js");if(t)t.addEventListener("load",(()=>{o({div:s,dom:e,position:a,styles:c,isPagination:l,attributes:n,type:i})}));else{const t=document.createElement("script");t.id="bp3d-o3dviewer-js",t.src=window.bp3dBlock?.o3dviewerSrc,document.head.appendChild(t),t.addEventListener("load",(()=>{o({div:s,dom:e,position:a,styles:c,isPagination:l,attributes:n,type:i})}))}}}})))}));const o=t=>{let{div:r,position:n,dom:o,styles:i,attributes:l,isPagination:c,type:s}=t;if("bottom"===n)setTimeout((()=>{o.appendChild(r),o=r,o.setAttribute("style",`width:${o.offsetWidth>0?o.offsetWidth+"px":"100%"} !important;height:calc(${i.height} + ${c?"100px":"0px"})`);(0,e.s)(o).render(React.createElement(a,{attributes:l}),o)}),100);else if("top"===n)o.insertBefore(r,o.firstChild),o=r,setTimeout((()=>{o.setAttribute("style",`width:${o.offsetWidth>0?o.offsetWidth+"px":"100%"} !important;height:calc(${i.height} + ${c?"100px":"0px"})`);(0,e.s)(o).render(React.createElement(a,{attributes:l}),o)}),100);else{o.setAttribute("style",`width:${o.offsetWidth>0?o.offsetWidth+"px":"100%"} !important;height:calc(${i.height} + ${c&&"popup"!==s?"100px":"0px"})`);(0,e.s)(o).render(React.createElement(a,{attributes:l}),o)}}})()})();
//# sourceMappingURL=3d-viewer-frontend.js.map