"use strict";window.pannellum=function(e,t,n){function a(a,o){var i,r,s,l,h,c,d,u,p,f=this,m=!1,v=Date.now(),y=0,g=0,w=-1,b=0,P=0,M=new Array(10),x=!1,E=!1,L=!1,C={yaw:0,pitch:0,hfov:0},k=!1,I=!1,z=0,R=0,O={},S={},H=[],D=!1,T=!1,N={hfov:100,minHfov:50,multiResMinHfov:!1,maxHfov:120,pitch:0,minPitch:n,maxPitch:n,yaw:0,minYaw:-180,maxYaw:180,roll:0,haov:360,vaov:180,vOffset:0,autoRotate:!1,autoRotateInactivityDelay:-1,autoRotateStopDelay:n,type:"equirectangular",northOffset:0,showFullscreenCtrl:!0,dynamic:!1,dynamicUpdate:!1,doubleClickZoom:!0,keyboardZoom:!0,mouseZoom:!0,showZoomCtrl:!0,autoLoad:!1,showControls:!0,orientationOnByDefault:!1,hotSpotDebug:!1,backgroundColor:[0,0,0],avoidShowingBackground:!1,animationTimingFunction:function(e){return e<.5?2*e*e:(4-2*e)*e-1},draggable:!0,disableKeyboardCtrl:!1,crossOrigin:"anonymous",touchPanSpeedCoeffFactor:1,capturedKeyNumbers:[16,17,27,37,38,39,40,61,65,68,83,87,107,109,173,187,189],friction:.15,strings:{loadButtonLabel:"Click to
Load
Panorama",loadingLabel:"Loading...",bylineLabel:"by %s",noPanoramaError:"No panorama image was specified.",fileAccessError:"The file %s could not be accessed.",malformedURLError:"There is something wrong with the panorama URL.",iOS8WebGLError:"Due to iOS 8's broken WebGL implementation, only progressive encoded JPEGs work for your device (this panorama uses standard encoding).",genericWebGLError:"Your browser does not have the necessary WebGL support to display this panorama.",textureSizeError:"This panorama is too big for your device! It's %spx wide, but your device only supports images up to %spx wide. Try another device. (If you're the author, try scaling down the image.)",unknownError:"Unknown error. Check developer console."}};(a="string"==typeof a?t.getElementById(a):a).classList.add("pnlm-container"),a.tabIndex=0;var F=t.createElement("div");F.className="pnlm-ui",a.appendChild(F);var A=t.createElement("div");A.className="pnlm-render-container",a.appendChild(A);var Y=t.createElement("div");Y.className="pnlm-dragfix",F.appendChild(Y);var W=t.createElement("span");W.className="pnlm-about-msg",W.innerHTML='Pannellum',F.appendChild(W),Y.addEventListener("contextmenu",function e(t){var n=V(t);W.style.left=n.x+"px";W.style.top=n.y+"px";clearTimeout(e.t1);clearTimeout(e.t2);W.style.display="block";W.style.opacity=1;e.t1=setTimeout(function(){W.style.opacity=0},2e3);e.t2=setTimeout(function(){W.style.display="none"},2500);t.preventDefault()});var B={},q=t.createElement("div");q.className="pnlm-sprite pnlm-hot-spot-debug-indicator",F.appendChild(q),B.container=t.createElement("div"),B.container.className="pnlm-panorama-info",B.title=t.createElement("div"),B.title.className="pnlm-title-box",B.container.appendChild(B.title),B.author=t.createElement("div"),B.author.className="pnlm-author-box",B.container.appendChild(B.author),F.appendChild(B.container),B.load={},B.load.box=t.createElement("div"),B.load.box.className="pnlm-load-box",B.load.boxp=t.createElement("p"),B.load.box.appendChild(B.load.boxp),B.load.lbox=t.createElement("div"),B.load.lbox.className="pnlm-lbox",B.load.lbox.innerHTML='
',B.load.box.appendChild(B.load.lbox),B.load.lbar=t.createElement("div"),B.load.lbar.className="pnlm-lbar",B.load.lbarFill=t.createElement("div"),B.load.lbarFill.className="pnlm-lbar-fill",B.load.lbar.appendChild(B.load.lbarFill),B.load.box.appendChild(B.load.lbar),B.load.msg=t.createElement("p"),B.load.msg.className="pnlm-lmsg",B.load.box.appendChild(B.load.msg),F.appendChild(B.load.box),B.errorMsg=t.createElement("div"),B.errorMsg.className="pnlm-error-msg pnlm-info-box",F.appendChild(B.errorMsg);var G={};G.container=t.createElement("div"),G.container.className="pnlm-controls-container",F.appendChild(G.container),G.load=t.createElement("div"),G.load.className="pnlm-load-button",G.load.addEventListener("click",function(){Ie(),De()}),F.appendChild(G.load),G.zoom=t.createElement("div"),G.zoom.className="pnlm-zoom-controls pnlm-controls",G.zoomIn=t.createElement("div"),G.zoomIn.className="pnlm-zoom-in pnlm-sprite pnlm-control",G.zoomIn.addEventListener("click",function(){l&&(Se(i.hfov-5),ge())}),G.zoom.appendChild(G.zoomIn),G.zoomOut=t.createElement("div"),G.zoomOut.className="pnlm-zoom-out pnlm-sprite pnlm-control",G.zoomOut.addEventListener("click",function(){l&&(Se(i.hfov+5),ge())}),G.zoom.appendChild(G.zoomOut),G.container.appendChild(G.zoom),G.fullscreen=t.createElement("div"),G.fullscreen.addEventListener("click",ze),G.fullscreen.className="pnlm-fullscreen-toggle-button pnlm-sprite pnlm-fullscreen-toggle-button-inactive pnlm-controls pnlm-control",(t.fullscreenEnabled||t.mozFullScreenEnabled||t.webkitFullscreenEnabled||t.msFullscreenEnabled)&&G.container.appendChild(G.fullscreen),G.orientation=t.createElement("div"),G.orientation.addEventListener("click",function(e){I?Ne():Fe()}),G.orientation.addEventListener("mousedown",function(e){e.stopPropagation()}),G.orientation.addEventListener("touchstart",function(e){e.stopPropagation()}),G.orientation.addEventListener("pointerdown",function(e){e.stopPropagation()}),G.orientation.className="pnlm-orientation-button pnlm-orientation-button-inactive pnlm-sprite pnlm-controls pnlm-control";var U,j=!1;e.DeviceOrientationEvent?e.addEventListener("deviceorientation",function t(n){e.removeEventListener("deviceorientation",t),n&&null!==n.alpha&&null!==n.beta&&null!==n.gamma?(G.container.appendChild(G.orientation),U=!0,j&&Fe()):U=!1}):U=!1;var Z=t.createElement("div");function X(){var a=t.createElement("div");if(a.innerHTML="\x3c!--[if lte IE 9]>65536)&&J(i.strings.iOS8WebGLError)}var r=t.indexOf("-1&&!0!==i.ignoreGPanoXMP){var l=t.substring(r,t.indexOf("")+12),c=function(e){var t;return l.indexOf(e+'="')>=0?t=(t=l.substring(l.indexOf(e+'="')+e.length+2)).substring(0,t.indexOf('"')):l.indexOf(e+">")>=0&&(t=(t=l.substring(l.indexOf(e+">")+e.length+1)).substring(0,t.indexOf("<"))),t!==n?Number(t):null},d={fullWidth:c("GPano:FullPanoWidthPixels"),croppedWidth:c("GPano:CroppedAreaImageWidthPixels"),fullHeight:c("GPano:FullPanoHeightPixels"),croppedHeight:c("GPano:CroppedAreaImageHeightPixels"),topPixels:c("GPano:CroppedAreaTopPixels"),heading:c("GPano:PoseHeadingDegrees"),horizonPitch:c("GPano:PosePitchDegrees"),horizonRoll:c("GPano:PoseRollDegrees")};null!==d.fullWidth&&null!==d.croppedWidth&&null!==d.fullHeight&&null!==d.croppedHeight&&null!==d.topPixels&&(H.indexOf("haov")<0&&(i.haov=d.croppedWidth/d.fullWidth*360),H.indexOf("vaov")<0&&(i.vaov=d.croppedHeight/d.fullHeight*180),H.indexOf("vOffset")<0&&(i.vOffset=-180*((d.topPixels+d.croppedHeight/2)/d.fullHeight-.5)),null!==d.heading&&H.indexOf("northOffset")<0&&(i.northOffset=d.heading,!1!==i.compass&&(i.compass=!0)),null!==d.horizonPitch&&null!==d.horizonRoll&&(H.indexOf("horizonPitch")<0&&(i.horizonPitch=d.horizonPitch),H.indexOf("horizonRoll")<0&&(i.horizonRoll=d.horizonRoll)))}h.src=e.URL.createObjectURL(o)}),s.readAsBinaryString!==n?s.readAsBinaryString(o):s.readAsText(o),B.load.msg.innerHTML=""},f.onprogress=function(e){if(e.lengthComputable){var t,n,a,o=e.loaded/e.total*100;B.load.lbarFill.style.width=o+"%",e.total>1e6?(t="MB",n=(e.loaded/1e6).toFixed(2),a=(e.total/1e6).toFixed(2)):e.total>1e3?(t="kB",n=(e.loaded/1e3).toFixed(1),a=(e.total/1e3).toFixed(1)):(t="B",n=e.loaded,a=e.total),B.load.msg.innerHTML=n+" / "+a+" "+t}else B.load.lbox.style.display="block",B.load.lbar.style.display="none"};try{f.open("GET",r,!0)}catch(e){J(i.strings.malformedURLError)}f.responseType="blob",f.setRequestHeader("Accept","image/*,*/*;q=0.9"),f.withCredentials="use-credentials"===i.crossOrigin,f.send()}i.draggable&&F.classList.add("pnlm-grab"),F.classList.remove("pnlm-grabbing")}else J()}function K(e){return new RegExp("^(?:[a-z]+:)?//","i").test(e)||"/"==e[0]||"blob:"==e.slice(0,5)}function _(){r||(r=new libpannellum.renderer(A)),L||(L=!0,Y.addEventListener("mousedown",Q,!1),t.addEventListener("mousemove",te,!1),t.addEventListener("mouseup",ne,!1),i.mouseZoom&&(F.addEventListener("mousewheel",de,!1),F.addEventListener("DOMMouseScroll",de,!1)),i.doubleClickZoom&&Y.addEventListener("dblclick",$,!1),a.addEventListener("mozfullscreenchange",Re,!1),a.addEventListener("webkitfullscreenchange",Re,!1),a.addEventListener("msfullscreenchange",Re,!1),a.addEventListener("fullscreenchange",Re,!1),e.addEventListener("resize",ye,!1),e.addEventListener("orientationchange",ye,!1),i.disableKeyboardCtrl||(a.addEventListener("keydown",ue,!1),a.addEventListener("keyup",fe,!1),a.addEventListener("blur",pe,!1)),t.addEventListener("mouseleave",ne,!1),""===t.documentElement.style.pointerAction&&""===t.documentElement.style.touchAction?(Y.addEventListener("pointerdown",le,!1),Y.addEventListener("pointermove",he,!1),Y.addEventListener("pointerup",ce,!1),Y.addEventListener("pointerleave",ce,!1)):(Y.addEventListener("touchstart",ae,!1),Y.addEventListener("touchmove",oe,!1),Y.addEventListener("touchend",ie,!1)),e.navigator.pointerEnabled&&(a.style.touchAction="none")),function(){try{var e={};i.horizonPitch!==n&&(e.horizonPitch=i.horizonPitch*Math.PI/180),i.horizonRoll!==n&&(e.horizonRoll=i.horizonRoll*Math.PI/180),i.backgroundColor!==n&&(e.backgroundColor=i.backgroundColor),r.init(h,i.type,i.dynamic,i.haov*Math.PI/180,i.vaov*Math.PI/180,i.vOffset*Math.PI/180,xe,e),!0!==i.dynamic&&(h=n)}catch(e){if("webgl error"==e.type||"no webgl"==e.type)J();else{if("webgl size error"!=e.type)throw J(i.strings.unknownError),e;J(i.strings.textureSizeError.replace("%s",e.width).replace("%s",e.maxWidth))}}}(),Se(i.hfov),setTimeout(function(){!0},500)}function J(e){e===n&&(e=i.strings.genericWebGLError),B.errorMsg.innerHTML=""+e+"
",G.load.style.display="none",B.load.box.style.display="none",B.errorMsg.style.display="table",E=!0,A.style.display="none",We("error",e)}function V(e){var t=a.getBoundingClientRect(),n={};return n.x=(e.clientX||e.pageX)-t.left,n.y=(e.clientY||e.pageY)-t.top,n}function Q(e){if(e.preventDefault(),a.focus(),l&&i.draggable){var t=V(e);if(i.hotSpotDebug){var n=ee(e);console.log("Pitch: "+n[0]+", Yaw: "+n[1]+", Center Pitch: "+i.pitch+", Center Yaw: "+i.yaw+", HFOV: "+i.hfov)}He(),Ne(),i.roll=0,C.hfov=0,m=!0,v=Date.now(),y=t.x,g=t.y,b=i.yaw,P=i.pitch,F.classList.add("pnlm-grabbing"),F.classList.remove("pnlm-grab"),We("mousedown",e),ge()}}function $(e){if(i.minHfov===i.hfov)f.setHfov(u,1e3);else{var t=ee(e);f.lookAt(t[0],t[1],i.minHfov,1e3)}}function ee(e){var t=V(e),n=r.getCanvas(),a=n.clientWidth,o=n.clientHeight,s=t.x/a*2-1,l=(1-t.y/o*2)*o/a,h=1/Math.tan(i.hfov*Math.PI/360),c=Math.sin(i.pitch*Math.PI/180),d=Math.cos(i.pitch*Math.PI/180),u=h*d-l*c,p=Math.sqrt(s*s+u*u),f=180*Math.atan((l*d+h*c)/p)/Math.PI,m=180*Math.atan2(s/p,u/p)/Math.PI+i.yaw;return m<-180&&(m+=360),m>180&&(m-=360),[f,m]}function te(e){if(m&&l){v=Date.now();var t=r.getCanvas(),n=t.clientWidth,a=t.clientHeight,o=V(e),s=180*(Math.atan(y/n*2-1)-Math.atan(o.x/n*2-1))/Math.PI*i.hfov/90+b;C.yaw=(s-i.yaw)%360*.2,i.yaw=s;var h=2*Math.atan(Math.tan(i.hfov/360*Math.PI)*a/n)*180/Math.PI,c=180*(Math.atan(o.y/a*2-1)-Math.atan(g/a*2-1))/Math.PI*h/90+P;C.pitch=.2*(c-i.pitch),i.pitch=c}}function ne(e){m&&(m=!1,Date.now()-v>15&&(C.pitch=C.yaw=0),F.classList.add("pnlm-grab"),F.classList.remove("pnlm-grabbing"),v=Date.now(),We("mouseup",e))}function ae(e){if(l&&i.draggable){He(),Ne(),i.roll=0,C.hfov=0;var t=V(e.targetTouches[0]);if(y=t.x,g=t.y,2==e.targetTouches.length){var n=V(e.targetTouches[1]);y+=.5*(n.x-t.x),g+=.5*(n.y-t.y),w=Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}m=!0,v=Date.now(),b=i.yaw,P=i.pitch,We("touchstart",e),ge()}}function oe(e){if(i.draggable&&(e.preventDefault(),l&&(v=Date.now()),m&&l)){var t=V(e.targetTouches[0]),n=t.x,a=t.y;if(2==e.targetTouches.length&&-1!=w){var o=V(e.targetTouches[1]);n+=.5*(o.x-t.x),a+=.5*(o.y-t.y);var r=Math.sqrt((t.x-o.x)*(t.x-o.x)+(t.y-o.y)*(t.y-o.y));Se(i.hfov+.1*(w-r)),w=r}var s=i.hfov/360*i.touchPanSpeedCoeffFactor,h=(y-n)*s+b;C.yaw=(h-i.yaw)%360*.2,i.yaw=h;var c=(a-g)*s+P;C.pitch=.2*(c-i.pitch),i.pitch=c}}function ie(){m=!1,Date.now()-v>150&&(C.pitch=C.yaw=0),w=-1,v=Date.now(),We("touchend",event)}Z.className="pnlm-compass pnlm-controls pnlm-control",F.appendChild(Z),o.firstScene?ke(o.firstScene):o.default&&o.default.firstScene?ke(o.default.firstScene):ke(null),Ie(!0);var re=[],se=[];function le(e){"touch"==e.pointerType&&(re.push(e.pointerId),se.push({clientX:e.clientX,clientY:e.clientY}),e.targetTouches=se,ae(e),e.preventDefault())}function he(e){if("touch"==e.pointerType)for(var t=0;t0?1:-1),ge())}function ue(e){He(),v=Date.now(),Ne(),i.roll=0;var t=e.which||e.keycode;i.capturedKeyNumbers.indexOf(t)<0||(e.preventDefault(),27==t?x&&ze():me(t,!0))}function pe(){for(var e=0;e<10;e++)M[e]=!1}function fe(e){var t=e.which||e.keycode;i.capturedKeyNumbers.indexOf(t)<0||(e.preventDefault(),me(t,!1))}function me(e,t){var n=!1;switch(e){case 109:case 189:case 17:case 173:M[0]!=t&&(n=!0),M[0]=t;break;case 107:case 187:case 16:case 61:M[1]!=t&&(n=!0),M[1]=t;break;case 38:M[2]!=t&&(n=!0),M[2]=t;break;case 87:M[6]!=t&&(n=!0),M[6]=t;break;case 40:M[3]!=t&&(n=!0),M[3]=t;break;case 83:M[7]!=t&&(n=!0),M[7]=t;break;case 37:M[4]!=t&&(n=!0),M[4]=t;break;case 65:M[8]!=t&&(n=!0),M[8]=t;break;case 39:M[5]!=t&&(n=!0),M[5]=t;break;case 68:M[9]!=t&&(n=!0),M[9]=t}n&&t&&(c="undefined"!=typeof performance&&performance.now()?performance.now():Date.now(),ge())}function ve(e){var t=O[e],n=Math.min(1,Math.max((Date.now()-t.startTime)/1e3/(t.duration/1e3),0)),a=t.startPosition+i.animationTimingFunction(n)*(t.endPosition-t.startPosition);(t.endPosition>t.startPosition&&a>=t.endPosition||t.endPositioni.haov;h?s*(1-Math.min(Math.cos((i.pitch-o)/180*Math.PI),Math.cos((i.pitch+o)/180*Math.PI))):t=o*(1-Math.min(Math.cos((i.pitch-s)/180*Math.PI),Math.cos((i.pitch+s)/180*Math.PI)))}var d=i.maxYaw-i.minYaw,u=-180,p=180;d<360&&(u=i.minYaw+i.hfov/2+t,p=i.maxYaw-i.hfov/2-t,d180?i.yaw-=360:i.yaw<-180&&(i.yaw+=360),!1!==i.autoRotate&&e!=i.yaw&&c!==n&&(i.autoRotate*=-1);var a=r.getCanvas(),f=2*Math.atan(Math.tan(i.hfov/180*Math.PI*.5)/(a.width/a.height))/Math.PI*180,m=i.minPitch+f/2,v=i.maxPitch-f/2,y=i.maxPitch-i.minPitch;y.01||Math.abs(C.pitch)>.01||Math.abs(C.hfov)>.01)!function(){if(l){var e,t=!1,a=i.pitch,o=i.yaw,r=i.hfov;e="undefined"!=typeof performance&&performance.now()?performance.now():Date.now(),c===n&&(c=e);var s=(e-c)*i.hfov/1700;if(s=Math.min(s,1),M[0]&&!0===i.keyboardZoom&&(Se(i.hfov+(.8*C.hfov+.5)*s),t=!0),M[1]&&!0===i.keyboardZoom&&(Se(i.hfov+(.8*C.hfov-.2)*s),t=!0),(M[2]||M[6])&&(i.pitch+=(.8*C.pitch+.2)*s,t=!0),(M[3]||M[7])&&(i.pitch+=(.8*C.pitch-.2)*s,t=!0),(M[4]||M[8])&&(i.yaw+=(.8*C.yaw-.2)*s,t=!0),(M[5]||M[9])&&(i.yaw+=(.8*C.yaw+.2)*s,t=!0),t&&(v=Date.now()),Date.now(),i.autoRotate){if(e-c>.001){var h=(e-c)/1e3,d=(C.yaw/h*s-.2*i.autoRotate)*h;d=(-i.autoRotate>0?1:-1)*Math.min(Math.abs(i.autoRotate*h),Math.abs(d)),i.yaw+=d}i.autoRotateStopDelay&&(i.autoRotateStopDelay-=e-c,i.autoRotateStopDelay<=0&&(i.autoRotateStopDelay=!1,R=i.autoRotate,i.autoRotate=0))}if(O.pitch&&(ve("pitch"),a=i.pitch),O.yaw&&(ve("yaw"),o=i.yaw),O.hfov&&(ve("hfov"),r=i.hfov),s>0&&!i.autoRotate){var u=1-i.friction;M[4]||M[5]||M[8]||M[9]||O.yaw||(i.yaw+=C.yaw*s*u),M[2]||M[3]||M[6]||M[7]||O.pitch||(i.pitch+=C.pitch*s*u),M[0]||M[1]||O.hfov||Se(i.hfov+C.hfov*s*u)}if(c=e,s>0){C.yaw=.8*C.yaw+(i.yaw-o)/s*.2,C.pitch=.8*C.pitch+(i.pitch-a)/s*.2,C.hfov=.8*C.hfov+(i.hfov-r)/s*.2;var p=i.autoRotate?Math.abs(i.autoRotate):5;C.yaw=Math.min(p,Math.max(C.yaw,-p)),C.pitch=Math.min(p,Math.max(C.pitch,-p)),C.hfov=Math.min(p,Math.max(C.hfov,-p))}M[0]&&M[1]&&(C.hfov=0),(M[2]||M[6])&&(M[3]||M[7])&&(C.pitch=0),(M[4]||M[8])&&(M[5]||M[9])&&(C.yaw=0)}}(),i.autoRotateInactivityDelay>=0&&R&&Date.now()-v>i.autoRotateInactivityDelay&&!i.autoRotate&&(i.autoRotate=R,f.lookAt(p,n,u,3e3)),requestAnimationFrame(we);else if(r&&(r.isLoading()||!0===i.dynamic&&D))requestAnimationFrame(we);else{We("animatefinished",{pitch:f.getPitch(),yaw:f.getYaw(),hfov:f.getHfov()}),k=!1,c=n;var e=i.autoRotateInactivityDelay-(Date.now()-v);e>0?d=setTimeout(function(){i.autoRotate=R,f.lookAt(p,n,u,3e3),ge()},e):i.autoRotateInactivityDelay>=0&&R&&(i.autoRotate=R,f.lookAt(p,n,u,3e3),ge())}}function be(e,t,n,a){this.w=e,this.x=t,this.y=n,this.z=a}function Pe(t,n,a){var o=function(e,t,n){var a=[t?t*Math.PI/180/2:0,n?n*Math.PI/180/2:0,e?e*Math.PI/180/2:0],o=[Math.cos(a[0]),Math.cos(a[1]),Math.cos(a[2])],i=[Math.sin(a[0]),Math.sin(a[1]),Math.sin(a[2])];return new be(o[0]*o[1]*o[2]-i[0]*i[1]*i[2],i[0]*o[1]*o[2]-o[0]*i[1]*i[2],o[0]*i[1]*o[2]+i[0]*o[1]*i[2],o[0]*o[1]*i[2]+i[0]*i[1]*o[2])}(t,n,a);o=o.multiply(new be(Math.sqrt(.5),-Math.sqrt(.5),0,0));var i=e.orientation?-e.orientation*Math.PI/180/2:0;return o.multiply(new be(Math.cos(i),0,-Math.sin(i),0))}function Me(e){var t=Pe(e.alpha,e.beta,e.gamma).toEulerAngles();"number"==typeof I&&I<10?I+=1:10===I?(z=t[2]/Math.PI*180+i.yaw,I=!0,requestAnimationFrame(we)):(i.pitch=t[0]/Math.PI*180,i.roll=-t[1]/Math.PI*180,i.yaw=-t[2]/Math.PI*180+z)}function xe(){if(i.sceneFadeDuration&&r.fadeImg!==n){r.fadeImg.style.opacity=0;var e=r.fadeImg;delete r.fadeImg,setTimeout(function(){A.removeChild(e),We("scenechangefadedone")},i.sceneFadeDuration)}i.compass?Z.style.display="inline":Z.style.display="none",function(){if(T)return;i.hotSpots?(i.hotSpots=i.hotSpots.sort(function(e,t){return e.pitch-90&&l<=0||(e.yaw>90||e.yaw<=-90)&&l<=0)e.div.style.visibility="hidden";else{var h=Math.sin((-e.yaw+i.yaw)*Math.PI/180),c=Math.tan(i.hfov*Math.PI/360);e.div.style.visibility="visible";var d=r.getCanvas(),u=d.clientWidth,p=d.clientHeight,f=[-u/c*h*n/l/2,-u/c*(t*o-n*s*a)/l/2],m=Math.sin(i.roll*Math.PI/180),v=Math.cos(i.roll*Math.PI/180);(f=[f[0]*v-f[1]*m,f[0]*m+f[1]*v])[0]+=(u-e.div.offsetWidth)/2,f[1]+=(p-e.div.offsetHeight)/2;var y="translate("+f[0]+"px, "+f[1]+"px) translateZ(9999px) rotate("+i.roll+"deg)";e.div.style.webkitTransform=y,e.div.style.MozTransform=y,e.div.style.transform=y}}function Ce(){i.hotSpots.forEach(Le)}function ke(e){var t,n;i={};var a=["haov","vaov","vOffset","northOffset","horizonPitch","horizonRoll"];for(t in H=[],N)N.hasOwnProperty(t)&&(i[t]=N[t]);for(t in o.default)if(o.default.hasOwnProperty(t))if("strings"==t)for(n in o.default.strings)o.default.strings.hasOwnProperty(n)&&(i.strings[n]=Ae(o.default.strings[n]));else i[t]=o.default[t],a.indexOf(t)>=0&&H.push(t);if(null!==e&&""!==e&&o.scenes&&o.scenes[e]){var r=o.scenes[e];for(t in r)if(r.hasOwnProperty(t))if("strings"==t)for(n in r.strings)r.strings.hasOwnProperty(n)&&(i.strings[n]=Ae(r.strings[n]));else i[t]=r[t],a.indexOf(t)>=0&&H.push(t);i.scene=e}for(t in o)if(o.hasOwnProperty(t))if("strings"==t)for(n in o.strings)o.strings.hasOwnProperty(n)&&(i.strings[n]=Ae(o.strings[n]));else i[t]=o[t],a.indexOf(t)>=0&&H.push(t)}function Ie(e){if((e=e||!1)&&"preview"in i){var a=i.preview;i.basePath&&!K(a)&&(a=i.basePath+a),(s=t.createElement("div")).className="pnlm-preview-img",s.style.backgroundImage="url('"+Ye(a).replace(/"/g,"%22").replace(/'/g,"%27")+"')",A.appendChild(s)}var o=i.title,l=i.author;for(var h in e&&("previewTitle"in i&&(i.title=i.previewTitle),"previewAuthor"in i&&(i.author=i.previewAuthor)),i.hasOwnProperty("title")||(B.title.innerHTML=""),i.hasOwnProperty("author")||(B.author.innerHTML=""),i.hasOwnProperty("title")||i.hasOwnProperty("author")||(B.container.style.display="none"),G.load.innerHTML=""+i.strings.loadButtonLabel+"
",B.load.boxp.innerHTML=i.strings.loadingLabel,i)if(i.hasOwnProperty(h))switch(h){case"title":B.title.innerHTML=Ae(i[h]),B.container.style.display="inline";break;case"author":B.author.innerHTML=i.strings.bylineLabel.replace("%s",Ae(i[h])),B.container.style.display="inline";break;case"fallback":var c=t.createElement("a");c.href=Ye(i[h]),c.target="_blank",c.textContent="Click here to view this panorama in an alternative viewer.";var d=t.createElement("p");d.textContent="Your browser does not support WebGL.",d.appendChild(t.createElement("br")),d.appendChild(c),B.errorMsg.innerHTML="",B.errorMsg.appendChild(d);break;case"hfov":Se(Number(i[h]));break;case"autoLoad":!0===i[h]&&r===n&&(B.load.box.style.display="inline",G.load.style.display="none",X());break;case"showZoomCtrl":i[h]&&0!=i.showControls?G.zoom.style.display="block":G.zoom.style.display="none";break;case"showFullscreenCtrl":i[h]&&0!=i.showControls&&("fullscreen"in t||"mozFullScreen"in t||"webkitIsFullScreen"in t||"msFullscreenElement"in t)?G.fullscreen.style.display="block":G.fullscreen.style.display="none";break;case"hotSpotDebug":i[h]?q.style.display="block":q.style.display="none";break;case"showControls":i[h]||(G.orientation.style.display="none",G.zoom.style.display="none",G.fullscreen.style.display="none");break;case"orientationOnByDefault":i[h]&&(U===n?j=!0:!0===U&&Fe())}e&&(o?i.title=o:delete i.title,l?i.author=l:delete i.author)}function ze(){if(l&&!E)if(x)t.exitFullscreen?t.exitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitCancelFullScreen?t.webkitCancelFullScreen():t.msExitFullscreen&&t.msExitFullscreen();else try{a.requestFullscreen?a.requestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.msRequestFullscreen?a.msRequestFullscreen():a.webkitRequestFullScreen()}catch(e){}}function Re(e){t.fullscreenElement||t.fullscreen||t.mozFullScreen||t.webkitIsFullScreen||t.msFullscreenElement?(G.fullscreen.classList.add("pnlm-fullscreen-toggle-button-active"),x=!0):(G.fullscreen.classList.remove("pnlm-fullscreen-toggle-button-active"),x=!1),"resize"!==e&&We("fullscreenchange",x),r.resize(),Se(i.hfov),ge()}function Oe(e){var t=i.minHfov;if("multires"==i.type&&r&&i.multiResMinHfov&&(t=Math.min(t,r.getCanvas().width/(i.multiRes.cubeResolution/90*.9))),t>i.maxHfov)return console.log("HFOV bounds do not make sense (minHfov > maxHfov)."),i.hfov;var n=i.hfov;if(n=ei.maxHfov?i.maxHfov:e,i.avoidShowingBackground&&r){var a=r.getCanvas();n=Math.min(n,360*Math.atan(Math.tan((i.maxPitch-i.minPitch)/360*Math.PI)/a.height*a.width)/Math.PI)}return n}function Se(e){i.hfov=Oe(e),We("zoomchange",i.hfov)}function He(){O={},R=i.autoRotate?i.autoRotate:R,i.autoRotate=!1}function De(){E&&(B.load.box.style.display="none",B.errorMsg.style.display="none",E=!1,We("errorcleared")),l=!1,G.load.style.display="none",B.load.box.style.display="inline",X()}function Te(e,t,a,s,c){var d,u,p,f;if(l=!1,O={},i.sceneFadeDuration&&!c){var m=r.render(i.pitch*Math.PI/180,i.yaw*Math.PI/180,i.hfov*Math.PI/180,{returnImage:!0});if(m!==n)return(d=new Image).className="pnlm-fade-img",d.style.transition="opacity "+i.sceneFadeDuration/1e3+"s",d.style.width="100%",d.style.height="100%",d.onload=function(){Te(e,t,a,s,!0)},d.src=m,A.appendChild(d),void(r.fadeImg=d)}u="same"===t?i.pitch:t,p="same"===a?i.yaw:"sameAzimuth"===a?i.yaw+(i.northOffset||0)-(o.scenes[e].northOffset||0):a,f="same"===s?i.hfov:s,function(){var e=i.hotSpots;if(T=!1,delete i.hotSpots,e)for(var t=0;t").join(">").split("/").join("/").split("\n").join("
"):String(e).split("\n").join("
")}function Ye(e){return 0===e.trim().toLowerCase().indexOf("javascript:")?"about:blank":e}function We(e){if(e in S)for(var t=S[e].length;t>0;t--)S[e][S[e].length-t].apply(null,[].slice.call(arguments,1))}be.prototype.multiply=function(e){return new be(this.w*e.w-this.x*e.x-this.y*e.y-this.z*e.z,this.x*e.w+this.w*e.x+this.y*e.z-this.z*e.y,this.y*e.w+this.w*e.y+this.z*e.x-this.x*e.z,this.z*e.w+this.w*e.z+this.x*e.y-this.y*e.x)},be.prototype.toEulerAngles=function(){return[Math.atan2(2*(this.w*this.x+this.y*this.z),1-2*(this.x*this.x+this.y*this.y)),Math.asin(2*(this.w*this.y-this.z*this.x)),Math.atan2(2*(this.w*this.z+this.x*this.y),1-2*(this.y*this.y+this.z*this.z))]},this.isLoaded=function(){return Boolean(l)},this.getPitch=function(){return i.pitch},this.setPitch=function(e,t,a,o){return v=Date.now(),Math.abs(e-i.pitch)<=1e-6?("function"==typeof a&&a(o),this):((t=t==n?1e3:Number(t))?(O.pitch={startTime:Date.now(),startPosition:i.pitch,endPosition:e,duration:t},"function"==typeof a&&setTimeout(function(){a(o)},t)):i.pitch=e,ge(),this)},this.getPitchBounds=function(){return[i.minPitch,i.maxPitch]},this.setPitchBounds=function(e){return i.minPitch=Math.max(-90,Math.min(e[0],90)),i.maxPitch=Math.max(-90,Math.min(e[1],90)),this},this.getYaw=function(){return i.yaw},this.setYaw=function(e,t,a,o){return v=Date.now(),Math.abs(e-i.yaw)<=1e-6?("function"==typeof a&&a(o),this):(e=(e+180)%360-180,(t=t==n?1e3:Number(t))?(i.yaw-e>180?e+=360:e-i.yaw>180&&(e-=360),O.yaw={startTime:Date.now(),startPosition:i.yaw,endPosition:e,duration:t},"function"==typeof a&&setTimeout(function(){a(o)},t)):i.yaw=e,ge(),this)},this.getYawBounds=function(){return[i.minYaw,i.maxYaw]},this.setYawBounds=function(e){return i.minYaw=Math.max(-180,Math.min(e[0],180)),i.maxYaw=Math.max(-180,Math.min(e[1],180)),this},this.getHfov=function(){return i.hfov},this.setHfov=function(e,t,a,o){return v=Date.now(),Math.abs(e-i.hfov)<=1e-6?("function"==typeof a&&a(o),this):((t=t==n?1e3:Number(t))?(O.hfov={startTime:Date.now(),startPosition:i.hfov,endPosition:Oe(e),duration:t},"function"==typeof a&&setTimeout(function(){a(o)},t)):Se(e),ge(),this)},this.getHfovBounds=function(){return[i.minHfov,i.maxHfov]},this.setHfovBounds=function(e){return i.minHfov=Math.max(0,e[0]),i.maxHfov=Math.max(0,e[1]),this},this.lookAt=function(e,t,a,o,r,s){return o=o==n?1e3:Number(o),e!==n&&Math.abs(e-i.pitch)>1e-6&&(this.setPitch(e,o,r,s),r=n),t!==n&&Math.abs(t-i.yaw)>1e-6&&(this.setYaw(t,o,r,s),r=n),a!==n&&Math.abs(a-i.hfov)>1e-6&&(this.setHfov(a,o,r,s),r=n),"function"==typeof r&&r(s),this},this.getNorthOffset=function(){return i.northOffset},this.setNorthOffset=function(e){return i.northOffset=Math.min(360,Math.max(0,e)),ge(),this},this.getHorizonRoll=function(){return i.horizonRoll},this.setHorizonRoll=function(e){return i.horizonRoll=Math.min(90,Math.max(-90,e)),r.setPose(i.horizonPitch*Math.PI/180,i.horizonRoll*Math.PI/180),ge(),this},this.getHorizonPitch=function(){return i.horizonPitch},this.setHorizonPitch=function(e){return i.horizonPitch=Math.min(90,Math.max(-90,e)),r.setPose(i.horizonPitch*Math.PI/180,i.horizonRoll*Math.PI/180),ge(),this},this.startAutoRotate=function(e){return e=e||R||1,i.autoRotate=e,f.lookAt(p,n,u,3e3),ge(),this},this.stopAutoRotate=function(){return R=i.autoRotate?i.autoRotate:R,i.autoRotate=!1,i.autoRotateInactivityDelay=-1,this},this.stopMovement=function(){He(),C={yaw:0,pitch:0,hfov:0}},this.getRenderer=function(){return r},this.setUpdate=function(e){return D=!0===e,r===n?_():ge(),this},this.mouseEventToCoords=function(e){return ee(e)},this.loadScene=function(e,t,n,a){return!1!==l&&Te(e,t,n,a),this},this.getScene=function(){return i.scene},this.addScene=function(e,t){return o.scenes[e]=t,this},this.removeScene=function(e){return!(i.scene===e||!o.scenes.hasOwnProperty(e))&&(delete o.scenes[e],!0)},this.toggleFullscreen=function(){return ze(),this},this.getConfig=function(){return i},this.getContainer=function(){return a},this.addHotSpot=function(e,t){if(t===n&&i.scene===n)i.hotSpots.push(e);else{var a=t!==n?t:i.scene;if(!o.scenes.hasOwnProperty(a))throw"Invalid scene ID!";o.scenes[a].hasOwnProperty("hotSpots")||(o.scenes[a].hotSpots=[],a==i.scene&&(i.hotSpots=o.scenes[a].hotSpots)),o.scenes[a].hotSpots.push(e)}return t!==n&&i.scene!=t||(Ee(e),l&&Le(e)),this},this.removeHotSpot=function(e,t){if(t===n||i.scene==t){if(!i.hotSpots)return!1;for(var a=0;a=0&&S[e].splice(n,1),0==S[e].length&&delete S[e]}else delete S[e];return this},this.destroy=function(){r&&r.destroy(),L&&(t.removeEventListener("mousemove",te,!1),t.removeEventListener("mouseup",ne,!1),a.removeEventListener("mozfullscreenchange",Re,!1),a.removeEventListener("webkitfullscreenchange",Re,!1),a.removeEventListener("msfullscreenchange",Re,!1),a.removeEventListener("fullscreenchange",Re,!1),e.removeEventListener("resize",ye,!1),e.removeEventListener("orientationchange",ye,!1),a.removeEventListener("keydown",ue,!1),a.removeEventListener("keyup",fe,!1),a.removeEventListener("blur",pe,!1),t.removeEventListener("mouseleave",ne,!1)),a.innerHTML="",a.classList.remove("pnlm-container")}}return{viewer:function(e,t){return new a(e,t)}}}(window,document);