//! 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.xe
“‘, 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;no
“$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.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;ethis.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;rt
”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;ne.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&&ee.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;rt
“/”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;rn
“/”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).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