window._kuulaEmbedVersion = '160'; !function(){if(!window._kuulaEmbedScriptLoaded){window._kuulaEmbedScriptLoaded=!0,console.log("VKE b"+(window._kuulaEmbedVersion||"L2"));var t,e,n,a=[],i={},o=window._kuulaMaxZIndex||"10000000",r="DeviceOrientationEvent"in window&&"function"==typeof DeviceOrientationEvent.requestPermission,d=!1,l=0,u=!1,c=!1,s=null;window.addEventListener("message",function(t){var e=t.data.fid||!1;switch(t.data.kuula&&a.forEach(function(e){(e.contentWindow||e).postMessage(t.data,"*")}),t.data.cmd){case"kuula-vr-btn":!0,s="vron",b(),c?p(e):m(!0,e);break;case"kuula-vroff-btn":!1,u=!1,m(!1,e);break;case"kuula-fs-btn":window.self!==window.top?window.open(document.location.href):m(u=!u,e);break;case"kuula-gcl":window.close();break;case"kuula-gyro-btn":b()}});var p=function(t){if(s){var e=t?i[t]:a[0];(e.contentWindow||e).postMessage({kuula:!0,cmd:s},"*"),s=null}},m=function(r,d){var l=d?i[d]:a[0];r&&!c?(t||((t=document.createElement("div")).setAttribute("style"," position: fixed; z-index: "+o+"; top: 0; left: 0; width: 100%; height: 100%; background-color: #000;"),(e=document.createElement("span")).style.display="none"),n=l.getAttribute("style"),l.setAttribute("style"," position: absolute !important; margin: 0 !important; padding: 0 !important; max-width: 100% !important; max-height: 100% !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;"),l.parentNode.replaceChild(e,l),t.appendChild(l),document.body.appendChild(t)):c&&!r&&(l.setAttribute("style",n),e.parentNode.replaceChild(l,e),document.body.removeChild(t)),c=r},w=function(){window.addEventListener("deviceorientation",function(t){var e={alpha:t.alpha,beta:t.beta,gamma:t.gamma,orientation:window.orientation};a.forEach(function(t){(t.contentWindow||t).postMessage(e,"*")})},!0)},b=function(){d||DeviceOrientationEvent.requestPermission().then(function(t){"granted"==t&&(d=!0,w())}).catch(function(t){console.error("GyroPermission",t)})},f=function(t,e){var n=e+"f"+Math.floor(100*Math.random()),o=t.getAttribute("data-kuula")||t.getAttribute("data-viewin360");if(o){var r=document.createElement("iframe");r.setAttribute("frameborder","0"),r.setAttribute("scrolling","no"),r.setAttribute("allow","xr-spatial-tracking;gyroscope;accelerometer;autoplay;microphone;camera"),r.setAttribute("allowfullscreen","true"),r.style.border="none",r.style.backgroundColor="#000000",r.style.maxWidth="100%",r.addEventListener("load",p);var d=t.getAttribute("data-width"),u=t.getAttribute("data-height"),c=t.getAttribute("data-aspect"),s=t.getAttribute("data-css"),m=t.getAttribute("data-title"),w=document.querySelector(".kuula-bl");w&&(w.style.display="none"),d&&!d.match(/px|%|v/)&&(d+="px"),r.style.width=d,u?u.match(/px|%|v/)||(u+="px"):(t.parentNode&&(u=t.parentNode.getBoundingClientRect().width),c&&(u*=c)),0!=u&&"0px"!=u||(u="100%"),r.style.height=u,r.kuulaSettings={width:d,height:u},m&&(r.setAttribute("alt",m),r.setAttribute("title",m)),s&&r.classList.add(s);var b=-1==o.indexOf("?")?"?":"&",f="enablejs=1&fid="+n;0===e&&-1==o.indexOf("priority=")&&(f+="&priority=1"),r.src=o+b+f,a.push(r),i[n]=r,-1==o.indexOf("gyro=0")&&l++,t.parentNode.insertBefore(r,t.nextSibling),t.parentNode.removeChild(t)}else console.warn("Malformed embed element.",t)};window.kuulaEmbedManualMode||window.addEventListener("DOMContentLoaded",function(){Array.prototype.slice.call(document.querySelectorAll("[data-kuula],[data-viewin360]")).forEach(f),l&&!r&&w()});var h={add:f,clear:function(){a.length=0}};window.kuulaEmbed=h,window.view360Embed=h}}();