kfb-view 3.0.5 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/kfb-view.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see kfb-view.js.LICENSE.txt */
2
- var KfbView=function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=141)}([function(t,e,i){var n=i(14),o=i(40).f,r=i(26),s=i(44),a=i(67),l=i(85),c=i(106);t.exports=function(t,e){var i,u,h,p,d,f=t.target,g=t.global,v=t.stat;if(i=g?n:v?n[f]||a(f,{}):(n[f]||{}).prototype)for(u in e){if(p=e[u],h=t.noTargetGet?(d=o(i,u))&&d.value:i[u],!c(g?u:f+(v?".":"#")+u,t.forced)&&void 0!==h){if(typeof p==typeof h)continue;l(p,h)}(t.sham||h&&h.sham)&&r(p,"sham",!0),s(i,u,p,t)}}},function(t,e,i){var n=i(75),o=i(44),r=i(120);n||o(Object.prototype,"toString",r,{unsafe:!0})},function(t,e,i){"use strict";var n=i(44),o=i(24),r=i(12),s=i(121),a="toString",l=RegExp.prototype,c=l.toString,u=r((function(){return"/a/b"!=c.call({source:"a",flags:"b"})})),h=c.name!=a;(u||h)&&n(RegExp.prototype,a,(function(){var t=o(this),e=String(t.source),i=t.flags;return"/"+e+"/"+String(void 0===i&&t instanceof RegExp&&!("flags"in l)?s.call(t):i)}),{unsafe:!0})},function(t,e,i){"use strict";var n=i(0),o=i(14),r=i(45),s=i(60),a=i(19),l=i(72),c=i(91),u=i(12),h=i(16),p=i(46),d=i(15),f=i(24),g=i(22),v=i(21),m=i(57),y=i(41),w=i(63),x=i(64),b=i(70),T=i(109),S=i(90),P=i(40),E=i(23),C=i(66),R=i(26),_=i(44),O=i(68),I=i(59),D=i(61),k=i(69),M=i(13),L=i(92),A=i(93),B=i(73),H=i(58),j=i(30).forEach,z=I("hidden"),N="Symbol",F=M("toPrimitive"),V=H.set,W=H.getterFor(N),U=Object.prototype,G=o.Symbol,Z=r("JSON","stringify"),q=P.f,$=E.f,K=T.f,X=C.f,Y=O("symbols"),J=O("op-symbols"),Q=O("string-to-symbol-registry"),tt=O("symbol-to-string-registry"),et=O("wks"),it=o.QObject,nt=!it||!it.prototype||!it.prototype.findChild,ot=a&&u((function(){return 7!=w($({},"a",{get:function(){return $(this,"a",{value:7}).a}})).a}))?function(t,e,i){var n=q(U,e);n&&delete U[e],$(t,e,i),n&&t!==U&&$(U,e,n)}:$,rt=function(t,e){var i=Y[t]=w(G.prototype);return V(i,{type:N,tag:t,description:e}),a||(i.description=e),i},st=c?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof G},at=function(t,e,i){t===U&&at(J,e,i),f(t);var n=m(e,!0);return f(i),h(Y,n)?(i.enumerable?(h(t,z)&&t[z][n]&&(t[z][n]=!1),i=w(i,{enumerable:y(0,!1)})):(h(t,z)||$(t,z,y(1,{})),t[z][n]=!0),ot(t,n,i)):$(t,n,i)},lt=function(t,e){f(t);var i=v(e),n=x(i).concat(pt(i));return j(n,(function(e){a&&!ct.call(i,e)||at(t,e,i[e])})),t},ct=function(t){var e=m(t,!0),i=X.call(this,e);return!(this===U&&h(Y,e)&&!h(J,e))&&(!(i||!h(this,e)||!h(Y,e)||h(this,z)&&this[z][e])||i)},ut=function(t,e){var i=v(t),n=m(e,!0);if(i!==U||!h(Y,n)||h(J,n)){var o=q(i,n);return!o||!h(Y,n)||h(i,z)&&i[z][n]||(o.enumerable=!0),o}},ht=function(t){var e=K(v(t)),i=[];return j(e,(function(t){h(Y,t)||h(D,t)||i.push(t)})),i},pt=function(t){var e=t===U,i=K(e?J:v(t)),n=[];return j(i,(function(t){!h(Y,t)||e&&!h(U,t)||n.push(Y[t])})),n};(l||(G=function(){if(this instanceof G)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=k(t),i=function(t){this===U&&i.call(J,t),h(this,z)&&h(this[z],e)&&(this[z][e]=!1),ot(this,e,y(1,t))};return a&&nt&&ot(U,e,{configurable:!0,set:i}),rt(e,t)},_(G.prototype,"toString",(function(){return W(this).tag})),_(G,"withoutSetter",(function(t){return rt(k(t),t)})),C.f=ct,E.f=at,P.f=ut,b.f=T.f=ht,S.f=pt,L.f=function(t){return rt(M(t),t)},a&&($(G.prototype,"description",{configurable:!0,get:function(){return W(this).description}}),s||_(U,"propertyIsEnumerable",ct,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:G}),j(x(et),(function(t){A(t)})),n({target:N,stat:!0,forced:!l},{for:function(t){var e=String(t);if(h(Q,e))return Q[e];var i=G(e);return Q[e]=i,tt[i]=e,i},keyFor:function(t){if(!st(t))throw TypeError(t+" is not a symbol");if(h(tt,t))return tt[t]},useSetter:function(){nt=!0},useSimple:function(){nt=!1}}),n({target:"Object",stat:!0,forced:!l,sham:!a},{create:function(t,e){return void 0===e?w(t):lt(w(t),e)},defineProperty:at,defineProperties:lt,getOwnPropertyDescriptor:ut}),n({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ht,getOwnPropertySymbols:pt}),n({target:"Object",stat:!0,forced:u((function(){S.f(1)}))},{getOwnPropertySymbols:function(t){return S.f(g(t))}}),Z)&&n({target:"JSON",stat:!0,forced:!l||u((function(){var t=G();return"[null]"!=Z([t])||"{}"!=Z({a:t})||"{}"!=Z(Object(t))}))},{stringify:function(t,e,i){for(var n,o=[t],r=1;arguments.length>r;)o.push(arguments[r++]);if(n=e,(d(e)||void 0!==t)&&!st(t))return p(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!st(e))return e}),o[1]=e,Z.apply(null,o)}});G.prototype[F]||R(G.prototype,F,G.prototype.valueOf),B(G,N),D[z]=!0},function(t,e,i){"use strict";var n=i(0),o=i(19),r=i(14),s=i(16),a=i(15),l=i(23).f,c=i(85),u=r.Symbol;if(o&&"function"==typeof u&&(!("description"in u.prototype)||void 0!==u().description)){var h={},p=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof p?new u(t):void 0===t?u():u(t);return""===t&&(h[e]=!0),e};c(p,u);var d=p.prototype=u.prototype;d.constructor=p;var f=d.toString,g="Symbol(test)"==String(u("test")),v=/^Symbol\((.*)\)[^)]+$/;l(d,"description",{configurable:!0,get:function(){var t=a(this)?this.valueOf():this,e=f.call(t);if(s(h,t))return"";var i=g?e.slice(7,-1):e.replace(v,"$1");return""===i?void 0:i}}),n({global:!0,forced:!0},{Symbol:p})}},function(t,e,i){"use strict";var n=i(21),o=i(50),r=i(48),s=i(58),a=i(96),l="Array Iterator",c=s.set,u=s.getterFor(l);t.exports=a(Array,"Array",(function(t,e){c(this,{type:l,target:n(t),index:0,kind:e})}),(function(){var t=u(this),e=t.target,i=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:n,done:!1}:"values"==i?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),r.Arguments=r.Array,o("keys"),o("values"),o("entries")},function(t,e,i){i(93)("iterator")},function(t,e,i){"use strict";var n=i(122).charAt,o=i(58),r=i(96),s="String Iterator",a=o.set,l=o.getterFor(s);r(String,"String",(function(t){a(this,{type:s,string:String(t),index:0})}),(function(){var t,e=l(this),i=e.string,o=e.index;return o>=i.length?{value:void 0,done:!0}:(t=n(i,o),e.index+=t.length,{value:t,done:!1})}))},function(t,e,i){var n=i(14),o=i(101),r=i(5),s=i(26),a=i(13),l=a("iterator"),c=a("toStringTag"),u=r.values;for(var h in o){var p=n[h],d=p&&p.prototype;if(d){if(d[l]!==u)try{s(d,l,u)}catch(g){d[l]=u}if(d[c]||s(d,c,h),o[h])for(var f in r)if(d[f]!==r[f])try{s(d,f,r[f])}catch(g){d[f]=r[f]}}}},function(t,e,i){var n=i(0),o=i(12),r=i(22),s=i(76),a=i(98);n({target:"Object",stat:!0,forced:o((function(){s(1)})),sham:!a},{getPrototypeOf:function(t){return s(r(t))}})},function(t,e,i){i(0)({target:"Object",stat:!0},{setPrototypeOf:i(99)})},function(t,e,i){var n=i(0),o=i(45),r=i(47),s=i(24),a=i(15),l=i(63),c=i(127),u=i(12),h=o("Reflect","construct"),p=u((function(){function t(){}return!(h((function(){}),[],t)instanceof t)})),d=!u((function(){h((function(){}))})),f=p||d;n({target:"Reflect",stat:!0,forced:f,sham:f},{construct:function(t,e){r(t),s(e);var i=arguments.length<3?t:r(arguments[2]);if(d&&!p)return h(t,e,i);if(t==i){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var n=[null];return n.push.apply(n,e),new(c.apply(t,n))}var o=i.prototype,u=l(a(o)?o:Object.prototype),f=Function.apply.call(t,u,e);return a(f)?f:u}})},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,i){var n=i(14),o=i(68),r=i(16),s=i(69),a=i(72),l=i(91),c=o("wks"),u=n.Symbol,h=l?u:u&&u.withoutSetter||s;t.exports=function(t){return r(c,t)||(a&&r(u,t)?c[t]=u[t]:c[t]=h("Symbol."+t)),c[t]}},function(t,e,i){(function(e){var i=function(t){return t&&t.Math==Math&&t};t.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof e&&e)||Function("return this")()}).call(this,i(104))},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){"use strict";var n=i(0),o=i(102);n({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},function(t,e,i){var n=i(14),o=i(101),r=i(102),s=i(26);for(var a in o){var l=n[a],c=l&&l.prototype;if(c&&c.forEach!==r)try{s(c,"forEach",r)}catch(u){c.forEach=r}}},function(t,e,i){var n=i(12);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,i){var n,o,r,s,a;function l(t){return new l.Viewer(t)}!function(t){t.version={versionStr:"4.0.0",major:parseInt("4",10),minor:parseInt("0",10),revision:parseInt("0",10)};var e,i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.isFunction=function(e){return"function"===t.type(e)},t.isArray=Array.isArray||function(e){return"array"===t.type(e)},t.isWindow=function(t){return t&&"object"==typeof t&&"setInterval"in t},t.type=function(t){return null==t?String(t):i[n.call(t)]||"object"},t.isPlainObject=function(e){if(!e||"object"!==l.type(e)||e.nodeType||t.isWindow(e))return!1;if(e.constructor&&!o.call(e,"constructor")&&!o.call(e.constructor.prototype,"isPrototypeOf"))return!1;var i;for(var n in e)i=n;return void 0===i||o.call(e,i)},t.isEmptyObject=function(t){for(var e in t)return!1;return!0},t.freezeObject=function(e){return Object.freeze?t.freezeObject=Object.freeze:t.freezeObject=function(t){return t},t.freezeObject(e)},t.supportsCanvas=(e=document.createElement("canvas"),!(!t.isFunction(e.getContext)||!e.getContext("2d"))),t.isCanvasTainted=function(t){var e=!1;try{t.getContext("2d").getImageData(0,0,1,1)}catch(i){e=!0}return e},t.supportsAddEventListener=!(!document.documentElement.addEventListener||!document.addEventListener),t.supportsRemoveEventListener=!(!document.documentElement.removeEventListener||!document.removeEventListener),t.supportsEventListenerOptions=function(){var e=0;if(t.supportsAddEventListener)try{var i={get capture(){return e++,!1},get once(){return e++,!1},get passive(){return e++,!1}};window.addEventListener("test",null,i),window.removeEventListener("test",null,i)}catch(n){e=0}return e>=3}(),t.getCurrentPixelDensityRatio=function(){if(t.supportsCanvas){var e=document.createElement("canvas").getContext("2d"),i=window.devicePixelRatio||1,n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return Math.max(i,1)/n}return 1},t.pixelDensityRatio=t.getCurrentPixelDensityRatio()}(l),function(t){t.extend=function(){var e,i,n,o,r,s,a=arguments[0]||{},c=arguments.length,u=!1,h=1;for("boolean"==typeof a&&(u=a,a=arguments[1]||{},h=2),"object"==typeof a||l.isFunction(a)||(a={}),c===h&&(a=this,--h);h<c;h++)if(null!==(e=arguments[h])||void 0!==e)for(i in e){var p=Object.getOwnPropertyDescriptor(e,i);void 0!==p?p.get||p.set?Object.defineProperty(a,i,p):a!==(o=p.value)&&(u&&o&&(l.isPlainObject(o)||(r=l.isArray(o)))?(n=a[i],r?(r=!1,s=n&&l.isArray(n)?n:[]):s=n&&l.isPlainObject(n)?n:{},a[i]=l.extend(u,s,o)):void 0!==o&&(a[i]=o)):t.console.warn('Could not copy inherited property "'+i+'".')}return a};t.extend(t,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:!1,ajaxWithCredentials:!1,loadTilesWithAjax:!1,ajaxHeaders:{},splitHashDataForPost:!1,panHorizontal:!0,panVertical:!0,constrainDuringPan:!1,wrapHorizontal:!1,wrapVertical:!1,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:!1,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:!0,scrollToZoom:!0,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsTouch:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!0,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsPen:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsUnknown:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!1,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},zoomPerClick:2,zoomPerScroll:1.2,zoomPerDblClickDrag:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:!1,autoHideControls:!0,immediateRender:!1,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:function(){if("object"!=typeof navigator)return!1;var t=navigator.userAgent;return"string"==typeof t&&(-1!==t.indexOf("iPhone")||-1!==t.indexOf("iPad")||-1!==t.indexOf("iPod"))}(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:!0,preserveImageSizeOnResize:!1,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:!0,sequenceControlAnchor:null,preserveViewport:!1,preserveOverlays:!1,navPrevNextWrap:!1,showNavigationControl:!0,navigationControlAnchor:null,showZoomControl:!0,showHomeControl:!0,showFullPageControl:!0,showRotationControl:!1,showFlipControl:!1,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:!0,showNavigator:!1,navigatorElement:null,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:!1,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:!0,navigatorAutoFade:!0,navigatorRotate:!0,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:!1,opacity:1,preload:!1,compositeOperation:null,imageSmoothingEnabled:!0,placeholderFillStyle:null,subPixelRoundingForTransparency:null,showReferenceStrip:!1,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:!1,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,useCanvas:!0,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:!1,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"],silenceMultiImageWarnings:!1},SIGNAL:"----seadragon----",delegate:function(t,e){return function(){var i=arguments;return void 0===i&&(i=[]),e.apply(t,i)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},SUBPIXEL_ROUNDING_OCCURRENCES:{NEVER:0,ONLY_AT_REST:1,ALWAYS:2},_viewers:new Map,getViewer:function(e){return t._viewers.get(this.getElement(e))},getElement:function(t){return"string"==typeof t&&(t=document.getElementById(t)),t},getElementPosition:function(e){var i,n,r=new t.Point;for(n=o(e=t.getElement(e),i="fixed"===t.getElementStyle(e).position);n;)r.x+=e.offsetLeft,r.y+=e.offsetTop,i&&(r=r.plus(t.getPageScroll())),n=o(e=n,i="fixed"===t.getElementStyle(e).position);return r},getElementOffset:function(e){var i,n,o=(e=t.getElement(e))&&e.ownerDocument,r={top:0,left:0};return o?(i=o.documentElement,void 0!==e.getBoundingClientRect&&(r=e.getBoundingClientRect()),n=o===o.window?o:9===o.nodeType&&(o.defaultView||o.parentWindow),new t.Point(r.left+(n.pageXOffset||i.scrollLeft)-(i.clientLeft||0),r.top+(n.pageYOffset||i.scrollTop)-(i.clientTop||0))):new t.Point},getElementSize:function(e){return e=t.getElement(e),new t.Point(e.clientWidth,e.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(e){return(e=t.getElement(e)).currentStyle}:function(e){return e=t.getElement(e),window.getComputedStyle(e,"")},getCssPropertyWithVendorPrefix:function(e){var i={};return t.getCssPropertyWithVendorPrefix=function(e){if(void 0!==i[e])return i[e];var n=document.createElement("div").style,o=null;if(void 0!==n[e])o=e;else for(var r=["Webkit","Moz","MS","O","webkit","moz","ms","o"],s=t.capitalizeFirstLetter(e),a=0;a<r.length;a++){var l=r[a]+s;if(void 0!==n[l]){o=l;break}}return i[e]=o,o},t.getCssPropertyWithVendorPrefix(e)},capitalizeFirstLetter:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},positiveModulo:function(t,e){var i=t%e;return i<0&&(i+=e),i},pointInElement:function(e,i){e=t.getElement(e);var n=t.getElementOffset(e),o=t.getElementSize(e);return i.x>=n.x&&i.x<n.x+o.x&&i.y<n.y+o.y&&i.y>=n.y},getMousePosition:function(e){if("number"==typeof e.pageX)t.getMousePosition=function(e){var i=new t.Point;return i.x=e.pageX,i.y=e.pageY,i};else{if("number"!=typeof e.clientX)throw new Error("Unknown event mouse position, no known technique.");t.getMousePosition=function(e){var i=new t.Point;return i.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop,i}}return t.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.pageXOffset)t.getPageScroll=function(){return new t.Point(window.pageXOffset,window.pageYOffset)};else if(i.scrollLeft||i.scrollTop)t.getPageScroll=function(){return new t.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new t.Point(0,0);t.getPageScroll=function(){return new t.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return t.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)t.setPageScroll=function(t){window.scrollTo(t.x,t.y)};else{var i=t.getPageScroll();if(i.x===e.x&&i.y===e.y)return;document.body.scrollLeft=e.x,document.body.scrollTop=e.y;var n=t.getPageScroll();if(n.x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.body.scrollLeft=t.x,document.body.scrollTop=t.y});if(document.documentElement.scrollLeft=e.x,document.documentElement.scrollTop=e.y,(n=t.getPageScroll()).x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.documentElement.scrollLeft=t.x,document.documentElement.scrollTop=t.y});t.setPageScroll=function(t){}}t.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.innerWidth)t.getWindowSize=function(){return new t.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)t.getWindowSize=function(){return new t.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!i.clientWidth&&!i.clientHeight)throw new Error("Unknown window size, no known technique.");t.getWindowSize=function(){return new t.Point(document.body.clientWidth,document.body.clientHeight)}}return t.getWindowSize()},makeCenteredNode:function(e){e=t.getElement(e);var i=[t.makeNeutralElement("div"),t.makeNeutralElement("div"),t.makeNeutralElement("div")];return t.extend(i[0].style,{display:"table",height:"100%",width:"100%"}),t.extend(i[1].style,{display:"table-row"}),t.extend(i[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),i[0].appendChild(i[1]),i[1].appendChild(i[2]),i[2].appendChild(e),i[0]},makeNeutralElement:function(t){var e=document.createElement(t),i=e.style;return i.background="transparent none",i.border="none",i.margin="0px",i.padding="0px",i.position="static",e},now:function(){return Date.now?t.now=Date.now:t.now=function(){return(new Date).getTime()},t.now()},makeTransparentImage:function(e){var i=t.makeNeutralElement("img");return i.src=e,i},setElementOpacity:function(e,i,n){var o;e=t.getElement(e),n&&!t.Browser.alpha&&(i=Math.round(i)),t.Browser.opacity?e.style.opacity=i<1?i:"":i<1?(o="alpha(opacity="+Math.round(100*i)+")",e.style.filter=o):e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=t.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},setElementPointerEvents:function(e,i){void 0!==(e=t.getElement(e)).style&&void 0!==e.style.pointerEvents&&(e.style.pointerEvents=i)},setElementPointerEventsNone:function(e){t.setElementPointerEvents(e,"none")},addClass:function(e,i){(e=t.getElement(e)).className?-1===(" "+e.className+" ").indexOf(" "+i+" ")&&(e.className+=" "+i):e.className=i},indexOf:function(t,e,i){return Array.prototype.indexOf?this.indexOf=function(t,e,i){return t.indexOf(e,i)}:this.indexOf=function(t,e,i){var n,o,r=i||0;if(!t)throw new TypeError;if(0===(o=t.length)||r>=o)return-1;for(r<0&&(r=o-Math.abs(r)),n=r;n<o;n++)if(t[n]===e)return n;return-1},this.indexOf(t,e,i)},removeClass:function(e,i){var n,o,r=[];for(n=(e=t.getElement(e)).className.split(/\s+/),o=0;o<n.length;o++)n[o]&&n[o]!==i&&r.push(n[o]);e.className=r.join(" ")},normalizeEventListenerOptions:function(e){return void 0!==e?"boolean"==typeof e?t.supportsEventListenerOptions?{capture:e}:e:t.supportsEventListenerOptions?e:void 0!==e.capture&&e.capture:!!t.supportsEventListenerOptions&&{capture:!1}},addEvent:function(){if(t.supportsAddEventListener)return function(e,i,n,o){o=t.normalizeEventListenerOptions(o),(e=t.getElement(e)).addEventListener(i,n,o)};if(document.documentElement.attachEvent&&document.attachEvent)return function(e,i,n){(e=t.getElement(e)).attachEvent("on"+i,n)};throw new Error("No known event model.")}(),removeEvent:function(){if(t.supportsRemoveEventListener)return function(e,i,n,o){o=t.normalizeEventListenerOptions(o),(e=t.getElement(e)).removeEventListener(i,n,o)};if(document.documentElement.detachEvent&&document.detachEvent)return function(e,i,n){(e=t.getElement(e)).detachEvent("on"+i,n)};throw new Error("No known event model.")}(),cancelEvent:function(t){t.preventDefault()},eventIsCanceled:function(t){return t.defaultPrevented},stopEvent:function(t){t.stopPropagation()},createCallback:function(t,e){var i,n=[];for(i=2;i<arguments.length;i++)n.push(arguments[i]);return function(){var i,o=n.concat([]);for(i=0;i<arguments.length;i++)o.push(arguments[i]);return e.apply(t,o)}},getUrlParameter:function(t){var e=n[t];return e||null},getUrlProtocol:function(t){var e=t.match(/^([a-z]+:)\/\//i);return null===e?window.location.protocol:e[1].toLowerCase()},createAjaxRequest:function(e){var i;try{i=!!new ActiveXObject("Microsoft.XMLHTTP")}catch(n){i=!1}if(i)window.XMLHttpRequest?t.createAjaxRequest=function(t){return t?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest}:t.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")};else{if(!window.XMLHttpRequest)throw new Error("Browser doesn't support XMLHttpRequest.");t.createAjaxRequest=function(){return new XMLHttpRequest}}return t.createAjaxRequest(e)},makeAjaxRequest:function(e,i,n){var o,r,s,a;t.isPlainObject(e)&&(i=e.success,n=e.error,o=e.withCredentials,r=e.headers,s=e.responseType||null,a=e.postData||null,e=e.url);var l=t.getUrlProtocol(e),c=t.createAjaxRequest("file:"===l);if(!t.isFunction(i))throw new Error("makeAjaxRequest requires a success callback");c.onreadystatechange=function(){4===c.readyState&&(c.onreadystatechange=function(){},c.status>=200&&c.status<300||0===c.status&&"http:"!==l&&"https:"!==l?i(c):t.isFunction(n)?n(c):t.console.error("AJAX request returned %d: %s",c.status,e))};var u=a?"POST":"GET";try{if(c.open(u,e,!0),s&&(c.responseType=s),r)for(var h in r)Object.prototype.hasOwnProperty.call(r,h)&&r[h]&&c.setRequestHeader(h,r[h]);o&&(c.withCredentials=!0),c.send(a)}catch(p){t.console.error("%s while making AJAX request: %s",p.name,p.message),c.onreadystatechange=function(){},t.isFunction(n)&&n(c,p)}return c},jsonp:function(e){var i,n=e.url,o=document.head||document.getElementsByTagName("head")[0]||document.documentElement,r=e.callbackName||"openseadragon"+t.now(),s=window[r],a="$1"+r+"$2",l=e.param||"callback",c=e.callback;n=n.replace(/(=)\?(&|$)|\?\?/i,a),n+=(/\?/.test(n)?"&":"?")+l+"="+r,window[r]=function(e){if(s)window[r]=s;else try{delete window[r]}catch(i){}c&&t.isFunction(c)&&c(e)},i=document.createElement("script"),void 0===e.async&&!1===e.async||(i.async="async"),e.scriptCharset&&(i.charset=e.scriptCharset),i.src=n,i.onload=i.onreadystatechange=function(t,e){(e||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,o&&i.parentNode&&o.removeChild(i),i=void 0)},o.insertBefore(i,o.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(e){if(window.DOMParser)t.parseXml=function(t){return(new DOMParser).parseFromString(t,"text/xml")};else{if(!window.ActiveXObject)throw new Error("Browser doesn't support XML DOM.");t.parseXml=function(t){var e=null;return(e=new ActiveXObject("Microsoft.XMLDOM")).async=!1,e.loadXML(t),e}}return t.parseXml(e)},parseJSON:function(e){return t.parseJSON=window.JSON.parse,t.parseJSON(e)},imageFormatSupported:function(t){return!!i[(t=t||"").toLowerCase()]},setImageFormatsSupported:function(e){t.extend(i,e)}});var e=function(t){};t.console=window.console||{log:e,debug:e,info:e,warn:e,error:e,assert:e},t.Browser={vendor:t.BROWSERS.UNKNOWN,version:0,alpha:!0};var i={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},n={};function o(t,e){return e&&t!==document.body?document.body:t.offsetParent}!function(){var e=navigator.appVersion,i=navigator.userAgent;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(i.substring(i.indexOf("MSIE")+5,i.indexOf(";",i.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(i.indexOf("Edge")>=0?(t.Browser.vendor=t.BROWSERS.EDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edge")+5))):i.indexOf("Edg")>=0?(t.Browser.vendor=t.BROWSERS.CHROMEEDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edg")+4))):i.indexOf("Firefox")>=0?(t.Browser.vendor=t.BROWSERS.FIREFOX,t.Browser.version=parseFloat(i.substring(i.indexOf("Firefox")+8))):i.indexOf("Safari")>=0?(t.Browser.vendor=i.indexOf("Chrome")>=0?t.BROWSERS.CHROME:t.BROWSERS.SAFARI,t.Browser.version=parseFloat(i.substring(i.substring(0,i.indexOf("Safari")).lastIndexOf("/")+1,i.indexOf("Safari")))):null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(i)&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(RegExp.$1)));break;case"Opera":t.Browser.vendor=t.BROWSERS.OPERA,t.Browser.version=parseFloat(e)}var o,r,s,a=window.location.search.substring(1).split("&");for(s=0;s<a.length;s++)if((r=(o=a[s]).indexOf("="))>0){var l=o.substring(0,r),c=o.substring(r+1);try{n[l]=decodeURIComponent(c)}catch(u){t.console.error("Ignoring malformed URL parameter: %s=%s",l,c)}}t.Browser.alpha=!(t.Browser.vendor===t.BROWSERS.CHROME&&t.Browser.version<2),t.Browser.opacity=!0,t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version<11&&t.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")}(),function(e){var i=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame,n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame;if(i&&n)t.requestAnimationFrame=function(){return i.apply(e,arguments)},t.cancelAnimationFrame=function(){return n.apply(e,arguments)};else{var o,r=[],s=[],a=0;t.requestAnimationFrame=function(e){return r.push([++a,e]),o||(o=setInterval((function(){if(r.length){var e=t.now(),i=s;for(s=r,r=i;s.length;)s.shift()[1](e)}else clearInterval(o),o=void 0}),20)),a},t.cancelAnimationFrame=function(t){var e,i;for(e=0,i=r.length;e<i;e+=1)if(r[e][0]===t)return void r.splice(e,1);for(e=0,i=s.length;e<i;e+=1)if(s[e][0]===t)return void s.splice(e,1)}}}(window)}(l),o=[],void 0===(r="function"==typeof(n=function(){return l})?n.apply(e,o):n)||(t.exports=r),s=l,a={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""},document.exitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.fullscreenElement},a.requestFullScreen=function(t){return t.requestFullscreen()},a.exitFullScreen=function(){document.exitFullscreen()},a.fullScreenEventName="fullscreenchange",a.fullScreenErrorEventName="fullscreenerror"):document.msExitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.msFullscreenElement},a.requestFullScreen=function(t){return t.msRequestFullscreen()},a.exitFullScreen=function(){document.msExitFullscreen()},a.fullScreenEventName="MSFullscreenChange",a.fullScreenErrorEventName="MSFullscreenError"):document.webkitExitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.webkitFullscreenElement},a.requestFullScreen=function(t){return t.webkitRequestFullscreen()},a.exitFullScreen=function(){document.webkitExitFullscreen()},a.fullScreenEventName="webkitfullscreenchange",a.fullScreenErrorEventName="webkitfullscreenerror"):document.webkitCancelFullScreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement},a.requestFullScreen=function(t){return t.webkitRequestFullScreen()},a.exitFullScreen=function(){document.webkitCancelFullScreen()},a.fullScreenEventName="webkitfullscreenchange",a.fullScreenErrorEventName="webkitfullscreenerror"):document.mozCancelFullScreen&&(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.mozFullScreenElement},a.requestFullScreen=function(t){return t.mozRequestFullScreen()},a.exitFullScreen=function(){document.mozCancelFullScreen()},a.fullScreenEventName="mozfullscreenchange",a.fullScreenErrorEventName="mozfullscreenerror"),a.isFullScreen=function(){return null!==a.getFullScreenElement()},a.cancelFullScreen=function(){s.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."),a.exitFullScreen()},s.extend(s,a),function(t){t.EventSource=function(){this.events={}},t.EventSource.prototype={addOnceHandler:function(t,e,i,n){var o=this;n=n||1;var r=0,s=function(i){++r===n&&o.removeHandler(t,s),e(i)};this.addHandler(t,s,i)},addHandler:function(e,i,n){var o=this.events[e];o||(this.events[e]=o=[]),i&&t.isFunction(i)&&(o[o.length]={handler:i,userData:n||null})},removeHandler:function(e,i){var n,o=this.events[e],r=[];if(o&&t.isArray(o)){for(n=0;n<o.length;n++)o[n].handler!==i&&r.push(o[n]);this.events[e]=r}},numberOfHandlers:function(t){var e=this.events[t];return e?e.length:0},removeAllHandlers:function(t){if(t)this.events[t]=[];else for(var e in this.events)this.events[e]=[]},getHandler:function(t){var e=this.events[t];return e&&e.length?(e=1===e.length?[e[0]]:Array.apply(null,e),function(t,i){var n,o=e.length;for(n=0;n<o;n++)e[n]&&(i.eventSource=t,i.userData=e[n].userData,e[n].handler(i))}):null},raiseEvent:function(t,e){var i=this.getHandler(t);i&&(e||(e={}),i(this,e))}}}(l),function(t){var e=[],i={};t.MouseTracker=function(n){e.push(this);var o=arguments;t.isPlainObject(n)||(n={element:o[0],clickTimeThreshold:o[1],clickDistThreshold:o[2]}),this.hash=Math.random(),this.element=t.getElement(n.element),this.clickTimeThreshold=n.clickTimeThreshold||t.DEFAULT_SETTINGS.clickTimeThreshold,this.clickDistThreshold=n.clickDistThreshold||t.DEFAULT_SETTINGS.clickDistThreshold,this.dblClickTimeThreshold=n.dblClickTimeThreshold||t.DEFAULT_SETTINGS.dblClickTimeThreshold,this.dblClickDistThreshold=n.dblClickDistThreshold||t.DEFAULT_SETTINGS.dblClickDistThreshold,this.userData=n.userData||null,this.stopDelay=n.stopDelay||50,this.preProcessEventHandler=n.preProcessEventHandler||null,this.contextMenuHandler=n.contextMenuHandler||null,this.enterHandler=n.enterHandler||null,this.leaveHandler=n.leaveHandler||null,this.exitHandler=n.exitHandler||null,this.overHandler=n.overHandler||null,this.outHandler=n.outHandler||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[this.hash]={click:function(t){T(r,t)},dblclick:function(t){S(r,t)},keydown:function(t){P(r,t)},keyup:function(t){E(r,t)},keypress:function(t){C(r,t)},focus:function(t){R(r,t)},blur:function(t){_(r,t)},contextmenu:function(t){O(r,t)},wheel:function(t){I(r,t)},mousewheel:function(t){D(r,t)},DOMMouseScroll:function(t){D(r,t)},MozMousePixelScroll:function(t){D(r,t)},losecapture:function(t){M(r,t)},mouseenter:function(t){V(r,t)},mouseleave:function(t){W(r,t)},mouseover:function(t){U(r,t)},mouseout:function(t){G(r,t)},mousedown:function(t){Z(r,t)},mouseup:function(t){q(r,t)},mousemove:function(t){X(r,t)},touchstart:function(t){L(r,t)},touchend:function(t){A(r,t)},touchmove:function(t){B(r,t)},touchcancel:function(t){H(r,t)},gesturestart:function(t){j(r,t)},gesturechange:function(t){z(r,t)},gotpointercapture:function(t){N(r,t)},lostpointercapture:function(t){F(r,t)},pointerenter:function(t){V(r,t)},pointerleave:function(t){W(r,t)},pointerover:function(t){U(r,t)},pointerout:function(t){G(r,t)},pointerdown:function(t){Z(r,t)},pointerup:function(t){q(r,t)},pointermove:function(t){X(r,t)},pointercancel:function(t){Q(r,t)},pointerupcaptured:function(t){$(r,t)},pointermovecaptured:function(t){Y(r,t)},tracking:!1,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:!1},this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler),this.hasScrollHandler=!!this.scrollHandler,t.MouseTracker.havePointerEvents&&t.setElementPointerEvents(this.element,"auto"),this.exitHandler&&t.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead."),n.startDisabled||this.setTracking(!0)},t.MouseTracker.prototype={destroy:function(){var t;for(p(this),this.element=null,t=0;t<e.length;t++)if(e[t]===this){e.splice(t,1);break}i[this.hash]=null,delete i[this.hash]},isTracking:function(){return i[this.hash].tracking},setTracking:function(e){return e?function(e){var n,o,r=i[e.hash];if(!r.tracking){for(o=0;o<t.MouseTracker.subscribeEvents.length;o++)n=t.MouseTracker.subscribeEvents[o],t.addEvent(e.element,n,r[n],n===t.MouseTracker.wheelEventName&&{passive:!1,capture:!1});h(e),r.tracking=!0}}(this):p(this),this},getActivePointersListByType:function(e){var n,o,r=i[this.hash],s=r.activePointersLists.length;for(n=0;n<s;n++)if(r.activePointersLists[n].type===e)return r.activePointersLists[n];return o=new t.MouseTracker.GesturePointList(e),r.activePointersLists.push(o),o},getActivePointerCount:function(){var t,e=i[this.hash],n=e.activePointersLists.length,o=0;for(t=0;t<n;t++)o+=e.activePointersLists[t].getLength();return o},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler: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(){}};var n,o,r,s,a,l,c=function(){try{return window.self!==window.top}catch(t){return!0}}();function u(t){try{return t.addEventListener&&t.removeEventListener}catch(e){return!1}}function h(t){var e,n,o,r,s,a=i[t.hash],l=a.activePointersLists.length;for(e=0;e<l;e++)if((o=a.activePointersLists[e]).getLength()>0){for(s=[],r=o.asArray(),n=0;n<r.length;n++)s.push(r[n]);for(n=0;n<s.length;n++)et(t,o,s[n])}for(e=0;e<l;e++)a.activePointersLists.pop();a.sentDragEvent=!1}function p(e){var n,o,r=i[e.hash];if(r.tracking){for(o=0;o<t.MouseTracker.subscribeEvents.length;o++)n=t.MouseTracker.subscribeEvents[o],t.removeEvent(e.element,n,r[n],!1);h(e),r.tracking=!1}}function d(t,e){var n=i[t.hash];if("pointerevent"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("mouse"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("touch"===e)return{upName:"touchend",upHandler:n.touchendcaptured,moveName:"touchmove",moveHandler:n.touchmovecaptured};throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}function f(e,i){var n,o;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents){if(!(o=e.getActivePointersListByType(i.type).getById(i.id))||!o.captured)return;try{e.element.releasePointerCapture(i.id)}catch(r){}}else e.element.releaseCapture();else n=d(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),c&&u(window.top)&&t.removeEvent(window.top,n.upName,n.upHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0);nt(e,i,!1)}function g(e){return t.MouseTracker.havePointerEvents?e.pointerId:t.MouseTracker.mousePointerId}function v(e){return t.MouseTracker.havePointerEvents?e.pointerType||(t.Browser.vendor===t.BROWSERS.IE?"mouse":""):"mouse"}function m(e){return!t.MouseTracker.havePointerEvents||e.isPrimary}function y(e){return t.getMousePosition(e)}function w(t,e){return x(y(t),e)}function x(e,i){var n=t.getElementOffset(i);return e.minus(n)}function b(e,i){return new t.Point((e.x+i.x)/2,(e.y+i.y)/2)}function T(e,i){var n={originalEvent:i,eventType:"click",pointerType:"mouse",isEmulated:!1};it(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i),n.stopPropagation&&t.stopEvent(i)}function S(e,i){var n={originalEvent:i,eventType:"dblclick",pointerType:"mouse",isEmulated:!1};it(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i),n.stopPropagation&&t.stopEvent(i)}function P(e,i){var n=null,o={originalEvent:i,eventType:"keydown",pointerType:"",isEmulated:!1};it(e,o),!e.keyDownHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyDownHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function E(e,i){var n=null,o={originalEvent:i,eventType:"keyup",pointerType:"",isEmulated:!1};it(e,o),!e.keyUpHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyUpHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function C(e,i){var n=null,o={originalEvent:i,eventType:"keypress",pointerType:"",isEmulated:!1};it(e,o),!e.keyHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function R(t,e){var i={originalEvent:e,eventType:"focus",pointerType:"",isEmulated:!1};it(t,i),t.focusHandler&&!i.preventGesture&&t.focusHandler({eventSource:t,originalEvent:e,userData:t.userData})}function _(t,e){var i={originalEvent:e,eventType:"blur",pointerType:"",isEmulated:!1};it(t,i),t.blurHandler&&!i.preventGesture&&t.blurHandler({eventSource:t,originalEvent:e,userData:t.userData})}function O(e,i){var n=null,o={originalEvent:i,eventType:"contextmenu",pointerType:"mouse",isEmulated:!1};it(e,o),!e.contextMenuHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,position:x(y(i),e.element),originalEvent:o.originalEvent,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.contextMenuHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function I(t,e){k(t,e,e)}function D(e,i){var n={target: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"===t.MouseTracker.wheelEventName?n.deltaY=-i.wheelDelta/t.DEFAULT_SETTINGS.pixelsPerWheelLine:n.deltaY=i.detail,k(e,n,i)}function k(e,i,n){var o,r,s=null;o=i.deltaY<0?1:-1,it(e,r={originalEvent:i,eventType:"wheel",pointerType:"mouse",isEmulated:i!==n}),!e.scrollHandler||r.preventGesture||r.defaultPrevented||(s={eventSource:e,pointerType:"mouse",position:w(i,e.element),scroll:o,shift:i.shiftKey,isTouchEvent:!1,originalEvent:n,preventDefault:r.preventDefault||r.defaultPrevented,userData:e.userData},e.scrollHandler(s)),r.stopPropagation&&t.stopEvent(n),(s&&s.preventDefault||r.preventDefault&&!r.defaultPrevented)&&t.cancelEvent(n)}function M(e,i){var n={id:t.MouseTracker.mousePointerId,type:"mouse"},o={originalEvent:i,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:!1};it(e,o),i.target===e.element&&nt(e,n,!1),o.stopPropagation&&t.stopEvent(i)}function L(e,i){var n,o,r,s=i.changedTouches.length,a=e.getActivePointersListByType("touch");n=t.now(),a.getLength()>i.touches.length-s&&t.console.warn("Tracked touch contact count doesn't match event.touches.length");var l={originalEvent:i,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(it(e,l),o=0;o<s;o++)ot(e,l,r={id:i.changedTouches[o].identifier,type:"touch",isPrimary:0===a.getLength(),currentPos:y(i.changedTouches[o]),currentTime:n}),st(e,l,r,0),nt(e,r,!0);l.preventDefault&&!l.defaultPrevented&&t.cancelEvent(i),l.stopPropagation&&t.stopEvent(i)}function A(e,i){var n,o,r,s=i.changedTouches.length;n=t.now();var a={originalEvent:i,eventType:"pointerup",pointerType:"touch",isEmulated:!1};for(it(e,a),o=0;o<s;o++)at(e,a,r={id:i.changedTouches[o].identifier,type:"touch",currentPos:y(i.changedTouches[o]),currentTime:n},0),nt(e,r,!1),rt(e,a,r);a.preventDefault&&!a.defaultPrevented&&t.cancelEvent(i),a.stopPropagation&&t.stopEvent(i)}function B(e,i){var n,o,r=i.changedTouches.length;n=t.now();var s={originalEvent:i,eventType:"pointermove",pointerType:"touch",isEmulated:!1};for(it(e,s),o=0;o<r;o++)lt(e,s,{id:i.changedTouches[o].identifier,type:"touch",currentPos:y(i.changedTouches[o]),currentTime:n});s.preventDefault&&!s.defaultPrevented&&t.cancelEvent(i),s.stopPropagation&&t.stopEvent(i)}function H(e,i){var n,o=i.changedTouches.length,r={originalEvent:i,eventType:"pointercancel",pointerType:"touch",isEmulated:!1};for(it(e,r),n=0;n<o;n++)ct(e,r,{id:i.changedTouches[n].identifier,type:"touch"});r.stopPropagation&&t.stopEvent(i)}function j(e,i){return t.eventIsCanceled(i)||i.preventDefault(),!1}function z(e,i){return t.eventIsCanceled(i)||i.preventDefault(),!1}function N(e,i){var n={originalEvent:i,eventType:"gotpointercapture",pointerType:v(i),isEmulated:!1};it(e,n),i.target===e.element&&nt(e,{id:i.pointerId,type:v(i)},!0),n.stopPropagation&&t.stopEvent(i)}function F(e,i){var n={originalEvent:i,eventType:"lostpointercapture",pointerType:v(i),isEmulated:!1};it(e,n),i.target===e.element&&nt(e,{id:i.pointerId,type:v(i)},!1),n.stopPropagation&&t.stopEvent(i)}function V(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerenter",pointerType:n.type,isEmulated:!1};it(e,o),ot(e,o,n)}function W(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerleave",pointerType:n.type,isEmulated:!1};it(e,o),rt(e,o,n)}function U(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerover",pointerType:n.type,isEmulated:!1};it(e,o),function(t,e,i){var n,o;n=t.getActivePointersListByType(i.type),(o=n.getById(i.id))?i=o:(i.captured=!1,i.insideElementPressed=!1);t.overHandler&&t.overHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function G(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerout",pointerType:n.type,isEmulated:!1};it(e,o),function(t,e,i){var n,o;n=t.getActivePointersListByType(i.type),(o=n.getById(i.id))?i=o:(i.captured=!1,i.insideElementPressed=!1);t.outHandler&&t.outHandler({eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function Z(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o=t.MouseTracker.havePointerEvents&&"touch"===n.type&&t.Browser.vendor!==t.BROWSERS.IE,r={originalEvent:i,eventType:"pointerdown",pointerType:n.type,isEmulated:!1};it(e,r),st(e,r,n,i.button),r.preventDefault&&!r.defaultPrevented&&t.cancelEvent(i),r.stopPropagation&&t.stopEvent(i),r.shouldCapture&&(o?nt(e,n,!0):function(e,i){var n;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents)try{e.element.setPointerCapture(i.id)}catch(o){return void t.console.warn("setPointerCapture() called on invalid pointer ID")}else e.element.setCapture(!0);else n=d(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),c&&u(window.top)&&t.addEvent(window.top,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0);nt(e,i,!0)}(e,n))}function q(t,e){K(t,e)}function $(e,i){e.getActivePointersListByType(v(i)).getById(i.pointerId)&&K(e,i),t.stopEvent(i)}function K(e,i){var n,o={originalEvent:i,eventType:"pointerup",pointerType:(n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()}).type,isEmulated:!1};it(e,o),at(e,o,n,i.button),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i),o.shouldReleaseCapture&&(i.target===e.element?f(e,n):nt(e,n,!1))}function X(t,e){J(t,e)}function Y(e,i){e.getActivePointersListByType(v(i)).getById(i.pointerId)&&J(e,i),t.stopEvent(i)}function J(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointermove",pointerType:n.type,isEmulated:!1};it(e,o),lt(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function Q(e,i){var n={id:i.pointerId,type:v(i)},o={originalEvent:i,eventType:"pointercancel",pointerType:n.type,isEmulated:!1};it(e,o),ct(e,o,n),o.stopPropagation&&t.stopEvent(i)}function tt(t,e){return e.speed=0,e.direction=0,e.contactPos=e.currentPos,e.contactTime=e.currentTime,e.lastPos=e.currentPos,e.lastTime=e.currentTime,t.add(e)}function et(e,i,n){var o,r=i.getById(n.id);return r?(r.captured&&(t.console.warn("stopTrackingPointer() called on captured pointer"),f(e,r)),i.removeContact(),o=i.removeById(n.id)):o=i.getLength(),o}function it(e,i){i.eventSource=e,i.eventPhase=i.originalEvent&&void 0!==i.originalEvent.eventPhase?i.originalEvent.eventPhase:0,i.defaultPrevented=t.eventIsCanceled(i.originalEvent),i.shouldCapture=!1,i.shouldReleaseCapture=!1,i.userData=e.userData,function(t,e){switch(e.eventType){case"pointermove":case"pointerdown":case"pointerup":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasGestureHandlers,e.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"wheel":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasScrollHandler,e.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":e.isStoppable=!0,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"click":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.clickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;case"dblclick":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.dblClickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;default:e.isStoppable=!1,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1}}(e,i),e.preProcessEventHandler&&e.preProcessEventHandler(i)}function nt(e,i,n){var o=e.getActivePointersListByType(i.type),r=o.getById(i.id);r?n&&!r.captured?(r.captured=!0,o.captureCount++):!n&&r.captured&&(r.captured=!1,o.captureCount--,o.captureCount<0&&(o.captureCount=0,t.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):t.console.warn("updatePointerCaptured() called on untracked pointer")}function ot(t,e,i){var n,o=t.getActivePointersListByType(i.type);(n=o.getById(i.id))?(n.insideElement=!0,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime,i=n):(i.captured=!1,i.insideElementPressed=!1,i.insideElement=!0,tt(o,i)),t.enterHandler&&t.enterHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:o.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==o.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}function rt(t,e,i){var n,o,r=t.getActivePointersListByType(i.type);(n=r.getById(i.id))?(n.captured?(n.insideElement=!1,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime):et(t,r,n),i=n):(i.captured=!1,i.insideElementPressed=!1),(t.leaveHandler||t.exitHandler)&&(o={eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:r.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==r.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData},t.leaveHandler&&t.leaveHandler(o),t.exitHandler&&t.exitHandler(o))}function st(e,n,o,r){var s,a=i[e.hash],l=e.getActivePointersListByType(o.type);if(void 0!==n.originalEvent.buttons?l.buttons=n.originalEvent.buttons:0===r?l.buttons|=1:1===r?l.buttons|=4:2===r?l.buttons|=2:3===r?l.buttons|=8:4===r?l.buttons|=16:5===r&&(l.buttons|=32),0!==r)return n.shouldCapture=!1,n.shouldReleaseCapture=!1,void(!e.nonPrimaryPressHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryPressHandler({eventSource:e,pointerType:o.type,position:x(o.currentPos,e.element),button:r,buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData})));(s=l.getById(o.id))?(s.insideElementPressed=!0,s.insideElement=!0,s.originalTarget=n.originalEvent.target,s.contactPos=o.currentPos,s.contactTime=o.currentTime,s.lastPos=s.currentPos,s.lastTime=s.currentTime,s.currentPos=o.currentPos,s.currentTime=o.currentTime,o=s):(o.captured=!1,o.insideElementPressed=!0,o.insideElement=!0,o.originalTarget=n.originalEvent.target,tt(l,o)),l.addContact(),n.preventGesture||n.defaultPrevented?(n.shouldCapture=!1,n.shouldReleaseCapture=!1):(n.shouldCapture=!0,n.shouldReleaseCapture=!1,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.addPoint(e,o),1===l.contacts?e.pressHandler&&!n.preventGesture&&e.pressHandler({eventSource:e,pointerType:o.type,position:x(o.contactPos,e.element),buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData}):2===l.contacts&&e.pinchHandler&&"touch"===o.type&&(a.pinchGPoints=l.asArray(),a.lastPinchDist=a.currentPinchDist=a.pinchGPoints[0].currentPos.distanceTo(a.pinchGPoints[1].currentPos),a.lastPinchCenter=a.currentPinchCenter=b(a.pinchGPoints[0].currentPos,a.pinchGPoints[1].currentPos)))}function at(e,n,o,r){var s,a,l,c,u=i[e.hash],h=e.getActivePointersListByType(o.type),p=!1;if(void 0!==n.originalEvent.buttons?h.buttons=n.originalEvent.buttons:0===r?h.buttons^=-2:1===r?h.buttons^=-5:2===r?h.buttons^=-3:3===r?h.buttons^=-9:4===r?h.buttons^=-17:5===r&&(h.buttons^=-33),n.shouldCapture=!1,0!==r)return n.shouldReleaseCapture=!1,void(!e.nonPrimaryReleaseHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryReleaseHandler({eventSource:e,pointerType:o.type,position:x(o.currentPos,e.element),button:r,buttons:h.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData})));(l=h.getById(o.id))?(h.removeContact(),l.captured&&(p=!0),l.lastPos=l.currentPos,l.lastTime=l.currentTime,l.currentPos=o.currentPos,l.currentTime=o.currentTime,l.insideElement||et(e,h,l),s=l.currentPos,a=l.currentTime):(o.captured=!1,o.insideElementPressed=!1,o.insideElement=!0,tt(h,o),l=o),n.preventGesture||n.defaultPrevented||(p?(n.shouldReleaseCapture=!0,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.removePoint(e,l),0===h.contacts?(e.releaseHandler&&s&&e.releaseHandler({eventSource:e,pointerType:l.type,position:x(s,e.element),buttons:h.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),e.dragEndHandler&&u.sentDragEvent&&e.dragEndHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),speed:l.speed,direction:l.direction,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.sentDragEvent=!1,(e.clickHandler||e.dblClickHandler)&&l.insideElement&&(c=a-l.contactTime<=e.clickTimeThreshold&&l.contactPos.distanceTo(s)<=e.clickDistThreshold,e.clickHandler&&e.clickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),quick:c,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,originalTarget:l.originalTarget,userData:e.userData}),e.dblClickHandler&&c&&(h.clicks++,1===h.clicks?(u.lastClickPos=s,u.dblClickTimeOut=setTimeout((function(){h.clicks=0}),e.dblClickTimeThreshold)):2===h.clicks&&(clearTimeout(u.dblClickTimeOut),h.clicks=0,u.lastClickPos.distanceTo(s)<=e.dblClickDistThreshold&&e.dblClickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.lastClickPos=null)))):2===h.contacts&&e.pinchHandler&&"touch"===l.type&&(u.pinchGPoints=h.asArray(),u.lastPinchDist=u.currentPinchDist=u.pinchGPoints[0].currentPos.distanceTo(u.pinchGPoints[1].currentPos),u.lastPinchCenter=u.currentPinchCenter=b(u.pinchGPoints[0].currentPos,u.pinchGPoints[1].currentPos))):(n.shouldReleaseCapture=!1,e.releaseHandler&&s&&(e.releaseHandler({eventSource:e,pointerType:l.type,position:x(s,e.element),buttons:h.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),n.preventDefault=!0)))}function lt(t,e,n){var o,r,s,a=i[t.hash],l=t.getActivePointersListByType(n.type);void 0!==e.originalEvent.buttons&&(l.buttons=e.originalEvent.buttons),(o=l.getById(n.id))&&(o.lastPos=o.currentPos,o.lastTime=o.currentTime,o.currentPos=n.currentPos,o.currentTime=n.currentTime,e.shouldCapture=!1,e.shouldReleaseCapture=!1,t.stopHandler&&"mouse"===n.type&&(clearTimeout(t.stopTimeOut),t.stopTimeOut=setTimeout((function(){!function(t,e,i){t.stopHandler&&t.stopHandler({eventSource:t,pointerType:i,position:w(e,t.element),buttons:t.getActivePointersListByType(i).buttons,isTouchEvent:"touch"===i,originalEvent:e,userData:t.userData})}(t,e.originalEvent,n.type)}),t.stopDelay)),0===l.contacts?t.moveHandler&&t.moveHandler({eventSource:t,pointerType:n.type,position:x(n.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===n.type,originalEvent:e.originalEvent,userData:t.userData}):1===l.contacts?(t.moveHandler&&(o=l.asArray()[0],t.moveHandler({eventSource:t,pointerType:o.type,position:x(o.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:e.originalEvent,userData:t.userData})),!t.dragHandler||e.preventGesture||e.defaultPrevented||(s=(o=l.asArray()[0]).currentPos.minus(o.lastPos),t.dragHandler({eventSource:t,pointerType:o.type,position:x(o.currentPos,t.element),buttons:l.buttons,delta:s,speed:o.speed,direction:o.direction,shift:e.originalEvent.shiftKey,isTouchEvent:"touch"===o.type,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0,a.sentDragEvent=!0)):2===l.contacts&&(t.moveHandler&&(r=l.asArray(),t.moveHandler({eventSource:t,pointerType:r[0].type,position:x(b(r[0].currentPos,r[1].currentPos),t.element),buttons:l.buttons,isTouchEvent:"touch"===r[0].type,originalEvent:e.originalEvent,userData:t.userData})),!t.pinchHandler||"touch"!==n.type||e.preventGesture||e.defaultPrevented||(s=a.pinchGPoints[0].currentPos.distanceTo(a.pinchGPoints[1].currentPos))!==a.currentPinchDist&&(a.lastPinchDist=a.currentPinchDist,a.currentPinchDist=s,a.lastPinchCenter=a.currentPinchCenter,a.currentPinchCenter=b(a.pinchGPoints[0].currentPos,a.pinchGPoints[1].currentPos),t.pinchHandler({eventSource:t,pointerType:"touch",gesturePoints:a.pinchGPoints,lastCenter:x(a.lastPinchCenter,t.element),center:x(a.currentPinchCenter,t.element),lastDistance:a.lastPinchDist,distance:a.currentPinchDist,shift:e.originalEvent.shiftKey,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0)))}function ct(t,e,i){var n,o=t.getActivePointersListByType(i.type);(n=o.getById(i.id))&&et(t,o,n)}t.MouseTracker.gesturePointVelocityTracker=(n=[],o=0,r=0,s=function(t,e){return t.hash.toString()+e.type+e.id.toString()},a=function(){var e,i,o,s,a,l,c=n.length,u=t.now();for(s=u-r,r=u,e=0;e<c;e++)(o=(i=n[e]).gPoint).direction=Math.atan2(o.currentPos.y-i.lastPos.y,o.currentPos.x-i.lastPos.x),a=i.lastPos.distanceTo(o.currentPos),i.lastPos=o.currentPos,l=1e3*a/(s+1),o.speed=.75*l+.25*o.speed},{addPoint:function(e,i){var l=s(e,i);n.push({guid:l,gPoint:i,lastPos:i.currentPos}),1===n.length&&(r=t.now(),o=window.setInterval(a,50))},removePoint:function(t,e){var i,r=s(t,e),a=n.length;for(i=0;i<a;i++)if(n[i].guid===r){n.splice(i,1),0==--a&&window.clearInterval(o);break}}}),t.MouseTracker.captureElement=document,t.MouseTracker.wheelEventName=t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version>8||"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",t.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",t.MouseTracker.wheelEventName],"DOMMouseScroll"===t.MouseTracker.wheelEventName&&t.MouseTracker.subscribeEvents.push("MozMousePixelScroll"),window.PointerEvent?(t.MouseTracker.havePointerEvents=!0,t.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel"),t.MouseTracker.havePointerCapture=(l=document.createElement("div"),t.isFunction(l.setPointerCapture)&&t.isFunction(l.releasePointerCapture)),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")):(t.MouseTracker.havePointerEvents=!1,t.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove"),t.MouseTracker.mousePointerId="legacy-mouse",t.MouseTracker.havePointerCapture=function(){var e=document.createElement("div");return t.isFunction(e.setCapture)&&t.isFunction(e.releaseCapture)}(),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("losecapture"),"ontouchstart"in window&&t.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel"),"ongesturestart"in window&&t.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")),t.MouseTracker.GesturePointList=function(t){this._gPoints=[],this.type=t,this.buttons=0,this.contacts=0,this.clicks=0,this.captureCount=0},t.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(t){return this._gPoints.push(t)},removeById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t){this._gPoints.splice(e,1);break}return this._gPoints.length},getByIndex:function(t){return t<this._gPoints.length?this._gPoints[t]:null},getById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t)return this._gPoints[e];return null},getPrimary:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].isPrimary)return this._gPoints[e];return null},addContact:function(){++this.contacts,this.contacts>1&&("mouse"===this.type||"pen"===this.type)&&(t.console.warn("GesturePointList.addContact() Implausible contacts value"),this.contacts=1)},removeContact:function(){--this.contacts,this.contacts<0&&(this.contacts=0)}}}(l),function(t){t.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},t.Control=function(e,i,n){var o=e.parentNode;"number"==typeof i&&(t.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=e,this.anchor=i.anchor,this.container=n,this.anchor===t.ControlAnchor.ABSOLUTE?(this.wrapper=t.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%"):(this.wrapper=t.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===t.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),i.attachToViewer?this.anchor===t.ControlAnchor.TOP_RIGHT||this.anchor===t.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):o.appendChild(this.wrapper)},t.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==t.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return"none"!==this.wrapper.style.display},setVisible:function(e){this.wrapper.style.display=e?this.anchor===t.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(e){this.element[t.SIGNAL]&&t.Browser.vendor===t.BROWSERS.IE?t.setElementOpacity(this.element,e,!0):t.setElementOpacity(this.wrapper,e,!0)}}}(l),function(t){function e(t,e){var i,n=t.controls;for(i=n.length-1;i>=0;i--)if(n[i].element===e)return i;return-1}t.ControlDock=function(e){var i,n,o=["topleft","topright","bottomright","bottomleft"];for(t.extend(!0,this,{id:"controldock-"+t.now()+"-"+Math.floor(1e6*Math.random()),container:t.makeNeutralElement("div"),controls:[]},e),this.container.onsubmit=function(){return!1},this.element&&(this.element=t.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),n=0;n<o.length;n++)i=o[n],this.controls[i]=t.makeNeutralElement("div"),this.controls[i].style.position="absolute",i.match("left")&&(this.controls[i].style.left="0px"),i.match("right")&&(this.controls[i].style.right="0px"),i.match("top")&&(this.controls[i].style.top="0px"),i.match("bottom")&&(this.controls[i].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)},t.ControlDock.prototype={addControl:function(i,n){var o=null;if(!(e(this,i=t.getElement(i))>=0)){switch(n.anchor){case t.ControlAnchor.TOP_RIGHT:o=this.controls.topright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.BOTTOM_RIGHT:o=this.controls.bottomright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.BOTTOM_LEFT:o=this.controls.bottomleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.TOP_LEFT:o=this.controls.topleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.ABSOLUTE:default:case t.ControlAnchor.NONE:o=this.container,i.style.margin="0px",i.style.padding="0px"}this.controls.push(new t.Control(i,n,o)),i.style.display="inline-block"}},removeControl:function(i){var n=e(this,i=t.getElement(i));return n>=0&&(this.controls[n].destroy(),this.controls.splice(n,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var t;for(t=this.controls.length-1;t>=0;t--)if(this.controls[t].isVisible())return!0;return!1},setControlsEnabled:function(t){var e;for(e=this.controls.length-1;e>=0;e--)this.controls[e].setVisible(t);return this}}}(l),function(t){t.Placement=t.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}}})}(l),function(t){var e={},i=1;function n(e){return e=t.getElement(e),new t.Point(0===e.clientWidth?1:e.clientWidth,0===e.clientHeight?1:e.clientHeight)}function o(e,i){if(i instanceof t.Overlay)return i;var n=null;if(i.element)n=t.getElement(i.element);else{var o=i.id?i.id:"openseadragon-overlay-"+Math.floor(1e7*Math.random());(n=t.getElement(i.id))||((n=document.createElement("a")).href="#/overlay/"+o),n.id=o,t.addClass(n,i.className?i.className:"openseadragon-overlay")}var r=i.location,s=i.width,a=i.height;if(!r){var l=i.x,c=i.y;if(void 0!==i.px){var u=e.viewport.imageToViewportRectangle(new t.Rect(i.px,i.py,s||0,a||0));l=u.x,c=u.y,s=void 0!==s?u.width:void 0,a=void 0!==a?u.height:void 0}r=new t.Point(l,c)}var h=i.placement;return h&&"string"===t.type(h)&&(h=t.Placement[i.placement.toUpperCase()]),new t.Overlay({element:n,location:r,placement:h,onDraw:i.onDraw,checkResize:i.checkResize,width:s,height:a,rotationMode:i.rotationMode})}function r(t,e){var i;for(i=t.length-1;i>=0;i--)if(t[i].element===e)return i;return-1}function s(e,i){return t.requestAnimationFrame((function(){i(e)}))}function a(e){t.requestAnimationFrame((function(){!function(e){var i,n;if(e.controlsShouldFade){for(i=1-(t.now()-e.controlsFadeBeginTime)/e.controlsFadeLength,i=Math.min(1,i),i=Math.max(0,i),n=e.controls.length-1;n>=0;n--)e.controls[n].autoFade&&e.controls[n].setOpacity(i);i>0&&a(e)}}(e)}))}function l(e){e.autoHideControls&&(e.controlsShouldFade=!0,e.controlsFadeBeginTime=t.now()+e.controlsFadeDelay,window.setTimeout((function(){a(e)}),e.controlsFadeDelay))}function c(t){var e;for(t.controlsShouldFade=!1,e=t.controls.length-1;e>=0;e--)t.controls[e].setOpacity(1)}function u(){c(this)}function h(){l(this)}function p(t){var e={tracker:t.eventSource,position:t.position,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.raiseEvent("canvas-contextmenu",e),t.preventDefault=e.preventDefault}function d(e){var i={originalEvent:e.originalEvent,preventDefaultAction:!1,preventVerticalPan:e.preventVerticalPan||!this.panVertical,preventHorizontalPan:e.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",i),i.preventDefaultAction||e.ctrl||e.alt||e.meta)e.preventDefault=!1;else switch(e.keyCode){case 38:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 40:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 37:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 39:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;default:e.preventDefault=!1}}function f(e){var i={originalEvent:e.originalEvent,preventDefaultAction:!1,preventVerticalPan:e.preventVerticalPan||!this.panVertical,preventHorizontalPan:e.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",i),i.preventDefaultAction||e.ctrl||e.alt||e.meta)e.preventDefault=!1;else switch(e.keyCode){case 43:case 61:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 45:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 119:case 87:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 115:case 83:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 97:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 100:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 114:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 82:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 102:this.viewport.toggleFlip(),e.preventDefault=!0;break;case 106:this.goToPreviousPage();break;case 107:this.goToNextPage();break;default:e.preventDefault=!1}}function g(i){var n;document.activeElement===this.canvas||this.canvas.focus(),this.viewport.flipped&&(i.position.x=this.viewport.getContainerSize().x-i.position.x);var o={tracker:i.eventSource,position:i.position,quick:i.quick,shift:i.shift,originalEvent:i.originalEvent,originalTarget:i.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",o),!o.preventDefaultAction&&this.viewport&&i.quick&&(!0===(n=this.gestureSettingsByDeviceType(i.pointerType)).clickToZoom&&(this.viewport.zoomBy(i.shift?1/this.zoomPerClick:this.zoomPerClick,n.zoomToRefPoint?this.viewport.pointFromPixel(i.position,!0):null),this.viewport.applyConstraints()),n.dblClickDragToZoom&&(!0===e[this.hash].draggingToZoom?(e[this.hash].lastClickTime=null,e[this.hash].draggingToZoom=!1):e[this.hash].lastClickTime=t.now()))}function v(t){var e,i={tracker:t.eventSource,position:t.position,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",i),!i.preventDefaultAction&&this.viewport&&(e=this.gestureSettingsByDeviceType(t.pointerType)).dblClickToZoom&&(this.viewport.zoomBy(t.shift?1/this.zoomPerClick:this.zoomPerClick,e.zoomToRefPoint?this.viewport.pointFromPixel(t.position,!0):null),this.viewport.applyConstraints())}function m(t){var i,n={tracker:t.eventSource,pointerType:t.pointerType,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",n),i=this.gestureSettingsByDeviceType(t.pointerType),!n.preventDefaultAction&&this.viewport)if(i.dblClickDragToZoom&&e[this.hash].draggingToZoom){var o=Math.pow(this.zoomPerDblClickDrag,t.delta.y/50);this.viewport.zoomBy(o)}else if(i.dragToPan&&!e[this.hash].draggingToZoom){if(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewport.flipped&&(t.delta.x=-t.delta.x),this.constrainDuringPan){var r=this.viewport.deltaPointsFromPixels(t.delta.negate());this.viewport.centerSpringX.target.value+=r.x,this.viewport.centerSpringY.target.value+=r.y;var s=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=r.x,this.viewport.centerSpringY.target.value-=r.y,s.xConstrained&&(t.delta.x=0),s.yConstrained&&(t.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta.negate()),i.flickEnabled&&!this.constrainDuringPan)}}function y(i){var n,o={tracker:i.eventSource,pointerType:i.pointerType,position:i.position,speed:i.speed,direction:i.direction,shift:i.shift,originalEvent:i.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",o),n=this.gestureSettingsByDeviceType(i.pointerType),!o.preventDefaultAction&&this.viewport){if(!e[this.hash].draggingToZoom&&n.flickEnabled&&i.speed>=n.flickMinSpeed){var r=0;this.panHorizontal&&(r=n.flickMomentum*i.speed*Math.cos(i.direction));var s=0;this.panVertical&&(s=n.flickMomentum*i.speed*Math.sin(i.direction));var a=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),l=this.viewport.pointFromPixel(new t.Point(a.x-r,a.y-s));this.viewport.panTo(l,!1)}this.viewport.applyConstraints()}n.dblClickDragToZoom&&!0===e[this.hash].draggingToZoom&&(e[this.hash].draggingToZoom=!1)}function w(t){this.raiseEvent("canvas-enter",{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 x(t){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 b(i){if(this.raiseEvent("canvas-press",{tracker:i.eventSource,pointerType:i.pointerType,position:i.position,insideElementPressed:i.insideElementPressed,insideElementReleased:i.insideElementReleased,originalEvent:i.originalEvent}),this.gestureSettingsByDeviceType(i.pointerType).dblClickDragToZoom){var n=e[this.hash].lastClickTime,o=t.now();if(null===n)return;o-n<this.dblClickTimeThreshold&&(e[this.hash].draggingToZoom=!0),e[this.hash].lastClickTime=null}}function T(t){this.raiseEvent("canvas-release",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,insideElementPressed:t.insideElementPressed,insideElementReleased:t.insideElementReleased,originalEvent:t.originalEvent})}function S(t){this.raiseEvent("canvas-nonprimary-press",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function P(t){this.raiseEvent("canvas-nonprimary-release",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function E(t){var e,i,n,o={tracker:t.eventSource,pointerType:t.pointerType,gesturePoints:t.gesturePoints,lastCenter:t.lastCenter,center:t.center,lastDistance:t.lastDistance,distance:t.distance,shift:t.shift,originalEvent:t.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",o),this.viewport&&(!(e=this.gestureSettingsByDeviceType(t.pointerType)).pinchToZoom||o.preventDefaultPanAction&&o.preventDefaultZoomAction||(i=this.viewport.pointFromPixel(t.center,!0),e.zoomToRefPoint&&!o.preventDefaultPanAction&&(n=this.viewport.pointFromPixel(t.lastCenter,!0).minus(i),this.panHorizontal||(n.x=0),this.panVertical||(n.y=0),this.viewport.panBy(n,!0)),o.preventDefaultZoomAction||this.viewport.zoomBy(t.distance/t.lastDistance,i,!0),this.viewport.applyConstraints()),e.pinchRotate&&!o.preventDefaultRotateAction)){var r=Math.atan2(t.gesturePoints[0].currentPos.y-t.gesturePoints[1].currentPos.y,t.gesturePoints[0].currentPos.x-t.gesturePoints[1].currentPos.x),s=Math.atan2(t.gesturePoints[0].lastPos.y-t.gesturePoints[1].lastPos.y,t.gesturePoints[0].lastPos.x-t.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(r-s)*(180/Math.PI))}}function C(e){var i,n,o,r;(r=t.now())-this._lastScrollTime>this.minScrollDeltaTime?(this._lastScrollTime=r,i={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",i),!i.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x),(n=this.gestureSettingsByDeviceType(e.pointerType)).scrollToZoom&&(o=Math.pow(this.zoomPerScroll,e.scroll),this.viewport.zoomBy(o,n.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null),this.viewport.applyConstraints())),e.preventDefault=i.preventDefault):e.preventDefault=!0}function R(t){e[this.hash].mouseInside=!0,c(this),this.raiseEvent("container-enter",{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){t.pointers<1&&(e[this.hash].mouseInside=!1,e[this.hash].animating||l(this)),this.raiseEvent("container-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 O(i){!function(i){if(i._opening||!e[i.hash])return;if(i.autoResize||e[i.hash].forceResize){var o;if(i._autoResizePolling){o=n(i.container);var r=e[i.hash].prevContainerSize;o.equals(r)||(e[i.hash].needsResize=!0)}e[i.hash].needsResize&&function(i,n){var o,r=i.viewport,s=r.getZoom(),a=r.getCenter();if(r.resize(n,i.preserveImageSizeOnResize),r.panTo(a,!0),i.preserveImageSizeOnResize)o=e[i.hash].prevContainerSize.x/n.x;else{var l=new t.Point(0,0),c=new t.Point(e[i.hash].prevContainerSize.x,e[i.hash].prevContainerSize.y).distanceTo(l);o=new t.Point(n.x,n.y).distanceTo(l)/c*e[i.hash].prevContainerSize.x/n.x}r.zoomTo(s*o,null,!0),e[i.hash].prevContainerSize=n,e[i.hash].forceRedraw=!0,e[i.hash].needsResize=!1,e[i.hash].forceResize=!1}(i,o||n(i.container))}var s=i.viewport.update(),a=i.world.update()||s;s&&i.raiseEvent("viewport-change");i.referenceStrip&&(a=i.referenceStrip.update(i.viewport)||a);var u=e[i.hash].animating;!u&&a&&(i.raiseEvent("animation-start"),c(i));var h=u&&!a;h&&(e[i.hash].animating=!1);(a||h||e[i.hash].forceRedraw||i.world.needsDraw())&&(!function(t){t.imageLoader.clear(),t.drawer.clear(),t.world.draw(),t.raiseEvent("update-viewport",{})}(i),i._drawOverlays(),i.navigator&&i.navigator.update(i.viewport),e[i.hash].forceRedraw=!1,a&&i.raiseEvent("animation"));h&&(i.raiseEvent("animation-finish"),e[i.hash].mouseInside||l(i));e[i.hash].animating=a}(i),i.isOpen()?i._updateRequestId=s(i,O):i._updateRequestId=!1}function I(t,e){return t?t+e:e}function D(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=this.zoomPerSecond,e[this.hash].zooming=!0,L(this)}function k(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=1/this.zoomPerSecond,e[this.hash].zooming=!0,L(this)}function M(){e[this.hash].zooming=!1}function L(e){t.requestAnimationFrame(t.delegate(e,A))}function A(){var i,n,o;e[this.hash].zooming&&this.viewport&&(n=(i=t.now())-e[this.hash].lastZoomTime,o=Math.pow(e[this.hash].zoomFactor,n/1e3),this.viewport.zoomBy(o),this.viewport.applyConstraints(),e[this.hash].lastZoomTime=i,L(this))}function B(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function H(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function j(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function z(){this.viewport&&this.viewport.goHome()}function N(){this.isFullPage()&&!t.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage()),this.buttonGroup&&this.buttonGroup.emulateLeave(),this.fullPageButton.element.focus(),this.viewport&&this.viewport.applyConstraints()}function F(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t+=this.rotationIncrement:t-=this.rotationIncrement,this.viewport.setRotation(t)}}function V(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t-=this.rotationIncrement:t+=this.rotationIncrement,this.viewport.setRotation(t)}}function W(){this.viewport.toggleFlip()}t.Viewer=function(o){var r,a,c=arguments,u=this;if(t.isPlainObject(o)||(o={id:c[0],xmlPath:c.length>1?c[1]:void 0,prefixUrl:c.length>2?c[2]:void 0,controls:c.length>3?c[3]:void 0,overlays:c.length>4?c[4]:void 0}),o.config&&(t.extend(!0,o,o.config),delete o.config),t.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,buttonGroup:null,profiler:null},t.DEFAULT_SETTINGS,o),void 0===this.hash)throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(void 0!==e[this.hash]&&t.console.warn("Hash "+this.hash+" has already been used."),e[this.hash]={fsBoundsDelta:new t.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=t.now(),t.EventSource.call(this),this.addHandler("open-failed",(function(e){var i=t.getString("Errors.OpenFailed",e.eventSource,e.message);u._showMessage(i)})),t.ControlDock.call(this,o),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=t.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",(a=this.canvas.style).width="100%",a.height="100%",a.overflow="hidden",a.position="absolute",a.top="0px",a.left="0px",t.setElementTouchActionNone(this.canvas),""!==o.tabIndex&&(this.canvas.tabIndex=void 0===o.tabIndex?0:o.tabIndex),this.container.className="openseadragon-container",function(t){t.width="100%",t.height="100%",t.position="relative",t.overflow="hidden",t.left="0px",t.top="0px",t.textAlign="left"}(this.container.style),t.setElementTouchActionNone(this.container),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 t.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:t.delegate(this,p),keyDownHandler:t.delegate(this,d),keyHandler:t.delegate(this,f),clickHandler:t.delegate(this,g),dblClickHandler:t.delegate(this,v),dragHandler:t.delegate(this,m),dragEndHandler:t.delegate(this,y),enterHandler:t.delegate(this,w),leaveHandler:t.delegate(this,x),pressHandler:t.delegate(this,b),releaseHandler:t.delegate(this,T),nonPrimaryPressHandler:t.delegate(this,S),nonPrimaryReleaseHandler:t.delegate(this,P),scrollHandler:t.delegate(this,C),pinchHandler:t.delegate(this,E)}),this.outerTracker=new t.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:t.delegate(this,R),leaveHandler:t.delegate(this,_)}),this.toolbar&&(this.toolbar=new t.ControlDock({element:this.toolbar})),this.bindStandardControls(),e[this.hash].prevContainerSize=n(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver((function(){e[u.hash].needsResize=!0})),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new t.World({viewer:this}),this.world.addHandler("add-item",(function(t){u.source=u.world.getItemAt(0).source,e[u.hash].forceRedraw=!0,u._updateRequestId||(u._updateRequestId=s(u,O))})),this.world.addHandler("remove-item",(function(t){u.world.getItemCount()?u.source=u.world.getItemAt(0).source:u.source=null,e[u.hash].forceRedraw=!0})),this.world.addHandler("metrics-change",(function(t){u.viewport&&u.viewport._setContentBounds(u.world.getHomeBounds(),u.world.getContentFactor())})),this.world.addHandler("item-index-change",(function(t){u.source=u.world.getItemAt(0).source})),this.viewport=new t.Viewport({containerSize:e[this.hash].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,silenceMultiImageWarnings:this.silenceMultiImageWarnings}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new t.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:o.timeout}),this.tileCache=new t.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new t.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=t.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(r=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(r,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(r=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(r,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new t.Navigator({element:this.navigatorElement,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,animationTime:this.animationTime})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),r=0;r<this.customControls.length;r++)this.addControl(this.customControls[r].id,{anchor:this.customControls[r].anchor});t.requestAnimationFrame((function(){l(u)})),void 0===this.imageSmoothingEnabled||this.imageSmoothingEnabled||this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled),t._viewers.set(this.element,this)},t.extend(t.Viewer.prototype,t.EventSource.prototype,t.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(e){return t.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead."),this.open(e)},openTileSource:function(e){return t.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead."),this.open(e)},get buttons(){return t.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup"),this.buttonGroup},open:function(e,i){var n=this;if(this.close(),!e)return this;if(this.sequenceMode&&t.isArray(e))return this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),void 0===i||isNaN(i)||(this.initialPage=i),this.tileSources=e,this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage)),this.tileSources.length&&(this.open(this.tileSources[this._sequenceIndex]),this.showReferenceStrip&&this.addReferenceStrip()),this._updateSequenceButtons(this._sequenceIndex),this;if(t.isArray(e)||(e=[e]),!e.length)return this;this._opening=!0;for(var r,s=e.length,a=0,l=0,c=function(){if(a+l===s)if(a){!n._firstOpen&&n.preserveViewport||(n.viewport.goHome(!0),n.viewport.update()),n._firstOpen=!1;var t=e[0];if(t.tileSource&&(t=t.tileSource),n.overlays&&!n.preserveOverlays)for(var i=0;i<n.overlays.length;i++)n.currentOverlays[i]=o(n,n.overlays[i]);n._drawOverlays(),n._opening=!1,n.raiseEvent("open",{source:t})}else n._opening=!1,n.raiseEvent("open-failed",r)},u=function(e){t.isPlainObject(e)&&e.tileSource||(e={tileSource:e}),void 0!==e.index&&(t.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"),delete e.index),void 0===e.collectionImmediately&&(e.collectionImmediately=!0);var i=e.success;e.success=function(t){if(a++,e.tileSource.overlays)for(var o=0;o<e.tileSource.overlays.length;o++)n.addOverlay(e.tileSource.overlays[o]);i&&i(t),c()};var o=e.error;e.error=function(t){l++,r||(r=t),o&&o(t),c()},n.addTiledImage(e)},h=0;h<e.length;h++)u(e[h]);return this},close:function(){return e[this.hash]?(this._opening=!1,this.navigator&&this.navigator.close(),this.preserveOverlays||(this.clearOverlays(),this.overlaysContainer.innerHTML=""),e[this.hash].animating=!1,this.world.removeAll(),this.imageLoader.clear(),this.raiseEvent("close"),this):this},destroy:function(){if(e[this.hash]){if(this.raiseEvent("before-destroy"),this._removeUpdatePixelDensityRatioEvent(),this.close(),this.clearOverlays(),this.overlaysContainer.innerHTML="",this._resizeObserver&&this._resizeObserver.disconnect(),this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),null!==this._updateRequestId&&(t.cancelAnimationFrame(this._updateRequestId),this._updateRequestId=null),this.drawer&&this.drawer.destroy(),this.navigator&&(this.navigator.destroy(),e[this.navigator.hash]=null,delete e[this.navigator.hash],this.navigator=null),this.buttonGroup)this.buttonGroup.destroy();else if(this.customButtons)for(;this.customButtons.length;)this.customButtons.pop().destroy();if(this.paging&&this.paging.destroy(),this.element)for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.container.onsubmit=null,this.clearControls(),this.innerTracker&&this.innerTracker.destroy(),this.outerTracker&&this.outerTracker.destroy(),e[this.hash]=null,delete e[this.hash],this.canvas=null,this.container=null,t._viewers.delete(this.element),this.element=null,this.raiseEvent("destroy"),this.removeAllHandlers()}},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(t){return this.innerTracker.setTracking(t),this.outerTracker.setTracking(t),this.raiseEvent("mouse-enabled",{enabled:t}),this},areControlsEnabled:function(){var t,e=this.controls.length;for(t=0;t<this.controls.length;t++)e=e&&this.controls[t].isVisible();return e},setControlsEnabled:function(t){return t?c(this):l(this),this.raiseEvent("controls-enabled",{enabled:t}),this},setDebugMode:function(t){for(var e=0;e<this.world.getItemCount();e++)this.world.getItemAt(e).debugMode=t;this.debugMode=t,this.forceRedraw()},isFullPage:function(){return e[this.hash].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 c={fullPage:i,preventDefaultAction:!1};if(this.raiseEvent("pre-full-page",c),c.preventDefaultAction)return this;if(i){for(this.elementSize=t.getElementSize(this.element),this.pageScroll=t.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.bodyDisplay=s.display,s.display="block",this.previousBody=[],e[this.hash].prevElementParent=this.element.parentNode,e[this.hash].prevNextSibling=this.element.nextSibling,e[this.hash].prevElementWidth=this.element.style.width,e[this.hash].prevElementHeight=this.element.style.height,n=r.childNodes.length,o=0;o<n;o++)this.previousBody.push(r.childNodes[0]),r.removeChild(r.childNodes[0]);this.toolbar&&this.toolbar.element&&(this.toolbar.parentNode=this.toolbar.element.parentNode,this.toolbar.nextSibling=this.toolbar.element.nextSibling,r.appendChild(this.toolbar.element),t.addClass(this.toolbar.element,"fullpage")),t.addClass(this.element,"fullpage"),r.appendChild(this.element),this.element.style.height="100vh",this.element.style.width="100vw",this.toolbar&&this.toolbar.element&&(this.element.style.height=t.getElementSize(this.element).y-t.getElementSize(this.toolbar.element).y+"px"),e[this.hash].fullPage=!0,t.delegate(this,R)({})}else{for(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,s.display=this.bodyDisplay,r.removeChild(this.element),n=this.previousBody.length,o=0;o<n;o++)r.appendChild(this.previousBody.shift());t.removeClass(this.element,"fullpage"),e[this.hash].prevElementParent.insertBefore(this.element,e[this.hash].prevNextSibling),this.toolbar&&this.toolbar.element&&(r.removeChild(this.toolbar.element),t.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=e[this.hash].prevElementWidth,this.element.style.height=e[this.hash].prevElementHeight;var u=0,h=function(){t.setPageScroll(l.pageScroll);var e=t.getPageScroll();++u<10&&(e.x!==l.pageScroll.x||e.y!==l.pageScroll.y)&&t.requestAnimationFrame(h)};t.requestAnimationFrame(h),e[this.hash].fullPage=!1,t.delegate(this,_)({})}return this.navigator&&this.viewport&&this.navigator.update(this.viewport),this.raiseEvent("full-page",{fullPage:i}),this},setFullScreen:function(e){var i=this;if(!t.supportsFullScreen)return this.setFullPage(e);if(t.isFullScreen()===e)return this;var n={fullScreen:e,preventDefaultAction:!1};if(this.raiseEvent("pre-full-screen",n),n.preventDefaultAction)return this;if(e){if(this.setFullPage(!0),!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 e=t.isFullScreen();e||(t.removeEvent(document,t.fullScreenEventName,o),t.removeEvent(document,t.fullScreenErrorEventName,o),i.setFullPage(!1),i.isFullPage()&&(i.element.style.width=i.fullPageStyleWidth,i.element.style.height=i.fullPageStyleHeight)),i.navigator&&i.viewport&&setTimeout((function(){i.navigator.update(i.viewport)})),i.raiseEvent("full-screen",{fullScreen:e})};t.addEvent(document,t.fullScreenEventName,o),t.addEvent(document,t.fullScreenErrorEventName,o),t.requestFullScreen(document.body)}else t.exitFullScreen();return this},isVisible:function(){return"hidden"!==this.container.style.visibility},isFullScreen:function(){return t.isFullScreen()&&this.isFullPage()},setVisible:function(t){return this.container.style.visibility=t?"":"hidden",this.raiseEvent("visible",{visible:t}),this},addTiledImage:function(e){t.console.assert(e,"[Viewer.addTiledImage] options is required"),t.console.assert(e.tileSource,"[Viewer.addTiledImage] options.tileSource is required"),t.console.assert(!e.replace||e.index>-1&&e.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var i=this;e.replace&&(e.replaceItem=i.world.getItemAt(e.index)),this._hideMessage(),void 0===e.placeholderFillStyle&&(e.placeholderFillStyle=this.placeholderFillStyle),void 0===e.opacity&&(e.opacity=this.opacity),void 0===e.preload&&(e.preload=this.preload),void 0===e.compositeOperation&&(e.compositeOperation=this.compositeOperation),void 0===e.crossOriginPolicy&&(e.crossOriginPolicy=void 0!==e.tileSource.crossOriginPolicy?e.tileSource.crossOriginPolicy:this.crossOriginPolicy),void 0===e.ajaxWithCredentials&&(e.ajaxWithCredentials=this.ajaxWithCredentials),void 0===e.loadTilesWithAjax&&(e.loadTilesWithAjax=this.loadTilesWithAjax),void 0===e.ajaxHeaders||null===e.ajaxHeaders?e.ajaxHeaders=this.ajaxHeaders:t.isPlainObject(e.ajaxHeaders)&&t.isPlainObject(this.ajaxHeaders)&&(e.ajaxHeaders=t.extend({},this.ajaxHeaders,e.ajaxHeaders));var n={options:e};function o(t){for(var o=0;o<i._loadQueue.length;o++)if(i._loadQueue[o]===n){i._loadQueue.splice(o,1);break}0===i._loadQueue.length&&r(n),i.raiseEvent("add-item-failed",t),e.error&&e.error(t)}function r(t){i.collectionMode&&(i.world.arrange({immediately:t.options.collectionImmediately,rows:i.collectionRows,columns:i.collectionColumns,layout:i.collectionLayout,tileSize:i.collectionTileSize,tileMargin:i.collectionTileMargin}),i.world.setAutoRefigureSizes(!0))}function s(){for(var e,n,o;i._loadQueue.length&&(e=i._loadQueue[0]).tileSource;){if(i._loadQueue.splice(0,1),e.options.replace){var s=i.world.getIndexOfItem(e.options.replaceItem);-1!==s&&(e.options.index=s),i.world.removeItem(e.options.replaceItem)}n=new t.TiledImage({viewer:i,source:e.tileSource,viewport:i.viewport,drawer:i.drawer,tileCache:i.tileCache,imageLoader:i.imageLoader,x:e.options.x,y:e.options.y,width:e.options.width,height:e.options.height,fitBounds:e.options.fitBounds,fitBoundsPlacement:e.options.fitBoundsPlacement,clip:e.options.clip,placeholderFillStyle:e.options.placeholderFillStyle,opacity:e.options.opacity,preload:e.options.preload,degrees:e.options.degrees,flipped:e.options.flipped,compositeOperation:e.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:e.options.crossOriginPolicy,ajaxWithCredentials:e.options.ajaxWithCredentials,loadTilesWithAjax:e.options.loadTilesWithAjax,ajaxHeaders:e.options.ajaxHeaders,debugMode:i.debugMode,subPixelRoundingForTransparency:i.subPixelRoundingForTransparency}),i.collectionMode&&i.world.setAutoRefigureSizes(!1),i.navigator&&(o=t.extend({},e.options,{replace:!1,originalTiledImage:n,tileSource:e.tileSource}),i.navigator.addTiledImage(o)),i.world.addItem(n,{index:e.options.index}),0===i._loadQueue.length&&r(e),1!==i.world.getItemCount()||i.preserveViewport||i.viewport.goHome(!0),e.options.success&&e.options.success({item:n})}}t.isArray(e.tileSource)?setTimeout((function(){o({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:e.tileSource,options:e})})):(this._loadQueue.push(n),function(e,i,n,o,r){var s=e;if("string"===t.type(i))if(i.match(/^\s*<.*>\s*$/))i=t.parseXml(i);else if(i.match(/^\s*[{[].*[}\]]\s*$/))try{var a=t.parseJSON(i);i=a}catch(c){}function l(t,e){t.ready?o(t):(t.addHandler("ready",(function(){o(t)})),t.addHandler("open-failed",(function(t){r({message:t.message,source:e})})))}setTimeout((function(){if("string"===t.type(i))(i=new t.TileSource({url:i,crossOriginPolicy:void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,ajaxHeaders:n.ajaxHeaders?n.ajaxHeaders:e.ajaxHeaders,splitHashDataForPost:e.splitHashDataForPost,useCanvas:e.useCanvas,success:function(t){o(t.tileSource)}})).addHandler("open-failed",(function(t){r(t)}));else if(t.isPlainObject(i)||i.nodeType)if(void 0!==i.crossOriginPolicy||void 0===n.crossOriginPolicy&&void 0===e.crossOriginPolicy||(i.crossOriginPolicy=void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy),void 0===i.ajaxWithCredentials&&(i.ajaxWithCredentials=e.ajaxWithCredentials),void 0===i.useCanvas&&(i.useCanvas=e.useCanvas),t.isFunction(i.getTileUrl)){var a=new t.TileSource(i);a.getTileUrl=i.getTileUrl,o(a)}else{var c=t.TileSource.determineType(s,i);if(!c)return void r({message:"Unable to load TileSource",source:i});var u=c.prototype.configure.apply(s,[i]);l(new c(u),i)}else l(i,i)}))}(this,e.tileSource,e,(function(t){n.tileSource=t,s()}),(function(t){t.options=e,o(t),s()})))},addSimpleImage:function(e){t.console.assert(e,"[Viewer.addSimpleImage] options is required"),t.console.assert(e.url,"[Viewer.addSimpleImage] options.url is required");var i=t.extend({},e,{tileSource:{type:"image",url:e.url}});delete i.url,this.addTiledImage(i)},addLayer:function(e){var i=this;t.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var n=t.extend({},e,{success:function(t){i.raiseEvent("add-layer",{options:e,drawer:t.item})},error:function(t){i.raiseEvent("add-layer-failed",t)}});return this.addTiledImage(n),this},getLayerAtLevel:function(e){return t.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(e)},getLevelOfLayer:function(e){return t.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(e)},getLayersCount:function(){return t.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(e,i){return t.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(e,i)},removeLayer:function(e){return t.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(e)},forceRedraw:function(){return e[this.hash].forceRedraw=!0,this},forceResize:function(){e[this.hash].needsResize=!0,e[this.hash].forceResize=!0},bindSequenceControls:function(){var e=t.delegate(this,u),i=t.delegate(this,h),n=t.delegate(this,this.goToNextPage),o=t.delegate(this,this.goToPreviousPage),r=this.navImages,s=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(s=!1),this.previousButton=new t.Button({element:this.previousButton?t.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.PreviousPage"),srcRest:I(this.prefixUrl,r.previous.REST),srcGroup:I(this.prefixUrl,r.previous.GROUP),srcHover:I(this.prefixUrl,r.previous.HOVER),srcDown:I(this.prefixUrl,r.previous.DOWN),onRelease:o,onFocus:e,onBlur:i}),this.nextButton=new t.Button({element:this.nextButton?t.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.NextPage"),srcRest:I(this.prefixUrl,r.next.REST),srcGroup:I(this.prefixUrl,r.next.GROUP),srcHover:I(this.prefixUrl,r.next.HOVER),srcDown:I(this.prefixUrl,r.next.DOWN),onRelease:n,onFocus:e,onBlur:i}),this.navPrevNextWrap||this.previousButton.disable(),this.tileSources&&this.tileSources.length||this.nextButton.disable(),s&&(this.paging=new t.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.pagingControl=this.paging.element,this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:t.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||t.ControlAnchor.TOP_LEFT}))),this},bindStandardControls:function(){var e=t.delegate(this,D),i=t.delegate(this,M),n=t.delegate(this,B),o=t.delegate(this,k),r=t.delegate(this,H),s=t.delegate(this,z),a=t.delegate(this,N),l=t.delegate(this,F),c=t.delegate(this,V),p=t.delegate(this,W),d=t.delegate(this,u),f=t.delegate(this,h),g=this.navImages,v=[],m=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(m=!1),this.showZoomControl&&(v.push(this.zoomInButton=new t.Button({element:this.zoomInButton?t.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomIn"),srcRest:I(this.prefixUrl,g.zoomIn.REST),srcGroup:I(this.prefixUrl,g.zoomIn.GROUP),srcHover:I(this.prefixUrl,g.zoomIn.HOVER),srcDown:I(this.prefixUrl,g.zoomIn.DOWN),onPress:e,onRelease:i,onClick:n,onEnter:e,onExit:i,onFocus:d,onBlur:f})),v.push(this.zoomOutButton=new t.Button({element:this.zoomOutButton?t.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomOut"),srcRest:I(this.prefixUrl,g.zoomOut.REST),srcGroup:I(this.prefixUrl,g.zoomOut.GROUP),srcHover:I(this.prefixUrl,g.zoomOut.HOVER),srcDown:I(this.prefixUrl,g.zoomOut.DOWN),onPress:o,onRelease:i,onClick:r,onEnter:o,onExit:i,onFocus:d,onBlur:f}))),this.showHomeControl&&v.push(this.homeButton=new t.Button({element:this.homeButton?t.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Home"),srcRest:I(this.prefixUrl,g.home.REST),srcGroup:I(this.prefixUrl,g.home.GROUP),srcHover:I(this.prefixUrl,g.home.HOVER),srcDown:I(this.prefixUrl,g.home.DOWN),onRelease:s,onFocus:d,onBlur:f})),this.showFullPageControl&&v.push(this.fullPageButton=new t.Button({element:this.fullPageButton?t.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.FullPage"),srcRest:I(this.prefixUrl,g.fullpage.REST),srcGroup:I(this.prefixUrl,g.fullpage.GROUP),srcHover:I(this.prefixUrl,g.fullpage.HOVER),srcDown:I(this.prefixUrl,g.fullpage.DOWN),onRelease:a,onFocus:d,onBlur:f})),this.showRotationControl&&(v.push(this.rotateLeftButton=new t.Button({element:this.rotateLeftButton?t.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateLeft"),srcRest:I(this.prefixUrl,g.rotateleft.REST),srcGroup:I(this.prefixUrl,g.rotateleft.GROUP),srcHover:I(this.prefixUrl,g.rotateleft.HOVER),srcDown:I(this.prefixUrl,g.rotateleft.DOWN),onRelease:l,onFocus:d,onBlur:f})),v.push(this.rotateRightButton=new t.Button({element:this.rotateRightButton?t.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateRight"),srcRest:I(this.prefixUrl,g.rotateright.REST),srcGroup:I(this.prefixUrl,g.rotateright.GROUP),srcHover:I(this.prefixUrl,g.rotateright.HOVER),srcDown:I(this.prefixUrl,g.rotateright.DOWN),onRelease:c,onFocus:d,onBlur:f}))),this.showFlipControl&&v.push(this.flipButton=new t.Button({element:this.flipButton?t.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Flip"),srcRest:I(this.prefixUrl,g.flip.REST),srcGroup:I(this.prefixUrl,g.flip.GROUP),srcHover:I(this.prefixUrl,g.flip.HOVER),srcDown:I(this.prefixUrl,g.flip.DOWN),onRelease:p,onFocus:d,onBlur:f})),m?(this.buttonGroup=new t.ButtonGroup({buttons:v,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttonGroup.element,this.addHandler("open",t.delegate(this,j)),this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT})):this.customButtons=v),this},currentPage:function(){return this._sequenceIndex},goToPage:function(t){return this.tileSources&&t>=0&&t<this.tileSources.length&&(this._sequenceIndex=t,this._updateSequenceButtons(t),this.open(this.tileSources[t]),this.referenceStrip&&this.referenceStrip.setFocus(t),this.raiseEvent("page",{page:t})),this},addOverlay:function(e,i,n,s){var a;if(a=t.isPlainObject(e)?e:{element:e,location:i,placement:n,onDraw:s},e=t.getElement(a.element),r(this.currentOverlays,e)>=0)return this;var l=o(this,a);return this.currentOverlays.push(l),l.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:e,location:a.location,placement:a.placement}),this},updateOverlay:function(i,n,o){var s;return i=t.getElement(i),(s=r(this.currentOverlays,i))>=0&&(this.currentOverlays[s].update(n,o),e[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:i,location:n,placement:o})),this},removeOverlay:function(i){var n;return i=t.getElement(i),(n=r(this.currentOverlays,i))>=0&&(this.currentOverlays[n].destroy(),this.currentOverlays.splice(n,1),e[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:i})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return e[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(e){var i;return e=t.getElement(e),(i=r(this.currentOverlays,e))>=0?this.currentOverlays[i]:null},_updateSequenceButtons:function(t){this.nextButton&&(this.tileSources&&this.tileSources.length-1!==t?this.nextButton.enable():this.navPrevNextWrap||this.nextButton.disable()),this.previousButton&&(t>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(e){this._hideMessage();var i=t.makeNeutralElement("div");i.appendChild(document.createTextNode(e)),this.messageDiv=t.makeCenteredNode(i),t.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var t=this.messageDiv;t&&(t.parentNode.removeChild(t),delete this.messageDiv)},gestureSettingsByDeviceType:function(t){switch(t){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var t,e=this.currentOverlays.length;for(t=0;t<e;t++)this.currentOverlays[t].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new t.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,useCanvas:this.useCanvas,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else t.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),t.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){t.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var e=t.pixelDensityRatio,i=t.getCurrentPixelDensityRatio();e!==i&&(t.pixelDensityRatio=i,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var t=this._sequenceIndex-1;this.navPrevNextWrap&&t<0&&(t+=this.tileSources.length),this.goToPage(t)},goToNextPage:function(){var t=this._sequenceIndex+1;this.navPrevNextWrap&&t>=this.tileSources.length&&(t=0),this.goToPage(t)},isAnimating:function(){return e[this.hash].animating}})}(l),function(t){function e(t){var e={tracker:t.eventSource,position:t.position,quick:t.quick,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.viewer.raiseEvent("navigator-click",e),!e.preventDefaultAction&&t.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(t.position.x=this.viewport.getContainerSize().x-t.position.x);var i=this.viewport.pointFromPixel(t.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(t){var e={tracker:t.eventSource,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.viewer.raiseEvent("navigator-drag",e),!e.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewer.viewport.flipped&&(t.delta.x=-t.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function n(t){t.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function o(t){var e={tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.viewer.raiseEvent("navigator-scroll",e),t.preventDefault=e.preventDefault}function r(t,e){s(t,"rotate("+e+"deg)")}function s(t,e){t.style.webkitTransform=e,t.style.mozTransform=e,t.style.msTransform=e,t.style.oTransform=e,t.style.transform=e}t.Navigator=function(s){var a,l,c,u,h=s.viewer,p=this;function d(t){r(p.displayRegionContainer,t),r(p.displayRegion,-t),p.viewport.setRotation(t)}(s.element||s.id?(s.element?(s.id&&t.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),s.element.id?s.id=s.element.id:s.id="navigator-"+t.now(),this.element=s.element):this.element=document.getElementById(s.id),s.controlOptions={anchor:t.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(s.id="navigator-"+t.now(),this.element=t.makeNeutralElement("div"),s.controlOptions={anchor:t.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:s.autoFade},s.position&&("BOTTOM_RIGHT"===s.position?s.controlOptions.anchor=t.ControlAnchor.BOTTOM_RIGHT:"BOTTOM_LEFT"===s.position?s.controlOptions.anchor=t.ControlAnchor.BOTTOM_LEFT:"TOP_RIGHT"===s.position?s.controlOptions.anchor=t.ControlAnchor.TOP_RIGHT:"TOP_LEFT"===s.position?s.controlOptions.anchor=t.ControlAnchor.TOP_LEFT:"ABSOLUTE"===s.position&&(s.controlOptions.anchor=t.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=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.navigatorSizeRatio},s,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:s.animationTime,autoResize:!1,minZoomImageRatio:1,background:s.background,opacity:s.opacity,borderColor:s.borderColor,displayRegionColor:s.displayRegionColor})).minPixelRatio=this.minPixelRatio=h.minPixelRatio,t.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new t.Point(1,1),this.totalBorderWidths=new t.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge),s.controlOptions.anchor!==t.ControlAnchor.NONE&&(c=this.element.style,u=this.borderWidth,c.margin="0px",c.border=u+"px solid "+s.borderColor,c.padding="0px",c.background=s.background,c.opacity=s.opacity,c.overflow="hidden"),this.displayRegion=t.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(t,e){t.position="relative",t.top="0px",t.left="0px",t.fontSize="0px",t.overflow="hidden",t.border=e+"px solid "+s.displayRegionColor,t.margin="0px",t.padding="0px",t.background="transparent",t.float="left",t.cssFloat="left",t.styleFloat="left",t.zIndex=999999999,t.cursor="default"}(this.displayRegion.style,this.borderWidth),t.setElementPointerEventsNone(this.displayRegion),t.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=t.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",t.setElementPointerEventsNone(this.displayRegionContainer),t.setElementTouchActionNone(this.displayRegionContainer),h.addControl(this.element,s.controlOptions),this._resizeWithViewer=s.controlOptions.anchor!==t.ControlAnchor.ABSOLUTE&&s.controlOptions.anchor!==t.ControlAnchor.NONE,s.width&&s.height?(this.setWidth(s.width),this.setHeight(s.height)):this._resizeWithViewer&&(a=t.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=t.getElementSize(this.element),this.elementArea=l.x*l.y),this.oldContainerSize=new t.Point(0,0),t.Viewer.apply(this,[s]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer),s.navigatorRotate)&&(d(s.viewer.viewport?s.viewer.viewport.getRotation():s.viewer.degrees||0),s.viewer.addHandler("rotate",(function(t){d(t.degrees)})));this.innerTracker.destroy(),this.innerTracker=new t.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:t.delegate(this,i),clickHandler:t.delegate(this,e),releaseHandler:t.delegate(this,n),scrollHandler:t.delegate(this,o),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",t.setElementPointerEventsNone(this.canvas),t.setElementPointerEventsNone(this.container),this.addHandler("reset-size",(function(){p.viewport&&p.viewport.goHome(!0)})),h.world.addHandler("item-index-change",(function(t){window.setTimeout((function(){var e=p.world.getItemAt(t.previousIndex);p.world.setItemIndex(e,t.newIndex)}),1)})),h.world.addHandler("remove-item",(function(t){var e=t.item,i=p._getMatchingItem(e);i&&p.world.removeItem(i)})),this.update(h.viewport)},t.extend(t.Navigator.prototype,t.EventSource.prototype,t.Viewer.prototype,{updateSize:function(){if(this.viewport){var e=new t.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);e.equals(this.oldContainerSize)||(this.viewport.resize(e,!0),this.viewport.goHome(!0),this.oldContainerSize=e,this.drawer.clear(),this.world.draw())}},setWidth:function(t){this.width=t,this.element.style.width="number"==typeof t?t+"px":t,this._resizeWithViewer=!1},setHeight:function(t){this.height=t,this.element.style.height="number"==typeof t?t+"px":t,this._resizeWithViewer=!1},setFlip:function(t){return this.viewport.setFlip(t),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(t){s(this.displayRegion,t),s(this.canvas,t),s(this.element,t)},update:function(e){var i,n,o,r,s,a;if(i=t.getElementSize(this.viewer.element),this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)&&(this.oldViewerSize=i,this.maintainSizeRatio||!this.elementArea?(n=i.x*this.sizeRatio,o=i.y*this.sizeRatio):(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()),e&&this.viewport){r=e.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 c=Math.abs(s.x-a.x),u=Math.abs(s.y-a.y);l.width=Math.round(Math.max(c,0))+"px",l.height=Math.round(Math.max(u,0))+"px"}},addTiledImage:function(e){var i=this,n=e.originalTiledImage;delete e.original;var o=t.extend({},e,{success:function(t){var e=t.item;function o(){i._matchBounds(e,n)}e._originalForNavigator=n,i._matchBounds(e,n,!0),i._matchOpacity(e,n),i._matchCompositeOperation(e,n),n.addHandler("bounds-change",o),n.addHandler("clip-change",o),n.addHandler("opacity-change",(function(){i._matchOpacity(e,n)})),n.addHandler("composite-operation-change",(function(){i._matchCompositeOperation(e,n)}))}});return t.Viewer.prototype.addTiledImage.apply(this,[o])},destroy:function(){return t.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(t){for(var e,i=this.world.getItemCount(),n=0;n<i;n++)if((e=this.world.getItemAt(n))._originalForNavigator===t)return e;return null},_matchBounds:function(t,e,i){var n=e.getBoundsNoRotate();t.setPosition(n.getTopLeft(),i),t.setWidth(n.width,i),t.setRotation(e.getRotation(),i),t.setClip(e.getClip()),t.setFlip(e.getFlip())},_matchOpacity:function(t,e){t.setOpacity(e.opacity)},_matchCompositeOperation:function(t,e){t.setCompositeOperation(e.compositeOperation)}})}(l),function(t){var e={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"}};t.extend(t,{getString:function(i){var n,o=i.split("."),r=null,s=arguments,a=e;for(n=0;n<o.length-1;n++)a=a[o[n]]||{};return"string"!=typeof(r=a[o[n]])&&(t.console.error("Untranslated source string:",i),r=""),r.replace(/\{\d+\}/g,(function(t){var e=parseInt(t.match(/\d+/),10)+1;return e<s.length?s[e]:""}))},setString:function(t,i){var n,o=t.split("."),r=e;for(n=0;n<o.length-1;n++)r[o[n]]||(r[o[n]]={}),r=r[o[n]];r[o[n]]=i}})}(l),function(t){t.Point=function(t,e){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0},t.Point.prototype={clone:function(){return new t.Point(this.x,this.y)},plus:function(e){return new t.Point(this.x+e.x,this.y+e.y)},minus:function(e){return new t.Point(this.x-e.x,this.y-e.y)},times:function(e){return new t.Point(this.x*e,this.y*e)},divide:function(e){return new t.Point(this.x/e,this.y/e)},negate:function(){return new t.Point(-this.x,-this.y)},distanceTo:function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},squaredDistanceTo:function(t){return Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2)},apply:function(e){return new t.Point(e(this.x),e(this.y))},equals:function(e){return e instanceof t.Point&&this.x===e.x&&this.y===e.y},rotate:function(e,i){var n,o;if(i=i||new t.Point(0,0),e%90==0){switch(t.positiveModulo(e,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=e*Math.PI/180;n=Math.cos(r),o=Math.sin(r)}var s=n*(this.x-i.x)-o*(this.y-i.y)+i.x,a=o*(this.x-i.x)+n*(this.y-i.y)+i.y;return new t.Point(s,a)},toString:function(){return"("+Math.round(100*this.x)/100+","+Math.round(100*this.y)/100+")"}}}(l),function(t){t.TileSource=function(e,i,n,o,r,s){var a,l,c=this,u=arguments;if(a=t.isPlainObject(e)?e:{width:u[0],height:u[1],tileSize:u[2],tileOverlap:u[3],minLevel:u[4],maxLevel:u[5]},t.EventSource.call(this),t.extend(!0,this,a),!this.success)for(l=0;l<arguments.length;l++)if(t.isFunction(arguments[l])){this.success=arguments[l];break}this.success&&this.addHandler("ready",(function(t){c.success(t)})),"string"===t.type(arguments[0])&&(this.url=arguments[0]),this.url?(this.aspectRatio=1,this.dimensions=new t.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)):(this.ready=!0,this.aspectRatio=a.width&&a.height?a.width/a.height:1,this.dimensions=new t.Point(a.width,a.height),this.tileSize?(this._tileWidth=this._tileHeight=this.tileSize,delete this.tileSize):(this.tileWidth?(this._tileWidth=this.tileWidth,delete this.tileWidth):this._tileWidth=0,this.tileHeight?(this._tileHeight=this.tileHeight,delete this.tileHeight):this._tileHeight=0),this.tileOverlap=a.tileOverlap?a.tileOverlap:0,this.minLevel=a.minLevel?a.minLevel:0,this.maxLevel=void 0!==a.maxLevel&&null!==a.maxLevel?a.maxLevel:a.width&&a.height?Math.ceil(Math.log(Math.max(a.width,a.height))/Math.log(2)):0,this.success&&t.isFunction(this.success)&&this.success(this))},t.TileSource.prototype={getTileSize:function(e){return t.console.error("[TileSource.getTileSize] is deprecated. Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"),this._tileWidth},getTileWidth:function(t){return this._tileWidth?this._tileWidth:this.getTileSize(t)},getTileHeight:function(t){return this._tileHeight?this._tileHeight:this.getTileSize(t)},setMaxLevel:function(t){this.maxLevel=t,this._memoizeLevelScale()},getLevelScale:function(t){return this._memoizeLevelScale(),this.getLevelScale(t)},_memoizeLevelScale:function(){var t,e={};for(t=0;t<=this.maxLevel;t++)e[t]=1/Math.pow(2,this.maxLevel-t);this.getLevelScale=function(t){return e[t]}},getNumTiles:function(e){var i=this.getLevelScale(e),n=Math.ceil(i*this.dimensions.x/this.getTileWidth(e)),o=Math.ceil(i*this.dimensions.y/this.getTileHeight(e));return new t.Point(n,o)},getPixelRatio:function(e){var i=this.dimensions.times(this.getLevelScale(e)),n=1/i.x*t.pixelDensityRatio,o=1/i.y*t.pixelDensityRatio;return new t.Point(n,o)},getClosestLevel:function(){var t,e;for(t=this.minLevel+1;t<=this.maxLevel&&!((e=this.getNumTiles(t)).x>1||e.y>1);t++);return t-1},getTileAtPoint:function(e,i){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;t.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var o=this.dimensions.x*this.getLevelScale(e),r=i.x*o,s=i.y*o,a=Math.floor(r/this.getTileWidth(e)),l=Math.floor(s/this.getTileHeight(e));i.x>=1&&(a=this.getNumTiles(e).x-1);return i.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(e).y-1),new t.Point(a,l)},getTileBounds:function(e,i,n,o){var r=this.dimensions.times(this.getLevelScale(e)),s=this.getTileWidth(e),a=this.getTileHeight(e),l=0===i?0:s*i-this.tileOverlap,c=0===n?0:a*n-this.tileOverlap,u=s+(0===i?1:2)*this.tileOverlap,h=a+(0===n?1:2)*this.tileOverlap,p=1/r.x;return u=Math.min(u,r.x-l),h=Math.min(h,r.y-c),o?new t.Rect(0,0,u,h):new t.Rect(l*p,c*p,u*p,h*p)},getImageInfo:function(e){var i,n,o,r,s,a,l,c=this;e&&(l=(a=(s=e.split("/"))[s.length-1]).lastIndexOf("."))>-1&&(s[s.length-1]=a.slice(0,l));var u=null;if(this.splitHashDataForPost){var h=e.indexOf("#");-1!==h&&(u=e.substring(h+1),e=e.substr(0,h))}n=function(i){"string"==typeof i&&(i=t.parseXml(i));var n=t.TileSource.determineType(c,i,e);n?(void 0===(r=n.prototype.configure.apply(c,[i,e,u])).ajaxWithCredentials&&(r.ajaxWithCredentials=c.ajaxWithCredentials),o=new n(r),c.ready=!0,c.raiseEvent("ready",{tileSource:o})):c.raiseEvent("open-failed",{message:"Unable to load TileSource",source:e})},e.match(/\.js$/)?(i=e.split("/").pop().replace(".js",""),t.jsonp({url:e,async:!1,callbackName:i,callback:n})):t.makeAjaxRequest({url:e,postData:u,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){var i=function(e){var i,n,o=e.responseText,r=e.status;if(!e)throw new Error(t.getString("Errors.Security"));if(200!==e.status&&0!==e.status)throw i=404===(r=e.status)?"Not Found":e.statusText,new Error(t.getString("Errors.Status",r,i));if(o.match(/\s*<.*/))try{n=e.responseXML&&e.responseXML.documentElement?e.responseXML:t.parseXml(o)}catch(s){n=e.responseText}else if(o.match(/\s*[{[].*/))try{n=t.parseJSON(o)}catch(s){n=o}else n=o;return n}(e);n(i)},error:function(i,n){var o;try{o="HTTP "+i.status+" attempting to load TileSource: "+e}catch(r){o=(void 0!==n&&n.toString?n.toString():"Unknown error")+" attempting to load TileSource: "+e}t.console.error(o),c.raiseEvent("open-failed",{message:o,source:e,postData:u})}})},supports:function(t,e){return!1},configure:function(t,e,i){throw new Error("Method not implemented.")},getTileUrl:function(t,e,i){throw new Error("Method not implemented.")},getTilePostData:function(t,e,i){return null},getTileAjaxHeaders:function(t,e,i){return{}},getTileHashKey:function(t,e,i,n,o,r){function s(t){return o?t+"+"+JSON.stringify(o):t}return s("string"!=typeof n?t+"/"+e+"_"+i:n)},tileExists:function(t,e,i){var n=this.getNumTiles(t);return t>=this.minLevel&&t<=this.maxLevel&&e>=0&&i>=0&&e<n.x&&i<n.y},hasTransparency:function(t,e,i,n){return!!t||e.match(".png")},downloadTileStart:function(e){var i=e.userData,n=new Image;i.image=n,i.request=null;var o=function(t){n?(n.onload=n.onerror=n.onabort=null,e.finish(t?null:n,i.request,t)):e.finish(null,i.request,"Image load failed: undefined Image instance.")};n.onload=function(){o()},n.onabort=n.onerror=function(){o("Image load aborted.")},e.loadWithAjax?i.request=t.makeAjaxRequest({url:e.src,withCredentials:e.ajaxWithCredentials,headers:e.ajaxHeaders,responseType:"arraybuffer",postData:e.postData,success:function(t){var e;try{e=new window.Blob([t.response])}catch(s){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if("TypeError"===s.name&&i){var r=new i;r.append(t.response),e=r.getBlob()}}0===e.size?o("Empty image response."):n.src=(window.URL||window.webkitURL).createObjectURL(e)},error:function(t){o("Image load aborted - XHR error")}}):(!1!==e.crossOriginPolicy&&(n.crossOrigin=e.crossOriginPolicy),n.src=e.src)},downloadTileAbort:function(t){t.userData.request&&t.userData.request.abort();var e=t.userData.image;t.userData.image&&(e.onload=e.onerror=e.onabort=null)},createTileCache:function(t,e,i){t._data=e},destroyTileCache:function(t){t._data=null,t._renderedContext=null},getTileCacheData:function(t){return t._data},getTileCacheDataAsImage:function(t){return t._data},getTileCacheDataAsContext2D:function(t){if(!t._renderedContext){var e=document.createElement("canvas");e.width=t._data.width,e.height=t._data.height,t._renderedContext=e.getContext("2d"),t._renderedContext.drawImage(t._data,0,0),t._data=null;const i=e.cloneNode(!0);t._copyRenderedContext=i.getContext("2d"),t._copyRenderedContext.drawImage(e,0,0)}return t._renderedContext},getCopyTileCacheDataAsContext2D:function(t){return t._copyRenderedContext||t._renderedContext}},t.extend(!0,t.TileSource.prototype,t.EventSource.prototype),t.TileSource.determineType=function(e,i,n){var o;for(o in l)if(o.match(/.+TileSource$/)&&t.isFunction(l[o])&&t.isFunction(l[o].prototype.supports)&&l[o].prototype.supports.call(e,i,n))return l[o];return t.console.error("No TileSource was able to open %s %s",n,i),null}}(l),function(t){function e(e,i){var n,o,r=i.Image,s=r.Url,a=r.Format,l=r.Size,c=r.DisplayRect||[],u=parseInt(l.Width,10),h=parseInt(l.Height,10),p=parseInt(r.TileSize,10),d=parseInt(r.Overlap,10),f=[];for(o=0;o<c.length;o++)n=c[o].Rect,f.push(new t.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 t.extend(!0,{width:u,height:h,tileSize:p,tileOverlap:d,minLevel:null,maxLevel:null,tilesUrl:s,fileFormat:a,displayRects:f},i)}t.DziTileSource=function(e,i,n,o,r,s,a,l,c){var u,h,p,d;if(d=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]},this._levelRects={},this.tilesUrl=d.tilesUrl,this.fileFormat=d.fileFormat,this.displayRects=d.displayRects,this.displayRects)for(u=this.displayRects.length-1;u>=0;u--)for(p=(h=this.displayRects[u]).minLevel;p<=h.maxLevel;p++)this._levelRects[p]||(this._levelRects[p]=[]),this._levelRects[p].push(h);t.TileSource.apply(this,[d])},t.extend(t.DziTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){var i;return t.Image?i=t.Image.xmlns:t.documentElement&&("Image"!==t.documentElement.localName&&"Image"!==t.documentElement.tagName||(i=t.documentElement.namespaceURI)),-1!==(i=(i||"").toLowerCase()).indexOf("schemas.microsoft.com/deepzoom/2008")||-1!==i.indexOf("schemas.microsoft.com/deepzoom/2009")},configure:function(i,n,o){var r;return r=t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var o,r,s,a,l,c=n.documentElement,u=c.localName||c.tagName,h=n.documentElement.namespaceURI,p=null,d=[];if("Image"===u)try{if(void 0===(a=c.getElementsByTagName("Size")[0])&&(a=c.getElementsByTagNameNS(h,"Size")[0]),p={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:c.getAttribute("Url"),Format:c.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(c.getAttribute("Overlap"),10),TileSize:parseInt(c.getAttribute("TileSize"),10),Size:{Height:parseInt(a.getAttribute("Height"),10),Width:parseInt(a.getAttribute("Width"),10)}}},!t.imageFormatSupported(p.Image.Format))throw new Error(t.getString("Errors.ImageFormat",p.Image.Format.toUpperCase()));for(void 0===(o=c.getElementsByTagName("DisplayRect"))&&(o=c.getElementsByTagNameNS(h,"DisplayRect")[0]),l=0;l<o.length;l++)void 0===(s=(r=o[l]).getElementsByTagName("Rect")[0])&&(s=r.getElementsByTagNameNS(h,"Rect")[0]),d.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)}});return d.length&&(p.Image.DisplayRect=d),e(i,p)}catch(g){throw g instanceof Error?g:new Error(t.getString("Errors.Dzi"))}else{if("Collection"===u)throw new Error(t.getString("Errors.Dzc"));if("Error"===u){var f=c.getElementsByTagName("Message")[0].firstChild.nodeValue;throw new Error(f)}}throw new Error(t.getString("Errors.Dzi"))}(this,i),n&&!r.tilesUrl&&(r.tilesUrl=n.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),-1!==n.search(/\.(dzi|xml|js)\?/)?r.queryParams=n.match(/\?.*/):r.queryParams=""),r},getTileUrl:function(t,e,i){return[this.tilesUrl,t,"/",e,"_",i,".",this.fileFormat,this.queryParams].join("")},tileExists:function(t,e,i){var n,o,r,s,a,l,c,u=this._levelRects[t];if(this.minLevel&&t<this.minLevel||this.maxLevel&&t>this.maxLevel)return!1;if(!u||!u.length)return!0;for(c=u.length-1;c>=0;c--)if(!(t<(n=u[c]).minLevel||t>n.maxLevel)&&(o=this.getLevelScale(t),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),r<=e&&e<a&&s<=i&&i<l))return!0;return!1}})}(l),function(t){function e(t){var e=Array.isArray(t.profile)?t.profile[0]:t.profile,i=-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","level0","https://iiif.io/api/image/3/level0.json"].indexOf(e),n=!1;return 2===t.version&&t.profile.length>1&&t.profile[1].supports&&(n=-1!==t.profile[1].supports.indexOf("sizeByW")),3===t.version&&t.extraFeatures&&(n=-1!==t.extraFeatures.indexOf("sizeByWh")),!i||n}function i(t){for(var e=[],i=0;i<t.sizes.length;i++)e.push({url:t._id+"/full/"+t.sizes[i].width+","+(3===t.version?t.sizes[i].height:"")+"/0/default."+t.tileFormat,width:t.sizes[i].width,height:t.sizes[i].height});return e.sort((function(t,e){return t.width-e.width}))}function n(e,i,o){var r,s;if(3===e.nodeType&&o)(s=e.nodeValue.trim()).match(/^\d*$/)&&(s=Number(s)),i[o]?(t.isArray(i[o])||(i[o]=[i[o]]),i[o].push(s)):i[o]=s;else if(1===e.nodeType)for(r=0;r<e.childNodes.length;r++)n(e.childNodes[r],i,e.nodeName)}t.IIIFTileSource=function(n){if(t.extend(!0,this,n),this._id=this["@id"]||this.id||this.identifier||null,!(this.height&&this.width&&this._id))throw new Error("IIIF required parameters (width, height, or id) not provided.");if(n.tileSizePerScaleFactor={},this.tileFormat=this.tileFormat||"jpg",this.version=n.version,this.tile_width&&this.tile_height)n.tileWidth=this.tile_width,n.tileHeight=this.tile_height;else if(this.tile_width)n.tileSize=this.tile_width;else if(this.tile_height)n.tileSize=this.tile_height;else if(this.tiles)if(1===this.tiles.length)n.tileWidth=this.tiles[0].width,n.tileHeight=this.tiles[0].height||this.tiles[0].width,this.scale_factors=this.tiles[0].scaleFactors;else{this.scale_factors=[];for(var o=0;o<this.tiles.length;o++)for(var r=0;r<this.tiles[o].scaleFactors.length;r++){var s=this.tiles[o].scaleFactors[r];this.scale_factors.push(s),n.tileSizePerScaleFactor[s]={width:this.tiles[o].width,height:this.tiles[o].height||this.tiles[o].width}}}else if(e(n)){for(var a=Math.min(this.height,this.width),l=[256,512,1024],c=[],u=0;u<l.length;u++)l[u]<=a&&c.push(l[u]);c.length>0?n.tileSize=Math.max.apply(null,c):n.tileSize=a}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,n.levels=i(this),t.extend(!0,n,{width:n.levels[n.levels.length-1].width,height:n.levels[n.levels.length-1].height,tileSize:Math.max(n.height,n.width),tileOverlap:0,minLevel:0,maxLevel:n.levels.length-1}),this.levels=n.levels):t.console.error("Nothing in the info.json to construct image pyramids from");if(!n.maxLevel&&!this.emulateLegacyImagePyramid)if(this.scale_factors){var h=Math.max.apply(null,this.scale_factors);n.maxLevel=Math.round(Math.log(h)*Math.LOG2E)}else n.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));t.TileSource.apply(this,[n])},t.extend(t.IIIFTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return!(!t.protocol||"http://iiif.io/api/image"!==t.protocol)||(!(!t["@context"]||"http://library.stanford.edu/iiif/image-api/1.1/context.json"!==t["@context"]&&"http://iiif.io/api/image/1/context.json"!==t["@context"])||(!(!t.profile||0!==t.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html"))||(!!(t.identifier&&t.width&&t.height)||!(!t.documentElement||"info"!==t.documentElement.tagName||"http://library.stanford.edu/iiif/image-api/ns/"!==t.documentElement.namespaceURI))))},configure:function(e,i,o){if(t.isPlainObject(e)){if(e["@context"]){var r=e["@context"];if(Array.isArray(r))for(var s=0;s<r.length;s++)if("string"==typeof r[s]&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(r[s])||"http://library.stanford.edu/iiif/image-api/1.1/context.json"===r[s])){r=r[s];break}switch(r){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":e.version=1;break;case"http://iiif.io/api/image/2/context.json":e.version=2;break;case"http://iiif.io/api/image/3/context.json":e.version=3;break;default:t.console.error("Data has a @context property which contains no known IIIF context URI.")}}else e["@context"]="http://iiif.io/api/image/1.0/context.json",e["@id"]=i.replace("/info.json",""),e.version=1;if(e.preferredFormats)for(var a=0;a<e.preferredFormats.length;a++)if(l.imageFormatSupported(e.preferredFormats[a])){e.tileFormat=e.preferredFormats[a];break}return e}var c=function(e){if(!e||!e.documentElement)throw new Error(t.getString("Errors.Xml"));var i=e.documentElement,o=i.tagName,r=null;if("info"===o)try{return n(i,r={}),r}catch(s){throw s instanceof Error?s:new Error(t.getString("Errors.IIIF"))}throw new Error(t.getString("Errors.IIIF"))}(e);return c["@context"]="http://iiif.io/api/image/1.0/context.json",c["@id"]=i.replace("/info.xml",""),c.version=1,c},getTileWidth:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileWidth.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].width:this._tileWidth},getTileHeight:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileHeight.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].height:this._tileHeight},getLevelScale:function(e){if(this.emulateLegacyImagePyramid){var i=NaN;return this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(i=this.levels[e].width/this.levels[this.maxLevel].width),i}return t.TileSource.prototype.getLevelScale.call(this,e)},getNumTiles:function(e){return this.emulateLegacyImagePyramid?this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0):t.TileSource.prototype.getNumTiles.call(this,e)},getTileAtPoint:function(e,i){return this.emulateLegacyImagePyramid?new t.Point(0,0):t.TileSource.prototype.getTileAtPoint.call(this,e,i)},getTileUrl:function(t,e,i){if(this.emulateLegacyImagePyramid){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}var o,r,s,a,l,c,u,h,p,d,f,g,v,m=Math.pow(.5,this.maxLevel-t),y=Math.round(this.width*m),w=Math.round(this.height*m);return o=this.getTileWidth(t),r=this.getTileHeight(t),s=Math.round(o/m),a=Math.round(r/m),v=1===this.version?"native."+this.tileFormat:"default."+this.tileFormat,y<o&&w<r?(d=2===this.version&&y===this.width?"full":3===this.version&&y===this.width&&w===this.height?"max":3===this.version?y+","+w:y+",",l="full"):(c=e*s,u=i*a,h=Math.min(s,this.width-c),p=Math.min(a,this.height-u),l=0===e&&0===i&&h===this.width&&p===this.height?"full":[c,u,h,p].join(","),f=Math.round(h*m),g=Math.round(p*m),d=2===this.version&&f===this.width?"full":3===this.version&&f===this.width&&g===this.height?"max":3===this.version?f+","+g:f+","),[this._id,l,d,"0",v].join("/")},__testonly__:{canBeTiled:e,constructLevels:i}})}(l),function(t){t.OsmTileSource=function(e,i,n,o,r){var s;(s=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}).width&&s.height||(s.width=65572864,s.height=65572864),s.tileSize||(s.tileSize=256,s.tileOverlap=0),s.tilesUrl||(s.tilesUrl="http://tile.openstreetmap.org/"),s.minLevel=8,t.TileSource.apply(this,[s])},t.extend(t.OsmTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"openstreetmaps"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){return this.tilesUrl+(t-8)+"/"+e+"/"+i+".png"}})}(l),function(t){t.TmsTileSource=function(e,i,n,o,r){var s;s=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};var a,l=256*Math.ceil(s.width/256),c=256*Math.ceil(s.height/256);a=l>c?l/256:c/256,s.maxLevel=Math.ceil(Math.log(a)/Math.log(2))-1,s.tileSize=256,s.width=l,s.height=c,t.TileSource.apply(this,[s])},t.extend(t.TmsTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"tiledmapservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n=this.getNumTiles(t).y-1;return this.tilesUrl+t+"/"+e+"/"+(n-i)+".png"}})}(l),function(t){t.ZoomifyTileSource=function(t){void 0===t.tileSize&&(t.tileSize=256),void 0===t.fileFormat&&(t.fileFormat="jpg",this.fileFormat=t.fileFormat);var e={x:t.width,y:t.height};for(t.imageSizes=[{x:t.width,y:t.height}],t.gridSize=[this._getGridSize(t.width,t.height,t.tileSize)];parseInt(e.x,10)>t.tileSize||parseInt(e.y,10)>t.tileSize;)e.x=Math.floor(e.x/2),e.y=Math.floor(e.y/2),t.imageSizes.push({x:e.x,y:e.y}),t.gridSize.push(this._getGridSize(e.x,e.y,t.tileSize));t.imageSizes.reverse(),t.gridSize.reverse(),t.minLevel=0,t.maxLevel=t.gridSize.length-1,l.TileSource.apply(this,[t])},t.extend(t.ZoomifyTileSource.prototype,t.TileSource.prototype,{_getGridSize:function(t,e,i){return{x:Math.ceil(t/i),y:Math.ceil(e/i)}},_calculateAbsoluteTileNumber:function(t,e,i){for(var n=0,o={},r=0;r<t;r++)n+=(o=this.gridSize[r]).x*o.y;return n+=(o=this.gridSize[t]).x*i+e},supports:function(t,e){return t.type&&"zoomifytileservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n,o=this._calculateAbsoluteTileNumber(t,e,i);return n=Math.floor(o/256),this.tilesUrl+"TileGroup"+n+"/"+t+"-"+e+"-"+i+"."+this.fileFormat}})}(l),function(t){function e(t,e){return e.levels}t.LegacyTileSource=function(e){var i,n,o;t.isArray(e)&&(i={type:"legacy-image-pyramid",levels:e}),i.levels=function(e){var i,n,o=[];for(n=0;n<e.length;n++)(i=e[n]).height&&i.width&&i.url?o.push({url:i.url,width:Number(i.width),height:Number(i.height)}):t.console.error("Unsupported image format: %s",i.url?i.url:"<no URL>");return o.sort((function(t,e){return t.height-e.height}))}(i.levels),i.levels.length>0?(n=i.levels[i.levels.length-1].width,o=i.levels[i.levels.length-1].height):(n=0,o=0,t.console.error("No supported image formats found")),t.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}),t.TileSource.apply(this,[i]),this.levels=i.levels},t.extend(t.LegacyTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"legacy-image-pyramid"===t.type||t.documentElement&&"legacy-image-pyramid"===t.documentElement.getAttribute("type")},configure:function(i,n,o){return t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var o,r,s=n.documentElement,a=s.tagName,l=null,c=[];if("image"===a)try{for(l={type:s.getAttribute("type"),levels:[]},c=s.getElementsByTagName("level"),r=0;r<c.length;r++)o=c[r],l.levels.push({url:o.getAttribute("url"),width:parseInt(o.getAttribute("width"),10),height:parseInt(o.getAttribute("height"),10)});return e(i,l)}catch(u){throw u instanceof Error?u: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(t){var e=NaN;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}})}(l),function(t){t.ImageTileSource=function(e){e=t.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},e),t.TileSource.apply(this,[e])},t.extend(t.ImageTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"image"===t.type},configure:function(t,e,i){return t},getImageInfo:function(e){var i=this._image=new Image,n=this;this.crossOriginPolicy&&(i.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(i.useCredentials=this.ajaxWithCredentials),t.addEvent(i,"load",(function(){n.width=i.naturalWidth,n.height=i.naturalHeight,n.aspectRatio=n.width/n.height,n.dimensions=new t.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})})),t.addEvent(i,"error",(function(){n.raiseEvent("open-failed",{message:"Error loading image at "+e,source:e})})),i.src=e},getLevelScale:function(t){var e=NaN;return t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n},getContext2D:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].context2D),n},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var e=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!t.supportsCanvas||!this.useCanvas)return delete this._image,e;var i=this._image.naturalWidth,n=this._image.naturalHeight,o=document.createElement("canvas"),r=o.getContext("2d");if(o.width=i,o.height=n,r.drawImage(this._image,0,0,i,n),e[0].context2D=r,delete this._image,t.isCanvasTainted(o))return e;for(;i>=2&&n>=2;){i=Math.floor(i/2),n=Math.floor(n/2);var s=document.createElement("canvas"),a=s.getContext("2d");s.width=i,s.height=n,a.drawImage(o,0,0,i,n),e.splice(0,0,{context2D:a,width:i,height:n}),o=s,r=a}return e},_freeupCanvasMemory:function(){for(var t=0;t<this.levels.length;t++)this.levels[t].context2D&&(this.levels[t].context2D.canvas.height=0,this.levels[t].context2D.canvas.width=0)}})}(l),function(t){t.TileSourceCollection=function(e,i,n,o){t.console.error("TileSourceCollection is deprecated; use World instead")}}(l),function(t){function e(i){t.requestAnimationFrame((function(){!function(i){var n;i.shouldFade&&(n=1-(t.now()-i.fadeBeginTime)/i.fadeLength,n=Math.min(1,n),n=Math.max(0,n),i.imgGroup&&t.setElementOpacity(i.imgGroup,n,!0),n>0&&e(i))}(i)}))}function i(e,i){e.element.disabled||(i>=t.ButtonState.GROUP&&e.currentState===t.ButtonState.REST&&(!function(e){e.shouldFade=!1,e.imgGroup&&t.setElementOpacity(e.imgGroup,1,!0)}(e),e.currentState=t.ButtonState.GROUP),i>=t.ButtonState.HOVER&&e.currentState===t.ButtonState.GROUP&&(e.imgHover&&(e.imgHover.style.visibility=""),e.currentState=t.ButtonState.HOVER),i>=t.ButtonState.DOWN&&e.currentState===t.ButtonState.HOVER&&(e.imgDown&&(e.imgDown.style.visibility=""),e.currentState=t.ButtonState.DOWN))}function n(i,n){i.element.disabled||(n<=t.ButtonState.HOVER&&i.currentState===t.ButtonState.DOWN&&(i.imgDown&&(i.imgDown.style.visibility="hidden"),i.currentState=t.ButtonState.HOVER),n<=t.ButtonState.GROUP&&i.currentState===t.ButtonState.HOVER&&(i.imgHover&&(i.imgHover.style.visibility="hidden"),i.currentState=t.ButtonState.GROUP),n<=t.ButtonState.REST&&i.currentState===t.ButtonState.GROUP&&(!function(i){i.shouldFade=!0,i.fadeBeginTime=t.now()+i.fadeDelay,window.setTimeout((function(){e(i)}),i.fadeDelay)}(i),i.currentState=t.ButtonState.REST))}t.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},t.Button=function(e){var o=this;t.EventSource.call(this),t.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},e),this.element=e.element||t.makeNeutralElement("div"),e.element||(this.imgRest=t.makeTransparentImage(this.srcRest),this.imgGroup=t.makeTransparentImage(this.srcGroup),this.imgHover=t.makeTransparentImage(this.srcHover),this.imgDown=t.makeTransparentImage(this.srcDown),this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip,t.setElementPointerEventsNone(this.imgRest),t.setElementPointerEventsNone(this.imgGroup),t.setElementPointerEventsNone(this.imgHover),t.setElementPointerEventsNone(this.imgDown),this.element.style.position="relative",t.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",t.Browser.vendor===t.BROWSERS.FIREFOX&&t.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=t.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 t.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(e){e.insideElementPressed?(i(o,t.ButtonState.DOWN),o.raiseEvent("enter",{originalEvent:e.originalEvent})):e.buttonDownAny||i(o,t.ButtonState.HOVER)},focusHandler:function(t){o.tracker.enterHandler(t),o.raiseEvent("focus",{originalEvent:t.originalEvent})},leaveHandler:function(e){n(o,t.ButtonState.GROUP),e.insideElementPressed&&o.raiseEvent("exit",{originalEvent:e.originalEvent})},blurHandler:function(t){o.tracker.leaveHandler(t),o.raiseEvent("blur",{originalEvent:t.originalEvent})},pressHandler:function(e){i(o,t.ButtonState.DOWN),o.raiseEvent("press",{originalEvent:e.originalEvent})},releaseHandler:function(e){e.insideElementPressed&&e.insideElementReleased?(n(o,t.ButtonState.HOVER),o.raiseEvent("release",{originalEvent:e.originalEvent})):e.insideElementPressed?n(o,t.ButtonState.GROUP):i(o,t.ButtonState.HOVER)},clickHandler:function(t){t.quick&&o.raiseEvent("click",{originalEvent:t.originalEvent})},keyHandler:function(t){13===t.keyCode?(o.raiseEvent("click",{originalEvent:t.originalEvent}),o.raiseEvent("release",{originalEvent:t.originalEvent}),t.preventDefault=!0):t.preventDefault=!1}}),n(this,t.ButtonState.REST)},t.extend(t.Button.prototype,t.EventSource.prototype,{notifyGroupEnter:function(){i(this,t.ButtonState.GROUP)},notifyGroupExit:function(){n(this,t.ButtonState.REST)},disable:function(){this.notifyGroupExit(),this.element.disabled=!0,this.tracker.setTracking(!1),t.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1,this.tracker.setTracking(!0),t.setElementOpacity(this.element,1,!0),this.notifyGroupEnter()},destroy:function(){this.imgRest&&(this.element.removeChild(this.imgRest),this.imgRest=null),this.imgGroup&&(this.element.removeChild(this.imgGroup),this.imgGroup=null),this.imgHover&&(this.element.removeChild(this.imgHover),this.imgHover=null),this.imgDown&&(this.element.removeChild(this.imgDown),this.imgDown=null),this.removeAllHandlers(),this.tracker.destroy(),this.element=null}})}(l),function(t){t.ButtonGroup=function(e){t.extend(!0,this,{buttons:[],clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},e);var i,n=this.buttons.concat([]),o=this;if(this.element=e.element||t.makeNeutralElement("div"),!e.group)for(this.element.style.display="inline-block",i=0;i<n.length;i++)this.element.appendChild(n[i].element);t.setElementTouchActionNone(this.element),this.tracker=new t.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){var e;for(e=0;e<o.buttons.length;e++)o.buttons[e].notifyGroupEnter()},leaveHandler:function(t){var e;if(!t.insideElementPressed)for(e=0;e<o.buttons.length;e++)o.buttons[e].notifyGroupExit()}})},t.ButtonGroup.prototype={emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){for(;this.buttons.length;){var t=this.buttons.pop();this.element.removeChild(t.element),t.destroy()}this.tracker.destroy(),this.element=null}}}(l),function(t){t.Rect=function(e,i,n,o,r){var s,a;this.x="number"==typeof e?e: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=t.positiveModulo(this.degrees,360),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):this.degrees>=180?(s=this.getBottomRight(),this.x=s.x,this.y=s.y,this.degrees-=180):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)},t.Rect.fromSummits=function(e,i,n){var o=e.distanceTo(i),r=e.distanceTo(n),s=i.minus(e),a=Math.atan(s.y/s.x);return s.x<0?a+=Math.PI:s.y<0&&(a+=2*Math.PI),new t.Rect(e.x,e.y,o,r,a/Math.PI*180)},t.Rect.prototype={clone:function(){return new t.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new t.Point(this.x,this.y)},getBottomRight:function(){return new t.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new t.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new t.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new t.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new t.Point(this.width,this.height)},equals:function(e){return e instanceof t.Rect&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height&&this.degrees===e.degrees},times:function(e){return new t.Rect(this.x*e,this.y*e,this.width*e,this.height*e,this.degrees)},translate:function(e){return new t.Rect(this.x+e.x,this.y+e.y,this.width,this.height,this.degrees)},union:function(e){var i=this.getBoundingBox(),n=e.getBoundingBox(),o=Math.min(i.x,n.x),r=Math.min(i.y,n.y),s=Math.max(i.x+i.width,n.x+n.width),a=Math.max(i.y+i.height,n.y+n.height);return new t.Rect(o,r,s-o,a-r)},intersection:function(e){var i=1e-10,n=[],o=this.getTopLeft();e.containsPoint(o,i)&&n.push(o);var r=this.getTopRight();e.containsPoint(r,i)&&n.push(r);var s=this.getBottomLeft();e.containsPoint(s,i)&&n.push(s);var a=this.getBottomRight();e.containsPoint(a,i)&&n.push(a);var l=e.getTopLeft();this.containsPoint(l,i)&&n.push(l);var c=e.getTopRight();this.containsPoint(c,i)&&n.push(c);var u=e.getBottomLeft();this.containsPoint(u,i)&&n.push(u);var h=e.getBottomRight();this.containsPoint(h,i)&&n.push(h);for(var p=this._getSegments(),d=e._getSegments(),f=0;f<p.length;f++)for(var g=p[f],v=0;v<d.length;v++){var m=d[v],y=w(g[0],g[1],m[0],m[1]);y&&n.push(y)}function w(e,n,o,r){var s=n.minus(e),a=r.minus(o),l=-a.x*s.y+s.x*a.y;if(0===l)return null;var c=(s.x*(e.y-o.y)-s.y*(e.x-o.x))/l,u=(a.x*(e.y-o.y)-a.y*(e.x-o.x))/l;return-1e-10<=c&&c<=1-i&&-1e-10<=u&&u<=1-i?new t.Point(e.x+u*s.x,e.y+u*s.y):null}if(0===n.length)return null;for(var x=n[0].x,b=n[0].x,T=n[0].y,S=n[0].y,P=1;P<n.length;P++){var E=n[P];E.x<x&&(x=E.x),E.x>b&&(b=E.x),E.y<T&&(T=E.y),E.y>S&&(S=E.y)}return new t.Rect(x,T,b-x,S-T)},_getSegments:function(){var t=this.getTopLeft(),e=this.getTopRight(),i=this.getBottomLeft(),n=this.getBottomRight();return[[t,e],[e,n],[n,i],[i,t]]},rotate:function(e,i){if(0===(e=t.positiveModulo(e,360)))return this.clone();i=i||this.getCenter();var n=this.getTopLeft().rotate(e,i),o=this.getTopRight().rotate(e,i).minus(n);o=o.apply((function(t){return Math.abs(t)<1e-15?0:t}));var r=Math.atan(o.y/o.x);return o.x<0?r+=Math.PI:o.y<0&&(r+=2*Math.PI),new t.Rect(n.x,n.y,this.width,this.height,r/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var e=this.getTopLeft(),i=this.getTopRight(),n=this.getBottomLeft(),o=this.getBottomRight(),r=Math.min(e.x,i.x,n.x,o.x),s=Math.max(e.x,i.x,n.x,o.x),a=Math.min(e.y,i.y,n.y,o.y),l=Math.max(e.y,i.y,n.y,o.y);return new t.Rect(r,a,s-r,l-a)},getIntegerBoundingBox:function(){var e=this.getBoundingBox(),i=Math.floor(e.x),n=Math.floor(e.y),o=Math.ceil(e.width+e.x-i),r=Math.ceil(e.height+e.y-n);return new t.Rect(i,n,o,r)},containsPoint:function(t,e){e=e||0;var i=this.getTopLeft(),n=this.getTopRight(),o=this.getBottomLeft(),r=n.minus(i),s=o.minus(i);return(t.x-i.x)*r.x+(t.y-i.y)*r.y>=-e&&(t.x-n.x)*r.x+(t.y-n.y)*r.y<=e&&(t.x-i.x)*s.x+(t.y-i.y)*s.y>=-e&&(t.x-o.x)*s.x+(t.y-o.y)*s.y<=e},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]"}}}(l),function(t){var e={};function i(t){var e;t.quick&&(e="horizontal"===this.scroll?Math.floor(t.position.x/this.panelWidth):Math.floor(t.position.y/this.panelHeight),this.viewer.goToPage(e));this.element.focus()}function n(e){if(this.dragging=!0,this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?-e.delta.x>0?i>-(o-a.x)&&(this.element.style.marginLeft=i+2*e.delta.x+"px",r(this,a.x,i+2*e.delta.x)):-e.delta.x<0&&i<0&&(this.element.style.marginLeft=i+2*e.delta.x+"px",r(this,a.x,i+2*e.delta.x)):-e.delta.y>0?n>-(s-a.y)&&(this.element.style.marginTop=n+2*e.delta.y+"px",r(this,a.y,n+2*e.delta.y)):-e.delta.y<0&&n<0&&(this.element.style.marginTop=n+2*e.delta.y+"px",r(this,a.y,n+2*e.delta.y))}}function o(e){if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?e.scroll>0?i>-(o-a.x)&&(this.element.style.marginLeft=i-60*e.scroll+"px",r(this,a.x,i-60*e.scroll)):e.scroll<0&&i<0&&(this.element.style.marginLeft=i-60*e.scroll+"px",r(this,a.x,i-60*e.scroll)):e.scroll<0?n>a.y-s&&(this.element.style.marginTop=n+60*e.scroll+"px",r(this,a.y,n+60*e.scroll)):e.scroll>0&&n<0&&(this.element.style.marginTop=n+60*e.scroll+"px",r(this,a.y,n+60*e.scroll)),e.preventDefault=!0}}function r(e,i,n){var o,r,s,a,l,c;for(o="horizontal"===e.scroll?e.panelWidth:e.panelHeight,r=Math.ceil(i/o)+5,l=r=(r=(s=Math.ceil((Math.abs(n)+i)/o)+1)-r)<0?0:r;l<s&&l<e.panels.length;l++)if(!(c=e.panels[l]).activePanel){var u,h=e.viewer.tileSources[l];u=h.referenceStripThumbnailUrl?{type:"image",url:h.referenceStripThumbnailUrl}:h,a=new t.Viewer({id:c.id,tileSources:[u],element:c,navigatorSizeRatio:e.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,loadTilesWithAjax:e.viewer.loadTilesWithAjax,ajaxHeaders:e.viewer.ajaxHeaders,useCanvas:e.useCanvas}),t.setElementPointerEventsNone(a.canvas),t.setElementPointerEventsNone(a.container),a.innerTracker.setTracking(!1),a.outerTracker.setTracking(!1),e.miniViewers[c.id]=a,c.activePanel=!0}}function s(t){var e=t.eventSource.element;"horizontal"===this.scroll?e.style.marginBottom="0px":e.style.marginLeft="0px"}function a(e){var i=e.eventSource.element;"horizontal"===this.scroll?i.style.marginBottom="-"+t.getElementSize(i).y/2+"px":i.style.marginLeft="-"+t.getElementSize(i).x/2+"px"}function l(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 38:case 39:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 40:case 37:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}function c(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 61:case 48:case 119:case 87:case 100:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 45:case 115:case 83:case 97:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}t.ReferenceStrip=function(u){var h,p,d,f=u.viewer,g=t.getElementSize(f.element);for(u.id||(u.id="referencestrip-"+t.now(),this.element=t.makeNeutralElement("div"),this.element.id=u.id,this.element.className="referencestrip"),u=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.referenceStripSizeRatio,position:t.DEFAULT_SETTINGS.referenceStripPosition,scroll:t.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold},u,{element:this.element}),t.extend(this,u),e[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,(p=this.element.style).marginTop="0px",p.marginRight="0px",p.marginBottom="0px",p.marginLeft="0px",p.left="0px",p.bottom="0px",p.border="0px",p.background="#000",p.position="relative",t.setElementTouchActionNone(this.element),t.setElementOpacity(this.element,.8),this.viewer=f,this.tracker=new t.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:t.delegate(this,i),dragHandler:t.delegate(this,n),scrollHandler:t.delegate(this,o),enterHandler:t.delegate(this,s),leaveHandler:t.delegate(this,a),keyDownHandler:t.delegate(this,l),keyHandler:t.delegate(this,c),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),u.width&&u.height?(this.element.style.width=u.width+"px",this.element.style.height=u.height+"px",f.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):"horizontal"===u.scroll?(this.element.style.width=g.x*u.sizeRatio*f.tileSources.length+12*f.tileSources.length+"px",this.element.style.height=g.y*u.sizeRatio+"px",f.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=g.y*u.sizeRatio*f.tileSources.length+12*f.tileSources.length+"px",this.element.style.width=g.x*u.sizeRatio+"px",f.addControl(this.element,{anchor:t.ControlAnchor.TOP_LEFT})),this.panelWidth=g.x*this.sizeRatio+8,this.panelHeight=g.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},d=0;d<f.tileSources.length;d++)(h=t.makeNeutralElement("div")).id=this.element.id+"-"+d,h.style.width=this.panelWidth+"px",h.style.height=this.panelHeight+"px",h.style.display="inline",h.style.float="left",h.style.cssFloat="left",h.style.styleFloat="left",h.style.padding="2px",t.setElementTouchActionNone(h),t.setElementPointerEventsNone(h),this.element.appendChild(h),h.activePanel=!1,this.panels.push(h);r(this,"vertical"===this.scroll?g.y:g.x,0),this.setFocus(0)},t.ReferenceStrip.prototype={setFocus:function(e){var i,n=this.element.querySelector("#"+this.element.id+"-"+e),o=t.getElementSize(this.viewer.canvas),a=Number(this.element.style.width.replace("px","")),l=Number(this.element.style.height.replace("px","")),c=-Number(this.element.style.marginLeft.replace("px","")),u=-Number(this.element.style.marginTop.replace("px",""));this.currentSelected!==n&&(this.currentSelected&&(this.currentSelected.style.background="#000"),this.currentSelected=n,this.currentSelected.style.background="#999","horizontal"===this.scroll?(i=Number(e)*(this.panelWidth+3))>c+o.x-this.panelWidth?(i=Math.min(i,a-o.x),this.element.style.marginLeft=-i+"px",r(this,o.x,-i)):i<c&&(i=Math.max(0,i-o.x/2),this.element.style.marginLeft=-i+"px",r(this,o.x,-i)):(i=Number(e)*(this.panelHeight+3))>u+o.y-this.panelHeight?(i=Math.min(i,l-o.y),this.element.style.marginTop=-i+"px",r(this,o.y,-i)):i<u&&(i=Math.max(0,i-o.y/2),this.element.style.marginTop=-i+"px",r(this,o.y,-i)),this.currentPage=e,s.call(this,{eventSource:this.tracker}))},update:function(){return!!e[this.id].animating},destroy:function(){if(this.miniViewers)for(var t in this.miniViewers)this.miniViewers[t].destroy();this.tracker.destroy(),this.element&&this.viewer.removeControl(this.element)}}}(l),function(t){t.DisplayRect=function(e,i,n,o,r,s){t.Rect.apply(this,[e,i,n,o]),this.minLevel=r,this.maxLevel=s},t.extend(t.DisplayRect.prototype,t.Rect.prototype)}(l),function(t){t.Spring=function(e){var i=arguments;"object"!=typeof e&&(e={initial:i.length&&"number"==typeof i[0]?i[0]:void 0,springStiffness:i.length>1?i[1].springStiffness:5,animationTime:i.length>1?i[1].animationTime:1.5}),t.console.assert("number"==typeof e.springStiffness&&0!==e.springStiffness,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),t.console.assert("number"==typeof e.animationTime&&e.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),e.exponential&&(this._exponential=!0,delete e.exponential),t.extend(!0,this,e),this.current={value:"number"==typeof this.initial?this.initial:this._exponential?0:1,time:t.now()},t.console.assert(!this._exponential||0!==this.current.value,"[OpenSeadragon.Spring] 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},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))},t.Spring.prototype={resetTo:function(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=e,this.start.time=this.target.time=this.current.time=t.now(),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(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=e,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(e){this.start.value+=e,this.target.value+=e,this._exponential&&(t.console.assert(0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.shiftBy] 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(e){this._exponential=e,this._exponential&&(t.console.assert(0!==this.current.value&&0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.setExponential] 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(){var e,i;this.current.time=t.now(),this._exponential?(e=this.start._logValue,i=this.target._logValue):(e=this.start.value,i=this.target.value);var n,o,r=this.current.time>=this.target.time?i:e+(i-e)*(n=this.springStiffness,o=(this.current.time-this.start.time)/(this.target.time-this.start.time),(1-Math.exp(n*-o))/(1-Math.exp(-n))),s=this.current.value;return this._exponential?this.current.value=Math.exp(r):this.current.value=r,s!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(l),function(t){t.ImageJob=function(e){t.extend(!0,this,{timeout:t.DEFAULT_SETTINGS.timeout,jobId:null},e),this.data=null,this.userData={},this.errorMsg=null},t.ImageJob.prototype={start:function(){var t=this,e=this.abort;this.jobId=window.setTimeout((function(){t.finish(null,null,"Image load exceeded timeout ("+t.timeout+" ms)")}),this.timeout),this.abort=function(){t.source.downloadTileAbort(t),"function"==typeof e&&e()},this.source.downloadTileStart(this)},finish:function(t,e,i){this.data=t,this.request=e,this.errorMsg=i,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},t.ImageLoader=function(e){t.extend(!0,this,{jobLimit:t.DEFAULT_SETTINGS.imageLoaderLimit,timeout:t.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},e)},t.ImageLoader.prototype={addJob:function(e){if(!e.source){t.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var i=t.TileSource.prototype;e.source={downloadTileStart:i.downloadTileStart,downloadTileAbort:i.downloadTileAbort}}var n=this,o={src:e.src,tile:e.tile||{},source:e.source,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.loadWithAjax?e.ajaxHeaders:null,crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,postData:e.postData,callback:function(t){!function(t,e,i){t.jobsInProgress--,(!t.jobLimit||t.jobsInProgress<t.jobLimit)&&t.jobQueue.length>0&&(t.jobQueue.shift().start(),t.jobsInProgress++);i(e.data,e.errorMsg,e.request)}(n,t,e.callback)},abort:e.abort,timeout:this.timeout},r=new t.ImageJob(o);!this.jobLimit||this.jobsInProgress<this.jobLimit?(r.start(),this.jobsInProgress++):this.jobQueue.push(r)},clear:function(){for(var t=0;t<this.jobQueue.length;t++){var e=this.jobQueue[t];"function"==typeof e.abort&&e.abort()}this.jobQueue=[]}}}(l),function(t){t.Tile=function(e,i,n,o,r,s,a,l,c,u,h,p){this.level=e,this.x=i,this.y=n,this.bounds=o,this.sourceBounds=u,this.exists=r,this._url=s,this.postData=h,this.context2D=a,this.loadWithAjax=l,this.ajaxHeaders=c,void 0===p&&(t.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),p=t.TileSource.prototype.getTileHashKey(e,i,n,s,c,h)),this.cacheKey=p,this.loaded=!1,this.loading=!1,this.element=null,this.imgElement=null,this.style=null,this.position=null,this.size=null,this.flipped=!1,this.blendStart=null,this.opacity=null,this.squaredDistance=null,this.visibility=null,this.hasTransparency=!1,this.beingDrawn=!1,this.lastTouchTime=0,this.isRightMost=!1,this.isBottomMost=!1},t.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){return!!this.context2D||this.getUrl().match(".png")},drawHTML:function(e){if(this.cacheImageRecord)if(this.loaded){if(!this.element){var i=this.getImage();if(!i)return;this.element=t.makeNeutralElement("div"),this.imgElement=i.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!==e&&e.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",this.flipped&&(this.style.transform="scaleX(-1)"),t.setElementOpacity(this.element,this.opacity)}else t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());else t.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString())},get image(){return t.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead."),this.getImage()},get url(){return t.console.error("[Tile.url] property has been deprecated. Use [Tile.prototype.getUrl] instead."),this.getUrl()},getImage:function(){return this.cacheImageRecord.getImage()},getUrl:function(){return"function"==typeof this._url?this._url():this._url},getCanvasContext:function(){return this.context2D||this.cacheImageRecord.getRenderedContext()},drawCanvas:function(e,i,n,o,r,s){var a,l,c,u=this.position.times(t.pixelDensityRatio),h=this.size.times(t.pixelDensityRatio);this.context2D||this.cacheImageRecord?(a=this.getCanvasContext(),this.loaded&&a?(e.save(),e.globalAlpha=this.opacity,"number"==typeof n&&1!==n&&(u=u.times(n),h=h.times(n)),o instanceof t.Point&&(u=u.plus(o)),1===e.globalAlpha&&this.hasTransparency&&(r&&(u.x=Math.round(u.x),u.y=Math.round(u.y),h.x=Math.round(h.x),h.y=Math.round(h.y)),e.clearRect(u.x,u.y,h.x,h.y)),this.sourceBounds?(l=Math.min(this.sourceBounds.width,a.canvas.width),c=Math.min(this.sourceBounds.height,a.canvas.height)):(l=a.canvas.width,c=a.canvas.height),e.translate(u.x+h.x/2,0),this.flipped&&e.scale(-1,1),i({context:e,tile:this,rendered:a,initRendered:this.cacheImageRecord?this.cacheImageRecord.getCopyRenderedContext():void 0,sourceWidth:l,sourceHeight:c,position:{original:u,x:-h.x/2,y:u.y},size:h,pixelDensityRatio:t.pixelDensityRatio}),e.restore()):t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString())):t.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString())},getScaleForEdgeSmoothing:function(){var e;if(this.cacheImageRecord)e=this.cacheImageRecord.getRenderedContext();else{if(!this.context2D)return t.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;e=this.context2D}return e.canvas.width/(this.size.x*t.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(e,i,n){var o=Math.max(1,Math.ceil((n.x-i.x)/2)),r=Math.max(1,Math.ceil((n.y-i.y)/2));return new t.Point(o,r).minus(this.position.times(t.pixelDensityRatio).times(e||1).apply((function(t){return t%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}}}(l),function(t){t.OverlayPlacement=t.Placement,t.OverlayRotationMode=t.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),t.Overlay=function(e,i,n){var o;o=t.isPlainObject(e)?e:{element:e,location:i,placement:n},this.element=o.element,this.style=o.element.style,this._init(o)},t.Overlay.prototype={_init:function(e){this.location=e.location,this.placement=void 0===e.placement?t.Placement.TOP_LEFT:e.placement,this.onDraw=e.onDraw,this.checkResize=void 0===e.checkResize||e.checkResize,this.width=void 0===e.width?null:e.width,this.height=void 0===e.height?null:e.height,this.rotationMode=e.rotationMode||t.OverlayRotationMode.EXACT,this.location instanceof t.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=t.Placement.TOP_LEFT),this.scales=null!==this.width&&null!==this.height,this.bounds=new t.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(e,i){var n=t.Placement.properties[this.placement];n&&(n.isHorizontallyCentered?e.x-=i.x/2:n.isRight&&(e.x-=i.x),n.isVerticallyCentered?e.y-=i.y/2:n.isBottom&&(e.y-=i.y))},destroy:function(){var e=this.element,i=this.style;e.parentNode&&(e.parentNode.removeChild(e),e.prevElementParent&&(i.display="none",document.body.appendChild(e))),this.onDraw=null,i.top="",i.left="",i.position="",null!==this.width&&(i.width=""),null!==this.height&&(i.height="");var n=t.getCssPropertyWithVendorPrefix("transformOrigin"),o=t.getCssPropertyWithVendorPrefix("transform");n&&o&&(i[n]="",i[o]="")},drawHTML:function(e,i){var n=this.element;n.parentNode!==e&&(n.prevElementParent=n.parentNode,n.prevNextSibling=n.nextSibling,e.appendChild(n),this.style.position="absolute",this.size=t.getElementSize(n));var o=this._getOverlayPositionAndSize(i),r=o.position,s=this.size=o.size,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 c=t.getCssPropertyWithVendorPrefix("transformOrigin"),u=t.getCssPropertyWithVendorPrefix("transform");c&&u&&(a?(l[c]=this._getTransformOrigin(),l[u]="rotate("+a+"deg)"):(l[c]="",l[u]="")),l.display="block"}},_getOverlayPositionAndSize:function(e){var i=e.pixelFromPoint(this.location,!0),n=this._getSizeInPixels(e);this.adjust(i,n);var o=0;if(e.getRotation(!0)&&this.rotationMode!==t.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX&&null!==this.width&&null!==this.height){var r=new t.Rect(i.x,i.y,n.x,n.y),s=this._getBoundingBox(r,e.getRotation(!0));i=s.getTopLeft(),n=s.getSize()}else o=e.getRotation(!0);return{position:i,size:n,rotate:o}},_getSizeInPixels:function(e){var i=this.size.x,n=this.size.y;if(null!==this.width||null!==this.height){var o=e.deltaPixelsFromPointsNoRotate(new t.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=t.getElementSize(this.element);null===this.width&&(i=r.x),null===this.height&&(n=r.y)}return new t.Point(i,n)},_getBoundingBox:function(t,e){var i=this._getPlacementPoint(t);return t.rotate(e,i).getBoundingBox()},_getPlacementPoint:function(e){var i=new t.Point(e.x,e.y),n=t.Placement.properties[this.placement];return n&&(n.isHorizontallyCentered?i.x+=e.width/2:n.isRight&&(i.x+=e.width),n.isVerticallyCentered?i.y+=e.height/2:n.isBottom&&(i.y+=e.height)),i},_getTransformOrigin:function(){var e="",i=t.Placement.properties[this.placement];return i?(i.isLeft?e="left":i.isRight&&(e="right"),i.isTop?e+=" top":i.isBottom&&(e+=" bottom"),e):e},update:function(e,i){var n=t.isPlainObject(e)?e:{location:e,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(e){t.console.assert(e,"A viewport must now be passed to Overlay.getBounds.");var i=this.width,n=this.height;if(null===i||null===n){var o=e.deltaPointsFromPixelsNoRotate(this.size,!0);null===i&&(i=o.x),null===n&&(n=o.y)}var r=this.location.clone();return this.adjust(r,new t.Point(i,n)),this._adjustBoundsForRotation(e,new t.Rect(r.x,r.y,i,n))},_adjustBoundsForRotation:function(e,i){if(!e||0===e.getRotation(!0)||this.rotationMode===t.OverlayRotationMode.EXACT)return i;if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX){if(null===this.width||null===this.height)return i;var n=this._getOverlayPositionAndSize(e);return e.viewerElementToViewportRectangle(new t.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-e.getRotation(!0),this._getPlacementPoint(i))}}}(l),function(t){t.Drawer=function(e){t.console.assert(e.viewer,"[Drawer] options.viewer is required");var i=arguments;if(t.isPlainObject(e)||(e={source:i[0],viewport:i[1],element:i[2]}),t.console.assert(e.viewport,"[Drawer] options.viewport is required"),t.console.assert(e.element,"[Drawer] options.element is required"),e.source&&t.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=e.viewer,this.viewport=e.viewport,this.debugGridColor="string"==typeof e.debugGridColor?[e.debugGridColor]:e.debugGridColor||t.DEFAULT_SETTINGS.debugGridColor,e.opacity&&t.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead"),this.useCanvas=t.supportsCanvas&&(!this.viewer||this.viewer.useCanvas),this.container=t.getElement(e.element),this.canvas=t.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",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",t.setElementOpacity(this.canvas,this.opacity,!0),t.setElementPointerEventsNone(this.canvas),t.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._imageSmoothingEnabled=!0},t.Drawer.prototype={addOverlay:function(e,i,n,o){return t.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(e,i,n,o),this},updateOverlay:function(e,i,n){return t.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(e,i,n),this},removeOverlay:function(e){return t.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(e),this},clearOverlays:function(){return t.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(e){var i=this.viewport.pixelFromPointNoRotate(e,!0);return new t.Point(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio)},clipWithPolygons:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),t.forEach((function(t){t.forEach((function(t,e){i[0===e?"moveTo":"lineTo"](t.x,t.y)}))})),i.clip()}},setOpacity:function(e){t.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var i=this.viewer.world,n=0;n<i.getItemCount();n++)i.getItemAt(n).setOpacity(e);return this},getOpacity:function(){t.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");for(var e=this.viewer.world,i=0,n=0;n<e.getItemCount();n++){var o=e.getItemAt(n).getOpacity();o>i&&(i=o)}return i},needsUpdate:function(){return t.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return t.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return t.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return t.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead."),this.clear(),this.viewer.world.draw(),this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null},clear:function(){if(this.canvas.innerHTML="",this.useCanvas){var t=this._calculateCanvasSize();if((this.canvas.width!==t.x||this.canvas.height!==t.y)&&(this.canvas.width=t.x,this.canvas.height=t.y,this._updateImageSmoothingEnabled(this.context),null!==this.sketchCanvas)){var e=this._calculateSketchCanvasSize();this.sketchCanvas.width=e.x,this.sketchCanvas.height=e.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(t,e){if(this.useCanvas){var i=this._getContext(t);if(e)i.clearRect(e.x,e.y,e.width,e.height);else{var n=i.canvas;i.clearRect(0,0,n.width,n.height)}}},viewportToDrawerRectangle:function(e){var i=this.viewport.pixelFromPointNoRotate(e.getTopLeft(),!0),n=this.viewport.deltaPixelsFromPointsNoRotate(e.getSize(),!0);return new t.Rect(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio,n.x*t.pixelDensityRatio,n.y*t.pixelDensityRatio)},drawTile:function(e,i,n,o,r,s,a){if(t.console.assert(e,"[Drawer.drawTile] tile is required"),t.console.assert(i,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var l=this._getContext(n);o=o||1,e.drawCanvas(l,i,o,r,s,a)}else e.drawHTML(this.canvas)},_getContext:function(t){var e=this.context;if(t){if(null===this.sketchCanvas){this.sketchCanvas=document.createElement("canvas");var i=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=i.x,this.sketchCanvas.height=i.y,this.sketchContext=this.sketchCanvas.getContext("2d"),0===this.viewport.getRotation()){var n=this;this.viewer.addHandler("rotate",(function t(){if(0!==n.viewport.getRotation()){n.viewer.removeHandler("rotate",t);var e=n._calculateSketchCanvasSize();n.sketchCanvas.width=e.x,n.sketchCanvas.height=e.y}}))}this._updateImageSmoothingEnabled(this.sketchContext)}e=this.sketchContext}return e},saveContext:function(t){this.useCanvas&&this._getContext(t).save()},restoreContext:function(t){this.useCanvas&&this._getContext(t).restore()},setClip:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),i.rect(t.x,t.y,t.width,t.height),i.clip()}},drawRectangle:function(t,e,i){if(this.useCanvas){var n=this._getContext(i);n.save(),n.fillStyle=e,n.fillRect(t.x,t.y,t.width,t.height),n.restore()}},blendSketch:function(e,i,n,o){var r=e;if(t.isPlainObject(r)||(r={opacity:e,scale:i,translate:n,compositeOperation:o}),this.useCanvas&&this.sketchCanvas){e=r.opacity,o=r.compositeOperation;var s=r.bounds;if(this.context.save(),this.context.globalAlpha=e,o&&(this.context.globalCompositeOperation=o),s)s.x<0&&(s.width+=s.x,s.x=0),s.x+s.width>this.canvas.width&&(s.width=this.canvas.width-s.x),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 t.Point?n:new t.Point(0,0),l=0,c=0;if(n){var u=this.sketchCanvas.width-this.canvas.width,h=this.sketchCanvas.height-this.canvas.height;l=Math.round(u/2),c=Math.round(h/2)}this.context.drawImage(this.sketchCanvas,a.x-l*i,a.y-c*i,(this.canvas.width+2*l)*i,(this.canvas.height+2*c)*i,-l,-c,this.canvas.width+2*l,this.canvas.height+2*c)}this.context.restore()}},drawDebugInfo:function(e,i,n,o){if(this.useCanvas){var r=this.viewer.world.getIndexOfItem(o)%this.debugGridColor.length,s=this.context;s.save(),s.lineWidth=2*t.pixelDensityRatio,s.font="small-caps bold "+13*t.pixelDensityRatio+"px arial",s.strokeStyle=this.debugGridColor[r],s.fillStyle=this.debugGridColor[r],this.viewport.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:this.viewport.getRotation(!0)}),o.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:o.getRotation(!0),point:o.viewport.pixelFromPointNoRotate(o._getRotationPoint(!0),!0)}),o.viewport.getRotation(!0)%360==0&&o.getRotation(!0)%360==0&&o._drawer.viewer.viewport.getFlip()&&o._drawer._flip(),s.strokeRect(e.position.x*t.pixelDensityRatio,e.position.y*t.pixelDensityRatio,e.size.x*t.pixelDensityRatio,e.size.y*t.pixelDensityRatio);var a=(e.position.x+e.size.x/2)*t.pixelDensityRatio,l=(e.position.y+e.size.y/2)*t.pixelDensityRatio;s.translate(a,l),s.rotate(Math.PI/180*-this.viewport.getRotation(!0)),s.translate(-a,-l),0===e.x&&0===e.y&&(s.fillText("Zoom: "+this.viewport.getZoom(),e.position.x*t.pixelDensityRatio,(e.position.y-30)*t.pixelDensityRatio),s.fillText("Pan: "+this.viewport.getBounds().toString(),e.position.x*t.pixelDensityRatio,(e.position.y-20)*t.pixelDensityRatio)),s.fillText("Level: "+e.level,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+20)*t.pixelDensityRatio),s.fillText("Column: "+e.x,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+30)*t.pixelDensityRatio),s.fillText("Row: "+e.y,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+40)*t.pixelDensityRatio),s.fillText("Order: "+n+" of "+i,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+50)*t.pixelDensityRatio),s.fillText("Size: "+e.size.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+60)*t.pixelDensityRatio),s.fillText("Position: "+e.position.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+70)*t.pixelDensityRatio),this.viewport.getRotation(!0)%360!=0&&this._restoreRotationChanges(),o.getRotation(!0)%360!=0&&this._restoreRotationChanges(),o.viewport.getRotation(!0)%360==0&&o.getRotation(!0)%360==0&&o._drawer.viewer.viewport.getFlip()&&o._drawer._flip(),s.restore()}},debugRect:function(e){if(this.useCanvas){var i=this.context;i.save(),i.lineWidth=2*t.pixelDensityRatio,i.strokeStyle=this.debugGridColor[0],i.fillStyle=this.debugGridColor[0],i.strokeRect(e.x*t.pixelDensityRatio,e.y*t.pixelDensityRatio,e.width*t.pixelDensityRatio,e.height*t.pixelDensityRatio),i.restore()}},setImageSmoothingEnabled:function(t){this.useCanvas&&(this._imageSmoothingEnabled=t,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(t){t.msImageSmoothingEnabled=this._imageSmoothingEnabled,t.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(e){var i=this._getContext(e).canvas;return new t.Point(i.width,i.height)},getCanvasCenter:function(){return new t.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(e){var i=e.point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.save(),n.translate(i.x,i.y),this.viewer.viewport.flipped?(n.rotate(Math.PI/180*-e.degrees),n.scale(-1,1)):n.rotate(Math.PI/180*e.degrees),n.translate(-i.x,-i.y)},_flip:function(e){var i=(e=e||{}).point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.translate(i.x,0),n.scale(-1,1),n.translate(-i.x,0)},_restoreRotationChanges:function(t){this._getContext(t).restore()},_calculateCanvasSize:function(){var e=t.pixelDensityRatio,i=this.viewport.getContainerSize();return{x:Math.round(i.x*e),y:Math.round(i.y*e)}},_calculateSketchCanvasSize:function(){var t=this._calculateCanvasSize();if(0===this.viewport.getRotation())return t;var e=Math.ceil(Math.sqrt(t.x*t.x+t.y*t.y));return{x:e,y:e}}}}(l),function(t){t.Viewport=function(e){var i=arguments;i.length&&i[0]instanceof t.Point&&(e={containerSize:i[0],contentSize:i[1],config:i[2]}),e.config&&(t.extend(!0,e,e.config),delete e.config),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e.margins||{}),delete e.margins,e.initialDegrees=e.degrees,delete e.degrees,t.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:t.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:t.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:t.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:t.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:t.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:t.DEFAULT_SETTINGS.degrees,flipped:t.DEFAULT_SETTINGS.flipped,homeFillsViewer:t.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:t.DEFAULT_SETTINGS.silenceMultiImageWarnings},e),this._updateContainerInnerSize(),this.centerSpringX=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new t.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.degreesSpring=new t.Spring({initial:e.initialDegrees,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._oldDegrees=this.degreesSpring.current.value,this._setContentBounds(new t.Rect(0,0,1,1),1),this.goHome(!0),this.update()},t.Viewport.prototype={get degrees(){return t.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead."),this.getRotation()},set degrees(e){t.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(e)},resetContentSize:function(e){return t.console.assert(e,"[Viewport.resetContentSize] contentSize is required"),t.console.assert(e instanceof t.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),t.console.assert(e.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),t.console.assert(e.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new t.Rect(0,0,1,e.y/e.x),e.x),this},setHomeBounds:function(e,i){t.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(e,i)},_setContentBounds:function(e,i){t.console.assert(e,"[Viewport._setContentBounds] bounds is required"),t.console.assert(e instanceof t.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),t.console.assert(e.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),t.console.assert(e.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=e.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i),this._contentBounds=e.rotate(this.getRotation()).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 t=this._contentAspectRatio/this.getAspectRatio();return(this.homeFillsViewer?t>=1?t:1:t>=1?1:t)/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var e=this._contentBounds.getCenter(),i=1/this.getHomeZoom(),n=i/this.getAspectRatio();return new t.Rect(e.x-i/2,e.y-n/2,i,n)},goHome:function(t){return this.viewer&&this.viewer.raiseEvent("home",{immediately:t}),this.fitBounds(this.getHomeBounds(),t)},getMinZoom:function(){var t=this.getHomeZoom();return this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*t},getMaxZoom:function(){var t=this.maxZoomLevel;return t||(t=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,t/=this._contentBounds.width),Math.max(t,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new t.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return t.extend({},this._margins)},setMargins:function(e){t.console.assert("object"===t.type(e),"[Viewport.setMargins] margins must be an object"),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(-this.getRotation(t))},getBoundsNoRotate:function(e){var i=this.getCenter(e),n=1/this.getZoom(e),o=n/this.getAspectRatio();return new t.Rect(i.x-n/2,i.y-o/2,n,o)},getBoundsWithMargins:function(t){return this.getBoundsNoRotateWithMargins(t).rotate(-this.getRotation(t),this.getCenter(t))},getBoundsNoRotateWithMargins:function(t){var e=this.getBoundsNoRotate(t),i=this._containerInnerSize.x*this.getZoom(t);return e.x-=this._margins.left/i,e.y-=this._margins.top/i,e.width+=(this._margins.left+this._margins.right)/i,e.height+=(this._margins.top+this._margins.bottom)/i,e},getCenter:function(e){var i,n,o,r,s,a,l=new t.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),c=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return e?l:this.zoomPoint?(i=this.pixelFromPoint(this.zoomPoint,!0),r=(o=1/(n=this.getZoom()))/this.getAspectRatio(),s=new t.Rect(l.x-o/2,l.y-r/2,o,r),a=this._pixelFromPoint(this.zoomPoint,s).minus(i).rotate(-this.getRotation(!0)).divide(this._containerInnerSize.x*n),c.plus(a)):c},getZoom:function(t){return t?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(t){return Math.max(Math.min(t,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(t){var e=this.viewportToViewerElementRectangle(t).getBoundingBox(),i=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),n=!1,o=!1;if(this.wrapHorizontal);else{var r,s,a,l=e.x+e.width,c=i.x+i.width;r=e.width>i.width?this.visibilityRatio*i.width:this.visibilityRatio*e.width,s=i.x-l+r,a=c-e.x-r,r>i.width?(e.x+=(s+a)/2,n=!0):a<0?(e.x+=a,n=!0):s>0&&(e.x+=s,n=!0)}if(this.wrapVertical);else{var u,h,p,d=e.y+e.height,f=i.y+i.height;u=e.height>i.height?this.visibilityRatio*i.height:this.visibilityRatio*e.height,h=i.y-d+u,p=f-e.y-u,u>i.height?(e.y+=(h+p)/2,o=!0):p<0?(e.y+=p,o=!0):h>0&&(e.y+=h,o=!0)}var g=n||o,v=g?this.viewerElementToViewportRectangle(e):t.clone();return v.xConstrained=n,v.yConstrained=o,v.constraintApplied=g,v},_raiseConstraintsEvent:function(t){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:t})},applyConstraints:function(t){var e=this.getZoom(),i=this._applyZoomConstraints(e);e!==i&&this.zoomTo(i,this.zoomPoint,t);var n=this.getConstrainedBounds(!1);return n.constraintApplied&&(this.fitBounds(n,t),this._raiseConstraintsEvent(t)),this},ensureVisible:function(t){return this.applyConstraints(t)},_fitBounds:function(e,i){var n=(i=i||{}).immediately||!1,o=i.constraints||!1,r=this.getAspectRatio(),s=e.getCenter(),a=new t.Rect(e.x,e.y,e.width,e.height,e.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(n)return this.panTo(s,!0),this.zoomTo(l,null,!0),o&&this.applyConstraints(!0),this;var c=this.getCenter(!0),u=this.getZoom(!0);this.panTo(c,!0),this.zoomTo(u,null,!0);var h=this.getBounds(),p=this.getZoom();if(0===p||Math.abs(l/p-1)<1e-8)return this.zoomTo(l,null,!0),this.panTo(s,n),o&&this.applyConstraints(!1),this;if(o){this.panTo(s,!1),this.zoomTo(l,null,!1);var d=this.getConstrainedBounds();this.panTo(c,!0),this.zoomTo(u,null,!0),this.fitBounds(d)}else{var f=a.rotate(-this.getRotation()).getTopLeft().times(l).minus(h.getTopLeft().times(p)).divide(l-p);this.zoomTo(l,f,n)}return this},fitBounds:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!1})},fitBoundsWithConstraints:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!0})},fitVertically:function(e){var i=new t.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,e)},fitHorizontally:function(e){var i=new t.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,e)},getConstrainedBounds:function(t){var e;return e=this.getBounds(t),this._applyBoundaryConstraints(e)},panBy:function(e,i){var n=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(e),i)},panTo:function(t,e){return e?(this.centerSpringX.resetTo(t.x),this.centerSpringY.resetTo(t.y)):(this.centerSpringX.springTo(t.x),this.centerSpringY.springTo(t.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:t,immediately:e}),this},zoomBy:function(t,e,i){return this.zoomTo(this.zoomSpring.target.value*t,e,i)},zoomTo:function(e,i,n){var o=this;return this.zoomPoint=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n?this._adjustCenterSpringsForZoomPoint((function(){o.zoomSpring.resetTo(e)})):this.zoomSpring.springTo(e),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:e,refPoint:i,immediately:n}),this},setRotation:function(t,e){return this.rotateTo(t,null,e)},getRotation:function(t){return t?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(t,e,i){return this.rotateTo(t,e,i)},rotateTo:function(e,i,n){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===e&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n)if(this.rotationPivot){if(!(e-this._oldDegrees))return this.rotationPivot=null,this;this._rotateAboutPivot(e)}else this.degreesSpring.resetTo(e);else{var o=t.positiveModulo(this.degreesSpring.current.value,360),r=t.positiveModulo(e,360),s=r-o;s>180?r-=360:s<-180&&(r+=360);var a=o-r;this.degreesSpring.resetTo(e+a),this.degreesSpring.springTo(e)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:e,immediately:!!n,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(t,e,i){return this.rotateTo(this.degreesSpring.target.value+t,e,i)},resize:function(t,e){var i,n=this.getBoundsNoRotate(),o=n;return this.containerSize.x=t.x,this.containerSize.y=t.y,this._updateContainerInnerSize(),e&&(i=t.x/this.containerSize.x,o.width=n.width*i,o.height=o.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:t,maintain:e}),this.fitBounds(o,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new t.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 t=this;this._adjustCenterSpringsForZoomPoint((function(){t.zoomSpring.update()})),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var e=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,e},_rotateAboutPivot:function(t){var e=!0===t,i=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(i.x),this.centerSpringY.shiftBy(i.y),e?this.degreesSpring.update():this.degreesSpring.resetTo(t);var n=this.degreesSpring.current.value-this._oldDegrees,o=i.rotate(-1*n).times(-1);this.centerSpringX.shiftBy(o.x),this.centerSpringY.shiftBy(o.y)},_adjustCenterSpringsForZoomPoint:function(t){if(this.zoomPoint){var e=this.pixelFromPoint(this.zoomPoint,!0);t();var i=this.pixelFromPoint(this.zoomPoint,!0).minus(e),n=this.deltaPointsFromPixels(i,!0);this.centerSpringX.shiftBy(n.x),this.centerSpringY.shiftBy(n.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else t()},deltaPixelsFromPointsNoRotate:function(t,e){return t.times(this._containerInnerSize.x*this.getZoom(e))},deltaPixelsFromPoints:function(t,e){return this.deltaPixelsFromPointsNoRotate(t.rotate(this.getRotation(e)),e)},deltaPointsFromPixelsNoRotate:function(t,e){return t.divide(this._containerInnerSize.x*this.getZoom(e))},deltaPointsFromPixels:function(t,e){return this.deltaPointsFromPixelsNoRotate(t,e).rotate(-this.getRotation(e))},pixelFromPointNoRotate:function(t,e){return this._pixelFromPointNoRotate(t,this.getBoundsNoRotate(e))},pixelFromPoint:function(t,e){return this._pixelFromPoint(t,this.getBoundsNoRotate(e))},_pixelFromPointNoRotate:function(e,i){return e.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new t.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(t,e){return this._pixelFromPointNoRotate(t.rotate(this.getRotation(!0),this.getCenter(!0)),e)},pointFromPixelNoRotate:function(e,i){var n=this.getBoundsNoRotate(i);return e.minus(new t.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(t,e){return this.pointFromPixelNoRotate(t,e).rotate(-this.getRotation(e),this.getCenter(e))},_viewportToImageDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(e,i){if(e instanceof t.Point)return this.viewportToImageCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).viewportToImageCoordinates(e,i,!0)}}return this._viewportToImageDelta(e-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(e,i){if(e instanceof t.Point)return this.imageToViewportCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).imageToViewportCoordinates(e,i,!0)}}var o=this._imageToViewportDelta(e,i);return o.x+=this._contentBoundsNoRotate.x,o.y+=this._contentBoundsNoRotate.y,o},imageToViewportRectangle:function(e,i,n,o){var r=e;if(r instanceof t.Rect||(r=new t.Rect(e,i,n,o)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(1===s){return this.viewer.world.getItemAt(0).imageToViewportRectangle(e,i,n,o,!0)}}var a=this.imageToViewportCoordinates(r.x,r.y),l=this._imageToViewportDelta(r.width,r.height);return new t.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewportToImageRectangle:function(e,i,n,o){var r=e;if(r instanceof t.Rect||(r=new t.Rect(e,i,n,o)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(1===s){return this.viewer.world.getItemAt(0).viewportToImageRectangle(e,i,n,o,!0)}}var a=this.viewportToImageCoordinates(r.x,r.y),l=this._viewportToImageDelta(r.width,r.height);return new t.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewerElementToImageCoordinates:function(t){var e=this.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.pixelFromPoint(e,!0)},windowToImageCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer."),this.imageToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(t){return this.pointFromPixel(t,!0)},viewportToViewerElementCoordinates:function(t){return this.pixelFromPoint(t,!0)},viewerElementToViewportRectangle:function(e){return t.Rect.fromSummits(this.pointFromPixel(e.getTopLeft(),!0),this.pointFromPixel(e.getTopRight(),!0),this.pointFromPixel(e.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(e){return t.Rect.fromSummits(this.pixelFromPoint(e.getTopLeft(),!0),this.pixelFromPoint(e.getTopRight(),!0),this.pixelFromPoint(e.getBottomLeft(),!0))},windowToViewportCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer."),this.viewportToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewportToImageZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).viewportToImageZoom(e)}}var n=this._contentSizeNoRotate.x;return e*(this._containerInnerSize.x/n*this._contentBoundsNoRotate.width)},imageToViewportZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).imageToViewportZoom(e)}}return e*(this._contentSizeNoRotate.x/this._containerInnerSize.x/this._contentBoundsNoRotate.width)},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(t){return this.flipped===t||(this.flipped=t,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:t})),this}}}(l),function(t){t.TiledImage=function(e){var i=this;t.console.assert(e.tileCache,"[TiledImage] options.tileCache is required"),t.console.assert(e.drawer,"[TiledImage] options.drawer is required"),t.console.assert(e.viewer,"[TiledImage] options.viewer is required"),t.console.assert(e.imageLoader,"[TiledImage] options.imageLoader is required"),t.console.assert(e.source,"[TiledImage] options.source is required"),t.console.assert(!e.clip||e.clip instanceof t.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),t.EventSource.call(this),this._tileCache=e.tileCache,delete e.tileCache,this._drawer=e.drawer,delete e.drawer,this._imageLoader=e.imageLoader,delete e.imageLoader,e.clip instanceof t.Rect&&(this._clip=e.clip.clone()),delete e.clip;var n=e.x||0;delete e.x;var o=e.y||0;delete e.y,this.normHeight=e.source.dimensions.y/e.source.dimensions.x,this.contentAspectX=e.source.dimensions.x/e.source.dimensions.y;var r=1;e.width?(r=e.width,delete e.width,e.height&&(t.console.error("specifying both width and height to a tiledImage is not supported"),delete e.height)):e.height&&(r=e.height/this.normHeight,delete e.height);var s=e.fitBounds;delete e.fitBounds;var a=e.fitBoundsPlacement||l.Placement.CENTER;delete e.fitBoundsPlacement;var c=e.degrees||0;delete e.degrees,t.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,immediateRender:t.DEFAULT_SETTINGS.immediateRender,blendTime:t.DEFAULT_SETTINGS.blendTime,alwaysBlend:t.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:t.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:t.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:t.DEFAULT_SETTINGS.iOSDevice,debugMode:t.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:t.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:t.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:t.DEFAULT_SETTINGS.placeholderFillStyle,opacity:t.DEFAULT_SETTINGS.opacity,preload:t.DEFAULT_SETTINGS.preload,compositeOperation:t.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:t.DEFAULT_SETTINGS.subPixelRoundingForTransparency},e),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new t.Spring({initial:n,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new t.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new t.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new t.Spring({initial:c,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),s&&this.fitBounds(s,a,!0),this._drawingHandler=function(e){i.viewer.raiseEvent("tile-drawing",t.extend({tiledImage:i},e))}},t.extend(t.TiledImage.prototype,t.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(t){t!==this._fullyLoaded&&(this._fullyLoaded=t,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=t.now(),this._needsDraw=!0},update:function(){var t=this._xSpring.update(),e=this._ySpring.update(),i=this._scaleSpring.update(),n=this._degreesSpring.update();return!!(t||e||i||n)&&(this._updateForScale(),this._needsDraw=!0,!0)},draw:function(){0!==this.opacity||this._preload?(this._midDraw=!0,this._updateViewport(),this._midDraw=!1):this._needsDraw=!1},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(this.getRotation(t),this._getRotationPoint(t))},getBoundsNoRotate:function(e){return e?new t.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new t.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){return t.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead"),this.getBounds()},getClippedBounds:function(e){var i=this.getBoundsNoRotate(e);if(this._clip){var n=(e?this._worldWidthCurrent:this._worldWidthTarget)/this.source.dimensions.x,o=this._clip.times(n);i=new t.Rect(i.x+o.x,i.y+o.y,o.width,o.height)}return i.rotate(this.getRotation(e),this._getRotationPoint(e))},getTileBounds:function(t,e,i){var n=this.source.getNumTiles(t),o=(n.x+e%n.x)%n.x,r=(n.y+i%n.y)%n.y,s=this.source.getTileBounds(t,o,r);return this.getFlip()&&(s.x=1-s.x-s.width),s.x+=(e-o)/n.x,s.y+=this._worldHeightCurrent/this._worldWidthCurrent*((i-r)/n.y),s},getContentSize:function(){return new t.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var e=this.imageToWindowCoordinates(new t.Point(0,0)),i=this.imageToWindowCoordinates(this.getContentSize());return new t.Point(i.x-e.x,i.y-e.y)},_viewportToImageDelta:function(e,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e*(this.source.dimensions.x/o),i*(this.source.dimensions.y*this.contentAspectX/o))},viewportToImageCoordinates:function(e,i,n){var o;return e instanceof t.Point?(n=i,o=e):o=new t.Point(e,i),o=o.rotate(-this.getRotation(n),this._getRotationPoint(n)),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(e,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e/this.source.dimensions.x*o,i/this.source.dimensions.y/this.contentAspectX*o)},imageToViewportCoordinates:function(e,i,n){e instanceof t.Point&&(n=i,i=e.y,e=e.x);var o=this._imageToViewportDelta(e,i);return n?(o.x+=this._xSpring.current.value,o.y+=this._ySpring.current.value):(o.x+=this._xSpring.target.value,o.y+=this._ySpring.target.value),o.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(e,i,n,o,r){var s=e;s instanceof t.Rect?r=i:s=new t.Rect(e,i,n,o);var a=this.imageToViewportCoordinates(s.getTopLeft(),r),l=this._imageToViewportDelta(s.width,s.height,r);return new t.Rect(a.x,a.y,l.x,l.y,s.degrees+this.getRotation(r))},viewportToImageRectangle:function(e,i,n,o,r){var s=e;e instanceof t.Rect?r=i:s=new t.Rect(e,i,n,o);var a=this.viewportToImageCoordinates(s.getTopLeft(),r),l=this._viewportToImageDelta(s.width,s.height,r);return new t.Rect(a.x,a.y,l.x,l.y,s.degrees-this.getRotation(r))},viewerElementToImageCoordinates:function(t){var e=this.viewport.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.viewport.pixelFromPoint(e,!0)},windowToImageCoordinates:function(t){var e=t.minus(l.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(e)},imageToWindowCoordinates:function(t){return this.imageToViewerElementCoordinates(t).plus(l.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(e){var i=this._scaleSpring.current.value;return e=e.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new t.Rect((e.x-this._xSpring.current.value)/i,(e.y-this._ySpring.current.value)/i,e.width/i,e.height/i,e.degrees)},viewportToImageZoom:function(t){return this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x*t},imageToViewportZoom:function(t){return t/(this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x)},setPosition:function(t,e){var i=this._xSpring.target.value===t.x&&this._ySpring.target.value===t.y;if(e){if(i&&this._xSpring.current.value===t.x&&this._ySpring.current.value===t.y)return;this._xSpring.resetTo(t.x),this._ySpring.resetTo(t.y),this._needsDraw=!0}else{if(i)return;this._xSpring.springTo(t.x),this._ySpring.springTo(t.y),this._needsDraw=!0}i||this._raiseBoundsChange()},setWidth:function(t,e){this._setScale(t,e)},setHeight:function(t,e){this._setScale(t/this.normHeight,e)},setCroppingPolygons:function(e){var i=function(e){return e.map((function(e){try{if(function(e){return e instanceof t.Point||"number"==typeof e.x&&"number"==typeof e.y}(e))return{x:e.x,y:e.y};throw new Error}catch(i){throw new Error("A Provided cropping polygon point is not supported")}}))};try{if(!t.isArray(e))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=e.map((function(t){return i(t)}))}catch(n){t.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),t.console.error(n),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(e,i,n){i=i||t.Placement.CENTER;var o=t.Placement.properties[i],r=this.contentAspectX,s=0,a=0,l=1,c=1;if(this._clip&&(r=this._clip.getAspectRatio(),l=this._clip.width/this.source.dimensions.x,c=this._clip.height/this.source.dimensions.y,e.getAspectRatio()>r?(s=this._clip.x/this._clip.height*e.height,a=this._clip.y/this._clip.height*e.height):(s=this._clip.x/this._clip.width*e.width,a=this._clip.y/this._clip.width*e.width)),e.getAspectRatio()>r){var u=e.height/c,h=0;o.isHorizontallyCentered?h=(e.width-e.height*r)/2:o.isRight&&(h=e.width-e.height*r),this.setPosition(new t.Point(e.x-s+h,e.y-a),n),this.setHeight(u,n)}else{var p=e.width/l,d=0;o.isVerticallyCentered?d=(e.height-e.width/r)/2:o.isBottom&&(d=e.height-e.width/r),this.setPosition(new t.Point(e.x-s,e.y-a+d),n),this.setWidth(p,n)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(e){t.console.assert(!e||e instanceof t.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),e instanceof t.Rect?this._clip=e.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(t){this.flipped=!!t,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(t){t!==this.opacity&&(this.opacity=t,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(t){this._preload=!!t,this._needsDraw=!0},getRotation:function(t){return t?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(t,e){this._degreesSpring.target.value===t&&this._degreesSpring.isAtTargetValue()||(e?this._degreesSpring.resetTo(t):this._degreesSpring.springTo(t),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(t){return this.getBoundsNoRotate(t).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(t){t!==this.compositeOperation&&(this.compositeOperation=t,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(t,e){var i=this._scaleSpring.target.value===t;if(e){if(i&&this._scaleSpring.current.value===t)return;this._scaleSpring.resetTo(t),this._updateForScale(),this._needsDraw=!0}else{if(i)return;this._scaleSpring.springTo(t),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 t=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),e=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,i=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(e/this.minPixelRatio)/Math.log(2))));return i=Math.max(i,this.source.minLevel||0),{lowestLevel:t=Math.min(t,i),highestLevel:i}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){this.lastDrawn.pop().beingDrawn=!1}var e=this.viewport,i=this._viewportToTiledImageRectangle(e.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var n=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(null===(i=i.intersection(n)))return}for(var o=this._getLevelsInterval(),r=o.lowestLevel,s=o.highestLevel,a=null,l=!1,c=t.now(),u=s;u>=r;u--){var h=!1,p=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!0).x*this._scaleSpring.current.value;if(u===r||!l&&p>=this.minPixelRatio)h=!0,l=!0;else if(!l)continue;var d=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!1).x*this._scaleSpring.current.value,f=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,g=this.immediateRender?1:f,v=Math.min(1,(p-.5)/.5),m=g/Math.abs(g-d);if(a=this._updateLevel(l,h,u,v,m,i,c,a),this._providesCoverage(this.coverage,u))break}this._drawTiles(this.lastDrawn),a&&!a.context2D?(this._loadTile(a,c),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(0===this._tilesLoading)},_getCornerTiles:function(e,i,n){var o,r,s,a;this.wrapHorizontal?(o=t.positiveModulo(i.x,1),r=t.positiveModulo(n.x,1)):(o=Math.max(0,i.x),r=Math.min(1,n.x));var l=1/this.source.aspectRatio;this.wrapVertical?(s=t.positiveModulo(i.y,l),a=t.positiveModulo(n.y,l)):(s=Math.max(0,i.y),a=Math.min(l,n.y));var c=this.source.getTileAtPoint(e,new t.Point(o,s)),u=this.source.getTileAtPoint(e,new t.Point(r,a)),h=this.source.getNumTiles(e);return this.wrapHorizontal&&(c.x+=h.x*Math.floor(i.x),u.x+=h.x*Math.floor(n.x)),this.wrapVertical&&(c.y+=h.y*Math.floor(i.y/l),u.y+=h.y*Math.floor(n.y/l)),{topLeft:c,bottomRight:u}},_updateLevel:function(t,e,i,n,o,r,s,a){var l=r.getBoundingBox().getTopLeft(),c=r.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:t,level:i,opacity:n,visibility:o,drawArea:r,topleft:l,bottomright:c,currenttime:s,best:a}),this._resetCoverage(this.coverage,i),this._resetCoverage(this.loadingCoverage,i);var u=this._getCornerTiles(i,l,c),h=u.topLeft,p=u.bottomRight,d=this.source.getNumTiles(i),f=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(p.x+=1,this.wrapHorizontal||(p.x=Math.min(p.x,d.x-1)));for(var g=h.x;g<=p.x;g++)for(var v=h.y;v<=p.y;v++){var m;if(this.getFlip()){var y=(d.x+g%d.x)%d.x;m=g+d.x-y-y-1}else m=g;null!==r.intersection(this.getTileBounds(i,m,v))&&(a=this._updateTile(e,t,m,v,i,n,o,f,d,s,a))}return a},_updateTile:function(t,e,i,n,o,r,s,a,l,c,u){var h=this._getTile(i,n,o,c,l,this._worldWidthCurrent,this._worldHeightCurrent),p=e;this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:h}),this._setCoverage(this.coverage,o,i,n,!1);var d=h.loaded||h.loading||this._isCovered(this.loadingCoverage,o,i,n);if(this._setCoverage(this.loadingCoverage,o,i,n,d),!h.exists)return u;if(t&&!p&&(this._isCovered(this.coverage,o,i,n)?this._setCoverage(this.coverage,o,i,n,!0):p=!0),!p)return u;if(this._positionTile(h,this.source.tileOverlap,this.viewport,a,s),!h.loaded)if(h.context2D)this._setTileLoaded(h);else{var f=this._tileCache.getImageRecord(h.cacheKey);f&&this._setTileLoaded(h,f.getData())}h.loaded?this._blendTile(h,i,n,o,r,c)&&(this._needsDraw=!0):h.loading?this._tilesLoading++:d||(u=this._compareTiles(u,h));return u},_getTile:function(e,i,n,o,r,s,a){var l,c,u,h,p,d,f,g,v,m,y=this.tilesMatrix,w=this.source;return y[n]||(y[n]={}),y[n][e]||(y[n][e]={}),y[n][e][i]&&!y[n][e][i].flipped==!this.flipped||(l=(r.x+e%r.x)%r.x,c=(r.y+i%r.y)%r.y,u=this.getTileBounds(n,e,i),h=w.getTileBounds(n,l,c,!0),p=w.tileExists(n,l,c),d=w.getTileUrl(n,l,c),f=w.getTilePostData(n,l,c),this.loadTilesWithAjax?(g=w.getTileAjaxHeaders(n,l,c),t.isPlainObject(this.ajaxHeaders)&&(g=t.extend({},this.ajaxHeaders,g))):g=null,v=w.getContext2D?w.getContext2D(n,l,c):void 0,m=new t.Tile(n,e,i,u,p,d,v,this.loadTilesWithAjax,g,h,f,w.getTileHashKey(n,l,c,d,g,f)),this.getFlip()?0===l&&(m.isRightMost=!0):l===r.x-1&&(m.isRightMost=!0),c===r.y-1&&(m.isBottomMost=!0),m.flipped=this.flipped,y[n][e][i]=m),(m=y[n][e][i]).lastTouchTime=o,m},_loadTile:function(t,e){var i=this;t.loading=!0,this._imageLoader.addJob({src:t.getUrl(),tile:t,source:this.source,postData:t.postData,loadWithAjax:t.loadWithAjax,ajaxHeaders:t.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(n,o,r){i._onTileLoad(t,e,n,o,r)},abort:function(){t.loading=!1}})},_onTileLoad:function(e,i,n,o,r){if(!n)return t.console.error("Tile %s failed to load: %s - error: %s",e,e.getUrl(),o),this.viewer.raiseEvent("tile-load-failed",{tile:e,tiledImage:this,time:i,message:o,tileRequest:r}),e.loading=!1,void(e.exists=!1);if(i<this.lastResetTime)return t.console.warn("Ignoring tile %s loaded before reset: %s",e,e.getUrl()),void(e.loading=!1);var s=this,a=function(){var t=s.source.getClosestLevel();s._setTileLoaded(e,n,t,r)};this._midDraw?window.setTimeout(a,1):a()},_setTileLoaded:function(e,i,n,o){var r=0,s=this;function a(){return r++,l}function l(){0===--r&&(e.loading=!1,e.loaded=!0,e.hasTransparency=s.source.hasTransparency(e.context2D,e.getUrl(),e.ajaxHeaders,e.postData),e.context2D||s._tileCache.cacheTile({data:i,tile:e,cutoff:n,tiledImage:s}),s._needsDraw=!0)}this.viewer.raiseEvent("tile-loaded",{tile:e,tiledImage:this,tileRequest:o,get image(){return t.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead."),i},data:i,getCompletionCallback:a}),a()()},_positionTile:function(e,i,n,o,r){var s=e.bounds.getTopLeft();s.x*=this._scaleSpring.current.value,s.y*=this._scaleSpring.current.value,s.x+=this._xSpring.current.value,s.y+=this._ySpring.current.value;var a=e.bounds.getSize();a.x*=this._scaleSpring.current.value,a.y*=this._scaleSpring.current.value;var l=n.pixelFromPointNoRotate(s,!0),c=n.pixelFromPointNoRotate(s,!1),u=n.deltaPixelsFromPointsNoRotate(a,!0),h=n.deltaPixelsFromPointsNoRotate(a,!1),p=c.plus(h.divide(2)),d=o.squaredDistanceTo(p);i||(u=u.plus(new t.Point(1,1))),e.isRightMost&&this.wrapHorizontal&&(u.x+=.75),e.isBottomMost&&this.wrapVertical&&(u.y+=.75),e.position=l,e.size=u,e.squaredDistance=d,e.visibility=r},_blendTile:function(t,e,i,n,o,r){var s,a,l=1e3*this.blendTime;if(t.blendStart||(t.blendStart=r),s=r-t.blendStart,a=l?Math.min(1,s/l):1,this.alwaysBlend&&(a*=o),t.opacity=a,this.lastDrawn.push(t),1===a)this._setCoverage(this.coverage,n,e,i,!0),this._hasOpaqueTile=!0;else if(s<l)return!0;return!1},_compareTiles:function(t,e){return t?e.visibility>t.visibility||e.visibility===t.visibility&&e.squaredDistance<t.squaredDistance?e:t:e},_drawTiles:function(o){if(0!==this.opacity&&(0!==o.length||this.placeholderFillStyle)){var r,s,a,l=o[0];l&&(r=this.opacity<1||this.compositeOperation&&"source-over"!==this.compositeOperation||!this._isBottomItem()&&this.source.hasTransparency(l.context2D,l.getUrl(),l.ajaxHeaders,l.postData));var c,u=this.viewport.getZoom(!0),h=this.viewportToImageZoom(u);o.length>1&&h>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(!0)%360==0&&t.supportsCanvas&&this.viewer.useCanvas&&(r=!0,s=l.getScaleForEdgeSmoothing(),a=l.getTranslationForEdgeSmoothing(s,this._drawer.getCanvasSize(!1),this._drawer.getCanvasSize(!0))),r&&(s||(c=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(!0)).getIntegerBoundingBox(),this._drawer.viewer.viewport.getFlip()&&(this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0||(c.x=this._drawer.viewer.container.clientWidth-(c.x+c.width))),c=c.times(t.pixelDensityRatio)),this._drawer._clear(!0,c)),s||(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:r}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:r}),this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip());var p=!1;if(this._clip){this._drawer.saveContext(r);var d=this.imageToViewportRectangle(this._clip,!0);d=d.rotate(-this.getRotation(!0),this._getRotationPoint(!0));var f=this._drawer.viewportToDrawerRectangle(d);s&&(f=f.times(s)),a&&(f=f.translate(a)),this._drawer.setClip(f,r),p=!0}if(this._croppingPolygons){var g=this;this._drawer.saveContext(r);try{var v=this._croppingPolygons.map((function(t){return t.map((function(t){var e=g.imageToViewportCoordinates(t.x,t.y,!0).rotate(-g.getRotation(!0),g._getRotationPoint(!0)),i=g._drawer.viewportCoordToDrawerCoord(e);return s&&(i=i.times(s)),i}))}));this._drawer.clipWithPolygons(v,r)}catch(T){t.console.error(T)}p=!0}if(this.placeholderFillStyle&&!1===this._hasOpaqueTile){var m=this._drawer.viewportToDrawerRectangle(this.getBounds(!0));s&&(m=m.times(s)),a&&(m=m.translate(a));var y=null;y="function"==typeof this.placeholderFillStyle?this.placeholderFillStyle(this,this._drawer.context):this.placeholderFillStyle,this._drawer.drawRectangle(m,y,r)}var w=function(o){if("number"==typeof o)return n(o);if(!o||!t.Browser)return e;var r=o[t.Browser.vendor];i(r)&&(r=o["*"]);return n(r)}(this.subPixelRoundingForTransparency),x=!1;if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)x=!0;else if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){x=!(this.viewer&&this.viewer.isAnimating())}for(var b=o.length-1;b>=0;b--)l=o[b],this._drawer.drawTile(l,this._drawingHandler,r,s,a,x,this.source),l.beingDrawn=!0,this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:l});p&&this._drawer.restoreContext(r),s||(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(r),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(r)),r&&(s&&(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:!1}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:!1})),this._drawer.blendSketch({opacity:this.opacity,scale:s,translate:a,compositeOperation:this.compositeOperation,bounds:c}),s&&(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1))),s||this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip(),this._drawDebugInfo(o)}},_drawDebugInfo:function(e){if(this.debugMode)for(var i=e.length-1;i>=0;i--){var n=e[i];try{this._drawer.drawDebugInfo(n,e.length,i,this)}catch(o){t.console.error(o)}}},_providesCoverage:function(t,e,i,n){var o,r,s,a;if(!t[e])return!1;if(void 0===i||void 0===n){for(s in o=t[e])if(Object.prototype.hasOwnProperty.call(o,s))for(a in r=o[s])if(Object.prototype.hasOwnProperty.call(r,a)&&!r[a])return!1;return!0}return void 0===t[e][i]||void 0===t[e][i][n]||!0===t[e][i][n]},_isCovered:function(t,e,i,n){return void 0===i||void 0===n?this._providesCoverage(t,e+1):this._providesCoverage(t,e+1,2*i,2*n)&&this._providesCoverage(t,e+1,2*i,2*n+1)&&this._providesCoverage(t,e+1,2*i+1,2*n)&&this._providesCoverage(t,e+1,2*i+1,2*n+1)},_setCoverage:function(e,i,n,o,r){e[i]?(e[i][n]||(e[i][n]={}),e[i][n][o]=r):t.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",i)},_resetCoverage:function(t,e){t[e]={}}});var e=t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function i(e){return e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function n(t){return i(t)?e:t}}(l),function(t){var e=function(e){t.console.assert(e,"[TileCache.cacheTile] options is required"),t.console.assert(e.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(e.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=e.tile,this.tiledImage=e.tiledImage},i=function(e){t.console.assert(e,"[ImageRecord] options is required"),t.console.assert(e.data,"[ImageRecord] options.data is required"),this._tiles=[],e.create.apply(null,[this,e.data,e.ownerTile]),this._destroyImplementation=e.destroy.bind(null,this),this.getImage=e.getImage.bind(null,this),this.getData=e.getData.bind(null,this),this.getRenderedContext=e.getRenderedContext.bind(null,this),this.getCopyRenderedContext=e.getCopyRenderedContext.bind(null,this)};i.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(e){t.console.assert(e,"[ImageRecord.addTile] tile is required"),this._tiles.push(e)},removeTile:function(e){for(var i=0;i<this._tiles.length;i++)if(this._tiles[i]===e)return void this._tiles.splice(i,1);t.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",e)},getTileCount:function(){return this._tiles.length}},t.TileCache=function(e){e=e||{},this._maxImageCacheCount=e.maxImageCacheCount||t.DEFAULT_SETTINGS.maxImageCacheCount,this._tilesLoaded=[],this._imagesLoaded=[],this._imagesLoadedCount=0},t.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(n){t.console.assert(n,"[TileCache.cacheTile] options is required"),t.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(n.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required"),t.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var o=n.cutoff||0,r=this._tilesLoaded.length,s=this._imagesLoaded[n.tile.cacheKey];if(s||(n.data||(t.console.error("[TileCache.cacheTile] options.image was renamed to options.data. '.image' attribute has been deprecated and will be removed in the future."),n.data=n.image),t.console.assert(n.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord"),s=this._imagesLoaded[n.tile.cacheKey]=new i({data:n.data,ownerTile:n.tile,create:n.tiledImage.source.createTileCache,destroy:n.tiledImage.source.destroyTileCache,getImage:n.tiledImage.source.getTileCacheDataAsImage,getData:n.tiledImage.source.getTileCacheData,getRenderedContext:n.tiledImage.source.getTileCacheDataAsContext2D,getCopyRenderedContext:n.tiledImage.source.getCopyTileCacheDataAsContext2D}),this._imagesLoadedCount++),s.addTile(n.tile),n.tile.cacheImageRecord=s,this._imagesLoadedCount>this._maxImageCacheCount){for(var a,l,c,u,h,p,d=null,f=-1,g=null,v=this._tilesLoaded.length-1;v>=0;v--)(a=(p=this._tilesLoaded[v]).tile).level<=o||a.beingDrawn||(d?(u=a.lastTouchTime,l=d.lastTouchTime,h=a.level,c=d.level,(u<l||u===l&&h>c)&&(d=a,f=v,g=p)):(d=a,f=v,g=p));d&&f>=0&&(this._unloadTile(g),r=f)}this._tilesLoaded[r]=new e({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(e){var i;t.console.assert(e,"[TileCache.clearTilesFor] tiledImage is required");for(var n=0;n<this._tilesLoaded.length;++n)(i=this._tilesLoaded[n]).tiledImage===e&&(this._unloadTile(i),this._tilesLoaded.splice(n,1),n--)},getImageRecord:function(e){return t.console.assert(e,"[TileCache.getImageRecord] cacheKey is required"),this._imagesLoaded[e]},_unloadTile:function(e){t.console.assert(e,"[TileCache._unloadTile] tileRecord is required");var i=e.tile,n=e.tiledImage;i.unload(),i.cacheImageRecord=null;var o=this._imagesLoaded[i.cacheKey];o.removeTile(i),o.getTileCount()||(o.destroy(),delete this._imagesLoaded[i.cacheKey],this._imagesLoadedCount--),n.viewer.raiseEvent("tile-unloaded",{tile:i,tiledImage:n})}}}(l),function(t){t.World=function(e){var i=this;t.console.assert(e.viewer,"[World] options.viewer is required"),t.EventSource.call(this),this.viewer=e.viewer,this._items=[],this._needsDraw=!1,this._autoRefigureSizes=!0,this._needsSizesFigured=!1,this._delegatedFigureSizes=function(t){i._autoRefigureSizes?i._figureSizes():i._needsSizesFigured=!0},this._figureSizes()},t.extend(t.World.prototype,t.EventSource.prototype,{addItem:function(e,i){if(t.console.assert(e,"[World.addItem] item is required"),t.console.assert(e instanceof t.TiledImage,"[World.addItem] only TiledImages supported at this time"),void 0!==(i=i||{}).index){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,e)}else this._items.push(e);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0,this._needsDraw=!0,e.addHandler("bounds-change",this._delegatedFigureSizes),e.addHandler("clip-change",this._delegatedFigureSizes),this.raiseEvent("add-item",{item:e})},getItemAt:function(e){return t.console.assert(void 0!==e,"[World.getItemAt] index is required"),this._items[e]},getIndexOfItem:function(e){return t.console.assert(e,"[World.getIndexOfItem] item is required"),t.indexOf(this._items,e)},getItemCount:function(){return this._items.length},setItemIndex:function(e,i){t.console.assert(e,"[World.setItemIndex] item is required"),t.console.assert(void 0!==i,"[World.setItemIndex] index is required");var n=this.getIndexOfItem(e);if(i>=this._items.length)throw new Error("Index bigger than number of layers.");i!==n&&-1!==n&&(this._items.splice(n,1),this._items.splice(i,0,e),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:e,previousIndex:n,newIndex:i}))},removeItem:function(e){t.console.assert(e,"[World.removeItem] item is required");var i=t.indexOf(this._items,e);-1!==i&&(e.removeHandler("bounds-change",this._delegatedFigureSizes),e.removeHandler("clip-change",this._delegatedFigureSizes),e.destroy(),this._items.splice(i,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(e))},removeAll:function(){var t,e;for(this.viewer._cancelPendingImages(),e=0;e<this._items.length;e++)(t=this._items[e]).removeHandler("bounds-change",this._delegatedFigureSizes),t.removeHandler("clip-change",this._delegatedFigureSizes),t.destroy();var i=this._items;for(this._items=[],this._figureSizes(),this._needsDraw=!0,e=0;e<i.length;e++)t=i[e],this._raiseRemoveItem(t)},resetItems:function(){for(var t=0;t<this._items.length;t++)this._items[t].reset()},update:function(){for(var t=!1,e=0;e<this._items.length;e++)t=this._items[e].update()||t;return t},draw:function(){for(var t=0;t<this._items.length;t++)this._items[t].draw();this._needsDraw=!1},needsDraw:function(){for(var t=0;t<this._items.length;t++)if(this._items[t].needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(t){this._autoRefigureSizes=t,t&this._needsSizesFigured&&(this._figureSizes(),this._needsSizesFigured=!1)},arrange:function(e){var i,n=(e=e||{}).immediately||!1,o=e.layout||t.DEFAULT_SETTINGS.collectionLayout,r=e.rows||t.DEFAULT_SETTINGS.collectionRows,s=e.columns||t.DEFAULT_SETTINGS.collectionColumns,a=e.tileSize||t.DEFAULT_SETTINGS.collectionTileSize,l=a+(e.tileMargin||t.DEFAULT_SETTINGS.collectionTileMargin);i=!e.rows&&s?s:Math.ceil(this._items.length/r);var c,u,h,p,d,f=0,g=0;this.setAutoRefigureSizes(!1);for(var v=0;v<this._items.length;v++)v&&v%i==0&&("horizontal"===o?(g+=l,f=0):(f+=l,g=0)),p=(h=(u=(c=this._items[v]).getBounds()).width>u.height?a:a*(u.width/u.height))*(u.height/u.width),d=new t.Point(f+(a-h)/2,g+(a-p)/2),c.setPosition(d,n),c.setWidth(h,n),"horizontal"===o?f+=l:g+=l;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var e=this._homeBounds?this._homeBounds.clone():null,i=this._contentSize?this._contentSize.clone():null,n=this._contentFactor||0;if(this._items.length){var o=this._items[0],r=o.getBounds();this._contentFactor=o.getContentSize().x/r.width;for(var s=o.getClippedBounds().getBoundingBox(),a=s.x,l=s.y,c=s.x+s.width,u=s.y+s.height,h=1;h<this._items.length;h++)r=(o=this._items[h]).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),c=Math.max(c,s.x+s.width),u=Math.max(u,s.y+s.height);this._homeBounds=new t.Rect(a,l,c-a,u-l),this._contentSize=new t.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}else this._homeBounds=new t.Rect(0,0,1,1),this._contentSize=new t.Point(1,1),this._contentFactor=1;this._contentFactor===n&&this._homeBounds.equals(e)&&this._contentSize.equals(i)||this.raiseEvent("metrics-change",{})},_raiseRemoveItem:function(t){this.raiseEvent("remove-item",{item:t})}})}(l)},function(t,e,i){var n=i(56),o=i(43);t.exports=function(t){return n(o(t))}},function(t,e,i){var n=i(43);t.exports=function(t){return Object(n(t))}},function(t,e,i){var n=i(19),o=i(81),r=i(24),s=i(57),a=Object.defineProperty;e.f=n?a:function(t,e,i){if(r(t),e=s(e,!0),r(i),o)try{return a(t,e,i)}catch(n){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var n=i(15);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,i){var n=i(19),o=i(12),r=i(16),s=Object.defineProperty,a={},l=function(t){throw t};t.exports=function(t,e){if(r(a,t))return a[t];e||(e={});var i=[][t],c=!!r(e,"ACCESSORS")&&e.ACCESSORS,u=r(e,0)?e[0]:l,h=r(e,1)?e[1]:void 0;return a[t]=!!i&&!o((function(){if(c&&!n)return!0;var t={length:-1};c?s(t,1,{enumerable:!0,get:l}):t[1]=1,i.call(t,u,h)}))}},function(t,e,i){var n=i(19),o=i(23),r=i(41);t.exports=n?function(t,e,i){return o.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){"use strict";var n=i(0),o=i(30).map,r=i(51),s=i(25),a=r("map"),l=s("map");n({target:"Array",proto:!0,forced:!a||!l},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(37),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,e,i){"use strict";var n=i(0),o=i(30).filter,r=i(51),s=i(25),a=r("filter"),l=s("filter");n({target:"Array",proto:!0,forced:!a||!l},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(94),o=i(56),r=i(22),s=i(28),a=i(74),l=[].push,c=function(t){var e=1==t,i=2==t,c=3==t,u=4==t,h=6==t,p=5==t||h;return function(d,f,g,v){for(var m,y,w=r(d),x=o(w),b=n(f,g,3),T=s(x.length),S=0,P=v||a,E=e?P(d,T):i?P(d,0):void 0;T>S;S++)if((p||S in x)&&(y=b(m=x[S],S,w),t))if(e)E[S]=y;else if(y)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:l.call(E,m)}else if(u)return!1;return h?-1:c||u?u:E}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},function(t,e,i){var n=i(0),o=i(110);n({target:"Array",stat:!0,forced:!i(114)((function(t){Array.from(t)}))},{from:o})},function(t,e,i){"use strict";var n=i(0),o=i(15),r=i(46),s=i(62),a=i(28),l=i(21),c=i(49),u=i(13),h=i(51),p=i(25),d=h("slice"),f=p("slice",{ACCESSORS:!0,0:0,1:2}),g=u("species"),v=[].slice,m=Math.max;n({target:"Array",proto:!0,forced:!d||!f},{slice:function(t,e){var i,n,u,h=l(this),p=a(h.length),d=s(t,p),f=s(void 0===e?p:e,p);if(r(h)&&("function"!=typeof(i=h.constructor)||i!==Array&&!r(i.prototype)?o(i)&&null===(i=i[g])&&(i=void 0):i=void 0,i===Array||void 0===i))return v.call(h,d,f);for(n=new(void 0===i?Array:i)(m(f-d,0)),u=0;d<f;d++,u++)d in h&&c(n,u,h[d]);return n.length=u,n}})},function(t,e,i){var n=i(19),o=i(23).f,r=Function.prototype,s=r.toString,a=/^\s*function ([^ (]*)/,l="name";n&&!(l in r)&&o(r,l,{configurable:!0,get:function(){try{return s.call(this).match(a)[1]}catch(t){return""}}})},function(t,e,i){var n=i(0),o=i(12),r=i(21),s=i(40).f,a=i(19),l=o((function(){s(1)}));n({target:"Object",stat:!0,forced:!a||l,sham:!a},{getOwnPropertyDescriptor:function(t,e){return s(r(t),e)}})},function(t,e,i){var n=i(0),o=i(19),r=i(86),s=i(21),a=i(40),l=i(49);n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){for(var e,i,n=s(t),o=a.f,c=r(n),u={},h=0;c.length>h;)void 0!==(i=o(n,e=c[h++]))&&l(u,e,i);return u}})},function(t,e,i){var n=i(0),o=i(22),r=i(64);n({target:"Object",stat:!0,forced:i(12)((function(){r(1)}))},{keys:function(t){return r(o(t))}})},function(t,e){var i=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:i)(t)}},function(t,e,i){"use strict";var n=i(0),o=i(12),r=i(46),s=i(15),a=i(22),l=i(28),c=i(49),u=i(74),h=i(51),p=i(13),d=i(100),f=p("isConcatSpreadable"),g=9007199254740991,v="Maximum allowed index exceeded",m=d>=51||!o((function(){var t=[];return t[f]=!1,t.concat()[0]!==t})),y=h("concat"),w=function(t){if(!s(t))return!1;var e=t[f];return void 0!==e?!!e:r(t)};n({target:"Array",proto:!0,forced:!m||!y},{concat:function(t){var e,i,n,o,r,s=a(this),h=u(s,0),p=0;for(e=-1,n=arguments.length;e<n;e++)if(w(r=-1===e?s:arguments[e])){if(p+(o=l(r.length))>g)throw TypeError(v);for(i=0;i<o;i++,p++)i in r&&c(h,p,r[i])}else{if(p>=g)throw TypeError(v);c(h,p++,r)}return h.length=p,h}})},function(t,e,i){"use strict";var n=i(0),o=i(30).findIndex,r=i(50),s=i(25),a="findIndex",l=!0,c=s(a);a in[]&&Array(1).findIndex((function(){l=!1})),n({target:"Array",proto:!0,forced:l||!c},{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(a)},function(t,e,i){var n=i(19),o=i(66),r=i(41),s=i(21),a=i(57),l=i(16),c=i(81),u=Object.getOwnPropertyDescriptor;e.f=n?u:function(t,e){if(t=s(t),e=a(e,!0),c)try{return u(t,e)}catch(i){}if(l(t,e))return r(!o.f.call(t,e),t[e])}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var n=i(14),o=i(26),r=i(16),s=i(67),a=i(83),l=i(58),c=l.get,u=l.enforce,h=String(String).split("String");(t.exports=function(t,e,i,a){var l=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,p=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof e||r(i,"name")||o(i,"name",e),u(i).source=h.join("string"==typeof e?e:"")),t!==n?(l?!p&&t[e]&&(c=!0):delete t[e],c?t[e]=i:o(t,e,i)):c?t[e]=i:s(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&c(this).source||a(this)}))},function(t,e,i){var n=i(87),o=i(14),r=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?r(n[t])||r(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},function(t,e,i){var n=i(42);t.exports=Array.isArray||function(t){return"Array"==n(t)}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e){t.exports={}},function(t,e,i){"use strict";var n=i(57),o=i(23),r=i(41);t.exports=function(t,e,i){var s=n(e);s in t?o.f(t,s,r(0,i)):t[s]=i}},function(t,e,i){var n=i(13),o=i(63),r=i(23),s=n("unscopables"),a=Array.prototype;null==a[s]&&r.f(a,s,{configurable:!0,value:o(null)}),t.exports=function(t){a[s][t]=!0}},function(t,e,i){var n=i(12),o=i(13),r=i(100),s=o("species");t.exports=function(t){return r>=51||!n((function(){var e=[];return(e.constructor={})[s]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},function(t,e,i){"use strict";var n=i(12);t.exports=function(t,e){var i=[][t];return!!i&&n((function(){i.call(null,e||function(){throw 1},1)}))}},function(t,e,i){"use strict";var n=i(0),o=i(37),r=i(123),s=i(124),a=i(12),l=1..toFixed,c=Math.floor,u=function(t,e,i){return 0===e?i:e%2==1?u(t,e-1,i*t):u(t*t,e/2,i)};n({target:"Number",proto:!0,forced:l&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!a((function(){l.call({})}))},{toFixed:function(t){var e,i,n,a,l=r(this),h=o(t),p=[0,0,0,0,0,0],d="",f="0",g=function(t,e){for(var i=-1,n=e;++i<6;)n+=t*p[i],p[i]=n%1e7,n=c(n/1e7)},v=function(t){for(var e=6,i=0;--e>=0;)i+=p[e],p[e]=c(i/t),i=i%t*1e7},m=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==p[t]){var i=String(p[t]);e=""===e?i:e+s.call("0",7-i.length)+i}return e};if(h<0||h>20)throw RangeError("Incorrect fraction digits");if(l!=l)return"NaN";if(l<=-1e21||l>=1e21)return String(l);if(l<0&&(d="-",l=-l),l>1e-21)if(i=(e=function(t){for(var e=0,i=t;i>=4096;)e+=12,i/=4096;for(;i>=2;)e+=1,i/=2;return e}(l*u(2,69,1))-69)<0?l*u(2,-e,1):l/u(2,e,1),i*=4503599627370496,(e=52-e)>0){for(g(0,i),n=h;n>=7;)g(1e7,0),n-=7;for(g(u(10,n,1),0),n=e-1;n>=23;)v(1<<23),n-=23;v(1<<n),g(1,1),v(2),f=m()}else g(0,i),g(1<<-e,0),f=m()+s.call("0",h);return f=h>0?d+((a=f.length)<=h?"0."+s.call("0",h-a)+f:f.slice(0,a-h)+"."+f.slice(a-h)):d+f}})},function(t,e,i){"use strict";var n=i(0),o=i(62),r=i(37),s=i(28),a=i(22),l=i(74),c=i(49),u=i(51),h=i(25),p=u("splice"),d=h("splice",{ACCESSORS:!0,0:0,1:2}),f=Math.max,g=Math.min,v=9007199254740991,m="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!p||!d},{splice:function(t,e){var i,n,u,h,p,d,y=a(this),w=s(y.length),x=o(t,w),b=arguments.length;if(0===b?i=n=0:1===b?(i=0,n=w-x):(i=b-2,n=g(f(r(e),0),w-x)),w+i-n>v)throw TypeError(m);for(u=l(y,n),h=0;h<n;h++)(p=x+h)in y&&c(u,h,y[p]);if(u.length=n,i<n){for(h=x;h<w-n;h++)d=h+i,(p=h+n)in y?y[d]=y[p]:delete y[d];for(h=w;h>w-n+i;h--)delete y[h-1]}else if(i>n)for(h=w-n;h>x;h--)d=h+i-1,(p=h+n-1)in y?y[d]=y[p]:delete y[d];for(h=0;h<i;h++)y[h+x]=arguments[h+2];return y.length=w-n+i,u}})},function(t,e,i){var n=i(0),o=i(126),r=i(50);n({target:"Array",proto:!0},{fill:o}),r("fill")},function(t,e,i){var n=i(12),o=i(42),r="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?r.call(t,""):Object(t)}:Object},function(t,e,i){var n=i(15);t.exports=function(t,e){if(!n(t))return t;var i,o;if(e&&"function"==typeof(i=t.toString)&&!n(o=i.call(t)))return o;if("function"==typeof(i=t.valueOf)&&!n(o=i.call(t)))return o;if(!e&&"function"==typeof(i=t.toString)&&!n(o=i.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var n,o,r,s=i(105),a=i(14),l=i(15),c=i(26),u=i(16),h=i(59),p=i(61),d=a.WeakMap;if(s){var f=new d,g=f.get,v=f.has,m=f.set;n=function(t,e){return m.call(f,t,e),e},o=function(t){return g.call(f,t)||{}},r=function(t){return v.call(f,t)}}else{var y=h("state");p[y]=!0,n=function(t,e){return c(t,y,e),e},o=function(t){return u(t,y)?t[y]:{}},r=function(t){return u(t,y)}}t.exports={set:n,get:o,has:r,enforce:function(t){return r(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return i}}}},function(t,e,i){var n=i(68),o=i(69),r=n("keys");t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e){t.exports=!1},function(t,e){t.exports={}},function(t,e,i){var n=i(37),o=Math.max,r=Math.min;t.exports=function(t,e){var i=n(t);return i<0?o(i+e,0):r(i,e)}},function(t,e,i){var n,o=i(24),r=i(107),s=i(71),a=i(61),l=i(108),c=i(82),u=i(59),h=u("IE_PROTO"),p=function(){},d=function(t){return"<script>"+t+"</"+"script>"},f=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(o){}var t,e;f=n?function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e}(n):((e=c("iframe")).style.display="none",l.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F);for(var i=s.length;i--;)delete f.prototype[s[i]];return f()};a[h]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(p.prototype=o(t),i=new p,p.prototype=null,i[h]=t):i=f(),void 0===e?i:r(i,e)}},function(t,e,i){var n=i(88),o=i(71);t.exports=Object.keys||function(t){return n(t,o)}},function(t,e,i){"use strict";var n=i(0),o=i(30).find,r=i(50),s=i(25),a="find",l=!0,c=s(a);a in[]&&Array(1).find((function(){l=!1})),n({target:"Array",proto:!0,forced:l||!c},{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(a)},function(t,e,i){"use strict";var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,r=o&&!n.call({1:2},1);e.f=r?function(t){var e=o(this,t);return!!e&&e.enumerable}:n},function(t,e,i){var n=i(14),o=i(26);t.exports=function(t,e){try{o(n,t,e)}catch(i){n[t]=e}return e}},function(t,e,i){var n=i(60),o=i(84);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e){var i=0,n=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++i+n).toString(36)}},function(t,e,i){var n=i(88),o=i(71).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,i){var n=i(12);t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},function(t,e,i){var n=i(23).f,o=i(16),r=i(13)("toStringTag");t.exports=function(t,e,i){t&&!o(t=i?t:t.prototype,r)&&n(t,r,{configurable:!0,value:e})}},function(t,e,i){var n=i(15),o=i(46),r=i(13)("species");t.exports=function(t,e){var i;return o(t)&&("function"!=typeof(i=t.constructor)||i!==Array&&!o(i.prototype)?n(i)&&null===(i=i[r])&&(i=void 0):i=void 0),new(void 0===i?Array:i)(0===e?0:e)}},function(t,e,i){var n={};n[i(13)("toStringTag")]="z",t.exports="[object z]"===String(n)},function(t,e,i){var n=i(16),o=i(22),r=i(59),s=i(98),a=r("IE_PROTO"),l=Object.prototype;t.exports=s?Object.getPrototypeOf:function(t){return t=o(t),n(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?l:null}},function(t,e,i){"use strict";var n=i(0),o=i(46),r=[].reverse,s=[1,2];n({target:"Array",proto:!0,forced:String(s)===String(s.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),r.call(this)}})},function(t,e,i){"use strict";var n=i(0),o=i(47),r=i(22),s=i(12),a=i(52),l=[],c=l.sort,u=s((function(){l.sort(void 0)})),h=s((function(){l.sort(null)})),p=a("sort");n({target:"Array",proto:!0,forced:u||!h||!p},{sort:function(t){return void 0===t?c.call(r(this)):c.call(r(this),o(t))}})},function(t,e,i){"use strict";var n=i(0),o=i(89).includes,r=i(50);n({target:"Array",proto:!0,forced:!i(25)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r("includes")},function(t,e,i){"use strict";var n=i(0),o=i(136),r=i(43);n({target:"String",proto:!0,forced:!i(138)("includes")},{includes:function(t){return!!~String(r(this)).indexOf(o(t),arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(19),o=i(12),r=i(82);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}))},function(t,e,i){var n=i(14),o=i(15),r=n.document,s=o(r)&&o(r.createElement);t.exports=function(t){return s?r.createElement(t):{}}},function(t,e,i){var n=i(84),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return o.call(t)}),t.exports=n.inspectSource},function(t,e,i){var n=i(14),o=i(67),r="__core-js_shared__",s=n[r]||o(r,{});t.exports=s},function(t,e,i){var n=i(16),o=i(86),r=i(40),s=i(23);t.exports=function(t,e){for(var i=o(e),a=s.f,l=r.f,c=0;c<i.length;c++){var u=i[c];n(t,u)||a(t,u,l(e,u))}}},function(t,e,i){var n=i(45),o=i(70),r=i(90),s=i(24);t.exports=n("Reflect","ownKeys")||function(t){var e=o.f(s(t)),i=r.f;return i?e.concat(i(t)):e}},function(t,e,i){var n=i(14);t.exports=n},function(t,e,i){var n=i(16),o=i(21),r=i(89).indexOf,s=i(61);t.exports=function(t,e){var i,a=o(t),l=0,c=[];for(i in a)!n(s,i)&&n(a,i)&&c.push(i);for(;e.length>l;)n(a,i=e[l++])&&(~r(c,i)||c.push(i));return c}},function(t,e,i){var n=i(21),o=i(28),r=i(62),s=function(t){return function(e,i,s){var a,l=n(e),c=o(l.length),u=r(s,c);if(t&&i!=i){for(;c>u;)if((a=l[u++])!=a)return!0}else for(;c>u;u++)if((t||u in l)&&l[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,i){var n=i(72);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,i){var n=i(13);e.f=n},function(t,e,i){var n=i(87),o=i(16),r=i(92),s=i(23).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});o(e,t)||s(e,t,{value:r.f(t)})}},function(t,e,i){var n=i(47);t.exports=function(t,e,i){if(n(t),void 0===e)return t;switch(i){case 0:return function(){return t.call(e)};case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,o){return t.call(e,i,n,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,i){var n=i(75),o=i(42),r=i(13)("toStringTag"),s="Arguments"==o(function(){return arguments}());t.exports=n?o:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(i){}}(e=Object(t),r))?i:s?o(e):"Object"==(n=o(e))&&"function"==typeof e.callee?"Arguments":n}},function(t,e,i){"use strict";var n=i(0),o=i(115),r=i(76),s=i(99),a=i(73),l=i(26),c=i(44),u=i(13),h=i(60),p=i(48),d=i(97),f=d.IteratorPrototype,g=d.BUGGY_SAFARI_ITERATORS,v=u("iterator"),m="keys",y="values",w="entries",x=function(){return this};t.exports=function(t,e,i,u,d,b,T){o(i,e,u);var S,P,E,C=function(t){if(t===d&&D)return D;if(!g&&t in O)return O[t];switch(t){case m:case y:case w:return function(){return new i(this,t)}}return function(){return new i(this)}},R=e+" Iterator",_=!1,O=t.prototype,I=O[v]||O["@@iterator"]||d&&O[d],D=!g&&I||C(d),k="Array"==e&&O.entries||I;if(k&&(S=r(k.call(new t)),f!==Object.prototype&&S.next&&(h||r(S)===f||(s?s(S,f):"function"!=typeof S[v]&&l(S,v,x)),a(S,R,!0,!0),h&&(p[R]=x))),d==y&&I&&I.name!==y&&(_=!0,D=function(){return I.call(this)}),h&&!T||O[v]===D||l(O,v,D),p[e]=D,d)if(P={values:C(y),keys:b?D:C(m),entries:C(w)},T)for(E in P)(g||_||!(E in O))&&c(O,E,P[E]);else n({target:e,proto:!0,forced:g||_},P);return P}},function(t,e,i){"use strict";var n,o,r,s=i(76),a=i(26),l=i(16),c=i(13),u=i(60),h=c("iterator"),p=!1;[].keys&&("next"in(r=[].keys())?(o=s(s(r)))!==Object.prototype&&(n=o):p=!0),null==n&&(n={}),u||l(n,h)||a(n,h,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:p}},function(t,e,i){var n=i(12);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},function(t,e,i){var n=i(24),o=i(116);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(i,[]),e=i instanceof Array}catch(r){}return function(i,r){return n(i),o(r),e?t.call(i,r):i.__proto__=r,i}}():void 0)},function(t,e,i){var n,o,r=i(14),s=i(117),a=r.process,l=a&&a.versions,c=l&&l.v8;c?o=(n=c.split("."))[0]+n[1]:s&&(!(n=s.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=s.match(/Chrome\/(\d+)/))&&(o=n[1]),t.exports=o&&+o},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,i){"use strict";var n=i(30).forEach,o=i(52),r=i(25),s=o("forEach"),a=r("forEach");t.exports=s&&a?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAASCAYAAADVCrdsAAAAAXNSR0IArs4c6QAAAzFJREFUSA2tVc9Lk3Ecbo4tE7FgOBNtIFhd5kWZsQm7JEkLvNRIAju4gyfREPwLJHBs1WFnSfAPGB0EDyoKqcw86UGw6GJ62SiIzM3Yp+f58P2ONadm9sDD99fz+TzP++593zmuXAAicgvy52AQ9IMe8Cr4DdwDP4CL4DuHw3GI8f8B5g/ANPgL/Bt8h+gN2HTpFGhyA6S54ujoqDgzMyODg4PS09Mjzc3N4na7xev1SigUkvHxcdne3rZyjgwT/ecgKA6An0HJZrPFiYkJ8Xg8gobnsre3V+bm5lhqMYWJ89QwOGwCX4EJ8DaFGO+DeVBWV1eltbW1ZOz3+yWRSKjJzs6OHBwcqGZ2dlaGhoaktra2pB0eHpZCoVBkH2AedJn+dzCnH32baLgEWtA4CWa5kUqlxOVyadPu7m5ZWVnh9pnI5XLFyclJ/Zl4PcFgkEFtkBSKX4J6gabREkPoxvT0NPesWNLptOAJ1wBjY2NyfHxsz75C9xp8CN4Fb4JBMAa+BxWZTEZ8Pp/Wd3Z2Sj6ft/U8Lxo/zvMMcchZXV2d8Go3NjaEt7mhoUEbxONxHhNswsU13tLTgPN74C6oz1JbW5v2GRkZ4Zb2pw/9DH4wRI4L+9DV1NRIY2OjFg4MDBidDs9OM67ch/o6OM+qzc3N0nPS398v7A+9+vEcyDLEF85aWlr0kALLZDIpRYDnAHWPKw2rraF7YvRaH41GSz1tbz7sBnsM8ZGL9vb2E0IWdHV1ydramtHrTxKpZmz3IHwEanDWsd4al4/0M9hliC0uOjo6qopZWF9fL+vr66ZGEtaw2ggRXz3Vs67cuHxOP4MthshwEQgEThQ4nU6JxWKyv79vf5ICpOFq5naP5yB1Wsd69ikPwDn9DDIMscxFOBz+QxiJRCo/wQwbsmZnjdSBenEYtQ/7lQehn8EyQ+hT3NfXpyK+0wsLC1bA8RP4FHScZVx5Rr2pY72CfdmfYehnMM8Q+gc1Ojoq/PQC9tbz1X0BuisNLrJmvemjnwLMi/Shn0GaIeJ2ZcafZu/GRczO06In/5Hpxf7lmGIIL7gIMulb0Hdew8ucs7/xoR99vb8Be6xf/B8l0bwAAAAASUVORK5CYII="},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(n){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var n=i(14),o=i(83),r=n.WeakMap;t.exports="function"==typeof r&&/native code/.test(o(r))},function(t,e,i){var n=i(12),o=/#|\.prototype\./,r=function(t,e){var i=a[s(t)];return i==c||i!=l&&("function"==typeof e?n(e):!!e)},s=r.normalize=function(t){return String(t).replace(o,".").toLowerCase()},a=r.data={},l=r.NATIVE="N",c=r.POLYFILL="P";t.exports=r},function(t,e,i){var n=i(19),o=i(23),r=i(24),s=i(64);t.exports=n?Object.defineProperties:function(t,e){r(t);for(var i,n=s(e),a=n.length,l=0;a>l;)o.f(t,i=n[l++],e[i]);return t}},function(t,e,i){var n=i(45);t.exports=n("document","documentElement")},function(t,e,i){var n=i(21),o=i(70).f,r={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return s&&"[object Window]"==r.call(t)?function(t){try{return o(t)}catch(e){return s.slice()}}(t):o(n(t))}},function(t,e,i){"use strict";var n=i(94),o=i(22),r=i(111),s=i(112),a=i(28),l=i(49),c=i(113);t.exports=function(t){var e,i,u,h,p,d,f=o(t),g="function"==typeof this?this:Array,v=arguments.length,m=v>1?arguments[1]:void 0,y=void 0!==m,w=c(f),x=0;if(y&&(m=n(m,v>2?arguments[2]:void 0,2)),null==w||g==Array&&s(w))for(i=new g(e=a(f.length));e>x;x++)d=y?m(f[x],x):f[x],l(i,x,d);else for(p=(h=w.call(f)).next,i=new g;!(u=p.call(h)).done;x++)d=y?r(h,m,[u.value,x],!0):u.value,l(i,x,d);return i.length=x,i}},function(t,e,i){var n=i(24);t.exports=function(t,e,i,o){try{return o?e(n(i)[0],i[1]):e(i)}catch(s){var r=t.return;throw void 0!==r&&n(r.call(t)),s}}},function(t,e,i){var n=i(13),o=i(48),r=n("iterator"),s=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||s[r]===t)}},function(t,e,i){var n=i(95),o=i(48),r=i(13)("iterator");t.exports=function(t){if(null!=t)return t[r]||t["@@iterator"]||o[n(t)]}},function(t,e,i){var n=i(13)("iterator"),o=!1;try{var r=0,s={next:function(){return{done:!!r++}},return:function(){o=!0}};s[n]=function(){return this},Array.from(s,(function(){throw 2}))}catch(a){}t.exports=function(t,e){if(!e&&!o)return!1;var i=!1;try{var r={};r[n]=function(){return{next:function(){return{done:i=!0}}}},t(r)}catch(a){}return i}},function(t,e,i){"use strict";var n=i(97).IteratorPrototype,o=i(63),r=i(41),s=i(73),a=i(48),l=function(){return this};t.exports=function(t,e,i){var c=e+" Iterator";return t.prototype=o(n,{next:r(1,i)}),s(t,c,!1,!0),a[c]=l,t}},function(t,e,i){var n=i(15);t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},function(t,e,i){var n=i(45);t.exports=n("navigator","userAgent")||""},function(t,e,i){i(0)({target:"Object",stat:!0},{is:i(119)})},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,i){"use strict";var n=i(75),o=i(95);t.exports=n?{}.toString:function(){return"[object "+o(this)+"]"}},function(t,e,i){"use strict";var n=i(24);t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,i){var n=i(37),o=i(43),r=function(t){return function(e,i){var r,s,a=String(o(e)),l=n(i),c=a.length;return l<0||l>=c?t?"":void 0:(r=a.charCodeAt(l))<55296||r>56319||l+1===c||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):r:t?a.slice(l,l+2):s-56320+(r-55296<<10)+65536}};t.exports={codeAt:r(!1),charAt:r(!0)}},function(t,e,i){var n=i(42);t.exports=function(t){if("number"!=typeof t&&"Number"!=n(t))throw TypeError("Incorrect invocation");return+t}},function(t,e,i){"use strict";var n=i(37),o=i(43);t.exports="".repeat||function(t){var e=String(o(this)),i="",r=n(t);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(i+=e);return i}},function(t,e,i){"use strict";var n=i(0),o=i(56),r=i(21),s=i(52),a=[].join,l=o!=Object,c=s("join",",");n({target:"Array",proto:!0,forced:l||!c},{join:function(t){return a.call(r(this),void 0===t?",":t)}})},function(t,e,i){"use strict";var n=i(22),o=i(62),r=i(28);t.exports=function(t){for(var e=n(this),i=r(e.length),s=arguments.length,a=o(s>1?arguments[1]:void 0,i),l=s>2?arguments[2]:void 0,c=void 0===l?i:o(l,i);c>a;)e[a++]=t;return e}},function(t,e,i){"use strict";var n=i(47),o=i(15),r=[].slice,s={},a=function(t,e,i){if(!(e in s)){for(var n=[],o=0;o<e;o++)n[o]="a["+o+"]";s[e]=Function("C,a","return new C("+n.join(",")+")")}return s[e](t,i)};t.exports=Function.bind||function(t){var e=n(this),i=r.call(arguments,1),s=function(){var n=i.concat(r.call(arguments));return this instanceof s?a(e,n.length,n):e.apply(t,n)};return o(e.prototype)&&(s.prototype=e.prototype),s}},function(t,e,i){"use strict";var n=i(0),o=i(129).left,r=i(52),s=i(25),a=r("reduce"),l=s("reduce",{1:0});n({target:"Array",proto:!0,forced:!a||!l},{reduce:function(t){return o(this,t,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(47),o=i(22),r=i(56),s=i(28),a=function(t){return function(e,i,a,l){n(i);var c=o(e),u=r(c),h=s(c.length),p=t?h-1:0,d=t?-1:1;if(a<2)for(;;){if(p in u){l=u[p],p+=d;break}if(p+=d,t?p<0:h<=p)throw TypeError("Reduce of empty array with no initial value")}for(;t?p>=0:h>p;p+=d)p in u&&(l=i(l,u[p],p,c));return l}};t.exports={left:a(!1),right:a(!0)}},function(t,e,i){var n=i(131);"string"==typeof n&&(n=[[t.i,n,""]]);var o={hmr:!0,transform:undefined,insertInto:void 0};i(133)(n,o);n.locals&&(t.exports=n.locals)},function(t,e,i){(t.exports=i(132)(!1)).push([t.i,".openseadragon-navigator{position:absolute;z-index:1}.openseadragon-navigator .navigator-main{position:relative;overflow:hidden;display:block;font-size:0}.openseadragon-navigator .navigator-main .v-line{height:100%;width:1px;line-height:1px;position:absolute;top:0}.openseadragon-navigator .navigator-main .h-line{width:100%;height:1px;line-height:1px;position:absolute;left:0}.openseadragon-navigator .navigator-main .view-rect{top:-1px;background-color:#fff;position:absolute;cursor:pointer;opacity:0.5;-webkit-box-sizing:border-box;box-sizing:border-box}.openseadragon-navigator .navigator-main .navigator-color-rect{position:absolute;top:0;left:0;z-index:1}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=function(t,e){var i=t[1]||"",n=t[3];if(!n)return i;if(e&&"function"==typeof btoa){var o=(s=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),r=n.sources.map((function(t){return"/*# sourceURL="+n.sourceRoot+t+" */"}));return[i].concat(r).concat([o]).join("\n")}var s;return[i].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i})).join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&n[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),e.push(s))}},e}},function(t,e,i){var n,o,r={},s=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(t){return document.querySelector(t)},l=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var i=a.call(this,t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(n){i=null}e[t]=i}return e[t]}}(),c=null,u=0,h=[],p=i(134);function d(t,e){for(var i=0;i<t.length;i++){var n=t[i],o=r[n.id];if(o){o.refs++;for(var s=0;s<o.parts.length;s++)o.parts[s](n.parts[s]);for(;s<n.parts.length;s++)o.parts.push(w(n.parts[s],e))}else{var a=[];for(s=0;s<n.parts.length;s++)a.push(w(n.parts[s],e));r[n.id]={id:n.id,refs:1,parts:a}}}}function f(t,e){for(var i=[],n={},o=0;o<t.length;o++){var r=t[o],s=e.base?r[0]+e.base:r[0],a={css:r[1],media:r[2],sourceMap:r[3]};n[s]?n[s].parts.push(a):i.push(n[s]={id:s,parts:[a]})}return i}function g(t,e){var i=l(t.insertInto);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=h[h.length-1];if("top"===t.insertAt)n?n.nextSibling?i.insertBefore(e,n.nextSibling):i.appendChild(e):i.insertBefore(e,i.firstChild),h.push(e);else if("bottom"===t.insertAt)i.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(t.insertInto+" "+t.insertAt.before);i.insertBefore(e,o)}}function v(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function m(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),y(e,t.attrs),g(t,e),e}function y(t,e){Object.keys(e).forEach((function(i){t.setAttribute(i,e[i])}))}function w(t,e){var i,n,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var s=u++;i=c||(c=m(e)),n=T.bind(null,i,s,!1),o=T.bind(null,i,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",y(e,t.attrs),g(t,e),e}(e),n=P.bind(null,i,e),o=function(){v(i),i.href&&URL.revokeObjectURL(i.href)}):(i=m(e),n=S.bind(null,i),o=function(){v(i)});return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var i=f(t,e);return d(i,e),function(t){for(var n=[],o=0;o<i.length;o++){var s=i[o];(a=r[s.id]).refs--,n.push(a)}t&&d(f(t,e),e);for(o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete r[a.id]}}}};var x,b=(x=[],function(t,e){return x[t]=e,x.filter(Boolean).join("\n")});function T(t,e,i,n){var o=i?"":n.css;if(t.styleSheet)t.styleSheet.cssText=b(e,o);else{var r=document.createTextNode(o),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function S(t,e){var i=e.css,n=e.media;if(n&&t.setAttribute("media",n),t.styleSheet)t.styleSheet.cssText=i;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(i))}}function P(t,e,i){var n=i.css,o=i.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(n=p(n)),o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var s=new Blob([n],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var i=e.protocol+"//"+e.host,n=i+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?i+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},function(t,e,i){"use strict";var n=i(0),o=i(30).every,r=i(52),s=i(25),a=r("every"),l=s("every");n({target:"Array",proto:!0,forced:!a||!l},{every:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(137);t.exports=function(t){if(n(t))throw TypeError("The method doesn't accept regular expressions");return t}},function(t,e,i){var n=i(15),o=i(42),r=i(13)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[r])?!!e:"RegExp"==o(t))}},function(t,e,i){var n=i(13)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[n]=!1,"/./"[t](e)}catch(o){}}return!1}},function(t,e,i){var n=i(0),o=i(140).values;n({target:"Object",stat:!0},{values:function(t){return o(t)}})},function(t,e,i){var n=i(19),o=i(64),r=i(21),s=i(66).f,a=function(t){return function(e){for(var i,a=r(e),l=o(a),c=l.length,u=0,h=[];c>u;)i=l[u++],n&&!s.call(a,i)||h.push(t?[i,a[i]]:a[i]);return h}};t.exports={entries:a(!0),values:a(!1)}},function(t,e,i){"use strict";i.r(e),i.d(e,"getRectPoint",(function(){return c})),i.d(e,"isPointInMatrix",(function(){return h})),i.d(e,"pointInOtherPoint",(function(){return d})),i.d(e,"isPointInEllipse",(function(){return p})),i.d(e,"pointsToRegion",(function(){return v})),i.d(e,"regionToPoint",(function(){return m})),i.d(e,"isPointInPolygon",(function(){return f})),i.d(e,"isPointInLine",(function(){return g})),i.d(e,"isNegNumber",(function(){return y})),i.d(e,"baseNumber",(function(){return w})),i.d(e,"acreage",(function(){return S})),i.d(e,"perimeter",(function(){return P})),i.d(e,"getPoint",(function(){return x})),i.d(e,"getAngle",(function(){return b})),i.d(e,"getDistance",(function(){return T})),i.d(e,"rgbToHsl",(function(){return E})),i.d(e,"hslToRgb",(function(){return C})),i.d(e,"toGamma",(function(){return _})),i.d(e,"cacheGammaTable",(function(){return O})),i.d(e,"imageSharpenUM",(function(){return k})),i.d(e,"Cache",(function(){return N})),i.d(e,"Rotation",(function(){return oi})),i.d(e,"Navigator",(function(){return Bi})),i.d(e,"Tailoring",(function(){return qi})),i.d(e,"Shape",(function(){return pn})),i.d(e,"Area",(function(){return Tn})),i.d(e,"Board",(function(){return Ln})),i.d(e,"Graduation",(function(){return Wn})),i.d(e,"Grid",(function(){return Xn})),i.d(e,"KfbView",(function(){return Eo})),i.d(e,"OpenSeadragon",(function(){return $.a}));var n={};i.r(n),i.d(n,"Brush",(function(){return St})),i.d(n,"Arrow",(function(){return It})),i.d(n,"Bilateral",(function(){return Ht})),i.d(n,"Line",(function(){return Ut})),i.d(n,"Polygon",(function(){return Jt})),i.d(n,"Ellipse",(function(){return re})),i.d(n,"Rectangle",(function(){return pe})),i.d(n,"Font",(function(){return we})),i.d(n,"Star",(function(){return Ce})),i.d(n,"Flag",(function(){return Le})),i.d(n,"Dot",(function(){return Fe})),i.d(n,"Image",(function(){return Ke}));var o={};i.r(o),i.d(o,"EVENT_START_PAINTING",(function(){return ri})),i.d(o,"EVENT_IN_PAINTING",(function(){return si})),i.d(o,"EVENT_END_PAINTING",(function(){return ai})),i.d(o,"EVENT_STOP_PAINTING",(function(){return li})),i.d(o,"EVENT_TAILORING_REGION",(function(){return ci})),i.d(o,"EVENT_TAILORING_SCREENSHOT",(function(){return ui})),i.d(o,"EVENT_AREA_MOVE_START",(function(){return hi})),i.d(o,"EVENT_AREA_MOVING",(function(){return pi})),i.d(o,"EVENT_AREA_MOVE_END",(function(){return di})),i.d(o,"EVENT_SELECT_LABEL",(function(){return fi})),i.d(o,"EVENT_CANCEL_SELECT_LABEL",(function(){return gi})),i.d(o,"EVENT_DB_CLICK_LABEL",(function(){return vi})),i.d(o,"EVENT_CACHE_BACK",(function(){return mi})),i.d(o,"EVENT_CACHE_FORWARD",(function(){return yi})),i.d(o,"EVENT_HIDDEN_LABEL",(function(){return wi})),i.d(o,"EVENT_DELETE_LABEL",(function(){return xi})),i.d(o,"EVENT_DELETE_POLYGON_POINT",(function(){return bi})),i.d(o,"EVENT_ADD_POLYGON_POINT",(function(){return Ti})),i.d(o,"EVENT_NAVIGATOR_VESTIGE",(function(){return Si}));var r={};i.r(r),i.d(r,"Cache",(function(){return N})),i.d(r,"Rotation",(function(){return oi})),i.d(r,"Navigator",(function(){return Bi})),i.d(r,"Tailoring",(function(){return qi})),i.d(r,"Shape",(function(){return pn})),i.d(r,"Area",(function(){return Tn})),i.d(r,"Board",(function(){return Ln})),i.d(r,"Graduation",(function(){return Wn})),i.d(r,"Grid",(function(){return Xn}));var s={};i.r(s),i.d(s,"COMPONENT_SHAPE",(function(){return no})),i.d(s,"COMPONENT_AREA",(function(){return oo})),i.d(s,"COMPONENT_BOARD",(function(){return ro})),i.d(s,"COMPONENT_GRADUATION",(function(){return so})),i.d(s,"COMPONENT_ROTATION",(function(){return ao})),i.d(s,"COMPONENT_TAILORING",(function(){return lo})),i.d(s,"COMPONENT_NAVIGATOR",(function(){return co})),i.d(s,"COMPONENT_CACHE",(function(){return uo})),i.d(s,"COMPONENT_FRID",(function(){return ho}));i(3),i(4),i(6),i(31),i(5),i(77),i(32),i(78),i(33),i(118),i(1),i(2),i(7),i(8);function a(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function c(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=(t.x+e.x)/2,o=(t.y+e.y)/2,r=Math.PI/180*i;return[{x:(t.x-n)*Math.cos(r)-(t.y-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+(t.y-o)*Math.cos(r)+o},{x:-(t.y-o)*Math.sin(r)+n,y:(t.y-o)*Math.cos(r)+o},{x:(e.x-n)*Math.cos(r)-(t.y-o)*Math.sin(r)+n,y:(e.x-n)*Math.sin(r)+(t.y-o)*Math.cos(r)+o},{x:(t.x-n)*Math.cos(r)-(o-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+o},{x:n,y:o},{x:(e.x-n)*Math.cos(r)+n,y:(e.x-n)*Math.sin(r)+o},{x:(t.x-n)*Math.cos(r)-(e.y-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+(e.y-o)*Math.cos(r)+o},{x:-(e.y-o)*Math.sin(r)+n,y:(e.y-o)*Math.cos(r)+o},{x:(e.x-n)*Math.cos(r)-(e.y-o)*Math.sin(r)+n,y:(e.x-n)*Math.sin(r)+(e.y-o)*Math.cos(r)+o}]}function u(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}function h(t,e,i,n,o){return u(t,e,o)*u(i,n,o)<=0&&u(e,n,o)*u(t,i,o)<=0}function p(t,e,i,n){return(t.x-e.x)*(t.x-e.x)/(i*i)+(t.y-e.y)*(t.y-e.y)/(n*n)<1}function d(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n={x:t.x-i,y:t.y-i},o={x:t.x+i,y:t.y-i},r={x:t.x-i,y:t.y+i},s={x:t.x+i,y:t.y+i};return h(n,o,r,s,e)}function f(t,e){for(var i=t.x,n=t.y,o=!1,r=0,s=e.length,a=s-1;r<s;a=r,r++){var l=e[r].x,c=e[r].y,u=e[a].x,h=e[a].y;if(l===i&&c===n||u===i&&h===n)return!0;if(c<n&&h>=n||c>=n&&h<n){var p=l+(n-c)*(u-l)/(h-c);if(Math.abs(p-i)<10)return!0;p>i&&(o=!o)}}return o}function g(t,e){var i=e[0],n=e[1];if(i.y<t.y&&n.y>=t.y||i.y>=t.y&&n.y<t.y){var o=i.x+(t.y-i.y)*(n.x-i.x)/(n.y-i.y);if(Math.abs(o-t.x)<8)return!0}return!1}function v(t){if(!Array.isArray(t)||0===t.length)return{x:0,y:0,width:0,height:0};if(2===t.length)return{x:t[0].x,y:t[0].y,width:t[1].x-t[0].x,height:t[1].y-t[0].y};var e=a(t).sort((function(t,e){return t.x-e.x})),i=a(t).sort((function(t,e){return t.y-e.y})),n={x:e[0].x,y:i[0].y},o=e.reverse()[0].x,r=i.reverse()[0].y;return{x:n.x,y:n.y,width:o-n.x,height:r-n.y}}function m(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?{startPoint:{x:t.width<0?t.x+t.width:t.x,y:t.height<0?t.y+t.height:t.y},endPoint:{x:t.width>0?t.x+t.width:t.x,y:t.height>0?t.y+t.height:t.y}}:{startPoint:{x:t.x,y:t.y},endPoint:{x:t.x+t.width,y:t.y+t.height}}}function y(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?Object.is(t,-0):t<0}function w(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?0:t<0?-1:1}function x(t,e,i){return i=i/180*Math.PI,{x:(e.x-t.x)*Math.cos(i)-(e.y-t.y)*Math.sin(i)+t.x,y:(e.x-t.x)*Math.sin(i)+(e.y-t.y)*Math.cos(i)+t.y}}function b(t,e,i){var n={x:e.x-t.x,y:e.y-t.y},o={x:i.x-t.x,y:i.y-t.y},r=Math.atan2(o.y,o.x)-Math.atan2(n.y,n.x);return r>Math.PI?r-2*Math.PI:r<-Math.PI?r+2*Math.PI:r}function T(t,e){var i=Math.pow(e.x-t.x,2),n=Math.pow(e.y-t.y,2);return Math.sqrt(i+n)}function S(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=0,r=Math.abs(i.x-e.x)*n,s=Math.abs(i.y-e.y)*n;return"Rectangle"===t&&(o=r*s/2),"Ellipse"===t&&(o=r*s/4*Math.PI),o}function P(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=0,r=Math.abs(i.x-e.x)*n,s=Math.abs(i.y-e.y)*n;if("Line"!==t&&"Arrow"!==t||(o=Math.sqrt(Math.pow(r,2)+Math.pow(s,2))),"Rectangle"===t&&(o=2*(r+s)),"Ellipse"===t){var a=r>=s?r:s,l=r>=s?s:r;o=4*(a-l)+2*Math.PI*l}return o}i(53);var E=function(t,e,i){var n=(t/=255)>(e/=255)?t:e,o=n>(i/=255)?n:i,r=t>e?e:t,s=r>i?i:r,a=o-s,l=o+s,c=(o+s)/2,u=0,h=0;return 0===a?{l:c,s:u,h:h}:(t===o&&(h=(e-i)/6/a),e===o&&(h=1/3+(i-t)/6/a),i===o&&(h=2/3+(t-e)/6/a),h<0&&(h+=1),h>1&&(h-=1),{l:c,s:u=c<.5?a/l:a/(2-l),h:h})},C=function(t,e,i){if(0===e)return{r:255*(i>1?1:i),g:255*(i>1?1:i),b:255*(i>1?1:i)};e>1&&(e=1);var n=0,o=2*i-(n=i<.5?i*(1+e):i+e-i*e),r=255*R(o,n,t+1/3),s=255*R(o,n,t),a=255*R(o,n,t-1/3);return{r:r>255?255:r,g:s>255?255:s,b:a>255?255:a}};function R(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),6*i<1?t+6*(e-t)*i:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}for(var _=function(t,e){return t>255&&(t=255),t<0&&(t=0),t/=255,255*Math.pow(t,1/e)},O={},I=0;I<256;I++)for(var D=.01;D<=2;D=(D+.01).toFixed(3)/1)O["".concat(D)]?O["".concat(D)].push(_(I,D)):O["".concat(D)]=[_(I,D)];var k=function(t,e,i){},M=(i(54),i(125),i(27),function(t){return(t=t.toString())[1]?t:"0"+t}),L=function(t){var e,i=Object.prototype.toString;if(t)return"[object String]"===(e=t,i).call(e)&&(t=new Date(t)),[t.getHours(),t.getMinutes(),t.getSeconds()].map(M).join(":")},A=function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=Object.prototype.toString;if(t){"[object String]"===(e=t,n).call(e)&&(t=new Date(t)),"number"==typeof t&&(t=new Date(t));var o=t.getFullYear(),r=t.getMonth()+1,s=t.getDate();return[o,r,s].map(M).join(i)}},B=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";if(t)return A(t,e)+" "+L(t)};function H(t){return function(t){if(Array.isArray(t))return j(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return j(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return j(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function z(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var N=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cacheList=[],this.currentIndex=-1}var e,i,n;return e=t,(i=[{key:"init",value:function(t,e){this.cacheList=H(t),this.currentIndex=e}},{key:"add",value:function(t,e){this.currentIndex===this.cacheList.length-1||(this.cacheList=this.cacheList.slice(0,this.currentIndex+1)),this.cacheList.push({type:t,options:e,time:B(new Date)}),this.currentIndex=this.cacheList.length-1}},{key:"getCache",value:function(t){return this.cacheList[t]}},{key:"removeIndex",value:function(t){this.cacheList.splice(t,1)}},{key:"removeAll",value:function(){this.cacheList=[],this.currentIndex=-1}}])&&z(e.prototype,i),n&&z(e,n),t}();i(55),i(65),i(17),i(9),i(10),i(11),i(18),i(38),i(29),i(128),i(34),i(35),i(36),i(39);function F(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var V=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.eventList=[]}var e,i,n;return e=t,i=[{key:"$emit",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,n=new CustomEvent(t,{bubbles:!0,detail:e});i.dispatchEvent(n)}},{key:"$on",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document;n.addEventListener(t,e,i),this.eventList.push({target:n,eventName:t,callback:e,options:i})}},{key:"$once",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document,o=function o(r){e(r),n.removeEventListener(t,o,i)};n.addEventListener(t,o,i)}},{key:"$off",value:function(t,e,i){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document,r=this.eventList.filter((function(n){return!(n.target!==o&&o&&o!==document||n.eventName!==t&&t||n.options!==i&&null!=i||n.callback!==e&&e)}));r.forEach((function(t){t.target.removeEventListener(t.eventName,t.callback,t.options);var e=n.eventList.findIndex((function(e){return e===t}));~e&&n.eventList.splice(e,1)}))}},{key:"destroy",value:function(){this.$off()}}],i&&F(e.prototype,i),n&&F(e,n),t}();function W(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function U(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var G={lineWidth:2,radius:5,fillStyle:"rgba(255, 255, 255, 1)",strokeStyle:"#01d0b0"},Z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;W(this,t),this.getConfig(e)}var e,i,n;return e=t,i=[{key:"getConfig",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;for(var e in G)Object.prototype.hasOwnProperty.call(G,e)&&(t[e]=t[e]||G[e]);return t}},{key:"setCanvas",value:function(t){this.canvas=t}},{key:"draw",value:function(t,e){var i=this.canvas.getContext("2d"),n=t.x,o=t.y;e=this.getConfig(e),i.beginPath(),i.lineWidth=e.lineWidth,i.arc(n,o,e.radius,0,2*Math.PI,!1),i.fillStyle=e.fillStyle,i.fill(),i.strokeStyle=e.strokeStyle,i.stroke()}}],i&&U(e.prototype,i),n&&U(e,n),t}(),q=i(20),$=i.n(q),K="Line",X="Arrow",Y="Bilateral",J="Rectangle",Q="Ellipse",tt="Polygon",et="Font",it="Star",nt="Flag",ot="Dot",rt="Image",st=[et,it,nt,ot],at=[J,Q],lt=[K,X,Y],ct=[tt,et,it,nt,ot],ut=([].concat(at,[tt]),[].concat(lt,[et,nt,rt])),ht=[K,X,Y,J,Q,tt,et,it,nt,ot,rt];function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function dt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function ft(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?dt(Object(i),!0).forEach((function(e){gt(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):dt(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function gt(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function vt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function mt(t,e){return mt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},mt(t,e)}function yt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=xt(t);if(e){var o=xt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return wt(this,i)}}function wt(t,e){return!e||"object"!==pt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function xt(t){return xt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},xt(t)}var bt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&mt(t,e)}(r,t);var e,i,n,o=yt(r);function r(t,e,i,n){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(s=o.call(this)).viewer=t,s.cache=i,s.viewport=t.viewport,s.canvas=e,s.options=n||{},s.thumb=new Z,s.thumb.setCanvas(e),s}return e=r,i=[{key:"init",value:function(){}},{key:"getCenterPoint",value:function(t){var e=this.viewport.imageToViewportRectangle(t.x,t.y,t.width,t.height);return c({x:e.x,y:e.y},{x:e.x+e.width,y:e.y+e.height})[4]}},{key:"moveToLabel",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.viewport.panTo(new q.Point(t.x,t.y),e)}},{key:"isContainerLabel",value:function(t,e){var i=this;return!!e.find((function(e){return i.isContainerInRegion(t,e)}))}},{key:"isContainerInRegion",value:function(t,e){var i=e.region,n=e.tool,o=e.points,r=e.isClose,s={x:i.x,y:i.y},a={x:i.x+i.width,y:i.y},l={x:i.x,y:i.y+i.height},c={x:i.x+i.width,y:i.y+i.height},u={x:i.x+i.width/2,y:i.y+i.height/2};return n===Q?p(t,u,Math.abs(i.width/2),Math.abs(i.height/2>>0)):n===J?h(s,a,l,c,t):!(n!==tt||!r)&&f(t,o)}},{key:"imageToViewerElementRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,o=t.height,r=this.viewport.imageToViewportRectangle(e,i,n,o);return this.viewport.viewportToViewerElementRectangle(r)}},{key:"imageToViewerElementCoordinates",value:function(t,e){return this.viewport.imageToViewerElementCoordinates(new q.Point(t,e))}},{key:"viewerElementToImageRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,o=t.height,r=this.viewport.viewerElementToViewportRectangle(new q.Rect(e,i,n,o,0));return this.viewport.viewportToImageRectangle(r.x,r.y,r.width,r.height)}},{key:"viewerElementToImageCoordinates",value:function(t,e){return this.viewport.viewerElementToImageCoordinates(new q.Point(t,e))}},{key:"imageToViewerElementPoints",value:function(t){var e=this;return(t||[]).map((function(t){var i=e.imageToViewerElementCoordinates(t.x,t.y);return{canMove:t.canMove,x:i.x,y:i.y}}))}},{key:"getImageZoom",value:function(t){return this.viewport.viewportToImageZoom(this.viewport.getZoom(t))}},{key:"getMeasureContent",value:function(t){var e={left:0,top:0,angle:0,texts:[]};if(t.points.length<=1)return e;var i=this.getImageZoom(!0)/t.scale,n=v(t.points),o={x:n.x,y:n.y},r={x:n.x+n.width,y:n.y+n.height},s={x:o.x<r.x?o.x:r.x,y:o.y<r.y?o.y:r.y},a={x:o.x>r.x?o.x:r.x,y:o.y>r.y?o.y:r.y};switch(t.tool){case X:case Y:case K:var l={x:o.x<r.x?o.x:r.x,y:o.x<r.x?o.y:r.y},u={x:o.x>r.x?o.x:r.x,y:o.x>r.x?o.y:r.y},h=Math.abs(u.x-l.x),p=Math.abs(u.y-l.y),d={x:(u.x+l.x)/2,y:(u.y+l.y)/2},f=b(l,ft(ft({},l),{},{x:l.x+1}),u),g=this.imageToViewerElementCoordinates(d.x,d.y),m=-50,y=-50;u.y<l.y&&u.x>l.x&&(m=-50,y=-50),u.y<l.y&&u.x<l.x&&(m=-10,y=50),u.y>l.y&&u.x>l.x&&(m=10,y=-50),u.y>l.y&&u.x<l.x&&(m=50,y=80),e={left:g.x+y*i,top:g.y+m*i,angle:f,texts:["长:".concat((Math.sqrt(h*h+p*p)*this.options.imageCapRes).toFixed(2)).concat(this.options.unit)]};break;case Q:var w=Math.abs(a.x-s.x),x=Math.abs(a.y-s.y),T=P(Q,s,a,this.options.imageCapRes),E=S(Q,s,a,this.options.imageCapRes),C=c(s,a)[2],R=this.imageToViewerElementCoordinates(C.x,C.y);e={left:R.x+10*i,top:R.y,angle:0,texts:["长轴:".concat((w*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"短轴:".concat((x*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"周长:".concat(T.toFixed(2)).concat(this.options.unit),"面积:".concat(E.toFixed(2)).concat(this.options.unit,"²")]};break;case J:var _=Math.abs(a.x-s.x),O=Math.abs(a.y-s.y),I=P(J,s,a,this.options.imageCapRes),D=S(J,s,a,this.options.imageCapRes),k=c(s,a)[2],M=this.imageToViewerElementCoordinates(k.x,k.y);e={left:M.x+10*i,top:M.y,angle:0,texts:["长:".concat((_*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"宽:".concat((O*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"周长:".concat(I.toFixed(2)).concat(this.options.unit),"面积:".concat(D.toFixed(2)).concat(this.options.unit,"²")]};break;case tt:var L=t.points,A=c(s,a)[2],B=this.imageToViewerElementCoordinates(A.x,A.y),H=0;L.reduce((function(t,e){return H+=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),e})),e={left:B.x,top:B.y,angle:0,texts:["周长:".concat((H*this.options.imageCapRes).toFixed(2)).concat(this.options.unit)]};break;default:e={left:0,right:0,angle:0,texts:[]}}var j=t.select&&this.options.measure.selectHandler||this.options.measure.handler;return ft(ft({},e),{},{texts:j?j(e.texts,t):e.texts})}},{key:"getImageData",value:function(t,e){var i=e.getContext("2d").getImageData(t.x,t.y,t.width,t.height);return this.changeImageData(i)}},{key:"changeImageData",value:function(t){var e=t.data,i=t.width,n=t.height,o=this.viewport.viewportToImageZoom(this.viewport.getZoom(!0));if(o<=10)return{points:[],imageData:{data:e,width:i,height:n}};var r=10/o*i>>0,s=10/o*n>>0,a=document.createElement("canvas"),l=a.getContext("2d");a.width=i,a.height=n,l.putImageData(t,0,0,0,0,a.width,a.height);var c=document.createElement("canvas"),u=c.getContext("2d");c.width=r,c.height=s,u.drawImage(a,0,0,r,s);var h=u.getImageData(0,0,r,s);return{points:[],imageData:{data:h.data,width:h.width,height:h.height}}}},{key:"isInCanvas",value:function(t,e){var i=t.x,n=t.y,o=t.x+t.width,r=t.y+t.height;return!(i>e.x+e.width||n>e.y+e.height||o<e.x||r<e.y)}},{key:"getFontWidth",value:function(t,e){var i=this.canvas.getContext("2d");return i.beginPath(),i.font="".concat(e,"px Arial"),i.measureText(t).width}},{key:"change",value:function(){}},{key:"updated",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=ft(ft({},this.options),t),this.change()}},{key:"clearCanvas",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"resetCanvasSize",value:function(t){var e=this,i=t.width,n=t.height;this.canvas.width=i,this.canvas.height=n,setTimeout((function(){e.change()}),100)}},{key:"destroy",value:function(){this.$off()}}],i&&vt(e.prototype,i),n&&vt(e,n),r}(V);function Tt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var St=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.thumb=new Z,this.options={}}var e,i,n;return e=t,(i=[{key:"setContent",value:function(t,e){this.canvas=t,this.thumb.setCanvas(t),this.options=e}},{key:"startDraw",value:function(){this.canvas.getContext("2d").beginPath()}},{key:"endDraw",value:function(){var t=this.canvas.getContext("2d");t.stroke(),this.options.fillStyle&&t.fill()}},{key:"drawThumb",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawPoints",value:function(t,e){var i=this;t.forEach((function(t){i.drawThumb(t,e)}))}},{key:"draw",value:function(t){}},{key:"drawMeasureInfo",value:function(t,e){var i=e.left,n=e.top,o=e.texts,r=e.angle;if(o.length){var s=this.canvas.getContext("2d");s.save(),s.beginPath(),s.translate(i,n),s.rotate(r);var a=[];s.font="".concat(this.options.measure.fontSize,"px Arial"),o.forEach((function(t){a.push(s.measureText(t).width)}));var l=Math.max.apply(Math,a);s.fillStyle=this.options.measure.backgroundColor;var c=20*o.length+16+4*(o.length-1);s.rect(0,0,l+22,c),s.fill(),s.beginPath(),s.fillStyle=this.options.measure.color,o.forEach((function(t,e){s.fillText(t,11,22+24*e)})),s.fill(),s.restore()}}},{key:"clearCanvas",value:function(){this.canvas&&this.canvas.getContext&&this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)}}])&&Tt(e.prototype,i),n&&Tt(e,n),t}();function Pt(t){return Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pt(t)}function Et(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ct(t,e){return Ct=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ct(t,e)}function Rt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ot(t);if(e){var o=Ot(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return _t(this,i)}}function _t(t,e){return!e||"object"!==Pt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ot(t){return Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ot(t)}var It=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ct(t,e)}(r,t);var e,i,n,o=Rt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i)}}])&&Et(e.prototype,i),n&&Et(e,n),r}(St);function Dt(t){return Dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dt(t)}function kt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mt(t,e){return Mt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Mt(t,e)}function Lt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Bt(t);if(e){var o=Bt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return At(this,i)}}function At(t,e){return!e||"object"!==Dt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Bt(t){return Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Bt(t)}var Ht=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Mt(t,e)}(r,t);var e,i,n,o=Lt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i),n.drawArrow(i,e)}}])&&kt(e.prototype,i),n&&kt(e,n),r}(St);function jt(t){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(t)}function zt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Nt(t,e){return Nt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Nt(t,e)}function Ft(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Wt(t);if(e){var o=Wt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Vt(this,i)}}function Vt(t,e){return!e||"object"!==jt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}var Ut=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Nt(t,e)}(r,t);var e,i,n,o=Ft(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y);var o=Math.atan2(i.y-e.y,i.x-e.x),r=5*Math.sin(o),s=5*Math.cos(o);n.moveTo(e.x+r,e.y-s),n.lineTo(e.x-r,e.y+s),n.moveTo(i.x+r,i.y-s),n.lineTo(i.x-r,i.y+s)}}])&&zt(e.prototype,i),n&&zt(e,n),r}(St);function Gt(t){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(t)}function Zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $t(t,e){return $t=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},$t(t,e)}function Kt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Yt(t);if(e){var o=Yt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Xt(this,i)}}function Xt(t,e){return!e||"object"!==Gt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Yt(t)}var Jt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&$t(t,e)}(r,t);var e,i,n,o=Kt(r);function r(){return Zt(this,r),o.apply(this,arguments)}return e=r,(i=[{key:"draw",value:function(t){var e=this.canvas.getContext("2d");e.lineWidth=this.options.lineWidth,e.strokeStyle=this.options.strokeStyle,e.moveTo(t[0].x,t[0].y),t.forEach((function(t,i){0!==i&&e.lineTo(t.x,t.y)})),this.options.isClose&&(e.lineTo(t[0].x,t[0].y),this.options.fillStyle&&(e.fillStyle=this.options.fillStyle))}}])&&qt(e.prototype,i),n&&qt(e,n),r}(St);function Qt(t){return Qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qt(t)}function te(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ee(t,e){return ee=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ee(t,e)}function ie(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=oe(t);if(e){var o=oe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ne(this,i)}}function ne(t,e){return!e||"object"!==Qt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function oe(t){return oe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},oe(t)}var re=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ee(t,e)}(r,t);var e,i,n,o=ie(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=t[0],o=t[t.length-1],r=this.canvas.getContext("2d");r.lineWidth=this.options.lineWidth,r.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(r.fillStyle=this.options.fillStyle),r.save();var s={x:(n.x+o.x)/2,y:(n.y+o.y)/2},a=(null==i?void 0:i.width)?Math.abs(i.width):Math.abs(o.x-n.x),l=(null==i?void 0:i.height)?Math.abs(i.height):Math.abs(o.y-n.y);r.translate(s.x,s.y),r.rotate(e*Math.PI/180),e<90&&e>=0||e>180&&e<270?r.drawOval(0,0,a/2,l/2):r.drawOval(0,0,l/2,a/2),r.restore()}}],i&&te(e.prototype,i),n&&te(e,n),r}(St);function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function ae(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function le(t,e){return le=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},le(t,e)}function ce(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=he(t);if(e){var o=he(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ue(this,i)}}function ue(t,e){return!e||"object"!==se(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function he(t){return he=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},he(t)}var pe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&le(t,e)}(r,t);var e,i,n,o=ce(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=t[0],o=t[t.length-1],r=this.canvas.getContext("2d");r.lineWidth=this.options.lineWidth,r.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(r.fillStyle=this.options.fillStyle),r.save();var s={x:(n.x+o.x)/2,y:(n.y+o.y)/2},a=(null==i?void 0:i.width)?Math.abs(i.width):Math.abs(o.x-n.x),l=(null==i?void 0:i.height)?Math.abs(i.height):Math.abs(o.y-n.y);r.translate(s.x,s.y),e<90&&e>=0||e>180&&e<270?(r.rotate(e*Math.PI/180),r.rect(-a/2,-l/2,a,l)):(r.rotate(e*Math.PI/180),r.rect(-l/2,-a/2,l,a)),r.restore()}}],i&&ae(e.prototype,i),n&&ae(e,n),r}(St);function de(t){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(t)}function fe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ge(t,e){return ge=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ge(t,e)}function ve(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=ye(t);if(e){var o=ye(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return me(this,i)}}function me(t,e){return!e||"object"!==de(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ye(t){return ye=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ye(t)}var we=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ge(t,e)}(r,t);var e,i,n,o=ve(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=t[0],n=this.options.angle||0,o=this.options.text||"编辑文字",r=this.canvas.getContext("2d");r.fillStyle=this.options.strokeStyle,r.save(),r.translate(i.x,i.y),r.rotate(n/180*Math.PI),r.scale(e,e),r.font="".concat(this.options.fontSize,"px Arial"),r.fillText(o,0,0),r.restore()}}],i&&fe(e.prototype,i),n&&fe(e,n),r}(St);function xe(t){return xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xe(t)}function be(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Te(t,e){return Te=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Te(t,e)}function Se(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ee(t);if(e){var o=Ee(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pe(this,i)}}function Pe(t,e){return!e||"object"!==xe(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ee(t){return Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ee(t)}var Ce=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Te(t,e)}(r,t);var e,i,n,o=Se(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth,n=t[0];i*=e;var o=.2*Math.PI,r=.3*Math.PI,s=Math.sin(o)*i*2,a=i/2/Math.cos(o),l={x:n.x,y:n.y-i},c={x:n.x+a*Math.sin(o),y:n.y-i+a*Math.cos(o)},u={x:n.x+s*Math.sin(r),y:n.y-i+s*Math.cos(r)},h={x:n.x+a*Math.sin(2*o),y:n.y+a*Math.cos(2*o)},p={x:n.x+i*Math.sin(o),y:n.y+i*Math.cos(o)},d={x:n.x,y:n.y+a},f={x:n.x-i*Math.sin(o),y:n.y+i*Math.cos(o)},g={x:n.x-a*Math.sin(2*o),y:n.y+a*Math.cos(2*o)},v={x:n.x-s*Math.sin(r),y:n.y-i+s*Math.cos(r)},m={x:n.x-a*Math.sin(o),y:n.y-i+a*Math.cos(o)},y=this.canvas.getContext("2d");y.lineWidth=2,y.moveTo(l.x,l.y),y.lineTo(c.x,c.y),y.lineTo(u.x,u.y),y.lineTo(h.x,h.y),y.lineTo(p.x,p.y),y.lineTo(d.x,d.y),y.lineTo(f.x,f.y),y.lineTo(g.x,g.y),y.lineTo(v.x,v.y),y.lineTo(m.x,m.y),y.lineTo(l.x,l.y),y.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(y.fillStyle=this.options.fillStyle)}}],i&&be(e.prototype,i),n&&be(e,n),r}(St);function Re(t){return Re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Re(t)}function _e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ie(t,e){return Ie=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ie(t,e)}function De(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Me(t);if(e){var o=Me(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ke(this,i)}}function ke(t,e){return!e||"object"!==Re(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Me(t){return Me=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Me(t)}var Le=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ie(t,e)}(r,t);var e,i,n,o=De(r);function r(){return _e(this,r),o.apply(this,arguments)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],o=this.canvas.getContext("2d");o.lineWidth=2,o.strokeStyle=this.options.strokeStyle,o.moveTo(n.x,n.y),o.lineTo(n.x,n.y-i);var r=i/5,s={x:n.x+r,y:n.y-i},a={x:n.x+2*r,y:n.y-i-r},l={x:n.x+4*r,y:n.y-i+r},c={x:n.x+i,y:n.y-i};o.bezierCurve([s,a,l,c]),o.moveTo(c.x,c.y),o.lineTo(c.x,c.y+i/2);var u={x:n.x+r,y:n.y-i/2},h={x:n.x+2*r,y:n.y-i/2-r},p={x:n.x+4*r,y:n.y-i/2+r},d={x:n.x+i,y:n.y-i/2};o.bezierCurve([u,h,p,d]),o.moveTo(s.x,s.y),o.lineTo(u.x,u.y)}}],i&&Oe(e.prototype,i),n&&Oe(e,n),r}(St);function Ae(t){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae(t)}function Be(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function He(t,e){return He=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},He(t,e)}function je(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ne(t);if(e){var o=Ne(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ze(this,i)}}function ze(t,e){return!e||"object"!==Ae(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ne(t){return Ne=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ne(t)}var Fe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&He(t,e)}(r,t);var e,i,n,o=je(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],o=this.canvas.getContext("2d"),r=n.x,s=n.y;o.lineWidth=2,o.moveTo(r+i,s),o.arc(r,s,i,0,2*Math.PI,!1),this.options.fillStyle&&(o.fillStyle=this.options.fillStyle),o.strokeStyle=this.options.strokeStyle}}],i&&Be(e.prototype,i),n&&Be(e,n),r}(St);function Ve(t){return Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ve(t)}function We(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ue(t,e){return Ue=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ue(t,e)}function Ge(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=qe(t);if(e){var o=qe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ze(this,i)}}function Ze(t,e){return!e||"object"!==Ve(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function qe(t){return qe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},qe(t)}var $e=new V,Ke=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ue(t,e)}(r,t);var e,i,n,o=Ge(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=this,i=v(t);if(this.options.imgLoadSuccess)this.drawImage(this.options.img,i);else if(this.options.img){var n=this.options.img;$e.$once("load",(function(){e.drawImage(n,i)}),!0,n)}}},{key:"drawImage",value:function(t,e){this.canvas.getContext("2d").drawImage(t,e.x,e.y,e.width,e.height)}}])&&We(e.prototype,i),n&&We(e,n),r}(St),Xe=i(103),Ye=i.n(Xe);function Je(t){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(t)}function Qe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ti(t,e){return ti=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ti(t,e)}function ei(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=ni(t);if(e){var o=ni(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ii(this,i)}}function ii(t,e){return!e||"object"!==Je(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ni(t){return ni=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ni(t)}var oi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ti(t,e)}(r,t);var e,i,n,o=ei(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).isInRotation=!1,e.pointList=[],e.img=new Image(33,18),e.img.src=Ye.a,e}return e=r,(i=[{key:"init",value:function(t){var e=t.width,i=t.height;this.isInRotation=!0,this.imgWidth=e,this.imgHeight=i,this.rect=new pe,this.rect.setContent(this.canvas,{lineWidth:1,strokeStyle:"#989898"}),this.change()}},{key:"drawRect",value:function(t,e){var i=this.viewport.imageToViewportRectangle(0,0,this.imgWidth,this.imgHeight);this.rect.startDraw(),this.rect.draw([t,e],this.viewport.getRotation(),this.viewport.viewportToViewerElementRectangle(i)),this.rect.endDraw(),this.drawThumbPoint()}},{key:"drawRotation",value:function(){var t=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),e=this.imageToViewerElementCoordinates(this.imgWidth/2,this.imgHeight/15),i=this.viewport.getRotation(),n=this.canvas.getContext("2d");n.save(),n.beginPath(),n.translate(e.x,e.y),n.rotate(i/180*Math.PI),n.font="14px Arial";var o=i+"°",r=n.measureText(o).width;n.fillStyle="rgba(0, 0, 0, 0.5)",n.rect(-r/2-10,0,r+20,24),n.fill(),n.beginPath(),n.fillStyle="#FDFDFD",n.fillText(o,-r/2,18),n.restore(),n.save(),n.beginPath(),n.translate(t.x,t.y),n.rotate(i/180*Math.PI),n.drawImage(this.img,-16.5,0,33,18),n.restore()}},{key:"drawPoint",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawThumbPoint",value:function(){var t=this;this.pointList.forEach((function(e,i){t.drawPoint({x:e.x,y:e.y},{radius:5})}))}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),o=!!c({x:n.x-16.5,y:n.y},{x:n.x+16.5,y:n.y-18}).find((function(t){return d(t,{x:e,y:i})}));this.rotatePoint=o?{x:e,y:i}:void 0}},{key:"onCanvasRelease",value:function(t){t.x,t.y,this.rotatePoint=void 0,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=t.x,i=t.y;if(this.rotatePoint){this.lastPoint||(this.lastPoint={x:e,y:i});var n=b(this.pointList[4],this.lastPoint,{x:e,y:i});if(!isNaN(n/Math.PI*180)){var o=(n/Math.PI*180).toFixed(1)/1;this.viewport.setRotation((this.viewport.getRotation()+o).toFixed(1)/1),this.lastPoint={x:e,y:i}}}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&(this.viewport.setRotation(0),this.stopRotation())}},{key:"stopRotation",value:function(){this.clearCanvas(),this.rotatePoint=void 0,this.lastPoint=void 0,this.pointList=[],this.isInRotation=!1}},{key:"change",value:function(){var t=this;this.isInRotation&&(this.clearCanvas(),this.pointList=c({x:0,y:0},{x:this.imgWidth,y:this.imgHeight}).map((function(e){var i=e.x,n=e.y;return t.imageToViewerElementCoordinates(i,n)})),this.drawRect(this.pointList[0],this.pointList[8]),this.drawRotation())}}])&&Qe(e.prototype,i),n&&Qe(e,n),r}(bt),ri=(i(130),"start-painting"),si="in-painting",ai="end-painting",li="stop-painting",ci="tailoring-region",ui="tailoring-screenshot",hi="area-move-start",pi="area-moving",di="area-move-end",fi="select-label",gi="cancel-select-label",vi="db-click-label",mi="cache-back",yi="cache-forward",wi="hidden-label",xi="delete-label",bi="delete-polygon-point",Ti="add-polygon-point",Si="navigator-vestige";function Pi(t){return Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pi(t)}function Ei(t){return function(t){if(Array.isArray(t))return Ci(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ci(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Ci(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ci(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Ri(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function _i(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ri(Object(i),!0).forEach((function(e){Oi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ri(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Oi(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ii(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Di(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ki(t,e){return ki=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ki(t,e)}function Mi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ai(t);if(e){var o=Ai(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Li(this,i)}}function Li(t,e){return!e||"object"!==Pi(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ai(t){return Ai=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ai(t)}var Bi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ki(t,e)}(r,t);var e,i,n,o=Mi(r);function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ii(this,r),(t=o.call(this)).options=e,t.viewport=e.viewer.viewport,t.viewer=e.viewer,t.el=e.el,t.height=e.height||150,t.width=e.width||150,t.containerHeight=e.containerHeight||window.innerHeight,t.containerWidth=e.containerWidth||window.innerWidth,t.element=e.element,t.pointList=e.pointList||[],t.loadStatus=!1,t.init(),t.vestige=t.options.vestige?_i({show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]},t.options.vestige):{show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]},t}return e=r,i=[{key:"init",value:function(){var t=this;this.element.innerHTML='<main class="navigator-main">\n <div class="v-line"></div>\n <div class="h-line"></div>\n <div class="view-rect"></div>\n <canvas class="navigator-color-rect"></canvas>\n</main>';var e=this.element.getElementsByClassName("navigator-main")[0];this.canvas=this.createNavigatorCanvas(),e.appendChild(this.canvas),this.handleMouseDrag(e);var i=this.element.getElementsByClassName("view-rect")[0];this.rect=i,this.$on("rect-change",(function(t){var n=e.getElementsByClassName("v-line")[0],o=e.getElementsByClassName("h-line")[0];n.style.left=Math.round(i.getBoundingClientRect().width/2+i.offsetLeft)+"px",o.style.top=Math.round(i.getBoundingClientRect().height/2+i.offsetTop)+"px",n.style.backgroundColor="red",o.style.backgroundColor="red"})),this.$on("rect-draw",(function(e){var n=i.offsetLeft,o=i.offsetTop,r=e.detail,s={left:n,top:o,width:i.clientWidth,height:i.clientHeight,scale:Ei(t.vestige.zooms).reverse()[r],color:Ei(t.vestige.colors).reverse()[r]};t.pointList.push(s),t.drawPointList(t.pointList),t.$emit(Si,t.pointList)})),this.viewer.addHandler("pan",(function(e){t.navigatorChange(t.viewport.getZoom(!0),e.center)})),this.viewer.addHandler("zoom",(function(e){t.navigatorChange(e.zoom,e.refPoint)}))}},{key:"drawPointList",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pointList;this.pointList=e;var i=this.element.getElementsByClassName("navigator-color-rect")[0],n=i.getContext("2d");this.pointList.sort((function(t,e){return t.scale>e.scale?1:-1})).forEach((function(e){t.drawRect(n,e)}))}},{key:"drawRect",value:function(t,e){t.beginPath(),t.fillStyle=e.color,t.clearRect(e.left,e.top,e.width+1,e.height+1),t.fillRect(e.left,e.top,e.width+1,e.height+1)}},{key:"navigatorChange",value:function(t,e,i){this.loadStatus&&(e||(e=this.viewport.getCenter(!0)),i||(i=this.element.getElementsByClassName("view-rect")[0]),this.setViewRect(i,e))}},{key:"panTo",value:function(t,e){var i=t.x,n=t.y,o=this.viewport.getHomeBounds(),r=this.viewport.viewportToImageRectangle(o),s=2*r.y+r.height,a=2*r.x+r.width,l={x:i/this.canvas.width*a,y:n/this.canvas.height*s};this.viewport.panTo(this.viewport.imageToViewportCoordinates(new q.Point(l.x,l.y)),!1)}},{key:"handleMouseDrag",value:function(t){var e,i,n=this,o=function(o){var r=o.x,s=o.y;i||(i={x:r,y:s}),e||(e={x:r,y:s});var a=r-e.x,l=s-e.y;n.panTo({x:i.x+a,y:i.y+l},t)},r=function t(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.$off("mousemove",o),n.$off("mouseup",t)},s=function t(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.$off("touchmove",a),n.$off("touchend",t)},a=function(o){var r=o.touches[0].clientX,s=o.touches[0].clientY;i||(i={x:r,y:s}),e||(e={x:r,y:s});var a=r-e.x,l=s-e.y;n.panTo({x:i.x+a,y:i.y+l},t)};this.$on("mousedown",(function(e){n.$on("selectstart",(function(){return 1})),n.$on("dragstart",(function(){return 1})),n.panTo({x:e.x-t.getBoundingClientRect().left,y:e.y-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.$on("mousemove",o),n.$on("mouseup",r)}),!0,t),this.$on("touchstart",(function(e){var o=e.touches[0].clientX,r=e.touches[0].clientY;n.panTo({x:o-t.getBoundingClientRect().left,y:r-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.$on("touchmove",a),n.$on("touchend",s)}),!0,t)}},{key:"setViewRect",value:function(t,e){var i=this;if(!t)throw new Error("找不到对应的导航器遮罩元素");e||(e=this.viewport.getCenter(!0));var n=this.viewport.getHomeBounds(),o=this.viewport.viewportToImageRectangle(n),r=2*o.y+o.height,s=2*o.x+o.width,a=1,l=this.canvas.height,c=this.canvas.width;a=r<=s?l/r:c/s;var u=this.viewport.getHomeZoom(),h=this.viewport.getZoom(),p=r*u/h,d=s*u/h;t.style.cssText="height:".concat(p*a,"px;\n width: ").concat(d*a,"px;");var f=this.viewport.viewportToImageCoordinates(e);this.centerPoint={x:f.x*c/s,y:f.y*l/r};var g=this.centerPoint.y-p*a/2,v=this.centerPoint.x-d*a/2;if(t.style.left=v+"px",t.style.top=g+"px",t.style.border="1px solid red",this.$emit("rect-change"),!1!==this.vestige.show){this.clearTimeId&&window.clearTimeout(this.clearTimeId);var m=this.viewport.viewportToImageZoom(h),y=Ei(this.vestige.zooms).reverse().findIndex((function(t){return m>=t/(i.options.scale||40)}));-1!==y&&(this.clearTimeId=window.setTimeout((function(){i.$emit("rect-draw",y)}),this.vestige.delay||1e3))}}},{key:"createNavigatorCanvas",value:function(){var t=this,e=document.createElement("canvas"),i=e.getContext("2d"),n=new Image;return n.onload=function(){var o=n.width,r=n.height;if(o>=r){var s=r/(o/t.width);e.width=t.width,e.height=s,i.drawImage(n,0,0,e.width,s)}if(r>o){var a=o/(r/t.height);e.height=t.height,e.width=a,i.drawImage(n,0,0,a,e.height)}t.setViewRect(t.element.getElementsByClassName("view-rect")[0]);var l=t.element.getElementsByClassName("navigator-color-rect")[0];l.width=t.canvas.width,l.height=t.canvas.height,t.loadStatus=!0},n.src=this.options.thumbnail,e}},{key:"updateNavigatorImg",value:function(t){var e=this;this.options.thumbnail=t;var i=this.canvas.getContext("2d"),n=new Image;n.onload=function(){var t=n.width,o=n.height;if(t>=o){var r=o/(t/e.width);e.canvas.width=e.width,e.canvas.height=r,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,e.canvas.width,r)}if(o>t){var s=t/(o/e.height);e.canvas.height=e.height,e.canvas.width=s,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,s,e.canvas.height)}e.setViewRect(e.element.getElementsByClassName("view-rect")[0]);var a=e.element.getElementsByClassName("navigator-color-rect")[0];a.width=e.canvas.width,a.height=e.canvas.height},n.src=this.options.thumbnail}}],i&&Di(e.prototype,i),n&&Di(e,n),r}(V);function Hi(t){return Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hi(t)}function ji(t){return function(t){if(Array.isArray(t))return zi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return zi(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return zi(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zi(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Ni(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Fi(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Vi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wi(t,e){return Wi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Wi(t,e)}function Ui(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Zi(t);if(e){var o=Zi(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Gi(this,i)}}function Gi(t,e){return!e||"object"!==Hi(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Zi(t){return Zi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Zi(t)}var qi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wi(t,e)}(r,t);var e,i,n,o=Ui(r);function r(t){var e,i=t.kv,n=t.viewer,s=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,n,s,a,l)).kv=i,e.isInTailoring=!1,e.tailoringPoints=[],e.movePointIndex=-1,e.color="#FFF",e.contents=[],e.options=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ni(Object(i),!0).forEach((function(e){Fi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ni(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({suffix:"jpeg",quality:.92,resolution:1200},e.options),e}return e=r,(i=[{key:"init",value:function(t){var e=t.width,i=t.height,n=t.left,o=t.top,r=t.color,s=t.now,a=void 0!==s&&s,l=t.contents,u=void 0===l?[]:l;this.isInTailoring=!0,this.movePointIndex=-1;var h=c({x:n,y:o},{x:n+e,y:o+i});this.tailoringPoints=[h[0],h[2],h[6],h[8]],a?(this.emitTailoringRegion(),this.$emit(ui,{base64:this.getScreenCanvasImage(),region:this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y})}),this.stopTailoring()):(this.color=r||"#FFF",this.contents=(null==u?void 0:u.length)?u:["双击区域内表示完成截图","双击区域外或按ESC表示取消截图"],this.change())}},{key:"emitTailoringRegion",value:function(){this.$emit(ci,this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y}))}},{key:"drawRect",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.strokeStyle=this.color,t.lineWidth=1,t.rect(this.tailoringPoints[0].x,this.tailoringPoints[0].y,this.tailoringPoints[3].x-this.tailoringPoints[0].x,this.tailoringPoints[3].y-this.tailoringPoints[0].y),t.stroke()}},{key:"drawTailoring",value:function(){var t,e,i,n,o,r=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),s=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),a=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),l=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),c={x:r,y:s},u={x:a,y:s},h={x:r,y:l},p={x:a,y:l},d=a-r>30?30:a-r,f=l-s>30?30:l-s,g=this.canvas.getContext("2d");g.beginPath(),g.strokeStyle=this.color,g.lineWidth=4,g.moveTo(c.x,c.y),g.lineTo(c.x+d,c.y),g.moveTo(c.x,c.y),g.lineTo(c.x,c.y+f),g.moveTo(u.x,u.y),g.lineTo(u.x-d,u.y),g.moveTo(u.x,u.y),g.lineTo(u.x,u.y+f),g.moveTo(h.x,h.y),g.lineTo(h.x+d,h.y),g.moveTo(h.x,h.y),g.lineTo(h.x,h.y-f),g.moveTo(p.x,p.y),g.lineTo(p.x-d,p.y),g.moveTo(p.x,p.y),g.lineTo(p.x,p.y-f),g.stroke(),g.beginPath(),g.fillStyle=this.color,g.font="18px Arial";var v=(u.x-c.x).toFixed(2)/1,m=(p.y-u.y).toFixed(2)/1;g.fillText((null===(t=this.contents)||void 0===t?void 0:t[2])?this.contents[2](v,m):"区域大小为:".concat(v,"*").concat(m),c.x,c.y-50),g.fillText(null!==(e=null===(i=this.contents)||void 0===i?void 0:i[0])&&void 0!==e?e:"双击区域内表示完成截图",c.x,c.y-30),g.fillText(null!==(n=null===(o=this.contents)||void 0===o?void 0:o[1])&&void 0!==n?n:"双击区域外或按ESC表示取消截图",c.x,c.y-10),g.stroke()}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y;this.movePointIndex=this.tailoringPoints.findIndex((function(t){return d(t,{x:e,y:i},30)}))}},{key:"onCanvasRelease",value:function(t){t.x,t.y,this.movePointIndex=-1,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=t.x,i=t.y;if(-1!==this.movePointIndex){this.lastPoint||(this.lastPoint={x:e,y:i});var n=e-this.lastPoint.x,o=i-this.lastPoint.y;switch(this.movePointIndex){case 0:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+n,y:this.tailoringPoints[0].y+o},this.tailoringPoints[1]={x:this.tailoringPoints[1].x,y:this.tailoringPoints[1].y+o},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+n,y:this.tailoringPoints[2].y};break;case 1:this.tailoringPoints[0]={x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y+o},this.tailoringPoints[1]={x:this.tailoringPoints[1].x+n,y:this.tailoringPoints[1].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+n,y:this.tailoringPoints[3].y};break;case 2:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+n,y:this.tailoringPoints[0].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+n,y:this.tailoringPoints[2].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x,y:this.tailoringPoints[3].y+o};break;case 3:this.tailoringPoints[1]={x:this.tailoringPoints[1].x+n,y:this.tailoringPoints[1].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x,y:this.tailoringPoints[2].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+n,y:this.tailoringPoints[3].y+o}}this.clearCanvas(),this.drawRect(),this.drawTailoring(),this.lastPoint={x:e,y:i},this.emitTailoringRegion()}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&this.stopTailoring()}},{key:"onCanvasDblClick",value:function(t){this.tailoringPoints.length>0&&this.isPointInMatrix(t)&&(this.emitTailoringRegion(),this.$emit(ui,{base64:this.getScreenCanvasImage(),region:this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y})})),this.stopTailoring()}},{key:"isPointInMatrix",value:function(t){var e=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),i=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),n=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),o=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y}))));return h({x:e,y:i},{x:n,y:i},{x:e,y:o},{x:n,y:o},t)}},{key:"getScreenCanvasImage",value:function(){var t=this.viewer.drawer.canvas,e=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),i=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),n=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),o=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),r=t.getContext("2d"),s=t.getBoundingClientRect(),a=s.width,l=s.height,c=[t.width,t.height],u=c[0]/a,h=c[1]/l,p=Math.abs(n-e)*u,d=Math.abs(o-i)*h;if(p.toFixed(5)/1!=0&&d.toFixed(5)/1!=0)try{for(var f,g=r.getImageData(e*u,i*h,p,d),v=0;v<g.data.length;v+=4)0===g.data[v+3]&&(g.data[v]=255,g.data[v+1]=255,g.data[v+2]=255,g.data[v+3]=255);var m=document.createElement("canvas");m.width=p,m.height=d;var y=m.getContext("2d");y.fillstyle="#fff",y.fillRect(0,0,m.width,m.height),y.putImageData(g,0,0,0,0,p,d);var w=null===(f=this.kv.shape)||void 0===f?void 0:f.canvas;if(w&&y.drawImage(w,e*u,i*h,p,d,0,0,p,d),m.width>this.options.resolution){var x=document.createElement("canvas");x.width=this.options.resolution,x.height=this.options.resolution/m.width*m.height;var b=x.getContext("2d");return b.fillstyle="#fff",b.fillRect(0,0,x.width,x.height),b.drawImage(m,0,0,m.width,m.height,0,0,x.width,x.height),x.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}return m.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}catch(T){}}},{key:"stopTailoring",value:function(){this.clearCanvas(),this.tailoringPoints=[],this.isInTailoring=!1,this.movePointIndex=-1,this.lastPoint=void 0}},{key:"change",value:function(){this.isInTailoring&&(this.clearCanvas(),this.emitTailoringRegion(),this.drawRect(),this.drawTailoring())}}])&&Vi(e.prototype,i),n&&Vi(e,n),r}(bt);i(135),i(79),i(80);function $i(t){return $i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$i(t)}function Ki(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Yi(t,e){return Yi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Yi(t,e)}function Ji(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=tn(t);if(e){var o=tn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Qi(this,i)}}function Qi(t,e){return!e||"object"!==$i(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function tn(t){return tn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},tn(t)}var en=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Yi(t,e)}(r,t);var e,i,n,o=Ji(r);function r(){return Ki(this,r),o.apply(this,arguments)}return e=r,i=[{key:"draw",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.canvas.getContext("2d"),o=t.tool,r=t.points;n.beginPath(),n.save();var s=v(r),a={x:s.x+s.width/2,y:s.y+s.height/2};n.translate(a.x,a.y),n.rotate(i*Math.PI/180),o===tt?n.drawPolygon(r.map((function(t){return{x:t.x-a.x,y:t.y-a.y}})),!0,!1):o===J?(n.moveTo(r[0].x-a.x,r[0].y-a.y),n.lineTo(r[0].x+s.width-a.x,r[0].y-a.y),n.lineTo(r[0].x+s.width-a.x,r[0].y+s.height-a.y),n.lineTo(r[0].x-a.x,r[0].y+s.height-a.y),n.lineTo(r[0].x-a.x,r[0].y-a.y)):o===Q&&n.drawOval(0,0,Math.abs(s.width/2),Math.abs(s.height/2),!1),n.closePath(),n.restore(),e.forEach((function(t){var e=t.tool,o=t.points;n.save();var r=v(o),s={x:r.x+r.width/2,y:r.y+r.height/2};n.translate(s.x,s.y),n.rotate(i*Math.PI/180),e===tt?n.drawPolygon(o.map((function(t){return{x:t.x-s.x,y:t.y-s.y}})),!0,!0):e===J?(n.moveTo(o[0].x-s.x,o[0].y-s.y),n.lineTo(o[0].x-s.x,o[0].y+r.height-s.y),n.lineTo(o[0].x+r.width-s.x,o[0].y+r.height-s.y),n.lineTo(o[0].x+r.width-s.x,o[0].y-s.y),n.lineTo(o[0].x-s.x,o[0].y-s.y)):e===Q&&n.drawOval(0,0,Math.abs(r.width/2),Math.abs(r.height/2),!0),n.closePath(),n.restore()})),this.options.fillStyle&&(n.fillStyle=this.options.fillStyle,n.fill())}}],i&&Xi(e.prototype,i),n&&Xi(e,n),r}(St);function nn(t){return nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nn(t)}function on(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function rn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?on(Object(i),!0).forEach((function(e){sn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):on(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function sn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function an(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ln(t,e){return ln=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ln(t,e)}function cn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=hn(t);if(e){var o=hn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return un(this,i)}}function un(t,e){return!e||"object"!==nn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function hn(t){return hn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},hn(t)}var pn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ln(t,e)}(s,t);var e,i,o,r=cn(s);function s(t){var e,i=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this,i,o,a,l)).labelList=[],ht.forEach((function(t){e[t]=new n[t]})),e.combination=new en,e.delaytimer=[],e}return e=s,(i=[{key:"onCanvasKey",value:function(t){}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"change",value:function(){var t=this;this.clearCanvas();var e=this.viewport.viewportToImageRectangle(this.viewport.getBounds()),i={},n={},o=[],r=[],s=this.labelList.filter((function(s){var a,l,c,u,h;if(!1===s.show)return!1;if(!t[s.tool])return!1;if(!t.isInCanvas(s.region,e))return!1;if((at.includes(s.tool)||s.isClose&&s.tool===tt)&&s.fillStyle)o.push(rn(rn({},s),{},{child:[],self:s}));else if(s.tool===rt)return r.push(s),!1;var p="".concat(null!==(a=s.strokeStyle)&&void 0!==a?a:"","_").concat(null!==(l=s.lineWidth)&&void 0!==l?l:"","_").concat(null!==(c=s.fillStyle)&&void 0!==c?c:""),d="".concat(null!==(u=s.strokeStyle)&&void 0!==u?u:"","_").concat(null!==(h=s.lineWidth)&&void 0!==h?h:"");return st.includes(s.tool)?i[p]?i[p].push(s):i[p]=[s]:n[d]?n[d].push(s):n[d]=[s],!ut.includes(s.tool)}));o.length>0&&s.forEach((function(e){var i=o.find((function(i){return i.self!==e&&e.points.every((function(e){return t.isContainerInRegion(e,i)}))}));i&&i.child.push(e)})),this.delaytimer&&(clearTimeout(this.delaytimer),this.delaytimer=void 0),this.deepDrawLabel(i,n,o,r,1,e)}},{key:"deepDrawLabel",value:function(t,e,i,n,o,r){var s=this,a=0,l=this.canvas.getContext("2d"),c={};Object.keys(t).forEach((function(e){var i=t[e];l.beginPath(),i.forEach((function(t){a>=2e3?c[e]?c[e].push(t):c[e]=[t]:s.drawLabel(t),a++}));var n=null==i?void 0:i[0];(null==n?void 0:n.fillStyle)&&(l.fillStyle=n.fillStyle,l.fill()),l.strokeStyle=n.strokeStyle,l.stroke()}));var u={};Object.keys(e).forEach((function(t){var i=e[t];l.beginPath(),i.forEach((function(e){a>=2e3?u[t]?u[t].push(e):u[t]=[e]:s.drawLabel(e),a++}));var n=null==i?void 0:i[0];l.lineWidth=n.lineWidth,l.strokeStyle=n.strokeStyle,l.stroke()})),0===Object.keys(c).length&&0===Object.keys(u).length?(this.delaytimer=void 0,n.forEach((function(t){s.drawLabel(t)})),i.forEach((function(t){s.combination.setContent(s.canvas,t),s.combination.draw({points:t.viewerElementPoints,tool:t.tool},t.child.map((function(t){return{points:t.viewerElementPoints,tool:t.tool}})),s.viewport.getRotation())}))):this.delaytimer=setTimeout((function(){s.deepDrawLabel(c,u,i,n,o+1,r)}),100)}},{key:"drawLabel",value:function(t){t.viewerElementPoints=this.imageToViewerElementPoints(t.points);var e=t.viewerElementPoints;if(this[t.tool].setContent(this.canvas,t),at.includes(t.tool))this[t.tool].draw(e,this.viewport.getRotation(),this.imageToViewerElementRectangle(t.region));else{var i=this.getImageZoom(!0)/t.scale;this[t.tool].draw(e,i)}}}])&&an(e.prototype,i),o&&an(e,o),s}(bt);function dn(t){return dn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dn(t)}function fn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function gn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?fn(Object(i),!0).forEach((function(e){vn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):fn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function vn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function mn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function yn(t,e){return yn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},yn(t,e)}function wn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=bn(t);if(e){var o=bn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return xn(this,i)}}function xn(t,e){return!e||"object"!==dn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function bn(t){return bn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},bn(t)}var Tn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&yn(t,e)}(s,t);var e,i,o,r=wn(s);function s(t){var e,i=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this,i,o,a,l)).labelList=[],e.movePoint=void 0,e.currentPressPoint=void 0,e.lastPoint=void 0,e.draging=!1,e.isHover=!1,ht.forEach((function(t){e[t]=new n[t]})),e}return e=s,(i=[{key:"drawPoint",value:function(t,e){this.thumb.draw(t,{radius:e?this.options.thumb.activeRadius:this.options.thumb.radius,strokeStyle:e?this.options.thumb.activeColor:this.options.thumb.color,fillStyle:e?this.options.thumb.activeBgColor:this.options.thumb.bgColor})}},{key:"drawLine",value:function(t,e,i){var n=this.canvas.getContext("2d");n.beginPath();var o=i?this.options.thumb.activeColor:this.options.thumb.color,r=2*(i?this.options.thumb.activeRadius:this.options.thumb.radius);n.strokeStyle=o||"#01d0b0",n.lineWidth=2,0===e?(n.moveTo(t.x-5,t.y-5),n.lineTo(t.x-5+r,t.y-5),n.moveTo(t.x-5,t.y-5),n.lineTo(t.x-5,t.y-5+r)):1===e?(n.moveTo(t.x,t.y-5),n.lineTo(t.x-r/2,t.y-5),n.moveTo(t.x,t.y-5),n.lineTo(t.x+r/2,t.y-5)):2===e?(n.moveTo(t.x+5,t.y-5),n.lineTo(t.x+5-r,t.y-5),n.moveTo(t.x+5,t.y-5),n.lineTo(t.x+5,t.y-5+r)):3===e?(n.moveTo(t.x-5,t.y),n.lineTo(t.x-5,t.y-r/2),n.moveTo(t.x-5,t.y),n.lineTo(t.x-5,t.y+r/2)):4===e&&i?this.drawPoint(t,i):5===e?(n.moveTo(t.x+5,t.y),n.lineTo(t.x+5,t.y-r/2),n.moveTo(t.x+5,t.y),n.lineTo(t.x+5,t.y+r/2)):6===e?(n.moveTo(t.x-5,t.y+5),n.lineTo(t.x-5,t.y+5-r),n.moveTo(t.x-5,t.y+5),n.lineTo(t.x-5+r,t.y+5)):7===e?(n.moveTo(t.x,t.y+5),n.lineTo(t.x-r/2,t.y+5),n.moveTo(t.x,t.y+5),n.lineTo(t.x+r/2,t.y+5)):8===e&&(n.moveTo(t.x+5,t.y+5),n.lineTo(t.x+5,t.y+5-r),n.moveTo(t.x+5,t.y+5),n.lineTo(t.x+5-r,t.y+5)),n.stroke()}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"onCanvasPress",value:function(t){var e=this,i=t.x,n=t.y;this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1;var o,r=[],s=void 0,a=this.viewport.viewportToImageRectangle(this.viewport.getBounds());this.labelList.forEach((function(t){if(t.tool!==rt&&(t.select&&(s=t),t.select=!1,!e.movePoint)){if(!e.isInCanvas(t.region,a))return!1;var o=-1,l=[],u=e.getImageZoom(!0)/t.scale,p=t.region,g=e.imageToViewerElementCoordinates(p.x,p.y),v=e.imageToViewerElementCoordinates(p.x+p.width,p.y+p.height);if(at.includes(t.tool))o=(l=c(g,v)).findIndex((function(t){return d(t,{x:i,y:n})}));else if(t.tool===tt)o=(l=e.setPointsMove(t)).findIndex((function(t){return t.canMove&&d(t,{x:i,y:n})}));else if(lt.includes(t.tool)){var m=(t.lineWidth||7)<8?8:t.lineWidth;l[0]={x:g.x+m*w(g.x-v.x)*w(g.y-v.y),y:g.y-m},l[1]=g,l[2]={x:v.x+m*w(g.x-v.x)*w(g.y-v.y),y:v.y-m},l[4]={x:(g.x+v.x)/2,y:(g.y+v.y)/2},l[6]={x:g.x-m*w(g.x-v.x)*w(g.y-v.y),y:g.y+m},l[7]=v,l[8]={x:v.x-m*w(g.x-v.x)*w(g.y-v.y),y:v.y+m},o=l.findIndex((function(t,e){return t&&d(t,{x:i,y:n})&&(1===e||4===e||7===e)}))}else if(t.tool===et){var y=e.getFontWidth(t.text,t.fontSize);l=c({x:v.x,y:v.y-t.fontSize*u},{x:v.x+y*u,y:v.y});var b=x(v,{x:i,y:n},-t.angle);o=l.findIndex((function(t,e){return d(t,b)&&4===e}))}else if(t.tool===it){var T=t.lineWidth*u;o=(l=c({x:v.x-T,y:v.y-T},{x:v.x+T,y:v.y+T})).findIndex((function(t){return d(t,{x:i,y:n})}))}if(t.tool===ot){var S=t.lineWidth*u;o=(l=c({x:v.x-S,y:v.y-S},{x:v.x+S,y:v.y+S})).findIndex((function(t,e){return d(t,{x:i,y:n})&&4===e}))}else if(t.tool===nt){var P=t.lineWidth*u;o=(l=c({x:v.x,y:v.y-P},{x:v.x+P,y:v.y})).findIndex((function(t){return d(t,{x:i,y:n})}))}~o?(e.movePoint={position:o,label:t},e.currentPressPoint={x:i,y:n}):(t.tool!==tt&&h(l[0],l[2],l[6],l[8],{x:i,y:n})||t.tool===tt&&f({x:i,y:n},l))&&r.push(t)}})),this.movePoint?(this.movePoint.label.select=!0,this.$emit(fi,this.movePoint.label),this.$emit(hi,this.movePoint.label),this.draging=!0):r.length>0&&((o=r.find((function(t){return t.tool===ot})))||(o=r.find((function(t){return t.tool===et})))||(o=r.find((function(t){return t.tool===it})))||(o=r.find((function(t){return t.tool===nt})))||(r.sort((function(t,e){return Math.abs(t.region.width)-Math.abs(e.region.width)})),o=r[0]),o.select=!0),o?this.$emit(fi,o):!this.movePoint&&s&&this.$emit(gi,s),this.change()}},{key:"onCanvasDblClick",value:function(t){var e=this,i=t.x,n=t.y;setTimeout((function(){var t=e.labelList.find((function(t){return t.select}));if((null==t?void 0:t.tool)===tt){for(var o=e.imageToViewerElementPoints(t.points),r=-1,s=0,a=o.length,l=a-1;s<a;l=s,s++){var c=o[s],u=o[l];if(g({x:i,y:n},[c,u])){r=s;break}}if(r>-1){var h=e.viewerElementToImageCoordinates(i,n);t.points.splice(r,0,gn(gn({},h),{},{canMove:!0})),e.$emit(Ti,t),e.change()}else e.$emit(vi,t)}else e.$emit(vi,t)}))}},{key:"onCanvasMove",value:function(t){var e=t.x,i=t.y,n=this.labelList.find((function(t){var e=t.tool,i=t.select;return e===J&&i}));if(n&&!this.movePoint){var o=this.imageToViewerElementRectangle(n.region);if(this.isContainerInRegion({x:e,y:i},gn(gn({},n),{},{region:o}))){var r=c({x:o.x,y:o.y},{x:o.x+o.width,y:o.y+o.height});4===r.findIndex((function(t){return d(t,{x:e,y:i})}))?(this.isHover=!0,this.drawPoint(r[4],!!this.movePoint)):this.isHover&&(this.isHover=!1,this.change())}}}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y;if(this.movePoint&&!1!==this.options.drag){var n=T(this.currentPressPoint,{x:e,y:i});if(Math.abs(n)>1){var o=this.movePoint.label;this.$emit(di,o)}}this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1,this.change()}},{key:"onCanvasDrag",value:function(t,e){var i=this,n=t.x,o=t.y;if(!1!==this.options.drag){this.lastPoint||(this.lastPoint={x:n,y:o});var r=this.movePoint.label,s=this.movePoint.position,a=!1!==r.move,l=!1!==r.resize;if((a||l)&&(4!==s||a)&&(4===s||l)){e.preventDefaultAction=!0;var u=this.getImageZoom(!0)/r.scale,h=r.tool,p=r.region,d=this.imageToViewerElementCoordinates(p.x,p.y),f=this.imageToViewerElementCoordinates(p.x+p.width,p.y+p.height),g=n-this.lastPoint.x,m=o-this.lastPoint.y,y=gn({},d),w=gn({},f);if(lt.includes(h))4===s&&(y={x:d.x+g,y:d.y+m},w={x:f.x+g,y:f.y+m}),1===s&&(y={x:d.x+g,y:d.y+m}),7===s&&(w={x:f.x+g,y:f.y+m});else if(at.includes(h)){var S=c(d,f);switch(s){case 0:y={x:S[0].x+g,y:S[0].y+m};break;case 1:y={x:S[0].x,y:S[0].y+m};break;case 2:y={x:S[0].x,y:S[0].y+m},w={x:S[8].x+g,y:S[8].y};break;case 3:y={x:S[0].x+g,y:S[0].y};break;case 4:y={x:S[0].x+g,y:S[0].y+m},w={x:S[8].x+g,y:S[8].y+m};break;case 5:w={x:S[8].x+g,y:S[8].y};break;case 6:y={x:S[0].x+g,y:S[0].y},w={x:S[8].x,y:S[8].y+m};break;case 7:w={x:S[8].x,y:S[8].y+m};break;case 8:w={x:S[8].x+g,y:S[8].y+m}}}else if(h===tt){for(var P=this.imageToViewerElementPoints(r.points).map((function(t,e){return gn(gn({},t),{},{index:e})})),E=P.filter((function(t){return t.canMove})),C=void 0,R=void 0,_=0;_<E.length-1;_++){if(0===s){C=E[E.length-1].index,R=E[1].index;break}if(s===E[E.length-1].index){C=E[E.length-2].index,R=E[0].index;break}if(s===E[_].index){C=E[_-1].index,R=E[_+1].index;break}}if(!C&&0!==C||!R&&0!==R)return;var O=P[C],I=P[R],D=P[s],k=b(I,D,{x:n,y:o}),M=b(O,D,{x:n,y:o}),L=T({x:n,y:o},I)/T(D,I),A=T({x:n,y:o},O)/T(D,O);r.points=P.map((function(t,e){if(0===s&&e>=s&&e<=R||s===E[E.length-1].index&&e>=s&&e>=R||0!==s&&s!==E[E.length-1].index&&e>=s&&e<=R){if(L===1/0)return gn(gn({},t),i.viewerElementToImageCoordinates(I.x,I.y));var n=x(I,t,180*k/Math.PI);return gn(gn({},t),i.viewerElementToImageCoordinates((n.x-I.x)*L+I.x,(n.y-I.y)*L+I.y))}if(0===s&&e>=C||s===E[E.length-1].index&&e<=s&&e>=C||0!==s&&s!==E[E.length-1].index&&e>=C&&e<=s){if(A===1/0)return gn(gn({},t),i.viewerElementToImageCoordinates(O.x,O.y));var o=x(O,t,180*M/Math.PI);return gn(gn({},t),i.viewerElementToImageCoordinates((o.x-O.x)*A+O.x,(o.y-O.y)*A+O.y))}return gn(gn({},t),i.viewerElementToImageCoordinates(t.x,t.y))}))}else h===et||h===ot?4===s&&(y={x:f.x+g,y:f.y+m},w={x:f.x+g,y:f.y+m}):h===it?4===s?(y={x:f.x+g,y:f.y+m},w={x:f.x+g,y:f.y+m}):0===s||2===s?r.lineWidth-=m/u:6!==s&&8!==s||(r.lineWidth+=m/u):h===nt&&(4===s?(y={x:f.x+g,y:f.y+m},w={x:f.x+g,y:f.y+m}):0===s||2===s?r.lineWidth-=m/u:6!==s&&8!==s||(r.lineWidth+=m/u,w={x:f.x,y:f.y+m},y={x:f.x,y:f.y+m}));h!==tt&&(r.points=[this.viewerElementToImageCoordinates(y.x,y.y),this.viewerElementToImageCoordinates(w.x,w.y)]),r.region=v(r.points),this.$emit(pi,r),this.lastPoint={x:n,y:o}}}}},{key:"drawThumbPoints",value:function(t,e){var i,n=this;if(!1!==this.options.thumb.show){var o=null===(i=this.movePoint)||void 0===i?void 0:i.position;lt.includes(e)?(this.drawPoint(t[0],1===o),this.drawPoint({x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2},4===o),this.drawPoint(t[1],7===o)):e===J?c({x:t[0].x<t[1].x?t[0].x:t[1].x,y:t[0].y<t[1].y?t[0].y:t[1].y},{x:t[0].x>t[1].x?t[0].x:t[1].x,y:t[0].y>t[1].y?t[0].y:t[1].y}).forEach((function(t,e){n.drawLine(t,e,o===e)})):at.includes(e)?c(t[0],t[1]).forEach((function(t,e){n.drawPoint(t,o===e)})):e===tt?t.forEach((function(t,e){t.canMove&&n.drawPoint(t,o===e)})):e===et||e===ot?this.drawPoint(t[0],4===o):e!==it&&e!==nt||c(t[0],t[1]).forEach((function(t,e){0!==e&&2!==e&&4!==e&&6!==e&&8!==e||n.drawPoint(t,o===e)}))}}},{key:"change",value:function(){this.clearCanvas(),this.showLabelMeasure();var t=this.labelList.find((function(t){return t.select}));if(t&&!1!==t.show){var e=t.region,i=this.imageToViewerElementCoordinates(e.x,e.y),n=this.imageToViewerElementCoordinates(e.x+e.width,e.y+e.height),o=this.getImageZoom(!0)/t.scale;if(ct.includes(t.tool)){if(t.tool===et){var r=this.getFontWidth(t.text,t.fontSize),s=x(i,{x:i.x+r/2*o,y:i.y-t.fontSize/2*o+4},t.angle);this.drawThumbPoints([s],t.tool)}else if(t.tool===it){var a=t.lineWidth*o;this.drawThumbPoints([{x:i.x-a,y:i.y-a},{x:i.x+a,y:i.y+a}],t.tool)}else if(t.tool===ot)this.drawThumbPoints([{x:i.x,y:i.y}],t.tool);else if(t.tool===nt){var l=t.lineWidth*o;this.drawThumbPoints([{x:i.x,y:i.y-l},{x:i.x+l,y:i.y}],t.tool)}else if(t.tool===tt)if(this.draging){var c=this.imageToViewerElementPoints(t.points);this.drawThumbPoints(c,t.tool)}else{var u=this.setPointsMove(t);this.drawThumbPoints(u,t.tool)}}else this.drawThumbPoints([i,n],t.tool);this[t.tool].setContent(this.canvas,gn({},t))}}},{key:"showLabelMeasure",value:function(){var t=this,e=this.viewport.viewportToImageRectangle(this.viewport.getBounds());if(this.getImageZoom(!0)*this.options.scale<this.options.measure.scale){var i=this.labelList.find((function(t){return t.select}));if(!i)return;if(!1===i.show)return;if(!1===i.measure)return;this[i.tool].drawMeasureInfo.call(this,i,this.getMeasureContent(i))}else this.labelList.forEach((function(i){if(!1!==i.show){if(i.select&&i.measure)t[i.tool].drawMeasureInfo.call(t,i,t.getMeasureContent(i));else if(t.options.measure.defaultShow&&i.measure){if(!t.isInCanvas(i.region,e))return!1;t[i.tool].drawMeasureInfo.call(t,i,t.getMeasureContent(i))}if(t.options.labelDrawing){if(!t.isInCanvas(i.region,e))return!1;t.options.labelDrawing(t.canvas,i,t.imageToViewerElementRectangle(i.region))}}}))}},{key:"setPointsMove",value:function(t){var e=this.imageToViewerElementPoints(t.points),i=e[0];return e.forEach((function(n,o){n.canMove=!1,t.points[o].canMove=!1,0!==o&&(d(i,n,30)||d(e[0],n,30))&&o!==e.length-1||(i=n,n.canMove=!0,t.points[o].canMove=!0)})),e}}])&&mn(e.prototype,i),o&&mn(e,o),s}(bt);function Sn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Pn=function t(){var e,i,n,o,r,s,a=this,l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Sn(this,t),l||(l={}),this.id=l.id,this.parent_id=l.parent_id,this.lineWidth=l.lineWidth?l.lineWidth:l.tool===it?15:l.tool===nt?30:l.tool===ot?10:2,this.strokeStyle=l.strokeStyle||"#027AFF",this.fillStyle=l.fillStyle,this.description=l.description,this.fontSize=l.fontSize||14,this.text=l.text,this.angle=null!==(e=l.angle)&&void 0!==e?e:0,this.measure=l.measure,this.points=l.points,this.tool=l.tool,this.src=l.src,this.scale=l.scale,this.region=l.region,this.move=l.move,this.resize=l.resize,this.isROI=null!==(i=l.isROI)&&void 0!==i&&i,this.isClose=null===(n=l.isClose)||void 0===n||n,this.select=null!==(o=l.select)&&void 0!==o&&o,this.show=null===(r=l.show)||void 0===r||r,this.__other__=l.__other__||{},this.__data__=null!==(s=l.__data__)&&void 0!==s?s:l,this.src&&(this.img=new Image,this.img.src=this.src,this.imgLoadSuccess=!1,this.img.onload=function(){a.imgLoadSuccess=!0})};function En(t){return En="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(t)}function Cn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Rn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Cn(Object(i),!0).forEach((function(e){_n(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Cn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function On(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function In(t,e){return In=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},In(t,e)}function Dn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Mn(t);if(e){var o=Mn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return kn(this,i)}}function kn(t,e){return!e||"object"!==En(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Mn(t){return Mn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Mn(t)}var Ln=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&In(t,e)}(s,t);var e,i,o,r=Dn(s);function s(t){var e,i=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=r.call(this,i,o,a,l),ht.forEach((function(t){e[t]=new n[t]})),e.ROIList=[],e.points=[],e.tool=void 0,e.isInDraw=!1,e}return e=s,i=[{key:"startDraw",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!ht.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.points=[],this.tool=t.tool,this[this.tool].setContent(this.canvas,Rn(Rn({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===it?15:this.tool===nt?30:this.tool===ot?10:2,tool:void 0})),this.isInDraw=!0}},{key:"updateOptions",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!ht.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.tool=t.tool,this[this.tool].setContent(this.canvas,Rn(Rn({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===it?15:this.tool===nt?30:this.tool===ot?10:2,tool:void 0}))}},{key:"setLabelList",value:function(t){this.ROIList=t.filter((function(t){return t.isROI}))}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n))return this.points=[],void this.clearCanvas();var o=this.tool;o===tt?this.points.push(n):this.points=[n],this.clearCanvas(),this[o].startDraw();var r=this.imageToViewerElementPoints(this.points);this[o].draw(r),this[o].endDraw(),this[o].drawPoints(r,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(ri,this.getPaintOptions())}},{key:"onCanvasDrag",value:function(t){var e=t.position,i=e.x,n=e.y,o=this.viewerElementToImageCoordinates(i,n);if(!this.isInROI(o))return this.points=[],void this.clearCanvas();t.preventDefaultAction=!0;var r=this.tool;ct.includes(r)?r===tt?(this.points.push(o),this.setEnablePoints(!1)):st.includes(r)&&(this.points=[o,o]):this.points=[this.points[0]||o,o],this.clearCanvas(),this[r].startDraw();var s=this.imageToViewerElementPoints(this.points);this[r].draw(s),this[r].endDraw(),this[r].drawPoints(s,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(si,this.getPaintOptions())}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n)||0===this.points.length)return this.points=[],void this.clearCanvas();var o=this.tool;if(ct.includes(o)){if(st.includes(o))this.points=[n,n];else if(o===tt){var r=this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),s=this[this.tool].options.enableDbClickClose,a=this[this.tool].options.isClose;if(s){if(!a||!d(r,{x:e,y:i}))return;if(this.setEnablePoints(),this.points.length<5)return}else if(this.setEnablePoints(),this.points.length<5)return this.points=[],void this.clearCanvas()}}else{var l=T(this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),{x:e,y:i});if(Math.abs(l)<10)return this.points=[],void this.clearCanvas()}this.$emit(ai,this.getPaintOptions()),this[this.tool].options.once?this.endDraw():this[this.tool].options.clear&&(this.points=[],this.clearCanvas())}},{key:"onCanvasDblClick",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);return this.isInROI(n)&&0!==this.points.length?this.tool===tt&&(this.setEnablePoints(),this.points.length<5)?(this.points=[],void this.clearCanvas()):(this.$emit(ai,this.getPaintOptions()),void(this[this.tool].options.once?(this.endDraw(),this.$emit(li,this.getPaintOptions())):this[this.tool].options.clear&&(this.points=[],this.clearCanvas()))):(this.points=[],void this.clearCanvas())}},{key:"onCanvasMove",value:function(t){var e=t.target,i=t.x,n=t.y,o=e.getBoundingClientRect(),r=o.left,s=o.top,a=this.viewerElementToImageCoordinates(i-r,n-s);if(!this.isInROI(a))return this.points=[],void this.clearCanvas();var l=this.tool;if(l===tt&&this.points.length>0){this.points.length>1&&this.points.pop(),this.points.push(a),this.clearCanvas(),this[l].startDraw();var c=this.imageToViewerElementPoints(this.points);this[l].draw(c),this[l].endDraw(),this[l].drawPoints(c,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(si,this.getPaintOptions())}}},{key:"onCanvasKey",value:function(t){var e=t.originalEvent;"Escape"===e.key&&this.isInDraw&&(this.$emit(li,this.getPaintOptions()),this.endDraw()),"Delete"!==e.key&&"Backspace"!==e.key||this.tool===tt&&this.points.length>1&&(this.points.splice(this.points.length-2,1),this.change())}},{key:"setEnablePoints",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=this.imageToViewerElementPoints(this.points),n=i[0];if(this.points=this.points.filter((function(e,o){var r=i[o];if(0===o)return!0;if(o===t.points.length-1)return!0;if(d(n,r,30)){var s=i[o+1];return!!s&&180*Math.abs(b(r,n,s))/Math.PI<90&&(n=r,!0)}return n=r,!0})),e&&this.points.length>1){var o=this.points[this.points.length-1],r=this.points[this.points.length-2];d(this.imageToViewerElementCoordinates(o.x,o.y),this.imageToViewerElementCoordinates(r.x,r.y))&&this.points.splice(this.points.length-2,1)}}},{key:"getPaintOptions",value:function(){var t=new Pn(Rn(Rn({},this[this.tool].options),{},{points:this.points,scale:this.getImageZoom(!0),region:v(this.points),tool:this.tool}));return t.measure&&this[this.tool].drawMeasureInfo.call(this,t,this.getMeasureContent(Rn(Rn({},t),{},{select:!0}))),t}},{key:"isInROI",value:function(t){return this.options.ROI?this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList):!(this.ROIList.length>0)||this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList)}},{key:"clearCanvas",value:function(){var t,e;null==this||null===(t=this[this.tool])||void 0===t||null===(e=t.clearCanvas)||void 0===e||e.call(t)}},{key:"endDraw",value:function(){this.clearCanvas(),this.points=[],this.tool=void 0,this.isInDraw=!1}},{key:"change",value:function(){if(this.isInDraw&&0!==this.points.length){var t=this.imageToViewerElementPoints(this.points);this.clearCanvas(),this[this.tool].startDraw(),this[this.tool].draw(t),this[this.tool].endDraw(),this[this.tool].drawPoints(t,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(si,this.getPaintOptions())}}}],i&&On(e.prototype,i),o&&On(e,o),s}(bt);function An(t){return An="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},An(t)}function Bn(t){return function(t){if(Array.isArray(t))return Hn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Hn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Hn(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function jn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function zn(t,e){return zn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},zn(t,e)}function Nn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Vn(t);if(e){var o=Vn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Fn(this,i)}}function Fn(t,e){return!e||"object"!==An(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Vn(t){return Vn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Vn(t)}var Wn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&zn(t,e)}(r,t);var e,i,n,o=Nn(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).scales=a.scales||[.1,.4,.6,1,2,4,8,10,20,40,60,100,140,200],e.microns=a.microns||[5e3,2e3,1250,1e3,500,250,200,100,50,25,20,10,5,2],e}return e=r,(i=[{key:"change",value:function(){var t=Bn(this.scales),e=40*this.viewport.viewportToImageZoom(this.viewport.getZoom(!0)),i=t.findIndex((function(t){return t>=e}));~i?this.setScaleLine(this.microns[i],this.microns[i]/this.options.imageCapRes):this.setScaleLine(this.microns[this.microns.length-1],this.microns[this.microns.length-1]/this.options.imageCapRes)}},{key:"setScaleLine",value:function(t,e){var i=this.imageToViewerElementCoordinates(0,0),n=this.imageToViewerElementCoordinates(e,0),o=Math.abs(n.x-i.x);this.options.custom?this.$emit("graduation-change",{width:o,txt:t}):this.paintGraduation({width:o,txt:t})}},{key:"paintGraduation",value:function(t){var e=t.width,i=t.txt,n=this.canvas.getContext("2d"),o=this.canvas.width,r=this.canvas.height;if(n.beginPath(),n.clearRect(0,0,o,r),this.options.show){var s=this.options,a=s.left,l=s.top,c=s.right,u=s.bottom,h=10,p=r-10;a?h=a:c&&(h=o-c-e),l?p=l:u&&(p=r-u),n.beginPath(),n.strokeStyle="#000000",n.lineWidth=3,n.moveTo(h,p-8),n.lineTo(h,p),n.lineTo(h+e,p),n.lineTo(h+e,p-8),n.stroke(),n.beginPath(),n.fillStyle="#000000",n.font="bold 16px Arial";var d=i.toFixed(0)+this.options.unit,f=n.measureText(d).width;n.fillText(d,h+e/2-f/2,l?p+12:p-12)}}}])&&jn(e.prototype,i),n&&jn(e,n),r}(bt);function Un(t){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(t)}function Gn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Zn(t,e){return Zn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Zn(t,e)}function qn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Kn(t);if(e){var o=Kn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return $n(this,i)}}function $n(t,e){return!e||"object"!==Un(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Kn(t){return Kn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Kn(t)}var Xn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Zn(t,e)}(r,t);var e,i,n,o=qn(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).options.scale||(e.options.scale=20),e}return e=r,(i=[{key:"change",value:function(){var t=this.viewerElementToImageCoordinates(0,0),e=this.viewerElementToImageCoordinates(this.canvas.width,0),i=this.viewerElementToImageCoordinates(0,this.canvas.height),n=this.getImageZoom(!0)*this.options.scale,o=40===this.options.scale?3200:1600,r=0;if(n>=1){for(;n/2>=1;)r++,n/=2;r&&(o/=Math.pow(2,r))}else if(n<1){for(;2*n<=1;)r++,n*=2;r&&(o*=Math.pow(2,r))}var s=e.distanceTo(t),a=i.distanceTo(t),l=Math.floor(t.x/o),c=Math.floor((e.x+s)/o),u=Math.floor(t.y/o),h=Math.floor((i.y+a)/o),p=this.canvas.getContext("2d");if(p.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.show){p.beginPath(),p.lineWidth=1;for(var d=l;d<=c+1;d++){var f=this.imageToViewerElementCoordinates(d*o,0);p.moveTo(f.x,0),p.lineTo(f.x,this.canvas.height)}for(var g=u;g<=h+1;g++){var v=this.imageToViewerElementCoordinates(0,g*o);p.moveTo(0,v.y),p.lineTo(this.canvas.width,v.y)}p.stroke()}if(this.options.ruler){var m=this.imageToViewerElementCoordinates(o,0).minus(this.imageToViewerElementCoordinates(0,0)).x;p.beginPath(),p.font="14px Arial",p.fillStyle="#fff",p.fillRect(0,0,20,this.canvas.height),p.fillRect(0,0,this.canvas.width,20),p.beginPath(),p.fillStyle="rgba(0, 0, 0, .3)",p.strokeStyle="rgba(0, 0, 0, .8)",p.moveTo(20,20),p.lineTo(20,this.canvas.height),p.moveTo(20,20),p.lineTo(this.canvas.width,20);for(var y=l;y<=c+1;y++){var w=this.imageToViewerElementCoordinates(y*o,0);p.moveTo(w.x,0),p.lineTo(w.x,20);for(var x=1;x<5;x++)p.moveTo(w.x+m/5*x,16),p.lineTo(w.x+m/5*x,20),y!==l&&p.fillText(y*o,w.x+5,13)}for(var b=u;b<=h+1;b++){var T=this.imageToViewerElementCoordinates(0,b*o);p.moveTo(0,T.y),p.lineTo(20,T.y);for(var S=1;S<5;S++)p.moveTo(16,T.y+m/5*S),p.lineTo(20,T.y+m/5*S),b!==u&&(p.save(),p.translate(3,T.y+5),p.rotate(Math.PI/2),p.fillText(b*o,0,0),p.restore())}p.stroke(),p.beginPath(),p.fillStyle="#fff",p.fillRect(0,0,20,20)}}}])&&Gn(e.prototype,i),n&&Gn(e,n),r}(bt);i(139);function Yn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Jn(t){return function(t){if(Array.isArray(t))return Qn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Qn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Qn(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}CanvasRenderingContext2D.prototype.clearArc=function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;this.beginPath(),this.save(),this.arc(t,e,i,n,o),this.clip(),this.clearRect(t-i,e-i,2*i,2*i),this.restore(),this.closePath()},CanvasRenderingContext2D.prototype.drawArrow=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,o=180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI,r=(o+i)*Math.PI/180,s=(o-i)*Math.PI/180,a=n*Math.cos(r),l=n*Math.sin(r),c=n*Math.cos(s),u=n*Math.sin(s),h=t.x-a,p=e.y-l;this.moveTo(h,p),this.moveTo(t.x,t.y),this.lineTo(e.x,e.y),h=e.x+a,p=e.y+l,this.moveTo(h,p),this.lineTo(e.x,e.y),h=e.x+c,p=e.y+u,this.lineTo(h,p)},CanvasRenderingContext2D.prototype.drawOval=function(t,e,i,n){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.save();var r=i>n?i:n,s=i/r,a=n/r;this.scale(s,a),this.moveTo((t+i)/s,e/a),this.arc(t/s,e/a,r,0,2*Math.PI,o),this.closePath(),this.restore()},CanvasRenderingContext2D.prototype.drawPolygon=function(t){for(var e=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=Jn(t),r=0,s=0;s<t.length-1;s++)r+=-.5*(t[s+1].y+t[s].y)*(t[s+1].x-t[s].x);r>0?n&&o.reverse():n||o.reverse(),this.moveTo(o[0].x,o[0].y),o.forEach((function(t){e.lineTo(t.x,t.y)})),i&&this.lineTo(o[0].x,o[0].y)};var to=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.points=e}var e,i,n;return e=t,(i=[{key:"calculationPoint",value:function(t){var e=this,i=this.points.length-1,n={x:0,y:0};return this.points.forEach((function(o,r){r?(n.x+=e.factorial(i)/e.factorial(r)/e.factorial(i-r)*o.x*Math.pow(1-t,i-r)*Math.pow(t,r),n.y+=e.factorial(i)/e.factorial(r)/e.factorial(i-r)*o.y*Math.pow(1-t,i-r)*Math.pow(t,r)):(n.x+=o.x*Math.pow(1-t,i-r)*Math.pow(t,r),n.y+=o.y*Math.pow(1-t,i-r)*Math.pow(t,r))})),n}},{key:"factorial",value:function(t){return t<=1?1:t*this.factorial(t-1)}}])&&Yn(e.prototype,i),n&&Yn(e,n),t}();CanvasRenderingContext2D.prototype.bezierCurve=function(){if(1===arguments.length){var t=arguments.length<=0?void 0:arguments[0];if(!Array.isArray(t))throw new SyntaxError("parameter error");if(1===t.length||0===t.length)throw new SyntaxError("Parameter length greater than 1");if(2===t.length&&(this.moveTo(t[0].x,t[0].y),this.lineTo(t[1].x,t[1].y),this.stroke()),3===t.length){var e=t[0];this.moveTo(e.x,e.y),this.quadraticCurveTo(t[1].x,t[1].y,t[2].x,t[2].y),this.stroke()}else if(4===t.length){var i=t[0];this.moveTo(i.x,i.y),this.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.stroke()}else for(var n=new to(t),o=Jn(new Array(101)).map((function(t,e){return n.calculationPoint(e/100)})),r=1;r<101;r++)this.moveTo(o[r-1].x,o[r-1].y),this.lineTo(o[r].x,o[r].y),this.stroke()}else if(4===arguments.length)this.quadraticCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3]);else{if(6!==arguments.length)throw new SyntaxError("parameter error");this.bezierCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5])}};var eo=function(t){var e=Object.prototype.toString;return t instanceof Element?"element":{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"}[e.call(t)]},io=function t(e){var i="array"===eo(e)?[]:{};for(var n in e)e.hasOwnProperty(n)&&(e[n]&&"object"===eo(e[n])||e[n]&&"array"===eo(e[n])?i[n]=t(e[n]):e[n]&&"date"===eo(e[n])?i[n]=new Date(e[n].valueOf()):i[n]=e[n]);return i};var no="shape",oo="area",ro="board",so="graduation",ao="rotation",lo="tailoring",co="navigator",uo="cache",ho="grid";function po(t){return po="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},po(t)}function fo(t){return function(t){if(Array.isArray(t))return go(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return go(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return go(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function go(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function vo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function mo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?vo(Object(i),!0).forEach((function(e){yo(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):vo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function yo(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xo(t,e){return xo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},xo(t,e)}function bo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Po(t);if(e){var o=Po(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return To(this,i)}}function To(t,e){return!e||"object"!==po(e)&&"function"!=typeof e?So(t):e}function So(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Po(t){return Po=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Po(t)}var Eo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&xo(t,e)}(a,t);var e,i,n,o=bo(a);function a(t){var e,i;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=o.call(this),!t.el)throw new Error("el must not be null");if(!t.openSeadragonOptions)throw new Error("no openSeadragon options");if("string"===eo(t.el)&&(e.$el=(i=t.el,document.querySelector(i))),"element"===eo(t.el)&&(e.$el=t.el),!e.$el)throw new Error("el is not a valid selector string or element object");e.$el.style.position="relative";var n,l,c=e.$el.getBoundingClientRect(),u=c.height,h=c.width;return e.$options=mo(mo({},t),{},{width:h,height:u}),n=So(e),l=mo(mo(mo({},{showNavigationControl:!1,navigatorSizeRatio:.25,wrapHorizontal:!1,minScrollDeltaTime:10,zoomPerClick:1,gestureSettingsMouse:{clickToZoom:!1}}),n.$options.openSeadragonOptions),{},{element:n.$el}),n.viewer=$()(l),n.viewer.addHandler("tile-drawing",(function(t){if("function"===eo(n.$options.tileDrawing))n.$options.tileDrawing(t);else{var e=t.context,i=t.rendered,o=t.sourceWidth,r=t.sourceHeight,s=t.position,a=t.size;e.drawImage(i.canvas,0,0,o,r,s.x,s.y,a.x,a.y)}})),function(t){var e=t.$options;Object.values(s).forEach((function(i){var n=i[0].toLocaleUpperCase()+i.substring(1);i===co?function(t){var e=t.$options;if(e.navigator=e.navigator||{disabled:!1},!0!==e.navigator.disabled){e.navigator.style||(e.navigator.style="bottom: 0;left: 0;");var i=document.createElement("div");i.setAttribute("class","openseadragon-navigator"),i.style.cssText+=e.navigator.style,t.viewer.container.appendChild(i),t.navigator=new Bi(mo({viewer:t.viewer,containerHeight:e.height,containerWidth:e.width,element:i,scale:e.scale},e.navigator))}}(t):i===uo?t.cache=new r[n]:(e[i]=e[i]||{disabled:!1},!0!==e[i].disabled&&(t[i]=new r[n](function(t,e){var i=t.$options,n=i.pxConversion||{imageCapRes:1,unit:""};return{kv:t,viewer:t.viewer,cache:t.cache,canvas:Co(t),options:mo(mo(mo({scale:i.scale,labelDrawing:i.labelDrawing,measure:mo({backgroundColor:"rgba(0,0,0,.5)",color:"#FFF",fontSize:14,scale:10,defaultShow:!1},i.measure||{})},i[e]),n),{},{thumb:i.thumb?mo({radius:5,activeRadius:7,activeBgColor:"#01d0b0"},i.thumb):{radius:5,activeRadius:7,activeBgColor:"#01d0b0"}})}}(t,i))))}))}(So(e)),function(t){t.viewer.addHandler("animation",(function(){var e;t.change(),(null===(e=t.tailoring)||void 0===e?void 0:e.isInTailoring)&&t.tailoring.emitTailoringRegion()})),t.viewer.addHandler("canvas-press",(function(e){var i,n,o,r;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)?t.board.onCanvasPress(e.position):(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation)?t.rotation.onCanvasPress(e.position):(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring)?t.tailoring.onCanvasPress(e.position):(null===(r=t.area)||void 0===r?void 0:r.onCanvasPress)&&t.area.onCanvasPress(e.position)})),t.viewer.addHandler("canvas-drag",(function(e){var i,n,o,r;if(null===(i=t.board)||void 0===i?void 0:i.isInDraw)t.board.onCanvasDrag(e);else if(null===(n=t.rotation)||void 0===n?void 0:n.rotatePoint)e.preventDefaultAction=!0,t.rotation.onCanvasDrag(e.position),t.change();else if((null===(o=t.tailoring)||void 0===o?void 0:o.movePointIndex)>-1)e.preventDefaultAction=!0,t.tailoring.onCanvasDrag(e.position);else if(null===(r=t.area)||void 0===r?void 0:r.movePoint){var s,a;t.area.onCanvasDrag(e.position,e),t.area.change(),null==t||null===(s=t.shape)||void 0===s||null===(a=s.change)||void 0===a||a.call(s)}})),t.viewer.addHandler("canvas-release",(function(e){var i,n,o,r;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)?t.board.onCanvasRelease(e.position):(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation)?t.rotation.onCanvasRelease(e.position):(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring)?t.tailoring.onCanvasRelease(e.position):(null===(r=t.area)||void 0===r?void 0:r.onCanvasRelease)&&t.area.onCanvasRelease(e.position)})),t.viewer.addHandler("canvas-key",function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,i=(new Date).getTime();return function(n){(new Date).getTime()-i>e&&t(n),i=(new Date).getTime()}}((function(e){var i,n,o;e.preventDefaultAction=!0;var r,s,a=e.originalEvent;if(function(t,e){if("z"===t.key&&t.ctrlKey){if(0===e.cache.currentIndex)return;e.cache.currentIndex--,e.$emit(mi,e.cache.currentIndex)}if("y"===t.key&&t.ctrlKey){if(e.cache.currentIndex===e.cache.cacheList.length-1)return;e.cache.currentIndex++,e.$emit(yi,e.cache.currentIndex)}}(a,t),null===(i=t.board)||void 0===i?void 0:i.isInDraw)null===(r=t.board)||void 0===r||null===(s=r.onCanvasKey)||void 0===s||s.call(r,e);else if(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation){var l,c;null===(l=t.rotation)||void 0===l||null===(c=l.onCanvasKey)||void 0===c||c.call(l,e)}else if(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring){var u,h;null===(u=t.tailoring)||void 0===u||null===(h=u.onCanvasKey)||void 0===h||h.call(u,e)}else{var p,d,f,g;!function(t,e){var i=e.labelList.findIndex((function(t){return t.select})),n=e.labelList[i];if("h"===t.key){if(!n)return;n.show=!1,e.$emit(wi,n)}else if("Delete"===t.key||"Backspace"===t.key){var o,r,s;if(!n)return;if((null===(o=e.area)||void 0===o||null===(r=o.movePoint)||void 0===r||null===(s=r.label)||void 0===s?void 0:s.tool)===tt){var a=e.area.movePoint;a.label.points.splice(a.position,1),0===a.label.points.length?(e.$emit(xi,n),e.labelList.splice(i,1)):e.$emit(bi,a.label),e.area.movePoint=void 0}else e.$emit(xi,n),e.labelList.splice(i,1)}else"Escape"===t.key&&(n&&e.$emit(gi,n),e.labelList.forEach((function(t){t.select=!1,t.show=!0})))}(a,t),null===(p=t.area)||void 0===p||null===(d=p.change)||void 0===d||d.call(p,e),null===(f=t.shape)||void 0===f||null===(g=f.change)||void 0===g||g.call(f,e)}}),100)),t.viewer.addHandler("canvas-double-click",(function(e){var i,n;if(null===(i=t.board)||void 0===i?void 0:i.isInDraw)t.board.onCanvasDblClick(e.position);else if(null===(n=t.tailoring)||void 0===n?void 0:n.isInTailoring){var o,r;null===(o=t.tailoring)||void 0===o||null===(r=o.onCanvasDblClick)||void 0===r||r.call(o,e.position)}else{var s,a;null===(s=t.area)||void 0===s||null===(a=s.onCanvasDblClick)||void 0===a||a.call(s,e.position)}})),t.viewer.addHandler("resize",(function(e){var i=e.newContainerSize,n=i.x,o=i.y;t.resizeViewContainer({width:n,height:o})})),t.$on("mousemove",(function(e){var i;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)&&t.board.onCanvasMove(e)}),!0,t.$el);var e,i=!1;t.viewer.canvas.addEventListener("contextmenu",(function(e){var i;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)&&e.preventDefault()})),t.viewer.addHandler("canvas-nonprimary-press",(function(t){2===t.button&&(i=!0),e=t.position.clone()})),t.viewer.addHandler("canvas-nonprimary-release",(function(t){2===t.button&&(i=!1)})),new $.a.MouseTracker({element:t.viewer.canvas,moveHandler:function(n){var o,r;if(i&&(null===(o=t.board)||void 0===o?void 0:o.isInDraw)){if(2!==n.buttons)return void(i=!1);var s=n.position.minus(e);e=n.position.clone(),t.viewer.viewport.panBy(t.viewer.viewport.deltaPointsFromPixels(s.negate()))}else(null===(r=t.area)||void 0===r?void 0:r.onCanvasMove)&&t.area.onCanvasMove(n.position)}})}(So(e)),e.initLabelList(t.labelList||[]),e.resizeViewContainer(e.$options),e}return e=a,(i=[{key:"initLabelList",value:function(t){var e,i,n,o,r,s;this.labelList=t.map((function(t){return new Pn(mo(mo({},t),{},{region:t.region||v(t.points),__data__:io(t)}))})),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(o=n.setLabelList)||void 0===o||o.call(n,this.labelList),null===(r=this.area)||void 0===r||null===(s=r.setLabelList)||void 0===s||s.call(r,this.labelList)}},{key:"appendLabelList",value:function(t){var e,i,n,o,r,s;this.labelList=[].concat(fo(this.labelList),fo(t.map((function(t){return new Pn(mo(mo({},t),{},{region:t.region||v(t.points),__data__:io(t)}))})))),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(o=n.setLabelList)||void 0===o||o.call(n,this.labelList),null===(r=this.area)||void 0===r||null===(s=r.setLabelList)||void 0===s||s.call(r,this.labelList)}},{key:"resizeViewContainer",value:function(t){var e=this,i=t.width,n=t.height;this.$options.width=i,this.$options.height=n,Object.values(s).forEach((function(t){var o;(null===(o=e[t])||void 0===o?void 0:o.resetCanvasSize)&&e[t].resetCanvasSize({width:i,height:n})}))}},{key:"change",value:function(){var t=this;Object.values(s).forEach((function(e){var i;(null===(i=t[e])||void 0===i?void 0:i.change)&&t[e].change()}))}},{key:"destroy",value:function(){var t,e,i=this;this.$off(),null===(t=this.viewer)||void 0===t||null===(e=t.destroy)||void 0===e||e.call(t),this.viewer=void 0,this.$el=void 0,Object.values(s).forEach((function(t){var e,n;null===(e=i[t])||void 0===e||null===(n=e.destroy)||void 0===n||n.call(e),i[t]=void 0}))}}])&&wo(e.prototype,i),n&&wo(e,n),a}(V);function Co(t){var e=t.$options,i=document.createElement("canvas");return i.style.cssText="position: absolute; top: 0;\n left: 0; width: 100%; height: 100%;",i.width=e.width,i.height=e.height,t.viewer.canvas.appendChild(i),i}Eo.marks={},ht.forEach((function(t){Eo.marks[t.toLocaleUpperCase()]=t})),Eo.events=mo({},o)}]);const _KfbView$getRectPoint=KfbView.getRectPoint,_KfbView$isPointInMatrix=KfbView.isPointInMatrix,_KfbView$pointInOtherPoint=KfbView.pointInOtherPoint,_KfbView$isPointInEllipse=KfbView.isPointInEllipse,_KfbView$pointsToRegion=KfbView.pointsToRegion,_KfbView$regionToPoint=KfbView.regionToPoint,_KfbView$isPointInPolygon=KfbView.isPointInPolygon,_KfbView$isPointInLine=KfbView.isPointInLine,_KfbView$isNegNumber=KfbView.isNegNumber,_KfbView$baseNumber=KfbView.baseNumber,_KfbView$acreage=KfbView.acreage,_KfbView$perimeter=KfbView.perimeter,_KfbView$getPoint=KfbView.getPoint,_KfbView$getAngle=KfbView.getAngle,_KfbView$getDistance=KfbView.getDistance,_KfbView$rgbToHsl=KfbView.rgbToHsl,_KfbView$hslToRgb=KfbView.hslToRgb,_KfbView$toGamma=KfbView.toGamma,_KfbView$cacheGammaTable=KfbView.cacheGammaTable,_KfbView$imageSharpenUM=KfbView.imageSharpenUM,_KfbView$Cache=KfbView.Cache,_KfbView$Rotation=KfbView.Rotation,_KfbView$Navigator=KfbView.Navigator,_KfbView$Tailoring=KfbView.Tailoring,_KfbView$Shape=KfbView.Shape,_KfbView$Area=KfbView.Area,_KfbView$Board=KfbView.Board,_KfbView$Graduation=KfbView.Graduation,_KfbView$Grid=KfbView.Grid,_KfbView$KfbView=KfbView.KfbView,_KfbView$OpenSeadragon=KfbView.OpenSeadragon;export{_KfbView$getRectPoint as getRectPoint,_KfbView$isPointInMatrix as isPointInMatrix,_KfbView$pointInOtherPoint as pointInOtherPoint,_KfbView$isPointInEllipse as isPointInEllipse,_KfbView$pointsToRegion as pointsToRegion,_KfbView$regionToPoint as regionToPoint,_KfbView$isPointInPolygon as isPointInPolygon,_KfbView$isPointInLine as isPointInLine,_KfbView$isNegNumber as isNegNumber,_KfbView$baseNumber as baseNumber,_KfbView$acreage as acreage,_KfbView$perimeter as perimeter,_KfbView$getPoint as getPoint,_KfbView$getAngle as getAngle,_KfbView$getDistance as getDistance,_KfbView$rgbToHsl as rgbToHsl,_KfbView$hslToRgb as hslToRgb,_KfbView$toGamma as toGamma,_KfbView$cacheGammaTable as cacheGammaTable,_KfbView$imageSharpenUM as imageSharpenUM,_KfbView$Cache as Cache,_KfbView$Rotation as Rotation,_KfbView$Navigator as Navigator,_KfbView$Tailoring as Tailoring,_KfbView$Shape as Shape,_KfbView$Area as Area,_KfbView$Board as Board,_KfbView$Graduation as Graduation,_KfbView$Grid as Grid,_KfbView$KfbView as KfbView,_KfbView$OpenSeadragon as OpenSeadragon};
2
+ var KfbView=function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=141)}([function(t,e,i){var n=i(14),o=i(40).f,r=i(26),s=i(44),a=i(67),l=i(85),c=i(106);t.exports=function(t,e){var i,u,h,p,d,f=t.target,g=t.global,v=t.stat;if(i=g?n:v?n[f]||a(f,{}):(n[f]||{}).prototype)for(u in e){if(p=e[u],h=t.noTargetGet?(d=o(i,u))&&d.value:i[u],!c(g?u:f+(v?".":"#")+u,t.forced)&&void 0!==h){if(typeof p==typeof h)continue;l(p,h)}(t.sham||h&&h.sham)&&r(p,"sham",!0),s(i,u,p,t)}}},function(t,e,i){var n=i(75),o=i(44),r=i(120);n||o(Object.prototype,"toString",r,{unsafe:!0})},function(t,e,i){"use strict";var n=i(44),o=i(24),r=i(12),s=i(121),a="toString",l=RegExp.prototype,c=l.toString,u=r((function(){return"/a/b"!=c.call({source:"a",flags:"b"})})),h=c.name!=a;(u||h)&&n(RegExp.prototype,a,(function(){var t=o(this),e=String(t.source),i=t.flags;return"/"+e+"/"+String(void 0===i&&t instanceof RegExp&&!("flags"in l)?s.call(t):i)}),{unsafe:!0})},function(t,e,i){"use strict";var n=i(0),o=i(14),r=i(45),s=i(60),a=i(19),l=i(72),c=i(91),u=i(12),h=i(16),p=i(46),d=i(15),f=i(24),g=i(22),v=i(21),m=i(57),y=i(41),w=i(63),x=i(64),b=i(70),T=i(109),S=i(90),P=i(40),E=i(23),C=i(66),R=i(26),_=i(44),O=i(68),I=i(59),D=i(61),k=i(69),M=i(13),L=i(92),A=i(93),B=i(73),H=i(58),j=i(30).forEach,z=I("hidden"),N="Symbol",F=M("toPrimitive"),V=H.set,W=H.getterFor(N),U=Object.prototype,G=o.Symbol,Z=r("JSON","stringify"),q=P.f,$=E.f,K=T.f,X=C.f,Y=O("symbols"),J=O("op-symbols"),Q=O("string-to-symbol-registry"),tt=O("symbol-to-string-registry"),et=O("wks"),it=o.QObject,nt=!it||!it.prototype||!it.prototype.findChild,ot=a&&u((function(){return 7!=w($({},"a",{get:function(){return $(this,"a",{value:7}).a}})).a}))?function(t,e,i){var n=q(U,e);n&&delete U[e],$(t,e,i),n&&t!==U&&$(U,e,n)}:$,rt=function(t,e){var i=Y[t]=w(G.prototype);return V(i,{type:N,tag:t,description:e}),a||(i.description=e),i},st=c?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof G},at=function(t,e,i){t===U&&at(J,e,i),f(t);var n=m(e,!0);return f(i),h(Y,n)?(i.enumerable?(h(t,z)&&t[z][n]&&(t[z][n]=!1),i=w(i,{enumerable:y(0,!1)})):(h(t,z)||$(t,z,y(1,{})),t[z][n]=!0),ot(t,n,i)):$(t,n,i)},lt=function(t,e){f(t);var i=v(e),n=x(i).concat(pt(i));return j(n,(function(e){a&&!ct.call(i,e)||at(t,e,i[e])})),t},ct=function(t){var e=m(t,!0),i=X.call(this,e);return!(this===U&&h(Y,e)&&!h(J,e))&&(!(i||!h(this,e)||!h(Y,e)||h(this,z)&&this[z][e])||i)},ut=function(t,e){var i=v(t),n=m(e,!0);if(i!==U||!h(Y,n)||h(J,n)){var o=q(i,n);return!o||!h(Y,n)||h(i,z)&&i[z][n]||(o.enumerable=!0),o}},ht=function(t){var e=K(v(t)),i=[];return j(e,(function(t){h(Y,t)||h(D,t)||i.push(t)})),i},pt=function(t){var e=t===U,i=K(e?J:v(t)),n=[];return j(i,(function(t){!h(Y,t)||e&&!h(U,t)||n.push(Y[t])})),n};(l||(G=function(){if(this instanceof G)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=k(t),i=function(t){this===U&&i.call(J,t),h(this,z)&&h(this[z],e)&&(this[z][e]=!1),ot(this,e,y(1,t))};return a&&nt&&ot(U,e,{configurable:!0,set:i}),rt(e,t)},_(G.prototype,"toString",(function(){return W(this).tag})),_(G,"withoutSetter",(function(t){return rt(k(t),t)})),C.f=ct,E.f=at,P.f=ut,b.f=T.f=ht,S.f=pt,L.f=function(t){return rt(M(t),t)},a&&($(G.prototype,"description",{configurable:!0,get:function(){return W(this).description}}),s||_(U,"propertyIsEnumerable",ct,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:G}),j(x(et),(function(t){A(t)})),n({target:N,stat:!0,forced:!l},{for:function(t){var e=String(t);if(h(Q,e))return Q[e];var i=G(e);return Q[e]=i,tt[i]=e,i},keyFor:function(t){if(!st(t))throw TypeError(t+" is not a symbol");if(h(tt,t))return tt[t]},useSetter:function(){nt=!0},useSimple:function(){nt=!1}}),n({target:"Object",stat:!0,forced:!l,sham:!a},{create:function(t,e){return void 0===e?w(t):lt(w(t),e)},defineProperty:at,defineProperties:lt,getOwnPropertyDescriptor:ut}),n({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ht,getOwnPropertySymbols:pt}),n({target:"Object",stat:!0,forced:u((function(){S.f(1)}))},{getOwnPropertySymbols:function(t){return S.f(g(t))}}),Z)&&n({target:"JSON",stat:!0,forced:!l||u((function(){var t=G();return"[null]"!=Z([t])||"{}"!=Z({a:t})||"{}"!=Z(Object(t))}))},{stringify:function(t,e,i){for(var n,o=[t],r=1;arguments.length>r;)o.push(arguments[r++]);if(n=e,(d(e)||void 0!==t)&&!st(t))return p(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!st(e))return e}),o[1]=e,Z.apply(null,o)}});G.prototype[F]||R(G.prototype,F,G.prototype.valueOf),B(G,N),D[z]=!0},function(t,e,i){"use strict";var n=i(0),o=i(19),r=i(14),s=i(16),a=i(15),l=i(23).f,c=i(85),u=r.Symbol;if(o&&"function"==typeof u&&(!("description"in u.prototype)||void 0!==u().description)){var h={},p=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof p?new u(t):void 0===t?u():u(t);return""===t&&(h[e]=!0),e};c(p,u);var d=p.prototype=u.prototype;d.constructor=p;var f=d.toString,g="Symbol(test)"==String(u("test")),v=/^Symbol\((.*)\)[^)]+$/;l(d,"description",{configurable:!0,get:function(){var t=a(this)?this.valueOf():this,e=f.call(t);if(s(h,t))return"";var i=g?e.slice(7,-1):e.replace(v,"$1");return""===i?void 0:i}}),n({global:!0,forced:!0},{Symbol:p})}},function(t,e,i){"use strict";var n=i(21),o=i(50),r=i(48),s=i(58),a=i(96),l="Array Iterator",c=s.set,u=s.getterFor(l);t.exports=a(Array,"Array",(function(t,e){c(this,{type:l,target:n(t),index:0,kind:e})}),(function(){var t=u(this),e=t.target,i=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:n,done:!1}:"values"==i?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),r.Arguments=r.Array,o("keys"),o("values"),o("entries")},function(t,e,i){i(93)("iterator")},function(t,e,i){"use strict";var n=i(122).charAt,o=i(58),r=i(96),s="String Iterator",a=o.set,l=o.getterFor(s);r(String,"String",(function(t){a(this,{type:s,string:String(t),index:0})}),(function(){var t,e=l(this),i=e.string,o=e.index;return o>=i.length?{value:void 0,done:!0}:(t=n(i,o),e.index+=t.length,{value:t,done:!1})}))},function(t,e,i){var n=i(14),o=i(101),r=i(5),s=i(26),a=i(13),l=a("iterator"),c=a("toStringTag"),u=r.values;for(var h in o){var p=n[h],d=p&&p.prototype;if(d){if(d[l]!==u)try{s(d,l,u)}catch(g){d[l]=u}if(d[c]||s(d,c,h),o[h])for(var f in r)if(d[f]!==r[f])try{s(d,f,r[f])}catch(g){d[f]=r[f]}}}},function(t,e,i){var n=i(0),o=i(12),r=i(22),s=i(76),a=i(98);n({target:"Object",stat:!0,forced:o((function(){s(1)})),sham:!a},{getPrototypeOf:function(t){return s(r(t))}})},function(t,e,i){i(0)({target:"Object",stat:!0},{setPrototypeOf:i(99)})},function(t,e,i){var n=i(0),o=i(45),r=i(47),s=i(24),a=i(15),l=i(63),c=i(127),u=i(12),h=o("Reflect","construct"),p=u((function(){function t(){}return!(h((function(){}),[],t)instanceof t)})),d=!u((function(){h((function(){}))})),f=p||d;n({target:"Reflect",stat:!0,forced:f,sham:f},{construct:function(t,e){r(t),s(e);var i=arguments.length<3?t:r(arguments[2]);if(d&&!p)return h(t,e,i);if(t==i){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var n=[null];return n.push.apply(n,e),new(c.apply(t,n))}var o=i.prototype,u=l(a(o)?o:Object.prototype),f=Function.apply.call(t,u,e);return a(f)?f:u}})},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,i){var n=i(14),o=i(68),r=i(16),s=i(69),a=i(72),l=i(91),c=o("wks"),u=n.Symbol,h=l?u:u&&u.withoutSetter||s;t.exports=function(t){return r(c,t)||(a&&r(u,t)?c[t]=u[t]:c[t]=h("Symbol."+t)),c[t]}},function(t,e,i){(function(e){var i=function(t){return t&&t.Math==Math&&t};t.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof e&&e)||Function("return this")()}).call(this,i(104))},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){"use strict";var n=i(0),o=i(102);n({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},function(t,e,i){var n=i(14),o=i(101),r=i(102),s=i(26);for(var a in o){var l=n[a],c=l&&l.prototype;if(c&&c.forEach!==r)try{s(c,"forEach",r)}catch(u){c.forEach=r}}},function(t,e,i){var n=i(12);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,i){var n,o,r,s,a;function l(t){return new l.Viewer(t)}!function(t){t.version={versionStr:"4.0.0",major:parseInt("4",10),minor:parseInt("0",10),revision:parseInt("0",10)};var e,i={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.isFunction=function(e){return"function"===t.type(e)},t.isArray=Array.isArray||function(e){return"array"===t.type(e)},t.isWindow=function(t){return t&&"object"==typeof t&&"setInterval"in t},t.type=function(t){return null==t?String(t):i[n.call(t)]||"object"},t.isPlainObject=function(e){if(!e||"object"!==l.type(e)||e.nodeType||t.isWindow(e))return!1;if(e.constructor&&!o.call(e,"constructor")&&!o.call(e.constructor.prototype,"isPrototypeOf"))return!1;var i;for(var n in e)i=n;return void 0===i||o.call(e,i)},t.isEmptyObject=function(t){for(var e in t)return!1;return!0},t.freezeObject=function(e){return Object.freeze?t.freezeObject=Object.freeze:t.freezeObject=function(t){return t},t.freezeObject(e)},t.supportsCanvas=(e=document.createElement("canvas"),!(!t.isFunction(e.getContext)||!e.getContext("2d"))),t.isCanvasTainted=function(t){var e=!1;try{t.getContext("2d").getImageData(0,0,1,1)}catch(i){e=!0}return e},t.supportsAddEventListener=!(!document.documentElement.addEventListener||!document.addEventListener),t.supportsRemoveEventListener=!(!document.documentElement.removeEventListener||!document.removeEventListener),t.supportsEventListenerOptions=function(){var e=0;if(t.supportsAddEventListener)try{var i={get capture(){return e++,!1},get once(){return e++,!1},get passive(){return e++,!1}};window.addEventListener("test",null,i),window.removeEventListener("test",null,i)}catch(n){e=0}return e>=3}(),t.getCurrentPixelDensityRatio=function(){if(t.supportsCanvas){var e=document.createElement("canvas").getContext("2d"),i=window.devicePixelRatio||1,n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return Math.max(i,1)/n}return 1},t.pixelDensityRatio=t.getCurrentPixelDensityRatio()}(l),function(t){t.extend=function(){var e,i,n,o,r,s,a=arguments[0]||{},c=arguments.length,u=!1,h=1;for("boolean"==typeof a&&(u=a,a=arguments[1]||{},h=2),"object"==typeof a||l.isFunction(a)||(a={}),c===h&&(a=this,--h);h<c;h++)if(null!==(e=arguments[h])||void 0!==e)for(i in e){var p=Object.getOwnPropertyDescriptor(e,i);void 0!==p?p.get||p.set?Object.defineProperty(a,i,p):a!==(o=p.value)&&(u&&o&&(l.isPlainObject(o)||(r=l.isArray(o)))?(n=a[i],r?(r=!1,s=n&&l.isArray(n)?n:[]):s=n&&l.isPlainObject(n)?n:{},a[i]=l.extend(u,s,o)):void 0!==o&&(a[i]=o)):t.console.warn('Could not copy inherited property "'+i+'".')}return a};t.extend(t,{DEFAULT_SETTINGS:{xmlPath:null,tileSources:null,tileHost:null,initialPage:0,crossOriginPolicy:!1,ajaxWithCredentials:!1,loadTilesWithAjax:!1,ajaxHeaders:{},splitHashDataForPost:!1,panHorizontal:!0,panVertical:!0,constrainDuringPan:!1,wrapHorizontal:!1,wrapVertical:!1,visibilityRatio:.5,minPixelRatio:.5,defaultZoomLevel:0,minZoomLevel:null,maxZoomLevel:null,homeFillsViewer:!1,clickTimeThreshold:300,clickDistThreshold:5,dblClickTimeThreshold:300,dblClickDistThreshold:20,springStiffness:6.5,animationTime:1.2,gestureSettingsMouse:{dragToPan:!0,scrollToZoom:!0,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsTouch:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!0,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsPen:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!0,dblClickToZoom:!1,dblClickDragToZoom:!1,pinchToZoom:!1,zoomToRefPoint:!0,flickEnabled:!1,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},gestureSettingsUnknown:{dragToPan:!0,scrollToZoom:!1,clickToZoom:!1,dblClickToZoom:!0,dblClickDragToZoom:!1,pinchToZoom:!0,zoomToRefPoint:!0,flickEnabled:!0,flickMinSpeed:120,flickMomentum:.25,pinchRotate:!1},zoomPerClick:2,zoomPerScroll:1.2,zoomPerDblClickDrag:1.2,zoomPerSecond:1,blendTime:0,alwaysBlend:!1,autoHideControls:!0,immediateRender:!1,minZoomImageRatio:.9,maxZoomPixelRatio:1.1,smoothTileEdgesMinZoom:1.1,iOSDevice:function(){if("object"!=typeof navigator)return!1;var t=navigator.userAgent;return"string"==typeof t&&(-1!==t.indexOf("iPhone")||-1!==t.indexOf("iPad")||-1!==t.indexOf("iPod"))}(),pixelsPerWheelLine:40,pixelsPerArrowPress:40,autoResize:!0,preserveImageSizeOnResize:!1,minScrollDeltaTime:50,rotationIncrement:90,showSequenceControl:!0,sequenceControlAnchor:null,preserveViewport:!1,preserveOverlays:!1,navPrevNextWrap:!1,showNavigationControl:!0,navigationControlAnchor:null,showZoomControl:!0,showHomeControl:!0,showFullPageControl:!0,showRotationControl:!1,showFlipControl:!1,controlsFadeDelay:2e3,controlsFadeLength:1500,mouseNavEnabled:!0,showNavigator:!1,navigatorElement:null,navigatorId:null,navigatorPosition:null,navigatorSizeRatio:.2,navigatorMaintainSizeRatio:!1,navigatorTop:null,navigatorLeft:null,navigatorHeight:null,navigatorWidth:null,navigatorAutoResize:!0,navigatorAutoFade:!0,navigatorRotate:!0,navigatorBackground:"#000",navigatorOpacity:.8,navigatorBorderColor:"#555",navigatorDisplayRegionColor:"#900",degrees:0,flipped:!1,opacity:1,preload:!1,compositeOperation:null,imageSmoothingEnabled:!0,placeholderFillStyle:null,subPixelRoundingForTransparency:null,showReferenceStrip:!1,referenceStripScroll:"horizontal",referenceStripElement:null,referenceStripHeight:null,referenceStripWidth:null,referenceStripPosition:"BOTTOM_LEFT",referenceStripSizeRatio:.2,collectionRows:3,collectionColumns:0,collectionLayout:"horizontal",collectionMode:!1,collectionTileSize:800,collectionTileMargin:80,imageLoaderLimit:0,maxImageCacheCount:200,timeout:3e4,useCanvas:!0,prefixUrl:"/images/",navImages:{zoomIn:{REST:"zoomin_rest.png",GROUP:"zoomin_grouphover.png",HOVER:"zoomin_hover.png",DOWN:"zoomin_pressed.png"},zoomOut:{REST:"zoomout_rest.png",GROUP:"zoomout_grouphover.png",HOVER:"zoomout_hover.png",DOWN:"zoomout_pressed.png"},home:{REST:"home_rest.png",GROUP:"home_grouphover.png",HOVER:"home_hover.png",DOWN:"home_pressed.png"},fullpage:{REST:"fullpage_rest.png",GROUP:"fullpage_grouphover.png",HOVER:"fullpage_hover.png",DOWN:"fullpage_pressed.png"},rotateleft:{REST:"rotateleft_rest.png",GROUP:"rotateleft_grouphover.png",HOVER:"rotateleft_hover.png",DOWN:"rotateleft_pressed.png"},rotateright:{REST:"rotateright_rest.png",GROUP:"rotateright_grouphover.png",HOVER:"rotateright_hover.png",DOWN:"rotateright_pressed.png"},flip:{REST:"flip_rest.png",GROUP:"flip_grouphover.png",HOVER:"flip_hover.png",DOWN:"flip_pressed.png"},previous:{REST:"previous_rest.png",GROUP:"previous_grouphover.png",HOVER:"previous_hover.png",DOWN:"previous_pressed.png"},next:{REST:"next_rest.png",GROUP:"next_grouphover.png",HOVER:"next_hover.png",DOWN:"next_pressed.png"}},debugMode:!1,debugGridColor:["#437AB2","#1B9E77","#D95F02","#7570B3","#E7298A","#66A61E","#E6AB02","#A6761D","#666666"],silenceMultiImageWarnings:!1},SIGNAL:"----seadragon----",delegate:function(t,e){return function(){var i=arguments;return void 0===i&&(i=[]),e.apply(t,i)}},BROWSERS:{UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5,EDGE:6,CHROMEEDGE:7},SUBPIXEL_ROUNDING_OCCURRENCES:{NEVER:0,ONLY_AT_REST:1,ALWAYS:2},_viewers:new Map,getViewer:function(e){return t._viewers.get(this.getElement(e))},getElement:function(t){return"string"==typeof t&&(t=document.getElementById(t)),t},getElementPosition:function(e){var i,n,r=new t.Point;for(n=o(e=t.getElement(e),i="fixed"===t.getElementStyle(e).position);n;)r.x+=e.offsetLeft,r.y+=e.offsetTop,i&&(r=r.plus(t.getPageScroll())),n=o(e=n,i="fixed"===t.getElementStyle(e).position);return r},getElementOffset:function(e){var i,n,o=(e=t.getElement(e))&&e.ownerDocument,r={top:0,left:0};return o?(i=o.documentElement,void 0!==e.getBoundingClientRect&&(r=e.getBoundingClientRect()),n=o===o.window?o:9===o.nodeType&&(o.defaultView||o.parentWindow),new t.Point(r.left+(n.pageXOffset||i.scrollLeft)-(i.clientLeft||0),r.top+(n.pageYOffset||i.scrollTop)-(i.clientTop||0))):new t.Point},getElementSize:function(e){return e=t.getElement(e),new t.Point(e.clientWidth,e.clientHeight)},getElementStyle:document.documentElement.currentStyle?function(e){return(e=t.getElement(e)).currentStyle}:function(e){return e=t.getElement(e),window.getComputedStyle(e,"")},getCssPropertyWithVendorPrefix:function(e){var i={};return t.getCssPropertyWithVendorPrefix=function(e){if(void 0!==i[e])return i[e];var n=document.createElement("div").style,o=null;if(void 0!==n[e])o=e;else for(var r=["Webkit","Moz","MS","O","webkit","moz","ms","o"],s=t.capitalizeFirstLetter(e),a=0;a<r.length;a++){var l=r[a]+s;if(void 0!==n[l]){o=l;break}}return i[e]=o,o},t.getCssPropertyWithVendorPrefix(e)},capitalizeFirstLetter:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},positiveModulo:function(t,e){var i=t%e;return i<0&&(i+=e),i},pointInElement:function(e,i){e=t.getElement(e);var n=t.getElementOffset(e),o=t.getElementSize(e);return i.x>=n.x&&i.x<n.x+o.x&&i.y<n.y+o.y&&i.y>=n.y},getMousePosition:function(e){if("number"==typeof e.pageX)t.getMousePosition=function(e){var i=new t.Point;return i.x=e.pageX,i.y=e.pageY,i};else{if("number"!=typeof e.clientX)throw new Error("Unknown event mouse position, no known technique.");t.getMousePosition=function(e){var i=new t.Point;return i.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop,i}}return t.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.pageXOffset)t.getPageScroll=function(){return new t.Point(window.pageXOffset,window.pageYOffset)};else if(i.scrollLeft||i.scrollTop)t.getPageScroll=function(){return new t.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new t.Point(0,0);t.getPageScroll=function(){return new t.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return t.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)t.setPageScroll=function(t){window.scrollTo(t.x,t.y)};else{var i=t.getPageScroll();if(i.x===e.x&&i.y===e.y)return;document.body.scrollLeft=e.x,document.body.scrollTop=e.y;var n=t.getPageScroll();if(n.x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.body.scrollLeft=t.x,document.body.scrollTop=t.y});if(document.documentElement.scrollLeft=e.x,document.documentElement.scrollTop=e.y,(n=t.getPageScroll()).x!==i.x&&n.y!==i.y)return void(t.setPageScroll=function(t){document.documentElement.scrollLeft=t.x,document.documentElement.scrollTop=t.y});t.setPageScroll=function(t){}}t.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},i=document.body||{};if("number"==typeof window.innerWidth)t.getWindowSize=function(){return new t.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)t.getWindowSize=function(){return new t.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!i.clientWidth&&!i.clientHeight)throw new Error("Unknown window size, no known technique.");t.getWindowSize=function(){return new t.Point(document.body.clientWidth,document.body.clientHeight)}}return t.getWindowSize()},makeCenteredNode:function(e){e=t.getElement(e);var i=[t.makeNeutralElement("div"),t.makeNeutralElement("div"),t.makeNeutralElement("div")];return t.extend(i[0].style,{display:"table",height:"100%",width:"100%"}),t.extend(i[1].style,{display:"table-row"}),t.extend(i[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),i[0].appendChild(i[1]),i[1].appendChild(i[2]),i[2].appendChild(e),i[0]},makeNeutralElement:function(t){var e=document.createElement(t),i=e.style;return i.background="transparent none",i.border="none",i.margin="0px",i.padding="0px",i.position="static",e},now:function(){return Date.now?t.now=Date.now:t.now=function(){return(new Date).getTime()},t.now()},makeTransparentImage:function(e){var i=t.makeNeutralElement("img");return i.src=e,i},setElementOpacity:function(e,i,n){var o;e=t.getElement(e),n&&!t.Browser.alpha&&(i=Math.round(i)),t.Browser.opacity?e.style.opacity=i<1?i:"":i<1?(o="alpha(opacity="+Math.round(100*i)+")",e.style.filter=o):e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=t.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},setElementPointerEvents:function(e,i){void 0!==(e=t.getElement(e)).style&&void 0!==e.style.pointerEvents&&(e.style.pointerEvents=i)},setElementPointerEventsNone:function(e){t.setElementPointerEvents(e,"none")},addClass:function(e,i){(e=t.getElement(e)).className?-1===(" "+e.className+" ").indexOf(" "+i+" ")&&(e.className+=" "+i):e.className=i},indexOf:function(t,e,i){return Array.prototype.indexOf?this.indexOf=function(t,e,i){return t.indexOf(e,i)}:this.indexOf=function(t,e,i){var n,o,r=i||0;if(!t)throw new TypeError;if(0===(o=t.length)||r>=o)return-1;for(r<0&&(r=o-Math.abs(r)),n=r;n<o;n++)if(t[n]===e)return n;return-1},this.indexOf(t,e,i)},removeClass:function(e,i){var n,o,r=[];for(n=(e=t.getElement(e)).className.split(/\s+/),o=0;o<n.length;o++)n[o]&&n[o]!==i&&r.push(n[o]);e.className=r.join(" ")},normalizeEventListenerOptions:function(e){return void 0!==e?"boolean"==typeof e?t.supportsEventListenerOptions?{capture:e}:e:t.supportsEventListenerOptions?e:void 0!==e.capture&&e.capture:!!t.supportsEventListenerOptions&&{capture:!1}},addEvent:function(){if(t.supportsAddEventListener)return function(e,i,n,o){o=t.normalizeEventListenerOptions(o),(e=t.getElement(e)).addEventListener(i,n,o)};if(document.documentElement.attachEvent&&document.attachEvent)return function(e,i,n){(e=t.getElement(e)).attachEvent("on"+i,n)};throw new Error("No known event model.")}(),removeEvent:function(){if(t.supportsRemoveEventListener)return function(e,i,n,o){o=t.normalizeEventListenerOptions(o),(e=t.getElement(e)).removeEventListener(i,n,o)};if(document.documentElement.detachEvent&&document.detachEvent)return function(e,i,n){(e=t.getElement(e)).detachEvent("on"+i,n)};throw new Error("No known event model.")}(),cancelEvent:function(t){t.preventDefault()},eventIsCanceled:function(t){return t.defaultPrevented},stopEvent:function(t){t.stopPropagation()},createCallback:function(t,e){var i,n=[];for(i=2;i<arguments.length;i++)n.push(arguments[i]);return function(){var i,o=n.concat([]);for(i=0;i<arguments.length;i++)o.push(arguments[i]);return e.apply(t,o)}},getUrlParameter:function(t){var e=n[t];return e||null},getUrlProtocol:function(t){var e=t.match(/^([a-z]+:)\/\//i);return null===e?window.location.protocol:e[1].toLowerCase()},createAjaxRequest:function(e){var i;try{i=!!new ActiveXObject("Microsoft.XMLHTTP")}catch(n){i=!1}if(i)window.XMLHttpRequest?t.createAjaxRequest=function(t){return t?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest}:t.createAjaxRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")};else{if(!window.XMLHttpRequest)throw new Error("Browser doesn't support XMLHttpRequest.");t.createAjaxRequest=function(){return new XMLHttpRequest}}return t.createAjaxRequest(e)},makeAjaxRequest:function(e,i,n){var o,r,s,a;t.isPlainObject(e)&&(i=e.success,n=e.error,o=e.withCredentials,r=e.headers,s=e.responseType||null,a=e.postData||null,e=e.url);var l=t.getUrlProtocol(e),c=t.createAjaxRequest("file:"===l);if(!t.isFunction(i))throw new Error("makeAjaxRequest requires a success callback");c.onreadystatechange=function(){4===c.readyState&&(c.onreadystatechange=function(){},c.status>=200&&c.status<300||0===c.status&&"http:"!==l&&"https:"!==l?i(c):t.isFunction(n)?n(c):t.console.error("AJAX request returned %d: %s",c.status,e))};var u=a?"POST":"GET";try{if(c.open(u,e,!0),s&&(c.responseType=s),r)for(var h in r)Object.prototype.hasOwnProperty.call(r,h)&&r[h]&&c.setRequestHeader(h,r[h]);o&&(c.withCredentials=!0),c.send(a)}catch(p){t.console.error("%s while making AJAX request: %s",p.name,p.message),c.onreadystatechange=function(){},t.isFunction(n)&&n(c,p)}return c},jsonp:function(e){var i,n=e.url,o=document.head||document.getElementsByTagName("head")[0]||document.documentElement,r=e.callbackName||"openseadragon"+t.now(),s=window[r],a="$1"+r+"$2",l=e.param||"callback",c=e.callback;n=n.replace(/(=)\?(&|$)|\?\?/i,a),n+=(/\?/.test(n)?"&":"?")+l+"="+r,window[r]=function(e){if(s)window[r]=s;else try{delete window[r]}catch(i){}c&&t.isFunction(c)&&c(e)},i=document.createElement("script"),void 0===e.async&&!1===e.async||(i.async="async"),e.scriptCharset&&(i.charset=e.scriptCharset),i.src=n,i.onload=i.onreadystatechange=function(t,e){(e||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,o&&i.parentNode&&o.removeChild(i),i=void 0)},o.insertBefore(i,o.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(e){if(window.DOMParser)t.parseXml=function(t){return(new DOMParser).parseFromString(t,"text/xml")};else{if(!window.ActiveXObject)throw new Error("Browser doesn't support XML DOM.");t.parseXml=function(t){var e=null;return(e=new ActiveXObject("Microsoft.XMLDOM")).async=!1,e.loadXML(t),e}}return t.parseXml(e)},parseJSON:function(e){return t.parseJSON=window.JSON.parse,t.parseJSON(e)},imageFormatSupported:function(t){return!!i[(t=t||"").toLowerCase()]},setImageFormatsSupported:function(e){t.extend(i,e)}});var e=function(t){};t.console=window.console||{log:e,debug:e,info:e,warn:e,error:e,assert:e},t.Browser={vendor:t.BROWSERS.UNKNOWN,version:0,alpha:!0};var i={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},n={};function o(t,e){return e&&t!==document.body?document.body:t.offsetParent}!function(){var e=navigator.appVersion,i=navigator.userAgent;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(i.substring(i.indexOf("MSIE")+5,i.indexOf(";",i.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(i.indexOf("Edge")>=0?(t.Browser.vendor=t.BROWSERS.EDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edge")+5))):i.indexOf("Edg")>=0?(t.Browser.vendor=t.BROWSERS.CHROMEEDGE,t.Browser.version=parseFloat(i.substring(i.indexOf("Edg")+4))):i.indexOf("Firefox")>=0?(t.Browser.vendor=t.BROWSERS.FIREFOX,t.Browser.version=parseFloat(i.substring(i.indexOf("Firefox")+8))):i.indexOf("Safari")>=0?(t.Browser.vendor=i.indexOf("Chrome")>=0?t.BROWSERS.CHROME:t.BROWSERS.SAFARI,t.Browser.version=parseFloat(i.substring(i.substring(0,i.indexOf("Safari")).lastIndexOf("/")+1,i.indexOf("Safari")))):null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(i)&&(t.Browser.vendor=t.BROWSERS.IE,t.Browser.version=parseFloat(RegExp.$1)));break;case"Opera":t.Browser.vendor=t.BROWSERS.OPERA,t.Browser.version=parseFloat(e)}var o,r,s,a=window.location.search.substring(1).split("&");for(s=0;s<a.length;s++)if((r=(o=a[s]).indexOf("="))>0){var l=o.substring(0,r),c=o.substring(r+1);try{n[l]=decodeURIComponent(c)}catch(u){t.console.error("Ignoring malformed URL parameter: %s=%s",l,c)}}t.Browser.alpha=!(t.Browser.vendor===t.BROWSERS.CHROME&&t.Browser.version<2),t.Browser.opacity=!0,t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version<11&&t.console.error("Internet Explorer versions < 11 are not supported by OpenSeadragon")}(),function(e){var i=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame,n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame;if(i&&n)t.requestAnimationFrame=function(){return i.apply(e,arguments)},t.cancelAnimationFrame=function(){return n.apply(e,arguments)};else{var o,r=[],s=[],a=0;t.requestAnimationFrame=function(e){return r.push([++a,e]),o||(o=setInterval((function(){if(r.length){var e=t.now(),i=s;for(s=r,r=i;s.length;)s.shift()[1](e)}else clearInterval(o),o=void 0}),20)),a},t.cancelAnimationFrame=function(t){var e,i;for(e=0,i=r.length;e<i;e+=1)if(r[e][0]===t)return void r.splice(e,1);for(e=0,i=s.length;e<i;e+=1)if(s[e][0]===t)return void s.splice(e,1)}}}(window)}(l),o=[],void 0===(r="function"==typeof(n=function(){return l})?n.apply(e,o):n)||(t.exports=r),s=l,a={supportsFullScreen:!1,isFullScreen:function(){return!1},getFullScreenElement:function(){return null},requestFullScreen:function(){},exitFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",fullScreenErrorEventName:""},document.exitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.fullscreenElement},a.requestFullScreen=function(t){return t.requestFullscreen()},a.exitFullScreen=function(){document.exitFullscreen()},a.fullScreenEventName="fullscreenchange",a.fullScreenErrorEventName="fullscreenerror"):document.msExitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.msFullscreenElement},a.requestFullScreen=function(t){return t.msRequestFullscreen()},a.exitFullScreen=function(){document.msExitFullscreen()},a.fullScreenEventName="MSFullscreenChange",a.fullScreenErrorEventName="MSFullscreenError"):document.webkitExitFullscreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.webkitFullscreenElement},a.requestFullScreen=function(t){return t.webkitRequestFullscreen()},a.exitFullScreen=function(){document.webkitExitFullscreen()},a.fullScreenEventName="webkitfullscreenchange",a.fullScreenErrorEventName="webkitfullscreenerror"):document.webkitCancelFullScreen?(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.webkitCurrentFullScreenElement},a.requestFullScreen=function(t){return t.webkitRequestFullScreen()},a.exitFullScreen=function(){document.webkitCancelFullScreen()},a.fullScreenEventName="webkitfullscreenchange",a.fullScreenErrorEventName="webkitfullscreenerror"):document.mozCancelFullScreen&&(a.supportsFullScreen=!0,a.getFullScreenElement=function(){return document.mozFullScreenElement},a.requestFullScreen=function(t){return t.mozRequestFullScreen()},a.exitFullScreen=function(){document.mozCancelFullScreen()},a.fullScreenEventName="mozfullscreenchange",a.fullScreenErrorEventName="mozfullscreenerror"),a.isFullScreen=function(){return null!==a.getFullScreenElement()},a.cancelFullScreen=function(){s.console.error("cancelFullScreen is deprecated. Use exitFullScreen instead."),a.exitFullScreen()},s.extend(s,a),function(t){t.EventSource=function(){this.events={}},t.EventSource.prototype={addOnceHandler:function(t,e,i,n){var o=this;n=n||1;var r=0,s=function(i){++r===n&&o.removeHandler(t,s),e(i)};this.addHandler(t,s,i)},addHandler:function(e,i,n){var o=this.events[e];o||(this.events[e]=o=[]),i&&t.isFunction(i)&&(o[o.length]={handler:i,userData:n||null})},removeHandler:function(e,i){var n,o=this.events[e],r=[];if(o&&t.isArray(o)){for(n=0;n<o.length;n++)o[n].handler!==i&&r.push(o[n]);this.events[e]=r}},numberOfHandlers:function(t){var e=this.events[t];return e?e.length:0},removeAllHandlers:function(t){if(t)this.events[t]=[];else for(var e in this.events)this.events[e]=[]},getHandler:function(t){var e=this.events[t];return e&&e.length?(e=1===e.length?[e[0]]:Array.apply(null,e),function(t,i){var n,o=e.length;for(n=0;n<o;n++)e[n]&&(i.eventSource=t,i.userData=e[n].userData,e[n].handler(i))}):null},raiseEvent:function(t,e){var i=this.getHandler(t);i&&(e||(e={}),i(this,e))}}}(l),function(t){var e=[],i={};t.MouseTracker=function(n){e.push(this);var o=arguments;t.isPlainObject(n)||(n={element:o[0],clickTimeThreshold:o[1],clickDistThreshold:o[2]}),this.hash=Math.random(),this.element=t.getElement(n.element),this.clickTimeThreshold=n.clickTimeThreshold||t.DEFAULT_SETTINGS.clickTimeThreshold,this.clickDistThreshold=n.clickDistThreshold||t.DEFAULT_SETTINGS.clickDistThreshold,this.dblClickTimeThreshold=n.dblClickTimeThreshold||t.DEFAULT_SETTINGS.dblClickTimeThreshold,this.dblClickDistThreshold=n.dblClickDistThreshold||t.DEFAULT_SETTINGS.dblClickDistThreshold,this.userData=n.userData||null,this.stopDelay=n.stopDelay||50,this.preProcessEventHandler=n.preProcessEventHandler||null,this.contextMenuHandler=n.contextMenuHandler||null,this.enterHandler=n.enterHandler||null,this.leaveHandler=n.leaveHandler||null,this.exitHandler=n.exitHandler||null,this.overHandler=n.overHandler||null,this.outHandler=n.outHandler||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[this.hash]={click:function(t){T(r,t)},dblclick:function(t){S(r,t)},keydown:function(t){P(r,t)},keyup:function(t){E(r,t)},keypress:function(t){C(r,t)},focus:function(t){R(r,t)},blur:function(t){_(r,t)},contextmenu:function(t){O(r,t)},wheel:function(t){I(r,t)},mousewheel:function(t){D(r,t)},DOMMouseScroll:function(t){D(r,t)},MozMousePixelScroll:function(t){D(r,t)},losecapture:function(t){M(r,t)},mouseenter:function(t){V(r,t)},mouseleave:function(t){W(r,t)},mouseover:function(t){U(r,t)},mouseout:function(t){G(r,t)},mousedown:function(t){Z(r,t)},mouseup:function(t){q(r,t)},mousemove:function(t){X(r,t)},touchstart:function(t){L(r,t)},touchend:function(t){A(r,t)},touchmove:function(t){B(r,t)},touchcancel:function(t){H(r,t)},gesturestart:function(t){j(r,t)},gesturechange:function(t){z(r,t)},gotpointercapture:function(t){N(r,t)},lostpointercapture:function(t){F(r,t)},pointerenter:function(t){V(r,t)},pointerleave:function(t){W(r,t)},pointerover:function(t){U(r,t)},pointerout:function(t){G(r,t)},pointerdown:function(t){Z(r,t)},pointerup:function(t){q(r,t)},pointermove:function(t){X(r,t)},pointercancel:function(t){Q(r,t)},pointerupcaptured:function(t){$(r,t)},pointermovecaptured:function(t){Y(r,t)},tracking:!1,activePointersLists:[],lastClickPos:null,dblClickTimeOut:null,pinchGPoints:[],lastPinchDist:0,currentPinchDist:0,lastPinchCenter:null,currentPinchCenter:null,sentDragEvent:!1},this.hasGestureHandlers=!!(this.pressHandler||this.nonPrimaryPressHandler||this.releaseHandler||this.nonPrimaryReleaseHandler||this.clickHandler||this.dblClickHandler||this.dragHandler||this.dragEndHandler||this.pinchHandler),this.hasScrollHandler=!!this.scrollHandler,t.MouseTracker.havePointerEvents&&t.setElementPointerEvents(this.element,"auto"),this.exitHandler&&t.console.error("MouseTracker.exitHandler is deprecated. Use MouseTracker.leaveHandler instead."),n.startDisabled||this.setTracking(!0)},t.MouseTracker.prototype={destroy:function(){var t;for(p(this),this.element=null,t=0;t<e.length;t++)if(e[t]===this){e.splice(t,1);break}i[this.hash]=null,delete i[this.hash]},isTracking:function(){return i[this.hash].tracking},setTracking:function(e){return e?function(e){var n,o,r=i[e.hash];if(!r.tracking){for(o=0;o<t.MouseTracker.subscribeEvents.length;o++)n=t.MouseTracker.subscribeEvents[o],t.addEvent(e.element,n,r[n],n===t.MouseTracker.wheelEventName&&{passive:!1,capture:!1});h(e),r.tracking=!0}}(this):p(this),this},getActivePointersListByType:function(e){var n,o,r=i[this.hash],s=r.activePointersLists.length;for(n=0;n<s;n++)if(r.activePointersLists[n].type===e)return r.activePointersLists[n];return o=new t.MouseTracker.GesturePointList(e),r.activePointersLists.push(o),o},getActivePointerCount:function(){var t,e=i[this.hash],n=e.activePointersLists.length,o=0;for(t=0;t<n;t++)o+=e.activePointersLists[t].getLength();return o},preProcessEventHandler:function(){},contextMenuHandler:function(){},enterHandler:function(){},leaveHandler:function(){},exitHandler:function(){},overHandler:function(){},outHandler: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(){}};var n,o,r,s,a,l,c=function(){try{return window.self!==window.top}catch(t){return!0}}();function u(t){try{return t.addEventListener&&t.removeEventListener}catch(e){return!1}}function h(t){var e,n,o,r,s,a=i[t.hash],l=a.activePointersLists.length;for(e=0;e<l;e++)if((o=a.activePointersLists[e]).getLength()>0){for(s=[],r=o.asArray(),n=0;n<r.length;n++)s.push(r[n]);for(n=0;n<s.length;n++)et(t,o,s[n])}for(e=0;e<l;e++)a.activePointersLists.pop();a.sentDragEvent=!1}function p(e){var n,o,r=i[e.hash];if(r.tracking){for(o=0;o<t.MouseTracker.subscribeEvents.length;o++)n=t.MouseTracker.subscribeEvents[o],t.removeEvent(e.element,n,r[n],!1);h(e),r.tracking=!1}}function d(t,e){var n=i[t.hash];if("pointerevent"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("mouse"===e)return{upName:"pointerup",upHandler:n.pointerupcaptured,moveName:"pointermove",moveHandler:n.pointermovecaptured};if("touch"===e)return{upName:"touchend",upHandler:n.touchendcaptured,moveName:"touchmove",moveHandler:n.touchmovecaptured};throw new Error("MouseTracker.getCaptureEventParams: Unknown pointer type.")}function f(e,i){var n,o;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents){if(!(o=e.getActivePointersListByType(i.type).getById(i.id))||!o.captured)return;try{e.element.releasePointerCapture(i.id)}catch(r){}}else e.element.releaseCapture();else n=d(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),c&&u(window.top)&&t.removeEvent(window.top,n.upName,n.upHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0),t.removeEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0);nt(e,i,!1)}function g(e){return t.MouseTracker.havePointerEvents?e.pointerId:t.MouseTracker.mousePointerId}function v(e){return t.MouseTracker.havePointerEvents?e.pointerType||(t.Browser.vendor===t.BROWSERS.IE?"mouse":""):"mouse"}function m(e){return!t.MouseTracker.havePointerEvents||e.isPrimary}function y(e){return t.getMousePosition(e)}function w(t,e){return x(y(t),e)}function x(e,i){var n=t.getElementOffset(i);return e.minus(n)}function b(e,i){return new t.Point((e.x+i.x)/2,(e.y+i.y)/2)}function T(e,i){var n={originalEvent:i,eventType:"click",pointerType:"mouse",isEmulated:!1};it(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i),n.stopPropagation&&t.stopEvent(i)}function S(e,i){var n={originalEvent:i,eventType:"dblclick",pointerType:"mouse",isEmulated:!1};it(e,n),n.preventDefault&&!n.defaultPrevented&&t.cancelEvent(i),n.stopPropagation&&t.stopEvent(i)}function P(e,i){var n=null,o={originalEvent:i,eventType:"keydown",pointerType:"",isEmulated:!1};it(e,o),!e.keyDownHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyDownHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function E(e,i){var n=null,o={originalEvent:i,eventType:"keyup",pointerType:"",isEmulated:!1};it(e,o),!e.keyUpHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyUpHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function C(e,i){var n=null,o={originalEvent:i,eventType:"keypress",pointerType:"",isEmulated:!1};it(e,o),!e.keyHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,keyCode:i.keyCode?i.keyCode:i.charCode,ctrl:i.ctrlKey,shift:i.shiftKey,alt:i.altKey,meta:i.metaKey,originalEvent:i,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.keyHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function R(t,e){var i={originalEvent:e,eventType:"focus",pointerType:"",isEmulated:!1};it(t,i),t.focusHandler&&!i.preventGesture&&t.focusHandler({eventSource:t,originalEvent:e,userData:t.userData})}function _(t,e){var i={originalEvent:e,eventType:"blur",pointerType:"",isEmulated:!1};it(t,i),t.blurHandler&&!i.preventGesture&&t.blurHandler({eventSource:t,originalEvent:e,userData:t.userData})}function O(e,i){var n=null,o={originalEvent:i,eventType:"contextmenu",pointerType:"mouse",isEmulated:!1};it(e,o),!e.contextMenuHandler||o.preventGesture||o.defaultPrevented||(n={eventSource:e,position:x(y(i),e.element),originalEvent:o.originalEvent,preventDefault:o.preventDefault||o.defaultPrevented,userData:e.userData},e.contextMenuHandler(n)),(n&&n.preventDefault||o.preventDefault&&!o.defaultPrevented)&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function I(t,e){k(t,e,e)}function D(e,i){var n={target: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"===t.MouseTracker.wheelEventName?n.deltaY=-i.wheelDelta/t.DEFAULT_SETTINGS.pixelsPerWheelLine:n.deltaY=i.detail,k(e,n,i)}function k(e,i,n){var o,r,s=null;o=i.deltaY<0?1:-1,it(e,r={originalEvent:i,eventType:"wheel",pointerType:"mouse",isEmulated:i!==n}),!e.scrollHandler||r.preventGesture||r.defaultPrevented||(s={eventSource:e,pointerType:"mouse",position:w(i,e.element),scroll:o,shift:i.shiftKey,isTouchEvent:!1,originalEvent:n,preventDefault:r.preventDefault||r.defaultPrevented,userData:e.userData},e.scrollHandler(s)),r.stopPropagation&&t.stopEvent(n),(s&&s.preventDefault||r.preventDefault&&!r.defaultPrevented)&&t.cancelEvent(n)}function M(e,i){var n={id:t.MouseTracker.mousePointerId,type:"mouse"},o={originalEvent:i,eventType:"lostpointercapture",pointerType:"mouse",isEmulated:!1};it(e,o),i.target===e.element&&nt(e,n,!1),o.stopPropagation&&t.stopEvent(i)}function L(e,i){var n,o,r,s=i.changedTouches.length,a=e.getActivePointersListByType("touch");n=t.now(),a.getLength()>i.touches.length-s&&t.console.warn("Tracked touch contact count doesn't match event.touches.length");var l={originalEvent:i,eventType:"pointerdown",pointerType:"touch",isEmulated:!1};for(it(e,l),o=0;o<s;o++)ot(e,l,r={id:i.changedTouches[o].identifier,type:"touch",isPrimary:0===a.getLength(),currentPos:y(i.changedTouches[o]),currentTime:n}),st(e,l,r,0),nt(e,r,!0);l.preventDefault&&!l.defaultPrevented&&t.cancelEvent(i),l.stopPropagation&&t.stopEvent(i)}function A(e,i){var n,o,r,s=i.changedTouches.length;n=t.now();var a={originalEvent:i,eventType:"pointerup",pointerType:"touch",isEmulated:!1};for(it(e,a),o=0;o<s;o++)at(e,a,r={id:i.changedTouches[o].identifier,type:"touch",currentPos:y(i.changedTouches[o]),currentTime:n},0),nt(e,r,!1),rt(e,a,r);a.preventDefault&&!a.defaultPrevented&&t.cancelEvent(i),a.stopPropagation&&t.stopEvent(i)}function B(e,i){var n,o,r=i.changedTouches.length;n=t.now();var s={originalEvent:i,eventType:"pointermove",pointerType:"touch",isEmulated:!1};for(it(e,s),o=0;o<r;o++)lt(e,s,{id:i.changedTouches[o].identifier,type:"touch",currentPos:y(i.changedTouches[o]),currentTime:n});s.preventDefault&&!s.defaultPrevented&&t.cancelEvent(i),s.stopPropagation&&t.stopEvent(i)}function H(e,i){var n,o=i.changedTouches.length,r={originalEvent:i,eventType:"pointercancel",pointerType:"touch",isEmulated:!1};for(it(e,r),n=0;n<o;n++)ct(e,r,{id:i.changedTouches[n].identifier,type:"touch"});r.stopPropagation&&t.stopEvent(i)}function j(e,i){return t.eventIsCanceled(i)||i.preventDefault(),!1}function z(e,i){return t.eventIsCanceled(i)||i.preventDefault(),!1}function N(e,i){var n={originalEvent:i,eventType:"gotpointercapture",pointerType:v(i),isEmulated:!1};it(e,n),i.target===e.element&&nt(e,{id:i.pointerId,type:v(i)},!0),n.stopPropagation&&t.stopEvent(i)}function F(e,i){var n={originalEvent:i,eventType:"lostpointercapture",pointerType:v(i),isEmulated:!1};it(e,n),i.target===e.element&&nt(e,{id:i.pointerId,type:v(i)},!1),n.stopPropagation&&t.stopEvent(i)}function V(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerenter",pointerType:n.type,isEmulated:!1};it(e,o),ot(e,o,n)}function W(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerleave",pointerType:n.type,isEmulated:!1};it(e,o),rt(e,o,n)}function U(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerover",pointerType:n.type,isEmulated:!1};it(e,o),function(t,e,i){var n,o;n=t.getActivePointersListByType(i.type),(o=n.getById(i.id))?i=o:(i.captured=!1,i.insideElementPressed=!1);t.overHandler&&t.overHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function G(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointerout",pointerType:n.type,isEmulated:!1};it(e,o),function(t,e,i){var n,o;n=t.getActivePointersListByType(i.type),(o=n.getById(i.id))?i=o:(i.captured=!1,i.insideElementPressed=!1);t.outHandler&&t.outHandler({eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:n.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==n.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function Z(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o=t.MouseTracker.havePointerEvents&&"touch"===n.type&&t.Browser.vendor!==t.BROWSERS.IE,r={originalEvent:i,eventType:"pointerdown",pointerType:n.type,isEmulated:!1};it(e,r),st(e,r,n,i.button),r.preventDefault&&!r.defaultPrevented&&t.cancelEvent(i),r.stopPropagation&&t.stopEvent(i),r.shouldCapture&&(o?nt(e,n,!0):function(e,i){var n;if(t.MouseTracker.havePointerCapture)if(t.MouseTracker.havePointerEvents)try{e.element.setPointerCapture(i.id)}catch(o){return void t.console.warn("setPointerCapture() called on invalid pointer ID")}else e.element.setCapture(!0);else n=d(e,t.MouseTracker.havePointerEvents?"pointerevent":i.type),c&&u(window.top)&&t.addEvent(window.top,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.upName,n.upHandler,!0),t.addEvent(t.MouseTracker.captureElement,n.moveName,n.moveHandler,!0);nt(e,i,!0)}(e,n))}function q(t,e){K(t,e)}function $(e,i){e.getActivePointersListByType(v(i)).getById(i.pointerId)&&K(e,i),t.stopEvent(i)}function K(e,i){var n,o={originalEvent:i,eventType:"pointerup",pointerType:(n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()}).type,isEmulated:!1};it(e,o),at(e,o,n,i.button),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i),o.shouldReleaseCapture&&(i.target===e.element?f(e,n):nt(e,n,!1))}function X(t,e){J(t,e)}function Y(e,i){e.getActivePointersListByType(v(i)).getById(i.pointerId)&&J(e,i),t.stopEvent(i)}function J(e,i){var n={id:g(i),type:v(i),isPrimary:m(i),currentPos:y(i),currentTime:t.now()},o={originalEvent:i,eventType:"pointermove",pointerType:n.type,isEmulated:!1};it(e,o),lt(e,o,n),o.preventDefault&&!o.defaultPrevented&&t.cancelEvent(i),o.stopPropagation&&t.stopEvent(i)}function Q(e,i){var n={id:i.pointerId,type:v(i)},o={originalEvent:i,eventType:"pointercancel",pointerType:n.type,isEmulated:!1};it(e,o),ct(e,o,n),o.stopPropagation&&t.stopEvent(i)}function tt(t,e){return e.speed=0,e.direction=0,e.contactPos=e.currentPos,e.contactTime=e.currentTime,e.lastPos=e.currentPos,e.lastTime=e.currentTime,t.add(e)}function et(e,i,n){var o,r=i.getById(n.id);return r?(r.captured&&(t.console.warn("stopTrackingPointer() called on captured pointer"),f(e,r)),i.removeContact(),o=i.removeById(n.id)):o=i.getLength(),o}function it(e,i){i.eventSource=e,i.eventPhase=i.originalEvent&&void 0!==i.originalEvent.eventPhase?i.originalEvent.eventPhase:0,i.defaultPrevented=t.eventIsCanceled(i.originalEvent),i.shouldCapture=!1,i.shouldReleaseCapture=!1,i.userData=e.userData,function(t,e){switch(e.eventType){case"pointermove":case"pointerdown":case"pointerup":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasGestureHandlers,e.stopPropagation=!1;break;case"pointerover":case"pointerout":case"contextmenu":case"keydown":case"keyup":case"keypress":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"wheel":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!1,e.preventGesture=!t.hasScrollHandler,e.stopPropagation=!1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":e.isStoppable=!0,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1;break;case"click":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.clickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;case"dblclick":e.isStoppable=!0,e.isCancelable=!0,e.preventDefault=!!t.dblClickHandler,e.preventGesture=!1,e.stopPropagation=!1;break;default:e.isStoppable=!1,e.isCancelable=!1,e.preventDefault=!1,e.preventGesture=!1,e.stopPropagation=!1}}(e,i),e.preProcessEventHandler&&e.preProcessEventHandler(i)}function nt(e,i,n){var o=e.getActivePointersListByType(i.type),r=o.getById(i.id);r?n&&!r.captured?(r.captured=!0,o.captureCount++):!n&&r.captured&&(r.captured=!1,o.captureCount--,o.captureCount<0&&(o.captureCount=0,t.console.warn("updatePointerCaptured() - pointsList.captureCount went negative"))):t.console.warn("updatePointerCaptured() called on untracked pointer")}function ot(t,e,i){var n,o=t.getActivePointersListByType(i.type);(n=o.getById(i.id))?(n.insideElement=!0,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime,i=n):(i.captured=!1,i.insideElementPressed=!1,i.insideElement=!0,tt(o,i)),t.enterHandler&&t.enterHandler({eventSource:t,pointerType:i.type,position:x(i.currentPos,t.element),buttons:o.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==o.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData})}function rt(t,e,i){var n,o,r=t.getActivePointersListByType(i.type);(n=r.getById(i.id))?(n.captured?(n.insideElement=!1,n.lastPos=n.currentPos,n.lastTime=n.currentTime,n.currentPos=i.currentPos,n.currentTime=i.currentTime):et(t,r,n),i=n):(i.captured=!1,i.insideElementPressed=!1),(t.leaveHandler||t.exitHandler)&&(o={eventSource:t,pointerType:i.type,position:i.currentPos&&x(i.currentPos,t.element),buttons:r.buttons,pointers:t.getActivePointerCount(),insideElementPressed:i.insideElementPressed,buttonDownAny:0!==r.buttons,isTouchEvent:"touch"===i.type,originalEvent:e.originalEvent,userData:t.userData},t.leaveHandler&&t.leaveHandler(o),t.exitHandler&&t.exitHandler(o))}function st(e,n,o,r){var s,a=i[e.hash],l=e.getActivePointersListByType(o.type);if(void 0!==n.originalEvent.buttons?l.buttons=n.originalEvent.buttons:0===r?l.buttons|=1:1===r?l.buttons|=4:2===r?l.buttons|=2:3===r?l.buttons|=8:4===r?l.buttons|=16:5===r&&(l.buttons|=32),0!==r)return n.shouldCapture=!1,n.shouldReleaseCapture=!1,void(!e.nonPrimaryPressHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryPressHandler({eventSource:e,pointerType:o.type,position:x(o.currentPos,e.element),button:r,buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData})));(s=l.getById(o.id))?(s.insideElementPressed=!0,s.insideElement=!0,s.originalTarget=n.originalEvent.target,s.contactPos=o.currentPos,s.contactTime=o.currentTime,s.lastPos=s.currentPos,s.lastTime=s.currentTime,s.currentPos=o.currentPos,s.currentTime=o.currentTime,o=s):(o.captured=!1,o.insideElementPressed=!0,o.insideElement=!0,o.originalTarget=n.originalEvent.target,tt(l,o)),l.addContact(),n.preventGesture||n.defaultPrevented?(n.shouldCapture=!1,n.shouldReleaseCapture=!1):(n.shouldCapture=!0,n.shouldReleaseCapture=!1,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.addPoint(e,o),1===l.contacts?e.pressHandler&&!n.preventGesture&&e.pressHandler({eventSource:e,pointerType:o.type,position:x(o.contactPos,e.element),buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData}):2===l.contacts&&e.pinchHandler&&"touch"===o.type&&(a.pinchGPoints=l.asArray(),a.lastPinchDist=a.currentPinchDist=a.pinchGPoints[0].currentPos.distanceTo(a.pinchGPoints[1].currentPos),a.lastPinchCenter=a.currentPinchCenter=b(a.pinchGPoints[0].currentPos,a.pinchGPoints[1].currentPos)))}function at(e,n,o,r){var s,a,l,c,u=i[e.hash],h=e.getActivePointersListByType(o.type),p=!1;if(void 0!==n.originalEvent.buttons?h.buttons=n.originalEvent.buttons:0===r?h.buttons^=-2:1===r?h.buttons^=-5:2===r?h.buttons^=-3:3===r?h.buttons^=-9:4===r?h.buttons^=-17:5===r&&(h.buttons^=-33),n.shouldCapture=!1,0!==r)return n.shouldReleaseCapture=!1,void(!e.nonPrimaryReleaseHandler||n.preventGesture||n.defaultPrevented||(n.preventDefault=!0,e.nonPrimaryReleaseHandler({eventSource:e,pointerType:o.type,position:x(o.currentPos,e.element),button:r,buttons:h.buttons,isTouchEvent:"touch"===o.type,originalEvent:n.originalEvent,userData:e.userData})));(l=h.getById(o.id))?(h.removeContact(),l.captured&&(p=!0),l.lastPos=l.currentPos,l.lastTime=l.currentTime,l.currentPos=o.currentPos,l.currentTime=o.currentTime,l.insideElement||et(e,h,l),s=l.currentPos,a=l.currentTime):(o.captured=!1,o.insideElementPressed=!1,o.insideElement=!0,tt(h,o),l=o),n.preventGesture||n.defaultPrevented||(p?(n.shouldReleaseCapture=!0,n.preventDefault=!0,(e.dragHandler||e.dragEndHandler||e.pinchHandler)&&t.MouseTracker.gesturePointVelocityTracker.removePoint(e,l),0===h.contacts?(e.releaseHandler&&s&&e.releaseHandler({eventSource:e,pointerType:l.type,position:x(s,e.element),buttons:h.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),e.dragEndHandler&&u.sentDragEvent&&e.dragEndHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),speed:l.speed,direction:l.direction,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.sentDragEvent=!1,(e.clickHandler||e.dblClickHandler)&&l.insideElement&&(c=a-l.contactTime<=e.clickTimeThreshold&&l.contactPos.distanceTo(s)<=e.clickDistThreshold,e.clickHandler&&e.clickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),quick:c,shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,originalTarget:l.originalTarget,userData:e.userData}),e.dblClickHandler&&c&&(h.clicks++,1===h.clicks?(u.lastClickPos=s,u.dblClickTimeOut=setTimeout((function(){h.clicks=0}),e.dblClickTimeThreshold)):2===h.clicks&&(clearTimeout(u.dblClickTimeOut),h.clicks=0,u.lastClickPos.distanceTo(s)<=e.dblClickDistThreshold&&e.dblClickHandler({eventSource:e,pointerType:l.type,position:x(l.currentPos,e.element),shift:n.originalEvent.shiftKey,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),u.lastClickPos=null)))):2===h.contacts&&e.pinchHandler&&"touch"===l.type&&(u.pinchGPoints=h.asArray(),u.lastPinchDist=u.currentPinchDist=u.pinchGPoints[0].currentPos.distanceTo(u.pinchGPoints[1].currentPos),u.lastPinchCenter=u.currentPinchCenter=b(u.pinchGPoints[0].currentPos,u.pinchGPoints[1].currentPos))):(n.shouldReleaseCapture=!1,e.releaseHandler&&s&&(e.releaseHandler({eventSource:e,pointerType:l.type,position:x(s,e.element),buttons:h.buttons,insideElementPressed:l.insideElementPressed,insideElementReleased:l.insideElement,isTouchEvent:"touch"===l.type,originalEvent:n.originalEvent,userData:e.userData}),n.preventDefault=!0)))}function lt(t,e,n){var o,r,s,a=i[t.hash],l=t.getActivePointersListByType(n.type);void 0!==e.originalEvent.buttons&&(l.buttons=e.originalEvent.buttons),(o=l.getById(n.id))&&(o.lastPos=o.currentPos,o.lastTime=o.currentTime,o.currentPos=n.currentPos,o.currentTime=n.currentTime,e.shouldCapture=!1,e.shouldReleaseCapture=!1,t.stopHandler&&"mouse"===n.type&&(clearTimeout(t.stopTimeOut),t.stopTimeOut=setTimeout((function(){!function(t,e,i){t.stopHandler&&t.stopHandler({eventSource:t,pointerType:i,position:w(e,t.element),buttons:t.getActivePointersListByType(i).buttons,isTouchEvent:"touch"===i,originalEvent:e,userData:t.userData})}(t,e.originalEvent,n.type)}),t.stopDelay)),0===l.contacts?t.moveHandler&&t.moveHandler({eventSource:t,pointerType:n.type,position:x(n.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===n.type,originalEvent:e.originalEvent,userData:t.userData}):1===l.contacts?(t.moveHandler&&(o=l.asArray()[0],t.moveHandler({eventSource:t,pointerType:o.type,position:x(o.currentPos,t.element),buttons:l.buttons,isTouchEvent:"touch"===o.type,originalEvent:e.originalEvent,userData:t.userData})),!t.dragHandler||e.preventGesture||e.defaultPrevented||(s=(o=l.asArray()[0]).currentPos.minus(o.lastPos),t.dragHandler({eventSource:t,pointerType:o.type,position:x(o.currentPos,t.element),buttons:l.buttons,delta:s,speed:o.speed,direction:o.direction,shift:e.originalEvent.shiftKey,isTouchEvent:"touch"===o.type,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0,a.sentDragEvent=!0)):2===l.contacts&&(t.moveHandler&&(r=l.asArray(),t.moveHandler({eventSource:t,pointerType:r[0].type,position:x(b(r[0].currentPos,r[1].currentPos),t.element),buttons:l.buttons,isTouchEvent:"touch"===r[0].type,originalEvent:e.originalEvent,userData:t.userData})),!t.pinchHandler||"touch"!==n.type||e.preventGesture||e.defaultPrevented||(s=a.pinchGPoints[0].currentPos.distanceTo(a.pinchGPoints[1].currentPos))!==a.currentPinchDist&&(a.lastPinchDist=a.currentPinchDist,a.currentPinchDist=s,a.lastPinchCenter=a.currentPinchCenter,a.currentPinchCenter=b(a.pinchGPoints[0].currentPos,a.pinchGPoints[1].currentPos),t.pinchHandler({eventSource:t,pointerType:"touch",gesturePoints:a.pinchGPoints,lastCenter:x(a.lastPinchCenter,t.element),center:x(a.currentPinchCenter,t.element),lastDistance:a.lastPinchDist,distance:a.currentPinchDist,shift:e.originalEvent.shiftKey,originalEvent:e.originalEvent,userData:t.userData}),e.preventDefault=!0)))}function ct(t,e,i){var n,o=t.getActivePointersListByType(i.type);(n=o.getById(i.id))&&et(t,o,n)}t.MouseTracker.gesturePointVelocityTracker=(n=[],o=0,r=0,s=function(t,e){return t.hash.toString()+e.type+e.id.toString()},a=function(){var e,i,o,s,a,l,c=n.length,u=t.now();for(s=u-r,r=u,e=0;e<c;e++)(o=(i=n[e]).gPoint).direction=Math.atan2(o.currentPos.y-i.lastPos.y,o.currentPos.x-i.lastPos.x),a=i.lastPos.distanceTo(o.currentPos),i.lastPos=o.currentPos,l=1e3*a/(s+1),o.speed=.75*l+.25*o.speed},{addPoint:function(e,i){var l=s(e,i);n.push({guid:l,gPoint:i,lastPos:i.currentPos}),1===n.length&&(r=t.now(),o=window.setInterval(a,50))},removePoint:function(t,e){var i,r=s(t,e),a=n.length;for(i=0;i<a;i++)if(n[i].guid===r){n.splice(i,1),0==--a&&window.clearInterval(o);break}}}),t.MouseTracker.captureElement=document,t.MouseTracker.wheelEventName=t.Browser.vendor===t.BROWSERS.IE&&t.Browser.version>8||"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",t.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur","contextmenu",t.MouseTracker.wheelEventName],"DOMMouseScroll"===t.MouseTracker.wheelEventName&&t.MouseTracker.subscribeEvents.push("MozMousePixelScroll"),window.PointerEvent?(t.MouseTracker.havePointerEvents=!0,t.MouseTracker.subscribeEvents.push("pointerenter","pointerleave","pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel"),t.MouseTracker.havePointerCapture=(l=document.createElement("div"),t.isFunction(l.setPointerCapture)&&t.isFunction(l.releasePointerCapture)),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("gotpointercapture","lostpointercapture")):(t.MouseTracker.havePointerEvents=!1,t.MouseTracker.subscribeEvents.push("mouseenter","mouseleave","mouseover","mouseout","mousedown","mouseup","mousemove"),t.MouseTracker.mousePointerId="legacy-mouse",t.MouseTracker.havePointerCapture=function(){var e=document.createElement("div");return t.isFunction(e.setCapture)&&t.isFunction(e.releaseCapture)}(),t.MouseTracker.havePointerCapture&&t.MouseTracker.subscribeEvents.push("losecapture"),"ontouchstart"in window&&t.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel"),"ongesturestart"in window&&t.MouseTracker.subscribeEvents.push("gesturestart","gesturechange")),t.MouseTracker.GesturePointList=function(t){this._gPoints=[],this.type=t,this.buttons=0,this.contacts=0,this.clicks=0,this.captureCount=0},t.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(t){return this._gPoints.push(t)},removeById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t){this._gPoints.splice(e,1);break}return this._gPoints.length},getByIndex:function(t){return t<this._gPoints.length?this._gPoints[t]:null},getById:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].id===t)return this._gPoints[e];return null},getPrimary:function(t){var e,i=this._gPoints.length;for(e=0;e<i;e++)if(this._gPoints[e].isPrimary)return this._gPoints[e];return null},addContact:function(){++this.contacts,this.contacts>1&&("mouse"===this.type||"pen"===this.type)&&(t.console.warn("GesturePointList.addContact() Implausible contacts value"),this.contacts=1)},removeContact:function(){--this.contacts,this.contacts<0&&(this.contacts=0)}}}(l),function(t){t.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},t.Control=function(e,i,n){var o=e.parentNode;"number"==typeof i&&(t.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=e,this.anchor=i.anchor,this.container=n,this.anchor===t.ControlAnchor.ABSOLUTE?(this.wrapper=t.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%"):(this.wrapper=t.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor===t.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),i.attachToViewer?this.anchor===t.ControlAnchor.TOP_RIGHT||this.anchor===t.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):o.appendChild(this.wrapper)},t.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.anchor!==t.ControlAnchor.NONE&&this.container.removeChild(this.wrapper)},isVisible:function(){return"none"!==this.wrapper.style.display},setVisible:function(e){this.wrapper.style.display=e?this.anchor===t.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(e){this.element[t.SIGNAL]&&t.Browser.vendor===t.BROWSERS.IE?t.setElementOpacity(this.element,e,!0):t.setElementOpacity(this.wrapper,e,!0)}}}(l),function(t){function e(t,e){var i,n=t.controls;for(i=n.length-1;i>=0;i--)if(n[i].element===e)return i;return-1}t.ControlDock=function(e){var i,n,o=["topleft","topright","bottomright","bottomleft"];for(t.extend(!0,this,{id:"controldock-"+t.now()+"-"+Math.floor(1e6*Math.random()),container:t.makeNeutralElement("div"),controls:[]},e),this.container.onsubmit=function(){return!1},this.element&&(this.element=t.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),n=0;n<o.length;n++)i=o[n],this.controls[i]=t.makeNeutralElement("div"),this.controls[i].style.position="absolute",i.match("left")&&(this.controls[i].style.left="0px"),i.match("right")&&(this.controls[i].style.right="0px"),i.match("top")&&(this.controls[i].style.top="0px"),i.match("bottom")&&(this.controls[i].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)},t.ControlDock.prototype={addControl:function(i,n){var o=null;if(!(e(this,i=t.getElement(i))>=0)){switch(n.anchor){case t.ControlAnchor.TOP_RIGHT:o=this.controls.topright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.BOTTOM_RIGHT:o=this.controls.bottomright,i.style.position="relative",i.style.paddingRight="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.BOTTOM_LEFT:o=this.controls.bottomleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingBottom="0px";break;case t.ControlAnchor.TOP_LEFT:o=this.controls.topleft,i.style.position="relative",i.style.paddingLeft="0px",i.style.paddingTop="0px";break;case t.ControlAnchor.ABSOLUTE:default:case t.ControlAnchor.NONE:o=this.container,i.style.margin="0px",i.style.padding="0px"}this.controls.push(new t.Control(i,n,o)),i.style.display="inline-block"}},removeControl:function(i){var n=e(this,i=t.getElement(i));return n>=0&&(this.controls[n].destroy(),this.controls.splice(n,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var t;for(t=this.controls.length-1;t>=0;t--)if(this.controls[t].isVisible())return!0;return!1},setControlsEnabled:function(t){var e;for(e=this.controls.length-1;e>=0;e--)this.controls[e].setVisible(t);return this}}}(l),function(t){t.Placement=t.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}}})}(l),function(t){var e={},i=1;function n(e){return e=t.getElement(e),new t.Point(0===e.clientWidth?1:e.clientWidth,0===e.clientHeight?1:e.clientHeight)}function o(e,i){if(i instanceof t.Overlay)return i;var n=null;if(i.element)n=t.getElement(i.element);else{var o=i.id?i.id:"openseadragon-overlay-"+Math.floor(1e7*Math.random());(n=t.getElement(i.id))||((n=document.createElement("a")).href="#/overlay/"+o),n.id=o,t.addClass(n,i.className?i.className:"openseadragon-overlay")}var r=i.location,s=i.width,a=i.height;if(!r){var l=i.x,c=i.y;if(void 0!==i.px){var u=e.viewport.imageToViewportRectangle(new t.Rect(i.px,i.py,s||0,a||0));l=u.x,c=u.y,s=void 0!==s?u.width:void 0,a=void 0!==a?u.height:void 0}r=new t.Point(l,c)}var h=i.placement;return h&&"string"===t.type(h)&&(h=t.Placement[i.placement.toUpperCase()]),new t.Overlay({element:n,location:r,placement:h,onDraw:i.onDraw,checkResize:i.checkResize,width:s,height:a,rotationMode:i.rotationMode})}function r(t,e){var i;for(i=t.length-1;i>=0;i--)if(t[i].element===e)return i;return-1}function s(e,i){return t.requestAnimationFrame((function(){i(e)}))}function a(e){t.requestAnimationFrame((function(){!function(e){var i,n;if(e.controlsShouldFade){for(i=1-(t.now()-e.controlsFadeBeginTime)/e.controlsFadeLength,i=Math.min(1,i),i=Math.max(0,i),n=e.controls.length-1;n>=0;n--)e.controls[n].autoFade&&e.controls[n].setOpacity(i);i>0&&a(e)}}(e)}))}function l(e){e.autoHideControls&&(e.controlsShouldFade=!0,e.controlsFadeBeginTime=t.now()+e.controlsFadeDelay,window.setTimeout((function(){a(e)}),e.controlsFadeDelay))}function c(t){var e;for(t.controlsShouldFade=!1,e=t.controls.length-1;e>=0;e--)t.controls[e].setOpacity(1)}function u(){c(this)}function h(){l(this)}function p(t){var e={tracker:t.eventSource,position:t.position,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.raiseEvent("canvas-contextmenu",e),t.preventDefault=e.preventDefault}function d(e){var i={originalEvent:e.originalEvent,preventDefaultAction:!1,preventVerticalPan:e.preventVerticalPan||!this.panVertical,preventHorizontalPan:e.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",i),i.preventDefaultAction||e.ctrl||e.alt||e.meta)e.preventDefault=!1;else switch(e.keyCode){case 38:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 40:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 37:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 39:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;default:e.preventDefault=!1}}function f(e){var i={originalEvent:e.originalEvent,preventDefaultAction:!1,preventVerticalPan:e.preventVerticalPan||!this.panVertical,preventHorizontalPan:e.preventHorizontalPan||!this.panHorizontal};if(this.raiseEvent("canvas-key",i),i.preventDefaultAction||e.ctrl||e.alt||e.meta)e.preventDefault=!1;else switch(e.keyCode){case 43:case 61:this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 45:this.viewport.zoomBy(.9),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 48:this.viewport.goHome(),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 119:case 87:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,-40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 115:case 83:i.preventVerticalPan||(e.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(0,40))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 97:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(-40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 100:i.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new t.Point(40,0))),this.viewport.applyConstraints()),e.preventDefault=!0;break;case 114:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 82:this.viewport.flipped?this.viewport.setRotation(this.viewport.getRotation()+this.rotationIncrement):this.viewport.setRotation(this.viewport.getRotation()-this.rotationIncrement),this.viewport.applyConstraints(),e.preventDefault=!0;break;case 102:this.viewport.toggleFlip(),e.preventDefault=!0;break;case 106:this.goToPreviousPage();break;case 107:this.goToNextPage();break;default:e.preventDefault=!1}}function g(i){var n;document.activeElement===this.canvas||this.canvas.focus(),this.viewport.flipped&&(i.position.x=this.viewport.getContainerSize().x-i.position.x);var o={tracker:i.eventSource,position:i.position,quick:i.quick,shift:i.shift,originalEvent:i.originalEvent,originalTarget:i.originalTarget,preventDefaultAction:!1};this.raiseEvent("canvas-click",o),!o.preventDefaultAction&&this.viewport&&i.quick&&(!0===(n=this.gestureSettingsByDeviceType(i.pointerType)).clickToZoom&&(this.viewport.zoomBy(i.shift?1/this.zoomPerClick:this.zoomPerClick,n.zoomToRefPoint?this.viewport.pointFromPixel(i.position,!0):null),this.viewport.applyConstraints()),n.dblClickDragToZoom&&(!0===e[this.hash].draggingToZoom?(e[this.hash].lastClickTime=null,e[this.hash].draggingToZoom=!1):e[this.hash].lastClickTime=t.now()))}function v(t){var e,i={tracker:t.eventSource,position:t.position,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.raiseEvent("canvas-double-click",i),!i.preventDefaultAction&&this.viewport&&(e=this.gestureSettingsByDeviceType(t.pointerType)).dblClickToZoom&&(this.viewport.zoomBy(t.shift?1/this.zoomPerClick:this.zoomPerClick,e.zoomToRefPoint?this.viewport.pointFromPixel(t.position,!0):null),this.viewport.applyConstraints())}function m(t){var i,n={tracker:t.eventSource,pointerType:t.pointerType,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag",n),i=this.gestureSettingsByDeviceType(t.pointerType),!n.preventDefaultAction&&this.viewport)if(i.dblClickDragToZoom&&e[this.hash].draggingToZoom){var o=Math.pow(this.zoomPerDblClickDrag,t.delta.y/50);this.viewport.zoomBy(o)}else if(i.dragToPan&&!e[this.hash].draggingToZoom){if(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewport.flipped&&(t.delta.x=-t.delta.x),this.constrainDuringPan){var r=this.viewport.deltaPointsFromPixels(t.delta.negate());this.viewport.centerSpringX.target.value+=r.x,this.viewport.centerSpringY.target.value+=r.y;var s=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=r.x,this.viewport.centerSpringY.target.value-=r.y,s.xConstrained&&(t.delta.x=0),s.yConstrained&&(t.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta.negate()),i.flickEnabled&&!this.constrainDuringPan)}}function y(i){var n,o={tracker:i.eventSource,pointerType:i.pointerType,position:i.position,speed:i.speed,direction:i.direction,shift:i.shift,originalEvent:i.originalEvent,preventDefaultAction:!1};if(this.raiseEvent("canvas-drag-end",o),n=this.gestureSettingsByDeviceType(i.pointerType),!o.preventDefaultAction&&this.viewport){if(!e[this.hash].draggingToZoom&&n.flickEnabled&&i.speed>=n.flickMinSpeed){var r=0;this.panHorizontal&&(r=n.flickMomentum*i.speed*Math.cos(i.direction));var s=0;this.panVertical&&(s=n.flickMomentum*i.speed*Math.sin(i.direction));var a=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),l=this.viewport.pointFromPixel(new t.Point(a.x-r,a.y-s));this.viewport.panTo(l,!1)}this.viewport.applyConstraints()}n.dblClickDragToZoom&&!0===e[this.hash].draggingToZoom&&(e[this.hash].draggingToZoom=!1)}function w(t){this.raiseEvent("canvas-enter",{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 x(t){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 b(i){if(this.raiseEvent("canvas-press",{tracker:i.eventSource,pointerType:i.pointerType,position:i.position,insideElementPressed:i.insideElementPressed,insideElementReleased:i.insideElementReleased,originalEvent:i.originalEvent}),this.gestureSettingsByDeviceType(i.pointerType).dblClickDragToZoom){var n=e[this.hash].lastClickTime,o=t.now();if(null===n)return;o-n<this.dblClickTimeThreshold&&(e[this.hash].draggingToZoom=!0),e[this.hash].lastClickTime=null}}function T(t){this.raiseEvent("canvas-release",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,insideElementPressed:t.insideElementPressed,insideElementReleased:t.insideElementReleased,originalEvent:t.originalEvent})}function S(t){this.raiseEvent("canvas-nonprimary-press",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function P(t){this.raiseEvent("canvas-nonprimary-release",{tracker:t.eventSource,position:t.position,pointerType:t.pointerType,button:t.button,buttons:t.buttons,originalEvent:t.originalEvent})}function E(t){var e,i,n,o={tracker:t.eventSource,pointerType:t.pointerType,gesturePoints:t.gesturePoints,lastCenter:t.lastCenter,center:t.center,lastDistance:t.lastDistance,distance:t.distance,shift:t.shift,originalEvent:t.originalEvent,preventDefaultPanAction:!1,preventDefaultZoomAction:!1,preventDefaultRotateAction:!1};if(this.raiseEvent("canvas-pinch",o),this.viewport&&(!(e=this.gestureSettingsByDeviceType(t.pointerType)).pinchToZoom||o.preventDefaultPanAction&&o.preventDefaultZoomAction||(i=this.viewport.pointFromPixel(t.center,!0),e.zoomToRefPoint&&!o.preventDefaultPanAction&&(n=this.viewport.pointFromPixel(t.lastCenter,!0).minus(i),this.panHorizontal||(n.x=0),this.panVertical||(n.y=0),this.viewport.panBy(n,!0)),o.preventDefaultZoomAction||this.viewport.zoomBy(t.distance/t.lastDistance,i,!0),this.viewport.applyConstraints()),e.pinchRotate&&!o.preventDefaultRotateAction)){var r=Math.atan2(t.gesturePoints[0].currentPos.y-t.gesturePoints[1].currentPos.y,t.gesturePoints[0].currentPos.x-t.gesturePoints[1].currentPos.x),s=Math.atan2(t.gesturePoints[0].lastPos.y-t.gesturePoints[1].lastPos.y,t.gesturePoints[0].lastPos.x-t.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(r-s)*(180/Math.PI))}}function C(e){var i,n,o,r;(r=t.now())-this._lastScrollTime>this.minScrollDeltaTime?(this._lastScrollTime=r,i={tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:!1,preventDefault:!0},this.raiseEvent("canvas-scroll",i),!i.preventDefaultAction&&this.viewport&&(this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x),(n=this.gestureSettingsByDeviceType(e.pointerType)).scrollToZoom&&(o=Math.pow(this.zoomPerScroll,e.scroll),this.viewport.zoomBy(o,n.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null),this.viewport.applyConstraints())),e.preventDefault=i.preventDefault):e.preventDefault=!0}function R(t){e[this.hash].mouseInside=!0,c(this),this.raiseEvent("container-enter",{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){t.pointers<1&&(e[this.hash].mouseInside=!1,e[this.hash].animating||l(this)),this.raiseEvent("container-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 O(i){!function(i){if(i._opening||!e[i.hash])return;if(i.autoResize||e[i.hash].forceResize){var o;if(i._autoResizePolling){o=n(i.container);var r=e[i.hash].prevContainerSize;o.equals(r)||(e[i.hash].needsResize=!0)}e[i.hash].needsResize&&function(i,n){var o,r=i.viewport,s=r.getZoom(),a=r.getCenter();if(r.resize(n,i.preserveImageSizeOnResize),r.panTo(a,!0),i.preserveImageSizeOnResize)o=e[i.hash].prevContainerSize.x/n.x;else{var l=new t.Point(0,0),c=new t.Point(e[i.hash].prevContainerSize.x,e[i.hash].prevContainerSize.y).distanceTo(l);o=new t.Point(n.x,n.y).distanceTo(l)/c*e[i.hash].prevContainerSize.x/n.x}r.zoomTo(s*o,null,!0),e[i.hash].prevContainerSize=n,e[i.hash].forceRedraw=!0,e[i.hash].needsResize=!1,e[i.hash].forceResize=!1}(i,o||n(i.container))}var s=i.viewport.update(),a=i.world.update()||s;s&&i.raiseEvent("viewport-change");i.referenceStrip&&(a=i.referenceStrip.update(i.viewport)||a);var u=e[i.hash].animating;!u&&a&&(i.raiseEvent("animation-start"),c(i));var h=u&&!a;h&&(e[i.hash].animating=!1);(a||h||e[i.hash].forceRedraw||i.world.needsDraw())&&(!function(t){t.imageLoader.clear(),t.drawer.clear(),t.world.draw(),t.raiseEvent("update-viewport",{})}(i),i._drawOverlays(),i.navigator&&i.navigator.update(i.viewport),e[i.hash].forceRedraw=!1,a&&i.raiseEvent("animation"));h&&(i.raiseEvent("animation-finish"),e[i.hash].mouseInside||l(i));e[i.hash].animating=a}(i),i.isOpen()?i._updateRequestId=s(i,O):i._updateRequestId=!1}function I(t,e){return t?t+e:e}function D(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=this.zoomPerSecond,e[this.hash].zooming=!0,L(this)}function k(){e[this.hash].lastZoomTime=t.now(),e[this.hash].zoomFactor=1/this.zoomPerSecond,e[this.hash].zooming=!0,L(this)}function M(){e[this.hash].zooming=!1}function L(e){t.requestAnimationFrame(t.delegate(e,A))}function A(){var i,n,o;e[this.hash].zooming&&this.viewport&&(n=(i=t.now())-e[this.hash].lastZoomTime,o=Math.pow(e[this.hash].zoomFactor,n/1e3),this.viewport.zoomBy(o),this.viewport.applyConstraints(),e[this.hash].lastZoomTime=i,L(this))}function B(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function H(){this.viewport&&(e[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function j(){this.buttonGroup&&(this.buttonGroup.emulateEnter(),this.buttonGroup.emulateLeave())}function z(){this.viewport&&this.viewport.goHome()}function N(){this.isFullPage()&&!t.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage()),this.buttonGroup&&this.buttonGroup.emulateLeave(),this.fullPageButton.element.focus(),this.viewport&&this.viewport.applyConstraints()}function F(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t+=this.rotationIncrement:t-=this.rotationIncrement,this.viewport.setRotation(t)}}function V(){if(this.viewport){var t=this.viewport.getRotation();this.viewport.flipped?t-=this.rotationIncrement:t+=this.rotationIncrement,this.viewport.setRotation(t)}}function W(){this.viewport.toggleFlip()}t.Viewer=function(o){var r,a,c=arguments,u=this;if(t.isPlainObject(o)||(o={id:c[0],xmlPath:c.length>1?c[1]:void 0,prefixUrl:c.length>2?c[2]:void 0,controls:c.length>3?c[3]:void 0,overlays:c.length>4?c[4]:void 0}),o.config&&(t.extend(!0,o,o.config),delete o.config),t.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,buttonGroup:null,profiler:null},t.DEFAULT_SETTINGS,o),void 0===this.hash)throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(void 0!==e[this.hash]&&t.console.warn("Hash "+this.hash+" has already been used."),e[this.hash]={fsBoundsDelta:new t.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,needsResize:!1,forceResize:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null,lastClickTime:null,draggingToZoom:!1},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._updatePixelDensityRatioBind=null,this._lastScrollTime=t.now(),t.EventSource.call(this),this.addHandler("open-failed",(function(e){var i=t.getString("Errors.OpenFailed",e.eventSource,e.message);u._showMessage(i)})),t.ControlDock.call(this,o),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=t.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",(a=this.canvas.style).width="100%",a.height="100%",a.overflow="hidden",a.position="absolute",a.top="0px",a.left="0px",t.setElementTouchActionNone(this.canvas),""!==o.tabIndex&&(this.canvas.tabIndex=void 0===o.tabIndex?0:o.tabIndex),this.container.className="openseadragon-container",function(t){t.width="100%",t.height="100%",t.position="relative",t.overflow="hidden",t.left="0px",t.top="0px",t.textAlign="left"}(this.container.style),t.setElementTouchActionNone(this.container),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 t.MouseTracker({userData:"Viewer.innerTracker",element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,contextMenuHandler:t.delegate(this,p),keyDownHandler:t.delegate(this,d),keyHandler:t.delegate(this,f),clickHandler:t.delegate(this,g),dblClickHandler:t.delegate(this,v),dragHandler:t.delegate(this,m),dragEndHandler:t.delegate(this,y),enterHandler:t.delegate(this,w),leaveHandler:t.delegate(this,x),pressHandler:t.delegate(this,b),releaseHandler:t.delegate(this,T),nonPrimaryPressHandler:t.delegate(this,S),nonPrimaryReleaseHandler:t.delegate(this,P),scrollHandler:t.delegate(this,C),pinchHandler:t.delegate(this,E)}),this.outerTracker=new t.MouseTracker({userData:"Viewer.outerTracker",element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:t.delegate(this,R),leaveHandler:t.delegate(this,_)}),this.toolbar&&(this.toolbar=new t.ControlDock({element:this.toolbar})),this.bindStandardControls(),e[this.hash].prevContainerSize=n(this.container),window.ResizeObserver?(this._autoResizePolling=!1,this._resizeObserver=new ResizeObserver((function(){e[u.hash].needsResize=!0})),this._resizeObserver.observe(this.container,{})):this._autoResizePolling=!0,this.world=new t.World({viewer:this}),this.world.addHandler("add-item",(function(t){u.source=u.world.getItemAt(0).source,e[u.hash].forceRedraw=!0,u._updateRequestId||(u._updateRequestId=s(u,O))})),this.world.addHandler("remove-item",(function(t){u.world.getItemCount()?u.source=u.world.getItemAt(0).source:u.source=null,e[u.hash].forceRedraw=!0})),this.world.addHandler("metrics-change",(function(t){u.viewport&&u.viewport._setContentBounds(u.world.getHomeBounds(),u.world.getContentFactor())})),this.world.addHandler("item-index-change",(function(t){u.source=u.world.getItemAt(0).source})),this.viewport=new t.Viewport({containerSize:e[this.hash].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,silenceMultiImageWarnings:this.silenceMultiImageWarnings}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new t.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:o.timeout}),this.tileCache=new t.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new t.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=t.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(r=this.buttonGroup.buttons.indexOf(this.rotateLeft),this.buttonGroup.buttons.splice(r,1),this.buttonGroup.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(r=this.buttonGroup.buttons.indexOf(this.rotateRight),this.buttonGroup.buttons.splice(r,1),this.buttonGroup.element.removeChild(this.rotateRight.element))),this._addUpdatePixelDensityRatioEvent(),this.showNavigator&&(this.navigator=new t.Navigator({element:this.navigatorElement,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,animationTime:this.animationTime})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),r=0;r<this.customControls.length;r++)this.addControl(this.customControls[r].id,{anchor:this.customControls[r].anchor});t.requestAnimationFrame((function(){l(u)})),void 0===this.imageSmoothingEnabled||this.imageSmoothingEnabled||this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled),t._viewers.set(this.element,this)},t.extend(t.Viewer.prototype,t.EventSource.prototype,t.ControlDock.prototype,{isOpen:function(){return!!this.world.getItemCount()},openDzi:function(e){return t.console.error("[Viewer.openDzi] this function is deprecated; use Viewer.open() instead."),this.open(e)},openTileSource:function(e){return t.console.error("[Viewer.openTileSource] this function is deprecated; use Viewer.open() instead."),this.open(e)},get buttons(){return t.console.warn("Viewer.buttons is deprecated; Please use Viewer.buttonGroup"),this.buttonGroup},open:function(e,i){var n=this;if(this.close(),!e)return this;if(this.sequenceMode&&t.isArray(e))return this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),void 0===i||isNaN(i)||(this.initialPage=i),this.tileSources=e,this._sequenceIndex=Math.max(0,Math.min(this.tileSources.length-1,this.initialPage)),this.tileSources.length&&(this.open(this.tileSources[this._sequenceIndex]),this.showReferenceStrip&&this.addReferenceStrip()),this._updateSequenceButtons(this._sequenceIndex),this;if(t.isArray(e)||(e=[e]),!e.length)return this;this._opening=!0;for(var r,s=e.length,a=0,l=0,c=function(){if(a+l===s)if(a){!n._firstOpen&&n.preserveViewport||(n.viewport.goHome(!0),n.viewport.update()),n._firstOpen=!1;var t=e[0];if(t.tileSource&&(t=t.tileSource),n.overlays&&!n.preserveOverlays)for(var i=0;i<n.overlays.length;i++)n.currentOverlays[i]=o(n,n.overlays[i]);n._drawOverlays(),n._opening=!1,n.raiseEvent("open",{source:t})}else n._opening=!1,n.raiseEvent("open-failed",r)},u=function(e){t.isPlainObject(e)&&e.tileSource||(e={tileSource:e}),void 0!==e.index&&(t.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"),delete e.index),void 0===e.collectionImmediately&&(e.collectionImmediately=!0);var i=e.success;e.success=function(t){if(a++,e.tileSource.overlays)for(var o=0;o<e.tileSource.overlays.length;o++)n.addOverlay(e.tileSource.overlays[o]);i&&i(t),c()};var o=e.error;e.error=function(t){l++,r||(r=t),o&&o(t),c()},n.addTiledImage(e)},h=0;h<e.length;h++)u(e[h]);return this},close:function(){return e[this.hash]?(this._opening=!1,this.navigator&&this.navigator.close(),this.preserveOverlays||(this.clearOverlays(),this.overlaysContainer.innerHTML=""),e[this.hash].animating=!1,this.world.removeAll(),this.imageLoader.clear(),this.raiseEvent("close"),this):this},destroy:function(){if(e[this.hash]){if(this.raiseEvent("before-destroy"),this._removeUpdatePixelDensityRatioEvent(),this.close(),this.clearOverlays(),this.overlaysContainer.innerHTML="",this._resizeObserver&&this._resizeObserver.disconnect(),this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null),null!==this._updateRequestId&&(t.cancelAnimationFrame(this._updateRequestId),this._updateRequestId=null),this.drawer&&this.drawer.destroy(),this.navigator&&(this.navigator.destroy(),e[this.navigator.hash]=null,delete e[this.navigator.hash],this.navigator=null),this.buttonGroup)this.buttonGroup.destroy();else if(this.customButtons)for(;this.customButtons.length;)this.customButtons.pop().destroy();if(this.paging&&this.paging.destroy(),this.element)for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.container.onsubmit=null,this.clearControls(),this.innerTracker&&this.innerTracker.destroy(),this.outerTracker&&this.outerTracker.destroy(),e[this.hash]=null,delete e[this.hash],this.canvas=null,this.container=null,t._viewers.delete(this.element),this.element=null,this.raiseEvent("destroy"),this.removeAllHandlers()}},isMouseNavEnabled:function(){return this.innerTracker.isTracking()},setMouseNavEnabled:function(t){return this.innerTracker.setTracking(t),this.outerTracker.setTracking(t),this.raiseEvent("mouse-enabled",{enabled:t}),this},areControlsEnabled:function(){var t,e=this.controls.length;for(t=0;t<this.controls.length;t++)e=e&&this.controls[t].isVisible();return e},setControlsEnabled:function(t){return t?c(this):l(this),this.raiseEvent("controls-enabled",{enabled:t}),this},setDebugMode:function(t){for(var e=0;e<this.world.getItemCount();e++)this.world.getItemAt(e).debugMode=t;this.debugMode=t,this.forceRedraw()},isFullPage:function(){return e[this.hash].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 c={fullPage:i,preventDefaultAction:!1};if(this.raiseEvent("pre-full-page",c),c.preventDefaultAction)return this;if(i){for(this.elementSize=t.getElementSize(this.element),this.pageScroll=t.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.bodyDisplay=s.display,s.display="block",this.previousBody=[],e[this.hash].prevElementParent=this.element.parentNode,e[this.hash].prevNextSibling=this.element.nextSibling,e[this.hash].prevElementWidth=this.element.style.width,e[this.hash].prevElementHeight=this.element.style.height,n=r.childNodes.length,o=0;o<n;o++)this.previousBody.push(r.childNodes[0]),r.removeChild(r.childNodes[0]);this.toolbar&&this.toolbar.element&&(this.toolbar.parentNode=this.toolbar.element.parentNode,this.toolbar.nextSibling=this.toolbar.element.nextSibling,r.appendChild(this.toolbar.element),t.addClass(this.toolbar.element,"fullpage")),t.addClass(this.element,"fullpage"),r.appendChild(this.element),this.element.style.height="100vh",this.element.style.width="100vw",this.toolbar&&this.toolbar.element&&(this.element.style.height=t.getElementSize(this.element).y-t.getElementSize(this.toolbar.element).y+"px"),e[this.hash].fullPage=!0,t.delegate(this,R)({})}else{for(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,s.display=this.bodyDisplay,r.removeChild(this.element),n=this.previousBody.length,o=0;o<n;o++)r.appendChild(this.previousBody.shift());t.removeClass(this.element,"fullpage"),e[this.hash].prevElementParent.insertBefore(this.element,e[this.hash].prevNextSibling),this.toolbar&&this.toolbar.element&&(r.removeChild(this.toolbar.element),t.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=e[this.hash].prevElementWidth,this.element.style.height=e[this.hash].prevElementHeight;var u=0,h=function(){t.setPageScroll(l.pageScroll);var e=t.getPageScroll();++u<10&&(e.x!==l.pageScroll.x||e.y!==l.pageScroll.y)&&t.requestAnimationFrame(h)};t.requestAnimationFrame(h),e[this.hash].fullPage=!1,t.delegate(this,_)({})}return this.navigator&&this.viewport&&this.navigator.update(this.viewport),this.raiseEvent("full-page",{fullPage:i}),this},setFullScreen:function(e){var i=this;if(!t.supportsFullScreen)return this.setFullPage(e);if(t.isFullScreen()===e)return this;var n={fullScreen:e,preventDefaultAction:!1};if(this.raiseEvent("pre-full-screen",n),n.preventDefaultAction)return this;if(e){if(this.setFullPage(!0),!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 e=t.isFullScreen();e||(t.removeEvent(document,t.fullScreenEventName,o),t.removeEvent(document,t.fullScreenErrorEventName,o),i.setFullPage(!1),i.isFullPage()&&(i.element.style.width=i.fullPageStyleWidth,i.element.style.height=i.fullPageStyleHeight)),i.navigator&&i.viewport&&setTimeout((function(){i.navigator.update(i.viewport)})),i.raiseEvent("full-screen",{fullScreen:e})};t.addEvent(document,t.fullScreenEventName,o),t.addEvent(document,t.fullScreenErrorEventName,o),t.requestFullScreen(document.body)}else t.exitFullScreen();return this},isVisible:function(){return"hidden"!==this.container.style.visibility},isFullScreen:function(){return t.isFullScreen()&&this.isFullPage()},setVisible:function(t){return this.container.style.visibility=t?"":"hidden",this.raiseEvent("visible",{visible:t}),this},addTiledImage:function(e){t.console.assert(e,"[Viewer.addTiledImage] options is required"),t.console.assert(e.tileSource,"[Viewer.addTiledImage] options.tileSource is required"),t.console.assert(!e.replace||e.index>-1&&e.index<this.world.getItemCount(),"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");var i=this;e.replace&&(e.replaceItem=i.world.getItemAt(e.index)),this._hideMessage(),void 0===e.placeholderFillStyle&&(e.placeholderFillStyle=this.placeholderFillStyle),void 0===e.opacity&&(e.opacity=this.opacity),void 0===e.preload&&(e.preload=this.preload),void 0===e.compositeOperation&&(e.compositeOperation=this.compositeOperation),void 0===e.crossOriginPolicy&&(e.crossOriginPolicy=void 0!==e.tileSource.crossOriginPolicy?e.tileSource.crossOriginPolicy:this.crossOriginPolicy),void 0===e.ajaxWithCredentials&&(e.ajaxWithCredentials=this.ajaxWithCredentials),void 0===e.loadTilesWithAjax&&(e.loadTilesWithAjax=this.loadTilesWithAjax),void 0===e.ajaxHeaders||null===e.ajaxHeaders?e.ajaxHeaders=this.ajaxHeaders:t.isPlainObject(e.ajaxHeaders)&&t.isPlainObject(this.ajaxHeaders)&&(e.ajaxHeaders=t.extend({},this.ajaxHeaders,e.ajaxHeaders));var n={options:e};function o(t){for(var o=0;o<i._loadQueue.length;o++)if(i._loadQueue[o]===n){i._loadQueue.splice(o,1);break}0===i._loadQueue.length&&r(n),i.raiseEvent("add-item-failed",t),e.error&&e.error(t)}function r(t){i.collectionMode&&(i.world.arrange({immediately:t.options.collectionImmediately,rows:i.collectionRows,columns:i.collectionColumns,layout:i.collectionLayout,tileSize:i.collectionTileSize,tileMargin:i.collectionTileMargin}),i.world.setAutoRefigureSizes(!0))}function s(){for(var e,n,o;i._loadQueue.length&&(e=i._loadQueue[0]).tileSource;){if(i._loadQueue.splice(0,1),e.options.replace){var s=i.world.getIndexOfItem(e.options.replaceItem);-1!==s&&(e.options.index=s),i.world.removeItem(e.options.replaceItem)}n=new t.TiledImage({viewer:i,source:e.tileSource,viewport:i.viewport,drawer:i.drawer,tileCache:i.tileCache,imageLoader:i.imageLoader,x:e.options.x,y:e.options.y,width:e.options.width,height:e.options.height,fitBounds:e.options.fitBounds,fitBoundsPlacement:e.options.fitBoundsPlacement,clip:e.options.clip,placeholderFillStyle:e.options.placeholderFillStyle,opacity:e.options.opacity,preload:e.options.preload,degrees:e.options.degrees,flipped:e.options.flipped,compositeOperation:e.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:e.options.crossOriginPolicy,ajaxWithCredentials:e.options.ajaxWithCredentials,loadTilesWithAjax:e.options.loadTilesWithAjax,ajaxHeaders:e.options.ajaxHeaders,debugMode:i.debugMode,subPixelRoundingForTransparency:i.subPixelRoundingForTransparency}),i.collectionMode&&i.world.setAutoRefigureSizes(!1),i.navigator&&(o=t.extend({},e.options,{replace:!1,originalTiledImage:n,tileSource:e.tileSource}),i.navigator.addTiledImage(o)),i.world.addItem(n,{index:e.options.index}),0===i._loadQueue.length&&r(e),1!==i.world.getItemCount()||i.preserveViewport||i.viewport.goHome(!0),e.options.success&&e.options.success({item:n})}}t.isArray(e.tileSource)?setTimeout((function(){o({message:"[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.",source:e.tileSource,options:e})})):(this._loadQueue.push(n),function(e,i,n,o,r){var s=e;if("string"===t.type(i))if(i.match(/^\s*<.*>\s*$/))i=t.parseXml(i);else if(i.match(/^\s*[{[].*[}\]]\s*$/))try{var a=t.parseJSON(i);i=a}catch(c){}function l(t,e){t.ready?o(t):(t.addHandler("ready",(function(){o(t)})),t.addHandler("open-failed",(function(t){r({message:t.message,source:e})})))}setTimeout((function(){if("string"===t.type(i))(i=new t.TileSource({url:i,crossOriginPolicy:void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,ajaxHeaders:n.ajaxHeaders?n.ajaxHeaders:e.ajaxHeaders,splitHashDataForPost:e.splitHashDataForPost,useCanvas:e.useCanvas,success:function(t){o(t.tileSource)}})).addHandler("open-failed",(function(t){r(t)}));else if(t.isPlainObject(i)||i.nodeType)if(void 0!==i.crossOriginPolicy||void 0===n.crossOriginPolicy&&void 0===e.crossOriginPolicy||(i.crossOriginPolicy=void 0!==n.crossOriginPolicy?n.crossOriginPolicy:e.crossOriginPolicy),void 0===i.ajaxWithCredentials&&(i.ajaxWithCredentials=e.ajaxWithCredentials),void 0===i.useCanvas&&(i.useCanvas=e.useCanvas),t.isFunction(i.getTileUrl)){var a=new t.TileSource(i);a.getTileUrl=i.getTileUrl,o(a)}else{var c=t.TileSource.determineType(s,i);if(!c)return void r({message:"Unable to load TileSource",source:i});var u=c.prototype.configure.apply(s,[i]);l(new c(u),i)}else l(i,i)}))}(this,e.tileSource,e,(function(t){n.tileSource=t,s()}),(function(t){t.options=e,o(t),s()})))},addSimpleImage:function(e){t.console.assert(e,"[Viewer.addSimpleImage] options is required"),t.console.assert(e.url,"[Viewer.addSimpleImage] options.url is required");var i=t.extend({},e,{tileSource:{type:"image",url:e.url}});delete i.url,this.addTiledImage(i)},addLayer:function(e){var i=this;t.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var n=t.extend({},e,{success:function(t){i.raiseEvent("add-layer",{options:e,drawer:t.item})},error:function(t){i.raiseEvent("add-layer-failed",t)}});return this.addTiledImage(n),this},getLayerAtLevel:function(e){return t.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(e)},getLevelOfLayer:function(e){return t.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(e)},getLayersCount:function(){return t.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(e,i){return t.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(e,i)},removeLayer:function(e){return t.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(e)},forceRedraw:function(){return e[this.hash].forceRedraw=!0,this},forceResize:function(){e[this.hash].needsResize=!0,e[this.hash].forceResize=!0},bindSequenceControls:function(){var e=t.delegate(this,u),i=t.delegate(this,h),n=t.delegate(this,this.goToNextPage),o=t.delegate(this,this.goToPreviousPage),r=this.navImages,s=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(s=!1),this.previousButton=new t.Button({element:this.previousButton?t.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.PreviousPage"),srcRest:I(this.prefixUrl,r.previous.REST),srcGroup:I(this.prefixUrl,r.previous.GROUP),srcHover:I(this.prefixUrl,r.previous.HOVER),srcDown:I(this.prefixUrl,r.previous.DOWN),onRelease:o,onFocus:e,onBlur:i}),this.nextButton=new t.Button({element:this.nextButton?t.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.NextPage"),srcRest:I(this.prefixUrl,r.next.REST),srcGroup:I(this.prefixUrl,r.next.GROUP),srcHover:I(this.prefixUrl,r.next.HOVER),srcDown:I(this.prefixUrl,r.next.DOWN),onRelease:n,onFocus:e,onBlur:i}),this.navPrevNextWrap||this.previousButton.disable(),this.tileSources&&this.tileSources.length||this.nextButton.disable(),s&&(this.paging=new t.ButtonGroup({buttons:[this.previousButton,this.nextButton],clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.pagingControl=this.paging.element,this.toolbar?this.toolbar.addControl(this.pagingControl,{anchor:t.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||t.ControlAnchor.TOP_LEFT}))),this},bindStandardControls:function(){var e=t.delegate(this,D),i=t.delegate(this,M),n=t.delegate(this,B),o=t.delegate(this,k),r=t.delegate(this,H),s=t.delegate(this,z),a=t.delegate(this,N),l=t.delegate(this,F),c=t.delegate(this,V),p=t.delegate(this,W),d=t.delegate(this,u),f=t.delegate(this,h),g=this.navImages,v=[],m=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(m=!1),this.showZoomControl&&(v.push(this.zoomInButton=new t.Button({element:this.zoomInButton?t.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomIn"),srcRest:I(this.prefixUrl,g.zoomIn.REST),srcGroup:I(this.prefixUrl,g.zoomIn.GROUP),srcHover:I(this.prefixUrl,g.zoomIn.HOVER),srcDown:I(this.prefixUrl,g.zoomIn.DOWN),onPress:e,onRelease:i,onClick:n,onEnter:e,onExit:i,onFocus:d,onBlur:f})),v.push(this.zoomOutButton=new t.Button({element:this.zoomOutButton?t.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.ZoomOut"),srcRest:I(this.prefixUrl,g.zoomOut.REST),srcGroup:I(this.prefixUrl,g.zoomOut.GROUP),srcHover:I(this.prefixUrl,g.zoomOut.HOVER),srcDown:I(this.prefixUrl,g.zoomOut.DOWN),onPress:o,onRelease:i,onClick:r,onEnter:o,onExit:i,onFocus:d,onBlur:f}))),this.showHomeControl&&v.push(this.homeButton=new t.Button({element:this.homeButton?t.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Home"),srcRest:I(this.prefixUrl,g.home.REST),srcGroup:I(this.prefixUrl,g.home.GROUP),srcHover:I(this.prefixUrl,g.home.HOVER),srcDown:I(this.prefixUrl,g.home.DOWN),onRelease:s,onFocus:d,onBlur:f})),this.showFullPageControl&&v.push(this.fullPageButton=new t.Button({element:this.fullPageButton?t.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.FullPage"),srcRest:I(this.prefixUrl,g.fullpage.REST),srcGroup:I(this.prefixUrl,g.fullpage.GROUP),srcHover:I(this.prefixUrl,g.fullpage.HOVER),srcDown:I(this.prefixUrl,g.fullpage.DOWN),onRelease:a,onFocus:d,onBlur:f})),this.showRotationControl&&(v.push(this.rotateLeftButton=new t.Button({element:this.rotateLeftButton?t.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateLeft"),srcRest:I(this.prefixUrl,g.rotateleft.REST),srcGroup:I(this.prefixUrl,g.rotateleft.GROUP),srcHover:I(this.prefixUrl,g.rotateleft.HOVER),srcDown:I(this.prefixUrl,g.rotateleft.DOWN),onRelease:l,onFocus:d,onBlur:f})),v.push(this.rotateRightButton=new t.Button({element:this.rotateRightButton?t.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.RotateRight"),srcRest:I(this.prefixUrl,g.rotateright.REST),srcGroup:I(this.prefixUrl,g.rotateright.GROUP),srcHover:I(this.prefixUrl,g.rotateright.HOVER),srcDown:I(this.prefixUrl,g.rotateright.DOWN),onRelease:c,onFocus:d,onBlur:f}))),this.showFlipControl&&v.push(this.flipButton=new t.Button({element:this.flipButton?t.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:t.getString("Tooltips.Flip"),srcRest:I(this.prefixUrl,g.flip.REST),srcGroup:I(this.prefixUrl,g.flip.GROUP),srcHover:I(this.prefixUrl,g.flip.HOVER),srcDown:I(this.prefixUrl,g.flip.DOWN),onRelease:p,onFocus:d,onBlur:f})),m?(this.buttonGroup=new t.ButtonGroup({buttons:v,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttonGroup.element,this.addHandler("open",t.delegate(this,j)),this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||t.ControlAnchor.TOP_LEFT})):this.customButtons=v),this},currentPage:function(){return this._sequenceIndex},goToPage:function(t){return this.tileSources&&t>=0&&t<this.tileSources.length&&(this._sequenceIndex=t,this._updateSequenceButtons(t),this.open(this.tileSources[t]),this.referenceStrip&&this.referenceStrip.setFocus(t),this.raiseEvent("page",{page:t})),this},addOverlay:function(e,i,n,s){var a;if(a=t.isPlainObject(e)?e:{element:e,location:i,placement:n,onDraw:s},e=t.getElement(a.element),r(this.currentOverlays,e)>=0)return this;var l=o(this,a);return this.currentOverlays.push(l),l.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:e,location:a.location,placement:a.placement}),this},updateOverlay:function(i,n,o){var s;return i=t.getElement(i),(s=r(this.currentOverlays,i))>=0&&(this.currentOverlays[s].update(n,o),e[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:i,location:n,placement:o})),this},removeOverlay:function(i){var n;return i=t.getElement(i),(n=r(this.currentOverlays,i))>=0&&(this.currentOverlays[n].destroy(),this.currentOverlays.splice(n,1),e[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:i})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return e[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(e){var i;return e=t.getElement(e),(i=r(this.currentOverlays,e))>=0?this.currentOverlays[i]:null},_updateSequenceButtons:function(t){this.nextButton&&(this.tileSources&&this.tileSources.length-1!==t?this.nextButton.enable():this.navPrevNextWrap||this.nextButton.disable()),this.previousButton&&(t>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(e){this._hideMessage();var i=t.makeNeutralElement("div");i.appendChild(document.createTextNode(e)),this.messageDiv=t.makeCenteredNode(i),t.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var t=this.messageDiv;t&&(t.parentNode.removeChild(t),delete this.messageDiv)},gestureSettingsByDeviceType:function(t){switch(t){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var t,e=this.currentOverlays.length;for(t=0;t<e;t++)this.currentOverlays[t].drawHTML(this.overlaysContainer,this.viewport)},_cancelPendingImages:function(){this._loadQueue=[]},removeReferenceStrip:function(){this.showReferenceStrip=!1,this.referenceStrip&&(this.referenceStrip.destroy(),this.referenceStrip=null)},addReferenceStrip:function(){if(this.showReferenceStrip=!0,this.sequenceMode){if(this.referenceStrip)return;this.tileSources.length&&this.tileSources.length>1&&(this.referenceStrip=new t.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,useCanvas:this.useCanvas,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else t.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')},_addUpdatePixelDensityRatioEvent:function(){this._updatePixelDensityRatioBind=this._updatePixelDensityRatio.bind(this),t.addEvent(window,"resize",this._updatePixelDensityRatioBind)},_removeUpdatePixelDensityRatioEvent:function(){t.removeEvent(window,"resize",this._updatePixelDensityRatioBind)},_updatePixelDensityRatio:function(){var e=t.pixelDensityRatio,i=t.getCurrentPixelDensityRatio();e!==i&&(t.pixelDensityRatio=i,this.world.resetItems(),this.forceRedraw())},goToPreviousPage:function(){var t=this._sequenceIndex-1;this.navPrevNextWrap&&t<0&&(t+=this.tileSources.length),this.goToPage(t)},goToNextPage:function(){var t=this._sequenceIndex+1;this.navPrevNextWrap&&t>=this.tileSources.length&&(t=0),this.goToPage(t)},isAnimating:function(){return e[this.hash].animating}})}(l),function(t){function e(t){var e={tracker:t.eventSource,position:t.position,quick:t.quick,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};if(this.viewer.raiseEvent("navigator-click",e),!e.preventDefaultAction&&t.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(t.position.x=this.viewport.getContainerSize().x-t.position.x);var i=this.viewport.pointFromPixel(t.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(t){var e={tracker:t.eventSource,position:t.position,delta:t.delta,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent,preventDefaultAction:!1};this.viewer.raiseEvent("navigator-drag",e),!e.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(t.delta.x=0),this.panVertical||(t.delta.y=0),this.viewer.viewport.flipped&&(t.delta.x=-t.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(t.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function n(t){t.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function o(t){var e={tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent,preventDefault:t.preventDefault};this.viewer.raiseEvent("navigator-scroll",e),t.preventDefault=e.preventDefault}function r(t,e){s(t,"rotate("+e+"deg)")}function s(t,e){t.style.webkitTransform=e,t.style.mozTransform=e,t.style.msTransform=e,t.style.oTransform=e,t.style.transform=e}t.Navigator=function(s){var a,l,c,u,h=s.viewer,p=this;function d(t){r(p.displayRegionContainer,t),r(p.displayRegion,-t),p.viewport.setRotation(t)}(s.element||s.id?(s.element?(s.id&&t.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead."),s.element.id?s.id=s.element.id:s.id="navigator-"+t.now(),this.element=s.element):this.element=document.getElementById(s.id),s.controlOptions={anchor:t.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(s.id="navigator-"+t.now(),this.element=t.makeNeutralElement("div"),s.controlOptions={anchor:t.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:s.autoFade},s.position&&("BOTTOM_RIGHT"===s.position?s.controlOptions.anchor=t.ControlAnchor.BOTTOM_RIGHT:"BOTTOM_LEFT"===s.position?s.controlOptions.anchor=t.ControlAnchor.BOTTOM_LEFT:"TOP_RIGHT"===s.position?s.controlOptions.anchor=t.ControlAnchor.TOP_RIGHT:"TOP_LEFT"===s.position?s.controlOptions.anchor=t.ControlAnchor.TOP_LEFT:"ABSOLUTE"===s.position&&(s.controlOptions.anchor=t.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=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.navigatorSizeRatio},s,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:s.animationTime,autoResize:!1,minZoomImageRatio:1,background:s.background,opacity:s.opacity,borderColor:s.borderColor,displayRegionColor:s.displayRegionColor})).minPixelRatio=this.minPixelRatio=h.minPixelRatio,t.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new t.Point(1,1),this.totalBorderWidths=new t.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge),s.controlOptions.anchor!==t.ControlAnchor.NONE&&(c=this.element.style,u=this.borderWidth,c.margin="0px",c.border=u+"px solid "+s.borderColor,c.padding="0px",c.background=s.background,c.opacity=s.opacity,c.overflow="hidden"),this.displayRegion=t.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(t,e){t.position="relative",t.top="0px",t.left="0px",t.fontSize="0px",t.overflow="hidden",t.border=e+"px solid "+s.displayRegionColor,t.margin="0px",t.padding="0px",t.background="transparent",t.float="left",t.cssFloat="left",t.styleFloat="left",t.zIndex=999999999,t.cursor="default"}(this.displayRegion.style,this.borderWidth),t.setElementPointerEventsNone(this.displayRegion),t.setElementTouchActionNone(this.displayRegion),this.displayRegionContainer=t.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",t.setElementPointerEventsNone(this.displayRegionContainer),t.setElementTouchActionNone(this.displayRegionContainer),h.addControl(this.element,s.controlOptions),this._resizeWithViewer=s.controlOptions.anchor!==t.ControlAnchor.ABSOLUTE&&s.controlOptions.anchor!==t.ControlAnchor.NONE,s.width&&s.height?(this.setWidth(s.width),this.setHeight(s.height)):this._resizeWithViewer&&(a=t.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=t.getElementSize(this.element),this.elementArea=l.x*l.y),this.oldContainerSize=new t.Point(0,0),t.Viewer.apply(this,[s]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer),s.navigatorRotate)&&(d(s.viewer.viewport?s.viewer.viewport.getRotation():s.viewer.degrees||0),s.viewer.addHandler("rotate",(function(t){d(t.degrees)})));this.innerTracker.destroy(),this.innerTracker=new t.MouseTracker({userData:"Navigator.innerTracker",element:this.element,dragHandler:t.delegate(this,i),clickHandler:t.delegate(this,e),releaseHandler:t.delegate(this,n),scrollHandler:t.delegate(this,o),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),this.outerTracker.userData="Navigator.outerTracker",t.setElementPointerEventsNone(this.canvas),t.setElementPointerEventsNone(this.container),this.addHandler("reset-size",(function(){p.viewport&&p.viewport.goHome(!0)})),h.world.addHandler("item-index-change",(function(t){window.setTimeout((function(){var e=p.world.getItemAt(t.previousIndex);p.world.setItemIndex(e,t.newIndex)}),1)})),h.world.addHandler("remove-item",(function(t){var e=t.item,i=p._getMatchingItem(e);i&&p.world.removeItem(i)})),this.update(h.viewport)},t.extend(t.Navigator.prototype,t.EventSource.prototype,t.Viewer.prototype,{updateSize:function(){if(this.viewport){var e=new t.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);e.equals(this.oldContainerSize)||(this.viewport.resize(e,!0),this.viewport.goHome(!0),this.oldContainerSize=e,this.drawer.clear(),this.world.draw())}},setWidth:function(t){this.width=t,this.element.style.width="number"==typeof t?t+"px":t,this._resizeWithViewer=!1},setHeight:function(t){this.height=t,this.element.style.height="number"==typeof t?t+"px":t,this._resizeWithViewer=!1},setFlip:function(t){return this.viewport.setFlip(t),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(t){s(this.displayRegion,t),s(this.canvas,t),s(this.element,t)},update:function(e){var i,n,o,r,s,a;if(i=t.getElementSize(this.viewer.element),this._resizeWithViewer&&i.x&&i.y&&!i.equals(this.oldViewerSize)&&(this.oldViewerSize=i,this.maintainSizeRatio||!this.elementArea?(n=i.x*this.sizeRatio,o=i.y*this.sizeRatio):(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()),e&&this.viewport){r=e.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 c=Math.abs(s.x-a.x),u=Math.abs(s.y-a.y);l.width=Math.round(Math.max(c,0))+"px",l.height=Math.round(Math.max(u,0))+"px"}},addTiledImage:function(e){var i=this,n=e.originalTiledImage;delete e.original;var o=t.extend({},e,{success:function(t){var e=t.item;function o(){i._matchBounds(e,n)}e._originalForNavigator=n,i._matchBounds(e,n,!0),i._matchOpacity(e,n),i._matchCompositeOperation(e,n),n.addHandler("bounds-change",o),n.addHandler("clip-change",o),n.addHandler("opacity-change",(function(){i._matchOpacity(e,n)})),n.addHandler("composite-operation-change",(function(){i._matchCompositeOperation(e,n)}))}});return t.Viewer.prototype.addTiledImage.apply(this,[o])},destroy:function(){return t.Viewer.prototype.destroy.apply(this)},_getMatchingItem:function(t){for(var e,i=this.world.getItemCount(),n=0;n<i;n++)if((e=this.world.getItemAt(n))._originalForNavigator===t)return e;return null},_matchBounds:function(t,e,i){var n=e.getBoundsNoRotate();t.setPosition(n.getTopLeft(),i),t.setWidth(n.width,i),t.setRotation(e.getRotation(),i),t.setClip(e.getClip()),t.setFlip(e.getFlip())},_matchOpacity:function(t,e){t.setOpacity(e.opacity)},_matchCompositeOperation:function(t,e){t.setCompositeOperation(e.compositeOperation)}})}(l),function(t){var e={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"}};t.extend(t,{getString:function(i){var n,o=i.split("."),r=null,s=arguments,a=e;for(n=0;n<o.length-1;n++)a=a[o[n]]||{};return"string"!=typeof(r=a[o[n]])&&(t.console.error("Untranslated source string:",i),r=""),r.replace(/\{\d+\}/g,(function(t){var e=parseInt(t.match(/\d+/),10)+1;return e<s.length?s[e]:""}))},setString:function(t,i){var n,o=t.split("."),r=e;for(n=0;n<o.length-1;n++)r[o[n]]||(r[o[n]]={}),r=r[o[n]];r[o[n]]=i}})}(l),function(t){t.Point=function(t,e){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0},t.Point.prototype={clone:function(){return new t.Point(this.x,this.y)},plus:function(e){return new t.Point(this.x+e.x,this.y+e.y)},minus:function(e){return new t.Point(this.x-e.x,this.y-e.y)},times:function(e){return new t.Point(this.x*e,this.y*e)},divide:function(e){return new t.Point(this.x/e,this.y/e)},negate:function(){return new t.Point(-this.x,-this.y)},distanceTo:function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},squaredDistanceTo:function(t){return Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2)},apply:function(e){return new t.Point(e(this.x),e(this.y))},equals:function(e){return e instanceof t.Point&&this.x===e.x&&this.y===e.y},rotate:function(e,i){var n,o;if(i=i||new t.Point(0,0),e%90==0){switch(t.positiveModulo(e,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=e*Math.PI/180;n=Math.cos(r),o=Math.sin(r)}var s=n*(this.x-i.x)-o*(this.y-i.y)+i.x,a=o*(this.x-i.x)+n*(this.y-i.y)+i.y;return new t.Point(s,a)},toString:function(){return"("+Math.round(100*this.x)/100+","+Math.round(100*this.y)/100+")"}}}(l),function(t){t.TileSource=function(e,i,n,o,r,s){var a,l,c=this,u=arguments;if(a=t.isPlainObject(e)?e:{width:u[0],height:u[1],tileSize:u[2],tileOverlap:u[3],minLevel:u[4],maxLevel:u[5]},t.EventSource.call(this),t.extend(!0,this,a),!this.success)for(l=0;l<arguments.length;l++)if(t.isFunction(arguments[l])){this.success=arguments[l];break}this.success&&this.addHandler("ready",(function(t){c.success(t)})),"string"===t.type(arguments[0])&&(this.url=arguments[0]),this.url?(this.aspectRatio=1,this.dimensions=new t.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)):(this.ready=!0,this.aspectRatio=a.width&&a.height?a.width/a.height:1,this.dimensions=new t.Point(a.width,a.height),this.tileSize?(this._tileWidth=this._tileHeight=this.tileSize,delete this.tileSize):(this.tileWidth?(this._tileWidth=this.tileWidth,delete this.tileWidth):this._tileWidth=0,this.tileHeight?(this._tileHeight=this.tileHeight,delete this.tileHeight):this._tileHeight=0),this.tileOverlap=a.tileOverlap?a.tileOverlap:0,this.minLevel=a.minLevel?a.minLevel:0,this.maxLevel=void 0!==a.maxLevel&&null!==a.maxLevel?a.maxLevel:a.width&&a.height?Math.ceil(Math.log(Math.max(a.width,a.height))/Math.log(2)):0,this.success&&t.isFunction(this.success)&&this.success(this))},t.TileSource.prototype={getTileSize:function(e){return t.console.error("[TileSource.getTileSize] is deprecated. Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"),this._tileWidth},getTileWidth:function(t){return this._tileWidth?this._tileWidth:this.getTileSize(t)},getTileHeight:function(t){return this._tileHeight?this._tileHeight:this.getTileSize(t)},setMaxLevel:function(t){this.maxLevel=t,this._memoizeLevelScale()},getLevelScale:function(t){return this._memoizeLevelScale(),this.getLevelScale(t)},_memoizeLevelScale:function(){var t,e={};for(t=0;t<=this.maxLevel;t++)e[t]=1/Math.pow(2,this.maxLevel-t);this.getLevelScale=function(t){return e[t]}},getNumTiles:function(e){var i=this.getLevelScale(e),n=Math.ceil(i*this.dimensions.x/this.getTileWidth(e)),o=Math.ceil(i*this.dimensions.y/this.getTileHeight(e));return new t.Point(n,o)},getPixelRatio:function(e){var i=this.dimensions.times(this.getLevelScale(e)),n=1/i.x*t.pixelDensityRatio,o=1/i.y*t.pixelDensityRatio;return new t.Point(n,o)},getClosestLevel:function(){var t,e;for(t=this.minLevel+1;t<=this.maxLevel&&!((e=this.getNumTiles(t)).x>1||e.y>1);t++);return t-1},getTileAtPoint:function(e,i){var n=i.x>=0&&i.x<=1&&i.y>=0&&i.y<=1/this.aspectRatio;t.console.assert(n,"[TileSource.getTileAtPoint] must be called with a valid point.");var o=this.dimensions.x*this.getLevelScale(e),r=i.x*o,s=i.y*o,a=Math.floor(r/this.getTileWidth(e)),l=Math.floor(s/this.getTileHeight(e));i.x>=1&&(a=this.getNumTiles(e).x-1);return i.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(e).y-1),new t.Point(a,l)},getTileBounds:function(e,i,n,o){var r=this.dimensions.times(this.getLevelScale(e)),s=this.getTileWidth(e),a=this.getTileHeight(e),l=0===i?0:s*i-this.tileOverlap,c=0===n?0:a*n-this.tileOverlap,u=s+(0===i?1:2)*this.tileOverlap,h=a+(0===n?1:2)*this.tileOverlap,p=1/r.x;return u=Math.min(u,r.x-l),h=Math.min(h,r.y-c),o?new t.Rect(0,0,u,h):new t.Rect(l*p,c*p,u*p,h*p)},getImageInfo:function(e){var i,n,o,r,s,a,l,c=this;e&&(l=(a=(s=e.split("/"))[s.length-1]).lastIndexOf("."))>-1&&(s[s.length-1]=a.slice(0,l));var u=null;if(this.splitHashDataForPost){var h=e.indexOf("#");-1!==h&&(u=e.substring(h+1),e=e.substr(0,h))}n=function(i){"string"==typeof i&&(i=t.parseXml(i));var n=t.TileSource.determineType(c,i,e);n?(void 0===(r=n.prototype.configure.apply(c,[i,e,u])).ajaxWithCredentials&&(r.ajaxWithCredentials=c.ajaxWithCredentials),o=new n(r),c.ready=!0,c.raiseEvent("ready",{tileSource:o})):c.raiseEvent("open-failed",{message:"Unable to load TileSource",source:e})},e.match(/\.js$/)?(i=e.split("/").pop().replace(".js",""),t.jsonp({url:e,async:!1,callbackName:i,callback:n})):t.makeAjaxRequest({url:e,postData:u,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(e){var i=function(e){var i,n,o=e.responseText,r=e.status;if(!e)throw new Error(t.getString("Errors.Security"));if(200!==e.status&&0!==e.status)throw i=404===(r=e.status)?"Not Found":e.statusText,new Error(t.getString("Errors.Status",r,i));if(o.match(/\s*<.*/))try{n=e.responseXML&&e.responseXML.documentElement?e.responseXML:t.parseXml(o)}catch(s){n=e.responseText}else if(o.match(/\s*[{[].*/))try{n=t.parseJSON(o)}catch(s){n=o}else n=o;return n}(e);n(i)},error:function(i,n){var o;try{o="HTTP "+i.status+" attempting to load TileSource: "+e}catch(r){o=(void 0!==n&&n.toString?n.toString():"Unknown error")+" attempting to load TileSource: "+e}t.console.error(o),c.raiseEvent("open-failed",{message:o,source:e,postData:u})}})},supports:function(t,e){return!1},configure:function(t,e,i){throw new Error("Method not implemented.")},getTileUrl:function(t,e,i){throw new Error("Method not implemented.")},getTilePostData:function(t,e,i){return null},getTileAjaxHeaders:function(t,e,i){return{}},getTileHashKey:function(t,e,i,n,o,r){function s(t){return o?t+"+"+JSON.stringify(o):t}return s("string"!=typeof n?t+"/"+e+"_"+i:n)},tileExists:function(t,e,i){var n=this.getNumTiles(t);return t>=this.minLevel&&t<=this.maxLevel&&e>=0&&i>=0&&e<n.x&&i<n.y},hasTransparency:function(t,e,i,n){return!!t||e.match(".png")},downloadTileStart:function(e){var i=e.userData,n=new Image;i.image=n,i.request=null;var o=function(t){n?(n.onload=n.onerror=n.onabort=null,e.finish(t?null:n,i.request,t)):e.finish(null,i.request,"Image load failed: undefined Image instance.")};n.onload=function(){o()},n.onabort=n.onerror=function(){o("Image load aborted.")},e.loadWithAjax?i.request=t.makeAjaxRequest({url:e.src,withCredentials:e.ajaxWithCredentials,headers:e.ajaxHeaders,responseType:"arraybuffer",postData:e.postData,success:function(t){var e;try{e=new window.Blob([t.response])}catch(s){var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if("TypeError"===s.name&&i){var r=new i;r.append(t.response),e=r.getBlob()}}0===e.size?o("Empty image response."):n.src=(window.URL||window.webkitURL).createObjectURL(e)},error:function(t){o("Image load aborted - XHR error")}}):(!1!==e.crossOriginPolicy&&(n.crossOrigin=e.crossOriginPolicy),n.src=e.src)},downloadTileAbort:function(t){t.userData.request&&t.userData.request.abort();var e=t.userData.image;t.userData.image&&(e.onload=e.onerror=e.onabort=null)},createTileCache:function(t,e,i){t._data=e},destroyTileCache:function(t){t._data=null,t._renderedContext=null},getTileCacheData:function(t){return t._data},getTileCacheDataAsImage:function(t){return t._data},getTileCacheDataAsContext2D:function(t){if(!t._renderedContext){var e=document.createElement("canvas");e.width=t._data.width,e.height=t._data.height,t._renderedContext=e.getContext("2d"),t._renderedContext.drawImage(t._data,0,0),t._data=null;const i=e.cloneNode(!0);t._copyRenderedContext=i.getContext("2d"),t._copyRenderedContext.drawImage(e,0,0)}return t._renderedContext},getCopyTileCacheDataAsContext2D:function(t){return t._copyRenderedContext||t._renderedContext}},t.extend(!0,t.TileSource.prototype,t.EventSource.prototype),t.TileSource.determineType=function(e,i,n){var o;for(o in l)if(o.match(/.+TileSource$/)&&t.isFunction(l[o])&&t.isFunction(l[o].prototype.supports)&&l[o].prototype.supports.call(e,i,n))return l[o];return t.console.error("No TileSource was able to open %s %s",n,i),null}}(l),function(t){function e(e,i){var n,o,r=i.Image,s=r.Url,a=r.Format,l=r.Size,c=r.DisplayRect||[],u=parseInt(l.Width,10),h=parseInt(l.Height,10),p=parseInt(r.TileSize,10),d=parseInt(r.Overlap,10),f=[];for(o=0;o<c.length;o++)n=c[o].Rect,f.push(new t.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 t.extend(!0,{width:u,height:h,tileSize:p,tileOverlap:d,minLevel:null,maxLevel:null,tilesUrl:s,fileFormat:a,displayRects:f},i)}t.DziTileSource=function(e,i,n,o,r,s,a,l,c){var u,h,p,d;if(d=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4],fileFormat:arguments[5],displayRects:arguments[6],minLevel:arguments[7],maxLevel:arguments[8]},this._levelRects={},this.tilesUrl=d.tilesUrl,this.fileFormat=d.fileFormat,this.displayRects=d.displayRects,this.displayRects)for(u=this.displayRects.length-1;u>=0;u--)for(p=(h=this.displayRects[u]).minLevel;p<=h.maxLevel;p++)this._levelRects[p]||(this._levelRects[p]=[]),this._levelRects[p].push(h);t.TileSource.apply(this,[d])},t.extend(t.DziTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){var i;return t.Image?i=t.Image.xmlns:t.documentElement&&("Image"!==t.documentElement.localName&&"Image"!==t.documentElement.tagName||(i=t.documentElement.namespaceURI)),-1!==(i=(i||"").toLowerCase()).indexOf("schemas.microsoft.com/deepzoom/2008")||-1!==i.indexOf("schemas.microsoft.com/deepzoom/2009")},configure:function(i,n,o){var r;return r=t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var o,r,s,a,l,c=n.documentElement,u=c.localName||c.tagName,h=n.documentElement.namespaceURI,p=null,d=[];if("Image"===u)try{if(void 0===(a=c.getElementsByTagName("Size")[0])&&(a=c.getElementsByTagNameNS(h,"Size")[0]),p={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:c.getAttribute("Url"),Format:c.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(c.getAttribute("Overlap"),10),TileSize:parseInt(c.getAttribute("TileSize"),10),Size:{Height:parseInt(a.getAttribute("Height"),10),Width:parseInt(a.getAttribute("Width"),10)}}},!t.imageFormatSupported(p.Image.Format))throw new Error(t.getString("Errors.ImageFormat",p.Image.Format.toUpperCase()));for(void 0===(o=c.getElementsByTagName("DisplayRect"))&&(o=c.getElementsByTagNameNS(h,"DisplayRect")[0]),l=0;l<o.length;l++)void 0===(s=(r=o[l]).getElementsByTagName("Rect")[0])&&(s=r.getElementsByTagNameNS(h,"Rect")[0]),d.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)}});return d.length&&(p.Image.DisplayRect=d),e(i,p)}catch(g){throw g instanceof Error?g:new Error(t.getString("Errors.Dzi"))}else{if("Collection"===u)throw new Error(t.getString("Errors.Dzc"));if("Error"===u){var f=c.getElementsByTagName("Message")[0].firstChild.nodeValue;throw new Error(f)}}throw new Error(t.getString("Errors.Dzi"))}(this,i),n&&!r.tilesUrl&&(r.tilesUrl=n.replace(/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/,"$1_files/"),-1!==n.search(/\.(dzi|xml|js)\?/)?r.queryParams=n.match(/\?.*/):r.queryParams=""),r},getTileUrl:function(t,e,i){return[this.tilesUrl,t,"/",e,"_",i,".",this.fileFormat,this.queryParams].join("")},tileExists:function(t,e,i){var n,o,r,s,a,l,c,u=this._levelRects[t];if(this.minLevel&&t<this.minLevel||this.maxLevel&&t>this.maxLevel)return!1;if(!u||!u.length)return!0;for(c=u.length-1;c>=0;c--)if(!(t<(n=u[c]).minLevel||t>n.maxLevel)&&(o=this.getLevelScale(t),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),r<=e&&e<a&&s<=i&&i<l))return!0;return!1}})}(l),function(t){function e(t){var e=Array.isArray(t.profile)?t.profile[0]:t.profile,i=-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","level0","https://iiif.io/api/image/3/level0.json"].indexOf(e),n=!1;return 2===t.version&&t.profile.length>1&&t.profile[1].supports&&(n=-1!==t.profile[1].supports.indexOf("sizeByW")),3===t.version&&t.extraFeatures&&(n=-1!==t.extraFeatures.indexOf("sizeByWh")),!i||n}function i(t){for(var e=[],i=0;i<t.sizes.length;i++)e.push({url:t._id+"/full/"+t.sizes[i].width+","+(3===t.version?t.sizes[i].height:"")+"/0/default."+t.tileFormat,width:t.sizes[i].width,height:t.sizes[i].height});return e.sort((function(t,e){return t.width-e.width}))}function n(e,i,o){var r,s;if(3===e.nodeType&&o)(s=e.nodeValue.trim()).match(/^\d*$/)&&(s=Number(s)),i[o]?(t.isArray(i[o])||(i[o]=[i[o]]),i[o].push(s)):i[o]=s;else if(1===e.nodeType)for(r=0;r<e.childNodes.length;r++)n(e.childNodes[r],i,e.nodeName)}t.IIIFTileSource=function(n){if(t.extend(!0,this,n),this._id=this["@id"]||this.id||this.identifier||null,!(this.height&&this.width&&this._id))throw new Error("IIIF required parameters (width, height, or id) not provided.");if(n.tileSizePerScaleFactor={},this.tileFormat=this.tileFormat||"jpg",this.version=n.version,this.tile_width&&this.tile_height)n.tileWidth=this.tile_width,n.tileHeight=this.tile_height;else if(this.tile_width)n.tileSize=this.tile_width;else if(this.tile_height)n.tileSize=this.tile_height;else if(this.tiles)if(1===this.tiles.length)n.tileWidth=this.tiles[0].width,n.tileHeight=this.tiles[0].height||this.tiles[0].width,this.scale_factors=this.tiles[0].scaleFactors;else{this.scale_factors=[];for(var o=0;o<this.tiles.length;o++)for(var r=0;r<this.tiles[o].scaleFactors.length;r++){var s=this.tiles[o].scaleFactors[r];this.scale_factors.push(s),n.tileSizePerScaleFactor[s]={width:this.tiles[o].width,height:this.tiles[o].height||this.tiles[o].width}}}else if(e(n)){for(var a=Math.min(this.height,this.width),l=[256,512,1024],c=[],u=0;u<l.length;u++)l[u]<=a&&c.push(l[u]);c.length>0?n.tileSize=Math.max.apply(null,c):n.tileSize=a}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,n.levels=i(this),t.extend(!0,n,{width:n.levels[n.levels.length-1].width,height:n.levels[n.levels.length-1].height,tileSize:Math.max(n.height,n.width),tileOverlap:0,minLevel:0,maxLevel:n.levels.length-1}),this.levels=n.levels):t.console.error("Nothing in the info.json to construct image pyramids from");if(!n.maxLevel&&!this.emulateLegacyImagePyramid)if(this.scale_factors){var h=Math.max.apply(null,this.scale_factors);n.maxLevel=Math.round(Math.log(h)*Math.LOG2E)}else n.maxLevel=Number(Math.round(Math.log(Math.max(this.width,this.height),2)));t.TileSource.apply(this,[n])},t.extend(t.IIIFTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return!(!t.protocol||"http://iiif.io/api/image"!==t.protocol)||(!(!t["@context"]||"http://library.stanford.edu/iiif/image-api/1.1/context.json"!==t["@context"]&&"http://iiif.io/api/image/1/context.json"!==t["@context"])||(!(!t.profile||0!==t.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html"))||(!!(t.identifier&&t.width&&t.height)||!(!t.documentElement||"info"!==t.documentElement.tagName||"http://library.stanford.edu/iiif/image-api/ns/"!==t.documentElement.namespaceURI))))},configure:function(e,i,o){if(t.isPlainObject(e)){if(e["@context"]){var r=e["@context"];if(Array.isArray(r))for(var s=0;s<r.length;s++)if("string"==typeof r[s]&&(/^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(r[s])||"http://library.stanford.edu/iiif/image-api/1.1/context.json"===r[s])){r=r[s];break}switch(r){case"http://iiif.io/api/image/1/context.json":case"http://library.stanford.edu/iiif/image-api/1.1/context.json":e.version=1;break;case"http://iiif.io/api/image/2/context.json":e.version=2;break;case"http://iiif.io/api/image/3/context.json":e.version=3;break;default:t.console.error("Data has a @context property which contains no known IIIF context URI.")}}else e["@context"]="http://iiif.io/api/image/1.0/context.json",e["@id"]=i.replace("/info.json",""),e.version=1;if(e.preferredFormats)for(var a=0;a<e.preferredFormats.length;a++)if(l.imageFormatSupported(e.preferredFormats[a])){e.tileFormat=e.preferredFormats[a];break}return e}var c=function(e){if(!e||!e.documentElement)throw new Error(t.getString("Errors.Xml"));var i=e.documentElement,o=i.tagName,r=null;if("info"===o)try{return n(i,r={}),r}catch(s){throw s instanceof Error?s:new Error(t.getString("Errors.IIIF"))}throw new Error(t.getString("Errors.IIIF"))}(e);return c["@context"]="http://iiif.io/api/image/1.0/context.json",c["@id"]=i.replace("/info.xml",""),c.version=1,c},getTileWidth:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileWidth.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].width:this._tileWidth},getTileHeight:function(e){if(this.emulateLegacyImagePyramid)return t.TileSource.prototype.getTileHeight.call(this,e);var i=Math.pow(2,this.maxLevel-e);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[i]?this.tileSizePerScaleFactor[i].height:this._tileHeight},getLevelScale:function(e){if(this.emulateLegacyImagePyramid){var i=NaN;return this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(i=this.levels[e].width/this.levels[this.maxLevel].width),i}return t.TileSource.prototype.getLevelScale.call(this,e)},getNumTiles:function(e){return this.emulateLegacyImagePyramid?this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0):t.TileSource.prototype.getNumTiles.call(this,e)},getTileAtPoint:function(e,i){return this.emulateLegacyImagePyramid?new t.Point(0,0):t.TileSource.prototype.getTileAtPoint.call(this,e,i)},getTileUrl:function(t,e,i){if(this.emulateLegacyImagePyramid){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}var o,r,s,a,l,c,u,h,p,d,f,g,v,m=Math.pow(.5,this.maxLevel-t),y=Math.round(this.width*m),w=Math.round(this.height*m);return o=this.getTileWidth(t),r=this.getTileHeight(t),s=Math.round(o/m),a=Math.round(r/m),v=1===this.version?"native."+this.tileFormat:"default."+this.tileFormat,y<o&&w<r?(d=2===this.version&&y===this.width?"full":3===this.version&&y===this.width&&w===this.height?"max":3===this.version?y+","+w:y+",",l="full"):(c=e*s,u=i*a,h=Math.min(s,this.width-c),p=Math.min(a,this.height-u),l=0===e&&0===i&&h===this.width&&p===this.height?"full":[c,u,h,p].join(","),f=Math.round(h*m),g=Math.round(p*m),d=2===this.version&&f===this.width?"full":3===this.version&&f===this.width&&g===this.height?"max":3===this.version?f+","+g:f+","),[this._id,l,d,"0",v].join("/")},__testonly__:{canBeTiled:e,constructLevels:i}})}(l),function(t){t.OsmTileSource=function(e,i,n,o,r){var s;(s=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]}).width&&s.height||(s.width=65572864,s.height=65572864),s.tileSize||(s.tileSize=256,s.tileOverlap=0),s.tilesUrl||(s.tilesUrl="http://tile.openstreetmap.org/"),s.minLevel=8,t.TileSource.apply(this,[s])},t.extend(t.OsmTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"openstreetmaps"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){return this.tilesUrl+(t-8)+"/"+e+"/"+i+".png"}})}(l),function(t){t.TmsTileSource=function(e,i,n,o,r){var s;s=t.isPlainObject(e)?e:{width:arguments[0],height:arguments[1],tileSize:arguments[2],tileOverlap:arguments[3],tilesUrl:arguments[4]};var a,l=256*Math.ceil(s.width/256),c=256*Math.ceil(s.height/256);a=l>c?l/256:c/256,s.maxLevel=Math.ceil(Math.log(a)/Math.log(2))-1,s.tileSize=256,s.width=l,s.height=c,t.TileSource.apply(this,[s])},t.extend(t.TmsTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"tiledmapservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n=this.getNumTiles(t).y-1;return this.tilesUrl+t+"/"+e+"/"+(n-i)+".png"}})}(l),function(t){t.ZoomifyTileSource=function(t){void 0===t.tileSize&&(t.tileSize=256),void 0===t.fileFormat&&(t.fileFormat="jpg",this.fileFormat=t.fileFormat);var e={x:t.width,y:t.height};for(t.imageSizes=[{x:t.width,y:t.height}],t.gridSize=[this._getGridSize(t.width,t.height,t.tileSize)];parseInt(e.x,10)>t.tileSize||parseInt(e.y,10)>t.tileSize;)e.x=Math.floor(e.x/2),e.y=Math.floor(e.y/2),t.imageSizes.push({x:e.x,y:e.y}),t.gridSize.push(this._getGridSize(e.x,e.y,t.tileSize));t.imageSizes.reverse(),t.gridSize.reverse(),t.minLevel=0,t.maxLevel=t.gridSize.length-1,l.TileSource.apply(this,[t])},t.extend(t.ZoomifyTileSource.prototype,t.TileSource.prototype,{_getGridSize:function(t,e,i){return{x:Math.ceil(t/i),y:Math.ceil(e/i)}},_calculateAbsoluteTileNumber:function(t,e,i){for(var n=0,o={},r=0;r<t;r++)n+=(o=this.gridSize[r]).x*o.y;return n+=(o=this.gridSize[t]).x*i+e},supports:function(t,e){return t.type&&"zoomifytileservice"===t.type},configure:function(t,e,i){return t},getTileUrl:function(t,e,i){var n,o=this._calculateAbsoluteTileNumber(t,e,i);return n=Math.floor(o/256),this.tilesUrl+"TileGroup"+n+"/"+t+"-"+e+"-"+i+"."+this.fileFormat}})}(l),function(t){function e(t,e){return e.levels}t.LegacyTileSource=function(e){var i,n,o;t.isArray(e)&&(i={type:"legacy-image-pyramid",levels:e}),i.levels=function(e){var i,n,o=[];for(n=0;n<e.length;n++)(i=e[n]).height&&i.width&&i.url?o.push({url:i.url,width:Number(i.width),height:Number(i.height)}):t.console.error("Unsupported image format: %s",i.url?i.url:"<no URL>");return o.sort((function(t,e){return t.height-e.height}))}(i.levels),i.levels.length>0?(n=i.levels[i.levels.length-1].width,o=i.levels[i.levels.length-1].height):(n=0,o=0,t.console.error("No supported image formats found")),t.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}),t.TileSource.apply(this,[i]),this.levels=i.levels},t.extend(t.LegacyTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"legacy-image-pyramid"===t.type||t.documentElement&&"legacy-image-pyramid"===t.documentElement.getAttribute("type")},configure:function(i,n,o){return t.isPlainObject(i)?e(this,i):function(i,n){if(!n||!n.documentElement)throw new Error(t.getString("Errors.Xml"));var o,r,s=n.documentElement,a=s.tagName,l=null,c=[];if("image"===a)try{for(l={type:s.getAttribute("type"),levels:[]},c=s.getElementsByTagName("level"),r=0;r<c.length;r++)o=c[r],l.levels.push({url:o.getAttribute("url"),width:parseInt(o.getAttribute("width"),10),height:parseInt(o.getAttribute("height"),10)});return e(i,l)}catch(u){throw u instanceof Error?u: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(t){var e=NaN;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return this.levels.length>0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n}})}(l),function(t){t.ImageTileSource=function(e){e=t.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},e),t.TileSource.apply(this,[e])},t.extend(t.ImageTileSource.prototype,t.TileSource.prototype,{supports:function(t,e){return t.type&&"image"===t.type},configure:function(t,e,i){return t},getImageInfo:function(e){var i=this._image=new Image,n=this;this.crossOriginPolicy&&(i.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(i.useCredentials=this.ajaxWithCredentials),t.addEvent(i,"load",(function(){n.width=i.naturalWidth,n.height=i.naturalHeight,n.aspectRatio=n.width/n.height,n.dimensions=new t.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})})),t.addEvent(i,"error",(function(){n.raiseEvent("open-failed",{message:"Error loading image at "+e,source:e})})),i.src=e},getLevelScale:function(t){var e=NaN;return t>=this.minLevel&&t<=this.maxLevel&&(e=this.levels[t].width/this.levels[this.maxLevel].width),e},getNumTiles:function(e){return this.getLevelScale(e)?new t.Point(1,1):new t.Point(0,0)},getTileUrl:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].url),n},getContext2D:function(t,e,i){var n=null;return t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].context2D),n},destroy:function(){this._freeupCanvasMemory()},_buildLevels:function(){var e=[{url:this._image.src,width:this._image.naturalWidth,height:this._image.naturalHeight}];if(!this.buildPyramid||!t.supportsCanvas||!this.useCanvas)return delete this._image,e;var i=this._image.naturalWidth,n=this._image.naturalHeight,o=document.createElement("canvas"),r=o.getContext("2d");if(o.width=i,o.height=n,r.drawImage(this._image,0,0,i,n),e[0].context2D=r,delete this._image,t.isCanvasTainted(o))return e;for(;i>=2&&n>=2;){i=Math.floor(i/2),n=Math.floor(n/2);var s=document.createElement("canvas"),a=s.getContext("2d");s.width=i,s.height=n,a.drawImage(o,0,0,i,n),e.splice(0,0,{context2D:a,width:i,height:n}),o=s,r=a}return e},_freeupCanvasMemory:function(){for(var t=0;t<this.levels.length;t++)this.levels[t].context2D&&(this.levels[t].context2D.canvas.height=0,this.levels[t].context2D.canvas.width=0)}})}(l),function(t){t.TileSourceCollection=function(e,i,n,o){t.console.error("TileSourceCollection is deprecated; use World instead")}}(l),function(t){function e(i){t.requestAnimationFrame((function(){!function(i){var n;i.shouldFade&&(n=1-(t.now()-i.fadeBeginTime)/i.fadeLength,n=Math.min(1,n),n=Math.max(0,n),i.imgGroup&&t.setElementOpacity(i.imgGroup,n,!0),n>0&&e(i))}(i)}))}function i(e,i){e.element.disabled||(i>=t.ButtonState.GROUP&&e.currentState===t.ButtonState.REST&&(!function(e){e.shouldFade=!1,e.imgGroup&&t.setElementOpacity(e.imgGroup,1,!0)}(e),e.currentState=t.ButtonState.GROUP),i>=t.ButtonState.HOVER&&e.currentState===t.ButtonState.GROUP&&(e.imgHover&&(e.imgHover.style.visibility=""),e.currentState=t.ButtonState.HOVER),i>=t.ButtonState.DOWN&&e.currentState===t.ButtonState.HOVER&&(e.imgDown&&(e.imgDown.style.visibility=""),e.currentState=t.ButtonState.DOWN))}function n(i,n){i.element.disabled||(n<=t.ButtonState.HOVER&&i.currentState===t.ButtonState.DOWN&&(i.imgDown&&(i.imgDown.style.visibility="hidden"),i.currentState=t.ButtonState.HOVER),n<=t.ButtonState.GROUP&&i.currentState===t.ButtonState.HOVER&&(i.imgHover&&(i.imgHover.style.visibility="hidden"),i.currentState=t.ButtonState.GROUP),n<=t.ButtonState.REST&&i.currentState===t.ButtonState.GROUP&&(!function(i){i.shouldFade=!0,i.fadeBeginTime=t.now()+i.fadeDelay,window.setTimeout((function(){e(i)}),i.fadeDelay)}(i),i.currentState=t.ButtonState.REST))}t.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},t.Button=function(e){var o=this;t.EventSource.call(this),t.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null,userData:null},e),this.element=e.element||t.makeNeutralElement("div"),e.element||(this.imgRest=t.makeTransparentImage(this.srcRest),this.imgGroup=t.makeTransparentImage(this.srcGroup),this.imgHover=t.makeTransparentImage(this.srcHover),this.imgDown=t.makeTransparentImage(this.srcDown),this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip,t.setElementPointerEventsNone(this.imgRest),t.setElementPointerEventsNone(this.imgGroup),t.setElementPointerEventsNone(this.imgHover),t.setElementPointerEventsNone(this.imgDown),this.element.style.position="relative",t.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",t.Browser.vendor===t.BROWSERS.FIREFOX&&t.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=t.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 t.MouseTracker({userData:"Button.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(e){e.insideElementPressed?(i(o,t.ButtonState.DOWN),o.raiseEvent("enter",{originalEvent:e.originalEvent})):e.buttonDownAny||i(o,t.ButtonState.HOVER)},focusHandler:function(t){o.tracker.enterHandler(t),o.raiseEvent("focus",{originalEvent:t.originalEvent})},leaveHandler:function(e){n(o,t.ButtonState.GROUP),e.insideElementPressed&&o.raiseEvent("exit",{originalEvent:e.originalEvent})},blurHandler:function(t){o.tracker.leaveHandler(t),o.raiseEvent("blur",{originalEvent:t.originalEvent})},pressHandler:function(e){i(o,t.ButtonState.DOWN),o.raiseEvent("press",{originalEvent:e.originalEvent})},releaseHandler:function(e){e.insideElementPressed&&e.insideElementReleased?(n(o,t.ButtonState.HOVER),o.raiseEvent("release",{originalEvent:e.originalEvent})):e.insideElementPressed?n(o,t.ButtonState.GROUP):i(o,t.ButtonState.HOVER)},clickHandler:function(t){t.quick&&o.raiseEvent("click",{originalEvent:t.originalEvent})},keyHandler:function(t){13===t.keyCode?(o.raiseEvent("click",{originalEvent:t.originalEvent}),o.raiseEvent("release",{originalEvent:t.originalEvent}),t.preventDefault=!0):t.preventDefault=!1}}),n(this,t.ButtonState.REST)},t.extend(t.Button.prototype,t.EventSource.prototype,{notifyGroupEnter:function(){i(this,t.ButtonState.GROUP)},notifyGroupExit:function(){n(this,t.ButtonState.REST)},disable:function(){this.notifyGroupExit(),this.element.disabled=!0,this.tracker.setTracking(!1),t.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1,this.tracker.setTracking(!0),t.setElementOpacity(this.element,1,!0),this.notifyGroupEnter()},destroy:function(){this.imgRest&&(this.element.removeChild(this.imgRest),this.imgRest=null),this.imgGroup&&(this.element.removeChild(this.imgGroup),this.imgGroup=null),this.imgHover&&(this.element.removeChild(this.imgHover),this.imgHover=null),this.imgDown&&(this.element.removeChild(this.imgDown),this.imgDown=null),this.removeAllHandlers(),this.tracker.destroy(),this.element=null}})}(l),function(t){t.ButtonGroup=function(e){t.extend(!0,this,{buttons:[],clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:t.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},e);var i,n=this.buttons.concat([]),o=this;if(this.element=e.element||t.makeNeutralElement("div"),!e.group)for(this.element.style.display="inline-block",i=0;i<n.length;i++)this.element.appendChild(n[i].element);t.setElementTouchActionNone(this.element),this.tracker=new t.MouseTracker({userData:"ButtonGroup.tracker",element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){var e;for(e=0;e<o.buttons.length;e++)o.buttons[e].notifyGroupEnter()},leaveHandler:function(t){var e;if(!t.insideElementPressed)for(e=0;e<o.buttons.length;e++)o.buttons[e].notifyGroupExit()}})},t.ButtonGroup.prototype={emulateEnter:function(){this.tracker.enterHandler({eventSource:this.tracker})},emulateLeave:function(){this.tracker.leaveHandler({eventSource:this.tracker})},destroy:function(){for(;this.buttons.length;){var t=this.buttons.pop();this.element.removeChild(t.element),t.destroy()}this.tracker.destroy(),this.element=null}}}(l),function(t){t.Rect=function(e,i,n,o,r){var s,a;this.x="number"==typeof e?e: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=t.positiveModulo(this.degrees,360),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):this.degrees>=180?(s=this.getBottomRight(),this.x=s.x,this.y=s.y,this.degrees-=180):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)},t.Rect.fromSummits=function(e,i,n){var o=e.distanceTo(i),r=e.distanceTo(n),s=i.minus(e),a=Math.atan(s.y/s.x);return s.x<0?a+=Math.PI:s.y<0&&(a+=2*Math.PI),new t.Rect(e.x,e.y,o,r,a/Math.PI*180)},t.Rect.prototype={clone:function(){return new t.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new t.Point(this.x,this.y)},getBottomRight:function(){return new t.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new t.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new t.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new t.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new t.Point(this.width,this.height)},equals:function(e){return e instanceof t.Rect&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height&&this.degrees===e.degrees},times:function(e){return new t.Rect(this.x*e,this.y*e,this.width*e,this.height*e,this.degrees)},translate:function(e){return new t.Rect(this.x+e.x,this.y+e.y,this.width,this.height,this.degrees)},union:function(e){var i=this.getBoundingBox(),n=e.getBoundingBox(),o=Math.min(i.x,n.x),r=Math.min(i.y,n.y),s=Math.max(i.x+i.width,n.x+n.width),a=Math.max(i.y+i.height,n.y+n.height);return new t.Rect(o,r,s-o,a-r)},intersection:function(e){var i=1e-10,n=[],o=this.getTopLeft();e.containsPoint(o,i)&&n.push(o);var r=this.getTopRight();e.containsPoint(r,i)&&n.push(r);var s=this.getBottomLeft();e.containsPoint(s,i)&&n.push(s);var a=this.getBottomRight();e.containsPoint(a,i)&&n.push(a);var l=e.getTopLeft();this.containsPoint(l,i)&&n.push(l);var c=e.getTopRight();this.containsPoint(c,i)&&n.push(c);var u=e.getBottomLeft();this.containsPoint(u,i)&&n.push(u);var h=e.getBottomRight();this.containsPoint(h,i)&&n.push(h);for(var p=this._getSegments(),d=e._getSegments(),f=0;f<p.length;f++)for(var g=p[f],v=0;v<d.length;v++){var m=d[v],y=w(g[0],g[1],m[0],m[1]);y&&n.push(y)}function w(e,n,o,r){var s=n.minus(e),a=r.minus(o),l=-a.x*s.y+s.x*a.y;if(0===l)return null;var c=(s.x*(e.y-o.y)-s.y*(e.x-o.x))/l,u=(a.x*(e.y-o.y)-a.y*(e.x-o.x))/l;return-1e-10<=c&&c<=1-i&&-1e-10<=u&&u<=1-i?new t.Point(e.x+u*s.x,e.y+u*s.y):null}if(0===n.length)return null;for(var x=n[0].x,b=n[0].x,T=n[0].y,S=n[0].y,P=1;P<n.length;P++){var E=n[P];E.x<x&&(x=E.x),E.x>b&&(b=E.x),E.y<T&&(T=E.y),E.y>S&&(S=E.y)}return new t.Rect(x,T,b-x,S-T)},_getSegments:function(){var t=this.getTopLeft(),e=this.getTopRight(),i=this.getBottomLeft(),n=this.getBottomRight();return[[t,e],[e,n],[n,i],[i,t]]},rotate:function(e,i){if(0===(e=t.positiveModulo(e,360)))return this.clone();i=i||this.getCenter();var n=this.getTopLeft().rotate(e,i),o=this.getTopRight().rotate(e,i).minus(n);o=o.apply((function(t){return Math.abs(t)<1e-15?0:t}));var r=Math.atan(o.y/o.x);return o.x<0?r+=Math.PI:o.y<0&&(r+=2*Math.PI),new t.Rect(n.x,n.y,this.width,this.height,r/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var e=this.getTopLeft(),i=this.getTopRight(),n=this.getBottomLeft(),o=this.getBottomRight(),r=Math.min(e.x,i.x,n.x,o.x),s=Math.max(e.x,i.x,n.x,o.x),a=Math.min(e.y,i.y,n.y,o.y),l=Math.max(e.y,i.y,n.y,o.y);return new t.Rect(r,a,s-r,l-a)},getIntegerBoundingBox:function(){var e=this.getBoundingBox(),i=Math.floor(e.x),n=Math.floor(e.y),o=Math.ceil(e.width+e.x-i),r=Math.ceil(e.height+e.y-n);return new t.Rect(i,n,o,r)},containsPoint:function(t,e){e=e||0;var i=this.getTopLeft(),n=this.getTopRight(),o=this.getBottomLeft(),r=n.minus(i),s=o.minus(i);return(t.x-i.x)*r.x+(t.y-i.y)*r.y>=-e&&(t.x-n.x)*r.x+(t.y-n.y)*r.y<=e&&(t.x-i.x)*s.x+(t.y-i.y)*s.y>=-e&&(t.x-o.x)*s.x+(t.y-o.y)*s.y<=e},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]"}}}(l),function(t){var e={};function i(t){var e;t.quick&&(e="horizontal"===this.scroll?Math.floor(t.position.x/this.panelWidth):Math.floor(t.position.y/this.panelHeight),this.viewer.goToPage(e));this.element.focus()}function n(e){if(this.dragging=!0,this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?-e.delta.x>0?i>-(o-a.x)&&(this.element.style.marginLeft=i+2*e.delta.x+"px",r(this,a.x,i+2*e.delta.x)):-e.delta.x<0&&i<0&&(this.element.style.marginLeft=i+2*e.delta.x+"px",r(this,a.x,i+2*e.delta.x)):-e.delta.y>0?n>-(s-a.y)&&(this.element.style.marginTop=n+2*e.delta.y+"px",r(this,a.y,n+2*e.delta.y)):-e.delta.y<0&&n<0&&(this.element.style.marginTop=n+2*e.delta.y+"px",r(this,a.y,n+2*e.delta.y))}}function o(e){if(this.element){var i=Number(this.element.style.marginLeft.replace("px","")),n=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=t.getElementSize(this.viewer.canvas);"horizontal"===this.scroll?e.scroll>0?i>-(o-a.x)&&(this.element.style.marginLeft=i-60*e.scroll+"px",r(this,a.x,i-60*e.scroll)):e.scroll<0&&i<0&&(this.element.style.marginLeft=i-60*e.scroll+"px",r(this,a.x,i-60*e.scroll)):e.scroll<0?n>a.y-s&&(this.element.style.marginTop=n+60*e.scroll+"px",r(this,a.y,n+60*e.scroll)):e.scroll>0&&n<0&&(this.element.style.marginTop=n+60*e.scroll+"px",r(this,a.y,n+60*e.scroll)),e.preventDefault=!0}}function r(e,i,n){var o,r,s,a,l,c;for(o="horizontal"===e.scroll?e.panelWidth:e.panelHeight,r=Math.ceil(i/o)+5,l=r=(r=(s=Math.ceil((Math.abs(n)+i)/o)+1)-r)<0?0:r;l<s&&l<e.panels.length;l++)if(!(c=e.panels[l]).activePanel){var u,h=e.viewer.tileSources[l];u=h.referenceStripThumbnailUrl?{type:"image",url:h.referenceStripThumbnailUrl}:h,a=new t.Viewer({id:c.id,tileSources:[u],element:c,navigatorSizeRatio:e.sizeRatio,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,loadTilesWithAjax:e.viewer.loadTilesWithAjax,ajaxHeaders:e.viewer.ajaxHeaders,useCanvas:e.useCanvas}),t.setElementPointerEventsNone(a.canvas),t.setElementPointerEventsNone(a.container),a.innerTracker.setTracking(!1),a.outerTracker.setTracking(!1),e.miniViewers[c.id]=a,c.activePanel=!0}}function s(t){var e=t.eventSource.element;"horizontal"===this.scroll?e.style.marginBottom="0px":e.style.marginLeft="0px"}function a(e){var i=e.eventSource.element;"horizontal"===this.scroll?i.style.marginBottom="-"+t.getElementSize(i).y/2+"px":i.style.marginLeft="-"+t.getElementSize(i).x/2+"px"}function l(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 38:case 39:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 40:case 37:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}function c(t){if(t.ctrl||t.alt||t.meta)t.preventDefault=!1;else switch(t.keyCode){case 61:case 48:case 119:case 87:case 100:o.call(this,{eventSource:this.tracker,position:null,scroll:1,shift:null}),t.preventDefault=!0;break;case 45:case 115:case 83:case 97:o.call(this,{eventSource:this.tracker,position:null,scroll:-1,shift:null}),t.preventDefault=!0;break;default:t.preventDefault=!1}}t.ReferenceStrip=function(u){var h,p,d,f=u.viewer,g=t.getElementSize(f.element);for(u.id||(u.id="referencestrip-"+t.now(),this.element=t.makeNeutralElement("div"),this.element.id=u.id,this.element.className="referencestrip"),u=t.extend(!0,{sizeRatio:t.DEFAULT_SETTINGS.referenceStripSizeRatio,position:t.DEFAULT_SETTINGS.referenceStripPosition,scroll:t.DEFAULT_SETTINGS.referenceStripScroll,clickTimeThreshold:t.DEFAULT_SETTINGS.clickTimeThreshold},u,{element:this.element}),t.extend(this,u),e[this.id]={animating:!1},this.minPixelRatio=this.viewer.minPixelRatio,this.element.tabIndex=0,(p=this.element.style).marginTop="0px",p.marginRight="0px",p.marginBottom="0px",p.marginLeft="0px",p.left="0px",p.bottom="0px",p.border="0px",p.background="#000",p.position="relative",t.setElementTouchActionNone(this.element),t.setElementOpacity(this.element,.8),this.viewer=f,this.tracker=new t.MouseTracker({userData:"ReferenceStrip.tracker",element:this.element,clickHandler:t.delegate(this,i),dragHandler:t.delegate(this,n),scrollHandler:t.delegate(this,o),enterHandler:t.delegate(this,s),leaveHandler:t.delegate(this,a),keyDownHandler:t.delegate(this,l),keyHandler:t.delegate(this,c),preProcessEventHandler:function(t){"wheel"===t.eventType&&(t.preventDefault=!0)}}),u.width&&u.height?(this.element.style.width=u.width+"px",this.element.style.height=u.height+"px",f.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):"horizontal"===u.scroll?(this.element.style.width=g.x*u.sizeRatio*f.tileSources.length+12*f.tileSources.length+"px",this.element.style.height=g.y*u.sizeRatio+"px",f.addControl(this.element,{anchor:t.ControlAnchor.BOTTOM_LEFT})):(this.element.style.height=g.y*u.sizeRatio*f.tileSources.length+12*f.tileSources.length+"px",this.element.style.width=g.x*u.sizeRatio+"px",f.addControl(this.element,{anchor:t.ControlAnchor.TOP_LEFT})),this.panelWidth=g.x*this.sizeRatio+8,this.panelHeight=g.y*this.sizeRatio+8,this.panels=[],this.miniViewers={},d=0;d<f.tileSources.length;d++)(h=t.makeNeutralElement("div")).id=this.element.id+"-"+d,h.style.width=this.panelWidth+"px",h.style.height=this.panelHeight+"px",h.style.display="inline",h.style.float="left",h.style.cssFloat="left",h.style.styleFloat="left",h.style.padding="2px",t.setElementTouchActionNone(h),t.setElementPointerEventsNone(h),this.element.appendChild(h),h.activePanel=!1,this.panels.push(h);r(this,"vertical"===this.scroll?g.y:g.x,0),this.setFocus(0)},t.ReferenceStrip.prototype={setFocus:function(e){var i,n=this.element.querySelector("#"+this.element.id+"-"+e),o=t.getElementSize(this.viewer.canvas),a=Number(this.element.style.width.replace("px","")),l=Number(this.element.style.height.replace("px","")),c=-Number(this.element.style.marginLeft.replace("px","")),u=-Number(this.element.style.marginTop.replace("px",""));this.currentSelected!==n&&(this.currentSelected&&(this.currentSelected.style.background="#000"),this.currentSelected=n,this.currentSelected.style.background="#999","horizontal"===this.scroll?(i=Number(e)*(this.panelWidth+3))>c+o.x-this.panelWidth?(i=Math.min(i,a-o.x),this.element.style.marginLeft=-i+"px",r(this,o.x,-i)):i<c&&(i=Math.max(0,i-o.x/2),this.element.style.marginLeft=-i+"px",r(this,o.x,-i)):(i=Number(e)*(this.panelHeight+3))>u+o.y-this.panelHeight?(i=Math.min(i,l-o.y),this.element.style.marginTop=-i+"px",r(this,o.y,-i)):i<u&&(i=Math.max(0,i-o.y/2),this.element.style.marginTop=-i+"px",r(this,o.y,-i)),this.currentPage=e,s.call(this,{eventSource:this.tracker}))},update:function(){return!!e[this.id].animating},destroy:function(){if(this.miniViewers)for(var t in this.miniViewers)this.miniViewers[t].destroy();this.tracker.destroy(),this.element&&this.viewer.removeControl(this.element)}}}(l),function(t){t.DisplayRect=function(e,i,n,o,r,s){t.Rect.apply(this,[e,i,n,o]),this.minLevel=r,this.maxLevel=s},t.extend(t.DisplayRect.prototype,t.Rect.prototype)}(l),function(t){t.Spring=function(e){var i=arguments;"object"!=typeof e&&(e={initial:i.length&&"number"==typeof i[0]?i[0]:void 0,springStiffness:i.length>1?i[1].springStiffness:5,animationTime:i.length>1?i[1].animationTime:1.5}),t.console.assert("number"==typeof e.springStiffness&&0!==e.springStiffness,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),t.console.assert("number"==typeof e.animationTime&&e.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),e.exponential&&(this._exponential=!0,delete e.exponential),t.extend(!0,this,e),this.current={value:"number"==typeof this.initial?this.initial:this._exponential?0:1,time:t.now()},t.console.assert(!this._exponential||0!==this.current.value,"[OpenSeadragon.Spring] 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},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))},t.Spring.prototype={resetTo:function(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=e,this.start.time=this.target.time=this.current.time=t.now(),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(e){t.console.assert(!this._exponential||0!==e,"[OpenSeadragon.Spring.springTo] target must be non-zero for exponential springs"),this.start.value=this.current.value,this.start.time=this.current.time,this.target.value=e,this.target.time=this.start.time+1e3*this.animationTime,this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value))},shiftBy:function(e){this.start.value+=e,this.target.value+=e,this._exponential&&(t.console.assert(0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.shiftBy] 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(e){this._exponential=e,this._exponential&&(t.console.assert(0!==this.current.value&&0!==this.target.value&&0!==this.start.value,"[OpenSeadragon.Spring.setExponential] 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(){var e,i;this.current.time=t.now(),this._exponential?(e=this.start._logValue,i=this.target._logValue):(e=this.start.value,i=this.target.value);var n,o,r=this.current.time>=this.target.time?i:e+(i-e)*(n=this.springStiffness,o=(this.current.time-this.start.time)/(this.target.time-this.start.time),(1-Math.exp(n*-o))/(1-Math.exp(-n))),s=this.current.value;return this._exponential?this.current.value=Math.exp(r):this.current.value=r,s!==this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(l),function(t){t.ImageJob=function(e){t.extend(!0,this,{timeout:t.DEFAULT_SETTINGS.timeout,jobId:null},e),this.data=null,this.userData={},this.errorMsg=null},t.ImageJob.prototype={start:function(){var t=this,e=this.abort;this.jobId=window.setTimeout((function(){t.finish(null,null,"Image load exceeded timeout ("+t.timeout+" ms)")}),this.timeout),this.abort=function(){t.source.downloadTileAbort(t),"function"==typeof e&&e()},this.source.downloadTileStart(this)},finish:function(t,e,i){this.data=t,this.request=e,this.errorMsg=i,this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},t.ImageLoader=function(e){t.extend(!0,this,{jobLimit:t.DEFAULT_SETTINGS.imageLoaderLimit,timeout:t.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},e)},t.ImageLoader.prototype={addJob:function(e){if(!e.source){t.console.error("ImageLoader.prototype.addJob() requires [options.source]. TileSource since new API defines how images are fetched. Creating a dummy TileSource.");var i=t.TileSource.prototype;e.source={downloadTileStart:i.downloadTileStart,downloadTileAbort:i.downloadTileAbort}}var n=this,o={src:e.src,tile:e.tile||{},source:e.source,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.loadWithAjax?e.ajaxHeaders:null,crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,postData:e.postData,callback:function(t){!function(t,e,i){t.jobsInProgress--,(!t.jobLimit||t.jobsInProgress<t.jobLimit)&&t.jobQueue.length>0&&(t.jobQueue.shift().start(),t.jobsInProgress++);i(e.data,e.errorMsg,e.request)}(n,t,e.callback)},abort:e.abort,timeout:this.timeout},r=new t.ImageJob(o);!this.jobLimit||this.jobsInProgress<this.jobLimit?(r.start(),this.jobsInProgress++):this.jobQueue.push(r)},clear:function(){for(var t=0;t<this.jobQueue.length;t++){var e=this.jobQueue[t];"function"==typeof e.abort&&e.abort()}this.jobQueue=[]}}}(l),function(t){t.Tile=function(e,i,n,o,r,s,a,l,c,u,h,p){this.level=e,this.x=i,this.y=n,this.bounds=o,this.sourceBounds=u,this.exists=r,this._url=s,this.postData=h,this.context2D=a,this.loadWithAjax=l,this.ajaxHeaders=c,void 0===p&&(t.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used."),p=t.TileSource.prototype.getTileHashKey(e,i,n,s,c,h)),this.cacheKey=p,this.loaded=!1,this.loading=!1,this.element=null,this.imgElement=null,this.style=null,this.position=null,this.size=null,this.flipped=!1,this.blendStart=null,this.opacity=null,this.squaredDistance=null,this.visibility=null,this.hasTransparency=!1,this.beingDrawn=!1,this.lastTouchTime=0,this.isRightMost=!1,this.isBottomMost=!1},t.Tile.prototype={toString:function(){return this.level+"/"+this.x+"_"+this.y},_hasTransparencyChannel:function(){return!!this.context2D||this.getUrl().match(".png")},drawHTML:function(e){if(this.cacheImageRecord)if(this.loaded){if(!this.element){var i=this.getImage();if(!i)return;this.element=t.makeNeutralElement("div"),this.imgElement=i.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!==e&&e.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",this.flipped&&(this.style.transform="scaleX(-1)"),t.setElementOpacity(this.element,this.opacity)}else t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString());else t.console.warn("[Tile.drawHTML] attempting to draw tile %s when it's not cached",this.toString())},get image(){return t.console.error("[Tile.image] property has been deprecated. Use [Tile.prototype.getImage] instead."),this.getImage()},get url(){return t.console.error("[Tile.url] property has been deprecated. Use [Tile.prototype.getUrl] instead."),this.getUrl()},getImage:function(){return this.cacheImageRecord.getImage()},getUrl:function(){return"function"==typeof this._url?this._url():this._url},getCanvasContext:function(){return this.context2D||this.cacheImageRecord.getRenderedContext()},drawCanvas:function(e,i,n,o,r,s){var a,l,c,u=this.position.times(t.pixelDensityRatio),h=this.size.times(t.pixelDensityRatio);this.context2D||this.cacheImageRecord?(a=this.getCanvasContext(),this.loaded&&a?(e.save(),e.globalAlpha=this.opacity,"number"==typeof n&&1!==n&&(u=u.times(n),h=h.times(n)),o instanceof t.Point&&(u=u.plus(o)),1===e.globalAlpha&&this.hasTransparency&&(r&&(u.x=Math.round(u.x),u.y=Math.round(u.y),h.x=Math.round(h.x),h.y=Math.round(h.y)),e.clearRect(u.x,u.y,h.x,h.y)),this.sourceBounds?(l=Math.min(this.sourceBounds.width,a.canvas.width),c=Math.min(this.sourceBounds.height,a.canvas.height)):(l=a.canvas.width,c=a.canvas.height),e.translate(u.x+h.x/2,0),this.flipped&&e.scale(-1,1),i({context:e,tile:this,rendered:a,initRendered:this.cacheImageRecord?this.cacheImageRecord.getCopyRenderedContext():void 0,sourceWidth:l,sourceHeight:c,position:{original:u,x:-h.x/2,y:u.y},size:h,pixelDensityRatio:t.pixelDensityRatio}),e.restore()):t.console.warn("Attempting to draw tile %s when it's not yet loaded.",this.toString())):t.console.warn("[Tile.drawCanvas] attempting to draw tile %s when it's not cached",this.toString())},getScaleForEdgeSmoothing:function(){var e;if(this.cacheImageRecord)e=this.cacheImageRecord.getRenderedContext();else{if(!this.context2D)return t.console.warn("[Tile.drawCanvas] attempting to get tile scale %s when tile's not cached",this.toString()),1;e=this.context2D}return e.canvas.width/(this.size.x*t.pixelDensityRatio)},getTranslationForEdgeSmoothing:function(e,i,n){var o=Math.max(1,Math.ceil((n.x-i.x)/2)),r=Math.max(1,Math.ceil((n.y-i.y)/2));return new t.Point(o,r).minus(this.position.times(t.pixelDensityRatio).times(e||1).apply((function(t){return t%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}}}(l),function(t){t.OverlayPlacement=t.Placement,t.OverlayRotationMode=t.freezeObject({NO_ROTATION:1,EXACT:2,BOUNDING_BOX:3}),t.Overlay=function(e,i,n){var o;o=t.isPlainObject(e)?e:{element:e,location:i,placement:n},this.element=o.element,this.style=o.element.style,this._init(o)},t.Overlay.prototype={_init:function(e){this.location=e.location,this.placement=void 0===e.placement?t.Placement.TOP_LEFT:e.placement,this.onDraw=e.onDraw,this.checkResize=void 0===e.checkResize||e.checkResize,this.width=void 0===e.width?null:e.width,this.height=void 0===e.height?null:e.height,this.rotationMode=e.rotationMode||t.OverlayRotationMode.EXACT,this.location instanceof t.Rect&&(this.width=this.location.width,this.height=this.location.height,this.location=this.location.getTopLeft(),this.placement=t.Placement.TOP_LEFT),this.scales=null!==this.width&&null!==this.height,this.bounds=new t.Rect(this.location.x,this.location.y,this.width,this.height),this.position=this.location},adjust:function(e,i){var n=t.Placement.properties[this.placement];n&&(n.isHorizontallyCentered?e.x-=i.x/2:n.isRight&&(e.x-=i.x),n.isVerticallyCentered?e.y-=i.y/2:n.isBottom&&(e.y-=i.y))},destroy:function(){var e=this.element,i=this.style;e.parentNode&&(e.parentNode.removeChild(e),e.prevElementParent&&(i.display="none",document.body.appendChild(e))),this.onDraw=null,i.top="",i.left="",i.position="",null!==this.width&&(i.width=""),null!==this.height&&(i.height="");var n=t.getCssPropertyWithVendorPrefix("transformOrigin"),o=t.getCssPropertyWithVendorPrefix("transform");n&&o&&(i[n]="",i[o]="")},drawHTML:function(e,i){var n=this.element;n.parentNode!==e&&(n.prevElementParent=n.parentNode,n.prevNextSibling=n.nextSibling,e.appendChild(n),this.style.position="absolute",this.size=t.getElementSize(n));var o=this._getOverlayPositionAndSize(i),r=o.position,s=this.size=o.size,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 c=t.getCssPropertyWithVendorPrefix("transformOrigin"),u=t.getCssPropertyWithVendorPrefix("transform");c&&u&&(a?(l[c]=this._getTransformOrigin(),l[u]="rotate("+a+"deg)"):(l[c]="",l[u]="")),l.display="block"}},_getOverlayPositionAndSize:function(e){var i=e.pixelFromPoint(this.location,!0),n=this._getSizeInPixels(e);this.adjust(i,n);var o=0;if(e.getRotation(!0)&&this.rotationMode!==t.OverlayRotationMode.NO_ROTATION)if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX&&null!==this.width&&null!==this.height){var r=new t.Rect(i.x,i.y,n.x,n.y),s=this._getBoundingBox(r,e.getRotation(!0));i=s.getTopLeft(),n=s.getSize()}else o=e.getRotation(!0);return{position:i,size:n,rotate:o}},_getSizeInPixels:function(e){var i=this.size.x,n=this.size.y;if(null!==this.width||null!==this.height){var o=e.deltaPixelsFromPointsNoRotate(new t.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=t.getElementSize(this.element);null===this.width&&(i=r.x),null===this.height&&(n=r.y)}return new t.Point(i,n)},_getBoundingBox:function(t,e){var i=this._getPlacementPoint(t);return t.rotate(e,i).getBoundingBox()},_getPlacementPoint:function(e){var i=new t.Point(e.x,e.y),n=t.Placement.properties[this.placement];return n&&(n.isHorizontallyCentered?i.x+=e.width/2:n.isRight&&(i.x+=e.width),n.isVerticallyCentered?i.y+=e.height/2:n.isBottom&&(i.y+=e.height)),i},_getTransformOrigin:function(){var e="",i=t.Placement.properties[this.placement];return i?(i.isLeft?e="left":i.isRight&&(e="right"),i.isTop?e+=" top":i.isBottom&&(e+=" bottom"),e):e},update:function(e,i){var n=t.isPlainObject(e)?e:{location:e,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(e){t.console.assert(e,"A viewport must now be passed to Overlay.getBounds.");var i=this.width,n=this.height;if(null===i||null===n){var o=e.deltaPointsFromPixelsNoRotate(this.size,!0);null===i&&(i=o.x),null===n&&(n=o.y)}var r=this.location.clone();return this.adjust(r,new t.Point(i,n)),this._adjustBoundsForRotation(e,new t.Rect(r.x,r.y,i,n))},_adjustBoundsForRotation:function(e,i){if(!e||0===e.getRotation(!0)||this.rotationMode===t.OverlayRotationMode.EXACT)return i;if(this.rotationMode===t.OverlayRotationMode.BOUNDING_BOX){if(null===this.width||null===this.height)return i;var n=this._getOverlayPositionAndSize(e);return e.viewerElementToViewportRectangle(new t.Rect(n.position.x,n.position.y,n.size.x,n.size.y))}return i.rotate(-e.getRotation(!0),this._getPlacementPoint(i))}}}(l),function(t){t.Drawer=function(e){t.console.assert(e.viewer,"[Drawer] options.viewer is required");var i=arguments;if(t.isPlainObject(e)||(e={source:i[0],viewport:i[1],element:i[2]}),t.console.assert(e.viewport,"[Drawer] options.viewport is required"),t.console.assert(e.element,"[Drawer] options.element is required"),e.source&&t.console.error("[Drawer] options.source is no longer accepted; use TiledImage instead"),this.viewer=e.viewer,this.viewport=e.viewport,this.debugGridColor="string"==typeof e.debugGridColor?[e.debugGridColor]:e.debugGridColor||t.DEFAULT_SETTINGS.debugGridColor,e.opacity&&t.console.error("[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead"),this.useCanvas=t.supportsCanvas&&(!this.viewer||this.viewer.useCanvas),this.container=t.getElement(e.element),this.canvas=t.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",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",t.setElementOpacity(this.canvas,this.opacity,!0),t.setElementPointerEventsNone(this.canvas),t.setElementTouchActionNone(this.canvas),this.container.style.textAlign="left",this.container.appendChild(this.canvas),this._imageSmoothingEnabled=!0},t.Drawer.prototype={addOverlay:function(e,i,n,o){return t.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead."),this.viewer.addOverlay(e,i,n,o),this},updateOverlay:function(e,i,n){return t.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead."),this.viewer.updateOverlay(e,i,n),this},removeOverlay:function(e){return t.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead."),this.viewer.removeOverlay(e),this},clearOverlays:function(){return t.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead."),this.viewer.clearOverlays(),this},viewportCoordToDrawerCoord:function(e){var i=this.viewport.pixelFromPointNoRotate(e,!0);return new t.Point(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio)},clipWithPolygons:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),t.forEach((function(t){t.forEach((function(t,e){i[0===e?"moveTo":"lineTo"](t.x,t.y)}))})),i.clip()}},setOpacity:function(e){t.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");for(var i=this.viewer.world,n=0;n<i.getItemCount();n++)i.getItemAt(n).setOpacity(e);return this},getOpacity:function(){t.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");for(var e=this.viewer.world,i=0,n=0;n<e.getItemCount();n++){var o=e.getItemAt(n).getOpacity();o>i&&(i=o)}return i},needsUpdate:function(){return t.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return t.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return t.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return t.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead."),this.clear(),this.viewer.world.draw(),this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1,this.canvas.height=1,this.sketchCanvas=null,this.sketchContext=null},clear:function(){if(this.canvas.innerHTML="",this.useCanvas){var t=this._calculateCanvasSize();if((this.canvas.width!==t.x||this.canvas.height!==t.y)&&(this.canvas.width=t.x,this.canvas.height=t.y,this._updateImageSmoothingEnabled(this.context),null!==this.sketchCanvas)){var e=this._calculateSketchCanvasSize();this.sketchCanvas.width=e.x,this.sketchCanvas.height=e.y,this._updateImageSmoothingEnabled(this.sketchContext)}this._clear()}},_clear:function(t,e){if(this.useCanvas){var i=this._getContext(t);if(e)i.clearRect(e.x,e.y,e.width,e.height);else{var n=i.canvas;i.clearRect(0,0,n.width,n.height)}}},viewportToDrawerRectangle:function(e){var i=this.viewport.pixelFromPointNoRotate(e.getTopLeft(),!0),n=this.viewport.deltaPixelsFromPointsNoRotate(e.getSize(),!0);return new t.Rect(i.x*t.pixelDensityRatio,i.y*t.pixelDensityRatio,n.x*t.pixelDensityRatio,n.y*t.pixelDensityRatio)},drawTile:function(e,i,n,o,r,s,a){if(t.console.assert(e,"[Drawer.drawTile] tile is required"),t.console.assert(i,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var l=this._getContext(n);o=o||1,e.drawCanvas(l,i,o,r,s,a)}else e.drawHTML(this.canvas)},_getContext:function(t){var e=this.context;if(t){if(null===this.sketchCanvas){this.sketchCanvas=document.createElement("canvas");var i=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=i.x,this.sketchCanvas.height=i.y,this.sketchContext=this.sketchCanvas.getContext("2d"),0===this.viewport.getRotation()){var n=this;this.viewer.addHandler("rotate",(function t(){if(0!==n.viewport.getRotation()){n.viewer.removeHandler("rotate",t);var e=n._calculateSketchCanvasSize();n.sketchCanvas.width=e.x,n.sketchCanvas.height=e.y}}))}this._updateImageSmoothingEnabled(this.sketchContext)}e=this.sketchContext}return e},saveContext:function(t){this.useCanvas&&this._getContext(t).save()},restoreContext:function(t){this.useCanvas&&this._getContext(t).restore()},setClip:function(t,e){if(this.useCanvas){var i=this._getContext(e);i.beginPath(),i.rect(t.x,t.y,t.width,t.height),i.clip()}},drawRectangle:function(t,e,i){if(this.useCanvas){var n=this._getContext(i);n.save(),n.fillStyle=e,n.fillRect(t.x,t.y,t.width,t.height),n.restore()}},blendSketch:function(e,i,n,o){var r=e;if(t.isPlainObject(r)||(r={opacity:e,scale:i,translate:n,compositeOperation:o}),this.useCanvas&&this.sketchCanvas){e=r.opacity,o=r.compositeOperation;var s=r.bounds;if(this.context.save(),this.context.globalAlpha=e,o&&(this.context.globalCompositeOperation=o),s)s.x<0&&(s.width+=s.x,s.x=0),s.x+s.width>this.canvas.width&&(s.width=this.canvas.width-s.x),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 t.Point?n:new t.Point(0,0),l=0,c=0;if(n){var u=this.sketchCanvas.width-this.canvas.width,h=this.sketchCanvas.height-this.canvas.height;l=Math.round(u/2),c=Math.round(h/2)}this.context.drawImage(this.sketchCanvas,a.x-l*i,a.y-c*i,(this.canvas.width+2*l)*i,(this.canvas.height+2*c)*i,-l,-c,this.canvas.width+2*l,this.canvas.height+2*c)}this.context.restore()}},drawDebugInfo:function(e,i,n,o){if(this.useCanvas){var r=this.viewer.world.getIndexOfItem(o)%this.debugGridColor.length,s=this.context;s.save(),s.lineWidth=2*t.pixelDensityRatio,s.font="small-caps bold "+13*t.pixelDensityRatio+"px arial",s.strokeStyle=this.debugGridColor[r],s.fillStyle=this.debugGridColor[r],this.viewport.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:this.viewport.getRotation(!0)}),o.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:o.getRotation(!0),point:o.viewport.pixelFromPointNoRotate(o._getRotationPoint(!0),!0)}),o.viewport.getRotation(!0)%360==0&&o.getRotation(!0)%360==0&&o._drawer.viewer.viewport.getFlip()&&o._drawer._flip(),s.strokeRect(e.position.x*t.pixelDensityRatio,e.position.y*t.pixelDensityRatio,e.size.x*t.pixelDensityRatio,e.size.y*t.pixelDensityRatio);var a=(e.position.x+e.size.x/2)*t.pixelDensityRatio,l=(e.position.y+e.size.y/2)*t.pixelDensityRatio;s.translate(a,l),s.rotate(Math.PI/180*-this.viewport.getRotation(!0)),s.translate(-a,-l),0===e.x&&0===e.y&&(s.fillText("Zoom: "+this.viewport.getZoom(),e.position.x*t.pixelDensityRatio,(e.position.y-30)*t.pixelDensityRatio),s.fillText("Pan: "+this.viewport.getBounds().toString(),e.position.x*t.pixelDensityRatio,(e.position.y-20)*t.pixelDensityRatio)),s.fillText("Level: "+e.level,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+20)*t.pixelDensityRatio),s.fillText("Column: "+e.x,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+30)*t.pixelDensityRatio),s.fillText("Row: "+e.y,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+40)*t.pixelDensityRatio),s.fillText("Order: "+n+" of "+i,(e.position.x+10)*t.pixelDensityRatio,(e.position.y+50)*t.pixelDensityRatio),s.fillText("Size: "+e.size.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+60)*t.pixelDensityRatio),s.fillText("Position: "+e.position.toString(),(e.position.x+10)*t.pixelDensityRatio,(e.position.y+70)*t.pixelDensityRatio),this.viewport.getRotation(!0)%360!=0&&this._restoreRotationChanges(),o.getRotation(!0)%360!=0&&this._restoreRotationChanges(),o.viewport.getRotation(!0)%360==0&&o.getRotation(!0)%360==0&&o._drawer.viewer.viewport.getFlip()&&o._drawer._flip(),s.restore()}},debugRect:function(e){if(this.useCanvas){var i=this.context;i.save(),i.lineWidth=2*t.pixelDensityRatio,i.strokeStyle=this.debugGridColor[0],i.fillStyle=this.debugGridColor[0],i.strokeRect(e.x*t.pixelDensityRatio,e.y*t.pixelDensityRatio,e.width*t.pixelDensityRatio,e.height*t.pixelDensityRatio),i.restore()}},setImageSmoothingEnabled:function(t){this.useCanvas&&(this._imageSmoothingEnabled=t,this._updateImageSmoothingEnabled(this.context),this.viewer.forceRedraw())},_updateImageSmoothingEnabled:function(t){t.msImageSmoothingEnabled=this._imageSmoothingEnabled,t.imageSmoothingEnabled=this._imageSmoothingEnabled},getCanvasSize:function(e){var i=this._getContext(e).canvas;return new t.Point(i.width,i.height)},getCanvasCenter:function(){return new t.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(e){var i=e.point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.save(),n.translate(i.x,i.y),this.viewer.viewport.flipped?(n.rotate(Math.PI/180*-e.degrees),n.scale(-1,1)):n.rotate(Math.PI/180*e.degrees),n.translate(-i.x,-i.y)},_flip:function(e){var i=(e=e||{}).point?e.point.times(t.pixelDensityRatio):this.getCanvasCenter(),n=this._getContext(e.useSketch);n.translate(i.x,0),n.scale(-1,1),n.translate(-i.x,0)},_restoreRotationChanges:function(t){this._getContext(t).restore()},_calculateCanvasSize:function(){var e=t.pixelDensityRatio,i=this.viewport.getContainerSize();return{x:Math.round(i.x*e),y:Math.round(i.y*e)}},_calculateSketchCanvasSize:function(){var t=this._calculateCanvasSize();if(0===this.viewport.getRotation())return t;var e=Math.ceil(Math.sqrt(t.x*t.x+t.y*t.y));return{x:e,y:e}}}}(l),function(t){t.Viewport=function(e){var i=arguments;i.length&&i[0]instanceof t.Point&&(e={containerSize:i[0],contentSize:i[1],config:i[2]}),e.config&&(t.extend(!0,e,e.config),delete e.config),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e.margins||{}),delete e.margins,e.initialDegrees=e.degrees,delete e.degrees,t.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,rotationPivot:null,viewer:null,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:t.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:t.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:t.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:t.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:t.DEFAULT_SETTINGS.maxZoomLevel,initialDegrees:t.DEFAULT_SETTINGS.degrees,flipped:t.DEFAULT_SETTINGS.flipped,homeFillsViewer:t.DEFAULT_SETTINGS.homeFillsViewer,silenceMultiImageWarnings:t.DEFAULT_SETTINGS.silenceMultiImageWarnings},e),this._updateContainerInnerSize(),this.centerSpringX=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new t.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new t.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.degreesSpring=new t.Spring({initial:e.initialDegrees,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._oldDegrees=this.degreesSpring.current.value,this._setContentBounds(new t.Rect(0,0,1,1),1),this.goHome(!0),this.update()},t.Viewport.prototype={get degrees(){return t.console.warn("Accessing [Viewport.degrees] is deprecated. Use viewport.getRotation instead."),this.getRotation()},set degrees(e){t.console.warn("Setting [Viewport.degrees] is deprecated. Use viewport.rotateTo, viewport.rotateBy, or viewport.setRotation instead."),this.rotateTo(e)},resetContentSize:function(e){return t.console.assert(e,"[Viewport.resetContentSize] contentSize is required"),t.console.assert(e instanceof t.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),t.console.assert(e.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),t.console.assert(e.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new t.Rect(0,0,1,e.y/e.x),e.x),this},setHomeBounds:function(e,i){t.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(e,i)},_setContentBounds:function(e,i){t.console.assert(e,"[Viewport._setContentBounds] bounds is required"),t.console.assert(e instanceof t.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),t.console.assert(e.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),t.console.assert(e.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=e.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(i),this._contentBounds=e.rotate(this.getRotation()).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 t=this._contentAspectRatio/this.getAspectRatio();return(this.homeFillsViewer?t>=1?t:1:t>=1?1:t)/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var e=this._contentBounds.getCenter(),i=1/this.getHomeZoom(),n=i/this.getAspectRatio();return new t.Rect(e.x-i/2,e.y-n/2,i,n)},goHome:function(t){return this.viewer&&this.viewer.raiseEvent("home",{immediately:t}),this.fitBounds(this.getHomeBounds(),t)},getMinZoom:function(){var t=this.getHomeZoom();return this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*t},getMaxZoom:function(){var t=this.maxZoomLevel;return t||(t=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,t/=this._contentBounds.width),Math.max(t,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new t.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return t.extend({},this._margins)},setMargins:function(e){t.console.assert("object"===t.type(e),"[Viewport.setMargins] margins must be an object"),this._margins=t.extend({left:0,top:0,right:0,bottom:0},e),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(-this.getRotation(t))},getBoundsNoRotate:function(e){var i=this.getCenter(e),n=1/this.getZoom(e),o=n/this.getAspectRatio();return new t.Rect(i.x-n/2,i.y-o/2,n,o)},getBoundsWithMargins:function(t){return this.getBoundsNoRotateWithMargins(t).rotate(-this.getRotation(t),this.getCenter(t))},getBoundsNoRotateWithMargins:function(t){var e=this.getBoundsNoRotate(t),i=this._containerInnerSize.x*this.getZoom(t);return e.x-=this._margins.left/i,e.y-=this._margins.top/i,e.width+=(this._margins.left+this._margins.right)/i,e.height+=(this._margins.top+this._margins.bottom)/i,e},getCenter:function(e){var i,n,o,r,s,a,l=new t.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),c=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return e?l:this.zoomPoint?(i=this.pixelFromPoint(this.zoomPoint,!0),r=(o=1/(n=this.getZoom()))/this.getAspectRatio(),s=new t.Rect(l.x-o/2,l.y-r/2,o,r),a=this._pixelFromPoint(this.zoomPoint,s).minus(i).rotate(-this.getRotation(!0)).divide(this._containerInnerSize.x*n),c.plus(a)):c},getZoom:function(t){return t?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(t){return Math.max(Math.min(t,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(t){var e=this.viewportToViewerElementRectangle(t).getBoundingBox(),i=this.viewportToViewerElementRectangle(this._contentBoundsNoRotate).getBoundingBox(),n=!1,o=!1;if(this.wrapHorizontal);else{var r,s,a,l=e.x+e.width,c=i.x+i.width;r=e.width>i.width?this.visibilityRatio*i.width:this.visibilityRatio*e.width,s=i.x-l+r,a=c-e.x-r,r>i.width?(e.x+=(s+a)/2,n=!0):a<0?(e.x+=a,n=!0):s>0&&(e.x+=s,n=!0)}if(this.wrapVertical);else{var u,h,p,d=e.y+e.height,f=i.y+i.height;u=e.height>i.height?this.visibilityRatio*i.height:this.visibilityRatio*e.height,h=i.y-d+u,p=f-e.y-u,u>i.height?(e.y+=(h+p)/2,o=!0):p<0?(e.y+=p,o=!0):h>0&&(e.y+=h,o=!0)}var g=n||o,v=g?this.viewerElementToViewportRectangle(e):t.clone();return v.xConstrained=n,v.yConstrained=o,v.constraintApplied=g,v},_raiseConstraintsEvent:function(t){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:t})},applyConstraints:function(t){var e=this.getZoom(),i=this._applyZoomConstraints(e);e!==i&&this.zoomTo(i,this.zoomPoint,t);var n=this.getConstrainedBounds(!1);return n.constraintApplied&&(this.fitBounds(n,t),this._raiseConstraintsEvent(t)),this},ensureVisible:function(t){return this.applyConstraints(t)},_fitBounds:function(e,i){var n=(i=i||{}).immediately||!1,o=i.constraints||!1,r=this.getAspectRatio(),s=e.getCenter(),a=new t.Rect(e.x,e.y,e.width,e.height,e.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(n)return this.panTo(s,!0),this.zoomTo(l,null,!0),o&&this.applyConstraints(!0),this;var c=this.getCenter(!0),u=this.getZoom(!0);this.panTo(c,!0),this.zoomTo(u,null,!0);var h=this.getBounds(),p=this.getZoom();if(0===p||Math.abs(l/p-1)<1e-8)return this.zoomTo(l,null,!0),this.panTo(s,n),o&&this.applyConstraints(!1),this;if(o){this.panTo(s,!1),this.zoomTo(l,null,!1);var d=this.getConstrainedBounds();this.panTo(c,!0),this.zoomTo(u,null,!0),this.fitBounds(d)}else{var f=a.rotate(-this.getRotation()).getTopLeft().times(l).minus(h.getTopLeft().times(p)).divide(l-p);this.zoomTo(l,f,n)}return this},fitBounds:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!1})},fitBoundsWithConstraints:function(t,e){return this._fitBounds(t,{immediately:e,constraints:!0})},fitVertically:function(e){var i=new t.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(i,e)},fitHorizontally:function(e){var i=new t.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(i,e)},getConstrainedBounds:function(t){var e;return e=this.getBounds(t),this._applyBoundaryConstraints(e)},panBy:function(e,i){var n=new t.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(n.plus(e),i)},panTo:function(t,e){return e?(this.centerSpringX.resetTo(t.x),this.centerSpringY.resetTo(t.y)):(this.centerSpringX.springTo(t.x),this.centerSpringY.springTo(t.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:t,immediately:e}),this},zoomBy:function(t,e,i){return this.zoomTo(this.zoomSpring.target.value*t,e,i)},zoomTo:function(e,i,n){var o=this;return this.zoomPoint=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n?this._adjustCenterSpringsForZoomPoint((function(){o.zoomSpring.resetTo(e)})):this.zoomSpring.springTo(e),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:e,refPoint:i,immediately:n}),this},setRotation:function(t,e){return this.rotateTo(t,null,e)},getRotation:function(t){return t?this.degreesSpring.current.value:this.degreesSpring.target.value},setRotationWithPivot:function(t,e,i){return this.rotateTo(t,e,i)},rotateTo:function(e,i,n){if(!this.viewer||!this.viewer.drawer.canRotate())return this;if(this.degreesSpring.target.value===e&&this.degreesSpring.isAtTargetValue())return this;if(this.rotationPivot=i instanceof t.Point&&!isNaN(i.x)&&!isNaN(i.y)?i:null,n)if(this.rotationPivot){if(!(e-this._oldDegrees))return this.rotationPivot=null,this;this._rotateAboutPivot(e)}else this.degreesSpring.resetTo(e);else{var o=t.positiveModulo(this.degreesSpring.current.value,360),r=t.positiveModulo(e,360),s=r-o;s>180?r-=360:s<-180&&(r+=360);var a=o-r;this.degreesSpring.resetTo(e+a),this.degreesSpring.springTo(e)}return this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:e,immediately:!!n,pivot:this.rotationPivot||this.getCenter()}),this},rotateBy:function(t,e,i){return this.rotateTo(this.degreesSpring.target.value+t,e,i)},resize:function(t,e){var i,n=this.getBoundsNoRotate(),o=n;return this.containerSize.x=t.x,this.containerSize.y=t.y,this._updateContainerInnerSize(),e&&(i=t.x/this.containerSize.x,o.width=n.width*i,o.height=o.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:t,maintain:e}),this.fitBounds(o,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new t.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 t=this;this._adjustCenterSpringsForZoomPoint((function(){t.zoomSpring.update()})),this.degreesSpring.isAtTargetValue()&&(this.rotationPivot=null),this.centerSpringX.update(),this.centerSpringY.update(),this.rotationPivot?this._rotateAboutPivot(!0):this.degreesSpring.update();var e=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom||this.degreesSpring.current.value!==this._oldDegrees;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._oldDegrees=this.degreesSpring.current.value,e},_rotateAboutPivot:function(t){var e=!0===t,i=this.rotationPivot.minus(this.getCenter());this.centerSpringX.shiftBy(i.x),this.centerSpringY.shiftBy(i.y),e?this.degreesSpring.update():this.degreesSpring.resetTo(t);var n=this.degreesSpring.current.value-this._oldDegrees,o=i.rotate(-1*n).times(-1);this.centerSpringX.shiftBy(o.x),this.centerSpringY.shiftBy(o.y)},_adjustCenterSpringsForZoomPoint:function(t){if(this.zoomPoint){var e=this.pixelFromPoint(this.zoomPoint,!0);t();var i=this.pixelFromPoint(this.zoomPoint,!0).minus(e),n=this.deltaPointsFromPixels(i,!0);this.centerSpringX.shiftBy(n.x),this.centerSpringY.shiftBy(n.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else t()},deltaPixelsFromPointsNoRotate:function(t,e){return t.times(this._containerInnerSize.x*this.getZoom(e))},deltaPixelsFromPoints:function(t,e){return this.deltaPixelsFromPointsNoRotate(t.rotate(this.getRotation(e)),e)},deltaPointsFromPixelsNoRotate:function(t,e){return t.divide(this._containerInnerSize.x*this.getZoom(e))},deltaPointsFromPixels:function(t,e){return this.deltaPointsFromPixelsNoRotate(t,e).rotate(-this.getRotation(e))},pixelFromPointNoRotate:function(t,e){return this._pixelFromPointNoRotate(t,this.getBoundsNoRotate(e))},pixelFromPoint:function(t,e){return this._pixelFromPoint(t,this.getBoundsNoRotate(e))},_pixelFromPointNoRotate:function(e,i){return e.minus(i.getTopLeft()).times(this._containerInnerSize.x/i.width).plus(new t.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(t,e){return this._pixelFromPointNoRotate(t.rotate(this.getRotation(!0),this.getCenter(!0)),e)},pointFromPixelNoRotate:function(e,i){var n=this.getBoundsNoRotate(i);return e.minus(new t.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/n.width).plus(n.getTopLeft())},pointFromPixel:function(t,e){return this.pointFromPixelNoRotate(t,e).rotate(-this.getRotation(e),this.getCenter(e))},_viewportToImageDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e*this._contentSizeNoRotate.x/n,i*this._contentSizeNoRotate.x/n)},viewportToImageCoordinates:function(e,i){if(e instanceof t.Point)return this.viewportToImageCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).viewportToImageCoordinates(e,i,!0)}}return this._viewportToImageDelta(e-this._contentBoundsNoRotate.x,i-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(e,i){var n=this._contentBoundsNoRotate.width;return new t.Point(e/this._contentSizeNoRotate.x*n,i/this._contentSizeNoRotate.x*n)},imageToViewportCoordinates:function(e,i){if(e instanceof t.Point)return this.imageToViewportCoordinates(e.x,e.y);if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(1===n){return this.viewer.world.getItemAt(0).imageToViewportCoordinates(e,i,!0)}}var o=this._imageToViewportDelta(e,i);return o.x+=this._contentBoundsNoRotate.x,o.y+=this._contentBoundsNoRotate.y,o},imageToViewportRectangle:function(e,i,n,o){var r=e;if(r instanceof t.Rect||(r=new t.Rect(e,i,n,o)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(1===s){return this.viewer.world.getItemAt(0).imageToViewportRectangle(e,i,n,o,!0)}}var a=this.imageToViewportCoordinates(r.x,r.y),l=this._imageToViewportDelta(r.width,r.height);return new t.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewportToImageRectangle:function(e,i,n,o){var r=e;if(r instanceof t.Rect||(r=new t.Rect(e,i,n,o)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(1===s){return this.viewer.world.getItemAt(0).viewportToImageRectangle(e,i,n,o,!0)}}var a=this.viewportToImageCoordinates(r.x,r.y),l=this._viewportToImageDelta(r.width,r.height);return new t.Rect(a.x,a.y,l.x,l.y,r.degrees)},viewerElementToImageCoordinates:function(t){var e=this.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.pixelFromPoint(e,!0)},windowToImageCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(i)},imageToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer."),this.imageToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(t){return this.pointFromPixel(t,!0)},viewportToViewerElementCoordinates:function(t){return this.pixelFromPoint(t,!0)},viewerElementToViewportRectangle:function(e){return t.Rect.fromSummits(this.pointFromPixel(e.getTopLeft(),!0),this.pointFromPixel(e.getTopRight(),!0),this.pointFromPixel(e.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(e){return t.Rect.fromSummits(this.pixelFromPoint(e.getTopLeft(),!0),this.pixelFromPoint(e.getTopRight(),!0),this.pixelFromPoint(e.getBottomLeft(),!0))},windowToViewportCoordinates:function(e){t.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var i=e.minus(t.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(i)},viewportToWindowCoordinates:function(e){return t.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer."),this.viewportToViewerElementCoordinates(e).plus(t.getElementPosition(this.viewer.element))},viewportToImageZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).viewportToImageZoom(e)}}var n=this._contentSizeNoRotate.x;return e*(this._containerInnerSize.x/n*this._contentBoundsNoRotate.width)},imageToViewportZoom:function(e){if(this.viewer){var i=this.viewer.world.getItemCount();if(i>1)this.silenceMultiImageWarnings||t.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(1===i){return this.viewer.world.getItemAt(0).imageToViewportZoom(e)}}return e*(this._contentSizeNoRotate.x/this._containerInnerSize.x/this._contentBoundsNoRotate.width)},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(t){return this.flipped===t||(this.flipped=t,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:t})),this}}}(l),function(t){t.TiledImage=function(e){var i=this;t.console.assert(e.tileCache,"[TiledImage] options.tileCache is required"),t.console.assert(e.drawer,"[TiledImage] options.drawer is required"),t.console.assert(e.viewer,"[TiledImage] options.viewer is required"),t.console.assert(e.imageLoader,"[TiledImage] options.imageLoader is required"),t.console.assert(e.source,"[TiledImage] options.source is required"),t.console.assert(!e.clip||e.clip instanceof t.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present"),t.EventSource.call(this),this._tileCache=e.tileCache,delete e.tileCache,this._drawer=e.drawer,delete e.drawer,this._imageLoader=e.imageLoader,delete e.imageLoader,e.clip instanceof t.Rect&&(this._clip=e.clip.clone()),delete e.clip;var n=e.x||0;delete e.x;var o=e.y||0;delete e.y,this.normHeight=e.source.dimensions.y/e.source.dimensions.x,this.contentAspectX=e.source.dimensions.x/e.source.dimensions.y;var r=1;e.width?(r=e.width,delete e.width,e.height&&(t.console.error("specifying both width and height to a tiledImage is not supported"),delete e.height)):e.height&&(r=e.height/this.normHeight,delete e.height);var s=e.fitBounds;delete e.fitBounds;var a=e.fitBoundsPlacement||l.Placement.CENTER;delete e.fitBoundsPlacement;var c=e.degrees||0;delete e.degrees,t.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,springStiffness:t.DEFAULT_SETTINGS.springStiffness,animationTime:t.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:t.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:t.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:t.DEFAULT_SETTINGS.wrapVertical,immediateRender:t.DEFAULT_SETTINGS.immediateRender,blendTime:t.DEFAULT_SETTINGS.blendTime,alwaysBlend:t.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:t.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:t.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:t.DEFAULT_SETTINGS.iOSDevice,debugMode:t.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:t.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:t.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:t.DEFAULT_SETTINGS.placeholderFillStyle,opacity:t.DEFAULT_SETTINGS.opacity,preload:t.DEFAULT_SETTINGS.preload,compositeOperation:t.DEFAULT_SETTINGS.compositeOperation,subPixelRoundingForTransparency:t.DEFAULT_SETTINGS.subPixelRoundingForTransparency},e),this._preload=this.preload,delete this.preload,this._fullyLoaded=!1,this._xSpring=new t.Spring({initial:n,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._ySpring=new t.Spring({initial:o,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._scaleSpring=new t.Spring({initial:r,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._degreesSpring=new t.Spring({initial:c,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._updateForScale(),s&&this.fitBounds(s,a,!0),this._drawingHandler=function(e){i.viewer.raiseEvent("tile-drawing",t.extend({tiledImage:i},e))}},t.extend(t.TiledImage.prototype,t.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(t){t!==this._fullyLoaded&&(this._fullyLoaded=t,this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded}))},reset:function(){this._tileCache.clearTilesFor(this),this.lastResetTime=t.now(),this._needsDraw=!0},update:function(){var t=this._xSpring.update(),e=this._ySpring.update(),i=this._scaleSpring.update(),n=this._degreesSpring.update();return!!(t||e||i||n)&&(this._updateForScale(),this._needsDraw=!0,!0)},draw:function(){0!==this.opacity||this._preload?(this._midDraw=!0,this._updateViewport(),this._midDraw=!1):this._needsDraw=!1},destroy:function(){this.reset(),this.source.destroy&&this.source.destroy()},getBounds:function(t){return this.getBoundsNoRotate(t).rotate(this.getRotation(t),this._getRotationPoint(t))},getBoundsNoRotate:function(e){return e?new t.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new t.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){return t.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead"),this.getBounds()},getClippedBounds:function(e){var i=this.getBoundsNoRotate(e);if(this._clip){var n=(e?this._worldWidthCurrent:this._worldWidthTarget)/this.source.dimensions.x,o=this._clip.times(n);i=new t.Rect(i.x+o.x,i.y+o.y,o.width,o.height)}return i.rotate(this.getRotation(e),this._getRotationPoint(e))},getTileBounds:function(t,e,i){var n=this.source.getNumTiles(t),o=(n.x+e%n.x)%n.x,r=(n.y+i%n.y)%n.y,s=this.source.getTileBounds(t,o,r);return this.getFlip()&&(s.x=1-s.x-s.width),s.x+=(e-o)/n.x,s.y+=this._worldHeightCurrent/this._worldWidthCurrent*((i-r)/n.y),s},getContentSize:function(){return new t.Point(this.source.dimensions.x,this.source.dimensions.y)},getSizeInWindowCoordinates:function(){var e=this.imageToWindowCoordinates(new t.Point(0,0)),i=this.imageToWindowCoordinates(this.getContentSize());return new t.Point(i.x-e.x,i.y-e.y)},_viewportToImageDelta:function(e,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e*(this.source.dimensions.x/o),i*(this.source.dimensions.y*this.contentAspectX/o))},viewportToImageCoordinates:function(e,i,n){var o;return e instanceof t.Point?(n=i,o=e):o=new t.Point(e,i),o=o.rotate(-this.getRotation(n),this._getRotationPoint(n)),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(e,i,n){var o=n?this._scaleSpring.current.value:this._scaleSpring.target.value;return new t.Point(e/this.source.dimensions.x*o,i/this.source.dimensions.y/this.contentAspectX*o)},imageToViewportCoordinates:function(e,i,n){e instanceof t.Point&&(n=i,i=e.y,e=e.x);var o=this._imageToViewportDelta(e,i);return n?(o.x+=this._xSpring.current.value,o.y+=this._ySpring.current.value):(o.x+=this._xSpring.target.value,o.y+=this._ySpring.target.value),o.rotate(this.getRotation(n),this._getRotationPoint(n))},imageToViewportRectangle:function(e,i,n,o,r){var s=e;s instanceof t.Rect?r=i:s=new t.Rect(e,i,n,o);var a=this.imageToViewportCoordinates(s.getTopLeft(),r),l=this._imageToViewportDelta(s.width,s.height,r);return new t.Rect(a.x,a.y,l.x,l.y,s.degrees+this.getRotation(r))},viewportToImageRectangle:function(e,i,n,o,r){var s=e;e instanceof t.Rect?r=i:s=new t.Rect(e,i,n,o);var a=this.viewportToImageCoordinates(s.getTopLeft(),r),l=this._viewportToImageDelta(s.width,s.height,r);return new t.Rect(a.x,a.y,l.x,l.y,s.degrees-this.getRotation(r))},viewerElementToImageCoordinates:function(t){var e=this.viewport.pointFromPixel(t,!0);return this.viewportToImageCoordinates(e)},imageToViewerElementCoordinates:function(t){var e=this.imageToViewportCoordinates(t);return this.viewport.pixelFromPoint(e,!0)},windowToImageCoordinates:function(t){var e=t.minus(l.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(e)},imageToWindowCoordinates:function(t){return this.imageToViewerElementCoordinates(t).plus(l.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(e){var i=this._scaleSpring.current.value;return e=e.rotate(-this.getRotation(!0),this._getRotationPoint(!0)),new t.Rect((e.x-this._xSpring.current.value)/i,(e.y-this._ySpring.current.value)/i,e.width/i,e.height/i,e.degrees)},viewportToImageZoom:function(t){return this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x*t},imageToViewportZoom:function(t){return t/(this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x)},setPosition:function(t,e){var i=this._xSpring.target.value===t.x&&this._ySpring.target.value===t.y;if(e){if(i&&this._xSpring.current.value===t.x&&this._ySpring.current.value===t.y)return;this._xSpring.resetTo(t.x),this._ySpring.resetTo(t.y),this._needsDraw=!0}else{if(i)return;this._xSpring.springTo(t.x),this._ySpring.springTo(t.y),this._needsDraw=!0}i||this._raiseBoundsChange()},setWidth:function(t,e){this._setScale(t,e)},setHeight:function(t,e){this._setScale(t/this.normHeight,e)},setCroppingPolygons:function(e){var i=function(e){return e.map((function(e){try{if(function(e){return e instanceof t.Point||"number"==typeof e.x&&"number"==typeof e.y}(e))return{x:e.x,y:e.y};throw new Error}catch(i){throw new Error("A Provided cropping polygon point is not supported")}}))};try{if(!t.isArray(e))throw new Error("Provided cropping polygon is not an array");this._croppingPolygons=e.map((function(t){return i(t)}))}catch(n){t.console.error("[TiledImage.setCroppingPolygons] Cropping polygon format not supported"),t.console.error(n),this._croppingPolygons=null}},resetCroppingPolygons:function(){this._croppingPolygons=null},fitBounds:function(e,i,n){i=i||t.Placement.CENTER;var o=t.Placement.properties[i],r=this.contentAspectX,s=0,a=0,l=1,c=1;if(this._clip&&(r=this._clip.getAspectRatio(),l=this._clip.width/this.source.dimensions.x,c=this._clip.height/this.source.dimensions.y,e.getAspectRatio()>r?(s=this._clip.x/this._clip.height*e.height,a=this._clip.y/this._clip.height*e.height):(s=this._clip.x/this._clip.width*e.width,a=this._clip.y/this._clip.width*e.width)),e.getAspectRatio()>r){var u=e.height/c,h=0;o.isHorizontallyCentered?h=(e.width-e.height*r)/2:o.isRight&&(h=e.width-e.height*r),this.setPosition(new t.Point(e.x-s+h,e.y-a),n),this.setHeight(u,n)}else{var p=e.width/l,d=0;o.isVerticallyCentered?d=(e.height-e.width/r)/2:o.isBottom&&(d=e.height-e.width/r),this.setPosition(new t.Point(e.x-s,e.y-a+d),n),this.setWidth(p,n)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(e){t.console.assert(!e||e instanceof t.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),e instanceof t.Rect?this._clip=e.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getFlip:function(){return!!this.flipped},setFlip:function(t){this.flipped=!!t,this._needsDraw=!0,this._raiseBoundsChange()},getOpacity:function(){return this.opacity},setOpacity:function(t){t!==this.opacity&&(this.opacity=t,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(t){this._preload=!!t,this._needsDraw=!0},getRotation:function(t){return t?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(t,e){this._degreesSpring.target.value===t&&this._degreesSpring.isAtTargetValue()||(e?this._degreesSpring.resetTo(t):this._degreesSpring.springTo(t),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(t){return this.getBoundsNoRotate(t).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(t){t!==this.compositeOperation&&(this.compositeOperation=t,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(t,e){var i=this._scaleSpring.target.value===t;if(e){if(i&&this._scaleSpring.current.value===t)return;this._scaleSpring.resetTo(t),this._updateForScale(),this._needsDraw=!0}else{if(i)return;this._scaleSpring.springTo(t),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 t=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),e=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,i=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(e/this.minPixelRatio)/Math.log(2))));return i=Math.max(i,this.source.minLevel||0),{lowestLevel:t=Math.min(t,i),highestLevel:i}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){this.lastDrawn.pop().beingDrawn=!1}var e=this.viewport,i=this._viewportToTiledImageRectangle(e.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var n=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(null===(i=i.intersection(n)))return}for(var o=this._getLevelsInterval(),r=o.lowestLevel,s=o.highestLevel,a=null,l=!1,c=t.now(),u=s;u>=r;u--){var h=!1,p=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!0).x*this._scaleSpring.current.value;if(u===r||!l&&p>=this.minPixelRatio)h=!0,l=!0;else if(!l)continue;var d=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(u),!1).x*this._scaleSpring.current.value,f=e.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,g=this.immediateRender?1:f,v=Math.min(1,(p-.5)/.5),m=g/Math.abs(g-d);if(a=this._updateLevel(l,h,u,v,m,i,c,a),this._providesCoverage(this.coverage,u))break}this._drawTiles(this.lastDrawn),a&&!a.context2D?(this._loadTile(a,c),this._needsDraw=!0,this._setFullyLoaded(!1)):this._setFullyLoaded(0===this._tilesLoading)},_getCornerTiles:function(e,i,n){var o,r,s,a;this.wrapHorizontal?(o=t.positiveModulo(i.x,1),r=t.positiveModulo(n.x,1)):(o=Math.max(0,i.x),r=Math.min(1,n.x));var l=1/this.source.aspectRatio;this.wrapVertical?(s=t.positiveModulo(i.y,l),a=t.positiveModulo(n.y,l)):(s=Math.max(0,i.y),a=Math.min(l,n.y));var c=this.source.getTileAtPoint(e,new t.Point(o,s)),u=this.source.getTileAtPoint(e,new t.Point(r,a)),h=this.source.getNumTiles(e);return this.wrapHorizontal&&(c.x+=h.x*Math.floor(i.x),u.x+=h.x*Math.floor(n.x)),this.wrapVertical&&(c.y+=h.y*Math.floor(i.y/l),u.y+=h.y*Math.floor(n.y/l)),{topLeft:c,bottomRight:u}},_updateLevel:function(t,e,i,n,o,r,s,a){var l=r.getBoundingBox().getTopLeft(),c=r.getBoundingBox().getBottomRight();this.viewer&&this.viewer.raiseEvent("update-level",{tiledImage:this,havedrawn:t,level:i,opacity:n,visibility:o,drawArea:r,topleft:l,bottomright:c,currenttime:s,best:a}),this._resetCoverage(this.coverage,i),this._resetCoverage(this.loadingCoverage,i);var u=this._getCornerTiles(i,l,c),h=u.topLeft,p=u.bottomRight,d=this.source.getNumTiles(i),f=this.viewport.pixelFromPoint(this.viewport.getCenter());this.getFlip()&&(p.x+=1,this.wrapHorizontal||(p.x=Math.min(p.x,d.x-1)));for(var g=h.x;g<=p.x;g++)for(var v=h.y;v<=p.y;v++){var m;if(this.getFlip()){var y=(d.x+g%d.x)%d.x;m=g+d.x-y-y-1}else m=g;null!==r.intersection(this.getTileBounds(i,m,v))&&(a=this._updateTile(e,t,m,v,i,n,o,f,d,s,a))}return a},_updateTile:function(t,e,i,n,o,r,s,a,l,c,u){var h=this._getTile(i,n,o,c,l,this._worldWidthCurrent,this._worldHeightCurrent),p=e;this.viewer&&this.viewer.raiseEvent("update-tile",{tiledImage:this,tile:h}),this._setCoverage(this.coverage,o,i,n,!1);var d=h.loaded||h.loading||this._isCovered(this.loadingCoverage,o,i,n);if(this._setCoverage(this.loadingCoverage,o,i,n,d),!h.exists)return u;if(t&&!p&&(this._isCovered(this.coverage,o,i,n)?this._setCoverage(this.coverage,o,i,n,!0):p=!0),!p)return u;if(this._positionTile(h,this.source.tileOverlap,this.viewport,a,s),!h.loaded)if(h.context2D)this._setTileLoaded(h);else{var f=this._tileCache.getImageRecord(h.cacheKey);f&&this._setTileLoaded(h,f.getData())}h.loaded?this._blendTile(h,i,n,o,r,c)&&(this._needsDraw=!0):h.loading?this._tilesLoading++:d||(u=this._compareTiles(u,h));return u},_getTile:function(e,i,n,o,r,s,a){var l,c,u,h,p,d,f,g,v,m,y=this.tilesMatrix,w=this.source;return y[n]||(y[n]={}),y[n][e]||(y[n][e]={}),y[n][e][i]&&!y[n][e][i].flipped==!this.flipped||(l=(r.x+e%r.x)%r.x,c=(r.y+i%r.y)%r.y,u=this.getTileBounds(n,e,i),h=w.getTileBounds(n,l,c,!0),p=w.tileExists(n,l,c),d=w.getTileUrl(n,l,c),f=w.getTilePostData(n,l,c),this.loadTilesWithAjax?(g=w.getTileAjaxHeaders(n,l,c),t.isPlainObject(this.ajaxHeaders)&&(g=t.extend({},this.ajaxHeaders,g))):g=null,v=w.getContext2D?w.getContext2D(n,l,c):void 0,m=new t.Tile(n,e,i,u,p,d,v,this.loadTilesWithAjax,g,h,f,w.getTileHashKey(n,l,c,d,g,f)),this.getFlip()?0===l&&(m.isRightMost=!0):l===r.x-1&&(m.isRightMost=!0),c===r.y-1&&(m.isBottomMost=!0),m.flipped=this.flipped,y[n][e][i]=m),(m=y[n][e][i]).lastTouchTime=o,m},_loadTile:function(t,e){var i=this;t.loading=!0,this._imageLoader.addJob({src:t.getUrl(),tile:t,source:this.source,postData:t.postData,loadWithAjax:t.loadWithAjax,ajaxHeaders:t.ajaxHeaders,crossOriginPolicy:this.crossOriginPolicy,ajaxWithCredentials:this.ajaxWithCredentials,callback:function(n,o,r){i._onTileLoad(t,e,n,o,r)},abort:function(){t.loading=!1}})},_onTileLoad:function(e,i,n,o,r){if(!n)return t.console.error("Tile %s failed to load: %s - error: %s",e,e.getUrl(),o),this.viewer.raiseEvent("tile-load-failed",{tile:e,tiledImage:this,time:i,message:o,tileRequest:r}),e.loading=!1,void(e.exists=!1);if(i<this.lastResetTime)return t.console.warn("Ignoring tile %s loaded before reset: %s",e,e.getUrl()),void(e.loading=!1);var s=this,a=function(){var t=s.source.getClosestLevel();s._setTileLoaded(e,n,t,r)};this._midDraw?window.setTimeout(a,1):a()},_setTileLoaded:function(e,i,n,o){var r=0,s=this;function a(){return r++,l}function l(){0===--r&&(e.loading=!1,e.loaded=!0,e.hasTransparency=s.source.hasTransparency(e.context2D,e.getUrl(),e.ajaxHeaders,e.postData),e.context2D||s._tileCache.cacheTile({data:i,tile:e,cutoff:n,tiledImage:s}),s._needsDraw=!0)}this.viewer.raiseEvent("tile-loaded",{tile:e,tiledImage:this,tileRequest:o,get image(){return t.console.error("[tile-loaded] event 'image' has been deprecated. Use 'data' property instead."),i},data:i,getCompletionCallback:a}),a()()},_positionTile:function(e,i,n,o,r){var s=e.bounds.getTopLeft();s.x*=this._scaleSpring.current.value,s.y*=this._scaleSpring.current.value,s.x+=this._xSpring.current.value,s.y+=this._ySpring.current.value;var a=e.bounds.getSize();a.x*=this._scaleSpring.current.value,a.y*=this._scaleSpring.current.value;var l=n.pixelFromPointNoRotate(s,!0),c=n.pixelFromPointNoRotate(s,!1),u=n.deltaPixelsFromPointsNoRotate(a,!0),h=n.deltaPixelsFromPointsNoRotate(a,!1),p=c.plus(h.divide(2)),d=o.squaredDistanceTo(p);i||(u=u.plus(new t.Point(1,1))),e.isRightMost&&this.wrapHorizontal&&(u.x+=.75),e.isBottomMost&&this.wrapVertical&&(u.y+=.75),e.position=l,e.size=u,e.squaredDistance=d,e.visibility=r},_blendTile:function(t,e,i,n,o,r){var s,a,l=1e3*this.blendTime;if(t.blendStart||(t.blendStart=r),s=r-t.blendStart,a=l?Math.min(1,s/l):1,this.alwaysBlend&&(a*=o),t.opacity=a,this.lastDrawn.push(t),1===a)this._setCoverage(this.coverage,n,e,i,!0),this._hasOpaqueTile=!0;else if(s<l)return!0;return!1},_compareTiles:function(t,e){return t?e.visibility>t.visibility||e.visibility===t.visibility&&e.squaredDistance<t.squaredDistance?e:t:e},_drawTiles:function(o){if(0!==this.opacity&&(0!==o.length||this.placeholderFillStyle)){var r,s,a,l=o[0];l&&(r=this.opacity<1||this.compositeOperation&&"source-over"!==this.compositeOperation||!this._isBottomItem()&&this.source.hasTransparency(l.context2D,l.getUrl(),l.ajaxHeaders,l.postData));var c,u=this.viewport.getZoom(!0),h=this.viewportToImageZoom(u);o.length>1&&h>this.smoothTileEdgesMinZoom&&!this.iOSDevice&&this.getRotation(!0)%360==0&&t.supportsCanvas&&this.viewer.useCanvas&&(r=!0,s=l.getScaleForEdgeSmoothing(),a=l.getTranslationForEdgeSmoothing(s,this._drawer.getCanvasSize(!1),this._drawer.getCanvasSize(!0))),r&&(s||(c=this.viewport.viewportToViewerElementRectangle(this.getClippedBounds(!0)).getIntegerBoundingBox(),this._drawer.viewer.viewport.getFlip()&&(this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0||(c.x=this._drawer.viewer.container.clientWidth-(c.x+c.width))),c=c.times(t.pixelDensityRatio)),this._drawer._clear(!0,c)),s||(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:r}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:r}),this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip());var p=!1;if(this._clip){this._drawer.saveContext(r);var d=this.imageToViewportRectangle(this._clip,!0);d=d.rotate(-this.getRotation(!0),this._getRotationPoint(!0));var f=this._drawer.viewportToDrawerRectangle(d);s&&(f=f.times(s)),a&&(f=f.translate(a)),this._drawer.setClip(f,r),p=!0}if(this._croppingPolygons){var g=this;this._drawer.saveContext(r);try{var v=this._croppingPolygons.map((function(t){return t.map((function(t){var e=g.imageToViewportCoordinates(t.x,t.y,!0).rotate(-g.getRotation(!0),g._getRotationPoint(!0)),i=g._drawer.viewportCoordToDrawerCoord(e);return s&&(i=i.times(s)),i}))}));this._drawer.clipWithPolygons(v,r)}catch(T){t.console.error(T)}p=!0}if(this.placeholderFillStyle&&!1===this._hasOpaqueTile){var m=this._drawer.viewportToDrawerRectangle(this.getBounds(!0));s&&(m=m.times(s)),a&&(m=m.translate(a));var y=null;y="function"==typeof this.placeholderFillStyle?this.placeholderFillStyle(this,this._drawer.context):this.placeholderFillStyle,this._drawer.drawRectangle(m,y,r)}var w=function(o){if("number"==typeof o)return n(o);if(!o||!t.Browser)return e;var r=o[t.Browser.vendor];i(r)&&(r=o["*"]);return n(r)}(this.subPixelRoundingForTransparency),x=!1;if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)x=!0;else if(w===t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST){x=!(this.viewer&&this.viewer.isAnimating())}for(var b=o.length-1;b>=0;b--)l=o[b],this._drawer.drawTile(l,this._drawingHandler,r,s,a,x,this.source),l.beingDrawn=!0,this.viewer&&this.viewer.raiseEvent("tile-drawn",{tiledImage:this,tile:l});p&&this._drawer.restoreContext(r),s||(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(r),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(r)),r&&(s&&(this.viewport.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.viewport.getRotation(!0),useSketch:!1}),this.getRotation(!0)%360!=0&&this._drawer._offsetForRotation({degrees:this.getRotation(!0),point:this.viewport.pixelFromPointNoRotate(this._getRotationPoint(!0),!0),useSketch:!1})),this._drawer.blendSketch({opacity:this.opacity,scale:s,translate:a,compositeOperation:this.compositeOperation,bounds:c}),s&&(this.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1),this.viewport.getRotation(!0)%360!=0&&this._drawer._restoreRotationChanges(!1))),s||this.viewport.getRotation(!0)%360==0&&this.getRotation(!0)%360==0&&this._drawer.viewer.viewport.getFlip()&&this._drawer._flip(),this._drawDebugInfo(o)}},_drawDebugInfo:function(e){if(this.debugMode)for(var i=e.length-1;i>=0;i--){var n=e[i];try{this._drawer.drawDebugInfo(n,e.length,i,this)}catch(o){t.console.error(o)}}},_providesCoverage:function(t,e,i,n){var o,r,s,a;if(!t[e])return!1;if(void 0===i||void 0===n){for(s in o=t[e])if(Object.prototype.hasOwnProperty.call(o,s))for(a in r=o[s])if(Object.prototype.hasOwnProperty.call(r,a)&&!r[a])return!1;return!0}return void 0===t[e][i]||void 0===t[e][i][n]||!0===t[e][i][n]},_isCovered:function(t,e,i,n){return void 0===i||void 0===n?this._providesCoverage(t,e+1):this._providesCoverage(t,e+1,2*i,2*n)&&this._providesCoverage(t,e+1,2*i,2*n+1)&&this._providesCoverage(t,e+1,2*i+1,2*n)&&this._providesCoverage(t,e+1,2*i+1,2*n+1)},_setCoverage:function(e,i,n,o,r){e[i]?(e[i][n]||(e[i][n]={}),e[i][n][o]=r):t.console.warn("Setting coverage for a tile before its level's coverage has been reset: %s",i)},_resetCoverage:function(t,e){t[e]={}}});var e=t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;function i(e){return e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST&&e!==t.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}function n(t){return i(t)?e:t}}(l),function(t){var e=function(e){t.console.assert(e,"[TileCache.cacheTile] options is required"),t.console.assert(e.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(e.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=e.tile,this.tiledImage=e.tiledImage},i=function(e){t.console.assert(e,"[ImageRecord] options is required"),t.console.assert(e.data,"[ImageRecord] options.data is required"),this._tiles=[],e.create.apply(null,[this,e.data,e.ownerTile]),this._destroyImplementation=e.destroy.bind(null,this),this.getImage=e.getImage.bind(null,this),this.getData=e.getData.bind(null,this),this.getRenderedContext=e.getRenderedContext.bind(null,this),this.getCopyRenderedContext=e.getCopyRenderedContext.bind(null,this)};i.prototype={destroy:function(){this._destroyImplementation(),this._tiles=null},addTile:function(e){t.console.assert(e,"[ImageRecord.addTile] tile is required"),this._tiles.push(e)},removeTile:function(e){for(var i=0;i<this._tiles.length;i++)if(this._tiles[i]===e)return void this._tiles.splice(i,1);t.console.warn("[ImageRecord.removeTile] trying to remove unknown tile",e)},getTileCount:function(){return this._tiles.length}},t.TileCache=function(e){e=e||{},this._maxImageCacheCount=e.maxImageCacheCount||t.DEFAULT_SETTINGS.maxImageCacheCount,this._tilesLoaded=[],this._imagesLoaded=[],this._imagesLoadedCount=0},t.TileCache.prototype={numTilesLoaded:function(){return this._tilesLoaded.length},cacheTile:function(n){t.console.assert(n,"[TileCache.cacheTile] options is required"),t.console.assert(n.tile,"[TileCache.cacheTile] options.tile is required"),t.console.assert(n.tile.cacheKey,"[TileCache.cacheTile] options.tile.cacheKey is required"),t.console.assert(n.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");var o=n.cutoff||0,r=this._tilesLoaded.length,s=this._imagesLoaded[n.tile.cacheKey];if(s||(n.data||(t.console.error("[TileCache.cacheTile] options.image was renamed to options.data. '.image' attribute has been deprecated and will be removed in the future."),n.data=n.image),t.console.assert(n.data,"[TileCache.cacheTile] options.data is required to create an ImageRecord"),s=this._imagesLoaded[n.tile.cacheKey]=new i({data:n.data,ownerTile:n.tile,create:n.tiledImage.source.createTileCache,destroy:n.tiledImage.source.destroyTileCache,getImage:n.tiledImage.source.getTileCacheDataAsImage,getData:n.tiledImage.source.getTileCacheData,getRenderedContext:n.tiledImage.source.getTileCacheDataAsContext2D,getCopyRenderedContext:n.tiledImage.source.getCopyTileCacheDataAsContext2D}),this._imagesLoadedCount++),s.addTile(n.tile),n.tile.cacheImageRecord=s,this._imagesLoadedCount>this._maxImageCacheCount){for(var a,l,c,u,h,p,d=null,f=-1,g=null,v=this._tilesLoaded.length-1;v>=0;v--)(a=(p=this._tilesLoaded[v]).tile).level<=o||a.beingDrawn||(d?(u=a.lastTouchTime,l=d.lastTouchTime,h=a.level,c=d.level,(u<l||u===l&&h>c)&&(d=a,f=v,g=p)):(d=a,f=v,g=p));d&&f>=0&&(this._unloadTile(g),r=f)}this._tilesLoaded[r]=new e({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(e){var i;t.console.assert(e,"[TileCache.clearTilesFor] tiledImage is required");for(var n=0;n<this._tilesLoaded.length;++n)(i=this._tilesLoaded[n]).tiledImage===e&&(this._unloadTile(i),this._tilesLoaded.splice(n,1),n--)},getImageRecord:function(e){return t.console.assert(e,"[TileCache.getImageRecord] cacheKey is required"),this._imagesLoaded[e]},_unloadTile:function(e){t.console.assert(e,"[TileCache._unloadTile] tileRecord is required");var i=e.tile,n=e.tiledImage;i.unload(),i.cacheImageRecord=null;var o=this._imagesLoaded[i.cacheKey];o.removeTile(i),o.getTileCount()||(o.destroy(),delete this._imagesLoaded[i.cacheKey],this._imagesLoadedCount--),n.viewer.raiseEvent("tile-unloaded",{tile:i,tiledImage:n})}}}(l),function(t){t.World=function(e){var i=this;t.console.assert(e.viewer,"[World] options.viewer is required"),t.EventSource.call(this),this.viewer=e.viewer,this._items=[],this._needsDraw=!1,this._autoRefigureSizes=!0,this._needsSizesFigured=!1,this._delegatedFigureSizes=function(t){i._autoRefigureSizes?i._figureSizes():i._needsSizesFigured=!0},this._figureSizes()},t.extend(t.World.prototype,t.EventSource.prototype,{addItem:function(e,i){if(t.console.assert(e,"[World.addItem] item is required"),t.console.assert(e instanceof t.TiledImage,"[World.addItem] only TiledImages supported at this time"),void 0!==(i=i||{}).index){var n=Math.max(0,Math.min(this._items.length,i.index));this._items.splice(n,0,e)}else this._items.push(e);this._autoRefigureSizes?this._figureSizes():this._needsSizesFigured=!0,this._needsDraw=!0,e.addHandler("bounds-change",this._delegatedFigureSizes),e.addHandler("clip-change",this._delegatedFigureSizes),this.raiseEvent("add-item",{item:e})},getItemAt:function(e){return t.console.assert(void 0!==e,"[World.getItemAt] index is required"),this._items[e]},getIndexOfItem:function(e){return t.console.assert(e,"[World.getIndexOfItem] item is required"),t.indexOf(this._items,e)},getItemCount:function(){return this._items.length},setItemIndex:function(e,i){t.console.assert(e,"[World.setItemIndex] item is required"),t.console.assert(void 0!==i,"[World.setItemIndex] index is required");var n=this.getIndexOfItem(e);if(i>=this._items.length)throw new Error("Index bigger than number of layers.");i!==n&&-1!==n&&(this._items.splice(n,1),this._items.splice(i,0,e),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:e,previousIndex:n,newIndex:i}))},removeItem:function(e){t.console.assert(e,"[World.removeItem] item is required");var i=t.indexOf(this._items,e);-1!==i&&(e.removeHandler("bounds-change",this._delegatedFigureSizes),e.removeHandler("clip-change",this._delegatedFigureSizes),e.destroy(),this._items.splice(i,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(e))},removeAll:function(){var t,e;for(this.viewer._cancelPendingImages(),e=0;e<this._items.length;e++)(t=this._items[e]).removeHandler("bounds-change",this._delegatedFigureSizes),t.removeHandler("clip-change",this._delegatedFigureSizes),t.destroy();var i=this._items;for(this._items=[],this._figureSizes(),this._needsDraw=!0,e=0;e<i.length;e++)t=i[e],this._raiseRemoveItem(t)},resetItems:function(){for(var t=0;t<this._items.length;t++)this._items[t].reset()},update:function(){for(var t=!1,e=0;e<this._items.length;e++)t=this._items[e].update()||t;return t},draw:function(){for(var t=0;t<this._items.length;t++)this._items[t].draw();this._needsDraw=!1},needsDraw:function(){for(var t=0;t<this._items.length;t++)if(this._items[t].needsDraw())return!0;return this._needsDraw},getHomeBounds:function(){return this._homeBounds.clone()},getContentFactor:function(){return this._contentFactor},setAutoRefigureSizes:function(t){this._autoRefigureSizes=t,t&this._needsSizesFigured&&(this._figureSizes(),this._needsSizesFigured=!1)},arrange:function(e){var i,n=(e=e||{}).immediately||!1,o=e.layout||t.DEFAULT_SETTINGS.collectionLayout,r=e.rows||t.DEFAULT_SETTINGS.collectionRows,s=e.columns||t.DEFAULT_SETTINGS.collectionColumns,a=e.tileSize||t.DEFAULT_SETTINGS.collectionTileSize,l=a+(e.tileMargin||t.DEFAULT_SETTINGS.collectionTileMargin);i=!e.rows&&s?s:Math.ceil(this._items.length/r);var c,u,h,p,d,f=0,g=0;this.setAutoRefigureSizes(!1);for(var v=0;v<this._items.length;v++)v&&v%i==0&&("horizontal"===o?(g+=l,f=0):(f+=l,g=0)),p=(h=(u=(c=this._items[v]).getBounds()).width>u.height?a:a*(u.width/u.height))*(u.height/u.width),d=new t.Point(f+(a-h)/2,g+(a-p)/2),c.setPosition(d,n),c.setWidth(h,n),"horizontal"===o?f+=l:g+=l;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var e=this._homeBounds?this._homeBounds.clone():null,i=this._contentSize?this._contentSize.clone():null,n=this._contentFactor||0;if(this._items.length){var o=this._items[0],r=o.getBounds();this._contentFactor=o.getContentSize().x/r.width;for(var s=o.getClippedBounds().getBoundingBox(),a=s.x,l=s.y,c=s.x+s.width,u=s.y+s.height,h=1;h<this._items.length;h++)r=(o=this._items[h]).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),c=Math.max(c,s.x+s.width),u=Math.max(u,s.y+s.height);this._homeBounds=new t.Rect(a,l,c-a,u-l),this._contentSize=new t.Point(this._homeBounds.width*this._contentFactor,this._homeBounds.height*this._contentFactor)}else this._homeBounds=new t.Rect(0,0,1,1),this._contentSize=new t.Point(1,1),this._contentFactor=1;this._contentFactor===n&&this._homeBounds.equals(e)&&this._contentSize.equals(i)||this.raiseEvent("metrics-change",{})},_raiseRemoveItem:function(t){this.raiseEvent("remove-item",{item:t})}})}(l)},function(t,e,i){var n=i(56),o=i(43);t.exports=function(t){return n(o(t))}},function(t,e,i){var n=i(43);t.exports=function(t){return Object(n(t))}},function(t,e,i){var n=i(19),o=i(81),r=i(24),s=i(57),a=Object.defineProperty;e.f=n?a:function(t,e,i){if(r(t),e=s(e,!0),r(i),o)try{return a(t,e,i)}catch(n){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var n=i(15);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,i){var n=i(19),o=i(12),r=i(16),s=Object.defineProperty,a={},l=function(t){throw t};t.exports=function(t,e){if(r(a,t))return a[t];e||(e={});var i=[][t],c=!!r(e,"ACCESSORS")&&e.ACCESSORS,u=r(e,0)?e[0]:l,h=r(e,1)?e[1]:void 0;return a[t]=!!i&&!o((function(){if(c&&!n)return!0;var t={length:-1};c?s(t,1,{enumerable:!0,get:l}):t[1]=1,i.call(t,u,h)}))}},function(t,e,i){var n=i(19),o=i(23),r=i(41);t.exports=n?function(t,e,i){return o.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){"use strict";var n=i(0),o=i(30).map,r=i(51),s=i(25),a=r("map"),l=s("map");n({target:"Array",proto:!0,forced:!a||!l},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(37),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,e,i){"use strict";var n=i(0),o=i(30).filter,r=i(51),s=i(25),a=r("filter"),l=s("filter");n({target:"Array",proto:!0,forced:!a||!l},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(94),o=i(56),r=i(22),s=i(28),a=i(74),l=[].push,c=function(t){var e=1==t,i=2==t,c=3==t,u=4==t,h=6==t,p=5==t||h;return function(d,f,g,v){for(var m,y,w=r(d),x=o(w),b=n(f,g,3),T=s(x.length),S=0,P=v||a,E=e?P(d,T):i?P(d,0):void 0;T>S;S++)if((p||S in x)&&(y=b(m=x[S],S,w),t))if(e)E[S]=y;else if(y)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:l.call(E,m)}else if(u)return!1;return h?-1:c||u?u:E}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6)}},function(t,e,i){var n=i(0),o=i(110);n({target:"Array",stat:!0,forced:!i(114)((function(t){Array.from(t)}))},{from:o})},function(t,e,i){"use strict";var n=i(0),o=i(15),r=i(46),s=i(62),a=i(28),l=i(21),c=i(49),u=i(13),h=i(51),p=i(25),d=h("slice"),f=p("slice",{ACCESSORS:!0,0:0,1:2}),g=u("species"),v=[].slice,m=Math.max;n({target:"Array",proto:!0,forced:!d||!f},{slice:function(t,e){var i,n,u,h=l(this),p=a(h.length),d=s(t,p),f=s(void 0===e?p:e,p);if(r(h)&&("function"!=typeof(i=h.constructor)||i!==Array&&!r(i.prototype)?o(i)&&null===(i=i[g])&&(i=void 0):i=void 0,i===Array||void 0===i))return v.call(h,d,f);for(n=new(void 0===i?Array:i)(m(f-d,0)),u=0;d<f;d++,u++)d in h&&c(n,u,h[d]);return n.length=u,n}})},function(t,e,i){var n=i(19),o=i(23).f,r=Function.prototype,s=r.toString,a=/^\s*function ([^ (]*)/,l="name";n&&!(l in r)&&o(r,l,{configurable:!0,get:function(){try{return s.call(this).match(a)[1]}catch(t){return""}}})},function(t,e,i){var n=i(0),o=i(12),r=i(21),s=i(40).f,a=i(19),l=o((function(){s(1)}));n({target:"Object",stat:!0,forced:!a||l,sham:!a},{getOwnPropertyDescriptor:function(t,e){return s(r(t),e)}})},function(t,e,i){var n=i(0),o=i(19),r=i(86),s=i(21),a=i(40),l=i(49);n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){for(var e,i,n=s(t),o=a.f,c=r(n),u={},h=0;c.length>h;)void 0!==(i=o(n,e=c[h++]))&&l(u,e,i);return u}})},function(t,e,i){var n=i(0),o=i(22),r=i(64);n({target:"Object",stat:!0,forced:i(12)((function(){r(1)}))},{keys:function(t){return r(o(t))}})},function(t,e){var i=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:i)(t)}},function(t,e,i){"use strict";var n=i(0),o=i(12),r=i(46),s=i(15),a=i(22),l=i(28),c=i(49),u=i(74),h=i(51),p=i(13),d=i(100),f=p("isConcatSpreadable"),g=9007199254740991,v="Maximum allowed index exceeded",m=d>=51||!o((function(){var t=[];return t[f]=!1,t.concat()[0]!==t})),y=h("concat"),w=function(t){if(!s(t))return!1;var e=t[f];return void 0!==e?!!e:r(t)};n({target:"Array",proto:!0,forced:!m||!y},{concat:function(t){var e,i,n,o,r,s=a(this),h=u(s,0),p=0;for(e=-1,n=arguments.length;e<n;e++)if(w(r=-1===e?s:arguments[e])){if(p+(o=l(r.length))>g)throw TypeError(v);for(i=0;i<o;i++,p++)i in r&&c(h,p,r[i])}else{if(p>=g)throw TypeError(v);c(h,p++,r)}return h.length=p,h}})},function(t,e,i){"use strict";var n=i(0),o=i(30).findIndex,r=i(50),s=i(25),a="findIndex",l=!0,c=s(a);a in[]&&Array(1).findIndex((function(){l=!1})),n({target:"Array",proto:!0,forced:l||!c},{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(a)},function(t,e,i){var n=i(19),o=i(66),r=i(41),s=i(21),a=i(57),l=i(16),c=i(81),u=Object.getOwnPropertyDescriptor;e.f=n?u:function(t,e){if(t=s(t),e=a(e,!0),c)try{return u(t,e)}catch(i){}if(l(t,e))return r(!o.f.call(t,e),t[e])}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var n=i(14),o=i(26),r=i(16),s=i(67),a=i(83),l=i(58),c=l.get,u=l.enforce,h=String(String).split("String");(t.exports=function(t,e,i,a){var l=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,p=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof e||r(i,"name")||o(i,"name",e),u(i).source=h.join("string"==typeof e?e:"")),t!==n?(l?!p&&t[e]&&(c=!0):delete t[e],c?t[e]=i:o(t,e,i)):c?t[e]=i:s(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&c(this).source||a(this)}))},function(t,e,i){var n=i(87),o=i(14),r=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?r(n[t])||r(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},function(t,e,i){var n=i(42);t.exports=Array.isArray||function(t){return"Array"==n(t)}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e){t.exports={}},function(t,e,i){"use strict";var n=i(57),o=i(23),r=i(41);t.exports=function(t,e,i){var s=n(e);s in t?o.f(t,s,r(0,i)):t[s]=i}},function(t,e,i){var n=i(13),o=i(63),r=i(23),s=n("unscopables"),a=Array.prototype;null==a[s]&&r.f(a,s,{configurable:!0,value:o(null)}),t.exports=function(t){a[s][t]=!0}},function(t,e,i){var n=i(12),o=i(13),r=i(100),s=o("species");t.exports=function(t){return r>=51||!n((function(){var e=[];return(e.constructor={})[s]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},function(t,e,i){"use strict";var n=i(12);t.exports=function(t,e){var i=[][t];return!!i&&n((function(){i.call(null,e||function(){throw 1},1)}))}},function(t,e,i){"use strict";var n=i(0),o=i(37),r=i(123),s=i(124),a=i(12),l=1..toFixed,c=Math.floor,u=function(t,e,i){return 0===e?i:e%2==1?u(t,e-1,i*t):u(t*t,e/2,i)};n({target:"Number",proto:!0,forced:l&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!a((function(){l.call({})}))},{toFixed:function(t){var e,i,n,a,l=r(this),h=o(t),p=[0,0,0,0,0,0],d="",f="0",g=function(t,e){for(var i=-1,n=e;++i<6;)n+=t*p[i],p[i]=n%1e7,n=c(n/1e7)},v=function(t){for(var e=6,i=0;--e>=0;)i+=p[e],p[e]=c(i/t),i=i%t*1e7},m=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==p[t]){var i=String(p[t]);e=""===e?i:e+s.call("0",7-i.length)+i}return e};if(h<0||h>20)throw RangeError("Incorrect fraction digits");if(l!=l)return"NaN";if(l<=-1e21||l>=1e21)return String(l);if(l<0&&(d="-",l=-l),l>1e-21)if(i=(e=function(t){for(var e=0,i=t;i>=4096;)e+=12,i/=4096;for(;i>=2;)e+=1,i/=2;return e}(l*u(2,69,1))-69)<0?l*u(2,-e,1):l/u(2,e,1),i*=4503599627370496,(e=52-e)>0){for(g(0,i),n=h;n>=7;)g(1e7,0),n-=7;for(g(u(10,n,1),0),n=e-1;n>=23;)v(1<<23),n-=23;v(1<<n),g(1,1),v(2),f=m()}else g(0,i),g(1<<-e,0),f=m()+s.call("0",h);return f=h>0?d+((a=f.length)<=h?"0."+s.call("0",h-a)+f:f.slice(0,a-h)+"."+f.slice(a-h)):d+f}})},function(t,e,i){"use strict";var n=i(0),o=i(62),r=i(37),s=i(28),a=i(22),l=i(74),c=i(49),u=i(51),h=i(25),p=u("splice"),d=h("splice",{ACCESSORS:!0,0:0,1:2}),f=Math.max,g=Math.min,v=9007199254740991,m="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!p||!d},{splice:function(t,e){var i,n,u,h,p,d,y=a(this),w=s(y.length),x=o(t,w),b=arguments.length;if(0===b?i=n=0:1===b?(i=0,n=w-x):(i=b-2,n=g(f(r(e),0),w-x)),w+i-n>v)throw TypeError(m);for(u=l(y,n),h=0;h<n;h++)(p=x+h)in y&&c(u,h,y[p]);if(u.length=n,i<n){for(h=x;h<w-n;h++)d=h+i,(p=h+n)in y?y[d]=y[p]:delete y[d];for(h=w;h>w-n+i;h--)delete y[h-1]}else if(i>n)for(h=w-n;h>x;h--)d=h+i-1,(p=h+n-1)in y?y[d]=y[p]:delete y[d];for(h=0;h<i;h++)y[h+x]=arguments[h+2];return y.length=w-n+i,u}})},function(t,e,i){var n=i(0),o=i(126),r=i(50);n({target:"Array",proto:!0},{fill:o}),r("fill")},function(t,e,i){var n=i(12),o=i(42),r="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?r.call(t,""):Object(t)}:Object},function(t,e,i){var n=i(15);t.exports=function(t,e){if(!n(t))return t;var i,o;if(e&&"function"==typeof(i=t.toString)&&!n(o=i.call(t)))return o;if("function"==typeof(i=t.valueOf)&&!n(o=i.call(t)))return o;if(!e&&"function"==typeof(i=t.toString)&&!n(o=i.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var n,o,r,s=i(105),a=i(14),l=i(15),c=i(26),u=i(16),h=i(59),p=i(61),d=a.WeakMap;if(s){var f=new d,g=f.get,v=f.has,m=f.set;n=function(t,e){return m.call(f,t,e),e},o=function(t){return g.call(f,t)||{}},r=function(t){return v.call(f,t)}}else{var y=h("state");p[y]=!0,n=function(t,e){return c(t,y,e),e},o=function(t){return u(t,y)?t[y]:{}},r=function(t){return u(t,y)}}t.exports={set:n,get:o,has:r,enforce:function(t){return r(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return i}}}},function(t,e,i){var n=i(68),o=i(69),r=n("keys");t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e){t.exports=!1},function(t,e){t.exports={}},function(t,e,i){var n=i(37),o=Math.max,r=Math.min;t.exports=function(t,e){var i=n(t);return i<0?o(i+e,0):r(i,e)}},function(t,e,i){var n,o=i(24),r=i(107),s=i(71),a=i(61),l=i(108),c=i(82),u=i(59),h=u("IE_PROTO"),p=function(){},d=function(t){return"<script>"+t+"</"+"script>"},f=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(o){}var t,e;f=n?function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e}(n):((e=c("iframe")).style.display="none",l.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F);for(var i=s.length;i--;)delete f.prototype[s[i]];return f()};a[h]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(p.prototype=o(t),i=new p,p.prototype=null,i[h]=t):i=f(),void 0===e?i:r(i,e)}},function(t,e,i){var n=i(88),o=i(71);t.exports=Object.keys||function(t){return n(t,o)}},function(t,e,i){"use strict";var n=i(0),o=i(30).find,r=i(50),s=i(25),a="find",l=!0,c=s(a);a in[]&&Array(1).find((function(){l=!1})),n({target:"Array",proto:!0,forced:l||!c},{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(a)},function(t,e,i){"use strict";var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,r=o&&!n.call({1:2},1);e.f=r?function(t){var e=o(this,t);return!!e&&e.enumerable}:n},function(t,e,i){var n=i(14),o=i(26);t.exports=function(t,e){try{o(n,t,e)}catch(i){n[t]=e}return e}},function(t,e,i){var n=i(60),o=i(84);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e){var i=0,n=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++i+n).toString(36)}},function(t,e,i){var n=i(88),o=i(71).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,i){var n=i(12);t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},function(t,e,i){var n=i(23).f,o=i(16),r=i(13)("toStringTag");t.exports=function(t,e,i){t&&!o(t=i?t:t.prototype,r)&&n(t,r,{configurable:!0,value:e})}},function(t,e,i){var n=i(15),o=i(46),r=i(13)("species");t.exports=function(t,e){var i;return o(t)&&("function"!=typeof(i=t.constructor)||i!==Array&&!o(i.prototype)?n(i)&&null===(i=i[r])&&(i=void 0):i=void 0),new(void 0===i?Array:i)(0===e?0:e)}},function(t,e,i){var n={};n[i(13)("toStringTag")]="z",t.exports="[object z]"===String(n)},function(t,e,i){var n=i(16),o=i(22),r=i(59),s=i(98),a=r("IE_PROTO"),l=Object.prototype;t.exports=s?Object.getPrototypeOf:function(t){return t=o(t),n(t,a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?l:null}},function(t,e,i){"use strict";var n=i(0),o=i(46),r=[].reverse,s=[1,2];n({target:"Array",proto:!0,forced:String(s)===String(s.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),r.call(this)}})},function(t,e,i){"use strict";var n=i(0),o=i(47),r=i(22),s=i(12),a=i(52),l=[],c=l.sort,u=s((function(){l.sort(void 0)})),h=s((function(){l.sort(null)})),p=a("sort");n({target:"Array",proto:!0,forced:u||!h||!p},{sort:function(t){return void 0===t?c.call(r(this)):c.call(r(this),o(t))}})},function(t,e,i){"use strict";var n=i(0),o=i(89).includes,r=i(50);n({target:"Array",proto:!0,forced:!i(25)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r("includes")},function(t,e,i){"use strict";var n=i(0),o=i(136),r=i(43);n({target:"String",proto:!0,forced:!i(138)("includes")},{includes:function(t){return!!~String(r(this)).indexOf(o(t),arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(19),o=i(12),r=i(82);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}))},function(t,e,i){var n=i(14),o=i(15),r=n.document,s=o(r)&&o(r.createElement);t.exports=function(t){return s?r.createElement(t):{}}},function(t,e,i){var n=i(84),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(t){return o.call(t)}),t.exports=n.inspectSource},function(t,e,i){var n=i(14),o=i(67),r="__core-js_shared__",s=n[r]||o(r,{});t.exports=s},function(t,e,i){var n=i(16),o=i(86),r=i(40),s=i(23);t.exports=function(t,e){for(var i=o(e),a=s.f,l=r.f,c=0;c<i.length;c++){var u=i[c];n(t,u)||a(t,u,l(e,u))}}},function(t,e,i){var n=i(45),o=i(70),r=i(90),s=i(24);t.exports=n("Reflect","ownKeys")||function(t){var e=o.f(s(t)),i=r.f;return i?e.concat(i(t)):e}},function(t,e,i){var n=i(14);t.exports=n},function(t,e,i){var n=i(16),o=i(21),r=i(89).indexOf,s=i(61);t.exports=function(t,e){var i,a=o(t),l=0,c=[];for(i in a)!n(s,i)&&n(a,i)&&c.push(i);for(;e.length>l;)n(a,i=e[l++])&&(~r(c,i)||c.push(i));return c}},function(t,e,i){var n=i(21),o=i(28),r=i(62),s=function(t){return function(e,i,s){var a,l=n(e),c=o(l.length),u=r(s,c);if(t&&i!=i){for(;c>u;)if((a=l[u++])!=a)return!0}else for(;c>u;u++)if((t||u in l)&&l[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,i){var n=i(72);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,i){var n=i(13);e.f=n},function(t,e,i){var n=i(87),o=i(16),r=i(92),s=i(23).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});o(e,t)||s(e,t,{value:r.f(t)})}},function(t,e,i){var n=i(47);t.exports=function(t,e,i){if(n(t),void 0===e)return t;switch(i){case 0:return function(){return t.call(e)};case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,o){return t.call(e,i,n,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,i){var n=i(75),o=i(42),r=i(13)("toStringTag"),s="Arguments"==o(function(){return arguments}());t.exports=n?o:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(i){}}(e=Object(t),r))?i:s?o(e):"Object"==(n=o(e))&&"function"==typeof e.callee?"Arguments":n}},function(t,e,i){"use strict";var n=i(0),o=i(115),r=i(76),s=i(99),a=i(73),l=i(26),c=i(44),u=i(13),h=i(60),p=i(48),d=i(97),f=d.IteratorPrototype,g=d.BUGGY_SAFARI_ITERATORS,v=u("iterator"),m="keys",y="values",w="entries",x=function(){return this};t.exports=function(t,e,i,u,d,b,T){o(i,e,u);var S,P,E,C=function(t){if(t===d&&D)return D;if(!g&&t in O)return O[t];switch(t){case m:case y:case w:return function(){return new i(this,t)}}return function(){return new i(this)}},R=e+" Iterator",_=!1,O=t.prototype,I=O[v]||O["@@iterator"]||d&&O[d],D=!g&&I||C(d),k="Array"==e&&O.entries||I;if(k&&(S=r(k.call(new t)),f!==Object.prototype&&S.next&&(h||r(S)===f||(s?s(S,f):"function"!=typeof S[v]&&l(S,v,x)),a(S,R,!0,!0),h&&(p[R]=x))),d==y&&I&&I.name!==y&&(_=!0,D=function(){return I.call(this)}),h&&!T||O[v]===D||l(O,v,D),p[e]=D,d)if(P={values:C(y),keys:b?D:C(m),entries:C(w)},T)for(E in P)(g||_||!(E in O))&&c(O,E,P[E]);else n({target:e,proto:!0,forced:g||_},P);return P}},function(t,e,i){"use strict";var n,o,r,s=i(76),a=i(26),l=i(16),c=i(13),u=i(60),h=c("iterator"),p=!1;[].keys&&("next"in(r=[].keys())?(o=s(s(r)))!==Object.prototype&&(n=o):p=!0),null==n&&(n={}),u||l(n,h)||a(n,h,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:p}},function(t,e,i){var n=i(12);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},function(t,e,i){var n=i(24),o=i(116);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(i,[]),e=i instanceof Array}catch(r){}return function(i,r){return n(i),o(r),e?t.call(i,r):i.__proto__=r,i}}():void 0)},function(t,e,i){var n,o,r=i(14),s=i(117),a=r.process,l=a&&a.versions,c=l&&l.v8;c?o=(n=c.split("."))[0]+n[1]:s&&(!(n=s.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=s.match(/Chrome\/(\d+)/))&&(o=n[1]),t.exports=o&&+o},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,i){"use strict";var n=i(30).forEach,o=i(52),r=i(25),s=o("forEach"),a=r("forEach");t.exports=s&&a?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAASCAYAAADVCrdsAAAAAXNSR0IArs4c6QAAAzFJREFUSA2tVc9Lk3Ecbo4tE7FgOBNtIFhd5kWZsQm7JEkLvNRIAju4gyfREPwLJHBs1WFnSfAPGB0EDyoKqcw86UGw6GJ62SiIzM3Yp+f58P2ONadm9sDD99fz+TzP++593zmuXAAicgvy52AQ9IMe8Cr4DdwDP4CL4DuHw3GI8f8B5g/ANPgL/Bt8h+gN2HTpFGhyA6S54ujoqDgzMyODg4PS09Mjzc3N4na7xev1SigUkvHxcdne3rZyjgwT/ecgKA6An0HJZrPFiYkJ8Xg8gobnsre3V+bm5lhqMYWJ89QwOGwCX4EJ8DaFGO+DeVBWV1eltbW1ZOz3+yWRSKjJzs6OHBwcqGZ2dlaGhoaktra2pB0eHpZCoVBkH2AedJn+dzCnH32baLgEWtA4CWa5kUqlxOVyadPu7m5ZWVnh9pnI5XLFyclJ/Zl4PcFgkEFtkBSKX4J6gabREkPoxvT0NPesWNLptOAJ1wBjY2NyfHxsz75C9xp8CN4Fb4JBMAa+BxWZTEZ8Pp/Wd3Z2Sj6ft/U8Lxo/zvMMcchZXV2d8Go3NjaEt7mhoUEbxONxHhNswsU13tLTgPN74C6oz1JbW5v2GRkZ4Zb2pw/9DH4wRI4L+9DV1NRIY2OjFg4MDBidDs9OM67ch/o6OM+qzc3N0nPS398v7A+9+vEcyDLEF85aWlr0kALLZDIpRYDnAHWPKw2rraF7YvRaH41GSz1tbz7sBnsM8ZGL9vb2E0IWdHV1ydramtHrTxKpZmz3IHwEanDWsd4al4/0M9hliC0uOjo6qopZWF9fL+vr66ZGEtaw2ggRXz3Vs67cuHxOP4MthshwEQgEThQ4nU6JxWKyv79vf5ICpOFq5naP5yB1Wsd69ikPwDn9DDIMscxFOBz+QxiJRCo/wQwbsmZnjdSBenEYtQ/7lQehn8EyQ+hT3NfXpyK+0wsLC1bA8RP4FHScZVx5Rr2pY72CfdmfYehnMM8Q+gc1Ojoq/PQC9tbz1X0BuisNLrJmvemjnwLMi/Shn0GaIeJ2ZcafZu/GRczO06In/5Hpxf7lmGIIL7gIMulb0Hdew8ucs7/xoR99vb8Be6xf/B8l0bwAAAAASUVORK5CYII="},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(n){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var n=i(14),o=i(83),r=n.WeakMap;t.exports="function"==typeof r&&/native code/.test(o(r))},function(t,e,i){var n=i(12),o=/#|\.prototype\./,r=function(t,e){var i=a[s(t)];return i==c||i!=l&&("function"==typeof e?n(e):!!e)},s=r.normalize=function(t){return String(t).replace(o,".").toLowerCase()},a=r.data={},l=r.NATIVE="N",c=r.POLYFILL="P";t.exports=r},function(t,e,i){var n=i(19),o=i(23),r=i(24),s=i(64);t.exports=n?Object.defineProperties:function(t,e){r(t);for(var i,n=s(e),a=n.length,l=0;a>l;)o.f(t,i=n[l++],e[i]);return t}},function(t,e,i){var n=i(45);t.exports=n("document","documentElement")},function(t,e,i){var n=i(21),o=i(70).f,r={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return s&&"[object Window]"==r.call(t)?function(t){try{return o(t)}catch(e){return s.slice()}}(t):o(n(t))}},function(t,e,i){"use strict";var n=i(94),o=i(22),r=i(111),s=i(112),a=i(28),l=i(49),c=i(113);t.exports=function(t){var e,i,u,h,p,d,f=o(t),g="function"==typeof this?this:Array,v=arguments.length,m=v>1?arguments[1]:void 0,y=void 0!==m,w=c(f),x=0;if(y&&(m=n(m,v>2?arguments[2]:void 0,2)),null==w||g==Array&&s(w))for(i=new g(e=a(f.length));e>x;x++)d=y?m(f[x],x):f[x],l(i,x,d);else for(p=(h=w.call(f)).next,i=new g;!(u=p.call(h)).done;x++)d=y?r(h,m,[u.value,x],!0):u.value,l(i,x,d);return i.length=x,i}},function(t,e,i){var n=i(24);t.exports=function(t,e,i,o){try{return o?e(n(i)[0],i[1]):e(i)}catch(s){var r=t.return;throw void 0!==r&&n(r.call(t)),s}}},function(t,e,i){var n=i(13),o=i(48),r=n("iterator"),s=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||s[r]===t)}},function(t,e,i){var n=i(95),o=i(48),r=i(13)("iterator");t.exports=function(t){if(null!=t)return t[r]||t["@@iterator"]||o[n(t)]}},function(t,e,i){var n=i(13)("iterator"),o=!1;try{var r=0,s={next:function(){return{done:!!r++}},return:function(){o=!0}};s[n]=function(){return this},Array.from(s,(function(){throw 2}))}catch(a){}t.exports=function(t,e){if(!e&&!o)return!1;var i=!1;try{var r={};r[n]=function(){return{next:function(){return{done:i=!0}}}},t(r)}catch(a){}return i}},function(t,e,i){"use strict";var n=i(97).IteratorPrototype,o=i(63),r=i(41),s=i(73),a=i(48),l=function(){return this};t.exports=function(t,e,i){var c=e+" Iterator";return t.prototype=o(n,{next:r(1,i)}),s(t,c,!1,!0),a[c]=l,t}},function(t,e,i){var n=i(15);t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},function(t,e,i){var n=i(45);t.exports=n("navigator","userAgent")||""},function(t,e,i){i(0)({target:"Object",stat:!0},{is:i(119)})},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,i){"use strict";var n=i(75),o=i(95);t.exports=n?{}.toString:function(){return"[object "+o(this)+"]"}},function(t,e,i){"use strict";var n=i(24);t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,i){var n=i(37),o=i(43),r=function(t){return function(e,i){var r,s,a=String(o(e)),l=n(i),c=a.length;return l<0||l>=c?t?"":void 0:(r=a.charCodeAt(l))<55296||r>56319||l+1===c||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):r:t?a.slice(l,l+2):s-56320+(r-55296<<10)+65536}};t.exports={codeAt:r(!1),charAt:r(!0)}},function(t,e,i){var n=i(42);t.exports=function(t){if("number"!=typeof t&&"Number"!=n(t))throw TypeError("Incorrect invocation");return+t}},function(t,e,i){"use strict";var n=i(37),o=i(43);t.exports="".repeat||function(t){var e=String(o(this)),i="",r=n(t);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(i+=e);return i}},function(t,e,i){"use strict";var n=i(0),o=i(56),r=i(21),s=i(52),a=[].join,l=o!=Object,c=s("join",",");n({target:"Array",proto:!0,forced:l||!c},{join:function(t){return a.call(r(this),void 0===t?",":t)}})},function(t,e,i){"use strict";var n=i(22),o=i(62),r=i(28);t.exports=function(t){for(var e=n(this),i=r(e.length),s=arguments.length,a=o(s>1?arguments[1]:void 0,i),l=s>2?arguments[2]:void 0,c=void 0===l?i:o(l,i);c>a;)e[a++]=t;return e}},function(t,e,i){"use strict";var n=i(47),o=i(15),r=[].slice,s={},a=function(t,e,i){if(!(e in s)){for(var n=[],o=0;o<e;o++)n[o]="a["+o+"]";s[e]=Function("C,a","return new C("+n.join(",")+")")}return s[e](t,i)};t.exports=Function.bind||function(t){var e=n(this),i=r.call(arguments,1),s=function(){var n=i.concat(r.call(arguments));return this instanceof s?a(e,n.length,n):e.apply(t,n)};return o(e.prototype)&&(s.prototype=e.prototype),s}},function(t,e,i){"use strict";var n=i(0),o=i(129).left,r=i(52),s=i(25),a=r("reduce"),l=s("reduce",{1:0});n({target:"Array",proto:!0,forced:!a||!l},{reduce:function(t){return o(this,t,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(47),o=i(22),r=i(56),s=i(28),a=function(t){return function(e,i,a,l){n(i);var c=o(e),u=r(c),h=s(c.length),p=t?h-1:0,d=t?-1:1;if(a<2)for(;;){if(p in u){l=u[p],p+=d;break}if(p+=d,t?p<0:h<=p)throw TypeError("Reduce of empty array with no initial value")}for(;t?p>=0:h>p;p+=d)p in u&&(l=i(l,u[p],p,c));return l}};t.exports={left:a(!1),right:a(!0)}},function(t,e,i){var n=i(131);"string"==typeof n&&(n=[[t.i,n,""]]);var o={hmr:!0,transform:undefined,insertInto:void 0};i(133)(n,o);n.locals&&(t.exports=n.locals)},function(t,e,i){(t.exports=i(132)(!1)).push([t.i,".openseadragon-navigator{position:absolute;z-index:1}.openseadragon-navigator .navigator-main{position:relative;overflow:hidden;display:block;font-size:0}.openseadragon-navigator .navigator-main .v-line{height:100%;width:1px;line-height:1px;position:absolute;top:0}.openseadragon-navigator .navigator-main .h-line{width:100%;height:1px;line-height:1px;position:absolute;left:0}.openseadragon-navigator .navigator-main .view-rect{top:-1px;background-color:#fff;position:absolute;cursor:pointer;opacity:0.5;-webkit-box-sizing:border-box;box-sizing:border-box}.openseadragon-navigator .navigator-main .navigator-color-rect{position:absolute;top:0;left:0;z-index:1}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=function(t,e){var i=t[1]||"",n=t[3];if(!n)return i;if(e&&"function"==typeof btoa){var o=(s=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),r=n.sources.map((function(t){return"/*# sourceURL="+n.sourceRoot+t+" */"}));return[i].concat(r).concat([o]).join("\n")}var s;return[i].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i})).join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&n[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),e.push(s))}},e}},function(t,e,i){var n,o,r={},s=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(t){return document.querySelector(t)},l=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var i=a.call(this,t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(n){i=null}e[t]=i}return e[t]}}(),c=null,u=0,h=[],p=i(134);function d(t,e){for(var i=0;i<t.length;i++){var n=t[i],o=r[n.id];if(o){o.refs++;for(var s=0;s<o.parts.length;s++)o.parts[s](n.parts[s]);for(;s<n.parts.length;s++)o.parts.push(w(n.parts[s],e))}else{var a=[];for(s=0;s<n.parts.length;s++)a.push(w(n.parts[s],e));r[n.id]={id:n.id,refs:1,parts:a}}}}function f(t,e){for(var i=[],n={},o=0;o<t.length;o++){var r=t[o],s=e.base?r[0]+e.base:r[0],a={css:r[1],media:r[2],sourceMap:r[3]};n[s]?n[s].parts.push(a):i.push(n[s]={id:s,parts:[a]})}return i}function g(t,e){var i=l(t.insertInto);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=h[h.length-1];if("top"===t.insertAt)n?n.nextSibling?i.insertBefore(e,n.nextSibling):i.appendChild(e):i.insertBefore(e,i.firstChild),h.push(e);else if("bottom"===t.insertAt)i.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(t.insertInto+" "+t.insertAt.before);i.insertBefore(e,o)}}function v(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function m(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),y(e,t.attrs),g(t,e),e}function y(t,e){Object.keys(e).forEach((function(i){t.setAttribute(i,e[i])}))}function w(t,e){var i,n,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var s=u++;i=c||(c=m(e)),n=T.bind(null,i,s,!1),o=T.bind(null,i,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",y(e,t.attrs),g(t,e),e}(e),n=P.bind(null,i,e),o=function(){v(i),i.href&&URL.revokeObjectURL(i.href)}):(i=m(e),n=S.bind(null,i),o=function(){v(i)});return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var i=f(t,e);return d(i,e),function(t){for(var n=[],o=0;o<i.length;o++){var s=i[o];(a=r[s.id]).refs--,n.push(a)}t&&d(f(t,e),e);for(o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete r[a.id]}}}};var x,b=(x=[],function(t,e){return x[t]=e,x.filter(Boolean).join("\n")});function T(t,e,i,n){var o=i?"":n.css;if(t.styleSheet)t.styleSheet.cssText=b(e,o);else{var r=document.createTextNode(o),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function S(t,e){var i=e.css,n=e.media;if(n&&t.setAttribute("media",n),t.styleSheet)t.styleSheet.cssText=i;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(i))}}function P(t,e,i){var n=i.css,o=i.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(n=p(n)),o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var s=new Blob([n],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var i=e.protocol+"//"+e.host,n=i+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?i+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},function(t,e,i){"use strict";var n=i(0),o=i(30).every,r=i(52),s=i(25),a=r("every"),l=s("every");n({target:"Array",proto:!0,forced:!a||!l},{every:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,i){var n=i(137);t.exports=function(t){if(n(t))throw TypeError("The method doesn't accept regular expressions");return t}},function(t,e,i){var n=i(15),o=i(42),r=i(13)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[r])?!!e:"RegExp"==o(t))}},function(t,e,i){var n=i(13)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[n]=!1,"/./"[t](e)}catch(o){}}return!1}},function(t,e,i){var n=i(0),o=i(140).values;n({target:"Object",stat:!0},{values:function(t){return o(t)}})},function(t,e,i){var n=i(19),o=i(64),r=i(21),s=i(66).f,a=function(t){return function(e){for(var i,a=r(e),l=o(a),c=l.length,u=0,h=[];c>u;)i=l[u++],n&&!s.call(a,i)||h.push(t?[i,a[i]]:a[i]);return h}};t.exports={entries:a(!0),values:a(!1)}},function(t,e,i){"use strict";i.r(e),i.d(e,"getRectPoint",(function(){return c})),i.d(e,"isPointInMatrix",(function(){return h})),i.d(e,"pointInOtherPoint",(function(){return d})),i.d(e,"isPointInEllipse",(function(){return p})),i.d(e,"pointsToRegion",(function(){return v})),i.d(e,"regionToPoint",(function(){return m})),i.d(e,"isPointInPolygon",(function(){return f})),i.d(e,"isPointInLine",(function(){return g})),i.d(e,"isNegNumber",(function(){return y})),i.d(e,"baseNumber",(function(){return w})),i.d(e,"acreage",(function(){return S})),i.d(e,"perimeter",(function(){return P})),i.d(e,"getPoint",(function(){return x})),i.d(e,"getAngle",(function(){return b})),i.d(e,"getDistance",(function(){return T})),i.d(e,"rgbToHsl",(function(){return E})),i.d(e,"hslToRgb",(function(){return C})),i.d(e,"toGamma",(function(){return _})),i.d(e,"cacheGammaTable",(function(){return O})),i.d(e,"imageSharpenUM",(function(){return k})),i.d(e,"Cache",(function(){return N})),i.d(e,"Rotation",(function(){return oi})),i.d(e,"Navigator",(function(){return Bi})),i.d(e,"Tailoring",(function(){return qi})),i.d(e,"Shape",(function(){return pn})),i.d(e,"Area",(function(){return Tn})),i.d(e,"Board",(function(){return Ln})),i.d(e,"Graduation",(function(){return Wn})),i.d(e,"Grid",(function(){return Xn})),i.d(e,"KfbView",(function(){return Eo})),i.d(e,"OpenSeadragon",(function(){return $.a}));var n={};i.r(n),i.d(n,"Brush",(function(){return St})),i.d(n,"Arrow",(function(){return It})),i.d(n,"Bilateral",(function(){return Ht})),i.d(n,"Line",(function(){return Ut})),i.d(n,"Polygon",(function(){return Jt})),i.d(n,"Ellipse",(function(){return re})),i.d(n,"Rectangle",(function(){return pe})),i.d(n,"Font",(function(){return we})),i.d(n,"Star",(function(){return Ce})),i.d(n,"Flag",(function(){return Le})),i.d(n,"Dot",(function(){return Fe})),i.d(n,"Image",(function(){return Ke}));var o={};i.r(o),i.d(o,"EVENT_START_PAINTING",(function(){return ri})),i.d(o,"EVENT_IN_PAINTING",(function(){return si})),i.d(o,"EVENT_END_PAINTING",(function(){return ai})),i.d(o,"EVENT_STOP_PAINTING",(function(){return li})),i.d(o,"EVENT_TAILORING_REGION",(function(){return ci})),i.d(o,"EVENT_TAILORING_SCREENSHOT",(function(){return ui})),i.d(o,"EVENT_AREA_MOVE_START",(function(){return hi})),i.d(o,"EVENT_AREA_MOVING",(function(){return pi})),i.d(o,"EVENT_AREA_MOVE_END",(function(){return di})),i.d(o,"EVENT_SELECT_LABEL",(function(){return fi})),i.d(o,"EVENT_CANCEL_SELECT_LABEL",(function(){return gi})),i.d(o,"EVENT_DB_CLICK_LABEL",(function(){return vi})),i.d(o,"EVENT_CACHE_BACK",(function(){return mi})),i.d(o,"EVENT_CACHE_FORWARD",(function(){return yi})),i.d(o,"EVENT_HIDDEN_LABEL",(function(){return wi})),i.d(o,"EVENT_DELETE_LABEL",(function(){return xi})),i.d(o,"EVENT_DELETE_POLYGON_POINT",(function(){return bi})),i.d(o,"EVENT_ADD_POLYGON_POINT",(function(){return Ti})),i.d(o,"EVENT_NAVIGATOR_VESTIGE",(function(){return Si}));var r={};i.r(r),i.d(r,"Cache",(function(){return N})),i.d(r,"Rotation",(function(){return oi})),i.d(r,"Navigator",(function(){return Bi})),i.d(r,"Tailoring",(function(){return qi})),i.d(r,"Shape",(function(){return pn})),i.d(r,"Area",(function(){return Tn})),i.d(r,"Board",(function(){return Ln})),i.d(r,"Graduation",(function(){return Wn})),i.d(r,"Grid",(function(){return Xn}));var s={};i.r(s),i.d(s,"COMPONENT_SHAPE",(function(){return no})),i.d(s,"COMPONENT_AREA",(function(){return oo})),i.d(s,"COMPONENT_BOARD",(function(){return ro})),i.d(s,"COMPONENT_GRADUATION",(function(){return so})),i.d(s,"COMPONENT_ROTATION",(function(){return ao})),i.d(s,"COMPONENT_TAILORING",(function(){return lo})),i.d(s,"COMPONENT_NAVIGATOR",(function(){return co})),i.d(s,"COMPONENT_CACHE",(function(){return uo})),i.d(s,"COMPONENT_FRID",(function(){return ho}));i(3),i(4),i(6),i(31),i(5),i(77),i(32),i(78),i(33),i(118),i(1),i(2),i(7),i(8);function a(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function c(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=(t.x+e.x)/2,o=(t.y+e.y)/2,r=Math.PI/180*i;return[{x:(t.x-n)*Math.cos(r)-(t.y-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+(t.y-o)*Math.cos(r)+o},{x:-(t.y-o)*Math.sin(r)+n,y:(t.y-o)*Math.cos(r)+o},{x:(e.x-n)*Math.cos(r)-(t.y-o)*Math.sin(r)+n,y:(e.x-n)*Math.sin(r)+(t.y-o)*Math.cos(r)+o},{x:(t.x-n)*Math.cos(r)-(o-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+o},{x:n,y:o},{x:(e.x-n)*Math.cos(r)+n,y:(e.x-n)*Math.sin(r)+o},{x:(t.x-n)*Math.cos(r)-(e.y-o)*Math.sin(r)+n,y:(t.x-n)*Math.sin(r)+(e.y-o)*Math.cos(r)+o},{x:-(e.y-o)*Math.sin(r)+n,y:(e.y-o)*Math.cos(r)+o},{x:(e.x-n)*Math.cos(r)-(e.y-o)*Math.sin(r)+n,y:(e.x-n)*Math.sin(r)+(e.y-o)*Math.cos(r)+o}]}function u(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}function h(t,e,i,n,o){return u(t,e,o)*u(i,n,o)<=0&&u(e,n,o)*u(t,i,o)<=0}function p(t,e,i,n){return(t.x-e.x)*(t.x-e.x)/(i*i)+(t.y-e.y)*(t.y-e.y)/(n*n)<1}function d(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n={x:t.x-i,y:t.y-i},o={x:t.x+i,y:t.y-i},r={x:t.x-i,y:t.y+i},s={x:t.x+i,y:t.y+i};return h(n,o,r,s,e)}function f(t,e){for(var i=t.x,n=t.y,o=!1,r=0,s=e.length,a=s-1;r<s;a=r,r++){var l=e[r].x,c=e[r].y,u=e[a].x,h=e[a].y;if(l===i&&c===n||u===i&&h===n)return!0;if(c<n&&h>=n||c>=n&&h<n){var p=l+(n-c)*(u-l)/(h-c);if(Math.abs(p-i)<10)return!0;p>i&&(o=!o)}}return o}function g(t,e){var i=e[0],n=e[1];if(i.y<t.y&&n.y>=t.y||i.y>=t.y&&n.y<t.y){var o=i.x+(t.y-i.y)*(n.x-i.x)/(n.y-i.y);if(Math.abs(o-t.x)<8)return!0}return!1}function v(t){if(!Array.isArray(t)||0===t.length)return{x:0,y:0,width:0,height:0};if(2===t.length)return{x:t[0].x,y:t[0].y,width:t[1].x-t[0].x,height:t[1].y-t[0].y};var e=a(t).sort((function(t,e){return t.x-e.x})),i=a(t).sort((function(t,e){return t.y-e.y})),n={x:e[0].x,y:i[0].y},o=e.reverse()[0].x,r=i.reverse()[0].y;return{x:n.x,y:n.y,width:o-n.x,height:r-n.y}}function m(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?{startPoint:{x:t.width<0?t.x+t.width:t.x,y:t.height<0?t.y+t.height:t.y},endPoint:{x:t.width>0?t.x+t.width:t.x,y:t.height>0?t.y+t.height:t.y}}:{startPoint:{x:t.x,y:t.y},endPoint:{x:t.x+t.width,y:t.y+t.height}}}function y(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?Object.is(t,-0):t<0}function w(t){if("number"!=typeof t)throw new Error("".concat(t," is not a number"));return 0===t?0:t<0?-1:1}function x(t,e,i){return i=i/180*Math.PI,{x:(e.x-t.x)*Math.cos(i)-(e.y-t.y)*Math.sin(i)+t.x,y:(e.x-t.x)*Math.sin(i)+(e.y-t.y)*Math.cos(i)+t.y}}function b(t,e,i){var n={x:e.x-t.x,y:e.y-t.y},o={x:i.x-t.x,y:i.y-t.y},r=Math.atan2(o.y,o.x)-Math.atan2(n.y,n.x);return r>Math.PI?r-2*Math.PI:r<-Math.PI?r+2*Math.PI:r}function T(t,e){var i=Math.pow(e.x-t.x,2),n=Math.pow(e.y-t.y,2);return Math.sqrt(i+n)}function S(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=0,r=Math.abs(i.x-e.x)*n,s=Math.abs(i.y-e.y)*n;return"Rectangle"===t&&(o=r*s/2),"Ellipse"===t&&(o=r*s/4*Math.PI),o}function P(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=0,r=Math.abs(i.x-e.x)*n,s=Math.abs(i.y-e.y)*n;if("Line"!==t&&"Arrow"!==t||(o=Math.sqrt(Math.pow(r,2)+Math.pow(s,2))),"Rectangle"===t&&(o=2*(r+s)),"Ellipse"===t){var a=r>=s?r:s,l=r>=s?s:r;o=4*(a-l)+2*Math.PI*l}return o}i(53);var E=function(t,e,i){var n=(t/=255)>(e/=255)?t:e,o=n>(i/=255)?n:i,r=t>e?e:t,s=r>i?i:r,a=o-s,l=o+s,c=(o+s)/2,u=0,h=0;return 0===a?{l:c,s:u,h:h}:(t===o&&(h=(e-i)/6/a),e===o&&(h=1/3+(i-t)/6/a),i===o&&(h=2/3+(t-e)/6/a),h<0&&(h+=1),h>1&&(h-=1),{l:c,s:u=c<.5?a/l:a/(2-l),h:h})},C=function(t,e,i){if(0===e)return{r:255*(i>1?1:i),g:255*(i>1?1:i),b:255*(i>1?1:i)};e>1&&(e=1);var n=0,o=2*i-(n=i<.5?i*(1+e):i+e-i*e),r=255*R(o,n,t+1/3),s=255*R(o,n,t),a=255*R(o,n,t-1/3);return{r:r>255?255:r,g:s>255?255:s,b:a>255?255:a}};function R(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),6*i<1?t+6*(e-t)*i:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}for(var _=function(t,e){return t>255&&(t=255),t<0&&(t=0),t/=255,255*Math.pow(t,1/e)},O={},I=0;I<256;I++)for(var D=.01;D<=2;D=(D+.01).toFixed(3)/1)O["".concat(D)]?O["".concat(D)].push(_(I,D)):O["".concat(D)]=[_(I,D)];var k=function(t,e,i){},M=(i(54),i(125),i(27),function(t){return(t=t.toString())[1]?t:"0"+t}),L=function(t){var e,i=Object.prototype.toString;if(t)return"[object String]"===(e=t,i).call(e)&&(t=new Date(t)),[t.getHours(),t.getMinutes(),t.getSeconds()].map(M).join(":")},A=function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=Object.prototype.toString;if(t){"[object String]"===(e=t,n).call(e)&&(t=new Date(t)),"number"==typeof t&&(t=new Date(t));var o=t.getFullYear(),r=t.getMonth()+1,s=t.getDate();return[o,r,s].map(M).join(i)}},B=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";if(t)return A(t,e)+" "+L(t)};function H(t){return function(t){if(Array.isArray(t))return j(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return j(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return j(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function z(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var N=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cacheList=[],this.currentIndex=-1}var e,i,n;return e=t,(i=[{key:"init",value:function(t,e){this.cacheList=H(t),this.currentIndex=e}},{key:"add",value:function(t,e){this.currentIndex===this.cacheList.length-1||(this.cacheList=this.cacheList.slice(0,this.currentIndex+1)),this.cacheList.push({type:t,options:e,time:B(new Date)}),this.currentIndex=this.cacheList.length-1}},{key:"getCache",value:function(t){return this.cacheList[t]}},{key:"removeIndex",value:function(t){this.cacheList.splice(t,1)}},{key:"removeAll",value:function(){this.cacheList=[],this.currentIndex=-1}}])&&z(e.prototype,i),n&&z(e,n),t}();i(55),i(65),i(17),i(9),i(10),i(11),i(18),i(38),i(29),i(128),i(34),i(35),i(36),i(39);function F(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var V=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.eventList=[]}var e,i,n;return e=t,i=[{key:"$emit",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,n=new CustomEvent(t,{bubbles:!0,detail:e});i.dispatchEvent(n)}},{key:"$on",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document;n.addEventListener(t,e,i),this.eventList.push({target:n,eventName:t,callback:e,options:i})}},{key:"$once",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document,o=function o(r){e(r),n.removeEventListener(t,o,i)};n.addEventListener(t,o,i)}},{key:"$off",value:function(t,e,i){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:document,r=this.eventList.filter((function(n){return!(n.target!==o&&o&&o!==document||n.eventName!==t&&t||n.options!==i&&null!=i||n.callback!==e&&e)}));r.forEach((function(t){t.target.removeEventListener(t.eventName,t.callback,t.options);var e=n.eventList.findIndex((function(e){return e===t}));~e&&n.eventList.splice(e,1)}))}},{key:"destroy",value:function(){this.$off()}}],i&&F(e.prototype,i),n&&F(e,n),t}();function W(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function U(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var G={lineWidth:2,radius:5,fillStyle:"rgba(255, 255, 255, 1)",strokeStyle:"#01d0b0"},Z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;W(this,t),this.getConfig(e)}var e,i,n;return e=t,i=[{key:"getConfig",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;for(var e in G)Object.prototype.hasOwnProperty.call(G,e)&&(t[e]=t[e]||G[e]);return t}},{key:"setCanvas",value:function(t){this.canvas=t}},{key:"draw",value:function(t,e){var i=this.canvas.getContext("2d"),n=t.x,o=t.y;e=this.getConfig(e),i.beginPath(),i.lineWidth=e.lineWidth,i.arc(n,o,e.radius,0,2*Math.PI,!1),i.fillStyle=e.fillStyle,i.fill(),i.strokeStyle=e.strokeStyle,i.stroke()}}],i&&U(e.prototype,i),n&&U(e,n),t}(),q=i(20),$=i.n(q),K="Line",X="Arrow",Y="Bilateral",J="Rectangle",Q="Ellipse",tt="Polygon",et="Font",it="Star",nt="Flag",ot="Dot",rt="Image",st=[et,it,nt,ot],at=[J,Q],lt=[K,X,Y],ct=[tt,et,it,nt,ot],ut=([].concat(at,[tt]),[].concat(lt,[et,nt,rt])),ht=[K,X,Y,J,Q,tt,et,it,nt,ot,rt];function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function dt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function ft(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?dt(Object(i),!0).forEach((function(e){gt(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):dt(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function gt(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function vt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function mt(t,e){return mt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},mt(t,e)}function yt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=xt(t);if(e){var o=xt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return wt(this,i)}}function wt(t,e){return!e||"object"!==pt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function xt(t){return xt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},xt(t)}var bt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&mt(t,e)}(r,t);var e,i,n,o=yt(r);function r(t,e,i,n){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(s=o.call(this)).viewer=t,s.cache=i,s.viewport=t.viewport,s.canvas=e,s.options=n||{},s.thumb=new Z,s.thumb.setCanvas(e),s}return e=r,i=[{key:"init",value:function(){}},{key:"getCenterPoint",value:function(t){var e=this.viewport.imageToViewportRectangle(t.x,t.y,t.width,t.height);return c({x:e.x,y:e.y},{x:e.x+e.width,y:e.y+e.height})[4]}},{key:"moveToLabel",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.viewport.panTo(new q.Point(t.x,t.y),e)}},{key:"isContainerLabel",value:function(t,e){var i=this;return!!e.find((function(e){return i.isContainerInRegion(t,e)}))}},{key:"isContainerInRegion",value:function(t,e){var i=e.region,n=e.tool,o=e.points,r=e.isClose,s={x:i.x,y:i.y},a={x:i.x+i.width,y:i.y},l={x:i.x,y:i.y+i.height},c={x:i.x+i.width,y:i.y+i.height},u={x:i.x+i.width/2,y:i.y+i.height/2};return n===Q?p(t,u,Math.abs(i.width/2),Math.abs(i.height/2>>0)):n===J?h(s,a,l,c,t):!(n!==tt||!r)&&f(t,o)}},{key:"imageToViewerElementRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,o=t.height,r=this.viewport.imageToViewportRectangle(e,i,n,o);return this.viewport.viewportToViewerElementRectangle(r)}},{key:"imageToViewerElementCoordinates",value:function(t,e){return this.viewport.imageToViewerElementCoordinates(new q.Point(t,e))}},{key:"viewerElementToImageRectangle",value:function(t){var e=t.x,i=t.y,n=t.width,o=t.height,r=this.viewport.viewerElementToViewportRectangle(new q.Rect(e,i,n,o,0));return this.viewport.viewportToImageRectangle(r.x,r.y,r.width,r.height)}},{key:"viewerElementToImageCoordinates",value:function(t,e){return this.viewport.viewerElementToImageCoordinates(new q.Point(t,e))}},{key:"imageToViewerElementPoints",value:function(t){var e=this;return(t||[]).map((function(t){var i=e.imageToViewerElementCoordinates(t.x,t.y);return{canMove:t.canMove,x:i.x,y:i.y}}))}},{key:"getImageZoom",value:function(t){return this.viewport.viewportToImageZoom(this.viewport.getZoom(t))}},{key:"getMeasureContent",value:function(t){var e={left:0,top:0,angle:0,texts:[]};if(t.points.length<=1)return e;var i=this.getImageZoom(!0)/t.scale,n=v(t.points),o={x:n.x,y:n.y},r={x:n.x+n.width,y:n.y+n.height},s={x:o.x<r.x?o.x:r.x,y:o.y<r.y?o.y:r.y},a={x:o.x>r.x?o.x:r.x,y:o.y>r.y?o.y:r.y};switch(t.tool){case X:case Y:case K:var l={x:o.x<r.x?o.x:r.x,y:o.x<r.x?o.y:r.y},u={x:o.x>r.x?o.x:r.x,y:o.x>r.x?o.y:r.y},h=Math.abs(u.x-l.x),p=Math.abs(u.y-l.y),d={x:(u.x+l.x)/2,y:(u.y+l.y)/2},f=b(l,ft(ft({},l),{},{x:l.x+1}),u),g=this.imageToViewerElementCoordinates(d.x,d.y),m=-50,y=-50;u.y<l.y&&u.x>l.x&&(m=-50,y=-50),u.y<l.y&&u.x<l.x&&(m=-10,y=50),u.y>l.y&&u.x>l.x&&(m=10,y=-50),u.y>l.y&&u.x<l.x&&(m=50,y=80),e={left:g.x+y*i,top:g.y+m*i,angle:f,texts:["长:".concat((Math.sqrt(h*h+p*p)*this.options.imageCapRes).toFixed(2)).concat(this.options.unit)]};break;case Q:var w=Math.abs(a.x-s.x),x=Math.abs(a.y-s.y),T=P(Q,s,a,this.options.imageCapRes),E=S(Q,s,a,this.options.imageCapRes),C=c(s,a)[2],R=this.imageToViewerElementCoordinates(C.x,C.y);e={left:R.x+10*i,top:R.y,angle:0,texts:["长轴:".concat((w*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"短轴:".concat((x*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"周长:".concat(T.toFixed(2)).concat(this.options.unit),"面积:".concat(E.toFixed(2)).concat(this.options.unit,"²")]};break;case J:var _=Math.abs(a.x-s.x),O=Math.abs(a.y-s.y),I=P(J,s,a,this.options.imageCapRes),D=S(J,s,a,this.options.imageCapRes),k=c(s,a)[2],M=this.imageToViewerElementCoordinates(k.x,k.y);e={left:M.x+10*i,top:M.y,angle:0,texts:["长:".concat((_*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"宽:".concat((O*this.options.imageCapRes).toFixed(2)).concat(this.options.unit),"周长:".concat(I.toFixed(2)).concat(this.options.unit),"面积:".concat(D.toFixed(2)).concat(this.options.unit,"²")]};break;case tt:var L=t.points,A=c(s,a)[2],B=this.imageToViewerElementCoordinates(A.x,A.y),H=0;L.reduce((function(t,e){return H+=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),e})),e={left:B.x,top:B.y,angle:0,texts:["周长:".concat((H*this.options.imageCapRes).toFixed(2)).concat(this.options.unit)]};break;default:e={left:0,right:0,angle:0,texts:[]}}var j=t.select&&this.options.measure.selectHandler||this.options.measure.handler;return ft(ft({},e),{},{texts:j?j(e.texts,t):e.texts})}},{key:"getImageData",value:function(t,e){var i=e.getContext("2d").getImageData(t.x,t.y,t.width,t.height);return this.changeImageData(i)}},{key:"changeImageData",value:function(t){var e=t.data,i=t.width,n=t.height,o=this.viewport.viewportToImageZoom(this.viewport.getZoom(!0));if(o<=10)return{points:[],imageData:{data:e,width:i,height:n}};var r=10/o*i>>0,s=10/o*n>>0,a=document.createElement("canvas"),l=a.getContext("2d");a.width=i,a.height=n,l.putImageData(t,0,0,0,0,a.width,a.height);var c=document.createElement("canvas"),u=c.getContext("2d");c.width=r,c.height=s,u.drawImage(a,0,0,r,s);var h=u.getImageData(0,0,r,s);return{points:[],imageData:{data:h.data,width:h.width,height:h.height}}}},{key:"isInCanvas",value:function(t,e){var i=t.x,n=t.y,o=t.x+t.width,r=t.y+t.height;return!(i>e.x+e.width||n>e.y+e.height||o<e.x||r<e.y)}},{key:"getFontWidth",value:function(t,e){var i=this.canvas.getContext("2d");return i.beginPath(),i.font="".concat(e,"px Arial"),i.measureText(t).width}},{key:"change",value:function(){}},{key:"updated",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=ft(ft({},this.options),t),this.change()}},{key:"clearCanvas",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"resetCanvasSize",value:function(t){var e=this,i=t.width,n=t.height;this.canvas.width=i,this.canvas.height=n,setTimeout((function(){e.change()}),100)}},{key:"destroy",value:function(){this.$off()}}],i&&vt(e.prototype,i),n&&vt(e,n),r}(V);function Tt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var St=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.thumb=new Z,this.options={}}var e,i,n;return e=t,(i=[{key:"setContent",value:function(t,e){this.canvas=t,this.thumb.setCanvas(t),this.options=e}},{key:"startDraw",value:function(){this.canvas.getContext("2d").beginPath()}},{key:"endDraw",value:function(){var t=this.canvas.getContext("2d");t.stroke(),this.options.fillStyle&&t.fill()}},{key:"drawThumb",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawPoints",value:function(t,e){var i=this;t.forEach((function(t){i.drawThumb(t,e)}))}},{key:"draw",value:function(t){}},{key:"drawMeasureInfo",value:function(t,e){var i=e.left,n=e.top,o=e.texts,r=e.angle;if(o.length){var s=this.canvas.getContext("2d");s.save(),s.beginPath(),s.translate(i,n),s.rotate(r);var a=[];s.font="".concat(this.options.measure.fontSize,"px Arial"),o.forEach((function(t){a.push(s.measureText(t).width)}));var l=Math.max.apply(Math,a);s.fillStyle=this.options.measure.backgroundColor;var c=20*o.length+16+4*(o.length-1);s.rect(0,0,l+22,c),s.fill(),s.beginPath(),s.fillStyle=this.options.measure.color,o.forEach((function(t,e){s.fillText(t,11,22+24*e)})),s.fill(),s.restore()}}},{key:"clearCanvas",value:function(){this.canvas&&this.canvas.getContext&&this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)}}])&&Tt(e.prototype,i),n&&Tt(e,n),t}();function Pt(t){return Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pt(t)}function Et(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ct(t,e){return Ct=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ct(t,e)}function Rt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ot(t);if(e){var o=Ot(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return _t(this,i)}}function _t(t,e){return!e||"object"!==Pt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ot(t){return Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ot(t)}var It=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ct(t,e)}(r,t);var e,i,n,o=Rt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i)}}])&&Et(e.prototype,i),n&&Et(e,n),r}(St);function Dt(t){return Dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dt(t)}function kt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mt(t,e){return Mt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Mt(t,e)}function Lt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Bt(t);if(e){var o=Bt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return At(this,i)}}function At(t,e){return!e||"object"!==Dt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Bt(t){return Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Bt(t)}var Ht=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Mt(t,e)}(r,t);var e,i,n,o=Lt(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y),n.drawArrow(e,i),n.drawArrow(i,e)}}])&&kt(e.prototype,i),n&&kt(e,n),r}(St);function jt(t){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(t)}function zt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Nt(t,e){return Nt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Nt(t,e)}function Ft(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Wt(t);if(e){var o=Wt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Vt(this,i)}}function Vt(t,e){return!e||"object"!==jt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}var Ut=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Nt(t,e)}(r,t);var e,i,n,o=Ft(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=t[0],i=t[t.length-1],n=this.canvas.getContext("2d");n.lineWidth=this.options.lineWidth,n.strokeStyle=this.options.strokeStyle,n.moveTo(e.x,e.y),n.lineTo(i.x,i.y);var o=Math.atan2(i.y-e.y,i.x-e.x),r=5*Math.sin(o),s=5*Math.cos(o);n.moveTo(e.x+r,e.y-s),n.lineTo(e.x-r,e.y+s),n.moveTo(i.x+r,i.y-s),n.lineTo(i.x-r,i.y+s)}}])&&zt(e.prototype,i),n&&zt(e,n),r}(St);function Gt(t){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(t)}function Zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $t(t,e){return $t=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},$t(t,e)}function Kt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Yt(t);if(e){var o=Yt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Xt(this,i)}}function Xt(t,e){return!e||"object"!==Gt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Yt(t)}var Jt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&$t(t,e)}(r,t);var e,i,n,o=Kt(r);function r(){return Zt(this,r),o.apply(this,arguments)}return e=r,(i=[{key:"draw",value:function(t){var e=this.canvas.getContext("2d");e.lineWidth=this.options.lineWidth,e.strokeStyle=this.options.strokeStyle,e.moveTo(t[0].x,t[0].y),t.forEach((function(t,i){0!==i&&e.lineTo(t.x,t.y)})),this.options.isClose&&(e.lineTo(t[0].x,t[0].y),this.options.fillStyle&&(e.fillStyle=this.options.fillStyle))}}])&&qt(e.prototype,i),n&&qt(e,n),r}(St);function Qt(t){return Qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qt(t)}function te(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ee(t,e){return ee=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ee(t,e)}function ie(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=oe(t);if(e){var o=oe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ne(this,i)}}function ne(t,e){return!e||"object"!==Qt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function oe(t){return oe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},oe(t)}var re=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ee(t,e)}(r,t);var e,i,n,o=ie(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=t[0],o=t[t.length-1],r=this.canvas.getContext("2d");r.lineWidth=this.options.lineWidth,r.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(r.fillStyle=this.options.fillStyle),r.save();var s={x:(n.x+o.x)/2,y:(n.y+o.y)/2},a=(null==i?void 0:i.width)?Math.abs(i.width):Math.abs(o.x-n.x),l=(null==i?void 0:i.height)?Math.abs(i.height):Math.abs(o.y-n.y);r.translate(s.x,s.y),r.rotate(e*Math.PI/180),e<90&&e>=0||e>180&&e<270?r.drawOval(0,0,a/2,l/2):r.drawOval(0,0,l/2,a/2),r.restore()}}],i&&te(e.prototype,i),n&&te(e,n),r}(St);function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function ae(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function le(t,e){return le=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},le(t,e)}function ce(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=he(t);if(e){var o=he(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ue(this,i)}}function ue(t,e){return!e||"object"!==se(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function he(t){return he=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},he(t)}var pe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&le(t,e)}(r,t);var e,i,n,o=ce(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=t[0],o=t[t.length-1],r=this.canvas.getContext("2d");r.lineWidth=this.options.lineWidth,r.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(r.fillStyle=this.options.fillStyle),r.save();var s={x:(n.x+o.x)/2,y:(n.y+o.y)/2},a=(null==i?void 0:i.width)?Math.abs(i.width):Math.abs(o.x-n.x),l=(null==i?void 0:i.height)?Math.abs(i.height):Math.abs(o.y-n.y);r.translate(s.x,s.y),e<90&&e>=0||e>180&&e<270?(r.rotate(e*Math.PI/180),r.rect(-a/2,-l/2,a,l)):(r.rotate(e*Math.PI/180),r.rect(-l/2,-a/2,l,a)),r.restore()}}],i&&ae(e.prototype,i),n&&ae(e,n),r}(St);function de(t){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(t)}function fe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ge(t,e){return ge=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ge(t,e)}function ve(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=ye(t);if(e){var o=ye(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return me(this,i)}}function me(t,e){return!e||"object"!==de(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ye(t){return ye=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ye(t)}var we=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ge(t,e)}(r,t);var e,i,n,o=ve(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=t[0],n=this.options.angle||0,o=this.options.text||"编辑文字",r=this.canvas.getContext("2d");r.fillStyle=this.options.strokeStyle,r.save(),r.translate(i.x,i.y),r.rotate(n/180*Math.PI),r.scale(e,e),r.font="".concat(this.options.fontSize,"px Arial"),r.fillText(o,0,0),r.restore()}}],i&&fe(e.prototype,i),n&&fe(e,n),r}(St);function xe(t){return xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xe(t)}function be(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Te(t,e){return Te=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Te(t,e)}function Se(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ee(t);if(e){var o=Ee(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pe(this,i)}}function Pe(t,e){return!e||"object"!==xe(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ee(t){return Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ee(t)}var Ce=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Te(t,e)}(r,t);var e,i,n,o=Se(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth,n=t[0];i*=e;var o=.2*Math.PI,r=.3*Math.PI,s=Math.sin(o)*i*2,a=i/2/Math.cos(o),l={x:n.x,y:n.y-i},c={x:n.x+a*Math.sin(o),y:n.y-i+a*Math.cos(o)},u={x:n.x+s*Math.sin(r),y:n.y-i+s*Math.cos(r)},h={x:n.x+a*Math.sin(2*o),y:n.y+a*Math.cos(2*o)},p={x:n.x+i*Math.sin(o),y:n.y+i*Math.cos(o)},d={x:n.x,y:n.y+a},f={x:n.x-i*Math.sin(o),y:n.y+i*Math.cos(o)},g={x:n.x-a*Math.sin(2*o),y:n.y+a*Math.cos(2*o)},v={x:n.x-s*Math.sin(r),y:n.y-i+s*Math.cos(r)},m={x:n.x-a*Math.sin(o),y:n.y-i+a*Math.cos(o)},y=this.canvas.getContext("2d");y.lineWidth=2,y.moveTo(l.x,l.y),y.lineTo(c.x,c.y),y.lineTo(u.x,u.y),y.lineTo(h.x,h.y),y.lineTo(p.x,p.y),y.lineTo(d.x,d.y),y.lineTo(f.x,f.y),y.lineTo(g.x,g.y),y.lineTo(v.x,v.y),y.lineTo(m.x,m.y),y.lineTo(l.x,l.y),y.strokeStyle=this.options.strokeStyle,this.options.fillStyle&&(y.fillStyle=this.options.fillStyle)}}],i&&be(e.prototype,i),n&&be(e,n),r}(St);function Re(t){return Re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Re(t)}function _e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ie(t,e){return Ie=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ie(t,e)}function De(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Me(t);if(e){var o=Me(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ke(this,i)}}function ke(t,e){return!e||"object"!==Re(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Me(t){return Me=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Me(t)}var Le=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ie(t,e)}(r,t);var e,i,n,o=De(r);function r(){return _e(this,r),o.apply(this,arguments)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],o=this.canvas.getContext("2d");o.lineWidth=2,o.strokeStyle=this.options.strokeStyle,o.moveTo(n.x,n.y),o.lineTo(n.x,n.y-i);var r=i/5,s={x:n.x+r,y:n.y-i},a={x:n.x+2*r,y:n.y-i-r},l={x:n.x+4*r,y:n.y-i+r},c={x:n.x+i,y:n.y-i};o.bezierCurve([s,a,l,c]),o.moveTo(c.x,c.y),o.lineTo(c.x,c.y+i/2);var u={x:n.x+r,y:n.y-i/2},h={x:n.x+2*r,y:n.y-i/2-r},p={x:n.x+4*r,y:n.y-i/2+r},d={x:n.x+i,y:n.y-i/2};o.bezierCurve([u,h,p,d]),o.moveTo(s.x,s.y),o.lineTo(u.x,u.y)}}],i&&Oe(e.prototype,i),n&&Oe(e,n),r}(St);function Ae(t){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae(t)}function Be(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function He(t,e){return He=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},He(t,e)}function je(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ne(t);if(e){var o=Ne(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ze(this,i)}}function ze(t,e){return!e||"object"!==Ae(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ne(t){return Ne=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ne(t)}var Fe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&He(t,e)}(r,t);var e,i,n,o=je(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,i=[{key:"draw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.options.lineWidth;i*=e;var n=t[0],o=this.canvas.getContext("2d"),r=n.x,s=n.y;o.lineWidth=2,o.moveTo(r+i,s),o.arc(r,s,i,0,2*Math.PI,!1),this.options.fillStyle&&(o.fillStyle=this.options.fillStyle),o.strokeStyle=this.options.strokeStyle}}],i&&Be(e.prototype,i),n&&Be(e,n),r}(St);function Ve(t){return Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ve(t)}function We(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ue(t,e){return Ue=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ue(t,e)}function Ge(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=qe(t);if(e){var o=qe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ze(this,i)}}function Ze(t,e){return!e||"object"!==Ve(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function qe(t){return qe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},qe(t)}var $e=new V,Ke=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ue(t,e)}(r,t);var e,i,n,o=Ge(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o.call(this)}return e=r,(i=[{key:"draw",value:function(t){var e=this,i=v(t);if(this.options.imgLoadSuccess)this.drawImage(this.options.img,i);else if(this.options.img){var n=this.options.img;$e.$once("load",(function(){e.drawImage(n,i)}),!0,n)}}},{key:"drawImage",value:function(t,e){this.canvas.getContext("2d").drawImage(t,e.x,e.y,e.width,e.height)}}])&&We(e.prototype,i),n&&We(e,n),r}(St),Xe=i(103),Ye=i.n(Xe);function Je(t){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(t)}function Qe(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ti(t,e){return ti=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ti(t,e)}function ei(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=ni(t);if(e){var o=ni(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ii(this,i)}}function ii(t,e){return!e||"object"!==Je(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function ni(t){return ni=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ni(t)}var oi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ti(t,e)}(r,t);var e,i,n,o=ei(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).isInRotation=!1,e.pointList=[],e.img=new Image(33,18),e.img.src=Ye.a,e}return e=r,(i=[{key:"init",value:function(t){var e=t.width,i=t.height;this.isInRotation=!0,this.imgWidth=e,this.imgHeight=i,this.rect=new pe,this.rect.setContent(this.canvas,{lineWidth:1,strokeStyle:"#989898"}),this.change()}},{key:"drawRect",value:function(t,e){var i=this.viewport.imageToViewportRectangle(0,0,this.imgWidth,this.imgHeight);this.rect.startDraw(),this.rect.draw([t,e],this.viewport.getRotation(),this.viewport.viewportToViewerElementRectangle(i)),this.rect.endDraw(),this.drawThumbPoint()}},{key:"drawRotation",value:function(){var t=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),e=this.imageToViewerElementCoordinates(this.imgWidth/2,this.imgHeight/15),i=this.viewport.getRotation(),n=this.canvas.getContext("2d");n.save(),n.beginPath(),n.translate(e.x,e.y),n.rotate(i/180*Math.PI),n.font="14px Arial";var o=i+"°",r=n.measureText(o).width;n.fillStyle="rgba(0, 0, 0, 0.5)",n.rect(-r/2-10,0,r+20,24),n.fill(),n.beginPath(),n.fillStyle="#FDFDFD",n.fillText(o,-r/2,18),n.restore(),n.save(),n.beginPath(),n.translate(t.x,t.y),n.rotate(i/180*Math.PI),n.drawImage(this.img,-16.5,0,33,18),n.restore()}},{key:"drawPoint",value:function(t,e){this.thumb.draw(t,e)}},{key:"drawThumbPoint",value:function(){var t=this;this.pointList.forEach((function(e,i){t.drawPoint({x:e.x,y:e.y},{radius:5})}))}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.imageToViewerElementCoordinates(this.imgWidth/2,-this.imgHeight/15),o=!!c({x:n.x-16.5,y:n.y},{x:n.x+16.5,y:n.y-18}).find((function(t){return d(t,{x:e,y:i})}));this.rotatePoint=o?{x:e,y:i}:void 0}},{key:"onCanvasRelease",value:function(t){t.x,t.y,this.rotatePoint=void 0,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=t.x,i=t.y;if(this.rotatePoint){this.lastPoint||(this.lastPoint={x:e,y:i});var n=b(this.pointList[4],this.lastPoint,{x:e,y:i});if(!isNaN(n/Math.PI*180)){var o=(n/Math.PI*180).toFixed(1)/1;this.viewport.setRotation((this.viewport.getRotation()+o).toFixed(1)/1),this.lastPoint={x:e,y:i}}}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&(this.viewport.setRotation(0),this.stopRotation())}},{key:"stopRotation",value:function(){this.clearCanvas(),this.rotatePoint=void 0,this.lastPoint=void 0,this.pointList=[],this.isInRotation=!1}},{key:"change",value:function(){var t=this;this.isInRotation&&(this.clearCanvas(),this.pointList=c({x:0,y:0},{x:this.imgWidth,y:this.imgHeight}).map((function(e){var i=e.x,n=e.y;return t.imageToViewerElementCoordinates(i,n)})),this.drawRect(this.pointList[0],this.pointList[8]),this.drawRotation())}}])&&Qe(e.prototype,i),n&&Qe(e,n),r}(bt),ri=(i(130),"start-painting"),si="in-painting",ai="end-painting",li="stop-painting",ci="tailoring-region",ui="tailoring-screenshot",hi="area-move-start",pi="area-moving",di="area-move-end",fi="select-label",gi="cancel-select-label",vi="db-click-label",mi="cache-back",yi="cache-forward",wi="hidden-label",xi="delete-label",bi="delete-polygon-point",Ti="add-polygon-point",Si="navigator-vestige";function Pi(t){return Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pi(t)}function Ei(t){return function(t){if(Array.isArray(t))return Ci(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ci(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Ci(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ci(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Ri(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function _i(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ri(Object(i),!0).forEach((function(e){Oi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ri(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Oi(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ii(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Di(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ki(t,e){return ki=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ki(t,e)}function Mi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ai(t);if(e){var o=Ai(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Li(this,i)}}function Li(t,e){return!e||"object"!==Pi(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Ai(t){return Ai=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ai(t)}var Bi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ki(t,e)}(r,t);var e,i,n,o=Mi(r);function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ii(this,r),(t=o.call(this)).options=e,t.viewport=e.viewer.viewport,t.viewer=e.viewer,t.el=e.el,t.height=e.height||150,t.width=e.width||150,t.containerHeight=e.containerHeight||window.innerHeight,t.containerWidth=e.containerWidth||window.innerWidth,t.element=e.element,t.pointList=e.pointList||[],t.loadStatus=!1,t.init(),t.vestige=t.options.vestige?_i({show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]},t.options.vestige):{show:!0,delay:1e3,colors:["rgba(255, 255, 0, .5)","rgba(0, 255, 255, .5)","rgba(255, 0, 255, .5)"],zooms:[5,10,20]},t}return e=r,i=[{key:"init",value:function(){var t=this;this.element.innerHTML='<main class="navigator-main">\n <div class="v-line"></div>\n <div class="h-line"></div>\n <div class="view-rect"></div>\n <canvas class="navigator-color-rect"></canvas>\n</main>';var e=this.element.getElementsByClassName("navigator-main")[0];this.canvas=this.createNavigatorCanvas(),e.appendChild(this.canvas),this.handleMouseDrag(e);var i=this.element.getElementsByClassName("view-rect")[0];this.rect=i,this.$on("rect-change",(function(t){var n=e.getElementsByClassName("v-line")[0],o=e.getElementsByClassName("h-line")[0];n.style.left=Math.round(i.getBoundingClientRect().width/2+i.offsetLeft)+"px",o.style.top=Math.round(i.getBoundingClientRect().height/2+i.offsetTop)+"px",n.style.backgroundColor="red",o.style.backgroundColor="red"})),this.$on("rect-draw",(function(e){var n=i.offsetLeft,o=i.offsetTop,r=e.detail,s={left:n,top:o,width:i.clientWidth,height:i.clientHeight,scale:Ei(t.vestige.zooms).reverse()[r],color:Ei(t.vestige.colors).reverse()[r]};t.pointList.push(s),t.drawPointList(t.pointList),t.$emit(Si,t.pointList)})),this.viewer.addHandler("pan",(function(e){t.navigatorChange(t.viewport.getZoom(!0),e.center)})),this.viewer.addHandler("zoom",(function(e){t.navigatorChange(e.zoom,e.refPoint)}))}},{key:"drawPointList",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pointList;this.pointList=e;var i=this.element.getElementsByClassName("navigator-color-rect")[0],n=i.getContext("2d");this.pointList.sort((function(t,e){return t.scale>e.scale?1:-1})).forEach((function(e){t.drawRect(n,e)}))}},{key:"drawRect",value:function(t,e){t.beginPath(),t.fillStyle=e.color,t.clearRect(e.left,e.top,e.width+1,e.height+1),t.fillRect(e.left,e.top,e.width+1,e.height+1)}},{key:"navigatorChange",value:function(t,e,i){this.loadStatus&&(e||(e=this.viewport.getCenter(!0)),i||(i=this.element.getElementsByClassName("view-rect")[0]),this.setViewRect(i,e))}},{key:"panTo",value:function(t,e){var i=t.x,n=t.y,o=this.viewport.getHomeBounds(),r=this.viewport.viewportToImageRectangle(o),s=2*r.y+r.height,a=2*r.x+r.width,l={x:i/this.canvas.width*a,y:n/this.canvas.height*s};this.viewport.panTo(this.viewport.imageToViewportCoordinates(new q.Point(l.x,l.y)),!1)}},{key:"handleMouseDrag",value:function(t){var e,i,n=this,o=function(o){var r=o.x,s=o.y;i||(i={x:r,y:s}),e||(e={x:r,y:s});var a=r-e.x,l=s-e.y;n.panTo({x:i.x+a,y:i.y+l},t)},r=function t(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.$off("mousemove",o),n.$off("mouseup",t)},s=function t(){e="",i={x:n.centerPoint.x,y:n.centerPoint.y},n.$off("touchmove",a),n.$off("touchend",t)},a=function(o){var r=o.touches[0].clientX,s=o.touches[0].clientY;i||(i={x:r,y:s}),e||(e={x:r,y:s});var a=r-e.x,l=s-e.y;n.panTo({x:i.x+a,y:i.y+l},t)};this.$on("mousedown",(function(e){n.$on("selectstart",(function(){return 1})),n.$on("dragstart",(function(){return 1})),n.panTo({x:e.x-t.getBoundingClientRect().left,y:e.y-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.$on("mousemove",o),n.$on("mouseup",r)}),!0,t),this.$on("touchstart",(function(e){var o=e.touches[0].clientX,r=e.touches[0].clientY;n.panTo({x:o-t.getBoundingClientRect().left,y:r-t.getBoundingClientRect().top},t),i={x:n.centerPoint.x,y:n.centerPoint.y},n.$on("touchmove",a),n.$on("touchend",s)}),!0,t)}},{key:"setViewRect",value:function(t,e){var i=this;if(!t)throw new Error("找不到对应的导航器遮罩元素");e||(e=this.viewport.getCenter(!0));var n=this.viewport.getHomeBounds(),o=this.viewport.viewportToImageRectangle(n),r=2*o.y+o.height,s=2*o.x+o.width,a=1,l=this.canvas.height,c=this.canvas.width;a=r<=s?l/r:c/s;var u=this.viewport.getHomeZoom(),h=this.viewport.getZoom(),p=r*u/h,d=s*u/h;t.style.cssText="height:".concat(p*a,"px;\n width: ").concat(d*a,"px;");var f=this.viewport.viewportToImageCoordinates(e);this.centerPoint={x:f.x*c/s,y:f.y*l/r};var g=this.centerPoint.y-p*a/2,v=this.centerPoint.x-d*a/2;if(t.style.left=v+"px",t.style.top=g+"px",t.style.border="1px solid red",this.$emit("rect-change"),!1!==this.vestige.show){this.clearTimeId&&window.clearTimeout(this.clearTimeId);var m=this.viewport.viewportToImageZoom(h),y=Ei(this.vestige.zooms).reverse().findIndex((function(t){return m>=t/(i.options.scale||40)}));-1!==y&&(this.clearTimeId=window.setTimeout((function(){i.$emit("rect-draw",y)}),this.vestige.delay||1e3))}}},{key:"createNavigatorCanvas",value:function(){var t=this,e=document.createElement("canvas"),i=e.getContext("2d"),n=new Image;return n.onload=function(){var o=n.width,r=n.height;if(o>=r){var s=r/(o/t.width);e.width=t.width,e.height=s,i.drawImage(n,0,0,e.width,s)}if(r>o){var a=o/(r/t.height);e.height=t.height,e.width=a,i.drawImage(n,0,0,a,e.height)}t.setViewRect(t.element.getElementsByClassName("view-rect")[0]);var l=t.element.getElementsByClassName("navigator-color-rect")[0];l.width=t.canvas.width,l.height=t.canvas.height,t.loadStatus=!0},n.src=this.options.thumbnail,e}},{key:"updateNavigatorImg",value:function(t){var e=this;this.options.thumbnail=t;var i=this.canvas.getContext("2d"),n=new Image;n.onload=function(){var t=n.width,o=n.height;if(t>=o){var r=o/(t/e.width);e.canvas.width=e.width,e.canvas.height=r,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,e.canvas.width,r)}if(o>t){var s=t/(o/e.height);e.canvas.height=e.height,e.canvas.width=s,i.clearRect(0,0,e.canvas.width,e.canvas.height),i.drawImage(n,0,0,s,e.canvas.height)}e.setViewRect(e.element.getElementsByClassName("view-rect")[0]);var a=e.element.getElementsByClassName("navigator-color-rect")[0];a.width=e.canvas.width,a.height=e.canvas.height},n.src=this.options.thumbnail}}],i&&Di(e.prototype,i),n&&Di(e,n),r}(V);function Hi(t){return Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hi(t)}function ji(t){return function(t){if(Array.isArray(t))return zi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return zi(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return zi(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zi(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Ni(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Fi(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Vi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wi(t,e){return Wi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Wi(t,e)}function Ui(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Zi(t);if(e){var o=Zi(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Gi(this,i)}}function Gi(t,e){return!e||"object"!==Hi(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Zi(t){return Zi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Zi(t)}var qi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wi(t,e)}(r,t);var e,i,n,o=Ui(r);function r(t){var e,i=t.kv,n=t.viewer,s=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,n,s,a,l)).kv=i,e.isInTailoring=!1,e.tailoringPoints=[],e.movePointIndex=-1,e.color="#FFF",e.contents=[],e.options=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ni(Object(i),!0).forEach((function(e){Fi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ni(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({suffix:"jpeg",quality:.92,resolution:1200},e.options),e}return e=r,(i=[{key:"init",value:function(t){var e=t.width,i=t.height,n=t.left,o=t.top,r=t.color,s=t.now,a=void 0!==s&&s,l=t.contents,u=void 0===l?[]:l;this.isInTailoring=!0,this.movePointIndex=-1;var h=c({x:n,y:o},{x:n+e,y:o+i});this.tailoringPoints=[h[0],h[2],h[6],h[8]],a?(this.emitTailoringRegion(),this.$emit(ui,{base64:this.getScreenCanvasImage(),region:this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y})}),this.stopTailoring()):(this.color=r||"#FFF",this.contents=(null==u?void 0:u.length)?u:["双击区域内表示完成截图","双击区域外或按ESC表示取消截图"],this.change())}},{key:"emitTailoringRegion",value:function(){this.$emit(ci,this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y}))}},{key:"drawRect",value:function(){var t=this.canvas.getContext("2d");t.beginPath(),t.strokeStyle=this.color,t.lineWidth=1,t.rect(this.tailoringPoints[0].x,this.tailoringPoints[0].y,this.tailoringPoints[3].x-this.tailoringPoints[0].x,this.tailoringPoints[3].y-this.tailoringPoints[0].y),t.stroke()}},{key:"drawTailoring",value:function(){var t,e,i,n,o,r=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),s=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),a=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),l=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),c={x:r,y:s},u={x:a,y:s},h={x:r,y:l},p={x:a,y:l},d=a-r>30?30:a-r,f=l-s>30?30:l-s,g=this.canvas.getContext("2d");g.beginPath(),g.strokeStyle=this.color,g.lineWidth=4,g.moveTo(c.x,c.y),g.lineTo(c.x+d,c.y),g.moveTo(c.x,c.y),g.lineTo(c.x,c.y+f),g.moveTo(u.x,u.y),g.lineTo(u.x-d,u.y),g.moveTo(u.x,u.y),g.lineTo(u.x,u.y+f),g.moveTo(h.x,h.y),g.lineTo(h.x+d,h.y),g.moveTo(h.x,h.y),g.lineTo(h.x,h.y-f),g.moveTo(p.x,p.y),g.lineTo(p.x-d,p.y),g.moveTo(p.x,p.y),g.lineTo(p.x,p.y-f),g.stroke(),g.beginPath(),g.fillStyle=this.color,g.font="18px Arial";var v=(u.x-c.x).toFixed(2)/1,m=(p.y-u.y).toFixed(2)/1;g.fillText((null===(t=this.contents)||void 0===t?void 0:t[2])?this.contents[2](v,m):"区域大小为:".concat(v,"*").concat(m),c.x,c.y-50),g.fillText(null!==(e=null===(i=this.contents)||void 0===i?void 0:i[0])&&void 0!==e?e:"双击区域内表示完成截图",c.x,c.y-30),g.fillText(null!==(n=null===(o=this.contents)||void 0===o?void 0:o[1])&&void 0!==n?n:"双击区域外或按ESC表示取消截图",c.x,c.y-10),g.stroke()}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y;this.movePointIndex=this.tailoringPoints.findIndex((function(t){return d(t,{x:e,y:i},30)}))}},{key:"onCanvasRelease",value:function(t){t.x,t.y,this.movePointIndex=-1,this.lastPoint=void 0}},{key:"onCanvasDrag",value:function(t){var e=t.x,i=t.y;if(-1!==this.movePointIndex){this.lastPoint||(this.lastPoint={x:e,y:i});var n=e-this.lastPoint.x,o=i-this.lastPoint.y;switch(this.movePointIndex){case 0:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+n,y:this.tailoringPoints[0].y+o},this.tailoringPoints[1]={x:this.tailoringPoints[1].x,y:this.tailoringPoints[1].y+o},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+n,y:this.tailoringPoints[2].y};break;case 1:this.tailoringPoints[0]={x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y+o},this.tailoringPoints[1]={x:this.tailoringPoints[1].x+n,y:this.tailoringPoints[1].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+n,y:this.tailoringPoints[3].y};break;case 2:this.tailoringPoints[0]={x:this.tailoringPoints[0].x+n,y:this.tailoringPoints[0].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x+n,y:this.tailoringPoints[2].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x,y:this.tailoringPoints[3].y+o};break;case 3:this.tailoringPoints[1]={x:this.tailoringPoints[1].x+n,y:this.tailoringPoints[1].y},this.tailoringPoints[2]={x:this.tailoringPoints[2].x,y:this.tailoringPoints[2].y+o},this.tailoringPoints[3]={x:this.tailoringPoints[3].x+n,y:this.tailoringPoints[3].y+o}}this.clearCanvas(),this.drawRect(),this.drawTailoring(),this.lastPoint={x:e,y:i},this.emitTailoringRegion()}}},{key:"onCanvasKey",value:function(t){"Escape"===t.originalEvent.key&&this.stopTailoring()}},{key:"onCanvasDblClick",value:function(t){this.tailoringPoints.length>0&&this.isPointInMatrix(t)&&(this.emitTailoringRegion(),this.$emit(ui,{base64:this.getScreenCanvasImage(),region:this.viewerElementToImageRectangle({x:this.tailoringPoints[0].x,y:this.tailoringPoints[0].y,width:this.tailoringPoints[3].x-this.tailoringPoints[0].x,height:this.tailoringPoints[3].y-this.tailoringPoints[0].y})})),this.stopTailoring()}},{key:"isPointInMatrix",value:function(t){var e=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),i=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),n=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),o=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y}))));return h({x:e,y:i},{x:n,y:i},{x:e,y:o},{x:n,y:o},t)}},{key:"getScreenCanvasImage",value:function(){var t=this.viewer.drawer.canvas,e=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),i=Math.min.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),n=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.x})))),o=Math.max.apply(Math,ji(this.tailoringPoints.map((function(t){return t.y})))),r=t.getContext("2d"),s=t.getBoundingClientRect(),a=s.width,l=s.height,c=[t.width,t.height],u=c[0]/a,h=c[1]/l,p=Math.abs(n-e)*u,d=Math.abs(o-i)*h;if(p.toFixed(5)/1!=0&&d.toFixed(5)/1!=0)try{for(var f,g=r.getImageData(e*u,i*h,p,d),v=0;v<g.data.length;v+=4)0===g.data[v+3]&&(g.data[v]=255,g.data[v+1]=255,g.data[v+2]=255,g.data[v+3]=255);var m=document.createElement("canvas");m.width=p,m.height=d;var y=m.getContext("2d");y.fillstyle="#fff",y.fillRect(0,0,m.width,m.height),y.putImageData(g,0,0,0,0,p,d);var w=null===(f=this.kv.shape)||void 0===f?void 0:f.canvas;if(w&&y.drawImage(w,e*u,i*h,p,d,0,0,p,d),m.width>this.options.resolution){var x=document.createElement("canvas");x.width=this.options.resolution,x.height=this.options.resolution/m.width*m.height;var b=x.getContext("2d");return b.fillstyle="#fff",b.fillRect(0,0,x.width,x.height),b.drawImage(m,0,0,m.width,m.height,0,0,x.width,x.height),x.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}return m.toDataURL("image/".concat(this.options.suffix||"jpeg"),this.options.quality)}catch(T){}}},{key:"stopTailoring",value:function(){this.clearCanvas(),this.tailoringPoints=[],this.isInTailoring=!1,this.movePointIndex=-1,this.lastPoint=void 0}},{key:"change",value:function(){this.isInTailoring&&(this.clearCanvas(),this.emitTailoringRegion(),this.drawRect(),this.drawTailoring())}}])&&Vi(e.prototype,i),n&&Vi(e,n),r}(bt);i(135),i(79),i(80);function $i(t){return $i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$i(t)}function Ki(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Yi(t,e){return Yi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Yi(t,e)}function Ji(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=tn(t);if(e){var o=tn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Qi(this,i)}}function Qi(t,e){return!e||"object"!==$i(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function tn(t){return tn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},tn(t)}var en=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Yi(t,e)}(r,t);var e,i,n,o=Ji(r);function r(){return Ki(this,r),o.apply(this,arguments)}return e=r,i=[{key:"draw",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.canvas.getContext("2d"),o=t.tool,r=t.points;n.beginPath(),n.save();var s=v(r),a={x:s.x+s.width/2,y:s.y+s.height/2};n.translate(a.x,a.y),n.rotate(i*Math.PI/180),o===tt?n.drawPolygon(r.map((function(t){return{x:t.x-a.x,y:t.y-a.y}})),!0,!1):o===J?(n.moveTo(r[0].x-a.x,r[0].y-a.y),n.lineTo(r[0].x+s.width-a.x,r[0].y-a.y),n.lineTo(r[0].x+s.width-a.x,r[0].y+s.height-a.y),n.lineTo(r[0].x-a.x,r[0].y+s.height-a.y),n.lineTo(r[0].x-a.x,r[0].y-a.y)):o===Q&&n.drawOval(0,0,Math.abs(s.width/2),Math.abs(s.height/2),!1),n.closePath(),n.restore(),e.forEach((function(t){var e=t.tool,o=t.points;n.save();var r=v(o),s={x:r.x+r.width/2,y:r.y+r.height/2};n.translate(s.x,s.y),n.rotate(i*Math.PI/180),e===tt?n.drawPolygon(o.map((function(t){return{x:t.x-s.x,y:t.y-s.y}})),!0,!0):e===J?(n.moveTo(o[0].x-s.x,o[0].y-s.y),n.lineTo(o[0].x-s.x,o[0].y+r.height-s.y),n.lineTo(o[0].x+r.width-s.x,o[0].y+r.height-s.y),n.lineTo(o[0].x+r.width-s.x,o[0].y-s.y),n.lineTo(o[0].x-s.x,o[0].y-s.y)):e===Q&&n.drawOval(0,0,Math.abs(r.width/2),Math.abs(r.height/2),!0),n.closePath(),n.restore()})),this.options.fillStyle&&(n.fillStyle=this.options.fillStyle,n.fill())}}],i&&Xi(e.prototype,i),n&&Xi(e,n),r}(St);function nn(t){return nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nn(t)}function on(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function rn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?on(Object(i),!0).forEach((function(e){sn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):on(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function sn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function an(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ln(t,e){return ln=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ln(t,e)}function cn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=hn(t);if(e){var o=hn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return un(this,i)}}function un(t,e){return!e||"object"!==nn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function hn(t){return hn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},hn(t)}var pn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ln(t,e)}(s,t);var e,i,o,r=cn(s);function s(t){var e,i=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this,i,o,a,l)).labelList=[],ht.forEach((function(t){e[t]=new n[t]})),e.combination=new en,e.delaytimer=[],e}return e=s,(i=[{key:"onCanvasKey",value:function(t){}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"change",value:function(){var t=this;this.clearCanvas();var e=this.viewport.viewportToImageRectangle(this.viewport.getBounds()),i={},n={},o=[],r=[],s=this.labelList.filter((function(s){var a,l,c,u,h;if(!1===s.show)return!1;if(!t[s.tool])return!1;if(!t.isInCanvas(s.region,e))return!1;if((at.includes(s.tool)||s.isClose&&s.tool===tt)&&s.fillStyle)o.push(rn(rn({},s),{},{child:[],self:s}));else if(s.tool===rt)return r.push(s),!1;var p="".concat(null!==(a=s.strokeStyle)&&void 0!==a?a:"","_").concat(null!==(l=s.lineWidth)&&void 0!==l?l:"","_").concat(null!==(c=s.fillStyle)&&void 0!==c?c:""),d="".concat(null!==(u=s.strokeStyle)&&void 0!==u?u:"","_").concat(null!==(h=s.lineWidth)&&void 0!==h?h:"");return st.includes(s.tool)?i[p]?i[p].push(s):i[p]=[s]:n[d]?n[d].push(s):n[d]=[s],!ut.includes(s.tool)}));o.length>0&&s.forEach((function(e){var i=o.find((function(i){return i.self!==e&&e.points.every((function(e){return t.isContainerInRegion(e,i)}))}));i&&i.child.push(e)})),this.delaytimer&&(clearTimeout(this.delaytimer),this.delaytimer=void 0),this.deepDrawLabel(i,n,o,r,1,e)}},{key:"deepDrawLabel",value:function(t,e,i,n,o,r){var s=this,a=0,l=this.canvas.getContext("2d"),c={};Object.keys(t).forEach((function(e){var i=t[e];l.beginPath(),i.forEach((function(t){a>=2e3?c[e]?c[e].push(t):c[e]=[t]:s.drawLabel(t),a++}));var n=null==i?void 0:i[0];(null==n?void 0:n.fillStyle)&&(l.fillStyle=n.fillStyle,l.fill()),l.strokeStyle=n.strokeStyle,l.stroke()}));var u={};Object.keys(e).forEach((function(t){var i=e[t];l.beginPath(),i.forEach((function(e){a>=2e3?u[t]?u[t].push(e):u[t]=[e]:s.drawLabel(e),a++}));var n=null==i?void 0:i[0];l.lineWidth=n.lineWidth,l.strokeStyle=n.strokeStyle,l.stroke()})),0===Object.keys(c).length&&0===Object.keys(u).length?(this.delaytimer=void 0,n.forEach((function(t){s.drawLabel(t)})),i.forEach((function(t){s.combination.setContent(s.canvas,t),s.combination.draw({points:s.imageToViewerElementPoints(t.points),tool:t.tool},t.child.map((function(t){var e=t.points,i=t.tool;return{points:s.imageToViewerElementPoints(e),tool:i}})),s.viewport.getRotation())}))):this.delaytimer=setTimeout((function(){s.deepDrawLabel(c,u,i,n,o+1,r)}),100)}},{key:"drawLabel",value:function(t){t.viewerElementPoints=this.imageToViewerElementPoints(t.points);var e=t.viewerElementPoints;if(this[t.tool].setContent(this.canvas,t),at.includes(t.tool))this[t.tool].draw(e,this.viewport.getRotation(),this.imageToViewerElementRectangle(t.region));else{var i=this.getImageZoom(!0)/t.scale;this[t.tool].draw(e,i)}}}])&&an(e.prototype,i),o&&an(e,o),s}(bt);function dn(t){return dn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dn(t)}function fn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function gn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?fn(Object(i),!0).forEach((function(e){vn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):fn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function vn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function mn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function yn(t,e){return yn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},yn(t,e)}function wn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=bn(t);if(e){var o=bn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return xn(this,i)}}function xn(t,e){return!e||"object"!==dn(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function bn(t){return bn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},bn(t)}var Tn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&yn(t,e)}(s,t);var e,i,o,r=wn(s);function s(t){var e,i=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this,i,o,a,l)).labelList=[],e.movePoint=void 0,e.currentPressPoint=void 0,e.lastPoint=void 0,e.draging=!1,e.isHover=!1,ht.forEach((function(t){e[t]=new n[t]})),e}return e=s,(i=[{key:"drawPoint",value:function(t,e){this.thumb.draw(t,{radius:e?this.options.thumb.activeRadius:this.options.thumb.radius,strokeStyle:e?this.options.thumb.activeColor:this.options.thumb.color,fillStyle:e?this.options.thumb.activeBgColor:this.options.thumb.bgColor})}},{key:"drawLine",value:function(t,e,i){var n=this.canvas.getContext("2d");n.beginPath();var o=i?this.options.thumb.activeColor:this.options.thumb.color,r=2*(i?this.options.thumb.activeRadius:this.options.thumb.radius);n.strokeStyle=o||"#01d0b0",n.lineWidth=2,0===e?(n.moveTo(t.x-5,t.y-5),n.lineTo(t.x-5+r,t.y-5),n.moveTo(t.x-5,t.y-5),n.lineTo(t.x-5,t.y-5+r)):1===e?(n.moveTo(t.x,t.y-5),n.lineTo(t.x-r/2,t.y-5),n.moveTo(t.x,t.y-5),n.lineTo(t.x+r/2,t.y-5)):2===e?(n.moveTo(t.x+5,t.y-5),n.lineTo(t.x+5-r,t.y-5),n.moveTo(t.x+5,t.y-5),n.lineTo(t.x+5,t.y-5+r)):3===e?(n.moveTo(t.x-5,t.y),n.lineTo(t.x-5,t.y-r/2),n.moveTo(t.x-5,t.y),n.lineTo(t.x-5,t.y+r/2)):4===e&&i?this.drawPoint(t,i):5===e?(n.moveTo(t.x+5,t.y),n.lineTo(t.x+5,t.y-r/2),n.moveTo(t.x+5,t.y),n.lineTo(t.x+5,t.y+r/2)):6===e?(n.moveTo(t.x-5,t.y+5),n.lineTo(t.x-5,t.y+5-r),n.moveTo(t.x-5,t.y+5),n.lineTo(t.x-5+r,t.y+5)):7===e?(n.moveTo(t.x,t.y+5),n.lineTo(t.x-r/2,t.y+5),n.moveTo(t.x,t.y+5),n.lineTo(t.x+r/2,t.y+5)):8===e&&(n.moveTo(t.x+5,t.y+5),n.lineTo(t.x+5,t.y+5-r),n.moveTo(t.x+5,t.y+5),n.lineTo(t.x+5-r,t.y+5)),n.stroke()}},{key:"setLabelList",value:function(t){this.labelList=t,this.change()}},{key:"onCanvasPress",value:function(t){var e=this,i=t.x,n=t.y;this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1;var o,r=[],s=void 0,a=this.viewport.viewportToImageRectangle(this.viewport.getBounds());this.labelList.forEach((function(t){if(t.tool!==rt&&(t.select&&(s=t),t.select=!1,!e.movePoint)){if(!e.isInCanvas(t.region,a))return!1;var o=-1,l=[],u=e.getImageZoom(!0)/t.scale,p=t.region,g=e.imageToViewerElementCoordinates(p.x,p.y),v=e.imageToViewerElementCoordinates(p.x+p.width,p.y+p.height);if(at.includes(t.tool))o=(l=c(g,v)).findIndex((function(t){return d(t,{x:i,y:n})}));else if(t.tool===tt)o=(l=e.setPointsMove(t)).findIndex((function(t){return t.canMove&&d(t,{x:i,y:n})}));else if(lt.includes(t.tool)){var m=(t.lineWidth||7)<8?8:t.lineWidth;l[0]={x:g.x+m*w(g.x-v.x)*w(g.y-v.y),y:g.y-m},l[1]=g,l[2]={x:v.x+m*w(g.x-v.x)*w(g.y-v.y),y:v.y-m},l[4]={x:(g.x+v.x)/2,y:(g.y+v.y)/2},l[6]={x:g.x-m*w(g.x-v.x)*w(g.y-v.y),y:g.y+m},l[7]=v,l[8]={x:v.x-m*w(g.x-v.x)*w(g.y-v.y),y:v.y+m},o=l.findIndex((function(t,e){return t&&d(t,{x:i,y:n})&&(1===e||4===e||7===e)}))}else if(t.tool===et){var y=e.getFontWidth(t.text,t.fontSize);l=c({x:v.x,y:v.y-t.fontSize*u},{x:v.x+y*u,y:v.y});var b=x(v,{x:i,y:n},-t.angle);o=l.findIndex((function(t,e){return d(t,b)&&4===e}))}else if(t.tool===it){var T=t.lineWidth*u;o=(l=c({x:v.x-T,y:v.y-T},{x:v.x+T,y:v.y+T})).findIndex((function(t){return d(t,{x:i,y:n})}))}if(t.tool===ot){var S=t.lineWidth*u;o=(l=c({x:v.x-S,y:v.y-S},{x:v.x+S,y:v.y+S})).findIndex((function(t,e){return d(t,{x:i,y:n})&&4===e}))}else if(t.tool===nt){var P=t.lineWidth*u;o=(l=c({x:v.x,y:v.y-P},{x:v.x+P,y:v.y})).findIndex((function(t){return d(t,{x:i,y:n})}))}~o?(e.movePoint={position:o,label:t},e.currentPressPoint={x:i,y:n}):(t.tool!==tt&&h(l[0],l[2],l[6],l[8],{x:i,y:n})||t.tool===tt&&f({x:i,y:n},l))&&r.push(t)}})),this.movePoint?(this.movePoint.label.select=!0,this.$emit(fi,this.movePoint.label),this.$emit(hi,this.movePoint.label),this.draging=!0):r.length>0&&((o=r.find((function(t){return t.tool===ot})))||(o=r.find((function(t){return t.tool===et})))||(o=r.find((function(t){return t.tool===it})))||(o=r.find((function(t){return t.tool===nt})))||(r.sort((function(t,e){return Math.abs(t.region.width)-Math.abs(e.region.width)})),o=r[0]),o.select=!0),o?this.$emit(fi,o):!this.movePoint&&s&&this.$emit(gi,s),this.change()}},{key:"onCanvasDblClick",value:function(t){var e=this,i=t.x,n=t.y;setTimeout((function(){var t=e.labelList.find((function(t){return t.select}));if((null==t?void 0:t.tool)===tt){for(var o=e.imageToViewerElementPoints(t.points),r=-1,s=0,a=o.length,l=a-1;s<a;l=s,s++){var c=o[s],u=o[l];if(g({x:i,y:n},[c,u])){r=s;break}}if(r>-1){var h=e.viewerElementToImageCoordinates(i,n);t.points.splice(r,0,gn(gn({},h),{},{canMove:!0})),e.$emit(Ti,t),e.change()}else e.$emit(vi,t)}else e.$emit(vi,t)}))}},{key:"onCanvasMove",value:function(t){var e=t.x,i=t.y,n=this.labelList.find((function(t){var e=t.tool,i=t.select;return e===J&&i}));if(n&&!this.movePoint){var o=this.imageToViewerElementRectangle(n.region);if(this.isContainerInRegion({x:e,y:i},gn(gn({},n),{},{region:o}))){var r=c({x:o.x,y:o.y},{x:o.x+o.width,y:o.y+o.height});4===r.findIndex((function(t){return d(t,{x:e,y:i})}))?(this.isHover=!0,this.drawPoint(r[4],!!this.movePoint)):this.isHover&&(this.isHover=!1,this.change())}}}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y;if(this.movePoint&&!1!==this.options.drag){var n=T(this.currentPressPoint,{x:e,y:i});if(Math.abs(n)>1){var o=this.movePoint.label;this.$emit(di,o)}}this.movePoint=void 0,this.currentPressPoint=void 0,this.lastPoint=void 0,this.draging=!1,this.change()}},{key:"onCanvasDrag",value:function(t,e){var i=this,n=t.x,o=t.y;if(!1!==this.options.drag){this.lastPoint||(this.lastPoint={x:n,y:o});var r=this.movePoint.label,s=this.movePoint.position,a=!1!==r.move,l=!1!==r.resize;if((a||l)&&(4!==s||a)&&(4===s||l)){e.preventDefaultAction=!0;var u=this.getImageZoom(!0)/r.scale,h=r.tool,p=r.region,d=this.imageToViewerElementCoordinates(p.x,p.y),f=this.imageToViewerElementCoordinates(p.x+p.width,p.y+p.height),g=n-this.lastPoint.x,m=o-this.lastPoint.y,y=gn({},d),w=gn({},f);if(lt.includes(h))4===s&&(y={x:d.x+g,y:d.y+m},w={x:f.x+g,y:f.y+m}),1===s&&(y={x:d.x+g,y:d.y+m}),7===s&&(w={x:f.x+g,y:f.y+m});else if(at.includes(h)){var S=c(d,f);switch(s){case 0:y={x:S[0].x+g,y:S[0].y+m};break;case 1:y={x:S[0].x,y:S[0].y+m};break;case 2:y={x:S[0].x,y:S[0].y+m},w={x:S[8].x+g,y:S[8].y};break;case 3:y={x:S[0].x+g,y:S[0].y};break;case 4:y={x:S[0].x+g,y:S[0].y+m},w={x:S[8].x+g,y:S[8].y+m};break;case 5:w={x:S[8].x+g,y:S[8].y};break;case 6:y={x:S[0].x+g,y:S[0].y},w={x:S[8].x,y:S[8].y+m};break;case 7:w={x:S[8].x,y:S[8].y+m};break;case 8:w={x:S[8].x+g,y:S[8].y+m}}}else if(h===tt){for(var P=this.imageToViewerElementPoints(r.points).map((function(t,e){return gn(gn({},t),{},{index:e})})),E=P.filter((function(t){return t.canMove})),C=void 0,R=void 0,_=0;_<E.length-1;_++){if(0===s){C=E[E.length-1].index,R=E[1].index;break}if(s===E[E.length-1].index){C=E[E.length-2].index,R=E[0].index;break}if(s===E[_].index){C=E[_-1].index,R=E[_+1].index;break}}if(!C&&0!==C||!R&&0!==R)return;var O=P[C],I=P[R],D=P[s],k=b(I,D,{x:n,y:o}),M=b(O,D,{x:n,y:o}),L=T({x:n,y:o},I)/T(D,I),A=T({x:n,y:o},O)/T(D,O);r.points=P.map((function(t,e){if(0===s&&e>=s&&e<=R||s===E[E.length-1].index&&e>=s&&e>=R||0!==s&&s!==E[E.length-1].index&&e>=s&&e<=R){if(L===1/0)return gn(gn({},t),i.viewerElementToImageCoordinates(I.x,I.y));var n=x(I,t,180*k/Math.PI);return gn(gn({},t),i.viewerElementToImageCoordinates((n.x-I.x)*L+I.x,(n.y-I.y)*L+I.y))}if(0===s&&e>=C||s===E[E.length-1].index&&e<=s&&e>=C||0!==s&&s!==E[E.length-1].index&&e>=C&&e<=s){if(A===1/0)return gn(gn({},t),i.viewerElementToImageCoordinates(O.x,O.y));var o=x(O,t,180*M/Math.PI);return gn(gn({},t),i.viewerElementToImageCoordinates((o.x-O.x)*A+O.x,(o.y-O.y)*A+O.y))}return gn(gn({},t),i.viewerElementToImageCoordinates(t.x,t.y))}))}else h===et||h===ot?4===s&&(y={x:f.x+g,y:f.y+m},w={x:f.x+g,y:f.y+m}):h===it?4===s?(y={x:f.x+g,y:f.y+m},w={x:f.x+g,y:f.y+m}):0===s||2===s?r.lineWidth-=m/u:6!==s&&8!==s||(r.lineWidth+=m/u):h===nt&&(4===s?(y={x:f.x+g,y:f.y+m},w={x:f.x+g,y:f.y+m}):0===s||2===s?r.lineWidth-=m/u:6!==s&&8!==s||(r.lineWidth+=m/u,w={x:f.x,y:f.y+m},y={x:f.x,y:f.y+m}));h!==tt&&(r.points=[this.viewerElementToImageCoordinates(y.x,y.y),this.viewerElementToImageCoordinates(w.x,w.y)]),r.region=v(r.points),this.$emit(pi,r),this.lastPoint={x:n,y:o}}}}},{key:"drawThumbPoints",value:function(t,e){var i,n=this;if(!1!==this.options.thumb.show){var o=null===(i=this.movePoint)||void 0===i?void 0:i.position;lt.includes(e)?(this.drawPoint(t[0],1===o),this.drawPoint({x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2},4===o),this.drawPoint(t[1],7===o)):e===J?c({x:t[0].x<t[1].x?t[0].x:t[1].x,y:t[0].y<t[1].y?t[0].y:t[1].y},{x:t[0].x>t[1].x?t[0].x:t[1].x,y:t[0].y>t[1].y?t[0].y:t[1].y}).forEach((function(t,e){n.drawLine(t,e,o===e)})):at.includes(e)?c(t[0],t[1]).forEach((function(t,e){n.drawPoint(t,o===e)})):e===tt?t.forEach((function(t,e){t.canMove&&n.drawPoint(t,o===e)})):e===et||e===ot?this.drawPoint(t[0],4===o):e!==it&&e!==nt||c(t[0],t[1]).forEach((function(t,e){0!==e&&2!==e&&4!==e&&6!==e&&8!==e||n.drawPoint(t,o===e)}))}}},{key:"change",value:function(){this.clearCanvas(),this.showLabelMeasure();var t=this.labelList.find((function(t){return t.select}));if(t&&!1!==t.show){var e=t.region,i=this.imageToViewerElementCoordinates(e.x,e.y),n=this.imageToViewerElementCoordinates(e.x+e.width,e.y+e.height),o=this.getImageZoom(!0)/t.scale;if(ct.includes(t.tool)){if(t.tool===et){var r=this.getFontWidth(t.text,t.fontSize),s=x(i,{x:i.x+r/2*o,y:i.y-t.fontSize/2*o+4},t.angle);this.drawThumbPoints([s],t.tool)}else if(t.tool===it){var a=t.lineWidth*o;this.drawThumbPoints([{x:i.x-a,y:i.y-a},{x:i.x+a,y:i.y+a}],t.tool)}else if(t.tool===ot)this.drawThumbPoints([{x:i.x,y:i.y}],t.tool);else if(t.tool===nt){var l=t.lineWidth*o;this.drawThumbPoints([{x:i.x,y:i.y-l},{x:i.x+l,y:i.y}],t.tool)}else if(t.tool===tt)if(this.draging){var c=this.imageToViewerElementPoints(t.points);this.drawThumbPoints(c,t.tool)}else{var u=this.setPointsMove(t);this.drawThumbPoints(u,t.tool)}}else this.drawThumbPoints([i,n],t.tool);this[t.tool].setContent(this.canvas,gn({},t))}}},{key:"showLabelMeasure",value:function(){var t=this,e=this.viewport.viewportToImageRectangle(this.viewport.getBounds());if(this.getImageZoom(!0)*this.options.scale<this.options.measure.scale){var i=this.labelList.find((function(t){return t.select}));if(!i)return;if(!1===i.show)return;if(!1===i.measure)return;this[i.tool].drawMeasureInfo.call(this,i,this.getMeasureContent(i))}else this.labelList.forEach((function(i){if(!1!==i.show){if(i.select&&i.measure)t[i.tool].drawMeasureInfo.call(t,i,t.getMeasureContent(i));else if(t.options.measure.defaultShow&&i.measure){if(!t.isInCanvas(i.region,e))return!1;t[i.tool].drawMeasureInfo.call(t,i,t.getMeasureContent(i))}if(t.options.labelDrawing){if(!t.isInCanvas(i.region,e))return!1;t.options.labelDrawing(t.canvas,i,t.imageToViewerElementRectangle(i.region))}}}))}},{key:"setPointsMove",value:function(t){var e=this.imageToViewerElementPoints(t.points),i=e[0];return e.forEach((function(n,o){n.canMove=!1,t.points[o].canMove=!1,0!==o&&(d(i,n,30)||d(e[0],n,30))&&o!==e.length-1||(i=n,n.canMove=!0,t.points[o].canMove=!0)})),e}}])&&mn(e.prototype,i),o&&mn(e,o),s}(bt);function Sn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Pn=function t(){var e,i,n,o,r,s,a=this,l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Sn(this,t),l||(l={}),this.id=l.id,this.parent_id=l.parent_id,this.lineWidth=l.lineWidth?l.lineWidth:l.tool===it?15:l.tool===nt?30:l.tool===ot?10:2,this.strokeStyle=l.strokeStyle||"#027AFF",this.fillStyle=l.fillStyle,this.description=l.description,this.fontSize=l.fontSize||14,this.text=l.text,this.angle=null!==(e=l.angle)&&void 0!==e?e:0,this.measure=l.measure,this.points=l.points,this.tool=l.tool,this.src=l.src,this.scale=l.scale,this.region=l.region,this.move=l.move,this.resize=l.resize,this.isROI=null!==(i=l.isROI)&&void 0!==i&&i,this.isClose=null===(n=l.isClose)||void 0===n||n,this.select=null!==(o=l.select)&&void 0!==o&&o,this.show=null===(r=l.show)||void 0===r||r,this.__other__=l.__other__||{},this.__data__=null!==(s=l.__data__)&&void 0!==s?s:l,this.src&&(this.img=new Image,this.img.src=this.src,this.imgLoadSuccess=!1,this.img.onload=function(){a.imgLoadSuccess=!0})};function En(t){return En="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(t)}function Cn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Rn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Cn(Object(i),!0).forEach((function(e){_n(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Cn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function On(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function In(t,e){return In=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},In(t,e)}function Dn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Mn(t);if(e){var o=Mn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return kn(this,i)}}function kn(t,e){return!e||"object"!==En(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Mn(t){return Mn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Mn(t)}var Ln=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&In(t,e)}(s,t);var e,i,o,r=Dn(s);function s(t){var e,i=t.viewer,o=t.canvas,a=t.cache,l=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),e=r.call(this,i,o,a,l),ht.forEach((function(t){e[t]=new n[t]})),e.ROIList=[],e.points=[],e.tool=void 0,e.isInDraw=!1,e}return e=s,i=[{key:"startDraw",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!ht.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.points=[],this.tool=t.tool,this[this.tool].setContent(this.canvas,Rn(Rn({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===it?15:this.tool===nt?30:this.tool===ot?10:2,tool:void 0})),this.isInDraw=!0}},{key:"updateOptions",value:function(t){if(!t.tool)throw new Error("options.tool must not bu null");if("curve"===t.tool)throw new Error("Curve is obsolete. Please use polygon instead");if(!ht.includes(t.tool))throw new Error("".concat(t.tool," is not a effective drawing tool"));this.viewer.canvas.focus(),this.tool=t.tool,this[this.tool].setContent(this.canvas,Rn(Rn({strokeStyle:"#027AFF",fillStyle:"",description:"",text:"",measure:!0,clear:!0,isClose:!0,enableDbClickClose:!0},t),{},{lineWidth:t.lineWidth?t.lineWidth:this.tool===it?15:this.tool===nt?30:this.tool===ot?10:2,tool:void 0}))}},{key:"setLabelList",value:function(t){this.ROIList=t.filter((function(t){return t.isROI}))}},{key:"onCanvasPress",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n))return this.points=[],void this.clearCanvas();var o=this.tool;o===tt?this.points.push(n):this.points=[n],this.clearCanvas(),this[o].startDraw();var r=this.imageToViewerElementPoints(this.points);this[o].draw(r),this[o].endDraw(),this[o].drawPoints(r,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(ri,this.getPaintOptions())}},{key:"onCanvasDrag",value:function(t){var e=t.position,i=e.x,n=e.y,o=this.viewerElementToImageCoordinates(i,n);if(!this.isInROI(o))return this.points=[],void this.clearCanvas();t.preventDefaultAction=!0;var r=this.tool;ct.includes(r)?r===tt?(this.points.push(o),this.setEnablePoints(!1)):st.includes(r)&&(this.points=[o,o]):this.points=[this.points[0]||o,o],this.clearCanvas(),this[r].startDraw();var s=this.imageToViewerElementPoints(this.points);this[r].draw(s),this[r].endDraw(),this[r].drawPoints(s,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(si,this.getPaintOptions())}},{key:"onCanvasRelease",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);if(!this.isInROI(n)||0===this.points.length)return this.points=[],void this.clearCanvas();var o=this.tool;if(ct.includes(o)){if(st.includes(o))this.points=[n,n];else if(o===tt){var r=this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),s=this[this.tool].options.enableDbClickClose,a=this[this.tool].options.isClose;if(s){if(!a||!d(r,{x:e,y:i}))return;if(this.setEnablePoints(),this.points.length<5)return}else if(this.setEnablePoints(),this.points.length<5)return this.points=[],void this.clearCanvas()}}else{var l=T(this.imageToViewerElementCoordinates(this.points[0].x,this.points[0].y),{x:e,y:i});if(Math.abs(l)<10)return this.points=[],void this.clearCanvas()}this.$emit(ai,this.getPaintOptions()),this[this.tool].options.once?this.endDraw():this[this.tool].options.clear&&(this.points=[],this.clearCanvas())}},{key:"onCanvasDblClick",value:function(t){var e=t.x,i=t.y,n=this.viewerElementToImageCoordinates(e,i);return this.isInROI(n)&&0!==this.points.length?this.tool===tt&&(this.setEnablePoints(),this.points.length<5)?(this.points=[],void this.clearCanvas()):(this.$emit(ai,this.getPaintOptions()),void(this[this.tool].options.once?(this.$emit(li,this.getPaintOptions()),this.endDraw()):this[this.tool].options.clear&&(this.points=[],this.clearCanvas()))):(this.points=[],void this.clearCanvas())}},{key:"onCanvasMove",value:function(t){var e=t.target,i=t.x,n=t.y,o=e.getBoundingClientRect(),r=o.left,s=o.top,a=this.viewerElementToImageCoordinates(i-r,n-s);if(!this.isInROI(a))return this.points=[],void this.clearCanvas();var l=this.tool;if(l===tt&&this.points.length>0){this.points.length>1&&this.points.pop(),this.points.push(a),this.clearCanvas(),this[l].startDraw();var c=this.imageToViewerElementPoints(this.points);this[l].draw(c),this[l].endDraw(),this[l].drawPoints(c,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(si,this.getPaintOptions())}}},{key:"onCanvasKey",value:function(t){var e=t.originalEvent;"Escape"===e.key&&this.isInDraw&&(this.$emit(li,this.getPaintOptions()),this.endDraw()),"Delete"!==e.key&&"Backspace"!==e.key||this.tool===tt&&this.points.length>1&&(this.points.splice(this.points.length-2,1),this.change())}},{key:"setEnablePoints",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=this.imageToViewerElementPoints(this.points),n=i[0];if(this.points=this.points.filter((function(e,o){var r=i[o];if(0===o)return!0;if(o===t.points.length-1)return!0;if(d(n,r,30)){var s=i[o+1];return!!s&&180*Math.abs(b(r,n,s))/Math.PI<90&&(n=r,!0)}return n=r,!0})),e&&this.points.length>1){var o=this.points[this.points.length-1],r=this.points[this.points.length-2];d(this.imageToViewerElementCoordinates(o.x,o.y),this.imageToViewerElementCoordinates(r.x,r.y))&&this.points.splice(this.points.length-2,1)}}},{key:"getPaintOptions",value:function(){var t=new Pn(Rn(Rn({},this[this.tool].options),{},{points:this.points,scale:this.getImageZoom(!0),region:v(this.points),tool:this.tool}));return t.measure&&this[this.tool].drawMeasureInfo.call(this,t,this.getMeasureContent(Rn(Rn({},t),{},{select:!0}))),t}},{key:"isInROI",value:function(t){return this.options.ROI?this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList):!(this.ROIList.length>0)||this[this.tool].options.isROI||this.isContainerLabel(t,this.ROIList)}},{key:"clearCanvas",value:function(){var t,e;null==this||null===(t=this[this.tool])||void 0===t||null===(e=t.clearCanvas)||void 0===e||e.call(t)}},{key:"endDraw",value:function(){this.clearCanvas(),this.points=[],this.tool=void 0,this.isInDraw=!1}},{key:"change",value:function(){if(this.isInDraw&&0!==this.points.length){var t=this.imageToViewerElementPoints(this.points);this.clearCanvas(),this[this.tool].startDraw(),this[this.tool].draw(t),this[this.tool].endDraw(),this[this.tool].drawPoints(t,{radius:this.options.thumb.radius,strokeStyle:this.options.thumb.color,fillStyle:this.options.thumb.bgColor}),this.$emit(si,this.getPaintOptions())}}}],i&&On(e.prototype,i),o&&On(e,o),s}(bt);function An(t){return An="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},An(t)}function Bn(t){return function(t){if(Array.isArray(t))return Hn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Hn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Hn(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function jn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function zn(t,e){return zn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},zn(t,e)}function Nn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Vn(t);if(e){var o=Vn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Fn(this,i)}}function Fn(t,e){return!e||"object"!==An(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Vn(t){return Vn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Vn(t)}var Wn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&zn(t,e)}(r,t);var e,i,n,o=Nn(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).scales=a.scales||[.1,.4,.6,1,2,4,8,10,20,40,60,100,140,200],e.microns=a.microns||[5e3,2e3,1250,1e3,500,250,200,100,50,25,20,10,5,2],e}return e=r,(i=[{key:"change",value:function(){var t=Bn(this.scales),e=40*this.viewport.viewportToImageZoom(this.viewport.getZoom(!0)),i=t.findIndex((function(t){return t>=e}));~i?this.setScaleLine(this.microns[i],this.microns[i]/this.options.imageCapRes):this.setScaleLine(this.microns[this.microns.length-1],this.microns[this.microns.length-1]/this.options.imageCapRes)}},{key:"setScaleLine",value:function(t,e){var i=this.imageToViewerElementCoordinates(0,0),n=this.imageToViewerElementCoordinates(e,0),o=Math.abs(n.x-i.x);this.options.custom?this.$emit("graduation-change",{width:o,txt:t}):this.paintGraduation({width:o,txt:t})}},{key:"paintGraduation",value:function(t){var e=t.width,i=t.txt,n=this.canvas.getContext("2d"),o=this.canvas.width,r=this.canvas.height;if(n.beginPath(),n.clearRect(0,0,o,r),this.options.show){var s=this.options,a=s.left,l=s.top,c=s.right,u=s.bottom,h=10,p=r-10;a?h=a:c&&(h=o-c-e),l?p=l:u&&(p=r-u),n.beginPath(),n.strokeStyle="#000000",n.lineWidth=3,n.moveTo(h,p-8),n.lineTo(h,p),n.lineTo(h+e,p),n.lineTo(h+e,p-8),n.stroke(),n.beginPath(),n.fillStyle="#000000",n.font="bold 16px Arial";var d=i.toFixed(0)+this.options.unit,f=n.measureText(d).width;n.fillText(d,h+e/2-f/2,l?p+12:p-12)}}}])&&jn(e.prototype,i),n&&jn(e,n),r}(bt);function Un(t){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(t)}function Gn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Zn(t,e){return Zn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Zn(t,e)}function qn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Kn(t);if(e){var o=Kn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return $n(this,i)}}function $n(t,e){return!e||"object"!==Un(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Kn(t){return Kn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Kn(t)}var Xn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Zn(t,e)}(r,t);var e,i,n,o=qn(r);function r(t){var e,i=t.viewer,n=t.canvas,s=t.cache,a=t.options;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(e=o.call(this,i,n,s,a)).options.scale||(e.options.scale=20),e}return e=r,(i=[{key:"change",value:function(){var t=this.viewerElementToImageCoordinates(0,0),e=this.viewerElementToImageCoordinates(this.canvas.width,0),i=this.viewerElementToImageCoordinates(0,this.canvas.height),n=this.getImageZoom(!0)*this.options.scale,o=40===this.options.scale?3200:1600,r=0;if(n>=1){for(;n/2>=1;)r++,n/=2;r&&(o/=Math.pow(2,r))}else if(n<1){for(;2*n<=1;)r++,n*=2;r&&(o*=Math.pow(2,r))}var s=e.distanceTo(t),a=i.distanceTo(t),l=Math.floor(t.x/o),c=Math.floor((e.x+s)/o),u=Math.floor(t.y/o),h=Math.floor((i.y+a)/o),p=this.canvas.getContext("2d");if(p.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.show){p.beginPath(),p.lineWidth=1;for(var d=l;d<=c+1;d++){var f=this.imageToViewerElementCoordinates(d*o,0);p.moveTo(f.x,0),p.lineTo(f.x,this.canvas.height)}for(var g=u;g<=h+1;g++){var v=this.imageToViewerElementCoordinates(0,g*o);p.moveTo(0,v.y),p.lineTo(this.canvas.width,v.y)}p.stroke()}if(this.options.ruler){var m=this.imageToViewerElementCoordinates(o,0).minus(this.imageToViewerElementCoordinates(0,0)).x;p.beginPath(),p.font="14px Arial",p.fillStyle="#fff",p.fillRect(0,0,20,this.canvas.height),p.fillRect(0,0,this.canvas.width,20),p.beginPath(),p.fillStyle="rgba(0, 0, 0, .3)",p.strokeStyle="rgba(0, 0, 0, .8)",p.moveTo(20,20),p.lineTo(20,this.canvas.height),p.moveTo(20,20),p.lineTo(this.canvas.width,20);for(var y=l;y<=c+1;y++){var w=this.imageToViewerElementCoordinates(y*o,0);p.moveTo(w.x,0),p.lineTo(w.x,20);for(var x=1;x<5;x++)p.moveTo(w.x+m/5*x,16),p.lineTo(w.x+m/5*x,20),y!==l&&p.fillText(y*o,w.x+5,13)}for(var b=u;b<=h+1;b++){var T=this.imageToViewerElementCoordinates(0,b*o);p.moveTo(0,T.y),p.lineTo(20,T.y);for(var S=1;S<5;S++)p.moveTo(16,T.y+m/5*S),p.lineTo(20,T.y+m/5*S),b!==u&&(p.save(),p.translate(3,T.y+5),p.rotate(Math.PI/2),p.fillText(b*o,0,0),p.restore())}p.stroke(),p.beginPath(),p.fillStyle="#fff",p.fillRect(0,0,20,20)}}}])&&Gn(e.prototype,i),n&&Gn(e,n),r}(bt);i(139);function Yn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Jn(t){return function(t){if(Array.isArray(t))return Qn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Qn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Qn(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}CanvasRenderingContext2D.prototype.clearArc=function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;this.beginPath(),this.save(),this.arc(t,e,i,n,o),this.clip(),this.clearRect(t-i,e-i,2*i,2*i),this.restore(),this.closePath()},CanvasRenderingContext2D.prototype.drawArrow=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,o=180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI,r=(o+i)*Math.PI/180,s=(o-i)*Math.PI/180,a=n*Math.cos(r),l=n*Math.sin(r),c=n*Math.cos(s),u=n*Math.sin(s),h=t.x-a,p=e.y-l;this.moveTo(h,p),this.moveTo(t.x,t.y),this.lineTo(e.x,e.y),h=e.x+a,p=e.y+l,this.moveTo(h,p),this.lineTo(e.x,e.y),h=e.x+c,p=e.y+u,this.lineTo(h,p)},CanvasRenderingContext2D.prototype.drawOval=function(t,e,i,n){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.save();var r=i>n?i:n,s=i/r,a=n/r;this.scale(s,a),this.moveTo((t+i)/s,e/a),this.arc(t/s,e/a,r,0,2*Math.PI,o),this.closePath(),this.restore()},CanvasRenderingContext2D.prototype.drawPolygon=function(t){for(var e=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=Jn(t),r=0,s=0;s<t.length-1;s++)r+=-.5*(t[s+1].y+t[s].y)*(t[s+1].x-t[s].x);r>0?n&&o.reverse():n||o.reverse(),this.moveTo(o[0].x,o[0].y),o.forEach((function(t){e.lineTo(t.x,t.y)})),i&&this.lineTo(o[0].x,o[0].y)};var to=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.points=e}var e,i,n;return e=t,(i=[{key:"calculationPoint",value:function(t){var e=this,i=this.points.length-1,n={x:0,y:0};return this.points.forEach((function(o,r){r?(n.x+=e.factorial(i)/e.factorial(r)/e.factorial(i-r)*o.x*Math.pow(1-t,i-r)*Math.pow(t,r),n.y+=e.factorial(i)/e.factorial(r)/e.factorial(i-r)*o.y*Math.pow(1-t,i-r)*Math.pow(t,r)):(n.x+=o.x*Math.pow(1-t,i-r)*Math.pow(t,r),n.y+=o.y*Math.pow(1-t,i-r)*Math.pow(t,r))})),n}},{key:"factorial",value:function(t){return t<=1?1:t*this.factorial(t-1)}}])&&Yn(e.prototype,i),n&&Yn(e,n),t}();CanvasRenderingContext2D.prototype.bezierCurve=function(){if(1===arguments.length){var t=arguments.length<=0?void 0:arguments[0];if(!Array.isArray(t))throw new SyntaxError("parameter error");if(1===t.length||0===t.length)throw new SyntaxError("Parameter length greater than 1");if(2===t.length&&(this.moveTo(t[0].x,t[0].y),this.lineTo(t[1].x,t[1].y),this.stroke()),3===t.length){var e=t[0];this.moveTo(e.x,e.y),this.quadraticCurveTo(t[1].x,t[1].y,t[2].x,t[2].y),this.stroke()}else if(4===t.length){var i=t[0];this.moveTo(i.x,i.y),this.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.stroke()}else for(var n=new to(t),o=Jn(new Array(101)).map((function(t,e){return n.calculationPoint(e/100)})),r=1;r<101;r++)this.moveTo(o[r-1].x,o[r-1].y),this.lineTo(o[r].x,o[r].y),this.stroke()}else if(4===arguments.length)this.quadraticCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3]);else{if(6!==arguments.length)throw new SyntaxError("parameter error");this.bezierCurveTo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5])}};var eo=function(t){var e=Object.prototype.toString;return t instanceof Element?"element":{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"}[e.call(t)]},io=function t(e){var i="array"===eo(e)?[]:{};for(var n in e)e.hasOwnProperty(n)&&(e[n]&&"object"===eo(e[n])||e[n]&&"array"===eo(e[n])?i[n]=t(e[n]):e[n]&&"date"===eo(e[n])?i[n]=new Date(e[n].valueOf()):i[n]=e[n]);return i};var no="shape",oo="area",ro="board",so="graduation",ao="rotation",lo="tailoring",co="navigator",uo="cache",ho="grid";function po(t){return po="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},po(t)}function fo(t){return function(t){if(Array.isArray(t))return go(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return go(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return go(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function go(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function vo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function mo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?vo(Object(i),!0).forEach((function(e){yo(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):vo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function yo(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xo(t,e){return xo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},xo(t,e)}function bo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Po(t);if(e){var o=Po(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return To(this,i)}}function To(t,e){return!e||"object"!==po(e)&&"function"!=typeof e?So(t):e}function So(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Po(t){return Po=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Po(t)}var Eo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&xo(t,e)}(a,t);var e,i,n,o=bo(a);function a(t){var e,i;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=o.call(this),!t.el)throw new Error("el must not be null");if(!t.openSeadragonOptions)throw new Error("no openSeadragon options");if("string"===eo(t.el)&&(e.$el=(i=t.el,document.querySelector(i))),"element"===eo(t.el)&&(e.$el=t.el),!e.$el)throw new Error("el is not a valid selector string or element object");e.$el.style.position="relative";var n,l,c=e.$el.getBoundingClientRect(),u=c.height,h=c.width;return e.$options=mo(mo({},t),{},{width:h,height:u}),n=So(e),l=mo(mo(mo({},{showNavigationControl:!1,navigatorSizeRatio:.25,wrapHorizontal:!1,minScrollDeltaTime:10,zoomPerClick:1,gestureSettingsMouse:{clickToZoom:!1}}),n.$options.openSeadragonOptions),{},{element:n.$el}),n.viewer=$()(l),n.viewer.addHandler("tile-drawing",(function(t){if("function"===eo(n.$options.tileDrawing))n.$options.tileDrawing(t);else{var e=t.context,i=t.rendered,o=t.sourceWidth,r=t.sourceHeight,s=t.position,a=t.size;e.drawImage(i.canvas,0,0,o,r,s.x,s.y,a.x,a.y)}})),function(t){var e=t.$options;Object.values(s).forEach((function(i){var n=i[0].toLocaleUpperCase()+i.substring(1);i===co?function(t){var e=t.$options;if(e.navigator=e.navigator||{disabled:!1},!0!==e.navigator.disabled){e.navigator.style||(e.navigator.style="bottom: 0;left: 0;");var i=document.createElement("div");i.setAttribute("class","openseadragon-navigator"),i.style.cssText+=e.navigator.style,t.viewer.container.appendChild(i),t.navigator=new Bi(mo({viewer:t.viewer,containerHeight:e.height,containerWidth:e.width,element:i,scale:e.scale},e.navigator))}}(t):i===uo?t.cache=new r[n]:(e[i]=e[i]||{disabled:!1},!0!==e[i].disabled&&(t[i]=new r[n](function(t,e){var i=t.$options,n=i.pxConversion||{imageCapRes:1,unit:""};return{kv:t,viewer:t.viewer,cache:t.cache,canvas:Co(t),options:mo(mo(mo({scale:i.scale,labelDrawing:i.labelDrawing,measure:mo({backgroundColor:"rgba(0,0,0,.5)",color:"#FFF",fontSize:14,scale:10,defaultShow:!1},i.measure||{})},i[e]),n),{},{thumb:i.thumb?mo({radius:5,activeRadius:7,activeBgColor:"#01d0b0"},i.thumb):{radius:5,activeRadius:7,activeBgColor:"#01d0b0"}})}}(t,i))))}))}(So(e)),function(t){t.viewer.addHandler("animation",(function(){var e;t.change(),(null===(e=t.tailoring)||void 0===e?void 0:e.isInTailoring)&&t.tailoring.emitTailoringRegion()})),t.viewer.addHandler("canvas-press",(function(e){var i,n,o,r;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)?t.board.onCanvasPress(e.position):(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation)?t.rotation.onCanvasPress(e.position):(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring)?t.tailoring.onCanvasPress(e.position):(null===(r=t.area)||void 0===r?void 0:r.onCanvasPress)&&t.area.onCanvasPress(e.position)})),t.viewer.addHandler("canvas-drag",(function(e){var i,n,o,r;if(null===(i=t.board)||void 0===i?void 0:i.isInDraw)t.board.onCanvasDrag(e);else if(null===(n=t.rotation)||void 0===n?void 0:n.rotatePoint)e.preventDefaultAction=!0,t.rotation.onCanvasDrag(e.position),t.change();else if((null===(o=t.tailoring)||void 0===o?void 0:o.movePointIndex)>-1)e.preventDefaultAction=!0,t.tailoring.onCanvasDrag(e.position);else if(null===(r=t.area)||void 0===r?void 0:r.movePoint){var s,a;t.area.onCanvasDrag(e.position,e),t.area.change(),null==t||null===(s=t.shape)||void 0===s||null===(a=s.change)||void 0===a||a.call(s)}})),t.viewer.addHandler("canvas-release",(function(e){var i,n,o,r;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)?t.board.onCanvasRelease(e.position):(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation)?t.rotation.onCanvasRelease(e.position):(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring)?t.tailoring.onCanvasRelease(e.position):(null===(r=t.area)||void 0===r?void 0:r.onCanvasRelease)&&t.area.onCanvasRelease(e.position)})),t.viewer.addHandler("canvas-key",function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,i=(new Date).getTime();return function(n){(new Date).getTime()-i>e&&t(n),i=(new Date).getTime()}}((function(e){var i,n,o;e.preventDefaultAction=!0;var r,s,a=e.originalEvent;if(function(t,e){if("z"===t.key&&t.ctrlKey){if(0===e.cache.currentIndex)return;e.cache.currentIndex--,e.$emit(mi,e.cache.currentIndex)}if("y"===t.key&&t.ctrlKey){if(e.cache.currentIndex===e.cache.cacheList.length-1)return;e.cache.currentIndex++,e.$emit(yi,e.cache.currentIndex)}}(a,t),null===(i=t.board)||void 0===i?void 0:i.isInDraw)null===(r=t.board)||void 0===r||null===(s=r.onCanvasKey)||void 0===s||s.call(r,e);else if(null===(n=t.rotation)||void 0===n?void 0:n.isInRotation){var l,c;null===(l=t.rotation)||void 0===l||null===(c=l.onCanvasKey)||void 0===c||c.call(l,e)}else if(null===(o=t.tailoring)||void 0===o?void 0:o.isInTailoring){var u,h;null===(u=t.tailoring)||void 0===u||null===(h=u.onCanvasKey)||void 0===h||h.call(u,e)}else{var p,d,f,g;!function(t,e){var i=e.labelList.findIndex((function(t){return t.select})),n=e.labelList[i];if("h"===t.key){if(!n)return;n.show=!1,e.$emit(wi,n)}else if("Delete"===t.key||"Backspace"===t.key){var o,r,s;if(!n)return;if((null===(o=e.area)||void 0===o||null===(r=o.movePoint)||void 0===r||null===(s=r.label)||void 0===s?void 0:s.tool)===tt){var a=e.area.movePoint;a.label.points.splice(a.position,1),0===a.label.points.length?(e.$emit(xi,n),e.labelList.splice(i,1)):e.$emit(bi,a.label),e.area.movePoint=void 0}else e.$emit(xi,n),e.labelList.splice(i,1)}else"Escape"===t.key&&(n&&e.$emit(gi,n),e.labelList.forEach((function(t){t.select=!1,t.show=!0})))}(a,t),null===(p=t.area)||void 0===p||null===(d=p.change)||void 0===d||d.call(p,e),null===(f=t.shape)||void 0===f||null===(g=f.change)||void 0===g||g.call(f,e)}}),100)),t.viewer.addHandler("canvas-double-click",(function(e){var i,n;if(null===(i=t.board)||void 0===i?void 0:i.isInDraw)t.board.onCanvasDblClick(e.position);else if(null===(n=t.tailoring)||void 0===n?void 0:n.isInTailoring){var o,r;null===(o=t.tailoring)||void 0===o||null===(r=o.onCanvasDblClick)||void 0===r||r.call(o,e.position)}else{var s,a;null===(s=t.area)||void 0===s||null===(a=s.onCanvasDblClick)||void 0===a||a.call(s,e.position)}})),t.viewer.addHandler("resize",(function(e){var i=e.newContainerSize,n=i.x,o=i.y;t.resizeViewContainer({width:n,height:o})})),t.$on("mousemove",(function(e){var i;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)&&t.board.onCanvasMove(e)}),!0,t.$el);var e,i=!1;t.viewer.canvas.addEventListener("contextmenu",(function(e){var i;(null===(i=t.board)||void 0===i?void 0:i.isInDraw)&&e.preventDefault()})),t.viewer.addHandler("canvas-nonprimary-press",(function(t){2===t.button&&(i=!0),e=t.position.clone()})),t.viewer.addHandler("canvas-nonprimary-release",(function(t){2===t.button&&(i=!1)})),new $.a.MouseTracker({element:t.viewer.canvas,moveHandler:function(n){var o,r;if(i&&(null===(o=t.board)||void 0===o?void 0:o.isInDraw)){if(2!==n.buttons)return void(i=!1);var s=n.position.minus(e);e=n.position.clone(),t.viewer.viewport.panBy(t.viewer.viewport.deltaPointsFromPixels(s.negate()))}else(null===(r=t.area)||void 0===r?void 0:r.onCanvasMove)&&t.area.onCanvasMove(n.position)}})}(So(e)),e.initLabelList(t.labelList||[]),e.resizeViewContainer(e.$options),e}return e=a,(i=[{key:"initLabelList",value:function(t){var e,i,n,o,r,s;this.labelList=t.map((function(t){return new Pn(mo(mo({},t),{},{region:t.region||v(t.points),__data__:io(t)}))})),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(o=n.setLabelList)||void 0===o||o.call(n,this.labelList),null===(r=this.area)||void 0===r||null===(s=r.setLabelList)||void 0===s||s.call(r,this.labelList)}},{key:"appendLabelList",value:function(t){var e,i,n,o,r,s;this.labelList=[].concat(fo(this.labelList),fo(t.map((function(t){return new Pn(mo(mo({},t),{},{region:t.region||v(t.points),__data__:io(t)}))})))),null===(e=this.board)||void 0===e||null===(i=e.setLabelList)||void 0===i||i.call(e,this.labelList),null===(n=this.shape)||void 0===n||null===(o=n.setLabelList)||void 0===o||o.call(n,this.labelList),null===(r=this.area)||void 0===r||null===(s=r.setLabelList)||void 0===s||s.call(r,this.labelList)}},{key:"resizeViewContainer",value:function(t){var e=this,i=t.width,n=t.height;this.$options.width=i,this.$options.height=n,Object.values(s).forEach((function(t){var o;(null===(o=e[t])||void 0===o?void 0:o.resetCanvasSize)&&e[t].resetCanvasSize({width:i,height:n})}))}},{key:"change",value:function(){var t=this;Object.values(s).forEach((function(e){var i;(null===(i=t[e])||void 0===i?void 0:i.change)&&t[e].change()}))}},{key:"destroy",value:function(){var t,e,i=this;this.$off(),null===(t=this.viewer)||void 0===t||null===(e=t.destroy)||void 0===e||e.call(t),this.viewer=void 0,this.$el=void 0,Object.values(s).forEach((function(t){var e,n;null===(e=i[t])||void 0===e||null===(n=e.destroy)||void 0===n||n.call(e),i[t]=void 0}))}}])&&wo(e.prototype,i),n&&wo(e,n),a}(V);function Co(t){var e=t.$options,i=document.createElement("canvas");return i.style.cssText="position: absolute; top: 0;\n left: 0; width: 100%; height: 100%;",i.width=e.width,i.height=e.height,t.viewer.canvas.appendChild(i),i}Eo.marks={},ht.forEach((function(t){Eo.marks[t.toLocaleUpperCase()]=t})),Eo.events=mo({},o)}]);const _KfbView$getRectPoint=KfbView.getRectPoint,_KfbView$isPointInMatrix=KfbView.isPointInMatrix,_KfbView$pointInOtherPoint=KfbView.pointInOtherPoint,_KfbView$isPointInEllipse=KfbView.isPointInEllipse,_KfbView$pointsToRegion=KfbView.pointsToRegion,_KfbView$regionToPoint=KfbView.regionToPoint,_KfbView$isPointInPolygon=KfbView.isPointInPolygon,_KfbView$isPointInLine=KfbView.isPointInLine,_KfbView$isNegNumber=KfbView.isNegNumber,_KfbView$baseNumber=KfbView.baseNumber,_KfbView$acreage=KfbView.acreage,_KfbView$perimeter=KfbView.perimeter,_KfbView$getPoint=KfbView.getPoint,_KfbView$getAngle=KfbView.getAngle,_KfbView$getDistance=KfbView.getDistance,_KfbView$rgbToHsl=KfbView.rgbToHsl,_KfbView$hslToRgb=KfbView.hslToRgb,_KfbView$toGamma=KfbView.toGamma,_KfbView$cacheGammaTable=KfbView.cacheGammaTable,_KfbView$imageSharpenUM=KfbView.imageSharpenUM,_KfbView$Cache=KfbView.Cache,_KfbView$Rotation=KfbView.Rotation,_KfbView$Navigator=KfbView.Navigator,_KfbView$Tailoring=KfbView.Tailoring,_KfbView$Shape=KfbView.Shape,_KfbView$Area=KfbView.Area,_KfbView$Board=KfbView.Board,_KfbView$Graduation=KfbView.Graduation,_KfbView$Grid=KfbView.Grid,_KfbView$KfbView=KfbView.KfbView,_KfbView$OpenSeadragon=KfbView.OpenSeadragon;export{_KfbView$getRectPoint as getRectPoint,_KfbView$isPointInMatrix as isPointInMatrix,_KfbView$pointInOtherPoint as pointInOtherPoint,_KfbView$isPointInEllipse as isPointInEllipse,_KfbView$pointsToRegion as pointsToRegion,_KfbView$regionToPoint as regionToPoint,_KfbView$isPointInPolygon as isPointInPolygon,_KfbView$isPointInLine as isPointInLine,_KfbView$isNegNumber as isNegNumber,_KfbView$baseNumber as baseNumber,_KfbView$acreage as acreage,_KfbView$perimeter as perimeter,_KfbView$getPoint as getPoint,_KfbView$getAngle as getAngle,_KfbView$getDistance as getDistance,_KfbView$rgbToHsl as rgbToHsl,_KfbView$hslToRgb as hslToRgb,_KfbView$toGamma as toGamma,_KfbView$cacheGammaTable as cacheGammaTable,_KfbView$imageSharpenUM as imageSharpenUM,_KfbView$Cache as Cache,_KfbView$Rotation as Rotation,_KfbView$Navigator as Navigator,_KfbView$Tailoring as Tailoring,_KfbView$Shape as Shape,_KfbView$Area as Area,_KfbView$Board as Board,_KfbView$Graduation as Graduation,_KfbView$Grid as Grid,_KfbView$KfbView as KfbView,_KfbView$OpenSeadragon as OpenSeadragon};