diff --git a/.gitignore b/.gitignore index 48348c0..2ad5c93 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules/ /.pnp .pnp.js +package-lock.json # testing coverage @@ -9,6 +10,7 @@ coverage # production lib build +dist # misc .DS_Store diff --git a/packages/mirador3-app/.eslintignore b/packages/mirador3-app/.eslintignore index 594cc78..0fc354f 100644 --- a/packages/mirador3-app/.eslintignore +++ b/packages/mirador3-app/.eslintignore @@ -1,4 +1,5 @@ build/ config/ +dist/ scripts/ coverage/ diff --git a/packages/mirador3-app/config/paths.js b/packages/mirador3-app/config/paths.js index 1e84ff8..7771620 100644 --- a/packages/mirador3-app/config/paths.js +++ b/packages/mirador3-app/config/paths.js @@ -65,9 +65,11 @@ module.exports = { dotenv: resolveApp('.env'), appPath: resolveApp('.'), appBuild: resolveApp('build'), + appDist: resolveApp('dist'), appPublic: resolveApp('public'), appHtml: resolveApp('public/index.html'), appIndexJs: resolveModule(resolveApp, 'src/index'), + appDistIndexJs: resolveModule(resolveApp, 'src/index-dist'), appPackageJson: resolveApp('package.json'), appSrc: resolveApp('src'), appTsConfig: resolveApp('tsconfig.json'), diff --git a/packages/mirador3-app/config/webpack.config.dist.js b/packages/mirador3-app/config/webpack.config.dist.js new file mode 100644 index 0000000..68815ae --- /dev/null +++ b/packages/mirador3-app/config/webpack.config.dist.js @@ -0,0 +1,50 @@ +process.env.BABEL_ENV = 'production'; +process.env.NODE_ENV = 'production'; + +require('./env'); +const paths = require('./paths'); + +module.exports = { + mode: 'production', + entry: [paths.appDistIndexJs], + output: { + path: paths.appDist, + filename: 'mirador.bundle.js', + libraryTarget: 'umd', + library: 'Mirador', + libraryExport: 'default', + }, + resolve: { extensions: ['.js'] }, + module: { + rules: [ + { + oneOf: [ + { + test: /\.js?$/, + exclude: /(node_modules)/, + loader: 'babel-loader', + }, + { + test: /\.scss$/, + use: [ + 'style-loader', // creates style nodes from JS strings + 'css-loader', // translates CSS into CommonJS + 'sass-loader', // compiles Sass to CSS, using Node Sass by default + ], + }, + { + loader: require.resolve('file-loader'), + // Exclude `js` files to keep "css" loader working as it injects + // it's runtime that would otherwise be processed through "file" loader. + // Also exclude `html` and `json` extensions so they get processed + // by webpacks internal loaders. + exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], + options: { + name: 'static/media/[name].[hash:8].[ext]', + }, + }, + ], + }, + ], + }, +}; diff --git a/packages/mirador3-app/config/webpack.config.prod.js b/packages/mirador3-app/config/webpack.config.prod.js index 2a3e36f..eeb7e91 100644 --- a/packages/mirador3-app/config/webpack.config.prod.js +++ b/packages/mirador3-app/config/webpack.config.prod.js @@ -206,7 +206,7 @@ module.exports = { // https://github.com/facebook/create-react-app/issues/253 modules: ['node_modules'].concat( // It is guaranteed to exist because we tweak it in `env.js` - process.env.NODE_PATH.split(path.delimiter).filter(Boolean) + process.env.NODE_PATH.split(path.delimiter).filter(Boolean), ), // These are the reasonable defaults supported by the Node ecosystem. // We also include JSX as a common component filename extension to support @@ -394,7 +394,7 @@ module.exports = { modules: true, getLocalIdent: getCSSModuleLocalIdent, }, - 'sass-loader' + 'sass-loader', ), }, // "file" loader makes sure assets end up in the `build` folder. diff --git a/packages/mirador3-app/package.json b/packages/mirador3-app/package.json index 8f62071..e2a0247 100644 --- a/packages/mirador3-app/package.json +++ b/packages/mirador3-app/package.json @@ -65,11 +65,13 @@ "terser-webpack-plugin": "1.1.0", "url-loader": "1.1.1", "webpack": "4.19.1", + "webpack-cli": "^3.1.2", "webpack-dev-server": "3.1.9", "webpack-manifest-plugin": "2.0.4", "workbox-webpack-plugin": "3.6.3" }, "scripts": { + "dist": "node_modules/.bin/webpack --config ./config/webpack.config.dist.js", "lint": "node_modules/.bin/eslint ./", "start": "node scripts/start.js", "build": "node scripts/build.js", @@ -86,7 +88,7 @@ "not ie <= 11", "not op_mini all" ], - "babel": { + "babel": { "presets": [ "react-app" ] diff --git a/packages/mirador3-app/src/index-dist.js b/packages/mirador3-app/src/index-dist.js new file mode 100644 index 0000000..65227f6 --- /dev/null +++ b/packages/mirador3-app/src/index-dist.js @@ -0,0 +1,18 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Provider } from 'react-redux'; +import { store } from 'mirador3-core'; +import App from './components/App'; +import './styles/index.scss'; + +/** + * Default Mirador distribution instantiation + */ +export default function Mirador(config) { + ReactDOM.render( + + + , + document.getElementById(config.id), + ); +} diff --git a/packages/mirador3-core/.eslintignore b/packages/mirador3-core/.eslintignore index 5dd89f0..bba186b 100644 --- a/packages/mirador3-core/.eslintignore +++ b/packages/mirador3-core/.eslintignore @@ -1,3 +1,4 @@ lib/ config/ coverage/ + diff --git a/packages/mirador3-e2e-tests/.eslintignore b/packages/mirador3-e2e-tests/.eslintignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/packages/mirador3-e2e-tests/.eslintignore @@ -0,0 +1 @@ +dist/ diff --git a/packages/mirador3-e2e-tests/.eslintrc b/packages/mirador3-e2e-tests/.eslintrc new file mode 100644 index 0000000..b86c3f4 --- /dev/null +++ b/packages/mirador3-e2e-tests/.eslintrc @@ -0,0 +1,18 @@ +{ + "env": { + "jest/globals": true + }, + "extends": "airbnb", + "globals": { + "page": true, + "document": true + }, + "plugins": ["jest"], + "rules": { + "no-console": "off", + "global-require": "off", + "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], + "require-jsdoc": 0, + "react/prefer-stateless-function": "off" + } +} diff --git a/packages/mirador3-e2e-tests/README.md b/packages/mirador3-e2e-tests/README.md new file mode 100644 index 0000000..54e376c --- /dev/null +++ b/packages/mirador3-e2e-tests/README.md @@ -0,0 +1,14 @@ +# Mirador3 E2E Tests + +### `npm run cypress:open` +starts server and runs cypress + +### Notes: +webpack is not used here yet, though a configuration is included. + +Currently, `dist` contains the common-js pre-built binary produced by `mirador3-app` with the `npm run dist` command. + +The server uses the index template from views that loads the binary from dist and loads default Mirador export. + +Optimally, `apps` will contain different source Apps that will be built with webpack from ES6 imports +using a published mirador3-app artifact. diff --git a/packages/mirador3-e2e-tests/apps.json b/packages/mirador3-e2e-tests/apps.json new file mode 100644 index 0000000..500dd2e --- /dev/null +++ b/packages/mirador3-e2e-tests/apps.json @@ -0,0 +1,3 @@ +[ + "mirador" +] diff --git a/packages/mirador3-e2e-tests/cypress.json b/packages/mirador3-e2e-tests/cypress.json new file mode 100644 index 0000000..a414c98 --- /dev/null +++ b/packages/mirador3-e2e-tests/cypress.json @@ -0,0 +1,8 @@ +{ + "baseUrl": "http://localhost:4000", + "reporter": "junit", + "reporterOptions": { + "mochaFile": "e2e-results.xml", + "toConsole": true + } +} \ No newline at end of file diff --git a/packages/mirador3-e2e-tests/cypress/fixtures/example.json b/packages/mirador3-e2e-tests/cypress/fixtures/example.json new file mode 100644 index 0000000..da18d93 --- /dev/null +++ b/packages/mirador3-e2e-tests/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} \ No newline at end of file diff --git a/packages/mirador3-e2e-tests/cypress/integration/mirador-base.spec.js b/packages/mirador3-e2e-tests/cypress/integration/mirador-base.spec.js new file mode 100644 index 0000000..f630b43 --- /dev/null +++ b/packages/mirador3-e2e-tests/cypress/integration/mirador-base.spec.js @@ -0,0 +1,7 @@ +/* global cy */ +describe('Mirador Base', () => { + it('Visits Mirador Base', () => { + cy.visit('http://localhost:4000/mirador'); + cy.get('title').contains('Mirador'); + }); +}); diff --git a/packages/mirador3-e2e-tests/cypress/plugins/index.js b/packages/mirador3-e2e-tests/cypress/plugins/index.js new file mode 100644 index 0000000..fd170fb --- /dev/null +++ b/packages/mirador3-e2e-tests/cypress/plugins/index.js @@ -0,0 +1,17 @@ +// *********************************************************** +// This example plugins/index.js can be used to load plugins +// +// You can change the location of this file or turn off loading +// the plugins file with the 'pluginsFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/plugins-guide +// *********************************************************** + +// This function is called when a project is opened or re-opened (e.g. due to +// the project's config changing) + +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config +} diff --git a/packages/mirador3-e2e-tests/cypress/support/commands.js b/packages/mirador3-e2e-tests/cypress/support/commands.js new file mode 100644 index 0000000..c1f5a77 --- /dev/null +++ b/packages/mirador3-e2e-tests/cypress/support/commands.js @@ -0,0 +1,25 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add("login", (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This is will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/packages/mirador3-e2e-tests/cypress/support/index.js b/packages/mirador3-e2e-tests/cypress/support/index.js new file mode 100644 index 0000000..d68db96 --- /dev/null +++ b/packages/mirador3-e2e-tests/cypress/support/index.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/packages/mirador3-e2e-tests/dist/mirador.bundle.js b/packages/mirador3-e2e-tests/dist/mirador.bundle.js new file mode 100644 index 0000000..5a6bb97 --- /dev/null +++ b/packages/mirador3-e2e-tests/dist/mirador.bundle.js @@ -0,0 +1,51 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Mirador=t():e.Mirador=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=15)}([function(e,t,n){"use strict";e.exports=n(16)},function(e,t,n){e.exports=n(20)()},function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=50)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l,u=[],c=!1,h=-1;function p(){c&&l&&(c=!1,l.length?u=l.concat(u):h=-1,u.length&&f())}function f(){if(!c){var e=a(p);c=!0;for(var t=u.length;t;){for(l=u,u=[];++h1)for(var n=1;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var r=!1,i={},a=0;a + * @license MIT + */ +var r=n(31),i=n(32),o=n(12);function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,s=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=n;oa&&(n=a-l),o=n;o>=0;o--){for(var h=!0,p=0;pi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function x(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function _(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);for(var n="",r=0;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return _(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return x(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},l.prototype.compare=function(e,t,n,r,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),c=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return T(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function I(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function A(e,t,n,r,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function k(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,o){return o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}l.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUInt8=function(e,t){return t||N(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||N(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||N(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||N(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||N(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||N(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||A(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);A(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);A(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function j(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(0))},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(5).Buffer)},function(e,t,n){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,n)});case 3:return t.nextTick(function(){e.call(null,n,r)});case 4:return t.nextTick(function(){e.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),h=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(46);function w(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?k+="x":k+=A[M];if(!k.match(f)){var D=O.slice(0,I),F=O.slice(I+1),B=A.match(d);B&&(D.push(B[1]),F.unshift(B[2])),F.length&&(w="/"+F.join(".")+w),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=r.toASCII(this.hostname));var U=this.port?":"+this.port:"",H=this.hostname||"";this.host=H+U,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==w[0]&&(w="/"+w))}if(!g[E])for(I=0,N=c.length;I0)&&n.host.split("@"))&&(n.auth=R.shift(),n.host=n.hostname=R.shift())),n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var _=S.slice(-1)[0],P=(n.host||e.host||S.length>1)&&("."===_||".."===_)||""===_,I=0,C=S.length;C>=0;C--)"."===(_=S[C])?S.splice(C,1):".."===_?(S.splice(C,1),I++):I&&(S.splice(C,1),I--);if(!b&&!E)for(;I--;I)S.unshift("..");!b||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),P&&"/"!==S.join("/").substr(-1)&&S.push("");var R,O=""===S[0]||S[0]&&"/"===S[0].charAt(0);return x&&(n.hostname=n.host=O?"":S.length?S.shift():"",(R=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=R.shift(),n.host=n.hostname=R.shift())),(b=b||n.host&&S.length)&&!O&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";(function(e,r){var i,o=n(24);i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:r;var s=Object(o.a)(i);t.a=s}).call(this,n(0),n(29)(e))},function(e,t,n){(function(e){var r=n(30),i=n(14),o=n(41),s=n(42),a=n(9),l=t;l.request=function(t,n){t="string"==typeof t?a.parse(t):o(t);var i=-1===e.location.protocol.search(/^https?:$/)?"http:":"",s=t.protocol||i,l=t.hostname||t.host,u=t.port,c=t.path||"/";l&&-1!==l.indexOf(":")&&(l="["+l+"]"),t.url=(l?s+"//"+l:"")+(u?":"+u:"")+c,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var h=new r(t);return n&&h.on("response",n),h},l.get=function(e,t){var n=l.request(e,t);return n.end(),n},l.ClientRequest=r,l.IncomingMessage=i.IncomingMessage,l.Agent=function(){},l.Agent.defaultMaxSockets=4,l.globalAgent=new l.Agent,l.STATUS_CODES=s,l.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,n(0))},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(e){t.fetch=a(e.fetch)&&a(e.ReadableStream),t.writableStream=a(e.WritableStream),t.abortController=a(e.AbortController),t.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),t.blobConstructor=!0}catch(e){}var n;function r(){if(void 0!==n)return n;if(e.XMLHttpRequest){n=new e.XMLHttpRequest;try{n.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var o=void 0!==e.ArrayBuffer,s=o&&a(e.ArrayBuffer.prototype.slice);function a(e){return"function"==typeof e}t.arraybuffer=t.fetch||o&&i("arraybuffer"),t.msstream=!t.fetch&&s&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&o&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!r()&&a(r().overrideMimeType),t.vbArray=a(e.VBArray),n=null}).call(this,n(0))},function(e,t,n){(function(e,r,i){var o=n(13),s=n(1),a=n(15),l=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},u=t.IncomingMessage=function(t,n,s,l){var u=this;if(a.Readable.call(u),u._mode=s,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){e.nextTick(function(){u.emit("close")})}),"fetch"===s){if(u._fetchResponse=n,u.url=n.url,u.statusCode=n.status,u.statusMessage=n.statusText,n.headers.forEach(function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)}),o.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,n){u._destroyed?n():u.push(new r(e))?t():u._resumeFetch=t})},close:function(){i.clearTimeout(l),u._destroyed||u.push(null)},abort:function(e){u._destroyed||u.emit("error",e)}});try{return void n.body.pipeTo(c).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}catch(e){}}var h=n.body.getReader();!function e(){h.read().then(function(t){if(!u._destroyed){if(t.done)return i.clearTimeout(l),void u.push(null);u.push(new r(t.value)),e()}}).catch(function(e){i.clearTimeout(l),u._destroyed||u.emit("error",e)})}()}else if(u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText,t.getAllResponseHeaders().split(/\r?\n/).forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===u.headers[n]&&(u.headers[n]=[]),u.headers[n].push(t[2])):void 0!==u.headers[n]?u.headers[n]+=", "+t[2]:u.headers[n]=t[2],u.rawHeaders.push(t[1],t[2])}}),u._charset="x-user-defined",!o.overrideMimeType){var p=u.rawHeaders["mime-type"];if(p){var f=p.match(/;\s*charset=([^;])(;|$)/);f&&(u._charset=f[1].toLowerCase())}u._charset||(u._charset="utf-8")}};s(u,a.Readable),u.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},u.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(t.readyState!==l.DONE)break;try{n=new i.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new r(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var o=n.substr(e._pos);if("x-user-defined"===e._charset){for(var s=new r(o.length),a=0;ae._pos&&(e.push(new r(new Uint8Array(u.result.slice(e._pos)))),e._pos=u.result.byteLength)},u.onload=function(){e.push(null)},u.readAsArrayBuffer(n)}e._xhr.readyState===l.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,n(2),n(5).Buffer,n(0))},function(e,t,n){(t=e.exports=n(16)).Stream=t,t.Readable=t,t.Writable=n(20),t.Duplex=n(3),t.Transform=n(22),t.PassThrough=n(39)},function(e,t,n){"use strict";(function(t,r){var i=n(7);e.exports=w;var o,s=n(12);w.ReadableState=y,n(17).EventEmitter;var a=function(e,t){return e.listeners(t).length},l=n(18),u=n(8).Buffer,c=t.Uint8Array||function(){},h=n(6);h.inherits=n(1);var p=n(33),f=void 0;f=p&&p.debuglog?p.debuglog("stream"):function(){};var d,g=n(34),m=n(19);h.inherits(w,l);var v=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var r=t instanceof(o=o||n(3));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=n(21).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function w(e){if(o=o||n(3),!(this instanceof w))return new w(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),l.call(this)}function T(e,t,n,r,i){var o,s=e._readableState;return null===t?(s.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,x(e)}}(e,s)):(i||(o=function(e,t){var n,r;return r=t,u.isBuffer(r)||r instanceof c||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):b(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?b(e,s,t,!1):P(e,s)):b(e,s,t,!1))):r||(s.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(f("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(_,e):_(e))}function _(e){f("emit readable"),e.emit("readable"),O(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(I,e,t))}function I(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0==(e-=s)){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),0==(e-=s)){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function A(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(k,t,e))}function k(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function M(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return f("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?A(this):x(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&A(this),null;var r,i=t.needReadable;return f("need readable",i),(0===t.length||t.length-e0?N(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&A(this)),null!==r&&this.emit("data",r),r},w.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,f("pipe count=%d opts=%j",o.pipesCount,t);var l=t&&!1===t.end||e===r.stdout||e===r.stderr?y:u;function u(){f("onend"),e.end()}o.endEmitted?i.nextTick(l):n.once("end",l),e.on("unpipe",function t(r,i){f("onunpipe"),r===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),e.removeListener("close",m),e.removeListener("finish",v),e.removeListener("drain",c),e.removeListener("error",g),e.removeListener("unpipe",t),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",d),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())});var c=function(e){return function(){var t=e._readableState;f("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,O(e))}}(n);e.on("drain",c);var h=!1,p=!1;function d(t){f("ondata"),p=!1,!1!==e.write(t)||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==M(o.pipes,e))&&!h&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function g(t){f("onerror",t),y(),e.removeListener("error",g),0===a(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",v),y()}function v(){f("onfinish"),e.removeListener("close",m),y()}function y(){f("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",g),e.once("close",m),e.once("finish",v),e.emit("pipe",n),o.flowing||(f("pipe resume"),n.resume()),e},w.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,o,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(a=s;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=a;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){e.exports=n(17).EventEmitter},function(e,t,n){"use strict";var r=n(7);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";(function(t,r,i){var o=n(7);function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=y;var a,l=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:o.nextTick;y.WritableState=v;var u=n(6);u.inherits=n(1);var c,h={deprecate:n(38)},p=n(18),f=n(8).Buffer,d=i.Uint8Array||function(){},g=n(19);function m(){}function v(e,t){a=a||n(3),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,u=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(u||0===u)?u:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(o.nextTick(i,r),o.nextTick(x,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),x(e,t))}(e,n,r,t,i);else{var s=E(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||b(e,n),r?l(T,e,n,s,i):T(e,n,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function y(e){if(a=a||n(3),!(c.call(y,this)||this instanceof a))return new y(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),p.call(this)}function w(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function T(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),x(e,t)}function b(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,l=!0;n;)i[a]=n,n.isBuf||(l=!1),n=n.next,a+=1;i.allBuffers=l,w(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,c=n.encoding,h=n.callback;if(w(e,t,!1,t.objectMode?1:u.length,u,c,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),x(e,t)})}function x(e,t){var n=E(t);return n&&(function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(S,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(y,p),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===y&&e&&e._writableState instanceof v}})):c=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,a=!i.objectMode&&(r=e,f.isBuffer(r)||r instanceof d);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=m),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),o.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(r,s),i=!1),i}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,o){if(!n){var s=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n)),t}(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var l=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,x(e,t),n&&(t.finished?o.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=g.destroy,y.prototype._undestroy=g.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(2),n(36).setImmediate,n(0))},function(e,t,n){"use strict";var r=n(8).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=h,t=3;break;default:return this.write=p,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(e.lastNeed=i-1),i):--r=0?(i>0&&(e.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=o;var r=n(3),i=n(6);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e),this._transformState={afterTransform:function(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length-1&&(this._keys.splice(t,1),this._values.splice(t,1),this.size--,!0)},t.prototype.entries=function(){var t=this;return e.range(0,this.size).select(function(e){return[t._keys[e],t._values[e]]})},t.prototype.forEach=function(e,t){null==t&&(t=this);for(var n=0,r=this._keys,i=this._values,o=r.length;n-1},t.prototype.keys=function(){return this._keys.en()},t.prototype.set=function(e,t){var n=this._keys.indexOf(e);n>-1?this._values[n]=t:(this._keys.push(e),this._values.push(t),this.size++)},t.prototype.values=function(){return this._values.en()},t}();e.Map3=t,e.Enumerable.prototype.toMap=function(e,n){for(var r=new t,i=this.getEnumerator();i.moveNext();)r.set(e(i.current),n(i.current));return r},e.List&&(e.List.prototype.toMap=e.Enumerable.prototype.toMap)}(o||(o={})),function(e){e.Map||(e.Map=o.Map3)}("undefined"==typeof window?t:window),function(e){e.anonymous=function(t){var n=new e.Enumerable;return n.getEnumerator=function(){var e={current:void 0,moveNext:function(){return t(e)}};return e},n}}(o||(o={})),function(e){e.Enumerable.prototype.append=function(){for(var t=this,n=[],r=0;r=t?(n.current=void 0,!1):(n.current=e[r],!0)},n}(t)},n.toArray=function(){return t.slice(0)},n}return a(t,e),t}(e.Enumerable);try{Object.defineProperty(Array.prototype,"en",{value:t,enumerable:!1,writable:!1,configurable:!1})}catch(e){Array.prototype.en=t}}(o||(o={})),function(e){e.Enumerable.prototype.concat=function(t){var n=this,r=t instanceof Array?t.en():t,i=new e.Enumerable;return i.getEnumerator=function(){return function(e,t){var n,r=!1,i={current:void 0,moveNext:function(){return n||(n=e.getEnumerator()),i.current=void 0,n.moveNext()?(i.current=n.current,!0):!r&&(r=!0,!!(n=t.getEnumerator()).moveNext()&&(i.current=n.current,!0))}};return i}(n,r)},i},e.List&&(e.List.prototype.concat=e.Enumerable.prototype.concat)}(o||(o={})),function(e){e.Enumerable.prototype.distinct=function(t){var n=this,r=new e.Enumerable;return r.getEnumerator=function(){return function(e,t){var n,r=[],i={current:void 0,moveNext:function(){if(n||(n=e.getEnumerator()),i.current=void 0,!t){for(;n.moveNext();)if(r.indexOf(n.current)<0)return r.push(i.current=n.current),!0;return!1}for(;n.moveNext();){for(var o=0,s=r.length,a=!1;o-1)){var s;void 0!==(s=n(e[o],this.$jsonMappings[o]))&&(r[o]=s,i.push(o))}for(var o in e)i.indexOf(o)>-1||(r[o]=e[o]);return r},function(e){function t(e,t,r){var i,o=0,s={current:void 0,moveNext:function(){return i||(i=n(e,t,r)),s.current=void 0,!(o>=i.length||(s.current=i[o],o++,0))}};return s}function n(e,t,n){n=n||function(e,t){return e===t};for(var i,o=[],s=[],a=e.getEnumerator();a.moveNext();){i=t(a.current);for(var l=-1,u=0,c=s.length;u=t?(n.current=void 0,!1):(n.current=e[r],!0)},n},n.prototype.remove=function(e){return this.removeWhere(function(t){return t===e}).any()},n.prototype.removeWhere=function(e){for(var t,n=[],r=this.length-1;r>=0;r--)!0===e(t=this[r],r)&&(this.splice(r,1),n.push(t));return n.en().reverse()}}(o||(o={})),function(e){function t(e,t,r,i){return new n(e,t,r,i)}var n=function(t){function n(e,n,r,i){var o=t.call(this)||this;o.Source=e,i=i||function(e,t){return e>t?1:e=t.length||(o.current=t[i],i++,0))}};return o},n.prototype.thenBy=function(e,t){return new r(this,e,!1,t)},n.prototype.thenByDescending=function(e,t){return new r(this,e,!0,t)},n}(e.Enumerable),r=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r,i)||this,s=t.Sorter,a=o.Sorter;return o.Sorter=function(e,t){return s(e,t)||a(e,t)},o}return a(t,e),t}(n),i=e.Enumerable.prototype;i.orderBy=function(e,n){return t(this,e,!1,n)},i.orderByDescending=function(e,n){return t(this,e,!0,n)},e.List&&(e.List.prototype.orderBy=e.Enumerable.prototype.orderBy,e.List.prototype.orderByDescending=e.Enumerable.prototype.orderByDescending)}(o||(o={})),function(e){e.Enumerable.prototype.prepend=function(){for(var t=this,n=[],r=0;r(n=n||0))throw new Error("Start cannot be greater than end.");null==r&&(r=1);var i=new e.Enumerable;return i.getEnumerator=function(){return function(e,t,n){var r=e-n,i={current:void 0,moveNext:function(){return!((r+=n)>=t||(i.current=r,0))}};return i}(t,n,r)},i}}(o||(o={})),function(e){e.Enumerable.prototype.reverse=function(){var t=this,n=new e.Enumerable;return n.getEnumerator=function(){return function(t){var n,r=0,i={current:void 0,moveNext:function(){return n||(n=e.en(t).toArray(),r=n.length),r--,i.current=n[r],r>=0}};return i}(t)},n},e.List&&(e.List.prototype.reverse=e.Enumerable.prototype.reverse)}(o||(o={})),(o||(o={})).round=function(e,t){if(0===(t=t||0))return Math.round(e);var n=Math.pow(10,t);return Math.round(e*n)/n},function(e){e.Enumerable.prototype.select=function(t){var n=this,r=new e.Enumerable;return r.getEnumerator=function(){return function(e,t){var n,r=0,i={current:void 0,moveNext:function(){return n||(n=e.getEnumerator()),!!n.moveNext()&&(i.current=t(n.current,r),r++,!0)}};return i}(n,t)},r},e.Enumerable.prototype.selectMany=function(t){var n=this,r=new e.Enumerable;return r.getEnumerator=function(){return function(t,n){var r,i,o={current:void 0,moveNext:function(){for(o.current=void 0,r||(r=t.getEnumerator());!i||!i.moveNext();){if(!r.moveNext())return!1;i=e.selectorEnumerator(n(r.current))}return o.current=i.current,!0}};return o}(n,t)},r},e.List&&(e.List.prototype.select=e.Enumerable.prototype.select,e.List.prototype.selectMany=e.Enumerable.prototype.selectMany)}(o||(o={})),(o||(o={})).selectorEnumerator=function(e){return Array.isArray(e)?e.en().getEnumerator():null!=e&&"function"==typeof e.getEnumerator?e.getEnumerator():null},function(e){e.Enumerable.prototype.skip=function(t){var n=this,r=new e.Enumerable;return r.getEnumerator=function(){return function(e,t){var n,r={current:void 0,moveNext:function(){if(!n){n=e.getEnumerator();for(var i=0;it||(i.current=void 0,!n.moveNext()||(i.current=n.current,0)))}};return i}(n,t)},r},e.Enumerable.prototype.takeWhile=function(t){var n=this,r=new e.Enumerable;return r.getEnumerator=function(){return function(e,t){var n,r=0,i={current:void 0,moveNext:function(){return n||(n=e.getEnumerator()),n.moveNext()&&t(n.current,r)?(r++,i.current=n.current,!0):(i.current=void 0,!1)}};return i}(n,t)},r},e.List&&(e.List.prototype.take=e.Enumerable.prototype.take,e.List.prototype.takeWhile=e.Enumerable.prototype.takeWhile)}(o||(o={})),function(e){function t(t,n,r){var i,o=!1,s=[],a={current:void 0,moveNext:function(){if(o){if(null==i)return!1;s.push(i),i=e.selectorEnumerator(n(a.current))}else i=t.getEnumerator(),o=!0;do{for(;!(i&&i.moveNext()||s.length<1);)i=s.pop();a.current=null==i?void 0:i.current}while(r(a.current));return void 0!==a.current}};return a}e.Enumerable.prototype.traverse=function(t){var n=this,r=new e.Enumerable;return r.getEnumerator=function(){return function(t,n){var r,i=!1,o=[],s={current:void 0,moveNext:function(){if(i){if(null==r)return!1;o.push(r),r=e.selectorEnumerator(n(s.current))}else r=t.getEnumerator(),i=!0;for(;!(r&&r.moveNext()||o.length<1);)r=o.pop();return s.current=null==r?void 0:r.current,void 0!==s.current}};return s}(n,t)},r},e.Enumerable.prototype.traverseUnique=function(n,r){var i=this,o=[],s=new e.Enumerable;return s.getEnumerator=r?function(){return t(i,n,function(e){return!!o.some(function(t){return r(e,t)})||(o.push(e),!1)})}:function(){return t(i,n,function(e){return o.indexOf(e)>-1||(o.push(e),!1)})},s},e.List&&(e.List.prototype.traverse=e.Enumerable.prototype.traverse,e.List.prototype.traverseUnique=e.Enumerable.prototype.traverseUnique)}(o||(o={})),function(e){e.Enumerable.prototype.union=function(t,n){var r=this,i=t instanceof Array?t.en():t,o=new e.Enumerable;return o.getEnumerator=function(){return function(t,n,r){r=r||function(e,t){return e===t};var i,o,s=[],a={current:void 0,moveNext:function(){if(i||(i=e.en(t).distinct().getEnumerator()),a.current=void 0,!o&&i.moveNext())return s.push(a.current=i.current),!0;for(o=o||e.en(n).distinct().getEnumerator();o.moveNext();){for(var l=0,u=!1,c=s.length;l-1||this.externalResource.data["@context"].indexOf("/1.1/context.json")>-1||this.externalResource.data["@context"].indexOf("/1/context.json")>-1)&&(i="native");else{var s=this.getImages();if(s&&s.length){var a=s[0].getResource(),l=a.getServices();if(o||(o=a.getWidth()),l.length){var u=l[0];r=u.id,i=e.Utils.getImageQuality(u.getProfile())}else if(o===a.getWidth())return a.id}if(!r){var c=this.getProperty("thumbnail");if(c){if("string"==typeof c)return c;if(c["@id"])return c["@id"];if(c.length)return c[0].id}}}return n=o+",",r&&r.endsWith("/")&&(r=r.substr(0,r.length-1)),[r,"full",n,0,i+".jpg"].join("/")},n.prototype.getMaxDimensions=function(){var t,n=null;return this.externalResource.data&&this.externalResource.data.profile&&(t=this.externalResource.data.profile,Array.isArray(t)&&(t=t.en().where(function(e){return e.maxWidth}).first())&&(n=new e.Size(t.maxWidth,t.maxHeight?t.maxHeight:t.maxWidth))),n},n.prototype.getContent=function(){var t=[],n=this.__jsonld.items||this.__jsonld.content;if(!n)return t;var r=null;if(n.length&&(r=new e.AnnotationPage(n[0],this.options)),!r)return t;for(var i=r.getItems(),o=0;o1},n.prototype.isPagingEnabled=function(){var t=this.getViewingHint();if(t)return t.toString()===e.ViewingHint.PAGED.toString();var n=this.getBehavior();return!!n&&n.toString()===e.Behavior.PAGED.toString()},n.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?new e.ViewingDirection(this.getProperty("viewingDirection")):null},n.prototype.getViewingHint=function(){return this.getProperty("viewingHint")?new e.ViewingHint(this.getProperty("viewingHint")):null},n}(e.IIIFResource);e.Manifest=t}(l||(l={})),a=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),function(e){var t=function(t){function n(e,n){var r=t.call(this,e,n)||this;return r.items=[],r._collections=null,r._manifests=null,e.__collection=r,r}return a(n,t),n.prototype.getCollections=function(){return this._collections?this._collections:this._collections=this.items.en().where(function(e){return e.isCollection()}).toArray()},n.prototype.getManifests=function(){return this._manifests?this._manifests:this._manifests=this.items.en().where(function(e){return e.isManifest()}).toArray()},n.prototype.getCollectionByIndex=function(e){var t=this.getCollections();if(!t[e])throw new Error("Collection index is outside range of array");var n=t[e];return n.options.index=e,n.load()},n.prototype.getManifestByIndex=function(e){var t=this.getManifests();if(!t[e])throw new Error("Manifest index is outside range of array");var n=t[e];return n.options.index=e,n.load()},n.prototype.getTotalCollections=function(){return this.getCollections().length},n.prototype.getTotalManifests=function(){return this.getManifests().length},n.prototype.getTotalItems=function(){return this.items.length},n.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?new e.ViewingDirection(this.getProperty("viewingDirection")):e.ViewingDirection.LEFTTORIGHT},n.prototype.getDefaultTree=function(){return t.prototype.getDefaultTree.call(this),this.defaultTree.data.type=e.Utils.normaliseType(e.TreeNodeType.COLLECTION.toString()),this._parseManifests(this),this._parseCollections(this),e.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},n.prototype._parseManifests=function(t){if(t.getManifests()&&t.getManifests().length)for(var n=0;n1&&(0===r&&(t=Number(o[0])),r===this.canvases.length-1&&(n=Number(o[1])))}else{var s=this.getRanges();for(r=0;r=t.start&&e<=t.end)},n.prototype._parseTreeNode=function(t,n){t.label=e.LanguageMap.getValue(n.getLabel(),this.options.locale),t.data=n,t.data.type=e.Utils.normaliseType(e.TreeNodeType.RANGE.toString()),n.treeNode=t;var r=n.getRanges();if(r&&r.length)for(var i=0;i=0;n--){var r=this.getCanvasByIndex(n),i=e.LanguageMap.getValue(r.getLabel(),this.options.locale);if(t){if(/^[a-zA-Z0-9]*$/.test(i))return i}else if(i)return i}return this.options.defaultLabel},n.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},n.prototype.getNextPageIndex=function(t,n){var r;if(n){var i=this.getPagedIndices(t),o=this.getViewingDirection();r=o&&o.toString()===e.ViewingDirection.RIGHTTOLEFT.toString()?i[0]+1:i[i.length-1]+1}else r=t+1;return r>this.getLastPageIndex()?-1:r},n.prototype.getPagedIndices=function(t,n){var r=[];if(n){r=this.isFirstCanvas(t)||this.isLastCanvas(t)?[t]:t%2?[t,t+1]:[t-1,t];var i=this.getViewingDirection();i&&i.toString()===e.ViewingDirection.RIGHTTOLEFT.toString()&&(r=r.reverse())}else r.push(t);return r},n.prototype.getPrevPageIndex=function(t,n){var r;if(n){var i=this.getPagedIndices(t),o=this.getViewingDirection();r=o&&o.toString()===e.ViewingDirection.RIGHTTOLEFT.toString()?i[i.length-1]-1:i[0]-1}else r=t-1;return r},n.prototype.getStartCanvasIndex=function(){var e=this.getStartCanvas();if(e)for(var t=0;tthis.getTotalCanvases()-1},n.prototype.isFirstCanvas=function(e){return 0===e},n.prototype.isLastCanvas=function(e){return e===this.getTotalCanvases()-1},n.prototype.isMultiCanvas=function(){return this.getTotalCanvases()>1},n.prototype.isPagingEnabled=function(){var t=this.getViewingHint();return!!t&&t.toString()===e.ViewingHint.PAGED.toString()},n.prototype.isTotalCanvasesEven=function(){return this.getTotalCanvases()%2==0},n}(e.ManifestResource);e.Sequence=t}(l||(l={})),function(e){var t=function(){function t(){}return t.parse=function(e,t){return"string"==typeof e&&(e=JSON.parse(e)),this.parseJson(e,t)},t.parseJson=function(e,t){var n;if(t&&t.navDate&&!isNaN(t.navDate.getTime())&&(e.navDate=t.navDate.toString()),e["@type"])switch(e["@type"]){case"sc:Collection":n=this.parseCollection(e,t);break;case"sc:Manifest":n=this.parseManifest(e,t);break;default:return null}else switch(e.type){case"Collection":n=this.parseCollection(e,t);break;case"Manifest":n=this.parseManifest(e,t);break;default:return null}return n.isLoaded=!0,n},t.parseCollection=function(t,n){var r=new e.Collection(t,n);return r.index=n&&n.index||0,this.parseCollections(r,n),this.parseManifests(r,n),this.parseItems(r,n),r},t.parseCollections=function(e,t){var n;if(e.__jsonld.collections?n=e.__jsonld.collections:e.__jsonld.items&&(n=e.__jsonld.items.en().where(function(e){return"collection"===e.type.toLowerCase()}).toArray()),n)for(var r=0;r0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]"):this.value=e,this.locale=t};e.Language=t}(l||(l={})),a=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),function(e){var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return a(n,t),n.parse=function(t,n){var r,i=[];if(!t)return i;if(Array.isArray(t))for(var o=0;o0?r-4:r,h=0;h>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===s&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[l++]=255&t),1===s&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<>1,c=-7,h=n?i-1:0,p=n?-1:1,f=e[t+h];for(h+=p,o=f&(1<<-c)-1,f>>=-c,c+=a;c>0;o=256*o+e[t+h],h+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*l-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(s=s<0;e[n+f]=255&s,f+=d,s/=256,u-=8);e[n+f-d]|=128*g}},function(e,t){},function(e,t,n){"use strict";var r=n(8).Buffer,i=n(35);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,o=r.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=o,i=a,t.copy(n,i),a+=s.data.length,s=s.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(37),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,o,s,a,l=1,u={},c=!1,h=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){d(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&d(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(t){e.postMessage(s+t,"*")}):e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){d(e.data)},r=function(e){o.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(e){var t=h.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(d,0,e)},p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=u-c,E=Math.floor,S=String.fromCharCode;function x(e){throw new RangeError(T[e])}function _(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function P(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+_((e=e.replace(w,".")).split("."),t).join(".")}function I(e){for(var t,n,r=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=S((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=S(e)}).join("")}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function O(e,t,n){var r=0;for(e=n?E(e/f):e>>1,e+=E(e/t);e>b*h>>1;r+=u)e=E(e/b);return E(r+(b+1)*e/(e+p))}function N(e){var t,n,r,i,o,s,a,p,f,v,y,w=[],T=e.length,b=0,S=g,_=d;for((n=e.lastIndexOf(m))<0&&(n=0),r=0;r=128&&x("not-basic"),w.push(e.charCodeAt(r));for(i=n>0?n+1:0;i=T&&x("invalid-input"),((p=(y=e.charCodeAt(i++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:u)>=u||p>E((l-b)/s))&&x("overflow"),b+=p*s,!(p<(f=a<=_?c:a>=_+h?h:a-_));a+=u)s>E(l/(v=u-f))&&x("overflow"),s*=v;_=O(b-o,t=w.length+1,0==o),E(b/t)>l-S&&x("overflow"),S+=E(b/t),b%=t,w.splice(b++,0,S)}return C(w)}function A(e){var t,n,r,i,o,s,a,p,f,v,y,w,T,b,_,P=[];for(w=(e=I(e)).length,t=g,n=0,o=d,s=0;s=t&&yE((l-n)/(T=r+1))&&x("overflow"),n+=(a-t)*T,t=a,s=0;sl&&x("overflow"),y==t){for(p=n,f=u;!(p<(v=f<=o?c:f>=o+h?h:f-o));f+=u)_=p-v,b=u-v,P.push(S(R(v+_%b,0))),p=E(_/b);P.push(S(R(p,0))),o=O(n,T,r==i),n=0,++r}++n,++t}return P.join("")}a={version:"1.4.1",ucs2:{decode:I,encode:C},decode:N,encode:A,toASCII:function(e){return P(e,function(e){return y.test(e)?"xn--"+A(e):e})},toUnicode:function(e){return P(e,function(e){return v.test(e)?N(e.slice(4).toLowerCase()):e})}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(44)(e),n(0))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(47),t.encode=t.stringify=n(48)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(h=g.substr(0,m),p=g.substr(m+1)):(h=g,p=""),f=decodeURIComponent(h),d=decodeURIComponent(p),r(s,f)?i(s[f])?s[f].push(d):s[f]=[s[f],d]:s[f]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],function(e){return a+encodeURIComponent(r(e))}).join(t):a+encodeURIComponent(r(e[s]))}).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case l.FOCUS_WINDOW:return Object.assign({},e,{focusedWindowId:t.windowId});default:return e}},windows:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case l.ADD_WINDOW:return e.concat(Object.assign({},t.payload));case l.REMOVE_WINDOW:return e.filter(function(e){return e.id!==t.windowId});case l.NEXT_CANVAS:return e.map(function(e){return e.id===t.windowId?Object.assign({},e,{canvasIndex:e.canvasIndex+1}):e});case l.PREVIOUS_CANVAS:return e.map(function(e){return e.id===t.windowId?Object.assign({},e,{canvasIndex:e.canvasIndex-1}):e});default:return e}},manifests:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case l.REQUEST_MANIFEST:return Object.assign({},e,h({},t.manifestId,{isFetching:!0}));case l.RECEIVE_MANIFEST:return Object.assign({},e,h({},t.manifestId,{manifestation:c.a.create(t.manifestJson),isFetching:!1}));case l.RECEIVE_MANIFEST_FAILURE:return Object.assign({},e,h({},t.manifestId,{error:t.error,isFetching:!1}));default:return e}}}),f=n(28),d=n.n(f);function g(e){return{type:l.FOCUS_WINDOW,windowId:e}}function m(e){var t={id:"window-".concat((new Date).valueOf()),canvasIndex:0,collectionIndex:0,manifestId:null,rangeId:null,xywh:[0,0,400,400],rotation:null};return{type:l.ADD_WINDOW,payload:Object.assign({},t,e)}}function v(e){return{type:l.REMOVE_WINDOW,windowId:e}}function y(e){return{type:l.NEXT_CANVAS,windowId:e}}function w(e){return{type:l.PREVIOUS_CANVAS,windowId:e}}function T(e){return{type:l.REQUEST_MANIFEST,manifestId:e}}function b(e,t){return{type:l.RECEIVE_MANIFEST,manifestId:e,manifestJson:t}}function E(e,t){return{type:l.RECEIVE_MANIFEST_FAILURE,manifestId:e,error:t}}function S(e){return function(t){return t(T(e)),d()(e).then(function(e){return e.json()}).then(function(n){return t(b(e,n))}).catch(function(n){return t(E(e,n))})}}n.d(t,"store",function(){return x}),n.d(t,"actions",function(){return _});var x=Object(s.createStore)(p,Object(a.composeWithDevTools)(Object(s.applyMiddleware)(o.a))),_=r;t.default={actions:_,store:x}}])},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i,o,s,a){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,i,o,s,a],c=0;(l=new Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}}},function(e,t,n){"use strict";e.exports=n(22)},function(e,t,n){"use strict";(function(e,r){var i,o=n(10);i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:r;var s=Object(o.a)(i);t.a=s}).call(this,n(7),n(23)(e))},function(e,t,n){"use strict"; +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l=n.escape.length&&e.substr(0,n.escape.length)===n.escape?e.substr(n.escape.length):e.match(n.include)&&!e.match(n.exclude)?n.prefix+n.namespace+n.glue+e:e}).join(" ").trim()}function v(e,t){a(i(t),"nsArray() expects array input, got: "+t);var n=p(e);return t.filter(function(e){return!!e}).map(m.bind(null,n)).join(" ")}function y(e,t){return a(o(t),"nsObject() expects object input, got: "+t),v(p(e),Object.keys(t).map(function(e){return t[e]?e:null}))}function w(e,t){if(r(t))return t;var n=p(e);a(s(n,t),"nsReactElement() expects a valid React element, got: "+t);var i=t.props.className?{className:g(n,t.props.className)}:t.props,o=n.React.Children.map(t.props.children,w.bind(null,n));return n.React.cloneElement(t,i,o)}},function(e,t){e.exports=t=window.fetch,t.Headers=window.Headers,t.Request=window.Request,t.Response=window.Response},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;//! openseadragon 2.4.0 +//! Built on 2018-07-20 +//! Git commit: v2.4.0-0-446af4d +//! http://openseadragon.github.io +//! License: http://openseadragon.github.io/license/ +function OpenSeadragon(e){return new OpenSeadragon.Viewer(e)}!function(e){e.version={versionStr:"2.4.0",major:parseInt("2",10),minor:parseInt("4",10),revision:parseInt("0",10)};var t={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;e.isFunction=function(t){return"function"===e.type(t)},e.isArray=Array.isArray||function(t){return"array"===e.type(t)},e.isWindow=function(e){return e&&"object"==typeof e&&"setInterval"in e},e.type=function(e){return null===e||void 0===e?String(e):t[n.call(e)]||"object"},e.isPlainObject=function(t){if(!t||"object"!==OpenSeadragon.type(t)||t.nodeType||e.isWindow(t))return!1;if(t.constructor&&!r.call(t,"constructor")&&!r.call(t.constructor.prototype,"isPrototypeOf"))return!1;var n;for(var i in t)n=i;return void 0===n||r.call(t,n)},e.isEmptyObject=function(e){for(var t in e)return!1;return!0},e.freezeObject=function(t){return Object.freeze?e.freezeObject=Object.freeze:e.freezeObject=function(e){return e},e.freezeObject(t)},e.supportsCanvas=function(){var t=document.createElement("canvas");return!(!e.isFunction(t.getContext)||!t.getContext("2d"))}(),e.isCanvasTainted=function(e){var t=!1;try{e.getContext("2d").getImageData(0,0,1,1)}catch(e){t=!0}return t},e.pixelDensityRatio=function(){if(e.supportsCanvas){var t=document.createElement("canvas").getContext("2d"),n=window.devicePixelRatio||1,r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return Math.max(n,1)/r}return 1}()}(OpenSeadragon),function($){$.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=arguments.length,l=!1,u=1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},u=2),"object"==typeof s||OpenSeadragon.isFunction(s)||(s={}),a===u&&(s=this,--u);u=n.x&&t.x=n.y},getEvent:function(e){return $.getEvent=e?function(e){return e}:function(){return window.event},$.getEvent(e)},getMousePosition:function(e){if("number"==typeof e.pageX)$.getMousePosition=function(e){var t=new $.Point;return e=$.getEvent(e),t.x=e.pageX,t.y=e.pageY,t};else{if("number"!=typeof e.clientX)throw new Error("Unknown event mouse position, no known technique.");$.getMousePosition=function(e){var t=new $.Point;return e=$.getEvent(e),t.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,t.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop,t}}return $.getMousePosition(e)},getPageScroll:function(){var e=document.documentElement||{},t=document.body||{};if("number"==typeof window.pageXOffset)$.getPageScroll=function(){return new $.Point(window.pageXOffset,window.pageYOffset)};else if(t.scrollLeft||t.scrollTop)$.getPageScroll=function(){return new $.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!e.scrollLeft&&!e.scrollTop)return new $.Point(0,0);$.getPageScroll=function(){return new $.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return $.getPageScroll()},setPageScroll:function(e){if(void 0!==window.scrollTo)$.setPageScroll=function(e){window.scrollTo(e.x,e.y)};else{var t=$.getPageScroll();if(t.x===e.x&&t.y===e.y)return;document.body.scrollLeft=e.x,document.body.scrollTop=e.y;var n=$.getPageScroll();if(n.x!==t.x&&n.y!==t.y)return void($.setPageScroll=function(e){document.body.scrollLeft=e.x,document.body.scrollTop=e.y});if(document.documentElement.scrollLeft=e.x,document.documentElement.scrollTop=e.y,(n=$.getPageScroll()).x!==t.x&&n.y!==t.y)return void($.setPageScroll=function(e){document.documentElement.scrollLeft=e.x,document.documentElement.scrollTop=e.y});$.setPageScroll=function(e){}}return $.setPageScroll(e)},getWindowSize:function(){var e=document.documentElement||{},t=document.body||{};if("number"==typeof window.innerWidth)$.getWindowSize=function(){return new $.Point(window.innerWidth,window.innerHeight)};else if(e.clientWidth||e.clientHeight)$.getWindowSize=function(){return new $.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!t.clientWidth&&!t.clientHeight)throw new Error("Unknown window size, no known technique.");$.getWindowSize=function(){return new $.Point(document.body.clientWidth,document.body.clientHeight)}}return $.getWindowSize()},makeCenteredNode:function(e){e=$.getElement(e);var t=[$.makeNeutralElement("div"),$.makeNeutralElement("div"),$.makeNeutralElement("div")];return $.extend(t[0].style,{display:"table",height:"100%",width:"100%"}),$.extend(t[1].style,{display:"table-row"}),$.extend(t[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"}),t[0].appendChild(t[1]),t[1].appendChild(t[2]),t[2].appendChild(e),t[0]},makeNeutralElement:function(e){var t=document.createElement(e),n=t.style;return n.background="transparent none",n.border="none",n.margin="0px",n.padding="0px",n.position="static",t},now:function(){return Date.now?$.now=Date.now:$.now=function(){return(new Date).getTime()},$.now()},makeTransparentImage:function(e){return $.makeTransparentImage=function(e){var t=$.makeNeutralElement("img");return t.src=e,t},$.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<7&&($.makeTransparentImage=function(e){var t=$.makeNeutralElement("img"),n=null;return(n=$.makeNeutralElement("span")).style.display="inline-block",t.onload=function(){n.style.width=n.style.width||t.width+"px",n.style.height=n.style.height||t.height+"px",t.onload=null,t=null},t.src=e,n.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e+"', sizingMethod='scale')",n}),$.makeTransparentImage(e)},setElementOpacity:function(e,t,n){var r;e=$.getElement(e),n&&!$.Browser.alpha&&(t=Math.round(t)),$.Browser.opacity?e.style.opacity=t<1?t:"":t<1?(r="alpha(opacity="+Math.round(100*t)+")",e.style.filter=r):e.style.filter=""},setElementTouchActionNone:function(e){void 0!==(e=$.getElement(e)).style.touchAction?e.style.touchAction="none":void 0!==e.style.msTouchAction&&(e.style.msTouchAction="none")},addClass:function(e,t){(e=$.getElement(e)).className?-1===(" "+e.className+" ").indexOf(" "+t+" ")&&(e.className+=" "+t):e.className=t},indexOf:function(e,t,n){return Array.prototype.indexOf?this.indexOf=function(e,t,n){return e.indexOf(t,n)}:this.indexOf=function(e,t,n){var r,i,o=n||0;if(!e)throw new TypeError;if(0===(i=e.length)||o>=i)return-1;for(o<0&&(o=i-Math.abs(o)),r=o;r=200&&a.status<300||0===a.status&&"http:"!==s&&"https:"!==s?t(a):($.console.log("AJAX request returned %d: %s",a.status,e),$.isFunction(n)&&n(a)))};try{if(a.open("GET",e,!0),o&&(a.responseType=o),i)for(var l in i)i.hasOwnProperty(l)&&i[l]&&a.setRequestHeader(l,i[l]);r&&(a.withCredentials=!0),a.send(null)}catch(r){var u=r.message;if($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<10&&void 0!==r.number&&-2147024891==r.number&&(u+="\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain"),$.console.log("%s while making AJAX request: %s",r.name,u),a.onreadystatechange=function(){},window.XDomainRequest){var c=new XDomainRequest;if(c){c.onload=function(e){$.isFunction(t)&&t({responseText:c.responseText,status:200,statusText:"OK"})},c.onerror=function(e){$.isFunction(n)&&n({responseText:c.responseText,status:444,statusText:"An error happened. Due to an XDomainRequest deficiency we can not extract any information about this error. Upgrade your browser."})};try{c.open("GET",e),c.send()}catch(e){$.isFunction(n)&&n(a,r)}}}else $.isFunction(n)&&n(a,r)}return a},jsonp:function(e){var t,n=e.url,r=document.head||document.getElementsByTagName("head")[0]||document.documentElement,i=e.callbackName||"openseadragon"+$.now(),o=window[i],s="$1"+i+"$2",a=e.param||"callback",l=e.callback;n=n.replace(/(\=)\?(&|$)|\?\?/i,s),n+=(/\?/.test(n)?"&":"?")+a+"="+i,window[i]=function(e){if(o)window[i]=o;else try{delete window[i]}catch(e){}l&&$.isFunction(l)&&l(e)},t=document.createElement("script"),void 0===e.async&&!1===e.async||(t.async="async"),e.scriptCharset&&(t.charset=e.scriptCharset),t.src=n,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,r&&t.parentNode&&r.removeChild(t),t=void 0)},r.insertBefore(t,r.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(e){if(window.DOMParser)$.parseXml=function(e){return(new DOMParser).parseFromString(e,"text/xml")};else{if(!window.ActiveXObject)throw new Error("Browser doesn't support XML DOM.");$.parseXml=function(e){var t=null;return(t=new ActiveXObject("Microsoft.XMLDOM")).async=!1,t.loadXML(e),t}}return $.parseXml(e)},parseJSON:function(string){return window.JSON&&window.JSON.parse?$.parseJSON=window.JSON.parse:$.parseJSON=function(string){return eval("("+string+")")},$.parseJSON(string)},imageFormatSupported:function(e){return!!FILEFORMATS[(e=e||"").toLowerCase()]}}),$.Browser={vendor:$.BROWSERS.UNKNOWN,version:0,alpha:!0};var FILEFORMATS={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},URLPARAMS={};!function(){var e=navigator.appVersion,t=navigator.userAgent;switch(navigator.appName){case"Microsoft Internet Explorer":window.attachEvent&&window.ActiveXObject&&($.Browser.vendor=$.BROWSERS.IE,$.Browser.version=parseFloat(t.substring(t.indexOf("MSIE")+5,t.indexOf(";",t.indexOf("MSIE")))));break;case"Netscape":window.addEventListener&&(t.indexOf("Firefox")>=0?($.Browser.vendor=$.BROWSERS.FIREFOX,$.Browser.version=parseFloat(t.substring(t.indexOf("Firefox")+8))):t.indexOf("Safari")>=0?($.Browser.vendor=t.indexOf("Chrome")>=0?$.BROWSERS.CHROME:$.BROWSERS.SAFARI,$.Browser.version=parseFloat(t.substring(t.substring(0,t.indexOf("Safari")).lastIndexOf("/")+1,t.indexOf("Safari")))):null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(t)&&($.Browser.vendor=$.BROWSERS.IE,$.Browser.version=parseFloat(RegExp.$1)));break;case"Opera":$.Browser.vendor=$.BROWSERS.OPERA,$.Browser.version=parseFloat(e)}var n,r,i,o=window.location.search.substring(1).split("&");for(i=0;i0&&(URLPARAMS[n.substring(0,r)]=decodeURIComponent(n.substring(r+1)));$.Browser.alpha=!($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<9||$.Browser.vendor==$.BROWSERS.CHROME&&$.Browser.version<2),$.Browser.opacity=!($.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<9)}();var nullfunction=function(e){};function getOffsetParent(e,t){return t&&e!=document.body?document.body:e.offsetParent}$.console=window.console||{log:nullfunction,debug:nullfunction,info:nullfunction,warn:nullfunction,error:nullfunction,assert:nullfunction},function(e){var t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame,n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.msCancelAnimationFrame;if(t&&n)$.requestAnimationFrame=function(){return t.apply(e,arguments)},$.cancelAnimationFrame=function(){return n.apply(e,arguments)};else{var r,i=[],o=[],s=0;$.requestAnimationFrame=function(e){return i.push([++s,e]),r||(r=setInterval(function(){if(i.length){var e=$.now(),t=o;for(o=i,i=t;o.length;)o.shift()[1](e)}else clearInterval(r),r=void 0},20)),s},$.cancelAnimationFrame=function(e){var t,n;for(t=0,n=i.length;t0&&(e.removeEvent(e.MouseTracker.captureElement,"mousemove",i.mousemovecaptured,!0),e.removeEvent(e.MouseTracker.captureElement,"mouseup",i.mouseupcaptured,!0),e.removeEvent(e.MouseTracker.captureElement,e.MouseTracker.unprefixedPointerEvents?"pointermove":"MSPointerMove",i.pointermovecaptured,!0),e.removeEvent(e.MouseTracker.captureElement,e.MouseTracker.unprefixedPointerEvents?"pointerup":"MSPointerUp",i.pointerupcaptured,!0),e.removeEvent(e.MouseTracker.captureElement,"touchmove",i.touchmovecaptured,!0),e.removeEvent(e.MouseTracker.captureElement,"touchend",i.touchendcaptured,!0),i.activePointersLists[r].captureCount=0);for(r=0;r0){for(r=0;r0&&(F(e,t,o,0),n.captureCount=1,a(e,n.type),L(e,t,o))}}function E(n,r){var i,o,s,l,c=r.changedTouches.length,h=[];for(i=e.now(),o=0;or.touches.length-c&&(e.console.warn("Tracked touch contact count doesn't match event.touches.length. Removing all tracked touch pointers."),b(n,r,p));for(o=0;o8||"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll",e.MouseTracker.supportsMouseCapture=function(){var t=document.createElement("div");return e.isFunction(t.setCapture)&&e.isFunction(t.releaseCapture)}(),e.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur",e.MouseTracker.wheelEventName],"DOMMouseScroll"==e.MouseTracker.wheelEventName&&e.MouseTracker.subscribeEvents.push("MozMousePixelScroll"),window.PointerEvent&&(window.navigator.pointerEnabled||e.Browser.vendor!==e.BROWSERS.IE)?(e.MouseTracker.havePointerEvents=!0,e.MouseTracker.subscribeEvents.push("pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel"),e.MouseTracker.unprefixedPointerEvents=!0,navigator.maxTouchPoints?e.MouseTracker.maxTouchPoints=navigator.maxTouchPoints:e.MouseTracker.maxTouchPoints=0,e.MouseTracker.haveMouseEnter=!1):window.MSPointerEvent&&window.navigator.msPointerEnabled?(e.MouseTracker.havePointerEvents=!0,e.MouseTracker.subscribeEvents.push("MSPointerOver","MSPointerOut","MSPointerDown","MSPointerUp","MSPointerMove","MSPointerCancel"),e.MouseTracker.unprefixedPointerEvents=!1,navigator.msMaxTouchPoints?e.MouseTracker.maxTouchPoints=navigator.msMaxTouchPoints:e.MouseTracker.maxTouchPoints=0,e.MouseTracker.haveMouseEnter=!1):(e.MouseTracker.havePointerEvents=!1,e.Browser.vendor===e.BROWSERS.IE&&e.Browser.version<9?(e.MouseTracker.subscribeEvents.push("mouseenter","mouseleave"),e.MouseTracker.haveMouseEnter=!0):(e.MouseTracker.subscribeEvents.push("mouseover","mouseout"),e.MouseTracker.haveMouseEnter=!1),e.MouseTracker.subscribeEvents.push("mousedown","mouseup","mousemove"),"ontouchstart"in window&&e.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel"),"ongesturestart"in window&&e.MouseTracker.subscribeEvents.push("gesturestart","gesturechange"),e.MouseTracker.mousePointerId="legacy-mouse",e.MouseTracker.maxTouchPoints=10),e.MouseTracker.GesturePointList=function(e){this._gPoints=[],this.type=e,this.buttons=0,this.contacts=0,this.clicks=0,this.captureCount=0},e.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(e){return this._gPoints.push(e)},removeById:function(e){var t,n=this._gPoints.length;for(t=0;t1&&("mouse"===this.type||"pen"===this.type)&&(this.contacts=1)},removeContact:function(){--this.contacts,this.contacts<0&&(this.contacts=0)}};var U=function(){try{return window.self!==window.top}catch(e){return!0}}();function H(e){try{return e.addEventListener&&e.removeEventListener}catch(e){return!1}}}(OpenSeadragon),function(e){e.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5},e.Control=function(t,n,r){var i=t.parentNode;"number"==typeof n&&(e.console.error("Passing an anchor directly into the OpenSeadragon.Control constructor is deprecated; please use an options object instead. Support for this deprecated variant is scheduled for removal in December 2013"),n={anchor:n}),n.attachToViewer=void 0===n.attachToViewer||n.attachToViewer,this.autoFade=void 0===n.autoFade||n.autoFade,this.element=t,this.anchor=n.anchor,this.container=r,this.anchor==e.ControlAnchor.ABSOLUTE?(this.wrapper=e.makeNeutralElement("div"),this.wrapper.style.position="absolute",this.wrapper.style.top="number"==typeof n.top?n.top+"px":n.top,this.wrapper.style.left="number"==typeof n.left?n.left+"px":n.left,this.wrapper.style.height="number"==typeof n.height?n.height+"px":n.height,this.wrapper.style.width="number"==typeof n.width?n.width+"px":n.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=e.makeNeutralElement("div"),this.wrapper.style.display="inline-block",this.anchor==e.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")),this.wrapper.appendChild(this.element),n.attachToViewer?this.anchor==e.ControlAnchor.TOP_RIGHT||this.anchor==e.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):i.appendChild(this.wrapper)},e.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element),this.container.removeChild(this.wrapper)},isVisible:function(){return"none"!=this.wrapper.style.display},setVisible:function(t){this.wrapper.style.display=t?this.anchor==e.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(t){this.element[e.SIGNAL]&&e.Browser.vendor==e.BROWSERS.IE?e.setElementOpacity(this.element,t,!0):e.setElementOpacity(this.wrapper,t,!0)}}}(OpenSeadragon),function(e){function t(e,t){var n,r=e.controls;for(n=r.length-1;n>=0;n--)if(r[n].element==t)return n;return-1}e.ControlDock=function(t){var n,r,i=["topleft","topright","bottomright","bottomleft"];for(e.extend(!0,this,{id:"controldock-"+e.now()+"-"+Math.floor(1e6*Math.random()),container:e.makeNeutralElement("div"),controls:[]},t),this.container.onsubmit=function(){return!1},this.element&&(this.element=e.getElement(this.element),this.element.appendChild(this.container),this.element.style.position="relative",this.container.style.width="100%",this.container.style.height="100%"),r=0;r=0)){switch(r.anchor){case e.ControlAnchor.TOP_RIGHT:i=this.controls.topright,n.style.position="relative",n.style.paddingRight="0px",n.style.paddingTop="0px";break;case e.ControlAnchor.BOTTOM_RIGHT:i=this.controls.bottomright,n.style.position="relative",n.style.paddingRight="0px",n.style.paddingBottom="0px";break;case e.ControlAnchor.BOTTOM_LEFT:i=this.controls.bottomleft,n.style.position="relative",n.style.paddingLeft="0px",n.style.paddingBottom="0px";break;case e.ControlAnchor.TOP_LEFT:i=this.controls.topleft,n.style.position="relative",n.style.paddingLeft="0px",n.style.paddingTop="0px";break;case e.ControlAnchor.ABSOLUTE:i=this.container,n.style.margin="0px",n.style.padding="0px";break;default:case e.ControlAnchor.NONE:i=this.container,n.style.margin="0px",n.style.padding="0px"}this.controls.push(new e.Control(n,r,i)),n.style.display="inline-block"}},removeControl:function(n){var r=t(this,n=e.getElement(n));return r>=0&&(this.controls[r].destroy(),this.controls.splice(r,1)),this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var e;for(e=this.controls.length-1;e>=0;e--)if(this.controls[e].isVisible())return!0;return!1},setControlsEnabled:function(e){var t;for(t=this.controls.length-1;t>=0;t--)this.controls[t].setVisible(e);return this}}}(OpenSeadragon),function(e){e.Placement=e.freezeObject({CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8,properties:{0:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1},1:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},2:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!0,isVerticallyCentered:!1,isBottom:!1},3:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!0,isVerticallyCentered:!1,isBottom:!1},4:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!0,isBottom:!1},5:{isLeft:!1,isHorizontallyCentered:!1,isRight:!0,isTop:!1,isVerticallyCentered:!1,isBottom:!0},6:{isLeft:!1,isHorizontallyCentered:!0,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},7:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!1,isBottom:!0},8:{isLeft:!0,isHorizontallyCentered:!1,isRight:!1,isTop:!1,isVerticallyCentered:!0,isBottom:!1}}})}(OpenSeadragon),function(e){var t={},n=1;function r(t){return t=e.getElement(t),new e.Point(0===t.clientWidth?1:t.clientWidth,0===t.clientHeight?1:t.clientHeight)}function i(t,n){if(n instanceof e.Overlay)return n;var r=null;if(n.element)r=e.getElement(n.element);else{var i=n.id?n.id:"openseadragon-overlay-"+Math.floor(1e7*Math.random());(r=e.getElement(n.id))||((r=document.createElement("a")).href="#/overlay/"+i),r.id=i,e.addClass(r,n.className?n.className:"openseadragon-overlay")}var o=n.location,s=n.width,a=n.height;if(!o){var l=n.x,u=n.y;if(void 0!==n.px){var c=t.viewport.imageToViewportRectangle(new e.Rect(n.px,n.py,s||0,a||0));l=c.x,u=c.y,s=void 0!==s?c.width:void 0,a=void 0!==a?c.height:void 0}o=new e.Point(l,u)}var h=n.placement;return h&&"string"===e.type(h)&&(h=e.Placement[n.placement.toUpperCase()]),new e.Overlay({element:r,location:o,placement:h,onDraw:n.onDraw,checkResize:n.checkResize,width:s,height:a,rotationMode:n.rotationMode})}function o(e,t){var n;for(n=e.length-1;n>=0;n--)if(e[n].element===t)return n;return-1}function s(t,n){return e.requestAnimationFrame(function(){n(t)})}function a(t){e.requestAnimationFrame(function(){!function(t){var n,r,i,o;if(t.controlsShouldFade){for(n=e.now(),r=n-t.controlsFadeBeginTime,i=1-r/t.controlsFadeLength,i=Math.min(1,i),i=Math.max(0,i),o=t.controls.length-1;o>=0;o--)t.controls[o].autoFade&&t.controls[o].setOpacity(i);i>0&&a(t)}}(t)})}function l(t){t.autoHideControls&&(t.controlsShouldFade=!0,t.controlsFadeBeginTime=e.now()+t.controlsFadeDelay,window.setTimeout(function(){a(t)},t.controlsFadeDelay))}function u(e){var t;for(e.controlsShouldFade=!1,t=e.controls.length-1;t>=0;t--)e.controls[t].setOpacity(1)}function c(){u(this)}function h(){l(this)}function p(t){var n={originalEvent:t.originalEvent,preventDefaultAction:t.preventDefaultAction,preventVerticalPan:t.preventVerticalPan,preventHorizontalPan:t.preventHorizontalPan};if(this.raiseEvent("canvas-key",n),n.preventDefaultAction||t.ctrl||t.alt||t.meta)return!0;switch(t.keyCode){case 38:return n.preventVerticalPan||(t.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-this.pixelsPerArrowPress))),this.viewport.applyConstraints()),!1;case 40:return n.preventVerticalPan||(t.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,this.pixelsPerArrowPress))),this.viewport.applyConstraints()),!1;case 37:return n.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),!1;case 39:return n.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(this.pixelsPerArrowPress,0))),this.viewport.applyConstraints()),!1;default:return!0}}function f(t){var n={originalEvent:t.originalEvent,preventDefaultAction:t.preventDefaultAction,preventVerticalPan:t.preventVerticalPan,preventHorizontalPan:t.preventHorizontalPan};if(this.raiseEvent("canvas-key",n),n.preventDefaultAction||t.ctrl||t.alt||t.meta)return!0;switch(t.keyCode){case 43:case 61:return this.viewport.zoomBy(1.1),this.viewport.applyConstraints(),!1;case 45:return this.viewport.zoomBy(.9),this.viewport.applyConstraints(),!1;case 48:return this.viewport.goHome(),this.viewport.applyConstraints(),!1;case 119:case 87:return n.preventVerticalPan||(t.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,-40))),this.viewport.applyConstraints()),!1;case 115:case 83:return n.preventVerticalPan||(t.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(0,40))),this.viewport.applyConstraints()),!1;case 97:return n.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(-40,0))),this.viewport.applyConstraints()),!1;case 100:return n.preventHorizontalPan||(this.viewport.panBy(this.viewport.deltaPointsFromPixels(new e.Point(40,0))),this.viewport.applyConstraints()),!1;case 114:return this.viewport.flipped?this.viewport.setRotation(this.viewport.degrees-90):this.viewport.setRotation(this.viewport.degrees+90),this.viewport.applyConstraints(),!1;case 82:return this.viewport.flipped?this.viewport.setRotation(this.viewport.degrees+90):this.viewport.setRotation(this.viewport.degrees-90),this.viewport.applyConstraints(),!1;case 102:return this.viewport.toggleFlip(),!1;default:return!0}}function d(e){var t;document.activeElement==this.canvas||this.canvas.focus(),this.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x);var n={tracker:e.eventSource,position:e.position,quick:e.quick,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.raiseEvent("canvas-click",n),!n.preventDefaultAction&&this.viewport&&e.quick&&(t=this.gestureSettingsByDeviceType(e.pointerType)).clickToZoom&&(this.viewport.zoomBy(e.shift?1/this.zoomPerClick:this.zoomPerClick,t.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null),this.viewport.applyConstraints())}function g(e){var t,n={tracker:e.eventSource,position:e.position,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.raiseEvent("canvas-double-click",n),!n.preventDefaultAction&&this.viewport&&(t=this.gestureSettingsByDeviceType(e.pointerType)).dblClickToZoom&&(this.viewport.zoomBy(e.shift?1/this.zoomPerClick:this.zoomPerClick,t.zoomToRefPoint?this.viewport.pointFromPixel(e.position,!0):null),this.viewport.applyConstraints())}function m(e){var t,n={tracker:e.eventSource,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};if(this.raiseEvent("canvas-drag",n),!n.preventDefaultAction&&this.viewport){if(t=this.gestureSettingsByDeviceType(e.pointerType),this.panHorizontal||(e.delta.x=0),this.panVertical||(e.delta.y=0),this.viewport.flipped&&(e.delta.x=-e.delta.x),this.constrainDuringPan){var r=this.viewport.deltaPointsFromPixels(e.delta.negate());this.viewport.centerSpringX.target.value+=r.x,this.viewport.centerSpringY.target.value+=r.y;var i=this.viewport.getBounds(),o=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=r.x,this.viewport.centerSpringY.target.value-=r.y,i.x!=o.x&&(e.delta.x=0),i.y!=o.y&&(e.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta.negate()),t.flickEnabled&&!this.constrainDuringPan)}}function v(t){if(!t.preventDefaultAction&&this.viewport){var n=this.gestureSettingsByDeviceType(t.pointerType);if(n.flickEnabled&&t.speed>=n.flickMinSpeed){var r=0;this.panHorizontal&&(r=n.flickMomentum*t.speed*Math.cos(t.direction));var i=0;this.panVertical&&(i=n.flickMomentum*t.speed*Math.sin(t.direction));var o=this.viewport.pixelFromPoint(this.viewport.getCenter(!0)),s=this.viewport.pointFromPixel(new e.Point(o.x-r,o.y-i));this.viewport.panTo(s,!1)}this.viewport.applyConstraints()}this.raiseEvent("canvas-drag-end",{tracker:t.eventSource,position:t.position,speed:t.speed,direction:t.direction,shift:t.shift,originalEvent:t.originalEvent})}function y(e){this.raiseEvent("canvas-enter",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function w(t){window.location!=window.parent.location&&e.MouseTracker.resetAllMouseTrackers(),this.raiseEvent("canvas-exit",{tracker:t.eventSource,pointerType:t.pointerType,position:t.position,buttons:t.buttons,pointers:t.pointers,insideElementPressed:t.insideElementPressed,buttonDownAny:t.buttonDownAny,originalEvent:t.originalEvent})}function T(e){this.raiseEvent("canvas-press",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent})}function b(e){this.raiseEvent("canvas-release",{tracker:e.eventSource,pointerType:e.pointerType,position:e.position,insideElementPressed:e.insideElementPressed,insideElementReleased:e.insideElementReleased,originalEvent:e.originalEvent})}function E(e){this.raiseEvent("canvas-nonprimary-press",{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function S(e){this.raiseEvent("canvas-nonprimary-release",{tracker:e.eventSource,position:e.position,pointerType:e.pointerType,button:e.button,buttons:e.buttons,originalEvent:e.originalEvent})}function x(e){var t,n,r;if(!e.preventDefaultAction&&this.viewport&&((t=this.gestureSettingsByDeviceType(e.pointerType)).pinchToZoom&&(n=this.viewport.pointFromPixel(e.center,!0),r=this.viewport.pointFromPixel(e.lastCenter,!0).minus(n),this.panHorizontal||(r.x=0),this.panVertical||(r.y=0),this.viewport.zoomBy(e.distance/e.lastDistance,n,!0),t.zoomToRefPoint&&this.viewport.panBy(r,!0),this.viewport.applyConstraints()),t.pinchRotate)){var i=Math.atan2(e.gesturePoints[0].currentPos.y-e.gesturePoints[1].currentPos.y,e.gesturePoints[0].currentPos.x-e.gesturePoints[1].currentPos.x),o=Math.atan2(e.gesturePoints[0].lastPos.y-e.gesturePoints[1].lastPos.y,e.gesturePoints[0].lastPos.x-e.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(i-o)*(180/Math.PI))}return this.raiseEvent("canvas-pinch",{tracker:e.eventSource,gesturePoints:e.gesturePoints,lastCenter:e.lastCenter,center:e.center,lastDistance:e.lastDistance,distance:e.distance,shift:e.shift,originalEvent:e.originalEvent}),!1}function _(t){var n,r,i;if((i=e.now())-this._lastScrollTime>this.minScrollDeltaTime){if(this._lastScrollTime=i,this.viewport.flipped&&(t.position.x=this.viewport.getContainerSize().x-t.position.x),!t.preventDefaultAction&&this.viewport&&(n=this.gestureSettingsByDeviceType(t.pointerType)).scrollToZoom&&(r=Math.pow(this.zoomPerScroll,t.scroll),this.viewport.zoomBy(r,n.zoomToRefPoint?this.viewport.pointFromPixel(t.position,!0):null),this.viewport.applyConstraints()),this.raiseEvent("canvas-scroll",{tracker:t.eventSource,position:t.position,scroll:t.scroll,shift:t.shift,originalEvent:t.originalEvent}),n&&n.scrollToZoom)return!1}else if((n=this.gestureSettingsByDeviceType(t.pointerType))&&n.scrollToZoom)return!1}function P(e){t[this.hash].mouseInside=!0,u(this),this.raiseEvent("container-enter",{tracker:e.eventSource,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function I(e){e.pointers<1&&(t[this.hash].mouseInside=!1,t[this.hash].animating||l(this)),this.raiseEvent("container-exit",{tracker:e.eventSource,position:e.position,buttons:e.buttons,pointers:e.pointers,insideElementPressed:e.insideElementPressed,buttonDownAny:e.buttonDownAny,originalEvent:e.originalEvent})}function C(e){!function(e){if(e._opening)return;if(e.autoResize){var n=r(e.container),i=t[e.hash].prevContainerSize;if(!n.equals(i)){var o=e.viewport;if(e.preserveImageSizeOnResize){var s=i.x/n.x,a=o.getZoom()*s,c=o.getCenter();o.resize(n,!1),o.zoomTo(a,null,!0),o.panTo(c,!0)}else{var h=o.getBounds();o.resize(n,!0),o.fitBoundsWithConstraints(h,!0)}t[e.hash].prevContainerSize=n,t[e.hash].forceRedraw=!0}}var p=e.viewport.update(),f=e.world.update()||p;p&&e.raiseEvent("viewport-change");e.referenceStrip&&(f=e.referenceStrip.update(e.viewport)||f);!t[e.hash].animating&&f&&(e.raiseEvent("animation-start"),u(e));(f||t[e.hash].forceRedraw||e.world.needsDraw())&&(!function(e){e.imageLoader.clear(),e.drawer.clear(),e.world.draw(),e.raiseEvent("update-viewport",{})}(e),e._drawOverlays(),e.navigator&&e.navigator.update(e.viewport),t[e.hash].forceRedraw=!1,f&&e.raiseEvent("animation"));t[e.hash].animating&&!f&&(e.raiseEvent("animation-finish"),t[e.hash].mouseInside||l(e));t[e.hash].animating=f}(e),e.isOpen()?e._updateRequestId=s(e,C):e._updateRequestId=!1}function R(e,t){return e?e+t:t}function O(){t[this.hash].lastZoomTime=e.now(),t[this.hash].zoomFactor=this.zoomPerSecond,t[this.hash].zooming=!0,k(this)}function N(){t[this.hash].lastZoomTime=e.now(),t[this.hash].zoomFactor=1/this.zoomPerSecond,t[this.hash].zooming=!0,k(this)}function A(){t[this.hash].zooming=!1}function k(t){e.requestAnimationFrame(e.delegate(t,M))}function M(){var n,r,i;t[this.hash].zooming&&this.viewport&&(r=(n=e.now())-t[this.hash].lastZoomTime,i=Math.pow(t[this.hash].zoomFactor,r/1e3),this.viewport.zoomBy(i),this.viewport.applyConstraints(),t[this.hash].lastZoomTime=n,k(this))}function L(){this.viewport&&(t[this.hash].zooming=!1,this.viewport.zoomBy(this.zoomPerClick/1),this.viewport.applyConstraints())}function D(){this.viewport&&(t[this.hash].zooming=!1,this.viewport.zoomBy(1/this.zoomPerClick),this.viewport.applyConstraints())}function F(){this.buttons.emulateEnter(),this.buttons.emulateExit()}function B(){this.viewport&&this.viewport.goHome()}function U(){this.isFullPage()&&!e.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage()),this.buttons&&this.buttons.emulateExit(),this.fullPageButton.element.focus(),this.viewport&&this.viewport.applyConstraints()}function H(){if(this.viewport){var t=this.viewport.getRotation();t=this.viewport.flipped?e.positiveModulo(t+90,360):e.positiveModulo(t-90,360),this.viewport.setRotation(t)}}function j(){if(this.viewport){var t=this.viewport.getRotation();t=this.viewport.flipped?e.positiveModulo(t-90,360):e.positiveModulo(t+90,360),this.viewport.setRotation(t)}}function z(){this.viewport.toggleFlip()}function V(){var e=this._sequenceIndex-1;this.navPrevNextWrap&&e<0&&(e+=this.tileSources.length),this.goToPage(e)}function W(){var e=this._sequenceIndex+1;this.navPrevNextWrap&&e>=this.tileSources.length&&(e=0),this.goToPage(e)}e.Viewer=function(i){var o,a=arguments,u=this;if(e.isPlainObject(i)||(i={id:a[0],xmlPath:a.length>1?a[1]:void 0,prefixUrl:a.length>2?a[2]:void 0,controls:a.length>3?a[3]:void 0,overlays:a.length>4?a[4]:void 0}),i.config&&(e.extend(!0,i,i.config),delete i.config),e.extend(!0,this,{id:i.id,hash:i.hash||n++,initialPage:0,element:null,container:null,canvas:null,overlays:[],overlaysContainer:null,previousBody:[],customControls:[],source:null,drawer:null,world:null,viewport:null,navigator:null,collectionViewport:null,collectionDrawer:null,navImages:null,buttons:null,profiler:null},e.DEFAULT_SETTINGS,i),void 0===this.hash)throw new Error("A hash must be defined, either by specifying options.id or options.hash.");for(void 0!==t[this.hash]&&e.console.warn("Hash "+this.hash+" has already been used."),t[this.hash]={fsBoundsDelta:new e.Point(1,1),prevContainerSize:null,animating:!1,forceRedraw:!1,mouseInside:!1,group:null,zooming:!1,zoomFactor:null,lastZoomTime:null,fullPage:!1,onfullscreenchange:null},this._sequenceIndex=0,this._firstOpen=!0,this._updateRequestId=null,this._loadQueue=[],this.currentOverlays=[],this._lastScrollTime=e.now(),e.EventSource.call(this),this.addHandler("open-failed",function(t){var n=e.getString("Errors.OpenFailed",t.eventSource,t.message);u._showMessage(n)}),e.ControlDock.call(this,i),this.xmlPath&&(this.tileSources=[this.xmlPath]),this.element=this.element||document.getElementById(this.id),this.canvas=e.makeNeutralElement("div"),this.canvas.className="openseadragon-canvas",function(e){e.width="100%",e.height="100%",e.overflow="hidden",e.position="absolute",e.top="0px",e.left="0px"}(this.canvas.style),e.setElementTouchActionNone(this.canvas),""!==i.tabIndex&&(this.canvas.tabIndex=void 0===i.tabIndex?0:i.tabIndex),this.container.className="openseadragon-container",function(e){e.width="100%",e.height="100%",e.position="relative",e.overflow="hidden",e.left="0px",e.top="0px",e.textAlign="left"}(this.container.style),this.container.insertBefore(this.canvas,this.container.firstChild),this.element.appendChild(this.container),this.bodyWidth=document.body.style.width,this.bodyHeight=document.body.style.height,this.bodyOverflow=document.body.style.overflow,this.docOverflow=document.documentElement.style.overflow,this.innerTracker=new e.MouseTracker({element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,keyDownHandler:e.delegate(this,p),keyHandler:e.delegate(this,f),clickHandler:e.delegate(this,d),dblClickHandler:e.delegate(this,g),dragHandler:e.delegate(this,m),dragEndHandler:e.delegate(this,v),enterHandler:e.delegate(this,y),exitHandler:e.delegate(this,w),pressHandler:e.delegate(this,T),releaseHandler:e.delegate(this,b),nonPrimaryPressHandler:e.delegate(this,E),nonPrimaryReleaseHandler:e.delegate(this,S),scrollHandler:e.delegate(this,_),pinchHandler:e.delegate(this,x)}),this.outerTracker=new e.MouseTracker({element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:e.delegate(this,P),exitHandler:e.delegate(this,I)}),this.toolbar&&(this.toolbar=new e.ControlDock({element:this.toolbar})),this.bindStandardControls(),t[this.hash].prevContainerSize=r(this.container),this.world=new e.World({viewer:this}),this.world.addHandler("add-item",function(e){u.source=u.world.getItemAt(0).source,t[u.hash].forceRedraw=!0,u._updateRequestId||(u._updateRequestId=s(u,C))}),this.world.addHandler("remove-item",function(e){u.world.getItemCount()?u.source=u.world.getItemAt(0).source:u.source=null,t[u.hash].forceRedraw=!0}),this.world.addHandler("metrics-change",function(e){u.viewport&&u.viewport._setContentBounds(u.world.getHomeBounds(),u.world.getContentFactor())}),this.world.addHandler("item-index-change",function(e){u.source=u.world.getItemAt(0).source}),this.viewport=new e.Viewport({containerSize:t[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}),this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor()),this.imageLoader=new e.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:i.timeout}),this.tileCache=new e.TileCache({maxImageCacheCount:this.maxImageCacheCount}),this.drawer=new e.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor}),this.overlaysContainer=e.makeNeutralElement("div"),this.canvas.appendChild(this.overlaysContainer),this.drawer.canRotate()||(this.rotateLeft&&(o=this.buttons.buttons.indexOf(this.rotateLeft),this.buttons.buttons.splice(o,1),this.buttons.element.removeChild(this.rotateLeft.element)),this.rotateRight&&(o=this.buttons.buttons.indexOf(this.rotateRight),this.buttons.buttons.splice(o,1),this.buttons.element.removeChild(this.rotateRight.element))),this.showNavigator&&(this.navigator=new e.Navigator({id:this.navigatorId,position:this.navigatorPosition,sizeRatio:this.navigatorSizeRatio,maintainSizeRatio:this.navigatorMaintainSizeRatio,top:this.navigatorTop,left:this.navigatorLeft,width:this.navigatorWidth,height:this.navigatorHeight,autoResize:this.navigatorAutoResize,autoFade:this.navigatorAutoFade,prefixUrl:this.prefixUrl,viewer:this,navigatorRotate:this.navigatorRotate,background:this.navigatorBackground,opacity:this.navigatorOpacity,borderColor:this.navigatorBorderColor,displayRegionColor:this.navigatorDisplayRegionColor,crossOriginPolicy:this.crossOriginPolicy})),this.sequenceMode&&this.bindSequenceControls(),this.tileSources&&this.open(this.tileSources),o=0;o-1&&t.index\s*$/))n=e.parseXml(n);else if(n.match(/^\s*[\{\[].*[\}\]]\s*$/))try{var a=e.parseJSON(n);n=a}catch(e){}function l(e,t){e.ready?i(e):(e.addHandler("ready",function(){i(e)}),e.addHandler("open-failed",function(e){o({message:e.message,source:t})}))}setTimeout(function(){if("string"==e.type(n))(n=new e.TileSource({url:n,crossOriginPolicy:void 0!==r.crossOriginPolicy?r.crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,ajaxHeaders:t.ajaxHeaders,useCanvas:t.useCanvas,success:function(e){i(e.tileSource)}})).addHandler("open-failed",function(e){o(e)});else if(e.isPlainObject(n)||n.nodeType)if(void 0!==n.crossOriginPolicy||void 0===r.crossOriginPolicy&&void 0===t.crossOriginPolicy||(n.crossOriginPolicy=void 0!==r.crossOriginPolicy?r.crossOriginPolicy:t.crossOriginPolicy),void 0===n.ajaxWithCredentials&&(n.ajaxWithCredentials=t.ajaxWithCredentials),void 0===n.useCanvas&&(n.useCanvas=t.useCanvas),e.isFunction(n.getTileUrl)){var a=new e.TileSource(n);a.getTileUrl=n.getTileUrl,i(a)}else{var u=e.TileSource.determineType(s,n);if(!u)return void o({message:"Unable to load TileSource",source:n});var c=u.prototype.configure.apply(s,[n]);l(new u(c),n)}else l(n,n)})}(this,t.tileSource,t,function(e){r.tileSource=e,s()},function(e){e.options=t,i(e),s()}))},addSimpleImage:function(t){e.console.assert(t,"[Viewer.addSimpleImage] options is required"),e.console.assert(t.url,"[Viewer.addSimpleImage] options.url is required");var n=e.extend({},t,{tileSource:{type:"image",url:t.url}});delete n.url,this.addTiledImage(n)},addLayer:function(t){var n=this;e.console.error("[Viewer.addLayer] this function is deprecated; use Viewer.addTiledImage() instead.");var r=e.extend({},t,{success:function(e){n.raiseEvent("add-layer",{options:t,drawer:e.item})},error:function(e){n.raiseEvent("add-layer-failed",e)}});return this.addTiledImage(r),this},getLayerAtLevel:function(t){return e.console.error("[Viewer.getLayerAtLevel] this function is deprecated; use World.getItemAt() instead."),this.world.getItemAt(t)},getLevelOfLayer:function(t){return e.console.error("[Viewer.getLevelOfLayer] this function is deprecated; use World.getIndexOfItem() instead."),this.world.getIndexOfItem(t)},getLayersCount:function(){return e.console.error("[Viewer.getLayersCount] this function is deprecated; use World.getItemCount() instead."),this.world.getItemCount()},setLayerLevel:function(t,n){return e.console.error("[Viewer.setLayerLevel] this function is deprecated; use World.setItemIndex() instead."),this.world.setItemIndex(t,n)},removeLayer:function(t){return e.console.error("[Viewer.removeLayer] this function is deprecated; use World.removeItem() instead."),this.world.removeItem(t)},forceRedraw:function(){return t[this.hash].forceRedraw=!0,this},bindSequenceControls:function(){var t=e.delegate(this,c),n=e.delegate(this,h),r=e.delegate(this,W),i=e.delegate(this,V),o=this.navImages,s=!0;return this.showSequenceControl&&((this.previousButton||this.nextButton)&&(s=!1),this.previousButton=new e.Button({element:this.previousButton?e.getElement(this.previousButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.PreviousPage"),srcRest:R(this.prefixUrl,o.previous.REST),srcGroup:R(this.prefixUrl,o.previous.GROUP),srcHover:R(this.prefixUrl,o.previous.HOVER),srcDown:R(this.prefixUrl,o.previous.DOWN),onRelease:i,onFocus:t,onBlur:n}),this.nextButton=new e.Button({element:this.nextButton?e.getElement(this.nextButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.NextPage"),srcRest:R(this.prefixUrl,o.next.REST),srcGroup:R(this.prefixUrl,o.next.GROUP),srcHover:R(this.prefixUrl,o.next.HOVER),srcDown:R(this.prefixUrl,o.next.DOWN),onRelease:r,onFocus:t,onBlur:n}),this.navPrevNextWrap||this.previousButton.disable(),this.tileSources&&this.tileSources.length||this.nextButton.disable(),s&&(this.paging=new e.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:e.ControlAnchor.BOTTOM_RIGHT}):this.addControl(this.pagingControl,{anchor:this.sequenceControlAnchor||e.ControlAnchor.TOP_LEFT}))),this},bindStandardControls:function(){var t=e.delegate(this,O),n=e.delegate(this,A),r=e.delegate(this,L),i=e.delegate(this,N),o=e.delegate(this,D),s=e.delegate(this,B),a=e.delegate(this,U),l=e.delegate(this,H),u=e.delegate(this,j),p=e.delegate(this,z),f=e.delegate(this,c),d=e.delegate(this,h),g=this.navImages,m=[],v=!0;return this.showNavigationControl&&((this.zoomInButton||this.zoomOutButton||this.homeButton||this.fullPageButton||this.rotateLeftButton||this.rotateRightButton||this.flipButton)&&(v=!1),this.showZoomControl&&(m.push(this.zoomInButton=new e.Button({element:this.zoomInButton?e.getElement(this.zoomInButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomIn"),srcRest:R(this.prefixUrl,g.zoomIn.REST),srcGroup:R(this.prefixUrl,g.zoomIn.GROUP),srcHover:R(this.prefixUrl,g.zoomIn.HOVER),srcDown:R(this.prefixUrl,g.zoomIn.DOWN),onPress:t,onRelease:n,onClick:r,onEnter:t,onExit:n,onFocus:f,onBlur:d})),m.push(this.zoomOutButton=new e.Button({element:this.zoomOutButton?e.getElement(this.zoomOutButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.ZoomOut"),srcRest:R(this.prefixUrl,g.zoomOut.REST),srcGroup:R(this.prefixUrl,g.zoomOut.GROUP),srcHover:R(this.prefixUrl,g.zoomOut.HOVER),srcDown:R(this.prefixUrl,g.zoomOut.DOWN),onPress:i,onRelease:n,onClick:o,onEnter:i,onExit:n,onFocus:f,onBlur:d}))),this.showHomeControl&&m.push(this.homeButton=new e.Button({element:this.homeButton?e.getElement(this.homeButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Home"),srcRest:R(this.prefixUrl,g.home.REST),srcGroup:R(this.prefixUrl,g.home.GROUP),srcHover:R(this.prefixUrl,g.home.HOVER),srcDown:R(this.prefixUrl,g.home.DOWN),onRelease:s,onFocus:f,onBlur:d})),this.showFullPageControl&&m.push(this.fullPageButton=new e.Button({element:this.fullPageButton?e.getElement(this.fullPageButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.FullPage"),srcRest:R(this.prefixUrl,g.fullpage.REST),srcGroup:R(this.prefixUrl,g.fullpage.GROUP),srcHover:R(this.prefixUrl,g.fullpage.HOVER),srcDown:R(this.prefixUrl,g.fullpage.DOWN),onRelease:a,onFocus:f,onBlur:d})),this.showRotationControl&&(m.push(this.rotateLeftButton=new e.Button({element:this.rotateLeftButton?e.getElement(this.rotateLeftButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateLeft"),srcRest:R(this.prefixUrl,g.rotateleft.REST),srcGroup:R(this.prefixUrl,g.rotateleft.GROUP),srcHover:R(this.prefixUrl,g.rotateleft.HOVER),srcDown:R(this.prefixUrl,g.rotateleft.DOWN),onRelease:l,onFocus:f,onBlur:d})),m.push(this.rotateRightButton=new e.Button({element:this.rotateRightButton?e.getElement(this.rotateRightButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.RotateRight"),srcRest:R(this.prefixUrl,g.rotateright.REST),srcGroup:R(this.prefixUrl,g.rotateright.GROUP),srcHover:R(this.prefixUrl,g.rotateright.HOVER),srcDown:R(this.prefixUrl,g.rotateright.DOWN),onRelease:u,onFocus:f,onBlur:d}))),this.showFlipControl&&m.push(this.flipButton=new e.Button({element:this.flipButton?e.getElement(this.flipButton):null,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,tooltip:e.getString("Tooltips.Flip"),srcRest:R(this.prefixUrl,g.flip.REST),srcGroup:R(this.prefixUrl,g.flip.GROUP),srcHover:R(this.prefixUrl,g.flip.HOVER),srcDown:R(this.prefixUrl,g.flip.DOWN),onRelease:p,onFocus:f,onBlur:d})),v&&(this.buttons=new e.ButtonGroup({buttons:m,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold}),this.navControl=this.buttons.element,this.addHandler("open",e.delegate(this,F)),this.toolbar?this.toolbar.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT}):this.addControl(this.navControl,{anchor:this.navigationControlAnchor||e.ControlAnchor.TOP_LEFT}))),this},currentPage:function(){return this._sequenceIndex},goToPage:function(e){return this.tileSources&&e>=0&&e=0)return this;var l=i(this,a);return this.currentOverlays.push(l),l.drawHTML(this.overlaysContainer,this.viewport),this.raiseEvent("add-overlay",{element:t,location:a.location,placement:a.placement}),this},updateOverlay:function(n,r,i){var s;return n=e.getElement(n),(s=o(this.currentOverlays,n))>=0&&(this.currentOverlays[s].update(r,i),t[this.hash].forceRedraw=!0,this.raiseEvent("update-overlay",{element:n,location:r,placement:i})),this},removeOverlay:function(n){var r;return n=e.getElement(n),(r=o(this.currentOverlays,n))>=0&&(this.currentOverlays[r].destroy(),this.currentOverlays.splice(r,1),t[this.hash].forceRedraw=!0,this.raiseEvent("remove-overlay",{element:n})),this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();return t[this.hash].forceRedraw=!0,this.raiseEvent("clear-overlay",{}),this},getOverlayById:function(t){var n;return t=e.getElement(t),(n=o(this.currentOverlays,t))>=0?this.currentOverlays[n]:null},_updateSequenceButtons:function(e){this.nextButton&&(this.tileSources&&this.tileSources.length-1!==e?this.nextButton.enable():this.navPrevNextWrap||this.nextButton.disable()),this.previousButton&&(e>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(t){this._hideMessage();var n=e.makeNeutralElement("div");n.appendChild(document.createTextNode(t)),this.messageDiv=e.makeCenteredNode(n),e.addClass(this.messageDiv,"openseadragon-message"),this.container.appendChild(this.messageDiv)},_hideMessage:function(){var e=this.messageDiv;e&&(e.parentNode.removeChild(e),delete this.messageDiv)},gestureSettingsByDeviceType:function(e){switch(e){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var e,t=this.currentOverlays.length;for(e=0;e1&&(this.referenceStrip=new e.ReferenceStrip({id:this.referenceStripElement,position:this.referenceStripPosition,sizeRatio:this.referenceStripSizeRatio,scroll:this.referenceStripScroll,height:this.referenceStripHeight,width:this.referenceStripWidth,tileSources:this.tileSources,prefixUrl:this.prefixUrl,viewer:this}),this.referenceStrip.setFocus(this._sequenceIndex))}else e.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')}})}(OpenSeadragon),function(e){function t(e){var t={tracker:e.eventSource,position:e.position,quick:e.quick,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};if(this.viewer.raiseEvent("navigator-click",t),!t.preventDefaultAction&&e.quick&&this.viewer.viewport&&(this.panVertical||this.panHorizontal)){this.viewer.viewport.flipped&&(e.position.x=this.viewport.getContainerSize().x-e.position.x);var n=this.viewport.pointFromPixel(e.position);this.panVertical?this.panHorizontal||(n.x=this.viewer.viewport.getCenter(!0).x):n.y=this.viewer.viewport.getCenter(!0).y,this.viewer.viewport.panTo(n),this.viewer.viewport.applyConstraints()}}function n(e){var t={tracker:e.eventSource,position:e.position,delta:e.delta,speed:e.speed,direction:e.direction,shift:e.shift,originalEvent:e.originalEvent,preventDefaultAction:e.preventDefaultAction};this.viewer.raiseEvent("navigator-drag",t),!t.preventDefaultAction&&this.viewer.viewport&&(this.panHorizontal||(e.delta.x=0),this.panVertical||(e.delta.y=0),this.viewer.viewport.flipped&&(e.delta.x=-e.delta.x),this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(e.delta)),this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints())}function r(e){e.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function i(e){return this.viewer.raiseEvent("navigator-scroll",{tracker:e.eventSource,position:e.position,scroll:e.scroll,shift:e.shift,originalEvent:e.originalEvent}),!1}function o(e,t){s(e,"rotate("+t+"deg)")}function s(e,t){e.style.webkitTransform=t,e.style.mozTransform=t,e.style.msTransform=t,e.style.oTransform=t,e.style.transform=t}e.Navigator=function(s){var a,l,u=s.viewer,c=this;function h(e){o(c.displayRegionContainer,e),o(c.displayRegion,-e),c.viewport.setRotation(e)}(s.id?(this.element=document.getElementById(s.id),s.controlOptions={anchor:e.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}):(s.id="navigator-"+e.now(),this.element=e.makeNeutralElement("div"),s.controlOptions={anchor:e.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:s.autoFade},s.position&&("BOTTOM_RIGHT"==s.position?s.controlOptions.anchor=e.ControlAnchor.BOTTOM_RIGHT:"BOTTOM_LEFT"==s.position?s.controlOptions.anchor=e.ControlAnchor.BOTTOM_LEFT:"TOP_RIGHT"==s.position?s.controlOptions.anchor=e.ControlAnchor.TOP_RIGHT:"TOP_LEFT"==s.position?s.controlOptions.anchor=e.ControlAnchor.TOP_LEFT:"ABSOLUTE"==s.position&&(s.controlOptions.anchor=e.ControlAnchor.ABSOLUTE,s.controlOptions.top=s.top,s.controlOptions.left=s.left,s.controlOptions.height=s.height,s.controlOptions.width=s.width))),this.element.id=s.id,this.element.className+=" navigator",(s=e.extend(!0,{sizeRatio:e.DEFAULT_SETTINGS.navigatorSizeRatio},s,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,autoResize:s.autoResize,minZoomImageRatio:1,background:s.background,opacity:s.opacity,borderColor:s.borderColor,displayRegionColor:s.displayRegionColor})).minPixelRatio=this.minPixelRatio=u.minPixelRatio,e.setElementTouchActionNone(this.element),this.borderWidth=2,this.fudge=new e.Point(1,1),this.totalBorderWidths=new e.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge),s.controlOptions.anchor!=e.ControlAnchor.NONE&&function(e,t){e.margin="0px",e.border=t+"px solid "+s.borderColor,e.padding="0px",e.background=s.background,e.opacity=s.opacity,e.overflow="hidden"}(this.element.style,this.borderWidth),this.displayRegion=e.makeNeutralElement("div"),this.displayRegion.id=this.element.id+"-displayregion",this.displayRegion.className="displayregion",function(e,t){e.position="relative",e.top="0px",e.left="0px",e.fontSize="0px",e.overflow="hidden",e.border=t+"px solid "+s.displayRegionColor,e.margin="0px",e.padding="0px",e.background="transparent",e.float="left",e.cssFloat="left",e.styleFloat="left",e.zIndex=999999999,e.cursor="default"}(this.displayRegion.style,this.borderWidth),this.displayRegionContainer=e.makeNeutralElement("div"),this.displayRegionContainer.id=this.element.id+"-displayregioncontainer",this.displayRegionContainer.className="displayregioncontainer",this.displayRegionContainer.style.width="100%",this.displayRegionContainer.style.height="100%",u.addControl(this.element,s.controlOptions),this._resizeWithViewer=s.controlOptions.anchor!=e.ControlAnchor.ABSOLUTE&&s.controlOptions.anchor!=e.ControlAnchor.NONE,this._resizeWithViewer&&(s.width&&s.height?(this.element.style.height="number"==typeof s.height?s.height+"px":s.height,this.element.style.width="number"==typeof s.width?s.width+"px":s.width):(a=e.getElementSize(u.element),this.element.style.height=Math.round(a.y*s.sizeRatio)+"px",this.element.style.width=Math.round(a.x*s.sizeRatio)+"px",this.oldViewerSize=a),l=e.getElementSize(this.element),this.elementArea=l.x*l.y),this.oldContainerSize=new e.Point(0,0),e.Viewer.apply(this,[s]),this.displayRegionContainer.appendChild(this.displayRegion),this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer),s.navigatorRotate)&&(h(s.viewer.viewport?s.viewer.viewport.getRotation():s.viewer.degrees||0),s.viewer.addHandler("rotate",function(e){h(e.degrees)}));this.innerTracker.destroy(),this.innerTracker=new e.MouseTracker({element:this.element,dragHandler:e.delegate(this,n),clickHandler:e.delegate(this,t),releaseHandler:e.delegate(this,r),scrollHandler:e.delegate(this,i)}),this.addHandler("reset-size",function(){c.viewport&&c.viewport.goHome(!0)}),u.world.addHandler("item-index-change",function(e){window.setTimeout(function(){var t=c.world.getItemAt(e.previousIndex);c.world.setItemIndex(t,e.newIndex)},1)}),u.world.addHandler("remove-item",function(e){var t=e.item,n=c._getMatchingItem(t);n&&c.world.removeItem(n)}),this.update(u.viewport)},e.extend(e.Navigator.prototype,e.EventSource.prototype,e.Viewer.prototype,{updateSize:function(){if(this.viewport){var t=new e.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);t.equals(this.oldContainerSize)||(this.viewport.resize(t,!0),this.viewport.goHome(!0),this.oldContainerSize=t,this.drawer.clear(),this.world.draw())}},setFlip:function(e){return this.viewport.setFlip(e),this.setDisplayTransform(this.viewer.viewport.getFlip()?"scale(-1,1)":"scale(1,1)"),this},setDisplayTransform:function(e){s(this.displayRegion,e),s(this.canvas,e),s(this.element,e)},update:function(t){var n,r,i,o,s,a;if(n=e.getElementSize(this.viewer.element),this._resizeWithViewer&&n.x&&n.y&&!n.equals(this.oldViewerSize)&&(this.oldViewerSize=n,this.maintainSizeRatio||!this.elementArea?(r=n.x*this.sizeRatio,i=n.y*this.sizeRatio):(r=Math.sqrt(this.elementArea*(n.x/n.y)),i=this.elementArea/r),this.element.style.width=Math.round(r)+"px",this.element.style.height=Math.round(i)+"px",this.elementArea||(this.elementArea=r*i),this.updateSize()),t&&this.viewport){o=t.getBoundsNoRotate(!0),s=this.viewport.pixelFromPointNoRotate(o.getTopLeft(),!1),a=this.viewport.pixelFromPointNoRotate(o.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 u=Math.abs(s.x-a.x),c=Math.abs(s.y-a.y);l.width=Math.round(Math.max(u,0))+"px",l.height=Math.round(Math.max(c,0))+"px"}},addTiledImage:function(t){var n=this,r=t.originalTiledImage;delete t.original;var i=e.extend({},t,{success:function(e){var t=e.item;function i(){n._matchBounds(t,r)}t._originalForNavigator=r,n._matchBounds(t,r,!0),r.addHandler("bounds-change",i),r.addHandler("clip-change",i),r.addHandler("opacity-change",function(){n._matchOpacity(t,r)}),r.addHandler("composite-operation-change",function(){n._matchCompositeOperation(t,r)})}});return e.Viewer.prototype.addTiledImage.apply(this,[i])},_getMatchingItem:function(e){for(var t,n=this.world.getItemCount(),r=0;r1||t.y>1);e++);return e-1},getTileAtPoint:function(t,n){var r=n.x>=0&&n.x<=1&&n.y>=0&&n.y<=1/this.aspectRatio;e.console.assert(r,"[TileSource.getTileAtPoint] must be called with a valid point.");var i=this.dimensions.x*this.getLevelScale(t),o=n.x*i,s=n.y*i,a=Math.floor(o/this.getTileWidth(t)),l=Math.floor(s/this.getTileHeight(t));n.x>=1&&(a=this.getNumTiles(t).x-1);return n.y>=1/this.aspectRatio-1e-15&&(l=this.getNumTiles(t).y-1),new e.Point(a,l)},getTileBounds:function(t,n,r,i){var o=this.dimensions.times(this.getLevelScale(t)),s=this.getTileWidth(t),a=this.getTileHeight(t),l=0===n?0:s*n-this.tileOverlap,u=0===r?0:a*r-this.tileOverlap,c=s+(0===n?1:2)*this.tileOverlap,h=a+(0===r?1:2)*this.tileOverlap,p=1/o.x;return c=Math.min(c,o.x-l),h=Math.min(h,o.y-u),i?new e.Rect(0,0,c,h):new e.Rect(l*p,u*p,c*p,h*p)},getImageInfo:function(t){var n,r,i,o,s,a,l,u=this;t&&(l=(a=(s=t.split("/"))[s.length-1]).lastIndexOf("."))>-1&&(s[s.length-1]=a.slice(0,l)),r=function(n){"string"==typeof n&&(n=e.parseXml(n));var r=e.TileSource.determineType(u,n,t);r?(void 0===(o=r.prototype.configure.apply(u,[n,t])).ajaxWithCredentials&&(o.ajaxWithCredentials=u.ajaxWithCredentials),i=new r(o),u.ready=!0,u.raiseEvent("ready",{tileSource:i})):u.raiseEvent("open-failed",{message:"Unable to load TileSource",source:t})},t.match(/\.js$/)?(n=t.split("/").pop().replace(".js",""),e.jsonp({url:t,async:!1,callbackName:n,callback:r})):e.makeAjaxRequest({url:t,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(t){var n=function(t){var n,r,i=t.responseText,o=t.status;if(!t)throw new Error(e.getString("Errors.Security"));if(200!==t.status&&0!==t.status)throw o=t.status,n=404==o?"Not Found":t.statusText,new Error(e.getString("Errors.Status",o,n));if(i.match(/\s*<.*/))try{r=t.responseXML&&t.responseXML.documentElement?t.responseXML:e.parseXml(i)}catch(e){r=t.responseText}else if(i.match(/\s*[\{\[].*/))try{r=e.parseJSON(i)}catch(e){r=i}else r=i;return r}(t);r(n)},error:function(e,n){var r;try{r="HTTP "+e.status+" attempting to load TileSource"}catch(e){r=(void 0!==n&&n.toString?n.toString():"Unknown error")+" attempting to load TileSource"}u.raiseEvent("open-failed",{message:r,source:t})}})},supports:function(e,t){return!1},configure:function(e,t){throw new Error("Method not implemented.")},getTileUrl:function(e,t,n){throw new Error("Method not implemented.")},getTileAjaxHeaders:function(e,t,n){return{}},tileExists:function(e,t,n){var r=this.getNumTiles(e);return e>=this.minLevel&&e<=this.maxLevel&&t>=0&&n>=0&&t=0;c--)for(p=(h=this.displayRects[c]).minLevel;p<=h.maxLevel;p++)this._levelRects[p]||(this._levelRects[p]=[]),this._levelRects[p].push(h);e.TileSource.apply(this,[f])},e.extend(e.DziTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){var n;return e.Image?n=e.Image.xmlns:e.documentElement&&("Image"!=e.documentElement.localName&&"Image"!=e.documentElement.tagName||(n=e.documentElement.namespaceURI)),-1!==(n=(n||"").toLowerCase()).indexOf("schemas.microsoft.com/deepzoom/2008")||-1!==n.indexOf("schemas.microsoft.com/deepzoom/2009")},configure:function(n,r){var i;return i=e.isPlainObject(n)?t(this,n):function(n,r){if(!r||!r.documentElement)throw new Error(e.getString("Errors.Xml"));var i,o,s,a,l,u=r.documentElement,c=u.localName||u.tagName,h=r.documentElement.namespaceURI,p=null,f=[];if("Image"==c)try{if(void 0===(a=u.getElementsByTagName("Size")[0])&&(a=u.getElementsByTagNameNS(h,"Size")[0]),p={Image:{xmlns:"http://schemas.microsoft.com/deepzoom/2008",Url:u.getAttribute("Url"),Format:u.getAttribute("Format"),DisplayRect:null,Overlap:parseInt(u.getAttribute("Overlap"),10),TileSize:parseInt(u.getAttribute("TileSize"),10),Size:{Height:parseInt(a.getAttribute("Height"),10),Width:parseInt(a.getAttribute("Width"),10)}}},!e.imageFormatSupported(p.Image.Format))throw new Error(e.getString("Errors.ImageFormat",p.Image.Format.toUpperCase()));for(void 0===(i=u.getElementsByTagName("DisplayRect"))&&(i=u.getElementsByTagNameNS(h,"DisplayRect")[0]),l=0;lthis.maxLevel)return!1;if(!c||!c.length)return!0;for(u=c.length-1;u>=0;u--)if(!(e<(r=c[u]).minLevel||e>r.maxLevel)&&(i=this.getLevelScale(e),o=r.x*i,s=r.y*i,a=o+r.width*i,l=s+r.height*i,o=Math.floor(o/this._tileWidth),s=Math.floor(s/this._tileWidth),a=Math.ceil(a/this._tileWidth),l=Math.ceil(l/this._tileWidth),o<=t&&t0?t.tileSize=Math.max.apply(null,a):t.tileSize=o}else this.sizes&&this.sizes.length>0?(this.emulateLegacyImagePyramid=!0,t.levels=function(e){for(var t=[],n=0;n0&&t>=this.minLevel&&t<=this.maxLevel&&(n=this.levels[t].width/this.levels[this.maxLevel].width),n}return e.TileSource.prototype.getLevelScale.call(this,t)},getNumTiles:function(t){return this.emulateLegacyImagePyramid?this.getLevelScale(t)?new e.Point(1,1):new e.Point(0,0):e.TileSource.prototype.getNumTiles.call(this,t)},getTileAtPoint:function(t,n){return this.emulateLegacyImagePyramid?new e.Point(0,0):e.TileSource.prototype.getTileAtPoint.call(this,t,n)},getTileUrl:function(e,t,n){if(this.emulateLegacyImagePyramid){var r=null;return this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(r=this.levels[e].url),r}var i,o,s,a,l,u,c,h,p,f,d,g=Math.pow(.5,this.maxLevel-e),m=Math.ceil(this.width*g),v=Math.ceil(this.height*g);return i=this.getTileWidth(e),o=this.getTileHeight(e),s=Math.ceil(i/g),a=Math.ceil(o/g),d=this["@context"].indexOf("/1.0/context.json")>-1||this["@context"].indexOf("/1.1/context.json")>-1||this["@context"].indexOf("/1/context.json")>-1?"native.jpg":"default.jpg",mu?l/256:u/256,s.maxLevel=Math.ceil(Math.log(a)/Math.log(2))-1,s.tileSize=256,s.width=l,s.height=u,e.TileSource.apply(this,[s])},e.extend(e.TmsTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"tiledmapservice"==e.type},configure:function(e,t){return e},getTileUrl:function(e,t,n){var r=this.getNumTiles(e).y-1;return this.tilesUrl+e+"/"+t+"/"+(r-n)+".png"}})}(OpenSeadragon),function(e){e.ZoomifyTileSource=function(e){e.tileSize=256;var t={x:e.width,y:e.height};for(e.imageSizes=[{x:e.width,y:e.height}],e.gridSize=[this._getGridSize(e.width,e.height,e.tileSize)];parseInt(t.x,10)>e.tileSize||parseInt(t.y,10)>e.tileSize;)t.x=Math.floor(t.x/2),t.y=Math.floor(t.y/2),e.imageSizes.push({x:t.x,y:t.y}),e.gridSize.push(this._getGridSize(t.x,t.y,e.tileSize));e.imageSizes.reverse(),e.gridSize.reverse(),e.minLevel=0,e.maxLevel=e.gridSize.length-1,OpenSeadragon.TileSource.apply(this,[e])},e.extend(e.ZoomifyTileSource.prototype,e.TileSource.prototype,{_getGridSize:function(e,t,n){return{x:Math.ceil(e/n),y:Math.ceil(t/n)}},_calculateAbsoluteTileNumber:function(e,t,n){for(var r=0,i={},o=0;o");return i.sort(function(e,t){return e.height-t.height})}(n.levels),n.levels.length>0?(r=n.levels[n.levels.length-1].width,i=n.levels[n.levels.length-1].height):(r=0,i=0,e.console.error("No supported image formats found")),e.extend(!0,n,{width:r,height:i,tileSize:Math.max(i,r),tileOverlap:0,minLevel:0,maxLevel:n.levels.length>0?n.levels.length-1:0}),e.TileSource.apply(this,[n]),this.levels=n.levels},e.extend(e.LegacyTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"legacy-image-pyramid"==e.type||e.documentElement&&"legacy-image-pyramid"==e.documentElement.getAttribute("type")},configure:function(n,r){return e.isPlainObject(n)?t(this,n):function(n,r){if(!r||!r.documentElement)throw new Error(e.getString("Errors.Xml"));var i,o,s=r.documentElement,a=s.tagName,l=null,u=[];if("image"==a)try{for(l={type:s.getAttribute("type"),levels:[]},u=s.getElementsByTagName("level"),o=0;o0&&e>=this.minLevel&&e<=this.maxLevel&&(t=this.levels[e].width/this.levels[this.maxLevel].width),t},getNumTiles:function(t){return this.getLevelScale(t)?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(e,t,n){var r=null;return this.levels.length>0&&e>=this.minLevel&&e<=this.maxLevel&&(r=this.levels[e].url),r}})}(OpenSeadragon),function(e){e.ImageTileSource=function(t){t=e.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},t),e.TileSource.apply(this,[t])},e.extend(e.ImageTileSource.prototype,e.TileSource.prototype,{supports:function(e,t){return e.type&&"image"===e.type},configure:function(e,t){return e},getImageInfo:function(t){var n=this._image=new Image,r=this;this.crossOriginPolicy&&(n.crossOrigin=this.crossOriginPolicy),this.ajaxWithCredentials&&(n.useCredentials=this.ajaxWithCredentials),e.addEvent(n,"load",function(){r.width=Object.prototype.hasOwnProperty.call(n,"naturalWidth")?n.naturalWidth:n.width,r.height=Object.prototype.hasOwnProperty.call(n,"naturalHeight")?n.naturalHeight:n.height,r.aspectRatio=r.width/r.height,r.dimensions=new e.Point(r.width,r.height),r._tileWidth=r.width,r._tileHeight=r.height,r.tileOverlap=0,r.minLevel=0,r.levels=r._buildLevels(),r.maxLevel=r.levels.length-1,r.ready=!0,r.raiseEvent("ready",{tileSource:r})}),e.addEvent(n,"error",function(){r.raiseEvent("open-failed",{message:"Error loading image at "+t,source:t})}),n.src=t},getLevelScale:function(e){var t=NaN;return e>=this.minLevel&&e<=this.maxLevel&&(t=this.levels[e].width/this.levels[this.maxLevel].width),t},getNumTiles:function(t){return this.getLevelScale(t)?new e.Point(1,1):new e.Point(0,0)},getTileUrl:function(e,t,n){var r=null;return e>=this.minLevel&&e<=this.maxLevel&&(r=this.levels[e].url),r},getContext2D:function(e,t,n){var r=null;return e>=this.minLevel&&e<=this.maxLevel&&(r=this.levels[e].context2D),r},_buildLevels:function(){var t=[{url:this._image.src,width:Object.prototype.hasOwnProperty.call(this._image,"naturalWidth")?this._image.naturalWidth:this._image.width,height:Object.prototype.hasOwnProperty.call(this._image,"naturalHeight")?this._image.naturalHeight:this._image.height}];if(!this.buildPyramid||!e.supportsCanvas||!this.useCanvas)return delete this._image,t;var n=Object.prototype.hasOwnProperty.call(this._image,"naturalWidth")?this._image.naturalWidth:this._image.width,r=Object.prototype.hasOwnProperty.call(this._image,"naturalHeight")?this._image.naturalHeight:this._image.height,i=document.createElement("canvas"),o=i.getContext("2d");if(i.width=n,i.height=r,o.drawImage(this._image,0,0,n,r),t[0].context2D=o,delete this._image,e.isCanvasTainted(i))return t;for(;n>=2&&r>=2;){n=Math.floor(n/2),r=Math.floor(r/2);var s=document.createElement("canvas"),a=s.getContext("2d");s.width=n,s.height=r,a.drawImage(i,0,0,n,r),t.splice(0,0,{context2D:a,width:n,height:r}),i=s,o=a}return t}})}(OpenSeadragon),function(e){e.TileSourceCollection=function(t,n,r,i){e.console.error("TileSourceCollection is deprecated; use World instead")}}(OpenSeadragon),function(e){function t(n){e.requestAnimationFrame(function(){!function(n){var r,i,o;n.shouldFade&&(r=e.now(),i=r-n.fadeBeginTime,o=1-i/n.fadeLength,o=Math.min(1,o),o=Math.max(0,o),n.imgGroup&&e.setElementOpacity(n.imgGroup,o,!0),o>0&&t(n))}(n)})}function n(t,n){t.element.disabled||(n>=e.ButtonState.GROUP&&t.currentState==e.ButtonState.REST&&(!function(t){t.shouldFade=!1,t.imgGroup&&e.setElementOpacity(t.imgGroup,1,!0)}(t),t.currentState=e.ButtonState.GROUP),n>=e.ButtonState.HOVER&&t.currentState==e.ButtonState.GROUP&&(t.imgHover&&(t.imgHover.style.visibility=""),t.currentState=e.ButtonState.HOVER),n>=e.ButtonState.DOWN&&t.currentState==e.ButtonState.HOVER&&(t.imgDown&&(t.imgDown.style.visibility=""),t.currentState=e.ButtonState.DOWN))}function r(n,r){n.element.disabled||(r<=e.ButtonState.HOVER&&n.currentState==e.ButtonState.DOWN&&(n.imgDown&&(n.imgDown.style.visibility="hidden"),n.currentState=e.ButtonState.HOVER),r<=e.ButtonState.GROUP&&n.currentState==e.ButtonState.HOVER&&(n.imgHover&&(n.imgHover.style.visibility="hidden"),n.currentState=e.ButtonState.GROUP),r<=e.ButtonState.REST&&n.currentState==e.ButtonState.GROUP&&(!function(n){n.shouldFade=!0,n.fadeBeginTime=e.now()+n.fadeDelay,window.setTimeout(function(){t(n)},n.fadeDelay)}(n),n.currentState=e.ButtonState.REST))}e.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3},e.Button=function(t){var i=this;e.EventSource.call(this),e.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null},t),this.element=t.element||e.makeNeutralElement("div"),t.element||(this.imgRest=e.makeTransparentImage(this.srcRest),this.imgGroup=e.makeTransparentImage(this.srcGroup),this.imgHover=e.makeTransparentImage(this.srcHover),this.imgDown=e.makeTransparentImage(this.srcDown),this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip,this.element.style.position="relative",e.setElementTouchActionNone(this.element),this.imgGroup.style.position=this.imgHover.style.position=this.imgDown.style.position="absolute",this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top="0px",this.imgGroup.style.left=this.imgHover.style.left=this.imgDown.style.left="0px",this.imgHover.style.visibility=this.imgDown.style.visibility="hidden",e.Browser.vendor==e.BROWSERS.FIREFOX&&e.Browser.version<3&&(this.imgGroup.style.top=this.imgHover.style.top=this.imgDown.style.top=""),this.element.appendChild(this.imgRest),this.element.appendChild(this.imgGroup),this.element.appendChild(this.imgHover),this.element.appendChild(this.imgDown)),this.addHandler("press",this.onPress),this.addHandler("release",this.onRelease),this.addHandler("click",this.onClick),this.addHandler("enter",this.onEnter),this.addHandler("exit",this.onExit),this.addHandler("focus",this.onFocus),this.addHandler("blur",this.onBlur),this.currentState=e.ButtonState.GROUP,this.fadeBeginTime=null,this.shouldFade=!1,this.element.style.display="inline-block",this.element.style.position="relative",this.element.title=this.tooltip,this.tracker=new e.MouseTracker({element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(t){t.insideElementPressed?(n(i,e.ButtonState.DOWN),i.raiseEvent("enter",{originalEvent:t.originalEvent})):t.buttonDownAny||n(i,e.ButtonState.HOVER)},focusHandler:function(e){this.enterHandler(e),i.raiseEvent("focus",{originalEvent:e.originalEvent})},exitHandler:function(t){r(i,e.ButtonState.GROUP),t.insideElementPressed&&i.raiseEvent("exit",{originalEvent:t.originalEvent})},blurHandler:function(e){this.exitHandler(e),i.raiseEvent("blur",{originalEvent:e.originalEvent})},pressHandler:function(t){n(i,e.ButtonState.DOWN),i.raiseEvent("press",{originalEvent:t.originalEvent})},releaseHandler:function(t){t.insideElementPressed&&t.insideElementReleased?(r(i,e.ButtonState.HOVER),i.raiseEvent("release",{originalEvent:t.originalEvent})):t.insideElementPressed?r(i,e.ButtonState.GROUP):n(i,e.ButtonState.HOVER)},clickHandler:function(e){e.quick&&i.raiseEvent("click",{originalEvent:e.originalEvent})},keyHandler:function(e){return 13!==e.keyCode||(i.raiseEvent("click",{originalEvent:e.originalEvent}),i.raiseEvent("release",{originalEvent:e.originalEvent}),!1)}}),r(this,e.ButtonState.REST)},e.extend(e.Button.prototype,e.EventSource.prototype,{notifyGroupEnter:function(){n(this,e.ButtonState.GROUP)},notifyGroupExit:function(){r(this,e.ButtonState.REST)},disable:function(){this.notifyGroupExit(),this.element.disabled=!0,e.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1,e.setElementOpacity(this.element,1,!0),this.notifyGroupEnter()}})}(OpenSeadragon),function(e){e.ButtonGroup=function(t){e.extend(!0,this,{buttons:[],clickTimeThreshold:e.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:e.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},t);var n,r=this.buttons.concat([]),i=this;if(this.element=t.element||e.makeNeutralElement("div"),!t.group)for(this.label=e.makeNeutralElement("label"),this.element.style.display="inline-block",this.element.appendChild(this.label),n=0;n=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)},e.Rect.fromSummits=function(t,n,r){var i=t.distanceTo(n),o=t.distanceTo(r),s=n.minus(t),a=Math.atan(s.y/s.x);return s.x<0?a+=Math.PI:s.y<0&&(a+=2*Math.PI),new e.Rect(t.x,t.y,i,o,a/Math.PI*180)},e.Rect.prototype={clone:function(){return new e.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new e.Point(this.x,this.y)},getBottomRight:function(){return new e.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new e.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new e.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new e.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new e.Point(this.width,this.height)},equals:function(t){return t instanceof e.Rect&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height&&this.degrees===t.degrees},times:function(t){return new e.Rect(this.x*t,this.y*t,this.width*t,this.height*t,this.degrees)},translate:function(t){return new e.Rect(this.x+t.x,this.y+t.y,this.width,this.height,this.degrees)},union:function(t){var n=this.getBoundingBox(),r=t.getBoundingBox(),i=Math.min(n.x,r.x),o=Math.min(n.y,r.y),s=Math.max(n.x+n.width,r.x+r.width),a=Math.max(n.y+n.height,r.y+r.height);return new e.Rect(i,o,s-i,a-o)},intersection:function(t){var n=1e-10,r=[],i=this.getTopLeft();t.containsPoint(i,n)&&r.push(i);var o=this.getTopRight();t.containsPoint(o,n)&&r.push(o);var s=this.getBottomLeft();t.containsPoint(s,n)&&r.push(s);var a=this.getBottomRight();t.containsPoint(a,n)&&r.push(a);var l=t.getTopLeft();this.containsPoint(l,n)&&r.push(l);var u=t.getTopRight();this.containsPoint(u,n)&&r.push(u);var c=t.getBottomLeft();this.containsPoint(c,n)&&r.push(c);var h=t.getBottomRight();this.containsPoint(h,n)&&r.push(h);for(var p=this._getSegments(),f=t._getSegments(),d=0;db&&(b=_.x),_.yS&&(S=_.y)}return new e.Rect(T,E,b-T,S-E)},_getSegments:function(){var e=this.getTopLeft(),t=this.getTopRight(),n=this.getBottomLeft(),r=this.getBottomRight();return[[e,t],[t,r],[r,n],[n,e]]},rotate:function(t,n){if(0===(t=e.positiveModulo(t,360)))return this.clone();n=n||this.getCenter();var r=this.getTopLeft().rotate(t,n),i=this.getTopRight().rotate(t,n).minus(r);i=i.apply(function(e){return Math.abs(e)<1e-15?0:e});var o=Math.atan(i.y/i.x);return i.x<0?o+=Math.PI:i.y<0&&(o+=2*Math.PI),new e.Rect(r.x,r.y,this.width,this.height,o/Math.PI*180)},getBoundingBox:function(){if(0===this.degrees)return this.clone();var t=this.getTopLeft(),n=this.getTopRight(),r=this.getBottomLeft(),i=this.getBottomRight(),o=Math.min(t.x,n.x,r.x,i.x),s=Math.max(t.x,n.x,r.x,i.x),a=Math.min(t.y,n.y,r.y,i.y),l=Math.max(t.y,n.y,r.y,i.y);return new e.Rect(o,a,s-o,l-a)},getIntegerBoundingBox:function(){var t=this.getBoundingBox(),n=Math.floor(t.x),r=Math.floor(t.y),i=Math.ceil(t.width+t.x-n),o=Math.ceil(t.height+t.y-r);return new e.Rect(n,r,i,o)},containsPoint:function(e,t){t=t||0;var n=this.getTopLeft(),r=this.getTopRight(),i=this.getBottomLeft(),o=r.minus(n),s=i.minus(n);return(e.x-n.x)*o.x+(e.y-n.y)*o.y>=-t&&(e.x-r.x)*o.x+(e.y-r.y)*o.y<=t&&(e.x-n.x)*s.x+(e.y-n.y)*s.y>=-t&&(e.x-i.x)*s.x+(e.y-i.y)*s.y<=t},toString:function(){return"["+Math.round(100*this.x)/100+", "+Math.round(100*this.y)/100+", "+Math.round(100*this.width)/100+"x"+Math.round(100*this.height)/100+", "+Math.round(100*this.degrees)/100+"deg]"}}}(OpenSeadragon),function(e){var t={};function n(t){var n=Number(this.element.style.marginLeft.replace("px","")),r=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=e.getElementSize(this.viewer.canvas);return this.dragging=!0,this.element&&("horizontal"==this.scroll?-t.delta.x>0?n>-(o-a.x)&&(this.element.style.marginLeft=n+2*t.delta.x+"px",i(this,a.x,n+2*t.delta.x)):-t.delta.x<0&&n<0&&(this.element.style.marginLeft=n+2*t.delta.x+"px",i(this,a.x,n+2*t.delta.x)):-t.delta.y>0?r>-(s-a.y)&&(this.element.style.marginTop=r+2*t.delta.y+"px",i(this,a.y,r+2*t.delta.y)):-t.delta.y<0&&r<0&&(this.element.style.marginTop=r+2*t.delta.y+"px",i(this,a.y,r+2*t.delta.y))),!1}function r(t){var n=Number(this.element.style.marginLeft.replace("px","")),r=Number(this.element.style.marginTop.replace("px","")),o=Number(this.element.style.width.replace("px","")),s=Number(this.element.style.height.replace("px","")),a=e.getElementSize(this.viewer.canvas);return this.element&&("horizontal"==this.scroll?t.scroll>0?n>-(o-a.x)&&(this.element.style.marginLeft=n-60*t.scroll+"px",i(this,a.x,n-60*t.scroll)):t.scroll<0&&n<0&&(this.element.style.marginLeft=n-60*t.scroll+"px",i(this,a.x,n-60*t.scroll)):t.scroll<0?r>a.y-s&&(this.element.style.marginTop=r+60*t.scroll+"px",i(this,a.y,r+60*t.scroll)):t.scroll>0&&r<0&&(this.element.style.marginTop=r+60*t.scroll+"px",i(this,a.y,r+60*t.scroll))),!1}function i(t,n,r){var i,o,s,a,l,u,c;for(i="horizontal"==t.scroll?t.panelWidth:t.panelHeight,o=Math.ceil(n/i)+5,u=o=(o=(s=Math.ceil((Math.abs(r)+n)/i)+1)-o)<0?0:o;uu+s.x-this.panelWidth?(n=Math.min(n,a-s.x),this.element.style.marginLeft=-n+"px",i(this,s.x,-n)):nc+s.y-this.panelHeight?(n=Math.min(n,l-s.y),this.element.style.marginTop=-n+"px",i(this,s.y,-n)):n1?n[1].springStiffness:5,animationTime:n.length>1?n[1].animationTime:1.5}),e.console.assert("number"==typeof t.springStiffness&&0!==t.springStiffness,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number"),e.console.assert("number"==typeof t.animationTime&&t.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0"),t.exponential&&(this._exponential=!0,delete t.exponential),e.extend(!0,this,t),this.current={value:"number"==typeof this.initial?this.initial:this._exponential?0:1,time:e.now()},e.console.assert(!this._exponential||0!==this.current.value,"[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))},e.Spring.prototype={resetTo:function(t){e.console.assert(!this._exponential||0!==t,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs"),this.start.value=this.target.value=this.current.value=t,this.start.time=this.target.time=this.current.time=e.now(),this._exponential&&(this.start._logValue=Math.log(this.start.value),this.target._logValue=Math.log(this.target.value),this.current._logValue=Math.log(this.current.value))},springTo:function(t){e.console.assert(!this._exponential||0!==t,"[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=t,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(t){this.start.value+=t,this.target.value+=t,this._exponential&&(e.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(t){this._exponential=t,this._exponential&&(e.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 t,n;this.current.time=e.now(),this._exponential?(t=this.start._logValue,n=this.target._logValue):(t=this.start.value,n=this.target.value);var r=this.current.time>=this.target.time?n:t+(n-t)*function(e,t){return(1-Math.exp(e*-t))/(1-Math.exp(-e))}(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time)),i=this.current.value;return this._exponential?this.current.value=Math.exp(r):this.current.value=r,i!=this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(OpenSeadragon),function(e){function t(t){e.extend(!0,this,{timeout:e.DEFAULT_SETTINGS.timeout,jobId:null},t),this.image=null}t.prototype={errorMsg:null,start:function(){var t=this,n=this.abort;this.image=new Image,this.image.onload=function(){t.finish(!0)},this.image.onabort=this.image.onerror=function(){t.errorMsg="Image load aborted",t.finish(!1)},this.jobId=window.setTimeout(function(){t.errorMsg="Image load exceeded timeout",t.finish(!1)},this.timeout),this.loadWithAjax?(this.request=e.makeAjaxRequest({url:this.src,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,responseType:"arraybuffer",success:function(e){var n;try{n=new window.Blob([e.response])}catch(t){var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if("TypeError"===t.name&&r){var i=new r;i.append(e.response),n=i.getBlob()}}0===n.size&&(t.errorMsg="Empty image response.",t.finish(!1));var o=(window.URL||window.webkitURL).createObjectURL(n);t.image.src=o},error:function(e){t.errorMsg="Image load aborted - XHR error",t.finish(!1)}}),this.abort=function(){t.request.abort(),"function"==typeof n&&n()}):(!1!==this.crossOriginPolicy&&(this.image.crossOrigin=this.crossOriginPolicy),this.image.src=this.src)},finish:function(e){this.image.onload=this.image.onerror=this.image.onabort=null,e||(this.image=null),this.jobId&&window.clearTimeout(this.jobId),this.callback(this)}},e.ImageLoader=function(t){e.extend(!0,this,{jobLimit:e.DEFAULT_SETTINGS.imageLoaderLimit,timeout:e.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},t)},e.ImageLoader.prototype={addJob:function(e){var n=this,r=new t({src:e.src,loadWithAjax:e.loadWithAjax,ajaxHeaders:e.loadWithAjax?e.ajaxHeaders:null,crossOriginPolicy:e.crossOriginPolicy,ajaxWithCredentials:e.ajaxWithCredentials,callback:function(t){!function(e,t,n){e.jobsInProgress--,(!e.jobLimit||e.jobsInProgress0&&(e.jobQueue.shift().start(),e.jobsInProgress++),n(t.image,t.errorMsg,t.request)}(n,t,e.callback)},abort:e.abort,timeout:this.timeout});!this.jobLimit||this.jobsInProgressn&&(n=i)}return n},needsUpdate:function(){return e.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead."),this.viewer.world.needsDraw()},numTilesLoaded:function(){return e.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead."),this.viewer.tileCache.numTilesLoaded()},reset:function(){return e.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead."),this.viewer.world.resetItems(),this},update:function(){return e.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 e=this._calculateCanvasSize();if((this.canvas.width!=e.x||this.canvas.height!=e.y)&&(this.canvas.width=e.x,this.canvas.height=e.y,null!==this.sketchCanvas)){var t=this._calculateSketchCanvasSize();this.sketchCanvas.width=t.x,this.sketchCanvas.height=t.y}this._clear()}},_clear:function(e,t){if(this.useCanvas){var n=this._getContext(e);if(t)n.clearRect(t.x,t.y,t.width,t.height);else{var r=n.canvas;n.clearRect(0,0,r.width,r.height)}}},viewportToDrawerRectangle:function(t){var n=this.viewport.pixelFromPointNoRotate(t.getTopLeft(),!0),r=this.viewport.deltaPixelsFromPointsNoRotate(t.getSize(),!0);return new e.Rect(n.x*e.pixelDensityRatio,n.y*e.pixelDensityRatio,r.x*e.pixelDensityRatio,r.y*e.pixelDensityRatio)},drawTile:function(t,n,r,i,o){if(e.console.assert(t,"[Drawer.drawTile] tile is required"),e.console.assert(n,"[Drawer.drawTile] drawingHandler is required"),this.useCanvas){var s=this._getContext(r);i=i||1,t.drawCanvas(s,n,i,o)}else t.drawHTML(this.canvas)},_getContext:function(e){var t=this.context;if(e){if(null===this.sketchCanvas){this.sketchCanvas=document.createElement("canvas");var n=this._calculateSketchCanvasSize();if(this.sketchCanvas.width=n.x,this.sketchCanvas.height=n.y,this.sketchContext=this.sketchCanvas.getContext("2d"),0===this.viewport.getRotation()){var r=this;this.viewer.addHandler("rotate",function e(){if(0!==r.viewport.getRotation()){r.viewer.removeHandler("rotate",e);var t=r._calculateSketchCanvasSize();r.sketchCanvas.width=t.x,r.sketchCanvas.height=t.y}})}}t=this.sketchContext}return t},saveContext:function(e){this.useCanvas&&this._getContext(e).save()},restoreContext:function(e){this.useCanvas&&this._getContext(e).restore()},setClip:function(e,t){if(this.useCanvas){var n=this._getContext(t);n.beginPath(),n.rect(e.x,e.y,e.width,e.height),n.clip()}},drawRectangle:function(e,t,n){if(this.useCanvas){var r=this._getContext(n);r.save(),r.fillStyle=t,r.fillRect(e.x,e.y,e.width,e.height),r.restore()}},blendSketch:function(t,n,r,i){var o=t;if(e.isPlainObject(o)||(o={opacity:t,scale:n,translate:r,compositeOperation:i}),this.useCanvas&&this.sketchCanvas){t=o.opacity,i=o.compositeOperation;var s=o.bounds;if(this.context.save(),this.context.globalAlpha=t,i&&(this.context.globalCompositeOperation=i),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{n=o.scale||1;var a=(r=o.translate)instanceof e.Point?r:new e.Point(0,0),l=0,u=0;if(r){var c=this.sketchCanvas.width-this.canvas.width,h=this.sketchCanvas.height-this.canvas.height;l=Math.round(c/2),u=Math.round(h/2)}this.context.drawImage(this.sketchCanvas,a.x-l*n,a.y-u*n,(this.canvas.width+2*l)*n,(this.canvas.height+2*u)*n,-l,-u,this.canvas.width+2*l,this.canvas.height+2*u)}this.context.restore()}},drawDebugInfo:function(t,n,r,i){if(this.useCanvas){var o=this.viewer.world.getIndexOfItem(i)%this.debugGridColor.length,s=this.context;s.save(),s.lineWidth=2*e.pixelDensityRatio,s.font="small-caps bold "+13*e.pixelDensityRatio+"px arial",s.strokeStyle=this.debugGridColor[o],s.fillStyle=this.debugGridColor[o],0!==this.viewport.degrees?this._offsetForRotation({degrees:this.viewport.degrees}):this.viewer.viewport.flipped&&this._flip(),i.getRotation(!0)%360!=0&&this._offsetForRotation({degrees:i.getRotation(!0),point:i.viewport.pixelFromPointNoRotate(i._getRotationPoint(!0),!0)}),s.strokeRect(t.position.x*e.pixelDensityRatio,t.position.y*e.pixelDensityRatio,t.size.x*e.pixelDensityRatio,t.size.y*e.pixelDensityRatio);var a=(t.position.x+t.size.x/2)*e.pixelDensityRatio,l=(t.position.y+t.size.y/2)*e.pixelDensityRatio;s.translate(a,l),s.rotate(Math.PI/180*-this.viewport.degrees),s.translate(-a,-l),0===t.x&&0===t.y&&(s.fillText("Zoom: "+this.viewport.getZoom(),t.position.x*e.pixelDensityRatio,(t.position.y-30)*e.pixelDensityRatio),s.fillText("Pan: "+this.viewport.getBounds().toString(),t.position.x*e.pixelDensityRatio,(t.position.y-20)*e.pixelDensityRatio)),s.fillText("Level: "+t.level,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+20)*e.pixelDensityRatio),s.fillText("Column: "+t.x,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+30)*e.pixelDensityRatio),s.fillText("Row: "+t.y,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+40)*e.pixelDensityRatio),s.fillText("Order: "+r+" of "+n,(t.position.x+10)*e.pixelDensityRatio,(t.position.y+50)*e.pixelDensityRatio),s.fillText("Size: "+t.size.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+60)*e.pixelDensityRatio),s.fillText("Position: "+t.position.toString(),(t.position.x+10)*e.pixelDensityRatio,(t.position.y+70)*e.pixelDensityRatio),0!==this.viewport.degrees&&this._restoreRotationChanges(),i.getRotation(!0)%360!=0&&this._restoreRotationChanges(),s.restore()}},debugRect:function(t){if(this.useCanvas){var n=this.context;n.save(),n.lineWidth=2*e.pixelDensityRatio,n.strokeStyle=this.debugGridColor[0],n.fillStyle=this.debugGridColor[0],n.strokeRect(t.x*e.pixelDensityRatio,t.y*e.pixelDensityRatio,t.width*e.pixelDensityRatio,t.height*e.pixelDensityRatio),n.restore()}},getCanvasSize:function(t){var n=this._getContext(t).canvas;return new e.Point(n.width,n.height)},getCanvasCenter:function(){return new e.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(t){var n=t.point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter(),r=this._getContext(t.useSketch);r.save(),r.translate(n.x,n.y),this.viewer.viewport.flipped?(r.rotate(Math.PI/180*-t.degrees),r.scale(-1,1)):r.rotate(Math.PI/180*t.degrees),r.translate(-n.x,-n.y)},_flip:function(t){var n=(t=t||{}).point?t.point.times(e.pixelDensityRatio):this.getCanvasCenter(),r=this._getContext(t.useSketch);r.translate(n.x,0),r.scale(-1,1),r.translate(-n.x,0)},_restoreRotationChanges:function(e){this._getContext(e).restore()},_calculateCanvasSize:function(){var t=e.pixelDensityRatio,n=this.viewport.getContainerSize();return{x:n.x*t,y:n.y*t}},_calculateSketchCanvasSize:function(){var e=this._calculateCanvasSize();if(0===this.viewport.getRotation())return e;var t=Math.ceil(Math.sqrt(e.x*e.x+e.y*e.y));return{x:t,y:t}}}}(OpenSeadragon),function(e){e.Viewport=function(t){var n=arguments;n.length&&n[0]instanceof e.Point&&(t={containerSize:n[0],contentSize:n[1],config:n[2]}),t.config&&(e.extend(!0,t,t.config),delete t.config),this._margins=e.extend({left:0,top:0,right:0,bottom:0},t.margins||{}),delete t.margins,e.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,viewer:null,springStiffness:e.DEFAULT_SETTINGS.springStiffness,animationTime:e.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:e.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:e.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:e.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:e.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:e.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:e.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:e.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:e.DEFAULT_SETTINGS.maxZoomLevel,degrees:e.DEFAULT_SETTINGS.degrees,flipped:e.DEFAULT_SETTINGS.flipped,homeFillsViewer:e.DEFAULT_SETTINGS.homeFillsViewer},t),this._updateContainerInnerSize(),this.centerSpringX=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.centerSpringY=new e.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime}),this.zoomSpring=new e.Spring({exponential:!0,initial:1,springStiffness:this.springStiffness,animationTime:this.animationTime}),this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,this._setContentBounds(new e.Rect(0,0,1,1),1),this.goHome(!0),this.update()},e.Viewport.prototype={resetContentSize:function(t){return e.console.assert(t,"[Viewport.resetContentSize] contentSize is required"),e.console.assert(t instanceof e.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point"),e.console.assert(t.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0"),e.console.assert(t.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0"),this._setContentBounds(new e.Rect(0,0,1,t.y/t.x),t.x),this},setHomeBounds:function(t,n){e.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually."),this._setContentBounds(t,n)},_setContentBounds:function(t,n){e.console.assert(t,"[Viewport._setContentBounds] bounds is required"),e.console.assert(t instanceof e.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect"),e.console.assert(t.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0"),e.console.assert(t.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0"),this._contentBoundsNoRotate=t.clone(),this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(n),this._contentBounds=t.rotate(this.degrees).getBoundingBox(),this._contentSize=this._contentBounds.getSize().times(n),this._contentAspectRatio=this._contentSize.x/this._contentSize.y,this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:n,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var e=this._contentAspectRatio/this.getAspectRatio();return(this.homeFillsViewer?e>=1?e:1:e>=1?1:e)/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var t=this._contentBounds.getCenter(),n=1/this.getHomeZoom(),r=n/this.getAspectRatio();return new e.Rect(t.x-n/2,t.y-r/2,n,r)},goHome:function(e){return this.viewer&&this.viewer.raiseEvent("home",{immediately:e}),this.fitBounds(this.getHomeBounds(),e)},getMinZoom:function(){var e=this.getHomeZoom();return this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*e},getMaxZoom:function(){var e=this.maxZoomLevel;return e||(e=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x,e/=this._contentBounds.width),Math.max(e,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new e.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return e.extend({},this._margins)},setMargins:function(t){e.console.assert("object"===e.type(t),"[Viewport.setMargins] margins must be an object"),this._margins=e.extend({left:0,top:0,right:0,bottom:0},t),this._updateContainerInnerSize(),this.viewer&&this.viewer.forceRedraw()},getBounds:function(e){return this.getBoundsNoRotate(e).rotate(-this.getRotation())},getBoundsNoRotate:function(t){var n=this.getCenter(t),r=1/this.getZoom(t),i=r/this.getAspectRatio();return new e.Rect(n.x-r/2,n.y-i/2,r,i)},getBoundsWithMargins:function(e){return this.getBoundsNoRotateWithMargins(e).rotate(-this.getRotation(),this.getCenter(e))},getBoundsNoRotateWithMargins:function(e){var t=this.getBoundsNoRotate(e),n=this._containerInnerSize.x*this.getZoom(e);return t.x-=this._margins.left/n,t.y-=this._margins.top/n,t.width+=(this._margins.left+this._margins.right)/n,t.height+=(this._margins.top+this._margins.bottom)/n,t},getCenter:function(t){var n,r,i,o,s,a,l=new e.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),u=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return t?l:this.zoomPoint?(n=this.pixelFromPoint(this.zoomPoint,!0),o=(i=1/(r=this.getZoom()))/this.getAspectRatio(),s=new e.Rect(l.x-i/2,l.y-o/2,i,o),a=this._pixelFromPoint(this.zoomPoint,s).minus(n).divide(this._containerInnerSize.x*r),u.plus(a)):u},getZoom:function(e){return e?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(e){return Math.max(Math.min(e,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(t){var n=new e.Rect(t.x,t.y,t.width,t.height);if(this.wrapHorizontal);else{var r=this.visibilityRatio*n.width,i=n.x+n.width,o=this._contentBoundsNoRotate.x+this._contentBoundsNoRotate.width,s=this._contentBoundsNoRotate.x-i+r,a=o-n.x-r;r>this._contentBoundsNoRotate.width?n.x+=(s+a)/2:a<0?n.x+=a:s>0&&(n.x+=s)}if(this.wrapVertical);else{var l=this.visibilityRatio*n.height,u=n.y+n.height,c=this._contentBoundsNoRotate.y+this._contentBoundsNoRotate.height,h=this._contentBoundsNoRotate.y-u+l,p=c-n.y-l;l>this._contentBoundsNoRotate.height?n.y+=(h+p)/2:p<0?n.y+=p:h>0&&(n.y+=h)}return n},_raiseConstraintsEvent:function(e){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:e})},applyConstraints:function(e){var t=this.getZoom(),n=this._applyZoomConstraints(t);t!==n&&this.zoomTo(n,this.zoomPoint,e);var r=this.getBoundsNoRotate(),i=this._applyBoundaryConstraints(r);return this._raiseConstraintsEvent(e),(r.x!==i.x||r.y!==i.y||e)&&this.fitBounds(i.rotate(-this.getRotation()),e),this},ensureVisible:function(e){return this.applyConstraints(e)},_fitBounds:function(t,n){var r=(n=n||{}).immediately||!1,i=n.constraints||!1,o=this.getAspectRatio(),s=t.getCenter(),a=new e.Rect(t.x,t.y,t.width,t.height,t.degrees+this.getRotation()).getBoundingBox();a.getAspectRatio()>=o?a.height=a.width/o:a.width=a.height*o,a.x=s.x-a.width/2,a.y=s.y-a.height/2;var l=1/a.width;if(i){var u=a.getAspectRatio(),c=this._applyZoomConstraints(l);l!==c&&(l=c,a.width=1/l,a.x=s.x-a.width/2,a.height=a.width/u,a.y=s.y-a.height/2),s=(a=this._applyBoundaryConstraints(a)).getCenter(),this._raiseConstraintsEvent(r)}if(r)return this.panTo(s,!0),this.zoomTo(l,null,!0);this.panTo(this.getCenter(!0),!0),this.zoomTo(this.getZoom(!0),null,!0);var h=this.getBounds(),p=this.getZoom();if(0===p||Math.abs(l/p-1)<1e-8)return this.zoomTo(l,!0),this.panTo(s,r);var f=(a=a.rotate(-this.getRotation())).getTopLeft().times(l).minus(h.getTopLeft().times(p)).divide(l-p);return this.zoomTo(l,f,r)},fitBounds:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!1})},fitBoundsWithConstraints:function(e,t){return this._fitBounds(e,{immediately:t,constraints:!0})},fitVertically:function(t){var n=new e.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(n,t)},fitHorizontally:function(t){var n=new e.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(n,t)},getConstrainedBounds:function(e){var t;return t=this.getBounds(e),this._applyBoundaryConstraints(t)},panBy:function(t,n){var r=new e.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(r.plus(t),n)},panTo:function(e,t){return t?(this.centerSpringX.resetTo(e.x),this.centerSpringY.resetTo(e.y)):(this.centerSpringX.springTo(e.x),this.centerSpringY.springTo(e.y)),this.viewer&&this.viewer.raiseEvent("pan",{center:e,immediately:t}),this},zoomBy:function(e,t,n){return this.zoomTo(this.zoomSpring.target.value*e,t,n)},zoomTo:function(t,n,r){var i=this;return this.zoomPoint=n instanceof e.Point&&!isNaN(n.x)&&!isNaN(n.y)?n:null,r?this._adjustCenterSpringsForZoomPoint(function(){i.zoomSpring.resetTo(t)}):this.zoomSpring.springTo(t),this.viewer&&this.viewer.raiseEvent("zoom",{zoom:t,refPoint:n,immediately:r}),this},setRotation:function(t){return this.viewer&&this.viewer.drawer.canRotate()?(this.degrees=e.positiveModulo(t,360),this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor()),this.viewer.forceRedraw(),this.viewer.raiseEvent("rotate",{degrees:t}),this):this},getRotation:function(){return this.degrees},resize:function(e,t){var n,r=this.getBoundsNoRotate(),i=r;return this.containerSize.x=e.x,this.containerSize.y=e.y,this._updateContainerInnerSize(),t&&(n=e.x/this.containerSize.x,i.width=r.width*n,i.height=i.width/this.getAspectRatio()),this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:e,maintain:t}),this.fitBounds(i,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new e.Point(Math.max(1,this.containerSize.x-(this._margins.left+this._margins.right)),Math.max(1,this.containerSize.y-(this._margins.top+this._margins.bottom)))},update:function(){var e=this;this._adjustCenterSpringsForZoomPoint(function(){e.zoomSpring.update()}),this.centerSpringX.update(),this.centerSpringY.update();var t=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom;return this._oldCenterX=this.centerSpringX.current.value,this._oldCenterY=this.centerSpringY.current.value,this._oldZoom=this.zoomSpring.current.value,t},_adjustCenterSpringsForZoomPoint:function(e){if(this.zoomPoint){var t=this.pixelFromPoint(this.zoomPoint,!0);e();var n=this.pixelFromPoint(this.zoomPoint,!0).minus(t),r=this.deltaPointsFromPixels(n,!0);this.centerSpringX.shiftBy(r.x),this.centerSpringY.shiftBy(r.y),this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else e()},deltaPixelsFromPointsNoRotate:function(e,t){return e.times(this._containerInnerSize.x*this.getZoom(t))},deltaPixelsFromPoints:function(e,t){return this.deltaPixelsFromPointsNoRotate(e.rotate(this.getRotation()),t)},deltaPointsFromPixelsNoRotate:function(e,t){return e.divide(this._containerInnerSize.x*this.getZoom(t))},deltaPointsFromPixels:function(e,t){return this.deltaPointsFromPixelsNoRotate(e,t).rotate(-this.getRotation())},pixelFromPointNoRotate:function(e,t){return this._pixelFromPointNoRotate(e,this.getBoundsNoRotate(t))},pixelFromPoint:function(e,t){return this._pixelFromPoint(e,this.getBoundsNoRotate(t))},_pixelFromPointNoRotate:function(t,n){return t.minus(n.getTopLeft()).times(this._containerInnerSize.x/n.width).plus(new e.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(e,t){return this._pixelFromPointNoRotate(e.rotate(this.getRotation(),this.getCenter(!0)),t)},pointFromPixelNoRotate:function(t,n){var r=this.getBoundsNoRotate(n);return t.minus(new e.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/r.width).plus(r.getTopLeft())},pointFromPixel:function(e,t){return this.pointFromPixelNoRotate(e,t).rotate(-this.getRotation(),this.getCenter(!0))},_viewportToImageDelta:function(t,n){var r=this._contentBoundsNoRotate.width;return new e.Point(t*this._contentSizeNoRotate.x/r,n*this._contentSizeNoRotate.x/r)},viewportToImageCoordinates:function(t,n){if(t instanceof e.Point)return this.viewportToImageCoordinates(t.x,t.y);if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(1===r){return this.viewer.world.getItemAt(0).viewportToImageCoordinates(t,n,!0)}}return this._viewportToImageDelta(t-this._contentBoundsNoRotate.x,n-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(t,n){var r=this._contentBoundsNoRotate.width;return new e.Point(t/this._contentSizeNoRotate.x*r,n/this._contentSizeNoRotate.x*r)},imageToViewportCoordinates:function(t,n){if(t instanceof e.Point)return this.imageToViewportCoordinates(t.x,t.y);if(this.viewer){var r=this.viewer.world.getItemCount();if(r>1)e.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(1===r){return this.viewer.world.getItemAt(0).imageToViewportCoordinates(t,n,!0)}}var i=this._imageToViewportDelta(t,n);return i.x+=this._contentBoundsNoRotate.x,i.y+=this._contentBoundsNoRotate.y,i},imageToViewportRectangle:function(t,n,r,i){var o=t;if(o instanceof e.Rect||(o=new e.Rect(t,n,r,i)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)e.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(t,n,r,i,!0)}}var a=this.imageToViewportCoordinates(o.x,o.y),l=this._imageToViewportDelta(o.width,o.height);return new e.Rect(a.x,a.y,l.x,l.y,o.degrees)},viewportToImageRectangle:function(t,n,r,i){var o=t;if(o instanceof e.Rect||(o=new e.Rect(t,n,r,i)),this.viewer){var s=this.viewer.world.getItemCount();if(s>1)e.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(t,n,r,i,!0)}}var a=this.viewportToImageCoordinates(o.x,o.y),l=this._viewportToImageDelta(o.width,o.height);return new e.Rect(a.x,a.y,l.x,l.y,o.degrees)},viewerElementToImageCoordinates:function(e){var t=this.pointFromPixel(e,!0);return this.viewportToImageCoordinates(t)},imageToViewerElementCoordinates:function(e){var t=this.imageToViewportCoordinates(e);return this.pixelFromPoint(t,!0)},windowToImageCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var n=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(n)},imageToWindowCoordinates:function(t){return e.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer."),this.imageToViewerElementCoordinates(t).plus(e.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(e){return this.pointFromPixel(e,!0)},viewportToViewerElementCoordinates:function(e){return this.pixelFromPoint(e,!0)},viewerElementToViewportRectangle:function(t){return e.Rect.fromSummits(this.pointFromPixel(t.getTopLeft(),!0),this.pointFromPixel(t.getTopRight(),!0),this.pointFromPixel(t.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(t){return e.Rect.fromSummits(this.pixelFromPoint(t.getTopLeft(),!0),this.pixelFromPoint(t.getTopRight(),!0),this.pixelFromPoint(t.getBottomLeft(),!0))},windowToViewportCoordinates:function(t){e.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var n=t.minus(e.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(n)},viewportToWindowCoordinates:function(t){return e.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer."),this.viewportToViewerElementCoordinates(t).plus(e.getElementPosition(this.viewer.element))},viewportToImageZoom:function(t){if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(1===n){return this.viewer.world.getItemAt(0).viewportToImageZoom(t)}}var r=this._contentSizeNoRotate.x;return t*(this._containerInnerSize.x/r*this._contentBoundsNoRotate.width)},imageToViewportZoom:function(t){if(this.viewer){var n=this.viewer.world.getItemCount();if(n>1)e.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(1===n){return this.viewer.world.getItemAt(0).imageToViewportZoom(t)}}return t*(this._contentSizeNoRotate.x/this._containerInnerSize.x/this._contentBoundsNoRotate.width)},toggleFlip:function(){return this.setFlip(!this.getFlip()),this},getFlip:function(){return this.flipped},setFlip:function(e){return this.flipped===e?this:(this.flipped=e,this.viewer.navigator&&this.viewer.navigator.setFlip(this.getFlip()),this.viewer.forceRedraw(),this.viewer.raiseEvent("flip",{flipped:e}),this)}}}(OpenSeadragon),function(e){function t(e,t,r,i,o,s,l,u,c){var h=l.getBoundingBox().getTopLeft(),p=l.getBoundingBox().getBottomRight();e.viewer&&e.viewer.raiseEvent("update-level",{tiledImage:e,havedrawn:t,level:i,opacity:o,visibility:s,drawArea:l,topleft:h,bottomright:p,currenttime:u,best:c}),a(e.coverage,i),a(e.loadingCoverage,i);for(var f=e._getCornerTiles(i,h,p),d=f.topLeft,g=f.bottomRight,m=e.source.getNumTiles(i),v=e.viewport.pixelFromPoint(e.viewport.getCenter()),y=d.x;y<=g.x;y++)for(var w=d.y;w<=g.y;w++){if(!e.wrapHorizontal&&!e.wrapVertical){var T=e.source.getTileBounds(i,y,w);if(null===l.intersection(T))continue}c=n(e,r,t,y,w,i,o,s,v,m,u,c)}return c}function n(t,n,i,a,l,u,c,h,p,f,d,g){var m=function(t,n,r,i,o,s,a,l,u,c){var h,p,f,d,g,m,v,y,w;s[r]||(s[r]={});s[r][t]||(s[r][t]={});s[r][t][n]||(h=(l.x+t%l.x)%l.x,p=(l.y+n%l.y)%l.y,f=o.getTileBounds(r,h,p),d=o.getTileBounds(r,h,p,!0),g=o.tileExists(r,h,p),m=o.getTileUrl(r,h,p),i.loadTilesWithAjax?(v=o.getTileAjaxHeaders(r,h,p),e.isPlainObject(i.ajaxHeaders)&&(v=e.extend({},i.ajaxHeaders,v))):v=null,y=o.getContext2D?o.getContext2D(r,h,p):void 0,f.x+=(t-h)/l.x,f.y+=c/u*((n-p)/l.y),w=new e.Tile(r,t,n,f,g,m,y,i.loadTilesWithAjax,v,d),h===l.x-1&&(w.isRightMost=!0),p===l.y-1&&(w.isBottomMost=!0),s[r][t][n]=w);return(w=s[r][t][n]).lastTouchTime=a,w}(a,l,u,t,t.source,t.tilesMatrix,d,f,t._worldWidthCurrent,t._worldHeightCurrent),v=i;t.viewer&&t.viewer.raiseEvent("update-tile",{tiledImage:t,tile:m}),s(t.coverage,u,a,l,!1);var y=m.loaded||m.loading||o(t.loadingCoverage,u,a,l);if(s(t.loadingCoverage,u,a,l,y),!m.exists)return g;if(n&&!v&&(o(t.coverage,u,a,l)?s(t.coverage,u,a,l,!0):v=!0),!v)return g;if(function(t,n,r,i,o,s){var a=t.bounds.getTopLeft();a.x*=s._scaleSpring.current.value,a.y*=s._scaleSpring.current.value,a.x+=s._xSpring.current.value,a.y+=s._ySpring.current.value;var l=t.bounds.getSize();l.x*=s._scaleSpring.current.value,l.y*=s._scaleSpring.current.value;var u=r.pixelFromPointNoRotate(a,!0),c=r.pixelFromPointNoRotate(a,!1),h=r.deltaPixelsFromPointsNoRotate(l,!0),p=r.deltaPixelsFromPointsNoRotate(l,!1),f=c.plus(p.divide(2)),d=i.squaredDistanceTo(f);n||(h=h.plus(new e.Point(1,1)));t.isRightMost&&s.wrapHorizontal&&(h.x+=.75);t.isBottomMost&&s.wrapVertical&&(h.y+=.75);t.position=u,t.size=h,t.squaredDistance=d,t.visibility=o}(m,t.source.tileOverlap,t.viewport,p,h,t),!m.loaded)if(m.context2D)r(t,m);else{var w=t._tileCache.getImageRecord(m.cacheKey);if(w)r(t,m,w.getImage())}m.loaded?function(e,t,n,r,i,o,a){var l,u,c=1e3*e.blendTime;t.blendStart||(t.blendStart=a);l=a-t.blendStart,u=c?Math.min(1,l/c):1,e.alwaysBlend&&(u*=o);if(t.opacity=u,e.lastDrawn.push(t),1==u)s(e.coverage,i,n,r,!0),e._hasOpaqueTile=!0;else if(le.visibility)return t;if(t.visibility==e.visibility&&t.squaredDistanceo?(s=this._clip.x/this._clip.height*t.height,a=this._clip.y/this._clip.height*t.height):(s=this._clip.x/this._clip.width*t.width,a=this._clip.y/this._clip.width*t.width)),t.getAspectRatio()>o){var c=t.height/u,h=0;i.isHorizontallyCentered?h=(t.width-t.height*o)/2:i.isRight&&(h=t.width-t.height*o),this.setPosition(new e.Point(t.x-s+h,t.y-a),r),this.setHeight(c,r)}else{var p=t.width/l,f=0;i.isVerticallyCentered?f=(t.height-t.width/o)/2:i.isBottom&&(f=t.height-t.width/o),this.setPosition(new e.Point(t.x-s,t.y-a+f),r),this.setWidth(p,r)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(t){e.console.assert(!t||t instanceof e.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null"),t instanceof e.Rect?this._clip=t.clone():this._clip=null,this._needsDraw=!0,this.raiseEvent("clip-change")},getOpacity:function(){return this.opacity},setOpacity:function(e){e!==this.opacity&&(this.opacity=e,this._needsDraw=!0,this.raiseEvent("opacity-change",{opacity:this.opacity}))},getPreload:function(){return this._preload},setPreload:function(e){this._preload=!!e,this._needsDraw=!0},getRotation:function(e){return e?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(e,t){this._degreesSpring.target.value===e&&this._degreesSpring.isAtTargetValue()||(t?this._degreesSpring.resetTo(e):this._degreesSpring.springTo(e),this._needsDraw=!0,this._raiseBoundsChange())},_getRotationPoint:function(e){return this.getBoundsNoRotate(e).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(e){e!==this.compositeOperation&&(this.compositeOperation=e,this._needsDraw=!0,this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation}))},_setScale:function(e,t){var n=this._scaleSpring.target.value===e;if(t){if(n&&this._scaleSpring.current.value===e)return;this._scaleSpring.resetTo(e),this._updateForScale(),this._needsDraw=!0}else{if(n)return;this._scaleSpring.springTo(e),this._updateForScale(),this._needsDraw=!0}n||this._raiseBoundsChange()},_updateForScale:function(){this._worldWidthTarget=this._scaleSpring.target.value,this._worldHeightTarget=this.normHeight*this._scaleSpring.target.value,this._worldWidthCurrent=this._scaleSpring.current.value,this._worldHeightCurrent=this.normHeight*this._scaleSpring.current.value},_raiseBoundsChange:function(){this.raiseEvent("bounds-change")},_isBottomItem:function(){return this.viewer.world.getItemAt(0)===this},_getLevelsInterval:function(){var e=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2))),t=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value,n=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(t/this.minPixelRatio)/Math.log(2))));return n=Math.max(n,this.source.minLevel||0),{lowestLevel:e=Math.min(e,n),highestLevel:n}},_updateViewport:function(){for(this._needsDraw=!1,this._tilesLoading=0,this.loadingCoverage={};this.lastDrawn.length>0;){this.lastDrawn.pop().beingDrawn=!1}var n=this.viewport,o=this._viewportToTiledImageRectangle(n.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var s=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));if(null===(o=o.intersection(s)))return}for(var a=this._getLevelsInterval(),l=a.lowestLevel,u=a.highestLevel,c=null,h=!1,p=e.now(),f=u;f>=l;f--){var d=!1,g=n.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(f),!0).x*this._scaleSpring.current.value;if(f===l||!h&&g>=this.minPixelRatio)d=!0,h=!0;else if(!h)continue;var m=n.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(f),!1).x*this._scaleSpring.current.value,v=n.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value,y=this.immediateRender?1:v;if(c=t(this,h,d,f,Math.min(1,(g-.5)/.5),y/Math.abs(y-m),o,p,c),i(this.coverage,f))break}!function(t,n){if(0===t.opacity||0===n.length&&!t.placeholderFillStyle)return;var r,i,o,s=n[0];s&&(r=t.opacity<1||t.compositeOperation&&"source-over"!==t.compositeOperation||!t._isBottomItem()&&s._hasTransparencyChannel());var a,l=t.viewport.getZoom(!0),u=t.viewportToImageZoom(l);n.length>1&&u>t.smoothTileEdgesMinZoom&&!t.iOSDevice&&t.getRotation(!0)%360==0&&e.supportsCanvas&&(r=!0,i=s.getScaleForEdgeSmoothing(),o=s.getTranslationForEdgeSmoothing(i,t._drawer.getCanvasSize(!1),t._drawer.getCanvasSize(!0)));r&&(i||(a=t.viewport.viewportToViewerElementRectangle(t.getClippedBounds(!0)).getIntegerBoundingBox().times(e.pixelDensityRatio)),t._drawer._clear(!0,a));i||(0!==t.viewport.degrees?t._drawer._offsetForRotation({degrees:t.viewport.degrees,useSketch:r}):t._drawer.viewer.viewport.flipped&&t._drawer._flip({}),t.getRotation(!0)%360!=0&&t._drawer._offsetForRotation({degrees:t.getRotation(!0),point:t.viewport.pixelFromPointNoRotate(t._getRotationPoint(!0),!0),useSketch:r}));var c=!1;if(t._clip){t._drawer.saveContext(r);var h=t.imageToViewportRectangle(t._clip,!0);h=h.rotate(-t.getRotation(!0),t._getRotationPoint(!0));var p=t._drawer.viewportToDrawerRectangle(h);i&&(p=p.times(i)),o&&(p=p.translate(o)),t._drawer.setClip(p,r),c=!0}if(t.placeholderFillStyle&&!1===t._hasOpaqueTile){var f=t._drawer.viewportToDrawerRectangle(t.getBounds(!0));i&&(f=f.times(i)),o&&(f=f.translate(o));var d=null;d="function"==typeof t.placeholderFillStyle?t.placeholderFillStyle(t,t._drawer.context):t.placeholderFillStyle,t._drawer.drawRectangle(f,d,r)}for(var g=n.length-1;g>=0;g--)s=n[g],t._drawer.drawTile(s,t._drawingHandler,r,i,o),s.beingDrawn=!0,t.viewer&&t.viewer.raiseEvent("tile-drawn",{tiledImage:t,tile:s});c&&t._drawer.restoreContext(r);i||(t.getRotation(!0)%360!=0&&t._drawer._restoreRotationChanges(r),0!==t.viewport.degrees?t._drawer._restoreRotationChanges(r):t._drawer.viewer.viewport.flipped&&t._drawer._flip({}));r&&(i&&(0!==t.viewport.degrees&&t._drawer._offsetForRotation({degrees:t.viewport.degrees,useSketch:!1}),t.getRotation(!0)%360!=0&&t._drawer._offsetForRotation({degrees:t.getRotation(!0),point:t.viewport.pixelFromPointNoRotate(t._getRotationPoint(!0),!0),useSketch:!1})),t._drawer.blendSketch({opacity:t.opacity,scale:i,translate:o,compositeOperation:t.compositeOperation,bounds:a}),i&&(t.getRotation(!0)%360!=0&&t._drawer._restoreRotationChanges(!1),0!==t.viewport.degrees&&t._drawer._restoreRotationChanges(!1)));!function(t,n){if(t.debugMode)for(var r=n.length-1;r>=0;r--){var i=n[r];try{t._drawer.drawDebugInfo(i,n.length,r,t)}catch(t){e.console.error(t)}}}(t,n)}(this,this.lastDrawn),c&&!c.context2D?(!function(t,n,i){n.loading=!0,t._imageLoader.addJob({src:n.url,loadWithAjax:n.loadWithAjax,ajaxHeaders:n.ajaxHeaders,crossOriginPolicy:t.crossOriginPolicy,ajaxWithCredentials:t.ajaxWithCredentials,callback:function(o,s,a){!function(t,n,i,o,s,a){if(!o)return e.console.log("Tile %s failed to load: %s - error: %s",n,n.url,s),t.viewer.raiseEvent("tile-load-failed",{tile:n,tiledImage:t,time:i,message:s,tileRequest:a}),n.loading=!1,void(n.exists=!1);if(ithis._maxImageCacheCount){for(var s,a,l,u,c,h,p=null,f=-1,d=null,g=this._tilesLoaded.length-1;g>=0;g--)(s=(h=this._tilesLoaded[g]).tile).level<=r||s.beingDrawn||(p?(u=s.lastTouchTime,a=p.lastTouchTime,c=s.level,l=p.level,(ul)&&(p=s,f=g,d=h)):(p=s,f=g,d=h));p&&f>=0&&(this._unloadTile(d),i=f)}this._tilesLoaded[i]=new function(t){e.console.assert(t,"[TileCache.cacheTile] options is required"),e.console.assert(t.tile,"[TileCache.cacheTile] options.tile is required"),e.console.assert(t.tiledImage,"[TileCache.cacheTile] options.tiledImage is required"),this.tile=t.tile,this.tiledImage=t.tiledImage}({tile:n.tile,tiledImage:n.tiledImage})},clearTilesFor:function(t){var n;e.console.assert(t,"[TileCache.clearTilesFor] tiledImage is required");for(var r=0;r=this._items.length)throw new Error("Index bigger than number of layers.");n!==r&&-1!==r&&(this._items.splice(r,1),this._items.splice(n,0,t),this._needsDraw=!0,this.raiseEvent("item-index-change",{item:t,previousIndex:r,newIndex:n}))},removeItem:function(t){e.console.assert(t,"[World.removeItem] item is required");var n=e.indexOf(this._items,t);-1!==n&&(t.removeHandler("bounds-change",this._delegatedFigureSizes),t.removeHandler("clip-change",this._delegatedFigureSizes),t.destroy(),this._items.splice(n,1),this._figureSizes(),this._needsDraw=!0,this._raiseRemoveItem(t))},removeAll:function(){var e,t;for(this.viewer._cancelPendingImages(),t=0;tc.height?a:a*(c.width/c.height))*(c.height/c.width),f=new e.Point(d+(a-h)/2,g+(a-p)/2),u.setPosition(f,r),u.setWidth(h,r),"horizontal"===i?d+=l:g+=l;this.setAutoRefigureSizes(!0)},_figureSizes:function(){var t=this._homeBounds?this._homeBounds.clone():null,n=this._contentSize?this._contentSize.clone():null,r=this._contentFactor||0;if(this._items.length){var i=this._items[0],o=i.getBounds();this._contentFactor=i.getContentSize().x/o.width;for(var s=i.getClippedBounds().getBoundingBox(),a=s.x,l=s.y,u=s.x+s.width,c=s.y+s.height,h=1;hN.length&&N.push(e)}function M(e,t,n){return null==e?0:function e(t,n,r,i){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var l=!1;if(null===t)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case o:case s:l=!0}}if(l)return r(i,t,""===n?"."+L(t,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(t))for(var u=0;uthis.eventPool.length&&this.eventPool.push(e)}function he(e){e.eventPool=[],e.getPooled=ue,e.release=ce}i(le.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=se)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=se)},persist:function(){this.isPersistent=se},isPersistent:ae,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ae,this._dispatchInstances=this._dispatchListeners=null}}),le.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},le.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var o=new t;return i(o,n.prototype),n.prototype=o,n.prototype.constructor=n,n.Interface=i({},r.Interface,e),n.extend=r.extend,he(n),n},he(le);var pe=le.extend({data:null}),fe=le.extend({data:null}),de=[9,13,27,32],ge=G&&"CompositionEvent"in window,me=null;G&&"documentMode"in document&&(me=document.documentMode);var ve=G&&"TextEvent"in window&&!me,ye=G&&(!ge||me&&8=me),we=String.fromCharCode(32),Te={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},be=!1;function Ee(e,t){switch(e){case"keyup":return-1!==de.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Se(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var xe=!1;var _e={eventTypes:Te,extractEvents:function(e,t,n,r){var i=void 0,o=void 0;if(ge)e:{switch(e){case"compositionstart":i=Te.compositionStart;break e;case"compositionend":i=Te.compositionEnd;break e;case"compositionupdate":i=Te.compositionUpdate;break e}i=void 0}else xe?Ee(e,n)&&(i=Te.compositionEnd):"keydown"===e&&229===n.keyCode&&(i=Te.compositionStart);return i?(ye&&"ko"!==n.locale&&(xe||i!==Te.compositionStart?i===Te.compositionEnd&&xe&&(o=oe()):(re="value"in(ne=r)?ne.value:ne.textContent,xe=!0)),i=pe.getPooled(i,t,n,r),o?i.data=o:null!==(o=Se(n))&&(i.data=o),W(i),o=i):o=null,(e=ve?function(e,t){switch(e){case"compositionend":return Se(t);case"keypress":return 32!==t.which?null:(be=!0,we);case"textInput":return(e=t.data)===we&&be?null:e;default:return null}}(e,n):function(e,t){if(xe)return"compositionend"===e||!ge&&Ee(e,t)?(e=oe(),ie=re=ne=null,xe=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1