Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/www.85520057.com/func.php:230) in /www/wwwroot/www.85520057.com/js.php on line 6
"use strict";function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _defineProperty(e,t,i){return t=_toPropertyKey(t),t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=_superPropBase(e,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}},_get.apply(this,arguments)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=_getPrototypeOf(e),null!==e););return e}function _defineProperties(e,t){for(var i=0;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i0?"-":"")+e.toLowerCase()})}function k(e,t){var i=!1;return function(){for(var n=this,r=arguments.length,o=new Array(r),a=0;a(.*)");if(null!==i){var n=parseInt(i[1],10);return isNaN(n)?null:n}if(i=e.match("GPano:"+t+'="(.*?)"'),null!==i){var r=parseInt(i[1],10);return isNaN(r)?null:r}return null}function V(e){if(!e)return{x:.5,y:.5};if("object"===_typeof(e))return e;var t=e.toLocaleLowerCase().split(" ").slice(0,2);1===t.length&&(t=Ne[t[0]]?[t[0],Ue]:[t[0],t[0]]);var i="left"!==t[1]&&"right"!==t[1]&&"top"!==t[0]&&"bottom"!==t[0];t=t.map(function(e){return Ne[e]||e}),i||t.reverse();var n=t.join(" ").match(/^([0-9.]+)% ([0-9.]+)%$/);return n?{x:parseFloat(n[1])/100,y:parseFloat(n[2])/100}:{x:.5,y:.5}}function D(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{allowCenter:!0,cssOrder:!0},i=t.allowCenter,n=t.cssOrder;return e?("string"==typeof e&&(e=e.split(" ")),1===e.length&&(e[0]===Ue?e=[Ue,Ue]:-1!==Ve.indexOf(e[0])?e=[Ue,e[0]]:-1!==De.indexOf(e[0])&&(e=[e[0],Ue])),2!==e.length||-1===je.indexOf(e[0])||-1===je.indexOf(e[1])?(R("Unparsable position ".concat(e)),null):i||e[0]!==Ue||e[1]!==Ue?(n&&!j(e)&&(e=[e[1],e[0]]),e[1]===Ue&&-1!==Ve.indexOf(e[0])&&(e=[Ue,e[0]]),e[0]===Ue&&-1!==De.indexOf(e[1])&&(e=[e[1],Ue]),e):(R("Invalid position center center"),null)):null}function j(e){return-1!==De.indexOf(e[0])&&-1!==Ve.indexOf(e[1])}function U(e){var t;if("string"==typeof e){var i=e.toString().trim(),n=parseFloat(i.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),r=i.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();switch(r.match(/(pm|per minute)$/)&&(n/=60),r){case"dpm":case"degrees per minute":case"dps":case"degrees per second":t=Re.MathUtils.degToRad(n);break;case"rdpm":case"radians per minute":case"rdps":case"radians per second":t=n;break;case"rpm":case"revolutions per minute":case"rps":case"revolutions per second":t=n*Math.PI*2;break;default:throw new He('Unknown speed unit "'.concat(r,'"'))}}else t=e;return t}function F(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n;if("string"==typeof e){var o=e.toLowerCase().trim().match(/^(-?[0-9]+(?:\.[0-9]*)?)(.*)$/);if(!o)throw new He('Unknown angle "'.concat(e,'"'));var a=parseFloat(o[1]),s=o[2];if(s)switch(s){case"deg":case"degs":t=Re.MathUtils.degToRad(a);break;case"rad":case"rads":t=a;break;default:throw new He('Unknown angle unit "'.concat(s,'"'))}else t=a}else{if("number"!=typeof e||isNaN(e))throw new He('Unknown angle "'.concat(e,'"'));t=e}return t=i(n?t+Math.PI:t,2*Math.PI),n?Re.MathUtils.clamp(t-Math.PI,-Math.PI/(r?2:1),Math.PI/(r?2:1)):t}function W(e){var t=new Re.Texture(e);return t.needsUpdate=!0,t.minFilter=Re.LinearFilter,t.generateMipmaps=!1,t}function Y(e,t){Fe.setFromEuler(t).invert(),e.applyQuaternion(Fe)}function B(e,t){var i=function(i){if(!i)return T(e);for(var n=T({...e,...i}),r={},o=0,a=Object.entries(n);o0;oi in localStorage&&(e="true"===localStorage[oi]);var t=new Promise(function(t){var i=function(){window.removeEventListener("mousedown",n),window.removeEventListener("touchstart",r),clearTimeout(a)},n=function(){i(),localStorage[oi]=!1,t(!1)},r=function(){i(),localStorage[oi]=!0,t(!0)},o=function(){i(),localStorage[oi]=e,t(e)};window.addEventListener("mousedown",n,!1),window.addEventListener("touchstart",r,!1);var a=setTimeout(o,1e4)});return{initial:e,promise:t}}function K(e){var t=document.createElement("canvas"),i=t.getContext("2d");for(t.width=e,t.height=e/2;t.width>1024;){i.fillStyle="white",i.fillRect(0,0,1,1);try{if(i.getImageData(0,0,1,1).data[0]>0)return t.width}catch(e){}t.width/=2,t.height/=2}throw new He("Unable to detect system capabilities")}function G(){return"exitFullscreen"in document?"fullscreenchange":"webkitExitFullscreen"in document?"webkitfullscreenchange":null}function Q(e){var t=0;switch(e){case 0:t=90;break;case 1:t=-90;break;case 3:t=180;break;default:t=0}return Ie.arrow.replace("rotate(0","rotate(".concat(t))}function $(e){if(e)for(var t=0,i=[["_",e]].concat(_toConsumableArray(Object.entries(e)));t1&&void 0!==arguments[1]?arguments[1]:1;this.mode=2,this.target=this.wrap?i(e,this.max):Ye.MathUtils.clamp(e,this.min,this.max),this.speedMult=t}},{key:"step",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;0===t?this.setValue(this.current+e):(2!==this.mode&&(this.target=this.current),this.goto(this.target+e,t))}},{key:"roll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.mode=1,this.target=e?-1/0:1/0,this.speedMult=t}},{key:"stop",value:function(){this.mode=0}},{key:"setValue",value:function(e){return this.target=this.wrap?i(e,this.max):Ye.MathUtils.clamp(e,this.min,this.max),this.mode=0,this.currentSpeed=0,this.target!==this.current&&(this.current=this.target,this.fn&&this.fn(this.current),!0)}},{key:"update",value:function(e){if(2===this.mode){this.wrap&&Math.abs(this.target-this.current)>this.max/2&&(this.current=this.currentn&&(this.currentSpeed=Math.max(n,this.currentSpeed-e/1e3*this.speed*this.speedMult*2));var r=null;return this.current>this.target&&this.currentSpeed?r=Math.max(this.target,this.current+this.currentSpeed*e/1e3):this.current1&&void 0!==arguments[1]?arguments[1]:1,i=0,n=Object.entries(e);i1&&void 0!==arguments[1]?arguments[1]:1;if(0===i)this.setValue(Object.keys(e).reduce(function(i,n){return i[n]=e[n]+t.dynamics[n].current,i},{}));else for(var n=0,r=Object.entries(e);n1&&void 0!==arguments[1]?arguments[1]:1,i=0,n=Object.entries(e);i0&&void 0!==arguments[0]?arguments[0]:200;_classCallCheck(this,e),this.delay=t,this.time=0,this.delay=t}return _createClass(e,[{key:"pending",get:function(){return 0!==this.time}},{key:"down",value:function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0),this.time=(new Date).getTime()}},{key:"up",value:function(e){var t=this;if(this.time){var i=Date.now()-this.time;i1&&void 0!==arguments[1]&&arguments[1];return _classCallCheck(this,t),i.call(this,e,{cancelable:n})}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(_wrapNativeSuper(Event)),$e=function(e){function t(){return _classCallCheck(this,t),i.apply(this,arguments)}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"dispatchEvent",value:function(e){return _get(_getPrototypeOf(t.prototype),"dispatchEvent",this).call(this,e)}},{key:"addEventListener",value:function(e,i,n){_get(_getPrototypeOf(t.prototype),"addEventListener",this).call(this,e,i,n)}},{key:"removeEventListener",value:function(e,i,n){_get(_getPrototypeOf(t.prototype),"removeEventListener",this).call(this,e,i,n)}}]),t}(_wrapNativeSuper(EventTarget)),Je=function(e){function t(){return _classCallCheck(this,t),i.apply(this,arguments)}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(Qe),et=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,t.type,!0),r.position=e,r.zoomLevel=n,r}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(Je),tt=et;tt.type="before-animate";var it=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,t.type),r.timestamp=e,r.elapsed=n,r}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(Je),nt=it;nt.type="before-render";var rt=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,t.type,!0),n.position=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(Je),ot=rt;ot.type="before-rotate";var at=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,t.type),n.data=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(Je),st=at;st.type="click";var lt=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,t.type),n.options=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"containsOptions",value:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=(i.additionalUniforms,i.overrideVertexShader);return new ti.ShaderMaterial({uniforms:(t={},_defineProperty(t,e.OVERLAY_UNIFORMS.panorama,{value:new ti.Texture}),_defineProperty(t,e.OVERLAY_UNIFORMS.overlay,{value:new ti.Texture}),_defineProperty(t,e.OVERLAY_UNIFORMS.globalOpacity,{value:1}),_defineProperty(t,e.OVERLAY_UNIFORMS.overlayOpacity,{value:1}),t),vertexShader:n||"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D ".concat(e.OVERLAY_UNIFORMS.panorama,";\nuniform sampler2D ").concat(e.OVERLAY_UNIFORMS.overlay,";\nuniform float ").concat(e.OVERLAY_UNIFORMS.globalOpacity,";\nuniform float ").concat(e.OVERLAY_UNIFORMS.overlayOpacity,";\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 tColor1 = texture2D( ").concat(e.OVERLAY_UNIFORMS.panorama,", vUv );\n vec4 tColor2 = texture2D( ").concat(e.OVERLAY_UNIFORMS.overlay,", vUv );\n gl_FragColor = vec4(\n mix( tColor1.rgb, tColor2.rgb, tColor2.a * ").concat(e.OVERLAY_UNIFORMS.overlayOpacity," ),\n ").concat(e.OVERLAY_UNIFORMS.globalOpacity,"\n );\n}")})}}]),e}(),ni=ii;ni.supportsDownload=!1,ni.supportsOverlay=!1,ni.OVERLAY_UNIFORMS={panorama:"panorama",overlay:"overlay",globalOpacity:"globalOpacity",overlayOpacity:"overlayOpacity"};var ri=se(),oi="".concat(Oe,"_touchSupport"),ai={loaded:!1,pixelRatio:1,isWebGLSupported:!1,maxTextureWidth:0,isTouchEnabled:null,fullscreenEvent:null,__maxCanvasWidth:null,get maxCanvasWidth(){return null===this.__maxCanvasWidth&&(this.__maxCanvasWidth=K(this.maxTextureWidth)),this.__maxCanvasWidth},load:function(){if(!this.loaded){var e=Z();this.pixelRatio=window.devicePixelRatio||1,this.isWebGLSupported=null!==e,this.maxTextureWidth=e?e.getParameter(e.MAX_TEXTURE_SIZE):0,this.isTouchEnabled=q(),this.fullscreenEvent=G(),this.loaded=!0}if(!ai.isWebGLSupported)throw new He("WebGL is not supported.");if(0===ai.maxTextureWidth)throw new He("Unable to detect system capabilities")}},si=B({resolution:64,blur:!1},{resolution:function(e){if(!e||!ri.MathUtils.isPowerOfTwo(e))throw new He("EquirectangularAdapter resolution must be power of two");return e}}),li=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e),r.config=si(n),r.SPHERE_SEGMENTS=r.config.resolution,r.SPHERE_HORIZONTAL_SEGMENTS=r.SPHERE_SEGMENTS/2,r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"supportsTransition",value:function(){return!0}},{key:"supportsPreload",value:function(){return!0}},{key:"loadTexture",value:async function(e,t){var i,n,r,o,a,s,l,c,u,h,d,v,p,f,y,m,g,_,w,b,k=this,E=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.viewer.config.useXmpData;if("string"!=typeof e)return Promise.reject(new He("Invalid panorama url, are you using the right adapter?"));E?(b=await this.loadXMP(e,function(e){return k.viewer.loader.setProgress(e)}),w=await this.viewer.textureLoader.loadImage(e)):w=await this.viewer.textureLoader.loadImage(e,function(e){return k.viewer.loader.setProgress(e)}),"function"==typeof t&&(t=t(w));var C={fullWidth:O(null===(i=t)||void 0===i?void 0:i.fullWidth,null===(n=b)||void 0===n?void 0:n.fullWidth,w.width),fullHeight:O(null===(r=t)||void 0===r?void 0:r.fullHeight,null===(o=b)||void 0===o?void 0:o.fullHeight,w.height),croppedWidth:O(null===(a=t)||void 0===a?void 0:a.croppedWidth,null===(s=b)||void 0===s?void 0:s.croppedWidth,w.width),croppedHeight:O(null===(l=t)||void 0===l?void 0:l.croppedHeight,null===(c=b)||void 0===c?void 0:c.croppedHeight,w.height),croppedX:O(null===(u=t)||void 0===u?void 0:u.croppedX,null===(h=b)||void 0===h?void 0:h.croppedX,0),croppedY:O(null===(d=t)||void 0===d?void 0:d.croppedY,null===(v=b)||void 0===v?void 0:v.croppedY,0),poseHeading:O(null===(p=t)||void 0===p?void 0:p.poseHeading,null===(f=b)||void 0===f?void 0:f.poseHeading,0),posePitch:O(null===(y=t)||void 0===y?void 0:y.posePitch,null===(m=b)||void 0===m?void 0:m.posePitch,0),poseRoll:O(null===(g=t)||void 0===g?void 0:g.poseRoll,null===(_=b)||void 0===_?void 0:_.poseRoll,0)};C.croppedWidth===w.width&&C.croppedHeight===w.height||R("Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image.\n panoData: ".concat(C.croppedWidth,"x").concat(C.croppedHeight,", image: ").concat(w.width,"x").concat(w.height)),(t||b)&&C.fullWidth!==2*C.fullHeight&&R("Invalid panoData, fullWidth should be twice fullHeight");var T=this.createEquirectangularTexture(w,C);return{panorama:e,texture:T,panoData:C}}},{key:"loadXMP",value:async function(e,t){var i=await this.viewer.textureLoader.loadFile(e,t),n=await this.loadBlobAsString(i),r=n.indexOf(""),a=n.substring(r,o);return-1!==r&&-1!==o&&a.includes("GPano:")?{fullWidth:N(a,"FullPanoWidthPixels"),fullHeight:N(a,"FullPanoHeightPixels"),croppedWidth:N(a,"CroppedAreaImageWidthPixels"),croppedHeight:N(a,"CroppedAreaImageHeightPixels"),croppedX:N(a,"CroppedAreaLeftPixels"),croppedY:N(a,"CroppedAreaTopPixels"),poseHeading:N(a,"PoseHeadingDegrees"),posePitch:N(a,"PosePitchDegrees"),poseRoll:N(a,"PoseRollDegrees")}:null}},{key:"loadBlobAsString",value:function(e){return new Promise(function(t,i){var n=new FileReader;n.onload=function(){return t(n.result)},n.onerror=i,n.readAsText(e)})}},{key:"createEquirectangularTexture",value:function(e,t){if(this.config.blur||t.fullWidth>ai.maxTextureWidth||t.croppedWidth!==t.fullWidth||t.croppedHeight!==t.fullHeight){var i=Math.min(1,ai.maxCanvasWidth/t.fullWidth),n={fullWidth:t.fullWidth*i,fullHeight:t.fullHeight*i,croppedWidth:t.croppedWidth*i,croppedHeight:t.croppedHeight*i,croppedX:t.croppedX*i,croppedY:t.croppedY*i},r=document.createElement("canvas");r.width=n.fullWidth,r.height=n.fullHeight;var o=r.getContext("2d");return this.config.blur&&(o.filter="blur(1px)"),o.drawImage(e,n.croppedX,n.croppedY,n.croppedWidth,n.croppedHeight),W(r)}return W(e)}},{key:"createMesh",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=new ri.SphereGeometry(Pe*e,this.SPHERE_SEGMENTS,this.SPHERE_HORIZONTAL_SEGMENTS,-Math.PI/2).scale(-1,1,1),i=ni.createOverlayMaterial();return new ri.Mesh(t,i)}},{key:"setTexture",value:function(e,t){this.__setUniform(e,ni.OVERLAY_UNIFORMS.panorama,t.texture),this.setOverlay(e,null,1)}},{key:"setOverlay",value:function(e,t,i){this.__setUniform(e,ni.OVERLAY_UNIFORMS.overlayOpacity,i),t?this.__setUniform(e,ni.OVERLAY_UNIFORMS.overlay,t.texture):this.__setUniform(e,ni.OVERLAY_UNIFORMS.overlay,new ri.Texture)}},{key:"setTextureOpacity",value:function(e,t){this.__setUniform(e,ni.OVERLAY_UNIFORMS.globalOpacity,t),e.material.transparent=t<1}},{key:"disposeTexture",value:function(e){var t;null===(t=e.texture)||void 0===t||t.dispose()}},{key:"__setUniform",value:function(e,t,i){_instanceof(e.material.uniforms[t].value,ri.Texture)&&e.material.uniforms[t].value.dispose(),e.material.uniforms[t].value=i}}]),t}(ni);li.id="equirectangular",li.supportsDownload=!0,li.supportsOverlay=!0;var ci=function(){function e(t,i){_classCallCheck(this,e),this.parent=t,this.children=[],this.container=document.createElement("div"),this.state={visible:!0},this.viewer=_instanceof(t,e)?t.viewer:t,this.container.className=i.className||"",this.parent.children.push(this),this.parent.container.appendChild(this.container)}return _createClass(e,[{key:"destroy",value:function(){this.parent.container.removeChild(this.container);var e=this.parent.children.indexOf(this);-1!==e&&this.parent.children.splice(e,1),this.children.slice().forEach(function(e){return e.destroy()}),this.children.length=0}},{key:"toggle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this.isVisible();e?this.show():this.hide()}},{key:"hide",value:function(e){this.container.style.display="none",this.state.visible=!1}},{key:"show",value:function(e){this.container.style.display="",this.state.visible=!0}},{key:"isVisible",value:function(){return this.state.visible}}]),e}(),ui=B({id:null,className:null,title:null,hoverScale:!1,collapsable:!1,tabbable:!0,icon:null,iconActive:null}),hi=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-button ".concat(n.hoverScale?"psv-button--hover-scale":""," ").concat(n.className||"")}),r.state={visible:!0,enabled:!0,supported:!0,collapsed:!1,active:!1,width:0},r.config=ui(n),r.config.id=r.constructor.id,n.icon&&r.__setIcon(n.icon),r.state.width=r.container.offsetWidth,r.config.title?r.container.title=r.config.title:r.id&&r.id in r.viewer.config.lang&&(r.container.title=r.viewer.config.lang[r.id]),n.tabbable&&(r.container.tabIndex=0),r.container.addEventListener("click",function(e){r.state.enabled&&r.onClick(),e.stopPropagation()}),r.container.addEventListener("keydown",function(e){e.key===xe.Enter&&r.state.enabled&&(r.onClick(),e.stopPropagation())}),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"id",get:function(){return this.config.id}},{key:"title",get:function(){return this.container.title}},{key:"content",get:function(){return this.container.innerHTML}},{key:"width",get:function(){return this.state.width}},{key:"collapsable",get:function(){return this.config.collapsable}},{key:"show",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isVisible()||(this.state.visible=!0,this.state.collapsed||(this.container.style.display=""),e&&this.viewer.navbar.autoSize())}},{key:"hide",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isVisible()&&(this.state.visible=!1,this.container.style.display="none",e&&this.viewer.navbar.autoSize())}},{key:"checkSupported",value:function(){var e=this;x(this.isSupported(),function(t,i){e.state&&(e.state.supported=t,i?t||e.hide():e.toggle(t))})}},{key:"autoSize",value:function(){}},{key:"isSupported",value:function(){return!0}},{key:"toggleActive",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this.state.active;e!==this.state.active&&(this.state.active=e,u(this.container,"psv-button--active",this.state.active),this.config.iconActive&&this.__setIcon(this.state.active?this.config.iconActive:this.config.icon))}},{key:"disable",value:function(){this.container.classList.add("psv-button--disabled"),this.state.enabled=!1}},{key:"enable",value:function(){this.container.classList.remove("psv-button--disabled"),this.state.enabled=!0}},{key:"collapse",value:function(){this.state.collapsed=!0,this.container.style.display="none"}},{key:"uncollapse",value:function(){this.state.collapsed=!1,this.state.visible&&(this.container.style.display="")}},{key:"__setIcon",value:function(e){this.container.innerHTML=e,h(this.container.querySelector("svg"),"psv-button-svg")}}]),t}(ci),di=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-custom-button ".concat(n.className||""),hoverScale:!1,collapsable:!1!==n.collapsable,tabbable:!1!==n.tabbable,title:n.title}),r.customOnClick=n.onClick,n.id?r.config.id=n.id:r.config.id="psvButton-"+Math.random().toString(36).substring(2),n.content&&(r.container.innerHTML=n.content),r.state.width=r.container.offsetWidth,n.disabled&&r.disable(),!1===n.visible&&r.hide(),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"onClick",value:function(){var e;null===(e=this.customOnClick)||void 0===e||e.call(this,this.viewer)}}]),t}(hi),vi=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-description-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:Ie.info}),n.mode=0,n.viewer.addEventListener(ft.type,_assertThisInitialized(n)),n.viewer.addEventListener(Rt.type,_assertThisInitialized(n)),n.viewer.addEventListener(_t.type,_assertThisInitialized(n)),n.viewer.addEventListener(Dt.type,_assertThisInitialized(n)),n.viewer.addEventListener(ct.type,_assertThisInitialized(n)),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(ft.type,this),this.viewer.removeEventListener(Rt.type,this),this.viewer.removeEventListener(_t.type,this),this.viewer.removeEventListener(Dt.type,this),this.viewer.removeEventListener(ct.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){if(_instanceof(e,ct))e.containsOptions("description")&&this.autoSize(!0);else if(this.mode){var t=!1;_instanceof(e,ft)?t=1===this.mode:_instanceof(e,Rt)?t=1===this.mode&&e.notificationId!==Le.DESCRIPTION:_instanceof(e,_t)?t=2===this.mode:_instanceof(e,Dt)&&(t=2===this.mode&&e.panelId!==Le.DESCRIPTION),t&&(this.toggleActive(!1),this.mode=0)}}},{key:"onClick",value:function(){this.mode?this.__close():this.__open()}},{key:"hide",value:function(e){_get(_getPrototypeOf(t.prototype),"hide",this).call(this,e),this.mode&&this.__close()}},{key:"autoSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e){var t=this.viewer.navbar.getButton("caption",!1),i=t&&!t.isVisible(),n=!!this.viewer.config.description;i||n?this.show(!1):this.hide(!1)}}},{key:"__close",value:function(){switch(this.mode){case 1:this.viewer.notification.hide(Le.DESCRIPTION);break;case 2:this.viewer.panel.hide(Le.DESCRIPTION)}}},{key:"__open",value:function(){this.toggleActive(!0),this.viewer.config.description?(this.mode=2,this.viewer.panel.show({id:Le.DESCRIPTION,content:(this.viewer.config.caption?"

".concat(this.viewer.config.caption,"

"):"")+this.viewer.config.description})):(this.mode=1,this.viewer.notification.show({id:Le.DESCRIPTION,content:this.viewer.config.caption}))}}]),t}(hi);vi.id="description";var pi=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-download-butto",hoverScale:!0,collapsable:!0,tabbable:!0,icon:Ie.download}),n.viewer.addEventListener(ct.type,_assertThisInitialized(n)),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(ct.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,ct)&&e.containsOptions("downloadUrl")&&this.checkSupported()}},{key:"onClick",value:function(){var e=this,t=document.createElement("a");t.href=this.viewer.config.downloadUrl||this.viewer.config.panorama,t.href.startsWith("data:")&&!this.viewer.config.downloadName?t.download="panorama."+t.href.substring(0,t.href.indexOf(";")).split("/").pop():t.download=this.viewer.config.downloadName||t.href.split("/").pop(),this.viewer.container.appendChild(t),t.click(),setTimeout(function(){e.viewer.container.removeChild(t)},100)}},{key:"checkSupported",value:function(){var e=this.viewer.adapter.constructor.supportsDownload||this.viewer.config.downloadUrl;e?this.show():this.hide()}}]),t}(hi);pi.id="download";var fi=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-fullscreen-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:Ie.fullscreenIn,iconActive:Ie.fullscreenOut}),n.viewer.addEventListener(vt.type,_assertThisInitialized(n)),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(vt.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,vt)&&this.toggleActive(e.fullscreenEnabled)}},{key:"onClick",value:function(){this.viewer.toggleFullscreen()}}]),t}(hi);fi.id="fullscreen";var yi="psvButton",mi=function(e,t){return'\n
\n

'.concat(Ie.menu," ").concat(t,'

\n
    \n ').concat(e.map(function(e){return'\n
  • \n ').concat(e.content,'\n ').concat(e.title,"\n
  • \n ")}).join(""),"\n
\n
\n")},gi=function(e){function t(e){var n,r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-menu-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:Ie.menu}),r.viewer.addEventListener(Dt.type,_assertThisInitialized(r)),r.viewer.addEventListener(_t.type,_assertThisInitialized(r)),_get((n=_assertThisInitialized(r),_getPrototypeOf(t.prototype)),"hide",n).call(n),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(Dt.type,this),this.viewer.removeEventListener(_t.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,Dt)?this.toggleActive(e.panelId===Le.MENU):_instanceof(e,_t)&&this.toggleActive(!1)}},{key:"onClick",value:function(){this.state.active?this.__hideMenu():this.__showMenu()}},{key:"hide",value:function(e){_get(_getPrototypeOf(t.prototype),"hide",this).call(this,e),this.__hideMenu()}},{key:"show",value:function(e){_get(_getPrototypeOf(t.prototype),"show",this).call(this,e),this.state.active&&this.__showMenu()}},{key:"__showMenu",value:function(){var e=this;this.viewer.panel.show({id:Le.MENU,content:mi(this.viewer.navbar.collapsed,this.viewer.config.lang.menu),noMargin:!0,clickHandler:function(t){var i=t?p(t,"li"):void 0,n=i?i.dataset[yi]:void 0;n&&(e.viewer.navbar.getButton(n).onClick(),e.__hideMenu())}})}},{key:"__hideMenu",value:function(){this.viewer.panel.hide(Le.MENU)}}]),t}(hi);gi.id="menu";var _i=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-move-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:Q(n)}),r.direction=n,r.handler=new Ze,r.container.addEventListener("mousedown",_assertThisInitialized(r)),r.container.addEventListener("keydown",_assertThisInitialized(r)),r.container.addEventListener("keyup",_assertThisInitialized(r)),r.viewer.container.addEventListener("mouseup",_assertThisInitialized(r)),r.viewer.container.addEventListener("touchend",_assertThisInitialized(r)),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.__onMouseUp(),this.viewer.container.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchend",this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case"mousedown":this.__onMouseDown();break;case"mouseup":case"touchend":this.__onMouseUp();break;case"keydown":e.key===xe.Enter&&this.__onMouseDown();break;case"keyup":e.key===xe.Enter&&this.__onMouseUp()}}},{key:"onClick",value:function(){}},{key:"isSupported",value:function(){return I(ai.isTouchEnabled)}},{key:"__onMouseDown",value:function(){if(this.state.enabled){var e={};switch(this.direction){case 0:e.pitch=!1;break;case 1:e.pitch=!0;break;case 3:e.yaw=!1;break;default:e.yaw=!0}this.viewer.stopAll(),this.viewer.dynamics.position.roll(e),this.handler.down()}}},{key:"__onMouseUp",value:function(){var e=this;this.state.enabled&&this.handler.up(function(){e.viewer.dynamics.position.stop(),e.viewer.resetIdleTimer()})}}]),t}(hi);_i.groupId="move";var wi=function(e){function t(e){return _classCallCheck(this,t),i.call(this,e,1)}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(_i);wi.id="moveDown";var bi=function(e){function t(e){return _classCallCheck(this,t),i.call(this,e,2)}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(_i);bi.id="moveLeft";var ki=function(e){function t(e){return _classCallCheck(this,t),i.call(this,e,3)}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(_i);ki.id="moveRight";var Ei=function(e){function t(e){return _classCallCheck(this,t),i.call(this,e,0)}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(_i);Ei.id="moveUp";var Ci=function(e){function t(e,n,r){var o;return _classCallCheck(this,t),o=i.call(this,e,{className:"psv-zoom-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:r}),o.direction=n,o.handler=new Ze,o.container.addEventListener("mousedown",_assertThisInitialized(o)),o.container.addEventListener("keydown",_assertThisInitialized(o)),o.container.addEventListener("keyup",_assertThisInitialized(o)),o.viewer.container.addEventListener("mouseup",_assertThisInitialized(o)),o.viewer.container.addEventListener("touchend",_assertThisInitialized(o)),o}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.__onMouseUp(),this.viewer.container.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchend",this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case"mousedown":this.__onMouseDown();break;case"mouseup":case"touchend":this.__onMouseUp();break;case"keydown":e.key===xe.Enter&&this.__onMouseDown();break;case"keyup":e.key===xe.Enter&&this.__onMouseUp()}}},{key:"onClick",value:function(){}},{key:"isSupported",value:function(){return I(ai.isTouchEnabled)}},{key:"__onMouseDown",value:function(){this.state.enabled&&(this.viewer.dynamics.zoom.roll(1===this.direction),this.handler.down())}},{key:"__onMouseUp",value:function(){var e=this;this.state.enabled&&this.handler.up(function(){return e.viewer.dynamics.zoom.stop()})}}]),t}(hi);Ci.groupId="zoom";var Ti=function(e){function t(e){return _classCallCheck(this,t),i.call(this,e,0,Ie.zoomIn)}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(Ci);Ti.id="zoomIn";var Si=function(e){function t(e){return _classCallCheck(this,t),i.call(this,e,1,Ie.zoomOut)}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(Ci);Si.id="zoomOut";var Pi=function(e){function t(e){var n ;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-zoom-range",hoverScale:!1,collapsable:!1,tabbable:!1}),n.zoomRange=document.createElement("div"),n.zoomRange.className="psv-zoom-range-line",n.container.appendChild(n.zoomRange),n.zoomValue=document.createElement("div"),n.zoomValue.className="psv-zoom-range-handle",n.zoomRange.appendChild(n.zoomValue),n.slider=new Ke(n.container,"HORIZONTAL",function(e){return n.__onSliderUpdate(e)}),n.mediaMinWidth=parseInt(y(n.container,"maxWidth"),10),n.viewer.addEventListener(Zt.type,_assertThisInitialized(n)),n.viewer.state.ready?n.__moveZoomValue(n.viewer.getZoomLevel()):n.viewer.addEventListener(xt.type,_assertThisInitialized(n)),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.slider.destroy(),this.viewer.removeEventListener(Zt.type,this),this.viewer.removeEventListener(xt.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,Zt)?this.__moveZoomValue(e.zoomLevel):_instanceof(e,xt)&&this.__moveZoomValue(this.viewer.getZoomLevel())}},{key:"onClick",value:function(){}},{key:"isSupported",value:function(){return I(ai.isTouchEnabled)}},{key:"autoSize",value:function(){this.state.supported&&(this.viewer.state.size.width<=this.mediaMinWidth&&this.state.visible?this.hide(!1):this.viewer.state.size.width>this.mediaMinWidth&&!this.state.visible&&this.show(!1))}},{key:"__moveZoomValue",value:function(e){this.zoomValue.style.left=e/100*this.zoomRange.offsetWidth-this.zoomValue.offsetWidth/2+"px"}},{key:"__onSliderUpdate",value:function(e){e.mousedown&&this.viewer.zoom(100*e.value)}}]),t}(hi);Pi.id="zoomRange",Pi.groupId="zoom";var Oi=se(),Mi=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this),n.viewer=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}($e),Li=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e),r.config=r.constructor.configParser(n),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"setOption",value:function(e,t){this.setOptions(_defineProperty({},e,t))}},{key:"setOptions",value:function(e){for(var t={...this.config,...e},i=this.constructor,n=i.configParser,r=i.readonlyOptions,o=i.id,a=0,s=Object.entries(e);a=this.contentWidth),this.__refreshButton()}},{key:"__refreshButton",value:function(){var e;null===(e=this.viewer.navbar.getButton(vi.id,!1))||void 0===e||e.autoSize(!0)}}]),t}(hi);Ri.id="caption";var Hi={},Ni={};[Si,Pi,Ti,vi,Ri,pi,fi,bi,ki,Ei,wi].forEach(function(e){return J(e)});var Vi=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-navbar psv--capture-event"}),n.collapsed=[],n.state.visible=!1,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"show",value:function(){this.container.classList.add("psv-navbar--open"),this.state.visible=!0}},{key:"hide",value:function(){this.container.classList.remove("psv-navbar--open"),this.state.visible=!1}},{key:"setButtons",value:function(e){var t=this;this.children.slice().forEach(function(e){return e.destroy()}),this.children.length=0,-1!==e.indexOf(Ri.id)&&-1===e.indexOf(vi.id)&&e.splice(e.indexOf(Ri.id),0,vi.id),e.forEach(function(e){"object"===_typeof(e)?new di(t,e):Hi[e]?new Hi[e](t):Ni[e]?Ni[e].forEach(function(e){new e(t)}):R("Unknown button ".concat(e))}),new gi(this),this.children.forEach(function(e){_instanceof(e,hi)&&e.checkSupported()}),this.autoSize()}},{key:"setCaption",value:function(e){this.children.some(function(t){return!!_instanceof(t,Ri)&&(t.setCaption(e),!0)})}},{key:"getButton",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.children.find(function(t){return _instanceof(t,hi)&&t.id===e});return!i&&t&&R('button "'.concat(e,'" not found in the navbar')),i}},{key:"autoSize",value:function(){var e;this.children.forEach(function(e){_instanceof(e,hi)&&e.autoSize()});var t=this.container.offsetWidth,i=0,n=[];this.children.forEach(function(e){e.isVisible()&&_instanceof(e,hi)&&(i+=e.width,e.collapsable&&n.push(e))}),0!==i&&(t0?(n.forEach(function(e){return e.collapse()}),this.collapsed=n,this.getButton(gi.id).show(!1)):t>=i&&this.collapsed.length>0&&(this.collapsed.forEach(function(e){return e.uncollapse()}),this.collapsed=[],this.getButton(gi.id).hide(!1)),null===(e=this.getButton(Ri.id,!1))||void 0===e||e.autoSize())}}]),t}(ci),Di=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-loader-container"}),n.loader=document.createElement("div"),n.loader.className="psv-loader",n.container.appendChild(n.loader),n.size=n.loader.offsetWidth,n.canvas=document.createElementNS("http://www.w3.org/2000/svg","svg"),n.canvas.setAttribute("class","psv-loader-canvas"),n.canvas.setAttribute("viewBox","0 0 ".concat(n.size," ").concat(n.size)),n.loader.appendChild(n.canvas),n.textColor=y(n.loader,"color"),n.color=y(n.canvas,"color"),n.border=parseInt(y(n.loader,"outlineWidth"),10),n.thickness=parseInt(y(n.canvas,"outlineWidth"),10),n.viewer.addEventListener(ct.type,_assertThisInitialized(n)),n.__updateContent(),n.hide(),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(ct.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,ct)&&e.containsOptions("loadingImg","loadingTxt")&&this.__updateContent()}},{key:"setProgress",value:function(e){var t=Math.min(e,99.999)/100*Math.PI*2,i=this.size/2,n=i,r=this.thickness/2+this.border,o=(this.size-this.thickness)/2-this.border,a=Math.sin(t)*o+i,s=-Math.cos(t)*o+i,l=e>50?"1":"0";this.canvas.innerHTML='\n \n \n '),this.viewer.dispatchEvent(new Tt(Math.round(e)))}},{key:"__updateContent",value:function(){var e,t=this.loader.querySelector(".psv-loader-image, .psv-loader-text");if(t&&this.loader.removeChild(t),this.viewer.config.loadingImg?(e=document.createElement("img"),e.className="psv-loader-image",e.src=this.viewer.config.loadingImg):this.viewer.config.loadingTxt&&(e=document.createElement("div"),e.className="psv-loader-text",e.innerHTML=this.viewer.config.loadingTxt),e){var i=Math.round(Math.sqrt(2*Math.pow(this.size/2-this.thickness/2-this.border,2)));e.style.maxWidth=i+"px",e.style.maxHeight=i+"px",this.loader.appendChild(e)}}}]),t}(ci),ji=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-notification"}),n.state={visible:!1,contentId:null,timeout:null},n.content=document.createElement("div"),n.content.className="psv-notification-content",n.container.appendChild(n.content),n.content.addEventListener("click",function(){return n.hide()}),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"isVisible",value:function(e){return this.state.visible&&(!e||!this.state.contentId||this.state.contentId===e)}},{key:"toggle",value:function(){throw new He("Notification cannot be toggled")}},{key:"show",value:function(e){var t=this;this.state.timeout&&(clearTimeout(this.state.timeout),this.state.timeout=null),"string"==typeof e&&(e={content:e}),this.state.contentId=e.id||null,this.content.innerHTML=e.content,this.container.classList.add("psv-notification--visible"),this.state.visible=!0,this.viewer.dispatchEvent(new Rt(e.id)),e.timeout&&(this.state.timeout=setTimeout(function(){return t.hide(t.state.contentId)},e.timeout))}},{key:"hide",value:function(e){if(this.isVisible(e)){var t=this.state.contentId;this.container.classList.remove("psv-notification--visible"),this.state.visible=!1,this.state.contentId=null,this.viewer.dispatchEvent(new ft(t))}}}]),t}(ci),Ui=function(e){function t(e){var n,r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-overlay"}),r.state={visible:!1,contentId:null,dissmisable:!0},r.image=document.createElement("div"),r.image.className="psv-overlay-image",r.container.appendChild(r.image),r.title=document.createElement("div"),r.title.className="psv-overlay-title",r.container.appendChild(r.title),r.text=document.createElement("div"),r.text.className="psv-overlay-text",r.container.appendChild(r.text),r.viewer.addEventListener(st.type,_assertThisInitialized(r)),r.viewer.addEventListener(Et.type,_assertThisInitialized(r)),_get((n=_assertThisInitialized(r),_getPrototypeOf(t.prototype)),"hide",n).call(n),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(st.type,this),this.viewer.removeEventListener(Et.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,st)?this.isVisible()&&this.state.dissmisable&&(this.hide(),e.stopPropagation()):_instanceof(e,Et)&&this.isVisible()&&this.state.dissmisable&&e.key===xe.Escape&&(this.hide(),e.preventDefault())}},{key:"isVisible",value:function(e){return this.state.visible&&(!e||!this.state.contentId||this.state.contentId===e)}},{key:"toggle",value:function(){throw new He("Overlay cannot be toggled")}},{key:"show",value:function(e){"string"==typeof e&&(e={title:e}),this.state.contentId=e.id||null,this.state.dissmisable=!1!==e.dissmisable,this.image.innerHTML=e.image||"",this.title.innerHTML=e.title||"",this.text.innerHTML=e.text||"",_get(_getPrototypeOf(t.prototype),"show",this).call(this),this.viewer.dispatchEvent(new Nt(e.id))}},{key:"hide",value:function(e){if(this.isVisible(e)){var i=this.state.contentId;_get(_getPrototypeOf(t.prototype),"hide",this).call(this),this.state.contentId=null,this.viewer.dispatchEvent(new mt(i))}}}]),t}(ci),Fi=200,Wi="psv-panel-content--no-interaction",Yi=function(e){function t(e){var n;_classCallCheck(this,t),n=i.call(this,e,{className:"psv-panel psv--capture-event"}),n.state={visible:!1,contentId:null,mouseX:0,mouseY:0,mousedown:!1,clickHandler:null,keyHandler:null,width:{}};var r=document.createElement("div");r.className="psv-panel-resizer",n.container.appendChild(r);var o=document.createElement("div");return o.className="psv-panel-close-button",o.innerHTML=Ie.close,o.title=e.config.lang.close,n.container.appendChild(o),n.content=document.createElement("div"),n.content.className="psv-panel-content",n.container.appendChild(n.content),n.container.addEventListener("wheel",function(e){return e.stopPropagation()}),o.addEventListener("click",function(){return n.hide()}),r.addEventListener("mousedown",_assertThisInitialized(n)),r.addEventListener("touchstart",_assertThisInitialized(n)),n.viewer.container.addEventListener("mouseup",_assertThisInitialized(n)),n.viewer.container.addEventListener("touchend",_assertThisInitialized(n)),n.viewer.container.addEventListener("mousemove",_assertThisInitialized(n)),n.viewer.container.addEventListener("touchmove",_assertThisInitialized(n)),n.viewer.addEventListener(Et.type,_assertThisInitialized(n)),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(Et.type,this),this.viewer.container.removeEventListener("mousemove",this),this.viewer.container.removeEventListener("touchmove",this),this.viewer.container.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchend",this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case"mousedown":this.__onMouseDown(e);break;case"touchstart":this.__onTouchStart(e);break;case"mousemove":this.__onMouseMove(e);break;case"touchmove":this.__onTouchMove(e);break;case"mouseup":this.__onMouseUp(e);break;case"touchend":this.__onTouchEnd(e);break;case Et.type:this.__onKeyPress(e)}}},{key:"isVisible",value:function(e){return this.state.visible&&(!e||!this.state.contentId||this.state.contentId===e)}},{key:"toggle",value:function(){throw new He("Panel cannot be toggled")}},{key:"show",value:function(e){var t=this;"string"==typeof e&&(e={content:e});var i=this.isVisible(e.id);this.state.contentId=e.id||null,this.state.visible=!0,this.state.clickHandler&&(this.content.removeEventListener("click",this.state.clickHandler),this.content.removeEventListener("keydown",this.state.keyHandler),this.state.clickHandler=null,this.state.keyHandler=null),e.id&&this.state.width[e.id]?this.container.style.width=this.state.width[e.id]:e.width?this.container.style.width=e.width:this.container.style.width=null,this.content.innerHTML=e.content,this.content.scrollTop=0,this.container.classList.add("psv-panel--open"),u(this.content,"psv-panel-content--no-margin",!0===e.noMargin),e.clickHandler&&(this.state.clickHandler=function(t){e.clickHandler(t.target)},this.state.keyHandler=function(t){t.key===xe.Enter&&e.clickHandler(t.target)},this.content.addEventListener("click",this.state.clickHandler),this.content.addEventListener("keydown",this.state.keyHandler),i||setTimeout(function(){var e;null===(e=t.content.querySelector("a,button,[tabindex]"))||void 0===e||e.focus()},300)),this.viewer.dispatchEvent(new Dt(e.id))}},{key:"hide",value:function(e){if(this.isVisible(e)){var t=this.state.contentId;this.state.visible=!1,this.state.contentId=null,this.content.innerHTML=null,this.container.classList.remove("psv-panel--open"),this.state.clickHandler&&(this.content.removeEventListener("click",this.state.clickHandler),this.state.clickHandler=null),this.viewer.dispatchEvent(new _t(t))}}},{key:"__onMouseDown",value:function(e){e.stopPropagation(),this.__startResize(e.clientX,e.clientY)}},{key:"__onTouchStart",value:function(e){if(e.stopPropagation(),1===e.touches.length){var t=e.touches[0];this.__startResize(t.clientX,t.clientY)}}},{key:"__onMouseUp",value:function(e){this.state.mousedown&&(e.stopPropagation(),this.state.mousedown=!1,this.content.classList.remove(Wi))}},{key:"__onTouchEnd",value:function(e){this.state.mousedown&&(e.stopPropagation(),0===e.touches.length&&(this.state.mousedown=!1,this.content.classList.remove(Wi)))}},{key:"__onMouseMove",value:function(e){this.state.mousedown&&(e.stopPropagation(),this.__resize(e.clientX,e.clientY))}},{key:"__onTouchMove",value:function(e){if(this.state.mousedown){var t=e.touches[0];this.__resize(t.clientX,t.clientY)}}},{key:"__onKeyPress",value:function(e){this.isVisible()&&e.key===xe.Escape&&(this.hide(),e.preventDefault())}},{key:"__startResize",value:function(e,t){this.state.mouseX=e,this.state.mouseY=t,this.state.mousedown=!0,this.content.classList.add(Wi)}},{key:"__resize",value:function(e,t){var i=e,n=t,r=Math.max(Fi,this.container.offsetWidth-(i-this.state.mouseX))+"px";this.state.contentId&&(this.state.width[this.state.contentId]=r),this.container.style.width=r,this.state.mouseX=i,this.state.mouseY=n}}]),t}(ci),Bi=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-tooltip"}),r.state={visible:!0,arrow:0,border:0,state:0,width:0,height:0,pos:"",config:null,data:null},r.content=document.createElement("div"),r.content.className="psv-tooltip-content",r.container.appendChild(r.content),r.arrow=document.createElement("div"),r.arrow.className="psv-tooltip-arrow",r.container.appendChild(r.arrow),r.container.addEventListener("transitionend",_assertThisInitialized(r)),r.container.style.top="-1000px",r.container.style.left="-1000px",r.show(n),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"handleEvent",value:function(e){"transitionend"===e.type&&this.__onTransitionEnd(e)}},{key:"destroy",value:function(){delete this.state.data,_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"toggle",value:function(){throw new He("Tooltip cannot be toggled")}},{key:"show",value:function(e){if(0!==this.state.state)throw new He("Initialized tooltip cannot be re-initialized");e.className&&h(this.container,e.className),this.state.state=3,this.update(e.content,e),this.state.data=e.data,this.state.state=1,this.viewer.dispatchEvent(new Ut(this,this.state.data)),this.__waitImages()}},{key:"update",value:function(e,t){this.content.innerHTML=e;var i=this.container.getBoundingClientRect();this.state.width=i.right-i.left,this.state.height=i.bottom-i.top,this.state.arrow=parseInt(y(this.arrow,"borderTopWidth"),10),this.state.border=parseInt(y(this.container,"borderTopLeftRadius"),10),this.move(null!=t?t:this.state.config)}},{key:"move",value:function(e){if(1!==this.state.state&&3!==this.state.state)throw new He("Uninitialized tooltip cannot be moved");e.box||(e.box={width:0,height:0}),this.state.config=e;var t=this.container,i=this.arrow,n={posClass:D(e.position,{allowCenter:!1,cssOrder:!1})||["top","center"],width:this.state.width,height:this.state.height,top:0,left:0,arrowTop:0,arrowLeft:0};this.__computeTooltipPosition(n,e);var r=null,o=null;if(n.top<0?r="bottom":n.top+n.height>this.viewer.state.size.height&&(r="top"),n.left<0?o="right":n.left+n.width>this.viewer.state.size.width&&(o="left"),o||r){var a=j(n.posClass);r&&(n.posClass[a?0:1]=r),o&&(n.posClass[a?1:0]=o),this.__computeTooltipPosition(n,e)}t.style.top=n.top+"px",t.style.left=n.left+"px",i.style.top=n.arrowTop+"px",i.style.left=n.arrowLeft+"px";var s=n.posClass.join("-");s!==this.state.pos&&(t.classList.remove("psv-tooltip--".concat(this.state.pos)),this.state.pos=s,t.classList.add("psv-tooltip--".concat(this.state.pos)))}},{key:"hide",value:function(){this.container.classList.remove("psv-tooltip--visible"),this.state.state=2,this.viewer.dispatchEvent(new bt(this.state.data))}},{key:"__onTransitionEnd",value:function(e){if("transform"===e.propertyName)switch(this.state.state){case 1:this.container.classList.add("psv-tooltip--visible"),this.state.state=3;break;case 2:this.state.state=0,this.destroy()}}},{key:"__computeTooltipPosition",value:function(e,t){var i=this.state.arrow,n=t.top,r=e.height,o=t.left,a=e.width,s=i+this.state.border,l=t.box.width/2+2*i,c=t.box.height/2+2*i;switch(e.posClass.join("-")){case"top-left":e.top=n-c-r,e.left=o+s-a,e.arrowTop=r,e.arrowLeft=a-s-i;break;case"top-center":e.top=n-c-r,e.left=o-a/2,e.arrowTop=r,e.arrowLeft=a/2-i;break;case"top-right":e.top=n-c-r,e.left=o-s,e.arrowTop=r,e.arrowLeft=i;break;case"bottom-left":e.top=n+c,e.left=o+s-a,e.arrowTop=2*-i,e.arrowLeft=a-s-i;break;case"bottom-center":e.top=n+c,e.left=o-a/2,e.arrowTop=2*-i,e.arrowLeft=a/2-i;break;case"bottom-right":e.top=n+c,e.left=o-s,e.arrowTop=2*-i,e.arrowLeft=i;break;case"left-top":e.top=n+s-r,e.left=o-l-a,e.arrowTop=r-s-i,e.arrowLeft=a;break;case"center-left":e.top=n-r/2,e.left=o-l-a,e.arrowTop=r/2-i,e.arrowLeft=a;break;case"left-bottom":e.top=n-s,e.left=o-l-a,e.arrowTop=i,e.arrowLeft=a;break;case"right-top":e.top=n+s-r,e.left=o+l,e.arrowTop=r-s-i,e.arrowLeft=2*-i;break;case"center-right":e.top=n-r/2,e.left=o+l,e.arrowTop=r/2-i,e.arrowLeft=2*-i;break;case"right-bottom":e.top=n-s,e.left=o+l,e.arrowTop=i,e.arrowLeft=2*-i}}},{key:"__waitImages",value:function(){var e=this,t=this.content.querySelectorAll("img");if(t.length>0){var i=[];t.forEach(function(e){i.push(new Promise(function(t){e.onload=t,e.onerror=t}))}),Promise.all(i).then(function(){if(1===e.state.state||3===e.state.state){var t=e.container.getBoundingClientRect();e.state.width=t.right-t.left,e.state.height=t.bottom-t.top,e.move(e.state.config)}})}}}]),t}(ci),Xi='\n',Zi=se(),qi=function(){function e(t){_classCallCheck(this,e),this.viewer=t,this.config=t.config,this.state=t.state}return _createClass(e,[{key:"destroy",value:function(){}}]),e}(),Ki=new Zi.Vector3,Gi=new Zi.Euler(0,0,0,"ZXY"),Qi=function(e){function t(e){return _classCallCheck(this,t),i.call(this,e)}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"fovToZoomLevel",value:function(e){var t=Math.round((e-this.config.minFov)/(this.config.maxFov-this.config.minFov)*100);return t-2*(t-50)}},{key:"zoomLevelToFov",value:function(e){return this.config.maxFov+e/100*(this.config.minFov-this.config.maxFov)}},{key:"vFovToHFov",value:function(e){return Zi.MathUtils.radToDeg(2*Math.atan(Math.tan(Zi.MathUtils.degToRad(e)/2)*this.state.aspect))}},{key:"speedToDuration",value:function(e,t){if("number"!=typeof e){var i=U(e);return t/Math.abs(i)*1e3}return Math.abs(e)}},{key:"textureCoordsToSphericalCoords",value:function(e){var t=this.state.panoData;if(!t)throw new He("Current adapter does not support texture coordinates.");var i=(e.textureX+t.croppedX)/t.fullWidth*Math.PI*2,n=(e.textureY+t.croppedY)/t.fullHeight*Math.PI,r={yaw:i>=Math.PI?i-Math.PI:i+Math.PI,pitch:Math.PI/2-n};return Gi.equals(this.viewer.renderer.panoramaPose)&&Gi.equals(this.viewer.renderer.sphereCorrection)?r:(this.sphericalCoordsToVector3(r,Ki),Ki.applyEuler(this.viewer.renderer.panoramaPose),Ki.applyEuler(this.viewer.renderer.sphereCorrection),this.vector3ToSphericalCoords(Ki))}},{key:"sphericalCoordsToTextureCoords",value:function(e){var t=this.state.panoData;if(!t)throw new He("Current adapter does not support texture coordinates.");Gi.equals(this.viewer.renderer.panoramaPose)&&Gi.equals(this.viewer.renderer.sphereCorrection)||(this.sphericalCoordsToVector3(e,Ki),Y(Ki,this.viewer.renderer.sphereCorrection),Y(Ki,this.viewer.renderer.panoramaPose),e=this.vector3ToSphericalCoords(Ki));var i=e.yaw/Math.PI/2*t.fullWidth,n=e.pitch/Math.PI*t.fullHeight;return{textureX:Math.round(e.yaw\n',en='\n',tn=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e),n.data={step:0,startMouseX:0,startMouseY:0,mouseX:0,mouseY:0,mouseHistory:[],pinchDist:0,ctrlKeyDown:!1,dblclickData:null,dblclickTimeout:null,longtouchTimeout:null,twofingersTimeout:null,ctrlZoomTimeout:null},n.keyHandler=new Ze,n.resizeObserver=new ResizeObserver(k(function(){return n.viewer.autoSize()},50)),n.moveThreshold=be*ai.pixelRatio,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"init",value:function(){window.addEventListener("keydown",this,{passive:!1}),window.addEventListener("keyup",this),this.viewer.container.addEventListener("mousedown",this),window.addEventListener("mousemove",this,{passive:!1}),window.addEventListener("mouseup",this),this.viewer.container.addEventListener("touchstart",this,{passive:!1}), window.addEventListener("touchmove",this,{passive:!1}),window.addEventListener("touchend",this,{passive:!1}),this.viewer.container.addEventListener("wheel",this,{passive:!1}),document.addEventListener(ai.fullscreenEvent,this),this.resizeObserver.observe(this.viewer.container)}},{key:"destroy",value:function(){window.removeEventListener("keydown",this),window.removeEventListener("keyup",this),this.viewer.container.removeEventListener("mousedown",this),window.removeEventListener("mousemove",this),window.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchstart",this),window.removeEventListener("touchmove",this),window.removeEventListener("touchend",this),this.viewer.container.removeEventListener("wheel",this),document.removeEventListener(ai.fullscreenEvent,this),this.resizeObserver.disconnect(),clearTimeout(this.data.dblclickTimeout),clearTimeout(this.data.longtouchTimeout),clearTimeout(this.data.twofingersTimeout),clearTimeout(this.data.ctrlZoomTimeout),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case"keydown":this.__onKeyDown(e);break;case"keyup":this.__onKeyUp();break;case"mousemove":this.__onMouseMove(e);break;case"mouseup":this.__onMouseUp(e);break;case"touchmove":this.__onTouchMove(e);break;case"touchend":this.__onTouchEnd(e);break;case ai.fullscreenEvent:this.__onFullscreenChange()}if(!p(e.target,".psv--capture-event"))switch(e.type){case"mousedown":this.__onMouseDown(e);break;case"touchstart":this.__onTouchStart(e);break;case"wheel":this.__onMouseWheel(e)}}},{key:"__isStep",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i3&&void 0!==arguments[3]&&arguments[3];this.__isStep(2)?this.config.moveInertia?(this.__logMouseMove(e,t),this.__stopMoveInertia(e,t)):(this.__resetMove(),this.viewer.resetIdleTimer()):this.__isStep(1)&&(this.viewer.stopAnimation(),this.__doClick(e,t,i,n),this.__resetMove(),this.viewer.resetIdleTimer())}},{key:"__stopMoveInertia",value:function(e,t){var i=this,n=new $i.SplineCurve(this.data.mouseHistory.map(function(e){var t=_slicedToArray(e,3),i=t[1],n=t[2];return new $i.Vector2(i,n)})),o=n.getTangent(1),a=this.data.mouseHistory.reduce(function(e,t){var i=e.total,n=e.prev;return{total:n?i+r({x:n[1],y:n[2]},{x:t[1],y:t[2]})/(t[0]-n[0]):0,prev:t}},{total:0,prev:null}).total/this.data.mouseHistory.length;if(!a)return this.__resetMove(),void this.viewer.resetIdleTimer();this.data.step=3;var s=e,l=t;this.state.animation=new We({properties:{speed:{start:a,end:0}},duration:1e3,easing:"outQuad",onTick:function(e){s+=e.speed*o.x*3*ai.pixelRatio,l+=e.speed*o.y*3*ai.pixelRatio,i.__applyMove(s,l)}}),this.state.animation.then(function(e){i.state.animation=null,e&&(i.__resetMove(),i.viewer.resetIdleTimer())})}},{key:"__doClick",value:function(e,t,i){var n=this,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=this.viewer.container.getBoundingClientRect(),a=e-o.left,s=t-o.top,l=this.viewer.renderer.getIntersections({x:a,y:s}),c=l.find(function(e){return e.object.userData[Oe]});if(c){var u=this.viewer.dataHelper.vector3ToSphericalCoords(c.point),h={rightclick:r,target:i,clientX:e,clientY:t,viewerX:a,viewerY:s,yaw:u.yaw,pitch:u.pitch,objects:l.map(function(e){return e.object}).filter(function(e){return!e.userData[Oe]})};try{var d=this.viewer.dataHelper.sphericalCoordsToTextureCoords(h);h.textureX=d.textureX,h.textureY=d.textureY}catch(e){h.textureX=NaN,h.textureY=NaN}this.data.dblclickTimeout?(Math.abs(this.data.dblclickData.clientX-h.clientX)=this.moveThreshold||Math.abs(t-this.data.startMouseY)>=this.moveThreshold)?(this.viewer.stopAll(),this.__resetMove(),this.data.step=2,this.data.mouseX=e,this.data.mouseY=t,this.__logMouseMove(e,t)):this.__isStep(2)&&(this.__applyMove(e,t),this.__logMouseMove(e,t))}},{key:"__applyMove",value:function(e,t){var i={yaw:this.config.moveSpeed*((e-this.data.mouseX)/this.state.size.width)*$i.MathUtils.degToRad(this.state.littlePlanet?90:this.state.hFov),pitch:this.config.moveSpeed*((t-this.data.mouseY)/this.state.size.height)*$i.MathUtils.degToRad(this.state.littlePlanet?90:this.state.vFov)},n=this.viewer.getPosition();this.viewer.rotate({yaw:n.yaw-i.yaw,pitch:n.pitch+i.pitch}),this.data.mouseX=e,this.data.mouseY=t}},{key:"__doMoveZoom",value:function(e){if(this.__isStep(2)){e.preventDefault();var t=m(e),i=(t.distance-this.data.pinchDist)/ai.pixelRatio*this.config.zoomSpeed;this.viewer.zoom(this.viewer.getZoomLevel()+i),this.__doMove(t.center.x,t.center.y),this.data.pinchDist=t.distance}}},{key:"__logMouseMove",value:function(e,t){var i=Date.now(),n=this.data.mouseHistory.length?this.data.mouseHistory[this.data.mouseHistory.length-1]:[0,-1,-1];n[1]===e&&n[2]===t?n[0]=i:i===n[0]?(n[1]=e,n[2]=t):this.data.mouseHistory.push([i,e,t]);for(var r=null,o=0;oSe/10?(this.data.mouseHistory.splice(0,o),o=0,r=this.data.mouseHistory[o][0]):(r=this.data.mouseHistory[o][0],o++)}}]),t}(qi),nn=se(),rn=new nn.Vector2,on=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e),n.renderer=new nn.WebGLRenderer({alpha:!0,antialias:!0}),n.renderer.setPixelRatio(ai.pixelRatio),n.renderer.domElement.className="psv-canvas",n.scene=new nn.Scene,n.camera=new nn.PerspectiveCamera(50,16/9,.1,2*Pe),n.mesh=n.viewer.adapter.createMesh(),n.mesh.userData=_defineProperty({},Oe,!0),n.meshContainer=new nn.Group,n.meshContainer.add(n.mesh),n.scene.add(n.meshContainer),n.raycaster=new nn.Raycaster,n.container=document.createElement("div"),n.container.className="psv-canvas-container",n.container.style.background=n.config.canvasBackground,n.container.appendChild(n.renderer.domElement),n.viewer.container.appendChild(n.container),n.viewer.addEventListener(Wt.type,_assertThisInitialized(n)),n.viewer.addEventListener(Zt.type,_assertThisInitialized(n)),n.viewer.addEventListener(Mt.type,_assertThisInitialized(n)),n.viewer.addEventListener(ct.type,_assertThisInitialized(n)),n.hide(),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"panoramaPose",get:function(){return this.mesh.rotation}},{key:"sphereCorrection",get:function(){return this.meshContainer.rotation}},{key:"init",value:function(){var e=this;this.config.mousemove&&(this.container.style.cursor="move"),this.show(),this.renderer.setAnimationLoop(function(t){return e.__renderLoop(t)})}},{key:"destroy",value:function(){this.renderer.setAnimationLoop(null),this.cleanScene(this.scene),this.viewer.container.removeChild(this.container),this.viewer.removeEventListener(Wt.type,this),this.viewer.removeEventListener(Zt.type,this),this.viewer.removeEventListener(Mt.type,this),this.viewer.removeEventListener(ct.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case Wt.type:this.__onSizeUpdated();break;case Zt.type:this.__onZoomUpdated();break;case Mt.type:this.__onPositionUpdated();break;case ct.type:e.containsOptions("fisheye")&&this.__onPositionUpdated(),e.containsOptions("mousemove")&&(this.container.style.cursor=this.config.mousemove?"move":"default"),e.containsOptions("canvasBackground")&&(this.container.style.background=this.config.canvasBackground)}}},{key:"hide",value:function(){this.container.style.opacity="0"}},{key:"show",value:function(){this.container.style.opacity="1"}},{key:"setCustomRenderer",value:function(e){this.customRenderer=e?e(this.renderer):null,this.viewer.needsUpdate()}},{key:"__onSizeUpdated",value:function(){this.renderer.setSize(this.state.size.width,this.state.size.height),this.camera.aspect=this.state.aspect,this.camera.updateProjectionMatrix(),this.viewer.needsUpdate()}},{key:"__onZoomUpdated",value:function(){this.camera.fov=this.state.vFov,this.camera.updateProjectionMatrix(),this.viewer.needsUpdate()}},{key:"__onPositionUpdated",value:function(){this.camera.position.set(0,0,0),this.camera.lookAt(this.state.direction),this.config.fisheye&&this.camera.position.copy(this.state.direction).multiplyScalar(this.config.fisheye/2).negate(),this.viewer.needsUpdate()}},{key:"__renderLoop",value:function(e){var t=this.timestamp?e-this.timestamp:0;this.timestamp=e,this.viewer.dispatchEvent(new nt(e,t)),this.viewer.dynamics.update(t),this.state.needsUpdate&&((this.customRenderer||this.renderer).render(this.scene,this.camera),this.viewer.dispatchEvent(new zt),this.state.needsUpdate=!1)}},{key:"setTexture",value:function(e){this.state.panoData=e.panoData,this.viewer.adapter.setTexture(this.mesh,e),this.viewer.needsUpdate()}},{key:"setOverlay",value:function(e,t){this.viewer.adapter.setOverlay(this.mesh,e,t),this.viewer.needsUpdate()}},{key:"setPanoramaPose",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mesh,i=this.viewer.dataHelper.cleanPanoramaPose(e);t.rotation.set(-i.tilt,-i.pan,-i.roll,"ZXY")}},{key:"setSphereCorrection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.meshContainer,i=this.viewer.dataHelper.cleanSphereCorrection(e);t.rotation.set(i.tilt,i.pan,i.roll,"ZXY")}},{key:"transition",value:function(e,t){var i=this,n=H(t),r="zoom"in t,o=new nn.Group,a=this.viewer.adapter.createMesh(.5);if(this.viewer.adapter.setTexture(a,e,!0),this.viewer.adapter.setTextureOpacity(a,0),this.setPanoramaPose(e.panoData,a),this.setSphereCorrection(t.sphereCorrection,o),n){var s=this.viewer.dataHelper.cleanPosition(t),l=this.viewer.getPosition(),c=new nn.Vector3(0,1,0);o.rotateOnWorldAxis(c,s.yaw-l.yaw);var u=new nn.Vector3(0,1,0).cross(this.camera.getWorldDirection(new nn.Vector3)).normalize();o.rotateOnWorldAxis(u,s.pitch-l.pitch)}o.add(a),this.scene.add(o),this.renderer.setRenderTarget(new nn.WebGLRenderTarget),this.renderer.render(this.scene,this.camera),this.renderer.setRenderTarget(null);var h=new We({properties:{opacity:{start:0,end:1},zoom:r?{start:this.viewer.getZoomLevel(),end:t.zoom}:void 0},duration:t.transition,easing:"outCubic",onTick:function(e){i.viewer.adapter.setTextureOpacity(a,e.opacity),i.viewer.adapter.setTextureOpacity(i.mesh,1-e.opacity),r&&i.viewer.zoom(e.zoom),i.viewer.needsUpdate()}});return h.then(function(r){r?(i.setTexture(e),i.viewer.adapter.setTextureOpacity(i.mesh,1),i.setPanoramaPose(e.panoData),i.setSphereCorrection(t.sphereCorrection),n&&i.viewer.rotate(t)):i.viewer.adapter.disposeTexture(e),i.scene.remove(o),a.geometry.dispose(),a.geometry=null}),h}},{key:"getIntersections",value:function(e){return rn.x=2*e.x/this.state.size.width-1,rn.y=-2*e.y/this.state.size.height+1,this.raycaster.setFromCamera(rn,this.camera),this.raycaster.intersectObjects(this.scene.children,!0).filter(function(e){return e.object.isMesh&&!!e.object.userData})}},{key:"addObject",value:function(e){this.scene.add(e)}},{key:"removeObject",value:function(e){this.scene.remove(e)}},{key:"cleanScene",value:function(e){var t=this;e.traverse(function(i){i.geometry&&i.geometry.dispose(),i.material&&(Array.isArray(i.material)?i.material.forEach(function(e){e.map&&e.map.dispose(),e.dispose()}):(i.material.map&&i.material.map.dispose(),i.material.dispose())),i.dispose&&!_instanceof(i,nn.Scene)&&i.dispose(),i!==e&&t.cleanScene(i)})}}]),t}(qi),an=se(),sn=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e),n.loader=new an.FileLoader,n.loader.setResponseType("blob"),n.config.withCredentials&&n.loader.setWithCredentials(!0),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.abortLoading(),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"abortLoading",value:function(){}},{key:"loadFile",value:function(e,t){var i=this;return this.config.requestHeaders&&this.loader.setRequestHeader(this.config.requestHeaders(e)),new Promise(function(n,r){var o=0;null==t||t(o),i.loader.load(e,function(e){o=100,null==t||t(o),n(e)},function(e){if(e.lengthComputable){var i=e.loaded/e.total*100;i>o&&(o=i,null==t||t(o))}},function(e){r(e)})})}},{key:"loadImage",value:function(e,t){return this.loadFile(e,t).then(function(e){return new Promise(function(t,i){var n=document.createElement("img");n.onload=function(){URL.revokeObjectURL(n.src),t(n)},n.onerror=i,n.src=URL.createObjectURL(e)})})}},{key:"preloadPanorama",value:function(e){return this.viewer.adapter.supportsPreload(e)?this.viewer.adapter.loadTexture(e):Promise.reject(new He("Current adapter does not support preload"))}}]),t}(qi),ln=se(),cn=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e),n.zoom=new Be(function(e){n.viewer.state.vFov=n.viewer.dataHelper.zoomLevelToFov(e),n.viewer.state.hFov=n.viewer.dataHelper.vFovToHFov(n.viewer.state.vFov),n.viewer.dispatchEvent(new Zt(e))},{defaultValue:n.viewer.config.defaultZoomLvl,min:0,max:100,wrap:!1}),n.position=new Xe(function(e){n.viewer.dataHelper.sphericalCoordsToVector3(e,n.viewer.state.direction),n.viewer.dispatchEvent(new Mt(e))},{yaw:new Be(null,{defaultValue:n.config.defaultYaw,min:0,max:2*Math.PI,wrap:!0}),pitch:new Be(null,{defaultValue:n.config.defaultPitch,min:n.viewer.state.littlePlanet?0:-Math.PI/2,max:n.viewer.state.littlePlanet?2*Math.PI:Math.PI/2,wrap:n.viewer.state.littlePlanet})}),n.updateSpeeds(),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"updateSpeeds",value:function(){this.zoom.setSpeed(50*this.config.zoomSpeed),this.position.setSpeed(ln.MathUtils.degToRad(50*this.config.moveSpeed))}},{key:"update",value:function(e){this.zoom.update(e),this.position.update(e)}}]),t}(qi),un=se(),hn=_createClass(function e(){_classCallCheck(this,e),this.ready=!1,this.needsUpdate=!1,this.keyboardEnabled=!1,this.direction=new un.Vector3(0,0,Pe),this.vFov=60,this.hFov=60,this.aspect=1,this.animation=null,this.transitionAnimation=null,this.loadingPromise=null,this.littlePlanet=!1,this.idleTime=-1,this.objectsObservers={},this.size={width:0,height:0},this.panoData={fullWidth:0,fullHeight:0,croppedWidth:0,croppedHeight:0,croppedX:0,croppedY:0,poseHeading:0,posePitch:0,poseRoll:0}}),dn=function(e){function t(e){var n;_classCallCheck(this,t),n=i.call(this),n.plugins={},n.children=[],n.onResize=k(function(){return n.navbar.autoSize()},500),ai.load(),n.state=new hn,n.config=Ai(e),n.parent=c(e.container),n.parent[Oe]=_assertThisInitialized(n),n.container=document.createElement("div"),n.container.classList.add("psv-container"),n.parent.appendChild(n.container),n.adapter=new n.config.adapter[0](_assertThisInitialized(n),n.config.adapter[1]),n.renderer=new on(_assertThisInitialized(n)),n.textureLoader=new sn(_assertThisInitialized(n)),n.eventsHandler=new tn(_assertThisInitialized(n)),n.dataHelper=new Qi(_assertThisInitialized(n)),n.dynamics=new cn(_assertThisInitialized(n)),n.loader=new Di(_assertThisInitialized(n)),n.navbar=new Vi(_assertThisInitialized(n)),n.panel=new Yi(_assertThisInitialized(n)),n.notification=new ji(_assertThisInitialized(n)),n.overlay=new Ui(_assertThisInitialized(n)),n.resize(n.config.size),x(ai.isTouchEnabled,function(e){u(n.container,"psv--is-touch",e)}),n.config.plugins.forEach(function(e){var t=_slicedToArray(e,2),i=t[0],r=t[1];n.plugins[i.id]=new i(_assertThisInitialized(n),r)});for(var r=0,o=Object.values(n.plugins);r1&&void 0!==arguments[1]?arguments[1]:{};this.textureLoader.abortLoading(),null===(t=this.state.transitionAnimation)||void 0===t||t.cancel(),this.state.ready||["sphereCorrection","panoData","overlay","overlayOpacity"].forEach(function(e){e in n||(n[e]=i.config[e])}),void 0!==n.transition&&!0!==n.transition||(n.transition=_e),void 0===n.showLoader&&(n.showLoader=!0),void 0===n.caption&&(n.caption=this.config.caption),void 0===n.description&&(n.description=this.config.description),n.panoData||"function"!=typeof this.config.panoData||(n.panoData=this.config.panoData);var r=H(n),o="zoom"in n;(r||o)&&this.stopAll(),this.hideError(),this.resetIdleTimer(),this.config.panorama=e,this.config.caption=n.caption,this.config.description=n.description;var a=function(e){if(i.loader.hide(),i.state.loadingPromise=null,A(e))return!1;if(e)throw i.navbar.setCaption(""),i.showError(i.config.lang.loadError),console.error(e),e;return i.setOverlay(n.overlay,n.overlayOpacity),i.navbar.setCaption(i.config.caption),!0};this.navbar.setCaption("".concat(this.config.loadingTxt||"","")),!n.showLoader&&this.state.ready||this.loader.show();var s=this.adapter.loadTexture(this.config.panorama,n.panoData).then(function(e){if(e.panorama!==i.config.panorama)throw i.adapter.disposeTexture(e),z();return e});return n.transition&&this.state.ready&&this.adapter.supportsTransition(this.config.panorama)?this.state.loadingPromise=s.then(function(e){return i.loader.hide(),i.dispatchEvent(new Pt(e)),i.state.transitionAnimation=i.renderer.transition(e,n),i.state.transitionAnimation}).then(function(e){if(i.state.transitionAnimation=null,!e)throw z()}).then(function(){return a()},function(e){return a(e)}):this.state.loadingPromise=s.then(function(e){i.renderer.show(),i.renderer.setTexture(e),i.renderer.setPanoramaPose(e.panoData),i.renderer.setSphereCorrection(n.sphereCorrection),i.dispatchEvent(new Pt(e)),o&&i.zoom(n.zoom),r&&i.rotate(n),i.state.ready||i.init()}).then(function(){return a()},function(e){return a(e)}),this.state.loadingPromise}},{key:"setOverlay",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.config.overlayOpacity,n=this.adapter.constructor.supportsOverlay;return e?n?this.adapter.loadTexture(e,function(e){var i=t.state.panoData,n=e.width/i.croppedWidth;return{fullWidth:n*i.fullWidth,fullHeight:n*i.fullHeight,croppedWidth:n*i.croppedWidth,croppedHeight:n*i.croppedHeight,croppedX:n*i.croppedX,croppedY:n*i.croppedY}},!1).then(function(e){t.renderer.setOverlay(e,i)}):Promise.reject(new He("Current adapter does not supports overlay")):(n&&this.renderer.setOverlay(null,0),Promise.resolve())}},{key:"setOptions",value:function(e){for(var t={...this.config,...e},i=0,n=Object.entries(e);i0&&void 0!==arguments[0]?arguments[0]:1;this.dynamics.zoom.step(e)}},{key:"zoomOut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.dynamics.zoom.step(-e)}},{key:"animate",value:function(e){var t=this,i=H(e),n=void 0!==e.zoom,r=new tt(i?this.dataHelper.cleanPosition(e):void 0,e.zoom);if(this.dispatchEvent(r),!r.defaultPrevented){var o=r.position,l=r.zoomLevel;this.stopAll();var c,u={};if(i){var h=this.getPosition(),d=a(h.yaw,o.yaw);u.yaw={start:h.yaw,end:h.yaw+d},u.pitch={start:h.pitch,end:o.pitch},c=this.dataHelper.speedToDuration(e.speed,s(h,o))}if(n){var v=Math.abs(l-this.getZoomLevel());u.zoom={start:this.getZoomLevel(),end:l},c||(c=this.dataHelper.speedToDuration(e.speed,Math.PI/4*v/100))}return c?(this.state.animation=new We({properties:u,duration:Math.max(we,c),easing:"inOutSine",onTick:function(e){i&&t.dynamics.position.setValue({yaw:e.yaw,pitch:e.pitch}),n&&t.dynamics.zoom.setValue(e.zoom)}}),this.state.animation.then(function(){t.state.animation=null,t.resetIdleTimer()}),this.state.animation):(i&&this.rotate(o),n&&this.zoom(l),new We(null))}}},{key:"stopAnimation",value:function(){return this.state.animation?(this.state.animation.cancel(),this.state.animation):Promise.resolve()}},{key:"resize",value:function(e){var t=this,i=e;["width","height"].forEach(function(n){e&&i[n]&&(/^[0-9.]+$/.test(i[n])&&(i[n]+="px"),t.parent.style[n]=i[n])}),this.autoSize()}},{key:"enterFullscreen",value:function(){this.isFullscreenEnabled()||_(this.container)}},{key:"exitFullscreen",value:function(){this.isFullscreenEnabled()&&w()}},{key:"toggleFullscreen",value:function(){this.isFullscreenEnabled()?this.exitFullscreen():this.enterFullscreen()}},{key:"startKeyboardControl",value:function(){this.state.keyboardEnabled=!0}},{key:"stopKeyboardControl",value:function(){this.state.keyboardEnabled=!1}},{key:"createTooltip",value:function(e){return new Bi(this,e)}},{key:"observeObjects",value:function(e){this.state.objectsObservers[e]=null}},{key:"unobserveObjects",value:function(e){delete this.state.objectsObservers[e]}},{key:"stopAll",value:function(){return this.dispatchEvent(new Bt),this.disableIdleTimer(),this.stopAnimation()}}]),t}($e);ae(te(e,"__esModule",{value:!0}),le)}),function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?t(exports,require("three"),require("@photo-sphere-viewer/core")):"function"==typeof define&&define.amd?define(["exports","three","@photo-sphere-viewer/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,t((e.PhotoSphereViewer=e.PhotoSphereViewer||{},e.PhotoSphereViewer.AutorotatePlugin={}),e.THREE,e.PhotoSphereViewer))}(window,function(e,t,i){function n(e){return[e.yaw,e.pitch]}var r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,l=function(e,t){for(var i in t)r(e,i,{get:t[i],enumerable:!0})},c=function(e,t,i,n){if(t&&"object"===_typeof(t)||"function"==typeof t){var l,c=_createForOfIteratorHelper(a(t));try{var u=function(){var a=l.value;s.call(e,a)||a===i||r(e,a,{get:function(){return t[a]},enumerable:!(n=o(t,a))||n.enumerable})};for(c.s();!(l=c.n()).done;)u()}catch(e){c.e(e)}finally{c.f()}}return e},u=function(){return i},h=function(){return t},d={};l(d,{AutorotatePlugin:function(){return S},events:function(){return f}});var v=u(),p=u(),f={};l(f,{AutorotateEvent:function(){return g}});var y=u(),m=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,t.type),n.autorotateEnabled=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(y.TypedEvent),g=m;g.type="autorotate" ;var _='\n',w='\n',b=function(e){function t(e){var n,r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-autorotate-button",hoverScale:!0,collapsable:!0,tabbable:!0,icon:w,iconActive:_}),r.plugin=r.viewer.getPlugin("autorotate"),null===(n=r.plugin)||void 0===n||n.addEventListener(g.type,_assertThisInitialized(r)),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){var e;null===(e=this.plugin)||void 0===e||e.removeEventListener(g.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"isSupported",value:function(){return!!this.plugin}},{key:"handleEvent",value:function(e){_instanceof(e,g)&&this.toggleActive(e.autorotateEnabled)}},{key:"onClick",value:function(){this.plugin.isEnabled()&&(this.plugin.config.autostartOnIdle=!1),this.plugin.toggle()}}]),t}(p.AbstractButton);b.id="autorotate";var k=u(),E=h(),C=k.utils.getConfigParser({autostartDelay:2e3,autostartOnIdle:!0,autorotateSpeed:k.utils.parseSpeed("2rpm"),autorotatePitch:null,autorotateZoomLvl:null,keypoints:null,startFromClosest:!0},{autostartOnIdle:function(e,t){var i=t.rawConfig;return e&&k.utils.isNil(i.autostartDelay)?(k.utils.logWarn("autostartOnIdle requires a non null autostartDelay"),!1):e},autorotateSpeed:function(e){return k.utils.parseSpeed(e)},autorotatePitch:function(e){return k.utils.isNil(e)?null:k.utils.parseAngle(e,!0)},autorotateZoomLvl:function(e){return k.utils.isNil(e)?null:E.MathUtils.clamp(e,0,100)}}),T=16,S=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e,n),r.state={initialStart:!0,enabled:!1,idx:-1,curve:[],startStep:null,endStep:null,startTime:null,stepDuration:null,remainingPause:null,lastTime:null,tooltip:null},r.state.initialStart=!k.utils.isNil(r.config.autostartDelay),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"init",value:function(){_get(_getPrototypeOf(t.prototype),"init",this).call(this),this.video=this.viewer.getPlugin("video"),this.markers=this.viewer.getPlugin("markers"),this.config.keypoints&&(this.setKeypoints(this.config.keypoints),delete this.config.keypoints),this.viewer.addEventListener(k.events.StopAllEvent.type,this),this.viewer.addEventListener(k.events.BeforeRenderEvent.type,this),this.video||this.viewer.addEventListener(k.events.KeypressEvent.type,this)}},{key:"destroy",value:function(){this.viewer.removeEventListener(k.events.StopAllEvent.type,this),this.viewer.removeEventListener(k.events.BeforeRenderEvent.type,this),this.viewer.removeEventListener(k.events.KeypressEvent.type,this),delete this.video,delete this.markers,delete this.keypoints,_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case k.events.StopAllEvent.type:this.stop();break;case k.events.BeforeRenderEvent.type:this.__beforeRender(e.timestamp);break;case k.events.KeypressEvent.type:e.key===k.CONSTANTS.KEY_CODES.Space&&(this.toggle(),e.preventDefault())}}},{key:"setKeypoints",value:function(e){var t=this;if(e){if(e.length<2)throw new k.PSVError("At least two points are required");this.keypoints=e.map(function(e,i){var r,o={position:null,markerId:null,pause:0,tooltip:null};if("string"==typeof e?o.markerId=e:k.utils.isExtendedPosition(e)?r=e:(o.markerId=e.markerId,o.pause=e.pause,r=e.position,e.tooltip&&"object"===_typeof(e.tooltip)?o.tooltip=e.tooltip:"string"==typeof e.tooltip&&(o.tooltip={content:e.tooltip})),o.markerId){if(!t.markers)throw new k.PSVError("Keypoint #".concat(i," references a marker but the markers plugin is not loaded"));var a=t.markers.getMarker(o.markerId);o.position=n(a.state.position)}else{if(!r)throw new k.PSVError("Keypoint #".concat(i," is missing marker or position"));o.position=n(t.viewer.dataHelper.cleanPosition(r))}return o})}else this.keypoints=null;this.isEnabled()&&(this.stop(),this.start())}},{key:"isEnabled",value:function(){return this.state.enabled}},{key:"start",value:function(){this.isEnabled()||(this.viewer.stopAll(),this.keypoints?this.config.startFromClosest&&this.__shiftKeypoints():this.__animate(),this.state.initialStart=!1,this.state.enabled=!0,this.dispatchEvent(new g(!0)))}},{key:"stop",value:function(){this.isEnabled()&&(this.__reset(),this.__hideTooltip(),this.viewer.dynamics.position.stop(),this.viewer.dynamics.zoom.stop(),this.state.enabled=!1,this.dispatchEvent(new g(!1)))}},{key:"toggle",value:function(){this.isEnabled()?this.stop():this.start()}},{key:"reverse",value:function(){this.isEnabled()&&!this.keypoints&&(this.config.autorotateSpeed=-this.config.autorotateSpeed,this.__animate())}},{key:"__animate",value:function(){var e,t=this;e=k.utils.isNil(this.config.autorotateZoomLvl)?Promise.resolve():this.viewer.animate({zoom:this.config.autorotateZoomLvl,speed:"".concat(2*this.viewer.config.zoomSpeed,"rpm")}),e.then(function(){var e;t.viewer.dynamics.position.roll({yaw:t.config.autorotateSpeed<0},Math.abs(t.config.autorotateSpeed/t.viewer.config.moveSpeed)),t.viewer.dynamics.position.goto({pitch:null!==(e=t.config.autorotatePitch)&&void 0!==e?e:t.viewer.config.defaultPitch},Math.abs(t.config.autorotateSpeed/t.viewer.config.moveSpeed))})}},{key:"__reset",value:function(){this.state.idx=-1,this.state.curve=[],this.state.startStep=null,this.state.endStep=null,this.state.startTime=null,this.state.stepDuration=null,this.state.remainingPause=null,this.state.lastTime=null,this.state.tooltip=null}},{key:"__beforeRender",value:function(e){(this.state.initialStart||this.config.autostartOnIdle)&&this.viewer.state.idleTime>0&&e-this.viewer.state.idleTime>this.config.autostartDelay&&this.start(),this.isEnabled()&&this.keypoints&&(this.state.startTime||(this.state.endStep=n(this.viewer.getPosition()),this.__nextStep(),this.state.startTime=e,this.state.lastTime=e),this.__nextFrame(e))}},{key:"__shiftKeypoints",value:function(){var e,t=n(this.viewer.getPosition()),i=this.__findMinIndex(this.keypoints,function(e){return k.utils.greatArcDistance(e.position,t)});(e=this.keypoints).push.apply(e,_toConsumableArray(this.keypoints.splice(0,i)))}},{key:"__incrementIdx",value:function(){this.state.idx++,this.state.idx===this.keypoints.length&&(this.state.idx=0)}},{key:"__showTooltip",value:function(){var e=this.keypoints[this.state.idx];if(e.tooltip){var t=this.viewer.dataHelper.vector3ToViewerCoords(this.viewer.state.direction);this.state.tooltip=this.viewer.createTooltip({content:e.tooltip.content,position:e.tooltip.position,top:t.y,left:t.x})}else if(e.markerId){var i=this.markers.getMarker(e.markerId);i.showTooltip(),this.state.tooltip=i.tooltip}}},{key:"__hideTooltip",value:function(){if(this.state.tooltip){var e=this.keypoints[this.state.idx];if(e.tooltip)this.state.tooltip.hide();else if(e.markerId){var t=this.markers.getMarker(e.markerId);t.hideTooltip()}this.state.tooltip=null}}},{key:"__nextPoint",value:function(){var e=[];if(-1===this.state.idx){var t=n(this.viewer.getPosition());e.push(t,t,this.keypoints[0].position,this.keypoints[1].position)}else for(var i=-1;i<3;i++){var r=this.state.idx+i<0?this.keypoints[this.keypoints.length-1]:this.keypoints[(this.state.idx+i)%this.keypoints.length];e.push(r.position)}for(var o=[new E.Vector2(e[0][0],e[0][1])],a=0,s=1;s<=3;s++){var l=e[s-1][0]-e[s][0];l>Math.PI?a+=1:l<-Math.PI&&(a-=1),0!==a&&1===s&&(o[0].x-=2*a*Math.PI,a=0),o.push(new E.Vector2(e[s][0]+2*a*Math.PI,e[s][1]))}var c=new E.SplineCurve(o).getPoints(3*T).map(function(e){return[e.x,e.y]});this.state.curve=c.slice(T+1,2*T+1),-1!==this.state.idx?(this.state.remainingPause=this.keypoints[this.state.idx].pause,this.state.remainingPause?this.__showTooltip():this.__incrementIdx()):this.__incrementIdx()}},{key:"__nextStep",value:function(){0===this.state.curve.length&&(this.__nextPoint(),this.state.endStep[0]=k.utils.parseAngle(this.state.endStep[0])),this.state.startStep=this.state.endStep,this.state.endStep=this.state.curve.shift();var e=k.utils.greatArcDistance(this.state.startStep,this.state.endStep);this.state.stepDuration=1e3*e/Math.abs(this.config.autorotateSpeed),0===e&&this.__nextStep()}},{key:"__nextFrame",value:function(e){var t=e-this.state.lastTime;if(this.state.lastTime=e,this.state.remainingPause){if(this.state.remainingPause=Math.max(0,this.state.remainingPause-t),this.state.remainingPause>0)return;this.__hideTooltip(),this.__incrementIdx(),this.state.startTime=e}var i=(e-this.state.startTime)/this.state.stepDuration;i>=1&&(this.__nextStep(),i=0,this.state.startTime=e),this.viewer.rotate({yaw:this.state.startStep[0]+(this.state.endStep[0]-this.state.startStep[0])*i,pitch:this.state.startStep[1]+(this.state.endStep[1]-this.state.startStep[1])*i})}},{key:"__findMinIndex",value:function(e,t){var i=0,n=Number.MAX_VALUE;return e.forEach(function(e,r){var o=t(e);o',_=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-gallery-button",hoverScale:!0,collapsable:!0,tabbable:!0,icon:g}),n.plugin=n.viewer.getPlugin("gallery"),n.plugin&&(n.plugin.addEventListener(f.type,_assertThisInitialized(n)),n.plugin.addEventListener(y.type,_assertThisInitialized(n))),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.plugin&&(this.plugin.removeEventListener(f.type,this),this.plugin.removeEventListener(y.type,this)),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,f)?this.toggleActive(!0):_instanceof(e,y)&&this.toggleActive(!1)}},{key:"isSupported",value:function(){return!!this.plugin}},{key:"onClick",value:function(){this.plugin.toggle()}}]),t}(m.AbstractButton);_.id="gallery";var w=c(),b=c(),k=c(),E="psvGalleryItem",C=k.utils.dasherize(E),T="psv-gallery-item--active",S=function(e,t){return"\n".concat(e.map(function(e){return'\n\n")}).join(""),"\n")},P='\n \n \n \n \n \n \n \n \n \n \n',O=function(e){function t(e,n){var r;_classCallCheck(this,t),r=i.call(this,n,{className:"psv-gallery psv--capture-event"}),r.plugin=e,r.state={visible:!0,mousedown:!1,initMouseX:null,mouseX:null},r.container.innerHTML=P,r.container.querySelector("svg").style.display="none";var o=document.createElement("div");return o.className="psv-panel-close-button",o.innerHTML=b.CONSTANTS.ICONS.close,r.container.appendChild(o),r.items=document.createElement("div"),r.items.className="psv-gallery-container",r.container.appendChild(r.items),r.observer=new IntersectionObserver(function(e){e.forEach(function(e){if(e.intersectionRatio>0){var t=e.target;t.style.backgroundImage="url(".concat(t.dataset.src,")"),delete t.dataset.src,r.observer.unobserve(e.target)}})},{root:r.viewer.container}),r.container.addEventListener("wheel",_assertThisInitialized(r)),r.container.addEventListener("mousedown",_assertThisInitialized(r)),r.container.addEventListener("mousemove",_assertThisInitialized(r)),r.container.addEventListener("click",_assertThisInitialized(r)),window.addEventListener("mouseup",_assertThisInitialized(r)),o.addEventListener("click",function(){return r.plugin.hide()}),r.hide(),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){window.removeEventListener("mouseup",this),this.observer.disconnect(),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case"wheel":this.container.scrollLeft+=50*e.deltaY,e.preventDefault();break;case"mousedown":this.state.mousedown=!0,this.state.initMouseX=e.clientX,this.state.mouseX=e.clientX;break;case"mousemove":if(this.state.mousedown){var t=this.state.mouseX-e.clientX;this.container.scrollLeft+=t,this.state.mouseX=e.clientX}break;case"mouseup":this.state.mousedown=!1,this.state.mouseX=null,e.preventDefault();break;case"click":if(Math.abs(this.state.initMouseX-e.clientX)<10){var i=b.utils.getClosest(e.target,"[data-".concat(C,"]"));i&&this.plugin.__click(i.dataset[E])}}}},{key:"show",value:function(){this.container.classList.add("psv-gallery--open"),this.state.visible=!0}},{key:"hide",value:function(){this.container.classList.remove("psv-gallery--open"),this.state.visible=!1}},{key:"setItems",value:function(e){var t=this;this.items.innerHTML=S(e,this.plugin.config.thumbnailSize),this.observer&&(this.observer.disconnect(),this.items.querySelectorAll("[data-src]").forEach(function(e){t.observer.observe(e)}))}},{key:"setActive",value:function(e){var t=this.items.querySelector("."+T);if(null==t||t.classList.remove(T),e){var i=this.items.querySelector("[data-".concat(C,'="').concat(e,'"]'));null==i||i.classList.add(T)}}}]),t}(b.AbstractComponent),M=w.utils.getConfigParser({items:[],visibleOnLoad:!1,hideOnClick:!0,thumbnailSize:{width:200,height:100}}),L=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e,n),r.items=[],r.gallery=new O(_assertThisInitialized(r),r.viewer),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"init",value:function(){var e=this;_get(_getPrototypeOf(t.prototype),"init",this).call(this),this.viewer.addEventListener(w.events.PanoramaLoadedEvent.type,this),this.viewer.addEventListener(w.events.ShowPanelEvent.type,this),this.config.visibleOnLoad&&this.viewer.addEventListener(w.events.ReadyEvent.type,function(){e.show()},{once:!0}),this.setItems(this.config.items),delete this.config.items,setTimeout(function(){return e.__updateButton()})}},{key:"destroy",value:function(){this.viewer.removeEventListener(w.events.PanoramaLoadedEvent.type,this),this.viewer.removeEventListener(w.events.ShowPanelEvent.type,this),this.gallery.destroy(),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"setOptions",value:function(e){_get(_getPrototypeOf(t.prototype),"setOptions",this).call(this,e),e.thumbnailSize&&this.gallery.setItems(this.items)}},{key:"handleEvent",value:function(e){if(_instanceof(e,w.events.PanoramaLoadedEvent)){var t=this.items.find(function(t){return w.utils.deepEqual(t.panorama,e.data.panorama)});this.currentId=null==t?void 0:t.id,this.gallery.setActive(null==t?void 0:t.id)}else _instanceof(e,w.events.ShowPanelEvent)&&this.gallery.isVisible()&&this.hide()}},{key:"show",value:function(){return this.dispatchEvent(new f),this.gallery.show()}},{key:"hide",value:function(){return this.dispatchEvent(new y),this.gallery.hide()}},{key:"toggle",value:function(){this.gallery.isVisible()?this.hide():this.show()}},{key:"setItems",value:function(e,t){e?e.forEach(function(e,t){if(!e.id)throw new w.PSVError("Item ".concat(t,' has no "id".'));if(!e.panorama)throw new w.PSVError("Item ".concat(e.id,' has no "panorama".'))}):e=[],this.handler=t,this.items=e.map(function(e){return{...e,id:"".concat(e.id)}}),this.gallery.setItems(this.items),this.__updateButton()}},{key:"__click",value:function(e){if(e!==this.currentId){if(this.handler)this.handler(e);else{var t=this.items.find(function(t){return t.id===e});this.viewer.setPanorama(t.panorama,{caption:t.name,...t.options})}this.currentId=e,this.gallery.setActive(e),this.config.hideOnClick&&this.hide()}}},{key:"__updateButton",value:function(){var e;null===(e=this.viewer.navbar.getButton(_.id,!1))||void 0===e||e.toggle(this.items.length>0)}}]),t}(w.AbstractConfigurablePlugin);L.id="gallery",L.configParser=M,L.readonlyOptions=["visibleOnLoad","items"],h.DEFAULTS.lang[_.id]="Gallery",(0,h.registerButton)(_,"caption:left"),l(n(e,"__esModule",{value:!0}),u)}),function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?t(exports,require("three"),require("@photo-sphere-viewer/core")):"function"==typeof define&&define.amd?define(["exports","three","@photo-sphere-viewer/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,t((e.PhotoSphereViewer=e.PhotoSphereViewer||{},e.PhotoSphereViewer.VideoPlugin={}),e.THREE,e.PhotoSphereViewer))}(window,function(e,t,i){function n(e){var t=Math.round(e%60),i=Math.round(e-t)/60;return"".concat(i,":").concat(("0"+t).slice(-2))}var r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,l=function(e,t){for(var i in t)r(e,i,{get:t[i],enumerable:!0})},c=function(e,t,i,n){if(t&&"object"===_typeof(t)||"function"==typeof t){var l,c=_createForOfIteratorHelper(a(t));try{var u=function(){var a=l.value;s.call(e,a)||a===i||r(e,a,{get:function(){return t[a]},enumerable:!(n=o(t,a))||n.enumerable})};for(c.s();!(l=c.n()).done;)u()}catch(e){c.e(e)}finally{c.f()}}return e},u=function(){return i},h=function(){return t},d={};l(d,{VideoPlugin:function(){return j},events:function(){return f}});var v=u(),p=u(),f={};l(f,{BufferEvent:function(){return C},PlayPauseEvent:function(){return g},ProgressEvent:function(){return k},VolumeChangeEvent:function(){return w}});var y=u(),m=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,t.type),n.playing=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(y.TypedEvent),g=m;g.type="play-pause";var _=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,t.type),n.volume=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(y.TypedEvent),w=_;w.type="volume-change";var b=function(e){function t(e,n,r){var o;return _classCallCheck(this,t),o=i.call(this,t.type),o.time=e,o.duration=n,o.progress=r,o}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(y.TypedEvent),k=b;k.type="progress";var E=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,t.type),n.maxBuffer=e,n}_inherits(t,e);var i=_createSuper(t);return _createClass(t)}(y.TypedEvent),C=E;C.type="buffer";var T='',S='',P=function(e){function t(e){var n,r;return _classCallCheck(this,t),r=i.call(this,e,{className:"psv-video-play-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:S,iconActive:T}),r.plugin=r.viewer.getPlugin("video"),null===(n=r.plugin)||void 0===n||n.addEventListener(g.type,_assertThisInitialized(r)),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){var e;null===(e=this.plugin)||void 0===e||e.removeEventListener(g.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"isSupported",value:function(){return!!this.plugin}},{key:"handleEvent",value:function(e){_instanceof(e,g)&&this.toggleActive(e.playing)}},{key:"onClick",value:function(){this.plugin.playPause()}}]),t}(p.AbstractButton);P.id="videoPlay",P.groupId="video";var O=u(),M=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-caption psv-video-time",hoverScale:!1,collapsable:!1,tabbable:!1}),n.contentElt=document.createElement("div"),n.contentElt.className="psv-caption-content",n.container.appendChild(n.contentElt),n.plugin=n.viewer.getPlugin("video"),n.plugin&&(n.viewer.addEventListener(O.events.PanoramaLoadedEvent.type,_assertThisInitialized(n)),n.plugin.addEventListener(k.type,_assertThisInitialized(n))),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.plugin&&(this.viewer.removeEventListener(O.events.PanoramaLoadedEvent.type,this),this.plugin.removeEventListener(k.type,this)),delete this.plugin,_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case O.events.PanoramaLoadedEvent.type:case k.type:this.contentElt.innerHTML="".concat(n(this.plugin.getTime())," / ").concat(n(this.plugin.getDuration()))}}},{key:"onClick",value:function(){}}]),t}(O.AbstractButton);M.id="videoTime",M.groupId="video";var L=u(),x='',I=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e,{className:"psv-video-volume-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:x}),n.plugin=n.viewer.getPlugin("video"),n.plugin&&(n.rangeContainer=document.createElement("div"),n.rangeContainer.className="psv-video-volume__container",n.container.appendChild(n.rangeContainer),n.range=document.createElement("div"),n.range.className="psv-video-volume__range",n.rangeContainer.appendChild(n.range),n.trackElt=document.createElement("div"),n.trackElt.className="psv-video-volume__track",n.range.appendChild(n.trackElt),n.progressElt=document.createElement("div"),n.progressElt.className="psv-video-volume__progress",n.range.appendChild(n.progressElt),n.handleElt=document.createElement("div"),n.handleElt.className="psv-video-volume__handle",n.range.appendChild(n.handleElt),n.slider=new L.utils.Slider(n.range,L.utils.SliderDirection.VERTICAL,n.__onSliderUpdate.bind(_assertThisInitialized(n))),n.viewer.addEventListener(L.events.PanoramaLoadedEvent.type,_assertThisInitialized(n)),n.plugin.addEventListener(g.type,_assertThisInitialized(n)),n.plugin.addEventListener(w.type,_assertThisInitialized(n)),n.__setVolume(0)),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.plugin&&(this.viewer.removeEventListener(L.events.PanoramaLoadedEvent.type,this),this.plugin.removeEventListener(g.type,this),this.plugin.removeEventListener(w.type,this)),this.slider.destroy(),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"isSupported",value:function(){return!!this.plugin}},{key:"handleEvent",value:function(e){switch(e.type){case L.events.PanoramaLoadedEvent.type:case g.type:case w.type:this.__setVolume(this.plugin.getVolume())}}},{key:"onClick",value:function(){this.plugin.setMute()}},{key:"__onSliderUpdate",value:function(e){e.mousedown&&this.plugin.setVolume(e.value)}},{key:"__setVolume",value:function(e){var t;t=0===e?0:e<.333?1:e<.666?2:3,L.utils.toggleClass(this.container,"psv-video-volume-button--0",0===t),L.utils.toggleClass(this.container,"psv-video-volume-button--1",1===t),L.utils.toggleClass(this.container,"psv-video-volume-button--2",2===t),L.utils.toggleClass(this.container,"psv-video-volume-button--3",3===t),this.handleElt.style.bottom="".concat(100*e,"%"),this.progressElt.style.height="".concat(100*e,"%")}}]),t}(L.AbstractButton);I.id="videoVolume",I.groupId="video";var z=u(),A=h(),R=u(),H=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,n,{className:"psv-video-overlay"}),r.plugin=e,r.button=document.createElement("button"),r.button.className="psv-video-bigbutton ".concat(R.CONSTANTS.CAPTURE_EVENTS_CLASS),r.button.innerHTML=S,r.container.appendChild(r.button),r.viewer.addEventListener(R.events.PanoramaLoadedEvent.type,_assertThisInitialized(r)),r.plugin.addEventListener(g.type,_assertThisInitialized(r)),r.button.addEventListener("click",_assertThisInitialized(r)),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(R.events.PanoramaLoadedEvent.type,this),this.plugin.removeEventListener(g.type,this),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case R.events.PanoramaLoadedEvent.type:case g.type:R.utils.toggleClass(this.button,"psv-video-bigbutton--pause",!this.plugin.isPlaying());break;case"click":this.plugin.playPause()}}}]),t}(R.AbstractComponent),N=u(),V=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,n,{className:"psv-video-progressbar"}),r.plugin=e,r.state={visible:!0,req:null,tooltip:null},r.bufferElt=document.createElement("div"),r.bufferElt.className="psv-video-progressbar__buffer",r.container.appendChild(r.bufferElt),r.progressElt=document.createElement("div"),r.progressElt.className="psv-video-progressbar__progress",r.container.appendChild(r.progressElt),r.handleElt=document.createElement("div"),r.handleElt.className="psv-video-progressbar__handle", r.container.appendChild(r.handleElt),r.slider=new N.utils.Slider(r.container,N.utils.SliderDirection.HORIZONTAL,r.__onSliderUpdate.bind(_assertThisInitialized(r))),r.viewer.addEventListener(N.events.PanoramaLoadedEvent.type,_assertThisInitialized(r)),r.plugin.addEventListener(C.type,_assertThisInitialized(r)),r.plugin.addEventListener(k.type,_assertThisInitialized(r)),r.state.req=window.requestAnimationFrame(function(){return r.__updateProgress()}),r.hide(),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){var e;this.viewer.removeEventListener(N.events.PanoramaLoadedEvent.type,this),this.plugin.removeEventListener(C.type,this),this.plugin.removeEventListener(k.type,this),this.slider.destroy(),null===(e=this.state.tooltip)||void 0===e||e.hide(),window.cancelAnimationFrame(this.state.req),delete this.state.tooltip,_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){switch(e.type){case N.events.PanoramaLoadedEvent.type:case C.type:case k.type:this.bufferElt.style.width="".concat(100*this.plugin.getBufferProgress(),"%")}}},{key:"__updateProgress",value:function(){var e=this;this.progressElt.style.width="".concat(100*this.plugin.getProgress(),"%"),this.state.req=window.requestAnimationFrame(function(){return e.__updateProgress()})}},{key:"__onSliderUpdate",value:function(e){if(e.mouseover){this.handleElt.style.display="block",this.handleElt.style.left="".concat(100*e.value,"%");var t=n(this.plugin.getDuration()*e.value);this.state.tooltip?this.state.tooltip.update(t,{top:e.cursor.clientY,left:e.cursor.clientX}):this.state.tooltip=this.viewer.createTooltip({top:e.cursor.clientY,left:e.cursor.clientX,content:t})}else{var i;this.handleElt.style.display="none",null===(i=this.state.tooltip)||void 0===i||i.hide(),delete this.state.tooltip}e.click&&this.plugin.setProgress(e.value)}}]),t}(N.AbstractComponent),D=z.utils.getConfigParser({progressbar:!0,bigbutton:!0,keypoints:null}),j=function(e){function t(e,n){var r;if(_classCallCheck(this,t),r=i.call(this,e,n),r.state={curve:null,start:null,end:null,keypoints:null},!r.viewer.adapter.constructor.id.includes("video"))throw new z.PSVError("VideoPlugin can only be used with a video adapter.");return r.config.progressbar&&(r.progressbar=new V(_assertThisInitialized(r),e)),r.config.bigbutton&&(r.overlay=new H(_assertThisInitialized(r),e)),r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"init",value:function(){var e;_get(_getPrototypeOf(t.prototype),"init",this).call(this),this.markers=this.viewer.getPlugin("markers"),this.autorotate=this.viewer.getPlugin("autorotate"),this.autorotate&&(this.autorotate.config.autostartDelay=0,this.autorotate.config.autostartOnIdle=!1),this.config.keypoints&&(this.setKeypoints(this.config.keypoints),delete this.config.keypoints),null===(e=this.autorotate)||void 0===e||e.addEventListener("autorotate",this),this.viewer.addEventListener(z.events.BeforeRenderEvent.type,this),this.viewer.addEventListener(z.events.PanoramaLoadedEvent.type,this),this.viewer.addEventListener(z.events.KeypressEvent.type,this)}},{key:"destroy",value:function(){var e;null===(e=this.autorotate)||void 0===e||e.removeEventListener("autorotate",this),this.viewer.removeEventListener(z.events.BeforeRenderEvent.type,this),this.viewer.removeEventListener(z.events.PanoramaLoadedEvent.type,this),this.viewer.removeEventListener(z.events.KeypressEvent.type,this),delete this.progressbar,delete this.overlay,delete this.markers,_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){var t;switch(e.type){case z.events.BeforeRenderEvent.type:this.__autorotate();break;case"autorotate":this.__configureAutorotate();break;case z.events.PanoramaLoadedEvent.type:this.__bindVideo(e.data),null===(t=this.progressbar)||void 0===t||t.show();break;case z.events.KeypressEvent.type:this.__onKeyPress(e);break;case"play":case"pause":this.dispatchEvent(new g(this.isPlaying()));break;case"progress":this.dispatchEvent(new C(this.getBufferProgress()));break;case"volumechange":this.dispatchEvent(new w(this.getVolume()));break;case"timeupdate":this.dispatchEvent(new k(this.getTime(),this.getDuration(),this.getProgress()))}}},{key:"__bindVideo",value:function(e){this.video&&(this.video.removeEventListener("play",this),this.video.removeEventListener("pause",this),this.video.removeEventListener("progress",this),this.video.removeEventListener("volumechange",this),this.video.removeEventListener("timeupdate",this)),this.video=e.texture.image,this.video.addEventListener("play",this),this.video.addEventListener("pause",this),this.video.addEventListener("progress",this),this.video.addEventListener("volumechange",this),this.video.addEventListener("timeupdate",this)}},{key:"__onKeyPress",value:function(e){e.key===z.CONSTANTS.KEY_CODES.Space&&(this.playPause(),e.preventDefault())}},{key:"getDuration",value:function(){var e,t;return null!==(e=null===(t=this.video)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}},{key:"getTime",value:function(){var e,t;return null!==(e=null===(t=this.video)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}},{key:"getProgress",value:function(){return this.video?this.video.currentTime/this.video.duration:0}},{key:"isPlaying",value:function(){return!!this.video&&!this.video.paused}},{key:"getVolume",value:function(){var e,t,i;return null!==(e=this.video)&&void 0!==e&&e.muted?0:null!==(t=null===(i=this.video)||void 0===i?void 0:i.volume)&&void 0!==t?t:0}},{key:"playPause",value:function(){this.video&&(this.video.paused?this.video.play():this.video.pause())}},{key:"play",value:function(){var e;null!==(e=this.video)&&void 0!==e&&e.paused&&this.video.play()}},{key:"pause",value:function(){this.video&&!this.video.paused&&this.video.pause()}},{key:"setVolume",value:function(e){this.video&&(this.video.muted=!1,this.video.volume=A.MathUtils.clamp(e,0,1))}},{key:"setMute",value:function(e){this.video&&(this.video.muted=void 0===e?!this.video.muted:e,this.video.muted||0!==this.video.volume||(this.video.volume=.1))}},{key:"setTime",value:function(e){this.video&&(this.video.currentTime=e)}},{key:"setProgress",value:function(e){this.video&&(this.video.currentTime=this.video.duration*e)}},{key:"getBufferProgress",value:function(){if(this.video){for(var e=0,t=this.video.buffered,i=0,n=t.length;i=this.video.currentTime){e=t.end(i);break}return Math.max(this.video.currentTime,e)/this.video.duration}return 0}},{key:"setKeypoints",value:function(e){var t=this;if(!this.autorotate)throw new z.PSVError("Video keypoints required the AutorotatePlugin");if(!e)return this.state.keypoints=null,void this.__configureAutorotate();if(e.length<2)throw new z.PSVError("At least two points are required");this.state.keypoints=z.utils.clone(e),this.state.keypoints&&(this.state.keypoints.forEach(function(e,i){if(!e.position)throw new z.PSVError("Keypoint #".concat(i," is missing marker or position"));if(e.position=t.viewer.dataHelper.cleanPosition(e.position),z.utils.isNil(e.time))throw new z.PSVError("Keypoint #".concat(i," is missing time"))}),this.state.keypoints.sort(function(e,t){return e.time-t.time})),this.__configureAutorotate()}},{key:"__configureAutorotate",value:function(){delete this.state.curve,delete this.state.start,delete this.state.end,this.autorotate.isEnabled()&&this.state.keypoints&&this.viewer.dynamics.position.stop()}},{key:"__autorotate",value:function(){var e;if(null!==(e=this.autorotate)&&void 0!==e&&e.isEnabled()&&this.state.keypoints){var t=this.getTime(),i=this.state;if((!i.curve||t=i.end.time)&&this.__autorotateNext(t),i.start===i.end)this.viewer.rotate(i.start.position);else{var n=(t-i.start.time)/(i.end.time-i.start.time),r=i.curve.getPoint(1/3+n/3);this.viewer.dynamics.position.goto({yaw:r.x,pitch:r.y})}}}},{key:"__autorotateNext",value:function(e){var t=null,i=null,n=this.state.keypoints,r=n.length-1;e=n[o].time&&e=n[r].time&&(t=r,i=r);for(var a=[n[Math.max(0,t-1)].position,n[t].position,n[i].position,n[Math.min(r,i+1)].position],s=[new A.Vector2(a[0].yaw,a[0].pitch)],l=0,c=1;c<=3;c++){var u=a[c-1].yaw-a[c].yaw;u>Math.PI?l+=1:u<-Math.PI&&(l-=1),0!==l&&1===c&&(s[0].x-=2*l*Math.PI,l=0),s.push(new A.Vector2(a[c].yaw+2*l*Math.PI,a[c].pitch))}this.state.curve=new A.SplineCurve(s),this.state.start=n[t],this.state.end=n[i]}}]),t}(z.AbstractConfigurablePlugin);j.id="video",j.configParser=D,j.readonlyOptions=Object.keys(D.defaults),v.DEFAULTS.lang[P.id]="Play/Pause",v.DEFAULTS.lang[I.id]="Volume",(0,v.registerButton)(P),(0,v.registerButton)(I),(0,v.registerButton)(M),v.DEFAULTS.navbar.unshift(P.groupId),c(r(e,"__esModule",{value:!0}),d)}),function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?t(exports,require("three"),require("@photo-sphere-viewer/core")):"function"==typeof define&&define.amd?define(["exports","three","@photo-sphere-viewer/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,t((e.PhotoSphereViewer=e.PhotoSphereViewer||{},e.PhotoSphereViewer.EquirectangularVideoAdapter={}),e.THREE,e.PhotoSphereViewer))}(window,function(e,t,i){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,s=function(e,t){for(var i in t)n(e,i,{get:t[i],enumerable:!0})},l=function(e,t,i,s){if(t&&"object"===_typeof(t)||"function"==typeof t){var l,c=_createForOfIteratorHelper(o(t));try{var u=function(){var o=l.value;a.call(e,o)||o===i||n(e,o,{get:function(){return t[o]},enumerable:!(s=r(t,o))||s.enumerable})};for(c.s();!(l=c.n()).done;)u()}catch(e){c.e(e)}finally{c.f()}}return e},c=function(){return i},u=function(){return t},h={};s(h,{EquirectangularVideoAdapter:function(){return g}});var d=c(),v=u(),p=c(),f=u(),y=function(e){function t(e){var n;return _classCallCheck(this,t),n=i.call(this,e),n.viewer.addEventListener(p.events.BeforeRenderEvent.type,_assertThisInitialized(n)),n}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"destroy",value:function(){this.viewer.removeEventListener(p.events.BeforeRenderEvent.type,this),this.__removeVideo(),_get(_getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"handleEvent",value:function(e){_instanceof(e,p.events.BeforeRenderEvent)&&this.viewer.needsUpdate()}},{key:"supportsPreload",value:function(){return!1}},{key:"supportsTransition",value:function(){return!1}},{key:"loadTexture",value:function(e){if("object"!==_typeof(e)||!e.source)return Promise.reject(new p.PSVError("Invalid panorama configuration, are you using the right adapter?"));if(!this.viewer.getPlugin("video"))return Promise.reject(new p.PSVError("Video adapters require VideoPlugin to be loaded too."));var t=this.__createVideo(e.source);return this.__videoLoadPromise(t).then(function(){var i=new f.VideoTexture(t);return{panorama:e,texture:i}})}},{key:"switchVideo",value:function(e){var t,i,n=!this.config.autoplay,r=this.config.muted,o=1;if(this.video){var a=this.video;t=a.currentTime,i=a.duration,n=a.paused,r=a.muted,o=a.volume}this.__removeVideo(),this.video=e.image,this.video.duration===i&&(this.video.currentTime=t),this.video.muted=r,this.video.volume=o,n||this.video.play()}},{key:"setTextureOpacity",value:function(e,t){e.material.opacity=t,e.material.transparent=t<1}},{key:"setOverlay",value:function(){throw new p.PSVError("VideoAdapter does not support overlay")}},{key:"disposeTexture",value:function(e){var t;if(e.texture){var i=e.texture.image;i.pause(),this.viewer.container.removeChild(i)}null===(t=e.texture)||void 0===t||t.dispose()}},{key:"__removeVideo",value:function(){this.video&&(this.video.pause(),this.viewer.container.removeChild(this.video),delete this.video)}},{key:"__createVideo",value:function(e){var t=document.createElement("video");return t.crossOrigin=this.viewer.config.withCredentials?"use-credentials":"anonymous",t.loop=!0,t.playsInline=!0,t.style.display="none",t.muted=this.config.muted,t.src=e,t.preload="metadata",this.viewer.container.appendChild(t),t}},{key:"__videoLoadPromise",value:function(e){var t=this;return new Promise(function(i,n){var r=function n(){t.video&&e.duration===t.video.duration?i(t.__videoBufferPromise(e,t.video.currentTime)):i(),e.removeEventListener("loadedmetadata",n)},o=function t(i){n(i),e.removeEventListener("error",t)};e.addEventListener("loadedmetadata",r),e.addEventListener("error",o)})}},{key:"__videoBufferPromise",value:function(e,t){return new Promise(function(i){function n(){for(var t=e.buffered,r=0,o=t.length;r=e.currentTime){e.pause(),e.removeEventListener("buffer",n),e.removeEventListener("progress",n),i();break}}e.currentTime=Math.min(t+2e3,e.duration),e.muted=!0,e.addEventListener("buffer",n),e.addEventListener("progress",n),e.play()})}}]),t}(p.AbstractAdapter);y.supportsDownload=!1,y.supportsOverlay=!1;var m=d.utils.getConfigParser({resolution:64,autoplay:!1,muted:!1,blur:!1},{resolution:function(e){if(!e||!v.MathUtils.isPowerOfTwo(e))throw new d.PSVError("EquirectangularTilesAdapter resolution must be power of two");return e}}),g=function(e){function t(e,n){var r;return _classCallCheck(this,t),r=i.call(this,e),r.config=m(n),r.SPHERE_SEGMENTS=r.config.resolution,r.SPHERE_HORIZONTAL_SEGMENTS=r.SPHERE_SEGMENTS/2,r}_inherits(t,e);var i=_createSuper(t);return _createClass(t,[{key:"loadTexture",value:function(e){return _get(_getPrototypeOf(t.prototype),"loadTexture",this).call(this,e).then(function(t){var i=t.texture,n=i.image,r={fullWidth:n.videoWidth,fullHeight:n.videoHeight,croppedWidth:n.videoWidth,croppedHeight:n.videoHeight,croppedX:0,croppedY:0,poseHeading:0,posePitch:0,poseRoll:0};return{panorama:e,texture:i,panoData:r}})}},{key:"createMesh",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=new v.SphereGeometry(d.CONSTANTS.SPHERE_RADIUS*e,this.SPHERE_SEGMENTS,this.SPHERE_HORIZONTAL_SEGMENTS,-Math.PI/2).scale(-1,1,1),i=new v.MeshBasicMaterial;return new v.Mesh(t,i)}},{key:"setTexture",value:function(e,t){var i;null===(i=e.material.map)||void 0===i||i.dispose(),e.material.map=t.texture,this.switchVideo(t.texture)}}]),t}(y);g.id="equirectangular-video",l(n(e,"__esModule",{value:!0}),h)});