/*! * Photo Sphere Viewer 3.5.1 * Copyright (c) 2014-2015 Jérémy Heleine * Copyright (c) 2015-2019 Damien "Mistic" Sorel * Licensed under MIT (https://opensource.org/licenses/MIT) */ !function(t,e){"function"==typeof define&&define.amd?define(["three","uevent","dot/doT"],e):"object"==typeof module&&module.exports?module.exports=e(require("three"),require("uevent"),require("dot/doT")):t.PhotoSphereViewer=e(t.THREE,t.uEvent,t.doT)}(this,function(u,t,o){"use strict";function d(t){if(!(this instanceof d))return new d(t);if(d.SYSTEM.loaded||d._loadSystem(),this.config=k.clone(d.DEFAULTS),k.deepmerge(this.config,t),!t.container)throw new x("No value given for container.");if(!d.SYSTEM.isCanvasSupported)throw new x("Canvas is not supported.");if(!(d.SYSTEM.isWebGLSupported&&this.config.webgl||k.checkTHREE("CanvasRenderer","Projector")))throw new x("Missing Three.js components: CanvasRenderer, Projector. Get them from three.js-examples package.");if(this.config.longitude_range&&2!==this.config.longitude_range.length&&(this.config.longitude_range=null,console.warn("PhotoSphereViewer: longitude_range must have exactly two elements.")),this.config.latitude_range?2!==this.config.latitude_range.length?(this.config.latitude_range=null,console.warn("PhotoSphereViewer: latitude_range must have exactly two elements.")):this.config.latitude_range[0]>this.config.latitude_range[1]&&(this.config.latitude_range=[this.config.latitude_range[1],this.config.latitude_range[0]],console.warn("PhotoSphereViewer: latitude_range values must be ordered.")):void 0===this.config.tilt_up_max&&void 0===this.config.tilt_down_max||(this.config.latitude_range=[void 0!==this.config.tilt_down_max?this.config.tilt_down_max-Math.PI/4:-k.HalfPI,void 0!==this.config.tilt_up_max?this.config.tilt_up_max+Math.PI/4:k.HalfPI],console.warn("PhotoSphereViewer: tilt_up_max and tilt_down_max are deprecated, use latitude_range instead.")),this.config.max_fov"),o=t.substring(e,i),s=null;-1!==e&&-1!==i&&-1!==o.indexOf("GPano:")&&((s={full_width:parseInt(k.getXMPValue(o,"FullPanoWidthPixels")),full_height:parseInt(k.getXMPValue(o,"FullPanoHeightPixels")),cropped_width:parseInt(k.getXMPValue(o,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(k.getXMPValue(o,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(k.getXMPValue(o,"CroppedAreaLeftPixels")),cropped_y:parseInt(k.getXMPValue(o,"CroppedAreaTopPixels"))}).full_width&&s.full_height&&s.cropped_width&&s.cropped_height||(console.warn("PhotoSphereViewer: invalid XMP data"),s=null)),n(s)}else 3===a.readyState&&this.loader.setProgress(r+=10)}.bind(this),a.onprogress=function(t){if(t.lengthComputable){var e=parseInt(t.loaded/t.total*100);rn[t]&&(n[t]=i,this.loader.setProgress(k.sum(n)/6),this.trigger("panorama-load-progress",l[t],n[t]))}},h=function(t,e){throw this.container.textContent="Cannot load image",i(e),new x("Cannot load image "+t)},p=0;p<6;p++){if(this.config.cache_texture){var c=this.getPanoramaCache(l[p]);if(c){a++,n[p]=100,r[p]=c.image;continue}}t.load(l[p],e.bind(this,p),o.bind(this,p),h.bind(this,p))}6===a&&s(r)}.bind(this))},d.prototype._setTexture=function(t){if(this.scene||this._createScene(),this.prop.isCubemap)for(var e=0;e<6;e++)this.mesh.material[e].map&&this.mesh.material[e].map.dispose(),this.mesh.material[e].map=t[e];else this.mesh.material.map&&this.mesh.material.map.dispose(),this.mesh.material.map=t;this.trigger("panorama-loaded"),this._render()},d.prototype._createScene=function(){this.raycaster=new u.Raycaster,this.renderer=d.SYSTEM.isWebGLSupported&&this.config.webgl?new u.WebGLRenderer:new u.CanvasRenderer,this.renderer.setSize(this.prop.size.width,this.prop.size.height),this.renderer.setPixelRatio(d.SYSTEM.pixelRatio);var t=d.SPHERE_RADIUS;this.prop.isCubemap&&(t*=Math.sqrt(3)),this.config.fisheye&&(t+=d.SPHERE_RADIUS),this.camera=new u.PerspectiveCamera(this.config.default_fov,this.prop.size.width/this.prop.size.height,1,t),this.camera.position.set(0,0,0),this.scene=new u.Scene,this.scene.add(this.camera),this.prop.isCubemap?this.mesh=this._createCubemap():this.mesh=this._createSphere(),this.scene.add(this.mesh),this.canvas_container=document.createElement("div"),this.canvas_container.className="psv-canvas-container",this.renderer.domElement.className="psv-canvas",this.container.appendChild(this.canvas_container),this.canvas_container.appendChild(this.renderer.domElement)},d.prototype._createSphere=function(t){t=t||1;var e=new u.SphereGeometry(d.SPHERE_RADIUS*t,d.SPHERE_VERTICES,d.SPHERE_VERTICES,-k.HalfPI),i=new u.MeshBasicMaterial({side:u.DoubleSide,overdraw:d.SYSTEM.isWebGLSupported&&this.config.webgl?0:1}),o=new u.Mesh(e,i);return o.scale.x=-1,o},d.prototype._setSphereCorrection=function(t,e){this.cleanSphereCorrection(e),t.rotation.set(e.tilt,e.pan,e.roll)},d.prototype._createCubemap=function(t){t=t||1;for(var e=new u.BoxGeometry(2*d.SPHERE_RADIUS*t,2*d.SPHERE_RADIUS*t,2*d.SPHERE_RADIUS*t,d.CUBE_VERTICES,d.CUBE_VERTICES,d.CUBE_VERTICES),i=[],o=0;o<6;o++)i.push(new u.MeshBasicMaterial({side:u.BackSide,overdraw:d.SYSTEM.isWebGLSupported&&this.config.webgl?0:1}));var s=new u.Mesh(e,i);return s.position.x-=d.SPHERE_RADIUS*t,s.position.y-=d.SPHERE_RADIUS*t,s.position.z-=d.SPHERE_RADIUS*t,s.applyMatrix((new u.Matrix4).makeScale(1,1,-1)),s},d.prototype._transition=function(i,t){var o,e=this.isExtendedPosition(t),s=void 0!==t.zoom;if(this.prop.isCubemap?(e&&(console.warn("PhotoSphereViewer: cannot perform cubemap transition to different position."),e=!1),(o=this._createCubemap(.9)).material.forEach(function(t,e){t.map=i[e],t.transparent=!0,t.opacity=0})):((o=this._createSphere(.9)).material.map=i,o.material.transparent=!0,o.material.opacity=0,t.sphere_correction&&this._setSphereCorrection(o,t.sphere_correction)),e){this.cleanPosition(t);var n=new u.Vector3(0,1,0);o.rotateOnWorldAxis(n,t.longitude-this.prop.position.longitude);var r=new u.Vector3(0,1,0).cross(this.camera.getWorldDirection()).normalize();o.rotateOnWorldAxis(r,t.latitude-this.prop.position.latitude),(this.config.latitude_range||this.config.longitude_range)&&(this.config.longitude_range=this.config.latitude_range=null,console.warn("PhotoSphereViewer: trying to perform transition with longitude_range and/or latitude_range, ranges cleared."))}return this.scene.add(o),this.needsUpdate(),new M({properties:{opacity:{start:0,end:1},zoom:s?{start:this.prop.zoom_lvl,end:t.zoom}:void 0},duration:this.config.transition.duration,easing:"outCubic",onTick:function(t){if(this.prop.isCubemap)for(var e=0;e<6;e++)o.material[e].opacity=t.opacity;else o.material.opacity=t.opacity;s&&this.zoom(t.zoom),this.needsUpdate()}.bind(this)}).then(function(){this._setTexture(i),this.scene.remove(o),o.geometry.dispose(),o.geometry=null,e&&this.rotate(t),t.sphere_correction?this._setSphereCorrection(this.mesh,t.sphere_correction):this._setSphereCorrection(this.mesh,{})}.bind(this))},d.prototype._reverseAutorotate=function(){var e=this,t=-this.config.anim_speed,i=this.config.longitude_range;this.config.longitude_range=null,new M({properties:{speed:{start:this.config.anim_speed,end:0}},duration:300,easing:"inSine",onTick:function(t){e.config.anim_speed=t.speed}}).then(function(){return new M({properties:{speed:{start:0,end:t}},duration:300,easing:"outSine",onTick:function(t){e.config.anim_speed=t.speed}})}).then(function(){e.config.longitude_range=i,e.config.anim_speed=t})},d.prototype._putPanoramaCache=function(t){if(!this.config.cache_texture)throw new x("Cannot add panorama to cache, cache_texture is disabled");var e=this.getPanoramaCache(t.panorama);e?(e.image=t.image,e.pano_data=t.pano_data):(this.prop.cache=this.prop.cache.slice(0,this.config.cache_texture-1),this.prop.cache.unshift(t)),this.trigger("panorama-cached",t.panorama)},d.prototype._stopAll=function(){this.stopAutorotate(),this.stopAnimation(),this.stopGyroscopeControl(),this.stopStereoView()},d.MOVE_THRESHOLD=4,d.ANGLE_THRESHOLD=.003,d.DBLCLICK_DELAY=300,d.INERTIA_WINDOW=300,d.SPHERE_RADIUS=100,d.SPHERE_VERTICES=64,d.CUBE_VERTICES=8,d.CUBE_MAP=[0,2,4,5,3,1],d.CUBE_HASHMAP=["left","right","top","bottom","back","front"],d.SYSTEM={loaded:!1,pixelRatio:1,isWebGLSupported:!1,isCanvasSupported:!1,deviceOrientationSupported:null,maxTextureWidth:0,mouseWheelEvent:null,fullscreenEvent:null},d.ICONS={},d.DEFAULTS={panorama:null,container:null,caption:null,usexmpdata:!0,pano_data:null,webgl:!0,min_fov:30,max_fov:90,default_fov:null,default_long:0,default_lat:0,sphere_correction:{pan:0,tilt:0,roll:0},longitude_range:null,latitude_range:null,move_speed:1,zoom_speed:2,time_anim:2e3,anim_speed:"2rpm",anim_lat:null,fisheye:!1,navbar:["autorotate","zoom","download","markers","caption","gyroscope","stereo","fullscreen"],tooltip:{offset:5,arrow_size:7,delay:100},lang:{autorotate:"Automatic rotation",zoom:"Zoom",zoomOut:"Zoom out",zoomIn:"Zoom in",download:"Download",fullscreen:"Fullscreen",markers:"Markers",gyroscope:"Gyroscope",stereo:"Stereo view",stereo_notification:"Click anywhere to exit stereo view.",please_rotate:["Please rotate your device","(or tap to continue)"],two_fingers:["Use two fingers to navigate"]},mousewheel:!0,mousewheel_factor:1,mousemove:!0,mousemove_hover:!1,touchmove_two_fingers:!1,keyboard:{ArrowUp:"rotateLatitudeUp",ArrowDown:"rotateLatitudeDown",ArrowRight:"rotateLongitudeRight",ArrowLeft:"rotateLongitudeLeft",PageUp:"zoomIn",PageDown:"zoomOut","+":"zoomIn","-":"zoomOut"," ":"toggleAutorotate"},move_inertia:!0,click_event_on_marker:!1,transition:{duration:1500,loader:!0},loading_img:null,loading_txt:"Loading...",size:null,cache_texture:0,templates:{},markers:[],with_credentials:!1},d.TEMPLATES={markersList:'

{{= it.config.lang.markers }}

    {{~ it.markers: marker }}
  • {{? marker.image }}{{?}}

    {{? marker.tooltip }}{{= marker.tooltip.content }}{{?? marker.html }}{{= marker.html }}{{??}}{{= marker.id }}{{?}}

  • {{~}}
'},d.prototype._bindEvents=function(){window.addEventListener("resize",this),this.config.mousemove&&(this.hud.container.style.cursor="move",this.config.mousemove_hover?(this.hud.container.addEventListener("mouseenter",this),this.hud.container.addEventListener("mouseleave",this)):(this.hud.container.addEventListener("mousedown",this),window.addEventListener("mouseup",this)),this.hud.container.addEventListener("touchstart",this),window.addEventListener("touchend",this),this.hud.container.addEventListener("mousemove",this),this.hud.container.addEventListener("touchmove",this)),d.SYSTEM.fullscreenEvent&&document.addEventListener(d.SYSTEM.fullscreenEvent,this),this.config.mousewheel&&this.hud.container.addEventListener(d.SYSTEM.mouseWheelEvent,this),this.on("_side-reached",function(t){this.isAutorotateEnabled()&&("left"!==t&&"right"!==t||this._reverseAutorotate())})},d.prototype._unbindEvents=function(){window.removeEventListener("resize",this),this.config.mousemove&&(this.hud.container.removeEventListener("mousedown",this),this.hud.container.removeEventListener("mouseenter",this),this.hud.container.removeEventListener("touchstart",this),window.removeEventListener("mouseup",this),window.removeEventListener("touchend",this),this.hud.container.removeEventListener("mouseleave",this),this.hud.container.removeEventListener("mousemove",this),this.hud.container.removeEventListener("touchmove",this)),d.SYSTEM.fullscreenEvent&&document.removeEventListener(d.SYSTEM.fullscreenEvent,this),this.config.mousewheel&&this.hud.container.removeEventListener(d.SYSTEM.mouseWheelEvent,this),this.off("_side-reached")},d.prototype.handleEvent=function(t){switch(t.type){case"resize":k.throttle(this._onResize(),50);break;case"keydown":this._onKeyDown(t);break;case"mousedown":case"mouseenter":this._onMouseDown(t);break;case"touchstart":this._onTouchStart(t);break;case"mouseup":case"mouseleave":this._onMouseUp(t);break;case"touchend":this._onTouchEnd(t);break;case"mousemove":this._onMouseMove(t);break;case"touchmove":this._onTouchMove(t);break;case d.SYSTEM.fullscreenEvent:this._fullscreenToggled();break;case d.SYSTEM.mouseWheelEvent:this._onMouseWheel(t)}},d.prototype._onResize=function(){this.container.clientWidth===this.prop.size.width&&this.container.clientHeight===this.prop.size.height||(this.prop.size.width=parseInt(this.container.clientWidth),this.prop.size.height=parseInt(this.container.clientHeight),this.prop.aspect=this.prop.size.width/this.prop.size.height,this.needsUpdate(),this.renderer&&(this.stereoEffect||this.renderer).setSize(this.prop.size.width,this.prop.size.height),this.trigger("size-updated",this.getSize()))},d.prototype._onKeyDown=function(t){var e=0,i=0,o=0,s=k.getEventKey(t);switch(this.config.keyboard[s]){case"rotateLatitudeUp":i=.01;break;case"rotateLatitudeDown":i=-.01;break;case"rotateLongitudeRight":e=.01;break;case"rotateLongitudeLeft":e=-.01;break;case"zoomIn":o=1;break;case"zoomOut":o=-1;break;case"toggleAutorotate":this.toggleAutorotate()}0!==o?this.zoom(this.prop.zoom_lvl+o*this.config.zoom_speed):0===i&&0===e||this.rotate({longitude:this.prop.position.longitude+e*this.prop.move_speed*this.prop.hFov,latitude:this.prop.position.latitude+i*this.prop.move_speed*this.prop.vFov})},d.prototype._onMouseDown=function(t){this._startMove(t)},d.prototype._onMouseUp=function(t){this._stopMove(t),this.isStereoEnabled()&&this.stopStereoView()},d.prototype._onMouseMove=function(t){0!==t.buttons?(t.preventDefault(),this._move(t)):this.config.mousemove_hover&&this._moveAbsolute(t)},d.prototype._onTouchStart=function(t){1===t.touches.length?this.config.touchmove_two_fingers||this._startMove(t.touches[0]):2===t.touches.length&&this._startMoveZoom(t)},d.prototype._onTouchEnd=function(t){1===t.touches.length?this._stopMoveZoom():0===t.touches.length&&(this._stopMove(t.changedTouches[0]),this.config.touchmove_two_fingers&&this.overlay.hideOverlay())},d.prototype._onTouchMove=function(t){1===t.touches.length?this.config.touchmove_two_fingers?this.overlay.showOverlay({image:d.ICONS["gesture.svg"],text:this.config.lang.two_fingers[0]}):(t.preventDefault(),this._move(t.touches[0])):2===t.touches.length&&(t.preventDefault(),this._moveZoom(t))},d.prototype._startMove=function(t){this.stopAutorotate(),this.stopAnimation().then(function(){this.prop.mouse_x=this.prop.start_mouse_x=parseInt(t.clientX),this.prop.mouse_y=this.prop.start_mouse_y=parseInt(t.clientY),this.prop.moving=!0,this.prop.zooming=!1,this.prop.mouse_history.length=0,this._logMouseMove(t)}.bind(this))},d.prototype._startMoveZoom=function(t){var e=[{x:parseInt(t.touches[0].clientX),y:parseInt(t.touches[0].clientY)},{x:parseInt(t.touches[1].clientX),y:parseInt(t.touches[1].clientY)}];this.prop.pinch_dist=Math.sqrt(Math.pow(e[0].x-e[1].x,2)+Math.pow(e[0].y-e[1].y,2)),this.prop.mouse_x=this.prop.start_mouse_x=(e[0].x+e[1].x)/2,this.prop.mouse_y=this.prop.start_mouse_x=(e[0].y+e[1].y)/2,this.prop.moving=!0,this.prop.zooming=!0},d.prototype._stopMove=function(t){k.getClosest(t.target,".psv-hud")&&this.prop.moving&&(Math.abs(t.clientX-this.prop.start_mouse_x)d.INERTIA_WINDOW/10?(this.prop.mouse_history.splice(0,o),o=0):o++,this.prop.mouse_history[0][o])},d.prototype.load=function(){if(!this.config.panorama)throw new x("No value given for panorama.");return this.setPanorama(this.config.panorama,!1)},d.prototype.getPosition=function(){return{longitude:this.prop.position.longitude,latitude:this.prop.position.latitude}},d.prototype.getZoomLevel=function(){return this.prop.zoom_lvl},d.prototype.getSize=function(){return{width:this.prop.size.width,height:this.prop.size.height}},d.prototype.isAutorotateEnabled=function(){return!!this.prop.autorotate_cb},d.prototype.isGyroscopeEnabled=function(){return!!this.prop.orientation_cb},d.prototype.isStereoEnabled=function(){return!!this.stereoEffect},d.prototype.isFullscreenEnabled=function(){return k.isFullscreenEnabled(this.container)},d.prototype.needsUpdate=function(){this.prop.needsUpdate=!0},d.prototype.render=function(){this._render()},d.prototype.destroy=function(){window.cancelAnimationFrame(this.prop.main_reqid),this._stopAll(),this.stopKeyboardControl(),this.stopNoSleep(),this.exitFullscreen(),this.unlockOrientation(),this._unbindEvents(),this.tooltip&&this.tooltip.destroy(),this.notification&&this.notification.destroy(),this.hud&&this.hud.destroy(),this.loader&&this.loader.destroy(),this.navbar&&this.navbar.destroy(),this.panel&&this.panel.destroy(),this.overlay&&this.overlay.destroy(),this.scene&&k.cleanTHREEScene(this.scene),this.canvas_container&&this.container.removeChild(this.canvas_container),this.parent.removeChild(this.container),delete this.parent.photoSphereViewer,delete this.parent,delete this.container,delete this.loader,delete this.navbar,delete this.hud,delete this.panel,delete this.tooltip,delete this.notification,delete this.overlay,delete this.canvas_container,delete this.renderer,delete this.noSleep,delete this.scene,delete this.camera,delete this.mesh,delete this.raycaster,delete this.passes,delete this.config,this.prop.cache.length=0},d.prototype.setPanorama=function(t,e,i){if(null!==this.prop.loading_promise)throw new x("Loading already in progress");"boolean"==typeof e&&(i=e,e=void 0),e||this.scene?e||(e={}):e={longitude:this.config.default_long,latitude:this.config.default_lat,zoom:this.config.default_zoom_lvl,sphere_correction:this.config.sphere_correction};var o=this.isExtendedPosition(e),s="zoom"in e;(o||s)&&this._stopAll(),this.config.panorama=t;var n=function(){this.loader.hide(),this.canvas_container.style.opacity=1,this.prop.loading_promise=null}.bind(this);return i&&this.config.transition&&this.scene?(this.config.transition.loader&&this.loader.show(),this.prop.loading_promise=this._loadTexture(this.config.panorama).then(function(t){return this.loader.hide(),this._transition(t,e)}.bind(this)).then(n,n)):(this.loader.show(),this.canvas_container&&(this.canvas_container.style.opacity=0),this.prop.loading_promise=this._loadTexture(this.config.panorama).then(function(t){this._setTexture(t),e.sphere_correction&&!this.prop.isCubemap&&this._setSphereCorrection(this.mesh,e.sphere_correction),o&&this.rotate(e),s&&this.zoom(e.zoom)}.bind(this)).then(n,n)),this.prop.loading_promise},d.prototype.startAutorotate=function(){this._stopAll(),this.prop.autorotate_cb=this._getAutorotateUpdate(),this.on("before-render",this.prop.autorotate_cb),this.trigger("autorotate",!0)},d.prototype._getAutorotateUpdate=function(){var e,i;return function(t){i=void 0===e?0:t-e,e=t,this.rotate({longitude:this.prop.position.longitude+this.config.anim_speed*i/1e3,latitude:this.prop.position.latitude-(this.prop.position.latitude-this.config.anim_lat)/200})}},d.prototype.stopAutorotate=function(){this.prop.start_timeout&&(window.clearTimeout(this.prop.start_timeout),this.prop.start_timeout=null),this.isAutorotateEnabled()&&(this.off("before-render",this.prop.autorotate_cb),this.prop.autorotate_cb=null,this.trigger("autorotate",!1))},d.prototype.toggleAutorotate=function(){this.isAutorotateEnabled()?this.stopAutorotate():this.startAutorotate()},d.prototype.startGyroscopeControl=function(){if(k.checkTHREE("DeviceOrientationControls"))return d.SYSTEM.deviceOrientationSupported.then(function(t){if(!t)return console.warn("PhotoSphereViewer: gyroscope not available"),Promise.reject();this._stopAll(),this.doControls=new u.DeviceOrientationControls(this.camera),this.doControls.alphaOffset=this.prop.position.longitude,this.doControls.update();var e=this.camera.getWorldDirection(new u.Vector3),i=this.vector3ToSphericalCoords(e);this.prop.gyro_alpha_offset=i.longitude,this.prop.orientation_cb=this._getOrientationUpdate(),this.on("before-render",this.prop.orientation_cb),this.trigger("gyroscope-updated",!0)}.bind(this));throw new x("Missing Three.js components: DeviceOrientationControls. Get them from three.js-examples package.")},d.prototype._getOrientationUpdate=function(){return function(){this.doControls.alphaOffset=this.prop.gyro_alpha_offset,this.doControls.update(),this.camera.getWorldDirection(this.prop.direction),this.prop.direction.multiplyScalar(d.SPHERE_RADIUS);var t=this.vector3ToSphericalCoords(this.prop.direction);this.prop.position.longitude=t.longitude,this.prop.position.latitude=t.latitude,this.needsUpdate()}},d.prototype.stopGyroscopeControl=function(){this.isGyroscopeEnabled()&&(this.off("before-render",this.prop.orientation_cb),this.prop.orientation_cb=null,this.doControls.disconnect(),this.doControls=null,this.trigger("gyroscope-updated",!1))},d.prototype.toggleGyroscopeControl=function(){this.isGyroscopeEnabled()?this.stopGyroscopeControl():this.startGyroscopeControl()},d.prototype.startNoSleep=function(){"NoSleep"in window?(this.noSleep||(this.noSleep=new NoSleep),this.noSleep.enable()):console.warn("PhotoSphereViewer: NoSleep is not available")},d.prototype.stopNoSleep=function(){this.noSleep&&this.noSleep.disable()},d.prototype.startStereoView=function(){if(!k.checkTHREE("DeviceOrientationControls","StereoEffect"))throw new x("Missing Three.js components: StereoEffect, DeviceOrientationControls. Get them from three.js-examples package.");this.startNoSleep(),this.enterFullscreen(),this.lockOrientation(),this.startGyroscopeControl().then(function(){this.stereoEffect=new u.StereoEffect(this.renderer),this.needsUpdate(),this.hud.hide(),this.navbar.hide(),this.panel.hidePanel(),this.trigger("stereo-updated",!0),this.notification.showNotification({content:this.config.lang.stereo_notification,timeout:3e3})}.bind(this),function(){this.unlockOrientation(),this.exitFullscreen(),this.stopNoSleep()}.bind(this))},d.prototype.stopStereoView=function(){this.isStereoEnabled()&&(this.stereoEffect=null,this.needsUpdate(),this.hud.show(),this.navbar.show(),this.unlockOrientation(),this.exitFullscreen(),this.stopNoSleep(),this.stopGyroscopeControl(),this.trigger("stereo-updated",!1))},d.prototype.lockOrientation=function(){var t,e=function(){this.isStereoEnabled()&&window.innerHeight>window.innerWidth&&this.overlay.showOverlay({image:d.ICONS["mobile-rotate.svg"],text:this.config.lang.please_rotate[0],subtext:this.config.lang.please_rotate[1]}),t&&window.clearTimeout(t)};window.screen&&window.screen.orientation?(window.screen.orientation.lock("landscape").then(null,e.bind(this)),t=setTimeout(e.bind(this),500)):e.apply(this)},d.prototype.unlockOrientation=function(){window.screen&&window.screen.orientation?window.screen.orientation.unlock():this.overlay.hideOverlay()},d.prototype.toggleStereoView=function(){this.isStereoEnabled()?this.stopStereoView():this.startStereoView()},d.prototype.rotate=function(t,e){this.cleanPosition(t),e||this.applyRanges(t).forEach(this.trigger.bind(this,"_side-reached")),this.prop.position.longitude=t.longitude,this.prop.position.latitude=t.latitude,this.needsUpdate(),this.trigger("position-updated",this.getPosition())},d.prototype.animate=function(t,e){this._stopAll();var i,o=this.isExtendedPosition(t),s="zoom"in t,n={};if(o){this.cleanPosition(t),this.applyRanges(t);var r=this.prop.position,a=Math.abs(t.longitude-r.longitude),h=Math.abs(t.latitude-r.latitude);if(d.ANGLE_THRESHOLD<=a||d.ANGLE_THRESHOLD<=h){var p=k.getShortestArc(this.prop.position.longitude,t.longitude);n.longitude={start:r.longitude,end:r.longitude+p},n.latitude={start:r.latitude,end:t.latitude},i=this.speedToDuration(e,k.getAngle(r,t))}}if(s){var c=Math.abs(t.zoom-this.prop.zoom_lvl);1<=c&&(n.zoom={start:this.prop.zoom_lvl,end:t.zoom},i||(i=this.speedToDuration(e,Math.PI/4*c/100)))}return i?(this.prop.animation_promise=new M({properties:n,duration:i,easing:"inOutSine",onTick:function(t){o&&this.rotate(t,!0),s&&this.zoom(t.zoom)}.bind(this)}),this.prop.animation_promise):(o&&this.rotate(t),s&&this.zoom(t.zoom),M.resolve())},d.prototype.stopAnimation=function(){return this.prop.animation_promise?new Promise(function(t){this.prop.animation_promise.finally(t),this.prop.animation_promise.cancel(),this.prop.animation_promise=null}.bind(this)):Promise.resolve()},d.prototype.zoom=function(t){this.prop.zoom_lvl=k.bound(t,0,100),this.prop.vFov=this.config.max_fov+this.prop.zoom_lvl/100*(this.config.min_fov-this.config.max_fov),this.prop.hFov=u.Math.radToDeg(2*Math.atan(Math.tan(u.Math.degToRad(this.prop.vFov)/2)*this.prop.aspect)),this.needsUpdate(),this.trigger("zoom-updated",this.getZoomLevel())},d.prototype.zoomIn=function(){this.prop.zoom_lvl<100&&this.zoom(this.prop.zoom_lvl+this.config.zoom_speed)},d.prototype.zoomOut=function(){0=Math.PI?e-Math.PI:e+Math.PI,latitude:k.HalfPI-i}},d.prototype.sphericalCoordsToTextureCoords=function(t){if(this.prop.isCubemap)throw new x("Unable to use texture coords with cubemap.");var e=t.longitude/k.TwoPI*this.prop.pano_data.full_width,i=t.latitude/Math.PI*this.prop.pano_data.full_height;return{x:parseInt(t.longitudee[1]?t.longitude>e[1]&&t.longitudee[0]/2+e[1]/2?(t.longitude=e[0],o.push("left")):(t.longitude=e[1],o.push("right"))):t.longitudee[1]&&(t.longitude=e[1],o.push("right"))),this.config.latitude_range&&(e=k.clone(this.config.latitude_range),i=u.Math.degToRad(this.prop.vFov)/2,e[0]=k.parseAngle(Math.min(e[0]+i,e[1]),!0),e[1]=k.parseAngle(Math.max(e[1]-i,e[0]),!0),t.latitudee[1]&&(t.latitude=e[1],o.push("top"))),o},s.className=null,s.publicMethods=[],s.prototype.create=function(){this.container=document.createElement("div"),this.constructor.className&&(this.container.className=this.constructor.className),this.parent.container.appendChild(this.container)},s.prototype.destroy=function(){this.parent.container.removeChild(this.container),this.constructor.publicMethods&&this.constructor.publicMethods.forEach(function(t){delete this.psv[t]},this),delete this.container,delete this.psv,delete this.parent},s.prototype.hide=function(){this.container.style.display="none",this.visible=!1},s.prototype.show=function(){this.container.style.display="",this.visible=!0},((n.prototype=Object.create(s.prototype)).constructor=n).className="psv-hud",n.publicMethods=["addMarker","removeMarker","updateMarker","clearMarkers","getMarker","getCurrentMarker","gotoMarker","hideMarker","showMarker","toggleMarker","toggleMarkersList","showMarkersList","hideMarkersList"],n.prototype.create=function(){s.prototype.create.call(this),this.svgContainer=document.createElementNS(k.svgNS,"svg"),this.svgContainer.setAttribute("class","psv-hud-svg-container"),this.container.appendChild(this.svgContainer),this.container.addEventListener("mouseenter",this,!0),this.container.addEventListener("mouseleave",this,!0),this.container.addEventListener("mousemove",this,!0),this.psv.on("click",this),this.psv.on("dblclick",this),this.psv.on("render",this),this.psv.on("open-panel",this),this.psv.on("close-panel",this)},n.prototype.destroy=function(){this.clearMarkers(!1),this.container.removeEventListener("mouseenter",this),this.container.removeEventListener("mouseleave",this),this.container.removeEventListener("mousemove",this),this.psv.off("click",this),this.psv.off("dblclick",this),this.psv.off("render",this),this.psv.off("open-panel",this),this.psv.off("close-panel",this),delete this.svgContainer,s.prototype.destroy.call(this)},n.prototype.handleEvent=function(t){switch(t.type){case"mouseenter":this._onMouseEnter(t);break;case"mouseleave":this._onMouseLeave(t);break;case"mousemove":this._onMouseMove(t);break;case"click":this._onClick(t.args[0],t,!1);break;case"dblclick":this._onClick(t.args[0],t,!0);break;case"render":this.renderMarkers();break;case"open-panel":this._onPanelOpened();break;case"close-panel":this._onPanelClosed()}},n.prototype.addMarker=function(t,e){if(!t.id)throw new x("missing marker id");if(this.markers[t.id])throw new x('marker "'+t.id+'" already exists');var i=new S(t,this.psv);return i.isNormal()?this.container.appendChild(i.$el):this.svgContainer.appendChild(i.$el),this.markers[i.id]=i,!1!==e&&this.renderMarkers(),i},n.prototype.getMarker=function(t){var e="object"==typeof t?t.id:t;if(!this.markers[e])throw new x('cannot find marker "'+e+'"');return this.markers[e]},n.prototype.getCurrentMarker=function(){return this.currentMarker},n.prototype.updateMarker=function(t,e){var i=this.getMarker(t);return i.update(t),!1!==e&&this.renderMarkers(),i},n.prototype.removeMarker=function(t,e){(t=this.getMarker(t)).isNormal()?this.container.removeChild(t.$el):this.svgContainer.removeChild(t.$el),this.hoveringMarker===t&&this.psv.tooltip.hideTooltip(),t.destroy(),delete this.markers[t.id],!1!==e&&this.renderMarkers()},n.prototype.clearMarkers=function(t){Object.keys(this.markers).forEach(function(t){this.removeMarker(t,!1)},this),!1!==t&&this.renderMarkers()},n.prototype.gotoMarker=function(t,e){return t=this.getMarker(t),this.psv.animate(t,e).then(function(){this.psv.trigger("goto-marker-done",t)}.bind(this))},n.prototype.hideMarker=function(t){this.getMarker(t).visible=!1,this.renderMarkers()},n.prototype.showMarker=function(t){this.getMarker(t).visible=!0,this.renderMarkers()},n.prototype.toggleMarker=function(t){this.getMarker(t).visible^=!0,this.renderMarkers()},n.prototype.toggleMarkersList=function(){this.prop.panelOpened?this.hideMarkersList():this.showMarkersList()},n.prototype.showMarkersList=function(){var e=[];k.forEach(this.markers,function(t){e.push(t)});var t=this.psv.config.templates.markersList({markers:this.psv.change("render-markers-list",e),config:this.psv.config});this.prop.panelOpening=!0,this.psv.panel.showPanel(t,!0),this.psv.panel.container.querySelector(".psv-markers-list").addEventListener("click",this._onClickItem.bind(this))},n.prototype.hideMarkersList=function(){this.prop.panelOpened&&this.psv.panel.hidePanel()},n.prototype.renderMarkers=function(){if(this.visible){var r=this.psv.isGyroscopeEnabled()?u.Math.radToDeg(this.psv.camera.rotation.z):0;k.forEach(this.markers,function(t){var e=t.visible;if(e&&t.isPoly()){var i=this._getPolyPositions(t);if(e=i.length>(t.isPolygon()?2:1)){t.position2D=this._getPolyDimensions(t,i);var o=i.map(function(t){return t.x+","+t.y}).join(" ");t.$el.setAttributeNS(null,"points",o)}}else if(e){var s=this._getMarkerPosition(t);if(e=this._isMarkerVisible(t,s)){t.position2D=s;var n=t.getScale(this.psv.getZoomLevel());t.isSvg()?t.$el.setAttributeNS(null,"transform","translate("+s.x+", "+s.y+")"+(1!==n?" scale("+n+", "+n+")":"")+(!t.lockRotation&&r?" rotate("+r+")":"")):t.$el.style.transform="translate3D("+s.x+"px, "+s.y+"px, 0px)"+(1!==n?" scale("+n+", "+n+")":"")+(!t.lockRotation&&r?" rotateZ("+r+"deg)":"")}}k.toggleClass(t.$el,"psv-marker--visible",e)}.bind(this))}},n.prototype._isMarkerVisible=function(t,e){return 0=this.prop.width?(this.button.hide(),this.content.style.display=""):(this.button.show(),this.content.style.display="none")},((h.prototype=Object.create(s.prototype)).constructor=h).className="psv-notification",h.publicMethods=["showNotification","hideNotification","isNotificationVisible"],h.prototype.create=function(){s.prototype.create.call(this),this.content=document.createElement("div"),this.content.className="psv-notification-content",this.container.appendChild(this.content),this.content.addEventListener("click",this.hideNotification.bind(this))},h.prototype.destroy=function(){delete this.content,s.prototype.destroy.call(this)},h.prototype.isNotificationVisible=function(){return this.container.classList.contains("psv-notification--visible")},h.prototype.showNotification=function(t){"string"==typeof t&&(t={content:t}),this.content.innerHTML=t.content,this.container.classList.add("psv-notification--visible"),this.psv.trigger("show-notification"),t.timeout&&setTimeout(this.hideNotification.bind(this),t.timeout)},h.prototype.hideNotification=function(){this.isNotificationVisible()&&(this.container.classList.remove("psv-notification--visible"),this.psv.trigger("hide-notification"))},((p.prototype=Object.create(s.prototype)).constructor=p).className="psv-overlay",p.publicMethods=["showOverlay","hideOverlay","isOverlayVisible"],p.prototype.create=function(){s.prototype.create.call(this),this.image=document.createElement("div"),this.image.className="psv-overlay-image",this.container.appendChild(this.image),this.text=document.createElement("div"),this.text.className="psv-overlay-text",this.container.appendChild(this.text),this.subtext=document.createElement("div"),this.subtext.className="psv-overlay-subtext",this.container.appendChild(this.subtext),this.container.addEventListener("click",this.hideOverlay.bind(this))},p.prototype.destroy=function(){delete this.image,delete this.text,delete this.subtext,s.prototype.destroy.call(this)},p.prototype.isOverlayVisible=function(){return this.visible},p.prototype.showOverlay=function(t){"string"==typeof t&&(t={text:t}),this.image.innerHTML=t.image||"",this.text.innerHTML=t.text||"",this.subtext.innerHTML=t.subtext||"",this.show(),this.psv.trigger("show-overlay")},p.prototype.hideOverlay=function(){this.isOverlayVisible()&&(this.hide(),this.psv.trigger("hide-overlay"))},((c.prototype=Object.create(s.prototype)).constructor=c).className="psv-panel",c.publicMethods=["showPanel","hidePanel"],c.prototype.create=function(){s.prototype.create.call(this),this.container.innerHTML='
',this.content=this.container.querySelector(".psv-panel-content"),this.container.querySelector(".psv-panel-close-button").addEventListener("click",this.hidePanel.bind(this)),this.psv.config.mousewheel&&this.container.addEventListener(d.SYSTEM.mouseWheelEvent,function(t){t.stopPropagation()});var t=this.container.querySelector(".psv-panel-resizer");t.addEventListener("mousedown",this),t.addEventListener("touchstart",this),this.psv.container.addEventListener("mouseup",this),this.psv.container.addEventListener("touchend",this),this.psv.container.addEventListener("mousemove",this),this.psv.container.addEventListener("touchmove",this)},c.prototype.destroy=function(){this.psv.container.removeEventListener("mousemove",this),this.psv.container.removeEventListener("touchmove",this),this.psv.container.removeEventListener("mouseup",this),this.psv.container.removeEventListener("touchend",this),delete this.prop,delete this.content,s.prototype.destroy.call(this)},c.prototype.handleEvent=function(t){switch(t.type){case"mousedown":this._onMouseDown(t);break;case"touchstart":this._onTouchStart(t);break;case"mousemove":this._onMouseMove(t);break;case"touchmove":this._onTouchMove(t);break;case"mouseup":case"touchend":this._onMouseUp(t)}},c.prototype.showPanel=function(t,e){this.content.innerHTML=t,this.content.scrollTop=0,this.container.classList.add("psv-panel--open"),k.toggleClass(this.content,"psv-panel-content--no-margin",!0===e),this.prop.opened=!0,this.psv.trigger("open-panel")},c.prototype.hidePanel=function(){this.content.innerHTML=null,this.prop.opened=!1,this.container.classList.remove("psv-panel--open"),this.psv.trigger("close-panel")},c.prototype._onMouseDown=function(t){t.stopPropagation(),this._startResize(t)},c.prototype._onTouchStart=function(t){t.stopPropagation(),this._startResize(t.changedTouches[0])},c.prototype._onMouseUp=function(t){this.prop.mousedown&&(t.stopPropagation(),this.prop.mousedown=!1,this.content.classList.remove("psv-panel-content--no-interaction"))},c.prototype._onMouseMove=function(t){this.prop.mousedown&&(t.stopPropagation(),this._resize(t))},c.prototype._onTouchMove=function(t){this.prop.mousedown&&this._resize(t.touches[0])},c.prototype._startResize=function(t){this.prop.mouse_x=parseInt(t.clientX),this.prop.mouse_y=parseInt(t.clientY),this.prop.mousedown=!0,this.content.classList.add("psv-panel-content--no-interaction")},c.prototype._resize=function(t){var e=parseInt(t.clientX),i=parseInt(t.clientY);this.container.style.width=this.container.offsetWidth-(e-this.prop.mouse_x)+"px",this.prop.mouse_x=e,this.prop.mouse_y=i},((l.prototype=Object.create(s.prototype)).constructor=l).className="psv-tooltip",l.publicMethods=["showTooltip","hideTooltip","isTooltipVisible"],l.leftMap={0:"left",.5:"center",1:"right"},l.topMap={0:"top",.5:"center",1:"bottom"},l.prototype.create=function(){s.prototype.create.call(this),this.container.innerHTML='
',this.container.style.top="-1000px",this.container.style.left="-1000px",this.content=this.container.querySelector(".psv-tooltip-content"),this.arrow=this.container.querySelector(".psv-tooltip-arrow"),this.psv.on("render",this)},l.prototype.destroy=function(){this.psv.off("render",this),delete this.config,delete this.prop,s.prototype.destroy.call(this)},l.prototype.handleEvent=function(t){switch(t.type){case"render":this.hideTooltip()}},l.prototype.isTooltipVisible=function(){return this.container.classList.contains("psv-tooltip--visible")},l.prototype.showTooltip=function(t){this.prop.timeout&&(window.clearTimeout(this.prop.timeout),this.prop.timeout=null);var e=this.isTooltipVisible(),i=this.container,o=this.content,s=this.arrow;if(t.position||(t.position=["top","center"]),t.box||(t.box={width:0,height:0}),"string"==typeof t.position){var n=k.parsePosition(t.position);if(!(n.left in l.leftMap&&n.top in l.topMap))throw new x('unable to parse tooltip position "'+t.position+'"');t.position=[l.topMap[n.top],l.leftMap[n.left]]}if("center"===t.position[0]&&"center"===t.position[1])throw new x('unable to parse tooltip position "center center"');if(e)for(var r=i.classList.length-1;0<=r;r--){var a=i.classList.item(r);"psv-tooltip"!==a&&"psv-tooltip--visible"!==a&&i.classList.remove(a)}else i.className="psv-tooltip";t.className&&k.addClasses(i,t.className),o.innerHTML=t.content,i.style.top="0px",i.style.left="0px";var h=i.getBoundingClientRect(),p={posClass:t.position.slice(),width:h.right-h.left,height:h.bottom-h.top,top:0,left:0,arrow_top:0,arrow_left:0};this._computeTooltipPosition(p,t);var c=!1;p.topthis.psv.prop.size.height-this.config.offset&&(p.posClass[0]="top",c=!0),p.leftthis.psv.prop.size.width-this.config.offset&&(p.posClass[1]="left",c=!0),c&&this._computeTooltipPosition(p,t),i.style.top=p.top+"px",i.style.left=p.left+"px",s.style.top=p.arrow_top+"px",s.style.left=p.arrow_left+"px",i.classList.add("psv-tooltip--"+p.posClass.join("-")),e||(this.prop.timeout=window.setTimeout(function(){i.classList.add("psv-tooltip--visible"),this.prop.timeout=null,this.psv.trigger("show-tooltip")}.bind(this),this.config.delay))},l.prototype.hideTooltip=function(){this.prop.timeout&&(window.clearTimeout(this.prop.timeout),this.prop.timeout=null),this.isTooltipVisible()&&(this.container.classList.remove("psv-tooltip--visible"),this.prop.timeout=window.setTimeout(function(){this.content.innerHTML=null,this.container.style.top="-1000px",this.container.style.left="-1000px",this.prop.timeout=null}.bind(this),this.config.delay),this.psv.trigger("hide-tooltip"))},l.prototype._computeTooltipPosition=function(t,e){var i=!1;switch(t.posClass[0]){case"bottom":t.top=e.top+e.box.height+this.config.offset+this.config.arrow_size,t.arrow_top=2*-this.config.arrow_size,i=!0;break;case"center":t.top=e.top+e.box.height/2-t.height/2,t.arrow_top=t.height/2-this.config.arrow_size;break;case"top":t.top=e.top-t.height-this.config.offset-this.config.arrow_size,t.arrow_top=t.height,i=!0}switch(t.posClass[1]){case"right":t.arrow_left=i?(t.left=e.left+e.box.width/2-this.config.offset-this.config.arrow_size,this.config.offset):(t.left=e.left+e.box.width+this.config.offset+this.config.arrow_size,2*-this.config.arrow_size);break;case"center":t.left=e.left+e.box.width/2-t.width/2,t.arrow_left=t.width/2-this.config.arrow_size;break;case"left":t.arrow_left=i?(t.left=e.left-t.width+e.box.width/2+this.config.offset+this.config.arrow_size,t.width-this.config.offset-2*this.config.arrow_size):(t.left=e.left-t.width-this.config.offset-this.config.arrow_size,t.width)}},((f.prototype=Object.create(s.prototype)).constructor=f).id=null,f.icon=null,f.iconActive=null,f.prototype.create=function(){s.prototype.create.call(this),this.constructor.icon&&this._setIcon(this.constructor.icon),this.id&&this.psv.config.lang[this.id]&&(this.container.title=this.psv.config.lang[this.id]),this.container.addEventListener("click",function(t){this.enabled&&this._onClick(),t.stopPropagation()}.bind(this));var t=this.supported();"function"==typeof t.then?(this.hide(),t.then(function(t){t&&this.show()}.bind(this))):t||this.hide()},f.prototype.destroy=function(){s.prototype.destroy.call(this)},f.prototype.supported=function(){return!0},f.prototype.toggleActive=function(t){k.toggleClass(this.container,"psv-button--active",t),this.constructor.iconActive&&this._setIcon(t?this.constructor.iconActive:this.constructor.icon)},f.prototype.disable=function(){this.container.classList.add("psv-button--disabled"),this.enabled=!1},f.prototype.enable=function(){this.container.classList.remove("psv-button--disabled"),this.enabled=!0},f.prototype._setIcon=function(t,e){e||(e=this.container),t?(e.innerHTML=d.ICONS[t],e.querySelector("svg").setAttribute("class","psv-button-svg")):e.innerHTML=""},f.prototype._onClick=function(){},((i.prototype=Object.create(f.prototype)).constructor=i).id="autorotate",i.className="psv-button psv-button--hover-scale psv-autorotate-button",i.icon="play.svg",i.iconActive="play-active.svg",i.prototype.create=function(){f.prototype.create.call(this),this.psv.on("autorotate",this)},i.prototype.destroy=function(){this.psv.off("autorotate",this),f.prototype.destroy.call(this)},i.prototype.handleEvent=function(t){switch(t.type){case"autorotate":this.toggleActive(t.args[0])}},i.prototype._onClick=function(){this.psv.toggleAutorotate()},((g.prototype=Object.create(f.prototype)).constructor=g).id="markers",g.className="psv-button psv-button--hover-scale psv-caption-button",g.icon="info.svg",g.prototype.create=function(){f.prototype.create.call(this),this.psv.on("hide-notification",this)},g.prototype.destroy=function(){this.psv.off("hide-notification",this),f.prototype.destroy.call(this)},g.prototype.handleEvent=function(t){switch(t.type){case"hide-notification":this.toggleActive(!1)}},g.prototype._onClick=function(){this.psv.isNotificationVisible()?this.psv.hideNotification():(this.psv.showNotification(this.parent.prop.caption),this.toggleActive(!0))},((m.prototype=Object.create(f.prototype)).constructor=m).className="psv-button psv-custom-button",m.prototype.create=function(){f.prototype.create.call(this),this.config.className&&k.addClasses(this.container,this.config.className),this.config.title&&(this.container.title=this.config.title),this.config.content&&(this.container.innerHTML=this.config.content),!1!==this.config.enabled&&!0!==this.config.disabled||this.disable(),!1!==this.config.visible&&!0!==this.config.hidden||this.hide()},m.prototype.destroy=function(){delete this.config,f.prototype.destroy.call(this)},m.prototype._onClick=function(){this.config.onClick&&this.config.onClick.apply(this.psv)},((v.prototype=Object.create(f.prototype)).constructor=v).id="download",v.className="psv-button psv-button--hover-scale psv-download-button",v.icon="download.svg",v.prototype._onClick=function(){var t=document.createElement("a");t.href=this.psv.config.panorama,t.download=this.psv.config.panorama,this.psv.container.appendChild(t),t.click()},((y.prototype=Object.create(f.prototype)).constructor=y).id="fullscreen",y.className="psv-button psv-button--hover-scale psv-fullscreen-button",y.icon="fullscreen-in.svg",y.iconActive="fullscreen-out.svg",y.prototype.create=function(){f.prototype.create.call(this),this.psv.on("fullscreen-updated",this)},y.prototype.destroy=function(){this.psv.off("fullscreen-updated",this),f.prototype.destroy.call(this)},y.prototype.supported=function(){return!!d.SYSTEM.fullscreenEvent},y.prototype.handleEvent=function(t){switch(t.type){case"fullscreen-updated":this.toggleActive(t.args[0])}},y.prototype._onClick=function(){this.psv.toggleFullscreen()},((_.prototype=Object.create(f.prototype)).constructor=_).id="gyroscope",_.className="psv-button psv-button--hover-scale psv-gyroscope-button",_.icon="compass.svg",_.prototype.create=function(){f.prototype.create.call(this),this.psv.on("gyroscope-updated",this)},_.prototype.destroy=function(){this.psv.off("gyroscope-updated",this),f.prototype.destroy.call(this)},_.prototype.supported=function(){return!!k.checkTHREE("DeviceOrientationControls")&&d.SYSTEM.deviceOrientationSupported},_.prototype.handleEvent=function(t){switch(t.type){case"gyroscope-updated":this.toggleActive(t.args[0])}},_.prototype._onClick=function(){this.psv.toggleGyroscopeControl()},((w.prototype=Object.create(f.prototype)).constructor=w).id="markers",w.className="psv-button psv-button--hover-scale psv-markers-button",w.icon="pin.svg",w.prototype._onClick=function(){this.psv.hud.toggleMarkersList()},((b.prototype=Object.create(f.prototype)).constructor=b).id="stereo",b.className="psv-button psv-button--hover-scale psv-stereo-button",b.icon="stereo.svg",b.prototype.create=function(){f.prototype.create.call(this),this.psv.on("stereo-updated",this)},b.prototype.destroy=function(){this.psv.off("stereo-updated",this),f.prototype.destroy.call(this)},b.prototype.supported=function(){return!(!d.SYSTEM.fullscreenEvent||!k.checkTHREE("DeviceOrientationControls"))&&d.SYSTEM.deviceOrientationSupported},b.prototype.handleEvent=function(t){switch(t.type){case"stereo-updated":this.toggleActive(t.args[0])}},b.prototype._onClick=function(){this.psv.toggleStereoView()},((E.prototype=Object.create(f.prototype)).constructor=E).id="zoom",E.className="psv-button psv-zoom-button",E.prototype.create=function(){f.prototype.create.call(this);var t=document.createElement("div");t.className="psv-zoom-button-minus",t.title=this.psv.config.lang.zoomOut,this._setIcon("zoom-out.svg",t),this.container.appendChild(t);var e=document.createElement("div");e.className="psv-zoom-button-range",this.container.appendChild(e),this.zoom_range=document.createElement("div"),this.zoom_range.className="psv-zoom-button-line",e.appendChild(this.zoom_range),this.zoom_value=document.createElement("div"),this.zoom_value.className="psv-zoom-button-handle",this.zoom_range.appendChild(this.zoom_value);var i=document.createElement("div");i.className="psv-zoom-button-plus",i.title=this.psv.config.lang.zoomIn,this._setIcon("zoom-in.svg",i),this.container.appendChild(i),this.zoom_range.addEventListener("mousedown",this),this.zoom_range.addEventListener("touchstart",this),this.psv.container.addEventListener("mousemove",this),this.psv.container.addEventListener("touchmove",this),this.psv.container.addEventListener("mouseup",this),this.psv.container.addEventListener("touchend",this),t.addEventListener("mousedown",this._zoomOut.bind(this)),i.addEventListener("mousedown",this._zoomIn.bind(this)),this.psv.on("zoom-updated",this),this.psv.once("ready",function(){this._moveZoomValue(this.psv.prop.zoom_lvl)}.bind(this))},E.prototype.destroy=function(){this._stopZoomChange(),this.psv.container.removeEventListener("mousemove",this),this.psv.container.removeEventListener("touchmove",this),this.psv.container.removeEventListener("mouseup",this),this.psv.container.removeEventListener("touchend",this),delete this.zoom_range,delete this.zoom_value,this.psv.off("zoom-updated",this),f.prototype.destroy.call(this)},E.prototype.handleEvent=function(t){switch(t.type){case"mousedown":this._initZoomChangeWithMouse(t);break;case"touchstart":this._initZoomChangeByTouch(t);break;case"mousemove":this._changeZoomWithMouse(t);break;case"touchmove":this._changeZoomByTouch(t);break;case"mouseup":case"touchend":this._stopZoomChange(t);break;case"zoom-updated":this._moveZoomValue(t.args[0])}},E.prototype._moveZoomValue=function(t){this.zoom_value.style.left=t/100*this.zoom_range.offsetWidth-this.zoom_value.offsetWidth/2+"px"},E.prototype._initZoomChangeWithMouse=function(t){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(t.clientX))},E.prototype._initZoomChangeByTouch=function(t){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(t.changedTouches[0].clientX))},E.prototype._zoomIn=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomIn(),this.prop.longPressTimeout=window.setTimeout(this._startLongPressInterval.bind(this,1),200))},E.prototype._zoomOut=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomOut(),this.prop.longPressTimeout=window.setTimeout(this._startLongPressInterval.bind(this,-1),200))},E.prototype._startLongPressInterval=function(t){this.prop.buttondown&&(this.prop.longPressInterval=window.setInterval(function(){this.psv.zoom(this.psv.prop.zoom_lvl+t)}.bind(this),50))},E.prototype._stopZoomChange=function(){this.enabled&&(window.clearInterval(this.prop.longPressInterval),window.clearTimeout(this.prop.longPressTimeout),this.prop.longPressInterval=null,this.prop.mousedown=!1,this.prop.buttondown=!1)},E.prototype._changeZoomWithMouse=function(t){this.enabled&&(t.preventDefault(),this._changeZoom(t.clientX))},E.prototype._changeZoomByTouch=function(t){this.enabled&&this._changeZoom(t.changedTouches[0].clientX)},E.prototype._changeZoom=function(t){if(this.prop.mousedown){var e=(parseInt(t)-this.zoom_range.getBoundingClientRect().left)/this.zoom_range.offsetWidth*100;this.psv.zoom(e)}},M.easings={linear:function(t){return t},inQuad:function(t){return t*t},outQuad:function(t){return t*(2-t)},inOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},inCubic:function(t){return t*t*t},outCubic:function(t){return--t*t*t+1},inOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},inQuart:function(t){return t*t*t*t},outQuart:function(t){return 1- --t*t*t*t},inOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},inQuint:function(t){return t*t*t*t*t},outQuint:function(t){return 1+--t*t*t*t*t},inOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t},inSine:function(t){return 1-Math.cos(t*(Math.PI/2))},outSine:function(t){return Math.sin(t*(Math.PI/2))},inOutSine:function(t){return.5-.5*Math.cos(Math.PI*t)},inExpo:function(t){return Math.pow(2,10*(t-1))},outExpo:function(t){return 1-Math.pow(2,-10*t)},inOutExpo:function(t){return(t=2*t-1)<0?.5*Math.pow(2,10*t):1-.5*Math.pow(2,-10*t)},inCirc:function(t){return 1-Math.sqrt(1-t*t)},outCirc:function(t){return t--,Math.sqrt(1-t*t)},inOutCirc:function(t){return(t*=2)<1?.5-.5*Math.sqrt(1-t*t):.5+.5*Math.sqrt(1-(t-=2)*t)}},M.prototype._run=function(t){if(!this._cancelled){null===this._start&&(this._start=t);var e,i=(t-this._start)/this._options.duration,o={};if(i<1){for(e in this._options.properties)this._options.properties[e]&&(o[e]=this._options.properties[e].start+(this._options.properties[e].end-this._options.properties[e].start)*this._options.easing(i));this._options.onTick(o,i),window.requestAnimationFrame(this._run.bind(this))}else{for(e in this._options.properties)this._options.properties[e]&&(o[e]=this._options.properties[e].end);this._options.onTick(o,1),window.requestAnimationFrame(function(){this._resolved=!0,this._resolve()}.bind(this))}}},M.prototype.then=function(t,e){var i=new M;return i._promise.then(null,this.cancel.bind(this)),this._promise.then(function(){i._resolve(t?t():void 0)},function(){i._reject(e?e():void 0)}),i},M.prototype.catch=function(t){return this.then(void 0,t)},M.prototype.finally=function(t){return this.then(t,t)},M.prototype.cancel=function(){this._cancelled||this._resolved||(this._cancelled=!0,this._reject(),this._delayTimeout&&(window.cancelAnimationFrame(this._delayTimeout),this._delayTimeout=null))},(x.prototype=Object.create(Error.prototype)).name="PSVError",d.Error=x.prototype.constructor=x,S.types=["image","html","polygon_px","polygon_rad","polyline_px","polyline_rad","rect","circle","ellipse","path"],S.getType=function(e,t){var i=[];if(S.types.forEach(function(t){e[t]&&i.push(t)}),0===i.length&&!t)throw new x("missing marker content, either "+S.types.join(", "));if(1(.*)"))?i[1]:null!==(i=t.match("GPano:"+e+'="(.*?)"'))?i[1]:null},k.isFullscreenEnabled=function(t){return(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)===t},k.requestFullscreen=function(t){(t.requestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullscreen||t.msRequestFullscreen).call(t)},k.exitFullscreen=function(){(document.exitFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.msExitFullscreen).call(document)},k.getStyle=function(t,e){return window.getComputedStyle(t,null)[e]},k.getShortestArc=function(i,o){return[0,k.TwoPI,-k.TwoPI].reduce(function(t,e){return e=o-i+e,Math.abs(e)