//! openseadragon 2.4.0 //! Built on 2018-07-20 //! Git commit: v2.4.0-0-446af4d //! openseadragon.github.io //! License: openseadragon.github.io/license/

function OpenSeadragon(e){return new OpenSeadragon.Viewer(e)}!function(e){e.version={versionStr:“2.4.0”,major:parseInt(“2”,10),minor:parseInt(“4”,10),revision:parseInt(“0”,10)};var t={“[object Boolean]”:“boolean”,“[object Number]”:“number”,“[object String]”:“string”,“[object Function]”:“function”,“[object Array]”:“array”,“[object Date]”:“date”,“[object RegExp]”:“regexp”,“[object Object]”:“object”},i=Object.prototype.toString,n=Object.prototype.hasOwnProperty;e.isFunction=function(t){return“function”===e.type(t)};e.isArray=Array.isArray||function(t){return“array”===e.type(t)};e.isWindow=function(e){return e&&“object”==typeof e&&“setInterval”in e};e.type=function(e){return null===e||void 0===e?String(e):t[i.call(e)]||“object”};e.isPlainObject=function(t){if(!t||“object”!==OpenSeadragon.type(t)||t.nodeType||e.isWindow(t))return!1;if(t.constructor&&!n.call(t,“constructor”)&&!n.call(t.constructor.prototype,“isPrototypeOf”))return!1;var i;for(var o in t)i=o;return void 0===i||n.call(t,i)};e.isEmptyObject=function(e){for(var t in e)return!1;return!0};e.freezeObject=function(t){Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(e){return e};return e.freezeObject(t)};e.supportsCanvas=function(){var t=document.createElement(“canvas”);return!(!e.isFunction(t.getContext)||!t.getContext(“2d”))}();e.isCanvasTainted=function(e){var t=!1;try{e.getContext(“2d”).getImageData(0,0,1,1)}catch(e){t=!0}return t};e.pixelDensityRatio=function(){if(e.supportsCanvas){var t=document.createElement(“canvas”).getContext(“2d”);var i=window.devicePixelRatio||1;var n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return Math.max(i,1)/n}return 1}()}(OpenSeadragon);!function($){$.extend=function(){var e,t,i,n,o,r,s=arguments[0]||{},a=arguments.length,l=!1,h=1;if(“boolean”==typeof s){l=s;s=arguments[1]||{};h=2}“object”==typeof s||OpenSeadragon.isFunction(s)||(s={});if(a===h){s=this;–h}for(;h=i.x&&t.x=i.y},getEvent:function(e){$.getEvent=e?function(e){return e}:function(){return window.event};return $.getEvent(e)},getMousePosition:function(e){if(“number”==typeof e.pageX)$.getMousePosition=function(e){var t=new $.Point;e=$.getEvent(e);t.x=e.pageX;t.y=e.pageY;return t};else{if(“number”!=typeof e.clientX)throw new Error(“Unknown event mouse position, no known technique.”);$.getMousePosition=function(e){var t=new $.Point;e=$.getEvent(e);t.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;t.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;return t}}return $.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},t=document.body||{};if(“number”==typeof window.pageXOffset)$.getPageScroll=function(){return new $.Point(window.pageXOffset,window.pageYOffset)};else if(t.scrollLeft||t.scrollTop)$.getPageScroll=function(){return new $.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new $.Point(0,0);$.getPageScroll=function(){return new $.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return $.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)$.setPageScroll=function(e){window.scrollTo(e.x,e.y)};else{var t=$.getPageScroll();if(t.x===e.x&&t.y===e.y)return;document.body.scrollLeft=e.x;document.body.scrollTop=e.y;var i=$.getPageScroll();if(i.x!==t.x&&i.y!==t.y){$.setPageScroll=function(e){document.body.scrollLeft=e.x;document.body.scrollTop=e.y};return}document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y;if((i=$.getPageScroll()).x!==t.x&&i.y!==t.y){$.setPageScroll=function(e){document.documentElement.scrollLeft=e.x;document.documentElement.scrollTop=e.y};return}$.setPageScroll=function(e){}}return $.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},t=document.body||{};if(“number”==typeof window.innerWidth)$.getWindowSize=function(){return new $.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)$.getWindowSize=function(){return new $.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!t.clientWidth&&!t.clientHeight)throw new Error(“Unknown window size, no known technique.”);$.getWindowSize=function(){return new $.Point(document.body.clientWidth,document.body.clientHeight)}}return $.getWindowSize()},makeCenteredNode:function(e){e=$.getElement(e);var t=[$.makeNeutralElement(“div”),$.makeNeutralElement(“div”),$.makeNeutralElement(“div”)];$.extend(t[0].style,{display:“table”,height:“100%”,width:“100%”});$.extend(t[1].style,{display:“table-row”});$.extend(t[2].style,{display:“table-cell”,verticalAlign:“middle”,textAlign:“center”});t[0].appendChild(t[1]);t[1].appendChild(t[2]);t[2].appendChild(e);return t[0]},makeNeutralElement:function(e){var t=document.createElement(e),i=t.style;i.background=“transparent none”;i.border=“none”;i.margin=“0px”;i.padding=“0px”;i.position=“static”;return t},now:function(){Date.now?$.now=Date.now:$.now=function(){return(new Date).getTime()};return $.now()},makeTransparentImage:function(e){$.makeTransparentImage=function(e){var t=$.makeNeutralElement(“img”);t.src=e;return t};$.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<7&&($.makeTransparentImage=function(e){var t=$.makeNeutralElement("img"),i=null;(i=$.makeNeutralElement("span")).style.display="inline-block";t.onload=function(){i.style.width=i.style.width||t.width+"px";i.style.height=i.style.height||t.height+"px";t.onload=null;t=null};t.src=e;i.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"e“‘, sizingMethod=’scale’)”;return i});return $.makeTransparentImage(e)},setElementOpacity:function(e,t,i){var n;e=$.getElement(e);i&&!$.Browser.alpha&&(t=Math.round(t));if($.Browser.opacity)e.style.opacity=t<1?t:"";else if(t<1){n="alpha(opacity="+Math.round(100*t)+")";e.style.filter=n}else e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=$.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},addClass:function(e,t){(e=$.getElement(e)).className?-1===(" "e.className“ ”).indexOf(“ ”t“ ”)&&(e.className+=“ ”+t):e.className=t},indexOf:function(e,t,i){Array.prototype.indexOf?this.indexOf=function(e,t,i){return e.indexOf(t,i)}:this.indexOf=function(e,t,i){var n,o,r=i||0;if(!e)throw new TypeError;if(0===(o=e.length)||r>=o)return-1;r<0&&(r=o-Math.abs(r));for(n=r;n=200&&a.status<300||0===a.status&&"http:"!==s&&"https:"!==s)t(a);else{$.console.log("AJAX request returned %d: %s",a.status,e);$.isFunction(i)&&i(a)}}};try{a.open("GET",e,!0);r&&(a.responseType=r);if(o)for(var l in o)o.hasOwnProperty(l)&&o[l]&&a.setRequestHeader(l,o[l]);n&&(a.withCredentials=!0);a.send(null)}catch(n){var h=n.message;$.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<10&&void 0!==n.number&&-2147024891==n.number&&(h+="\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain");$.console.log("%s while making AJAX request: %s",n.name,h);a.onreadystatechange=function(){};if(window.XDomainRequest){var c=new XDomainRequest;if(c){c.onload=function(e){$.isFunction(t)&&t({responseText:c.responseText,status:200,statusText:"OK"})};c.onerror=function(e){$.isFunction(i)&&i({responseText:c.responseText,status:444,statusText:"An error happened. Due to an XDomainRequest deficiency we can not extract any information about this error. Upgrade your browser."})};try{c.open("GET",e);c.send()}catch(e){$.isFunction(i)&&i(a,n)}}}else $.isFunction(i)&&i(a,n)}return a},jsonp:function(e){var t,i=e.url,n=document.head||document.getElementsByTagName("head")[0]||document.documentElement,o=e.callbackName||"openseadragon"+$.now(),r=window[o],s="$1"o“$2”,a=e.param||“callback”,l=e.callback;i=i.replace(/(=)?(&|$)|??/i,s);i+=(/?/.test(i)?“&”:“?”)a“=”+o;window[o]=function(e){if®window[o]=r;else try{delete window[o]}catch(e){}l&&$.isFunction(l)&&l(e)};t=document.createElement(“script”);void 0===e.async&&!1===e.async||(t.async=“async”);e.scriptCharset&&(t.charset=e.scriptCharset);t.src=i;t.onload=t.onreadystatechange=function(e,i){if(i||!t.readyState||/loaded|complete/.test(t.readyState)){t.onload=t.onreadystatechange=null;n&&t.parentNode&&n.removeChild(t);t=void 0}};n.insertBefore(t,n.firstChild)},createFromDZI:function(){throw“OpenSeadragon.createFromDZI is deprecated, use Viewer.open.”},parseXml:function(e){if(window.DOMParser)$.parseXml=function(e){return(new DOMParser).parseFromString(e,“text/xml”)};else{if(!window.ActiveXObject)throw new Error(“Browser doesn’t support XML DOM.”);$.parseXml=function(e){var t=null;(t=new ActiveXObject(“Microsoft.XMLDOM”)).async=!1;t.loadXML(e);return t}}return $.parseXml(e)},parseJSON:function(string){window.JSON&&window.JSON.parse?$.parseJSON=window.JSON.parse:$.parseJSON=function(string){return eval(“(”string“)”)};return $.parseJSON(string)},imageFormatSupported:function(e){return!!FILEFORMATS[(e=e||“”).toLowerCase()]}});$.Browser={vendor:$.BROWSERS.UNKNOWN,version:0,alpha:!0};var FILEFORMATS={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},URLPARAMS={};!function(){var e=navigator.appVersion,t=navigator.userAgent;switch(navigator.appName){case“Microsoft Internet Explorer”:if(window.attachEvent&&window.ActiveXObject){$.Browser.vendor=$.BROWSERS.IE;$.Browser.version=parseFloat(t.substring(t.indexOf(“MSIE”)+5,t.indexOf(“;”,t.indexOf(“MSIE”))))}break;case“Netscape”:if(window.addEventListener)if(t.indexOf(“Firefox”)>=0){$.Browser.vendor=$.BROWSERS.FIREFOX;$.Browser.version=parseFloat(t.substring(t.indexOf(“Firefox”)+8))}else if(t.indexOf(“Safari”)>=0){$.Browser.vendor=t.indexOf(“Chrome”)>=0?$.BROWSERS.CHROME:$.BROWSERS.SAFARI;$.Browser.version=parseFloat(t.substring(t.substring(0,t.indexOf(“Safari”)).lastIndexOf(“/”)+1,t.indexOf(“Safari”)))}else if(null!==new RegExp(“Trident/.*rv:([0-9]{1,}[.0-9]{0,})”).exec(t)){$.Browser.vendor=$.BROWSERS.IE;$.Browser.version=parseFloat(RegExp.$1)}break;case“Opera”:$.Browser.vendor=$.BROWSERS.OPERA;$.Browser.version=parseFloat(e)}var i,n,o,r=window.location.search.substring(1).split(“&”);for(o=0;o).indexOf(“=”))>0&&(URLPARAMS=decodeURIComponent(i.substring(n+1)));$.Browser.alpha=!($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<9||$.Browser.vendor==$.BROWSERS.CHROME&&$.Browser.version<2);$.Browser.opacity=!($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<9)}();var nullfunction=function(e){};$.console=window.console||{log:nullfunction,debug:nullfunction,info:nullfunction,warn:nullfunction,error:nullfunction,assert:nullfunction};!function(e){var t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame;var i=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame;if(t&&i){$.requestAnimationFrame=function(){return t.apply(e,arguments)};$.cancelAnimationFrame=function(){return i.apply(e,arguments)}}else{var n,o=[],r=,s=0;$.requestAnimationFrame=function(e){o.push();n||(n=setInterval(function(){if(o.length){var e=$.now();var t=r;r=o;o=t;for(;r.length;)r.shift()(e)}else{clearInterval(n);n=void 0}},20));return s};$.cancelAnimationFrame=function(e){var t,i;for(t=0,i=o.length;t[0]===e){o.splice(t,1);return}for(t=0,i=r.length;t[0]===e){r.splice(t,1);return}}}}(window);function getOffsetParent(e,t){return t&&e!=document.body?document.body:e.offsetParent}}(OpenSeadragon);!function(e,t){“function”==typeof define&&define.amd?define([],t):“object”==typeof module&&module.exports?module.exports=t():e.OpenSeadragon=t()}(this,function(){return OpenSeadragon});!function(e){var t={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:“”,fullScreenErrorEventName:“”};if(document.exitFullscreen){t.supportsFullScreen=!0;t.getFullScreenElement=function(){return document.fullscreenElement};t.requestFullScreen=function(e){return e.requestFullscreen()};t.exitFullScreen=function(){document.exitFullscreen()};t.fullScreenEventName=“fullscreenchange”;t.fullScreenErrorEventName=“fullscreenerror”}else if(document.msExitFullscreen){t.supportsFullScreen=!0;t.getFullScreenElement=function(){return document.msFullscreenElement};t.requestFullScreen=function(e){return e.msRequestFullscreen()};t.exitFullScreen=function(){document.msExitFullscreen()};t.fullScreenEventName=“MSFullscreenChange”;t.fullScreenErrorEventName=“MSFullscreenError”}else if(document.webkitExitFullscreen){t.supportsFullScreen=!0;t.getFullScreenElement=function(){return document.webkitFullscreenElement};t.requestFullScreen=function(e){return e.webkitRequestFullscreen()};t.exitFullScreen=function(){document.webkitExitFullscreen()};t.fullScreenEventName=“webkitfullscreenchange”;t.fullScreenErrorEventName=“webkitfullscreenerror”}else if(document.webkitCancelFullScreen){t.supportsFullScreen=!0;t.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement};t.requestFullScreen=function(e){return e.webkitRequestFullScreen()};t.exitFullScreen=function(){document.webkitCancelFullScreen()};t.fullScreenEventName=“webkitfullscreenchange”;t.fullScreenErrorEventName=“webkitfullscreenerror”}else if(document.mozCancelFullScreen){t.supportsFullScreen=!0;t.getFullScreenElement=function(){return document.mozFullScreenElement};t.requestFullScreen=function(e){return e.mozRequestFullScreen()};t.exitFullScreen=function(){document.mozCancelFullScreen()};t.fullScreenEventName=“mozfullscreenchange”;t.fullScreenErrorEventName=“mozfullscreenerror”}t.isFullScreen=function(){return null!==t.getFullScreenElement()};t.cancelFullScreen=function(){e.console.error(“cancelFullScreen is deprecated. Use exitFullScreen instead.”);t.exitFullScreen()};e.extend(e,t)}(OpenSeadragon);!function(e){e.EventSource=function(){this.events={}};e.EventSource.prototype={addOnceHandler:function(e,t,i,n){var o=this;n=n||1;var r=0;var s=function(i){++r===n&&o.removeHandler(e,s);t(i)};this.addHandler(e,s,i)},addHandler:function(t,i,n){var o=this.events;o||(this.events=o=[]);i&&e.isFunction(i)&&(o={handler:i,userData:n||null})},removeHandler:function(t,i){var n,o=this.events,r=[];if(o&&e.isArray(o)){for(n=0;n.handler!==i&&r.push(o);this.events=r}},removeAllHandlers:function(e){if(e)this.events=[];else for(var t in this.events)this.events=[]},getHandler:function(e){var t=this.events;if(!t||!t.length)return null;t=1===t.length?[t]:Array.apply(null,t);return function(e,i){var n,o=t.length;for(n=0;n){i.eventSource=e;i.userData=t.userData;t.handler(i)}}},raiseEvent:function(e,t){var i=this.getHandler(e);if(i){t||(t={});i(this,t)}}}}(OpenSeadragon);!function(e){var t=[];var i={};e.MouseTracker=function(n){t.push(this);var o=arguments;e.isPlainObject(n)||(n={element:o,clickTimeThreshold:o,clickDistThreshold:o});this.hash=Math.random();this.element=e.getElement(n.element);this.clickTimeThreshold=n.clickTimeThreshold||e.DEFAULT_SETTINGS.clickTimeThreshold;this.clickDistThreshold=n.clickDistThreshold||e.DEFAULT_SETTINGS.clickDistThreshold;this.dblClickTimeThreshold=n.dblClickTimeThreshold||e.DEFAULT_SETTINGS.dblClickTimeThreshold;this.dblClickDistThreshold=n.dblClickDistThreshold||e.DEFAULT_SETTINGS.dblClickDistThreshold;this.userData=n.userData||null;this.stopDelay=n.stopDelay||50;this.enterHandler=n.enterHandler||null;this.exitHandler=n.exitHandler||null;this.pressHandler=n.pressHandler||null;this.nonPrimaryPressHandler=n.nonPrimaryPressHandler||null;this.releaseHandler=n.releaseHandler||null;this.nonPrimaryReleaseHandler=n.nonPrimaryReleaseHandler||null;this.moveHandler=n.moveHandler||null;this.scrollHandler=n.scrollHandler||null;this.clickHandler=n.clickHandler||null;this.dblClickHandler=n.dblClickHandler||null;this.dragHandler=n.dragHandler||null;this.dragEndHandler=n.dragEndHandler||null;this.pinchHandler=n.pinchHandler||null;this.stopHandler=n.stopHandler||null;this.keyDownHandler=n.keyDownHandler||null;this.keyUpHandler=n.keyUpHandler||null;this.keyHandler=n.keyHandler||null;this.focusHandler=n.focusHandler||null;this.blurHandler=n.blurHandler||null;var r=this;i={click:function(t){i=t,r.clickHandler&&e.cancelEvent(i);var i},dblclick:function(t){i=t,r.dblClickHandler&&e.cancelEvent(i);var i},keydown:function(t){!function(t,i){if(t.keyDownHandler){i=e.getEvent(i);t.keyDownHandler({eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefaultAction:!1,userData:t.userData})||e.cancelEvent(i)}}(r,t)},keyup:function(t){!function(t,i){if(t.keyUpHandler){i=e.getEvent(i);t.keyUpHandler({eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefaultAction:!1,userData:t.userData})||e.cancelEvent(i)}}(r,t)},keypress:function(t){!function(t,i){if(t.keyHandler){i=e.getEvent(i);t.keyHandler({eventSource:t,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefaultAction:!1,userData:t.userData})||e.cancelEvent(i)}}(r,t)},focus:function(t){!function(t,i){if(t.focusHandler){i=e.getEvent(i);!1===t.focusHandler({eventSource:t,originalEvent:i,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(i)}}(r,t)},blur:function(t){!function(t,i){if(t.blurHandler){i=e.getEvent(i);!1===t.blurHandler({eventSource:t,originalEvent:i,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(i)}}(r,t)},wheel:function(e){g(r,t=e,t);var t},mousewheel:function(e){p(r,e)},DOMMouseScroll:function(e){p(r,e)},MozMousePixelScroll:function(e){p(r,e)},mouseenter:function(t){!function(t,i){i=e.getEvent(i);v(t,i)}(r,t)},mouseleave:function(t){!function(t,i){i=e.getEvent(i);f(t,i)}(r,t)},mouseover:function(t){!function(t,i){if((i=e.getEvent(i)).currentTarget===i.relatedTarget||m(i.currentTarget,i.relatedTarget))return;v(t,i)}(r,t)},mouseout:function(t){!function(t,i){if((i=e.getEvent(i)).currentTarget===i.relatedTarget||m(i.currentTarget,i.relatedTarget))return;f(t,i)}(r,t)},mousedown:function(t){!function(t,i){var n;i=e.getEvent(i);n={id:e.MouseTracker.mousePointerId,type:“mouse”,isPrimary:!0,currentPos:h(i),currentTime:e.now()};if(H(t,i,,w(i.button))){e.stopEvent(i);s(t,“mouse”)}(t.clickHandler||t.dblClickHandler||t.pressHandler||t.dragHandler||t.dragEndHandler)&&e.cancelEvent(i)}(r,t)},mouseup:function(e){y(r,e)},mouseupcaptured:function(t){!function(t,i){y(t,i);e.stopEvent(i)}(r,t)},mousemove:function(e){T(r,e)},mousemovecaptured:function(t){!function(t,i){T(t,i);e.stopEvent(i)}(r,t)},touchstart:function(i){!function(i,n){var o,r,a,l,c=n.changedTouches.length,u=[],d=i.getActivePointersListByType(“touch”);o=e.now();if(d.getLength()>n.touches.length-c){e.console.warn(“Tracked touch contact count doesn't match event.touches.length. Removing all tracked touch pointers.”);x(i,n,d)}for(r=0;r<c;r++)u.push({id:n.changedTouches.identifier,type:“touch”,currentPos:h(n.changedTouches),currentTime:o});z(i,n,u);for(r=0;r!==i&&t.isTracking()&&m(t.element,i.element)){l=[];for(a=0;a.identifier,type:“touch”,currentPos:h(n.changedTouches),currentTime:o});z(t,n,l)}if(H(i,n,u,0)){e.stopEvent(n);s(i,“touch”,c)}e.cancelEvent(n)}(r,i)},touchend:function(e){S(r,e)},touchendcaptured:function(t){!function(t,i){S(t,i);e.stopEvent(i)}(r,t)},touchmove:function(e){E(r,e)},touchmovecaptured:function(t){!function(t,i){E(t,i);e.stopEvent(i)}(r,t)},touchcancel:function(e){!function(e,t){var i=e.getActivePointersListByType(“touch”);x(e,t,i)}(r,e)},gesturestart:function(e){!function(e,t){t.stopPropagation();t.preventDefault()}(0,e)},gesturechange:function(e){!function(e,t){t.stopPropagation();t.preventDefault()}(0,e)},pointerover:function(e){P(r,e)},MSPointerOver:function(e){P(r,e)},pointerout:function(e){R(r,e)},MSPointerOut:function(e){R(r,e)},pointerdown:function(e){_(r,e)},MSPointerDown:function(e){_(r,e)},pointerup:function(e){C(r,e)},MSPointerUp:function(e){C(r,e)},pointermove:function(e){O(r,e)},MSPointerMove:function(e){O(r,e)},pointercancel:function(e){k(r,e)},MSPointerCancel:function(e){k(r,e)},pointerupcaptured:function(t){!function(t,i){t.getActivePointersListByType(l(i)).getById(i.pointerId)&&b(t,i);e.stopEvent(i)}(r,t)},pointermovecaptured:function(t){!function(t,i){t.getActivePointersListByType(l(i)).getById(i.pointerId)&&I(t,i);e.stopEvent(i)}(r,t)},tracking:!1,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:,lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null};n.startDisabled||this.setTracking(!0)};e.MouseTracker.prototype={destroy:function(){var e;o(this);this.element=null;for(e=0;e===this){t.splice(e,1);break}i=null;delete i},isTracking:function(){return i.tracking},setTracking:function(t){t?function(t){var o,r,s=i;if(!s.tracking){for(r=0;r<e.MouseTracker.subscribeEvents.length;r++){o=e.MouseTracker.subscribeEvents;e.addEvent(t.element,o,s,!1)}n(t);s.tracking=!0}}(this):o(this);return this},getActivePointersListsExceptType:function(e){var t=i;var n=[];for(var o=0;o.type!==e&&n.push(t.activePointersLists);return n},getActivePointersListByType:function(t){var n,o,r=i,s=r.activePointersLists.length;for(n=0;n.type===t)return r.activePointersLists;o=new e.MouseTracker.GesturePointList(t);r.activePointersLists.push(o);return o},getActivePointerCount:function(){var e,t=i,n=t.activePointersLists.length,o=0;for(e=0;e.getLength();return o},enterHandler:function(){},exitHandler:function(){},pressHandler:function(){},nonPrimaryPressHandler:function(){},releaseHandler:function(){},nonPrimaryReleaseHandler:function(){},moveHandler:function(){},scrollHandler:function(){},clickHandler:function(){},dblClickHandler:function(){},dragHandler:function(){},dragEndHandler:function(){},pinchHandler:function(){},stopHandler:function(){},keyDownHandler:function(){},keyUpHandler:function(){},keyHandler:function(){},focusHandler:function(){},blurHandler:function(){}};e.MouseTracker.resetAllMouseTrackers=function(){for(var e=0;e.isTracking()){t.setTracking(!1);t.setTracking(!0)}};e.MouseTracker.gesturePointVelocityTracker=function(){var t=[],i=0,n=0;var o=function(e,t){return e.hash.toString()+t.type+t.id.toString()};var r=function(){var i,o,r,s,a,l,h=t.length,c=e.now();s=c-n;n=c;for(i=0;i<h;i++){(r=(o=t).gPoint).direction=Math.atan2(r.currentPos.y-o.lastPos.y,r.currentPos.x-o.lastPos.x);a=o.lastPos.distanceTo(r.currentPos);o.lastPos=r.currentPos;l=1e3*a/(s+1);r.speed=.75*l+.25*r.speed}};return{addPoint:function(s,a){var l=o(s,a);t.push({guid:l,gPoint:a,lastPos:a.currentPos});if(1===t.length){n=e.now();i=window.setInterval(r,50)}},removePoint:function(e,n){var r,s=o(e,n),a=t.length;for(r=0;r.guid===s){t.splice(r,1);0==–a&&window.clearInterval(i);break}}}}();e.MouseTracker.captureElement=document;e.MouseTracker.wheelEventName=e.Browser.vendor==e.BROWSERS.IE&&e.Browser.version>8||“onwheel”in document.createElement(“div”)?“wheel”:void 0!==document.onmousewheel?“mousewheel”:“DOMMouseScroll”;e.MouseTracker.supportsMouseCapture=function(){var t=document.createElement(“div”);return e.isFunction(t.setCapture)&&e.isFunction(t.releaseCapture)}();e.MouseTracker.subscribeEvents=;“DOMMouseScroll”==e.MouseTracker.wheelEventName&&e.MouseTracker.subscribeEvents.push(“MozMousePixelScroll”);if(window.PointerEvent&&(window.navigator.pointerEnabled||e.Browser.vendor!==e.BROWSERS.IE)){e.MouseTracker.havePointerEvents=!0;e.MouseTracker.subscribeEvents.push(“pointerover”,“pointerout”,“pointerdown”,“pointerup”,“pointermove”,“pointercancel”);e.MouseTracker.unprefixedPointerEvents=!0;navigator.maxTouchPoints?e.MouseTracker.maxTouchPoints=navigator.maxTouchPoints:e.MouseTracker.maxTouchPoints=0;e.MouseTracker.haveMouseEnter=!1}else if(window.MSPointerEvent&&window.navigator.msPointerEnabled){e.MouseTracker.havePointerEvents=!0;e.MouseTracker.subscribeEvents.push(“MSPointerOver”,“MSPointerOut”,“MSPointerDown”,“MSPointerUp”,“MSPointerMove”,“MSPointerCancel”);e.MouseTracker.unprefixedPointerEvents=!1;navigator.msMaxTouchPoints?e.MouseTracker.maxTouchPoints=navigator.msMaxTouchPoints:e.MouseTracker.maxTouchPoints=0;e.MouseTracker.haveMouseEnter=!1}else{e.MouseTracker.havePointerEvents=!1;if(e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<9){e.MouseTracker.subscribeEvents.push(“mouseenter”,“mouseleave”);e.MouseTracker.haveMouseEnter=!0}else{e.MouseTracker.subscribeEvents.push(“mouseover”,“mouseout”);e.MouseTracker.haveMouseEnter=!1}e.MouseTracker.subscribeEvents.push(“mousedown”,“mouseup”,“mousemove”);“ontouchstart”in window&&e.MouseTracker.subscribeEvents.push(“touchstart”,“touchend”,“touchmove”,“touchcancel”);“ongesturestart”in window&&e.MouseTracker.subscribeEvents.push(“gesturestart”,“gesturechange”);e.MouseTracker.mousePointerId=“legacy-mouse”;e.MouseTracker.maxTouchPoints=10}e.MouseTracker.GesturePointList=function(e){this._gPoints=[];this.type=e;this.buttons=0;this.contacts=0;this.clicks=0;this.captureCount=0};e.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(e){return this._gPoints.push(e)},removeById:function(e){var t,i=this._gPoints.length;for(t=0;t.id===e){this._gPoints.splice(t,1);break}return this._gPoints.length},getByIndex:function(e){return e:null},getById:function(e){var t,i=this._gPoints.length;for(t=0;t.id===e)return this._gPoints;return null},getPrimary:function(e){var t,i=this._gPoints.length;for(t=0;t.isPrimary)return this._gPoints;return null},addContact:function(){++this.contacts;this.contacts>1&&(“mouse”===this.type||“pen”===this.type)&&(this.contacts=1)},removeContact:function(){–this.contacts;this.contacts<0&&(this.contacts=0)}};function n(t){var n,o=i,r=o.activePointersLists.length;for(n=0;n.captureCount>0){e.removeEvent(e.MouseTracker.captureElement,“mousemove”,o.mousemovecaptured,!0);e.removeEvent(e.MouseTracker.captureElement,“mouseup”,o.mouseupcaptured,!0);e.removeEvent(e.MouseTracker.captureElement,e.MouseTracker.unprefixedPointerEvents?“pointermove”:“MSPointerMove”,o.pointermovecaptured,!0);e.removeEvent(e.MouseTracker.captureElement,e.MouseTracker.unprefixedPointerEvents?“pointerup”:“MSPointerUp”,o.pointerupcaptured,!0);e.removeEvent(e.MouseTracker.captureElement,“touchmove”,o.touchmovecaptured,!0);e.removeEvent(e.MouseTracker.captureElement,“touchend”,o.touchendcaptured,!0);o.activePointersLists.captureCount=0}for(n=0;n<r;n++)o.activePointersLists.pop()}function o(t){var o,r,s=i;if(s.tracking){for(r=0;r<e.MouseTracker.subscribeEvents.length;r++){o=e.MouseTracker.subscribeEvents;e.removeEvent(t.element,o,s,!1)}n(t);s.tracking=!1}}function r(t,n){var o=i;if(“pointerevent”===n)return{upName:e.MouseTracker.unprefixedPointerEvents?“pointerup”:“MSPointerUp”,upHandler:o.pointerupcaptured,moveName:e.MouseTracker.unprefixedPointerEvents?“pointermove”:“MSPointerMove”,moveHandler:o.pointermovecaptured};if(“mouse”===n)return{upName:“mouseup”,upHandler:o.mouseupcaptured,moveName:“mousemove”,moveHandler:o.mousemovecaptured};if(“touch”===n)return{upName:“touchend”,upHandler:o.touchendcaptured,moveName:“touchmove”,moveHandler:o.touchmovecaptured};throw new Error(“MouseTracker.getCaptureEventParams: Unknown pointer type.”)}function s(t,i,n){var o,s=t.getActivePointersListByType(i);s.captureCount+=n||1;if(1===s.captureCount)if(e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<9)t.element.setCapture(!0);else{o=r(t,e.MouseTracker.havePointerEvents?“pointerevent”:i);N&&A(window.top)&&e.addEvent(window.top,o.upName,o.upHandler,!0);e.addEvent(e.MouseTracker.captureElement,o.upName,o.upHandler,!0);e.addEvent(e.MouseTracker.captureElement,o.moveName,o.moveHandler,!0)}}function a(t,i,n){var o,s=t.getActivePointersListByType(i);s.captureCount-=n||1;if(0===s.captureCount)if(e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<9)t.element.releaseCapture();else{o=r(t,e.MouseTracker.havePointerEvents?“pointerevent”:i);N&&A(window.top)&&e.removeEvent(window.top,o.upName,o.upHandler,!0);e.removeEvent(e.MouseTracker.captureElement,o.moveName,o.moveHandler,!0);e.removeEvent(e.MouseTracker.captureElement,o.upName,o.upHandler,!0)}}function l(t){var i;if(e.MouseTracker.unprefixedPointerEvents)i=t.pointerType;else switch(t.pointerType){case 2:i=“touch”;break;case 3:i=“pen”;break;case 4:i=“mouse”;break;default:i=“”}return i}function h(t){return e.getMousePosition(t)}function c(e,t){return u(h(e),t)}function u(t,i){var n=e.getElementOffset(i);return t.minus(n)}function d(t,i){return new e.Point((t.x+i.x)/2,(t.y+i.y)/2)}function p(t,i){var n={target:(i=e.getEvent(i)).target||i.srcElement,type:“wheel”,shiftKey:i.shiftKey||!1,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX?i.pageX:i.clientX,pageY:i.pageY?i.pageY:i.clientY,deltaMode:“MozMousePixelScroll”==i.type?0:1,deltaX:0,deltaZ:0};“mousewheel”==e.MouseTracker.wheelEventName?n.deltaY=-i.wheelDelta/e.DEFAULT_SETTINGS.pixelsPerWheelLine:n.deltaY=i.detail;g(t,n,i)}function g(t,i,n){var o=0;o=i.deltaY<0?1:-1;t.scrollHandler&&!1===t.scrollHandler({eventSource:t,pointerType:“mouse”,position:c(i,t.element),scroll:o,shift:i.shiftKey,isTouchEvent:!1,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n)}function m(e,t){if(e===t)return!1;for(;t&&t!==e;)t=t.parentNode;return t===e}function v(t,i){z(t,i,)}function f(t,i){M(t,i,)}function w(t){return e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<9?1===t?0:2===t?2:4===t?1:-1:t}function y(t,i){L(t,i=e.getEvent(i),,w(i.button))&&a(t,“mouse”)}function T(t,i){F(t,i=e.getEvent(i),)}function x(e,t,i){var n,o=i.getLength(),r=[];if(“touch”===i.type||i.contacts>0){for(n=0;n<o;n++)r.push(i.getByIndex(n));if(r.length>0){L(e,t,r,0);i.captureCount=1;a(e,i.type);M(e,t,r)}}}function S(i,n){var o,r,s,l,c=n.changedTouches.length,u=[];o=e.now();for(r=0;r.identifier,type:“touch”,currentPos:h(n.changedTouches),currentTime:o});L(i,n,u,0)&&a(i,“touch”,c);M(i,n,u);for(r=0;r!==i&&t.isTracking()&&m(t.element,i.element)){l=[];for(s=0;s.identifier,type:“touch”,currentPos:h(n.changedTouches),currentTime:o});M(t,n,l)}e.cancelEvent(n)}function E(t,i){var n,o=i.changedTouches.length,r=[];for(n=0;n.identifier,type:“touch”,currentPos:h(i.changedTouches),currentTime:e.now()});F(t,i,r);e.cancelEvent(i)}function P(t,i){i.currentTarget===i.relatedTarget||m(i.currentTarget,i.relatedTarget)||z(t,i,)}function R(t,i){i.currentTarget===i.relatedTarget||m(i.currentTarget,i.relatedTarget)||M(t,i,)}function _(t,i){var n;if(H(t,i,,i.button)){e.stopEvent(i);s(t,n.type)}(t.clickHandler||t.dblClickHandler||t.pressHandler||t.dragHandler||t.dragEndHandler||t.pinchHandler)&&e.cancelEvent(i)}function C(e,t){b(e,t)}function b(t,i){var n;L(t,i,,i.button)&&a(t,n.type)}function O(e,t){I(e,t)}function I(t,i){F(t,i,)}function k(e,t){!function(e,t,i){L(e,t,i,0);M(e,t,i)}(e,t,)}function B(e,t){t.hasOwnProperty(“isPrimary”)||(0===e.getLength()?t.isPrimary=!0:t.isPrimary=!1);t.speed=0;t.direction=0;t.contactPos=t.currentPos;t.contactTime=t.currentTime;t.lastPos=t.currentPos;t.lastTime=t.currentTime;return e.add(t)}function D(e,t){var i,n;if(e.getById(t.id)){i=e.removeById(t.id);t.hasOwnProperty(“isPrimary”)||(n=e.getPrimary())||(n=e.getByIndex(0))&&(n.isPrimary=!0)}else i=e.getLength();return i}function z(t,i,n){var o,r,s,a=t.getActivePointersListByType(n.type),l=n.length;for(o=0;o<l;o++){r=n;if(s=a.getById(r.id)){s.insideElement=!0;s.lastPos=s.currentPos;s.lastTime=s.currentTime;s.currentPos=r.currentPos;s.currentTime=r.currentTime;r=s}else{r.captured=!1;r.insideElementPressed=!1;r.insideElement=!0;B(a,r)}t.enterHandler&&!1===t.enterHandler({eventSource:t,pointerType:r.type,position:u(r.currentPos,t.element),buttons:a.buttons,pointers:t.getActivePointerCount(),insideElementPressed:r.insideElementPressed,buttonDownAny:0!==a.buttons,isTouchEvent:“touch”===r.type,originalEvent:i,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(i)}}function M(t,i,n){var o,r,s,a=t.getActivePointersListByType(n.type),l=n.length;for(o=0;o<l;o++){r=n;if(s=a.getById(r.id)){if(s.captured){s.insideElement=!1;s.lastPos=s.currentPos;s.lastTime=s.currentTime;s.currentPos=r.currentPos;s.currentTime=r.currentTime}else D(a,s);r=s}t.exitHandler&&!1===t.exitHandler({eventSource:t,pointerType:r.type,position:u(r.currentPos,t.element),buttons:a.buttons,pointers:t.getActivePointerCount(),insideElementPressed:!!s&&s.insideElementPressed,buttonDownAny:0!==a.buttons,isTouchEvent:“touch”===r.type,originalEvent:i,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(i)}}function H(t,n,o,r){var s,a,l,h=i,c=t.getActivePointersListByType(o.type),p=o.length;void 0!==n.buttons?c.buttons=n.buttons:e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<9?0===r?c.buttons+=1:1===r?c.buttons+=4:2===r?c.buttons+=2:3===r?c.buttons+=8:4===r?c.buttons+=16:5===r&&(c.buttons+=32):0===r?c.buttons|=1:1===r?c.buttons|=4:2===r?c.buttons|=2:3===r?c.buttons|=8:4===r?c.buttons|=16:5===r&&(c.buttons|=32);var g=t.getActivePointersListsExceptType(o.type);for(s=0;s);if(0!==r){t.nonPrimaryPressHandler&&!1===t.nonPrimaryPressHandler({eventSource:t,pointerType:o.type,position:u(o.currentPos,t.element),button:r,buttons:c.buttons,isTouchEvent:“touch”===o.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);return!1}for(s=0;s<p;s++){a=o;if(l=c.getById(a.id)){l.captured=!0;l.insideElementPressed=!0;l.insideElement=!0;l.contactPos=a.currentPos;l.contactTime=a.currentTime;l.lastPos=l.currentPos;l.lastTime=l.currentTime;l.currentPos=a.currentPos;l.currentTime=a.currentTime;a=l}else{a.captured=!0;a.insideElementPressed=!0;a.insideElement=!0;B(c,a)}c.addContact();(t.dragHandler||t.dragEndHandler||t.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.addPoint(t,a);if(1===c.contacts)t.pressHandler&&!1===t.pressHandler({eventSource:t,pointerType:a.type,position:u(a.contactPos,t.element),buttons:c.buttons,isTouchEvent:“touch”===a.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);else if(2===c.contacts&&t.pinchHandler&&“touch”===a.type){h.pinchGPoints=c.asArray();h.lastPinchDist=h.currentPinchDist=h.pinchGPoints.currentPos.distanceTo(h.pinchGPoints.currentPos);h.lastPinchCenter=h.currentPinchCenter=d(h.pinchGPoints.currentPos,h.pinchGPoints.currentPos)}}return!0}function L(t,n,o,r){var s,a,l,h,c,p,g=i,m=t.getActivePointersListByType(o.type),v=o.length,f=!1,w=!1;void 0!==n.buttons?m.buttons=n.buttons:e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<9?0===r?m.buttons-=1:1===r?m.buttons-=4:2===r?m.buttons-=2:3===r?m.buttons-=8:4===r?m.buttons-=16:5===r&&(m.buttons-=32):0===r?m.buttons^=-2:1===r?m.buttons^=-5:2===r?m.buttons^=-3:3===r?m.buttons^=-9:4===r?m.buttons^=-17:5===r&&(m.buttons^=-33);if(0!==r){t.nonPrimaryReleaseHandler&&!1===t.nonPrimaryReleaseHandler({eventSource:t,pointerType:o.type,position:u(o.currentPos,t.element),button:r,buttons:m.buttons,isTouchEvent:“touch”===o.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);x(t,n,t.getActivePointersListByType(“mouse”));return!1}for(l=0;l<v;l++){h=o;if(c=m.getById(h.id)){if(c.captured){c.captured=!1;f=!0;w=!0}c.lastPos=c.currentPos;c.lastTime=c.currentTime;c.currentPos=h.currentPos;c.currentTime=h.currentTime;c.insideElement||D(m,c);s=c.currentPos;a=c.currentTime;if(w){m.removeContact();(t.dragHandler||t.dragEndHandler||t.pinchHandler)&&e.MouseTracker.gesturePointVelocityTracker.removePoint(t,c);if(0===m.contacts){t.releaseHandler&&!1===t.releaseHandler({eventSource:t,pointerType:c.type,position:u(s,t.element),buttons:m.buttons,insideElementPressed:c.insideElementPressed,insideElementReleased:c.insideElement,isTouchEvent:“touch”===c.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);t.dragEndHandler&&!c.currentPos.equals(c.contactPos)&&!1===t.dragEndHandler({eventSource:t,pointerType:c.type,position:u(c.currentPos,t.element),speed:c.speed,direction:c.direction,shift:n.shiftKey,isTouchEvent:“touch”===c.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);if((t.clickHandler||t.dblClickHandler)&&c.insideElement){p=a-c.contactTime<=t.clickTimeThreshold&&c.contactPos.distanceTo(s)<=t.clickDistThreshold;t.clickHandler&&!1===t.clickHandler({eventSource:t,pointerType:c.type,position:u(c.currentPos,t.element),quick:p,shift:n.shiftKey,isTouchEvent:“touch”===c.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);if(t.dblClickHandler&&p){m.clicks++;if(1===m.clicks){g.lastClickPos=s;g.dblClickTimeOut=setTimeout(function(){m.clicks=0},t.dblClickTimeThreshold)}else if(2===m.clicks){clearTimeout(g.dblClickTimeOut);m.clicks=0;g.lastClickPos.distanceTo(s)<=t.dblClickDistThreshold&&!1===t.dblClickHandler({eventSource:t,pointerType:c.type,position:u(c.currentPos,t.element),shift:n.shiftKey,isTouchEvent:“touch”===c.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);g.lastClickPos=null}}}}else if(2===m.contacts&&t.pinchHandler&&“touch”===c.type){g.pinchGPoints=m.asArray();g.lastPinchDist=g.currentPinchDist=g.pinchGPoints.currentPos.distanceTo(g.pinchGPoints.currentPos);g.lastPinchCenter=g.currentPinchCenter=d(g.pinchGPoints.currentPos,g.pinchGPoints.currentPos)}}else t.releaseHandler&&!1===t.releaseHandler({eventSource:t,pointerType:c.type,position:u(s,t.element),buttons:m.buttons,insideElementPressed:c.insideElementPressed,insideElementReleased:c.insideElement,isTouchEvent:“touch”===c.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n)}}return f}function F(t,n,o){var r,s,a,l,h,p=i,g=t.getActivePointersListByType(o.type),m=o.length;void 0!==n.buttons&&(g.buttons=n.buttons);for(r=0;r<m;r++){s=o;if(a=g.getById(s.id)){s.hasOwnProperty(“isPrimary”)&&(a.isPrimary=s.isPrimary);a.lastPos=a.currentPos;a.lastTime=a.currentTime;a.currentPos=s.currentPos;a.currentTime=s.currentTime}else{s.captured=!1;s.insideElementPressed=!1;s.insideElement=!0;B(g,s)}}if(t.stopHandler&&“mouse”===o.type){clearTimeout(t.stopTimeOut);t.stopTimeOut=setTimeout(function(){e=t,i=n,r=o.type,e.stopHandler&&e.stopHandler({eventSource:e,pointerType:r,position:c(i,e.element),buttons:e.getActivePointersListByType®.buttons,isTouchEvent:“touch”===r,originalEvent:i,preventDefaultAction:!1,userData:e.userData});var e,i,r},t.stopDelay)}if(0===g.contacts)t.moveHandler&&!1===t.moveHandler({eventSource:t,pointerType:o.type,position:u(o.currentPos,t.element),buttons:g.buttons,isTouchEvent:“touch”===o.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n);else if(1===g.contacts){if(t.moveHandler){a=g.asArray();!1===t.moveHandler({eventSource:t,pointerType:a.type,position:u(a.currentPos,t.element),buttons:g.buttons,isTouchEvent:“touch”===a.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n)}if(t.dragHandler){h=(a=g.asArray()).currentPos.minus(a.lastPos);!1===t.dragHandler({eventSource:t,pointerType:a.type,position:u(a.currentPos,t.element),buttons:g.buttons,delta:h,speed:a.speed,direction:a.direction,shift:n.shiftKey,isTouchEvent:“touch”===a.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n)}}else if(2===g.contacts){if(t.moveHandler){l=g.asArray();!1===t.moveHandler({eventSource:t,pointerType:l.type,position:u(d(l.currentPos,l.currentPos),t.element),buttons:g.buttons,isTouchEvent:“touch”===l.type,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n)}if(t.pinchHandler&&“touch”===o.type&&(h=p.pinchGPoints.currentPos.distanceTo(p.pinchGPoints.currentPos))!=p.currentPinchDist){p.lastPinchDist=p.currentPinchDist;p.currentPinchDist=h;p.lastPinchCenter=p.currentPinchCenter;p.currentPinchCenter=d(p.pinchGPoints.currentPos,p.pinchGPoints.currentPos);!1===t.pinchHandler({eventSource:t,pointerType:“touch”,gesturePoints:p.pinchGPoints,lastCenter:u(p.lastPinchCenter,t.element),center:u(p.currentPinchCenter,t.element),lastDistance:p.lastPinchDist,distance:p.currentPinchDist,shift:n.shiftKey,originalEvent:n,preventDefaultAction:!1,userData:t.userData})&&e.cancelEvent(n)}}}var N=function(){try{return window.self!==window.top}catch(e){return!0}}();function A(e){try{return e.addEventListener&&e.removeEventListener}catch(e){return!1}}}(OpenSeadragon);!function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5};e.Control=function(t,i,n){var o=t.parentNode;if(“number”==typeof i){e.console.error(“Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; please use an options object instead. Support for this deprecated variant is scheduled for removal in December 2013”);i={anchor:i}}i.attachToViewer=void 0===i.attachToViewer||i.attachToViewer;this.autoFade=void 0===i.autoFade||i.autoFade;this.element=t;this.anchor=i.anchor;this.container=n;if(this.anchor==e.ControlAnchor.ABSOLUTE){this.wrapper=e.makeNeutralElement(“div”);this.wrapper.style.position=“absolute”;this.wrapper.style.top=“number”==typeof i.top?i.top+“px”:i.top;this.wrapper.style.left=“number”==typeof i.left?i.left+“px”:i.left;this.wrapper.style.height=“number”==typeof i.height?i.height+“px”:i.height;this.wrapper.style.width=“number”==typeof i.width?i.width+“px”:i.width;this.wrapper.style.margin=“0px”;this.wrapper.style.padding=“0px”;this.element.style.position=“relative”;this.element.style.top=“0px”;this.element.style.left=“0px”;this.element.style.height=“100%”;this.element.style.width=“100%”}else{this.wrapper=e.makeNeutralElement(“div”);this.wrapper.style.display=“inline-block”;this.anchor==e.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height=“100%”)}this.wrapper.appendChild(this.element);i.attachToViewer?this.anchor==e.ControlAnchor.TOP_RIGHT||this.anchor==e.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):o.appendChild(this.wrapper)};e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element);this.container.removeChild(this.wrapper)},isVisible:function(){return“none”!=this.wrapper.style.display},setVisible:function(t){this.wrapper.style.display=t?this.anchor==e.ControlAnchor.ABSOLUTE?“block”:“inline-block”:“none”},setOpacity:function(t){this.element&&e.Browser.vendor==e.BROWSERS.IE?e.setElementOpacity(this.element,t,!0):e.setElementOpacity(this.wrapper,t,!0)}}}(OpenSeadragon);!function(e){e.ControlDock=function(t){var i,n,o=;e.extend(!0,this,{id:“controldock-”+e.now()+“-”+Math.floor(1e6*Math.random()),container:e.makeNeutralElement(“div”),controls:[]},t);this.container.onsubmit=function(){return!1};if(this.element){this.element=e.getElement(this.element);this.element.appendChild(this.container);this.element.style.position=“relative”;this.container.style.width=“100%”;this.container.style.height=“100%”}for(n=0;n;this.controls=e.makeNeutralElement(“div”);this.controls.style.position=“absolute”;i.match(“left”)&&(this.controls.style.left=“0px”);i.match(“right”)&&(this.controls.style.right=“0px”);i.match(“top”)&&(this.controls.style.top=“0px”);i.match(“bottom”)&&(this.controls.style.bottom=“0px”)}this.container.appendChild(this.controls.topleft);this.container.appendChild(this.controls.topright);this.container.appendChild(this.controls.bottomright);this.container.appendChild(this.controls.bottomleft)};e.ControlDock.prototype={addControl:function(i,n){var o=null;if(!(t(this,i=e.getElement(i))>=0)){switch(n.anchor){case e.ControlAnchor.TOP_RIGHT:o=this.controls.topright;i.style.position=“relative”;i.style.paddingRight=“0px”;i.style.paddingTop=“0px”;break;case e.ControlAnchor.BOTTOM_RIGHT:o=this.controls.bottomright;i.style.position=“relative”;i.style.paddingRight=“0px”;i.style.paddingBottom=“0px”;break;case e.ControlAnchor.BOTTOM_LEFT:o=this.controls.bottomleft;i.style.position=“relative”;i.style.paddingLeft=“0px”;i.style.paddingBottom=“0px”;break;case e.ControlAnchor.TOP_LEFT:o=this.controls.topleft;i.style.position=“relative”;i.style.paddingLeft=“0px”;i.style.paddingTop=“0px”;break;case e.ControlAnchor.ABSOLUTE:o=this.container;i.style.margin=“0px”;i.style.padding=“0px”;break;default:case e.ControlAnchor.NONE:o=this.container;i.style.margin=“0px”;i.style.padding=“0px”}this.controls.push(new e.Control(i,n,o));i.style.display=“inline-block”}},removeControl:function(i){var n=t(this,i=e.getElement(i));if(n>=0){this.controls.destroy();this.controls.splice(n,1)}return this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var e;for(e=this.controls.length-1;e>=0;e–)if(this.controls.isVisible())return!0;return!1},setControlsEnabled:function(e){var t;for(t=this.controls.length-1;t>=0;t–)this.controls.setVisible(e);return this}};function t(e,t){var i,n=e.controls;for(i=n.length-1;i>=0;i–)if(n.element==t)return i;return-1}}(OpenSeadragon);!function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(OpenSeadragon);!function(e){var t={};var i=1;e.Viewer=function(o){var r,a=arguments,h=this;e.isPlainObject(o)||(o={id:a,xmlPath:a.length>1?a:void 0,prefixUrl:a.length>2?a:void 0,controls:a.length>3?a:void 0,overlays:a.length>4?a:void 0});if(o.config){e.extend(!0,o,o.config);delete o.config}e.extend(!0,this,{id:o.id,hash:o.hash||i++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:,customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttons:null,profiler:null},e.DEFAULT_SETTINGS,o);if(void 0===this.hash)throw new Error(“A hash must be defined, either by specifying options.id or options.hash.”);void 0!==t&&e.console.warn(“Hash ”this.hash“ has already been used.”);t={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null};this._sequenceIndex=0;this._firstOpen=!0;this._updateRequestId=null;this._loadQueue=[];this.currentOverlays=;this._lastScrollTime=e.now();e.EventSource.call(this);this.addHandler(“open-failed”,function(t){var i=e.getString(“Errors.OpenFailed”,t.eventSource,t.message);h._showMessage(i)});e.ControlDock.call(this,o);this.xmlPath&&(this.tileSources=);this.element=this.element||document.getElementById(this.id);this.canvas=e.makeNeutralElement(“div”);this.canvas.className=“openseadragon-canvas”;!function(e){e.width=“100%”;e.height=“100%”;e.overflow=“hidden”;e.position=“absolute”;e.top=“0px”;e.left=“0px”}(this.canvas.style);e.setElementTouchActionNone(this.canvas);“”!==o.tabIndex&&(this.canvas.tabIndex=void 0===o.tabIndex?0:o.tabIndex);this.container.className=“openseadragon-container”;!function(e){e.width=“100%”;e.height=“100%”;e.position=“relative”;e.overflow=“hidden”;e.left=“0px”;e.top=“0px”;e.textAlign=“left”}(this.container.style);this.container.insertBefore(this.canvas,this.container.firstChild);this.element.appendChild(this.container);this.bodyWidth=document.body.style.width;this.bodyHeight=document.body.style.height;this.bodyOverflow=document.body.style.overflow;this.docOverflow=document.documentElement.style.overflow;this.innerTracker=new e.MouseTracker({element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,keyDownHandler:e.delegate(this,d),keyHandler:e.delegate(this,p),clickHandler:e.delegate(this,g),dblClickHandler:e.delegate(this,m),dragHandler:e.delegate(this,v),dragEndHandler:e.delegate(this,f),enterHandler:e.delegate(this,w),exitHandler:e.delegate(this,y),pressHandler:e.delegate(this,T),releaseHandler:e.delegate(this,x),nonPrimaryPressHandler:e.delegate(this,S),nonPrimaryReleaseHandler:e.delegate(this,E),scrollHandler:e.delegate(this,R),pinchHandler:e.delegate(this,P)});this.outerTracker=new e.MouseTracker({element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:e.delegate(this,_),exitHandler:e.delegate(this,C)});this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar}));this.bindStandardControls();t.prevContainerSize=n(this.container);this.world=new e.World({viewer:this});this.world.addHandler(“add-item”,function(e){h.source=h.world.getItemAt(0).source;t.forceRedraw=!0;h._updateRequestId||(h._updateRequestId=s(h,b))});this.world.addHandler(“remove-item”,function(e){h.world.getItemCount()?h.source=h.world.getItemAt(0).source:h.source=null;t.forceRedraw=!0});this.world.addHandler(“metrics-change”,function(e){h.viewport&&h.viewport._setContentBounds(h.world.getHomeBounds(),h.world.getContentFactor())});this.world.addHandler(“item-index-change”,function(e){h.source=h.world.getItemAt(0).source});this.viewport=new e.Viewport({containerSize:t.prevContainerSize,springStiffness:this.springStiffness,animationTime:this.animationTime,minZoomImageRatio:this.minZoomImageRatio,maxZoomPixelRatio:this.maxZoomPixelRatio,visibilityRatio:this.visibilityRatio,wrapHorizontal:this.wrapHorizontal,wrapVertical:this.wrapVertical,defaultZoomLevel:this.defaultZoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,viewer:this,degrees:this.degrees,flipped:this.flipped,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins});this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor());this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:o.timeout});this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount});this.drawer=new e.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor});this.overlaysContainer=e.makeNeutralElement(“div”);this.canvas.appendChild(this.overlaysContainer);if(!this.drawer.canRotate()){if(this.rotateLeft){r=this.buttons.buttons.indexOf(this.rotateLeft);this.buttons.buttons.splice(r,1);this.buttons.element.removeChild(this.rotateLeft.element)}if(this.rotateRight){r=this.buttons.buttons.indexOf(this.rotateRight);this.buttons.buttons.splice(r,1);this.buttons.element.removeChild(this.rotateRight.element)}}this.showNavigator&&(this.navigator=new e.Navigator({id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy}));this.sequenceMode&&this.bindSequenceControls();this.tileSources&&this.open(this.tileSources);for(r=0;r.id,{anchor:this.customControls.anchor});e.requestAnimationFrame(function(){l(h)})};e.extend(e.Viewer.prototype,e.EventSource.prototype,e.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(t){e.console.error(“ this function is deprecated; use Viewer.open() instead.”);return this.open(t)},openTileSource:function(t){e.console.error(“ this function is deprecated; use Viewer.open() instead.”);return this.open(t)},open:function(t,i){var n=this;this.close();if(t)if(this.sequenceMode&&e.isArray(t)){if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}void 0===i||isNaN(i)||(this.initialPage=i);this.tileSources=t;this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage));if(this.tileSources.length){this.open(this.tileSources);this.showReferenceStrip&&this.addReferenceStrip()}this._updateSequenceButtons(this._sequenceIndex)}else{e.isArray(t)||(t=);if(t.length){this._opening=!0;var r=t.length;var s=0;var a=0;var l;var h=function(){if(s+a===r)if(s){if(n._firstOpen||!n.preserveViewport){n.viewport.goHome(!0);n.viewport.update()}n._firstOpen=!1;var e=t;e.tileSource&&(e=e.tileSource);if(n.overlays&&!n.preserveOverlays)for(var i=0;i=o(n,n.overlays);n._drawOverlays();n._opening=!1;n.raiseEvent(“open”,{source:e})}else{n._opening=!1;n.raiseEvent(“open-failed”,l)}};var c=function(t){e.isPlainObject(t)&&t.tileSource||(t={tileSource:t});if(void 0!==t.index){e.console.error(“ setting indexes here is not supported; use addTiledImage instead”);delete t.index}void 0===t.collectionImmediately&&(t.collectionImmediately=!0);var i=t.success;t.success=function(e){s++;if(t.tileSource.overlays)for(var o=0;o);i&&i(e);h()};var o=t.error;t.error=function(e){a++;l||(l=e);o&&o(e);h()};n.addTiledImage(t)};for(var u=0;u);return this}}},close:function(){if(!t)return this;this._opening=!1;this.navigator&&this.navigator.close();if(!this.preserveOverlays){this.clearOverlays();this.overlaysContainer.innerHTML=“”}t.animating=!1;this.world.removeAll();this.imageLoader.clear();this.raiseEvent(“close”);return this},destroy:function(){if(t){this.close();this.clearOverlays();this.overlaysContainer.innerHTML=“”;if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}if(null!==this._updateRequestId){e.cancelAnimationFrame(this._updateRequestId);this._updateRequestId=null}this.drawer&&this.drawer.destroy();this.removeAllHandlers();if(this.element)for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.innerTracker&&this.innerTracker.destroy();this.outerTracker&&this.outerTracker.destroy();t=null;delete t;this.canvas=null;this.container=null;this.element=null}},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(e){this.innerTracker.setTracking(e);this.outerTracker.setTracking(e);this.raiseEvent(“mouse-enabled”,{enabled:e});return this},areControlsEnabled:function(){var e,t=this.controls.length;for(e=0;e.isVisibile();return t},setControlsEnabled:function(e){e?h(this):l(this);this.raiseEvent(“controls-enabled”,{enabled:e});return this},setDebugMode:function(e){for(var t=0;t<this.world.getItemCount();t++)this.world.getItemAt(t).debugMode=e;this.debugMode=e;this.forceRedraw()},isFullPage:function(){return t.fullPage},setFullPage:function(i){var n,o,r=document.body,s=r.style,a=document.documentElement.style,l=this;if(i==this.isFullPage())return this;var h={fullPage:i,preventDefaultAction:!1};this.raiseEvent(“pre-full-page”,h);if(h.preventDefaultAction)return this;if(i){this.elementSize=e.getElementSize(this.element);this.pageScroll=e.getPageScroll();this.elementMargin=this.element.style.margin;this.element.style.margin=“0”;this.elementPadding=this.element.style.padding;this.element.style.padding=“0”;this.bodyMargin=s.margin;this.docMargin=a.margin;s.margin=“0”;a.margin=“0”;this.bodyPadding=s.padding;this.docPadding=a.padding;s.padding=“0”;a.padding=“0”;this.bodyWidth=s.width;this.docWidth=a.width;s.width=“100%”;a.width=“100%”;this.bodyHeight=s.height;this.docHeight=a.height;s.height=“100%”;a.height=“100%”;this.previousBody=[];t.prevElementParent=this.element.parentNode;t.prevNextSibling=this.element.nextSibling;t.prevElementWidth=this.element.style.width;t.prevElementHeight=this.element.style.height;n=r.childNodes.length;for(o=0;o<n;o++){this.previousBody.push(r.childNodes);r.removeChild(r.childNodes)}if(this.toolbar&&this.toolbar.element){this.toolbar.parentNode=this.toolbar.element.parentNode;this.toolbar.nextSibling=this.toolbar.element.nextSibling;r.appendChild(this.toolbar.element);e.addClass(this.toolbar.element,“fullpage”)}e.addClass(this.element,“fullpage”);r.appendChild(this.element);this.element.style.height=e.getWindowSize().y+“px”;this.element.style.width=e.getWindowSize().x+“px”;this.toolbar&&this.toolbar.element&&(this.element.style.height=e.getElementSize(this.element).y-e.getElementSize(this.toolbar.element).y+“px”);t.fullPage=!0;e.delegate(this,_)({})}else{this.element.style.margin=this.elementMargin;this.element.style.padding=this.elementPadding;s.margin=this.bodyMargin;a.margin=this.docMargin;s.padding=this.bodyPadding;a.padding=this.docPadding;s.width=this.bodyWidth;a.width=this.docWidth;s.height=this.bodyHeight;a.height=this.docHeight;r.removeChild(this.element);n=this.previousBody.length;for(o=0;o.prevElementParent.insertBefore(this.element,t.prevNextSibling);if(this.toolbar&&this.toolbar.element){r.removeChild(this.toolbar.element);e.removeClass(this.toolbar.element,“fullpage”);this.toolbar.parentNode.insertBefore(this.toolbar.element,this.toolbar.nextSibling);delete this.toolbar.parentNode;delete this.toolbar.nextSibling}this.element.style.width=t.prevElementWidth;this.element.style.height=t.prevElementHeight;var c=0;var u=function(){e.setPageScroll(l.pageScroll);var t=e.getPageScroll();++c<10&&(t.x!==l.pageScroll.x||t.y!==l.pageScroll.y)&&e.requestAnimationFrame(u)};e.requestAnimationFrame(u);t.fullPage=!1;e.delegate(this,C)({})}this.navigator&&this.viewport&&this.navigator.update(this.viewport);this.raiseEvent(“full-page”,{fullPage:i});return this},setFullScreen:function(t){var i=this;if(!e.supportsFullScreen)return this.setFullPage(t);if(e.isFullScreen()===t)return this;var n={fullScreen:t,preventDefaultAction:!1};this.raiseEvent(“pre-full-screen”,n);if(n.preventDefaultAction)return this;if(t){this.setFullPage(!0);if(!this.isFullPage())return this;this.fullPageStyleWidth=this.element.style.width;this.fullPageStyleHeight=this.element.style.height;this.element.style.width=“100%”;this.element.style.height=“100%”;var o=function(){var t=e.isFullScreen();if(!t){e.removeEvent(document,e.fullScreenEventName,o);e.removeEvent(document,e.fullScreenErrorEventName,o);i.setFullPage(!1);if(i.isFullPage()){i.element.style.width=i.fullPageStyleWidth;i.element.style.height=i.fullPageStyleHeight}}i.navigator&&i.viewport&&i.navigator.update(i.viewport);i.raiseEvent(“full-screen”,{fullScreen:t})};e.addEvent(document,e.fullScreenEventName,o);e.addEvent(document,e.fullScreenErrorEventName,o);e.requestFullScreen(document.body)}else e.exitFullScreen();return this},isVisible:function(){return“hidden”!=this.container.style.visibility},setVisible:function(e){this.container.style.visibility=e?“”:“hidden”;this.raiseEvent(“visible”,{visible:e});return this},addTiledImage:function(t){e.console.assert(t,“ options is required”);e.console.assert(t.tileSource,“ options.tileSource is required”);e.console.assert(!t.replace||t.index>-1&&t.index if options.replace is used, options.index must be a valid index in Viewer.world“);var i=this;t.replace&&(t.replaceItem=i.world.getItemAt(t.index));this._hideMessage();void 0===t.placeholderFillStyle&&(t.placeholderFillStyle=this.placeholderFillStyle);void 0===t.opacity&&(t.opacity=this.opacity);void 0===t.preload&&(t.preload=this.preload);void 0===t.compositeOperation&&(t.compositeOperation=this.compositeOperation);void 0===t.crossOriginPolicy&&(t.crossOriginPolicy=void 0!==t.tileSource.crossOriginPolicy?t.tileSource.crossOriginPolicy:this.crossOriginPolicy);void 0===t.ajaxWithCredentials&&(t.ajaxWithCredentials=this.ajaxWithCredentials);void 0===t.loadTilesWithAjax&&(t.loadTilesWithAjax=this.loadTilesWithAjax);void 0===t.ajaxHeaders||null===t.ajaxHeaders?t.ajaxHeaders=this.ajaxHeaders:e.isPlainObject(t.ajaxHeaders)&&e.isPlainObject(this.ajaxHeaders)&&(t.ajaxHeaders=e.extend({},this.ajaxHeaders,t.ajaxHeaders));var n={options:t};function o(e){for(var o=0;o===n){i._loadQueue.splice(o,1);break}0===i._loadQueue.length&&r(n);i.raiseEvent(”add-item-failed“,e);t.error&&t.error(e)}function r(e){if(i.collectionMode){i.world.arrange({immediately:e.options.collectionImmediately,rows:i.collectionRows,columns:i.collectionColumns,layout:i.collectionLayout,tileSize:i.collectionTileSize,tileMargin:i.collectionTileMargin});i.world.setAutoRefigureSizes(!0)}}if(e.isArray(t.tileSource))setTimeout(function(){o({message:” Sequences can not be added; add them one at a time instead.“,source:t.tileSource,options:t})});else{this._loadQueue.push(n);!function(t,i,n,o,r){var s=t;if(”string“==e.type(i))if(i.match(/^s*<.*>s*$/))i=e.parseXml(i);else if(i.match(/^s*[{.*[}]]s*$/))try{var a=e.parseJSON(i);i=a}catch(e){}function l(e,t){if(e.ready)o(e);else{e.addHandler(”ready“,function(){o(e)});e.addHandler(”open-failed“,function(e){r({message:e.message,source:t})})}}setTimeout(function(){if(”string“==e.type(i))(i=new e.TileSource({url:i,crossOriginPolicy:void 0!==n.crossOriginPolicy?n.crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,ajaxHeaders:t.ajaxHeaders,useCanvas:t.useCanvas,success:function(e){o(e.tileSource)}})).addHandler(”open-failed“,function(e){r(e)});else if(e.isPlainObject(i)||i.nodeType){void 0!==i.crossOriginPolicy||void 0===n.crossOriginPolicy&&void 0===t.crossOriginPolicy||(i.crossOriginPolicy=void 0!==n.crossOriginPolicy?n.crossOriginPolicy:t.crossOriginPolicy);void 0===i.ajaxWithCredentials&&(i.ajaxWithCredentials=t.ajaxWithCredentials);void 0===i.useCanvas&&(i.useCanvas=t.useCanvas);if(e.isFunction(i.getTileUrl)){var a=new e.TileSource(i);a.getTileUrl=i.getTileUrl;o(a)}else{var h=e.TileSource.determineType(s,i);if(!h){r({message:”Unable to load TileSource“,source:i});return}var c=h.prototype.configure.apply(s,);l(new h©,i)}}else l(i,i)})}(this,t.tileSource,t,function(e){n.tileSource=e;s()},function(e){e.options=t;o(e);s()})}function s(){var t,n,o;for(;i._loadQueue.length&&(t=i._loadQueue).tileSource;){i._loadQueue.splice(0,1);if(t.options.replace){var s=i.world.getIndexOfItem(t.options.replaceItem);-1!=s&&(t.options.index=s);i.world.removeItem(t.options.replaceItem)}n=new e.TiledImage({viewer:i,source:t.tileSource,viewport:i.viewport,drawer:i.drawer,tileCache:i.tileCache,imageLoader:i.imageLoader,x:t.options.x,y:t.options.y,width:t.options.width,height:t.options.height,fitBounds:t.options.fitBounds,fitBoundsPlacement:t.options.fitBoundsPlacement,clip:t.options.clip,placeholderFillStyle:t.options.placeholderFillStyle,opacity:t.options.opacity,preload:t.options.preload,degrees:t.options.degrees,compositeOperation:t.options.compositeOperation,springStiffness:i.springStiffness,animationTime:i.animationTime,minZoomImageRatio:i.minZoomImageRatio,wrapHorizontal:i.wrapHorizontal,wrapVertical:i.wrapVertical,immediateRender:i.immediateRender,blendTime:i.blendTime,alwaysBlend:i.alwaysBlend,minPixelRatio:i.minPixelRatio,smoothTileEdgesMinZoom:i.smoothTileEdgesMinZoom,iOSDevice:i.iOSDevice,crossOriginPolicy:t.options.crossOriginPolicy,ajaxWithCredentials:t.options.ajaxWithCredentials,loadTilesWithAjax:t.options.loadTilesWithAjax,ajaxHeaders:t.options.ajaxHeaders,debugMode:i.debugMode});i.collectionMode&&i.world.setAutoRefigureSizes(!1);i.world.addItem(n,{index:t.options.index});0===i._loadQueue.length&&r(t);1!==i.world.getItemCount()||i.preserveViewport||i.viewport.goHome(!0);if(i.navigator){o=e.extend({},t.options,{replace:!1,originalTiledImage:n,tileSource:t.tileSource});i.navigator.addTiledImage(o)}t.options.success&&t.options.success({item:n})}}},addSimpleImage:function(t){e.console.assert(t,” options is required“);e.console.assert(t.url,” options.url is required“);var i=e.extend({},t,{tileSource:{type:”image“,url:t.url}});delete i.url;this.addTiledImage(i)},addLayer:function(t){var i=this;e.console.error(” this function is deprecated; use Viewer.addTiledImage() instead.“);var n=e.extend({},t,{success:function(e){i.raiseEvent(”add-layer“,{options:t,drawer:e.item})},error:function(e){i.raiseEvent(”add-layer-failed“,e)}});this.addTiledImage(n);return this},getLayerAtLevel:function(t){e.console.error(” this function is deprecated; use World.getItemAt() instead.“);return this.world.getItemAt(t)},getLevelOfLayer:function(t){e.console.error(” this function is deprecated; use World.getIndexOfItem() instead.“);return this.world.getIndexOfItem(t)},getLayersCount:function(){e.console.error(” this function is deprecated; use World.getItemCount() instead.“);return this.world.getItemCount()},setLayerLevel:function(t,i){e.console.error(” this function is deprecated; use World.setItemIndex() instead.“);return this.world.setItemIndex(t,i)},removeLayer:function(t){e.console.error(” this function is deprecated; use World.removeItem() instead.“);return this.world.removeItem(t)},forceRedraw:function(){t.forceRedraw=!0;return this},bindSequenceControls:function(){var t=e.delegate(this,c),i=e.delegate(this,u),n=e.delegate(this,j),o=e.delegate(this,U),r=this.navImages,s=!0;if(this.showSequenceControl){(this.previousButton||this.nextButton)&&(s=!1);this.previousButton=new e.Button({element:this.previousButton?e.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.PreviousPage“),srcRest:O(this.prefixUrl,r.previous.REST),srcGroup:O(this.prefixUrl,r.previous.GROUP),srcHover:O(this.prefixUrl,r.previous.HOVER),srcDown:O(this.prefixUrl,r.previous.DOWN),onRelease:o,onFocus:t,onBlur:i});this.nextButton=new e.Button({element:this.nextButton?e.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.NextPage“),srcRest:O(this.prefixUrl,r.next.REST),srcGroup:O(this.prefixUrl,r.next.GROUP),srcHover:O(this.prefixUrl,r.next.HOVER),srcDown:O(this.prefixUrl,r.next.DOWN),onRelease:n,onFocus:t,onBlur:i});this.navPrevNextWrap||this.previousButton.disable();this.tileSources&&this.tileSources.length||this.nextButton.disable();if(s){this.paging=new e.ButtonGroup({buttons:,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.pagingControl=this.paging.element;this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:e.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||e.ControlAnchor.TOP_LEFT})}}return this},bindStandardControls:function(){var t=e.delegate(this,I),i=e.delegate(this,B),n=e.delegate(this,M),o=e.delegate(this,k),r=e.delegate(this,H),s=e.delegate(this,F),a=e.delegate(this,N),l=e.delegate(this,A),h=e.delegate(this,W),d=e.delegate(this,V),p=e.delegate(this,c),g=e.delegate(this,u),m=this.navImages,v=[],f=!0;if(this.showNavigationControl){(this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(f=!1);if(this.showZoomControl){v.push(this.zoomInButton=new e.Button({element:this.zoomInButton?e.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.ZoomIn“),srcRest:O(this.prefixUrl,m.zoomIn.REST),srcGroup:O(this.prefixUrl,m.zoomIn.GROUP),srcHover:O(this.prefixUrl,m.zoomIn.HOVER),srcDown:O(this.prefixUrl,m.zoomIn.DOWN),onPress:t,onRelease:i,onClick:n,onEnter:t,onExit:i,onFocus:p,onBlur:g}));v.push(this.zoomOutButton=new e.Button({element:this.zoomOutButton?e.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.ZoomOut“),srcRest:O(this.prefixUrl,m.zoomOut.REST),srcGroup:O(this.prefixUrl,m.zoomOut.GROUP),srcHover:O(this.prefixUrl,m.zoomOut.HOVER),srcDown:O(this.prefixUrl,m.zoomOut.DOWN),onPress:o,onRelease:i,onClick:r,onEnter:o,onExit:i,onFocus:p,onBlur:g}))}this.showHomeControl&&v.push(this.homeButton=new e.Button({element:this.homeButton?e.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.Home“),srcRest:O(this.prefixUrl,m.home.REST),srcGroup:O(this.prefixUrl,m.home.GROUP),srcHover:O(this.prefixUrl,m.home.HOVER),srcDown:O(this.prefixUrl,m.home.DOWN),onRelease:s,onFocus:p,onBlur:g}));this.showFullPageControl&&v.push(this.fullPageButton=new e.Button({element:this.fullPageButton?e.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.FullPage“),srcRest:O(this.prefixUrl,m.fullpage.REST),srcGroup:O(this.prefixUrl,m.fullpage.GROUP),srcHover:O(this.prefixUrl,m.fullpage.HOVER),srcDown:O(this.prefixUrl,m.fullpage.DOWN),onRelease:a,onFocus:p,onBlur:g}));if(this.showRotationControl){v.push(this.rotateLeftButton=new e.Button({element:this.rotateLeftButton?e.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.RotateLeft“),srcRest:O(this.prefixUrl,m.rotateleft.REST),srcGroup:O(this.prefixUrl,m.rotateleft.GROUP),srcHover:O(this.prefixUrl,m.rotateleft.HOVER),srcDown:O(this.prefixUrl,m.rotateleft.DOWN),onRelease:l,onFocus:p,onBlur:g}));v.push(this.rotateRightButton=new e.Button({element:this.rotateRightButton?e.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.RotateRight“),srcRest:O(this.prefixUrl,m.rotateright.REST),srcGroup:O(this.prefixUrl,m.rotateright.GROUP),srcHover:O(this.prefixUrl,m.rotateright.HOVER),srcDown:O(this.prefixUrl,m.rotateright.DOWN),onRelease:h,onFocus:p,onBlur:g}))}this.showFlipControl&&v.push(this.flipButton=new e.Button({element:this.flipButton?e.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString(”Tooltips.Flip“),srcRest:O(this.prefixUrl,m.flip.REST),srcGroup:O(this.prefixUrl,m.flip.GROUP),srcHover:O(this.prefixUrl,m.flip.HOVER),srcDown:O(this.prefixUrl,m.flip.DOWN),onRelease:d,onFocus:p,onBlur:g}));if(f){this.buttons=new e.ButtonGroup({buttons:v,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold});this.navControl=this.buttons.element;this.addHandler(”open“,e.delegate(this,L));this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT})}}return this},currentPage:function(){return this._sequenceIndex},goToPage:function(e){if(this.tileSources&&e>=0&&e<this.tileSources.length){this._sequenceIndex=e;this._updateSequenceButtons(e);this.open(this.tileSources);this.referenceStrip&&this.referenceStrip.setFocus(e);this.raiseEvent(”page“,{page:e})}return this},addOverlay:function(t,i,n,s){var a;a=e.isPlainObject(t)?t:{element:t,location:i,placement:n,onDraw:s};t=e.getElement(a.element);if(r(this.currentOverlays,t)>=0)return this;var l=o(this,a);this.currentOverlays.push(l);l.drawHTML(this.overlaysContainer,this.viewport);this.raiseEvent(”add-overlay“,{element:t,location:a.location,placement:a.placement});return this},updateOverlay:function(i,n,o){var s;i=e.getElement(i);if((s=r(this.currentOverlays,i))>=0){this.currentOverlays.update(n,o);t.forceRedraw=!0;this.raiseEvent(”update-overlay“,{element:i,location:n,placement:o})}return this},removeOverlay:function(i){var n;i=e.getElement(i);if((n=r(this.currentOverlays,i))>=0){this.currentOverlays.destroy();this.currentOverlays.splice(n,1);t.forceRedraw=!0;this.raiseEvent(”remove-overlay“,{element:i})}return this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();t.forceRedraw=!0;this.raiseEvent(”clear-overlay“,{});return this},getOverlayById:function(t){var i;t=e.getElement(t);return(i=r(this.currentOverlays,t))>=0?this.currentOverlays:null},_updateSequenceButtons:function(e){this.nextButton&&(this.tileSources&&this.tileSources.length-1!==e?this.nextButton.enable():this.navPrevNextWrap||this.nextButton.disable());this.previousButton&&(e>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(t){this._hideMessage();var i=e.makeNeutralElement(”div“);i.appendChild(document.createTextNode(t));this.messageDiv=e.makeCenteredNode(i);e.addClass(this.messageDiv,”openseadragon-message“);this.container.appendChild(this.messageDiv)},_hideMessage:function(){var e=this.messageDiv;if(e){e.parentNode.removeChild(e);delete this.messageDiv}},gestureSettingsByDeviceType:function(e){switch(e){case”mouse“:return this.gestureSettingsMouse;case”touch“:return this.gestureSettingsTouch;case”pen“:return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var e,t=this.currentOverlays.length;for(e=0;e.drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1;if(this.referenceStrip){this.referenceStrip.destroy();this.referenceStrip=null}},addReferenceStrip:function(){this.showReferenceStrip=!0;if(this.sequenceMode){if(this.referenceStrip)return;if(this.tileSources.length&&this.tileSources.length>1){this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,viewer:this});this.referenceStrip.setFocus(this._sequenceIndex)}}else e.console.warn('Attempting to display a reference strip while ”sequenceMode“ is off.')}});function n(t){t=e.getElement(t);return new e.Point(0===t.clientWidth?1:t.clientWidth,0===t.clientHeight?1:t.clientHeight)}function o(t,i){if(i instanceof e.Overlay)return i;var n=null;if(i.element)n=e.getElement(i.element);else{var o=i.id?i.id:”openseadragon-overlay-“+Math.floor(1e7*Math.random());(n=e.getElement(i.id))||((n=document.createElement(”a“)).href=”#/overlay/“+o);n.id=o;e.addClass(n,i.className?i.className:”openseadragon-overlay“)}var r=i.location;var s=i.width;var a=i.height;if(!r){var l=i.x;var h=i.y;if(void 0!==i.px){var c=t.viewport.imageToViewportRectangle(new e.Rect(i.px,i.py,s||0,a||0));l=c.x;h=c.y;s=void 0!==s?c.width:void 0;a=void 0!==a?c.height:void 0}r=new e.Point(l,h)}var u=i.placement;u&&”string“===e.type(u)&&(u=e.Placement);return new e.Overlay({element:n,location:r,placement:u,onDraw:i.onDraw,checkResize:i.checkResize,width:s,height:a,rotationMode:i.rotationMode})}function r(e,t){var i;for(i=e.length-1;i>=0;i–)if(e.element===t)return i;return-1}function s(t,i){return e.requestAnimationFrame(function(){i(t)})}function a(t){e.requestAnimationFrame(function(){!function(t){var i,n,o,r;if(t.controlsShouldFade){i=e.now();n=i-t.controlsFadeBeginTime;o=1-n/t.controlsFadeLength;o=Math.min(1,o);o=Math.max(0,o);for(r=t.controls.length-1;r>=0;r–)t.controls.autoFade&&t.controls.setOpacity(o);o>0&&a(t)}}(t)})}function l(t){if(t.autoHideControls){t.controlsShouldFade=!0;t.controlsFadeBeginTime=e.now()+t.controlsFadeDelay;window.setTimeout(function(){a(t)},t.controlsFadeDelay)}}function h(e){var t;e.controlsShouldFade=!1;for(t=e.controls.length-1;t>=0;t–)e.controls.setOpacity(1)}function c(){h(this)}function u(){l(this)}function d(t){var i={originalEvent:t.originalEvent,preventDefaultAction:t.preventDefaultAction,preventVerticalPan:t.preventVerticalPan,preventHorizontalPan:t.preventHorizontalPan};this.raiseEvent(”canvas-key“,i);if(i.preventDefaultAction||t.ctrl||t.alt||t.meta)return!0;switch(t.keyCode){case 38:if(!i.preventVerticalPan){t.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress)));this.viewport.applyConstraints()}return!1;case 40:if(!i.preventVerticalPan){t.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress)));this.viewport.applyConstraints()}return!1;case 37:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0)));this.viewport.applyConstraints()}return!1;case 39:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0)));this.viewport.applyConstraints()}return!1;default:return!0}}function p(t){var i={originalEvent:t.originalEvent,preventDefaultAction:t.preventDefaultAction,preventVerticalPan:t.preventVerticalPan,preventHorizontalPan:t.preventHorizontalPan};this.raiseEvent(”canvas-key“,i);if(i.preventDefaultAction||t.ctrl||t.alt||t.meta)return!0;switch(t.keyCode){case 43:case 61:this.viewport.zoomBy(1.1);this.viewport.applyConstraints();return!1;case 45:this.viewport.zoomBy(.9);this.viewport.applyConstraints();return!1;case 48:this.viewport.goHome();this.viewport.applyConstraints();return!1;case 119:case 87:if(!i.preventVerticalPan){t.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40)));this.viewport.applyConstraints()}return!1;case 115:case 83:if(!i.preventVerticalPan){t.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40)));this.viewport.applyConstraints()}return!1;case 97:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0)));this.viewport.applyConstraints()}return!1;case 100:if(!i.preventHorizontalPan){this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0)));this.viewport.applyConstraints()}return!1;case 114:this.viewport.flipped?this.viewport.setRotation(this.viewport.degrees-90):this.viewport.setRotation(this.viewport.degrees+90);this.viewport.applyConstraints();return!1;case 82:this.viewport.flipped?this.viewport.setRotation(this.viewport.degrees+90):this.viewport.setRotation(this.viewport.degrees-90);this.viewport.applyConstraints();return!1;case 102:this.viewport.toggleFlip();return!1;default:return!0}}function g(e){var t;document.activeElement==this.canvas||this.canvas.focus();this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x);var i={tracker:e.eventSource,position:e.position,quick:e.quick,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.raiseEvent(”canvas-click“,i);if(!i.preventDefaultAction&&this.viewport&&e.quick&&(t=this.gestureSettingsByDeviceType(e.pointerType)).clickToZoom){this.viewport.zoomBy(e.shift?1/this.zoomPerClick:this.zoomPerClick,t.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null);this.viewport.applyConstraints()}}function m(e){var t;var i={tracker:e.eventSource,position:e.position,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.raiseEvent(”canvas-double-click“,i);if(!i.preventDefaultAction&&this.viewport&&(t=this.gestureSettingsByDeviceType(e.pointerType)).dblClickToZoom){this.viewport.zoomBy(e.shift?1/this.zoomPerClick:this.zoomPerClick,t.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null);this.viewport.applyConstraints()}}function v(e){var t;var i={tracker:e.eventSource,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.raiseEvent(”canvas-drag“,i);if(!i.preventDefaultAction&&this.viewport){t=this.gestureSettingsByDeviceType(e.pointerType);this.panHorizontal||(e.delta.x=0);this.panVertical||(e.delta.y=0);this.viewport.flipped&&(e.delta.x=-e.delta.x);if(this.constrainDuringPan){var n=this.viewport.deltaPointsFromPixels(e.delta.negate());this.viewport.centerSpringX.target.value+=n.x;this.viewport.centerSpringY.target.value+=n.y;var o=this.viewport.getBounds();var r=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=n.x;this.viewport.centerSpringY.target.value-=n.y;o.x!=r.x&&(e.delta.x=0);o.y!=r.y&&(e.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta.negate()),t.flickEnabled&&!this.constrainDuringPan)}}function f(t){if(!t.preventDefaultAction&&this.viewport){var i=this.gestureSettingsByDeviceType(t.pointerType);if(i.flickEnabled&&t.speed>=i.flickMinSpeed){var n=0;this.panHorizontal&&(n=i.flickMomentum*t.speed*Math.cos(t.direction));var o=0;this.panVertical&&(o=i.flickMomentum*t.speed*Math.sin(t.direction));var r=this.viewport.pixelFromPoint(this.viewport.getCenter(!0));var s=this.viewport.pointFromPixel(new e.Point(r.x-n,r.y-o));this.viewport.panTo(s,!1)}this.viewport.applyConstraints()}this.raiseEvent(”canvas-drag-end“,{tracker:t.eventSource,position:t.position,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent})}function w(e){this.raiseEvent(”canvas-enter“,{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function y(t){window.location!=window.parent.location&&e.MouseTracker.resetAllMouseTrackers();this.raiseEvent(”canvas-exit“,{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function T(e){this.raiseEvent(”canvas-press“,{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent})}function x(e){this.raiseEvent(”canvas-release“,{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent})}function S(e){this.raiseEvent(”canvas-nonprimary-press“,{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function E(e){this.raiseEvent(”canvas-nonprimary-release“,{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function P(e){var t,i,n;if(!e.preventDefaultAction&&this.viewport){if((t=this.gestureSettingsByDeviceType(e.pointerType)).pinchToZoom){i=this.viewport.pointFromPixel(e.center,!0);n=this.viewport.pointFromPixel(e.lastCenter,!0).minus(i);this.panHorizontal||(n.x=0);this.panVertical||(n.y=0);this.viewport.zoomBy(e.distance/e.lastDistance,i,!0);t.zoomToRefPoint&&this.viewport.panBy(n,!0);this.viewport.applyConstraints()}if(t.pinchRotate){var o=Math.atan2(e.gesturePoints.currentPos.y-e.gesturePoints.currentPos.y,e.gesturePoints.currentPos.x-e.gesturePoints.currentPos.x);var r=Math.atan2(e.gesturePoints.lastPos.y-e.gesturePoints.lastPos.y,e.gesturePoints.lastPos.x-e.gesturePoints.lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(o-r)*(180/Math.PI))}}this.raiseEvent(”canvas-pinch“,{tracker:e.eventSource,gesturePoints:e.gesturePoints,lastCenter:e.lastCenter,center:e.center,lastDistance:e.lastDistance,distance:e.distance,shift:e.shift,originalEvent:e.originalEvent});return!1}function R(t){var i,n,o;if((o=e.now())-this._lastScrollTime>this.minScrollDeltaTime){this._lastScrollTime=o;this.viewport.flipped&&(t.position.x=this.viewport.getContainerSize().x-t.position.x);if(!t.preventDefaultAction&&this.viewport&&(i=this.gestureSettingsByDeviceType(t.pointerType)).scrollToZoom){n=Math.pow(this.zoomPerScroll,t.scroll);this.viewport.zoomBy(n,i.zoomToRefPoint?this.viewport.pointFromPixel(t.position,!0):null);this.viewport.applyConstraints()}this.raiseEvent(”canvas-scroll“,{tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent});if(i&&i.scrollToZoom)return!1}else if((i=this.gestureSettingsByDeviceType(t.pointerType))&&i.scrollToZoom)return!1}function _(e){t.mouseInside=!0;h(this);this.raiseEvent(”container-enter“,{tracker:e.eventSource,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function C(e){if(e.pointers<1){t.mouseInside=!1;t.animating||l(this)}this.raiseEvent(”container-exit“,{tracker:e.eventSource,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function b(e){!function(e){if(e._opening)return;if(e.autoResize){var i=n(e.container);var o=t.prevContainerSize;if(!i.equals(o)){var r=e.viewport;if(e.preserveImageSizeOnResize){var s=o.x/i.x;var a=r.getZoom()*s;var c=r.getCenter();r.resize(i,!1);r.zoomTo(a,null,!0);r.panTo(c,!0)}else{var u=r.getBounds();r.resize(i,!0);r.fitBoundsWithConstraints(u,!0)}t.prevContainerSize=i;t.forceRedraw=!0}}var d=e.viewport.update();var p=e.world.update()||d;d&&e.raiseEvent(”viewport-change“);e.referenceStrip&&(p=e.referenceStrip.update(e.viewport)||p);if(!t.animating&&p){e.raiseEvent(”animation-start“);h(e)}if(p||t.forceRedraw||e.world.needsDraw()){!function(e){e.imageLoader.clear();e.drawer.clear();e.world.draw();e.raiseEvent(”update-viewport“,{})}(e);e._drawOverlays();e.navigator&&e.navigator.update(e.viewport);t.forceRedraw=!1;p&&e.raiseEvent(”animation“)}if(t.animating&&!p){e.raiseEvent(”animation-finish“);t.mouseInside||l(e)}t.animating=p}(e);e.isOpen()?e._updateRequestId=s(e,b):e._updateRequestId=!1}function O(e,t){return e?e+t:t}function I(){t.lastZoomTime=e.now();t.zoomFactor=this.zoomPerSecond;t.zooming=!0;D(this)}function k(){t.lastZoomTime=e.now();t.zoomFactor=1/this.zoomPerSecond;t.zooming=!0;D(this)}function B(){t.zooming=!1}function D(t){e.requestAnimationFrame(e.delegate(t,z))}function z(){var i,n,o;if(t.zooming&&this.viewport){n=(i=e.now())-t.lastZoomTime;o=Math.pow(t.zoomFactor,n/1e3);this.viewport.zoomBy(o);this.viewport.applyConstraints();t.lastZoomTime=i;D(this)}}function M(){if(this.viewport){t.zooming=!1;this.viewport.zoomBy(this.zoomPerClick/1);this.viewport.applyConstraints()}}function H(){if(this.viewport){t.zooming=!1;this.viewport.zoomBy(1/this.zoomPerClick);this.viewport.applyConstraints()}}function L(){this.buttons.emulateEnter();this.buttons.emulateExit()}function F(){this.viewport&&this.viewport.goHome()}function N(){this.isFullPage()&&!e.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage());this.buttons&&this.buttons.emulateExit();this.fullPageButton.element.focus();this.viewport&&this.viewport.applyConstraints()}function A(){if(this.viewport){var t=this.viewport.getRotation();t=this.viewport.flipped?e.positiveModulo(t+90,360):e.positiveModulo(t-90,360);this.viewport.setRotation(t)}}function W(){if(this.viewport){var t=this.viewport.getRotation();t=this.viewport.flipped?e.positiveModulo(t-90,360):e.positiveModulo(t+90,360);this.viewport.setRotation(t)}}function V(){this.viewport.toggleFlip()}function U(){var e=this._sequenceIndex-1;this.navPrevNextWrap&&e<0&&(e+=this.tileSources.length);this.goToPage(e)}function j(){var e=this._sequenceIndex+1;this.navPrevNextWrap&&e>=this.tileSources.length&&(e=0);this.goToPage(e)}}(OpenSeadragon);!function(e){e.Navigator=function(s){var a,l,h=s.viewer,c=this;if(s.id){this.element=document.getElementById(s.id);s.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}}else{s.id=”navigator-“+e.now();this.element=e.makeNeutralElement(”div“);s.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:s.autoFade};if(s.position)if(”BOTTOM_RIGHT“==s.position)s.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT;else if(”BOTTOM_LEFT“==s.position)s.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT;else if(”TOP_RIGHT“==s.position)s.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT;else if(”TOP_LEFT“==s.position)s.controlOptions.anchor=e.ControlAnchor.TOP_LEFT;else if(”ABSOLUTE“==s.position){s.controlOptions.anchor=e.ControlAnchor.ABSOLUTE;s.controlOptions.top=s.top;s.controlOptions.left=s.left;s.controlOptions.height=s.height;s.controlOptions.width=s.width}}this.element.id=s.id;this.element.className+=” navigator“;(s=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},s,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,autoResize:s.autoResize,minZoomImageRatio:1,background:s.background,opacity:s.opacity,borderColor:s.borderColor,displayRegionColor:s.displayRegionColor})).minPixelRatio=this.minPixelRatio=h.minPixelRatio;e.setElementTouchActionNone(this.element);this.borderWidth=2;this.fudge=new e.Point(1,1);this.totalBorderWidths=new e.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge);s.controlOptions.anchor!=e.ControlAnchor.NONE&&function(e,t){e.margin=”0px“;e.border=t+”px solid “+s.borderColor;e.padding=”0px“;e.background=s.background;e.opacity=s.opacity;e.overflow=”hidden“}(this.element.style,this.borderWidth);this.displayRegion=e.makeNeutralElement(”div“);this.displayRegion.id=this.element.id+”-displayregion“;this.displayRegion.className=”displayregion“;!function(e,t){e.position=”relative“;e.top=”0px“;e.left=”0px“;e.fontSize=”0px“;e.overflow=”hidden“;e.border=t+”px solid “+s.displayRegionColor;e.margin=”0px“;e.padding=”0px“;e.background=”transparent“;e.float=”left“;e.cssFloat=”left“;e.styleFloat=”left“;e.zIndex=999999999;e.cursor=”default“}(this.displayRegion.style,this.borderWidth);this.displayRegionContainer=e.makeNeutralElement(”div“);this.displayRegionContainer.id=this.element.id+”-displayregioncontainer“;this.displayRegionContainer.className=”displayregioncontainer“;this.displayRegionContainer.style.width=”100%“;this.displayRegionContainer.style.height=”100%“;h.addControl(this.element,s.controlOptions);this._resizeWithViewer=s.controlOptions.anchor!=e.ControlAnchor.ABSOLUTE&&s.controlOptions.anchor!=e.ControlAnchor.NONE;if(this._resizeWithViewer){if(s.width&&s.height){this.element.style.height=”number“==typeof s.height?s.height+”px“:s.height;this.element.style.width=”number“==typeof s.width?s.width+”px“:s.width}else{a=e.getElementSize(h.element);this.element.style.height=Math.round(a.y*s.sizeRatio)+”px“;this.element.style.width=Math.round(a.x*s.sizeRatio)+”px“;this.oldViewerSize=a}l=e.getElementSize(this.element);this.elementArea=l.x*l.y}this.oldContainerSize=new e.Point(0,0);e.Viewer.apply(this,);this.displayRegionContainer.appendChild(this.displayRegion);this.element.getElementsByTagName(”div“).appendChild(this.displayRegionContainer);function u(e){r(c.displayRegionContainer,e);r(c.displayRegion,-e);c.viewport.setRotation(e)}if(s.navigatorRotate){u(s.viewer.viewport?s.viewer.viewport.getRotation():s.viewer.degrees||0);s.viewer.addHandler(”rotate“,function(e){u(e.degrees)})}this.innerTracker.destroy();this.innerTracker=new e.MouseTracker({element:this.element,dragHandler:e.delegate(this,i),clickHandler:e.delegate(this,t),releaseHandler:e.delegate(this,n),scrollHandler:e.delegate(this,o)});this.addHandler(”reset-size“,function(){c.viewport&&c.viewport.goHome(!0)});h.world.addHandler(”item-index-change“,function(e){window.setTimeout(function(){var t=c.world.getItemAt(e.previousIndex);c.world.setItemIndex(t,e.newIndex)},1)});h.world.addHandler(”remove-item“,function(e){var t=e.item;var i=c._getMatchingItem(t);i&&c.world.removeItem(i)});this.update(h.viewport)};e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var t=new e.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);if(!t.equals(this.oldContainerSize)){this.viewport.resize(t,!0);this.viewport.goHome(!0);this.oldContainerSize=t;this.drawer.clear();this.world.draw()}}},setFlip:function(e){this.viewport.setFlip(e);this.setDisplayTransform(this.viewer.viewport.getFlip()?”scale(-1,1)“:”scale(1,1)“);return this},setDisplayTransform:function(e){s(this.displayRegion,e);s(this.canvas,e);s(this.element,e)},update:function(t){var i,n,o,r,s,a;i=e.getElementSize(this.viewer.element);if(this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)){this.oldViewerSize=i;if(this.maintainSizeRatio||!this.elementArea){n=i.x*this.sizeRatio;o=i.y*this.sizeRatio}else{n=Math.sqrt(this.elementArea*(i.x/i.y));o=this.elementArea/n}this.element.style.width=Math.round(n)+”px“;this.element.style.height=Math.round(o)+”px“;this.elementArea||(this.elementArea=n*o);this.updateSize()}if(t&&this.viewport){r=t.getBoundsNoRotate(!0);s=this.viewport.pixelFromPointNoRotate(r.getTopLeft(),!1);a=this.viewport.pixelFromPointNoRotate(r.getBottomRight(),!1).minus(this.totalBorderWidths);var l=this.displayRegion.style;l.display=this.world.getItemCount()?”block“:”none“;l.top=Math.round(s.y)+”px“;l.left=Math.round(s.x)+”px“;var h=Math.abs(s.x-a.x);var c=Math.abs(s.y-a.y);l.width=Math.round(Math.max(h,0))+”px“;l.height=Math.round(Math.max(c,0))+”px“}},addTiledImage:function(t){var i=this;var n=t.originalTiledImage;delete t.original;var o=e.extend({},t,{success:function(e){var t=e.item;t._originalForNavigator=n;i._matchBounds(t,n,!0);function o(){i._matchBounds(t,n)}n.addHandler(”bounds-change“,o);n.addHandler(”clip-change“,o);n.addHandler(”opacity-change“,function(){i._matchOpacity(t,n)});n.addHandler(”composite-operation-change“,function(){i._matchCompositeOperation(t,n)})}});return e.Viewer.prototype.addTiledImage.apply(this,)},_getMatchingItem:function(e){var t=this.world.getItemCount();var i;for(var n=0;n<t;n++)if((i=this.world.getItemAt(n))._originalForNavigator===e)return i;return null},_matchBounds:function(e,t,i){var n=t.getBoundsNoRotate();e.setPosition(n.getTopLeft(),i);e.setWidth(n.width,i);e.setRotation(t.getRotation(),i);e.setClip(t.getClip())},_matchOpacity:function(e,t){e.setOpacity(t.opacity)},_matchCompositeOperation:function(e,t){e.setCompositeOperation(t.compositeOperation)}});function t(e){var t={tracker:e.eventSource,position:e.position,quick:e.quick,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.viewer.raiseEvent(”navigator-click“,t);if(!t.preventDefaultAction&&e.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x);var i=this.viewport.pointFromPixel(e.position);this.panVertical?this.panHorizontal||(i.x=this.viewer.viewport.getCenter(!0).x):i.y=this.viewer.viewport.getCenter(!0).y;this.viewer.viewport.panTo(i);this.viewer.viewport.applyConstraints()}}function i(e){var t={tracker:e.eventSource,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.viewer.raiseEvent(”navigator-drag“,t);if(!t.preventDefaultAction&&this.viewer.viewport){this.panHorizontal||(e.delta.x=0);this.panVertical||(e.delta.y=0);this.viewer.viewport.flipped&&(e.delta.x=-e.delta.x);this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta));this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints()}}function n(e){e.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function o(e){this.viewer.raiseEvent(”navigator-scroll“,{tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent});return!1}function r(e,t){s(e,”rotate(“t”deg)“)}function s(e,t){e.style.webkitTransform=t;e.style.mozTransform=t;e.style.msTransform=t;e.style.oTransform=t;e.style.transform=t}}(OpenSeadragon);!function(e){var t={Errors:{Dzc:”Sorry, we don't support Deep Zoom Collections!“,Dzi:”Hmm, this doesn't appear to be a valid Deep Zoom Image.“,Xml:”Hmm, this doesn't appear to be a valid Deep Zoom Image.“,ImageFormat:”Sorry, we don't support {0}-based Deep Zoom Images.“,Security:”It looks like a security restriction stopped us from loading this Deep Zoom Image.“,Status:”This space unintentionally left blank ({0} {1}).“,OpenFailed:”Unable to open {0}: {1}“},Tooltips:{FullPage:”Toggle full page“,Home:”Go home“,ZoomIn:”Zoom in“,ZoomOut:”Zoom out“,NextPage:”Next page“,PreviousPage:”Previous page“,RotateLeft:”Rotate left“,RotateRight:”Rotate right“,Flip:”Flip Horizontally“}};e.extend(e,{getString:function(i){var n,o=i.split(”.“),r=null,s=arguments,a=t;for(n=0;n]||{};if(”string“!=typeof(r=a[o])){e.console.log(”Untranslated source string:“,i);r=”“}return r.replace(/{d+}/g,function(e){var t=parseInt(e.match(/d+/),10)+1;return t:”“})},setString:function(e,i){var n,o=e.split(”.“),r=t;for(n=0;n<o.length-1;n++){r[o]||(r[o]={});r=r[o]}r[o]=i}})}(OpenSeadragon);!function(e){e.Point=function(e,t){this.x=”number“==typeof e?e:0;this.y=”number“==typeof t?t:0};e.Point.prototype={clone:function(){return new e.Point(this.x,this.y)},plus:function(t){return new e.Point(this.x+t.x,this.y+t.y)},minus:function(t){return new e.Point(this.x-t.x,this.y-t.y)},times:function(t){return new e.Point(this.x*t,this.y*t)},divide:function(t){return new e.Point(this.x/t,this.y/t)},negate:function(){return new e.Point(-this.x,-this.y)},distanceTo:function(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))},squaredDistanceTo:function(e){return Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2)},apply:function(t){return new e.Point(t(this.x),t(this.y))},equals:function(t){return t instanceof e.Point&&this.x===t.x&&this.y===t.y},rotate:function(t,i){i=i||new e.Point(0,0);var n;var o;if(t%90==0){switch(e.positiveModulo(t,360)){case 0:n=1;o=0;break;case 90:n=0;o=1;break;case 180:n=-1;o=0;break;case 270:n=0;o=-1}}else{var r=t*Math.PI/180;n=Math.cos®;o=Math.sin®}var s=n*(this.x-i.x)-o*(this.y-i.y)+i.x;var a=o*(this.x-i.x)+n*(this.y-i.y)+i.y;return new e.Point(s,a)},toString:function(){return”(“+Math.round(100*this.x)/100+”,“+Math.round(100*this.y)/100+”)“}}}(OpenSeadragon);!function(e){e.TileSource=function(t,i,n,o,r,s){var a=this;var l,h,c=arguments;l=e.isPlainObject(t)?t:{width:c,height:c,tileSize:c,tileOverlap:c,minLevel:c,maxLevel:c};e.EventSource.call(this);e.extend(!0,this,l);if(!this.success)for(h=0;h)){this.success=arguments;break}this.success&&this.addHandler(”ready“,function(e){a.success(e)});”string“==e.type(arguments)&&(this.url=arguments);if(this.url){this.aspectRatio=1;this.dimensions=new e.Point(10,10);this._tileWidth=0;this._tileHeight=0;this.tileOverlap=0;this.minLevel=0;this.maxLevel=0;this.ready=!1;this.getImageInfo(this.url)}else{this.ready=!0;this.aspectRatio=l.width&&l.height?l.width/l.height:1;this.dimensions=new e.Point(l.width,l.height);if(this.tileSize){this._tileWidth=this._tileHeight=this.tileSize;delete this.tileSize}else{if(this.tileWidth){this._tileWidth=this.tileWidth;delete this.tileWidth}else this._tileWidth=0;if(this.tileHeight){this._tileHeight=this.tileHeight;delete this.tileHeight}else this._tileHeight=0}this.tileOverlap=l.tileOverlap?l.tileOverlap:0;this.minLevel=l.minLevel?l.minLevel:0;this.maxLevel=void 0!==l.maxLevel&&null!==l.maxLevel?l.maxLevel:l.width&&l.height?Math.ceil(Math.log(Math.max(l.width,l.height))/Math.log(2)):0;this.success&&e.isFunction(this.success)&&this.success(this)}};e.TileSource.prototype={getTileSize:function(t){e.console.error(” is deprecated.Use TileSource.getTileWidth() and TileSource.getTileHeight() instead“);return this._tileWidth},getTileWidth:function(e){return this._tileWidth?this._tileWidth:this.getTileSize(e)},getTileHeight:function(e){return this._tileHeight?this._tileHeight:this.getTileSize(e)},getLevelScale:function(e){var t,i={};for(t=0;t<=this.maxLevel;t++)i=1/Math.pow(2,this.maxLevel-t);this.getLevelScale=function(e){return i};return this.getLevelScale(e)},getNumTiles:function(t){var i=this.getLevelScale(t),n=Math.ceil(i*this.dimensions.x/this.getTileWidth(t)),o=Math.ceil(i*this.dimensions.y/this.getTileHeight(t));return new e.Point(n,o)},getPixelRatio:function(t){var i=this.dimensions.times(this.getLevelScale(t)),n=1/i.x,o=1/i.y;return new e.Point(n,o)},getClosestLevel:function(){var e,t;for(e=this.minLevel+1;e<=this.maxLevel&&!((t=this.getNumTiles(e)).x>1||t.y>1);e++);return e-1},getTileAtPoint:function(t,i){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;e.console.assert(n," must be called with a valid point.”);var o=this.dimensions.x*this.getLevelScale(t);var r=i.x*o;var s=i.y*o;var a=Math.floor(r/this.getTileWidth(t));var l=Math.floor(s/this.getTileHeight(t));i.x>=1&&(a=this.getNumTiles(t).x-1);i.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(t).y-1);return new e.Point(a,l)},getTileBounds:function(t,i,n,o){var r=this.dimensions.times(this.getLevelScale(t)),s=this.getTileWidth(t),a=this.getTileHeight(t),l=0===i?0:s*i-this.tileOverlap,h=0===n?0:a*n-this.tileOverlap,c=s+(0===i?1:2)*this.tileOverlap,u=a+(0===n?1:2)*this.tileOverlap,d=1/r.x;c=Math.min(c,r.x-l);u=Math.min(u,r.y-h);return o?new e.Rect(0,0,c,u):new e.Rect(l*d,h*d,c*d,u*d)},getImageInfo:function(t){var i,n,o,r,s,a,l,h=this;t&&(l=(a=(s=t.split(“/”))).lastIndexOf(“.”))>-1&&(s=a.slice(0,l));n=function(i){“string”==typeof i&&(i=e.parseXml(i));var n=e.TileSource.determineType(h,i,t);if(n){void 0===(r=n.prototype.configure.apply(h,)).ajaxWithCredentials&&(r.ajaxWithCredentials=h.ajaxWithCredentials);o=new n®;h.ready=!0;h.raiseEvent(“ready”,{tileSource:o})}else h.raiseEvent(“open-failed”,{message:“Unable to load TileSource”,source:t})};if(t.match(/.js$/)){i=t.split(“/”).pop().replace(“.js”,“”);e.jsonp({url:t,async:!1,callbackName:i,callback:n})}else e.makeAjaxRequest({url:t,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(t){var i=function(t){var i,n,o=t.responseText,r=t.status;{if(!t)throw new Error(e.getString(“Errors.Security”));if(200!==t.status&&0!==t.status){r=t.status;i=404==r?“Not Found”:t.statusText;throw new Error(e.getString(“Errors.Status”,r,i))}}if(o.match(/s*<.*/))try{n=t.responseXML&&t.responseXML.documentElement?t.responseXML:e.parseXml(o)}catch(e){n=t.responseText}else if(o.match(/s*[{.*/))try{n=e.parseJSON(o)}catch(e){n=o}else n=o;return n}(t);n(i)},error:function(e,i){var n;try{n=“HTTP ”e.status“ attempting to load TileSource”}catch(e){var o;o=void 0!==i&&i.toString?i.toString():“Unknown error”;n=o+“ attempting to load TileSource”}h.raiseEvent(“open-failed”,{message:n,source:t})}})},supports:function(e,t){return!1},configure:function(e,t){throw new Error(“Method not implemented.”)},getTileUrl:function(e,t,i){throw new Error(“Method not implemented.”)},getTileAjaxHeaders:function(e,t,i){return{}},tileExists:function(e,t,i){var n=this.getNumTiles(e);return e>=this.minLevel&&e<=this.maxLevel&&t>=0&&i>=0&&t<n.x&&i<n.y}};e.extend(!0,e.TileSource.prototype,e.EventSource.prototype);e.TileSource.determineType=function(t,i,n){var o;for(o in OpenSeadragon)if(o.match(/.+TileSource$/)&&e.isFunction(OpenSeadragon)&&e.isFunction(OpenSeadragon.prototype.supports)&&OpenSeadragon.prototype.supports.call(t,i,n))return OpenSeadragon;e.console.error(“No TileSource was able to open %s %s”,n,i)}}(OpenSeadragon);!function(e){e.DziTileSource=function(t,i,n,o,r,s,a,l,h){var c,u,d,p;p=e.isPlainObject(t)?t:{width:arguments,height:arguments,tileSize:arguments,tileOverlap:arguments,tilesUrl:arguments,fileFormat:arguments,displayRects:arguments,minLevel:arguments,maxLevel:arguments};this._levelRects={};this.tilesUrl=p.tilesUrl;this.fileFormat=p.fileFormat;this.displayRects=p.displayRects;if(this.displayRects)for(c=this.displayRects.length-1;c>=0;c–)for(d=(u=this.displayRects).minLevel;d<=u.maxLevel;d++){this._levelRects||(this._levelRects=[]);this._levelRects.push(u)}e.TileSource.apply(this,)};e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){var i;e.Image?i=e.Image.xmlns:e.documentElement&&(“Image”!=e.documentElement.localName&&“Image”!=e.documentElement.tagName||(i=e.documentElement.namespaceURI));return-1!==(i=(i||“”).toLowerCase()).indexOf(“schemas.microsoft.com/deepzoom/2008”)||-1!==i.indexOf(“schemas.microsoft.com/deepzoom/2009”)},configure:function(i,n){var o;o=e.isPlainObject(i)?t(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(e.getString(“Errors.Xml”));var o,r,s,a,l,h=n.documentElement,c=h.localName||h.tagName,u=n.documentElement.namespaceURI,d=null,p=[];if(“Image”==c)try{void 0===(a=h.getElementsByTagName(“Size”))&&(a=h.getElementsByTagNameNS(u,“Size”));d={Image:{xmlns:“schemas.microsoft.com/deepzoom/2008”,Url:h.getAttribute(“Url”),Format:h.getAttribute(“Format”),DisplayRect:null,Overlap:parseInt(h.getAttribute(“Overlap”),10),TileSize:parseInt(h.getAttribute(“TileSize”),10),Size:{Height:parseInt(a.getAttribute(“Height”),10),Width:parseInt(a.getAttribute(“Width”),10)}}};if(!e.imageFormatSupported(d.Image.Format))throw new Error(e.getString(“Errors.ImageFormat”,d.Image.Format.toUpperCase()));void 0===(o=h.getElementsByTagName(“DisplayRect”))&&(o=h.getElementsByTagNameNS(u,“DisplayRect”));for(l=0;l<o.length;l++){r=o;void 0===(s=r.getElementsByTagName(“Rect”))&&(s=r.getElementsByTagNameNS(u,“Rect”));p.push({Rect:{X:parseInt(s.getAttribute(“X”),10),Y:parseInt(s.getAttribute(“Y”),10),Width:parseInt(s.getAttribute(“Width”),10),Height:parseInt(s.getAttribute(“Height”),10),MinLevel:parseInt(r.getAttribute(“MinLevel”),10),MaxLevel:parseInt(r.getAttribute(“MaxLevel”),10)}})}p.length&&(d.Image.DisplayRect=p);return t(i,d)}catch(t){throw t instanceof Error?t:new Error(e.getString(“Errors.Dzi”))}else{if(“Collection”==c)throw new Error(e.getString(“Errors.Dzc”));if(“Error”==c){var g=h.getElementsByTagName(“Message”);var m=g.firstChild.nodeValue;throw new Error(m)}}throw new Error(e.getString(“Errors.Dzi”))}(this,i);if(n&&!o.tilesUrl){o.tilesUrl=n.replace(/(+?)(.(dzi|xml|js)?(?*)?)?/?$/,“$1_files/”);-1!=n.search(/.(dzi|xml|js)?/)?o.queryParams=n.match(/?.*/):o.queryParams=“”}return o},getTileUrl:function(e,t,i){return.join(“”)},tileExists:function(e,t,i){var n,o,r,s,a,l,h,c=this._levelRects;if(this.minLevel&&ethis.maxLevel)return!1;if(!c||!c.length)return!0;for(h=c.length-1;h>=0;h–)if(!(e<(n=c).minLevel||e>n.maxLevel)){o=this.getLevelScale(e);r=n.x*o;s=n.y*o;a=r+n.width*o;l=s+n.height*o;r=Math.floor(r/this._tileWidth);s=Math.floor(s/this._tileWidth);a=Math.ceil(a/this._tileWidth);l=Math.ceil(l/this._tileWidth);if(r<=t&&t<a&&s<=i&&i<l)return!0}return!1}});function t(t,i){var n,o,r=i.Image,s=r.Url,a=r.Format,l=r.Size,h=r.DisplayRect||[],c=parseInt(l.Width,10),u=parseInt(l.Height,10),d=parseInt(r.TileSize,10),p=parseInt(r.Overlap,10),g=;for(o=0;o<h.length;o++){n=h.Rect;g.push(new e.DisplayRect(parseInt(n.X,10),parseInt(n.Y,10),parseInt(n.Width,10),parseInt(n.Height,10),parseInt(n.MinLevel,10),parseInt(n.MaxLevel,10)))}return e.extend(!0,{width:c,height:u,tileSize:d,tileOverlap:p,minLevel:null,maxLevel:null,tilesUrl:s,fileFormat:a,displayRects:g},i)}}(OpenSeadragon);!function(e){e.IIIFTileSource=function(t){e.extend(!0,this,t);if(!(this.height&&this.width&&this))throw new Error(“IIIF required parameters not provided.”);t.tileSizePerScaleFactor={};if(this.tile_width&&this.tile_height){t.tileWidth=this.tile_width;t.tileHeight=this.tile_height}else if(this.tile_width)t.tileSize=this.tile_width;else if(this.tile_height)t.tileSize=this.tile_height;else if(this.tiles)if(1==this.tiles.length){t.tileWidth=this.tiles.width;t.tileHeight=this.tiles.height||this.tiles.width;this.scale_factors=this.tiles.scaleFactors}else{this.scale_factors=[];for(var i=0;i<this.tiles.length;i++)for(var n=0;n.scaleFactors.length;n++){var o=this.tiles.scaleFactors;this.scale_factors.push(o);t.tileSizePerScaleFactor={width:this.tiles.width,height:this.tiles.height||this.tiles.width}}}else if(h=t.profile,-1==[“http://library.stanford.edu/iiif/image-api/compliance.html#level0”,“http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0”,“http://iiif.io/api/image/2/level0.json”].indexOf(h[0])||-1!=h.indexOf(“sizeByW”)){var r=Math.min(this.height,this.width),s=,a=[];for(var l=0;l<=r&&a.push(s);a.length>0?t.tileSize=Math.max.apply(null,a):t.tileSize=r}else if(this.sizes&&this.sizes.length>0){this.emulateLegacyImagePyramid=!0;t.levels=function(e){var t=[];for(var i=0;i<e.sizes.length;i++)t.push({url:e+“/full/”e.sizes[i].width“,/0/default.jpg”,width:e.sizes.width,height:e.sizes.height});return t.sort(function(e,t){return e.width-t.width})}(this);e.extend(!0,t,{width:t.levels.width,height:t.levels.height,tileSize:Math.max(t.height,t.width),tileOverlap:0,minLevel:0,maxLevel:t.levels.length-1});this.levels=t.levels}else e.console.error(“Nothing in the info.json to construct image pyramids from”);var h;if(!t.maxLevel&&!this.emulateLegacyImagePyramid)if(this.scale_factors){var c=Math.max.apply(null,this.scale_factors);t.maxLevel=Math.round(Math.log©*Math.LOG2E)}else t.maxLevel=Number(Math.ceil(Math.log(Math.max(this.width,this.height),2)));e.TileSource.apply(this,)};e.extend(e.IIIFTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return!(!e.protocol||“http://iiif.io/api/image”!=e.protocol)||(!(!e[“@context”]||“http://library.stanford.edu/iiif/image-api/1.1/context.json”!=e[“@context”]&&“http://iiif.io/api/image/1/context.json”!=e[“@context”])||(!(!e.profile||0!==e.profile.indexOf(“http://library.stanford.edu/iiif/image-api/compliance.html”))||(!!(e.identifier&&e.width&&e.height)||!(!e.documentElement||“info”!=e.documentElement.tagName||“http://library.stanford.edu/iiif/image-api/ns/”!=e.documentElement.namespaceURI))))},configure:function(t,i){if(e.isPlainObject(t)){if(t[“@context”])return t;t=“iiif.io/api/image/1.0/context.json”;t[“@id”]=i.replace(“/info.json”,“”);return t}var n=function(t){if(!t||!t.documentElement)throw new Error(e.getString(“Errors.Xml”));var i=t.documentElement,n=null;if(“info”==i.tagName)try{!function t(i,n,o){var r,s;if(3==i.nodeType&&o){(s=i.nodeValue.trim()).match(/^d*$/)&&(s=Number(s));if(n){e.isArray(n)||(n=[n]);n.push(s)}else n=s}else if(1==i.nodeType)for(r=0;r,n,i.nodeName)}(i,n={});return n}catch(t){throw t instanceof Error?t:new Error(e.getString(“Errors.IIIF”))}throw new Error(e.getString(“Errors.IIIF”))}(t);n=“iiif.io/api/image/1.0/context.json”;n[“@id”]=i.replace(“/info.xml”,“”);return n},getTileWidth:function(t){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileWidth.call(this,t);var i=Math.pow(2,this.maxLevel-t);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor?this.tileSizePerScaleFactor.width:this._tileWidth},getTileHeight:function(t){if(this.emulateLegacyImagePyramid)return e.TileSource.prototype.getTileHeight.call(this,t);var i=Math.pow(2,this.maxLevel-t);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor?this.tileSizePerScaleFactor.height:this._tileHeight},getLevelScale:function(t){if(this.emulateLegacyImagePyramid){var i=NaN;this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(i=this.levels.width/this.levels.width);return i}return e.TileSource.prototype.getLevelScale.call(this,t)},getNumTiles:function(t){if(this.emulateLegacyImagePyramid){return this.getLevelScale(t)?new e.Point(1,1):new e.Point(0,0)}return e.TileSource.prototype.getNumTiles.call(this,t)},getTileAtPoint:function(t,i){return this.emulateLegacyImagePyramid?new e.Point(0,0):e.TileSource.prototype.getTileAtPoint.call(this,t,i)},getTileUrl:function(e,t,i){if(this.emulateLegacyImagePyramid){var n=null;this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(n=this.levels.url);return n}var o,r,s,a,l,h,c,u,d,p,g,m=Math.pow(.5,this.maxLevel-e),v=Math.ceil(this.width*m),f=Math.ceil(this.height*m);o=this.getTileWidth(e);r=this.getTileHeight(e);s=Math.ceil(o/m);a=Math.ceil(r/m);g=this.indexOf(“/1.0/context.json”)>-1||this.indexOf(“/1.1/context.json”)>-1||this.indexOf(“/1/context.json”)>-1?“native.jpg”:“default.jpg”;if(v<o&&f<r){p=v+“,”;l=“full”}else{h=t*s;c=i*a;u=Math.min(s,this.width-h);d=Math.min(a,this.height-c);p=Math.ceil(u*m)+“,”;l=.join(“,”)}return[this,l,p,“0”,g].join(“/”)}})}(OpenSeadragon);!function(e){e.OsmTileSource=function(t,i,n,o,r){var s;if(!(s=e.isPlainObject(t)?t:{width:arguments,height:arguments,tileSize:arguments,tileOverlap:arguments,tilesUrl:arguments}).width||!s.height){s.width=65572864;s.height=65572864}if(!s.tileSize){s.tileSize=256;s.tileOverlap=0}s.tilesUrl||(s.tilesUrl=“http://tile.openstreetmap.org/”);s.minLevel=8;e.TileSource.apply(this,[s])};e.extend(e.OsmTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&“openstreetmaps”==e.type},configure:function(e,t){return e},getTileUrl:function(e,t,i){return this.tilesUrl+(e-8)+“/”t“/”i“.png”}})}(OpenSeadragon);!function(e){e.TmsTileSource=function(t,i,n,o,r){var s;s=e.isPlainObject(t)?t:{width:arguments,height:arguments,tileSize:arguments,tileOverlap:arguments,tilesUrl:arguments};var a,l=256*Math.ceil(s.width/256),h=256*Math.ceil(s.height/256);a=l>h?l/256:h/256;s.maxLevel=Math.ceil(Math.log(a)/Math.log(2))-1;s.tileSize=256;s.width=l;s.height=h;e.TileSource.apply(this,)};e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&“tiledmapservice”==e.type},configure:function(e,t){return e},getTileUrl:function(e,t,i){var n=this.getNumTiles(e).y-1;return this.tilesUrl+e+“/”t“/”+(n-i)+“.png”}})}(OpenSeadragon);!function(e){e.ZoomifyTileSource=function(e){e.tileSize=256;var t={x:e.width,y:e.height};e.imageSizes=;e.gridSize=;for(;parseInt(t.x,10)>e.tileSize||parseInt(t.y,10)>e.tileSize;){t.x=Math.floor(t.x/2);t.y=Math.floor(t.y/2);e.imageSizes.push({x:t.x,y:t.y});e.gridSize.push(this._getGridSize(t.x,t.y,e.tileSize))}e.imageSizes.reverse();e.gridSize.reverse();e.minLevel=0;e.maxLevel=e.gridSize.length-1;OpenSeadragon.TileSource.apply(this,)};e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(e,t,i){return{x:Math.ceil(e/i),y:Math.ceil(t/i)}},_calculateAbsoluteTileNumber:function(e,t,i){var n=0;var o={};for(var r=0;r).x*o.y;return n+=(o=this.gridSize).x*i+t},supports:function(e,t){return e.type&&“zoomifytileservice”==e.type},configure:function(e,t){return e},getTileUrl:function(e,t,i){var n=0;var o=this._calculateAbsoluteTileNumber(e,t,i);n=Math.floor(o/256);return this.tilesUrl+“TileGroup”n“/”e“-”t“-”i“.jpg”}})}(OpenSeadragon);!function(e){e.LegacyTileSource=function(t){var i,n,o;e.isArray(t)&&(i={type:“legacy-image-pyramid”,levels:t});i.levels=function(t){var i,n,o=[];for(n=0;n).height&&i.width&&i.url?o.push({url:i.url,width:Number(i.width),height:Number(i.height)}):e.console.error(“Unsupported image format: %s”,i.url?i.url:“<no URL>”);return o.sort(function(e,t){return e.height-t.height})}(i.levels);if(i.levels.length>0){n=i.levels.width;o=i.levels.height}else{n=0;o=0;e.console.error(“No supported image formats found”)}e.extend(!0,i,{width:n,height:o,tileSize:Math.max(o,n),tileOverlap:0,minLevel:0,maxLevel:i.levels.length>0?i.levels.length-1:0});e.TileSource.apply(this,);this.levels=i.levels};e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&“legacy-image-pyramid”==e.type||e.documentElement&&“legacy-image-pyramid”==e.documentElement.getAttribute(“type”)},configure:function(i,n){return e.isPlainObject(i)?t(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(e.getString(“Errors.Xml”));var o,r,s=n.documentElement,a=s.tagName,l=null,h=[];if(“image”==a)try{l={type:s.getAttribute(“type”),levels:};h=s.getElementsByTagName(“level”);for(r=0;r<h.length;r++){o=h;l.levels.push({url:o.getAttribute(“url”),width:parseInt(o.getAttribute(“width”),10),height:parseInt(o.getAttribute(“height”),10)})}return t(i,l)}catch(e){throw e instanceof Error?e:new Error(“Unknown error parsing Legacy Image Pyramid XML.”)}else{if(“collection”==a)throw new Error(“Legacy Image Pyramid Collections not yet supported.”);if(“error”==a)throw new Error(“Error: ”+n)}throw new Error(“Unknown element ”+a)}(this,i)},getLevelScale:function(e){var t=NaN;this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(t=this.levels.width/this.levels.width);return t},getNumTiles:function(t){return this.getLevelScale(t)?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(e,t,i){var n=null;this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(n=this.levels.url);return n}});function t(e,t){return t.levels}}(OpenSeadragon);!function(e){e.ImageTileSource=function(t){t=e.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},t);e.TileSource.apply(this,)};e.extend(e.ImageTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&“image”===e.type},configure:function(e,t){return e},getImageInfo:function(t){var i=this._image=new Image;var n=this;this.crossOriginPolicy&&(i.crossOrigin=this.crossOriginPolicy);this.ajaxWithCredentials&&(i.useCredentials=this.ajaxWithCredentials);e.addEvent(i,“load”,function(){n.width=Object.prototype.hasOwnProperty.call(i,“naturalWidth”)?i.naturalWidth:i.width;n.height=Object.prototype.hasOwnProperty.call(i,“naturalHeight”)?i.naturalHeight:i.height;n.aspectRatio=n.width/n.height;n.dimensions=new e.Point(n.width,n.height);n._tileWidth=n.width;n._tileHeight=n.height;n.tileOverlap=0;n.minLevel=0;n.levels=n._buildLevels();n.maxLevel=n.levels.length-1;n.ready=!0;n.raiseEvent(“ready”,{tileSource:n})});e.addEvent(i,“error”,function(){n.raiseEvent(“open-failed”,{message:“Error loading image at ”+t,source:t})});i.src=t},getLevelScale:function(e){var t=NaN;e>=this.minLevel&&e<=this.maxLevel&&(t=this.levels.width/this.levels.width);return t},getNumTiles:function(t){return this.getLevelScale(t)?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(e,t,i){var n=null;e>=this.minLevel&&e<=this.maxLevel&&(n=this.levels.url);return n},getContext2D:function(e,t,i){var n=null;e>=this.minLevel&&e<=this.maxLevel&&(n=this.levels.context2D);return n},_buildLevels:function(){var t=;if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas){delete this._image;return t}var i=Object.prototype.hasOwnProperty.call(this._image,“naturalWidth”)?this._image.naturalWidth:this._image.width;var n=Object.prototype.hasOwnProperty.call(this._image,“naturalHeight”)?this._image.naturalHeight:this._image.height;var o=document.createElement(“canvas”);var r=o.getContext(“2d”);o.width=i;o.height=n;r.drawImage(this._image,0,0,i,n);t.context2D=r;delete this._image;if(e.isCanvasTainted(o))return t;for(;i>=2&&n>=2;){i=Math.floor(i/2);n=Math.floor(n/2);var s=document.createElement(“canvas”);var a=s.getContext(“2d”);s.width=i;s.height=n;a.drawImage(o,0,0,i,n);t.splice(0,0,{context2D:a,width:i,height:n});o=s;r=a}return t}})}(OpenSeadragon);!function(e){e.TileSourceCollection=function(t,i,n,o){e.console.error(“TileSourceCollection is deprecated; use World instead”)}}(OpenSeadragon);!function(e){e.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3};e.Button=function(t){var o=this;e.EventSource.call(this);e.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null},t);this.element=t.element||e.makeNeutralElement(“div”);if(!t.element){this.imgRest=e.makeTransparentImage(this.srcRest);this.imgGroup=e.makeTransparentImage(this.srcGroup);this.imgHover=e.makeTransparentImage(this.srcHover);this.imgDown=e.makeTransparentImage(this.srcDown);this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip;this.element.style.position=“relative”;e.setElementTouchActionNone(this.element);this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position=“absolute”;this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=“0px”;this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left=“0px”;this.imgHover.style.visibility=this.imgDown.style.visibility=“hidden”;e.Browser.vendor==e.BROWSERS.FIREFOX&&e.Browser.version<3&&(this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=“”);this.element.appendChild(this.imgRest);this.element.appendChild(this.imgGroup);this.element.appendChild(this.imgHover);this.element.appendChild(this.imgDown)}this.addHandler(“press”,this.onPress);this.addHandler(“release”,this.onRelease);this.addHandler(“click”,this.onClick);this.addHandler(“enter”,this.onEnter);this.addHandler(“exit”,this.onExit);this.addHandler(“focus”,this.onFocus);this.addHandler(“blur”,this.onBlur);this.currentState=e.ButtonState.GROUP;this.fadeBeginTime=null;this.shouldFade=!1;this.element.style.display=“inline-block”;this.element.style.position=“relative”;this.element.title=this.tooltip;this.tracker=new e.MouseTracker({element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){if(t.insideElementPressed){i(o,e.ButtonState.DOWN);o.raiseEvent(“enter”,{originalEvent:t.originalEvent})}else t.buttonDownAny||i(o,e.ButtonState.HOVER)},focusHandler:function(e){this.enterHandler(e);o.raiseEvent(“focus”,{originalEvent:e.originalEvent})},exitHandler:function(t){n(o,e.ButtonState.GROUP);t.insideElementPressed&&o.raiseEvent(“exit”,{originalEvent:t.originalEvent})},blurHandler:function(e){this.exitHandler(e);o.raiseEvent(“blur”,{originalEvent:e.originalEvent})},pressHandler:function(t){i(o,e.ButtonState.DOWN);o.raiseEvent(“press”,{originalEvent:t.originalEvent})},releaseHandler:function(t){if(t.insideElementPressed&&t.insideElementReleased){n(o,e.ButtonState.HOVER);o.raiseEvent(“release”,{originalEvent:t.originalEvent})}else t.insideElementPressed?n(o,e.ButtonState.GROUP):i(o,e.ButtonState.HOVER)},clickHandler:function(e){e.quick&&o.raiseEvent(“click”,{originalEvent:e.originalEvent})},keyHandler:function(e){if(13===e.keyCode){o.raiseEvent(“click”,{originalEvent:e.originalEvent});o.raiseEvent(“release”,{originalEvent:e.originalEvent});return!1}return!0}});n(this,e.ButtonState.REST)};e.extend(e.Button.prototype,e.EventSource.prototype,{notifyGroupEnter:function(){i(this,e.ButtonState.GROUP)},notifyGroupExit:function(){n(this,e.ButtonState.REST)},disable:function(){this.notifyGroupExit();this.element.disabled=!0;e.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1;e.setElementOpacity(this.element,1,!0);this.notifyGroupEnter()}});function t(i){e.requestAnimationFrame(function(){!function(i){var n,o,r;if(i.shouldFade){n=e.now();o=n-i.fadeBeginTime;r=1-o/i.fadeLength;r=Math.min(1,r);r=Math.max(0,r);i.imgGroup&&e.setElementOpacity(i.imgGroup,r,!0);r>0&&t(i)}}(i)})}function i(t,i){if(!t.element.disabled){if(i>=e.ButtonState.GROUP&&t.currentState==e.ButtonState.REST){!function(t){t.shouldFade=!1;t.imgGroup&&e.setElementOpacity(t.imgGroup,1,!0)}(t);t.currentState=e.ButtonState.GROUP}if(i>=e.ButtonState.HOVER&&t.currentState==e.ButtonState.GROUP){t.imgHover&&(t.imgHover.style.visibility=“”);t.currentState=e.ButtonState.HOVER}if(i>=e.ButtonState.DOWN&&t.currentState==e.ButtonState.HOVER){t.imgDown&&(t.imgDown.style.visibility=“”);t.currentState=e.ButtonState.DOWN}}}function n(i,n){if(!i.element.disabled){if(n<=e.ButtonState.HOVER&&i.currentState==e.ButtonState.DOWN){i.imgDown&&(i.imgDown.style.visibility=“hidden”);i.currentState=e.ButtonState.HOVER}if(n<=e.ButtonState.GROUP&&i.currentState==e.ButtonState.HOVER){i.imgHover&&(i.imgHover.style.visibility=“hidden”);i.currentState=e.ButtonState.GROUP}if(n<=e.ButtonState.REST&&i.currentState==e.ButtonState.GROUP){!function(i){i.shouldFade=!0;i.fadeBeginTime=e.now()+i.fadeDelay;window.setTimeout(function(){t(i)},i.fadeDelay)}(i);i.currentState=e.ButtonState.REST}}}}(OpenSeadragon);!function(e){e.ButtonGroup=function(t){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:“”},t);var i,n=this.buttons.concat([]),o=this;this.element=t.element||e.makeNeutralElement(“div”);if(!t.group){this.label=e.makeNeutralElement(“label”);this.element.style.display=“inline-block”;this.element.appendChild(this.label);for(i=0;i.element)}e.setElementTouchActionNone(this.element);this.tracker=new e.MouseTracker({element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(e){var t;for(t=0;t.notifyGroupEnter()},exitHandler:function(e){var t;if(!e.insideElementPressed)for(t=0;t.notifyGroupExit()}})};e.ButtonGroup.prototype={emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateExit:function(){this.tracker.exitHandler({eventSource:this.tracker})}}}(OpenSeadragon);!function(e){e.Rect=function(t,i,n,o,r){this.x=“number”==typeof t?t:0;this.y=“number”==typeof i?i:0;this.width=“number”==typeof n?n:0;this.height=“number”==typeof o?o:0;this.degrees=“number”==typeof r?r:0;this.degrees=e.positiveModulo(this.degrees,360);var s,a;if(this.degrees>=270){s=this.getTopRight();this.x=s.x;this.y=s.y;a=this.height;this.height=this.width;this.width=a;this.degrees-=270}else if(this.degrees>=180){s=this.getBottomRight();this.x=s.x;this.y=s.y;this.degrees-=180}else if(this.degrees>=90){s=this.getBottomLeft();this.x=s.x;this.y=s.y;a=this.height;this.height=this.width;this.width=a;this.degrees-=90}};e.Rect.fromSummits=function(t,i,n){var o=t.distanceTo(i);var r=t.distanceTo(n);var s=i.minus(t);var a=Math.atan(s.y/s.x);s.x<0?a+=Math.PI:s.y<0&&(a+=2*Math.PI);return new e.Rect(t.x,t.y,o,r,a/Math.PI*180)};e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(t){return t instanceof e.Rect&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height&&this.degrees===t.degrees},times:function(t){return new e.Rect(this.x*t,this.y*t,this.width*t,this.height*t,this.degrees)},translate:function(t){return new e.Rect(this.x+t.x,this.y+t.y,this.width,this.height,this.degrees)},union:function(t){var i=this.getBoundingBox();var n=t.getBoundingBox();var o=Math.min(i.x,n.x);var r=Math.min(i.y,n.y);var s=Math.max(i.x+i.width,n.x+n.width);var a=Math.max(i.y+i.height,n.y+n.height);return new e.Rect(o,r,s-o,a-r)},intersection:function(t){var i=1e-10;var n=[];var o=this.getTopLeft();t.containsPoint(o,i)&&n.push(o);var r=this.getTopRight();t.containsPoint(r,i)&&n.push®;var s=this.getBottomLeft();t.containsPoint(s,i)&&n.push(s);var a=this.getBottomRight();t.containsPoint(a,i)&&n.push(a);var l=t.getTopLeft();this.containsPoint(l,i)&&n.push(l);var h=t.getTopRight();this.containsPoint(h,i)&&n.push(h);var c=t.getBottomLeft();this.containsPoint(c,i)&&n.push©;var u=t.getBottomRight();this.containsPoint(u,i)&&n.push(u);var d=this._getSegments();var p=t._getSegments();for(var g=0;g<d.length;g++){var m=d;for(var v=0;v<p.length;v++){var f=p;var w=y(m,m,f,f);w&&n.push(w)}}function y(t,n,o,r){var s=n.minus(t);var a=r.minus(o);var l=-a.x*s.y+s.x*a.y;if(0===l)return null;var h=(s.x*(t.y-o.y)-s.y*(t.x-o.x))/l;var c=(a.x*(t.y-o.y)-a.y*(t.x-o.x))/l;return-i<=h&&h<=1-i&&-i<=c&&c<=1-i?new e.Point(t.x+c*s.x,t.y+c*s.y):null}if(0===n.length)return null;var T=n.x;var x=n.x;var S=n.y;var E=n.y;for(var P=1;P<n.length;P++){var R=n;R.x<T&&(T=R.x);R.x>x&&(x=R.x);R.y<S&&(S=R.y);R.y>E&&(E=R.y)}return new e.Rect(T,S,x-T,E-S)},_getSegments:function(){var e=this.getTopLeft();var t=this.getTopRight();var i=this.getBottomLeft();var n=this.getBottomRight();return[,[t,n],,[i,e]]},rotate:function(t,i){if(0===(t=e.positiveModulo(t,360)))return this.clone();i=i||this.getCenter();var n=this.getTopLeft().rotate(t,i);var o=this.getTopRight().rotate(t,i).minus(n);o=o.apply(function(e){return Math.abs(e)<1e-15?0:e});var r=Math.atan(o.y/o.x);o.x<0?r+=Math.PI:o.y<0&&(r+=2*Math.PI);return new e.Rect(n.x,n.y,this.width,this.height,r/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var t=this.getTopLeft();var i=this.getTopRight();var n=this.getBottomLeft();var o=this.getBottomRight();var r=Math.min(t.x,i.x,n.x,o.x);var s=Math.max(t.x,i.x,n.x,o.x);var a=Math.min(t.y,i.y,n.y,o.y);var l=Math.max(t.y,i.y,n.y,o.y);return new e.Rect(r,a,s-r,l-a)},getIntegerBoundingBox:function(){var t=this.getBoundingBox();var i=Math.floor(t.x);var n=Math.floor(t.y);var o=Math.ceil(t.width+t.x-i);var r=Math.ceil(t.height+t.y-n);return new e.Rect(i,n,o,r)},containsPoint:function(e,t){t=t||0;var i=this.getTopLeft();var n=this.getTopRight();var o=this.getBottomLeft();var r=n.minus(i);var s=o.minus(i);return(e.x-i.x)*r.x+(e.y-i.y)*r.y>=-t&&(e.x-n.x)*r.x+(e.y-n.y)*r.y<=t&&(e.x-i.x)*s.x+(e.y-i.y)*s.y>=-t&&(e.x-o.x)*s.x+(e.y-o.y)*s.y<=t},toString:function(){return“[”+Math.round(100*this.x)/100+“, ”+Math.round(100*this.y)/100+“, ”+Math.round(100*this.width)/100+“x”+Math.round(100*this.height)/100+“, ”+Math.round(100*this.degrees)/100+“deg]”}}}(OpenSeadragon);!function(e){var t={};e.ReferenceStrip=function(h){var c,u,d,p=h.viewer,g=e.getElementSize(p.element);if(!h.id){h.id=“referencestrip-”+e.now();this.element=e.makeNeutralElement(“div”);this.element.id=h.id;this.element.className=“referencestrip”}h=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.referenceStripSizeRatio,position:e.DEFAULT_SETTINGS.referenceStripPosition,scroll:e.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold},h,{element:this.element,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1});e.extend(this,h);t={animating:!1};this.minPixelRatio=this.viewer.minPixelRatio;(u=this.element.style).marginTop=“0px”;u.marginRight=“0px”;u.marginBottom=“0px”;u.marginLeft=“0px”;u.left=“0px”;u.bottom=“0px”;u.border=“0px”;u.background=“#000”;u.position=“relative”;e.setElementTouchActionNone(this.element);e.setElementOpacity(this.element,.8);this.viewer=p;this.innerTracker=new e.MouseTracker({element:this.element,dragHandler:e.delegate(this,i),scrollHandler:e.delegate(this,n),enterHandler:e.delegate(this,r),exitHandler:e.delegate(this,s),keyDownHandler:e.delegate(this,a),keyHandler:e.delegate(this,l)});if(h.width&&h.height){this.element.style.width=h.width+“px”;this.element.style.height=h.height+“px”;p.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})}else if(“horizontal”==h.scroll){this.element.style.width=g.x*h.sizeRatio*p.tileSources.length+12*p.tileSources.length+“px”;this.element.style.height=g.y*h.sizeRatio+“px”;p.addControl(this.element,{anchor:e.ControlAnchor.BOTTOM_LEFT})}else{this.element.style.height=g.y*h.sizeRatio*p.tileSources.length+12*p.tileSources.length+“px”;this.element.style.width=g.x*h.sizeRatio+“px”;p.addControl(this.element,{anchor:e.ControlAnchor.TOP_LEFT})}this.panelWidth=g.x*this.sizeRatio+8;this.panelHeight=g.y*this.sizeRatio+8;this.panels=[];this.miniViewers={};for(d=0;d<p.tileSources.length;d++){(c=e.makeNeutralElement(“div”)).id=this.element.id+“-”+d;c.style.width=this.panelWidth+“px”;c.style.height=this.panelHeight+“px”;c.style.display=“inline”;c.style.float=“left”;c.style.cssFloat=“left”;c.style.styleFloat=“left”;c.style.padding=“2px”;e.setElementTouchActionNone©;c.innerTracker=new e.MouseTracker({element:c,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,pressHandler:function(t){t.eventSource.dragging=e.now()},releaseHandler:function(t){var i=t.eventSource,n=i.element.id,o=Number(n.split(“-”)),r=e.now();if(t.insideElementPressed&&t.insideElementReleased&&i.dragging&&r-i.dragging<i.clickTimeThreshold){i.dragging=null;p.goToPage(o)}}});this.element.appendChild©;c.activePanel=!1;this.panels.push©}o(this,“vertical”==this.scroll?g.y:g.x,0);this.setFocus(0)};e.extend(e.ReferenceStrip.prototype,e.EventSource.prototype,e.Viewer.prototype,{setFocus:function(t){var i,n=e.getElement(this.element.id+“-”+t),s=e.getElementSize(this.viewer.canvas),a=Number(this.element.style.width.replace(“px”,“”)),l=Number(this.element.style.height.replace(“px”,“”)),h=-Number(this.element.style.marginLeft.replace(“px”,“”)),c=-Number(this.element.style.marginTop.replace(“px”,“”));if(this.currentSelected!==n){this.currentSelected&&(this.currentSelected.style.background=“#000”);this.currentSelected=n;this.currentSelected.style.background=“#999”;if(“horizontal”==this.scroll){if((i=Number(t)*(this.panelWidth+3))>h+s.x-this.panelWidth){i=Math.min(i,a-s.x);this.element.style.marginLeft=-i+“px”;o(this,s.x,-i)}else if(i<h){i=Math.max(0,i-s.x/2);this.element.style.marginLeft=-i+“px”;o(this,s.x,-i)}}else if((i=Number(t)*(this.panelHeight+3))>c+s.y-this.panelHeight){i=Math.min(i,l-s.y);this.element.style.marginTop=-i+“px”;o(this,s.y,-i)}else if(i<c){i=Math.max(0,i-s.y/2);this.element.style.marginTop=-i+“px”;o(this,s.y,-i)}this.currentPage=t;r.call(this,{eventSource:this.innerTracker})}},update:function(){if(t.animating){e.console.log(“image reference strip update”);return!0}return!1},destroy:function(){if(this.miniViewers)for(var e in this.miniViewers)this.miniViewers.destroy();this.element&&this.element.parentNode.removeChild(this.element)}});function i(t){var i=Number(this.element.style.marginLeft.replace(“px”,“”)),n=Number(this.element.style.marginTop.replace(“px”,“”)),r=Number(this.element.style.width.replace(“px”,“”)),s=Number(this.element.style.height.replace(“px”,“”)),a=e.getElementSize(this.viewer.canvas);this.dragging=!0;if(this.element)if(“horizontal”==this.scroll){if(-t.delta.x>0){if(i>-(r-a.x)){this.element.style.marginLeft=i+2*t.delta.x+“px”;o(this,a.x,i+2*t.delta.x)}}else if(-t.delta.x<0&&i<0){this.element.style.marginLeft=i+2*t.delta.x+“px”;o(this,a.x,i+2*t.delta.x)}}else if(-t.delta.y>0){if(n>-(s-a.y)){this.element.style.marginTop=n+2*t.delta.y+“px”;o(this,a.y,n+2*t.delta.y)}}else if(-t.delta.y<0&&n<0){this.element.style.marginTop=n+2*t.delta.y+“px”;o(this,a.y,n+2*t.delta.y)}return!1}function n(t){var i=Number(this.element.style.marginLeft.replace(“px”,“”)),n=Number(this.element.style.marginTop.replace(“px”,“”)),r=Number(this.element.style.width.replace(“px”,“”)),s=Number(this.element.style.height.replace(“px”,“”)),a=e.getElementSize(this.viewer.canvas);if(this.element)if(“horizontal”==this.scroll){if(t.scroll>0){if(i>-(r-a.x)){this.element.style.marginLeft=i-60*t.scroll+“px”;o(this,a.x,i-60*t.scroll)}}else if(t.scroll<0&&i<0){this.element.style.marginLeft=i-60*t.scroll+“px”;o(this,a.x,i-60*t.scroll)}}else if(t.scroll<0){if(n>a.y-s){this.element.style.marginTop=n+60*t.scroll+“px”;o(this,a.y,n+60*t.scroll)}}else if(t.scroll>0&&n<0){this.element.style.marginTop=n+60*t.scroll+“px”;o(this,a.y,n+60*t.scroll)}return!1}function o(t,i,n){var o,r,s,a,l,h,c;o=“horizontal”==t.scroll?t.panelWidth:t.panelHeight;r=Math.ceil(i/o)+5;for(h=r=(r=(s=Math.ceil((Math.abs(n)+i)/o)+1)-r)<0?0:r;h).activePanel){var u;var d=t.viewer.tileSources;u=d.referenceStripThumbnailUrl?{type:“image”,url:d.referenceStripThumbnailUrl}:d;(a=new e.Viewer({id:c.id,tileSources:,element:c,navigatorSizeRatio:t.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0})).displayRegion=e.makeNeutralElement(“div”);a.displayRegion.id=c.id+“-displayregion”;a.displayRegion.className=“displayregion”;(l=a.displayRegion.style).position=“relative”;l.top=“0px”;l.left=“0px”;l.fontSize=“0px”;l.overflow=“hidden”;l.float=“left”;l.cssFloat=“left”;l.styleFloat=“left”;l.zIndex=999999999;l.cursor=“default”;l.width=t.panelWidth-4+“px”;l.height=t.panelHeight-4+“px”;a.displayRegion.innerTracker=new e.MouseTracker({element:a.displayRegion,startDisabled:!0});c.getElementsByTagName(“div”).appendChild(a.displayRegion);t.miniViewers=a;c.activePanel=!0}}function r(e){var t=e.eventSource.element;“horizontal”==this.scroll?t.style.marginBottom=“0px”:t.style.marginLeft=“0px”;return!1}function s(t){var i=t.eventSource.element;“horizontal”==this.scroll?i.style.marginBottom=“-”+e.getElementSize(i).y/2+“px”:i.style.marginLeft=“-”+e.getElementSize(i).x/2+“px”;return!1}function a(e){if(e.preventDefaultAction||e.ctrl||e.alt||e.meta)return!0;switch(e.keyCode){case 38:n.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return!1;case 40:case 37:n.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return!1;case 39:n.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return!1;default:return!0}}function l(e){if(e.preventDefaultAction||e.ctrl||e.alt||e.meta)return!0;switch(e.keyCode){case 61:n.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return!1;case 45:n.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return!1;case 48:case 119:case 87:n.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return!1;case 115:case 83:case 97:n.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null});return!1;case 100:n.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null});return!1;default:return!0}}}(OpenSeadragon);!function(e){e.DisplayRect=function(t,i,n,o,r,s){e.Rect.apply(this,);this.minLevel=r;this.maxLevel=s};e.extend(e.DisplayRect.prototype,e.Rect.prototype)}(OpenSeadragon);!function(e){e.Spring=function(t){var i=arguments;“object”!=typeof t&&(t={initial:i.length&&“number”==typeof i?i:void 0,springStiffness:i.length>1?i.springStiffness:5,animationTime:i.length>1?i.animationTime:1.5});e.console.assert(“number”==typeof t.springStiffness&&0!==t.springStiffness,“ options.springStiffness must be a non-zero number”);e.console.assert(“number”==typeof t.animationTime&&t.animationTime>=0,“ options.animationTime must be a number greater than or equal to 0”);if(t.exponential){this._exponential=!0;delete t.exponential}e.extend(!0,this,t);this.current={value:“number”==typeof this.initial?this.initial:this._exponential?0:1,time:e.now()};e.console.assert(!this._exponential||0!==this.current.value,“ value must be non-zero for exponential springs”);this.start={value:this.current.value,time:this.current.time};this.target={value:this.current.value,time:this.current.time};if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}};e.Spring.prototype={resetTo:function(t){e.console.assert(!this._exponential||0!==t,“ target must be non-zero for exponential springs”);this.start.value=this.target.value=this.current.value=t;this.start.time=this.target.time=this.current.time=e.now();if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}},springTo:function(t){e.console.assert(!this._exponential||0!==t,“ target must be non-zero for exponential springs”);this.start.value=this.current.value;this.start.time=this.current.time;this.target.value=t;this.target.time=this.start.time+1e3*this.animationTime;if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value)}},shiftBy:function(t){this.start.value+=t;this.target.value+=t;if(this._exponential){e.console.assert(0!==this.target.value&&0!==this.start.value,“ spring value must be non-zero for exponential springs”);this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value)}},setExponential:function(t){this._exponential=t;if(this._exponential){e.console.assert(0!==this.current.value&&0!==this.target.value&&0!==this.start.value,“ spring value must be non-zero for exponential springs”);this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}},update:function(){this.current.time=e.now();var t,i;if(this._exponential){t=this.start._logValue;i=this.target._logValue}else{t=this.start.value;i=this.target.value}var n=this.current.time>=this.target.time?i:t+(i-t)*(o=this.springStiffness,r=(this.current.time-this.start.time)/(this.target.time-this.start.time),(1-Math.exp(o*-r))/(1-Math.exp(-o)));var o,r;var s=this.current.value;this._exponential?this.current.value=Math.exp(n):this.current.value=n;return s!=this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(OpenSeadragon);!function(e){function t(t){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null},t);this.image=null}t.prototype={errorMsg:null,start:function(){var t=this;var i=this.abort;this.image=new Image;this.image.onload=function(){t.finish(!0)};this.image.onabort=this.image.onerror=function(){t.errorMsg=“Image load aborted”;t.finish(!1)};this.jobId=window.setTimeout(function(){t.errorMsg=“Image load exceeded timeout”;t.finish(!1)},this.timeout);if(this.loadWithAjax){this.request=e.makeAjaxRequest({url:this.src,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,responseType:“arraybuffer”,success:function(e){var i;try{i=new window.Blob()}catch(t){var n=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(“TypeError”===t.name&&n){var o=new n;o.append(e.response);i=o.getBlob()}}if(0===i.size){t.errorMsg=“Empty image response.”;t.finish(!1)}var r=(window.URL||window.webkitURL).createObjectURL(i);t.image.src=r},error:function(e){t.errorMsg=“Image load aborted - XHR error”;t.finish(!1)}});this.abort=function(){t.request.abort();“function”==typeof i&&i()}}else{!1!==this.crossOriginPolicy&&(this.image.crossOrigin=this.crossOriginPolicy);this.image.src=this.src}},finish:function(e){this.image.onload=this.image.onerror=this.image.onabort=null;e||(this.image=null);this.jobId&&window.clearTimeout(this.jobId);this.callback(this)}};e.ImageLoader=function(t){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},t)};e.ImageLoader.prototype={addJob:function(e){var i=this,n=new t({src:e.src,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.loadWithAjax?e.ajaxHeaders:null,crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,callback:function(t){!function(e,t,i){e.jobsInProgress–;if((!e.jobLimit||e.jobsInProgress<e.jobLimit)&&e.jobQueue.length>0){e.jobQueue.shift().start();e.jobsInProgress++}i(t.image,t.errorMsg,t.request)}(i,t,e.callback)},abort:e.abort,timeout:this.timeout});if(!this.jobLimit||this.jobsInProgress<this.jobLimit){n.start();this.jobsInProgress++}else this.jobQueue.push(n)},clear:function(){for(var e=0;e<this.jobQueue.length;e++){var t=this.jobQueue;“function”==typeof t.abort&&t.abort()}this.jobQueue=[]}}}(OpenSeadragon);!function(e){e.Tile=function(e,t,i,n,o,r,s,a,l,h){this.level=e;this.x=t;this.y=i;this.bounds=n;this.sourceBounds=h;this.exists=o;this.url=r;this.context2D=s;this.loadWithAjax=a;this.ajaxHeaders=l;this.ajaxHeaders?this.cacheKey=this.url+“+”+JSON.stringify(this.ajaxHeaders):this.cacheKey=this.url;this.loaded=!1;this.loading=!1;this.element=null;this.imgElement=null;this.image=null;this.style=null;this.position=null;this.size=null;this.blendStart=null;this.opacity=null;this.squaredDistance=null;this.visibility=null;this.beingDrawn=!1;this.lastTouchTime=0;this.isRightMost=!1;this.isBottomMost=!1};e.Tile.prototype={toString:function(){return this.level+“/”this.x“_”+this.y},_hasTransparencyChannel:function(){return!!this.context2D||this.url.match(“.png”)},drawHTML:function(t){if(this.cacheImageRecord)if(this.loaded){if(!this.element){this.element=e.makeNeutralElement(“div”);this.imgElement=this.cacheImageRecord.getImage().cloneNode();this.imgElement.style.msInterpolationMode=“nearest-neighbor”;this.imgElement.style.width=“100%”;this.imgElement.style.height=“100%”;this.style=this.element.style;this.style.position=“absolute”}this.element.parentNode!=t&&t.appendChild(this.element);this.imgElement.parentNode!=this.element&&this.element.appendChild(this.imgElement);this.style.top=this.position.y+“px”;this.style.left=this.position.x+“px”;this.style.height=this.size.y+“px”;this.style.width=this.size.x+“px”;e.setElementOpacity(this.element,this.opacity)}else e.console.warn(“Attempting to draw tile %s when it's not yet loaded.”,this.toString());else e.console.warn(“ attempting to draw tile %s when it's not cached”,this.toString())},drawCanvas:function(t,i,n,o){var r,s=this.position.times(e.pixelDensityRatio),a=this.size.times(e.pixelDensityRatio);if(this.context2D||this.cacheImageRecord){r=this.context2D||this.cacheImageRecord.getRenderedContext();if(this.loaded&&r){t.save();t.globalAlpha=this.opacity;if(“number”==typeof n&&1!==n){s=s.times(n);a=a.times(n)}o instanceof e.Point&&(s=s.plus(o));1===t.globalAlpha&&this._hasTransparencyChannel()&&t.clearRect(s.x,s.y,a.x,a.y);i({context:t,tile:this,rendered:r});var l,h;if(this.sourceBounds){l=Math.min(this.sourceBounds.width,r.canvas.width);h=Math.min(this.sourceBounds.height,r.canvas.height)}else{l=r.canvas.width;h=r.canvas.height}t.drawImage(r.canvas,0,0,l,h,s.x,s.y,a.x,a.y);t.restore()}else e.console.warn(“Attempting to draw tile %s when it's not yet loaded.”,this.toString())}else e.console.warn(“ attempting to draw tile %s when it's not cached”,this.toString())},getScaleForEdgeSmoothing:function(){var t;if(this.cacheImageRecord)t=this.cacheImageRecord.getRenderedContext();else{if(!this.context2D){e.console.warn(“ attempting to get tile scale %s when tile's not cached”,this.toString());return 1}t=this.context2D}return t.canvas.width/(this.size.x*e.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(t,i,n){var o=Math.max(1,Math.ceil((n.x-i.x)/2));var r=Math.max(1,Math.ceil((n.y-i.y)/2));return new e.Point(o,r).minus(this.position.times(e.pixelDensityRatio).times(t||1).apply(function(e){return e%1}))},unload:function(){this.imgElement&&this.imgElement.parentNode&&this.imgElement.parentNode.removeChild(this.imgElement);this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element);this.element=null;this.imgElement=null;this.loaded=!1;this.loading=!1}}}(OpenSeadragon);!function(e){e.OverlayPlacement=e.Placement;e.OverlayRotationMode=e.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3});e.Overlay=function(t,i,n){var o;o=e.isPlainObject(t)?t:{element:t,location:i,placement:n};this.element=o.element;this.style=o.element.style;this._init(o)};e.Overlay.prototype={_init:function(t){this.location=t.location;this.placement=void 0===t.placement?e.Placement.TOP_LEFT:t.placement;this.onDraw=t.onDraw;this.checkResize=void 0===t.checkResize||t.checkResize;this.width=void 0===t.width?null:t.width;this.height=void 0===t.height?null:t.height;this.rotationMode=t.rotationMode||e.OverlayRotationMode.EXACT;if(this.location instanceof e.Rect){this.width=this.location.width;this.height=this.location.height;this.location=this.location.getTopLeft();this.placement=e.Placement.TOP_LEFT}this.scales=null!==this.width&&null!==this.height;this.bounds=new e.Rect(this.location.x,this.location.y,this.width,this.height);this.position=this.location},adjust:function(t,i){var n=e.Placement.properties;if(n){n.isHorizontallyCentered?t.x-=i.x/2:n.isRight&&(t.x-=i.x);n.isVerticallyCentered?t.y-=i.y/2:n.isBottom&&(t.y-=i.y)}},destroy:function(){var t=this.element;var i=this.style;if(t.parentNode){t.parentNode.removeChild(t);if(t.prevElementParent){i.display=“none”;document.body.appendChild(t)}}this.onDraw=null;i.top=“”;i.left=“”;i.position=“”;null!==this.width&&(i.width=“”);null!==this.height&&(i.height=“”);var n=e.getCssPropertyWithVendorPrefix(“transformOrigin”);var o=e.getCssPropertyWithVendorPrefix(“transform”);if(n&&o){i=“”;i=“”}},drawHTML:function(t,i){var n=this.element;if(n.parentNode!==t){n.prevElementParent=n.parentNode;n.prevNextSibling=n.nextSibling;t.appendChild(n);this.style.position=“absolute”;this.size=e.getElementSize(n)}var o=this._getOverlayPositionAndSize(i);var r=o.position;var s=this.size=o.size;var a=o.rotate;if(this.onDraw)this.onDraw(r,s,this.element);else{var l=this.style;l.left=r.x+“px”;l.top=r.y+“px”;null!==this.width&&(l.width=s.x+“px”);null!==this.height&&(l.height=s.y+“px”);var h=e.getCssPropertyWithVendorPrefix(“transformOrigin”);var c=e.getCssPropertyWithVendorPrefix(“transform”);if(h&&c)if(a){l=this._getTransformOrigin();l=“rotate(”a“deg)”}else{l=“”;l=“”}“none”!==l.display&&(l.display=“block”)}},_getOverlayPositionAndSize:function(t){var i=t.pixelFromPoint(this.location,!0);var n=this._getSizeInPixels(t);this.adjust(i,n);var o=0;if(t.degrees&&this.rotationMode!==e.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX&&null!==this.width&&null!==this.height){var r=new e.Rect(i.x,i.y,n.x,n.y);var s=this._getBoundingBox(r,t.degrees);i=s.getTopLeft();n=s.getSize()}else o=t.degrees;return{position:i,size:n,rotate:o}},_getSizeInPixels:function(t){var i=this.size.x;var n=this.size.y;if(null!==this.width||null!==this.height){var o=t.deltaPixelsFromPointsNoRotate(new e.Point(this.width||0,this.height||0),!0);null!==this.width&&(i=o.x);null!==this.height&&(n=o.y)}if(this.checkResize&&(null===this.width||null===this.height)){var r=this.size=e.getElementSize(this.element);null===this.width&&(i=r.x);null===this.height&&(n=r.y)}return new e.Point(i,n)},_getBoundingBox:function(e,t){var i=this._getPlacementPoint(e);return e.rotate(t,i).getBoundingBox()},_getPlacementPoint:function(t){var i=new e.Point(t.x,t.y);var n=e.Placement.properties;if(n){n.isHorizontallyCentered?i.x+=t.width/2:n.isRight&&(i.x+=t.width);n.isVerticallyCentered?i.y+=t.height/2:n.isBottom&&(i.y+=t.height)}return i},_getTransformOrigin:function(){var t=“”;var i=e.Placement.properties;if(!i)return t;i.isLeft?t=“left”:i.isRight&&(t=“right”);i.isTop?t+=“ top”:i.isBottom&&(t+=“ bottom”);return t},update:function(t,i){var n=e.isPlainObject(t)?t:{location:t,placement:i};this._init({location:n.location||this.location,placement:void 0!==n.placement?n.placement:this.placement,onDraw:n.onDraw||this.onDraw,checkResize:n.checkResize||this.checkResize,width:void 0!==n.width?n.width:this.width,height:void 0!==n.height?n.height:this.height,rotationMode:n.rotationMode||this.rotationMode})},getBounds:function(t){e.console.assert(t,“A viewport must now be passed to Overlay.getBounds.”);var i=this.width;var n=this.height;if(null===i||null===n){var o=t.deltaPointsFromPixelsNoRotate(this.size,!0);null===i&&(i=o.x);null===n&&(n=o.y)}var r=this.location.clone();this.adjust(r,new e.Point(i,n));return this._adjustBoundsForRotation(t,new e.Rect(r.x,r.y,i,n))},_adjustBoundsForRotation:function(t,i){if(!t||0===t.degrees||this.rotationMode===e.OverlayRotationMode.EXACT)return i;if(this.rotationMode===e.OverlayRotationMode.BOUNDING_BOX){if(null===this.width||null===this.height)return i;var n=this._getOverlayPositionAndSize(t);return t.viewerElementToViewportRectangle(new e.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-t.degrees,this._getPlacementPoint(i))}}}(OpenSeadragon);!function(e){e.Drawer=function(t){e.console.assert(t.viewer,“ options.viewer is required”);var i=arguments;e.isPlainObject(t)||(t={source:i,viewport:i,element:i});e.console.assert(t.viewport,“ options.viewport is required”);e.console.assert(t.element,“ options.element is required”);t.source&&e.console.error(“ options.source is no longer accepted; use TiledImage instead”);this.viewer=t.viewer;this.viewport=t.viewport;this.debugGridColor=“string”==typeof t.debugGridColor?:t.debugGridColor||e.DEFAULT_SETTINGS.debugGridColor;t.opacity&&e.console.error(“ options.opacity is no longer accepted; set the opacity on the TiledImage instead”);this.useCanvas=e.supportsCanvas&&(!this.viewer||this.viewer.useCanvas);this.container=e.getElement(t.element);this.canvas=e.makeNeutralElement(this.useCanvas?“canvas”:“div”);this.context=this.useCanvas?this.canvas.getContext(“2d”):null;this.sketchCanvas=null;this.sketchContext=null;this.element=this.container;this.container.dir=“ltr”;if(this.useCanvas){var n=this._calculateCanvasSize();this.canvas.width=n.x;this.canvas.height=n.y}this.canvas.style.width=“100%”;this.canvas.style.height=“100%”;this.canvas.style.position=“absolute”;e.setElementOpacity(this.canvas,this.opacity,!0);this.container.style.textAlign=“left”;this.container.appendChild(this.canvas)};e.Drawer.prototype={addOverlay:function(t,i,n,o){e.console.error(“drawer.addOverlay is deprecated. Use viewer.addOverlay instead.”);this.viewer.addOverlay(t,i,n,o);return this},updateOverlay:function(t,i,n){e.console.error(“drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead.”);this.viewer.updateOverlay(t,i,n);return this},removeOverlay:function(t){e.console.error(“drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead.”);this.viewer.removeOverlay(t);return this},clearOverlays:function(){e.console.error(“drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead.”);this.viewer.clearOverlays();return this},setOpacity:function(t){e.console.error(“drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.”);var i=this.viewer.world;for(var n=0;n<i.getItemCount();n++)i.getItemAt(n).setOpacity(t);return this},getOpacity:function(){e.console.error(“drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.”);var t=this.viewer.world;var i=0;for(var n=0;n<t.getItemCount();n++){var o=t.getItemAt(n).getOpacity();o>i&&(i=o)}return i},needsUpdate:function(){e.console.error(“ this function is deprecated. Use World.needsDraw instead.”);return this.viewer.world.needsDraw()},numTilesLoaded:function(){e.console.error(“ this function is deprecated. Use TileCache.numTilesLoaded instead.”);return this.viewer.tileCache.numTilesLoaded()},reset:function(){e.console.error(“ this function is deprecated. Use World.resetItems instead.”);this.viewer.world.resetItems();return this},update:function(){e.console.error(“ this function is deprecated. Use Drawer.clear and World.draw instead.”);this.clear();this.viewer.world.draw();return this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1;this.canvas.height=1;this.sketchCanvas=null;this.sketchContext=null},clear:function(){this.canvas.innerHTML=“”;if(this.useCanvas){var e=this._calculateCanvasSize();if(this.canvas.width!=e.x||this.canvas.height!=e.y){this.canvas.width=e.x;this.canvas.height=e.y;if(null!==this.sketchCanvas){var t=this._calculateSketchCanvasSize();this.sketchCanvas.width=t.x;this.sketchCanvas.height=t.y}}this._clear()}},_clear:function(e,t){if(this.useCanvas){var i=this._getContext(e);if(t)i.clearRect(t.x,t.y,t.width,t.height);else{var n=i.canvas;i.clearRect(0,0,n.width,n.height)}}},viewportToDrawerRectangle:function(t){var i=this.viewport.pixelFromPointNoRotate(t.getTopLeft(),!0);var n=this.viewport.deltaPixelsFromPointsNoRotate(t.getSize(),!0);return new e.Rect(i.x*e.pixelDensityRatio,i.y*e.pixelDensityRatio,n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio)},drawTile:function(t,i,n,o,r){e.console.assert(t,“ tile is required”);e.console.assert(i,“ drawingHandler is required”);if(this.useCanvas){var s=this._getContext(n);o=o||1;t.drawCanvas(s,i,o,r)}else t.drawHTML(this.canvas)},_getContext:function(e){var t=this.context;if(e){if(null===this.sketchCanvas){this.sketchCanvas=document.createElement(“canvas”);var i=this._calculateSketchCanvasSize();this.sketchCanvas.width=i.x;this.sketchCanvas.height=i.y;this.sketchContext=this.sketchCanvas.getContext(“2d”);if(0===this.viewport.getRotation()){var n=this;this.viewer.addHandler(“rotate”,function e(){if(0!==n.viewport.getRotation()){n.viewer.removeHandler(“rotate”,e);var t=n._calculateSketchCanvasSize();n.sketchCanvas.width=t.x;n.sketchCanvas.height=t.y}})}}t=this.sketchContext}return t},saveContext:function(e){this.useCanvas&&this._getContext(e).save()},restoreContext:function(e){this.useCanvas&&this._getContext(e).restore()},setClip:function(e,t){if(this.useCanvas){var i=this._getContext(t);i.beginPath();i.rect(e.x,e.y,e.width,e.height);i.clip()}},drawRectangle:function(e,t,i){if(this.useCanvas){var n=this._getContext(i);n.save();n.fillStyle=t;n.fillRect(e.x,e.y,e.width,e.height);n.restore()}},blendSketch:function(t,i,n,o){var r=t;e.isPlainObject®||(r={opacity:t,scale:i,translate:n,compositeOperation:o});if(this.useCanvas&&this.sketchCanvas){t=r.opacity;o=r.compositeOperation;var s=r.bounds;this.context.save();this.context.globalAlpha=t;o&&(this.context.globalCompositeOperation=o);if(s){if(s.x<0){s.width+=s.x;s.x=0}s.x+s.width>this.canvas.width&&(s.width=this.canvas.width-s.x);if(s.y<0){s.height+=s.y;s.y=0}s.y+s.height>this.canvas.height&&(s.height=this.canvas.height-s.y);this.context.drawImage(this.sketchCanvas,s.x,s.y,s.width,s.height,s.x,s.y,s.width,s.height)}else{i=r.scale||1;var a=(n=r.translate)instanceof e.Point?n:new e.Point(0,0);var l=0;var h=0;if(n){var c=this.sketchCanvas.width-this.canvas.width;var u=this.sketchCanvas.height-this.canvas.height;l=Math.round(c/2);h=Math.round(u/2)}this.context.drawImage(this.sketchCanvas,a.x-l*i,a.y-h*i,(this.canvas.width+2*l)*i,(this.canvas.height+2*h)*i,-l,-h,this.canvas.width+2*l,this.canvas.height+2*h)}this.context.restore()}},drawDebugInfo:function(t,i,n,o){if(this.useCanvas){var r=this.viewer.world.getIndexOfItem(o)%this.debugGridColor.length;var s=this.context;s.save();s.lineWidth=2*e.pixelDensityRatio;s.font=“small-caps bold ”+13*e.pixelDensityRatio+“px arial”;s.strokeStyle=this.debugGridColor;s.fillStyle=this.debugGridColor;0!==this.viewport.degrees?this._offsetForRotation({degrees:this.viewport.degrees}):this.viewer.viewport.flipped&&this._flip();o.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:o.getRotation(!0),point:o.viewport.pixelFromPointNoRotate(o._getRotationPoint(!0),!0)});s.strokeRect(t.position.x*e.pixelDensityRatio,t.position.y*e.pixelDensityRatio,t.size.x*e.pixelDensityRatio,t.size.y*e.pixelDensityRatio);var a=(t.position.x+t.size.x/2)*e.pixelDensityRatio;var l=(t.position.y+t.size.y/2)*e.pixelDensityRatio;s.translate(a,l);s.rotate(Math.PI/180*-this.viewport.degrees);s.translate(-a,-l);if(0===t.x&&0===t.y){s.fillText(“Zoom: ”+this.viewport.getZoom(),t.position.x*e.pixelDensityRatio,(t.position.y-30)*e.pixelDensityRatio);s.fillText(“Pan: ”+this.viewport.getBounds().toString(),t.position.x*e.pixelDensityRatio,(t.position.y-20)*e.pixelDensityRatio)}s.fillText(“Level: ”+t.level,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+20)*e.pixelDensityRatio);s.fillText(“Column: ”+t.x,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+30)*e.pixelDensityRatio);s.fillText(“Row: ”+t.y,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+40)*e.pixelDensityRatio);s.fillText(“Order: ”n“ of ”+i,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+50)*e.pixelDensityRatio);s.fillText(“Size: ”+t.size.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+60)*e.pixelDensityRatio);s.fillText(“Position: ”+t.position.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+70)*e.pixelDensityRatio);0!==this.viewport.degrees&&this._restoreRotationChanges();o.getRotation(!0)%360!=0&&this._restoreRotationChanges();s.restore()}},debugRect:function(t){if(this.useCanvas){var i=this.context;i.save();i.lineWidth=2*e.pixelDensityRatio;i.strokeStyle=this.debugGridColor;i.fillStyle=this.debugGridColor;i.strokeRect(t.x*e.pixelDensityRatio,t.y*e.pixelDensityRatio,t.width*e.pixelDensityRatio,t.height*e.pixelDensityRatio);i.restore()}},getCanvasSize:function(t){var i=this._getContext(t).canvas;return new e.Point(i.width,i.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(t){var i=t.point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter();var n=this._getContext(t.useSketch);n.save();n.translate(i.x,i.y);if(this.viewer.viewport.flipped){n.rotate(Math.PI/180*-t.degrees);n.scale(-1,1)}else n.rotate(Math.PI/180*t.degrees);n.translate(-i.x,-i.y)},_flip:function(t){var i=(t=t||{}).point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter();var n=this._getContext(t.useSketch);n.translate(i.x,0);n.scale(-1,1);n.translate(-i.x,0)},_restoreRotationChanges:function(e){this._getContext(e).restore()},_calculateCanvasSize:function(){var t=e.pixelDensityRatio;var i=this.viewport.getContainerSize();return{x:i.x*t,y:i.y*t}},_calculateSketchCanvasSize:function(){var e=this._calculateCanvasSize();if(0===this.viewport.getRotation())return e;var t=Math.ceil(Math.sqrt(e.x*e.x+e.y*e.y));return{x:t,y:t}}}}(OpenSeadragon);!function(e){e.Viewport=function(t){var i=arguments;i.length&&iinstanceof e.Point&&(t={containerSize:i,contentSize:i,config:i});if(t.config){e.extend(!0,t,t.config);delete t.config}this._margins=e.extend({left:0,top:0,right:0,bottom:0},t.margins||{});delete t.margins;e.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,degrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer},t);this._updateContainerInnerSize();this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.zoomSpring=new e.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime});this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;this._setContentBounds(new e.Rect(0,0,1,1),1);this.goHome(!0);this.update()};e.Viewport.prototype={resetContentSize:function(t){e.console.assert(t,“ contentSize is required”);e.console.assert(t instanceof e.Point,“ contentSize must be an OpenSeadragon.Point”);e.console.assert(t.x>0,“ contentSize.x must be greater than 0”);e.console.assert(t.y>0,“ contentSize.y must be greater than 0”);this._setContentBounds(new e.Rect(0,0,1,t.y/t.x),t.x);return this},setHomeBounds:function(t,i){e.console.error(“ this function is deprecated; The content bounds should not be set manually.”);this._setContentBounds(t,i)},_setContentBounds:function(t,i){e.console.assert(t,“ bounds is required”);e.console.assert(t instanceof e.Rect,“ bounds must be an OpenSeadragon.Rect”);e.console.assert(t.width>0,“ bounds.width must be greater than 0”);e.console.assert(t.height>0,“ bounds.height must be greater than 0”);this._contentBoundsNoRotate=t.clone();this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i);this._contentBounds=t.rotate(this.degrees).getBoundingBox();this._contentSize=this._contentBounds.getSize().times(i);this._contentAspectRatio=this._contentSize.x/this._contentSize.y;this.viewer&&this.viewer.raiseEvent(“reset-size”,{contentSize:this._contentSizeNoRotate.clone(),contentFactor:i,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var e=this._contentAspectRatio/this.getAspectRatio();return(this.homeFillsViewer?e>=1?e:1:e>=1?1:e)/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var t=this._contentBounds.getCenter();var i=1/this.getHomeZoom();var n=i/this.getAspectRatio();return new e.Rect(t.x-i/2,t.y-n/2,i,n)},goHome:function(e){this.viewer&&this.viewer.raiseEvent(“home”,{immediately:e});return this.fitBounds(this.getHomeBounds(),e)},getMinZoom:function(){var e=this.getHomeZoom();return this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*e},getMaxZoom:function(){var e=this.maxZoomLevel;if(!e){e=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x;e/=this._contentBounds.width}return Math.max(e,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(t){e.console.assert(“object”===e.type(t),“ margins must be an object”);this._margins=e.extend({left:0,top:0,right:0,bottom:0},t);this._updateContainerInnerSize();this.viewer&&this.viewer.forceRedraw()},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(-this.getRotation())},getBoundsNoRotate:function(t){var i=this.getCenter(t);var n=1/this.getZoom(t);var o=n/this.getAspectRatio();return new e.Rect(i.x-n/2,i.y-o/2,n,o)},getBoundsWithMargins:function(e){return this.getBoundsNoRotateWithMargins(e).rotate(-this.getRotation(),this.getCenter(e))},getBoundsNoRotateWithMargins:function(e){var t=this.getBoundsNoRotate(e);var i=this._containerInnerSize.x*this.getZoom(e);t.x-=this._margins.left/i;t.y-=this._margins.top/i;t.width+=(this._margins.left+this._margins.right)/i;t.height+=(this._margins.top+this._margins.bottom)/i;return t},getCenter:function(t){var i,n,o,r,s,a,l=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),h=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);if(t)return l;if(!this.zoomPoint)return h;i=this.pixelFromPoint(this.zoomPoint,!0);r=(o=1/(n=this.getZoom()))/this.getAspectRatio();s=new e.Rect(l.x-o/2,l.y-r/2,o,r);a=this._pixelFromPoint(this.zoomPoint,s).minus(i).divide(this._containerInnerSize.x*n);return h.plus(a)},getZoom:function(e){return e?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(e){return Math.max(Math.min(e,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(t){var i=new e.Rect(t.x,t.y,t.width,t.height);if(this.wrapHorizontal);else{var n=this.visibilityRatio*i.width;var o=i.x+i.width;var r=this._contentBoundsNoRotate.x+this._contentBoundsNoRotate.width;var s=this._contentBoundsNoRotate.x-o+n;var a=r-i.x-n;n>this._contentBoundsNoRotate.width?i.x+=(s+a)/2:a<0?i.x+=a:s>0&&(i.x+=s)}if(this.wrapVertical);else{var l=this.visibilityRatio*i.height;var h=i.y+i.height;var c=this._contentBoundsNoRotate.y+this._contentBoundsNoRotate.height;var u=this._contentBoundsNoRotate.y-h+l;var d=c-i.y-l;l>this._contentBoundsNoRotate.height?i.y+=(u+d)/2:d<0?i.y+=d:u>0&&(i.y+=u)}return i},_raiseConstraintsEvent:function(e){this.viewer&&this.viewer.raiseEvent(“constrain”,{immediately:e})},applyConstraints:function(e){var t=this.getZoom();var i=this._applyZoomConstraints(t);t!==i&&this.zoomTo(i,this.zoomPoint,e);var n=this.getBoundsNoRotate();var o=this._applyBoundaryConstraints(n);this._raiseConstraintsEvent(e);(n.x!==o.x||n.y!==o.y||e)&&this.fitBounds(o.rotate(-this.getRotation()),e);return this},ensureVisible:function(e){return this.applyConstraints(e)},_fitBounds:function(t,i){var n=(i=i||{}).immediately||!1;var o=i.constraints||!1;var r=this.getAspectRatio();var s=t.getCenter();var a=new e.Rect(t.x,t.y,t.width,t.height,t.degrees+this.getRotation()).getBoundingBox();a.getAspectRatio()>=r?a.height=a.width/r:a.width=a.height*r;a.x=s.x-a.width/2;a.y=s.y-a.height/2;var l=1/a.width;if(o){var h=a.getAspectRatio();var c=this._applyZoomConstraints(l);if(l!==c){l=c;a.width=1/l;a.x=s.x-a.width/2;a.height=a.width/h;a.y=s.y-a.height/2}s=(a=this._applyBoundaryConstraints(a)).getCenter();this._raiseConstraintsEvent(n)}if(n){this.panTo(s,!0);return this.zoomTo(l,null,!0)}this.panTo(this.getCenter(!0),!0);this.zoomTo(this.getZoom(!0),null,!0);var u=this.getBounds();var d=this.getZoom();if(0===d||Math.abs(l/d-1)<1e-8){this.zoomTo(l,!0);return this.panTo(s,n)}var p=(a=a.rotate(-this.getRotation())).getTopLeft().times(l).minus(u.getTopLeft().times(d)).divide(l-d);return this.zoomTo(l,p,n)},fitBounds:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!1})},fitBoundsWithConstraints:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!0})},fitVertically:function(t){var i=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,t)},fitHorizontally:function(t){var i=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,t)},getConstrainedBounds:function(e){var t;t=this.getBounds(e);return this._applyBoundaryConstraints(t)},panBy:function(t,i){var n=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(t),i)},panTo:function(e,t){if(t){this.centerSpringX.resetTo(e.x);this.centerSpringY.resetTo(e.y)}else{this.centerSpringX.springTo(e.x);this.centerSpringY.springTo(e.y)}this.viewer&&this.viewer.raiseEvent(“pan”,{center:e,immediately:t});return this},zoomBy:function(e,t,i){return this.zoomTo(this.zoomSpring.target.value*e,t,i)},zoomTo:function(t,i,n){var o=this;this.zoomPoint=i instanceof e.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null;n?this._adjustCenterSpringsForZoomPoint(function(){o.zoomSpring.resetTo(t)}):this.zoomSpring.springTo(t);this.viewer&&this.viewer.raiseEvent(“zoom”,{zoom:t,refPoint:i,immediately:n});return this},setRotation:function(t){if(!this.viewer||!this.viewer.drawer.canRotate())return this;this.degrees=e.positiveModulo(t,360);this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor());this.viewer.forceRedraw();this.viewer.raiseEvent(“rotate”,{degrees:t});return this},getRotation:function(){return this.degrees},resize:function(e,t){var i,n=this.getBoundsNoRotate(),o=n;this.containerSize.x=e.x;this.containerSize.y=e.y;this._updateContainerInnerSize();if(t){i=e.x/this.containerSize.x;o.width=n.width*i;o.height=o.width/this.getAspectRatio()}this.viewer&&this.viewer.raiseEvent(“resize”,{newContainerSize:e,maintain:t});return this.fitBounds(o,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var e=this;this._adjustCenterSpringsForZoomPoint(function(){e.zoomSpring.update()});this.centerSpringX.update();this.centerSpringY.update();var t=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom;this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;return t},_adjustCenterSpringsForZoomPoint:function(e){if(this.zoomPoint){var t=this.pixelFromPoint(this.zoomPoint,!0);e();var i=this.pixelFromPoint(this.zoomPoint,!0).minus(t);var n=this.deltaPointsFromPixels(i,!0);this.centerSpringX.shiftBy(n.x);this.centerSpringY.shiftBy(n.y);this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else e()},deltaPixelsFromPointsNoRotate:function(e,t){return e.times(this._containerInnerSize.x*this.getZoom(t))},deltaPixelsFromPoints:function(e,t){return this.deltaPixelsFromPointsNoRotate(e.rotate(this.getRotation()),t)},deltaPointsFromPixelsNoRotate:function(e,t){return e.divide(this._containerInnerSize.x*this.getZoom(t))},deltaPointsFromPixels:function(e,t){return this.deltaPointsFromPixelsNoRotate(e,t).rotate(-this.getRotation())},pixelFromPointNoRotate:function(e,t){return this._pixelFromPointNoRotate(e,this.getBoundsNoRotate(t))},pixelFromPoint:function(e,t){return this._pixelFromPoint(e,this.getBoundsNoRotate(t))},_pixelFromPointNoRotate:function(t,i){return t.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(e,t){return this._pixelFromPointNoRotate(e.rotate(this.getRotation(),this.getCenter(!0)),t)},pointFromPixelNoRotate:function(t,i){var n=this.getBoundsNoRotate(i);return t.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(e,t){return this.pointFromPixelNoRotate(e,t).rotate(-this.getRotation(),this.getCenter(!0))},_viewportToImageDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(t,i){if(t instanceof e.Point)return this.viewportToImageCoordinates(t.x,t.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error(“ is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.”);else if(1===n){return this.viewer.world.getItemAt(0).viewportToImageCoordinates(t,i,!0)}}return this._viewportToImageDelta(t-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(t,i){var n=this._contentBoundsNoRotate.width;return new e.Point(t/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(t,i){if(t instanceof e.Point)return this.imageToViewportCoordinates(t.x,t.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error(“ is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.”);else if(1===n){return this.viewer.world.getItemAt(0).imageToViewportCoordinates(t,i,!0)}}var o=this._imageToViewportDelta(t,i);o.x+=this._contentBoundsNoRotate.x;o.y+=this._contentBoundsNoRotate.y;return o},imageToViewportRectangle:function(t,i,n,o){var r=t;r instanceof e.Rect||(r=new e.Rect(t,i,n,o));if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)e.console.error(“ is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.”);else if(1===s){return this.viewer.world.getItemAt(0).imageToViewportRectangle(t,i,n,o,!0)}}var a=this.imageToViewportCoordinates(r.x,r.y);var l=this._imageToViewportDelta(r.width,r.height);return new e.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewportToImageRectangle:function(t,i,n,o){var r=t;r instanceof e.Rect||(r=new e.Rect(t,i,n,o));if(this.viewer){var s=this.viewer.world.getItemCount();if(s>1)e.console.error(“ is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.”);else if(1===s){return this.viewer.world.getItemAt(0).viewportToImageRectangle(t,i,n,o,!0)}}var a=this.viewportToImageCoordinates(r.x,r.y);var l=this._viewportToImageDelta(r.width,r.height);return new e.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewerElementToImageCoordinates:function(e){var t=this.pointFromPixel(e,!0);return this.viewportToImageCoordinates(t)},imageToViewerElementCoordinates:function(e){var t=this.imageToViewportCoordinates(e);return this.pixelFromPoint(t,!0)},windowToImageCoordinates:function(t){e.console.assert(this.viewer,“ the viewport must have a viewer.”);var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(t){e.console.assert(this.viewer,“ the viewport must have a viewer.”);return this.imageToViewerElementCoordinates(t).plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(e){return this.pointFromPixel(e,!0)},viewportToViewerElementCoordinates:function(e){return this.pixelFromPoint(e,!0)},viewerElementToViewportRectangle:function(t){return e.Rect.fromSummits(this.pointFromPixel(t.getTopLeft(),!0),this.pointFromPixel(t.getTopRight(),!0),this.pointFromPixel(t.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(t){return e.Rect.fromSummits(this.pixelFromPoint(t.getTopLeft(),!0),this.pixelFromPoint(t.getTopRight(),!0),this.pixelFromPoint(t.getBottomLeft(),!0))},windowToViewportCoordinates:function(t){e.console.assert(this.viewer,“ the viewport must have a viewer.”);var i=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(t){e.console.assert(this.viewer,“ the viewport must have a viewer.”);return this.viewportToViewerElementCoordinates(t).plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)e.console.error(“ is not accurate with multi-image.”);else if(1===i){return this.viewer.world.getItemAt(0).viewportToImageZoom(t)}}var n=this._contentSizeNoRotate.x;return t*(this._containerInnerSize.x/n*this._contentBoundsNoRotate.width)},imageToViewportZoom:function(t){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)e.console.error(“ is not accurate with multi-image.”);else if(1===i){return this.viewer.world.getItemAt(0).imageToViewportZoom(t)}}return t*(this._contentSizeNoRotate.x/this._containerInnerSize.x/this._contentBoundsNoRotate.width)},toggleFlip:function(){this.setFlip(!this.getFlip());return this},getFlip:function(){return this.flipped},setFlip:function(e){if(this.flipped===e)return this;this.flipped=e;this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip());this.viewer.forceRedraw();this.viewer.raiseEvent(“flip”,{flipped:e});return this}}}(OpenSeadragon);!function(e){e.TiledImage=function(t){var i=this;e.console.assert(t.tileCache,“ options.tileCache is required”);e.console.assert(t.drawer,“ options.drawer is required”);e.console.assert(t.viewer,“ options.viewer is required”);e.console.assert(t.imageLoader,“ options.imageLoader is required”);e.console.assert(t.source,“ options.source is required”);e.console.assert(!t.clip||t.clip instanceof e.Rect,“ options.clip must be an OpenSeadragon.Rect if present”);e.EventSource.call(this);this._tileCache=t.tileCache;delete t.tileCache;this._drawer=t.drawer;delete t.drawer;this._imageLoader=t.imageLoader;delete t.imageLoader;t.clip instanceof e.Rect&&(this._clip=t.clip.clone());delete t.clip;var n=t.x||0;delete t.x;var o=t.y||0;delete t.y;this.normHeight=t.source.dimensions.y/t.source.dimensions.x;this.contentAspectX=t.source.dimensions.x/t.source.dimensions.y;var r=1;if(t.width){r=t.width;delete t.width;if(t.height){e.console.error(“specifying both width and height to a tiledImage is not supported”);delete t.height}}else if(t.height){r=t.height/this.normHeight;delete t.height}var s=t.fitBounds;delete t.fitBounds;var a=t.fitBoundsPlacement||OpenSeadragon.Placement.CENTER;delete t.fitBoundsPlacement;var l=t.degrees||0;delete t.degrees;e.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,immediateRender:e.DEFAULT_SETTINGS.immediateRender,blendTime:e.DEFAULT_SETTINGS.blendTime,alwaysBlend:e.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:e.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:e.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:e.DEFAULT_SETTINGS.iOSDevice,debugMode:e.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:e.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:e.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:e.DEFAULT_SETTINGS.placeholderFillStyle,opacity:e.DEFAULT_SETTINGS.opacity,preload:e.DEFAULT_SETTINGS.preload,compositeOperation:e.DEFAULT_SETTINGS.compositeOperation},t);this._preload=this.preload;delete this.preload;this._fullyLoaded=!1;this._xSpring=new e.Spring({initial:n,springStiffness:this.springStiffness,animationTime:this.animationTime});this._ySpring=new e.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime});this._scaleSpring=new e.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime});this._degreesSpring=new e.Spring({initial:l,springStiffness:this.springStiffness,animationTime:this.animationTime});this._updateForScale();s&&this.fitBounds(s,a,!0);this._drawingHandler=function(t){i.viewer.raiseEvent(“tile-drawing”,e.extend({tiledImage:i},t))}};e.extend(e.TiledImage.prototype,e.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(e){if(e!==this._fullyLoaded){this._fullyLoaded=e;this.raiseEvent(“fully-loaded-change”,{fullyLoaded:this._fullyLoaded})}},reset:function(){this._tileCache.clearTilesFor(this);this.lastResetTime=e.now();this._needsDraw=!0},update:function(){var e=this._xSpring.update();var t=this._ySpring.update();var i=this._scaleSpring.update();var n=this._degreesSpring.update();if(e||t||i||n){this._updateForScale();this._needsDraw=!0;return!0}return!1},draw:function(){if(0!==this.opacity||this._preload){this._midDraw=!0;this._updateViewport();this._midDraw=!1}else this._needsDraw=!1},destroy:function(){this.reset()},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(this.getRotation(e),this._getRotationPoint(e))},getBoundsNoRotate:function(t){return t?new e.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new e.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){e.console.error(“ is deprecated; use TiledImage.getBounds instead”);return this.getBounds()},getClippedBounds:function(t){var i=this.getBoundsNoRotate(t);if(this._clip){var n=(t?this._worldWidthCurrent:this._worldWidthTarget)/this.source.dimensions.x;var o=this._clip.times(n);i=new e.Rect(i.x+o.x,i.y+o.y,o.width,o.height)}return i.rotate(this.getRotation(t),this._getRotationPoint(t))},getContentSize:function(){return new e.Point(this.source.dimensions.x,this.source.dimensions.y)},_viewportToImageDelta:function(t,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t*(this.source.dimensions.x/o),i*(this.source.dimensions.y*this.contentAspectX/o))},viewportToImageCoordinates:function(t,i,n){var o;if(t instanceof e.Point){n=i;o=t}else o=new e.Point(t,i);o=o.rotate(-this.getRotation(n),this._getRotationPoint(n));return n?this._viewportToImageDelta(o.x-this._xSpring.current.value,o.y-this._ySpring.current.value):this._viewportToImageDelta(o.x-this._xSpring.target.value,o.y-this._ySpring.target.value)},_imageToViewportDelta:function(t,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new e.Point(t/this.source.dimensions.x*o,i/this.source.dimensions.y/this.contentAspectX*o)},imageToViewportCoordinates:function(t,i,n){if(t instanceof e.Point){n=i;i=t.y;t=t.x}var o=this._imageToViewportDelta(t,i);if(n){o.x+=this._xSpring.current.value;o.y+=this._ySpring.current.value}else{o.x+=this._xSpring.target.value;o.y+=this._ySpring.target.value}return o.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(t,i,n,o,r){var s=t;s instanceof e.Rect?r=i:s=new e.Rect(t,i,n,o);var a=this.imageToViewportCoordinates(s.getTopLeft(),r);var l=this._imageToViewportDelta(s.width,s.height,r);return new e.Rect(a.x,a.y,l.x,l.y,s.degrees+this.getRotation®)},viewportToImageRectangle:function(t,i,n,o,r){var s=t;t instanceof e.Rect?r=i:s=new e.Rect(t,i,n,o);var a=this.viewportToImageCoordinates(s.getTopLeft(),r);var l=this._viewportToImageDelta(s.width,s.height,r);return new e.Rect(a.x,a.y,l.x,l.y,s.degrees-this.getRotation®)},viewerElementToImageCoordinates:function(e){var t=this.viewport.pointFromPixel(e,!0);return this.viewportToImageCoordinates(t)},imageToViewerElementCoordinates:function(e){var t=this.imageToViewportCoordinates(e);return this.viewport.pixelFromPoint(t,!0)},windowToImageCoordinates:function(e){var t=e.minus(OpenSeadragon.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(t)},imageToWindowCoordinates:function(e){return this.imageToViewerElementCoordinates(e).plus(OpenSeadragon.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(t){var i=this._scaleSpring.current.value;t=t.rotate(-this.getRotation(!0),this._getRotationPoint(!0));return new e.Rect((t.x-this._xSpring.current.value)/i,(t.y-this._ySpring.current.value)/i,t.width/i,t.height/i,t.degrees)},viewportToImageZoom:function(e){return this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x*e},imageToViewportZoom:function(e){return e/(this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x)},setPosition:function(e,t){var i=this._xSpring.target.value===e.x&&this._ySpring.target.value===e.y;if(t){if(i&&this._xSpring.current.value===e.x&&this._ySpring.current.value===e.y)return;this._xSpring.resetTo(e.x);this._ySpring.resetTo(e.y);this._needsDraw=!0}else{if(i)return;this._xSpring.springTo(e.x);this._ySpring.springTo(e.y);this._needsDraw=!0}i||this._raiseBoundsChange()},setWidth:function(e,t){this._setScale(e,t)},setHeight:function(e,t){this._setScale(e/this.normHeight,t)},fitBounds:function(t,i,n){i=i||e.Placement.CENTER;var o=e.Placement.properties;var r=this.contentAspectX;var s=0;var a=0;var l=1;var h=1;if(this._clip){r=this._clip.getAspectRatio();l=this._clip.width/this.source.dimensions.x;h=this._clip.height/this.source.dimensions.y;if(t.getAspectRatio()>r){s=this._clip.x/this._clip.height*t.height;a=this._clip.y/this._clip.height*t.height}else{s=this._clip.x/this._clip.width*t.width;a=this._clip.y/this._clip.width*t.width}}if(t.getAspectRatio()>r){var c=t.height/h;var u=0;o.isHorizontallyCentered?u=(t.width-t.height*r)/2:o.isRight&&(u=t.width-t.height*r);this.setPosition(new e.Point(t.x-s+u,t.y-a),n);this.setHeight(c,n)}else{var d=t.width/l;var p=0;o.isVerticallyCentered?p=(t.height-t.width/r)/2:o.isBottom&&(p=t.height-t.width/r);this.setPosition(new e.Point(t.x-s,t.y-a+p),n);this.setWidth(d,n)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(t){e.console.assert(!t||t instanceof e.Rect,“ newClip must be an OpenSeadragon.Rect or null”);t instanceof e.Rect?this._clip=t.clone():this._clip=null;this._needsDraw=!0;this.raiseEvent(“clip-change”)},getOpacity:function(){return this.opacity},setOpacity:function(e){if(e!==this.opacity){this.opacity=e;this._needsDraw=!0;this.raiseEvent(“opacity-change”,{opacity:this.opacity})}},getPreload:function(){return this._preload},setPreload:function(e){this._preload=!!e;this._needsDraw=!0},getRotation:function(e){return e?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(e,t){if(this._degreesSpring.target.value!==e||!this._degreesSpring.isAtTargetValue()){t?this._degreesSpring.resetTo(e):this._degreesSpring.springTo(e);this._needsDraw=!0;this._raiseBoundsChange()}},_getRotationPoint:function(e){return this.getBoundsNoRotate(e).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(e){if(e!==this.compositeOperation){this.compositeOperation=e;this._needsDraw=!0;this.raiseEvent(“composite-operation-change”,{compositeOperation:this.compositeOperation})}},_setScale:function(e,t){var i=this._scaleSpring.target.value===e;if(t){if(i&&this._scaleSpring.current.value===e)return;this._scaleSpring.resetTo(e);this._updateForScale();this._needsDraw=!0}else{if(i)return;this._scaleSpring.springTo(e);this._updateForScale();this._needsDraw=!0}i||this._raiseBoundsChange()},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value;this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value;this._worldWidthCurrent=this._scaleSpring.current.value;this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent(“bounds-change”)},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var e=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2)));var t=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value;var i=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(t/this.minPixelRatio)/Math.log(2))));i=Math.max(i,this.source.minLevel||0);return{lowestLevel:e=Math.min(e,i),highestLevel:i}},_updateViewport:function(){this._needsDraw=!1;this._tilesLoading=0;this.loadingCoverage={};for(;this.lastDrawn.length>0;){this.lastDrawn.pop().beingDrawn=!1}var i=this.viewport;var r=this._viewportToTiledImageRectangle(i.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var s=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(null===(r=r.intersection(s)))return}var a=this._getLevelsInterval();var l=a.lowestLevel;var h=a.highestLevel;var c=null;var u=!1;var d=e.now();for(var p=h;p>=l;p–){var g=!1;var m=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(p),!0).x*this._scaleSpring.current.value;if(p===l||!u&&m>=this.minPixelRatio){g=!0;u=!0}else if(!u)continue;var v=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(p),!1).x*this._scaleSpring.current.value;var f=i.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value;var w=this.immediateRender?1:f;c=t(this,u,g,p,Math.min(1,(m-.5)/.5),w/Math.abs(w-v),r,d,c);if(o(this.coverage,p))break}!function(t,i){if(0===t.opacity||0===i.length&&!t.placeholderFillStyle)return;var n=i;var o;n&&(o=t.opacity<1||t.compositeOperation&&“source-over”!==t.compositeOperation||!t._isBottomItem()&&n._hasTransparencyChannel());var r;var s;var a=t.viewport.getZoom(!0);var l=t.viewportToImageZoom(a);if(i.length>1&&l>t.smoothTileEdgesMinZoom&&!t.iOSDevice&&t.getRotation(!0)%360==0&&e.supportsCanvas){o=!0;r=n.getScaleForEdgeSmoothing();s=n.getTranslationForEdgeSmoothing(r,t._drawer.getCanvasSize(!1),t._drawer.getCanvasSize(!0))}var h;if(o){r||(h=t.viewport.viewportToViewerElementRectangle(t.getClippedBounds(!0)).getIntegerBoundingBox().times(e.pixelDensityRatio));t._drawer._clear(!0,h)}if(!r){0!==t.viewport.degrees?t._drawer._offsetForRotation({degrees:t.viewport.degrees,useSketch:o}):t._drawer.viewer.viewport.flipped&&t._drawer._flip({});t.getRotation(!0)%360!=0&&t._drawer._offsetForRotation({degrees:t.getRotation(!0),point:t.viewport.pixelFromPointNoRotate(t._getRotationPoint(!0),!0),useSketch:o})}var c=!1;if(t._clip){t._drawer.saveContext(o);var u=t.imageToViewportRectangle(t._clip,!0);u=u.rotate(-t.getRotation(!0),t._getRotationPoint(!0));var d=t._drawer.viewportToDrawerRectangle(u);r&&(d=d.times®);s&&(d=d.translate(s));t._drawer.setClip(d,o);c=!0}if(t.placeholderFillStyle&&!1===t._hasOpaqueTile){var p=t._drawer.viewportToDrawerRectangle(t.getBounds(!0));r&&(p=p.times®);s&&(p=p.translate(s));var g=null;g=“function”==typeof t.placeholderFillStyle?t.placeholderFillStyle(t,t._drawer.context):t.placeholderFillStyle;t._drawer.drawRectangle(p,g,o)}for(var m=i.length-1;m>=0;m–){n=i;t._drawer.drawTile(n,t._drawingHandler,o,r,s);n.beingDrawn=!0;t.viewer&&t.viewer.raiseEvent(“tile-drawn”,{tiledImage:t,tile:n})}c&&t._drawer.restoreContext(o);if(!r){t.getRotation(!0)%360!=0&&t._drawer._restoreRotationChanges(o);0!==t.viewport.degrees?t._drawer._restoreRotationChanges(o):t._drawer.viewer.viewport.flipped&&t._drawer._flip({})}if(o){if®{0!==t.viewport.degrees&&t._drawer._offsetForRotation({degrees:t.viewport.degrees,useSketch:!1});t.getRotation(!0)%360!=0&&t._drawer._offsetForRotation({degrees:t.getRotation(!0),point:t.viewport.pixelFromPointNoRotate(t._getRotationPoint(!0),!0),useSketch:!1})}t._drawer.blendSketch({opacity:t.opacity,scale:r,translate:s,compositeOperation:t.compositeOperation,bounds:h});if®{t.getRotation(!0)%360!=0&&t._drawer._restoreRotationChanges(!1);0!==t.viewport.degrees&&t._drawer._restoreRotationChanges(!1)}}!function(t,i){if(t.debugMode)for(var n=i.length-1;n>=0;n–){var o=i;try{t._drawer.drawDebugInfo(o,i.length,n,t)}catch(t){e.console.error(t)}}}(t,i)}(this,this.lastDrawn);if(c&&!c.context2D){!function(t,i,o){i.loading=!0;t._imageLoader.addJob({src:i.url,loadWithAjax:i.loadWithAjax,ajaxHeaders:i.ajaxHeaders,crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,callback:function(r,s,a){!function(t,i,o,r,s,a){if(!r){e.console.log(“Tile %s failed to load: %s - error: %s”,i,i.url,s);t.viewer.raiseEvent(“tile-load-failed”,{tile:i,tiledImage:t,time:o,message:s,tileRequest:a});i.loading=!1;i.exists=!1;return}if(o<t.lastResetTime){e.console.log(“Ignoring tile %s loaded before reset: %s”,i,i.url);i.loading=!1;return}var l=function(){var e=t.source.getClosestLevel();n(t,i,r,e,a)};t._midDraw?window.setTimeout(l,1):l()}(t,i,o,r,s,a)},abort:function(){i.loading=!1}})}(this,c,d);this._needsDraw=!0;this._setFullyLoaded(!1)}else this._setFullyLoaded(0===this._tilesLoading)},_getCornerTiles:function(t,i,n){var o;var r;if(this.wrapHorizontal){o=e.positiveModulo(i.x,1);r=e.positiveModulo(n.x,1)}else{o=Math.max(0,i.x);r=Math.min(1,n.x)}var s;var a;var l=1/this.source.aspectRatio;if(this.wrapVertical){s=e.positiveModulo(i.y,l);a=e.positiveModulo(n.y,l)}else{s=Math.max(0,i.y);a=Math.min(l,n.y)}var h=this.source.getTileAtPoint(t,new e.Point(o,s));var c=this.source.getTileAtPoint(t,new e.Point(r,a));var u=this.source.getNumTiles(t);if(this.wrapHorizontal){h.x+=u.x*Math.floor(i.x);c.x+=u.x*Math.floor(n.x)}if(this.wrapVertical){h.y+=u.y*Math.floor(i.y/l);c.y+=u.y*Math.floor(n.y/l)}return{topLeft:h,bottomRight:c}}});function t(e,t,n,o,r,s,l,h,c){var u=l.getBoundingBox().getTopLeft();var d=l.getBoundingBox().getBottomRight();e.viewer&&e.viewer.raiseEvent(“update-level”,{tiledImage:e,havedrawn:t,level:o,opacity:r,visibility:s,drawArea:l,topleft:u,bottomright:d,currenttime:h,best:c});a(e.coverage,o);a(e.loadingCoverage,o);var p=e._getCornerTiles(o,u,d);var g=p.topLeft;var m=p.bottomRight;var v=e.source.getNumTiles(o);var f=e.viewport.pixelFromPoint(e.viewport.getCenter());for(var w=g.x;w<=m.x;w++)for(var y=g.y;y<=m.y;y++){if(!e.wrapHorizontal&&!e.wrapVertical){var T=e.source.getTileBounds(o,w,y);if(null===l.intersection(T))continue}c=i(e,n,t,w,y,o,r,s,f,v,h,c)}return c}function i(t,i,o,a,l,h,c,u,d,p,g,m){var v=function(t,i,n,o,r,s,a,l,h,c){var u,d,p,g,m,v,f,w,y;s||(s={});s[t]||(s[t]={});if(!s[t]){u=(l.x+t%l.x)%l.x;d=(l.y+i%l.y)%l.y;p=r.getTileBounds(n,u,d);g=r.getTileBounds(n,u,d,!0);m=r.tileExists(n,u,d);v=r.getTileUrl(n,u,d);if(o.loadTilesWithAjax){f=r.getTileAjaxHeaders(n,u,d);e.isPlainObject(o.ajaxHeaders)&&(f=e.extend({},o.ajaxHeaders,f))}else f=null;w=r.getContext2D?r.getContext2D(n,u,d):void 0;p.x+=(t-u)/l.x;p.y+=c/h*((i-d)/l.y);y=new e.Tile(n,t,i,p,m,v,w,o.loadTilesWithAjax,f,g);u===l.x-1&&(y.isRightMost=!0);d===l.y-1&&(y.isBottomMost=!0);s[t]=y}(y=s[t]).lastTouchTime=a;return y}(a,l,h,t,t.source,t.tilesMatrix,g,p,t._worldWidthCurrent,t._worldHeightCurrent),f=o;t.viewer&&t.viewer.raiseEvent(“update-tile”,{tiledImage:t,tile:v});s(t.coverage,h,a,l,!1);var w=v.loaded||v.loading||r(t.loadingCoverage,h,a,l);s(t.loadingCoverage,h,a,l,w);if(!v.exists)return m;i&&!f&&(r(t.coverage,h,a,l)?s(t.coverage,h,a,l,!0):f=!0);if(!f)return m;!function(t,i,n,o,r,s){var a=t.bounds.getTopLeft();a.x*=s._scaleSpring.current.value;a.y*=s._scaleSpring.current.value;a.x+=s._xSpring.current.value;a.y+=s._ySpring.current.value;var l=t.bounds.getSize();l.x*=s._scaleSpring.current.value;l.y*=s._scaleSpring.current.value;var h=n.pixelFromPointNoRotate(a,!0),c=n.pixelFromPointNoRotate(a,!1),u=n.deltaPixelsFromPointsNoRotate(l,!0),d=n.deltaPixelsFromPointsNoRotate(l,!1),p=c.plus(d.divide(2)),g=o.squaredDistanceTo(p);i||(u=u.plus(new e.Point(1,1)));t.isRightMost&&s.wrapHorizontal&&(u.x+=.75);t.isBottomMost&&s.wrapVertical&&(u.y+=.75);t.position=h;t.size=u;t.squaredDistance=g;t.visibility=r}(v,t.source.tileOverlap,t.viewport,d,u,t);if(!v.loaded)if(v.context2D)n(t,v);else{var y=t._tileCache.getImageRecord(v.cacheKey);if(y){n(t,v,y.getImage())}}if(v.loaded){(function(e,t,i,n,o,r,a){var l,h,c=1e3*e.blendTime;t.blendStart||(t.blendStart=a);l=a-t.blendStart;h=c?Math.min(1,l/c):1;e.alwaysBlend&&(h*=r);t.opacity=h;e.lastDrawn.push(t);if(1==h){s(e.coverage,o,i,n,!0);e._hasOpaqueTile=!0}else if(l<c)return!0;return!1})(t,v,a,l,h,c,g)&&(t._needsDraw=!0)}else v.loading?t._tilesLoading++:w||(m=function(e,t){if(!e)return t;{if(t.visibility>e.visibility)return t;if(t.visibility==e.visibility&&t.squaredDistance<e.squaredDistance)return t}return e}(m,v));return m}function n(e,t,i,n,o){var r=0;function s(){r++;return a}function a(){if(0===–r){t.loading=!1;t.loaded=!0;t.context2D||e._tileCache.cacheTile({image:i,tile:t,cutoff:n,tiledImage:e});e._needsDraw=!0}}e.viewer.raiseEvent(“tile-loaded”,{tile:t,tiledImage:e,tileRequest:o,image:i,getCompletionCallback:s});s()()}function o(e,t,i,n){var o,r,s,a;if(!e)return!1;if(void 0===i||void 0===n){o=e;for(s in o)if(o.hasOwnProperty(s)){r=o;for(a in r)if(r.hasOwnProperty(a)&&!r)return!1}return!0}return void 0===e[i]||void 0===e[i]||!0===e[i]}function r(e,t,i,n){return void 0===i||void 0===n?o(e,t+1):o(e,t+1,2*i,2*n)&&o(e,t+1,2*i,2*n+1)&&o(e,t+1,2*i+1,2*n)&&o(e,t+1,2*i+1,2*n+1)}function s(t,i,n,o,r){if(t){t[n]||(t[n]={});t[n]=r}else e.console.warn(“Setting coverage for a tile before its level's coverage has been reset: %s”,i)}function a(e,t){e={}}}(OpenSeadragon);!function(e){var t=function(t){e.console.assert(t,“ options is required”);e.console.assert(t.image,“ options.image is required”);this._image=t.image;this._tiles=[]};t.prototype={destroy:function(){this._image=null;this._renderedContext=null;this._tiles=null},getImage:function(){return this._image},getRenderedContext:function(){if(!this._renderedContext){var e=document.createElement(“canvas”);e.width=this._image.width;e.height=this._image.height;this._renderedContext=e.getContext(“2d”);this._renderedContext.drawImage(this._image,0,0);this._image=null}return this._renderedContext},setRenderedContext:function(t){e.console.error(“ImageRecord.setRenderedContext is deprecated. The rendered context should be created by the ImageRecord itself when calling ImageRecord.getRenderedContext.”);this._renderedContext=t},addTile:function(t){e.console.assert(t,“ tile is required”);this._tiles.push(t)},removeTile:function(t){for(var i=0;i===t){this._tiles.splice(i,1);return}e.console.warn(“ trying to remove unknown tile”,t)},getTileCount:function(){return this._tiles.length}};e.TileCache=function(t){t=t||{};this._maxImageCacheCount=t.maxImageCacheCount||e.DEFAULT_SETTINGS.maxImageCacheCount;this._tilesLoaded=[];this._imagesLoaded=;this._imagesLoadedCount=0};e.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(i){e.console.assert(i,“ options is required”);e.console.assert(i.tile,“ options.tile is required”);e.console.assert(i.tile.cacheKey,“ options.tile.cacheKey is required”);e.console.assert(i.tiledImage,“ options.tiledImage is required”);var n=i.cutoff||0;var o=this._tilesLoaded.length;var r=this._imagesLoaded;if(!r){e.console.assert(i.image,“ options.image is required to create an ImageRecord”);r=this._imagesLoaded=new t({image:i.image});this._imagesLoadedCount++}r.addTile(i.tile);i.tile.cacheImageRecord=r;if(this._imagesLoadedCount>this._maxImageCacheCount){var s=null;var a=-1;var l=null;var h,c,u,d,p,g;for(var m=this._tilesLoaded.length-1;m>=0;m–)if(!((h=(g=this._tilesLoaded).tile).level<=n||h.beingDrawn))if(s){d=h.lastTouchTime;c=s.lastTouchTime;p=h.level;u=s.level;if(d<c||d==c&&p>u){s=h;a=m;l=g}}else{s=h;a=m;l=g}if(s&&a>=0){this._unloadTile(l);o=a}}this._tilesLoaded=new function(t){e.console.assert(t,“ options is required”);e.console.assert(t.tile,“ options.tile is required”);e.console.assert(t.tiledImage,“ options.tiledImage is required”);this.tile=t.tile;this.tiledImage=t.tiledImage}({tile:i.tile,tiledImage:i.tiledImage})},clearTilesFor:function(t){e.console.assert(t,“ tiledImage is required”);var i;for(var n=0;n).tiledImage===t){this._unloadTile(i);this._tilesLoaded.splice(n,1);n–}},getImageRecord:function(t){e.console.assert(t,“ cacheKey is required”);return this._imagesLoaded},_unloadTile:function(t){e.console.assert(t,“ tileRecord is required”);var i=t.tile;var n=t.tiledImage;i.unload();i.cacheImageRecord=null;var o=this._imagesLoaded;o.removeTile(i);if(!o.getTileCount()){o.destroy();delete this._imagesLoaded;this._imagesLoadedCount–}n.viewer.raiseEvent(“tile-unloaded”,{tile:i,tiledImage:n})}}}(OpenSeadragon);!function(e){e.World=function(t){var i=this;e.console.assert(t.viewer,“ options.viewer is required”);e.EventSource.call(this);this.viewer=t.viewer;this._items=[];this._needsDraw=!1;this._autoRefigureSizes=!0;this._needsSizesFigured=!1;this._delegatedFigureSizes=function(e){i._autoRefigureSizes?i._figureSizes():i._needsSizesFigured=!0};this._figureSizes()};e.extend(e.World.prototype,e.EventSource.prototype,{addItem:function(t,i){e.console.assert(t,“ item is required”);e.console.assert(t instanceof e.TiledImage,“ only TiledImages supported at this time”);if(void 0!==(i=i||{}).index){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,t)}else this._items.push(t);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0;this._needsDraw=!0;t.addHandler(“bounds-change”,this._delegatedFigureSizes);t.addHandler(“clip-change”,this._delegatedFigureSizes);this.raiseEvent(“add-item”,{item:t})},getItemAt:function(t){e.console.assert(void 0!==t,“ index is required”);return this._items},getIndexOfItem:function(t){e.console.assert(t,“ item is required”);return e.indexOf(this._items,t)},getItemCount:function(){return this._items.length},setItemIndex:function(t,i){e.console.assert(t,“ item is required”);e.console.assert(void 0!==i,“ index is required”);var n=this.getIndexOfItem(t);if(i>=this._items.length)throw new Error(“Index bigger than number of layers.”);if(i!==n&&-1!==n){this._items.splice(n,1);this._items.splice(i,0,t);this._needsDraw=!0;this.raiseEvent(“item-index-change”,{item:t,previousIndex:n,newIndex:i})}},removeItem:function(t){e.console.assert(t,“ item is required”);var i=e.indexOf(this._items,t);if(-1!==i){t.removeHandler(“bounds-change”,this._delegatedFigureSizes);t.removeHandler(“clip-change”,this._delegatedFigureSizes);t.destroy();this._items.splice(i,1);this._figureSizes();this._needsDraw=!0;this._raiseRemoveItem(t)}},removeAll:function(){this.viewer._cancelPendingImages();var e;var t;for(t=0;t<this._items.length;t++){(e=this._items).removeHandler(“bounds-change”,this._delegatedFigureSizes);e.removeHandler(“clip-change”,this._delegatedFigureSizes);e.destroy()}var i=this._items;this._items=[];this._figureSizes();this._needsDraw=!0;for(t=0;t;this._raiseRemoveItem(e)}},resetItems:function(){for(var e=0;e.reset()},update:function(){var e=!1;for(var t=0;t.update()||e;return e},draw:function(){for(var e=0;e.draw();this._needsDraw=!1},needsDraw:function(){for(var e=0;e.needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(e){this._autoRefigureSizes=e;if(e&this._needsSizesFigured){this._figureSizes();this._needsSizesFigured=!1}},arrange:function(t){var i=(t=t||{}).immediately||!1;var n=t.layout||e.DEFAULT_SETTINGS.collectionLayout;var o=t.rows||e.DEFAULT_SETTINGS.collectionRows;var r=t.columns||e.DEFAULT_SETTINGS.collectionColumns;var s=t.tileSize||e.DEFAULT_SETTINGS.collectionTileSize;var a=s+(t.tileMargin||e.DEFAULT_SETTINGS.collectionTileMargin);var l;l=!t.rows&&r?r:Math.ceil(this._items.length/o);var h=0;var c=0;var u,d,p,g,m;this.setAutoRefigureSizes(!1);for(var v=0;v<this._items.length;v++){if(v&&v%l==0)if(“horizontal”===n){c+=a;h=0}else{h+=a;c=0}g=(p=(d=(u=this._items).getBounds()).width>d.height?s:s*(d.width/d.height))*(d.height/d.width);m=new e.Point(h+(s-p)/2,c+(s-g)/2);u.setPosition(m,i);u.setWidth(p,i);“horizontal”===n?h+=a:c+=a}this.setAutoRefigureSizes(!0)},_figureSizes:function(){var t=this._homeBounds?this._homeBounds.clone():null;var i=this._contentSize?this._contentSize.clone():null;var n=this._contentFactor||0;if(this._items.length){var o=this._items;var r=o.getBounds();this._contentFactor=o.getContentSize().x/r.width;var s=o.getClippedBounds().getBoundingBox();var a=s.x;var l=s.y;var h=s.x+s.width;var c=s.y+s.height;for(var u=1;u<this._items.length;u++){r=(o=this._items).getBounds();this._contentFactor=Math.max(this._contentFactor,o.getContentSize().x/r.width);s=o.getClippedBounds().getBoundingBox();a=Math.min(a,s.x);l=Math.min(l,s.y);h=Math.max(h,s.x+s.width);c=Math.max(c,s.y+s.height)}this._homeBounds=new e.Rect(a,l,h-a,c-l);this._contentSize=new e.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}else{this._homeBounds=new e.Rect(0,0,1,1);this._contentSize=new e.Point(1,1);this._contentFactor=1}this._contentFactor===n&&this._homeBounds.equals(t)&&this._contentSize.equals(i)||this.raiseEvent(“metrics-change”,{})},_raiseRemoveItem:function(e){this.raiseEvent(“remove-item”,{item:e})}})}(OpenSeadragon); //# sourceMappingURL=openseadragon.min.js.map