diff --git a/.gitignore b/.gitignore index 00cbbdf..d247aad 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ typings/ # dotenv environment variables file .env +# MacOS +.DS_Store \ No newline at end of file diff --git a/Kacheltechnik_Allgemein.md b/Kacheltechnik_Allgemein.md new file mode 100644 index 0000000..8706101 --- /dev/null +++ b/Kacheltechnik_Allgemein.md @@ -0,0 +1,142 @@ +# Einbindung OpenSeadragon auf beliebiger Webseite + +## OpenSeadragon +[http://openseadragon.github.io](http://openseadragon.github.io) +OpenSeadragon von Homepage laden und entpacken. +Bei Bedarf andere Icons installieren, z. B. [https://github.com/peterthomet/openseadragon-flat-toolbar-icons](https://github.com/peterthomet/openseadragon-flat-toolbar-icons) (ggfls. Höhe der Toolbar anpassen). + +## HTML + +Diese Elemente an einer beliebigen Stelle einfügen: +``` +
+
+ + Seite  + +  von  + + +
+
+
+``` + +## CSS + +Werte an Seite anpassen! CSS in einer Datei speichern. + +``` +#dla_kachelviewer_viewport { + width: 777px; /* DLA homepage (default 800px) */ + height: 600px; +} +#dla_kachelviewer_toolbar { + width: 100%; + height: 2.3125rem; /* DLA input element (default 30px) */ +} +} +#dla_kachelviewer_seitenanzeige { + display: table; + margin: auto; + padding-left: 1em; /* ggfls. anpassen */ + padding-right: 1em; /* ggfls. anpassen */ + background-color: white; /* ggfls. anpassen */ +} +#dla_kachelviewer_seite { + display: inline; /* nur auf DLA Homepage nötig */ + width: 3em; /* nur auf DLA Homepage nötig */ +} +#dla_kachelviewer_content { + width: 100%; + height: 100%; + background-color: black; /* ggfls. anpassen */ +} +``` +Datei im Header der Seite einbinden: +``` + + … + + … + +``` + +## JavaScript + +Pfade und tileSources anpassen. Javascript in Datei speichern. +Für IIIF siehe hier: [http://openseadragon.github.io/examples/tilesource-iiif/](http://openseadragon.github.io/examples/tilesource-iiif/) + +``` +/** + * Skript zur Anzeige von Kacheln + */ + +/** + * Konfiguration + */ +var dlaKachelviewerConfig = { + id: 'dla_kachelviewer_content' + , toolbar: 'dla_kachelviewer_toolbar' + , prefixUrl: 'Pfad/zu/openseadragon/images/' + , tileSources: ['Pfad/zu/kachel1.dzi', 'Pfad/zu/kachel2.dzi'] + , sequenceMode: true + , showReferenceStrip: true +} + +/** + * Setup OpenSeadragon Kachelviewer + */ +var dlaKachelviewer +var setupDlaKachelviewer = function () { + + // Bestehende Instanz von dlaKachelviewer löschen + if (dlaKachelviewer) dlaKachelviewer.destroy() + + // Seitennummern setzen + var totalPages = dlaKachelviewerConfig['tileSources'].length + document.getElementById("dla_kachelviewer_seite").value = 1 + document.getElementById("dla_kachelviewer_seite").size = String(totalPages).length + document.getElementById("dla_kachelviewer_seite").maxLength = String(totalPages).length + document.getElementById("dla_kachelviewer_seiten").innerHTML = String(totalPages) + + // Viewer einrichten + dlaKachelviewer = OpenSeadragon(dlaKachelviewerConfig) + + /** + * Event handler definieren + */ + + // Seitenzahlen + dlaKachelviewer.addHandler("page", function (data) { + document.getElementById("dla_kachelviewer_seite").value = data.page + 1 + }) + var pageInput = document.getElementById("dla_kachelviewer_seite") + pageInput.oninput = function (e) { + var p = pageInput.value + if (p) { + if (pageInput.value > totalPages) p = totalPages + else if (pageInput.value < 1) p = 1 + dlaKachelviewer.goToPage(p - 1) + } + } + pageInput.onpropertychange = pageInput.oninput +} + +/** + * Ausführen + */ +setupDlaKachelviewer() +``` + +Javascript zusammen mit OpenSeadragon am Ende(!) der Seite einfügen. Reihenfolge beachten. + +``` + … + + + +``` + +___ +*6.11.2016, Alexander Harm* \ No newline at end of file diff --git a/LICENSE b/LICENSE index 8dada3e..28d6ed2 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2017 Deutsches Literaturarchiv Marbach Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 6bfe196..e5b622f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,48 @@ # dla_kachelviewer A Typo3-Extension to view DeepZoomImages using OpenSeadragon + +### Installation + +Dieses Repositorium klonen und das Unterverzeichnis `dla_kachelviewer` in den Pfad der Typo3-Erweiterungen kopieren (`.../typo3conf/ext/`). + +### Einbindung auf einer Typo3-Seite + +Auf der gewünschten Seite ein neues `Inhaltselement` Typ `Allgemeines Plug-In` hinzufügen. +Unter `Plug-In` nun den `DLA Kachelviewer` auswählen und speichern. + + +### Konfiguration + +Es gibt folgende Konfigurationsmöglichkeiten im Typo3-Backend: + +* Speicherpfad: Pfad unter dem die Digitalisate/Kacheln in Unterordnern gespeichert sind. Normalerweise ist dies der Typo3-Ordner `fileadmin`. + +* Objekt ID: Der Verzeichnisname (nicht als vollständiger Pfad!). + +* Metadaten anzeigen: Zeigt Metadaten aus dem Kallias-OPAC an. + +* Metadaten ID: Falls sich der Verzeichnisname nicht mit der Mediennummer deckt, kann hier eine Alternative angegeben werden. Zusätzlich ist es möglich eine Regular Expression anzugeben. In diesem Fall werden die Metadaten aus den einzelnen Dateinamen generiert. Die Regular Expression muss mit `re:` beginnen und genau eine Match-Group enthalten, z. B. `re:^.*\/(.+)_[0-9]{4}.dzi$` (entfernt die laufende Nummer). Achtung: OpenSeadragon gibt den vollständigen Pfad zurück. + +* Startseite: Bei Bedarf kann eine Startseite definiert werden. + +* Suchmaske: Bei Bedarf kann eine Suchmaske eingeblendet werden über die direkt Objekte angegeben werden können. + +* Speicherstruktur: Es gibt prinzipiell zwei Strukturen in denen die Dateien abgelegt sind: + + * 1. Object/Quality/File: z. B. `.../HS_12345678/tiles/...` + * 2. Quality/Object/File: z. B. `.../tiles/HS_12345678/...` + + Normalerweise wird immer in Struktur 1 abgelegt. + +### Paramterübergabe per URL + +Manche Parameter können auch direkt über die URL im SearchString übergeben werden: + +* id: Wird von Typo3 vergeben +* object: Die Objekt ID +* metadata: Die Metadata ID (keine Regular Expression) +* physpage: Die Startseite + +Beispiel: + +`https://www.dla-marbach.de/index.php?id=1017&object=HS_12345678&metadata=HS_87654321&physpage=10` \ No newline at end of file diff --git a/dla_kachelviewer/Classes/Controller/KachelviewerController.php b/dla_kachelviewer/Classes/Controller/KachelviewerController.php new file mode 100644 index 0000000..b5fc7c3 --- /dev/null +++ b/dla_kachelviewer/Classes/Controller/KachelviewerController.php @@ -0,0 +1,22 @@ +response->addAdditionalHeaderData(''); + // Pass variables to JavaScript + $this->response->addAdditionalHeaderData(''); + $this->response->addAdditionalHeaderData(''); + $this->response->addAdditionalHeaderData(''); + $this->response->addAdditionalHeaderData(''); + $this->response->addAdditionalHeaderData(''); + $this->response->addAdditionalHeaderData(''); + $this->response->addAdditionalHeaderData(''); + } + } + +?> \ No newline at end of file diff --git a/dla_kachelviewer/Configuration/FlexForms/DlaKachelviewer.xml b/dla_kachelviewer/Configuration/FlexForms/DlaKachelviewer.xml new file mode 100755 index 0000000..5d30f1d --- /dev/null +++ b/dla_kachelviewer/Configuration/FlexForms/DlaKachelviewer.xml @@ -0,0 +1,118 @@ + + + 1 + + + + + + General Settings + + array + + + + + + input + 75 + /fileadmin/data/repo/dido + trim + + + + + + + + input + 30 + re:^.*\/(.+)_[0-9]{4}.dzi$ + trim + + + + + + + + select + 1 + + + True + True + + + False + False + + + + + + + + + + input + 30 + re:^.*\/(.+)_[0-9]{4}.dzi$ + trim + + + + + + + + input + 5 + 1 + trim + + + + + + + + select + 1 + + + False + False + + + True + True + + + + + + + + + + select + 1 + + + 1: Object/Quality/File + 1 + + + 2: Quality/Object/File + 2 + + + + + + + + + + diff --git a/dla_kachelviewer/Resources/Private/Templates/Kachelviewer/Deepzoom.html b/dla_kachelviewer/Resources/Private/Templates/Kachelviewer/Deepzoom.html new file mode 100644 index 0000000..6023a77 --- /dev/null +++ b/dla_kachelviewer/Resources/Private/Templates/Kachelviewer/Deepzoom.html @@ -0,0 +1,19 @@ +
Objekt wurde nicht gefunden!
+
+ + +
+
+
+ + Seite  + +  von  + + +
+
+
+
+ + \ No newline at end of file diff --git a/dla_kachelviewer/Resources/Public/CSS/dla_kachelviewer.css b/dla_kachelviewer/Resources/Public/CSS/dla_kachelviewer.css new file mode 100644 index 0000000..573a237 --- /dev/null +++ b/dla_kachelviewer/Resources/Public/CSS/dla_kachelviewer.css @@ -0,0 +1,42 @@ +#dla_kachelviewer_error { + color: red; + font-weight: bold; + visibility: hidden; +} +#dla_kachelviewer_input { + margin-bottom: 20px; +} +#dla_kachelviewer_input_text { + display: inline; /* nur auf DLA Homepage nötig */ + width: 9em; /* nur auf DLA Homepage nötig */ +} +#dla_kachelviewer_input_submit { + display: inline; /* nur auf DLA Homepage nötig */ +} +#dla_kachelviewer_viewport { + width: 777px; /* DLA homepage (default 800px) */ +} +#dla_kachelviewer_toolbar { + width: 100%; + height: 2.3125rem; /* DLA input element (default 30px) */ +} +#dla_kachelviewer_seitenanzeige { + display: table; + margin: auto; + padding-left: 1em; + padding-right: 1em; + background-color: white; /* ggfls. anpassen */ +} +#dla_kachelviewer_seite { + display: inline; /* nur auf DLA Homepage nötig */ + width: 3em; /* nur auf DLA Homepage nötig */ +} +#dla_kachelviewer_content { + width: 100%; + height: 600px; + background-color: black; /* ggfls. anpassen */ +} +#dla_kachelviewer_metadaten table tr td { + padding-bottom: 0.25rem; + padding-top: 0.25rem; +} \ No newline at end of file diff --git a/dla_kachelviewer/Resources/Public/JavaScript/dla_kachelviewer.js b/dla_kachelviewer/Resources/Public/JavaScript/dla_kachelviewer.js new file mode 100644 index 0000000..acafc16 --- /dev/null +++ b/dla_kachelviewer/Resources/Public/JavaScript/dla_kachelviewer.js @@ -0,0 +1,414 @@ +/** + * Skript zur Anzeige von Kacheln + */ + +/** + * Check Extension Variables + */ +if (dlaKachelviewerStoragePath) { + if (dlaKachelviewerStoragePath.substr(0, 1) !== '/') dlaKachelviewerStoragePath = '/' + dlaKachelviewerStoragePath + if (dlaKachelviewerStoragePath.substr(dlaKachelviewerStoragePath.length - 1, 1) !== '/') dlaKachelviewerStoragePath = dlaKachelviewerStoragePath + '/' +} +else { + dlaKachelviewerStoragePath = '/fileadmin/data/repo/dido/' +} +var dlaKachelviewerFullStoragePath = '' // Dependent on dlaKachelviewerStoragePattern (1: Object/Quality/File, 2: Quality/Object/File) + +if (dlaKachelviewerShowSearchField) { + if (dlaKachelviewerShowSearchField === 'True') dlaKachelviewerShowSearchField = true + else dlaKachelviewerShowSearchField = false +} +else { + dlaKachelviewerShowSearchField = true +} + +if (dlaKachelviewerShowMetadata) { + if (dlaKachelviewerShowMetadata === 'True') dlaKachelviewerShowMetadata = true + else dlaKachelviewerShowMetadata = false +} +else { + dlaKachelviewerShowMetadata = true +} + +if (!dlaKachelviewerPhysPage) { + dlaKachelviewerPhysPage = 0 +} + +/** + * Suchfeld anzeigen/verstecken + */ +if (!dlaKachelviewerShowSearchField) document.getElementById('dla_kachelviewer_input').style.display = 'none' + +/** + * Objekt-ID aus URL bestimmen + * Zwei Quellen möglich: 'searchString', 'userInput' + */ +var dlaKachelviewerGetObjectID = function (source, searchString) { + + // Regular Expression + var reObjectID + var reMetadataID + var rePhysPage = /physpage=([0-9]+)/ + + // Anpassen der Parameter an Quelle + if (source === 'userInput') { + reObjectID = /([A-Z]{0,2}[_]{0,1}[0-9]{1,8}[0-9Xx]{0,1})/ + } + else { + searchString = window.location.search + reObjectID = /object=([A-Z]{0,2}[_]{0,1}[0-9]{1,8}[0-9Xx]{0,1})/ + reMetadataID = /metadata=((?:[A-Z]{0,2}[_]{0,1}[0-9]{1,8}[0-9Xx]{0,1})|(?:false))/ + } + + // Prüfen ob Seite übergeben wurde + var physPage = searchString.match(rePhysPage) + + if (physPage && physPage[1]) { + console.log('PhysPage: ' + physPage[1]) + dlaKachelviewerPhysPage = physPage[1] + } + + // Objekt-ID + var objectID = searchString.match(reObjectID) + + if (objectID && objectID[1]) { + // Objektdaten laden + console.log('ObjectID: ' + objectID[1]) + document.getElementById("dla_kachelviewer_input_text").value = objectID[1] + dlaKachelviewerOsDataExists(objectID[1], 1) + } + else { + console.log('No ObjectID') + dlaKachelviewerShowError() + } + + // Metadaten-ID + if (objectID && objectID[1]) { + + var metadataID = searchString.match(reMetadataID) + if (metadataID && metadataID[1]) { + + if (metadataID[1] === 'false') { + console.log('MetadataID: false') + } + else { + console.log('MetadataID: ' + metadataID[1]) + dlaKachelviewerLoadKalliasData(metadataID[1]) + } + + } + else { + console.log('MetadataID: ' + objectID[1]) + dlaKachelviewerLoadKalliasData(objectID[1]) + } + + } + +} + +/** + * Laden der Kallias-Metadaten + */ +var dlaKachelviewerLoadKalliasData = function (metadataID) { + + // Bestand bestimmen + var kalliasBestand = metadataID.match(/^[A-Z]{2}/) + // Datensatznummer bestimmen + var kalliasDatensatznummer = metadataID.match(/[0-9]{1,8}/) + + // API Abfrage + var kalliasApi = 'https://www.dla-marbach.de/cgi-bin/aDISCGI/kallias_prod/lib/adis.htm?ADISDB=' + kalliasApi += kalliasBestand[0] + kalliasApi += '&ADISOI=' + kalliasApi += kalliasDatensatznummer[0] + kalliasApi += '&WEB=JA' + + var xhr = new XMLHttpRequest() + xhr.open('GET', kalliasApi, true) + xhr.onload = function (e) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + console.log('KalliasData loaded: ' + metadataID) + dlaKachelviewerParseKallias(xhr.responseText) + } + else { + console.log('No KalliasData loaded') + } + } + } + xhr.onerror = function (e) { + console.log('No KalliasData loaded') + } + xhr.send(null) + +} + +/** + * Parse Kallias Metadaten + */ +var dlaKachelviewerParseKallias = function (kalliasRawData) { + + // leider können alle getesten Parser (xhr.responseXML, htmlparser) nicht mit dem gelieferten HTML umgehen + // Identifizieren des span-Elements über RegEx (nicht empfohlen, daher wird RegEx so genau wie möglich definiert) + var re = /[\s\S]*?document\.close\(\)\s<\/script>\s<\/span>/ + var kalliasData = kalliasRawData.match(re)[0] + + // Manchmal werden mehrere Tabellen zurückgegeben, wir wollen nur die erste + var reTables = /([\s\S]+?)(?:){0,}([\s\S]+?)/ + kalliasData = kalliasData.replace(reTables, "$1$2") + + // Das Ergebnis kann auch einen Scripttag beinhalten + var reScript = // + kalliasData = kalliasData.replace(reScript, "") + + // Tabellenbreite korrigieren + var reWidth = /width="150%"/ + kalliasData = kalliasData.replace(reWidth, "width=\"100%\"") + + // HTML-Element erstellen + var kalliasHtmlElement = document.createElement('div') + kalliasHtmlElement.innerHTML = kalliasData + + // Metadaten-Tabelle analysieren (falls vorhanden) + var zellen = kalliasHtmlElement.querySelectorAll("td") + if (zellen.length > 0) { + // HTML säubern + for(var i = 0; i < zellen.length; i++) { + zellen[i].innerHTML = zellen[i].innerText || zellen[i].textContent + } + + // Kallias Tabelle in Metadaten einfügen + document.getElementById('dla_kachelviewer_metadaten').innerHTML = kalliasHtmlElement.innerHTML + } + else document.getElementById('dla_kachelviewer_metadaten').innerHTML = '' + +} + +/** + * Testen ob OpenSeadragon-Metadaten existieren + */ +var dlaKachelviewerOsDataExists = function (objectID, dlaKachelviewerStoragePattern) { + + // storage path + if (dlaKachelviewerStoragePattern === 1) dlaKachelviewerFullStoragePath = dlaKachelviewerStoragePath + objectID + '/tiles/' + else dlaKachelviewerFullStoragePath = dlaKachelviewerStoragePath + 'tiles/' + objectID + '/' + + var xhr = new XMLHttpRequest() + xhr.open('HEAD', dlaKachelviewerFullStoragePath + objectID + '.json', true) + xhr.onload = function (e) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + console.log('OsData found: ' + objectID) + dlaKachelviewerLoadOsData(objectID, dlaKachelviewerStoragePattern) + } + else { + if (dlaKachelviewerStoragePattern === 1) dlaKachelviewerOsDataExists(objectID, 2) + else { + console.log('No OsData found') + dlaKachelviewerShowError() + } + } + } + } + xhr.onerror = function (e) { + console.log('OsData: Error') + dlaKachelviewerShowError() + } + xhr.send(null) + +} + +/** + * Laden der OpenSeadragon-Metadaten + */ +var dlaKachelviewerLoadOsData = function (objectID) { + + var xhr = new XMLHttpRequest() + xhr.open('GET', dlaKachelviewerFullStoragePath + objectID + '.json', true) + xhr.onload = function (e) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { + console.log('OsData loaded: ' + objectID) + var osData = JSON.parse(xhr.responseText) + dlaKachelviewerSetupOpenSeadragon(objectID, osData) + } + else { + console.log('No OsData loaded') + dlaKachelviewerShowError() + } + } + } + xhr.onerror = function (e) { + dlaKachelviewerShowError() + } + xhr.send(null) + +} + +/** + * Setup OpenSeadragon + */ +var dlaKachelviewerViewer +var dlaKachelviewerSetupOpenSeadragon = function (objectID, osData) { + + // set visibility of elements + document.getElementById('dla_kachelviewer_error').style.visibility = 'hidden' + document.getElementById('dla_kachelviewer_input').style.visibility = 'visible' + document.getElementById('dla_kachelviewer_viewport').style.visibility = 'visible' + + // set page numbers + var totalPages = osData['files'].length + document.getElementById("dla_kachelviewer_seite").value = 1 + document.getElementById("dla_kachelviewer_seite").size = String(totalPages).length + document.getElementById("dla_kachelviewer_seite").maxLength = String(totalPages).length + document.getElementById("dla_kachelviewer_seiten").innerHTML = String(totalPages) + + // modify path + for (var i = 0; i < osData['files'].length; i++) { + osData['files'][i] = dlaKachelviewerFullStoragePath + osData['files'][i].replace(/\.[a-z]{3,4}$/i, '.dzi') + } + + // if dlaKachelviewerViewer exists destroy it + if (dlaKachelviewerViewer) dlaKachelviewerViewer.destroy() + + // create dlaKachelviewerViewer + dlaKachelviewerViewer = OpenSeadragon({ + id: 'dla_kachelviewer_content' + , prefixUrl: 'typo3conf/ext/dla_kachelviewer/Resources/Public/openseadragon/images/' + , tileSources: osData['files'] + , toolbar: 'dla_kachelviewer_toolbar' + , sequenceMode: true + , showReferenceStrip: true + }) + + /** + * add event handlers + */ + + // new image opened + dlaKachelviewerViewer.addHandler("open", function (data) { + + // Reload Metadata if ShowMetadata is true and MetadataID is a RegEx + if (dlaKachelviewerShowMetadata === true) { + + // Check if MetadataID exists and is a regex + if (dlaKachelviewerMetadataID && dlaKachelviewerMetadataID.substr(0, 3) === "re:") { + dlaKachelviewerLoadKalliasData(data.source.match(new RegExp(dlaKachelviewerMetadataID.substr(3)))[1]) + } + } + }) + + // page numbers + dlaKachelviewerViewer.addHandler("page", function (data) { + document.getElementById("dla_kachelviewer_seite").value = data.page + 1 + }) + var pageInput = document.getElementById("dla_kachelviewer_seite") + pageInput.oninput = function (e) { + var p = pageInput.value + if (p) { + if (pageInput.value > totalPages) p = totalPages + else if (pageInput.value < 1) p = 1 + dlaKachelviewerViewer.goToPage(p - 1) + } + } + pageInput.onpropertychange = pageInput.oninput + + /** + * Element fokussieren und Keys zur Navigation nutzen + */ + // fokussieren + document.getElementsByClassName('openseadragon-canvas')[0].focus() + + var dlaKachelviewerShiftKey = false + window.addEventListener("keydown", function (e) { + + // aktuelle Seite + var currentPage = dlaKachelviewerViewer.currentPage() + + // Welcher Key gedrückt? + var key = e.keyCode || e.which + + // Shift-Key Zustand speichern + if (key === 16) dlaKachelviewerShiftKey = true + else { + // Shift gedrückt? + if (e.shiftKey || dlaKachelviewerShiftKey) { + + // Shift - Pfeiltaste links + if (key === 37 || e.key === 'ArrowLeft') { + e.preventDefault() + if (currentPage > 0) dlaKachelviewerViewer.goToPage(currentPage - 1) + } + // Shift - Pfeiltaste rechts + if (key === 39 || e.key === 'ArrowRight') { + e.preventDefault() + if (currentPage < totalPages - 1) dlaKachelviewerViewer.goToPage(currentPage + 1) + } + } + } + + }) + + window.addEventListener("keyup", function (e) { + + // Welcher Key gedrückt? + var key = e.keyCode || e.which + // Shift-Key Zustand speichern + if (key === 16) dlaKachelviewerShiftKey = false + + }) + + /** + * Übergebenes Digitalisat aufrufen + */ + dlaKachelviewerViewer.goToPage(Math.max(0, Math.min(dlaKachelviewerPhysPage - 1, totalPages))) + +} + +/** + * Error Handling + */ +var dlaKachelviewerShowError = function () { + document.getElementById('dla_kachelviewer_error').style.visibility = 'visible' + document.getElementById('dla_kachelviewer_input').style.visibility = 'visible' + document.getElementById('dla_kachelviewer_viewport').style.visibility = 'hidden' +} + +/** + * Setup Object Search + */ +var dlaKachelviewerObjectInput = document.getElementById("dla_kachelviewer_input_submit") +dlaKachelviewerObjectInput.onclick = function (e) { + dlaKachelviewerGetObjectID('userInput', document.getElementById("dla_kachelviewer_input_text").value) +} + +/** + * Execute + */ +if (dlaKachelviewerObjectID) { + + document.getElementById("dla_kachelviewer_input_text").value = dlaKachelviewerObjectID + dlaKachelviewerOsDataExists(dlaKachelviewerObjectID, 1) + + // Show Metadata + if (dlaKachelviewerShowMetadata === true) { + + // Check if MetadataID exists + if (dlaKachelviewerMetadataID) { + + // Load if it is not a RegEx + if (dlaKachelviewerMetadataID.substr(0, 3) !== "re:") { + dlaKachelviewerLoadKalliasData(dlaKachelviewerMetadataID) + } + + } + + // Use ObjectID as default + else { + dlaKachelviewerLoadKalliasData(dlaKachelviewerObjectID) + } + } +} +else { + dlaKachelviewerGetObjectID('searchString') +} \ No newline at end of file diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/button_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/button_grouphover.png new file mode 100644 index 0000000..9db590e Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/button_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/button_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/button_hover.png new file mode 100644 index 0000000..645c241 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/button_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/button_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/button_pressed.png new file mode 100644 index 0000000..d5b1d7d Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/button_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/button_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/button_rest.png new file mode 100644 index 0000000..e232387 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/button_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_grouphover.png new file mode 100644 index 0000000..da9002b Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_hover.png new file mode 100644 index 0000000..705b3d3 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_pressed.png new file mode 100644 index 0000000..6fa182a Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_rest.png new file mode 100644 index 0000000..bfab643 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/fullpage_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/home_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/home_grouphover.png new file mode 100644 index 0000000..cb412ba Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/home_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/home_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/home_hover.png new file mode 100644 index 0000000..c8f860b Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/home_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/home_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/home_pressed.png new file mode 100644 index 0000000..00c349b Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/home_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/home_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/home_rest.png new file mode 100644 index 0000000..6ac397d Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/home_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/next_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/next_grouphover.png new file mode 100644 index 0000000..18c1a92 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/next_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/next_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/next_hover.png new file mode 100644 index 0000000..fdce582 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/next_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/next_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/next_pressed.png new file mode 100644 index 0000000..5297c52 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/next_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/next_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/next_rest.png new file mode 100644 index 0000000..e3c5a3c Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/next_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/previous_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_grouphover.png new file mode 100644 index 0000000..5e0fda1 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/previous_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_hover.png new file mode 100644 index 0000000..9f9efe6 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/previous_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_pressed.png new file mode 100644 index 0000000..75c7e7d Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/previous_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_rest.png new file mode 100644 index 0000000..902a7b4 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/previous_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_grouphover.png new file mode 100644 index 0000000..302ac62 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_hover.png new file mode 100644 index 0000000..e757d87 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_pressed.png new file mode 100644 index 0000000..1480b1a Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_rest.png new file mode 100644 index 0000000..f0b8654 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateleft_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_grouphover.png new file mode 100644 index 0000000..9e71371 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_hover.png new file mode 100644 index 0000000..08f1416 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_pressed.png new file mode 100644 index 0000000..351f824 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_rest.png new file mode 100644 index 0000000..d70468a Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/rotateright_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_grouphover.png new file mode 100644 index 0000000..98ecd29 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_hover.png new file mode 100644 index 0000000..c25bda4 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_pressed.png new file mode 100644 index 0000000..e617e03 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_rest.png new file mode 100644 index 0000000..4380589 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomin_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_grouphover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_grouphover.png new file mode 100644 index 0000000..b588ecf Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_grouphover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_hover.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_hover.png new file mode 100644 index 0000000..a132cb4 Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_hover.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_pressed.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_pressed.png new file mode 100644 index 0000000..679c5cd Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_pressed.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_rest.png b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_rest.png new file mode 100644 index 0000000..e3ac4ab Binary files /dev/null and b/dla_kachelviewer/Resources/Public/openseadragon/images/zoomout_rest.png differ diff --git a/dla_kachelviewer/Resources/Public/openseadragon/openseadragon.min.js b/dla_kachelviewer/Resources/Public/openseadragon/openseadragon.min.js new file mode 100644 index 0000000..d42ecf6 --- /dev/null +++ b/dla_kachelviewer/Resources/Public/openseadragon/openseadragon.min.js @@ -0,0 +1,15 @@ +//! openseadragon 2.3.0 +//! Built on 2017-07-14 +//! Git commit: v2.3.0-1-e4fd781 +//! http://openseadragon.github.io +//! License: http://openseadragon.github.io/license/ + + +function OpenSeadragon(a){return new OpenSeadragon.Viewer(a)}!function(a){a.version={versionStr:"2.3.0",major:parseInt("2",10),minor:parseInt("3",10),revision:parseInt("0",10)};var b={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},c=Object.prototype.toString,d=Object.prototype.hasOwnProperty;a.isFunction=function(b){return"function"===a.type(b)};a.isArray=Array.isArray||function(b){return"array"===a.type(b)};a.isWindow=function(a){return a&&"object"==typeof a&&"setInterval"in a};a.type=function(a){return null===a||void 0===a?String(a):b[c.call(a)]||"object"};a.isPlainObject=function(b){if(!b||"object"!==OpenSeadragon.type(b)||b.nodeType||a.isWindow(b))return!1;if(b.constructor&&!d.call(b,"constructor")&&!d.call(b.constructor.prototype,"isPrototypeOf"))return!1;var c;for(var e in b)c=e;return void 0===c||d.call(b,c)};a.isEmptyObject=function(a){for(var b in a)return!1;return!0};a.freezeObject=function(b){Object.freeze?a.freezeObject=Object.freeze:a.freezeObject=function(a){return a};return a.freezeObject(b)};a.supportsCanvas=function(){var b=document.createElement("canvas");return!(!a.isFunction(b.getContext)||!b.getContext("2d"))}();a.isCanvasTainted=function(a){var b=!1;try{a.getContext("2d").getImageData(0,0,1,1)}catch(a){b=!0}return b};a.pixelDensityRatio=function(){if(a.supportsCanvas){var b=document.createElement("canvas").getContext("2d");var c=window.devicePixelRatio||1;var d=b.webkitBackingStorePixelRatio||b.mozBackingStorePixelRatio||b.msBackingStorePixelRatio||b.oBackingStorePixelRatio||b.backingStorePixelRatio||1;return Math.max(c,1)/d}return 1}()}(OpenSeadragon);!function($){function getOffsetParent(a,b){return b&&a!=document.body?document.body:a.offsetParent}$.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=arguments.length,i=!1,j=1;if("boolean"==typeof g){i=g;g=arguments[1]||{};j=2}"object"==typeof g||OpenSeadragon.isFunction(g)||(g={});if(h===j){g=this;--j}for(;j=c.x&&b.x=c.y},getEvent:function(a){a?$.getEvent=function(a){return a}:$.getEvent=function(){return window.event};return $.getEvent(a)},getMousePosition:function(a){if("number"==typeof a.pageX)$.getMousePosition=function(a){var b=new $.Point;a=$.getEvent(a);b.x=a.pageX;b.y=a.pageY;return b};else{if("number"!=typeof a.clientX)throw new Error("Unknown event mouse position, no known technique.");$.getMousePosition=function(a){var b=new $.Point;a=$.getEvent(a);b.x=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;b.y=a.clientY+document.body.scrollTop+document.documentElement.scrollTop;return b}}return $.getMousePosition(a)},getPageScroll:function(){var a=document.documentElement||{},b=document.body||{};if("number"==typeof window.pageXOffset)$.getPageScroll=function(){return new $.Point(window.pageXOffset,window.pageYOffset)};else if(b.scrollLeft||b.scrollTop)$.getPageScroll=function(){return new $.Point(document.body.scrollLeft,document.body.scrollTop)};else{if(!a.scrollLeft&&!a.scrollTop)return new $.Point(0,0);$.getPageScroll=function(){return new $.Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}}return $.getPageScroll()},setPageScroll:function(a){if("undefined"!=typeof window.scrollTo)$.setPageScroll=function(a){window.scrollTo(a.x,a.y)};else{var b=$.getPageScroll();if(b.x===a.x&&b.y===a.y)return;document.body.scrollLeft=a.x;document.body.scrollTop=a.y;var c=$.getPageScroll();if(c.x!==b.x&&c.y!==b.y){$.setPageScroll=function(a){document.body.scrollLeft=a.x;document.body.scrollTop=a.y};return}document.documentElement.scrollLeft=a.x;document.documentElement.scrollTop=a.y;c=$.getPageScroll();if(c.x!==b.x&&c.y!==b.y){$.setPageScroll=function(a){document.documentElement.scrollLeft=a.x;document.documentElement.scrollTop=a.y};return}$.setPageScroll=function(a){}}return $.setPageScroll(a)},getWindowSize:function(){var a=document.documentElement||{},b=document.body||{};if("number"==typeof window.innerWidth)$.getWindowSize=function(){return new $.Point(window.innerWidth,window.innerHeight)};else if(a.clientWidth||a.clientHeight)$.getWindowSize=function(){return new $.Point(document.documentElement.clientWidth,document.documentElement.clientHeight)};else{if(!b.clientWidth&&!b.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(a){a=$.getElement(a);var b=[$.makeNeutralElement("div"),$.makeNeutralElement("div"),$.makeNeutralElement("div")];$.extend(b[0].style,{display:"table",height:"100%",width:"100%"});$.extend(b[1].style,{display:"table-row"});$.extend(b[2].style,{display:"table-cell",verticalAlign:"middle",textAlign:"center"});b[0].appendChild(b[1]);b[1].appendChild(b[2]);b[2].appendChild(a);return b[0]},makeNeutralElement:function(a){var b=document.createElement(a),c=b.style;c.background="transparent none";c.border="none";c.margin="0px";c.padding="0px";c.position="static";return b},now:function(){Date.now?$.now=Date.now:$.now=function(){return(new Date).getTime()};return $.now()},makeTransparentImage:function(a){$.makeTransparentImage=function(a){var b=$.makeNeutralElement("img");b.src=a;return b};$.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<7&&($.makeTransparentImage=function(a){var b=$.makeNeutralElement("img"),c=null;c=$.makeNeutralElement("span");c.style.display="inline-block";b.onload=function(){c.style.width=c.style.width||b.width+"px";c.style.height=c.style.height||b.height+"px";b.onload=null;b=null};b.src=a;c.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='scale')";return c});return $.makeTransparentImage(a)},setElementOpacity:function(a,b,c){var d,e;a=$.getElement(a);c&&!$.Browser.alpha&&(b=Math.round(b));if($.Browser.opacity)a.style.opacity=b<1?b:"";else if(b<1){d=Math.round(100*b);e="alpha(opacity="+d+")";a.style.filter=e}else a.style.filter=""},setElementTouchActionNone:function(a){a=$.getElement(a);"undefined"!=typeof a.style.touchAction?a.style.touchAction="none":"undefined"!=typeof a.style.msTouchAction&&(a.style.msTouchAction="none")},addClass:function(a,b){a=$.getElement(a);a.className?(" "+a.className+" ").indexOf(" "+b+" ")===-1&&(a.className+=" "+b):a.className=b},indexOf:function(a,b,c){Array.prototype.indexOf?this.indexOf=function(a,b,c){return a.indexOf(b,c)}:this.indexOf=function(a,b,c){var d,e,f=c?c:0;if(!a)throw new TypeError;e=a.length;if(0===e||f>=e)return-1;f<0&&(f=e-Math.abs(f));for(d=f;d=200&&h.status<300||0===h.status&&"http:"!==g&&"https:"!==g)b(h);else{$.console.log("AJAX request returned %d: %s",h.status,a);$.isFunction(c)&&c(h)}}};try{h.open("GET",a,!0);f&&(h.responseType=f);if(e)for(var i in e)e.hasOwnProperty(i)&&e[i]&&h.setRequestHeader(i,e[i]);d&&(h.withCredentials=!0);h.send(null)}catch(d){var j=d.message;var k=$.Browser.vendor==$.BROWSERS.IE&&$.Browser.version<10;k&&"undefined"!=typeof d.number&&d.number==-2147024891&&(j+="\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain");$.console.log("%s while making AJAX request: %s",d.name,j);h.onreadystatechange=function(){};if(window.XDomainRequest){var l=new XDomainRequest;if(l){l.onload=function(a){$.isFunction(b)&&b({responseText:l.responseText,status:200,statusText:"OK"})};l.onerror=function(a){$.isFunction(c)&&c({responseText:l.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{l.open("GET",a);l.send()}catch(a){$.isFunction(c)&&c(h,d)}}}else $.isFunction(c)&&c(h,d)}return h},jsonp:function(a){var b,c=a.url,d=document.head||document.getElementsByTagName("head")[0]||document.documentElement,e=a.callbackName||"openseadragon"+$.now(),f=window[e],g="$1"+e+"$2",h=a.param||"callback",i=a.callback;c=c.replace(/(\=)\?(&|$)|\?\?/i,g);c+=(/\?/.test(c)?"&":"?")+h+"="+e;window[e]=function(a){if(f)window[e]=f;else try{delete window[e]}catch(a){}i&&$.isFunction(i)&&i(a)};b=document.createElement("script");void 0===a.async&&!1===a.async||(b.async="async");a.scriptCharset&&(b.charset=a.scriptCharset);b.src=c;b.onload=b.onreadystatechange=function(a,c){if(c||!b.readyState||/loaded|complete/.test(b.readyState)){b.onload=b.onreadystatechange=null;d&&b.parentNode&&d.removeChild(b);b=void 0}};d.insertBefore(b,d.firstChild)},createFromDZI:function(){throw"OpenSeadragon.createFromDZI is deprecated, use Viewer.open."},parseXml:function(a){if(window.DOMParser)$.parseXml=function(a){var b,c=null;b=new DOMParser;c=b.parseFromString(a,"text/xml");return c};else{if(!window.ActiveXObject)throw new Error("Browser doesn't support XML DOM.");$.parseXml=function(a){var b=null;b=new ActiveXObject("Microsoft.XMLDOM");b.async=!1;b.loadXML(a);return b}}return $.parseXml(a)},parseJSON:function(string){window.JSON&&window.JSON.parse?$.parseJSON=window.JSON.parse:$.parseJSON=function(string){return eval("("+string+")")};return $.parseJSON(string)},imageFormatSupported:function(a){a=a?a:"";return!!FILEFORMATS[a.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 a,b=navigator.appVersion,c=navigator.userAgent;switch(navigator.appName){case"Microsoft Internet Explorer":if(window.attachEvent&&window.ActiveXObject){$.Browser.vendor=$.BROWSERS.IE;$.Browser.version=parseFloat(c.substring(c.indexOf("MSIE")+5,c.indexOf(";",c.indexOf("MSIE"))))}break;case"Netscape":if(window.addEventListener)if(c.indexOf("Firefox")>=0){$.Browser.vendor=$.BROWSERS.FIREFOX;$.Browser.version=parseFloat(c.substring(c.indexOf("Firefox")+8))}else if(c.indexOf("Safari")>=0){$.Browser.vendor=c.indexOf("Chrome")>=0?$.BROWSERS.CHROME:$.BROWSERS.SAFARI;$.Browser.version=parseFloat(c.substring(c.substring(0,c.indexOf("Safari")).lastIndexOf("/")+1,c.indexOf("Safari")))}else{a=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})");if(null!==a.exec(c)){$.Browser.vendor=$.BROWSERS.IE;$.Browser.version=parseFloat(RegExp.$1)}}break;case"Opera":$.Browser.vendor=$.BROWSERS.OPERA;$.Browser.version=parseFloat(b)}var d,e,f,g=window.location.search.substring(1),h=g.split("&");for(f=0;f0&&(URLPARAMS[d.substring(0,e)]=decodeURIComponent(d.substring(e+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(a){};$.console=window.console||{log:nullfunction,debug:nullfunction,info:nullfunction,warn:nullfunction,error:nullfunction,assert:nullfunction};!function(a){var b=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame;var c=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame;if(b&&c){$.requestAnimationFrame=function(){return b.apply(a,arguments)};$.cancelAnimationFrame=function(){return c.apply(a,arguments)}}else{var d,e=[],f=[],g=0;$.requestAnimationFrame=function(a){e.push([++g,a]);d||(d=setInterval(function(){if(e.length){var a=$.now();var b=f;f=e;e=b;for(;f.length;)f.shift()[1](a)}else{clearInterval(d);d=void 0}},20));return g};$.cancelAnimationFrame=function(a){var b,c;for(b=0,c=e.length;b0){a.removeEvent(a.MouseTracker.captureElement,"mousemove",d.mousemovecaptured,!0);a.removeEvent(a.MouseTracker.captureElement,"mouseup",d.mouseupcaptured,!0);a.removeEvent(a.MouseTracker.captureElement,a.MouseTracker.unprefixedPointerEvents?"pointermove":"MSPointerMove",d.pointermovecaptured,!0);a.removeEvent(a.MouseTracker.captureElement,a.MouseTracker.unprefixedPointerEvents?"pointerup":"MSPointerUp",d.pointerupcaptured,!0);a.removeEvent(a.MouseTracker.captureElement,"touchmove",d.touchmovecaptured,!0);a.removeEvent(a.MouseTracker.captureElement,"touchend",d.touchendcaptured,!0);d.activePointersLists[c].captureCount=0}for(c=0;c0){for(d=0;d0){ja(a,b,f,0);c.captureCount=1;g(a,c.type);ha(a,b,f)}}}function M(b,c){var d,e,g,h,j=c.changedTouches.length,k=[],l=b.getActivePointersListByType("touch");d=a.now();if(l.getLength()>c.touches.length-j){a.console.warn("Tracked touch contact count doesn't match event.touches.length. Removing all tracked touch pointers.");L(b,c,l)}for(e=0;e8||"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";a.MouseTracker.supportsMouseCapture=function(){var b=document.createElement("div");return a.isFunction(b.setCapture)&&a.isFunction(b.releaseCapture)}();a.MouseTracker.subscribeEvents=["click","dblclick","keydown","keyup","keypress","focus","blur",a.MouseTracker.wheelEventName];"DOMMouseScroll"==a.MouseTracker.wheelEventName&&a.MouseTracker.subscribeEvents.push("MozMousePixelScroll");if(window.PointerEvent&&(window.navigator.pointerEnabled||a.Browser.vendor!==a.BROWSERS.IE)){a.MouseTracker.havePointerEvents=!0;a.MouseTracker.subscribeEvents.push("pointerover","pointerout","pointerdown","pointerup","pointermove","pointercancel");a.MouseTracker.unprefixedPointerEvents=!0;navigator.maxTouchPoints?a.MouseTracker.maxTouchPoints=navigator.maxTouchPoints:a.MouseTracker.maxTouchPoints=0;a.MouseTracker.haveMouseEnter=!1}else if(window.MSPointerEvent&&window.navigator.msPointerEnabled){a.MouseTracker.havePointerEvents=!0;a.MouseTracker.subscribeEvents.push("MSPointerOver","MSPointerOut","MSPointerDown","MSPointerUp","MSPointerMove","MSPointerCancel");a.MouseTracker.unprefixedPointerEvents=!1;navigator.msMaxTouchPoints?a.MouseTracker.maxTouchPoints=navigator.msMaxTouchPoints:a.MouseTracker.maxTouchPoints=0;a.MouseTracker.haveMouseEnter=!1}else{a.MouseTracker.havePointerEvents=!1;if(a.Browser.vendor===a.BROWSERS.IE&&a.Browser.version<9){a.MouseTracker.subscribeEvents.push("mouseenter","mouseleave");a.MouseTracker.haveMouseEnter=!0}else{a.MouseTracker.subscribeEvents.push("mouseover","mouseout");a.MouseTracker.haveMouseEnter=!1}a.MouseTracker.subscribeEvents.push("mousedown","mouseup","mousemove");"ontouchstart"in window&&a.MouseTracker.subscribeEvents.push("touchstart","touchend","touchmove","touchcancel");"ongesturestart"in window&&a.MouseTracker.subscribeEvents.push("gesturestart","gesturechange");a.MouseTracker.mousePointerId="legacy-mouse";a.MouseTracker.maxTouchPoints=10}a.MouseTracker.GesturePointList=function(a){this._gPoints=[];this.type=a;this.buttons=0;this.contacts=0;this.clicks=0;this.captureCount=0};a.MouseTracker.GesturePointList.prototype={getLength:function(){return this._gPoints.length},asArray:function(){return this._gPoints},add:function(a){return this._gPoints.push(a)},removeById:function(a){var b,c=this._gPoints.length;for(b=0;b1&&("mouse"===this.type||"pen"===this.type)&&(this.contacts=1)},removeContact:function(){--this.contacts;this.contacts<0&&(this.contacts=0)}};var qa=function(){try{return window.self!==window.top}catch(a){return!0}}()}(OpenSeadragon);!function(a){a.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4,ABSOLUTE:5};a.Control=function(b,c,d){var e=b.parentNode;if("number"==typeof c){a.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");c={anchor:c}}c.attachToViewer="undefined"==typeof c.attachToViewer||c.attachToViewer;this.autoFade="undefined"==typeof c.autoFade||c.autoFade;this.element=b;this.anchor=c.anchor;this.container=d;if(this.anchor==a.ControlAnchor.ABSOLUTE){this.wrapper=a.makeNeutralElement("div");this.wrapper.style.position="absolute";this.wrapper.style.top="number"==typeof c.top?c.top+"px":c.top;this.wrapper.style.left="number"==typeof c.left?c.left+"px":c.left;this.wrapper.style.height="number"==typeof c.height?c.height+"px":c.height;this.wrapper.style.width="number"==typeof c.width?c.width+"px":c.width;this.wrapper.style.margin="0px";this.wrapper.style.padding="0px";this.element.style.position="relative";this.element.style.top="0px";this.element.style.left="0px";this.element.style.height="100%";this.element.style.width="100%"}else{this.wrapper=a.makeNeutralElement("div");this.wrapper.style.display="inline-block";this.anchor==a.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%")}this.wrapper.appendChild(this.element);c.attachToViewer?this.anchor==a.ControlAnchor.TOP_RIGHT||this.anchor==a.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.wrapper,this.container.firstChild):this.container.appendChild(this.wrapper):e.appendChild(this.wrapper)};a.Control.prototype={destroy:function(){this.wrapper.removeChild(this.element);this.container.removeChild(this.wrapper)},isVisible:function(){return"none"!=this.wrapper.style.display},setVisible:function(b){this.wrapper.style.display=b?this.anchor==a.ControlAnchor.ABSOLUTE?"block":"inline-block":"none"},setOpacity:function(b){this.element[a.SIGNAL]&&a.Browser.vendor==a.BROWSERS.IE?a.setElementOpacity(this.element,b,!0):a.setElementOpacity(this.wrapper,b,!0)}}}(OpenSeadragon);!function(a){function b(a,b){var c,d=a.controls;for(c=d.length-1;c>=0;c--)if(d[c].element==b)return c;return-1}a.ControlDock=function(b){var c,d,e=["topleft","topright","bottomright","bottomleft"];a.extend(!0,this,{id:"controldock-"+a.now()+"-"+Math.floor(1e6*Math.random()),container:a.makeNeutralElement("div"),controls:[]},b);this.container.onsubmit=function(){return!1};if(this.element){this.element=a.getElement(this.element);this.element.appendChild(this.container);this.element.style.position="relative";this.container.style.width="100%";this.container.style.height="100%"}for(d=0;d=0)){switch(d.anchor){case a.ControlAnchor.TOP_RIGHT:e=this.controls.topright;c.style.position="relative";c.style.paddingRight="0px";c.style.paddingTop="0px";break;case a.ControlAnchor.BOTTOM_RIGHT:e=this.controls.bottomright;c.style.position="relative";c.style.paddingRight="0px";c.style.paddingBottom="0px";break;case a.ControlAnchor.BOTTOM_LEFT:e=this.controls.bottomleft;c.style.position="relative";c.style.paddingLeft="0px";c.style.paddingBottom="0px";break;case a.ControlAnchor.TOP_LEFT:e=this.controls.topleft;c.style.position="relative";c.style.paddingLeft="0px";c.style.paddingTop="0px";break;case a.ControlAnchor.ABSOLUTE:e=this.container;c.style.margin="0px";c.style.padding="0px";break;default:case a.ControlAnchor.NONE:e=this.container;c.style.margin="0px";c.style.padding="0px"}this.controls.push(new a.Control(c,d,e));c.style.display="inline-block"}},removeControl:function(c){c=a.getElement(c);var d=b(this,c);if(d>=0){this.controls[d].destroy();this.controls.splice(d,1)}return this},clearControls:function(){for(;this.controls.length>0;)this.controls.pop().destroy();return this},areControlsEnabled:function(){var a;for(a=this.controls.length-1;a>=0;a--)if(this.controls[a].isVisible())return!0;return!1},setControlsEnabled:function(a){var b;for(b=this.controls.length-1;b>=0;b--)this.controls[b].setVisible(a);return this}}}(OpenSeadragon);!function(a){a.Placement=a.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(a){function b(b){b=a.getElement(b);return new a.Point(0===b.clientWidth?1:b.clientWidth,0===b.clientHeight?1:b.clientHeight)}function c(b,c,d,e,f){function g(a,b){if(a.ready)e(a);else{a.addHandler("ready",function(){e(a)});a.addHandler("open-failed",function(a){f({message:a.message,source:b})})}}var h=b;if("string"==a.type(c))if(c.match(/^\s*<.*>\s*$/))c=a.parseXml(c);else if(c.match(/^\s*[\{\[].*[\}\]]\s*$/))try{var i=a.parseJSON(c);c=i}catch(a){}setTimeout(function(){if("string"==a.type(c)){c=new a.TileSource({url:c,crossOriginPolicy:void 0!==d.crossOriginPolicy?d.crossOriginPolicy:b.crossOriginPolicy,ajaxWithCredentials:b.ajaxWithCredentials,ajaxHeaders:b.ajaxHeaders,useCanvas:b.useCanvas,success:function(a){e(a.tileSource)}});c.addHandler("open-failed",function(a){f(a)})}else if(a.isPlainObject(c)||c.nodeType){void 0!==c.crossOriginPolicy||void 0===d.crossOriginPolicy&&void 0===b.crossOriginPolicy||(c.crossOriginPolicy=void 0!==d.crossOriginPolicy?d.crossOriginPolicy:b.crossOriginPolicy);void 0===c.ajaxWithCredentials&&(c.ajaxWithCredentials=b.ajaxWithCredentials);void 0===c.useCanvas&&(c.useCanvas=b.useCanvas);if(a.isFunction(c.getTileUrl)){var i=new a.TileSource(c);i.getTileUrl=c.getTileUrl;e(i)}else{var j=a.TileSource.determineType(h,c);if(!j){f({message:"Unable to load TileSource",source:c});return}var k=j.prototype.configure.apply(h,[c]);g(new j(k),c)}}else g(c,c)})}function d(b,c){if(c instanceof a.Overlay)return c;var d=null;if(c.element)d=a.getElement(c.element);else{var e=c.id?c.id:"openseadragon-overlay-"+Math.floor(1e7*Math.random());d=a.getElement(c.id);if(!d){d=document.createElement("a");d.href="#/overlay/"+e}d.id=e;a.addClass(d,c.className?c.className:"openseadragon-overlay")}var f=c.location;var g=c.width;var h=c.height;if(!f){var i=c.x;var j=c.y;if(void 0!==c.px){var k=b.viewport.imageToViewportRectangle(new a.Rect(c.px,c.py,g||0,h||0));i=k.x;j=k.y;g=void 0!==g?k.width:void 0;h=void 0!==h?k.height:void 0}f=new a.Point(i,j)}var l=c.placement;l&&"string"===a.type(l)&&(l=a.Placement[c.placement.toUpperCase()]);return new a.Overlay({element:d,location:f,placement:l,onDraw:c.onDraw,checkResize:c.checkResize,width:g,height:h,rotationMode:c.rotationMode})}function e(a,b){var c;for(c=a.length-1;c>=0;c--)if(a[c].element===b)return c;return-1}function f(b,c){return a.requestAnimationFrame(function(){c(b)})}function g(b){a.requestAnimationFrame(function(){i(b)})}function h(b){if(b.autoHideControls){b.controlsShouldFade=!0;b.controlsFadeBeginTime=a.now()+b.controlsFadeDelay;window.setTimeout(function(){g(b)},b.controlsFadeDelay)}}function i(b){var c,d,e,f;if(b.controlsShouldFade){c=a.now();d=c-b.controlsFadeBeginTime;e=1-d/b.controlsFadeLength;e=Math.min(1,e);e=Math.max(0,e);for(f=b.controls.length-1;f>=0;f--)b.controls[f].autoFade&&b.controls[f].setOpacity(e);e>0&&g(b)}}function j(a){var b;a.controlsShouldFade=!1;for(b=a.controls.length-1;b>=0;b--)a.controls[b].setOpacity(1)}function k(){j(this)}function l(){h(this)}function m(b){if(b.preventDefaultAction||b.ctrl||b.alt||b.meta)return!0;switch(b.keyCode){case 38:b.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(0,-40)));this.viewport.applyConstraints();return!1;case 40:b.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(0,40)));this.viewport.applyConstraints();return!1;case 37:this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(-40,0)));this.viewport.applyConstraints();return!1;case 39:this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(40,0)));this.viewport.applyConstraints();return!1;default:return!0}}function n(b){if(b.preventDefaultAction||b.ctrl||b.alt||b.meta)return!0;switch(b.keyCode){case 43:case 61:this.viewport.zoomBy(1.1);this.viewport.applyConstraints();return!1;case 45:this.viewport.zoomBy(.9);this.viewport.applyConstraints();return!1;case 48:this.viewport.goHome();this.viewport.applyConstraints();return!1;case 119:case 87:b.shift?this.viewport.zoomBy(1.1):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(0,-40)));this.viewport.applyConstraints();return!1;case 115:case 83:b.shift?this.viewport.zoomBy(.9):this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(0,40)));this.viewport.applyConstraints();return!1;case 97:this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(-40,0)));this.viewport.applyConstraints();return!1;case 100:this.viewport.panBy(this.viewport.deltaPointsFromPixels(new a.Point(40,0)));this.viewport.applyConstraints();return!1;default:return!0}}function o(a){var b;var c=document.activeElement==this.canvas;c||this.canvas.focus();var d={tracker:a.eventSource,position:a.position,quick:a.quick,shift:a.shift,originalEvent:a.originalEvent,preventDefaultAction:a.preventDefaultAction};this.raiseEvent("canvas-click",d);if(!d.preventDefaultAction&&this.viewport&&a.quick){b=this.gestureSettingsByDeviceType(a.pointerType);if(b.clickToZoom){this.viewport.zoomBy(a.shift?1/this.zoomPerClick:this.zoomPerClick,this.viewport.pointFromPixel(a.position,!0));this.viewport.applyConstraints()}}}function p(a){var b;if(!a.preventDefaultAction&&this.viewport){b=this.gestureSettingsByDeviceType(a.pointerType);if(b.dblClickToZoom){this.viewport.zoomBy(a.shift?1/this.zoomPerClick:this.zoomPerClick,this.viewport.pointFromPixel(a.position,!0));this.viewport.applyConstraints()}}this.raiseEvent("canvas-double-click",{tracker:a.eventSource,position:a.position,shift:a.shift,originalEvent:a.originalEvent})}function q(a){var b;var c={tracker:a.eventSource,position:a.position,delta:a.delta,speed:a.speed,direction:a.direction,shift:a.shift,originalEvent:a.originalEvent,preventDefaultAction:a.preventDefaultAction};this.raiseEvent("canvas-drag",c);if(!a.preventDefaultAction&&this.viewport){b=this.gestureSettingsByDeviceType(a.pointerType);this.panHorizontal||(a.delta.x=0);this.panVertical||(a.delta.y=0);if(this.constrainDuringPan){var d=this.viewport.deltaPointsFromPixels(a.delta.negate());this.viewport.centerSpringX.target.value+=d.x;this.viewport.centerSpringY.target.value+=d.y;var e=this.viewport.getBounds();var f=this.viewport.getConstrainedBounds();this.viewport.centerSpringX.target.value-=d.x;this.viewport.centerSpringY.target.value-=d.y;e.x!=f.x&&(a.delta.x=0);e.y!=f.y&&(a.delta.y=0)}this.viewport.panBy(this.viewport.deltaPointsFromPixels(a.delta.negate()),b.flickEnabled&&!this.constrainDuringPan)}}function r(b){if(!b.preventDefaultAction&&this.viewport){var c=this.gestureSettingsByDeviceType(b.pointerType);if(c.flickEnabled&&b.speed>=c.flickMinSpeed){var d=0;this.panHorizontal&&(d=c.flickMomentum*b.speed*Math.cos(b.direction));var e=0;this.panVertical&&(e=c.flickMomentum*b.speed*Math.sin(b.direction));var f=this.viewport.pixelFromPoint(this.viewport.getCenter(!0));var g=this.viewport.pointFromPixel(new a.Point(f.x-d,f.y-e));this.viewport.panTo(g,!1)}this.viewport.applyConstraints()}this.raiseEvent("canvas-drag-end",{ +tracker:b.eventSource,position:b.position,speed:b.speed,direction:b.direction,shift:b.shift,originalEvent:b.originalEvent})}function s(a){this.raiseEvent("canvas-enter",{tracker:a.eventSource,pointerType:a.pointerType,position:a.position,buttons:a.buttons,pointers:a.pointers,insideElementPressed:a.insideElementPressed,buttonDownAny:a.buttonDownAny,originalEvent:a.originalEvent})}function t(b){window.location!=window.parent.location&&a.MouseTracker.resetAllMouseTrackers();this.raiseEvent("canvas-exit",{tracker:b.eventSource,pointerType:b.pointerType,position:b.position,buttons:b.buttons,pointers:b.pointers,insideElementPressed:b.insideElementPressed,buttonDownAny:b.buttonDownAny,originalEvent:b.originalEvent})}function u(a){this.raiseEvent("canvas-press",{tracker:a.eventSource,pointerType:a.pointerType,position:a.position,insideElementPressed:a.insideElementPressed,insideElementReleased:a.insideElementReleased,originalEvent:a.originalEvent})}function v(a){this.raiseEvent("canvas-release",{tracker:a.eventSource,pointerType:a.pointerType,position:a.position,insideElementPressed:a.insideElementPressed,insideElementReleased:a.insideElementReleased,originalEvent:a.originalEvent})}function w(a){this.raiseEvent("canvas-nonprimary-press",{tracker:a.eventSource,position:a.position,pointerType:a.pointerType,button:a.button,buttons:a.buttons,originalEvent:a.originalEvent})}function x(a){this.raiseEvent("canvas-nonprimary-release",{tracker:a.eventSource,position:a.position,pointerType:a.pointerType,button:a.button,buttons:a.buttons,originalEvent:a.originalEvent})}function y(a){var b,c,d,e;if(!a.preventDefaultAction&&this.viewport){b=this.gestureSettingsByDeviceType(a.pointerType);if(b.pinchToZoom){c=this.viewport.pointFromPixel(a.center,!0);d=this.viewport.pointFromPixel(a.lastCenter,!0);e=d.minus(c);this.panHorizontal||(e.x=0);this.panVertical||(e.y=0);this.viewport.zoomBy(a.distance/a.lastDistance,c,!0);this.viewport.panBy(e,!0);this.viewport.applyConstraints()}if(b.pinchRotate){var f=Math.atan2(a.gesturePoints[0].currentPos.y-a.gesturePoints[1].currentPos.y,a.gesturePoints[0].currentPos.x-a.gesturePoints[1].currentPos.x);var g=Math.atan2(a.gesturePoints[0].lastPos.y-a.gesturePoints[1].lastPos.y,a.gesturePoints[0].lastPos.x-a.gesturePoints[1].lastPos.x);this.viewport.setRotation(this.viewport.getRotation()+(f-g)*(180/Math.PI))}}this.raiseEvent("canvas-pinch",{tracker:a.eventSource,gesturePoints:a.gesturePoints,lastCenter:a.lastCenter,center:a.center,lastDistance:a.lastDistance,distance:a.distance,shift:a.shift,originalEvent:a.originalEvent});return!1}function z(b){var c,d,e,f;e=a.now();f=e-this._lastScrollTime;if(f>this.minScrollDeltaTime){this._lastScrollTime=e;if(!b.preventDefaultAction&&this.viewport){c=this.gestureSettingsByDeviceType(b.pointerType);if(c.scrollToZoom){d=Math.pow(this.zoomPerScroll,b.scroll);this.viewport.zoomBy(d,this.viewport.pointFromPixel(b.position,!0));this.viewport.applyConstraints()}}this.raiseEvent("canvas-scroll",{tracker:b.eventSource,position:b.position,scroll:b.scroll,shift:b.shift,originalEvent:b.originalEvent});if(c&&c.scrollToZoom)return!1}else{c=this.gestureSettingsByDeviceType(b.pointerType);if(c&&c.scrollToZoom)return!1}}function A(a){U[this.hash].mouseInside=!0;j(this);this.raiseEvent("container-enter",{tracker:a.eventSource,position:a.position,buttons:a.buttons,pointers:a.pointers,insideElementPressed:a.insideElementPressed,buttonDownAny:a.buttonDownAny,originalEvent:a.originalEvent})}function B(a){if(a.pointers<1){U[this.hash].mouseInside=!1;U[this.hash].animating||h(this)}this.raiseEvent("container-exit",{tracker:a.eventSource,position:a.position,buttons:a.buttons,pointers:a.pointers,insideElementPressed:a.insideElementPressed,buttonDownAny:a.buttonDownAny,originalEvent:a.originalEvent})}function C(a){D(a);a.isOpen()?a._updateRequestId=f(a,C):a._updateRequestId=!1}function D(a){if(!a._opening){if(a.autoResize){var c=b(a.container);var d=U[a.hash].prevContainerSize;if(!c.equals(d)){var e=a.viewport;if(a.preserveImageSizeOnResize){var f=d.x/c.x;var g=e.getZoom()*f;var i=e.getCenter();e.resize(c,!1);e.zoomTo(g,null,!0);e.panTo(i,!0)}else{var k=e.getBounds();e.resize(c,!0);e.fitBoundsWithConstraints(k,!0)}U[a.hash].prevContainerSize=c;U[a.hash].forceRedraw=!0}}var l=a.viewport.update();var m=a.world.update()||l;l&&a.raiseEvent("viewport-change");a.referenceStrip&&(m=a.referenceStrip.update(a.viewport)||m);if(!U[a.hash].animating&&m){a.raiseEvent("animation-start");j(a)}if(m||U[a.hash].forceRedraw||a.world.needsDraw()){E(a);a._drawOverlays();a.navigator&&a.navigator.update(a.viewport);U[a.hash].forceRedraw=!1;m&&a.raiseEvent("animation")}if(U[a.hash].animating&&!m){a.raiseEvent("animation-finish");U[a.hash].mouseInside||h(a)}U[a.hash].animating=m}}function E(a){a.imageLoader.clear();a.drawer.clear();a.world.draw();a.raiseEvent("update-viewport",{})}function F(a,b){return a?a+b:b}function G(){U[this.hash].lastZoomTime=a.now();U[this.hash].zoomFactor=this.zoomPerSecond;U[this.hash].zooming=!0;J(this)}function H(){U[this.hash].lastZoomTime=a.now();U[this.hash].zoomFactor=1/this.zoomPerSecond;U[this.hash].zooming=!0;J(this)}function I(){U[this.hash].zooming=!1}function J(b){a.requestAnimationFrame(a.delegate(b,K))}function K(){var b,c,d;if(U[this.hash].zooming&&this.viewport){b=a.now();c=b-U[this.hash].lastZoomTime;d=Math.pow(U[this.hash].zoomFactor,c/1e3);this.viewport.zoomBy(d);this.viewport.applyConstraints();U[this.hash].lastZoomTime=b;J(this)}}function L(){if(this.viewport){U[this.hash].zooming=!1;this.viewport.zoomBy(this.zoomPerClick/1);this.viewport.applyConstraints()}}function M(){if(this.viewport){U[this.hash].zooming=!1;this.viewport.zoomBy(1/this.zoomPerClick);this.viewport.applyConstraints()}}function N(){this.buttons.emulateEnter();this.buttons.emulateExit()}function O(){this.viewport&&this.viewport.goHome()}function P(){this.isFullPage()&&!a.isFullScreen()?this.setFullPage(!1):this.setFullScreen(!this.isFullPage());this.buttons&&this.buttons.emulateExit();this.fullPageButton.element.focus();this.viewport&&this.viewport.applyConstraints()}function Q(){if(this.viewport){var a=this.viewport.getRotation();0===a?a=270:a-=90;this.viewport.setRotation(a)}}function R(){if(this.viewport){var a=this.viewport.getRotation();270===a?a=0:a+=90;this.viewport.setRotation(a)}}function S(){var a=this._sequenceIndex-1;this.navPrevNextWrap&&a<0&&(a+=this.tileSources.length);this.goToPage(a)}function T(){var a=this._sequenceIndex+1;this.navPrevNextWrap&&a>=this.tileSources.length&&(a=0);this.goToPage(a)}var U={};var V=1;a.Viewer=function(c){var d,e=arguments,g=this;a.isPlainObject(c)||(c={id:e[0],xmlPath:e.length>1?e[1]:void 0,prefixUrl:e.length>2?e[2]:void 0,controls:e.length>3?e[3]:void 0,overlays:e.length>4?e[4]:void 0});if(c.config){a.extend(!0,c,c.config);delete c.config}a.extend(!0,this,{id:c.id,hash:c.hash||V++,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},a.DEFAULT_SETTINGS,c);if("undefined"==typeof this.hash)throw new Error("A hash must be defined, either by specifying options.id or options.hash.");"undefined"!=typeof U[this.hash]&&a.console.warn("Hash "+this.hash+" has already been used.");U[this.hash]={fsBoundsDelta:new a.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=a.now();a.EventSource.call(this);this.addHandler("open-failed",function(b){var c=a.getString("Errors.OpenFailed",b.eventSource,b.message);g._showMessage(c)});a.ControlDock.call(this,c);this.xmlPath&&(this.tileSources=[this.xmlPath]);this.element=this.element||document.getElementById(this.id);this.canvas=a.makeNeutralElement("div");this.canvas.className="openseadragon-canvas";!function(a){a.width="100%";a.height="100%";a.overflow="hidden";a.position="absolute";a.top="0px";a.left="0px"}(this.canvas.style);a.setElementTouchActionNone(this.canvas);""!==c.tabIndex&&(this.canvas.tabIndex=void 0===c.tabIndex?0:c.tabIndex);this.container.className="openseadragon-container";!function(a){a.width="100%";a.height="100%";a.position="relative";a.overflow="hidden";a.left="0px";a.top="0px";a.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 a.MouseTracker({element:this.canvas,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,keyDownHandler:a.delegate(this,m),keyHandler:a.delegate(this,n),clickHandler:a.delegate(this,o),dblClickHandler:a.delegate(this,p),dragHandler:a.delegate(this,q),dragEndHandler:a.delegate(this,r),enterHandler:a.delegate(this,s),exitHandler:a.delegate(this,t),pressHandler:a.delegate(this,u),releaseHandler:a.delegate(this,v),nonPrimaryPressHandler:a.delegate(this,w),nonPrimaryReleaseHandler:a.delegate(this,x),scrollHandler:a.delegate(this,z),pinchHandler:a.delegate(this,y)});this.outerTracker=new a.MouseTracker({element:this.container,startDisabled:!this.mouseNavEnabled,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,dblClickTimeThreshold:this.dblClickTimeThreshold,dblClickDistThreshold:this.dblClickDistThreshold,enterHandler:a.delegate(this,A),exitHandler:a.delegate(this,B)});this.toolbar&&(this.toolbar=new a.ControlDock({element:this.toolbar}));this.bindStandardControls();U[this.hash].prevContainerSize=b(this.container);this.world=new a.World({viewer:this});this.world.addHandler("add-item",function(a){g.source=g.world.getItemAt(0).source;U[g.hash].forceRedraw=!0;g._updateRequestId||(g._updateRequestId=f(g,C))});this.world.addHandler("remove-item",function(a){g.world.getItemCount()?g.source=g.world.getItemAt(0).source:g.source=null;U[g.hash].forceRedraw=!0});this.world.addHandler("metrics-change",function(a){g.viewport&&g.viewport._setContentBounds(g.world.getHomeBounds(),g.world.getContentFactor())});this.world.addHandler("item-index-change",function(a){g.source=g.world.getItemAt(0).source});this.viewport=new a.Viewport({containerSize:U[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,navigatorRotate:this.navigatorRotate,homeFillsViewer:this.homeFillsViewer,margins:this.viewportMargins});this.viewport._setContentBounds(this.world.getHomeBounds(),this.world.getContentFactor());this.imageLoader=new a.ImageLoader({jobLimit:this.imageLoaderLimit,timeout:c.timeout});this.tileCache=new a.TileCache({maxImageCacheCount:this.maxImageCacheCount});this.drawer=new a.Drawer({viewer:this,viewport:this.viewport,element:this.canvas,debugGridColor:this.debugGridColor});this.overlaysContainer=a.makeNeutralElement("div");this.canvas.appendChild(this.overlaysContainer);if(!this.drawer.canRotate()){if(this.rotateLeft){d=this.buttons.buttons.indexOf(this.rotateLeft);this.buttons.buttons.splice(d,1);this.buttons.element.removeChild(this.rotateLeft.element)}if(this.rotateRight){d=this.buttons.buttons.indexOf(this.rotateRight);this.buttons.buttons.splice(d,1);this.buttons.element.removeChild(this.rotateRight.element)}}this.showNavigator&&(this.navigator=new a.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,crossOriginPolicy:this.crossOriginPolicy}));this.sequenceMode&&this.bindSequenceControls();this.tileSources&&this.open(this.tileSources);for(d=0;d-1&&b.index=0&&a=0)return this;var i=d(this,h);this.currentOverlays.push(i);i.drawHTML(this.overlaysContainer,this.viewport);this.raiseEvent("add-overlay",{element:b,location:h.location,placement:h.placement});return this},updateOverlay:function(b,c,d){var f;b=a.getElement(b);f=e(this.currentOverlays,b);if(f>=0){this.currentOverlays[f].update(c,d);U[this.hash].forceRedraw=!0;this.raiseEvent("update-overlay",{element:b,location:c,placement:d})}return this},removeOverlay:function(b){var c;b=a.getElement(b);c=e(this.currentOverlays,b);if(c>=0){ +this.currentOverlays[c].destroy();this.currentOverlays.splice(c,1);U[this.hash].forceRedraw=!0;this.raiseEvent("remove-overlay",{element:b})}return this},clearOverlays:function(){for(;this.currentOverlays.length>0;)this.currentOverlays.pop().destroy();U[this.hash].forceRedraw=!0;this.raiseEvent("clear-overlay",{});return this},getOverlayById:function(b){var c;b=a.getElement(b);c=e(this.currentOverlays,b);return c>=0?this.currentOverlays[c]:null},_updateSequenceButtons:function(a){this.nextButton&&(this.tileSources&&this.tileSources.length-1!==a?this.nextButton.enable():this.navPrevNextWrap||this.nextButton.disable());this.previousButton&&(a>0?this.previousButton.enable():this.navPrevNextWrap||this.previousButton.disable())},_showMessage:function(b){this._hideMessage();var c=a.makeNeutralElement("div");c.appendChild(document.createTextNode(b));this.messageDiv=a.makeCenteredNode(c);a.addClass(this.messageDiv,"openseadragon-message");this.container.appendChild(this.messageDiv)},_hideMessage:function(){var a=this.messageDiv;if(a){a.parentNode.removeChild(a);delete this.messageDiv}},gestureSettingsByDeviceType:function(a){switch(a){case"mouse":return this.gestureSettingsMouse;case"touch":return this.gestureSettingsTouch;case"pen":return this.gestureSettingsPen;default:return this.gestureSettingsUnknown}},_drawOverlays:function(){var a,b=this.currentOverlays.length;for(a=0;a1){this.referenceStrip=new a.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 a.console.warn('Attempting to display a reference strip while "sequenceMode" is off.')}})}(OpenSeadragon);!function(a){function b(a){if(a.quick&&this.viewer.viewport){this.viewer.viewport.panTo(this.viewport.pointFromPixel(a.position));this.viewer.viewport.applyConstraints()}}function c(a){if(this.viewer.viewport){this.panHorizontal||(a.delta.x=0);this.panVertical||(a.delta.y=0);this.viewer.viewport.panBy(this.viewport.deltaPointsFromPixels(a.delta));this.viewer.constrainDuringPan&&this.viewer.viewport.applyConstraints()}}function d(a){a.insideElementPressed&&this.viewer.viewport&&this.viewer.viewport.applyConstraints()}function e(a){this.viewer.raiseEvent("navigator-scroll",{tracker:a.eventSource,position:a.position,scroll:a.scroll,shift:a.shift,originalEvent:a.originalEvent});return!1}function f(a,b){a.style.webkitTransform="rotate("+b+"deg)";a.style.mozTransform="rotate("+b+"deg)";a.style.msTransform="rotate("+b+"deg)";a.style.oTransform="rotate("+b+"deg)";a.style.transform="rotate("+b+"deg)"}a.Navigator=function(g){function h(a){f(l.displayRegionContainer,a);f(l.displayRegion,-a);l.viewport.setRotation(a)}var i,j,k=g.viewer,l=this;if(g.id){this.element=document.getElementById(g.id);g.controlOptions={anchor:a.ControlAnchor.NONE,attachToViewer:!1,autoFade:!1}}else{g.id="navigator-"+a.now();this.element=a.makeNeutralElement("div");g.controlOptions={anchor:a.ControlAnchor.TOP_RIGHT,attachToViewer:!0,autoFade:g.autoFade};if(g.position)if("BOTTOM_RIGHT"==g.position)g.controlOptions.anchor=a.ControlAnchor.BOTTOM_RIGHT;else if("BOTTOM_LEFT"==g.position)g.controlOptions.anchor=a.ControlAnchor.BOTTOM_LEFT;else if("TOP_RIGHT"==g.position)g.controlOptions.anchor=a.ControlAnchor.TOP_RIGHT;else if("TOP_LEFT"==g.position)g.controlOptions.anchor=a.ControlAnchor.TOP_LEFT;else if("ABSOLUTE"==g.position){g.controlOptions.anchor=a.ControlAnchor.ABSOLUTE;g.controlOptions.top=g.top;g.controlOptions.left=g.left;g.controlOptions.height=g.height;g.controlOptions.width=g.width}}this.element.id=g.id;this.element.className+=" navigator";g=a.extend(!0,{sizeRatio:a.DEFAULT_SETTINGS.navigatorSizeRatio},g,{element:this.element,tabIndex:-1,showNavigator:!1,mouseNavEnabled:!1,showNavigationControl:!1,showSequenceControl:!1,immediateRender:!0,blendTime:0,animationTime:0,autoResize:g.autoResize,minZoomImageRatio:1});g.minPixelRatio=this.minPixelRatio=k.minPixelRatio;a.setElementTouchActionNone(this.element);this.borderWidth=2;this.fudge=new a.Point(1,1);this.totalBorderWidths=new a.Point(2*this.borderWidth,2*this.borderWidth).minus(this.fudge);g.controlOptions.anchor!=a.ControlAnchor.NONE&&!function(a,b){a.margin="0px";a.border=b+"px solid #555";a.padding="0px";a.background="#000";a.opacity=.8;a.overflow="hidden"}(this.element.style,this.borderWidth);this.displayRegion=a.makeNeutralElement("div");this.displayRegion.id=this.element.id+"-displayregion";this.displayRegion.className="displayregion";!function(a,b){a.position="relative";a.top="0px";a.left="0px";a.fontSize="0px";a.overflow="hidden";a.border=b+"px solid #900";a.margin="0px";a.padding="0px";a.background="transparent";a.float="left";a.cssFloat="left";a.styleFloat="left";a.zIndex=999999999;a.cursor="default"}(this.displayRegion.style,this.borderWidth);this.displayRegionContainer=a.makeNeutralElement("div");this.displayRegionContainer.id=this.element.id+"-displayregioncontainer";this.displayRegionContainer.className="displayregioncontainer";this.displayRegionContainer.style.width="100%";this.displayRegionContainer.style.height="100%";k.addControl(this.element,g.controlOptions);this._resizeWithViewer=g.controlOptions.anchor!=a.ControlAnchor.ABSOLUTE&&g.controlOptions.anchor!=a.ControlAnchor.NONE;if(this._resizeWithViewer){if(g.width&&g.height){this.element.style.height="number"==typeof g.height?g.height+"px":g.height;this.element.style.width="number"==typeof g.width?g.width+"px":g.width}else{i=a.getElementSize(k.element);this.element.style.height=Math.round(i.y*g.sizeRatio)+"px";this.element.style.width=Math.round(i.x*g.sizeRatio)+"px";this.oldViewerSize=i}j=a.getElementSize(this.element);this.elementArea=j.x*j.y}this.oldContainerSize=new a.Point(0,0);a.Viewer.apply(this,[g]);this.displayRegionContainer.appendChild(this.displayRegion);this.element.getElementsByTagName("div")[0].appendChild(this.displayRegionContainer);if(g.navigatorRotate){var m=g.viewer.viewport?g.viewer.viewport.getRotation():g.viewer.degrees||0;h(m);g.viewer.addHandler("rotate",function(a){h(a.degrees)})}this.innerTracker.destroy();this.innerTracker=new a.MouseTracker({element:this.element,dragHandler:a.delegate(this,c),clickHandler:a.delegate(this,b),releaseHandler:a.delegate(this,d),scrollHandler:a.delegate(this,e)});this.addHandler("reset-size",function(){l.viewport&&l.viewport.goHome(!0)});k.world.addHandler("item-index-change",function(a){window.setTimeout(function(){var b=l.world.getItemAt(a.previousIndex);l.world.setItemIndex(b,a.newIndex)},1)});k.world.addHandler("remove-item",function(a){var b=a.item;var c=l._getMatchingItem(b);c&&l.world.removeItem(c)});this.update(k.viewport)};a.extend(a.Navigator.prototype,a.EventSource.prototype,a.Viewer.prototype,{updateSize:function(){if(this.viewport){var b=new a.Point(0===this.container.clientWidth?1:this.container.clientWidth,0===this.container.clientHeight?1:this.container.clientHeight);if(!b.equals(this.oldContainerSize)){this.viewport.resize(b,!0);this.viewport.goHome(!0);this.oldContainerSize=b;this.drawer.clear();this.world.draw()}}},update:function(b){var c,d,e,f,g,h;c=a.getElementSize(this.viewer.element);if(this._resizeWithViewer&&c.x&&c.y&&!c.equals(this.oldViewerSize)){this.oldViewerSize=c;if(this.maintainSizeRatio||!this.elementArea){d=c.x*this.sizeRatio;e=c.y*this.sizeRatio}else{d=Math.sqrt(this.elementArea*(c.x/c.y));e=this.elementArea/d}this.element.style.width=Math.round(d)+"px";this.element.style.height=Math.round(e)+"px";this.elementArea||(this.elementArea=d*e);this.updateSize()}if(b&&this.viewport){f=b.getBoundsNoRotate(!0);g=this.viewport.pixelFromPointNoRotate(f.getTopLeft(),!1);h=this.viewport.pixelFromPointNoRotate(f.getBottomRight(),!1).minus(this.totalBorderWidths);var i=this.displayRegion.style;i.display=this.world.getItemCount()?"block":"none";i.top=Math.round(g.y)+"px";i.left=Math.round(g.x)+"px";var j=Math.abs(g.x-h.x);var k=Math.abs(g.y-h.y);i.width=Math.round(Math.max(j,0))+"px";i.height=Math.round(Math.max(k,0))+"px"}},addTiledImage:function(b){var c=this;var d=b.originalTiledImage;delete b.original;var e=a.extend({},b,{success:function(a){function b(){c._matchBounds(g,d)}function e(){c._matchOpacity(g,d)}function f(){c._matchCompositeOperation(g,d)}var g=a.item;g._originalForNavigator=d;c._matchBounds(g,d,!0);d.addHandler("bounds-change",b);d.addHandler("clip-change",b);d.addHandler("opacity-change",e);d.addHandler("composite-operation-change",f)}});return a.Viewer.prototype.addTiledImage.apply(this,[e])},_getMatchingItem:function(a){var b=this.world.getItemCount();var c;for(var d=0;d1||b.y>1)break}return a-1},getTileAtPoint:function(b,c){var d=c.x>=0&&c.x<=1&&c.y>=0&&c.y<=1/this.aspectRatio;a.console.assert(d,"[TileSource.getTileAtPoint] must be called with a valid point.");var e=this.dimensions.x*this.getLevelScale(b);var f=c.x*e;var g=c.y*e;var h=Math.floor(f/this.getTileWidth(b));var i=Math.floor(g/this.getTileHeight(b));c.x>=1&&(h=this.getNumTiles(b).x-1);c.y>=1/this.aspectRatio&&(i=this.getNumTiles(b).y-1);return new a.Point(h,i)},getTileBounds:function(b,c,d){var e=this.dimensions.times(this.getLevelScale(b)),f=this.getTileWidth(b),g=this.getTileHeight(b),h=0===c?0:f*c-this.tileOverlap,i=0===d?0:g*d-this.tileOverlap,j=f+(0===c?1:2)*this.tileOverlap,k=g+(0===d?1:2)*this.tileOverlap,l=1/e.x;j=Math.min(j,e.x-h);k=Math.min(k,e.y-i);return new a.Rect(h*l,i*l,j*l,k*l)},getImageInfo:function(c){var d,e,f,g,h,i,j,k=this;if(c){h=c.split("/");i=h[h.length-1];j=i.lastIndexOf(".");j>-1&&(h[h.length-1]=i.slice(0,j))}e=function(b){"string"==typeof b&&(b=a.parseXml(b));var d=a.TileSource.determineType(k,b,c);if(d){g=d.prototype.configure.apply(k,[b,c]);void 0===g.ajaxWithCredentials&&(g.ajaxWithCredentials=k.ajaxWithCredentials);f=new d(g);k.ready=!0;k.raiseEvent("ready",{tileSource:f})}else k.raiseEvent("open-failed",{message:"Unable to load TileSource",source:c})};if(c.match(/\.js$/)){d=c.split("/").pop().replace(".js","");a.jsonp({url:c,async:!1,callbackName:d,callback:e})}else a.makeAjaxRequest({url:c,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,success:function(a){var c=b(a);e(c)},error:function(a,b){var d;try{d="HTTP "+a.status+" attempting to load TileSource"}catch(a){var e;e="undefined"!=typeof b&&b.toString?b.toString():"Unknown error";d=e+" attempting to load TileSource"}k.raiseEvent("open-failed",{message:d,source:c})}})},supports:function(a,b){return!1},configure:function(a,b){throw new Error("Method not implemented.")},getTileUrl:function(a,b,c){throw new Error("Method not implemented.")},getTileAjaxHeaders:function(a,b,c){return{}},tileExists:function(a,b,c){var d=this.getNumTiles(a);return a>=this.minLevel&&a<=this.maxLevel&&b>=0&&c>=0&&b=0;k--){l=this.displayRects[k];for(m=l.minLevel;m<=l.maxLevel;m++){this._levelRects[m]||(this._levelRects[m]=[]);this._levelRects[m].push(l)}}a.TileSource.apply(this,[n])};a.extend(a.DziTileSource.prototype,a.TileSource.prototype,{supports:function(a,b){var c;a.Image?c=a.Image.xmlns:a.documentElement&&("Image"!=a.documentElement.localName&&"Image"!=a.documentElement.tagName||(c=a.documentElement.namespaceURI));c=(c||"").toLowerCase();return c.indexOf("schemas.microsoft.com/deepzoom/2008")!==-1||c.indexOf("schemas.microsoft.com/deepzoom/2009")!==-1},configure:function(d,e){var f;f=a.isPlainObject(d)?c(this,d):b(this,d);if(e&&!f.tilesUrl){f.tilesUrl=e.replace(/([^\/]+?)(\.(dzi|xml|js)?(\?[^\/]*)?)?\/?$/,"$1_files/");e.search(/\.(dzi|xml|js)\?/)!=-1?f.queryParams=e.match(/\?.*/):f.queryParams=""}return f},getTileUrl:function(a,b,c){return[this.tilesUrl,a,"/",b,"_",c,".",this.fileFormat,this.queryParams].join("")},tileExists:function(a,b,c){var d,e,f,g,h,i,j,k=this._levelRects[a];if(!k||!k.length)return!0;for(j=k.length-1;j>=0;j--){d=k[j];if(!(ad.maxLevel)){e=this.getLevelScale(a);f=d.x*e;g=d.y*e;h=f+d.width*e;i=g+d.height*e;f=Math.floor(f/this._tileWidth);g=Math.floor(g/this._tileWidth);h=Math.ceil(h/this._tileWidth);i=Math.ceil(i/this._tileWidth);if(f<=b&&b0?d.tileSize=Math.max.apply(null,j):d.tileSize=h}else if(this.sizes&&this.sizes.length>0){this.emulateLegacyImagePyramid=!0;d.levels=c(this);a.extend(!0,d,{width:d.levels[d.levels.length-1].width,height:d.levels[d.levels.length-1].height,tileSize:Math.max(d.height,d.width),tileOverlap:0,minLevel:0,maxLevel:d.levels.length-1});this.levels=d.levels}else a.console.error("Nothing in the info.json to construct image pyramids from");d.maxLevel||this.emulateLegacyImagePyramid||(this.scale_factors?d.maxLevel=Math.floor(Math.pow(Math.max.apply(null,this.scale_factors),.5)):d.maxLevel=Number(Math.ceil(Math.log(Math.max(this.width,this.height),2))));a.TileSource.apply(this,[d])};a.extend(a.IIIFTileSource.prototype,a.TileSource.prototype,{supports:function(a,b){return!(!a.protocol||"http://iiif.io/api/image"!=a.protocol)||(!(!a["@context"]||"http://library.stanford.edu/iiif/image-api/1.1/context.json"!=a["@context"]&&"http://iiif.io/api/image/1/context.json"!=a["@context"])||(!(!a.profile||0!==a.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html"))||(!!(a.identifier&&a.width&&a.height)||!(!a.documentElement||"info"!=a.documentElement.tagName||"http://library.stanford.edu/iiif/image-api/ns/"!=a.documentElement.namespaceURI))))},configure:function(b,c){if(a.isPlainObject(b)){if(b["@context"])return b;b["@context"]="http://iiif.io/api/image/1.0/context.json";b["@id"]=c.replace("/info.json","");return b}var e=d(b);e["@context"]="http://iiif.io/api/image/1.0/context.json";e["@id"]=c.replace("/info.xml","");return e},getTileWidth:function(b){if(this.emulateLegacyImagePyramid)return a.TileSource.prototype.getTileWidth.call(this,b);var c=Math.pow(2,this.maxLevel-b);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[c]?this.tileSizePerScaleFactor[c].width:this._tileWidth},getTileHeight:function(b){if(this.emulateLegacyImagePyramid)return a.TileSource.prototype.getTileHeight.call(this,b);var c=Math.pow(2,this.maxLevel-b);return this.tileSizePerScaleFactor&&this.tileSizePerScaleFactor[c]?this.tileSizePerScaleFactor[c].height:this._tileHeight},getLevelScale:function(b){if(this.emulateLegacyImagePyramid){var c=NaN;this.levels.length>0&&b>=this.minLevel&&b<=this.maxLevel&&(c=this.levels[b].width/this.levels[this.maxLevel].width);return c}return a.TileSource.prototype.getLevelScale.call(this,b)},getNumTiles:function(b){if(this.emulateLegacyImagePyramid){var c=this.getLevelScale(b);return c?new a.Point(1,1):new a.Point(0,0)}return a.TileSource.prototype.getNumTiles.call(this,b)},getTileAtPoint:function(b,c){return this.emulateLegacyImagePyramid?new a.Point(0,0):a.TileSource.prototype.getTileAtPoint.call(this,b,c)},getTileUrl:function(a,b,c){if(this.emulateLegacyImagePyramid){var d=null;this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(d=this.levels[a].url);return d}var e,f,g,h,i,j,k,l,m,n,o,p,q="0",r=Math.pow(.5,this.maxLevel-a),s=Math.ceil(this.width*r),t=Math.ceil(this.height*r);e=this.getTileWidth(a);f=this.getTileHeight(a);g=Math.ceil(e/r);h=Math.ceil(f/r);o=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";if(sj?i/256:j/256;g.maxLevel=Math.ceil(Math.log(h)/Math.log(2))-1;g.tileSize=256;g.width=i;g.height=j;a.TileSource.apply(this,[g])};a.extend(a.TmsTileSource.prototype,a.TileSource.prototype,{supports:function(a,b){return a.type&&"tiledmapservice"==a.type},configure:function(a,b){return a},getTileUrl:function(a,b,c){var d=this.getNumTiles(a).y-1;return this.tilesUrl+a+"/"+b+"/"+(d-c)+".png"}})}(OpenSeadragon);!function(a){a.ZoomifyTileSource=function(a){a.tileSize=256;var b={x:a.width,y:a.height};a.imageSizes=[{x:a.width,y:a.height}];a.gridSize=[this._getGridSize(a.width,a.height,a.tileSize)];for(;parseInt(b.x,10)>a.tileSize||parseInt(b.y,10)>a.tileSize;){b.x=Math.floor(b.x/2);b.y=Math.floor(b.y/2);a.imageSizes.push({x:b.x,y:b.y});a.gridSize.push(this._getGridSize(b.x,b.y,a.tileSize))}a.imageSizes.reverse();a.gridSize.reverse();a.minLevel=0;a.maxLevel=a.gridSize.length-1;OpenSeadragon.TileSource.apply(this,[a])};a.extend(a.ZoomifyTileSource.prototype,a.TileSource.prototype,{_getGridSize:function(a,b,c){return{x:Math.ceil(a/c),y:Math.ceil(b/c)}},_calculateAbsoluteTileNumber:function(a,b,c){var d=0;var e={};for(var f=0;f")}return e.sort(function(a,b){return a.height-b.height})}function c(b,c){if(!c||!c.documentElement)throw new Error(a.getString("Errors.Xml"));var e,f,g=c.documentElement,h=g.tagName,i=null,j=[];if("image"==h)try{i={type:g.getAttribute("type"),levels:[]};j=g.getElementsByTagName("level");for(f=0;f0){e=d.levels[d.levels.length-1].width;f=d.levels[d.levels.length-1].height}else{e=0;f=0;a.console.error("No supported image formats found")}a.extend(!0,d,{width:e,height:f,tileSize:Math.max(f,e),tileOverlap:0,minLevel:0,maxLevel:d.levels.length>0?d.levels.length-1:0});a.TileSource.apply(this,[d]);this.levels=d.levels};a.extend(a.LegacyTileSource.prototype,a.TileSource.prototype,{supports:function(a,b){return a.type&&"legacy-image-pyramid"==a.type||a.documentElement&&"legacy-image-pyramid"==a.documentElement.getAttribute("type")},configure:function(b,e){var f;f=a.isPlainObject(b)?d(this,b):c(this,b);return f},getLevelScale:function(a){var b=NaN;this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(b=this.levels[a].width/this.levels[this.maxLevel].width);return b},getNumTiles:function(b){var c=this.getLevelScale(b);return c?new a.Point(1,1):new a.Point(0,0)},getTileUrl:function(a,b,c){var d=null;this.levels.length>0&&a>=this.minLevel&&a<=this.maxLevel&&(d=this.levels[a].url);return d}})}(OpenSeadragon);!function(a){a.ImageTileSource=function(b){b=a.extend({buildPyramid:!0,crossOriginPolicy:!1,ajaxWithCredentials:!1,useCanvas:!0},b);a.TileSource.apply(this,[b])};a.extend(a.ImageTileSource.prototype,a.TileSource.prototype,{supports:function(a,b){return a.type&&"image"===a.type},configure:function(a,b){return a},getImageInfo:function(b){var c=this._image=new Image;var d=this;this.crossOriginPolicy&&(c.crossOrigin=this.crossOriginPolicy);this.ajaxWithCredentials&&(c.useCredentials=this.ajaxWithCredentials);a.addEvent(c,"load",function(){d.width=Object.prototype.hasOwnProperty.call(c,"naturalWidth")?c.naturalWidth:c.width;d.height=Object.prototype.hasOwnProperty.call(c,"naturalHeight")?c.naturalHeight:c.height;d.aspectRatio=d.width/d.height;d.dimensions=new a.Point(d.width,d.height);d._tileWidth=d.width;d._tileHeight=d.height;d.tileOverlap=0;d.minLevel=0;d.levels=d._buildLevels();d.maxLevel=d.levels.length-1; +d.ready=!0;d.raiseEvent("ready",{tileSource:d})});a.addEvent(c,"error",function(){d.raiseEvent("open-failed",{message:"Error loading image at "+b,source:b})});c.src=b},getLevelScale:function(a){var b=NaN;a>=this.minLevel&&a<=this.maxLevel&&(b=this.levels[a].width/this.levels[this.maxLevel].width);return b},getNumTiles:function(b){var c=this.getLevelScale(b);return c?new a.Point(1,1):new a.Point(0,0)},getTileUrl:function(a,b,c){var d=null;a>=this.minLevel&&a<=this.maxLevel&&(d=this.levels[a].url);return d},getContext2D:function(a,b,c){var d=null;a>=this.minLevel&&a<=this.maxLevel&&(d=this.levels[a].context2D);return d},_buildLevels:function(){var b=[{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||!a.supportsCanvas||!this.useCanvas){delete this._image;return b}var c=Object.prototype.hasOwnProperty.call(this._image,"naturalWidth")?this._image.naturalWidth:this._image.width;var d=Object.prototype.hasOwnProperty.call(this._image,"naturalHeight")?this._image.naturalHeight:this._image.height;var e=document.createElement("canvas");var f=e.getContext("2d");e.width=c;e.height=d;f.drawImage(this._image,0,0,c,d);b[0].context2D=f;delete this._image;if(a.isCanvasTainted(e))return b;for(;c>=2&&d>=2;){c=Math.floor(c/2);d=Math.floor(d/2);var g=document.createElement("canvas");var h=g.getContext("2d");g.width=c;g.height=d;h.drawImage(e,0,0,c,d);b.splice(0,0,{context2D:h,width:c,height:d});e=g;f=h}return b}})}(OpenSeadragon);!function(a){a.TileSourceCollection=function(b,c,d,e){a.console.error("TileSourceCollection is deprecated; use World instead")}}(OpenSeadragon);!function(a){function b(b){a.requestAnimationFrame(function(){c(b)})}function c(c){var d,e,f;if(c.shouldFade){d=a.now();e=d-c.fadeBeginTime;f=1-e/c.fadeLength;f=Math.min(1,f);f=Math.max(0,f);c.imgGroup&&a.setElementOpacity(c.imgGroup,f,!0);f>0&&b(c)}}function d(c){c.shouldFade=!0;c.fadeBeginTime=a.now()+c.fadeDelay;window.setTimeout(function(){b(c)},c.fadeDelay)}function e(b){b.shouldFade=!1;b.imgGroup&&a.setElementOpacity(b.imgGroup,1,!0)}function f(b,c){if(!b.element.disabled){if(c>=a.ButtonState.GROUP&&b.currentState==a.ButtonState.REST){e(b);b.currentState=a.ButtonState.GROUP}if(c>=a.ButtonState.HOVER&&b.currentState==a.ButtonState.GROUP){b.imgHover&&(b.imgHover.style.visibility="");b.currentState=a.ButtonState.HOVER}if(c>=a.ButtonState.DOWN&&b.currentState==a.ButtonState.HOVER){b.imgDown&&(b.imgDown.style.visibility="");b.currentState=a.ButtonState.DOWN}}}function g(b,c){if(!b.element.disabled){if(c<=a.ButtonState.HOVER&&b.currentState==a.ButtonState.DOWN){b.imgDown&&(b.imgDown.style.visibility="hidden");b.currentState=a.ButtonState.HOVER}if(c<=a.ButtonState.GROUP&&b.currentState==a.ButtonState.HOVER){b.imgHover&&(b.imgHover.style.visibility="hidden");b.currentState=a.ButtonState.GROUP}if(c<=a.ButtonState.REST&&b.currentState==a.ButtonState.GROUP){d(b);b.currentState=a.ButtonState.REST}}}a.ButtonState={REST:0,GROUP:1,HOVER:2,DOWN:3};a.Button=function(b){var c=this;a.EventSource.call(this);a.extend(!0,this,{tooltip:null,srcRest:null,srcGroup:null,srcHover:null,srcDown:null,clickTimeThreshold:a.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:a.DEFAULT_SETTINGS.clickDistThreshold,fadeDelay:0,fadeLength:2e3,onPress:null,onRelease:null,onClick:null,onEnter:null,onExit:null,onFocus:null,onBlur:null},b);this.element=b.element||a.makeNeutralElement("div");if(!b.element){this.imgRest=a.makeTransparentImage(this.srcRest);this.imgGroup=a.makeTransparentImage(this.srcGroup);this.imgHover=a.makeTransparentImage(this.srcHover);this.imgDown=a.makeTransparentImage(this.srcDown);this.imgRest.alt=this.imgGroup.alt=this.imgHover.alt=this.imgDown.alt=this.tooltip;this.element.style.position="relative";a.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";a.Browser.vendor==a.BROWSERS.FIREFOX&&a.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=a.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 a.MouseTracker({element:this.element,clickTimeThreshold:this.clickTimeThreshold,clickDistThreshold:this.clickDistThreshold,enterHandler:function(b){if(b.insideElementPressed){f(c,a.ButtonState.DOWN);c.raiseEvent("enter",{originalEvent:b.originalEvent})}else b.buttonDownAny||f(c,a.ButtonState.HOVER)},focusHandler:function(a){this.enterHandler(a);c.raiseEvent("focus",{originalEvent:a.originalEvent})},exitHandler:function(b){g(c,a.ButtonState.GROUP);b.insideElementPressed&&c.raiseEvent("exit",{originalEvent:b.originalEvent})},blurHandler:function(a){this.exitHandler(a);c.raiseEvent("blur",{originalEvent:a.originalEvent})},pressHandler:function(b){f(c,a.ButtonState.DOWN);c.raiseEvent("press",{originalEvent:b.originalEvent})},releaseHandler:function(b){if(b.insideElementPressed&&b.insideElementReleased){g(c,a.ButtonState.HOVER);c.raiseEvent("release",{originalEvent:b.originalEvent})}else b.insideElementPressed?g(c,a.ButtonState.GROUP):f(c,a.ButtonState.HOVER)},clickHandler:function(a){a.quick&&c.raiseEvent("click",{originalEvent:a.originalEvent})},keyHandler:function(a){if(13===a.keyCode){c.raiseEvent("click",{originalEvent:a.originalEvent});c.raiseEvent("release",{originalEvent:a.originalEvent});return!1}return!0}});g(this,a.ButtonState.REST)};a.extend(a.Button.prototype,a.EventSource.prototype,{notifyGroupEnter:function(){f(this,a.ButtonState.GROUP)},notifyGroupExit:function(){g(this,a.ButtonState.REST)},disable:function(){this.notifyGroupExit();this.element.disabled=!0;a.setElementOpacity(this.element,.2,!0)},enable:function(){this.element.disabled=!1;a.setElementOpacity(this.element,1,!0);this.notifyGroupEnter()}})}(OpenSeadragon);!function(a){a.ButtonGroup=function(b){a.extend(!0,this,{buttons:[],clickTimeThreshold:a.DEFAULT_SETTINGS.clickTimeThreshold,clickDistThreshold:a.DEFAULT_SETTINGS.clickDistThreshold,labelText:""},b);var c,d=this.buttons.concat([]),e=this;this.element=b.element||a.makeNeutralElement("div");if(!b.group){this.label=a.makeNeutralElement("label");this.element.style.display="inline-block";this.element.appendChild(this.label);for(c=0;c=270){g=this.getTopRight();this.x=g.x;this.y=g.y;h=this.height;this.height=this.width;this.width=h;this.degrees-=270}else if(this.degrees>=180){g=this.getBottomRight();this.x=g.x;this.y=g.y;this.degrees-=180}else if(this.degrees>=90){g=this.getBottomLeft();this.x=g.x;this.y=g.y;h=this.height;this.height=this.width;this.width=h;this.degrees-=90}};a.Rect.fromSummits=function(b,c,d){var e=b.distanceTo(c);var f=b.distanceTo(d);var g=c.minus(b);var h=Math.atan(g.y/g.x);g.x<0?h+=Math.PI:g.y<0&&(h+=2*Math.PI);return new a.Rect(b.x,b.y,e,f,h/Math.PI*180)};a.Rect.prototype={clone:function(){return new a.Rect(this.x,this.y,this.width,this.height,this.degrees)},getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new a.Point(this.x,this.y)},getBottomRight:function(){return new a.Point(this.x+this.width,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getTopRight:function(){return new a.Point(this.x+this.width,this.y).rotate(this.degrees,this.getTopLeft())},getBottomLeft:function(){return new a.Point(this.x,this.y+this.height).rotate(this.degrees,this.getTopLeft())},getCenter:function(){return new a.Point(this.x+this.width/2,this.y+this.height/2).rotate(this.degrees,this.getTopLeft())},getSize:function(){return new a.Point(this.width,this.height)},equals:function(b){return b instanceof a.Rect&&this.x===b.x&&this.y===b.y&&this.width===b.width&&this.height===b.height&&this.degrees===b.degrees},times:function(b){return new a.Rect(this.x*b,this.y*b,this.width*b,this.height*b,this.degrees)},translate:function(b){return new a.Rect(this.x+b.x,this.y+b.y,this.width,this.height,this.degrees)},union:function(b){var c=this.getBoundingBox();var d=b.getBoundingBox();var e=Math.min(c.x,d.x);var f=Math.min(c.y,d.y);var g=Math.max(c.x+c.width,d.x+d.width);var h=Math.max(c.y+c.height,d.y+d.height);return new a.Rect(e,f,g-e,h-f)},intersection:function(b){function c(b,c,e,f){var g=c.minus(b);var h=f.minus(e);var i=-h.x*g.y+g.x*h.y;if(0===i)return null;var j=(g.x*(b.y-e.y)-g.y*(b.x-e.x))/i;var k=(h.x*(b.y-e.y)-h.y*(b.x-e.x))/i;return-d<=j&&j<=1-d&&-d<=k&&k<=1-d?new a.Point(b.x+k*g.x,b.y+k*g.y):null}var d=1e-10;var e=[];var f=this.getTopLeft();b.containsPoint(f,d)&&e.push(f);var g=this.getTopRight();b.containsPoint(g,d)&&e.push(g);var h=this.getBottomLeft();b.containsPoint(h,d)&&e.push(h);var i=this.getBottomRight();b.containsPoint(i,d)&&e.push(i);var j=b.getTopLeft();this.containsPoint(j,d)&&e.push(j);var k=b.getTopRight();this.containsPoint(k,d)&&e.push(k);var l=b.getBottomLeft();this.containsPoint(l,d)&&e.push(l);var m=b.getBottomRight();this.containsPoint(m,d)&&e.push(m);var n=this._getSegments();var o=b._getSegments();for(var p=0;pv&&(v=z.x);z.yx&&(x=z.y)}return new a.Rect(u,w,v-u,x-w)},_getSegments:function(){var a=this.getTopLeft();var b=this.getTopRight();var c=this.getBottomLeft();var d=this.getBottomRight();return[[a,b],[b,d],[d,c],[c,a]]},rotate:function(b,c){b=a.positiveModulo(b,360);if(0===b)return this.clone();c=c||this.getCenter();var d=this.getTopLeft().rotate(b,c);var e=this.getTopRight().rotate(b,c);var f=e.minus(d);f=f.apply(function(a){var b=1e-15;return Math.abs(a)=-b&&(a.x-d.x)*f.x+(a.y-d.y)*f.y<=b&&(a.x-c.x)*g.x+(a.y-c.y)*g.y>=-b&&(a.x-e.x)*g.x+(a.y-e.y)*g.y<=b},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(a){function b(b){var c=Number(this.element.style.marginLeft.replace("px","")),e=Number(this.element.style.marginTop.replace("px","")),f=Number(this.element.style.width.replace("px","")),g=Number(this.element.style.height.replace("px","")),h=a.getElementSize(this.viewer.canvas);this.dragging=!0;if(this.element)if("horizontal"==this.scroll){if(-b.delta.x>0){if(c>-(f-h.x)){this.element.style.marginLeft=c+2*b.delta.x+"px";d(this,h.x,c+2*b.delta.x)}}else if(-b.delta.x<0&&c<0){this.element.style.marginLeft=c+2*b.delta.x+"px";d(this,h.x,c+2*b.delta.x)}}else if(-b.delta.y>0){if(e>-(g-h.y)){this.element.style.marginTop=e+2*b.delta.y+"px";d(this,h.y,e+2*b.delta.y)}}else if(-b.delta.y<0&&e<0){this.element.style.marginTop=e+2*b.delta.y+"px";d(this,h.y,e+2*b.delta.y)}return!1}function c(b){var c=Number(this.element.style.marginLeft.replace("px","")),e=Number(this.element.style.marginTop.replace("px","")),f=Number(this.element.style.width.replace("px","")),g=Number(this.element.style.height.replace("px","")),h=a.getElementSize(this.viewer.canvas);if(this.element)if("horizontal"==this.scroll){if(b.scroll>0){if(c>-(f-h.x)){this.element.style.marginLeft=c-60*b.scroll+"px";d(this,h.x,c-60*b.scroll)}}else if(b.scroll<0&&c<0){this.element.style.marginLeft=c-60*b.scroll+"px";d(this,h.x,c-60*b.scroll)}}else if(b.scroll<0){if(e>h.y-g){this.element.style.marginTop=e+60*b.scroll+"px";d(this,h.y,e+60*b.scroll)}}else if(b.scroll>0&&e<0){this.element.style.marginTop=e+60*b.scroll+"px";d(this,h.y,e+60*b.scroll)}return!1}function d(b,c,d){var e,f,g,h,i,j,k;e="horizontal"==b.scroll?b.panelWidth:b.panelHeight;f=Math.ceil(c/e)+5;g=Math.ceil((Math.abs(d)+c)/e)+1;f=g-f;f=f<0?0:f;for(j=f;jj+g.x-this.panelWidth){c=Math.min(c,h-g.x);this.element.style.marginLeft=-c+"px";d(this,g.x,-c)}else if(ck+g.y-this.panelHeight){c=Math.min(c,i-g.y);this.element.style.marginTop=-c+"px";d(this,g.y,-c)}else if(c1?c[1].springStiffness:5,animationTime:c.length>1?c[1].animationTime:1.5});a.console.assert("number"==typeof b.springStiffness&&0!==b.springStiffness,"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number");a.console.assert("number"==typeof b.animationTime&&b.animationTime>=0,"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0");if(b.exponential){this._exponential=!0;delete b.exponential}a.extend(!0,this,b);this.current={value:"number"==typeof this.initial?this.initial:this._exponential?0:1,time:a.now()};a.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};if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}};a.Spring.prototype={resetTo:function(b){a.console.assert(!this._exponential||0!==b,"[OpenSeadragon.Spring.resetTo] target must be non-zero for exponential springs");this.start.value=this.target.value=this.current.value=b;this.start.time=this.target.time=this.current.time=a.now();if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value);this.current._logValue=Math.log(this.current.value)}},springTo:function(b){a.console.assert(!this._exponential||0!==b,"[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=b;this.target.time=this.start.time+1e3*this.animationTime;if(this._exponential){this.start._logValue=Math.log(this.start.value);this.target._logValue=Math.log(this.target.value)}},shiftBy:function(b){this.start.value+=b;this.target.value+=b;if(this._exponential){a.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(b){this._exponential=b;if(this._exponential){a.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(){this.current.time=a.now();var c,d;if(this._exponential){c=this.start._logValue;d=this.target._logValue}else{c=this.start.value;d=this.target.value}var e=this.current.time>=this.target.time?d:c+(d-c)*b(this.springStiffness,(this.current.time-this.start.time)/(this.target.time-this.start.time));var f=this.current.value;this._exponential?this.current.value=Math.exp(e):this.current.value=e;return f!=this.current.value},isAtTargetValue:function(){return this.current.value===this.target.value}}}(OpenSeadragon);!function(a){function b(b){a.extend(!0,this,{timeout:a.DEFAULT_SETTINGS.timeout,jobId:null},b);this.image=null}function c(a,b,c){var d;a.jobsInProgress--;if((!a.jobLimit||a.jobsInProgress0){d=a.jobQueue.shift();d.start();a.jobsInProgress++}c(b.image,b.errorMsg,b.request)}b.prototype={errorMsg:null,start:function(){var b=this;var c=this.abort;this.image=new Image;this.image.onload=function(){b.finish(!0)};this.image.onabort=this.image.onerror=function(){b.errorMsg="Image load aborted";b.finish(!1)};this.jobId=window.setTimeout(function(){b.errorMsg="Image load exceeded timeout";b.finish(!1)},this.timeout);if(this.loadWithAjax){this.request=a.makeAjaxRequest({url:this.src,withCredentials:this.ajaxWithCredentials,headers:this.ajaxHeaders,responseType:"arraybuffer",success:function(a){var c;try{c=new window.Blob([a.response])}catch(b){var d=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if("TypeError"===b.name&&d){var e=new d;e.append(a.response);c=e.getBlob()}}if(0===c.size){b.errorMsg="Empty image response.";b.finish(!1)}var f=(window.URL||window.webkitURL).createObjectURL(c);b.image.src=f},error:function(a){b.errorMsg="Image load aborted - XHR error";b.finish(!1)}});this.abort=function(){b.request.abort();"function"==typeof c&&c()}}else{this.crossOriginPolicy!==!1&&(this.image.crossOrigin=this.crossOriginPolicy);this.image.src=this.src}},finish:function(a){this.image.onload=this.image.onerror=this.image.onabort=null;a||(this.image=null);this.jobId&&window.clearTimeout(this.jobId);this.callback(this)}};a.ImageLoader=function(b){a.extend(!0,this,{jobLimit:a.DEFAULT_SETTINGS.imageLoaderLimit,timeout:a.DEFAULT_SETTINGS.timeout,jobQueue:[],jobsInProgress:0},b)};a.ImageLoader.prototype={addJob:function(a){var d=this,e=function(b){c(d,b,a.callback)},f={src:a.src,loadWithAjax:a.loadWithAjax,ajaxHeaders:a.loadWithAjax?a.ajaxHeaders:null,crossOriginPolicy:a.crossOriginPolicy,ajaxWithCredentials:a.ajaxWithCredentials,callback:e,abort:a.abort,timeout:this.timeout},g=new b(f);if(!this.jobLimit||this.jobsInProgressc&&(c=e)}return c},needsUpdate:function(){a.console.error("[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead.");return this.viewer.world.needsDraw()},numTilesLoaded:function(){a.console.error("[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead.");return this.viewer.tileCache.numTilesLoaded()},reset:function(){a.console.error("[Drawer.reset] this function is deprecated. Use World.resetItems instead.");this.viewer.world.resetItems();return this},update:function(){a.console.error("[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead.");this.clear();this.viewer.world.draw();return this},canRotate:function(){return this.useCanvas},destroy:function(){this.canvas.width=1;this.canvas.height=1;this.sketchCanvas=null;this.sketchContext=null},clear:function(){this.canvas.innerHTML="";if(this.useCanvas){var a=this._calculateCanvasSize();if(this.canvas.width!=a.x||this.canvas.height!=a.y){this.canvas.width=a.x;this.canvas.height=a.y;if(null!==this.sketchCanvas){var b=this._calculateSketchCanvasSize();this.sketchCanvas.width=b.x;this.sketchCanvas.height=b.y}}this._clear()}},_clear:function(a,b){if(this.useCanvas){var c=this._getContext(a);if(b)c.clearRect(b.x,b.y,b.width,b.height);else{var d=c.canvas;c.clearRect(0,0,d.width,d.height)}}},viewportToDrawerRectangle:function(b){var c=this.viewport.pixelFromPointNoRotate(b.getTopLeft(),!0);var d=this.viewport.deltaPixelsFromPointsNoRotate(b.getSize(),!0);return new a.Rect(c.x*a.pixelDensityRatio,c.y*a.pixelDensityRatio,d.x*a.pixelDensityRatio,d.y*a.pixelDensityRatio)},drawTile:function(b,c,d,e,f){a.console.assert(b,"[Drawer.drawTile] tile is required");a.console.assert(c,"[Drawer.drawTile] drawingHandler is required");if(this.useCanvas){var g=this._getContext(d);e=e||1;b.drawCanvas(g,c,e,f)}else b.drawHTML(this.canvas)},_getContext:function(a){var b=this.context;if(a){if(null===this.sketchCanvas){this.sketchCanvas=document.createElement("canvas");var c=this._calculateSketchCanvasSize();this.sketchCanvas.width=c.x;this.sketchCanvas.height=c.y;this.sketchContext=this.sketchCanvas.getContext("2d");if(0===this.viewport.getRotation()){var d=this;this.viewer.addHandler("rotate",function a(){if(0!==d.viewport.getRotation()){d.viewer.removeHandler("rotate",a);var b=d._calculateSketchCanvasSize();d.sketchCanvas.width=b.x;d.sketchCanvas.height=b.y}})}}b=this.sketchContext}return b},saveContext:function(a){this.useCanvas&&this._getContext(a).save()},restoreContext:function(a){this.useCanvas&&this._getContext(a).restore()},setClip:function(a,b){if(this.useCanvas){var c=this._getContext(b);c.beginPath();c.rect(a.x,a.y,a.width,a.height);c.clip()}},drawRectangle:function(a,b,c){if(this.useCanvas){var d=this._getContext(c);d.save();d.fillStyle=b;d.fillRect(a.x,a.y,a.width,a.height);d.restore()}},blendSketch:function(b,c,d,e){var f=b;a.isPlainObject(f)||(f={opacity:b,scale:c,translate:d,compositeOperation:e});if(this.useCanvas&&this.sketchCanvas){b=f.opacity;e=f.compositeOperation;var g=f.bounds;this.context.save();this.context.globalAlpha=b;e&&(this.context.globalCompositeOperation=e);if(g){if(g.x<0){g.width+=g.x;g.x=0}g.x+g.width>this.canvas.width&&(g.width=this.canvas.width-g.x);if(g.y<0){g.height+=g.y;g.y=0}g.y+g.height>this.canvas.height&&(g.height=this.canvas.height-g.y);this.context.drawImage(this.sketchCanvas,g.x,g.y,g.width,g.height,g.x,g.y,g.width,g.height)}else{c=f.scale||1;d=f.translate;var h=d instanceof a.Point?d:new a.Point(0,0);var i=0;var j=0;if(d){var k=this.sketchCanvas.width-this.canvas.width;var l=this.sketchCanvas.height-this.canvas.height;i=Math.round(k/2);j=Math.round(l/2)}this.context.drawImage(this.sketchCanvas,h.x-i*c,h.y-j*c,(this.canvas.width+2*i)*c,(this.canvas.height+2*j)*c,-i,-j,this.canvas.width+2*i,this.canvas.height+2*j)}this.context.restore()}},drawDebugInfo:function(b,c,d,e){if(this.useCanvas){var f=this.context;f.save();f.lineWidth=2*a.pixelDensityRatio;f.font="small-caps bold "+13*a.pixelDensityRatio+"px arial";f.strokeStyle=this.debugGridColor;f.fillStyle=this.debugGridColor;0!==this.viewport.degrees&&this._offsetForRotation({degrees:this.viewport.degrees});e.getRotation(!0)%360!==0&&this._offsetForRotation({degrees:e.getRotation(!0),point:e.viewport.pixelFromPointNoRotate(e._getRotationPoint(!0),!0)});f.strokeRect(b.position.x*a.pixelDensityRatio,b.position.y*a.pixelDensityRatio,b.size.x*a.pixelDensityRatio,b.size.y*a.pixelDensityRatio);var g=(b.position.x+b.size.x/2)*a.pixelDensityRatio;var h=(b.position.y+b.size.y/2)*a.pixelDensityRatio;f.translate(g,h);f.rotate(Math.PI/180*-this.viewport.degrees);f.translate(-g,-h);if(0===b.x&&0===b.y){f.fillText("Zoom: "+this.viewport.getZoom(),b.position.x*a.pixelDensityRatio,(b.position.y-30)*a.pixelDensityRatio);f.fillText("Pan: "+this.viewport.getBounds().toString(),b.position.x*a.pixelDensityRatio,(b.position.y-20)*a.pixelDensityRatio)}f.fillText("Level: "+b.level,(b.position.x+10)*a.pixelDensityRatio,(b.position.y+20)*a.pixelDensityRatio);f.fillText("Column: "+b.x,(b.position.x+10)*a.pixelDensityRatio,(b.position.y+30)*a.pixelDensityRatio);f.fillText("Row: "+b.y,(b.position.x+10)*a.pixelDensityRatio,(b.position.y+40)*a.pixelDensityRatio);f.fillText("Order: "+d+" of "+c,(b.position.x+10)*a.pixelDensityRatio,(b.position.y+50)*a.pixelDensityRatio);f.fillText("Size: "+b.size.toString(),(b.position.x+10)*a.pixelDensityRatio,(b.position.y+60)*a.pixelDensityRatio);f.fillText("Position: "+b.position.toString(),(b.position.x+10)*a.pixelDensityRatio,(b.position.y+70)*a.pixelDensityRatio);0!==this.viewport.degrees&&this._restoreRotationChanges();e.getRotation(!0)%360!==0&&this._restoreRotationChanges();f.restore()}},debugRect:function(b){if(this.useCanvas){var c=this.context;c.save();c.lineWidth=2*a.pixelDensityRatio;c.strokeStyle=this.debugGridColor;c.fillStyle=this.debugGridColor;c.strokeRect(b.x*a.pixelDensityRatio,b.y*a.pixelDensityRatio,b.width*a.pixelDensityRatio,b.height*a.pixelDensityRatio);c.restore()}},getCanvasSize:function(b){var c=this._getContext(b).canvas;return new a.Point(c.width,c.height)},getCanvasCenter:function(){return new a.Point(this.canvas.width/2,this.canvas.height/2)},_offsetForRotation:function(b){var c=b.point?b.point.times(a.pixelDensityRatio):this.getCanvasCenter();var d=this._getContext(b.useSketch);d.save();d.translate(c.x,c.y);d.rotate(Math.PI/180*b.degrees);d.translate(-c.x,-c.y)},_restoreRotationChanges:function(a){var b=this._getContext(a);b.restore()},_calculateCanvasSize:function(){var b=a.pixelDensityRatio;var c=this.viewport.getContainerSize();return{x:c.x*b,y:c.y*b}},_calculateSketchCanvasSize:function(){var a=this._calculateCanvasSize();if(0===this.viewport.getRotation())return a;var b=Math.ceil(Math.sqrt(a.x*a.x+a.y*a.y));return{x:b,y:b}}}}(OpenSeadragon);!function(a){a.Viewport=function(b){var c=arguments;c.length&&c[0]instanceof a.Point&&(b={containerSize:c[0],contentSize:c[1],config:c[2]});if(b.config){a.extend(!0,b,b.config);delete b.config}this._margins=a.extend({left:0,top:0,right:0,bottom:0},b.margins||{});delete b.margins;a.extend(!0,this,{containerSize:null,contentSize:null,zoomPoint:null,viewer:null,springStiffness:a.DEFAULT_SETTINGS.springStiffness,animationTime:a.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:a.DEFAULT_SETTINGS.minZoomImageRatio,maxZoomPixelRatio:a.DEFAULT_SETTINGS.maxZoomPixelRatio,visibilityRatio:a.DEFAULT_SETTINGS.visibilityRatio,wrapHorizontal:a.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:a.DEFAULT_SETTINGS.wrapVertical,defaultZoomLevel:a.DEFAULT_SETTINGS.defaultZoomLevel,minZoomLevel:a.DEFAULT_SETTINGS.minZoomLevel,maxZoomLevel:a.DEFAULT_SETTINGS.maxZoomLevel,degrees:a.DEFAULT_SETTINGS.degrees,homeFillsViewer:a.DEFAULT_SETTINGS.homeFillsViewer},b);this._updateContainerInnerSize();this.centerSpringX=new a.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.centerSpringY=new a.Spring({initial:0,springStiffness:this.springStiffness,animationTime:this.animationTime});this.zoomSpring=new a.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 a.Rect(0,0,1,1),1);this.goHome(!0);this.update()};a.Viewport.prototype={resetContentSize:function(b){a.console.assert(b,"[Viewport.resetContentSize] contentSize is required");a.console.assert(b instanceof a.Point,"[Viewport.resetContentSize] contentSize must be an OpenSeadragon.Point");a.console.assert(b.x>0,"[Viewport.resetContentSize] contentSize.x must be greater than 0");a.console.assert(b.y>0,"[Viewport.resetContentSize] contentSize.y must be greater than 0");this._setContentBounds(new a.Rect(0,0,1,b.y/b.x),b.x);return this},setHomeBounds:function(b,c){a.console.error("[Viewport.setHomeBounds] this function is deprecated; The content bounds should not be set manually.");this._setContentBounds(b,c)},_setContentBounds:function(b,c){a.console.assert(b,"[Viewport._setContentBounds] bounds is required");a.console.assert(b instanceof a.Rect,"[Viewport._setContentBounds] bounds must be an OpenSeadragon.Rect");a.console.assert(b.width>0,"[Viewport._setContentBounds] bounds.width must be greater than 0");a.console.assert(b.height>0,"[Viewport._setContentBounds] bounds.height must be greater than 0");this._contentBoundsNoRotate=b.clone();this._contentSizeNoRotate=this._contentBoundsNoRotate.getSize().times(c);this._contentBounds=b.rotate(this.degrees).getBoundingBox();this._contentSize=this._contentBounds.getSize().times(c);this._contentAspectRatio=this._contentSize.x/this._contentSize.y;this.viewer&&this.viewer.raiseEvent("reset-size",{contentSize:this._contentSizeNoRotate.clone(),contentFactor:c,homeBounds:this._contentBoundsNoRotate.clone(),contentBounds:this._contentBounds.clone()})},getHomeZoom:function(){if(this.defaultZoomLevel)return this.defaultZoomLevel;var a=this._contentAspectRatio/this.getAspectRatio();var b;b=this.homeFillsViewer?a>=1?a:1:a>=1?1:a;return b/this._contentBounds.width},getHomeBounds:function(){return this.getHomeBoundsNoRotate().rotate(-this.getRotation())},getHomeBoundsNoRotate:function(){var b=this._contentBounds.getCenter();var c=1/this.getHomeZoom();var d=c/this.getAspectRatio();return new a.Rect(b.x-c/2,b.y-d/2,c,d)},goHome:function(a){this.viewer&&this.viewer.raiseEvent("home",{immediately:a});return this.fitBounds(this.getHomeBounds(),a)},getMinZoom:function(){var a=this.getHomeZoom(),b=this.minZoomLevel?this.minZoomLevel:this.minZoomImageRatio*a;return b},getMaxZoom:function(){var a=this.maxZoomLevel;if(!a){a=this._contentSize.x*this.maxZoomPixelRatio/this._containerInnerSize.x;a/=this._contentBounds.width}return Math.max(a,this.getHomeZoom())},getAspectRatio:function(){return this._containerInnerSize.x/this._containerInnerSize.y},getContainerSize:function(){return new a.Point(this.containerSize.x,this.containerSize.y)},getMargins:function(){return a.extend({},this._margins)},setMargins:function(b){a.console.assert("object"===a.type(b),"[Viewport.setMargins] margins must be an object");this._margins=a.extend({left:0,top:0,right:0,bottom:0},b);this._updateContainerInnerSize();this.viewer&&this.viewer.forceRedraw()},getBounds:function(a){return this.getBoundsNoRotate(a).rotate(-this.getRotation())},getBoundsNoRotate:function(b){var c=this.getCenter(b);var d=1/this.getZoom(b);var e=d/this.getAspectRatio();return new a.Rect(c.x-d/2,c.y-e/2,d,e)},getBoundsWithMargins:function(a){return this.getBoundsNoRotateWithMargins(a).rotate(-this.getRotation(),this.getCenter(a))},getBoundsNoRotateWithMargins:function(a){var b=this.getBoundsNoRotate(a);var c=this._containerInnerSize.x*this.getZoom(a);b.x-=this._margins.left/c;b.y-=this._margins.top/c;b.width+=(this._margins.left+this._margins.right)/c;b.height+=(this._margins.top+this._margins.bottom)/c;return b},getCenter:function(b){var c,d,e,f,g,h,i,j,k=new a.Point(this.centerSpringX.current.value,this.centerSpringY.current.value),l=new a.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);if(b)return k;if(!this.zoomPoint)return l;c=this.pixelFromPoint(this.zoomPoint,!0);d=this.getZoom();e=1/d;f=e/this.getAspectRatio();g=new a.Rect(k.x-e/2,k.y-f/2,e,f);h=this._pixelFromPoint(this.zoomPoint,g);i=h.minus(c);j=i.divide(this._containerInnerSize.x*d);return l.plus(j)},getZoom:function(a){return a?this.zoomSpring.current.value:this.zoomSpring.target.value},_applyZoomConstraints:function(a){return Math.max(Math.min(a,this.getMaxZoom()),this.getMinZoom())},_applyBoundaryConstraints:function(b){var c=new a.Rect(b.x,b.y,b.width,b.height);if(this.wrapHorizontal);else{var d=this.visibilityRatio*c.width;var e=c.x+c.width;var f=this._contentBoundsNoRotate.x+this._contentBoundsNoRotate.width;var g=this._contentBoundsNoRotate.x-e+d;var h=f-c.x-d;d>this._contentBoundsNoRotate.width?c.x+=(g+h)/2:h<0?c.x+=h:g>0&&(c.x+=g)}if(this.wrapVertical);else{var i=this.visibilityRatio*c.height;var j=c.y+c.height;var k=this._contentBoundsNoRotate.y+this._contentBoundsNoRotate.height;var l=this._contentBoundsNoRotate.y-j+i;var m=k-c.y-i;i>this._contentBoundsNoRotate.height?c.y+=(l+m)/2:m<0?c.y+=m:l>0&&(c.y+=l)}return c},_raiseConstraintsEvent:function(a){this.viewer&&this.viewer.raiseEvent("constrain",{immediately:a})},applyConstraints:function(a){var b=this.getZoom();var c=this._applyZoomConstraints(b);b!==c&&this.zoomTo(c,this.zoomPoint,a);var d=this.getBoundsNoRotate();var e=this._applyBoundaryConstraints(d);this._raiseConstraintsEvent(a);(d.x!==e.x||d.y!==e.y||a)&&this.fitBounds(e.rotate(-this.getRotation()),a);return this},ensureVisible:function(a){return this.applyConstraints(a)},_fitBounds:function(b,c){c=c||{};var d=c.immediately||!1;var e=c.constraints||!1;var f=this.getAspectRatio();var g=b.getCenter();var h=new a.Rect(b.x,b.y,b.width,b.height,b.degrees+this.getRotation()).getBoundingBox();h.getAspectRatio()>=f?h.height=h.width/f:h.width=h.height*f;h.x=g.x-h.width/2;h.y=g.y-h.height/2;var i=1/h.width;if(e){var j=h.getAspectRatio();var k=this._applyZoomConstraints(i);if(i!==k){i=k;h.width=1/i;h.x=g.x-h.width/2;h.height=h.width/j;h.y=g.y-h.height/2}h=this._applyBoundaryConstraints(h);g=h.getCenter();this._raiseConstraintsEvent(d)}if(d){this.panTo(g,!0);return this.zoomTo(i,null,!0)}this.panTo(this.getCenter(!0),!0);this.zoomTo(this.getZoom(!0),null,!0);var l=this.getBounds();var m=this.getZoom();if(0===m||Math.abs(i/m-1)<1e-8){this.zoomTo(i,!0);return this.panTo(g,d)}h=h.rotate(-this.getRotation());var n=h.getTopLeft().times(i).minus(l.getTopLeft().times(m)).divide(i-m);return this.zoomTo(i,n,d)},fitBounds:function(a,b){return this._fitBounds(a,{immediately:b,constraints:!1})},fitBoundsWithConstraints:function(a,b){return this._fitBounds(a,{immediately:b,constraints:!0})},fitVertically:function(b){var c=new a.Rect(this._contentBounds.x+this._contentBounds.width/2,this._contentBounds.y,0,this._contentBounds.height);return this.fitBounds(c,b)},fitHorizontally:function(b){var c=new a.Rect(this._contentBounds.x,this._contentBounds.y+this._contentBounds.height/2,this._contentBounds.width,0);return this.fitBounds(c,b)},getConstrainedBounds:function(a){var b,c;b=this.getBounds(a);c=this._applyBoundaryConstraints(b);return c},panBy:function(b,c){var d=new a.Point(this.centerSpringX.target.value,this.centerSpringY.target.value);return this.panTo(d.plus(b),c)},panTo:function(a,b){if(b){this.centerSpringX.resetTo(a.x);this.centerSpringY.resetTo(a.y)}else{this.centerSpringX.springTo(a.x);this.centerSpringY.springTo(a.y)}this.viewer&&this.viewer.raiseEvent("pan",{center:a,immediately:b});return this},zoomBy:function(a,b,c){return this.zoomTo(this.zoomSpring.target.value*a,b,c)},zoomTo:function(b,c,d){var e=this;this.zoomPoint=c instanceof a.Point&&!isNaN(c.x)&&!isNaN(c.y)?c:null;d?this._adjustCenterSpringsForZoomPoint(function(){e.zoomSpring.resetTo(b)}):this.zoomSpring.springTo(b);this.viewer&&this.viewer.raiseEvent("zoom",{zoom:b,refPoint:c,immediately:d});return this},setRotation:function(b){if(!this.viewer||!this.viewer.drawer.canRotate())return this;this.degrees=a.positiveModulo(b,360);this._setContentBounds(this.viewer.world.getHomeBounds(),this.viewer.world.getContentFactor());this.viewer.forceRedraw();this.viewer.raiseEvent("rotate",{degrees:b});return this},getRotation:function(){return this.degrees},resize:function(a,b){var c,d=this.getBoundsNoRotate(),e=d;this.containerSize.x=a.x;this.containerSize.y=a.y;this._updateContainerInnerSize();if(b){c=a.x/this.containerSize.x;e.width=d.width*c;e.height=e.width/this.getAspectRatio()}this.viewer&&this.viewer.raiseEvent("resize",{newContainerSize:a,maintain:b});return this.fitBounds(e,!0)},_updateContainerInnerSize:function(){this._containerInnerSize=new a.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 a=this;this._adjustCenterSpringsForZoomPoint(function(){a.zoomSpring.update()});this.centerSpringX.update();this.centerSpringY.update();var b=this.centerSpringX.current.value!==this._oldCenterX||this.centerSpringY.current.value!==this._oldCenterY||this.zoomSpring.current.value!==this._oldZoom;this._oldCenterX=this.centerSpringX.current.value;this._oldCenterY=this.centerSpringY.current.value;this._oldZoom=this.zoomSpring.current.value;return b},_adjustCenterSpringsForZoomPoint:function(a){if(this.zoomPoint){var b=this.pixelFromPoint(this.zoomPoint,!0);a();var c=this.pixelFromPoint(this.zoomPoint,!0);var d=c.minus(b);var e=this.deltaPointsFromPixels(d,!0);this.centerSpringX.shiftBy(e.x);this.centerSpringY.shiftBy(e.y);this.zoomSpring.isAtTargetValue()&&(this.zoomPoint=null)}else a()},deltaPixelsFromPointsNoRotate:function(a,b){return a.times(this._containerInnerSize.x*this.getZoom(b))},deltaPixelsFromPoints:function(a,b){return this.deltaPixelsFromPointsNoRotate(a.rotate(this.getRotation()),b)},deltaPointsFromPixelsNoRotate:function(a,b){return a.divide(this._containerInnerSize.x*this.getZoom(b))},deltaPointsFromPixels:function(a,b){return this.deltaPointsFromPixelsNoRotate(a,b).rotate(-this.getRotation())},pixelFromPointNoRotate:function(a,b){return this._pixelFromPointNoRotate(a,this.getBoundsNoRotate(b))},pixelFromPoint:function(a,b){return this._pixelFromPoint(a,this.getBoundsNoRotate(b))},_pixelFromPointNoRotate:function(b,c){return b.minus(c.getTopLeft()).times(this._containerInnerSize.x/c.width).plus(new a.Point(this._margins.left,this._margins.top))},_pixelFromPoint:function(a,b){return this._pixelFromPointNoRotate(a.rotate(this.getRotation(),this.getCenter(!0)),b)},pointFromPixelNoRotate:function(b,c){var d=this.getBoundsNoRotate(c);return b.minus(new a.Point(this._margins.left,this._margins.top)).divide(this._containerInnerSize.x/d.width).plus(d.getTopLeft())},pointFromPixel:function(a,b){return this.pointFromPixelNoRotate(a,b).rotate(-this.getRotation(),this.getCenter(!0))},_viewportToImageDelta:function(b,c){var d=this._contentBoundsNoRotate.width;return new a.Point(b*this._contentSizeNoRotate.x/d,c*this._contentSizeNoRotate.x/d)},viewportToImageCoordinates:function(b,c){if(b instanceof a.Point)return this.viewportToImageCoordinates(b.x,b.y);if(this.viewer){var d=this.viewer.world.getItemCount();if(d>1)a.console.error("[Viewport.viewportToImageCoordinates] is not accurate with multi-image; use TiledImage.viewportToImageCoordinates instead.");else if(1===d){var e=this.viewer.world.getItemAt(0);return e.viewportToImageCoordinates(b,c,!0)}}return this._viewportToImageDelta(b-this._contentBoundsNoRotate.x,c-this._contentBoundsNoRotate.y)},_imageToViewportDelta:function(b,c){var d=this._contentBoundsNoRotate.width;return new a.Point(b/this._contentSizeNoRotate.x*d,c/this._contentSizeNoRotate.x*d)},imageToViewportCoordinates:function(b,c){if(b instanceof a.Point)return this.imageToViewportCoordinates(b.x,b.y);if(this.viewer){var d=this.viewer.world.getItemCount();if(d>1)a.console.error("[Viewport.imageToViewportCoordinates] is not accurate with multi-image; use TiledImage.imageToViewportCoordinates instead.");else if(1===d){var e=this.viewer.world.getItemAt(0);return e.imageToViewportCoordinates(b,c,!0)}}var f=this._imageToViewportDelta(b,c);f.x+=this._contentBoundsNoRotate.x;f.y+=this._contentBoundsNoRotate.y;return f},imageToViewportRectangle:function(b,c,d,e){var f=b;f instanceof a.Rect||(f=new a.Rect(b,c,d,e));if(this.viewer){var g=this.viewer.world.getItemCount();if(g>1)a.console.error("[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.");else if(1===g){var h=this.viewer.world.getItemAt(0);return h.imageToViewportRectangle(b,c,d,e,!0)}}var i=this.imageToViewportCoordinates(f.x,f.y);var j=this._imageToViewportDelta(f.width,f.height);return new a.Rect(i.x,i.y,j.x,j.y,f.degrees)},viewportToImageRectangle:function(b,c,d,e){var f=b;f instanceof a.Rect||(f=new a.Rect(b,c,d,e));if(this.viewer){var g=this.viewer.world.getItemCount();if(g>1)a.console.error("[Viewport.viewportToImageRectangle] is not accurate with multi-image; use TiledImage.viewportToImageRectangle instead.");else if(1===g){var h=this.viewer.world.getItemAt(0);return h.viewportToImageRectangle(b,c,d,e,!0)}}var i=this.viewportToImageCoordinates(f.x,f.y);var j=this._viewportToImageDelta(f.width,f.height);return new a.Rect(i.x,i.y,j.x,j.y,f.degrees)},viewerElementToImageCoordinates:function(a){var b=this.pointFromPixel(a,!0);return this.viewportToImageCoordinates(b)},imageToViewerElementCoordinates:function(a){var b=this.imageToViewportCoordinates(a);return this.pixelFromPoint(b,!0)},windowToImageCoordinates:function(b){a.console.assert(this.viewer,"[Viewport.windowToImageCoordinates] the viewport must have a viewer.");var c=b.minus(a.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(c)},imageToWindowCoordinates:function(b){a.console.assert(this.viewer,"[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");var c=this.imageToViewerElementCoordinates(b);return c.plus(a.getElementPosition(this.viewer.element))},viewerElementToViewportCoordinates:function(a){return this.pointFromPixel(a,!0)},viewportToViewerElementCoordinates:function(a){return this.pixelFromPoint(a,!0)},viewerElementToViewportRectangle:function(b){return a.Rect.fromSummits(this.pointFromPixel(b.getTopLeft(),!0),this.pointFromPixel(b.getTopRight(),!0),this.pointFromPixel(b.getBottomLeft(),!0))},viewportToViewerElementRectangle:function(b){return a.Rect.fromSummits(this.pixelFromPoint(b.getTopLeft(),!0),this.pixelFromPoint(b.getTopRight(),!0),this.pixelFromPoint(b.getBottomLeft(),!0))},windowToViewportCoordinates:function(b){a.console.assert(this.viewer,"[Viewport.windowToViewportCoordinates] the viewport must have a viewer.");var c=b.minus(a.getElementPosition(this.viewer.element));return this.viewerElementToViewportCoordinates(c)},viewportToWindowCoordinates:function(b){a.console.assert(this.viewer,"[Viewport.viewportToWindowCoordinates] the viewport must have a viewer.");var c=this.viewportToViewerElementCoordinates(b);return c.plus(a.getElementPosition(this.viewer.element))},viewportToImageZoom:function(b){if(this.viewer){var c=this.viewer.world.getItemCount();if(c>1)a.console.error("[Viewport.viewportToImageZoom] is not accurate with multi-image.");else if(1===c){var d=this.viewer.world.getItemAt(0);return d.viewportToImageZoom(b)}}var e=this._contentSizeNoRotate.x;var f=this._containerInnerSize.x;var g=this._contentBoundsNoRotate.width;var h=f/e*g;return b*h},imageToViewportZoom:function(b){if(this.viewer){var c=this.viewer.world.getItemCount();if(c>1)a.console.error("[Viewport.imageToViewportZoom] is not accurate with multi-image.");else if(1===c){var d=this.viewer.world.getItemAt(0);return d.imageToViewportZoom(b)}}var e=this._contentSizeNoRotate.x;var f=this._containerInnerSize.x;var g=this._contentBoundsNoRotate.width;var h=e/f/g;return b*h}}}(OpenSeadragon);!function(a){function b(a,b,d,e,f,g,h,i,j){var k=h.getBoundingBox().getTopLeft();var l=h.getBoundingBox().getBottomRight();a.viewer&&a.viewer.raiseEvent("update-level",{tiledImage:a,havedrawn:b,level:e,opacity:f,visibility:g,drawArea:h,topleft:k,bottomright:l,currenttime:i,best:j});m(a.coverage,e);m(a.loadingCoverage,e);var n=a._getCornerTiles(e,k,l);var o=n.topLeft;var p=n.bottomRight;var q=a.source.getNumTiles(e);var r=a.viewport.pixelFromPoint(a.viewport.getCenter());for(var s=o.x;s<=p.x;s++)for(var t=o.y;t<=p.y;t++){if(!a.wrapHorizontal&&!a.wrapVertical){var u=a.source.getTileBounds(e,s,t);if(null===h.intersection(u))continue}j=c(a,d,b,s,t,e,f,g,r,q,i,j)}return j}function c(a,b,c,e,f,j,m,o,p,q,r,s){var t=d(e,f,j,a,a.source,a.tilesMatrix,r,q,a._worldWidthCurrent,a._worldHeightCurrent),u=c;a.viewer&&a.viewer.raiseEvent("update-tile",{tiledImage:a,tile:t});l(a.coverage,j,e,f,!1);var v=t.loaded||t.loading||k(a.loadingCoverage,j,e,f);l(a.loadingCoverage,j,e,f,v);if(!t.exists)return s;b&&!u&&(k(a.coverage,j,e,f)?l(a.coverage,j,e,f,!0):u=!0);if(!u)return s;h(t,a.source.tileOverlap,a.viewport,p,o,a);if(!t.loaded)if(t.context2D)g(a,t);else{var w=a._tileCache.getImageRecord(t.cacheKey);if(w){var x=w.getImage();g(a,t,x)}}if(t.loaded){var y=i(a,t,e,f,j,m,r);y&&(a._needsDraw=!0)}else t.loading?a._tilesLoading++:v||(s=n(s,t));return s}function d(b,c,d,e,f,g,h,i,j,k){var l,m,n,o,p,q,r,s;g[d]||(g[d]={});g[d][b]||(g[d][b]={});if(!g[d][b][c]){l=(i.x+b%i.x)%i.x;m=(i.y+c%i.y)%i.y;n=f.getTileBounds(d,l,m);o=f.tileExists(d,l,m);p=f.getTileUrl(d,l,m);if(e.loadTilesWithAjax){q=f.getTileAjaxHeaders(d,l,m);a.isPlainObject(e.ajaxHeaders)&&(q=a.extend({},e.ajaxHeaders,q))}else q=null;r=f.getContext2D?f.getContext2D(d,l,m):void 0;n.x+=(b-l)/i.x;n.y+=k/j*((c-m)/i.y);g[d][b][c]=new a.Tile(d,b,c,n,o,p,r,e.loadTilesWithAjax,q)}s=g[d][b][c];s.lastTouchTime=h;return s}function e(a,b,c){b.loading=!0;a._imageLoader.addJob({src:b.url,loadWithAjax:b.loadWithAjax,ajaxHeaders:b.ajaxHeaders,crossOriginPolicy:a.crossOriginPolicy,ajaxWithCredentials:a.ajaxWithCredentials,callback:function(d,e,g){f(a,b,c,d,e,g)},abort:function(){b.loading=!1}})}function f(b,c,d,e,f,h){if(e)if(da.visibility?b:b.visibility==a.visibility&&b.squaredDistance1&&i>b.smoothTileEdgesMinZoom&&!b.iOSDevice&&b.getRotation(!0)%360===0&&a.supportsCanvas){e=!0;f=d.getScaleForEdgeSmoothing();g=d.getTranslationForEdgeSmoothing(f,b._drawer.getCanvasSize(!1),b._drawer.getCanvasSize(!0))}var j;if(e){f||(j=b.viewport.viewportToViewerElementRectangle(b.getClippedBounds(!0)).getIntegerBoundingBox().times(a.pixelDensityRatio));b._drawer._clear(!0,j)}if(!f){0!==b.viewport.degrees&&b._drawer._offsetForRotation({degrees:b.viewport.degrees,useSketch:e});b.getRotation(!0)%360!==0&&b._drawer._offsetForRotation({degrees:b.getRotation(!0),point:b.viewport.pixelFromPointNoRotate(b._getRotationPoint(!0),!0),useSketch:e})}var k=!1;if(b._clip){b._drawer.saveContext(e);var l=b.imageToViewportRectangle(b._clip,!0);l=l.rotate(-b.getRotation(!0),b._getRotationPoint(!0));var m=b._drawer.viewportToDrawerRectangle(l);f&&(m=m.times(f));g&&(m=m.translate(g));b._drawer.setClip(m,e);k=!0}if(b.placeholderFillStyle&&b._hasOpaqueTile===!1){var n=b._drawer.viewportToDrawerRectangle(b.getBounds(!0));f&&(n=n.times(f));g&&(n=n.translate(g));var o=null;o="function"==typeof b.placeholderFillStyle?b.placeholderFillStyle(b,b._drawer.context):b.placeholderFillStyle;b._drawer.drawRectangle(n,o,e)}for(var q=c.length-1;q>=0;q--){d=c[q];b._drawer.drawTile(d,b._drawingHandler,e,f,g);d.beingDrawn=!0;b.viewer&&b.viewer.raiseEvent("tile-drawn",{tiledImage:b,tile:d})}k&&b._drawer.restoreContext(e);if(!f){b.getRotation(!0)%360!==0&&b._drawer._restoreRotationChanges(e);0!==b.viewport.degrees&&b._drawer._restoreRotationChanges(e)}if(e){if(f){0!==b.viewport.degrees&&b._drawer._offsetForRotation({degrees:b.viewport.degrees,useSketch:!1});b.getRotation(!0)%360!==0&&b._drawer._offsetForRotation({degrees:b.getRotation(!0),point:b.viewport.pixelFromPointNoRotate(b._getRotationPoint(!0),!0),useSketch:!1})}b._drawer.blendSketch({opacity:b.opacity,scale:f,translate:g,compositeOperation:b.compositeOperation,bounds:j});if(f){b.getRotation(!0)%360!==0&&b._drawer._restoreRotationChanges(!1);0!==b.viewport.degrees&&b._drawer._restoreRotationChanges(!1)}}p(b,c)}}function p(b,c){if(b.debugMode)for(var d=c.length-1;d>=0;d--){var e=c[d];try{b._drawer.drawDebugInfo(e,c.length,d,b)}catch(b){a.console.error(b)}}}a.TiledImage=function(b){var c=this;a.console.assert(b.tileCache,"[TiledImage] options.tileCache is required");a.console.assert(b.drawer,"[TiledImage] options.drawer is required");a.console.assert(b.viewer,"[TiledImage] options.viewer is required");a.console.assert(b.imageLoader,"[TiledImage] options.imageLoader is required");a.console.assert(b.source,"[TiledImage] options.source is required");a.console.assert(!b.clip||b.clip instanceof a.Rect,"[TiledImage] options.clip must be an OpenSeadragon.Rect if present");a.EventSource.call(this);this._tileCache=b.tileCache;delete b.tileCache;this._drawer=b.drawer;delete b.drawer;this._imageLoader=b.imageLoader;delete b.imageLoader;b.clip instanceof a.Rect&&(this._clip=b.clip.clone());delete b.clip;var d=b.x||0;delete b.x;var e=b.y||0;delete b.y;this.normHeight=b.source.dimensions.y/b.source.dimensions.x;this.contentAspectX=b.source.dimensions.x/b.source.dimensions.y;var f=1;if(b.width){f=b.width;delete b.width;if(b.height){a.console.error("specifying both width and height to a tiledImage is not supported");delete b.height}}else if(b.height){f=b.height/this.normHeight;delete b.height}var g=b.fitBounds;delete b.fitBounds;var h=b.fitBoundsPlacement||OpenSeadragon.Placement.CENTER;delete b.fitBoundsPlacement;var i=b.degrees||0;delete b.degrees;a.extend(!0,this,{viewer:null,tilesMatrix:{},coverage:{},loadingCoverage:{},lastDrawn:[],lastResetTime:0,_midDraw:!1,_needsDraw:!0,_hasOpaqueTile:!1,_tilesLoading:0,springStiffness:a.DEFAULT_SETTINGS.springStiffness,animationTime:a.DEFAULT_SETTINGS.animationTime,minZoomImageRatio:a.DEFAULT_SETTINGS.minZoomImageRatio,wrapHorizontal:a.DEFAULT_SETTINGS.wrapHorizontal,wrapVertical:a.DEFAULT_SETTINGS.wrapVertical,immediateRender:a.DEFAULT_SETTINGS.immediateRender,blendTime:a.DEFAULT_SETTINGS.blendTime,alwaysBlend:a.DEFAULT_SETTINGS.alwaysBlend,minPixelRatio:a.DEFAULT_SETTINGS.minPixelRatio,smoothTileEdgesMinZoom:a.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,iOSDevice:a.DEFAULT_SETTINGS.iOSDevice,debugMode:a.DEFAULT_SETTINGS.debugMode,crossOriginPolicy:a.DEFAULT_SETTINGS.crossOriginPolicy,ajaxWithCredentials:a.DEFAULT_SETTINGS.ajaxWithCredentials,placeholderFillStyle:a.DEFAULT_SETTINGS.placeholderFillStyle,opacity:a.DEFAULT_SETTINGS.opacity,preload:a.DEFAULT_SETTINGS.preload,compositeOperation:a.DEFAULT_SETTINGS.compositeOperation},b);this._preload=this.preload;delete this.preload;this._fullyLoaded=!1;this._xSpring=new a.Spring({initial:d,springStiffness:this.springStiffness,animationTime:this.animationTime});this._ySpring=new a.Spring({initial:e,springStiffness:this.springStiffness,animationTime:this.animationTime});this._scaleSpring=new a.Spring({initial:f,springStiffness:this.springStiffness,animationTime:this.animationTime});this._degreesSpring=new a.Spring({initial:i,springStiffness:this.springStiffness,animationTime:this.animationTime});this._updateForScale();g&&this.fitBounds(g,h,!0);this._drawingHandler=function(b){c.viewer.raiseEvent("tile-drawing",a.extend({tiledImage:c},b))}};a.extend(a.TiledImage.prototype,a.EventSource.prototype,{needsDraw:function(){return this._needsDraw},getFullyLoaded:function(){return this._fullyLoaded},_setFullyLoaded:function(a){if(a!==this._fullyLoaded){this._fullyLoaded=a;this.raiseEvent("fully-loaded-change",{fullyLoaded:this._fullyLoaded})}},reset:function(){this._tileCache.clearTilesFor(this);this.lastResetTime=a.now();this._needsDraw=!0},update:function(){var a=this._xSpring.update();var b=this._ySpring.update();var c=this._scaleSpring.update();var d=this._degreesSpring.update();if(a||b||c||d){this._updateForScale();this._needsDraw=!0;return!0}return!1},draw:function(){if(0!==this.opacity||this._preload){this._midDraw=!0;this._updateViewport();this._midDraw=!1}},destroy:function(){this.reset()},getBounds:function(a){return this.getBoundsNoRotate(a).rotate(this.getRotation(a),this._getRotationPoint(a))},getBoundsNoRotate:function(b){return b?new a.Rect(this._xSpring.current.value,this._ySpring.current.value,this._worldWidthCurrent,this._worldHeightCurrent):new a.Rect(this._xSpring.target.value,this._ySpring.target.value,this._worldWidthTarget,this._worldHeightTarget)},getWorldBounds:function(){a.console.error("[TiledImage.getWorldBounds] is deprecated; use TiledImage.getBounds instead");return this.getBounds()},getClippedBounds:function(b){var c=this.getBoundsNoRotate(b);if(this._clip){var d=b?this._worldWidthCurrent:this._worldWidthTarget;var e=d/this.source.dimensions.x;var f=this._clip.times(e);c=new a.Rect(c.x+f.x,c.y+f.y,f.width,f.height)}return c.rotate(this.getRotation(b),this._getRotationPoint(b))},getContentSize:function(){return new a.Point(this.source.dimensions.x,this.source.dimensions.y)},_viewportToImageDelta:function(b,c,d){var e=d?this._scaleSpring.current.value:this._scaleSpring.target.value;return new a.Point(b*(this.source.dimensions.x/e),c*(this.source.dimensions.y*this.contentAspectX/e))},viewportToImageCoordinates:function(b,c,d){var e;if(b instanceof a.Point){d=c;e=b}else e=new a.Point(b,c);e=e.rotate(-this.getRotation(d),this._getRotationPoint(d));return d?this._viewportToImageDelta(e.x-this._xSpring.current.value,e.y-this._ySpring.current.value):this._viewportToImageDelta(e.x-this._xSpring.target.value,e.y-this._ySpring.target.value)},_imageToViewportDelta:function(b,c,d){var e=d?this._scaleSpring.current.value:this._scaleSpring.target.value;return new a.Point(b/this.source.dimensions.x*e,c/this.source.dimensions.y/this.contentAspectX*e)},imageToViewportCoordinates:function(b,c,d){if(b instanceof a.Point){d=c;c=b.y;b=b.x}var e=this._imageToViewportDelta(b,c);if(d){e.x+=this._xSpring.current.value;e.y+=this._ySpring.current.value}else{e.x+=this._xSpring.target.value;e.y+=this._ySpring.target.value}return e.rotate(this.getRotation(d),this._getRotationPoint(d))},imageToViewportRectangle:function(b,c,d,e,f){var g=b;g instanceof a.Rect?f=c:g=new a.Rect(b,c,d,e);var h=this.imageToViewportCoordinates(g.getTopLeft(),f);var i=this._imageToViewportDelta(g.width,g.height,f);return new a.Rect(h.x,h.y,i.x,i.y,g.degrees+this.getRotation(f))},viewportToImageRectangle:function(b,c,d,e,f){var g=b;b instanceof a.Rect?f=c:g=new a.Rect(b,c,d,e);var h=this.viewportToImageCoordinates(g.getTopLeft(),f);var i=this._viewportToImageDelta(g.width,g.height,f);return new a.Rect(h.x,h.y,i.x,i.y,g.degrees-this.getRotation(f))},viewerElementToImageCoordinates:function(a){var b=this.viewport.pointFromPixel(a,!0);return this.viewportToImageCoordinates(b)},imageToViewerElementCoordinates:function(a){var b=this.imageToViewportCoordinates(a);return this.viewport.pixelFromPoint(b,!0)},windowToImageCoordinates:function(a){var b=a.minus(OpenSeadragon.getElementPosition(this.viewer.element));return this.viewerElementToImageCoordinates(b)},imageToWindowCoordinates:function(a){var b=this.imageToViewerElementCoordinates(a);return b.plus(OpenSeadragon.getElementPosition(this.viewer.element))},_viewportToTiledImageRectangle:function(b){var c=this._scaleSpring.current.value;b=b.rotate(-this.getRotation(!0),this._getRotationPoint(!0));return new a.Rect((b.x-this._xSpring.current.value)/c,(b.y-this._ySpring.current.value)/c,b.width/c,b.height/c,b.degrees)},viewportToImageZoom:function(a){var b=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return b*a},imageToViewportZoom:function(a){var b=this._scaleSpring.current.value*this.viewport._containerInnerSize.x/this.source.dimensions.x;return a/b},setPosition:function(a,b){var c=this._xSpring.target.value===a.x&&this._ySpring.target.value===a.y;if(b){if(c&&this._xSpring.current.value===a.x&&this._ySpring.current.value===a.y)return;this._xSpring.resetTo(a.x);this._ySpring.resetTo(a.y);this._needsDraw=!0}else{if(c)return;this._xSpring.springTo(a.x);this._ySpring.springTo(a.y);this._needsDraw=!0}c||this._raiseBoundsChange()},setWidth:function(a,b){this._setScale(a,b)},setHeight:function(a,b){this._setScale(a/this.normHeight,b)},fitBounds:function(b,c,d){c=c||a.Placement.CENTER;var e=a.Placement.properties[c];var f=this.contentAspectX;var g=0;var h=0;var i=1;var j=1;if(this._clip){f=this._clip.getAspectRatio();i=this._clip.width/this.source.dimensions.x;j=this._clip.height/this.source.dimensions.y;if(b.getAspectRatio()>f){g=this._clip.x/this._clip.height*b.height;h=this._clip.y/this._clip.height*b.height}else{g=this._clip.x/this._clip.width*b.width;h=this._clip.y/this._clip.width*b.width}}if(b.getAspectRatio()>f){var k=b.height/j;var l=0;e.isHorizontallyCentered?l=(b.width-b.height*f)/2:e.isRight&&(l=b.width-b.height*f);this.setPosition(new a.Point(b.x-g+l,b.y-h),d);this.setHeight(k,d)}else{var m=b.width/i;var n=0;e.isVerticallyCentered?n=(b.height-b.width/f)/2:e.isBottom&&(n=b.height-b.width/f);this.setPosition(new a.Point(b.x-g,b.y-h+n),d);this.setWidth(m,d)}},getClip:function(){return this._clip?this._clip.clone():null},setClip:function(b){a.console.assert(!b||b instanceof a.Rect,"[TiledImage.setClip] newClip must be an OpenSeadragon.Rect or null");b instanceof a.Rect?this._clip=b.clone():this._clip=null;this._needsDraw=!0;this.raiseEvent("clip-change")},getOpacity:function(){return this.opacity},setOpacity:function(a){if(a!==this.opacity){this.opacity=a;this._needsDraw=!0;this.raiseEvent("opacity-change",{opacity:this.opacity})}},getPreload:function(){return this._preload},setPreload:function(a){this._preload=!!a;this._needsDraw=!0},getRotation:function(a){return a?this._degreesSpring.current.value:this._degreesSpring.target.value},setRotation:function(a,b){if(this._degreesSpring.target.value!==a||!this._degreesSpring.isAtTargetValue()){b?this._degreesSpring.resetTo(a):this._degreesSpring.springTo(a);this._needsDraw=!0;this._raiseBoundsChange()}},_getRotationPoint:function(a){return this.getBoundsNoRotate(a).getCenter()},getCompositeOperation:function(){return this.compositeOperation},setCompositeOperation:function(a){if(a!==this.compositeOperation){this.compositeOperation=a;this._needsDraw=!0;this.raiseEvent("composite-operation-change",{compositeOperation:this.compositeOperation})}},_setScale:function(a,b){var c=this._scaleSpring.target.value===a;if(b){if(c&&this._scaleSpring.current.value===a)return;this._scaleSpring.resetTo(a);this._updateForScale();this._needsDraw=!0}else{if(c)return;this._scaleSpring.springTo(a);this._updateForScale();this._needsDraw=!0}c||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 a=Math.max(this.source.minLevel,Math.floor(Math.log(this.minZoomImageRatio)/Math.log(2)));var b=this.viewport.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(0),!0).x*this._scaleSpring.current.value;var c=Math.min(Math.abs(this.source.maxLevel),Math.abs(Math.floor(Math.log(b/this.minPixelRatio)/Math.log(2))));a=Math.min(a,c);return{lowestLevel:a,highestLevel:c}},_updateViewport:function(){this._needsDraw=!1;this._tilesLoading=0;this.loadingCoverage={};for(;this.lastDrawn.length>0;){var c=this.lastDrawn.pop();c.beingDrawn=!1}var d=this.viewport;var f=this._viewportToTiledImageRectangle(d.getBoundsWithMargins(!0));if(!this.wrapHorizontal&&!this.wrapVertical){var g=this._viewportToTiledImageRectangle(this.getClippedBounds(!0));f=f.intersection(g);if(null===f)return}var h=this._getLevelsInterval();var i=h.lowestLevel;var k=h.highestLevel;var l=null;var m=!1;var n=a.now();for(var p=k;p>=i;p--){var q=!1;var r=d.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(p),!0).x*this._scaleSpring.current.value;if(p===i||!m&&r>=this.minPixelRatio){q=!0;m=!0}else if(!m)continue;var s=d.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(p),!1).x*this._scaleSpring.current.value;var t=d.deltaPixelsFromPointsNoRotate(this.source.getPixelRatio(Math.max(this.source.getClosestLevel(),0)),!1).x*this._scaleSpring.current.value;var u=this.immediateRender?1:t;var v=Math.min(1,(r-.5)/.5);var w=u/Math.abs(u-s);l=b(this,m,q,p,v,w,f,n,l);if(j(this.coverage,p))break}o(this,this.lastDrawn);if(l&&!l.context2D){e(this,l,n);this._needsDraw=!0;this._setFullyLoaded(!1)}else this._setFullyLoaded(0===this._tilesLoading)},_getCornerTiles:function(b,c,d){var e;var f;if(this.wrapHorizontal){e=a.positiveModulo(c.x,1);f=a.positiveModulo(d.x,1)}else{e=Math.max(0,c.x);f=Math.min(1,d.x)}var g;var h;var i=1/this.source.aspectRatio;if(this.wrapVertical){g=a.positiveModulo(c.y,i);h=a.positiveModulo(d.y,i)}else{g=Math.max(0,c.y);h=Math.min(i,d.y)}var j=this.source.getTileAtPoint(b,new a.Point(e,g));var k=this.source.getTileAtPoint(b,new a.Point(f,h));var l=this.source.getNumTiles(b);if(this.wrapHorizontal){j.x+=l.x*Math.floor(c.x);k.x+=l.x*Math.floor(d.x)}if(this.wrapVertical){j.y+=l.y*Math.floor(c.y/i);k.y+=l.y*Math.floor(d.y/i)}return{topLeft:j,bottomRight:k}}})}(OpenSeadragon);!function(a){var b=function(b){a.console.assert(b,"[TileCache.cacheTile] options is required");a.console.assert(b.tile,"[TileCache.cacheTile] options.tile is required");a.console.assert(b.tiledImage,"[TileCache.cacheTile] options.tiledImage is required");this.tile=b.tile;this.tiledImage=b.tiledImage};var c=function(b){a.console.assert(b,"[ImageRecord] options is required");a.console.assert(b.image,"[ImageRecord] options.image is required");this._image=b.image;this._tiles=[]};c.prototype={destroy:function(){this._image=null;this._renderedContext=null;this._tiles=null},getImage:function(){return this._image},getRenderedContext:function(){if(!this._renderedContext){var a=document.createElement("canvas");a.width=this._image.width;a.height=this._image.height;this._renderedContext=a.getContext("2d");this._renderedContext.drawImage(this._image,0,0);this._image=null}return this._renderedContext},setRenderedContext:function(b){a.console.error("ImageRecord.setRenderedContext is deprecated. The rendered context should be created by the ImageRecord itself when calling ImageRecord.getRenderedContext.");this._renderedContext=b},addTile:function(b){a.console.assert(b,"[ImageRecord.addTile] tile is required");this._tiles.push(b)},removeTile:function(b){for(var c=0;cthis._maxImageCacheCount){var h=null;var i=-1;var j=null;var k,l,m,n,o,p;for(var q=this._tilesLoaded.length-1;q>=0;q--){p=this._tilesLoaded[q];k=p.tile;if(!(k.level<=e||k.beingDrawn))if(h){n=k.lastTouchTime;l=h.lastTouchTime;o=k.level;m=h.level;if(nm){h=k;i=q;j=p}}else{h=k;i=q;j=p}}if(h&&i>=0){this._unloadTile(j);f=i}}this._tilesLoaded[f]=new b({tile:d.tile,tiledImage:d.tiledImage})},clearTilesFor:function(b){a.console.assert(b,"[TileCache.clearTilesFor] tiledImage is required");var c;for(var d=0;d=this._items.length)throw new Error("Index bigger than number of layers.");if(c!==d&&d!==-1){this._items.splice(d,1);this._items.splice(c,0,b);this._needsDraw=!0;this.raiseEvent("item-index-change",{item:b,previousIndex:d,newIndex:c})}},removeItem:function(b){a.console.assert(b,"[World.removeItem] item is required");var c=a.indexOf(this._items,b);if(c!==-1){b.removeHandler("bounds-change",this._delegatedFigureSizes);b.removeHandler("clip-change",this._delegatedFigureSizes);b.destroy();this._items.splice(c,1);this._figureSizes();this._needsDraw=!0;this._raiseRemoveItem(b)}},removeAll:function(){this.viewer._cancelPendingImages();var a;var b;for(b=0;bn.height?g:g*(n.width/n.height);p=o*(n.height/n.width);q=new a.Point(k+(g-o)/2,l+(g-p)/2);m.setPosition(q,c);m.setWidth(o,c);"horizontal"===d?k+=i:l+=i}this.setAutoRefigureSizes(!0)},_figureSizes:function(){var b=this._homeBounds?this._homeBounds.clone():null;var c=this._contentSize?this._contentSize.clone():null;var d=this._contentFactor||0;if(this._items.length){var e=this._items[0];var f=e.getBounds();this._contentFactor=e.getContentSize().x/f.width;var g=e.getClippedBounds().getBoundingBox();var h=g.x;var i=g.y;var j=g.x+g.width;var k=g.y+g.height;for(var l=1;l 'DLA Kachelviewer', + 'description' => 'DLA Kachelviewer auf Basis von OpenSeadragon', + 'category' => 'plugin', + 'author' => 'Alexander Harm', + 'author_company' => 'DLA Marbach', + 'author_email' => 'wdv@dla-marbach.de', + 'dependencies' => 'extbase,fluid', + 'state' => 'beta', + 'clearCacheOnLoad' => '1', + 'version' => '2.0.0', + 'constraints' => array( + 'depends' => array( + 'typo3' => '6.2.0-0.0.0', + 'extbase' => '1.0.0-0.0.0', + 'fluid' => '1.0.0-0.0.0', + ) + ) + ); +?> \ No newline at end of file diff --git a/dla_kachelviewer/ext_icon.gif b/dla_kachelviewer/ext_icon.gif new file mode 100644 index 0000000..4c48f50 Binary files /dev/null and b/dla_kachelviewer/ext_icon.gif differ diff --git a/dla_kachelviewer/ext_localconf.php b/dla_kachelviewer/ext_localconf.php new file mode 100644 index 0000000..899bc93 --- /dev/null +++ b/dla_kachelviewer/ext_localconf.php @@ -0,0 +1,11 @@ + 'deepzoom') + ); + +?> \ No newline at end of file diff --git a/dla_kachelviewer/ext_tables.php b/dla_kachelviewer/ext_tables.php new file mode 100755 index 0000000..1b6041c --- /dev/null +++ b/dla_kachelviewer/ext_tables.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..ee15496 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,14 @@ +{ + "name": "dla_kachelviewer", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "openseadragon": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/openseadragon/-/openseadragon-2.3.0.tgz", + "integrity": "sha1-iZ/j3lQ/9R1+Ftu7g//6ByCjshE=", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..b9ca649 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "dla_kachelviewer", + "version": "2.0.0", + "description": "A Typo3-Extension to view DeepZoomImages using OpenSeadragon", + "dependencies": {}, + "devDependencies": { + "openseadragon": "^2.3.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": "git+https://github.com/dla-marbach/dla_kachelviewer.git", + "author": "Alexander Harm", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/dla-marbach/dla_kachelviewer/issues" + }, + "homepage": "https://github.com/dla-marbach/dla_kachelviewer#readme", + "main": "index.js" +}