diff --git a/app/assets/stylesheets/components/viewer.scss b/app/assets/stylesheets/components/viewer.scss index f98699b94f..545281c454 100644 --- a/app/assets/stylesheets/components/viewer.scss +++ b/app/assets/stylesheets/components/viewer.scss @@ -31,4 +31,5 @@ left: 0; width: 100%; height: 100%; + border: none; } diff --git a/app/controllers/downloads_controller.rb b/app/controllers/downloads_controller.rb index d28850fd37..4172377e1a 100644 --- a/app/controllers/downloads_controller.rb +++ b/app/controllers/downloads_controller.rb @@ -34,7 +34,7 @@ def send_hls playlist.items.each do |item| item.segment = "#{item.segment}?auth_token=#{params[:auth_token]}" end - render plain: playlist.to_s + send_data(playlist.to_s, type: "application/x-mpegurl", disposition: :inline) end def send_fgdc diff --git a/app/javascript/entrypoints/viewer.js b/app/javascript/entrypoints/viewer.js index e075ea31a1..712abddc9e 100644 --- a/app/javascript/entrypoints/viewer.js +++ b/app/javascript/entrypoints/viewer.js @@ -1,9 +1,4 @@ import UVManager from '@viewer/uv_manager' import 'leaflet/dist/leaflet.css' const UVManagerInstance = new UVManager() -let timer = window.setInterval(() => { - if (window.UV !== undefined) { - UVManagerInstance.initialize() - window.clearInterval(timer) - } -}, 5) +UVManagerInstance.initialize() diff --git a/app/javascript/test/viewer/uv_manager.spec.js b/app/javascript/test/viewer/uv_manager.spec.js index 713a1ff7dd..62b5005e0f 100644 --- a/app/javascript/test/viewer/uv_manager.spec.js +++ b/app/javascript/test/viewer/uv_manager.spec.js @@ -1,6 +1,21 @@ +import { init, IIIFURLAdapter } from 'universalviewer'; import UVManager from '@viewer/uv_manager' import jQ from 'jquery' vi.mock('viewer/cdl_timer') +vi.mock('universalviewer', () => ({ + init: vi.fn().mockImplementation(() => { + return { on: vi.fn() } + }), + IIIFURLAdapter: vi.fn().mockImplementation(() => { + return { + get: global.getResult, + getInitialData: vi.fn().mockImplementation(() => { + return {} + }) + } + }) +})) + describe('UVManager', () => { const initialHTML = '

' + @@ -72,13 +87,7 @@ describe('UVManager', () => { return 'https://figgy.princeton.edu/uv/uv_config.json' } else { return null } }) - - // This makes it so global.UV.URLDataProvider.get returns our mock data - const provider = vi.fn().mockImplementation(() => { - return { get: getResult } - }) - global.UV = { URLDataProvider: provider } - global.createUV = vi.fn() + global.getResult = getResult // Allow window location assign const location = window.location vi.spyOn(location, 'assign').mockImplementation(() => true) diff --git a/app/javascript/viewer/uv_manager.js b/app/javascript/viewer/uv_manager.js index f5dd09a7d7..6feceac8a9 100644 --- a/app/javascript/viewer/uv_manager.js +++ b/app/javascript/viewer/uv_manager.js @@ -1,4 +1,5 @@ -/* global UV, $, createUV */ +import { init, IIIFURLAdapter } from "universalviewer"; +import "universalviewer/dist/esm/index.css"; import CDLTimer from '@viewer/cdl_timer' import IIIFLogo from '@images/iiif-logo.svg' import StatementOnHarmfulContentIcon from '@images/statement.png' @@ -24,7 +25,7 @@ export default class UVManager { return window.location.assign('/viewer/' + this.figgyId + '/auth') } else if (result.embed.status === 'authorized') { this.displayNotice(result) - this.createUV(null, null, result) + this.createUV(result) await this.buildLeafletViewer() } } else { @@ -90,25 +91,46 @@ export default class UVManager { return this.leafletViewer.loadLeaflet() } - createUV (data, status, graphqlData) { + createUV (graphqlData) { this.tabManager.onTabSelect(() => setTimeout(() => this.resize(), 100)) this.processTitle(graphqlData) this.uvElement.show() - this.uv = createUV('#uv', { - root: 'uv', - iiifResourceUri: this.manifest, - configUri: this.configURI, - collectionIndex: Number(this.urlDataProvider.get('c', 0)), - manifestIndex: Number(this.urlDataProvider.get('m', 0)), - sequenceIndex: Number(this.urlDataProvider.get('s', 0)), - canvasIndex: Number(this.urlDataProvider.get('cv', 0)), - rangeId: this.urlDataProvider.get('rid', 0), - rotation: Number(this.urlDataProvider.get('r', 0)), - xywh: this.urlDataProvider.get('xywh', ''), + + // const opts = { + // manifest: this.manifest, + // embedded: true, + // collectionIndex: + // this.iiifUrlAdapter.get('c') !== undefined + // ? Number(this.iiifUrlAdapter.get('c')) + // : undefined, + // manifestIndex: Number(this.iiifUrlAdapter.get('m', 0)), + // canvasIndex: Number(this.iiifUrlAdapter.get('cv', 0)), + // rotation: Number(this.iiifUrlAdapter.get('r', 0)), + // rangeId: this.iiifUrlAdapter.get('rid', ''), + // xywh: this.iiifUrlAdapter.get('xywh', ''), + // sequenceIndex: Number(this.iiifUrlAdapter.get('s', 0)) + // } + + const opts = this.iiifUrlAdapter.getInitialData({ + manifest: this.manifest, embedded: true - }, this.urlDataProvider) + }) + this.cdlTimer = new CDLTimer(this.figgyId) this.cdlTimer.initializeTimer() + + let uv = init('uv', opts) + + const configPath = this.configURI + uv.on('configure', function ({ config, cb }) { + cb( + new Promise(function (resolve) { + fetch(configPath).then(function (response) { + resolve(response.json()) + }) + }) + ) + }) } addViewerIcons () { @@ -187,7 +209,7 @@ export default class UVManager { if (this.isFiggyManifest) { return '/viewer/config/' + this.manifest.replace('/manifest', '').replace(/.*\//, '') + '.json' } else { - return this.urlDataProvider.get('config') + return this.iiifUrlAdapter.get('config') } } @@ -213,7 +235,8 @@ export default class UVManager { this.uvElement.width(windowWidth) this.uvElement.height(windowHeight - titleHeight - tabHeight) this.uvElement.children('div').height(windowHeight - titleHeight - tabHeight) - this.waitForElementToDisplay('button.share', 1000, this.addViewerIcons.bind(this)) + // TODO: Viewer icons method not working + // this.waitForElementToDisplay('button.share', 1000, this.addViewerIcons.bind(this)) if (this.uv) { this.uv.resize() } } @@ -237,12 +260,12 @@ export default class UVManager { }) } - get urlDataProvider () { - return new UV.URLDataProvider(false) + get iiifUrlAdapter () { + return new IIIFURLAdapter() } get manifest () { - return this.urlDataProvider.get('manifest') + return this.iiifUrlAdapter.get('manifest') } get uvElement () { diff --git a/app/services/manifest_builder.rb b/app/services/manifest_builder.rb index e09b2b00b1..bae22ead85 100644 --- a/app/services/manifest_builder.rb +++ b/app/services/manifest_builder.rb @@ -637,7 +637,7 @@ def display_content format: "application/vnd.apple.mpegurl", label: resource.title.first, duration: file.duration.first.to_f, - type: "Audio" # required for the viewer to play audio correctly + type: "Sound" # required for the viewer to play audio correctly ) end diff --git a/app/services/manifest_builder/canvas_rendering_builder.rb b/app/services/manifest_builder/canvas_rendering_builder.rb index cba151e49a..608adf5f94 100644 --- a/app/services/manifest_builder/canvas_rendering_builder.rb +++ b/app/services/manifest_builder/canvas_rendering_builder.rb @@ -133,7 +133,7 @@ def mp3_file_hash { "id" => download_url, - "type" => "Audio", + "type" => "Sound", "label" => "Download the mp3", "format" => mp3_file.mime_type.first } diff --git a/app/values/viewer_configuration.rb b/app/values/viewer_configuration.rb index beb2d75098..6c0ed7a013 100644 --- a/app/values/viewer_configuration.rb +++ b/app/values/viewer_configuration.rb @@ -7,7 +7,7 @@ def self.default_values { "modules" => { - "pagingHeaderPanel" => + "headerPanel" => { "options" => { @@ -15,7 +15,7 @@ def self.default_values "imageSelectionBoxEnabled" => true } }, - "contentLeftPanel" => + "leftPanel" => { "options" => { @@ -30,17 +30,11 @@ def self.default_values "shareEnabled" => true } }, - "avCenterPanel" => - { - "options" => - { - "posterImageExpanded" => true - } - }, - "seadragonCenterPanel" => + "centerPanel" => { "options" => { + "posterImageExpanded" => true, "immediateRender" => true, "maxZoomPixelRatio" => 1.0 } diff --git a/app/views/layouts/viewer_layout.html.erb b/app/views/layouts/viewer_layout.html.erb index c2602ba425..bdb758f817 100644 --- a/app/views/layouts/viewer_layout.html.erb +++ b/app/views/layouts/viewer_layout.html.erb @@ -2,16 +2,12 @@ <%= csrf_meta_tag %> - + <%= vite_javascript_tag 'viewer' %> <%= stylesheet_link_tag 'viewer' %> <%= yield :head %> - - - <%= yield %> - diff --git a/package.json b/package.json index 943ae2482c..022b41ce9c 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "flush-promises": "^1.0.2", "graphql": "^16.8.1", "graphql-tag": "^2.9.2", + "hls.js": "^1.4.10", "leaflet": "^1.7.1", "lodash": "^4.17.21", "lux-design-system": "4.5.2", @@ -33,6 +34,7 @@ "sass": "^1.62.1", "unfetch": "^4.0.1", "uppy": "^3.9.1", + "universalviewer": "https://pkg.csb.dev/UniversalViewer/universalviewer/commit/3930eefe/universalviewer", "vue": "^2.5.17", "vue-details": "^1.1.0", "vue-loader": "^15.4.2", diff --git a/public/uv/build.js.map b/public/uv/build.js.map deleted file mode 100644 index 0c05cd423d..0000000000 --- a/public/uv/build.js.map +++ /dev/null @@ -1,236 +0,0 @@ -{ - "version": 3, - "sources": [ - "../node_modules/requirejs/require.js", - "lib/base64.min.js", - "lib/browserdetect.js", - "lib/detectmobilebrowser.js", - "lib/jquery.xdomainrequest.js", - "lib/modernizr.js", - "lib/ex.es3.min.js", - "lib/BaseComponent.js", - "lib/KeyCodes.js", - "lib/HTTPStatusCode.js", - "lib/jquery-plugins.js", - "lib/ba-tiny-pubsub.js", - "lib/manifesto.js", - "lib/manifold.js", - "lib/Utils.js", - "lib/xss.min.js", - "UVDataProvider.js", - "URLDataProvider.js", - "modules/uv-shared-module/BaseEvents.js", - "modules/uv-shared-module/Panel.js", - "modules/uv-shared-module/BaseView.js", - "modules/uv-shared-module/Position.js", - "Utils.js", - "modules/uv-shared-module/CenterPanel.js", - "modules/uv-avcenterpanel-module/AVCenterPanel.js", - "modules/uv-shared-module/InformationArgs.js", - "modules/uv-shared-module/InformationType.js", - "modules/uv-shared-module/LoginWarningMessages.js", - "modules/uv-shared-module/Auth09.js", - "modules/uv-shared-module/Auth1.js", - "modules/uv-shared-module/Dialogue.js", - "modules/uv-dialogues-module/AuthDialogue.js", - "modules/uv-dialogues-module/ClickThroughDialogue.js", - "modules/uv-dialogues-module/LoginDialogue.js", - "modules/uv-shared-module/StringValue.js", - "modules/uv-shared-module/MetricType.js", - "modules/uv-dialogues-module/RestrictedDialogue.js", - "modules/uv-shared-module/GenericDialogue.js", - "modules/uv-shared-module/Shell.js", - "SynchronousRequire.js", - "modules/uv-shared-module/BaseExtension.js", - "modules/uv-contentleftpanel-module/GalleryView.js", - "modules/uv-shared-module/BaseExpandPanel.js", - "modules/uv-shared-module/LeftPanel.js", - "extensions/uv-seadragon-extension/Mode.js", - "modules/uv-shared-module/ThumbsView.js", - "extensions/uv-seadragon-extension/Events.js", - "modules/uv-contentleftpanel-module/ThumbsView.js", - "modules/uv-contentleftpanel-module/TreeView.js", - "modules/uv-contentleftpanel-module/ContentLeftPanel.js", - "modules/uv-shared-module/DownloadOption.js", - "modules/uv-dialogues-module/DownloadDialogue.js", - "extensions/uv-av-extension/DownloadDialogue.js", - "modules/uv-shared-module/FooterPanel.js", - "modules/uv-avmobilefooterpanel-module/MobileFooter.js", - "modules/uv-shared-module/Information.js", - "modules/uv-shared-module/InformationAction.js", - "modules/uv-shared-module/InformationFactory.js", - "modules/uv-shared-module/HeaderPanel.js", - "modules/uv-shared-module/RightPanel.js", - "modules/uv-moreinforightpanel-module/MoreInfoRightPanel.js", - "modules/uv-dialogues-module/SettingsDialogue.js", - "extensions/uv-av-extension/SettingsDialogue.js", - "modules/uv-dialogues-module/ShareDialogue.js", - "extensions/uv-av-extension/ShareDialogue.js", - "extensions/uv-av-extension/Extension.js", - "modules/uv-filelinkcenterpanel-module/FileLinkCenterPanel.js", - "modules/uv-dialogues-module/HelpDialogue.js", - "modules/uv-resourcesleftpanel-module/ThumbsView.js", - "modules/uv-resourcesleftpanel-module/ResourcesLeftPanel.js", - "extensions/uv-default-extension/SettingsDialogue.js", - "extensions/uv-default-extension/ShareDialogue.js", - "extensions/uv-default-extension/Extension.js", - "modules/uv-shared-module/Bookmark.js", - "extensions/uv-mediaelement-extension/DownloadDialogue.js", - "extensions/uv-mediaelement-extension/Events.js", - "modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel.js", - "extensions/uv-mediaelement-extension/SettingsDialogue.js", - "extensions/uv-mediaelement-extension/ShareDialogue.js", - "extensions/uv-mediaelement-extension/Extension.js", - "modules/uv-shared-module/AnnotationResults.js", - "modules/uv-shared-module/Point.js", - "extensions/uv-seadragon-extension/CroppedImageDimensions.js", - "extensions/uv-seadragon-extension/DownloadDialogue.js", - "modules/uv-dialogues-module/ExternalContentDialogue.js", - "modules/uv-osdmobilefooterpanel-module/MobileFooter.js", - "modules/uv-shared-module/AutoComplete.js", - "modules/uv-searchfooterpanel-module/FooterPanel.js", - "modules/uv-dialogues-module/MoreInfoDialogue.js", - "modules/uv-multiselectdialogue-module/MultiSelectDialogue.js", - "extensions/uv-seadragon-extension/MultiSelectionArgs.js", - "modules/uv-pagingheaderpanel-module/PagingHeaderPanel.js", - "extensions/uv-seadragon-extension/Bounds.js", - "modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel.js", - "extensions/uv-seadragon-extension/SettingsDialogue.js", - "extensions/uv-seadragon-extension/ShareDialogue.js", - "extensions/uv-seadragon-extension/Extension.js", - "extensions/uv-pdf-extension/DownloadDialogue.js", - "extensions/uv-pdf-extension/Events.js", - "modules/uv-pdfcenterpanel-module/PDFCenterPanel.js", - "modules/uv-pdfheaderpanel-module/PDFHeaderPanel.js", - "extensions/uv-pdf-extension/SettingsDialogue.js", - "extensions/uv-pdf-extension/ShareDialogue.js", - "extensions/uv-pdf-extension/Extension.js", - "extensions/uv-virtex-extension/DownloadDialogue.js", - "extensions/uv-virtex-extension/SettingsDialogue.js", - "extensions/uv-virtex-extension/ShareDialogue.js", - "modules/uv-virtexcenterpanel-module/VirtexCenterPanel.js", - "extensions/uv-virtex-extension/Extension.js", - "PubSub.js", - "Polyfills.js", - "UVComponent.js", - "app.js" - ], - "names": [], - "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjmEA;AACA;AACA;AACA,ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACvDA;AACA;AACA;AACA,ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACVA;AACA;AACA;AACA;AACA;AACA,ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC7LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AClZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1qWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACj6CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3oBA;AACA;AACA;AACA,ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AChIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC9MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AClNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC9JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AChHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjhCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC9kBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC/LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AClJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACxHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACrLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACxKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACrhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AChNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC5iBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACl2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACz3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACrIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACxHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACnXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", - "file": "build.js", - "sourcesContent": [ - "/** vim: et:ts=4:sw=4:sts=4\n * @license RequireJS 2.2.0 Copyright jQuery Foundation and other contributors.\n * Released under MIT license, http://github.com/requirejs/requirejs/LICENSE\n */\n//Not using strict: uneven strict support in browsers, #392, and causes\n//problems with requirejs.exec()/transpiler plugins that may not be strict.\n/*jslint regexp: true, nomen: true, sloppy: true */\n/*global window, navigator, document, importScripts, setTimeout, opera */\n\nvar requirejs, require, define;\n(function (global) {\n var req, s, head, baseElement, dataMain, src,\n interactiveScript, currentlyAddingScript, mainScript, subPath,\n version = '2.2.0',\n commentRegExp = /(\\/\\*([\\s\\S]*?)\\*\\/|([^:]|^)\\/\\/(.*)$)/mg,\n cjsRequireRegExp = /[^.]\\s*require\\s*\\(\\s*[\"']([^'\"\\s]+)[\"']\\s*\\)/g,\n jsSuffixRegExp = /\\.js$/,\n currDirRegExp = /^\\.\\//,\n op = Object.prototype,\n ostring = op.toString,\n hasOwn = op.hasOwnProperty,\n isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),\n isWebWorker = !isBrowser && typeof importScripts !== 'undefined',\n //PS3 indicates loaded and complete, but need to wait for complete\n //specifically. Sequence is 'loading', 'loaded', execution,\n // then 'complete'. The UA check is unfortunate, but not sure how\n //to feature test w/o causing perf issues.\n readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?\n /^complete$/ : /^(complete|loaded)$/,\n defContextName = '_',\n //Oh the tragedy, detecting opera. See the usage of isOpera for reason.\n isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',\n contexts = {},\n cfg = {},\n globalDefQueue = [],\n useInteractive = false;\n\n //Could match something like ')//comment', do not lose the prefix to comment.\n function commentReplace(match, multi, multiText, singlePrefix) {\n return singlePrefix || '';\n }\n\n function isFunction(it) {\n return ostring.call(it) === '[object Function]';\n }\n\n function isArray(it) {\n return ostring.call(it) === '[object Array]';\n }\n\n /**\n * Helper function for iterating over an array. If the func returns\n * a true value, it will break out of the loop.\n */\n function each(ary, func) {\n if (ary) {\n var i;\n for (i = 0; i < ary.length; i += 1) {\n if (ary[i] && func(ary[i], i, ary)) {\n break;\n }\n }\n }\n }\n\n /**\n * Helper function for iterating over an array backwards. If the func\n * returns a true value, it will break out of the loop.\n */\n function eachReverse(ary, func) {\n if (ary) {\n var i;\n for (i = ary.length - 1; i > -1; i -= 1) {\n if (ary[i] && func(ary[i], i, ary)) {\n break;\n }\n }\n }\n }\n\n function hasProp(obj, prop) {\n return hasOwn.call(obj, prop);\n }\n\n function getOwn(obj, prop) {\n return hasProp(obj, prop) && obj[prop];\n }\n\n /**\n * Cycles over properties in an object and calls a function for each\n * property value. If the function returns a truthy value, then the\n * iteration is stopped.\n */\n function eachProp(obj, func) {\n var prop;\n for (prop in obj) {\n if (hasProp(obj, prop)) {\n if (func(obj[prop], prop)) {\n break;\n }\n }\n }\n }\n\n /**\n * Simple function to mix in properties from source into target,\n * but only if target does not already have a property of the same name.\n */\n function mixin(target, source, force, deepStringMixin) {\n if (source) {\n eachProp(source, function (value, prop) {\n if (force || !hasProp(target, prop)) {\n if (deepStringMixin && typeof value === 'object' && value &&\n !isArray(value) && !isFunction(value) &&\n !(value instanceof RegExp)) {\n\n if (!target[prop]) {\n target[prop] = {};\n }\n mixin(target[prop], value, force, deepStringMixin);\n } else {\n target[prop] = value;\n }\n }\n });\n }\n return target;\n }\n\n //Similar to Function.prototype.bind, but the 'this' object is specified\n //first, since it is easier to read/figure out what 'this' will be.\n function bind(obj, fn) {\n return function () {\n return fn.apply(obj, arguments);\n };\n }\n\n function scripts() {\n return document.getElementsByTagName('script');\n }\n\n function defaultOnError(err) {\n throw err;\n }\n\n //Allow getting a global that is expressed in\n //dot notation, like 'a.b.c'.\n function getGlobal(value) {\n if (!value) {\n return value;\n }\n var g = global;\n each(value.split('.'), function (part) {\n g = g[part];\n });\n return g;\n }\n\n /**\n * Constructs an error with a pointer to an URL with more information.\n * @param {String} id the error ID that maps to an ID on a web page.\n * @param {String} message human readable error.\n * @param {Error} [err] the original error, if there is one.\n *\n * @returns {Error}\n */\n function makeError(id, msg, err, requireModules) {\n var e = new Error(msg + '\\nhttp://requirejs.org/docs/errors.html#' + id);\n e.requireType = id;\n e.requireModules = requireModules;\n if (err) {\n e.originalError = err;\n }\n return e;\n }\n\n if (typeof define !== 'undefined') {\n //If a define is already in play via another AMD loader,\n //do not overwrite.\n return;\n }\n\n if (typeof requirejs !== 'undefined') {\n if (isFunction(requirejs)) {\n //Do not overwrite an existing requirejs instance.\n return;\n }\n cfg = requirejs;\n requirejs = undefined;\n }\n\n //Allow for a require config object\n if (typeof require !== 'undefined' && !isFunction(require)) {\n //assume it is a config object.\n cfg = require;\n require = undefined;\n }\n\n function newContext(contextName) {\n var inCheckLoaded, Module, context, handlers,\n checkLoadedTimeoutId,\n config = {\n //Defaults. Do not set a default for map\n //config to speed up normalize(), which\n //will run faster if there is no default.\n waitSeconds: 7,\n baseUrl: './',\n paths: {},\n bundles: {},\n pkgs: {},\n shim: {},\n config: {}\n },\n registry = {},\n //registry of just enabled modules, to speed\n //cycle breaking code when lots of modules\n //are registered, but not activated.\n enabledRegistry = {},\n undefEvents = {},\n defQueue = [],\n defined = {},\n urlFetched = {},\n bundlesMap = {},\n requireCounter = 1,\n unnormalizedCounter = 1;\n\n /**\n * Trims the . and .. from an array of path segments.\n * It will keep a leading path segment if a .. will become\n * the first path segment, to help with module name lookups,\n * which act like paths, but can be remapped. But the end result,\n * all paths that use this function should look normalized.\n * NOTE: this method MODIFIES the input array.\n * @param {Array} ary the array of path segments.\n */\n function trimDots(ary) {\n var i, part;\n for (i = 0; i < ary.length; i++) {\n part = ary[i];\n if (part === '.') {\n ary.splice(i, 1);\n i -= 1;\n } else if (part === '..') {\n // If at the start, or previous value is still ..,\n // keep them so that when converted to a path it may\n // still work when converted to a path, even though\n // as an ID it is less than ideal. In larger point\n // releases, may be better to just kick out an error.\n if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') {\n continue;\n } else if (i > 0) {\n ary.splice(i - 1, 2);\n i -= 2;\n }\n }\n }\n }\n\n /**\n * Given a relative module name, like ./something, normalize it to\n * a real name that can be mapped to a path.\n * @param {String} name the relative name\n * @param {String} baseName a real name that the name arg is relative\n * to.\n * @param {Boolean} applyMap apply the map config to the value. Should\n * only be done if this normalization is for a dependency ID.\n * @returns {String} normalized name\n */\n function normalize(name, baseName, applyMap) {\n var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,\n foundMap, foundI, foundStarMap, starI, normalizedBaseParts,\n baseParts = (baseName && baseName.split('/')),\n map = config.map,\n starMap = map && map['*'];\n\n //Adjust any relative paths.\n if (name) {\n name = name.split('/');\n lastIndex = name.length - 1;\n\n // If wanting node ID compatibility, strip .js from end\n // of IDs. Have to do this here, and not in nameToUrl\n // because node allows either .js or non .js to map\n // to same file.\n if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {\n name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');\n }\n\n // Starts with a '.' so need the baseName\n if (name[0].charAt(0) === '.' && baseParts) {\n //Convert baseName to array, and lop off the last part,\n //so that . matches that 'directory' and not name of the baseName's\n //module. For instance, baseName of 'one/two/three', maps to\n //'one/two/three.js', but we want the directory, 'one/two' for\n //this normalization.\n normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);\n name = normalizedBaseParts.concat(name);\n }\n\n trimDots(name);\n name = name.join('/');\n }\n\n //Apply map config if available.\n if (applyMap && map && (baseParts || starMap)) {\n nameParts = name.split('/');\n\n outerLoop: for (i = nameParts.length; i > 0; i -= 1) {\n nameSegment = nameParts.slice(0, i).join('/');\n\n if (baseParts) {\n //Find the longest baseName segment match in the config.\n //So, do joins on the biggest to smallest lengths of baseParts.\n for (j = baseParts.length; j > 0; j -= 1) {\n mapValue = getOwn(map, baseParts.slice(0, j).join('/'));\n\n //baseName segment has config, find if it has one for\n //this name.\n if (mapValue) {\n mapValue = getOwn(mapValue, nameSegment);\n if (mapValue) {\n //Match, update name to the new value.\n foundMap = mapValue;\n foundI = i;\n break outerLoop;\n }\n }\n }\n }\n\n //Check for a star map match, but just hold on to it,\n //if there is a shorter segment match later in a matching\n //config, then favor over this star map.\n if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {\n foundStarMap = getOwn(starMap, nameSegment);\n starI = i;\n }\n }\n\n if (!foundMap && foundStarMap) {\n foundMap = foundStarMap;\n foundI = starI;\n }\n\n if (foundMap) {\n nameParts.splice(0, foundI, foundMap);\n name = nameParts.join('/');\n }\n }\n\n // If the name points to a package's name, use\n // the package main instead.\n pkgMain = getOwn(config.pkgs, name);\n\n return pkgMain ? pkgMain : name;\n }\n\n function removeScript(name) {\n if (isBrowser) {\n each(scripts(), function (scriptNode) {\n if (scriptNode.getAttribute('data-requiremodule') === name &&\n scriptNode.getAttribute('data-requirecontext') === context.contextName) {\n scriptNode.parentNode.removeChild(scriptNode);\n return true;\n }\n });\n }\n }\n\n function hasPathFallback(id) {\n var pathConfig = getOwn(config.paths, id);\n if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {\n //Pop off the first array value, since it failed, and\n //retry\n pathConfig.shift();\n context.require.undef(id);\n\n //Custom require that does not do map translation, since\n //ID is \"absolute\", already mapped/resolved.\n context.makeRequire(null, {\n skipMap: true\n })([id]);\n\n return true;\n }\n }\n\n //Turns a plugin!resource to [plugin, resource]\n //with the plugin being undefined if the name\n //did not have a plugin prefix.\n function splitPrefix(name) {\n var prefix,\n index = name ? name.indexOf('!') : -1;\n if (index > -1) {\n prefix = name.substring(0, index);\n name = name.substring(index + 1, name.length);\n }\n return [prefix, name];\n }\n\n /**\n * Creates a module mapping that includes plugin prefix, module\n * name, and path. If parentModuleMap is provided it will\n * also normalize the name via require.normalize()\n *\n * @param {String} name the module name\n * @param {String} [parentModuleMap] parent module map\n * for the module name, used to resolve relative names.\n * @param {Boolean} isNormalized: is the ID already normalized.\n * This is true if this call is done for a define() module ID.\n * @param {Boolean} applyMap: apply the map config to the ID.\n * Should only be true if this map is for a dependency.\n *\n * @returns {Object}\n */\n function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {\n var url, pluginModule, suffix, nameParts,\n prefix = null,\n parentName = parentModuleMap ? parentModuleMap.name : null,\n originalName = name,\n isDefine = true,\n normalizedName = '';\n\n //If no name, then it means it is a require call, generate an\n //internal name.\n if (!name) {\n isDefine = false;\n name = '_@r' + (requireCounter += 1);\n }\n\n nameParts = splitPrefix(name);\n prefix = nameParts[0];\n name = nameParts[1];\n\n if (prefix) {\n prefix = normalize(prefix, parentName, applyMap);\n pluginModule = getOwn(defined, prefix);\n }\n\n //Account for relative paths if there is a base name.\n if (name) {\n if (prefix) {\n if (pluginModule && pluginModule.normalize) {\n //Plugin is loaded, use its normalize method.\n normalizedName = pluginModule.normalize(name, function (name) {\n return normalize(name, parentName, applyMap);\n });\n } else {\n // If nested plugin references, then do not try to\n // normalize, as it will not normalize correctly. This\n // places a restriction on resourceIds, and the longer\n // term solution is not to normalize until plugins are\n // loaded and all normalizations to allow for async\n // loading of a loader plugin. But for now, fixes the\n // common uses. Details in #1131\n normalizedName = name.indexOf('!') === -1 ?\n normalize(name, parentName, applyMap) :\n name;\n }\n } else {\n //A regular module.\n normalizedName = normalize(name, parentName, applyMap);\n\n //Normalized name may be a plugin ID due to map config\n //application in normalize. The map config values must\n //already be normalized, so do not need to redo that part.\n nameParts = splitPrefix(normalizedName);\n prefix = nameParts[0];\n normalizedName = nameParts[1];\n isNormalized = true;\n\n url = context.nameToUrl(normalizedName);\n }\n }\n\n //If the id is a plugin id that cannot be determined if it needs\n //normalization, stamp it with a unique ID so two matching relative\n //ids that may conflict can be separate.\n suffix = prefix && !pluginModule && !isNormalized ?\n '_unnormalized' + (unnormalizedCounter += 1) :\n '';\n\n return {\n prefix: prefix,\n name: normalizedName,\n parentMap: parentModuleMap,\n unnormalized: !!suffix,\n url: url,\n originalName: originalName,\n isDefine: isDefine,\n id: (prefix ?\n prefix + '!' + normalizedName :\n normalizedName) + suffix\n };\n }\n\n function getModule(depMap) {\n var id = depMap.id,\n mod = getOwn(registry, id);\n\n if (!mod) {\n mod = registry[id] = new context.Module(depMap);\n }\n\n return mod;\n }\n\n function on(depMap, name, fn) {\n var id = depMap.id,\n mod = getOwn(registry, id);\n\n if (hasProp(defined, id) &&\n (!mod || mod.defineEmitComplete)) {\n if (name === 'defined') {\n fn(defined[id]);\n }\n } else {\n mod = getModule(depMap);\n if (mod.error && name === 'error') {\n fn(mod.error);\n } else {\n mod.on(name, fn);\n }\n }\n }\n\n function onError(err, errback) {\n var ids = err.requireModules,\n notified = false;\n\n if (errback) {\n errback(err);\n } else {\n each(ids, function (id) {\n var mod = getOwn(registry, id);\n if (mod) {\n //Set error on module, so it skips timeout checks.\n mod.error = err;\n if (mod.events.error) {\n notified = true;\n mod.emit('error', err);\n }\n }\n });\n\n if (!notified) {\n req.onError(err);\n }\n }\n }\n\n /**\n * Internal method to transfer globalQueue items to this context's\n * defQueue.\n */\n function takeGlobalQueue() {\n //Push all the globalDefQueue items into the context's defQueue\n if (globalDefQueue.length) {\n each(globalDefQueue, function(queueItem) {\n var id = queueItem[0];\n if (typeof id === 'string') {\n context.defQueueMap[id] = true;\n }\n defQueue.push(queueItem);\n });\n globalDefQueue = [];\n }\n }\n\n handlers = {\n 'require': function (mod) {\n if (mod.require) {\n return mod.require;\n } else {\n return (mod.require = context.makeRequire(mod.map));\n }\n },\n 'exports': function (mod) {\n mod.usingExports = true;\n if (mod.map.isDefine) {\n if (mod.exports) {\n return (defined[mod.map.id] = mod.exports);\n } else {\n return (mod.exports = defined[mod.map.id] = {});\n }\n }\n },\n 'module': function (mod) {\n if (mod.module) {\n return mod.module;\n } else {\n return (mod.module = {\n id: mod.map.id,\n uri: mod.map.url,\n config: function () {\n return getOwn(config.config, mod.map.id) || {};\n },\n exports: mod.exports || (mod.exports = {})\n });\n }\n }\n };\n\n function cleanRegistry(id) {\n //Clean up machinery used for waiting modules.\n delete registry[id];\n delete enabledRegistry[id];\n }\n\n function breakCycle(mod, traced, processed) {\n var id = mod.map.id;\n\n if (mod.error) {\n mod.emit('error', mod.error);\n } else {\n traced[id] = true;\n each(mod.depMaps, function (depMap, i) {\n var depId = depMap.id,\n dep = getOwn(registry, depId);\n\n //Only force things that have not completed\n //being defined, so still in the registry,\n //and only if it has not been matched up\n //in the module already.\n if (dep && !mod.depMatched[i] && !processed[depId]) {\n if (getOwn(traced, depId)) {\n mod.defineDep(i, defined[depId]);\n mod.check(); //pass false?\n } else {\n breakCycle(dep, traced, processed);\n }\n }\n });\n processed[id] = true;\n }\n }\n\n function checkLoaded() {\n var err, usingPathFallback,\n waitInterval = config.waitSeconds * 1000,\n //It is possible to disable the wait interval by using waitSeconds of 0.\n expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),\n noLoads = [],\n reqCalls = [],\n stillLoading = false,\n needCycleCheck = true;\n\n //Do not bother if this call was a result of a cycle break.\n if (inCheckLoaded) {\n return;\n }\n\n inCheckLoaded = true;\n\n //Figure out the state of all the modules.\n eachProp(enabledRegistry, function (mod) {\n var map = mod.map,\n modId = map.id;\n\n //Skip things that are not enabled or in error state.\n if (!mod.enabled) {\n return;\n }\n\n if (!map.isDefine) {\n reqCalls.push(mod);\n }\n\n if (!mod.error) {\n //If the module should be executed, and it has not\n //been inited and time is up, remember it.\n if (!mod.inited && expired) {\n if (hasPathFallback(modId)) {\n usingPathFallback = true;\n stillLoading = true;\n } else {\n noLoads.push(modId);\n removeScript(modId);\n }\n } else if (!mod.inited && mod.fetched && map.isDefine) {\n stillLoading = true;\n if (!map.prefix) {\n //No reason to keep looking for unfinished\n //loading. If the only stillLoading is a\n //plugin resource though, keep going,\n //because it may be that a plugin resource\n //is waiting on a non-plugin cycle.\n return (needCycleCheck = false);\n }\n }\n }\n });\n\n if (expired && noLoads.length) {\n //If wait time expired, throw error of unloaded modules.\n err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);\n err.contextName = context.contextName;\n return onError(err);\n }\n\n //Not expired, check for a cycle.\n if (needCycleCheck) {\n each(reqCalls, function (mod) {\n breakCycle(mod, {}, {});\n });\n }\n\n //If still waiting on loads, and the waiting load is something\n //other than a plugin resource, or there are still outstanding\n //scripts, then just try back later.\n if ((!expired || usingPathFallback) && stillLoading) {\n //Something is still waiting to load. Wait for it, but only\n //if a timeout is not already in effect.\n if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {\n checkLoadedTimeoutId = setTimeout(function () {\n checkLoadedTimeoutId = 0;\n checkLoaded();\n }, 50);\n }\n }\n\n inCheckLoaded = false;\n }\n\n Module = function (map) {\n this.events = getOwn(undefEvents, map.id) || {};\n this.map = map;\n this.shim = getOwn(config.shim, map.id);\n this.depExports = [];\n this.depMaps = [];\n this.depMatched = [];\n this.pluginMaps = {};\n this.depCount = 0;\n\n /* this.exports this.factory\n this.depMaps = [],\n this.enabled, this.fetched\n */\n };\n\n Module.prototype = {\n init: function (depMaps, factory, errback, options) {\n options = options || {};\n\n //Do not do more inits if already done. Can happen if there\n //are multiple define calls for the same module. That is not\n //a normal, common case, but it is also not unexpected.\n if (this.inited) {\n return;\n }\n\n this.factory = factory;\n\n if (errback) {\n //Register for errors on this module.\n this.on('error', errback);\n } else if (this.events.error) {\n //If no errback already, but there are error listeners\n //on this module, set up an errback to pass to the deps.\n errback = bind(this, function (err) {\n this.emit('error', err);\n });\n }\n\n //Do a copy of the dependency array, so that\n //source inputs are not modified. For example\n //\"shim\" deps are passed in here directly, and\n //doing a direct modification of the depMaps array\n //would affect that config.\n this.depMaps = depMaps && depMaps.slice(0);\n\n this.errback = errback;\n\n //Indicate this module has be initialized\n this.inited = true;\n\n this.ignore = options.ignore;\n\n //Could have option to init this module in enabled mode,\n //or could have been previously marked as enabled. However,\n //the dependencies are not known until init is called. So\n //if enabled previously, now trigger dependencies as enabled.\n if (options.enabled || this.enabled) {\n //Enable this module and dependencies.\n //Will call this.check()\n this.enable();\n } else {\n this.check();\n }\n },\n\n defineDep: function (i, depExports) {\n //Because of cycles, defined callback for a given\n //export can be called more than once.\n if (!this.depMatched[i]) {\n this.depMatched[i] = true;\n this.depCount -= 1;\n this.depExports[i] = depExports;\n }\n },\n\n fetch: function () {\n if (this.fetched) {\n return;\n }\n this.fetched = true;\n\n context.startTime = (new Date()).getTime();\n\n var map = this.map;\n\n //If the manager is for a plugin managed resource,\n //ask the plugin to load it now.\n if (this.shim) {\n context.makeRequire(this.map, {\n enableBuildCallback: true\n })(this.shim.deps || [], bind(this, function () {\n return map.prefix ? this.callPlugin() : this.load();\n }));\n } else {\n //Regular dependency.\n return map.prefix ? this.callPlugin() : this.load();\n }\n },\n\n load: function () {\n var url = this.map.url;\n\n //Regular dependency.\n if (!urlFetched[url]) {\n urlFetched[url] = true;\n context.load(this.map.id, url);\n }\n },\n\n /**\n * Checks if the module is ready to define itself, and if so,\n * define it.\n */\n check: function () {\n if (!this.enabled || this.enabling) {\n return;\n }\n\n var err, cjsModule,\n id = this.map.id,\n depExports = this.depExports,\n exports = this.exports,\n factory = this.factory;\n\n if (!this.inited) {\n // Only fetch if not already in the defQueue.\n if (!hasProp(context.defQueueMap, id)) {\n this.fetch();\n }\n } else if (this.error) {\n this.emit('error', this.error);\n } else if (!this.defining) {\n //The factory could trigger another require call\n //that would result in checking this module to\n //define itself again. If already in the process\n //of doing that, skip this work.\n this.defining = true;\n\n if (this.depCount < 1 && !this.defined) {\n if (isFunction(factory)) {\n //If there is an error listener, favor passing\n //to that instead of throwing an error. However,\n //only do it for define()'d modules. require\n //errbacks should not be called for failures in\n //their callbacks (#699). However if a global\n //onError is set, use that.\n if ((this.events.error && this.map.isDefine) ||\n req.onError !== defaultOnError) {\n try {\n exports = context.execCb(id, factory, depExports, exports);\n } catch (e) {\n err = e;\n }\n } else {\n exports = context.execCb(id, factory, depExports, exports);\n }\n\n // Favor return value over exports. If node/cjs in play,\n // then will not have a return value anyway. Favor\n // module.exports assignment over exports object.\n if (this.map.isDefine && exports === undefined) {\n cjsModule = this.module;\n if (cjsModule) {\n exports = cjsModule.exports;\n } else if (this.usingExports) {\n //exports already set the defined value.\n exports = this.exports;\n }\n }\n\n if (err) {\n err.requireMap = this.map;\n err.requireModules = this.map.isDefine ? [this.map.id] : null;\n err.requireType = this.map.isDefine ? 'define' : 'require';\n return onError((this.error = err));\n }\n\n } else {\n //Just a literal value\n exports = factory;\n }\n\n this.exports = exports;\n\n if (this.map.isDefine && !this.ignore) {\n defined[id] = exports;\n\n if (req.onResourceLoad) {\n var resLoadMaps = [];\n each(this.depMaps, function (depMap) {\n resLoadMaps.push(depMap.normalizedMap || depMap);\n });\n req.onResourceLoad(context, this.map, resLoadMaps);\n }\n }\n\n //Clean up\n cleanRegistry(id);\n\n this.defined = true;\n }\n\n //Finished the define stage. Allow calling check again\n //to allow define notifications below in the case of a\n //cycle.\n this.defining = false;\n\n if (this.defined && !this.defineEmitted) {\n this.defineEmitted = true;\n this.emit('defined', this.exports);\n this.defineEmitComplete = true;\n }\n\n }\n },\n\n callPlugin: function () {\n var map = this.map,\n id = map.id,\n //Map already normalized the prefix.\n pluginMap = makeModuleMap(map.prefix);\n\n //Mark this as a dependency for this plugin, so it\n //can be traced for cycles.\n this.depMaps.push(pluginMap);\n\n on(pluginMap, 'defined', bind(this, function (plugin) {\n var load, normalizedMap, normalizedMod,\n bundleId = getOwn(bundlesMap, this.map.id),\n name = this.map.name,\n parentName = this.map.parentMap ? this.map.parentMap.name : null,\n localRequire = context.makeRequire(map.parentMap, {\n enableBuildCallback: true\n });\n\n //If current map is not normalized, wait for that\n //normalized name to load instead of continuing.\n if (this.map.unnormalized) {\n //Normalize the ID if the plugin allows it.\n if (plugin.normalize) {\n name = plugin.normalize(name, function (name) {\n return normalize(name, parentName, true);\n }) || '';\n }\n\n //prefix and name should already be normalized, no need\n //for applying map config again either.\n normalizedMap = makeModuleMap(map.prefix + '!' + name,\n this.map.parentMap);\n on(normalizedMap,\n 'defined', bind(this, function (value) {\n this.map.normalizedMap = normalizedMap;\n this.init([], function () { return value; }, null, {\n enabled: true,\n ignore: true\n });\n }));\n\n normalizedMod = getOwn(registry, normalizedMap.id);\n if (normalizedMod) {\n //Mark this as a dependency for this plugin, so it\n //can be traced for cycles.\n this.depMaps.push(normalizedMap);\n\n if (this.events.error) {\n normalizedMod.on('error', bind(this, function (err) {\n this.emit('error', err);\n }));\n }\n normalizedMod.enable();\n }\n\n return;\n }\n\n //If a paths config, then just load that file instead to\n //resolve the plugin, as it is built into that paths layer.\n if (bundleId) {\n this.map.url = context.nameToUrl(bundleId);\n this.load();\n return;\n }\n\n load = bind(this, function (value) {\n this.init([], function () { return value; }, null, {\n enabled: true\n });\n });\n\n load.error = bind(this, function (err) {\n this.inited = true;\n this.error = err;\n err.requireModules = [id];\n\n //Remove temp unnormalized modules for this module,\n //since they will never be resolved otherwise now.\n eachProp(registry, function (mod) {\n if (mod.map.id.indexOf(id + '_unnormalized') === 0) {\n cleanRegistry(mod.map.id);\n }\n });\n\n onError(err);\n });\n\n //Allow plugins to load other code without having to know the\n //context or how to 'complete' the load.\n load.fromText = bind(this, function (text, textAlt) {\n /*jslint evil: true */\n var moduleName = map.name,\n moduleMap = makeModuleMap(moduleName),\n hasInteractive = useInteractive;\n\n //As of 2.1.0, support just passing the text, to reinforce\n //fromText only being called once per resource. Still\n //support old style of passing moduleName but discard\n //that moduleName in favor of the internal ref.\n if (textAlt) {\n text = textAlt;\n }\n\n //Turn off interactive script matching for IE for any define\n //calls in the text, then turn it back on at the end.\n if (hasInteractive) {\n useInteractive = false;\n }\n\n //Prime the system by creating a module instance for\n //it.\n getModule(moduleMap);\n\n //Transfer any config to this other module.\n if (hasProp(config.config, id)) {\n config.config[moduleName] = config.config[id];\n }\n\n try {\n req.exec(text);\n } catch (e) {\n return onError(makeError('fromtexteval',\n 'fromText eval for ' + id +\n ' failed: ' + e,\n e,\n [id]));\n }\n\n if (hasInteractive) {\n useInteractive = true;\n }\n\n //Mark this as a dependency for the plugin\n //resource\n this.depMaps.push(moduleMap);\n\n //Support anonymous modules.\n context.completeLoad(moduleName);\n\n //Bind the value of that module to the value for this\n //resource ID.\n localRequire([moduleName], load);\n });\n\n //Use parentName here since the plugin's name is not reliable,\n //could be some weird string with no path that actually wants to\n //reference the parentName's path.\n plugin.load(map.name, localRequire, load, config);\n }));\n\n context.enable(pluginMap, this);\n this.pluginMaps[pluginMap.id] = pluginMap;\n },\n\n enable: function () {\n enabledRegistry[this.map.id] = this;\n this.enabled = true;\n\n //Set flag mentioning that the module is enabling,\n //so that immediate calls to the defined callbacks\n //for dependencies do not trigger inadvertent load\n //with the depCount still being zero.\n this.enabling = true;\n\n //Enable each dependency\n each(this.depMaps, bind(this, function (depMap, i) {\n var id, mod, handler;\n\n if (typeof depMap === 'string') {\n //Dependency needs to be converted to a depMap\n //and wired up to this module.\n depMap = makeModuleMap(depMap,\n (this.map.isDefine ? this.map : this.map.parentMap),\n false,\n !this.skipMap);\n this.depMaps[i] = depMap;\n\n handler = getOwn(handlers, depMap.id);\n\n if (handler) {\n this.depExports[i] = handler(this);\n return;\n }\n\n this.depCount += 1;\n\n on(depMap, 'defined', bind(this, function (depExports) {\n if (this.undefed) {\n return;\n }\n this.defineDep(i, depExports);\n this.check();\n }));\n\n if (this.errback) {\n on(depMap, 'error', bind(this, this.errback));\n } else if (this.events.error) {\n // No direct errback on this module, but something\n // else is listening for errors, so be sure to\n // propagate the error correctly.\n on(depMap, 'error', bind(this, function(err) {\n this.emit('error', err);\n }));\n }\n }\n\n id = depMap.id;\n mod = registry[id];\n\n //Skip special modules like 'require', 'exports', 'module'\n //Also, don't call enable if it is already enabled,\n //important in circular dependency cases.\n if (!hasProp(handlers, id) && mod && !mod.enabled) {\n context.enable(depMap, this);\n }\n }));\n\n //Enable each plugin that is used in\n //a dependency\n eachProp(this.pluginMaps, bind(this, function (pluginMap) {\n var mod = getOwn(registry, pluginMap.id);\n if (mod && !mod.enabled) {\n context.enable(pluginMap, this);\n }\n }));\n\n this.enabling = false;\n\n this.check();\n },\n\n on: function (name, cb) {\n var cbs = this.events[name];\n if (!cbs) {\n cbs = this.events[name] = [];\n }\n cbs.push(cb);\n },\n\n emit: function (name, evt) {\n each(this.events[name], function (cb) {\n cb(evt);\n });\n if (name === 'error') {\n //Now that the error handler was triggered, remove\n //the listeners, since this broken Module instance\n //can stay around for a while in the registry.\n delete this.events[name];\n }\n }\n };\n\n function callGetModule(args) {\n //Skip modules already defined.\n if (!hasProp(defined, args[0])) {\n getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);\n }\n }\n\n function removeListener(node, func, name, ieName) {\n //Favor detachEvent because of IE9\n //issue, see attachEvent/addEventListener comment elsewhere\n //in this file.\n if (node.detachEvent && !isOpera) {\n //Probably IE. If not it will throw an error, which will be\n //useful to know.\n if (ieName) {\n node.detachEvent(ieName, func);\n }\n } else {\n node.removeEventListener(name, func, false);\n }\n }\n\n /**\n * Given an event from a script node, get the requirejs info from it,\n * and then removes the event listeners on the node.\n * @param {Event} evt\n * @returns {Object}\n */\n function getScriptData(evt) {\n //Using currentTarget instead of target for Firefox 2.0's sake. Not\n //all old browsers will be supported, but this one was easy enough\n //to support and still makes sense.\n var node = evt.currentTarget || evt.srcElement;\n\n //Remove the listeners once here.\n removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');\n removeListener(node, context.onScriptError, 'error');\n\n return {\n node: node,\n id: node && node.getAttribute('data-requiremodule')\n };\n }\n\n function intakeDefines() {\n var args;\n\n //Any defined modules in the global queue, intake them now.\n takeGlobalQueue();\n\n //Make sure any remaining defQueue items get properly processed.\n while (defQueue.length) {\n args = defQueue.shift();\n if (args[0] === null) {\n return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' +\n args[args.length - 1]));\n } else {\n //args are id, deps, factory. Should be normalized by the\n //define() function.\n callGetModule(args);\n }\n }\n context.defQueueMap = {};\n }\n\n context = {\n config: config,\n contextName: contextName,\n registry: registry,\n defined: defined,\n urlFetched: urlFetched,\n defQueue: defQueue,\n defQueueMap: {},\n Module: Module,\n makeModuleMap: makeModuleMap,\n nextTick: req.nextTick,\n onError: onError,\n\n /**\n * Set a configuration for the context.\n * @param {Object} cfg config object to integrate.\n */\n configure: function (cfg) {\n //Make sure the baseUrl ends in a slash.\n if (cfg.baseUrl) {\n if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {\n cfg.baseUrl += '/';\n }\n }\n\n // Convert old style urlArgs string to a function.\n if (typeof cfg.urlArgs === 'string') {\n var urlArgs = cfg.urlArgs;\n cfg.urlArgs = function(id, url) {\n return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;\n };\n }\n\n //Save off the paths since they require special processing,\n //they are additive.\n var shim = config.shim,\n objs = {\n paths: true,\n bundles: true,\n config: true,\n map: true\n };\n\n eachProp(cfg, function (value, prop) {\n if (objs[prop]) {\n if (!config[prop]) {\n config[prop] = {};\n }\n mixin(config[prop], value, true, true);\n } else {\n config[prop] = value;\n }\n });\n\n //Reverse map the bundles\n if (cfg.bundles) {\n eachProp(cfg.bundles, function (value, prop) {\n each(value, function (v) {\n if (v !== prop) {\n bundlesMap[v] = prop;\n }\n });\n });\n }\n\n //Merge shim\n if (cfg.shim) {\n eachProp(cfg.shim, function (value, id) {\n //Normalize the structure\n if (isArray(value)) {\n value = {\n deps: value\n };\n }\n if ((value.exports || value.init) && !value.exportsFn) {\n value.exportsFn = context.makeShimExports(value);\n }\n shim[id] = value;\n });\n config.shim = shim;\n }\n\n //Adjust packages if necessary.\n if (cfg.packages) {\n each(cfg.packages, function (pkgObj) {\n var location, name;\n\n pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;\n\n name = pkgObj.name;\n location = pkgObj.location;\n if (location) {\n config.paths[name] = pkgObj.location;\n }\n\n //Save pointer to main module ID for pkg name.\n //Remove leading dot in main, so main paths are normalized,\n //and remove any trailing .js, since different package\n //envs have different conventions: some use a module name,\n //some use a file name.\n config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')\n .replace(currDirRegExp, '')\n .replace(jsSuffixRegExp, '');\n });\n }\n\n //If there are any \"waiting to execute\" modules in the registry,\n //update the maps for them, since their info, like URLs to load,\n //may have changed.\n eachProp(registry, function (mod, id) {\n //If module already has init called, since it is too\n //late to modify them, and ignore unnormalized ones\n //since they are transient.\n if (!mod.inited && !mod.map.unnormalized) {\n mod.map = makeModuleMap(id, null, true);\n }\n });\n\n //If a deps array or a config callback is specified, then call\n //require with those args. This is useful when require is defined as a\n //config object before require.js is loaded.\n if (cfg.deps || cfg.callback) {\n context.require(cfg.deps || [], cfg.callback);\n }\n },\n\n makeShimExports: function (value) {\n function fn() {\n var ret;\n if (value.init) {\n ret = value.init.apply(global, arguments);\n }\n return ret || (value.exports && getGlobal(value.exports));\n }\n return fn;\n },\n\n makeRequire: function (relMap, options) {\n options = options || {};\n\n function localRequire(deps, callback, errback) {\n var id, map, requireMod;\n\n if (options.enableBuildCallback && callback && isFunction(callback)) {\n callback.__requireJsBuild = true;\n }\n\n if (typeof deps === 'string') {\n if (isFunction(callback)) {\n //Invalid call\n return onError(makeError('requireargs', 'Invalid require call'), errback);\n }\n\n //If require|exports|module are requested, get the\n //value for them from the special handlers. Caveat:\n //this only works while module is being defined.\n if (relMap && hasProp(handlers, deps)) {\n return handlers[deps](registry[relMap.id]);\n }\n\n //Synchronous access to one module. If require.get is\n //available (as in the Node adapter), prefer that.\n if (req.get) {\n return req.get(context, deps, relMap, localRequire);\n }\n\n //Normalize module name, if it contains . or ..\n map = makeModuleMap(deps, relMap, false, true);\n id = map.id;\n\n if (!hasProp(defined, id)) {\n return onError(makeError('notloaded', 'Module name \"' +\n id +\n '\" has not been loaded yet for context: ' +\n contextName +\n (relMap ? '' : '. Use require([])')));\n }\n return defined[id];\n }\n\n //Grab defines waiting in the global queue.\n intakeDefines();\n\n //Mark all the dependencies as needing to be loaded.\n context.nextTick(function () {\n //Some defines could have been added since the\n //require call, collect them.\n intakeDefines();\n\n requireMod = getModule(makeModuleMap(null, relMap));\n\n //Store if map config should be applied to this require\n //call for dependencies.\n requireMod.skipMap = options.skipMap;\n\n requireMod.init(deps, callback, errback, {\n enabled: true\n });\n\n checkLoaded();\n });\n\n return localRequire;\n }\n\n mixin(localRequire, {\n isBrowser: isBrowser,\n\n /**\n * Converts a module name + .extension into an URL path.\n * *Requires* the use of a module name. It does not support using\n * plain URLs like nameToUrl.\n */\n toUrl: function (moduleNamePlusExt) {\n var ext,\n index = moduleNamePlusExt.lastIndexOf('.'),\n segment = moduleNamePlusExt.split('/')[0],\n isRelative = segment === '.' || segment === '..';\n\n //Have a file extension alias, and it is not the\n //dots from a relative path.\n if (index !== -1 && (!isRelative || index > 1)) {\n ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);\n moduleNamePlusExt = moduleNamePlusExt.substring(0, index);\n }\n\n return context.nameToUrl(normalize(moduleNamePlusExt,\n relMap && relMap.id, true), ext, true);\n },\n\n defined: function (id) {\n return hasProp(defined, makeModuleMap(id, relMap, false, true).id);\n },\n\n specified: function (id) {\n id = makeModuleMap(id, relMap, false, true).id;\n return hasProp(defined, id) || hasProp(registry, id);\n }\n });\n\n //Only allow undef on top level require calls\n if (!relMap) {\n localRequire.undef = function (id) {\n //Bind any waiting define() calls to this context,\n //fix for #408\n takeGlobalQueue();\n\n var map = makeModuleMap(id, relMap, true),\n mod = getOwn(registry, id);\n\n mod.undefed = true;\n removeScript(id);\n\n delete defined[id];\n delete urlFetched[map.url];\n delete undefEvents[id];\n\n //Clean queued defines too. Go backwards\n //in array so that the splices do not\n //mess up the iteration.\n eachReverse(defQueue, function(args, i) {\n if (args[0] === id) {\n defQueue.splice(i, 1);\n }\n });\n delete context.defQueueMap[id];\n\n if (mod) {\n //Hold on to listeners in case the\n //module will be attempted to be reloaded\n //using a different config.\n if (mod.events.defined) {\n undefEvents[id] = mod.events;\n }\n\n cleanRegistry(id);\n }\n };\n }\n\n return localRequire;\n },\n\n /**\n * Called to enable a module if it is still in the registry\n * awaiting enablement. A second arg, parent, the parent module,\n * is passed in for context, when this method is overridden by\n * the optimizer. Not shown here to keep code compact.\n */\n enable: function (depMap) {\n var mod = getOwn(registry, depMap.id);\n if (mod) {\n getModule(depMap).enable();\n }\n },\n\n /**\n * Internal method used by environment adapters to complete a load event.\n * A load event could be a script load or just a load pass from a synchronous\n * load call.\n * @param {String} moduleName the name of the module to potentially complete.\n */\n completeLoad: function (moduleName) {\n var found, args, mod,\n shim = getOwn(config.shim, moduleName) || {},\n shExports = shim.exports;\n\n takeGlobalQueue();\n\n while (defQueue.length) {\n args = defQueue.shift();\n if (args[0] === null) {\n args[0] = moduleName;\n //If already found an anonymous module and bound it\n //to this name, then this is some other anon module\n //waiting for its completeLoad to fire.\n if (found) {\n break;\n }\n found = true;\n } else if (args[0] === moduleName) {\n //Found matching define call for this script!\n found = true;\n }\n\n callGetModule(args);\n }\n context.defQueueMap = {};\n\n //Do this after the cycle of callGetModule in case the result\n //of those calls/init calls changes the registry.\n mod = getOwn(registry, moduleName);\n\n if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {\n if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {\n if (hasPathFallback(moduleName)) {\n return;\n } else {\n return onError(makeError('nodefine',\n 'No define call for ' + moduleName,\n null,\n [moduleName]));\n }\n } else {\n //A script that does not call define(), so just simulate\n //the call for it.\n callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);\n }\n }\n\n checkLoaded();\n },\n\n /**\n * Converts a module name to a file path. Supports cases where\n * moduleName may actually be just an URL.\n * Note that it **does not** call normalize on the moduleName,\n * it is assumed to have already been normalized. This is an\n * internal API, not a public one. Use toUrl for the public API.\n */\n nameToUrl: function (moduleName, ext, skipExt) {\n var paths, syms, i, parentModule, url,\n parentPath, bundleId,\n pkgMain = getOwn(config.pkgs, moduleName);\n\n if (pkgMain) {\n moduleName = pkgMain;\n }\n\n bundleId = getOwn(bundlesMap, moduleName);\n\n if (bundleId) {\n return context.nameToUrl(bundleId, ext, skipExt);\n }\n\n //If a colon is in the URL, it indicates a protocol is used and it is just\n //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)\n //or ends with .js, then assume the user meant to use an url and not a module id.\n //The slash is important for protocol-less URLs as well as full paths.\n if (req.jsExtRegExp.test(moduleName)) {\n //Just a plain path, not module name lookup, so just return it.\n //Add extension if it is included. This is a bit wonky, only non-.js things pass\n //an extension, this method probably needs to be reworked.\n url = moduleName + (ext || '');\n } else {\n //A module that needs to be converted to a path.\n paths = config.paths;\n\n syms = moduleName.split('/');\n //For each module name segment, see if there is a path\n //registered for it. Start with most specific name\n //and work up from it.\n for (i = syms.length; i > 0; i -= 1) {\n parentModule = syms.slice(0, i).join('/');\n\n parentPath = getOwn(paths, parentModule);\n if (parentPath) {\n //If an array, it means there are a few choices,\n //Choose the one that is desired\n if (isArray(parentPath)) {\n parentPath = parentPath[0];\n }\n syms.splice(0, i, parentPath);\n break;\n }\n }\n\n //Join the path parts together, then figure out if baseUrl is needed.\n url = syms.join('/');\n url += (ext || (/^data\\:|^blob\\:|\\?/.test(url) || skipExt ? '' : '.js'));\n url = (url.charAt(0) === '/' || url.match(/^[\\w\\+\\.\\-]+:/) ? '' : config.baseUrl) + url;\n }\n\n return config.urlArgs && !/^blob\\:/.test(url) ?\n url + config.urlArgs(moduleName, url) : url;\n },\n\n //Delegates to req.load. Broken out as a separate function to\n //allow overriding in the optimizer.\n load: function (id, url) {\n req.load(context, id, url);\n },\n\n /**\n * Executes a module callback function. Broken out as a separate function\n * solely to allow the build system to sequence the files in the built\n * layer in the right sequence.\n *\n * @private\n */\n execCb: function (name, callback, args, exports) {\n return callback.apply(exports, args);\n },\n\n /**\n * callback for script loads, used to check status of loading.\n *\n * @param {Event} evt the event from the browser for the script\n * that was loaded.\n */\n onScriptLoad: function (evt) {\n //Using currentTarget instead of target for Firefox 2.0's sake. Not\n //all old browsers will be supported, but this one was easy enough\n //to support and still makes sense.\n if (evt.type === 'load' ||\n (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {\n //Reset interactive script so a script node is not held onto for\n //to long.\n interactiveScript = null;\n\n //Pull out the name of the module and the context.\n var data = getScriptData(evt);\n context.completeLoad(data.id);\n }\n },\n\n /**\n * Callback for script errors.\n */\n onScriptError: function (evt) {\n var data = getScriptData(evt);\n if (!hasPathFallback(data.id)) {\n var parents = [];\n eachProp(registry, function(value, key) {\n if (key.indexOf('_@r') !== 0) {\n each(value.depMaps, function(depMap) {\n if (depMap.id === data.id) {\n parents.push(key);\n return true;\n }\n });\n }\n });\n return onError(makeError('scripterror', 'Script error for \"' + data.id +\n (parents.length ?\n '\", needed by: ' + parents.join(', ') :\n '\"'), evt, [data.id]));\n }\n }\n };\n\n context.require = context.makeRequire();\n return context;\n }\n\n /**\n * Main entry point.\n *\n * If the only argument to require is a string, then the module that\n * is represented by that string is fetched for the appropriate context.\n *\n * If the first argument is an array, then it will be treated as an array\n * of dependency string names to fetch. An optional function callback can\n * be specified to execute when all of those dependencies are available.\n *\n * Make a local req variable to help Caja compliance (it assumes things\n * on a require that are not standardized), and to give a short\n * name for minification/local scope use.\n */\n req = requirejs = function (deps, callback, errback, optional) {\n\n //Find the right context, use default\n var context, config,\n contextName = defContextName;\n\n // Determine if have config object in the call.\n if (!isArray(deps) && typeof deps !== 'string') {\n // deps is a config object\n config = deps;\n if (isArray(callback)) {\n // Adjust args if there are dependencies\n deps = callback;\n callback = errback;\n errback = optional;\n } else {\n deps = [];\n }\n }\n\n if (config && config.context) {\n contextName = config.context;\n }\n\n context = getOwn(contexts, contextName);\n if (!context) {\n context = contexts[contextName] = req.s.newContext(contextName);\n }\n\n if (config) {\n context.configure(config);\n }\n\n return context.require(deps, callback, errback);\n };\n\n /**\n * Support require.config() to make it easier to cooperate with other\n * AMD loaders on globally agreed names.\n */\n req.config = function (config) {\n return req(config);\n };\n\n /**\n * Execute something after the current tick\n * of the event loop. Override for other envs\n * that have a better solution than setTimeout.\n * @param {Function} fn function to execute later.\n */\n req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {\n setTimeout(fn, 4);\n } : function (fn) { fn(); };\n\n /**\n * Export require as a global, but only if it does not already exist.\n */\n if (!require) {\n require = req;\n }\n\n req.version = version;\n\n //Used to filter out dependencies that are already paths.\n req.jsExtRegExp = /^\\/|:|\\?|\\.js$/;\n req.isBrowser = isBrowser;\n s = req.s = {\n contexts: contexts,\n newContext: newContext\n };\n\n //Create default context.\n req({});\n\n //Exports some context-sensitive methods on global require.\n each([\n 'toUrl',\n 'undef',\n 'defined',\n 'specified'\n ], function (prop) {\n //Reference from contexts instead of early binding to default context,\n //so that during builds, the latest instance of the default context\n //with its config gets used.\n req[prop] = function () {\n var ctx = contexts[defContextName];\n return ctx.require[prop].apply(ctx, arguments);\n };\n });\n\n if (isBrowser) {\n head = s.head = document.getElementsByTagName('head')[0];\n //If BASE tag is in play, using appendChild is a problem for IE6.\n //When that browser dies, this can be removed. Details in this jQuery bug:\n //http://dev.jquery.com/ticket/2709\n baseElement = document.getElementsByTagName('base')[0];\n if (baseElement) {\n head = s.head = baseElement.parentNode;\n }\n }\n\n /**\n * Any errors that require explicitly generates will be passed to this\n * function. Intercept/override it if you want custom error handling.\n * @param {Error} err the error object.\n */\n req.onError = defaultOnError;\n\n /**\n * Creates the node for the load command. Only used in browser envs.\n */\n req.createNode = function (config, moduleName, url) {\n var node = config.xhtml ?\n document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :\n document.createElement('script');\n node.type = config.scriptType || 'text/javascript';\n node.charset = 'utf-8';\n node.async = true;\n return node;\n };\n\n /**\n * Does the request to load a module for the browser case.\n * Make this a separate function to allow other environments\n * to override it.\n *\n * @param {Object} context the require context to find state.\n * @param {String} moduleName the name of the module.\n * @param {Object} url the URL to the module.\n */\n req.load = function (context, moduleName, url) {\n var config = (context && context.config) || {},\n node;\n if (isBrowser) {\n //In the browser so use a script tag\n node = req.createNode(config, moduleName, url);\n\n node.setAttribute('data-requirecontext', context.contextName);\n node.setAttribute('data-requiremodule', moduleName);\n\n //Set up load listener. Test attachEvent first because IE9 has\n //a subtle issue in its addEventListener and script onload firings\n //that do not match the behavior of all other browsers with\n //addEventListener support, which fire the onload event for a\n //script right after the script execution. See:\n //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution\n //UNFORTUNATELY Opera implements attachEvent but does not follow the script\n //script execution mode.\n if (node.attachEvent &&\n //Check if node.attachEvent is artificially added by custom script or\n //natively supported by browser\n //read https://github.com/requirejs/requirejs/issues/187\n //if we can NOT find [native code] then it must NOT natively supported.\n //in IE8, node.attachEvent does not have toString()\n //Note the test for \"[native code\" with no closing brace, see:\n //https://github.com/requirejs/requirejs/issues/273\n !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&\n !isOpera) {\n //Probably IE. IE (at least 6-8) do not fire\n //script onload right after executing the script, so\n //we cannot tie the anonymous define call to a name.\n //However, IE reports the script as being in 'interactive'\n //readyState at the time of the define call.\n useInteractive = true;\n\n node.attachEvent('onreadystatechange', context.onScriptLoad);\n //It would be great to add an error handler here to catch\n //404s in IE9+. However, onreadystatechange will fire before\n //the error handler, so that does not help. If addEventListener\n //is used, then IE will fire error before load, but we cannot\n //use that pathway given the connect.microsoft.com issue\n //mentioned above about not doing the 'script execute,\n //then fire the script load event listener before execute\n //next script' that other browsers do.\n //Best hope: IE10 fixes the issues,\n //and then destroys all installs of IE 6-9.\n //node.attachEvent('onerror', context.onScriptError);\n } else {\n node.addEventListener('load', context.onScriptLoad, false);\n node.addEventListener('error', context.onScriptError, false);\n }\n node.src = url;\n\n //Calling onNodeCreated after all properties on the node have been\n //set, but before it is placed in the DOM.\n if (config.onNodeCreated) {\n config.onNodeCreated(node, config, moduleName, url);\n }\n\n //For some cache cases in IE 6-8, the script executes before the end\n //of the appendChild execution, so to tie an anonymous define\n //call to the module name (which is stored on the node), hold on\n //to a reference to this node, but clear after the DOM insertion.\n currentlyAddingScript = node;\n if (baseElement) {\n head.insertBefore(node, baseElement);\n } else {\n head.appendChild(node);\n }\n currentlyAddingScript = null;\n\n return node;\n } else if (isWebWorker) {\n try {\n //In a web worker, use importScripts. This is not a very\n //efficient use of importScripts, importScripts will block until\n //its script is downloaded and evaluated. However, if web workers\n //are in play, the expectation is that a build has been done so\n //that only one script needs to be loaded anyway. This may need\n //to be reevaluated if other use cases become common.\n\n // Post a task to the event loop to work around a bug in WebKit\n // where the worker gets garbage-collected after calling\n // importScripts(): https://webkit.org/b/153317\n setTimeout(function() {}, 0);\n importScripts(url);\n\n //Account for anonymous modules\n context.completeLoad(moduleName);\n } catch (e) {\n context.onError(makeError('importscripts',\n 'importScripts failed for ' +\n moduleName + ' at ' + url,\n e,\n [moduleName]));\n }\n }\n };\n\n function getInteractiveScript() {\n if (interactiveScript && interactiveScript.readyState === 'interactive') {\n return interactiveScript;\n }\n\n eachReverse(scripts(), function (script) {\n if (script.readyState === 'interactive') {\n return (interactiveScript = script);\n }\n });\n return interactiveScript;\n }\n\n //Look for a data-main script attribute, which could also adjust the baseUrl.\n if (isBrowser && !cfg.skipDataMain) {\n //Figure out baseUrl. Get it from the script tag with require.js in it.\n eachReverse(scripts(), function (script) {\n //Set the 'head' where we can append children by\n //using the script's parent.\n if (!head) {\n head = script.parentNode;\n }\n\n //Look for a data-main attribute to set main script for the page\n //to load. If it is there, the path to data main becomes the\n //baseUrl, if it is not already set.\n dataMain = script.getAttribute('data-main');\n if (dataMain) {\n //Preserve dataMain in case it is a path (i.e. contains '?')\n mainScript = dataMain;\n\n //Set final baseUrl if there is not already an explicit one,\n //but only do so if the data-main value is not a loader plugin\n //module ID.\n if (!cfg.baseUrl && mainScript.indexOf('!') === -1) {\n //Pull off the directory of data-main for use as the\n //baseUrl.\n src = mainScript.split('/');\n mainScript = src.pop();\n subPath = src.length ? src.join('/') + '/' : './';\n\n cfg.baseUrl = subPath;\n }\n\n //Strip off any trailing .js since mainScript is now\n //like a module name.\n mainScript = mainScript.replace(jsSuffixRegExp, '');\n\n //If mainScript is still a path, fall back to dataMain\n if (req.jsExtRegExp.test(mainScript)) {\n mainScript = dataMain;\n }\n\n //Put the data-main script in the files to load.\n cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];\n\n return true;\n }\n });\n }\n\n /**\n * The function that handles definitions of modules. Differs from\n * require() in that a string for the module should be the first argument,\n * and the function to execute after dependencies are loaded should\n * return a value to define the module corresponding to the first argument's\n * name.\n */\n define = function (name, deps, callback) {\n var node, context;\n\n //Allow for anonymous modules\n if (typeof name !== 'string') {\n //Adjust args appropriately\n callback = deps;\n deps = name;\n name = null;\n }\n\n //This module may not have dependencies\n if (!isArray(deps)) {\n callback = deps;\n deps = null;\n }\n\n //If no name, and callback is a function, then figure out if it a\n //CommonJS thing with dependencies.\n if (!deps && isFunction(callback)) {\n deps = [];\n //Remove comments from the callback string,\n //look for require calls, and pull them into the dependencies,\n //but only if there are function args.\n if (callback.length) {\n callback\n .toString()\n .replace(commentRegExp, commentReplace)\n .replace(cjsRequireRegExp, function (match, dep) {\n deps.push(dep);\n });\n\n //May be a CommonJS thing even without require calls, but still\n //could use exports, and module. Avoid doing exports and module\n //work though if it just needs require.\n //REQUIRES the function to expect the CommonJS variables in the\n //order listed below.\n deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);\n }\n }\n\n //If in IE 6-8 and hit an anonymous define() call, do the interactive\n //work.\n if (useInteractive) {\n node = currentlyAddingScript || getInteractiveScript();\n if (node) {\n if (!name) {\n name = node.getAttribute('data-requiremodule');\n }\n context = contexts[node.getAttribute('data-requirecontext')];\n }\n }\n\n //Always save off evaluating the def call until the script onload handler.\n //This allows multiple modules to be in a file without prematurely\n //tracing dependencies, and allows for anonymous module support,\n //where the module name is not known until the script onload event\n //occurs. If no context, use the global queue, and get it processed\n //in the onscript load callback.\n if (context) {\n context.defQueue.push([name, deps, callback]);\n context.defQueueMap[name] = true;\n } else {\n globalDefQueue.push([name, deps, callback]);\n }\n };\n\n define.amd = {\n jQuery: true\n };\n\n /**\n * Executes the text. Normally just uses eval, but can be modified\n * to use a better, environment-specific call. Only used for transpiling\n * loader plugins, not for plain JS modules.\n * @param {String} text the text to execute/evaluate.\n */\n req.exec = function (text) {\n /*jslint evil: true */\n return eval(text);\n };\n\n //Set up with config info.\n req(cfg);\n}(this));\n\ndefine(\"requireLib\", function(){});\n\n", - "!function(){function t(t){this.message=t}var r=\"undefined\"!=typeof exports?exports:self,e=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";t.prototype=new Error,t.prototype.name=\"InvalidCharacterError\",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d=\"\";a.charAt(0|i)||(c=\"=\",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(n=a.charCodeAt(i+=.75),n>255)throw new t(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,\"\");if(o.length%4==1)throw new t(\"'atob' failed: The string to be decoded is not correctly encoded.\");for(var n,a,i=0,c=0,d=\"\";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}();\ndefine(\"lib/base64.min.js\", function(){});\n\n", - "window.browserDetect = {\n init: function () {\n this.browser = this.searchString(this.dataBrowser) || \"Other\";\n this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || \"Unknown\";\n // detect IE 11\n if (this.browser == 'Explorer' && this.version == '7' && navigator.userAgent.match(/Trident/i)) {\n this.version = this.searchVersionIE();\n }\n },\n\n searchString: function (data) {\n for (var i = 0 ; i < data.length ; i++) {\n var dataString = data[i].string;\n this.versionSearchString = data[i].subString;\n\n if (dataString.indexOf(data[i].subString) != -1) {\n return data[i].identity;\n }\n }\n },\n\n searchVersion: function (dataString) {\n var index = dataString.indexOf(this.versionSearchString);\n if (index == -1) return;\n return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));\n },\n\n searchVersionIE: function() {\n var ua = navigator.userAgent.toString().toLowerCase(),\n match = /(trident)(?:.*rv:([\\w.]+))?/.exec(ua) || /(msie) ([\\w.]+)/.exec(ua) || ['', null, -1],\n ver;\n try {\n ver = (match[2]).split('.')[0]; // version\n }\n catch (err) {\n ver = 'unknown'; //\n }\n return ver;\n },\n\n dataBrowser:\n [\n { string: navigator.userAgent, subString: \"Chrome\", identity: \"Chrome\" },\n { string: navigator.userAgent, subString: \"MSIE\", identity: \"Explorer\" },\n { string: navigator.userAgent, subString: \"Trident\", identity: \"Explorer\" },\n { string: navigator.userAgent, subString: \"Firefox\", identity: \"Firefox\" },\n { string: navigator.userAgent, subString: \"Safari\", identity: \"Safari\" },\n { string: navigator.userAgent, subString: \"Opera\", identity: \"Opera\" }\n ]\n\n};\n\nwindow.browserDetect.init();\ndefine(\"lib/browserdetect.js\", function(){});\n\n", - "(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|android|ipad|playbook|silk|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);\ndefine(\"lib/detectmobilebrowser.js\", function(){});\n\n", - "/*!\n * jQuery-ajaxTransport-XDomainRequest - v1.0.4 - 2015-03-05\n * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest\n * Copyright (c) 2015 Jason Moon (@JSONMOON)\n * Licensed MIT (/blob/master/LICENSE.txt)\n */\n(function(factory) {\n //if (typeof define === 'function' && define.amd) {\n // // AMD. Register as anonymous module.\n // define(['jquery'], factory);\n //} else if (typeof exports === 'object') {\n // // CommonJS\n // module.exports = factory(require('jquery'));\n //} else {\n // Browser globals.\n factory(jQuery);\n //}\n}(function($) {\n\n// Only continue if we're on IE8/IE9 with jQuery 1.5+ (contains the ajaxTransport function)\n if ($.support.cors || !$.ajaxTransport || !window.XDomainRequest) {\n return $;\n }\n\n var httpRegEx = /^(https?:)?\\/\\//i;\n var getOrPostRegEx = /^get|post$/i;\n var sameSchemeRegEx = new RegExp('^(\\/\\/|' + location.protocol + ')', 'i');\n\n// ajaxTransport exists in jQuery 1.5+\n $.ajaxTransport('* text html xml json', function(options, userOptions, jqXHR) {\n\n // Only continue if the request is: asynchronous, uses GET or POST method, has HTTP or HTTPS protocol, and has the same scheme as the calling page\n if (!options.crossDomain || !options.async || !getOrPostRegEx.test(options.type) || !httpRegEx.test(options.url) || !sameSchemeRegEx.test(options.url)) {\n return;\n }\n\n var xdr = null;\n\n return {\n send: function(headers, complete) {\n var postData = '';\n var userType = (userOptions.dataType || '').toLowerCase();\n\n xdr = new XDomainRequest();\n if (/^\\d+$/.test(userOptions.timeout)) {\n xdr.timeout = userOptions.timeout;\n }\n\n xdr.ontimeout = function() {\n complete(500, 'timeout');\n };\n\n xdr.onload = function() {\n var allResponseHeaders = 'Content-Length: ' + xdr.responseText.length + '\\r\\nContent-Type: ' + xdr.contentType;\n var status = {\n code: 200,\n message: 'success'\n };\n var responses = {\n text: xdr.responseText\n };\n try {\n if (userType === 'html' || /text\\/html/i.test(xdr.contentType)) {\n responses.html = xdr.responseText;\n } else if (userType === 'json' || (userType !== 'text' && /\\/json/i.test(xdr.contentType))) {\n try {\n responses.json = $.parseJSON(xdr.responseText);\n } catch(e) {\n status.code = 500;\n status.message = 'parseerror';\n //throw 'Invalid JSON: ' + xdr.responseText;\n }\n } else if (userType === 'xml' || (userType !== 'text' && /\\/xml/i.test(xdr.contentType))) {\n var doc = new ActiveXObject('Microsoft.XMLDOM');\n doc.async = false;\n try {\n doc.loadXML(xdr.responseText);\n } catch(e) {\n doc = undefined;\n }\n if (!doc || !doc.documentElement || doc.getElementsByTagName('parsererror').length) {\n status.code = 500;\n status.message = 'parseerror';\n throw 'Invalid XML: ' + xdr.responseText;\n }\n responses.xml = doc;\n }\n } catch(parseMessage) {\n throw parseMessage;\n } finally {\n complete(status.code, status.message, responses, allResponseHeaders);\n }\n };\n\n // set an empty handler for 'onprogress' so requests don't get aborted\n xdr.onprogress = function(){};\n xdr.onerror = function() {\n complete(401, 'error', {\n text: xdr.responseText\n });\n };\n\n if (userOptions.data) {\n postData = ($.type(userOptions.data) === 'string') ? userOptions.data : $.param(userOptions.data);\n }\n xdr.open(options.type, options.url);\n xdr.send(postData);\n },\n abort: function() {\n if (xdr) {\n xdr.abort();\n }\n }\n };\n });\n\n return $;\n\n}));\n\ndefine(\"lib/jquery.xdomainrequest.js\", function(){});\n\n", - "/* Modernizr 2.8.3 (Custom Build) | MIT & BSD\n * Build: http://modernizr.com/download/#-input-inputtypes-cssclasses-load\n */\n/* Modernizr 2.8.3 (Custom Build) | MIT & BSD\n * Build: http://modernizr.com/download/#-input-inputtypes-cssclasses-cors-load\n * (add Non-core detects: cors)\n */\n;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(prefixes.join(a+\";\")+(b||\"\"))}function x(a,b){return typeof a===b}function y(a,b){return!!~(\"\"+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,\"function\")?f.bind(d||b):f}return!1}function A(){e.input=function(c){for(var d=0,e=c.length;d-1&&(this._keys.splice(e,1),this._values.splice(e,1),this.size--,!0)},e.prototype.entries=function(){var e=this;return r.range(0,this.size).select(function(r){return[e._keys[r],e._values[r]]})},e.prototype.forEach=function(r,e){null==e&&(e=this);for(var t=0,n=this._keys,o=this._values,u=n.length;t-1},e.prototype.keys=function(){return this._keys.en()},e.prototype.set=function(r,e){var t=this._keys.indexOf(r);t>-1?this._values[t]=e:(this._keys.push(r),this._values.push(e),this.size++)},e.prototype.values=function(){return this._values.en()},e}();r.Map3=e,r.Enumerable.prototype.toMap=function(r,t){for(var n=new e,o=this.getEnumerator();o.moveNext();)n.set(r(o.current),t(o.current));return n},r.List&&(r.List.prototype.toMap=r.Enumerable.prototype.toMap)}(exjs||(exjs={})),function(r){r.Map||(r.Map=exjs.Map3)}(\"undefined\"==typeof window?global:window);var exjs;!function(r){function e(e){var t=new r.Enumerable;return t.getEnumerator=function(){var r={current:void 0,moveNext:function(){return e(r)}};return r},t}r.anonymous=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(o<2){if(t=t||r.getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||e.en().getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.append=function(){for(var t=this,n=[],o=0;o=e?(t.current=void 0,!1):(t.current=r[n],!0)},t}function t(){return this&&Array.isArray(this)?new n(this):new r.Enumerable}var n=function(r){function t(t){var n=r.call(this)||this;return n.getEnumerator=function(){return e(t)},n.toArray=function(){return t.slice(0)},n}return __extends(t,r),t}(r.Enumerable);try{Object.defineProperty(Array.prototype,\"en\",{value:t,enumerable:!1,writable:!1,configurable:!1})}catch(r){Array.prototype.en=t}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=!1,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),o.current=void 0,t.moveNext()?(o.current=t.current,!0):!n&&(n=!0,t=e.getEnumerator(),!!t.moveNext()&&(o.current=t.current,!0))}};return o}r.Enumerable.prototype.concat=function(t){var n=this,o=t instanceof Array?t.en():t,u=new r.Enumerable;return u.getEnumerator=function(){return e(n,o)},u},r.List&&(r.List.prototype.concat=r.Enumerable.prototype.concat)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=[],o={current:void 0,moveNext:function(){if(t||(t=r.getEnumerator()),o.current=void 0,!e){for(;t.moveNext();)if(n.indexOf(t.current)<0)return n.push(o.current=t.current),!0;return!1}for(;t.moveNext();){for(var u=0,i=n.length,c=!1;u-1)){var i=t(r[u],this.$jsonMappings[u]);void 0!==i&&(n[u]=i,o.push(u))}for(var u in r)o.indexOf(u)>-1||(n[u]=r[u]);return n};var exjs;!function(r){function e(r,e,n){var o,u=0,i={current:void 0,moveNext:function(){return o||(o=t(r,e,n)),i.current=void 0,!(u>=o.length)&&(i.current=o[u],u++,!0)}};return i}function t(r,e,t){t=t||function(r,e){return r===e};for(var o,u=[],i=[],c=r.getEnumerator();c.moveNext();){o=e(c.current);for(var a=-1,p=0,f=i.length;p=e?(t.current=void 0,!1):(t.current=r[n],!0)},t},t.prototype.remove=function(r){return this.removeWhere(function(e){return e===r}).any()},t.prototype.removeWhere=function(r){for(var e,t=[],n=this.length-1;n>=0;n--)e=this[n],r(e,n)===!0&&(this.splice(n,1),t.push(e));return t.en().reverse()}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,n,o){return new t(r,e,n,o)}var t=function(e){function t(r,t,n,o){var u=e.call(this)||this;u.Source=r,o=o||function(r,e){return r>e?1:r=e.length)&&(u.current=e[o],o++,!0)}};return u},t.prototype.thenBy=function(r,e){return new n(this,r,!1,e)},t.prototype.thenByDescending=function(r,e){return new n(this,r,!0,e)},t}(r.Enumerable),n=function(r){function e(e,t,n,o){var u=r.call(this,e,t,n,o)||this,i=e.Sorter,c=u.Sorter;return u.Sorter=function(r,e){return i(r,e)||c(r,e)},u}return __extends(e,r),e}(t),o=r.Enumerable.prototype;o.orderBy=function(r,t){return e(this,r,!1,t)},o.orderByDescending=function(r,t){return e(this,r,!0,t)},r.List&&(r.List.prototype.orderBy=r.Enumerable.prototype.orderBy,r.List.prototype.orderByDescending=r.Enumerable.prototype.orderByDescending)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(o<2){if(t=t||e.en().getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||r.getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.prepend=function(){for(var t=this,n=[],o=0;o=e)&&(o.current=n,!0)}};return o}function t(t,n,o){if(t=t||0,n=n||0,t>n)throw new Error(\"Start cannot be greater than end.\");null==o&&(o=1);var u=new r.Enumerable;return u.getEnumerator=function(){return e(t,n,o)},u}r.range=t}(exjs||(exjs={}));var exjs;!function(r){function e(e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.en(e).toArray(),n=t.length),n--,o.current=t[n],n>=0}};return o}r.Enumerable.prototype.reverse=function(){var t=this,n=new r.Enumerable;return n.getEnumerator=function(){return e(t)},n},r.List&&(r.List.prototype.reverse=r.Enumerable.prototype.reverse)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){if(e=e||0,0===e)return Math.round(r);var t=Math.pow(10,e);return Math.round(r*t)/t}r.round=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),!!t.moveNext()&&(o.current=e(t.current,n),n++,!0)}};return o}function t(e,t){var n,o,u={current:void 0,moveNext:function(){for(u.current=void 0,n||(n=e.getEnumerator());!o||!o.moveNext();){if(!n.moveNext())return!1;o=r.selectorEnumerator(t(n.current))}return u.current=o.current,!0}};return u}r.Enumerable.prototype.select=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.selectMany=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.select=r.Enumerable.prototype.select,r.List.prototype.selectMany=r.Enumerable.prototype.selectMany)}(exjs||(exjs={}));var exjs;!function(r){function e(r){return Array.isArray(r)?r.en().getEnumerator():null!=r&&\"function\"==typeof r.getEnumerator?r.getEnumerator():null}r.selectorEnumerator=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;oe)&&(o.current=void 0,!!t.moveNext()&&(o.current=t.current,!0))}};return o}function t(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),t.moveNext()&&e(t.current,n)?(n++,o.current=t.current,!0):(o.current=void 0,!1)}};return o}r.Enumerable.prototype.take=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.takeWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.take=r.Enumerable.prototype.take,r.List.prototype.takeWhile=r.Enumerable.prototype.takeWhile)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t){var n,o=!1,u=[],i={current:void 0,moveNext:function(){if(o){if(null==n)return!1;u.push(n),n=r.selectorEnumerator(t(i.current))}else n=e.getEnumerator(),o=!0;for(;!(n&&n.moveNext()||u.length<1);)n=u.pop();return i.current=null==n?void 0:n.current,void 0!==i.current}};return i}function t(e,t,n){var o,u=!1,i=[],c={current:void 0,moveNext:function(){if(u){if(null==o)return!1;i.push(o),o=r.selectorEnumerator(t(c.current))}else o=e.getEnumerator(),u=!0;do{for(;!(o&&o.moveNext()||i.length<1);)o=i.pop();c.current=null==o?void 0:o.current}while(n(c.current));return void 0!==c.current}};return c}r.Enumerable.prototype.traverse=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.traverseUnique=function(e,n){var o=this,u=[],i=new r.Enumerable;return n?i.getEnumerator=function(){return t(o,e,function(r){return!!u.some(function(e){return n(r,e)})||(u.push(r),!1)})}:i.getEnumerator=function(){return t(o,e,function(r){return u.indexOf(r)>-1||(u.push(r),!1)})},i},r.List&&(r.List.prototype.traverse=r.Enumerable.prototype.traverse,r.List.prototype.traverseUnique=r.Enumerable.prototype.traverseUnique)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u,i=[],c={current:void 0,moveNext:function(){if(o||(o=r.en(e).distinct().getEnumerator()),c.current=void 0,!u&&o.moveNext())return i.push(c.current=o.current),!0;for(u=u||r.en(t).distinct().getEnumerator();u.moveNext();){for(var a=0,p=!1,f=i.length;a chars) {\r\n var trimmedText = text.substr(0, chars);\r\n trimmedText = trimmedText.substr(0, Math.min(trimmedText.length, trimmedText.lastIndexOf(\" \")));\r\n $self.empty().html(trimmedText + \"…\");\r\n }\r\n });\r\n };\r\n $.fn.ellipsisFill = function (text) {\r\n var textPassed = true;\r\n if (!text)\r\n textPassed = false;\r\n return this.each(function () {\r\n var $self = $(this);\r\n if (!textPassed)\r\n text = $self.text();\r\n $self.empty();\r\n var $spanElem = $('');\r\n $self.append($spanElem);\r\n $self.css('overflow', 'hidden');\r\n $spanElem.css('white-space', 'nowrap');\r\n $spanElem.html(text);\r\n // get the width of the span.\r\n // if it's wider than the container, remove a word until it's not.\r\n if ($spanElem.width() > $self.width()) {\r\n var lastText = null;\r\n while ($spanElem.width() > $self.width()) {\r\n var t = $spanElem.html();\r\n t = t.substring(0, t.lastIndexOf(' ')) + '…';\r\n if (t === lastText)\r\n break;\r\n $spanElem.html(t);\r\n lastText = t;\r\n }\r\n }\r\n });\r\n };\r\n // Truncates to a certain number of letters, while ignoring and preserving HTML\r\n $.fn.ellipsisHtmlFixed = function (chars, cb) {\r\n return this.each(function () {\r\n var $self = $(this);\r\n var expandedText = $self.html();\r\n var $trunc = $('');\r\n $trunc.html($self.html().replace(/\\s[\\s]*/g, ' ').trim());\r\n if ($trunc.text().trim().length <= chars) {\r\n return; // do nothing if we're under the limit!\r\n }\r\n while ($trunc.text().trim().length > chars) {\r\n $trunc.removeLastWord(chars);\r\n }\r\n var collapsedText = $trunc.html();\r\n // Toggle function\r\n var expanded = false;\r\n $self.toggle = function () {\r\n $self.empty();\r\n var $toggleButton = $('');\r\n if (expanded) {\r\n $self.html(expandedText + \" \");\r\n $toggleButton.text(\"less\");\r\n $toggleButton.switchClass(\"less\", \"more\");\r\n }\r\n else {\r\n $self.html(collapsedText + \"… \");\r\n $toggleButton.text(\"more\");\r\n $toggleButton.switchClass(\"more\", \"less\");\r\n }\r\n $toggleButton.one('click', function (e) {\r\n e.preventDefault();\r\n $self.toggle();\r\n });\r\n expanded = !expanded;\r\n $self.append($toggleButton);\r\n if (cb)\r\n cb();\r\n };\r\n $self.toggle();\r\n });\r\n };\r\n $.fn.enable = function () {\r\n return this.each(function () {\r\n var $self = $(this);\r\n $self.removeClass('disabled');\r\n $self.attr('tabindex', $self.data('tabindex'));\r\n });\r\n };\r\n $.fn.equaliseHeight = function (reset, average) {\r\n var maxHeight = -1;\r\n var minHeight = Number.MAX_VALUE;\r\n var heights = [];\r\n // reset all heights to auto first so they can be re-measured.\r\n if (reset) {\r\n this.each(function () {\r\n $(this).height('auto');\r\n });\r\n }\r\n this.each(function () {\r\n var currentHeight = $(this).height();\r\n heights.push(currentHeight);\r\n maxHeight = maxHeight > currentHeight ? maxHeight : currentHeight;\r\n minHeight = minHeight < currentHeight ? minHeight : currentHeight;\r\n });\r\n var finalHeight = maxHeight;\r\n if (average) {\r\n heights.sort(function (a, b) { return a - b; });\r\n var half = Math.floor(heights.length / 2);\r\n if (heights.length % 2) {\r\n finalHeight = heights[half];\r\n }\r\n else {\r\n finalHeight = (heights[half - 1] + heights[half]) / 2.0;\r\n }\r\n }\r\n this.each(function () {\r\n $(this).height(finalHeight);\r\n });\r\n return this;\r\n };\r\n $.fn.getVisibleElementWithGreatestTabIndex = function () {\r\n var $self = $(this);\r\n var maxTabIndex = 0;\r\n var $elementWithGreatestTabIndex = null;\r\n $self.find('*:visible[tabindex]').each(function (index, el) {\r\n var $el = $(el);\r\n var tabIndex = parseInt($el.attr('tabindex'));\r\n if (tabIndex > maxTabIndex) {\r\n maxTabIndex = tabIndex;\r\n $elementWithGreatestTabIndex = $el;\r\n }\r\n });\r\n return $elementWithGreatestTabIndex;\r\n };\r\n $.fn.horizontalMargins = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('marginLeft')) + parseInt($self.css('marginRight'));\r\n };\r\n $.fn.leftMargin = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('marginLeft'));\r\n };\r\n $.fn.rightMargin = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('marginRight'));\r\n };\r\n $.fn.horizontalPadding = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('paddingLeft')) + parseInt($self.css('paddingRight'));\r\n };\r\n $.fn.leftPadding = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('paddingLeft'));\r\n };\r\n $.fn.rightPadding = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('paddingRight'));\r\n };\r\n $.mlp = { x: 0, y: 0 }; // Mouse Last Position\r\n function documentHandler() {\r\n var $current = this === document ? $(this) : $(this).contents();\r\n $current.mousemove(function (e) { jQuery.mlp = { x: e.pageX, y: e.pageY }; });\r\n $current.find('iframe').on('load', documentHandler);\r\n }\r\n $(documentHandler);\r\n $.fn.ismouseover = function () {\r\n var result = false;\r\n this.eq(0).each(function () {\r\n var $current = $(this).is(\"iframe\") ? $(this).contents().find(\"body\") : $(this);\r\n var offset = $current.offset();\r\n result = offset.left <= $.mlp.x && offset.left + $current.outerWidth() > $.mlp.x &&\r\n offset.top <= $.mlp.y && offset.top + $current.outerHeight() > $.mlp.y;\r\n });\r\n return result;\r\n };\r\n var on = $.fn.on;\r\n var timer;\r\n $.fn.on = function () {\r\n var args = Array.apply(null, arguments);\r\n var last = args[args.length - 1];\r\n if (isNaN(last) || (last === 1 && args.pop()))\r\n return on.apply(this, args);\r\n var delay = args.pop();\r\n var fn = args.pop();\r\n args.push(function () {\r\n var self = this;\r\n var params = arguments;\r\n clearTimeout(timer);\r\n timer = setTimeout(function () {\r\n fn.apply(self, params);\r\n }, delay);\r\n });\r\n return on.apply(this, args);\r\n };\r\n $.fn.onEnter = function (cb) {\r\n return this.each(function () {\r\n var $this = $(this);\r\n $this.on('keyup', function (e) {\r\n if (e.keyCode === 13) {\r\n e.preventDefault();\r\n cb();\r\n }\r\n });\r\n });\r\n };\r\n $.fn.onPressed = function (cb) {\r\n return this.each(function () {\r\n var $this = $(this);\r\n $this.on('touchstart click', function (e) {\r\n e.preventDefault();\r\n cb(e);\r\n });\r\n $this.on('keyup', function (e) {\r\n if (e.keyCode === 13) {\r\n e.preventDefault();\r\n cb(e);\r\n }\r\n });\r\n });\r\n };\r\n // Recursively removes the last empty element (img, audio, etc) or word in an element\r\n $.fn.removeLastWord = function (chars, depth) {\r\n if (chars === void 0) { chars = 8; }\r\n if (depth === void 0) { depth = 0; }\r\n return this.each(function () {\r\n var $self = $(this);\r\n if ($self.contents().length > 0) {\r\n var $lastElement = $self.contents().last();\r\n if ($lastElement[0].nodeType === 3) {\r\n var words = $lastElement.text().trim().split(' ');\r\n if (words.length > 1) {\r\n words.splice(words.length - 1, 1);\r\n $lastElement[0].data = words.join(' '); // textnode.data\r\n return;\r\n }\r\n else if ('undefined' !== typeof chars && words.length === 1 && words[0].length > chars) {\r\n $lastElement[0].data = words.join(' ').substring(0, chars);\r\n return;\r\n }\r\n }\r\n $lastElement.removeLastWord(chars, depth + 1); // Element\r\n }\r\n else if (depth > 0) {\r\n // Empty element\r\n $self.remove();\r\n }\r\n });\r\n };\r\n $.fn.switchClass = function (class1, class2) {\r\n return this.each(function () {\r\n $(this).removeClass(class1).addClass(class2);\r\n });\r\n };\r\n $.fn.targetBlank = function () {\r\n return this.each(function () {\r\n $(this).find('a').prop('target', '_blank');\r\n });\r\n };\r\n $.fn.toggleExpandText = function (chars, lessText, moreText, cb) {\r\n return this.each(function () {\r\n var $self = $(this);\r\n var expandedText = $self.html();\r\n if (chars > expandedText.length)\r\n return;\r\n var expanded = false;\r\n var collapsedText = expandedText.substr(0, chars);\r\n collapsedText = collapsedText.substr(0, Math.min(collapsedText.length, collapsedText.lastIndexOf(\" \")));\r\n $self.toggle = function () {\r\n $self.empty();\r\n var $toggleButton = $('');\r\n if (expanded) {\r\n $self.html(expandedText + \" \");\r\n $toggleButton.text(lessText);\r\n $toggleButton.switchClass(\"less\", \"more\");\r\n }\r\n else {\r\n $self.html(collapsedText + \" \");\r\n $toggleButton.text(moreText);\r\n $toggleButton.switchClass(\"more\", \"less\");\r\n }\r\n $toggleButton.one('click', function (e) {\r\n e.preventDefault();\r\n $self.toggle();\r\n });\r\n expanded = !expanded;\r\n $self.append($toggleButton);\r\n if (cb)\r\n cb();\r\n };\r\n $self.toggle();\r\n });\r\n };\r\n // Toggle expansion by number of lines\r\n $.fn.toggleExpandTextByLines = function (lines, lessText, moreText, cb) {\r\n return this.each(function () {\r\n var $self = $(this);\r\n var expandedText = $self.html();\r\n // add 'pad' to account for the right margin in the sidebar\r\n var $buttonPad = $('morepad');\r\n // when height changes, store string, then pick from line counts\r\n var stringsByLine = [expandedText];\r\n var lastHeight = $self.height();\r\n // Until empty\r\n while ($self.text().length > 0) {\r\n $self.removeLastWord();\r\n var html = $self.html();\r\n $self.append($buttonPad);\r\n if (lastHeight > $self.height()) {\r\n stringsByLine.unshift(html);\r\n lastHeight = $self.height();\r\n }\r\n $buttonPad.remove();\r\n }\r\n if (stringsByLine.length <= lines) {\r\n $self.html(expandedText);\r\n return;\r\n }\r\n var collapsedText = stringsByLine[lines - 1];\r\n // Toggle function\r\n var expanded = false;\r\n $self.toggle = function () {\r\n $self.empty();\r\n var $toggleButton = $('');\r\n if (expanded) {\r\n $self.html(expandedText + \" \");\r\n $toggleButton.text(lessText);\r\n $toggleButton.switchClass(\"less\", \"more\");\r\n }\r\n else {\r\n $self.html(collapsedText + \"… \");\r\n $toggleButton.text(moreText);\r\n $toggleButton.switchClass(\"more\", \"less\");\r\n }\r\n $toggleButton.one('click', function (e) {\r\n e.preventDefault();\r\n $self.toggle();\r\n });\r\n expanded = !expanded;\r\n $self.append($toggleButton);\r\n if (cb)\r\n cb();\r\n };\r\n $self.toggle();\r\n });\r\n };\r\n $.fn.toggleText = function (text1, text2) {\r\n return this.each(function () {\r\n var $self = $(this);\r\n if ($self.text() === text1) {\r\n $(this).text(text2);\r\n }\r\n else {\r\n $(this).text(text1);\r\n }\r\n });\r\n };\r\n $.fn.updateAttr = function (attrName, oldVal, newVal) {\r\n return this.each(function () {\r\n var $self = $(this);\r\n var attr = $self.attr(attrName);\r\n if (attr && attr.indexOf(oldVal) === 0) {\r\n attr = attr.replace(oldVal, newVal);\r\n $self.attr(attrName, attr);\r\n }\r\n });\r\n };\r\n $.fn.verticalMargins = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('marginTop')) + parseInt($self.css('marginBottom'));\r\n };\r\n $.fn.verticalPadding = function () {\r\n var $self = $(this);\r\n return parseInt($self.css('paddingTop')) + parseInt($self.css('paddingBottom'));\r\n };\r\n})(jQuery);\r\n\ndefine(\"lib/jquery-plugins.js\", function(){});\n\n", - "/*! Tiny Pub/Sub - v0.7.0 - 2018-10-11\r\n* https://github.com/cowboy/jquery-tiny-pubsub\r\n* Copyright (c) 2018 \"Cowboy\" Ben Alman; Licensed MIT */\r\n(function($) {\n\n var o = null;\n\n $.initPubSub = function() {\n o = $({});\n };\n\n $.subscribe = function() {\n if (!o) {\n $.initPubSub();\n }\n\n o.on.apply(o, arguments);\n };\n\n $.unsubscribe = function() {\n if (!o) {\n $.initPubSub();\n }\n\n o.off.apply(o, arguments);\n };\n\n $.disposePubSub = function() {\n o = null;\n };\n\n $.publish = function() {\n if (!o) {\n $.initPubSub();\n }\n\n o.trigger.apply(o, arguments);\n };\n\n}(jQuery));\ndefine(\"lib/ba-tiny-pubsub.js\", function(){});\n\n", - "// manifesto v3.0.12 https://github.com/iiif-commons/manifesto\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define('lib/manifesto.js',[],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.manifesto = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i -1 ||\n this.externalResource.data['@context'].indexOf('/1.1/context.json') > -1 ||\n this.externalResource.data['@context'].indexOf('/1/context.json') > -1) {\n quality = 'native';\n }\n }\n }\n else {\n // info.json hasn't been loaded yet\n var images = this.getImages();\n if (images && images.length) {\n var firstImage = images[0];\n var resource = firstImage.getResource();\n var services = resource.getServices();\n if (!width) {\n width = resource.getWidth();\n }\n if (services.length) {\n var service = services[0];\n id = service.id;\n quality = Manifesto.Utils.getImageQuality(service.getProfile());\n }\n else if (width === resource.getWidth()) {\n // if the passed width is the same as the resource width\n // i.e. not looking for a thumbnail\n // return the full size image.\n // used for download options when loading static images.\n return resource.id;\n }\n }\n // todo: should this be moved to getThumbUri?\n if (!id) {\n var thumbnail = this.getProperty('thumbnail');\n if (thumbnail) {\n if (typeof (thumbnail) === 'string') {\n return thumbnail;\n }\n else {\n if (thumbnail['@id']) {\n return thumbnail['@id'];\n }\n else if (thumbnail.length) {\n return thumbnail[0].id;\n }\n }\n }\n }\n }\n size = width + ',';\n // trim off trailing '/'\n if (id && id.endsWith('/')) {\n id = id.substr(0, id.length - 1);\n }\n var uri = [id, region, size, rotation, quality + '.jpg'].join('/');\n return uri;\n };\n Canvas.prototype.getMaxDimensions = function () {\n var maxDimensions = null;\n var profile;\n if (this.externalResource && this.externalResource.data && this.externalResource.data.profile) {\n profile = this.externalResource.data.profile;\n if (Array.isArray(profile)) {\n profile = profile.filter(function (p) { return p[\"maxWidth\" || \"maxwidth\"]; })[0];\n if (profile) {\n maxDimensions = new Manifesto.Size(profile.maxWidth, profile.maxHeight ? profile.maxHeight : profile.maxWidth);\n }\n }\n }\n return maxDimensions;\n };\n // Presentation API 3.0\n Canvas.prototype.getContent = function () {\n var content = [];\n var items = this.__jsonld.items || this.__jsonld.content;\n if (!items)\n return content;\n // should be contained in an AnnotationPage\n var annotationPage = null;\n if (items.length) {\n annotationPage = new Manifesto.AnnotationPage(items[0], this.options);\n }\n if (!annotationPage) {\n return content;\n }\n var annotations = annotationPage.getItems();\n for (var i = 0; i < annotations.length; i++) {\n var a = annotations[i];\n var annotation = new Manifesto.Annotation(a, this.options);\n content.push(annotation);\n }\n return content;\n };\n Canvas.prototype.getDuration = function () {\n return this.getProperty('duration');\n };\n Canvas.prototype.getImages = function () {\n var images = [];\n if (!this.__jsonld.images)\n return images;\n for (var i = 0; i < this.__jsonld.images.length; i++) {\n var a = this.__jsonld.images[i];\n var annotation = new Manifesto.Annotation(a, this.options);\n images.push(annotation);\n }\n return images;\n };\n Canvas.prototype.getIndex = function () {\n return this.getProperty('index');\n };\n Canvas.prototype.getOtherContent = function () {\n var _this = this;\n var otherContent = Array.isArray(this.getProperty('otherContent')) ?\n this.getProperty('otherContent') :\n [this.getProperty('otherContent')];\n var canonicalComparison = function (typeA, typeB) {\n if (typeof typeA !== 'string' || typeof typeB !== 'string') {\n return false;\n }\n return typeA.toLowerCase() === typeA.toLowerCase();\n };\n var otherPromises = otherContent\n .filter(function (otherContent) { return otherContent && canonicalComparison(otherContent['@type'], 'sc:AnnotationList'); })\n .map(function (annotationList, i) { return ((new Manifesto.AnnotationList(annotationList['label'] || \"Annotation list \" + i, annotationList, _this.options))); })\n .map(function (annotationList) { return annotationList.load(); });\n return Promise.all(otherPromises);\n };\n // Prefer thumbnail service to image service if supplied and if\n // the thumbnail service can provide a satisfactory size +/- x pixels.\n // this is used to get thumb URIs *before* the info.json has been requested\n // and populate thumbnails in a viewer.\n // the publisher may also provide pre-computed fixed-size thumbs for better performance.\n //getThumbUri(width: number): string {\n //\n // var uri;\n // var images: IAnnotation[] = this.getImages();\n //\n // if (images && images.length) {\n // var firstImage = images[0];\n // var resource: IResource = firstImage.getResource();\n // var services: IService[] = resource.getServices();\n //\n // for (let i = 0; i < services.length; i++) {\n // var service: IService = services[i];\n // var id = service.id;\n //\n // if (!_endsWith(id, '/')) {\n // id += '/';\n // }\n //\n // uri = id + 'full/' + width + ',/0/' + Utils.getImageQuality(service.getProfile()) + '.jpg';\n // }\n // }\n //\n // return uri;\n //}\n //getType(): CanvasType {\n // return new CanvasType(this.getProperty('@type').toLowerCase());\n //}\n Canvas.prototype.getWidth = function () {\n return this.getProperty('width');\n };\n Canvas.prototype.getHeight = function () {\n return this.getProperty('height');\n };\n return Canvas;\n }(Manifesto.Resource));\n Manifesto.Canvas = Canvas;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var IIIFResource = /** @class */ (function (_super) {\n __extends(IIIFResource, _super);\n function IIIFResource(jsonld, options) {\n var _this = _super.call(this, jsonld, options) || this;\n _this.index = -1;\n _this.isLoaded = false;\n var defaultOptions = {\n defaultLabel: '-',\n locale: 'en-GB',\n resource: _this,\n pessimisticAccessControl: false\n };\n _this.options = Object.assign(defaultOptions, options);\n return _this;\n }\n IIIFResource.prototype.getAttribution = function () {\n console.warn('getAttribution will be deprecated, use getRequiredStatement instead.');\n var attribution = this.getProperty('attribution');\n if (attribution) {\n return Manifesto.LanguageMap.parse(attribution, this.options.locale);\n }\n return [];\n };\n IIIFResource.prototype.getDescription = function () {\n var description = this.getProperty('description');\n if (description) {\n return Manifesto.LanguageMap.parse(description, this.options.locale);\n }\n return [];\n };\n IIIFResource.prototype.getIIIFResourceType = function () {\n return new Manifesto.IIIFResourceType(Manifesto.Utils.normaliseType(this.getProperty('type')));\n };\n IIIFResource.prototype.getLogo = function () {\n var logo = this.getProperty('logo');\n if (!logo)\n return null;\n if (typeof (logo) === 'string')\n return logo;\n if (Array.isArray(logo) && logo.length) {\n logo = logo[0];\n }\n return logo['@id'] || logo.id;\n };\n IIIFResource.prototype.getLicense = function () {\n return Manifesto.Utils.getLocalisedValue(this.getProperty('license'), this.options.locale);\n };\n IIIFResource.prototype.getNavDate = function () {\n return new Date(this.getProperty('navDate'));\n };\n IIIFResource.prototype.getRelated = function () {\n return this.getProperty('related');\n };\n IIIFResource.prototype.getSeeAlso = function () {\n return this.getProperty('seeAlso');\n };\n IIIFResource.prototype.getTrackingLabel = function () {\n var service = this.getService(Manifesto.ServiceProfile.TRACKINGEXTENSIONS);\n if (service) {\n return service.getProperty('trackingLabel');\n }\n return '';\n };\n IIIFResource.prototype.getDefaultTree = function () {\n this.defaultTree = new Manifesto.TreeNode('root');\n this.defaultTree.data = this;\n return this.defaultTree;\n };\n IIIFResource.prototype.getRequiredStatement = function () {\n var requiredStatement = null;\n var _requiredStatement = this.getProperty('requiredStatement');\n if (_requiredStatement) {\n requiredStatement = new Manifesto.LabelValuePair(this.options.locale);\n requiredStatement.parse(_requiredStatement);\n }\n else {\n // fall back to attribution (if it exists)\n var attribution = this.getAttribution();\n if (attribution) {\n requiredStatement = new Manifesto.LabelValuePair(this.options.locale);\n requiredStatement.value = attribution;\n }\n }\n return requiredStatement;\n };\n IIIFResource.prototype.isCollection = function () {\n if (this.getIIIFResourceType().toString() === Manifesto.IIIFResourceType.COLLECTION.toString()) {\n return true;\n }\n return false;\n };\n IIIFResource.prototype.isManifest = function () {\n if (this.getIIIFResourceType().toString() === Manifesto.IIIFResourceType.MANIFEST.toString()) {\n return true;\n }\n return false;\n };\n IIIFResource.prototype.load = function () {\n var that = this;\n return new Promise(function (resolve, reject) {\n if (that.isLoaded) {\n resolve(that);\n }\n else {\n var options_1 = that.options;\n options_1.navDate = that.getNavDate();\n var id = that.__jsonld.id;\n if (!id) {\n id = that.__jsonld['@id'];\n }\n Manifesto.Utils.loadResource(id).then(function (data) {\n that.parentLabel = Manifesto.LanguageMap.getValue(that.getLabel(), options_1.locale);\n var parsed = Manifesto.Deserialiser.parse(data, options_1);\n that = Object.assign(that, parsed);\n //that.parentCollection = options.resource.parentCollection;\n that.index = options_1.index;\n resolve(that);\n });\n }\n });\n };\n return IIIFResource;\n }(Manifesto.ManifestResource));\n Manifesto.IIIFResource = IIIFResource;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Manifest = /** @class */ (function (_super) {\n __extends(Manifest, _super);\n function Manifest(jsonld, options) {\n var _this = _super.call(this, jsonld, options) || this;\n _this.index = 0;\n _this._allRanges = null;\n _this.items = [];\n _this._topRanges = [];\n if (_this.__jsonld.structures && _this.__jsonld.structures.length) {\n var topRanges = _this._getTopRanges();\n for (var i = 0; i < topRanges.length; i++) {\n var range = topRanges[i];\n _this._parseRanges(range, String(i));\n }\n }\n return _this;\n }\n Manifest.prototype.getPosterCanvas = function () {\n var posterCanvas = this.getProperty('posterCanvas');\n if (posterCanvas) {\n posterCanvas = new Manifesto.Canvas(posterCanvas, this.options);\n }\n return posterCanvas;\n };\n Manifest.prototype.getBehavior = function () {\n var behavior = this.getProperty('behavior');\n if (Array.isArray(behavior)) {\n behavior = behavior[0];\n }\n if (behavior) {\n return new Manifesto.Behavior(behavior);\n }\n return null;\n };\n Manifest.prototype.getDefaultTree = function () {\n _super.prototype.getDefaultTree.call(this);\n this.defaultTree.data.type = Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.MANIFEST.toString());\n if (!this.isLoaded) {\n return this.defaultTree;\n }\n var topRanges = this.getTopRanges();\n // if there are any ranges in the manifest, default to the first 'top' range or generated placeholder\n if (topRanges.length) {\n topRanges[0].getTree(this.defaultTree);\n }\n Manifesto.Utils.generateTreeNodeIds(this.defaultTree);\n return this.defaultTree;\n };\n Manifest.prototype._getTopRanges = function () {\n var topRanges = [];\n if (this.__jsonld.structures && this.__jsonld.structures.length) {\n for (var i = 0; i < this.__jsonld.structures.length; i++) {\n var json = this.__jsonld.structures[i];\n if (json.viewingHint === Manifesto.ViewingHint.TOP.toString()) {\n topRanges.push(json);\n }\n }\n // if no viewingHint=\"top\" range was found, create a default one\n if (!topRanges.length) {\n var range = {};\n range.ranges = this.__jsonld.structures;\n topRanges.push(range);\n }\n }\n return topRanges;\n };\n Manifest.prototype.getTopRanges = function () {\n return this._topRanges;\n };\n Manifest.prototype._getRangeById = function (id) {\n if (this.__jsonld.structures && this.__jsonld.structures.length) {\n for (var i = 0; i < this.__jsonld.structures.length; i++) {\n var r = this.__jsonld.structures[i];\n if (r['@id'] === id || r.id === id) {\n return r;\n }\n }\n }\n return null;\n };\n //private _parseRangeCanvas(json: any, range: IRange): void {\n // todo: currently this isn't needed\n //var canvas: IJSONLDResource = new JSONLDResource(json);\n //range.items.push(canvas);\n //}\n Manifest.prototype._parseRanges = function (r, path, parentRange) {\n var range;\n var id = null;\n if (typeof (r) === 'string') {\n id = r;\n r = this._getRangeById(id);\n }\n if (!r) {\n console.warn(\"Range:\", id, \"does not exist\");\n return;\n }\n range = new Manifesto.Range(r, this.options);\n range.parentRange = parentRange;\n range.path = path;\n if (!parentRange) {\n this._topRanges.push(range);\n }\n else {\n parentRange.items.push(range);\n }\n var items = r.items || r.members;\n if (items) {\n for (var i = 0; i < items.length; i++) {\n var item = items[i];\n // todo: use an ItemType constant?\n if (item['@type'] && item['@type'].toLowerCase() === 'sc:range' || item['type'] && item['type'].toLowerCase() === 'range') {\n this._parseRanges(item, path + '/' + i, range);\n }\n else if (item['@type'] && item['@type'].toLowerCase() === 'sc:canvas' || item['type'] && item['type'].toLowerCase() === 'canvas') {\n // store the ids on the __jsonld object to be used by Range.getCanvasIds()\n if (!range.canvases) {\n range.canvases = [];\n }\n var id_1 = item.id || item['@id'];\n range.canvases.push(id_1);\n }\n }\n }\n else if (r.ranges) {\n for (var i = 0; i < r.ranges.length; i++) {\n this._parseRanges(r.ranges[i], path + '/' + i, range);\n }\n }\n };\n Manifest.prototype.getAllRanges = function () {\n if (this._allRanges != null)\n return this._allRanges;\n this._allRanges = [];\n var topRanges = this.getTopRanges();\n var _loop_1 = function (i) {\n var topRange = topRanges[i];\n if (topRange.id) {\n this_1._allRanges.push(topRange); // it might be a placeholder root range\n }\n var reducer = function (acc, next) {\n acc.add(next);\n var nextRanges = next.getRanges();\n if (nextRanges.length) {\n return nextRanges.reduce(reducer, acc);\n }\n return acc;\n };\n var subRanges = Array.from(topRange.getRanges().reduce(reducer, new Set()));\n this_1._allRanges = this_1._allRanges.concat(subRanges);\n };\n var this_1 = this;\n for (var i = 0; i < topRanges.length; i++) {\n _loop_1(i);\n }\n return this._allRanges;\n };\n Manifest.prototype.getRangeById = function (id) {\n var ranges = this.getAllRanges();\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.id === id) {\n return range;\n }\n }\n return null;\n };\n Manifest.prototype.getRangeByPath = function (path) {\n var ranges = this.getAllRanges();\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.path === path) {\n return range;\n }\n }\n return null;\n };\n Manifest.prototype.getSequences = function () {\n if (this.items.length) {\n return this.items;\n }\n // IxIF mediaSequences overrode sequences, so need to be checked first.\n // deprecate this when presentation 3 ships\n var items = this.__jsonld.mediaSequences || this.__jsonld.sequences;\n if (items) {\n for (var i = 0; i < items.length; i++) {\n var s = items[i];\n var sequence = new Manifesto.Sequence(s, this.options);\n this.items.push(sequence);\n }\n }\n else if (this.__jsonld.items) {\n var sequence = new Manifesto.Sequence(this.__jsonld.items, this.options);\n this.items.push(sequence);\n }\n return this.items;\n };\n Manifest.prototype.getSequenceByIndex = function (sequenceIndex) {\n return this.getSequences()[sequenceIndex];\n };\n Manifest.prototype.getTotalSequences = function () {\n return this.getSequences().length;\n };\n Manifest.prototype.getManifestType = function () {\n var service = this.getService(Manifesto.ServiceProfile.UIEXTENSIONS);\n if (service) {\n return new Manifesto.ManifestType(service.getProperty('manifestType'));\n }\n return new Manifesto.ManifestType('');\n };\n Manifest.prototype.isMultiSequence = function () {\n return this.getTotalSequences() > 1;\n };\n Manifest.prototype.isPagingEnabled = function () {\n var viewingHint = this.getViewingHint();\n if (viewingHint) {\n return viewingHint.toString() === Manifesto.ViewingHint.PAGED.toString();\n }\n var behavior = this.getBehavior();\n if (behavior) {\n return behavior.toString() === Manifesto.Behavior.PAGED.toString();\n }\n return false;\n };\n Manifest.prototype.getViewingDirection = function () {\n if (this.getProperty('viewingDirection')) {\n return new Manifesto.ViewingDirection(this.getProperty('viewingDirection'));\n }\n return null;\n };\n Manifest.prototype.getViewingHint = function () {\n if (this.getProperty('viewingHint')) {\n return new Manifesto.ViewingHint(this.getProperty('viewingHint'));\n }\n return null;\n };\n return Manifest;\n }(Manifesto.IIIFResource));\n Manifesto.Manifest = Manifest;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Collection = /** @class */ (function (_super) {\n __extends(Collection, _super);\n function Collection(jsonld, options) {\n var _this = _super.call(this, jsonld, options) || this;\n _this.items = [];\n _this._collections = null;\n _this._manifests = null;\n jsonld.__collection = _this;\n return _this;\n }\n Collection.prototype.getCollections = function () {\n if (this._collections) {\n return this._collections;\n }\n return this._collections = this.items.filter(function (m) { return m.isCollection(); });\n };\n Collection.prototype.getManifests = function () {\n if (this._manifests) {\n return this._manifests;\n }\n return this._manifests = this.items.filter(function (m) { return m.isManifest(); });\n };\n Collection.prototype.getCollectionByIndex = function (collectionIndex) {\n var collections = this.getCollections();\n var collection;\n for (var i = 0; i < collections.length; i++) {\n var c = collections[i];\n if (c.index === collectionIndex) {\n collection = c;\n }\n }\n if (collection) {\n collection.options.index = collectionIndex;\n // id for collection MUST be dereferenceable\n return collection.load();\n }\n else {\n throw new Error(\"Collection index not found\");\n }\n };\n Collection.prototype.getManifestByIndex = function (manifestIndex) {\n var manifests = this.getManifests();\n var manifest;\n for (var i = 0; i < manifests.length; i++) {\n var m = manifests[i];\n if (m.index === manifestIndex) {\n manifest = m;\n }\n }\n if (manifest) {\n manifest.options.index = manifestIndex;\n return manifest.load();\n }\n else {\n throw new Error(\"Manifest index not found\");\n }\n };\n Collection.prototype.getTotalCollections = function () {\n return this.getCollections().length;\n };\n Collection.prototype.getTotalManifests = function () {\n return this.getManifests().length;\n };\n Collection.prototype.getTotalItems = function () {\n return this.items.length;\n };\n Collection.prototype.getViewingDirection = function () {\n if (this.getProperty('viewingDirection')) {\n return new Manifesto.ViewingDirection(this.getProperty('viewingDirection'));\n }\n return Manifesto.ViewingDirection.LEFTTORIGHT;\n };\n /**\n * Get a tree of sub collections and manifests, using each child manifest's first 'top' range.\n */\n Collection.prototype.getDefaultTree = function () {\n _super.prototype.getDefaultTree.call(this);\n //console.log(\"get default tree for \", this.id);\n this.defaultTree.data.type = Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.COLLECTION.toString());\n this._parseManifests(this);\n this._parseCollections(this);\n Manifesto.Utils.generateTreeNodeIds(this.defaultTree);\n return this.defaultTree;\n };\n Collection.prototype._parseManifests = function (parentCollection) {\n //console.log(\"parse manifests for \", parentCollection.id);\n if (parentCollection.getManifests() && parentCollection.getManifests().length) {\n for (var i = 0; i < parentCollection.getManifests().length; i++) {\n var manifest = parentCollection.getManifests()[i];\n var tree = manifest.getDefaultTree();\n tree.label = manifest.parentLabel || Manifesto.LanguageMap.getValue(manifest.getLabel(), this.options.locale) || 'manifest ' + (i + 1);\n tree.navDate = manifest.getNavDate();\n tree.data.id = manifest.id;\n tree.data.type = Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.MANIFEST.toString());\n parentCollection.defaultTree.addNode(tree);\n }\n }\n };\n Collection.prototype._parseCollections = function (parentCollection) {\n //console.log(\"parse collections for \", parentCollection.id);\n if (parentCollection.getCollections() && parentCollection.getCollections().length) {\n for (var i = 0; i < parentCollection.getCollections().length; i++) {\n var collection = parentCollection.getCollections()[i];\n var tree = collection.getDefaultTree();\n tree.label = collection.parentLabel || Manifesto.LanguageMap.getValue(collection.getLabel(), this.options.locale) || 'collection ' + (i + 1);\n tree.navDate = collection.getNavDate();\n tree.data.id = collection.id;\n tree.data.type = Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.COLLECTION.toString());\n parentCollection.defaultTree.addNode(tree);\n }\n }\n };\n return Collection;\n }(Manifesto.IIIFResource));\n Manifesto.Collection = Collection;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Range = /** @class */ (function (_super) {\n __extends(Range, _super);\n function Range(jsonld, options) {\n var _this = _super.call(this, jsonld, options) || this;\n _this._ranges = null;\n _this.canvases = null;\n _this.items = [];\n return _this;\n }\n Range.prototype.getCanvasIds = function () {\n if (this.__jsonld.canvases) {\n return this.__jsonld.canvases;\n }\n else if (this.canvases) {\n return this.canvases;\n }\n return [];\n };\n Range.prototype.getDuration = function () {\n var start;\n var end;\n if (this.canvases && this.canvases.length) {\n for (var i = 0; i < this.canvases.length; i++) {\n var canvas = this.canvases[i];\n var temporal = Manifesto.Utils.getTemporalComponent(canvas);\n if (temporal && temporal.length > 1) {\n if (i === 0) {\n start = Number(temporal[0]);\n }\n if (i === this.canvases.length - 1) {\n end = Number(temporal[1]);\n }\n }\n }\n }\n else {\n // get child ranges and calculate the start and end based on them\n var childRanges = this.getRanges();\n for (var i = 0; i < childRanges.length; i++) {\n var childRange = childRanges[i];\n var duration = childRange.getDuration();\n if (duration) {\n if (i === 0) {\n start = duration.start;\n }\n if (i === childRanges.length - 1) {\n end = duration.end;\n }\n }\n }\n }\n if (start !== undefined && end !== undefined) {\n return new Manifesto.Duration(start, end);\n }\n return undefined;\n };\n // getCanvases(): ICanvas[] {\n // if (this._canvases) {\n // return this._canvases;\n // }\n // return this._canvases = this.items.en().where(m => m.isCanvas()).toArray();\n // }\n Range.prototype.getRanges = function () {\n if (this._ranges) {\n return this._ranges;\n }\n return this._ranges = this.items.filter(function (m) { return m.isRange(); });\n };\n Range.prototype.getBehavior = function () {\n var behavior = this.getProperty('behavior');\n if (Array.isArray(behavior)) {\n behavior = behavior[0];\n }\n if (behavior) {\n return new Manifesto.Behavior(behavior);\n }\n return null;\n };\n Range.prototype.getViewingDirection = function () {\n if (this.getProperty('viewingDirection')) {\n return new Manifesto.ViewingDirection(this.getProperty('viewingDirection'));\n }\n return null;\n };\n Range.prototype.getViewingHint = function () {\n if (this.getProperty('viewingHint')) {\n return new Manifesto.ViewingHint(this.getProperty('viewingHint'));\n }\n return null;\n };\n Range.prototype.getTree = function (treeRoot) {\n treeRoot.data = this;\n this.treeNode = treeRoot;\n var ranges = this.getRanges();\n if (ranges && ranges.length) {\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n var node = new Manifesto.TreeNode();\n treeRoot.addNode(node);\n this._parseTreeNode(node, range);\n }\n }\n Manifesto.Utils.generateTreeNodeIds(treeRoot);\n return treeRoot;\n };\n Range.prototype.spansTime = function (time) {\n var duration = this.getDuration();\n if (duration) {\n if (time >= duration.start && time <= duration.end) {\n return true;\n }\n }\n return false;\n };\n Range.prototype._parseTreeNode = function (node, range) {\n node.label = Manifesto.LanguageMap.getValue(range.getLabel(), this.options.locale);\n node.data = range;\n node.data.type = Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.RANGE.toString());\n range.treeNode = node;\n var ranges = range.getRanges();\n if (ranges && ranges.length) {\n for (var i = 0; i < ranges.length; i++) {\n var childRange = ranges[i];\n var behavior = childRange.getBehavior();\n if (behavior && behavior.toString() === Manifesto.Behavior.NONAV.toString()) {\n continue;\n }\n else {\n var childNode = new Manifesto.TreeNode();\n node.addNode(childNode);\n this._parseTreeNode(childNode, childRange);\n }\n }\n }\n };\n return Range;\n }(Manifesto.ManifestResource));\n Manifesto.Range = Range;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Rendering = /** @class */ (function (_super) {\n __extends(Rendering, _super);\n function Rendering(jsonld, options) {\n return _super.call(this, jsonld, options) || this;\n }\n Rendering.prototype.getFormat = function () {\n return new Manifesto.RenderingFormat(this.getProperty('format'));\n };\n return Rendering;\n }(Manifesto.ManifestResource));\n Manifesto.Rendering = Rendering;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Sequence = /** @class */ (function (_super) {\n __extends(Sequence, _super);\n function Sequence(jsonld, options) {\n var _this = _super.call(this, jsonld, options) || this;\n _this.items = [];\n _this._thumbnails = null;\n return _this;\n }\n Sequence.prototype.getCanvases = function () {\n if (this.items.length) {\n return this.items;\n }\n var items = this.__jsonld.canvases || this.__jsonld.elements;\n if (items) {\n for (var i = 0; i < items.length; i++) {\n var c = items[i];\n var canvas = new Manifesto.Canvas(c, this.options);\n canvas.index = i;\n this.items.push(canvas);\n }\n }\n else if (this.__jsonld) {\n for (var i = 0; i < this.__jsonld.length; i++) {\n var c = this.__jsonld[i];\n var canvas = new Manifesto.Canvas(c, this.options);\n canvas.index = i;\n this.items.push(canvas);\n }\n }\n return this.items;\n };\n Sequence.prototype.getCanvasById = function (id) {\n for (var i = 0; i < this.getTotalCanvases(); i++) {\n var canvas = this.getCanvasByIndex(i);\n // normalise canvas id\n var canvasId = Manifesto.Utils.normaliseUrl(canvas.id);\n if (Manifesto.Utils.normaliseUrl(id) === canvasId) {\n return canvas;\n }\n }\n return null;\n };\n Sequence.prototype.getCanvasByIndex = function (canvasIndex) {\n return this.getCanvases()[canvasIndex];\n };\n Sequence.prototype.getCanvasIndexById = function (id) {\n for (var i = 0; i < this.getTotalCanvases(); i++) {\n var canvas = this.getCanvasByIndex(i);\n if (canvas.id === id) {\n return i;\n }\n }\n return null;\n };\n Sequence.prototype.getCanvasIndexByLabel = function (label, foliated) {\n label = label.trim();\n if (!isNaN(label)) { // if the label is numeric\n label = parseInt(label, 10).toString(); // trim any preceding zeros.\n if (foliated)\n label += 'r'; // default to recto\n }\n var doublePageRegExp = /(\\d*)\\D+(\\d*)/;\n var match, regExp, regStr, labelPart1, labelPart2;\n for (var i = 0; i < this.getTotalCanvases(); i++) {\n var canvas = this.getCanvasByIndex(i);\n // check if there's a literal match\n if (Manifesto.LanguageMap.getValue(canvas.getLabel(), this.options.locale) === label) {\n return i;\n }\n // check if there's a match for double-page spreads e.g. 100-101, 100_101, 100 101\n match = doublePageRegExp.exec(label);\n if (!match)\n continue;\n labelPart1 = match[1];\n labelPart2 = match[2];\n if (!labelPart2)\n continue;\n regStr = \"^\" + labelPart1 + \"\\\\D+\" + labelPart2 + \"$\";\n regExp = new RegExp(regStr);\n if (regExp.test(canvas.getLabel().toString())) {\n return i;\n }\n }\n return -1;\n };\n Sequence.prototype.getLastCanvasLabel = function (alphanumeric) {\n for (var i = this.getTotalCanvases() - 1; i >= 0; i--) {\n var canvas = this.getCanvasByIndex(i);\n var label = Manifesto.LanguageMap.getValue(canvas.getLabel(), this.options.locale);\n if (alphanumeric) {\n var regExp = /^[a-zA-Z0-9]*$/;\n if (regExp.test(label)) {\n return label;\n }\n }\n else if (label) {\n return label;\n }\n }\n return this.options.defaultLabel;\n };\n Sequence.prototype.getLastPageIndex = function () {\n return this.getTotalCanvases() - 1;\n };\n Sequence.prototype.getNextPageIndex = function (canvasIndex, pagingEnabled) {\n var index;\n if (pagingEnabled) {\n var indices = this.getPagedIndices(canvasIndex);\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection && viewingDirection.toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) {\n index = indices[0] + 1;\n }\n else {\n index = indices[indices.length - 1] + 1;\n }\n }\n else {\n index = canvasIndex + 1;\n }\n if (index > this.getLastPageIndex()) {\n return -1;\n }\n return index;\n };\n Sequence.prototype.getPagedIndices = function (canvasIndex, pagingEnabled) {\n var indices = [];\n if (!pagingEnabled) {\n indices.push(canvasIndex);\n }\n else {\n if (this.isFirstCanvas(canvasIndex) || this.isLastCanvas(canvasIndex)) {\n indices = [canvasIndex];\n }\n else if (canvasIndex % 2) {\n indices = [canvasIndex, canvasIndex + 1];\n }\n else {\n indices = [canvasIndex - 1, canvasIndex];\n }\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection && viewingDirection.toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) {\n indices = indices.reverse();\n }\n }\n return indices;\n };\n Sequence.prototype.getPrevPageIndex = function (canvasIndex, pagingEnabled) {\n var index;\n if (pagingEnabled) {\n var indices = this.getPagedIndices(canvasIndex);\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection && viewingDirection.toString() === Manifesto.ViewingDirection.RIGHTTOLEFT.toString()) {\n index = indices[indices.length - 1] - 1;\n }\n else {\n index = indices[0] - 1;\n }\n }\n else {\n index = canvasIndex - 1;\n }\n return index;\n };\n Sequence.prototype.getStartCanvasIndex = function () {\n var startCanvas = this.getStartCanvas();\n if (startCanvas) {\n // if there's a startCanvas attribute, loop through the canvases and return the matching index.\n for (var i = 0; i < this.getTotalCanvases(); i++) {\n var canvas = this.getCanvasByIndex(i);\n if (canvas.id === startCanvas)\n return i;\n }\n }\n // default to first canvas.\n return 0;\n };\n // todo: deprecate\n Sequence.prototype.getThumbs = function (width, height) {\n console.warn('getThumbs will be deprecated, use getThumbnails instead');\n var thumbs = [];\n var totalCanvases = this.getTotalCanvases();\n for (var i = 0; i < totalCanvases; i++) {\n var canvas = this.getCanvasByIndex(i);\n var thumb = new Manifesto.Thumb(width, canvas);\n thumbs.push(thumb);\n }\n return thumbs;\n };\n Sequence.prototype.getThumbnails = function () {\n if (this._thumbnails != null)\n return this._thumbnails;\n this._thumbnails = [];\n var canvases = this.getCanvases();\n for (var i = 0; i < canvases.length; i++) {\n var thumbnail = canvases[i].getThumbnail();\n if (thumbnail) {\n this._thumbnails.push(thumbnail);\n }\n }\n return this._thumbnails;\n };\n Sequence.prototype.getStartCanvas = function () {\n return this.getProperty('startCanvas');\n };\n Sequence.prototype.getTotalCanvases = function () {\n return this.getCanvases().length;\n };\n Sequence.prototype.getViewingDirection = function () {\n if (this.getProperty('viewingDirection')) {\n return new Manifesto.ViewingDirection(this.getProperty('viewingDirection'));\n }\n else if (this.options.resource.getViewingDirection) {\n return this.options.resource.getViewingDirection();\n }\n return null;\n };\n Sequence.prototype.getViewingHint = function () {\n if (this.getProperty('viewingHint')) {\n return new Manifesto.ViewingHint(this.getProperty('viewingHint'));\n }\n return null;\n };\n Sequence.prototype.isCanvasIndexOutOfRange = function (canvasIndex) {\n return canvasIndex > this.getTotalCanvases() - 1;\n };\n Sequence.prototype.isFirstCanvas = function (canvasIndex) {\n return canvasIndex === 0;\n };\n Sequence.prototype.isLastCanvas = function (canvasIndex) {\n return canvasIndex === this.getTotalCanvases() - 1;\n };\n Sequence.prototype.isMultiCanvas = function () {\n return this.getTotalCanvases() > 1;\n };\n Sequence.prototype.isPagingEnabled = function () {\n var viewingHint = this.getViewingHint();\n if (viewingHint) {\n return viewingHint.toString() === Manifesto.ViewingHint.PAGED.toString();\n }\n return false;\n };\n // checks if the number of canvases is even - therefore has a front and back cover\n Sequence.prototype.isTotalCanvasesEven = function () {\n return this.getTotalCanvases() % 2 === 0;\n };\n return Sequence;\n }(Manifesto.ManifestResource));\n Manifesto.Sequence = Sequence;\n})(Manifesto || (Manifesto = {}));\n\nvar Manifesto;\n(function (Manifesto) {\n var Deserialiser = /** @class */ (function () {\n function Deserialiser() {\n }\n Deserialiser.parse = function (manifest, options) {\n if (typeof manifest === 'string') {\n manifest = JSON.parse(manifest);\n }\n return this.parseJson(manifest, options);\n };\n Deserialiser.parseJson = function (json, options) {\n var resource;\n // have options been passed for the manifest to inherit?\n if (options) {\n if (options.navDate && !isNaN(options.navDate.getTime())) {\n json.navDate = options.navDate.toString();\n }\n }\n if (json['@type']) {\n switch (json['@type']) {\n case 'sc:Collection':\n resource = this.parseCollection(json, options);\n break;\n case 'sc:Manifest':\n resource = this.parseManifest(json, options);\n break;\n default:\n return null;\n }\n }\n else {\n // presentation 3\n switch (json['type']) {\n case 'Collection':\n resource = this.parseCollection(json, options);\n break;\n case 'Manifest':\n resource = this.parseManifest(json, options);\n break;\n default:\n return null;\n }\n }\n // Top-level resource was loaded from a URI, so flag it to prevent\n // unnecessary reload:\n resource.isLoaded = true;\n return resource;\n };\n Deserialiser.parseCollection = function (json, options) {\n var collection = new Manifesto.Collection(json, options);\n if (options) {\n collection.index = options.index || 0;\n if (options.resource) {\n collection.parentCollection = options.resource.parentCollection;\n }\n }\n else {\n collection.index = 0;\n }\n this.parseCollections(collection, options);\n this.parseManifests(collection, options);\n this.parseItems(collection, options);\n return collection;\n };\n Deserialiser.parseCollections = function (collection, options) {\n var items;\n if (collection.__jsonld.collections) {\n items = collection.__jsonld.collections;\n }\n else if (collection.__jsonld.items) {\n items = collection.__jsonld.items.filter(function (m) { return m.type.toLowerCase() === 'collection'; });\n }\n if (items) {\n for (var i = 0; i < items.length; i++) {\n if (options) {\n options.index = i;\n }\n var item = this.parseCollection(items[i], options);\n item.index = i;\n item.parentCollection = collection;\n collection.items.push(item);\n }\n }\n };\n Deserialiser.parseManifest = function (json, options) {\n var manifest = new Manifesto.Manifest(json, options);\n return manifest;\n };\n Deserialiser.parseManifests = function (collection, options) {\n var items;\n if (collection.__jsonld.manifests) {\n items = collection.__jsonld.manifests;\n }\n else if (collection.__jsonld.items) {\n items = collection.__jsonld.items.filter(function (m) { return m.type.toLowerCase() === 'manifest'; });\n }\n if (items) {\n for (var i = 0; i < items.length; i++) {\n var item = this.parseManifest(items[i], options);\n item.index = i;\n item.parentCollection = collection;\n collection.items.push(item);\n }\n }\n };\n Deserialiser.parseItem = function (json, options) {\n if (json['@type']) {\n if (json['@type'].toLowerCase() === 'sc:manifest') {\n return this.parseManifest(json, options);\n }\n else if (json['@type'].toLowerCase() === 'sc:collection') {\n return this.parseCollection(json, options);\n }\n }\n else if (json.type) {\n if (json.type.toLowerCase() === 'manifest') {\n return this.parseManifest(json, options);\n }\n else if (json.type.toLowerCase() === 'collection') {\n return this.parseCollection(json, options);\n }\n }\n return null;\n };\n Deserialiser.parseItems = function (collection, options) {\n var items = collection.__jsonld.members || collection.__jsonld.items;\n if (items) {\n var _loop_1 = function (i) {\n if (options) {\n options.index = i;\n }\n var item = this_1.parseItem(items[i], options);\n if (!item)\n return { value: void 0 };\n // only add to items if not already parsed from backwards-compatible collections/manifests arrays\n if (collection.items.filter(function (m) { return m.id === item.id; })[0]) {\n return \"continue\";\n }\n item.index = i;\n item.parentCollection = collection;\n collection.items.push(item);\n };\n var this_1 = this;\n for (var i = 0; i < items.length; i++) {\n var state_1 = _loop_1(i);\n if (typeof state_1 === \"object\")\n return state_1.value;\n }\n }\n };\n return Deserialiser;\n }());\n Manifesto.Deserialiser = Deserialiser;\n var Serialiser = /** @class */ (function () {\n function Serialiser() {\n }\n Serialiser.serialise = function (manifest) {\n // todo\n return \"\";\n };\n return Serialiser;\n }());\n Manifesto.Serialiser = Serialiser;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Service = /** @class */ (function (_super) {\n __extends(Service, _super);\n function Service(jsonld, options) {\n return _super.call(this, jsonld, options) || this;\n }\n Service.prototype.getProfile = function () {\n var profile = this.getProperty('profile');\n if (!profile) {\n profile = this.getProperty('dcterms:conformsTo');\n }\n if (Array.isArray(profile)) {\n return new Manifesto.ServiceProfile(profile[0]);\n }\n return new Manifesto.ServiceProfile(profile);\n };\n Service.prototype.getConfirmLabel = function () {\n return Manifesto.Utils.getLocalisedValue(this.getProperty('confirmLabel'), this.options.locale);\n };\n Service.prototype.getDescription = function () {\n return Manifesto.Utils.getLocalisedValue(this.getProperty('description'), this.options.locale);\n };\n Service.prototype.getFailureDescription = function () {\n return Manifesto.Utils.getLocalisedValue(this.getProperty('failureDescription'), this.options.locale);\n };\n Service.prototype.getFailureHeader = function () {\n return Manifesto.Utils.getLocalisedValue(this.getProperty('failureHeader'), this.options.locale);\n };\n Service.prototype.getHeader = function () {\n return Manifesto.Utils.getLocalisedValue(this.getProperty('header'), this.options.locale);\n };\n Service.prototype.getServiceLabel = function () {\n return Manifesto.Utils.getLocalisedValue(this.getProperty('label'), this.options.locale);\n };\n Service.prototype.getInfoUri = function () {\n var infoUri = this.id;\n if (!infoUri.endsWith('/')) {\n infoUri += '/';\n }\n infoUri += 'info.json';\n return infoUri;\n };\n return Service;\n }(Manifesto.ManifestResource));\n Manifesto.Service = Service;\n})(Manifesto || (Manifesto = {}));\n\n\nvar Manifesto;\n(function (Manifesto) {\n // todo: deprecate\n // this is used by Sequence.getThumbs\n var Thumb = /** @class */ (function () {\n function Thumb(width, canvas) {\n this.data = canvas;\n this.index = canvas.index;\n this.width = width;\n var heightRatio = canvas.getHeight() / canvas.getWidth();\n if (heightRatio) {\n this.height = Math.floor(this.width * heightRatio);\n }\n else {\n this.height = width;\n }\n this.uri = canvas.getCanonicalImageUri(width);\n this.label = Manifesto.LanguageMap.getValue(canvas.getLabel()); // todo: pass locale?\n }\n return Thumb;\n }());\n Manifesto.Thumb = Thumb;\n})(Manifesto || (Manifesto = {}));\n\n\nvar Manifesto;\n(function (Manifesto) {\n var TreeNode = /** @class */ (function () {\n function TreeNode(label, data) {\n this.label = label;\n this.data = data || {};\n this.nodes = [];\n }\n TreeNode.prototype.addNode = function (node) {\n this.nodes.push(node);\n node.parentNode = this;\n };\n TreeNode.prototype.isCollection = function () {\n return this.data.type === Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.COLLECTION.toString());\n };\n TreeNode.prototype.isManifest = function () {\n return this.data.type === Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.MANIFEST.toString());\n };\n TreeNode.prototype.isRange = function () {\n return this.data.type === Manifesto.Utils.normaliseType(Manifesto.TreeNodeType.RANGE.toString());\n };\n return TreeNode;\n }());\n Manifesto.TreeNode = TreeNode;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var TreeNodeType = /** @class */ (function (_super) {\n __extends(TreeNodeType, _super);\n function TreeNodeType() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n // todo: use getters when ES3 target is no longer required.\n TreeNodeType.prototype.collection = function () {\n return new TreeNodeType(TreeNodeType.COLLECTION.toString());\n };\n TreeNodeType.prototype.manifest = function () {\n return new TreeNodeType(TreeNodeType.MANIFEST.toString());\n };\n TreeNodeType.prototype.range = function () {\n return new TreeNodeType(TreeNodeType.RANGE.toString());\n };\n TreeNodeType.COLLECTION = new TreeNodeType(\"collection\");\n TreeNodeType.MANIFEST = new TreeNodeType(\"manifest\");\n TreeNodeType.RANGE = new TreeNodeType(\"range\");\n return TreeNodeType;\n }(Manifesto.StringValue));\n Manifesto.TreeNodeType = TreeNodeType;\n})(Manifesto || (Manifesto = {}));\n\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar http = require('http');\nvar https = require('https');\nvar url = require('url');\nvar Manifesto;\n(function (Manifesto) {\n var Utils = /** @class */ (function () {\n function Utils() {\n }\n Utils.getMediaType = function (type) {\n type = type.toLowerCase();\n type = type.split(';')[0];\n return type.trim();\n };\n Utils.getImageQuality = function (profile) {\n var p = profile.toString();\n if (p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString() ||\n p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString() ||\n p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString() ||\n p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString() ||\n p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString() ||\n p === Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString() ||\n p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString() ||\n p === Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString() ||\n p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString() ||\n p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString() ||\n p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString() ||\n p === Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()) {\n return 'native';\n }\n return 'default';\n };\n Utils.getInexactLocale = function (locale) {\n if (locale.indexOf('-') !== -1) {\n return locale.substr(0, locale.indexOf('-'));\n }\n return locale;\n };\n Utils.getLocalisedValue = function (resource, locale) {\n // if the resource is not an array of translations, return the string.\n if (!Array.isArray(resource)) {\n return resource;\n }\n // test for exact match\n for (var i = 0; i < resource.length; i++) {\n var value_1 = resource[i];\n var language_1 = value_1['@language'];\n if (locale === language_1) {\n return value_1['@value'];\n }\n }\n // test for inexact match\n var match = locale.substr(0, locale.indexOf('-'));\n for (var i = 0; i < resource.length; i++) {\n var value = resource[i];\n var language = value['@language'];\n if (language === match) {\n return value['@value'];\n }\n }\n return null;\n };\n Utils.generateTreeNodeIds = function (treeNode, index) {\n if (index === void 0) { index = 0; }\n var id;\n if (!treeNode.parentNode) {\n id = '0';\n }\n else {\n id = treeNode.parentNode.id + \"-\" + index;\n }\n treeNode.id = id;\n for (var i = 0; i < treeNode.nodes.length; i++) {\n var n = treeNode.nodes[i];\n Utils.generateTreeNodeIds(n, i);\n }\n };\n Utils.normaliseType = function (type) {\n type = type.toLowerCase();\n if (type.indexOf(':') !== -1) {\n var split = type.split(':');\n return split[1];\n }\n return type;\n };\n Utils.normaliseUrl = function (url) {\n url = url.substr(url.indexOf('://'));\n if (url.indexOf('#') !== -1) {\n url = url.split('#')[0];\n }\n return url;\n };\n Utils.normalisedUrlsMatch = function (url1, url2) {\n return Utils.normaliseUrl(url1) === Utils.normaliseUrl(url2);\n };\n Utils.isImageProfile = function (profile) {\n if (typeof (profile) === 'string') {\n profile = new Manifesto.ServiceProfile(profile);\n }\n if (Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString())) {\n return true;\n }\n return false;\n };\n Utils.isLevel0ImageProfile = function (profile) {\n if (typeof (profile) === 'string') {\n profile = new Manifesto.ServiceProfile(profile);\n }\n if (Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString())) {\n return true;\n }\n return false;\n };\n Utils.isLevel1ImageProfile = function (profile) {\n if (typeof (profile) === 'string') {\n profile = new Manifesto.ServiceProfile(profile);\n }\n if (Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString())) {\n return true;\n }\n return false;\n };\n Utils.isLevel2ImageProfile = function (profile) {\n if (typeof (profile) === 'string') {\n profile = new Manifesto.ServiceProfile(profile);\n }\n if (Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString()) ||\n Utils.normalisedUrlsMatch(profile.toString(), Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString())) {\n return true;\n }\n return false;\n };\n Utils.loadResource = function (uri) {\n return new Promise(function (resolve, reject) {\n var u = url.parse(uri);\n var req;\n var opts = {\n host: u.hostname,\n port: u.port,\n path: u.path,\n method: \"GET\",\n withCredentials: false\n };\n switch (u.protocol) {\n case 'https:':\n req = https.request(opts, function (response) {\n var result = \"\";\n response.on('data', function (chunk) {\n result += chunk;\n });\n response.on('end', function () {\n resolve(result);\n });\n });\n req.on('error', function (error) {\n reject(error);\n });\n req.end();\n break;\n case 'dat:':\n var xhr_1 = new XMLHttpRequest();\n xhr_1.onreadystatechange = function () {\n if (xhr_1.readyState === 4) {\n resolve(xhr_1.response);\n }\n };\n xhr_1.open(\"GET\", uri, true);\n xhr_1.send();\n break;\n default:\n req = http.request(opts, function (response) {\n var result = \"\";\n response.on('data', function (chunk) {\n result += chunk;\n });\n response.on('end', function () {\n resolve(result);\n });\n });\n req.on('error', function (error) {\n reject(error);\n });\n req.end();\n break;\n }\n });\n };\n Utils.loadExternalResourcesAuth1 = function (resources, openContentProviderInteraction, openTokenService, getStoredAccessToken, userInteractedWithContentProvider, getContentProviderInteraction, handleMovedTemporarily, showOutOfOptionsMessages) {\n return new Promise(function (resolve, reject) {\n var promises = resources.map(function (resource) {\n return Utils.loadExternalResourceAuth1(resource, openContentProviderInteraction, openTokenService, getStoredAccessToken, userInteractedWithContentProvider, getContentProviderInteraction, handleMovedTemporarily, showOutOfOptionsMessages);\n });\n Promise.all(promises)\n .then(function () {\n resolve(resources);\n })[\"catch\"](function (error) {\n reject(error);\n });\n });\n };\n Utils.loadExternalResourceAuth1 = function (resource, openContentProviderInteraction, openTokenService, getStoredAccessToken, userInteractedWithContentProvider, getContentProviderInteraction, handleMovedTemporarily, showOutOfOptionsMessages) {\n return __awaiter(this, void 0, void 0, function () {\n var storedAccessToken;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getStoredAccessToken(resource)];\n case 1:\n storedAccessToken = _a.sent();\n if (!storedAccessToken) return [3 /*break*/, 6];\n return [4 /*yield*/, resource.getData(storedAccessToken)];\n case 2:\n _a.sent();\n if (!(resource.status === HTTPStatusCode.OK)) return [3 /*break*/, 3];\n return [2 /*return*/, resource];\n case 3: \n // the stored token is no good for this resource\n return [4 /*yield*/, Utils.doAuthChain(resource, openContentProviderInteraction, openTokenService, userInteractedWithContentProvider, getContentProviderInteraction, handleMovedTemporarily, showOutOfOptionsMessages)];\n case 4:\n // the stored token is no good for this resource\n _a.sent();\n _a.label = 5;\n case 5:\n if (resource.status === HTTPStatusCode.OK || resource.status === HTTPStatusCode.MOVED_TEMPORARILY) {\n return [2 /*return*/, resource];\n }\n throw Utils.createAuthorizationFailedError();\n case 6: return [4 /*yield*/, resource.getData()];\n case 7:\n _a.sent();\n if (!(resource.status === HTTPStatusCode.MOVED_TEMPORARILY || resource.status === HTTPStatusCode.UNAUTHORIZED)) return [3 /*break*/, 9];\n return [4 /*yield*/, Utils.doAuthChain(resource, openContentProviderInteraction, openTokenService, userInteractedWithContentProvider, getContentProviderInteraction, handleMovedTemporarily, showOutOfOptionsMessages)];\n case 8:\n _a.sent();\n _a.label = 9;\n case 9:\n if (resource.status === HTTPStatusCode.OK || resource.status === HTTPStatusCode.MOVED_TEMPORARILY) {\n return [2 /*return*/, resource];\n }\n throw Utils.createAuthorizationFailedError();\n }\n });\n });\n };\n Utils.doAuthChain = function (resource, openContentProviderInteraction, openTokenService, userInteractedWithContentProvider, getContentProviderInteraction, handleMovedTemporarily, showOutOfOptionsMessages) {\n return __awaiter(this, void 0, void 0, function () {\n var externalService, kioskService, clickThroughService, loginService, serviceToTry, lastAttempted, kioskInteraction, contentProviderInteraction, contentProviderInteraction;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // This function enters the flowchart at the < External? > junction\n // http://iiif.io/api/auth/1.0/#workflow-from-the-browser-client-perspective\n if (!resource.isAccessControlled()) {\n return [2 /*return*/, resource]; // no services found\n }\n externalService = resource.externalService;\n if (externalService) {\n externalService.options = resource.options;\n }\n kioskService = resource.kioskService;\n if (kioskService) {\n kioskService.options = resource.options;\n }\n clickThroughService = resource.clickThroughService;\n if (clickThroughService) {\n clickThroughService.options = resource.options;\n }\n loginService = resource.loginService;\n if (loginService) {\n loginService.options = resource.options;\n }\n if (!(!resource.isResponseHandled && resource.status === HTTPStatusCode.MOVED_TEMPORARILY)) return [3 /*break*/, 2];\n return [4 /*yield*/, handleMovedTemporarily(resource)];\n case 1:\n _a.sent();\n return [2 /*return*/, resource];\n case 2:\n serviceToTry = null;\n lastAttempted = null;\n // repetition of logic is left in these steps for clarity:\n // Looking for external pattern\n serviceToTry = externalService;\n if (!serviceToTry) return [3 /*break*/, 4];\n lastAttempted = serviceToTry;\n return [4 /*yield*/, Utils.attemptResourceWithToken(resource, openTokenService, serviceToTry)];\n case 3:\n _a.sent();\n return [2 /*return*/, resource];\n case 4:\n // Looking for kiosk pattern\n serviceToTry = kioskService;\n if (!serviceToTry) return [3 /*break*/, 7];\n lastAttempted = serviceToTry;\n kioskInteraction = openContentProviderInteraction(serviceToTry);\n if (!kioskInteraction) return [3 /*break*/, 7];\n return [4 /*yield*/, userInteractedWithContentProvider(kioskInteraction)];\n case 5:\n _a.sent();\n return [4 /*yield*/, Utils.attemptResourceWithToken(resource, openTokenService, serviceToTry)];\n case 6:\n _a.sent();\n return [2 /*return*/, resource];\n case 7:\n // The code for the next two patterns is identical (other than the profile name).\n // The difference is in the expected behaviour of\n //\n // await userInteractedWithContentProvider(contentProviderInteraction);\n // \n // For clickthrough the opened window should close immediately having established\n // a session, whereas for login the user might spend some time entering credentials etc.\n // Looking for clickthrough pattern\n serviceToTry = clickThroughService;\n if (!serviceToTry) return [3 /*break*/, 11];\n lastAttempted = serviceToTry;\n return [4 /*yield*/, getContentProviderInteraction(resource, serviceToTry)];\n case 8:\n contentProviderInteraction = _a.sent();\n if (!contentProviderInteraction) return [3 /*break*/, 11];\n // should close immediately\n return [4 /*yield*/, userInteractedWithContentProvider(contentProviderInteraction)];\n case 9:\n // should close immediately\n _a.sent();\n return [4 /*yield*/, Utils.attemptResourceWithToken(resource, openTokenService, serviceToTry)];\n case 10:\n _a.sent();\n return [2 /*return*/, resource];\n case 11:\n // Looking for login pattern\n serviceToTry = loginService;\n if (!serviceToTry) return [3 /*break*/, 15];\n lastAttempted = serviceToTry;\n return [4 /*yield*/, getContentProviderInteraction(resource, serviceToTry)];\n case 12:\n contentProviderInteraction = _a.sent();\n if (!contentProviderInteraction) return [3 /*break*/, 15];\n // we expect the user to spend some time interacting\n return [4 /*yield*/, userInteractedWithContentProvider(contentProviderInteraction)];\n case 13:\n // we expect the user to spend some time interacting\n _a.sent();\n return [4 /*yield*/, Utils.attemptResourceWithToken(resource, openTokenService, serviceToTry)];\n case 14:\n _a.sent();\n return [2 /*return*/, resource];\n case 15:\n // nothing worked! Use the most recently tried service as the source of\n // messages to show to the user.\n if (lastAttempted) {\n showOutOfOptionsMessages(resource, lastAttempted);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n Utils.attemptResourceWithToken = function (resource, openTokenService, authService) {\n return __awaiter(this, void 0, void 0, function () {\n var tokenService, tokenMessage;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n tokenService = authService.getService(Manifesto.ServiceProfile.AUTH1TOKEN.toString());\n if (!tokenService) return [3 /*break*/, 3];\n return [4 /*yield*/, openTokenService(resource, tokenService)];\n case 1:\n tokenMessage = _a.sent();\n if (!(tokenMessage && tokenMessage.accessToken)) return [3 /*break*/, 3];\n return [4 /*yield*/, resource.getData(tokenMessage)];\n case 2:\n _a.sent();\n return [2 /*return*/, resource];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n Utils.loadExternalResourcesAuth09 = function (resources, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options) {\n return new Promise(function (resolve, reject) {\n var promises = resources.map(function (resource) {\n return Utils.loadExternalResourceAuth09(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options);\n });\n Promise.all(promises)\n .then(function () {\n resolve(resources);\n })[\"catch\"](function (error) {\n reject(error);\n });\n });\n };\n // IIIF auth api pre v1.0\n // Keeping this around for now until the auth 1.0 implementation is stable\n Utils.loadExternalResourceAuth09 = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken, handleResourceResponse, options) {\n return new Promise(function (resolve, reject) {\n if (options && options.pessimisticAccessControl) {\n // pessimistic: access control cookies may have been deleted.\n // always request the access token for every access controlled info.json request\n // returned access tokens are not stored, therefore the login window flashes for every request.\n resource.getData().then(function () {\n if (resource.isAccessControlled()) {\n // if the resource has a click through service, use that.\n if (resource.clickThroughService) {\n resolve(clickThrough(resource));\n //} else if(resource.restrictedService) {\n resolve(restricted(resource));\n }\n else {\n login(resource).then(function () {\n getAccessToken(resource, true).then(function (token) {\n resource.getData(token).then(function () {\n resolve(handleResourceResponse(resource));\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n }\n }\n else {\n // this info.json isn't access controlled, therefore no need to request an access token.\n resolve(resource);\n }\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n }\n else {\n // optimistic: access control cookies may not have been deleted.\n // store access tokens to avoid login window flashes.\n // if cookies are deleted a page refresh is required.\n // try loading the resource using an access token that matches the info.json domain.\n // if an access token is found, request the resource using it regardless of whether it is access controlled.\n getStoredAccessToken(resource, tokenStorageStrategy).then(function (storedAccessToken) {\n if (storedAccessToken) {\n // try using the stored access token\n resource.getData(storedAccessToken).then(function () {\n // if the info.json loaded using the stored access token\n if (resource.status === HTTPStatusCode.OK) {\n resolve(handleResourceResponse(resource));\n }\n else {\n // otherwise, load the resource data to determine the correct access control services.\n // if access controlled, do login.\n Utils.authorize(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken).then(function () {\n resolve(handleResourceResponse(resource));\n })[\"catch\"](function (error) {\n // if (resource.restrictedService){\n // reject(Utils.createRestrictedError());\n // } else {\n reject(Utils.createAuthorizationFailedError());\n //}\n });\n }\n })[\"catch\"](function (error) {\n reject(Utils.createAuthorizationFailedError());\n });\n }\n else {\n Utils.authorize(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken).then(function () {\n resolve(handleResourceResponse(resource));\n })[\"catch\"](function (error) {\n reject(Utils.createAuthorizationFailedError());\n });\n }\n })[\"catch\"](function (error) {\n reject(Utils.createAuthorizationFailedError());\n });\n }\n });\n };\n Utils.createError = function (name, message) {\n var error = new Error();\n error.message = message;\n error.name = name;\n return error;\n };\n Utils.createAuthorizationFailedError = function () {\n return Utils.createError(manifesto.StatusCodes.AUTHORIZATION_FAILED.toString(), \"Authorization failed\");\n };\n Utils.createRestrictedError = function () {\n return Utils.createError(manifesto.StatusCodes.RESTRICTED.toString(), \"Restricted\");\n };\n Utils.createInternalServerError = function (message) {\n return Utils.createError(manifesto.StatusCodes.INTERNAL_SERVER_ERROR.toString(), message);\n };\n Utils.authorize = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, getStoredAccessToken) {\n return new Promise(function (resolve, reject) {\n resource.getData().then(function () {\n if (resource.isAccessControlled()) {\n getStoredAccessToken(resource, tokenStorageStrategy).then(function (storedAccessToken) {\n if (storedAccessToken) {\n // try using the stored access token\n resource.getData(storedAccessToken).then(function () {\n if (resource.status === HTTPStatusCode.OK) {\n resolve(resource); // happy path ended\n }\n else {\n // the stored token is no good for this resource\n Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject);\n }\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n }\n else {\n // There was no stored token, but the user might have a cookie that will grant a token\n getAccessToken(resource, false).then(function (accessToken) {\n if (accessToken) {\n storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () {\n // try using the fresh access token\n resource.getData(accessToken).then(function () {\n if (resource.status === HTTPStatusCode.OK) {\n resolve(resource);\n }\n else {\n // User has a token, but it's not good enough\n Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject);\n }\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n })[\"catch\"](function (message) {\n // not able to store access token\n reject(Utils.createInternalServerError(message));\n });\n }\n else {\n // The user did not have a cookie that granted a token\n Utils.showAuthInteraction(resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject);\n }\n });\n }\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n }\n else {\n // this info.json isn't access controlled, therefore there's no need to request an access token\n resolve(resource);\n }\n });\n });\n };\n Utils.showAuthInteraction = function (resource, tokenStorageStrategy, clickThrough, restricted, login, getAccessToken, storeAccessToken, resolve, reject) {\n if (resource.status === HTTPStatusCode.MOVED_TEMPORARILY && !resource.isResponseHandled) {\n // if the resource was redirected to a degraded version\n // and the response hasn't been handled yet.\n // if the client wishes to trigger a login, set resource.isResponseHandled to true\n // and call loadExternalResources() again passing the resource.\n resolve(resource);\n // } else if (resource.restrictedService) {\n // resolve(restricted(resource));\n // // TODO: move to next etc\n }\n else if (resource.clickThroughService && !resource.isResponseHandled) {\n // if the resource has a click through service, use that.\n clickThrough(resource).then(function () {\n getAccessToken(resource, true).then(function (accessToken) {\n storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () {\n resource.getData(accessToken).then(function () {\n resolve(resource);\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n });\n }\n else {\n // get an access token\n login(resource).then(function () {\n getAccessToken(resource, true).then(function (accessToken) {\n storeAccessToken(resource, accessToken, tokenStorageStrategy).then(function () {\n resource.getData(accessToken).then(function () {\n resolve(resource);\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n })[\"catch\"](function (message) {\n reject(Utils.createInternalServerError(message));\n });\n });\n }\n };\n ;\n Utils.getService = function (resource, profile) {\n var services = this.getServices(resource);\n // coerce profile to string\n if (typeof (profile) !== 'string') {\n profile = profile.toString();\n }\n for (var i = 0; i < services.length; i++) {\n var service = services[i];\n if (service.getProfile().toString() === profile) {\n return service;\n }\n }\n return null;\n };\n Utils.getResourceById = function (parentResource, id) {\n return Utils.traverseAndFind(parentResource.__jsonld, '@id', id);\n };\n /**\n * Does a depth first traversal of an Object, returning an Object that\n * matches provided k and v arguments\n * @example Utils.traverseAndFind({foo: 'bar'}, 'foo', 'bar')\n */\n Utils.traverseAndFind = function (object, k, v) {\n if (object.hasOwnProperty(k) && object[k] === v) {\n return object;\n }\n for (var i = 0; i < Object.keys(object).length; i++) {\n if (typeof object[Object.keys(object)[i]] === \"object\") {\n var o = Utils.traverseAndFind(object[Object.keys(object)[i]], k, v);\n if (o != null) {\n return o;\n }\n }\n }\n };\n Utils.getServices = function (resource) {\n var service;\n // if passing a manifesto-parsed object, use the __jsonld.service property,\n // otherwise look for a service property (info.json services)\n if (resource.__jsonld) {\n service = resource.__jsonld.service;\n }\n else {\n service = resource.service;\n }\n var services = [];\n if (!service)\n return services;\n // coerce to array\n if (!Array.isArray(service)) {\n service = [service];\n }\n for (var i = 0; i < service.length; i++) {\n var s = service[i];\n if (typeof (s) === 'string') {\n var r = this.getResourceById(resource.options.resource, s);\n if (r) {\n services.push(new Manifesto.Service(r.__jsonld || r, resource.options));\n }\n }\n else {\n services.push(new Manifesto.Service(s, resource.options));\n }\n }\n return services;\n };\n Utils.getTemporalComponent = function (target) {\n var temporal = /t=([^&]+)/g.exec(target);\n var t = null;\n if (temporal && temporal[1]) {\n t = temporal[1].split(',');\n }\n return t;\n };\n return Utils;\n }());\n Manifesto.Utils = Utils;\n})(Manifesto || (Manifesto = {}));\n\nvar Manifesto;\n(function (Manifesto) {\n var Language = /** @class */ (function () {\n function Language(value, locale) {\n if (Array.isArray(value)) {\n if (value.length === 1) {\n this.value = value[0];\n }\n else {\n // concatenate all of the values\n this.value = value.join('
');\n }\n }\n else {\n this.value = value;\n }\n this.locale = locale;\n }\n return Language;\n }());\n Manifesto.Language = Language;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var LanguageMap = /** @class */ (function (_super) {\n __extends(LanguageMap, _super);\n function LanguageMap() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LanguageMap.parse = function (language, defaultLocale) {\n var tc = [];\n var t;\n if (!language) {\n return tc;\n }\n else if (Array.isArray(language)) {\n for (var i = 0; i < language.length; i++) {\n var value = language[i];\n if (typeof (value) === 'string') {\n t = new Manifesto.Language(value, defaultLocale);\n }\n else {\n t = new Manifesto.Language(value['@value'], value['@language'] || defaultLocale);\n }\n tc.push(t);\n }\n }\n else if (typeof (language) === 'string') {\n // if it's just a single string value, create one language in the configured locale\n t = new Manifesto.Language(language, defaultLocale);\n tc.push(t);\n return tc;\n }\n else {\n // it's an object\n if (language['@value']) {\n // presentation 2\n t = new Manifesto.Language(language['@value'], language['@language'] || defaultLocale);\n tc.push(t);\n }\n else {\n // presentation 3\n Object.keys(language).forEach(function (key) {\n // todo: support multiple values in array\n if (language[key].length) {\n t = new Manifesto.Language(language[key], key);\n tc.push(t);\n }\n else {\n throw new Error('language must have a value');\n }\n });\n }\n }\n return tc;\n };\n LanguageMap.getValue = function (languageCollection, locale) {\n if (languageCollection.length) {\n if (locale) {\n var language = languageCollection.filter(function (t) { return t.locale === locale || Manifesto.Utils.getInexactLocale(t.locale) === Manifesto.Utils.getInexactLocale(locale); })[0];\n if (language) {\n return language.value;\n }\n }\n // return the first valuel\n return languageCollection[0].value;\n }\n return null;\n };\n return LanguageMap;\n }(Array));\n Manifesto.LanguageMap = LanguageMap;\n})(Manifesto || (Manifesto = {}));\n\nvar Manifesto;\n(function (Manifesto) {\n var LabelValuePair = /** @class */ (function () {\n function LabelValuePair(defaultLocale) {\n this.defaultLocale = defaultLocale;\n }\n LabelValuePair.prototype.parse = function (resource) {\n this.resource = resource;\n this.label = Manifesto.LanguageMap.parse(this.resource.label, this.defaultLocale);\n this.value = Manifesto.LanguageMap.parse(this.resource.value, this.defaultLocale);\n };\n // shortcuts to get/set values based on default locale\n LabelValuePair.prototype.getLabel = function () {\n if (this.label) {\n return Manifesto.LanguageMap.getValue(this.label, this.defaultLocale);\n }\n return null;\n };\n LabelValuePair.prototype.setLabel = function (value) {\n var _this = this;\n if (this.label && this.label.length) {\n var t = this.label.filter(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); })[0];\n if (t)\n t.value = value;\n }\n };\n LabelValuePair.prototype.getValue = function () {\n if (this.value) {\n var locale = this.defaultLocale;\n // if the label has a locale, prefer that to the default locale\n if (this.label && this.label.length && this.label[0].locale) {\n locale = this.label[0].locale;\n }\n return Manifesto.LanguageMap.getValue(this.value, locale);\n }\n return null;\n };\n LabelValuePair.prototype.setValue = function (value) {\n var _this = this;\n if (this.value && this.value.length) {\n var t = this.value.filter(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); })[0];\n if (t)\n t.value = value;\n }\n };\n return LabelValuePair;\n }());\n Manifesto.LabelValuePair = LabelValuePair;\n})(Manifesto || (Manifesto = {}));\n\nvar Manifesto;\n(function (Manifesto) {\n var Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n }());\n Manifesto.Size = Size;\n})(Manifesto || (Manifesto = {}));\n\nglobal.manifesto = global.Manifesto = module.exports = {\n AnnotationMotivation: new Manifesto.AnnotationMotivation(),\n Behavior: new Manifesto.Behavior(),\n IIIFResourceType: new Manifesto.IIIFResourceType(),\n LabelValuePair: Manifesto.LabelValuePair,\n Language: Manifesto.Language,\n LanguageMap: Manifesto.LanguageMap,\n ManifestType: new Manifesto.ManifestType(),\n MediaType: new Manifesto.MediaType(),\n RenderingFormat: new Manifesto.RenderingFormat(),\n ResourceType: new Manifesto.ResourceType(),\n ServiceProfile: new Manifesto.ServiceProfile(),\n Size: Manifesto.Size,\n TreeNode: Manifesto.TreeNode,\n TreeNodeType: new Manifesto.TreeNodeType(),\n Utils: Manifesto.Utils,\n ViewingDirection: new Manifesto.ViewingDirection(),\n ViewingHint: new Manifesto.ViewingHint(),\n Annotation: Manifesto.Annotation,\n AnnotationBody: Manifesto.AnnotationBody,\n AnnotationList: Manifesto.AnnotationList,\n AnnotationPage: Manifesto.AnnotationPage,\n Canvas: Manifesto.Canvas,\n Collection: Manifesto.Collection,\n Duration: Manifesto.Duration,\n Manifest: Manifesto.Manifest,\n Range: Manifesto.Range,\n Sequence: Manifesto.Sequence,\n Service: Manifesto.Service,\n Thumbnail: Manifesto.Thumbnail,\n Thumb: Manifesto.Thumb,\n StatusCodes: {\n AUTHORIZATION_FAILED: 1,\n FORBIDDEN: 2,\n INTERNAL_SERVER_ERROR: 3,\n RESTRICTED: 4\n },\n create: function (manifest, options) {\n return Manifesto.Deserialiser.parse(manifest, options);\n },\n loadManifest: function (uri) {\n return Manifesto.Utils.loadResource(uri);\n }\n};\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Annotation = /** @class */ (function (_super) {\n __extends(Annotation, _super);\n function Annotation(jsonld, options) {\n return _super.call(this, jsonld, options) || this;\n }\n Annotation.prototype.getBody = function () {\n var bodies = [];\n var body = this.getProperty('body');\n // todo: make this a generic \"property that can be an object or array enumerator\" util\n if (body) {\n if (Array.isArray(body)) {\n for (var i = 0; i < body.length; i++) {\n var b = body[i];\n if (b.items) {\n for (var i_1 = 0; i_1 < b.items.length; i_1++) { // todo: don't ignore that it's a choice. maybe add isChoice() to IAnnotationBody?\n var c = b.items[i_1];\n bodies.push(new Manifesto.AnnotationBody(c, this.options));\n }\n }\n else {\n bodies.push(new Manifesto.AnnotationBody(b, this.options));\n }\n }\n }\n else if (body.items) {\n for (var i = 0; i < body.items.length; i++) {\n var b = body.items[i];\n bodies.push(new Manifesto.AnnotationBody(b, this.options));\n }\n }\n else {\n bodies.push(new Manifesto.AnnotationBody(body, this.options));\n }\n }\n return bodies;\n };\n Annotation.prototype.getMotivation = function () {\n var motivation = this.getProperty('motivation');\n if (motivation) {\n return new Manifesto.AnnotationMotivation(motivation.toLowerCase());\n }\n return null;\n };\n // open annotation\n Annotation.prototype.getOn = function () {\n return this.getProperty('on');\n };\n Annotation.prototype.getTarget = function () {\n return this.getProperty('target');\n };\n Annotation.prototype.getResource = function () {\n return new Manifesto.Resource(this.getProperty('resource'), this.options);\n };\n return Annotation;\n }(Manifesto.ManifestResource));\n Manifesto.Annotation = Annotation;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var AnnotationBody = /** @class */ (function (_super) {\n __extends(AnnotationBody, _super);\n function AnnotationBody(jsonld, options) {\n return _super.call(this, jsonld, options) || this;\n }\n AnnotationBody.prototype.getFormat = function () {\n var format = this.getProperty('format');\n if (format) {\n return new Manifesto.MediaType(Manifesto.Utils.getMediaType(format));\n }\n return null;\n };\n AnnotationBody.prototype.getType = function () {\n var type = this.getProperty('type');\n if (type) {\n return new Manifesto.ResourceType(Manifesto.Utils.normaliseType(this.getProperty('type')));\n }\n return null;\n };\n AnnotationBody.prototype.getWidth = function () {\n return this.getProperty('width');\n };\n AnnotationBody.prototype.getHeight = function () {\n return this.getProperty('height');\n };\n return AnnotationBody;\n }(Manifesto.ManifestResource));\n Manifesto.AnnotationBody = AnnotationBody;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var AnnotationList = /** @class */ (function (_super) {\n __extends(AnnotationList, _super);\n function AnnotationList(label, jsonld, options) {\n var _this = _super.call(this, jsonld) || this;\n _this.label = label;\n _this.options = options;\n return _this;\n }\n AnnotationList.prototype.getIIIFResourceType = function () {\n return new Manifesto.IIIFResourceType(Manifesto.Utils.normaliseType(this.getProperty('type')));\n };\n AnnotationList.prototype.getLabel = function () {\n return this.label;\n };\n AnnotationList.prototype.getResources = function () {\n var _this = this;\n var resources = this.getProperty('resources');\n return resources.map(function (resource) { return new Manifesto.Annotation(resource, _this.options); });\n };\n AnnotationList.prototype.load = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n if (_this.isLoaded) {\n resolve(_this);\n }\n else {\n var id = _this.__jsonld.id;\n if (!id) {\n id = _this.__jsonld['@id'];\n }\n Manifesto.Utils.loadResource(id).then(function (data) {\n _this.__jsonld = JSON.parse(data);\n _this.context = _this.getProperty('context');\n _this.id = _this.getProperty('id');\n _this.isLoaded = true;\n resolve(_this);\n }).catch(reject);\n }\n });\n };\n return AnnotationList;\n }(Manifesto.JSONLDResource));\n Manifesto.AnnotationList = AnnotationList;\n})(Manifesto || (Manifesto = {}));\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var AnnotationPage = /** @class */ (function (_super) {\n __extends(AnnotationPage, _super);\n function AnnotationPage(jsonld, options) {\n return _super.call(this, jsonld, options) || this;\n }\n AnnotationPage.prototype.getItems = function () {\n return this.getProperty('items');\n };\n return AnnotationPage;\n }(Manifesto.ManifestResource));\n Manifesto.AnnotationPage = AnnotationPage;\n})(Manifesto || (Manifesto = {}));\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n }\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar Manifesto;\n(function (Manifesto) {\n var Thumbnail = /** @class */ (function (_super) {\n __extends(Thumbnail, _super);\n function Thumbnail(jsonld, options) {\n return _super.call(this, jsonld, options) || this;\n }\n return Thumbnail;\n }(Manifesto.Resource));\n Manifesto.Thumbnail = Thumbnail;\n})(Manifesto || (Manifesto = {}));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"http\":30,\"https\":9,\"url\":36}],2:[function(require,module,exports){\n'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n for (var i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n},{}],3:[function(require,module,exports){\n\n},{}],4:[function(require,module,exports){\n(function (global){\n/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],5:[function(require,module,exports){\n(function (global){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"base64-js\":2,\"ieee754\":10,\"isarray\":13}],6:[function(require,module,exports){\nmodule.exports = {\n \"100\": \"Continue\",\n \"101\": \"Switching Protocols\",\n \"102\": \"Processing\",\n \"200\": \"OK\",\n \"201\": \"Created\",\n \"202\": \"Accepted\",\n \"203\": \"Non-Authoritative Information\",\n \"204\": \"No Content\",\n \"205\": \"Reset Content\",\n \"206\": \"Partial Content\",\n \"207\": \"Multi-Status\",\n \"208\": \"Already Reported\",\n \"226\": \"IM Used\",\n \"300\": \"Multiple Choices\",\n \"301\": \"Moved Permanently\",\n \"302\": \"Found\",\n \"303\": \"See Other\",\n \"304\": \"Not Modified\",\n \"305\": \"Use Proxy\",\n \"307\": \"Temporary Redirect\",\n \"308\": \"Permanent Redirect\",\n \"400\": \"Bad Request\",\n \"401\": \"Unauthorized\",\n \"402\": \"Payment Required\",\n \"403\": \"Forbidden\",\n \"404\": \"Not Found\",\n \"405\": \"Method Not Allowed\",\n \"406\": \"Not Acceptable\",\n \"407\": \"Proxy Authentication Required\",\n \"408\": \"Request Timeout\",\n \"409\": \"Conflict\",\n \"410\": \"Gone\",\n \"411\": \"Length Required\",\n \"412\": \"Precondition Failed\",\n \"413\": \"Payload Too Large\",\n \"414\": \"URI Too Long\",\n \"415\": \"Unsupported Media Type\",\n \"416\": \"Range Not Satisfiable\",\n \"417\": \"Expectation Failed\",\n \"418\": \"I'm a teapot\",\n \"421\": \"Misdirected Request\",\n \"422\": \"Unprocessable Entity\",\n \"423\": \"Locked\",\n \"424\": \"Failed Dependency\",\n \"425\": \"Unordered Collection\",\n \"426\": \"Upgrade Required\",\n \"428\": \"Precondition Required\",\n \"429\": \"Too Many Requests\",\n \"431\": \"Request Header Fields Too Large\",\n \"451\": \"Unavailable For Legal Reasons\",\n \"500\": \"Internal Server Error\",\n \"501\": \"Not Implemented\",\n \"502\": \"Bad Gateway\",\n \"503\": \"Service Unavailable\",\n \"504\": \"Gateway Timeout\",\n \"505\": \"HTTP Version Not Supported\",\n \"506\": \"Variant Also Negotiates\",\n \"507\": \"Insufficient Storage\",\n \"508\": \"Loop Detected\",\n \"509\": \"Bandwidth Limit Exceeded\",\n \"510\": \"Not Extended\",\n \"511\": \"Network Authentication Required\"\n}\n\n},{}],7:[function(require,module,exports){\n(function (Buffer){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n}).call(this,{\"isBuffer\":require(\"../../is-buffer/index.js\")})\n},{\"../../is-buffer/index.js\":12}],8:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n},{}],9:[function(require,module,exports){\nvar http = require('http');\n\nvar https = module.exports;\n\nfor (var key in http) {\n if (http.hasOwnProperty(key)) https[key] = http[key];\n};\n\nhttps.request = function (params, cb) {\n if (!params) params = {};\n params.scheme = 'https';\n params.protocol = 'https:';\n return http.request.call(this, params, cb);\n}\n\n},{\"http\":30}],10:[function(require,module,exports){\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n},{}],11:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n},{}],12:[function(require,module,exports){\n/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n// The _isBuffer check is for Safari 5-7 support, because it's missing\n// Object.prototype.constructor. Remove this eventually\nmodule.exports = function (obj) {\n return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)\n}\n\nfunction isBuffer (obj) {\n return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n\n// For Node v0.10 support. Remove this eventually.\nfunction isSlowBuffer (obj) {\n return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))\n}\n\n},{}],13:[function(require,module,exports){\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n},{}],14:[function(require,module,exports){\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],15:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\n},{}],16:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n\n},{}],17:[function(require,module,exports){\n'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n\n},{\"./decode\":15,\"./encode\":16}],18:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/**/\n\nmodule.exports = Duplex;\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\n{\n // avoid scope creep, the keys array can then be collected\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n pna.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n\n pna.nextTick(cb, err);\n};\n},{\"./_stream_readable\":20,\"./_stream_writable\":22,\"core-util-is\":7,\"inherits\":11,\"process-nextick-args\":26}],19:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};\n},{\"./_stream_transform\":21,\"core-util-is\":7,\"inherits\":11}],20:[function(require,module,exports){\n(function (process,global){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function (emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar debugUtil = require('util');\nvar debug = void 0;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\nvar BufferList = require('./internal/streams/BufferList');\nvar destroyImpl = require('./internal/streams/destroy');\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n if (!(this instanceof Readable)) return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new Error('stream.push() after EOF'));\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n pna.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('_read() is not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n // If the user pushes more data while we're writing to dest then we'll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one 'drain' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n var increasedAwaitDrain = false;\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n increasedAwaitDrain = true;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = { hasUnpiped: false };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, unpipeInfo);\n }return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this, unpipeInfo);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data') {\n // Start flowing on next tick if stream isn't explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n var state = this._readableState;\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n if (!state.reading) {\n pna.nextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n pna.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null) {}\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._readableState.highWaterMark;\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n\n return ret;\n}\n\n// Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}\n\n// Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\n// Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0) throw new Error('\"endReadable()\" called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n pna.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./_stream_duplex\":18,\"./internal/streams/BufferList\":23,\"./internal/streams/destroy\":24,\"./internal/streams/stream\":25,\"_process\":14,\"core-util-is\":7,\"events\":8,\"inherits\":11,\"isarray\":13,\"process-nextick-args\":26,\"safe-buffer\":29,\"string_decoder/\":27,\"util\":3}],21:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n\n return stream.push(null);\n}\n},{\"./_stream_duplex\":18,\"core-util-is\":7,\"inherits\":11}],22:[function(require,module,exports){\n(function (process,global,setImmediate){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;\n/**/\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function (object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function (object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n\n if (typeof options.writev === 'function') this._writev = options.writev;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe, not readable'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n pna.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n pna.nextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function') cb = nop;\n\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n pna.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n pna.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /**/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /**/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('_write() is not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n stream.emit('error', err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function') {\n state.pendingcb++;\n state.finalCalled = true;\n pna.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = corkReq;\n } else {\n state.corkedRequestsFree = corkReq;\n }\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n get: function () {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\n\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {},require(\"timers\").setImmediate)\n},{\"./_stream_duplex\":18,\"./internal/streams/destroy\":24,\"./internal/streams/stream\":25,\"_process\":14,\"core-util-is\":7,\"inherits\":11,\"process-nextick-args\":26,\"safe-buffer\":29,\"timers\":34,\"util-deprecate\":38}],23:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Buffer = require('safe-buffer').Buffer;\nvar util = require('util');\n\nfunction copyBuffer(src, target, offset) {\n src.copy(target, offset);\n}\n\nmodule.exports = function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n BufferList.prototype.push = function push(v) {\n var entry = { data: v, next: null };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n };\n\n BufferList.prototype.unshift = function unshift(v) {\n var entry = { data: v, next: this.head };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n };\n\n BufferList.prototype.shift = function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n };\n\n BufferList.prototype.clear = function clear() {\n this.head = this.tail = null;\n this.length = 0;\n };\n\n BufferList.prototype.join = function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }return ret;\n };\n\n BufferList.prototype.concat = function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n if (this.length === 1) return this.head.data;\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n };\n\n return BufferList;\n}();\n\nif (util && util.inspect && util.inspect.custom) {\n module.exports.prototype[util.inspect.custom] = function () {\n var obj = util.inspect({ length: this.length });\n return this.constructor.name + ' ' + obj;\n };\n}\n},{\"safe-buffer\":29,\"util\":3}],24:[function(require,module,exports){\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {\n pna.nextTick(emitErrorNT, this, err);\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n pna.nextTick(emitErrorNT, _this, err);\n if (_this._writableState) {\n _this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};\n},{\"process-nextick-args\":26}],25:[function(require,module,exports){\nmodule.exports = require('events').EventEmitter;\n\n},{\"events\":8}],26:[function(require,module,exports){\n(function (process){\n'use strict';\n\nif (!process.version ||\n process.version.indexOf('v0.') === 0 ||\n process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = { nextTick: nextTick };\n} else {\n module.exports = process\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n var len = arguments.length;\n var args, i;\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n default:\n args = new Array(len - 1);\n i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}\n\n\n}).call(this,require('_process'))\n},{\"_process\":14}],27:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}\n},{\"safe-buffer\":29}],28:[function(require,module,exports){\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n\n},{\"./lib/_stream_duplex.js\":18,\"./lib/_stream_passthrough.js\":19,\"./lib/_stream_readable.js\":20,\"./lib/_stream_transform.js\":21,\"./lib/_stream_writable.js\":22}],29:[function(require,module,exports){\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n\n},{\"buffer\":5}],30:[function(require,module,exports){\n(function (global){\nvar ClientRequest = require('./lib/request')\nvar response = require('./lib/response')\nvar extend = require('xtend')\nvar statusCodes = require('builtin-status-codes')\nvar url = require('url')\n\nvar http = exports\n\nhttp.request = function (opts, cb) {\n\tif (typeof opts === 'string')\n\t\topts = url.parse(opts)\n\telse\n\t\topts = extend(opts)\n\n\t// Normally, the page is loaded from http or https, so not specifying a protocol\n\t// will result in a (valid) protocol-relative url. However, this won't work if\n\t// the protocol is something else, like 'file:'\n\tvar defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : ''\n\n\tvar protocol = opts.protocol || defaultProtocol\n\tvar host = opts.hostname || opts.host\n\tvar port = opts.port\n\tvar path = opts.path || '/'\n\n\t// Necessary for IPv6 addresses\n\tif (host && host.indexOf(':') !== -1)\n\t\thost = '[' + host + ']'\n\n\t// This may be a relative url. The browser should always be able to interpret it correctly.\n\topts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path\n\topts.method = (opts.method || 'GET').toUpperCase()\n\topts.headers = opts.headers || {}\n\n\t// Also valid opts.auth, opts.mode\n\n\tvar req = new ClientRequest(opts)\n\tif (cb)\n\t\treq.on('response', cb)\n\treturn req\n}\n\nhttp.get = function get (opts, cb) {\n\tvar req = http.request(opts, cb)\n\treq.end()\n\treturn req\n}\n\nhttp.ClientRequest = ClientRequest\nhttp.IncomingMessage = response.IncomingMessage\n\nhttp.Agent = function () {}\nhttp.Agent.defaultMaxSockets = 4\n\nhttp.globalAgent = new http.Agent()\n\nhttp.STATUS_CODES = statusCodes\n\nhttp.METHODS = [\n\t'CHECKOUT',\n\t'CONNECT',\n\t'COPY',\n\t'DELETE',\n\t'GET',\n\t'HEAD',\n\t'LOCK',\n\t'M-SEARCH',\n\t'MERGE',\n\t'MKACTIVITY',\n\t'MKCOL',\n\t'MOVE',\n\t'NOTIFY',\n\t'OPTIONS',\n\t'PATCH',\n\t'POST',\n\t'PROPFIND',\n\t'PROPPATCH',\n\t'PURGE',\n\t'PUT',\n\t'REPORT',\n\t'SEARCH',\n\t'SUBSCRIBE',\n\t'TRACE',\n\t'UNLOCK',\n\t'UNSUBSCRIBE'\n]\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./lib/request\":32,\"./lib/response\":33,\"builtin-status-codes\":6,\"url\":36,\"xtend\":39}],31:[function(require,module,exports){\n(function (global){\nexports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream)\n\nexports.writableStream = isFunction(global.WritableStream)\n\nexports.abortController = isFunction(global.AbortController)\n\nexports.blobConstructor = false\ntry {\n\tnew Blob([new ArrayBuffer(1)])\n\texports.blobConstructor = true\n} catch (e) {}\n\n// The xhr request to example.com may violate some restrictive CSP configurations,\n// so if we're running in a browser that supports `fetch`, avoid calling getXHR()\n// and assume support for certain features below.\nvar xhr\nfunction getXHR () {\n\t// Cache the xhr value\n\tif (xhr !== undefined) return xhr\n\n\tif (global.XMLHttpRequest) {\n\t\txhr = new global.XMLHttpRequest()\n\t\t// If XDomainRequest is available (ie only, where xhr might not work\n\t\t// cross domain), use the page location. Otherwise use example.com\n\t\t// Note: this doesn't actually make an http request.\n\t\ttry {\n\t\t\txhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com')\n\t\t} catch(e) {\n\t\t\txhr = null\n\t\t}\n\t} else {\n\t\t// Service workers don't have XHR\n\t\txhr = null\n\t}\n\treturn xhr\n}\n\nfunction checkTypeSupport (type) {\n\tvar xhr = getXHR()\n\tif (!xhr) return false\n\ttry {\n\t\txhr.responseType = type\n\t\treturn xhr.responseType === type\n\t} catch (e) {}\n\treturn false\n}\n\n// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.\n// Safari 7.1 appears to have fixed this bug.\nvar haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined'\nvar haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice)\n\n// If fetch is supported, then arraybuffer will be supported too. Skip calling\n// checkTypeSupport(), since that calls getXHR().\nexports.arraybuffer = exports.fetch || (haveArrayBuffer && checkTypeSupport('arraybuffer'))\n\n// These next two tests unavoidably show warnings in Chrome. Since fetch will always\n// be used if it's available, just return false for these to avoid the warnings.\nexports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream')\nexports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer &&\n\tcheckTypeSupport('moz-chunked-arraybuffer')\n\n// If fetch is supported, then overrideMimeType will be supported too. Skip calling\n// getXHR().\nexports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false)\n\nexports.vbArray = isFunction(global.VBArray)\n\nfunction isFunction (value) {\n\treturn typeof value === 'function'\n}\n\nxhr = null // Help gc\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],32:[function(require,module,exports){\n(function (process,global,Buffer){\nvar capability = require('./capability')\nvar inherits = require('inherits')\nvar response = require('./response')\nvar stream = require('readable-stream')\nvar toArrayBuffer = require('to-arraybuffer')\n\nvar IncomingMessage = response.IncomingMessage\nvar rStates = response.readyStates\n\nfunction decideMode (preferBinary, useFetch) {\n\tif (capability.fetch && useFetch) {\n\t\treturn 'fetch'\n\t} else if (capability.mozchunkedarraybuffer) {\n\t\treturn 'moz-chunked-arraybuffer'\n\t} else if (capability.msstream) {\n\t\treturn 'ms-stream'\n\t} else if (capability.arraybuffer && preferBinary) {\n\t\treturn 'arraybuffer'\n\t} else if (capability.vbArray && preferBinary) {\n\t\treturn 'text:vbarray'\n\t} else {\n\t\treturn 'text'\n\t}\n}\n\nvar ClientRequest = module.exports = function (opts) {\n\tvar self = this\n\tstream.Writable.call(self)\n\n\tself._opts = opts\n\tself._body = []\n\tself._headers = {}\n\tif (opts.auth)\n\t\tself.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'))\n\tObject.keys(opts.headers).forEach(function (name) {\n\t\tself.setHeader(name, opts.headers[name])\n\t})\n\n\tvar preferBinary\n\tvar useFetch = true\n\tif (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) {\n\t\t// If the use of XHR should be preferred. Not typically needed.\n\t\tuseFetch = false\n\t\tpreferBinary = true\n\t} else if (opts.mode === 'prefer-streaming') {\n\t\t// If streaming is a high priority but binary compatibility and\n\t\t// the accuracy of the 'content-type' header aren't\n\t\tpreferBinary = false\n\t} else if (opts.mode === 'allow-wrong-content-type') {\n\t\t// If streaming is more important than preserving the 'content-type' header\n\t\tpreferBinary = !capability.overrideMimeType\n\t} else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {\n\t\t// Use binary if text streaming may corrupt data or the content-type header, or for speed\n\t\tpreferBinary = true\n\t} else {\n\t\tthrow new Error('Invalid value for opts.mode')\n\t}\n\tself._mode = decideMode(preferBinary, useFetch)\n\tself._fetchTimer = null\n\n\tself.on('finish', function () {\n\t\tself._onFinish()\n\t})\n}\n\ninherits(ClientRequest, stream.Writable)\n\nClientRequest.prototype.setHeader = function (name, value) {\n\tvar self = this\n\tvar lowerName = name.toLowerCase()\n\t// This check is not necessary, but it prevents warnings from browsers about setting unsafe\n\t// headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but\n\t// http-browserify did it, so I will too.\n\tif (unsafeHeaders.indexOf(lowerName) !== -1)\n\t\treturn\n\n\tself._headers[lowerName] = {\n\t\tname: name,\n\t\tvalue: value\n\t}\n}\n\nClientRequest.prototype.getHeader = function (name) {\n\tvar header = this._headers[name.toLowerCase()]\n\tif (header)\n\t\treturn header.value\n\treturn null\n}\n\nClientRequest.prototype.removeHeader = function (name) {\n\tvar self = this\n\tdelete self._headers[name.toLowerCase()]\n}\n\nClientRequest.prototype._onFinish = function () {\n\tvar self = this\n\n\tif (self._destroyed)\n\t\treturn\n\tvar opts = self._opts\n\n\tvar headersObj = self._headers\n\tvar body = null\n\tif (opts.method !== 'GET' && opts.method !== 'HEAD') {\n\t\tif (capability.arraybuffer) {\n\t\t\tbody = toArrayBuffer(Buffer.concat(self._body))\n\t\t} else if (capability.blobConstructor) {\n\t\t\tbody = new global.Blob(self._body.map(function (buffer) {\n\t\t\t\treturn toArrayBuffer(buffer)\n\t\t\t}), {\n\t\t\t\ttype: (headersObj['content-type'] || {}).value || ''\n\t\t\t})\n\t\t} else {\n\t\t\t// get utf8 string\n\t\t\tbody = Buffer.concat(self._body).toString()\n\t\t}\n\t}\n\n\t// create flattened list of headers\n\tvar headersList = []\n\tObject.keys(headersObj).forEach(function (keyName) {\n\t\tvar name = headersObj[keyName].name\n\t\tvar value = headersObj[keyName].value\n\t\tif (Array.isArray(value)) {\n\t\t\tvalue.forEach(function (v) {\n\t\t\t\theadersList.push([name, v])\n\t\t\t})\n\t\t} else {\n\t\t\theadersList.push([name, value])\n\t\t}\n\t})\n\n\tif (self._mode === 'fetch') {\n\t\tvar signal = null\n\t\tvar fetchTimer = null\n\t\tif (capability.abortController) {\n\t\t\tvar controller = new AbortController()\n\t\t\tsignal = controller.signal\n\t\t\tself._fetchAbortController = controller\n\n\t\t\tif ('requestTimeout' in opts && opts.requestTimeout !== 0) {\n\t\t\t\tself._fetchTimer = global.setTimeout(function () {\n\t\t\t\t\tself.emit('requestTimeout')\n\t\t\t\t\tif (self._fetchAbortController)\n\t\t\t\t\t\tself._fetchAbortController.abort()\n\t\t\t\t}, opts.requestTimeout)\n\t\t\t}\n\t\t}\n\n\t\tglobal.fetch(self._opts.url, {\n\t\t\tmethod: self._opts.method,\n\t\t\theaders: headersList,\n\t\t\tbody: body || undefined,\n\t\t\tmode: 'cors',\n\t\t\tcredentials: opts.withCredentials ? 'include' : 'same-origin',\n\t\t\tsignal: signal\n\t\t}).then(function (response) {\n\t\t\tself._fetchResponse = response\n\t\t\tself._connect()\n\t\t}, function (reason) {\n\t\t\tglobal.clearTimeout(self._fetchTimer)\n\t\t\tif (!self._destroyed)\n\t\t\t\tself.emit('error', reason)\n\t\t})\n\t} else {\n\t\tvar xhr = self._xhr = new global.XMLHttpRequest()\n\t\ttry {\n\t\t\txhr.open(self._opts.method, self._opts.url, true)\n\t\t} catch (err) {\n\t\t\tprocess.nextTick(function () {\n\t\t\t\tself.emit('error', err)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// Can't set responseType on really old browsers\n\t\tif ('responseType' in xhr)\n\t\t\txhr.responseType = self._mode.split(':')[0]\n\n\t\tif ('withCredentials' in xhr)\n\t\t\txhr.withCredentials = !!opts.withCredentials\n\n\t\tif (self._mode === 'text' && 'overrideMimeType' in xhr)\n\t\t\txhr.overrideMimeType('text/plain; charset=x-user-defined')\n\n\t\tif ('requestTimeout' in opts) {\n\t\t\txhr.timeout = opts.requestTimeout\n\t\t\txhr.ontimeout = function () {\n\t\t\t\tself.emit('requestTimeout')\n\t\t\t}\n\t\t}\n\n\t\theadersList.forEach(function (header) {\n\t\t\txhr.setRequestHeader(header[0], header[1])\n\t\t})\n\n\t\tself._response = null\n\t\txhr.onreadystatechange = function () {\n\t\t\tswitch (xhr.readyState) {\n\t\t\t\tcase rStates.LOADING:\n\t\t\t\tcase rStates.DONE:\n\t\t\t\t\tself._onXHRProgress()\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Necessary for streaming in Firefox, since xhr.response is ONLY defined\n\t\t// in onprogress, not in onreadystatechange with xhr.readyState = 3\n\t\tif (self._mode === 'moz-chunked-arraybuffer') {\n\t\t\txhr.onprogress = function () {\n\t\t\t\tself._onXHRProgress()\n\t\t\t}\n\t\t}\n\n\t\txhr.onerror = function () {\n\t\t\tif (self._destroyed)\n\t\t\t\treturn\n\t\t\tself.emit('error', new Error('XHR error'))\n\t\t}\n\n\t\ttry {\n\t\t\txhr.send(body)\n\t\t} catch (err) {\n\t\t\tprocess.nextTick(function () {\n\t\t\t\tself.emit('error', err)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n}\n\n/**\n * Checks if xhr.status is readable and non-zero, indicating no error.\n * Even though the spec says it should be available in readyState 3,\n * accessing it throws an exception in IE8\n */\nfunction statusValid (xhr) {\n\ttry {\n\t\tvar status = xhr.status\n\t\treturn (status !== null && status !== 0)\n\t} catch (e) {\n\t\treturn false\n\t}\n}\n\nClientRequest.prototype._onXHRProgress = function () {\n\tvar self = this\n\n\tif (!statusValid(self._xhr) || self._destroyed)\n\t\treturn\n\n\tif (!self._response)\n\t\tself._connect()\n\n\tself._response._onXHRProgress()\n}\n\nClientRequest.prototype._connect = function () {\n\tvar self = this\n\n\tif (self._destroyed)\n\t\treturn\n\n\tself._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer)\n\tself._response.on('error', function(err) {\n\t\tself.emit('error', err)\n\t})\n\n\tself.emit('response', self._response)\n}\n\nClientRequest.prototype._write = function (chunk, encoding, cb) {\n\tvar self = this\n\n\tself._body.push(chunk)\n\tcb()\n}\n\nClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {\n\tvar self = this\n\tself._destroyed = true\n\tglobal.clearTimeout(self._fetchTimer)\n\tif (self._response)\n\t\tself._response._destroyed = true\n\tif (self._xhr)\n\t\tself._xhr.abort()\n\telse if (self._fetchAbortController)\n\t\tself._fetchAbortController.abort()\n}\n\nClientRequest.prototype.end = function (data, encoding, cb) {\n\tvar self = this\n\tif (typeof data === 'function') {\n\t\tcb = data\n\t\tdata = undefined\n\t}\n\n\tstream.Writable.prototype.end.call(self, data, encoding, cb)\n}\n\nClientRequest.prototype.flushHeaders = function () {}\nClientRequest.prototype.setTimeout = function () {}\nClientRequest.prototype.setNoDelay = function () {}\nClientRequest.prototype.setSocketKeepAlive = function () {}\n\n// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method\nvar unsafeHeaders = [\n\t'accept-charset',\n\t'accept-encoding',\n\t'access-control-request-headers',\n\t'access-control-request-method',\n\t'connection',\n\t'content-length',\n\t'cookie',\n\t'cookie2',\n\t'date',\n\t'dnt',\n\t'expect',\n\t'host',\n\t'keep-alive',\n\t'origin',\n\t'referer',\n\t'te',\n\t'trailer',\n\t'transfer-encoding',\n\t'upgrade',\n\t'via'\n]\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {},require(\"buffer\").Buffer)\n},{\"./capability\":31,\"./response\":33,\"_process\":14,\"buffer\":5,\"inherits\":11,\"readable-stream\":28,\"to-arraybuffer\":35}],33:[function(require,module,exports){\n(function (process,global,Buffer){\nvar capability = require('./capability')\nvar inherits = require('inherits')\nvar stream = require('readable-stream')\n\nvar rStates = exports.readyStates = {\n\tUNSENT: 0,\n\tOPENED: 1,\n\tHEADERS_RECEIVED: 2,\n\tLOADING: 3,\n\tDONE: 4\n}\n\nvar IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {\n\tvar self = this\n\tstream.Readable.call(self)\n\n\tself._mode = mode\n\tself.headers = {}\n\tself.rawHeaders = []\n\tself.trailers = {}\n\tself.rawTrailers = []\n\n\t// Fake the 'close' event, but only once 'end' fires\n\tself.on('end', function () {\n\t\t// The nextTick is necessary to prevent the 'request' module from causing an infinite loop\n\t\tprocess.nextTick(function () {\n\t\t\tself.emit('close')\n\t\t})\n\t})\n\n\tif (mode === 'fetch') {\n\t\tself._fetchResponse = response\n\n\t\tself.url = response.url\n\t\tself.statusCode = response.status\n\t\tself.statusMessage = response.statusText\n\t\t\n\t\tresponse.headers.forEach(function (header, key){\n\t\t\tself.headers[key.toLowerCase()] = header\n\t\t\tself.rawHeaders.push(key, header)\n\t\t})\n\n\t\tif (capability.writableStream) {\n\t\t\tvar writable = new WritableStream({\n\t\t\t\twrite: function (chunk) {\n\t\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\t\tif (self._destroyed) {\n\t\t\t\t\t\t\treject()\n\t\t\t\t\t\t} else if(self.push(new Buffer(chunk))) {\n\t\t\t\t\t\t\tresolve()\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tself._resumeFetch = resolve\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\tclose: function () {\n\t\t\t\t\tglobal.clearTimeout(fetchTimer)\n\t\t\t\t\tif (!self._destroyed)\n\t\t\t\t\t\tself.push(null)\n\t\t\t\t},\n\t\t\t\tabort: function (err) {\n\t\t\t\t\tif (!self._destroyed)\n\t\t\t\t\t\tself.emit('error', err)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\ttry {\n\t\t\t\tresponse.body.pipeTo(writable).catch(function (err) {\n\t\t\t\t\tglobal.clearTimeout(fetchTimer)\n\t\t\t\t\tif (!self._destroyed)\n\t\t\t\t\t\tself.emit('error', err)\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t} catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this\n\t\t}\n\t\t// fallback for when writableStream or pipeTo aren't available\n\t\tvar reader = response.body.getReader()\n\t\tfunction read () {\n\t\t\treader.read().then(function (result) {\n\t\t\t\tif (self._destroyed)\n\t\t\t\t\treturn\n\t\t\t\tif (result.done) {\n\t\t\t\t\tglobal.clearTimeout(fetchTimer)\n\t\t\t\t\tself.push(null)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tself.push(new Buffer(result.value))\n\t\t\t\tread()\n\t\t\t}).catch(function (err) {\n\t\t\t\tglobal.clearTimeout(fetchTimer)\n\t\t\t\tif (!self._destroyed)\n\t\t\t\t\tself.emit('error', err)\n\t\t\t})\n\t\t}\n\t\tread()\n\t} else {\n\t\tself._xhr = xhr\n\t\tself._pos = 0\n\n\t\tself.url = xhr.responseURL\n\t\tself.statusCode = xhr.status\n\t\tself.statusMessage = xhr.statusText\n\t\tvar headers = xhr.getAllResponseHeaders().split(/\\r?\\n/)\n\t\theaders.forEach(function (header) {\n\t\t\tvar matches = header.match(/^([^:]+):\\s*(.*)/)\n\t\t\tif (matches) {\n\t\t\t\tvar key = matches[1].toLowerCase()\n\t\t\t\tif (key === 'set-cookie') {\n\t\t\t\t\tif (self.headers[key] === undefined) {\n\t\t\t\t\t\tself.headers[key] = []\n\t\t\t\t\t}\n\t\t\t\t\tself.headers[key].push(matches[2])\n\t\t\t\t} else if (self.headers[key] !== undefined) {\n\t\t\t\t\tself.headers[key] += ', ' + matches[2]\n\t\t\t\t} else {\n\t\t\t\t\tself.headers[key] = matches[2]\n\t\t\t\t}\n\t\t\t\tself.rawHeaders.push(matches[1], matches[2])\n\t\t\t}\n\t\t})\n\n\t\tself._charset = 'x-user-defined'\n\t\tif (!capability.overrideMimeType) {\n\t\t\tvar mimeType = self.rawHeaders['mime-type']\n\t\t\tif (mimeType) {\n\t\t\t\tvar charsetMatch = mimeType.match(/;\\s*charset=([^;])(;|$)/)\n\t\t\t\tif (charsetMatch) {\n\t\t\t\t\tself._charset = charsetMatch[1].toLowerCase()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!self._charset)\n\t\t\t\tself._charset = 'utf-8' // best guess\n\t\t}\n\t}\n}\n\ninherits(IncomingMessage, stream.Readable)\n\nIncomingMessage.prototype._read = function () {\n\tvar self = this\n\n\tvar resolve = self._resumeFetch\n\tif (resolve) {\n\t\tself._resumeFetch = null\n\t\tresolve()\n\t}\n}\n\nIncomingMessage.prototype._onXHRProgress = function () {\n\tvar self = this\n\n\tvar xhr = self._xhr\n\n\tvar response = null\n\tswitch (self._mode) {\n\t\tcase 'text:vbarray': // For IE9\n\t\t\tif (xhr.readyState !== rStates.DONE)\n\t\t\t\tbreak\n\t\t\ttry {\n\t\t\t\t// This fails in IE8\n\t\t\t\tresponse = new global.VBArray(xhr.responseBody).toArray()\n\t\t\t} catch (e) {}\n\t\t\tif (response !== null) {\n\t\t\t\tself.push(new Buffer(response))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Falls through in IE8\t\n\t\tcase 'text':\n\t\t\ttry { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4\n\t\t\t\tresponse = xhr.responseText\n\t\t\t} catch (e) {\n\t\t\t\tself._mode = 'text:vbarray'\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (response.length > self._pos) {\n\t\t\t\tvar newData = response.substr(self._pos)\n\t\t\t\tif (self._charset === 'x-user-defined') {\n\t\t\t\t\tvar buffer = new Buffer(newData.length)\n\t\t\t\t\tfor (var i = 0; i < newData.length; i++)\n\t\t\t\t\t\tbuffer[i] = newData.charCodeAt(i) & 0xff\n\n\t\t\t\t\tself.push(buffer)\n\t\t\t\t} else {\n\t\t\t\t\tself.push(newData, self._charset)\n\t\t\t\t}\n\t\t\t\tself._pos = response.length\n\t\t\t}\n\t\t\tbreak\n\t\tcase 'arraybuffer':\n\t\t\tif (xhr.readyState !== rStates.DONE || !xhr.response)\n\t\t\t\tbreak\n\t\t\tresponse = xhr.response\n\t\t\tself.push(new Buffer(new Uint8Array(response)))\n\t\t\tbreak\n\t\tcase 'moz-chunked-arraybuffer': // take whole\n\t\t\tresponse = xhr.response\n\t\t\tif (xhr.readyState !== rStates.LOADING || !response)\n\t\t\t\tbreak\n\t\t\tself.push(new Buffer(new Uint8Array(response)))\n\t\t\tbreak\n\t\tcase 'ms-stream':\n\t\t\tresponse = xhr.response\n\t\t\tif (xhr.readyState !== rStates.LOADING)\n\t\t\t\tbreak\n\t\t\tvar reader = new global.MSStreamReader()\n\t\t\treader.onprogress = function () {\n\t\t\t\tif (reader.result.byteLength > self._pos) {\n\t\t\t\t\tself.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))))\n\t\t\t\t\tself._pos = reader.result.byteLength\n\t\t\t\t}\n\t\t\t}\n\t\t\treader.onload = function () {\n\t\t\t\tself.push(null)\n\t\t\t}\n\t\t\t// reader.onerror = ??? // TODO: this\n\t\t\treader.readAsArrayBuffer(response)\n\t\t\tbreak\n\t}\n\n\t// The ms-stream case handles end separately in reader.onload()\n\tif (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {\n\t\tself.push(null)\n\t}\n}\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {},require(\"buffer\").Buffer)\n},{\"./capability\":31,\"_process\":14,\"buffer\":5,\"inherits\":11,\"readable-stream\":28}],34:[function(require,module,exports){\n(function (setImmediate,clearImmediate){\nvar nextTick = require('process/browser.js').nextTick;\nvar apply = Function.prototype.apply;\nvar slice = Array.prototype.slice;\nvar immediateIds = {};\nvar nextImmediateId = 0;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) { timeout.close(); };\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// That's not how node.js implements it but the exposed api is the same.\nexports.setImmediate = typeof setImmediate === \"function\" ? setImmediate : function(fn) {\n var id = nextImmediateId++;\n var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n\n immediateIds[id] = true;\n\n nextTick(function onNextTick() {\n if (immediateIds[id]) {\n // fn.call() is faster so we optimize for the common use-case\n // @see http://jsperf.com/call-apply-segu\n if (args) {\n fn.apply(null, args);\n } else {\n fn.call(null);\n }\n // Prevent ids from leaking\n exports.clearImmediate(id);\n }\n });\n\n return id;\n};\n\nexports.clearImmediate = typeof clearImmediate === \"function\" ? clearImmediate : function(id) {\n delete immediateIds[id];\n};\n}).call(this,require(\"timers\").setImmediate,require(\"timers\").clearImmediate)\n},{\"process/browser.js\":14,\"timers\":34}],35:[function(require,module,exports){\nvar Buffer = require('buffer').Buffer\n\nmodule.exports = function (buf) {\n\t// If the buffer is backed by a Uint8Array, a faster version will work\n\tif (buf instanceof Uint8Array) {\n\t\t// If the buffer isn't a subarray, return the underlying ArrayBuffer\n\t\tif (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {\n\t\t\treturn buf.buffer\n\t\t} else if (typeof buf.buffer.slice === 'function') {\n\t\t\t// Otherwise we need to get a proper copy\n\t\t\treturn buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)\n\t\t}\n\t}\n\n\tif (Buffer.isBuffer(buf)) {\n\t\t// This is the slow version that will work with any Buffer\n\t\t// implementation (even in old browsers)\n\t\tvar arrayCopy = new Uint8Array(buf.length)\n\t\tvar len = buf.length\n\t\tfor (var i = 0; i < len; i++) {\n\t\t\tarrayCopy[i] = buf[i]\n\t\t}\n\t\treturn arrayCopy.buffer\n\t} else {\n\t\tthrow new Error('Argument must be a Buffer')\n\t}\n}\n\n},{\"buffer\":5}],36:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n\n},{\"./util\":37,\"punycode\":4,\"querystring\":17}],37:[function(require,module,exports){\n'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n\n},{}],38:[function(require,module,exports){\n(function (global){\n\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],39:[function(require,module,exports){\nmodule.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n\n},{}]},{},[1])(1)\n});\n\n", - "// @iiif/manifold v1.2.37 https://github.com/iiif-commons/manifold#readme\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define('lib/manifold.js',[],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.iiifmanifold = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i 0) {\n if (msie === 9) {\n // CORS not available, use jsonp\n var settings = {\n url: that._options.iiifResourceUri,\n type: 'GET',\n dataType: 'jsonp',\n jsonp: 'callback',\n jsonpCallback: 'manifestCallback'\n };\n $.ajax(settings);\n global.manifestCallback = function (json) {\n that._loaded(that, JSON.stringify(json), resolve, reject);\n };\n }\n else {\n $.getJSON(that._options.iiifResourceUri, function (json) {\n that._loaded(that, JSON.stringify(json), resolve, reject);\n });\n }\n }\n }\n });\n };\n Bootstrapper.prototype._loaded = function (bootstrapper, json, resolve, reject) {\n var iiifResource = manifesto.create(json, {\n locale: bootstrapper._options.locale\n });\n // only set the root IIIFResource on the first load\n if (!bootstrapper._options.iiifResource) {\n bootstrapper._options.iiifResource = iiifResource;\n }\n var collectionIndex = bootstrapper._options.collectionIndex; // this is either undefined, 0, or a positive number (defaults to undefined)\n var manifestIndex = bootstrapper._options.manifestIndex; // this is either 0 or a positive number (defaults to 0)\n if (iiifResource.getIIIFResourceType().toString() === manifesto.IIIFResourceType.collection().toString() ||\n iiifResource.getIIIFResourceType().toString().toLowerCase() === 'collection') {\n // it's a collection\n var manifests = iiifResource.getManifests();\n var collections = iiifResource.getCollections();\n // if there are only collections available, set the collectionIndex to 0 if undefined.\n if (!manifests.length && collectionIndex === undefined) {\n collectionIndex = 0;\n }\n if (collectionIndex !== undefined && collections && collections.length) {\n // a collectionIndex has been passed and we have sub collections\n iiifResource.getCollectionByIndex(collectionIndex).then(function (collection) {\n if (!collection) {\n reject('Collection index not found');\n }\n // Special case: we're trying to load the first manifest of the\n // specified collection, but the collection has no manifests but does have\n // subcollections. Thus, we should dive in until we find something\n // we can display!\n if (collection.getTotalManifests() === 0 && manifestIndex === 0 && collection.getTotalCollections() > 0) {\n bootstrapper._options.collectionIndex = 0;\n bootstrapper._options.iiifResourceUri = collection.id;\n bootstrapper.bootstrap(resolve, reject);\n }\n else {\n collection.getManifestByIndex(manifestIndex).then(function (manifest) {\n bootstrapper._options.manifest = manifest;\n var helper = new Manifold.Helper(bootstrapper._options);\n resolve(helper);\n });\n }\n });\n }\n else {\n iiifResource.getManifestByIndex(bootstrapper._options.manifestIndex).then(function (manifest) {\n bootstrapper._options.manifest = manifest;\n var helper = new Manifold.Helper(bootstrapper._options);\n resolve(helper);\n });\n }\n }\n else {\n bootstrapper._options.manifest = iiifResource;\n var helper = new Manifold.Helper(bootstrapper._options);\n resolve(helper);\n }\n };\n Bootstrapper.prototype._detectIE = function () {\n var ua = window.navigator.userAgent;\n // Test values; Uncomment to check result …\n // IE 10\n // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';\n // IE 11\n // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';\n // Edge 12 (Spartan)\n // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0';\n // Edge 13\n // ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586';\n var msie = ua.indexOf('MSIE ');\n if (msie > 0) {\n // IE 10 or older => return version number\n return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);\n }\n var trident = ua.indexOf('Trident/');\n if (trident > 0) {\n // IE 11 => return version number\n var rv = ua.indexOf('rv:');\n return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);\n }\n var edge = ua.indexOf('Edge/');\n if (edge > 0) {\n // Edge (IE 12+) => return version number\n return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);\n }\n // other browser\n return false;\n };\n return Bootstrapper;\n }());\n Manifold.Bootstrapper = Bootstrapper;\n})(Manifold || (Manifold = {}));\n\nvar Manifold;\n(function (Manifold) {\n var ExternalResource = /** @class */ (function () {\n function ExternalResource(canvas, options) {\n this.authHoldingPage = null;\n this.clickThroughService = null;\n this.externalService = null;\n this.isProbed = false;\n this.isResponseHandled = false;\n this.kioskService = null;\n this.loginService = null;\n this.logoutService = null;\n this.probeService = null;\n this.restrictedService = null;\n this.tokenService = null;\n canvas.externalResource = this;\n this.dataUri = this._getDataUri(canvas);\n this.index = canvas.index;\n this.authAPIVersion = options.authApiVersion;\n this._parseAuthServices(canvas);\n // get the height and width of the image resource if available\n this._parseDimensions(canvas);\n }\n ExternalResource.prototype._getImageServiceDescriptor = function (services) {\n var infoUri = null;\n for (var i = 0; i < services.length; i++) {\n var service = services[i];\n var id = service.id;\n if (!id.endsWith('/')) {\n id += '/';\n }\n if (manifesto.Utils.isImageProfile(service.getProfile())) {\n infoUri = id + 'info.json';\n }\n }\n return infoUri;\n };\n ExternalResource.prototype._getDataUri = function (canvas) {\n var content = canvas.getContent();\n var images = canvas.getImages();\n var infoUri = null;\n // presentation 3\n if (content && content.length) {\n var annotation = content[0];\n var annotationBody = annotation.getBody();\n if (annotationBody.length) {\n var body = annotationBody[0];\n var services = body.getServices();\n if (services.length) {\n infoUri = this._getImageServiceDescriptor(services);\n if (infoUri) {\n return infoUri;\n }\n }\n // no image services. return the image id\n return annotationBody[0].id;\n }\n return null;\n }\n else if (images && images.length) {\n var firstImage = images[0];\n var resource = firstImage.getResource();\n var services = resource.getServices();\n if (services.length) {\n infoUri = this._getImageServiceDescriptor(services);\n if (infoUri) {\n return infoUri;\n }\n }\n // no image services. return the image id\n return resource.id;\n }\n else {\n // Legacy IxIF\n var service = canvas.getService(manifesto.ServiceProfile.ixif());\n if (service) {\n return service.getInfoUri();\n }\n // return the canvas id.\n return canvas.id;\n }\n };\n ExternalResource.prototype._parseAuthServices = function (resource) {\n if (this.authAPIVersion === 0.9) {\n this.clickThroughService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.clickThrough().toString());\n this.loginService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.login().toString());\n this.restrictedService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.restricted().toString());\n if (this.clickThroughService) {\n this.logoutService = this.clickThroughService.getService(manifesto.ServiceProfile.logout().toString());\n this.tokenService = this.clickThroughService.getService(manifesto.ServiceProfile.token().toString());\n }\n else if (this.loginService) {\n this.logoutService = this.loginService.getService(manifesto.ServiceProfile.logout().toString());\n this.tokenService = this.loginService.getService(manifesto.ServiceProfile.token().toString());\n }\n else if (this.restrictedService) {\n this.logoutService = this.restrictedService.getService(manifesto.ServiceProfile.logout().toString());\n this.tokenService = this.restrictedService.getService(manifesto.ServiceProfile.token().toString());\n }\n }\n else {\n // if the resource is a canvas, not an info.json, look for auth services on its content.\n if (resource.isCanvas !== undefined && resource.isCanvas()) {\n var content = resource.getContent();\n if (content && content.length) {\n var body = content[0].getBody();\n if (body && body.length) {\n var annotation = body[0];\n resource = annotation;\n }\n }\n }\n this.clickThroughService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.auth1Clickthrough().toString());\n this.loginService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.auth1Login().toString());\n this.externalService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.auth1External().toString());\n this.kioskService = manifesto.Utils.getService(resource, manifesto.ServiceProfile.auth1Kiosk().toString());\n if (this.clickThroughService) {\n this.logoutService = this.clickThroughService.getService(manifesto.ServiceProfile.auth1Logout().toString());\n this.tokenService = this.clickThroughService.getService(manifesto.ServiceProfile.auth1Token().toString());\n this.probeService = this.clickThroughService.getService(manifesto.ServiceProfile.auth1Probe().toString());\n }\n else if (this.loginService) {\n this.logoutService = this.loginService.getService(manifesto.ServiceProfile.auth1Logout().toString());\n this.tokenService = this.loginService.getService(manifesto.ServiceProfile.auth1Token().toString());\n this.probeService = this.loginService.getService(manifesto.ServiceProfile.auth1Probe().toString());\n }\n else if (this.externalService) {\n this.logoutService = this.externalService.getService(manifesto.ServiceProfile.auth1Logout().toString());\n this.tokenService = this.externalService.getService(manifesto.ServiceProfile.auth1Token().toString());\n this.probeService = this.externalService.getService(manifesto.ServiceProfile.auth1Probe().toString());\n }\n else if (this.kioskService) {\n this.logoutService = this.kioskService.getService(manifesto.ServiceProfile.auth1Logout().toString());\n this.tokenService = this.kioskService.getService(manifesto.ServiceProfile.auth1Token().toString());\n this.probeService = this.kioskService.getService(manifesto.ServiceProfile.auth1Probe().toString());\n }\n }\n };\n ExternalResource.prototype._parseDimensions = function (canvas) {\n var images = canvas.getImages();\n if (images && images.length) {\n var firstImage = images[0];\n var resource = firstImage.getResource();\n this.width = resource.getWidth();\n this.height = resource.getHeight();\n }\n else {\n // presentation 3\n images = canvas.getContent();\n if (images.length) {\n var annotation = images[0];\n var body = annotation.getBody();\n if (body.length) {\n this.width = body[0].getWidth();\n this.height = body[0].getHeight();\n }\n }\n }\n };\n ExternalResource.prototype.isAccessControlled = function () {\n if (this.clickThroughService || this.loginService || this.externalService || this.kioskService || this.probeService) {\n return true;\n }\n return false;\n };\n ExternalResource.prototype.hasServiceDescriptor = function () {\n if (this.dataUri) {\n return this.dataUri.endsWith('info.json');\n }\n return false;\n };\n ExternalResource.prototype.getData = function (accessToken) {\n var _this = this;\n var that = this;\n that.data = {};\n return new Promise(function (resolve, reject) {\n if (!_this.dataUri) {\n reject('There is no dataUri to fetch');\n }\n // if the resource has a probe service, use that to get http status code\n if (that.probeService && !that.isProbed) {\n that.isProbed = true;\n $.ajax({\n url: that.probeService.id,\n type: 'GET',\n dataType: 'json'\n }).done(function (data) {\n var contentLocation = unescape(data.contentLocation);\n if (contentLocation !== that.dataUri) {\n that.status = HTTPStatusCode.MOVED_TEMPORARILY;\n }\n else {\n that.status = HTTPStatusCode.OK;\n }\n resolve(that);\n }).fail(function (error) {\n that.status = error.status;\n that.error = error;\n resolve(that);\n });\n }\n else {\n // check if dataUri ends with info.json\n // if not issue a HEAD request.\n var type = 'GET';\n if (!that.hasServiceDescriptor()) {\n // If access control is unnecessary, short circuit the process.\n // Note that isAccessControlled check for short-circuiting only\n // works in the \"binary resource\" context, since in that case,\n // we know about access control from the manifest. For image\n // resources, we need to check info.json for details and can't\n // short-circuit like this.\n if (!that.isAccessControlled()) {\n that.status = HTTPStatusCode.OK;\n resolve(that);\n return;\n }\n type = 'HEAD';\n }\n $.ajax({\n url: that.dataUri,\n type: type,\n dataType: 'json',\n beforeSend: function (xhr) {\n if (accessToken) {\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + accessToken.accessToken);\n }\n }\n }).done(function (data) {\n // if it's a resource without an info.json\n // todo: if resource doesn't have a @profile\n if (!data) {\n that.status = HTTPStatusCode.OK;\n resolve(that);\n }\n else {\n var uri = unescape(data['@id']);\n that.data = data;\n that._parseAuthServices(that.data);\n // remove trailing /info.json\n if (uri.endsWith('/info.json')) {\n uri = uri.substr(0, uri.lastIndexOf('/'));\n }\n var dataUri = that.dataUri;\n if (dataUri && dataUri.endsWith('/info.json')) {\n dataUri = dataUri.substr(0, dataUri.lastIndexOf('/'));\n }\n // if the request was redirected to a degraded version and there's a login service to get the full quality version\n if (uri !== dataUri && that.loginService) {\n that.status = HTTPStatusCode.MOVED_TEMPORARILY;\n }\n else {\n that.status = HTTPStatusCode.OK;\n }\n resolve(that);\n }\n }).fail(function (error) {\n that.status = error.status;\n that.error = error;\n if (error.responseJSON) {\n that._parseAuthServices(error.responseJSON);\n }\n resolve(that);\n });\n }\n });\n };\n return ExternalResource;\n }());\n Manifold.ExternalResource = ExternalResource;\n})(Manifold || (Manifold = {}));\n\nvar Manifold;\n(function (Manifold) {\n var Helper = /** @class */ (function () {\n function Helper(options) {\n this.options = options;\n this.iiifResource = this.options.iiifResource;\n this.iiifResourceUri = this.options.iiifResourceUri;\n this.manifest = this.options.manifest;\n this.collectionIndex = this.options.collectionIndex;\n this.manifestIndex = this.options.manifestIndex || 0;\n this.sequenceIndex = this.options.sequenceIndex || 0;\n this.canvasIndex = this.options.canvasIndex || 0;\n }\n // getters //\n Helper.prototype.getAutoCompleteService = function () {\n var service = this.getSearchService();\n if (service) {\n return service.getService(manifesto.ServiceProfile.autoComplete());\n }\n return null;\n };\n Helper.prototype.getAttribution = function () {\n console.warn('getAttribution will be deprecated, use getRequiredStatement instead.');\n var attribution = this.manifest.getAttribution();\n if (attribution) {\n return Manifesto.LanguageMap.getValue(attribution, this.options.locale);\n }\n return null;\n };\n Helper.prototype.getCanvases = function () {\n return this.getCurrentSequence().getCanvases();\n };\n Helper.prototype.getCanvasById = function (id) {\n return this.getCurrentSequence().getCanvasById(id);\n };\n Helper.prototype.getCanvasesById = function (ids) {\n var canvases = [];\n for (var i = 0; i < ids.length; i++) {\n var id = ids[i];\n var canvas = this.getCanvasById(id);\n if (canvas) {\n canvases.push(canvas);\n }\n }\n return canvases;\n };\n Helper.prototype.getCanvasByIndex = function (index) {\n return this.getCurrentSequence().getCanvasByIndex(index);\n };\n Helper.prototype.getCanvasIndexById = function (id) {\n return this.getCurrentSequence().getCanvasIndexById(id);\n };\n Helper.prototype.getCanvasIndexByLabel = function (label) {\n var foliated = this.getManifestType().toString() === manifesto.ManifestType.manuscript().toString();\n return this.getCurrentSequence().getCanvasIndexByLabel(label, foliated);\n };\n Helper.prototype.getCanvasRange = function (canvas, path) {\n var ranges = this.getCanvasRanges(canvas);\n if (path) {\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.path === path) {\n return range;\n }\n }\n return null;\n }\n else {\n return ranges[0]; // else return the first range\n }\n };\n Helper.prototype.getCanvasRanges = function (canvas) {\n if (canvas.ranges) {\n return canvas.ranges; // cache\n }\n else {\n canvas.ranges = this.manifest.getAllRanges().en().where(function (range) { return (range.getCanvasIds().en().any(function (c) { return manifesto.Utils.normaliseUrl(c) === manifesto.Utils.normaliseUrl(canvas.id); })); }).toArray();\n }\n return canvas.ranges;\n };\n Helper.prototype.getCollectionIndex = function (iiifResource) {\n // todo: this only works for collections nested one level deep\n if (iiifResource.parentCollection && !iiifResource.parentCollection.parentCollection) {\n // manifest must be in the root\n return undefined;\n }\n else if (iiifResource.parentCollection) {\n return iiifResource.parentCollection.index;\n }\n return undefined;\n };\n Helper.prototype.getCurrentCanvas = function () {\n return this.getCurrentSequence().getCanvasByIndex(this.canvasIndex);\n };\n Helper.prototype.getCurrentSequence = function () {\n return this.getSequenceByIndex(this.sequenceIndex);\n };\n Helper.prototype.getDescription = function () {\n var description = this.manifest.getDescription();\n if (description) {\n return Manifesto.LanguageMap.getValue(description, this.options.locale);\n }\n return null;\n };\n Helper.prototype.getFirstPageIndex = function () {\n return 0;\n };\n Helper.prototype.getLabel = function () {\n var label = this.manifest.getLabel();\n if (label) {\n return Manifesto.LanguageMap.getValue(label, this.options.locale);\n }\n return null;\n };\n Helper.prototype.getLastCanvasLabel = function (alphanumeric) {\n return this.getCurrentSequence().getLastCanvasLabel(alphanumeric);\n };\n Helper.prototype.getLastPageIndex = function () {\n return this.getTotalCanvases() - 1;\n };\n Helper.prototype.getLicense = function () {\n return this.manifest.getLicense();\n };\n Helper.prototype.getLogo = function () {\n return this.manifest.getLogo();\n };\n Helper.prototype.getManifestType = function () {\n var manifestType = this.manifest.getManifestType();\n // default to monograph\n if (manifestType.toString() === \"\") {\n manifestType = manifesto.ManifestType.monograph();\n }\n return manifestType;\n };\n Helper.prototype.getMetadata = function (options) {\n var metadataGroups = [];\n var manifestMetadata = this.manifest.getMetadata();\n var manifestGroup = new Manifold.MetadataGroup(this.manifest);\n if (manifestMetadata && manifestMetadata.length) {\n manifestGroup.addMetadata(manifestMetadata, true);\n }\n if (this.manifest.getDescription().length) {\n var metadataItem = new Manifesto.LabelValuePair(this.options.locale);\n metadataItem.label = [new Manifesto.Language(\"description\", this.options.locale)];\n metadataItem.value = this.manifest.getDescription();\n metadataItem.isRootLevel = true;\n manifestGroup.addItem(metadataItem);\n }\n if (this.manifest.getAttribution().length) {\n var metadataItem = new Manifesto.LabelValuePair(this.options.locale);\n metadataItem.label = [new Manifesto.Language(\"attribution\", this.options.locale)];\n metadataItem.value = this.manifest.getAttribution();\n metadataItem.isRootLevel = true;\n manifestGroup.addItem(metadataItem);\n }\n var license = this.manifest.getLicense();\n if (license) {\n var item = {\n label: \"license\",\n value: (options && options.licenseFormatter) ? options.licenseFormatter.format(license) : license\n };\n var metadataItem = new Manifesto.LabelValuePair(this.options.locale);\n metadataItem.parse(item);\n metadataItem.isRootLevel = true;\n manifestGroup.addItem(metadataItem);\n }\n if (this.manifest.getLogo()) {\n var item = {\n label: \"logo\",\n value: ''\n };\n var metadataItem = new Manifesto.LabelValuePair(this.options.locale);\n metadataItem.parse(item);\n metadataItem.isRootLevel = true;\n manifestGroup.addItem(metadataItem);\n }\n metadataGroups.push(manifestGroup);\n if (options) {\n return this._parseMetadataOptions(options, metadataGroups);\n }\n else {\n return metadataGroups;\n }\n };\n Helper.prototype.getRequiredStatement = function () {\n var requiredStatement = this.manifest.getRequiredStatement();\n if (requiredStatement) {\n return {\n label: requiredStatement.getLabel(),\n value: requiredStatement.getValue()\n };\n }\n return null;\n };\n Helper.prototype._parseMetadataOptions = function (options, metadataGroups) {\n // get sequence metadata\n var sequence = this.getCurrentSequence();\n var sequenceMetadata = sequence.getMetadata();\n if (sequenceMetadata && sequenceMetadata.length) {\n var sequenceGroup = new Manifold.MetadataGroup(sequence);\n sequenceGroup.addMetadata(sequenceMetadata);\n metadataGroups.push(sequenceGroup);\n }\n // get range metadata\n if (options.range) {\n var rangeGroups = this._getRangeMetadata([], options.range);\n rangeGroups = rangeGroups.reverse();\n metadataGroups = metadataGroups.concat(rangeGroups);\n }\n // get canvas metadata\n if (options.canvases && options.canvases.length) {\n for (var i = 0; i < options.canvases.length; i++) {\n var canvas = options.canvases[i];\n var canvasMetadata = canvas.getMetadata();\n if (canvasMetadata && canvasMetadata.length) {\n var canvasGroup = new Manifold.MetadataGroup(canvas);\n canvasGroup.addMetadata(canvas.getMetadata());\n metadataGroups.push(canvasGroup);\n }\n // add image metadata\n var images = canvas.getImages();\n for (var j = 0; j < images.length; j++) {\n var image = images[j];\n var imageMetadata = image.getMetadata();\n if (imageMetadata && imageMetadata.length) {\n var imageGroup = new Manifold.MetadataGroup(image);\n imageGroup.addMetadata(imageMetadata);\n metadataGroups.push(imageGroup);\n }\n }\n }\n }\n return metadataGroups;\n };\n Helper.prototype._getRangeMetadata = function (metadataGroups, range) {\n var rangeMetadata = range.getMetadata();\n if (rangeMetadata && rangeMetadata.length) {\n var rangeGroup = new Manifold.MetadataGroup(range);\n rangeGroup.addMetadata(rangeMetadata);\n metadataGroups.push(rangeGroup);\n }\n else if (range.parentRange) {\n return this._getRangeMetadata(metadataGroups, range.parentRange);\n }\n return metadataGroups;\n };\n Helper.prototype.getMultiSelectState = function () {\n if (!this._multiSelectState) {\n this._multiSelectState = new Manifold.MultiSelectState();\n this._multiSelectState.ranges = this.getRanges().slice(0);\n this._multiSelectState.canvases = this.getCurrentSequence().getCanvases().slice(0);\n }\n return this._multiSelectState;\n };\n Helper.prototype.getCurrentRange = function () {\n if (this.rangeId) {\n return this.getRangeById(this.rangeId);\n }\n return null;\n };\n Helper.prototype.getPosterCanvas = function () {\n return this.manifest.getPosterCanvas();\n };\n Helper.prototype.getPosterImage = function () {\n var posterCanvas = this.getPosterCanvas();\n if (posterCanvas) {\n var content = posterCanvas.getContent();\n if (content && content.length) {\n var anno = content[0];\n var body = anno.getBody();\n return body[0].id;\n }\n }\n return null;\n };\n Helper.prototype.getPreviousRange = function (range) {\n var currentRange = null;\n if (range) {\n currentRange = range;\n }\n else {\n currentRange = this.getCurrentRange();\n }\n if (currentRange) {\n var flatTree = this.getFlattenedTree();\n for (var i = 0; i < flatTree.length; i++) {\n var node = flatTree[i];\n // find current range in flattened tree\n if (node.data.id === currentRange.id) {\n // find the first node before it that has canvases\n while (i > 0) {\n i--;\n var prevNode = flatTree[i];\n return prevNode.data;\n }\n break;\n }\n }\n }\n return null;\n };\n Helper.prototype.getNextRange = function (range) {\n // if a range is passed, use that. otherwise get the current range.\n var currentRange = null;\n if (range) {\n currentRange = range;\n }\n else {\n currentRange = this.getCurrentRange();\n }\n if (currentRange) {\n var flatTree = this.getFlattenedTree();\n for (var i = 0; i < flatTree.length; i++) {\n var node = flatTree[i];\n // find current range in flattened tree\n if (node.data.id === currentRange.id) {\n // find the first node after it that has canvases\n while (i < flatTree.length - 1) {\n i++;\n var nextNode = flatTree[i];\n if (nextNode.data.canvases && nextNode.data.canvases.length) {\n return nextNode.data;\n }\n }\n break;\n }\n }\n }\n return null;\n };\n Helper.prototype.getFlattenedTree = function () {\n return this._flattenTree(this.getTree(), 'nodes');\n };\n Helper.prototype._flattenTree = function (root, key) {\n var _this = this;\n var flatten = [Object.assign({}, root)];\n delete flatten[0][key];\n if (root[key] && root[key].length > 0) {\n return flatten.concat(root[key]\n .map(function (child) { return _this._flattenTree(child, key); })\n .reduce(function (a, b) { return a.concat(b); }, []));\n }\n return flatten;\n };\n Helper.prototype.getRanges = function () {\n return this.manifest.getAllRanges();\n };\n Helper.prototype.getRangeByPath = function (path) {\n return this.manifest.getRangeByPath(path);\n };\n Helper.prototype.getRangeById = function (id) {\n return this.manifest.getRangeById(id);\n };\n Helper.prototype.getRangeCanvases = function (range) {\n var ids = range.getCanvasIds();\n return this.getCanvasesById(ids);\n };\n Helper.prototype.getRelated = function () {\n return this.manifest.getRelated();\n };\n Helper.prototype.getSearchService = function () {\n return this.manifest.getService(manifesto.ServiceProfile.search());\n };\n Helper.prototype.getSeeAlso = function () {\n return this.manifest.getSeeAlso();\n };\n Helper.prototype.getSequenceByIndex = function (index) {\n return this.manifest.getSequenceByIndex(index);\n };\n Helper.prototype.getShareServiceUrl = function () {\n var url = null;\n var shareService = this.manifest.getService(manifesto.ServiceProfile.shareExtensions());\n if (shareService) {\n if (shareService.length) {\n shareService = shareService[0];\n }\n url = shareService.__jsonld.shareUrl;\n }\n return url;\n };\n Helper.prototype.getSortedTreeNodesByDate = function (sortedTree, tree) {\n var all = tree.nodes.en().traverseUnique(function (node) { return node.nodes; })\n .where(function (n) { return n.data.type === manifesto.TreeNodeType.collection().toString() ||\n n.data.type === manifesto.TreeNodeType.manifest().toString(); }).toArray();\n //var collections: ITreeNode[] = tree.nodes.en().traverseUnique(n => n.nodes)\n // .where((n) => n.data.type === ITreeNodeType.collection().toString()).toArray();\n var manifests = tree.nodes.en().traverseUnique(function (n) { return n.nodes; })\n .where(function (n) { return n.data.type === manifesto.TreeNodeType.manifest().toString(); }).toArray();\n this.createDecadeNodes(sortedTree, all);\n this.sortDecadeNodes(sortedTree);\n this.createYearNodes(sortedTree, all);\n this.sortYearNodes(sortedTree);\n this.createMonthNodes(sortedTree, manifests);\n this.sortMonthNodes(sortedTree);\n this.createDateNodes(sortedTree, manifests);\n this.pruneDecadeNodes(sortedTree);\n };\n Helper.prototype.getStartCanvasIndex = function () {\n return this.getCurrentSequence().getStartCanvasIndex();\n };\n Helper.prototype.getThumbs = function (width, height) {\n return this.getCurrentSequence().getThumbs(width, height);\n };\n Helper.prototype.getTopRanges = function () {\n return this.manifest.getTopRanges();\n };\n Helper.prototype.getTotalCanvases = function () {\n return this.getCurrentSequence().getTotalCanvases();\n };\n Helper.prototype.getTrackingLabel = function () {\n return this.manifest.getTrackingLabel();\n };\n Helper.prototype._getTopRanges = function () {\n return this.iiifResource.getTopRanges();\n };\n Helper.prototype.getTree = function (topRangeIndex, sortType) {\n // if it's a collection, use IIIFResource.getDefaultTree()\n // otherwise, get the top range by index and use Range.getTree()\n if (topRangeIndex === void 0) { topRangeIndex = 0; }\n if (sortType === void 0) { sortType = Manifold.TreeSortType.NONE; }\n if (!this.iiifResource) {\n return null;\n }\n var tree;\n if (this.iiifResource.isCollection()) {\n tree = this.iiifResource.getDefaultTree();\n }\n else {\n var topRanges = this._getTopRanges();\n var root = new manifesto.TreeNode();\n root.label = 'root';\n root.data = this.iiifResource;\n if (topRanges.length) {\n var range = topRanges[topRangeIndex];\n tree = range.getTree(root);\n }\n else {\n return root;\n }\n }\n var sortedTree = new manifesto.TreeNode();\n switch (sortType.toString()) {\n case Manifold.TreeSortType.DATE.toString():\n // returns a list of treenodes for each decade.\n // expanding a decade generates a list of years\n // expanding a year gives a list of months containing issues\n // expanding a month gives a list of issues.\n if (this.treeHasNavDates(tree)) {\n this.getSortedTreeNodesByDate(sortedTree, tree);\n break;\n }\n default:\n sortedTree = tree;\n }\n return sortedTree;\n };\n Helper.prototype.treeHasNavDates = function (tree) {\n var node = tree.nodes.en().traverseUnique(function (node) { return node.nodes; }).where(function (n) { return !isNaN(n.navDate); }).first();\n return (node) ? true : false;\n };\n Helper.prototype.getViewingDirection = function () {\n var viewingDirection = this.getCurrentSequence().getViewingDirection();\n if (!viewingDirection) {\n viewingDirection = this.manifest.getViewingDirection();\n }\n return viewingDirection;\n };\n Helper.prototype.getViewingHint = function () {\n var viewingHint = this.getCurrentSequence().getViewingHint();\n if (!viewingHint) {\n viewingHint = this.manifest.getViewingHint();\n }\n return viewingHint;\n };\n // inquiries //\n Helper.prototype.hasParentCollection = function () {\n return !!this.manifest.parentCollection;\n };\n Helper.prototype.hasRelatedPage = function () {\n var related = this.getRelated();\n if (!related)\n return false;\n if (related.length) {\n related = related[0];\n }\n return related['format'] === 'text/html';\n };\n Helper.prototype.hasResources = function () {\n var canvas = this.getCurrentCanvas();\n return canvas.getResources().length > 0;\n };\n Helper.prototype.isBottomToTop = function () {\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection) {\n return viewingDirection.toString() === manifesto.ViewingDirection.bottomToTop().toString();\n }\n return false;\n };\n Helper.prototype.isCanvasIndexOutOfRange = function (index) {\n return this.getCurrentSequence().isCanvasIndexOutOfRange(index);\n };\n Helper.prototype.isContinuous = function () {\n var viewingHint = this.getViewingHint();\n if (viewingHint) {\n return viewingHint.toString() === manifesto.ViewingHint.continuous().toString();\n }\n return false;\n };\n Helper.prototype.isFirstCanvas = function (index) {\n if (typeof index !== 'undefined') {\n return this.getCurrentSequence().isFirstCanvas(index);\n }\n return this.getCurrentSequence().isFirstCanvas(this.canvasIndex);\n };\n Helper.prototype.isHorizontallyAligned = function () {\n return this.isLeftToRight() || this.isRightToLeft();\n };\n Helper.prototype.isLastCanvas = function (index) {\n if (typeof index !== 'undefined') {\n return this.getCurrentSequence().isLastCanvas(index);\n }\n return this.getCurrentSequence().isLastCanvas(this.canvasIndex);\n };\n Helper.prototype.isLeftToRight = function () {\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection) {\n return viewingDirection.toString() === manifesto.ViewingDirection.leftToRight().toString();\n }\n return false;\n };\n Helper.prototype.isMultiCanvas = function () {\n return this.getCurrentSequence().isMultiCanvas();\n };\n Helper.prototype.isMultiSequence = function () {\n return this.manifest.isMultiSequence();\n };\n Helper.prototype.isPaged = function () {\n // check the sequence for a viewingHint (deprecated)\n var viewingHint = this.getViewingHint();\n if (viewingHint) {\n return viewingHint.toString() === manifesto.ViewingHint.paged().toString();\n }\n // check the manifest for a viewingHint (deprecated) or paged behavior\n return this.manifest.isPagingEnabled();\n };\n Helper.prototype.isPagingAvailable = function () {\n // paged mode is useless unless you have at least 3 pages...\n return this.isPagingEnabled() && this.getTotalCanvases() > 2;\n };\n Helper.prototype.isPagingEnabled = function () {\n return (this.manifest.isPagingEnabled() || this.getCurrentSequence().isPagingEnabled());\n };\n Helper.prototype.isRightToLeft = function () {\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection) {\n return viewingDirection.toString() === manifesto.ViewingDirection.rightToLeft().toString();\n }\n return false;\n };\n Helper.prototype.isTopToBottom = function () {\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection) {\n return viewingDirection.toString() === manifesto.ViewingDirection.topToBottom().toString();\n }\n return false;\n };\n Helper.prototype.isTotalCanvasesEven = function () {\n return this.getCurrentSequence().isTotalCanvasesEven();\n };\n Helper.prototype.isUIEnabled = function (name) {\n var uiExtensions = this.manifest.getService(manifesto.ServiceProfile.uiExtensions());\n if (uiExtensions) {\n var disableUI = uiExtensions.getProperty('disableUI');\n if (disableUI) {\n if (disableUI.indexOf(name) !== -1 || disableUI.indexOf(name.toLowerCase()) !== -1) {\n return false;\n }\n }\n }\n return true;\n };\n Helper.prototype.isVerticallyAligned = function () {\n return this.isTopToBottom() || this.isBottomToTop();\n };\n // dates // \n Helper.prototype.createDateNodes = function (rootNode, nodes) {\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n var year = this.getNodeYear(node);\n var month = this.getNodeMonth(node);\n var dateNode = new manifesto.TreeNode();\n dateNode.id = node.id;\n dateNode.label = this.getNodeDisplayDate(node);\n dateNode.data = node.data;\n dateNode.data.type = manifesto.TreeNodeType.manifest().toString();\n dateNode.data.year = year;\n dateNode.data.month = month;\n var decadeNode = this.getDecadeNode(rootNode, year);\n if (decadeNode) {\n var yearNode = this.getYearNode(decadeNode, year);\n if (yearNode) {\n var monthNode = this.getMonthNode(yearNode, month);\n if (monthNode) {\n monthNode.addNode(dateNode);\n }\n }\n }\n }\n };\n Helper.prototype.createDecadeNodes = function (rootNode, nodes) {\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n var year = this.getNodeYear(node);\n var endYear = Number(year.toString().substr(0, 3) + \"9\");\n if (!this.getDecadeNode(rootNode, year)) {\n var decadeNode = new manifesto.TreeNode();\n decadeNode.label = year + \" - \" + endYear;\n decadeNode.navDate = node.navDate;\n decadeNode.data.startYear = year;\n decadeNode.data.endYear = endYear;\n rootNode.addNode(decadeNode);\n }\n }\n };\n Helper.prototype.createMonthNodes = function (rootNode, nodes) {\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n var year = this.getNodeYear(node);\n var month = this.getNodeMonth(node);\n var decadeNode = this.getDecadeNode(rootNode, year);\n var yearNode = null;\n if (decadeNode) {\n yearNode = this.getYearNode(decadeNode, year);\n }\n if (decadeNode && yearNode && !this.getMonthNode(yearNode, month)) {\n var monthNode = new manifesto.TreeNode();\n monthNode.label = this.getNodeDisplayMonth(node);\n monthNode.navDate = node.navDate;\n monthNode.data.year = year;\n monthNode.data.month = month;\n yearNode.addNode(monthNode);\n }\n }\n };\n Helper.prototype.createYearNodes = function (rootNode, nodes) {\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n var year = this.getNodeYear(node);\n var decadeNode = this.getDecadeNode(rootNode, year);\n if (decadeNode && !this.getYearNode(decadeNode, year)) {\n var yearNode = new manifesto.TreeNode();\n yearNode.label = year.toString();\n yearNode.navDate = node.navDate;\n yearNode.data.year = year;\n decadeNode.addNode(yearNode);\n }\n }\n };\n Helper.prototype.getDecadeNode = function (rootNode, year) {\n for (var i = 0; i < rootNode.nodes.length; i++) {\n var n = rootNode.nodes[i];\n if (year >= n.data.startYear && year <= n.data.endYear)\n return n;\n }\n return null;\n };\n Helper.prototype.getMonthNode = function (yearNode, month) {\n for (var i = 0; i < yearNode.nodes.length; i++) {\n var n = yearNode.nodes[i];\n if (month === this.getNodeMonth(n))\n return n;\n }\n return null;\n };\n Helper.prototype.getNodeDisplayDate = function (node) {\n return node.navDate.toDateString();\n };\n Helper.prototype.getNodeDisplayMonth = function (node) {\n var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n return months[node.navDate.getMonth()];\n };\n Helper.prototype.getNodeMonth = function (node) {\n return node.navDate.getMonth();\n };\n Helper.prototype.getNodeYear = function (node) {\n return node.navDate.getFullYear();\n };\n Helper.prototype.getYearNode = function (decadeNode, year) {\n for (var i = 0; i < decadeNode.nodes.length; i++) {\n var n = decadeNode.nodes[i];\n if (year === this.getNodeYear(n))\n return n;\n }\n return null;\n };\n // delete any empty decades\n Helper.prototype.pruneDecadeNodes = function (rootNode) {\n var pruned = [];\n for (var i = 0; i < rootNode.nodes.length; i++) {\n var n = rootNode.nodes[i];\n if (!n.nodes.length) {\n pruned.push(n);\n }\n }\n for (var j = 0; j < pruned.length; j++) {\n var p = pruned[j];\n var index = rootNode.nodes.indexOf(p);\n if (index > -1) {\n rootNode.nodes.splice(index, 1);\n }\n }\n };\n Helper.prototype.sortDecadeNodes = function (rootNode) {\n rootNode.nodes = rootNode.nodes.sort(function (a, b) {\n return a.data.startYear - b.data.startYear;\n });\n };\n Helper.prototype.sortMonthNodes = function (rootNode) {\n var _this = this;\n for (var i = 0; i < rootNode.nodes.length; i++) {\n var decadeNode = rootNode.nodes[i];\n for (var j = 0; j < decadeNode.nodes.length; j++) {\n var monthNode = decadeNode.nodes[j];\n monthNode.nodes = monthNode.nodes.sort(function (a, b) {\n return _this.getNodeMonth(a) - _this.getNodeMonth(b);\n });\n }\n }\n };\n Helper.prototype.sortYearNodes = function (rootNode) {\n var _this = this;\n for (var i = 0; i < rootNode.nodes.length; i++) {\n var decadeNode = rootNode.nodes[i];\n decadeNode.nodes = decadeNode.nodes.sort(function (a, b) {\n return (_this.getNodeYear(a) - _this.getNodeYear(b));\n });\n }\n };\n return Helper;\n }());\n Manifold.Helper = Helper;\n})(Manifold || (Manifold = {}));\n\n\n\nvar Manifold;\n(function (Manifold) {\n var ILabelValuePair = /** @class */ (function () {\n function ILabelValuePair() {\n }\n return ILabelValuePair;\n }());\n Manifold.ILabelValuePair = ILabelValuePair;\n})(Manifold || (Manifold = {}));\n\n\n\n\n\n\n\n\n/// \n/// \nvar Manifold;\n(function (Manifold) {\n function loadManifest(options) {\n var bootstrapper = new Manifold.Bootstrapper(options);\n return bootstrapper.bootstrap();\n }\n Manifold.loadManifest = loadManifest;\n})(Manifold || (Manifold = {}));\n(function (g) {\n if (!g.Manifold) {\n g.Manifold = Manifold;\n }\n})(global);\n\nvar Manifold;\n(function (Manifold) {\n var MetadataGroup = /** @class */ (function () {\n function MetadataGroup(resource, label) {\n this.items = [];\n this.resource = resource;\n this.label = label;\n }\n MetadataGroup.prototype.addItem = function (item) {\n this.items.push(item);\n };\n MetadataGroup.prototype.addMetadata = function (metadata, isRootLevel) {\n if (isRootLevel === void 0) { isRootLevel = false; }\n for (var i = 0; i < metadata.length; i++) {\n var item = metadata[i];\n item.isRootLevel = isRootLevel;\n this.addItem(item);\n }\n };\n return MetadataGroup;\n }());\n Manifold.MetadataGroup = MetadataGroup;\n})(Manifold || (Manifold = {}));\n\nvar Manifold;\n(function (Manifold) {\n var MetadataOptions = /** @class */ (function () {\n function MetadataOptions() {\n }\n return MetadataOptions;\n }());\n Manifold.MetadataOptions = MetadataOptions;\n})(Manifold || (Manifold = {}));\n\nvar Manifold;\n(function (Manifold) {\n var MultiSelectState = /** @class */ (function () {\n function MultiSelectState() {\n this.isEnabled = false;\n this.ranges = [];\n this.canvases = [];\n }\n MultiSelectState.prototype.allCanvasesSelected = function () {\n return this.canvases.length > 0 && this.getAllSelectedCanvases().length === this.canvases.length;\n };\n MultiSelectState.prototype.allRangesSelected = function () {\n return this.ranges.length > 0 && this.getAllSelectedRanges().length === this.ranges.length;\n };\n MultiSelectState.prototype.allSelected = function () {\n return this.allRangesSelected() && this.allCanvasesSelected();\n };\n MultiSelectState.prototype.getAll = function () {\n return this.canvases.concat(this.ranges);\n };\n MultiSelectState.prototype.getAllSelectedCanvases = function () {\n return this.canvases.en().where(function (c) { return c.multiSelected; }).toArray();\n };\n MultiSelectState.prototype.getAllSelectedRanges = function () {\n return this.ranges.en().where(function (r) { return r.multiSelected; }).toArray();\n };\n MultiSelectState.prototype.getCanvasById = function (id) {\n return this.canvases.en().where(function (c) { return manifesto.Utils.normaliseUrl(c.id) === manifesto.Utils.normaliseUrl(id); }).first();\n };\n MultiSelectState.prototype.getCanvasesByIds = function (ids) {\n var canvases = [];\n for (var i = 0; i < ids.length; i++) {\n var id = ids[i];\n canvases.push(this.getCanvasById(id));\n }\n return canvases;\n };\n MultiSelectState.prototype.getRangeCanvases = function (range) {\n var ids = range.getCanvasIds();\n return this.getCanvasesByIds(ids);\n };\n MultiSelectState.prototype.selectAll = function (selected) {\n this.selectRanges(this.ranges, selected);\n this.selectCanvases(this.canvases, selected);\n };\n MultiSelectState.prototype.selectCanvas = function (canvas, selected) {\n var c = this.canvases.en().where(function (c) { return c.id === canvas.id; }).first();\n c.multiSelected = selected;\n };\n MultiSelectState.prototype.selectAllCanvases = function (selected) {\n this.selectCanvases(this.canvases, selected);\n };\n MultiSelectState.prototype.selectCanvases = function (canvases, selected) {\n for (var j = 0; j < canvases.length; j++) {\n var canvas = canvases[j];\n canvas.multiSelected = selected;\n }\n };\n MultiSelectState.prototype.selectRange = function (range, selected) {\n var r = this.ranges.en().where(function (r) { return r.id === range.id; }).first();\n r.multiSelected = selected;\n var canvases = this.getRangeCanvases(r);\n this.selectCanvases(canvases, selected);\n };\n MultiSelectState.prototype.selectAllRanges = function (selected) {\n this.selectRanges(this.ranges, selected);\n };\n MultiSelectState.prototype.selectRanges = function (ranges, selected) {\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n range.multiSelected = selected;\n var canvases = this.getCanvasesByIds(range.getCanvasIds());\n this.selectCanvases(canvases, selected);\n }\n };\n MultiSelectState.prototype.setEnabled = function (enabled) {\n this.isEnabled = enabled;\n var items = this.getAll();\n for (var i = 0; i < items.length; i++) {\n var item = items[i];\n item.multiSelectEnabled = this.isEnabled;\n if (!enabled) {\n item.multiSelected = false;\n }\n }\n };\n return MultiSelectState;\n }());\n Manifold.MultiSelectState = MultiSelectState;\n})(Manifold || (Manifold = {}));\n\nvar Manifold;\n(function (Manifold) {\n var Translation = /** @class */ (function () {\n function Translation(value, locale) {\n this.value = value;\n this.locale = locale;\n }\n return Translation;\n }());\n Manifold.Translation = Translation;\n})(Manifold || (Manifold = {}));\n\nvar Manifold;\n(function (Manifold) {\n // This class formats URIs into HTML links, applying labels when available\n var UriLabeller = /** @class */ (function () {\n function UriLabeller(labels) {\n this.labels = labels;\n }\n UriLabeller.prototype.format = function (url) {\n // if already a link, do nothing.\n if (url.indexOf('' + label + '';\n };\n return UriLabeller;\n }());\n Manifold.UriLabeller = UriLabeller;\n})(Manifold || (Manifold = {}));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}]},{},[1])(1)\n});\n\n", - "var Utils;\r\n(function (Utils) {\r\n var Async = /** @class */ (function () {\r\n function Async() {\r\n }\r\n Async.waitFor = function (test, successCallback, failureCallback, interval, maxTries, numTries) {\r\n if (!interval)\r\n interval = 200;\r\n if (!maxTries)\r\n maxTries = 100; // try 100 times over 20 seconds\r\n if (!numTries)\r\n numTries = 0;\r\n numTries += 1;\r\n if (numTries > maxTries) {\r\n if (failureCallback)\r\n failureCallback();\r\n }\r\n else if (test()) {\r\n successCallback();\r\n }\r\n else {\r\n setTimeout(function () {\r\n Async.waitFor(test, successCallback, failureCallback, interval, maxTries, numTries);\r\n }, interval);\r\n }\r\n };\r\n return Async;\r\n }());\r\n Utils.Async = Async;\r\n var Bools = /** @class */ (function () {\r\n function Bools() {\r\n }\r\n Bools.getBool = function (val, defaultVal) {\r\n if (val === null || typeof (val) === 'undefined') {\r\n return defaultVal;\r\n }\r\n return val;\r\n };\r\n return Bools;\r\n }());\r\n Utils.Bools = Bools;\r\n var Clipboard = /** @class */ (function () {\r\n function Clipboard() {\r\n }\r\n Clipboard.supportsCopy = function () {\r\n return document.queryCommandSupported && document.queryCommandSupported('copy');\r\n };\r\n Clipboard.copy = function (text) {\r\n text = Clipboard.convertBrToNewLine(text);\r\n var textArea = document.createElement(\"textarea\");\r\n textArea.value = text;\r\n Clipboard.hideButKeepEnabled(textArea);\r\n document.body.appendChild(textArea);\r\n textArea.focus();\r\n textArea.select();\r\n document.execCommand('copy');\r\n document.body.removeChild(textArea);\r\n };\r\n Clipboard.hideButKeepEnabled = function (textArea) {\r\n // Place in top-left corner of screen regardless of scroll position.\r\n textArea.style.position = 'fixed';\r\n textArea.style.top = '0';\r\n textArea.style.left = '0';\r\n // Ensure it has a small width and height. Setting to 1px / 1em\r\n // doesn't work as this gives a negative w/h on some browsers.\r\n textArea.style.width = '2em';\r\n textArea.style.height = '2em';\r\n // We don't need padding, reducing the size if it does flash render.\r\n textArea.style.padding = '0';\r\n // Clean up any borders.\r\n textArea.style.border = 'none';\r\n textArea.style.outline = 'none';\r\n textArea.style.boxShadow = 'none';\r\n // Avoid flash of white box if rendered for any reason.\r\n textArea.style.background = 'transparent';\r\n };\r\n Clipboard.convertBrToNewLine = function (text) {\r\n var brRegex = //gi;\r\n text = text.replace(brRegex, \"\\n\");\r\n return text;\r\n };\r\n return Clipboard;\r\n }());\r\n Utils.Clipboard = Clipboard;\r\n var Colors = /** @class */ (function () {\r\n function Colors() {\r\n }\r\n Colors.float32ColorToARGB = function (float32Color) {\r\n var a = (float32Color & 0xff000000) >>> 24;\r\n var r = (float32Color & 0xff0000) >>> 16;\r\n var g = (float32Color & 0xff00) >>> 8;\r\n var b = float32Color & 0xff;\r\n var result = [a, r, g, b];\r\n return result;\r\n };\r\n Colors._componentToHex = function (c) {\r\n var hex = c.toString(16);\r\n return hex.length == 1 ? \"0\" + hex : hex;\r\n };\r\n Colors.rgbToHexString = function (rgb) {\r\n Colors.coalesce(rgb);\r\n return \"#\" + Colors._componentToHex(rgb[0]) + Colors._componentToHex(rgb[1]) + Colors._componentToHex(rgb[2]);\r\n };\r\n Colors.argbToHexString = function (argb) {\r\n return \"#\" + Colors._componentToHex(argb[0]) + Colors._componentToHex(argb[1]) + Colors._componentToHex(argb[2]) + Colors._componentToHex(argb[3]);\r\n };\r\n Colors.coalesce = function (arr) {\r\n for (var i = 1; i < arr.length; i++) {\r\n if (typeof (arr[i]) === 'undefined')\r\n arr[i] = arr[i - 1];\r\n }\r\n };\r\n return Colors;\r\n }());\r\n Utils.Colors = Colors;\r\n var Dates = /** @class */ (function () {\r\n function Dates() {\r\n }\r\n Dates.getTimeStamp = function () {\r\n return new Date().getTime();\r\n };\r\n return Dates;\r\n }());\r\n Utils.Dates = Dates;\r\n var Device = /** @class */ (function () {\r\n function Device() {\r\n }\r\n Device.getPixelRatio = function (ctx) {\r\n var dpr = window.devicePixelRatio || 1;\r\n var bsr = ctx.webkitBackingStorePixelRatio ||\r\n ctx.mozBackingStorePixelRatio ||\r\n ctx.msBackingStorePixelRatio ||\r\n ctx.oBackingStorePixelRatio ||\r\n ctx.backingStorePixelRatio || 1;\r\n return dpr / bsr;\r\n };\r\n Device.isTouch = function () {\r\n return !!(\"ontouchstart\" in window) || window.navigator.msMaxTouchPoints > 0;\r\n };\r\n return Device;\r\n }());\r\n Utils.Device = Device;\r\n var Documents = /** @class */ (function () {\r\n function Documents() {\r\n }\r\n Documents.isInIFrame = function () {\r\n // see http://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t\r\n try {\r\n return window.self !== window.top;\r\n }\r\n catch (e) {\r\n return true;\r\n }\r\n };\r\n Documents.supportsFullscreen = function () {\r\n var doc = document.documentElement;\r\n var support = doc.requestFullscreen || doc.mozRequestFullScreen ||\r\n doc.webkitRequestFullScreen || doc.msRequestFullscreen;\r\n return support !== undefined;\r\n };\r\n Documents.isHidden = function () {\r\n var prop = Documents.getHiddenProp();\r\n if (!prop)\r\n return false;\r\n return true;\r\n //return document[prop];\r\n };\r\n Documents.getHiddenProp = function () {\r\n var prefixes = ['webkit', 'moz', 'ms', 'o'];\r\n // if 'hidden' is natively supported just return it\r\n if ('hidden' in document)\r\n return 'hidden';\r\n // otherwise loop over all the known prefixes until we find one\r\n for (var i = 0; i < prefixes.length; i++) {\r\n if ((prefixes[i] + 'Hidden') in document) {\r\n return prefixes[i] + 'Hidden';\r\n }\r\n }\r\n // otherwise it's not supported\r\n return null;\r\n };\r\n return Documents;\r\n }());\r\n Utils.Documents = Documents;\r\n var Events = /** @class */ (function () {\r\n function Events() {\r\n }\r\n Events.debounce = function (fn, debounceDuration) {\r\n // summary:\r\n // Returns a debounced function that will make sure the given\r\n // function is not triggered too much.\r\n // fn: Function\r\n // Function to debounce.\r\n // debounceDuration: Number\r\n // OPTIONAL. The amount of time in milliseconds for which we\r\n // will debounce the function. (defaults to 100ms)\r\n debounceDuration = debounceDuration || 100;\r\n return function () {\r\n if (!fn.debouncing) {\r\n var args = Array.prototype.slice.apply(arguments);\r\n fn.lastReturnVal = fn.apply(window, args);\r\n fn.debouncing = true;\r\n }\r\n clearTimeout(fn.debounceTimeout);\r\n fn.debounceTimeout = setTimeout(function () {\r\n fn.debouncing = false;\r\n }, debounceDuration);\r\n return fn.lastReturnVal;\r\n };\r\n };\r\n return Events;\r\n }());\r\n Utils.Events = Events;\r\n var Files = /** @class */ (function () {\r\n function Files() {\r\n }\r\n Files.simplifyMimeType = function (mime) {\r\n switch (mime) {\r\n case 'text/plain':\r\n return 'txt';\r\n case 'image/jpeg':\r\n return 'jpg';\r\n case 'application/msword':\r\n return 'doc';\r\n case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':\r\n return 'docx';\r\n default:\r\n var parts = mime.split('/');\r\n return parts[parts.length - 1];\r\n }\r\n };\r\n return Files;\r\n }());\r\n Utils.Files = Files;\r\n var Keyboard = /** @class */ (function () {\r\n function Keyboard() {\r\n }\r\n Keyboard.getCharCode = function (e) {\r\n var charCode = (typeof e.which == \"number\") ? e.which : e.keyCode;\r\n return charCode;\r\n };\r\n return Keyboard;\r\n }());\r\n Utils.Keyboard = Keyboard;\r\n var Maths = /** @class */ (function () {\r\n function Maths() {\r\n }\r\n Maths.normalise = function (num, min, max) {\r\n return (num - min) / (max - min);\r\n };\r\n Maths.median = function (values) {\r\n values.sort(function (a, b) {\r\n return a - b;\r\n });\r\n var half = Math.floor(values.length / 2);\r\n if (values.length % 2) {\r\n return values[half];\r\n }\r\n else {\r\n return (values[half - 1] + values[half]) / 2.0;\r\n }\r\n };\r\n Maths.clamp = function (value, min, max) {\r\n return Math.min(Math.max(value, min), max);\r\n };\r\n return Maths;\r\n }());\r\n Utils.Maths = Maths;\r\n var Size = /** @class */ (function () {\r\n function Size(width, height) {\r\n this.width = width;\r\n this.height = height;\r\n }\r\n return Size;\r\n }());\r\n Utils.Size = Size;\r\n var Dimensions = /** @class */ (function () {\r\n function Dimensions() {\r\n }\r\n Dimensions.fitRect = function (width1, height1, width2, height2) {\r\n var ratio1 = height1 / width1;\r\n var ratio2 = height2 / width2;\r\n var width = 0;\r\n var height = 0;\r\n var scale;\r\n if (ratio1 < ratio2) {\r\n scale = width2 / width1;\r\n width = width1 * scale;\r\n height = height1 * scale;\r\n }\r\n else {\r\n scale = height2 / height1;\r\n width = width1 * scale;\r\n height = height1 * scale;\r\n }\r\n return new Size(Math.floor(width), Math.floor(height));\r\n };\r\n Dimensions.hitRect = function (x, y, w, h, mx, my) {\r\n if (mx > x && mx < (x + w) && my > y && my < (y + h)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n return Dimensions;\r\n }());\r\n Utils.Dimensions = Dimensions;\r\n var Numbers = /** @class */ (function () {\r\n function Numbers() {\r\n }\r\n Numbers.numericalInput = function (event) {\r\n // Allow: backspace, delete, tab and escape\r\n if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 ||\r\n // Allow: Ctrl+A\r\n (event.keyCode == 65 && event.ctrlKey === true) ||\r\n // Allow: home, end, left, right\r\n (event.keyCode >= 35 && event.keyCode <= 39)) {\r\n // let it happen, don't do anything\r\n return true;\r\n }\r\n else {\r\n // Ensure that it is a number and stop the keypress\r\n if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) {\r\n event.preventDefault();\r\n return false;\r\n }\r\n return true;\r\n }\r\n };\r\n return Numbers;\r\n }());\r\n Utils.Numbers = Numbers;\r\n var Objects = /** @class */ (function () {\r\n function Objects() {\r\n }\r\n Objects.toPlainObject = function (value) {\r\n value = Object(value);\r\n var result = {};\r\n for (var key in value) {\r\n result[key] = value[key];\r\n }\r\n return result;\r\n };\r\n return Objects;\r\n }());\r\n Utils.Objects = Objects;\r\n var Storage = /** @class */ (function () {\r\n function Storage() {\r\n }\r\n Storage.clear = function (storageType) {\r\n if (storageType === void 0) { storageType = StorageType.memory; }\r\n switch (storageType.value) {\r\n case StorageType.memory.value:\r\n this._memoryStorage = {};\r\n break;\r\n case StorageType.session.value:\r\n sessionStorage.clear();\r\n break;\r\n case StorageType.local.value:\r\n localStorage.clear();\r\n break;\r\n }\r\n };\r\n Storage.clearExpired = function (storageType) {\r\n if (storageType === void 0) { storageType = StorageType.memory; }\r\n var items = this.getItems(storageType);\r\n for (var i = 0; i < items.length; i++) {\r\n var item = items[i];\r\n if (this._isExpired(item)) {\r\n this.remove(item.key);\r\n }\r\n }\r\n };\r\n Storage.get = function (key, storageType) {\r\n if (storageType === void 0) { storageType = StorageType.memory; }\r\n var data = null;\r\n switch (storageType.value) {\r\n case StorageType.memory.value:\r\n data = this._memoryStorage[key];\r\n break;\r\n case StorageType.session.value:\r\n data = sessionStorage.getItem(key);\r\n break;\r\n case StorageType.local.value:\r\n data = localStorage.getItem(key);\r\n break;\r\n }\r\n if (!data)\r\n return null;\r\n var item = null;\r\n try {\r\n item = JSON.parse(data);\r\n }\r\n catch (error) {\r\n return null;\r\n }\r\n if (!item)\r\n return null;\r\n if (this._isExpired(item))\r\n return null;\r\n // useful reference\r\n item.key = key;\r\n return item;\r\n };\r\n Storage._isExpired = function (item) {\r\n if (new Date().getTime() < item.expiresAt) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n Storage.getItems = function (storageType) {\r\n if (storageType === void 0) { storageType = StorageType.memory; }\r\n var items = [];\r\n switch (storageType.value) {\r\n case StorageType.memory.value:\r\n var keys = Object.keys(this._memoryStorage);\r\n for (var i = 0; i < keys.length; i++) {\r\n var item = this.get(keys[i], StorageType.memory);\r\n if (item) {\r\n items.push(item);\r\n }\r\n }\r\n break;\r\n case StorageType.session.value:\r\n for (var i = 0; i < sessionStorage.length; i++) {\r\n var key = sessionStorage.key(i);\r\n if (key) {\r\n var item = this.get(key, StorageType.session);\r\n if (item) {\r\n items.push(item);\r\n }\r\n }\r\n }\r\n break;\r\n case StorageType.local.value:\r\n for (var i = 0; i < localStorage.length; i++) {\r\n var key = localStorage.key(i);\r\n if (key) {\r\n var item = this.get(key, StorageType.local);\r\n if (item) {\r\n items.push(item);\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n return items;\r\n };\r\n Storage.remove = function (key, storageType) {\r\n if (storageType === void 0) { storageType = StorageType.memory; }\r\n switch (storageType.value) {\r\n case StorageType.memory.value:\r\n delete this._memoryStorage[key];\r\n break;\r\n case StorageType.session.value:\r\n sessionStorage.removeItem(key);\r\n break;\r\n case StorageType.local.value:\r\n localStorage.removeItem(key);\r\n break;\r\n }\r\n };\r\n Storage.set = function (key, value, expirationSecs, storageType) {\r\n if (storageType === void 0) { storageType = StorageType.memory; }\r\n var expirationMS = expirationSecs * 1000;\r\n var record = new StorageItem();\r\n record.value = value;\r\n record.expiresAt = new Date().getTime() + expirationMS;\r\n switch (storageType.value) {\r\n case StorageType.memory.value:\r\n this._memoryStorage[key] = JSON.stringify(record);\r\n break;\r\n case StorageType.session.value:\r\n sessionStorage.setItem(key, JSON.stringify(record));\r\n break;\r\n case StorageType.local.value:\r\n localStorage.setItem(key, JSON.stringify(record));\r\n break;\r\n }\r\n return record;\r\n };\r\n Storage._memoryStorage = {};\r\n return Storage;\r\n }());\r\n Utils.Storage = Storage;\r\n var StorageItem = /** @class */ (function () {\r\n function StorageItem() {\r\n }\r\n return StorageItem;\r\n }());\r\n Utils.StorageItem = StorageItem;\r\n var StorageType = /** @class */ (function () {\r\n function StorageType(value) {\r\n this.value = value;\r\n }\r\n StorageType.prototype.toString = function () {\r\n return this.value;\r\n };\r\n StorageType.memory = new StorageType(\"memory\");\r\n StorageType.session = new StorageType(\"session\");\r\n StorageType.local = new StorageType(\"local\");\r\n return StorageType;\r\n }());\r\n Utils.StorageType = StorageType;\r\n var Strings = /** @class */ (function () {\r\n function Strings() {\r\n }\r\n Strings.ellipsis = function (text, chars) {\r\n if (text.length <= chars)\r\n return text;\r\n var trimmedText = text.substr(0, chars);\r\n var lastSpaceIndex = trimmedText.lastIndexOf(\" \");\r\n if (lastSpaceIndex != -1) {\r\n trimmedText = trimmedText.substr(0, Math.min(trimmedText.length, lastSpaceIndex));\r\n }\r\n return trimmedText + \"…\";\r\n };\r\n Strings.htmlDecode = function (encoded) {\r\n var div = document.createElement('div');\r\n div.innerHTML = encoded;\r\n return div.firstChild.nodeValue;\r\n };\r\n Strings.format = function (str) {\r\n var values = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n values[_i - 1] = arguments[_i];\r\n }\r\n for (var i = 0; i < values.length; i++) {\r\n var reg = new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\");\r\n str = str.replace(reg, values[i]);\r\n }\r\n return str;\r\n };\r\n Strings.isAlphanumeric = function (str) {\r\n return /^[a-zA-Z0-9]*$/.test(str);\r\n };\r\n Strings.toCssClass = function (str) {\r\n return str.replace(/[^a-z0-9]/g, function (s) {\r\n var c = s.charCodeAt(0);\r\n if (c == 32)\r\n return '-';\r\n if (c >= 65 && c <= 90)\r\n return '_' + s.toLowerCase();\r\n return '__' + ('000' + c.toString(16)).slice(-4);\r\n });\r\n };\r\n Strings.toFileName = function (str) {\r\n return str.replace(/[^a-z0-9]/gi, '_').toLowerCase();\r\n };\r\n Strings.utf8_to_b64 = function (str) {\r\n return window.btoa(unescape(encodeURIComponent(str)));\r\n };\r\n return Strings;\r\n }());\r\n Utils.Strings = Strings;\r\n var Urls = /** @class */ (function () {\r\n function Urls() {\r\n }\r\n Urls.getHashParameter = function (key, doc) {\r\n if (!doc)\r\n doc = window.document;\r\n if (doc && doc.location) {\r\n return this.getHashParameterFromString(key, doc.location.hash);\r\n }\r\n return null;\r\n };\r\n Urls.getHashParameterFromString = function (key, url) {\r\n var regex = new RegExp(\"#.*[?&]\" + key + \"=([^&]+)(&|$)\");\r\n var match = regex.exec(url);\r\n return (match ? decodeURIComponent(match[1].replace(/\\+/g, \" \")) : null);\r\n };\r\n Urls.setHashParameter = function (key, value, doc) {\r\n if (!doc)\r\n doc = window.document;\r\n if (doc && doc.location) {\r\n var kvp = this.updateURIKeyValuePair(doc.location.hash.replace('#?', ''), key, value);\r\n var newHash = \"#?\" + kvp;\r\n var url = doc.URL;\r\n // remove hash value (if present).\r\n var index = url.indexOf('#');\r\n if (index != -1) {\r\n url = url.substr(0, url.indexOf('#'));\r\n }\r\n doc.location.replace(url + newHash);\r\n }\r\n };\r\n Urls.getQuerystringParameter = function (key, w) {\r\n if (!w)\r\n w = window;\r\n return this.getQuerystringParameterFromString(key, w.location.search);\r\n };\r\n Urls.getQuerystringParameterFromString = function (key, querystring) {\r\n key = key.replace(/[\\[]/, \"\\\\\\[\").replace(/[\\]]/, \"\\\\\\]\");\r\n var regex = new RegExp(\"[\\\\?&]\" + key + \"=([^&#]*)\");\r\n var match = regex.exec(querystring);\r\n return (match ? decodeURIComponent(match[1].replace(/\\+/g, \" \")) : null);\r\n };\r\n Urls.setQuerystringParameter = function (key, value, doc) {\r\n if (!doc)\r\n doc = window.document;\r\n if (doc && doc.location) {\r\n var kvp = this.updateURIKeyValuePair(doc.location.hash.replace('#?', ''), key, value);\r\n // redirects.\r\n window.location.search = kvp;\r\n }\r\n };\r\n Urls.updateURIKeyValuePair = function (uriSegment, key, value) {\r\n key = encodeURIComponent(key);\r\n value = encodeURIComponent(value);\r\n var kvp = uriSegment.split('&');\r\n // Array.split() returns an array with a single \"\" item\r\n // if the target string is empty. remove if present.\r\n if (kvp[0] == \"\")\r\n kvp.shift();\r\n var i = kvp.length;\r\n var x;\r\n // replace if already present.\r\n while (i--) {\r\n x = kvp[i].split('=');\r\n if (x[0] == key) {\r\n x[1] = value;\r\n kvp[i] = x.join('=');\r\n break;\r\n }\r\n }\r\n // not found, so append.\r\n if (i < 0) {\r\n kvp[kvp.length] = [key, value].join('=');\r\n }\r\n return kvp.join('&');\r\n };\r\n Urls.getUrlParts = function (url) {\r\n var a = document.createElement('a');\r\n a.href = url;\r\n return a;\r\n };\r\n Urls.convertToRelativeUrl = function (url) {\r\n var parts = this.getUrlParts(url);\r\n var relUri = parts.pathname + parts.searchWithin;\r\n if (!relUri.startsWith(\"/\")) {\r\n relUri = \"/\" + relUri;\r\n }\r\n return relUri;\r\n };\r\n return Urls;\r\n }());\r\n Utils.Urls = Urls;\r\n})(Utils || (Utils = {}));\r\nwindow.Utils = Utils;\r\n\ndefine(\"lib/Utils.js\", function(){});\n\n", - "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o/g;var REGEXP_QUOTE=/\"/g;var REGEXP_QUOTE_2=/"/g;var REGEXP_ATTR_VALUE_1=/&#([a-zA-Z0-9]*);?/gim;var REGEXP_ATTR_VALUE_COLON=/:?/gim;var REGEXP_ATTR_VALUE_NEWLINE=/&newline;?/gim;var REGEXP_DEFAULT_ON_TAG_ATTR_3=/\\/\\*|\\*\\//gm;var REGEXP_DEFAULT_ON_TAG_ATTR_4=/((j\\s*a\\s*v\\s*a|v\\s*b|l\\s*i\\s*v\\s*e)\\s*s\\s*c\\s*r\\s*i\\s*p\\s*t\\s*|m\\s*o\\s*c\\s*h\\s*a)\\:/gi;var REGEXP_DEFAULT_ON_TAG_ATTR_5=/^[\\s\"'`]*(d\\s*a\\s*t\\s*a\\s*)\\:/gi;var REGEXP_DEFAULT_ON_TAG_ATTR_6=/^[\\s\"'`]*(d\\s*a\\s*t\\s*a\\s*)\\:\\s*image\\//gi;var REGEXP_DEFAULT_ON_TAG_ATTR_7=/e\\s*x\\s*p\\s*r\\s*e\\s*s\\s*s\\s*i\\s*o\\s*n\\s*\\(.*/gi;var REGEXP_DEFAULT_ON_TAG_ATTR_8=/u\\s*r\\s*l\\s*\\(.*/gi;function escapeQuote(str){return str.replace(REGEXP_QUOTE,\""\")}function unescapeQuote(str){return str.replace(REGEXP_QUOTE_2,'\"')}function escapeHtmlEntities(str){return str.replace(REGEXP_ATTR_VALUE_1,function replaceUnicode(str,code){return code[0]===\"x\"||code[0]===\"X\"?String.fromCharCode(parseInt(code.substr(1),16)):String.fromCharCode(parseInt(code,10))})}function escapeDangerHtml5Entities(str){return str.replace(REGEXP_ATTR_VALUE_COLON,\":\").replace(REGEXP_ATTR_VALUE_NEWLINE,\" \")}function clearNonPrintableCharacter(str){var str2=\"\";for(var i=0,len=str.length;i/g;function stripBlankChar(html){var chars=html.split(\"\");chars=chars.filter(function(char){var c=char.charCodeAt(0);if(c===127)return false;if(c<=31){if(c===10||c===13)return true;return false}return true});return chars.join(\"\")}exports.whiteList=getDefaultWhiteList();exports.getDefaultWhiteList=getDefaultWhiteList;exports.onTag=onTag;exports.onIgnoreTag=onIgnoreTag;exports.onTagAttr=onTagAttr;exports.onIgnoreTagAttr=onIgnoreTagAttr;exports.safeAttrValue=safeAttrValue;exports.escapeHtml=escapeHtml;exports.escapeQuote=escapeQuote;exports.unescapeQuote=unescapeQuote;exports.escapeHtmlEntities=escapeHtmlEntities;exports.escapeDangerHtml5Entities=escapeDangerHtml5Entities;exports.clearNonPrintableCharacter=clearNonPrintableCharacter;exports.friendlyAttrValue=friendlyAttrValue;exports.escapeAttrValue=escapeAttrValue;exports.onIgnoreTagStripAll=onIgnoreTagStripAll;exports.StripTagBody=StripTagBody;exports.stripCommentTag=stripCommentTag;exports.stripBlankChar=stripBlankChar;exports.cssFilter=defaultCSSFilter;exports.getDefaultCSSWhiteList=getDefaultCSSWhiteList},{\"./util\":4,cssfilter:8}],2:[function(require,module,exports){var DEFAULT=require(\"./default\");var parser=require(\"./parser\");var FilterXSS=require(\"./xss\");function filterXSS(html,options){var xss=new FilterXSS(options);return xss.process(html)}exports=module.exports=filterXSS;exports.FilterXSS=FilterXSS;for(var i in DEFAULT)exports[i]=DEFAULT[i];for(var i in parser)exports[i]=parser[i];if(typeof window!==\"undefined\"){window.filterXSS=module.exports}function isWorkerEnv(){return typeof self!==\"undefined\"&&typeof DedicatedWorkerGlobalScope!==\"undefined\"&&self instanceof DedicatedWorkerGlobalScope}if(isWorkerEnv()){self.filterXSS=module.exports}},{\"./default\":1,\"./parser\":3,\"./xss\":5}],3:[function(require,module,exports){var _=require(\"./util\");function getTagName(html){var i=_.spaceIndex(html);if(i===-1){var tagName=html.slice(1,-1)}else{var tagName=html.slice(1,i+1)}tagName=_.trim(tagName).toLowerCase();if(tagName.slice(0,1)===\"/\")tagName=tagName.slice(1);if(tagName.slice(-1)===\"/\")tagName=tagName.slice(0,-1);return tagName}function isClosing(html){return html.slice(0,2)===\"\"){rethtml+=escapeHtml(html.slice(lastPos,tagStart));currentHtml=html.slice(tagStart,currentPos+1);currentTagName=getTagName(currentHtml);rethtml+=onTag(tagStart,rethtml.length,currentTagName,currentHtml,isClosing(currentHtml));lastPos=currentPos+1;tagStart=false;continue}if((c==='\"'||c===\"'\")&&html.charAt(currentPos-1)===\"=\"){quoteStart=c;continue}}else{if(c===quoteStart){quoteStart=false;continue}}}}if(lastPos0;i--){var c=str[i];if(c===\" \")continue;if(c===\"=\")return i;return-1}}function isQuoteWrapString(text){if(text[0]==='\"'&&text[text.length-1]==='\"'||text[0]===\"'\"&&text[text.length-1]===\"'\"){return true}else{return false}}function stripQuoteWrap(text){if(isQuoteWrapString(text)){return text.substr(1,text.length-2)}else{return text}}exports.parseTag=parseTag;exports.parseAttr=parseAttr},{\"./util\":4}],4:[function(require,module,exports){module.exports={indexOf:function(arr,item){var i,j;if(Array.prototype.indexOf){return arr.indexOf(item)}for(i=0,j=arr.length;i\"}var attrs=getAttrs(html);var whiteAttrList=whiteList[tag];var attrsHtml=parseAttr(attrs.html,function(name,value){var isWhiteAttr=_.indexOf(whiteAttrList,name)!==-1;var ret=onTagAttr(tag,name,value,isWhiteAttr);if(!isNull(ret))return ret;if(isWhiteAttr){value=safeAttrValue(tag,name,value,cssFilter);if(value){return name+'=\"'+value+'\"'}else{return name}}else{var ret=onIgnoreTagAttr(tag,name,value,isWhiteAttr);if(!isNull(ret))return ret;return}});var html=\"<\"+tag;if(attrsHtml)html+=\" \"+attrsHtml;if(attrs.closing)html+=\" /\";html+=\">\";return html}else{var ret=onIgnoreTag(tag,html,info);if(!isNull(ret))return ret;return escapeHtml(html)}},escapeHtml);if(stripIgnoreTagBody){retHtml=stripIgnoreTagBody.remove(retHtml)}return retHtml};module.exports=FilterXSS},{\"./default\":1,\"./parser\":3,\"./util\":4,cssfilter:8}],6:[function(require,module,exports){var DEFAULT=require(\"./default\");var parseStyle=require(\"./parser\");var _=require(\"./util\");function isNull(obj){return obj===undefined||obj===null}function shallowCopyObject(obj){var ret={};for(var i in obj){ret[i]=obj[i]}return ret}function FilterCSS(options){options=shallowCopyObject(options||{});options.whiteList=options.whiteList||DEFAULT.whiteList;options.onAttr=options.onAttr||DEFAULT.onAttr;options.onIgnoreAttr=options.onIgnoreAttr||DEFAULT.onIgnoreAttr;options.safeAttrValue=options.safeAttrValue||DEFAULT.safeAttrValue;this.options=options}FilterCSS.prototype.process=function(css){css=css||\"\";css=css.toString();if(!css)return\"\";var me=this;var options=me.options;var whiteList=options.whiteList;var onAttr=options.onAttr;var onIgnoreAttr=options.onIgnoreAttr;var safeAttrValue=options.safeAttrValue;var retCSS=parseStyle(css,function(sourcePosition,position,name,value,source){var check=whiteList[name];var isWhite=false;if(check===true)isWhite=check;else if(typeof check===\"function\")isWhite=check(value);else if(check instanceof RegExp)isWhite=check.test(value);if(isWhite!==true)isWhite=false;value=safeAttrValue(name,value);if(!value)return;var opts={position:position,sourcePosition:sourcePosition,source:source,isWhite:isWhite};if(isWhite){var ret=onAttr(name,value,opts);if(isNull(ret)){return name+\":\"+value}else{return ret}}else{var ret=onIgnoreAttr(name,value,opts);if(!isNull(ret)){return ret}}});return retCSS};module.exports=FilterCSS},{\"./default\":7,\"./parser\":9,\"./util\":10}],7:[function(require,module,exports){function getDefaultWhiteList(){var whiteList={};whiteList[\"align-content\"]=false;whiteList[\"align-items\"]=false;whiteList[\"align-self\"]=false;whiteList[\"alignment-adjust\"]=false;whiteList[\"alignment-baseline\"]=false;whiteList[\"all\"]=false;whiteList[\"anchor-point\"]=false;whiteList[\"animation\"]=false;whiteList[\"animation-delay\"]=false;whiteList[\"animation-direction\"]=false;whiteList[\"animation-duration\"]=false;whiteList[\"animation-fill-mode\"]=false;whiteList[\"animation-iteration-count\"]=false;whiteList[\"animation-name\"]=false;whiteList[\"animation-play-state\"]=false;whiteList[\"animation-timing-function\"]=false;whiteList[\"azimuth\"]=false;whiteList[\"backface-visibility\"]=false;whiteList[\"background\"]=true;whiteList[\"background-attachment\"]=true;whiteList[\"background-clip\"]=true;whiteList[\"background-color\"]=true;whiteList[\"background-image\"]=true;whiteList[\"background-origin\"]=true;whiteList[\"background-position\"]=true;whiteList[\"background-repeat\"]=true;whiteList[\"background-size\"]=true;whiteList[\"baseline-shift\"]=false;whiteList[\"binding\"]=false;whiteList[\"bleed\"]=false;whiteList[\"bookmark-label\"]=false;whiteList[\"bookmark-level\"]=false;whiteList[\"bookmark-state\"]=false;whiteList[\"border\"]=true;whiteList[\"border-bottom\"]=true;whiteList[\"border-bottom-color\"]=true;whiteList[\"border-bottom-left-radius\"]=true;whiteList[\"border-bottom-right-radius\"]=true;whiteList[\"border-bottom-style\"]=true;whiteList[\"border-bottom-width\"]=true;whiteList[\"border-collapse\"]=true;whiteList[\"border-color\"]=true;whiteList[\"border-image\"]=true;whiteList[\"border-image-outset\"]=true;whiteList[\"border-image-repeat\"]=true;whiteList[\"border-image-slice\"]=true;whiteList[\"border-image-source\"]=true;whiteList[\"border-image-width\"]=true;whiteList[\"border-left\"]=true;whiteList[\"border-left-color\"]=true;whiteList[\"border-left-style\"]=true;whiteList[\"border-left-width\"]=true;whiteList[\"border-radius\"]=true;whiteList[\"border-right\"]=true;whiteList[\"border-right-color\"]=true;whiteList[\"border-right-style\"]=true;whiteList[\"border-right-width\"]=true;whiteList[\"border-spacing\"]=true;whiteList[\"border-style\"]=true;whiteList[\"border-top\"]=true;whiteList[\"border-top-color\"]=true;whiteList[\"border-top-left-radius\"]=true;whiteList[\"border-top-right-radius\"]=true;whiteList[\"border-top-style\"]=true;whiteList[\"border-top-width\"]=true;whiteList[\"border-width\"]=true;whiteList[\"bottom\"]=false;whiteList[\"box-decoration-break\"]=true;whiteList[\"box-shadow\"]=true;whiteList[\"box-sizing\"]=true;whiteList[\"box-snap\"]=true;whiteList[\"box-suppress\"]=true;whiteList[\"break-after\"]=true;whiteList[\"break-before\"]=true;whiteList[\"break-inside\"]=true;whiteList[\"caption-side\"]=false;whiteList[\"chains\"]=false;whiteList[\"clear\"]=true;whiteList[\"clip\"]=false;whiteList[\"clip-path\"]=false;whiteList[\"clip-rule\"]=false;whiteList[\"color\"]=true;whiteList[\"color-interpolation-filters\"]=true;whiteList[\"column-count\"]=false;whiteList[\"column-fill\"]=false;whiteList[\"column-gap\"]=false;whiteList[\"column-rule\"]=false;whiteList[\"column-rule-color\"]=false;whiteList[\"column-rule-style\"]=false;whiteList[\"column-rule-width\"]=false;whiteList[\"column-span\"]=false;whiteList[\"column-width\"]=false;whiteList[\"columns\"]=false;whiteList[\"contain\"]=false;whiteList[\"content\"]=false;whiteList[\"counter-increment\"]=false;whiteList[\"counter-reset\"]=false;whiteList[\"counter-set\"]=false;whiteList[\"crop\"]=false;whiteList[\"cue\"]=false;whiteList[\"cue-after\"]=false;whiteList[\"cue-before\"]=false;whiteList[\"cursor\"]=false;whiteList[\"direction\"]=false;whiteList[\"display\"]=true;whiteList[\"display-inside\"]=true;whiteList[\"display-list\"]=true;whiteList[\"display-outside\"]=true;whiteList[\"dominant-baseline\"]=false;whiteList[\"elevation\"]=false;whiteList[\"empty-cells\"]=false;whiteList[\"filter\"]=false;whiteList[\"flex\"]=false;whiteList[\"flex-basis\"]=false;whiteList[\"flex-direction\"]=false;whiteList[\"flex-flow\"]=false;whiteList[\"flex-grow\"]=false;whiteList[\"flex-shrink\"]=false;whiteList[\"flex-wrap\"]=false;whiteList[\"float\"]=false;whiteList[\"float-offset\"]=false;whiteList[\"flood-color\"]=false;whiteList[\"flood-opacity\"]=false;whiteList[\"flow-from\"]=false;whiteList[\"flow-into\"]=false;whiteList[\"font\"]=true;whiteList[\"font-family\"]=true;whiteList[\"font-feature-settings\"]=true;whiteList[\"font-kerning\"]=true;whiteList[\"font-language-override\"]=true;whiteList[\"font-size\"]=true;whiteList[\"font-size-adjust\"]=true;whiteList[\"font-stretch\"]=true;whiteList[\"font-style\"]=true;whiteList[\"font-synthesis\"]=true;whiteList[\"font-variant\"]=true;whiteList[\"font-variant-alternates\"]=true;whiteList[\"font-variant-caps\"]=true;whiteList[\"font-variant-east-asian\"]=true;whiteList[\"font-variant-ligatures\"]=true;whiteList[\"font-variant-numeric\"]=true;whiteList[\"font-variant-position\"]=true;whiteList[\"font-weight\"]=true;whiteList[\"grid\"]=false;whiteList[\"grid-area\"]=false;whiteList[\"grid-auto-columns\"]=false;whiteList[\"grid-auto-flow\"]=false;whiteList[\"grid-auto-rows\"]=false;whiteList[\"grid-column\"]=false;whiteList[\"grid-column-end\"]=false;whiteList[\"grid-column-start\"]=false;whiteList[\"grid-row\"]=false;whiteList[\"grid-row-end\"]=false;whiteList[\"grid-row-start\"]=false;whiteList[\"grid-template\"]=false;whiteList[\"grid-template-areas\"]=false;whiteList[\"grid-template-columns\"]=false;whiteList[\"grid-template-rows\"]=false;whiteList[\"hanging-punctuation\"]=false;whiteList[\"height\"]=true;whiteList[\"hyphens\"]=false;whiteList[\"icon\"]=false;whiteList[\"image-orientation\"]=false;whiteList[\"image-resolution\"]=false;whiteList[\"ime-mode\"]=false;whiteList[\"initial-letters\"]=false;whiteList[\"inline-box-align\"]=false;whiteList[\"justify-content\"]=false;whiteList[\"justify-items\"]=false;whiteList[\"justify-self\"]=false;whiteList[\"left\"]=false;whiteList[\"letter-spacing\"]=true;whiteList[\"lighting-color\"]=true;whiteList[\"line-box-contain\"]=false;whiteList[\"line-break\"]=false;whiteList[\"line-grid\"]=false;whiteList[\"line-height\"]=false;whiteList[\"line-snap\"]=false;whiteList[\"line-stacking\"]=false;whiteList[\"line-stacking-ruby\"]=false;whiteList[\"line-stacking-shift\"]=false;whiteList[\"line-stacking-strategy\"]=false;whiteList[\"list-style\"]=true;whiteList[\"list-style-image\"]=true;whiteList[\"list-style-position\"]=true;whiteList[\"list-style-type\"]=true;whiteList[\"margin\"]=true;whiteList[\"margin-bottom\"]=true;whiteList[\"margin-left\"]=true;whiteList[\"margin-right\"]=true;whiteList[\"margin-top\"]=true;whiteList[\"marker-offset\"]=false;whiteList[\"marker-side\"]=false;whiteList[\"marks\"]=false;whiteList[\"mask\"]=false;whiteList[\"mask-box\"]=false;whiteList[\"mask-box-outset\"]=false;whiteList[\"mask-box-repeat\"]=false;whiteList[\"mask-box-slice\"]=false;whiteList[\"mask-box-source\"]=false;whiteList[\"mask-box-width\"]=false;whiteList[\"mask-clip\"]=false;whiteList[\"mask-image\"]=false;whiteList[\"mask-origin\"]=false;whiteList[\"mask-position\"]=false;whiteList[\"mask-repeat\"]=false;whiteList[\"mask-size\"]=false;whiteList[\"mask-source-type\"]=false;whiteList[\"mask-type\"]=false;whiteList[\"max-height\"]=true;whiteList[\"max-lines\"]=false;whiteList[\"max-width\"]=true;whiteList[\"min-height\"]=true;whiteList[\"min-width\"]=true;whiteList[\"move-to\"]=false;whiteList[\"nav-down\"]=false;whiteList[\"nav-index\"]=false;whiteList[\"nav-left\"]=false;whiteList[\"nav-right\"]=false;whiteList[\"nav-up\"]=false;whiteList[\"object-fit\"]=false;whiteList[\"object-position\"]=false;whiteList[\"opacity\"]=false;whiteList[\"order\"]=false;whiteList[\"orphans\"]=false;whiteList[\"outline\"]=false;whiteList[\"outline-color\"]=false;whiteList[\"outline-offset\"]=false;whiteList[\"outline-style\"]=false;whiteList[\"outline-width\"]=false;whiteList[\"overflow\"]=false;whiteList[\"overflow-wrap\"]=false;whiteList[\"overflow-x\"]=false;whiteList[\"overflow-y\"]=false;whiteList[\"padding\"]=true;whiteList[\"padding-bottom\"]=true;whiteList[\"padding-left\"]=true;whiteList[\"padding-right\"]=true;whiteList[\"padding-top\"]=true;whiteList[\"page\"]=false;whiteList[\"page-break-after\"]=false;whiteList[\"page-break-before\"]=false;whiteList[\"page-break-inside\"]=false;whiteList[\"page-policy\"]=false;whiteList[\"pause\"]=false;whiteList[\"pause-after\"]=false;whiteList[\"pause-before\"]=false;whiteList[\"perspective\"]=false;whiteList[\"perspective-origin\"]=false;whiteList[\"pitch\"]=false;whiteList[\"pitch-range\"]=false;whiteList[\"play-during\"]=false;whiteList[\"position\"]=false;whiteList[\"presentation-level\"]=false;whiteList[\"quotes\"]=false;whiteList[\"region-fragment\"]=false;whiteList[\"resize\"]=false;whiteList[\"rest\"]=false;whiteList[\"rest-after\"]=false;whiteList[\"rest-before\"]=false;whiteList[\"richness\"]=false;whiteList[\"right\"]=false;whiteList[\"rotation\"]=false;whiteList[\"rotation-point\"]=false;whiteList[\"ruby-align\"]=false;whiteList[\"ruby-merge\"]=false;whiteList[\"ruby-position\"]=false;whiteList[\"shape-image-threshold\"]=false;whiteList[\"shape-outside\"]=false;whiteList[\"shape-margin\"]=false;whiteList[\"size\"]=false;whiteList[\"speak\"]=false;whiteList[\"speak-as\"]=false;whiteList[\"speak-header\"]=false;whiteList[\"speak-numeral\"]=false;whiteList[\"speak-punctuation\"]=false;whiteList[\"speech-rate\"]=false;whiteList[\"stress\"]=false;whiteList[\"string-set\"]=false;whiteList[\"tab-size\"]=false;whiteList[\"table-layout\"]=false;whiteList[\"text-align\"]=true;whiteList[\"text-align-last\"]=true;whiteList[\"text-combine-upright\"]=true;whiteList[\"text-decoration\"]=true;whiteList[\"text-decoration-color\"]=true;whiteList[\"text-decoration-line\"]=true;whiteList[\"text-decoration-skip\"]=true;whiteList[\"text-decoration-style\"]=true;whiteList[\"text-emphasis\"]=true;whiteList[\"text-emphasis-color\"]=true;whiteList[\"text-emphasis-position\"]=true;whiteList[\"text-emphasis-style\"]=true;whiteList[\"text-height\"]=true;whiteList[\"text-indent\"]=true;whiteList[\"text-justify\"]=true;whiteList[\"text-orientation\"]=true;whiteList[\"text-overflow\"]=true;whiteList[\"text-shadow\"]=true;whiteList[\"text-space-collapse\"]=true;whiteList[\"text-transform\"]=true;whiteList[\"text-underline-position\"]=true;whiteList[\"text-wrap\"]=true;whiteList[\"top\"]=false;whiteList[\"transform\"]=false;whiteList[\"transform-origin\"]=false;whiteList[\"transform-style\"]=false;whiteList[\"transition\"]=false;whiteList[\"transition-delay\"]=false;whiteList[\"transition-duration\"]=false;whiteList[\"transition-property\"]=false;whiteList[\"transition-timing-function\"]=false;whiteList[\"unicode-bidi\"]=false;whiteList[\"vertical-align\"]=false;whiteList[\"visibility\"]=false;whiteList[\"voice-balance\"]=false;whiteList[\"voice-duration\"]=false;whiteList[\"voice-family\"]=false;whiteList[\"voice-pitch\"]=false;whiteList[\"voice-range\"]=false;whiteList[\"voice-rate\"]=false;whiteList[\"voice-stress\"]=false;whiteList[\"voice-volume\"]=false;whiteList[\"volume\"]=false;whiteList[\"white-space\"]=false;whiteList[\"widows\"]=false;whiteList[\"width\"]=true;whiteList[\"will-change\"]=false;whiteList[\"word-break\"]=true;whiteList[\"word-spacing\"]=true;whiteList[\"word-wrap\"]=true;whiteList[\"wrap-flow\"]=false;whiteList[\"wrap-through\"]=false;whiteList[\"writing-mode\"]=false;whiteList[\"z-index\"]=false;return whiteList}function onAttr(name,value,options){}function onIgnoreAttr(name,value,options){}var REGEXP_URL_JAVASCRIPT=/javascript\\s*\\:/gim;function safeAttrValue(name,value){if(REGEXP_URL_JAVASCRIPT.test(value))return\"\";return value}exports.whiteList=getDefaultWhiteList();exports.getDefaultWhiteList=getDefaultWhiteList;exports.onAttr=onAttr;exports.onIgnoreAttr=onIgnoreAttr;exports.safeAttrValue=safeAttrValue},{}],8:[function(require,module,exports){var DEFAULT=require(\"./default\");var FilterCSS=require(\"./css\");function filterCSS(html,options){var xss=new FilterCSS(options);return xss.process(html)}exports=module.exports=filterCSS;exports.FilterCSS=FilterCSS;for(var i in DEFAULT)exports[i]=DEFAULT[i];if(typeof window!==\"undefined\"){window.filterCSS=module.exports}},{\"./css\":6,\"./default\":7}],9:[function(require,module,exports){var _=require(\"./util\");function parseStyle(css,onAttr){css=_.trimRight(css);if(css[css.length-1]!==\";\")css+=\";\";var cssLength=css.length;var isParenthesisOpen=false;var lastPos=0;var i=0;var retCSS=\"\";function addNewAttr(){if(!isParenthesisOpen){var source=_.trim(css.slice(lastPos,i));var j=source.indexOf(\":\");if(j!==-1){var name=_.trim(source.slice(0,j));var value=_.trim(source.slice(j+1));if(name){var ret=onAttr(lastPos,retCSS.length,name,value,source);if(ret)retCSS+=ret+\"; \"}}}lastPos=i+1}for(;i');\n this.$element.append(this.$title);\n this.$subtitle = $(\"
\\n
\\n \\n \\n
\\n
\");\n this.$element.append(this.$subtitle);\n this.$subtitleWrapper = this.$subtitle.find('.wrapper');\n this.$subtitleExpand = this.$subtitle.find('.expand-btn');\n this.$subtitleText = this.$subtitle.find('.text');\n this.$content = $('
');\n this.$element.append(this.$content);\n this.$attribution = $(\"\\n
\\n
\\n
\\n \\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n \");\n this.$attribution.find('.header .title').text(this.content.attribution);\n this.$content.append(this.$attribution);\n this.closeAttribution();\n this.$closeAttributionButton = this.$attribution.find('.header .close');\n this.$closeAttributionButton.on('click', function (e) {\n e.preventDefault();\n _this.closeAttribution();\n });\n this.$subtitleExpand.on('click', function (e) {\n e.preventDefault();\n _this.subtitleExpanded = !_this.subtitleExpanded;\n if (_this.subtitleExpanded) {\n _this.$subtitleWrapper.addClass('expanded');\n _this.$subtitleExpand.text('-');\n }\n else {\n _this.$subtitleWrapper.removeClass('expanded');\n _this.$subtitleExpand.text('+');\n }\n _this.resize();\n });\n if (Utils.Bools.getBool(this.options.titleEnabled, true)) {\n this.$title.removeClass('hidden');\n }\n else {\n this.$title.addClass('hidden');\n }\n if (Utils.Bools.getBool(this.options.subtitleEnabled, false)) {\n this.$subtitle.removeClass('hidden');\n }\n else {\n this.$subtitle.addClass('hidden');\n }\n this.whenResized(function () {\n _this.updateRequiredStatement();\n });\n };\n CenterPanel.prototype.openAttribution = function () {\n this.$attribution.show();\n this.isAttributionOpen = true;\n };\n CenterPanel.prototype.closeAttribution = function () {\n this.$attribution.hide();\n this.isAttributionOpen = false;\n };\n CenterPanel.prototype.updateRequiredStatement = function () {\n var _this = this;\n var requiredStatement = this.extension.helper.getRequiredStatement();\n //var license = this.provider.getLicense();\n //var logo = this.provider.getLogo();\n var enabled = Utils.Bools.getBool(this.options.requiredStatementEnabled, true);\n if (!requiredStatement || !requiredStatement.value || !enabled) {\n return;\n }\n this.openAttribution();\n var $attributionTitle = this.$attribution.find('.title');\n var $attributionText = this.$attribution.find('.attribution-text');\n var $license = this.$attribution.find('.license');\n var $logo = this.$attribution.find('.logo');\n if (requiredStatement.label) {\n var sanitizedTitle = Utils_1.UVUtils.sanitize(requiredStatement.label);\n $attributionTitle.html(sanitizedTitle);\n }\n else {\n $attributionTitle.text(this.content.attribution);\n }\n if (requiredStatement.value) {\n var sanitizedText = Utils_1.UVUtils.sanitize(requiredStatement.value);\n $attributionText.html(sanitizedText);\n $attributionText.find('img').one('load', function () {\n _this.resize();\n }).each(function () {\n if (this.complete)\n $(this).load();\n });\n $attributionText.targetBlank();\n }\n // $attribution.toggleExpandText(this.options.trimAttributionCount, () => {\n // this.resize();\n // });\n //if (license){\n // $license.append('' + license + '');\n //} else {\n $license.hide();\n //}\n //\n //if (logo){\n // $logo.append('');\n //} else {\n $logo.hide();\n //}\n this.resize();\n };\n CenterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n var leftPanelWidth = this.extension.shell.$leftPanel.is(':visible') ? Math.floor(this.extension.shell.$leftPanel.width()) : 0;\n var rightPanelWidth = this.extension.shell.$rightPanel.is(':visible') ? Math.floor(this.extension.shell.$rightPanel.width()) : 0;\n var width = Math.floor(this.$element.parent().width() - leftPanelWidth - rightPanelWidth);\n this.$element.css({\n 'left': leftPanelWidth,\n 'width': width\n });\n var titleHeight;\n var subtitleHeight;\n if (this.options && this.options.titleEnabled === false || !this.$title.is(':visible')) {\n titleHeight = 0;\n }\n else {\n titleHeight = this.$title.height();\n }\n if (this.options && this.options.subtitleEnabled === false || !this.$subtitle.is(':visible')) {\n subtitleHeight = 0;\n }\n else {\n subtitleHeight = this.$subtitle.height();\n }\n this.$content.height(this.$element.height() - titleHeight - subtitleHeight);\n this.$content.width(this.$element.width());\n if (this.$attribution && this.isAttributionOpen) {\n switch (this.attributionPosition) {\n case Position_1.Position.BOTTOM_LEFT:\n this.$attribution.css('top', this.$content.height() - this.$attribution.outerHeight() - this.$attribution.verticalMargins());\n this.$attribution.css('left', 0);\n break;\n case Position_1.Position.BOTTOM_RIGHT:\n this.$attribution.css('top', this.$content.height() - this.$attribution.outerHeight() - this.$attribution.verticalMargins());\n this.$attribution.css('left', this.$content.width() - this.$attribution.outerWidth() - this.$attribution.horizontalMargins());\n break;\n }\n // hide the attribution if there's no room for it\n if (this.$content.width() <= this.$attribution.width()) {\n this.$attribution.hide();\n }\n else {\n this.$attribution.show();\n }\n }\n if (this.subtitle && this.options.subtitleEnabled) {\n this.$subtitleText.html(Utils_1.UVUtils.sanitize(this.subtitle.replace(//gi, '; ')));\n this.$subtitleText.removeClass('elided');\n this.$subtitle.removeClass('hidden');\n this.$subtitleWrapper.css('max-height', this.$content.height() + this.$subtitle.outerHeight());\n this.$subtitleWrapper.width(this.$content.width());\n if (!this.subtitleExpanded) {\n this.$subtitleText.width('auto');\n this.$subtitleWrapper.width('auto');\n this.$subtitleExpand.hide();\n // if the subtitle span is wider than the container, set it to display:block \n // and set its width to that of the container\n // this will make it appear elided.\n // show the expand button\n if (this.$subtitleText.width() > this.$content.width()) {\n this.$subtitleExpand.show();\n this.$subtitleText.addClass('elided');\n this.$subtitleText.width(this.$content.width() - (this.$subtitleExpand.outerWidth() + this.$subtitleText.horizontalMargins()));\n }\n }\n else {\n // subtitle expanded\n this.$subtitleText.width(this.$content.width() - this.$subtitleText.horizontalMargins() - 2);\n }\n }\n else {\n this.$subtitle.addClass('hidden');\n }\n };\n return CenterPanel;\n }(BaseView_1.BaseView));\n exports.CenterPanel = CenterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-avcenterpanel-module/AVCenterPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/CenterPanel\", \"../uv-shared-module/Position\", \"../../Utils\"], function (require, exports, BaseEvents_1, CenterPanel_1, Position_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var AVCenterPanel = /** @class */ (function (_super) {\n __extends(AVCenterPanel, _super);\n function AVCenterPanel($element) {\n var _this = _super.call(this, $element) || this;\n _this._mediaReady = false;\n _this._isThumbsViewOpen = false;\n _this.attributionPosition = Position_1.Position.BOTTOM_RIGHT;\n return _this;\n }\n AVCenterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('avCenterPanel');\n _super.prototype.create.call(this);\n var that = this;\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, function (resources) {\n that.openMedia(resources);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this._viewCanvas(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RANGE_CHANGED, function (range) {\n if (!_this._observeRangeChanges()) {\n return;\n }\n _this._whenMediaReady(function () {\n that._viewRange(range);\n that._setTitle();\n });\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.METRIC_CHANGED, function () {\n _this._whenMediaReady(function () {\n if (_this.avcomponent) {\n _this.avcomponent.set({\n limitToRange: _this._limitToRange(),\n constrainNavigationToRange: _this._limitToRange()\n });\n }\n });\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CREATED, function () {\n _this._setTitle();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_THUMBS_VIEW, function () {\n _this._isThumbsViewOpen = true;\n _this._whenMediaReady(function () {\n if (_this.avcomponent) {\n _this.avcomponent.set({\n virtualCanvasEnabled: false\n });\n var canvas = _this.extension.helper.getCurrentCanvas();\n if (canvas) {\n _this._viewCanvas(_this.extension.helper.canvasIndex);\n }\n }\n });\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_TREE_VIEW, function () {\n _this._isThumbsViewOpen = false;\n _this._whenMediaReady(function () {\n if (_this.avcomponent) {\n _this.avcomponent.set({\n virtualCanvasEnabled: true\n });\n }\n });\n });\n this._createAVComponent();\n };\n AVCenterPanel.prototype._createAVComponent = function () {\n var _this = this;\n this.$avcomponent = $('
');\n this.$content.prepend(this.$avcomponent);\n this.avcomponent = new IIIFComponents.AVComponent({\n target: this.$avcomponent[0],\n posterImageExpanded: this.options.posterImageExpanded\n });\n this.avcomponent.on('mediaready', function () {\n console.log('mediaready');\n _this._mediaReady = true;\n }, false);\n this.avcomponent.on('rangechanged', function (rangeId) {\n if (rangeId) {\n _this._setTitle();\n var range = _this.extension.helper.getRangeById(rangeId);\n if (range) {\n var currentRange = _this.extension.helper.getCurrentRange();\n if (range !== currentRange) {\n _this.component.publish(BaseEvents_1.BaseEvents.RANGE_CHANGED, range);\n }\n }\n else {\n _this.component.publish(BaseEvents_1.BaseEvents.RANGE_CHANGED, null);\n }\n }\n else {\n _this.component.publish(BaseEvents_1.BaseEvents.RANGE_CHANGED, null);\n }\n }, false);\n };\n AVCenterPanel.prototype._observeRangeChanges = function () {\n if (!this._isThumbsViewOpen) {\n return true;\n }\n return false;\n };\n AVCenterPanel.prototype._setTitle = function () {\n var _this = this;\n var title = '';\n var value;\n var label;\n // get the current range or canvas title\n var currentRange = this.extension.helper.getCurrentRange();\n if (currentRange) {\n label = currentRange.getLabel();\n }\n else {\n label = this.extension.helper.getCurrentCanvas().getLabel();\n }\n value = Manifesto.LanguageMap.getValue(label);\n if (value) {\n title = value;\n }\n if (Utils.Bools.getBool(this.config.options.includeParentInTitleEnabled, false)) {\n // get the parent range or manifest's title\n if (currentRange) {\n if (currentRange.parentRange) {\n label = currentRange.parentRange.getLabel();\n value = Manifesto.LanguageMap.getValue(label);\n }\n }\n else {\n value = this.extension.helper.getLabel();\n }\n if (value) {\n title += this.content.delimiter + value;\n }\n }\n this.title = title;\n // set subtitle\n var groups = this.extension.helper.getMetadata({\n range: currentRange\n });\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n var item = group.items.find(function (el) {\n if (el.label) {\n var label_1 = Manifesto.LanguageMap.getValue(el.label);\n if (label_1 && label_1.toLowerCase() === _this.config.options.subtitleMetadataField) {\n return true;\n }\n }\n return false;\n });\n if (item) {\n this.subtitle = Manifesto.LanguageMap.getValue(item.value);\n break;\n }\n }\n this.$title.text(Utils_1.UVUtils.sanitize(this.title));\n this.resize(false);\n };\n AVCenterPanel.prototype._isCurrentResourceAccessControlled = function () {\n var canvas = this.extension.helper.getCurrentCanvas();\n return canvas.externalResource.isAccessControlled();\n };\n AVCenterPanel.prototype.openMedia = function (resources) {\n var _this = this;\n this.extension.getExternalResources(resources).then(function () {\n if (_this.avcomponent) {\n // reset if the media has already been loaded (degraded flow has happened)\n if (_this.extension.helper.canvasIndex === _this._lastCanvasIndex) {\n _this.avcomponent.reset();\n }\n _this._lastCanvasIndex = _this.extension.helper.canvasIndex;\n _this.avcomponent.set({\n helper: _this.extension.helper,\n adaptiveAuthEnabled: _this._isCurrentResourceAccessControlled(),\n autoPlay: _this.config.options.autoPlay,\n autoSelectRange: true,\n constrainNavigationToRange: _this._limitToRange(),\n content: _this.content,\n defaultAspectRatio: 0.56,\n doubleClickMS: 350,\n limitToRange: _this._limitToRange(),\n posterImageRatio: _this.config.options.posterImageRatio\n });\n _this.resize();\n }\n });\n };\n AVCenterPanel.prototype._limitToRange = function () {\n return !this.extension.isDesktopMetric();\n };\n AVCenterPanel.prototype._whenMediaReady = function (cb) {\n var _this = this;\n Utils.Async.waitFor(function () {\n return _this._mediaReady;\n }, cb);\n };\n AVCenterPanel.prototype._viewRange = function (range) {\n var _this = this;\n this._whenMediaReady(function () {\n if (range && _this.avcomponent) {\n _this.avcomponent.playRange(range.id);\n }\n // don't resize the av component to avoid expensively redrawing waveforms\n _this.resize(false);\n });\n };\n AVCenterPanel.prototype._viewCanvas = function (canvasIndex) {\n var _this = this;\n this._whenMediaReady(function () {\n var canvas = _this.extension.helper.getCanvasByIndex(canvasIndex);\n if (_this.avcomponent) {\n _this.avcomponent.showCanvas(canvas.id);\n }\n });\n };\n AVCenterPanel.prototype.resize = function (resizeAVComponent) {\n if (resizeAVComponent === void 0) { resizeAVComponent = true; }\n _super.prototype.resize.call(this);\n if (resizeAVComponent && this.avcomponent) {\n this.$avcomponent.height(this.$content.height());\n this.avcomponent.resize();\n }\n };\n return AVCenterPanel;\n }(CenterPanel_1.CenterPanel));\n exports.AVCenterPanel = AVCenterPanel;\n});\n\n", - "define('modules/uv-shared-module/InformationArgs',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var InformationArgs = /** @class */ (function () {\n function InformationArgs(informationType, param) {\n this.informationType = informationType;\n this.param = param;\n }\n return InformationArgs;\n }());\n exports.InformationArgs = InformationArgs;\n});\n\n", - "define('modules/uv-shared-module/InformationType',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var InformationType;\n (function (InformationType) {\n InformationType[InformationType[\"AUTH_CORS_ERROR\"] = 0] = \"AUTH_CORS_ERROR\";\n InformationType[InformationType[\"DEGRADED_RESOURCE\"] = 1] = \"DEGRADED_RESOURCE\";\n })(InformationType = exports.InformationType || (exports.InformationType = {}));\n});\n\n", - "define('modules/uv-shared-module/LoginWarningMessages',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var LoginWarningMessages = /** @class */ (function () {\n function LoginWarningMessages() {\n }\n LoginWarningMessages.FORBIDDEN = \"forbiddenResourceMessage\";\n return LoginWarningMessages;\n }());\n exports.LoginWarningMessages = LoginWarningMessages;\n});\n\n", - "define('modules/uv-shared-module/Auth09',[\"require\", \"exports\", \"./BaseEvents\", \"./InformationArgs\", \"./InformationType\", \"./LoginWarningMessages\"], function (require, exports, BaseEvents_1, InformationArgs_1, InformationType_1, LoginWarningMessages_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Auth09 = /** @class */ (function () {\n function Auth09() {\n }\n Auth09.loadExternalResources = function (resourcesToLoad, storageStrategy) {\n return new Promise(function (resolve) {\n manifesto.Utils.loadExternalResourcesAuth09(resourcesToLoad, storageStrategy, Auth09.clickThrough, Auth09.restricted, Auth09.login, Auth09.getAccessToken, Auth09.storeAccessToken, Auth09.getStoredAccessToken, Auth09.handleExternalResourceResponse).then(function (r) {\n resolve(r);\n })['catch'](function (error) {\n switch (error.name) {\n case manifesto.StatusCodes.AUTHORIZATION_FAILED.toString():\n Auth09.publish(BaseEvents_1.BaseEvents.LOGIN_FAILED);\n break;\n case manifesto.StatusCodes.FORBIDDEN.toString():\n Auth09.publish(BaseEvents_1.BaseEvents.FORBIDDEN);\n break;\n case manifesto.StatusCodes.RESTRICTED.toString():\n // do nothing\n break;\n default:\n Auth09.publish(BaseEvents_1.BaseEvents.SHOW_MESSAGE, [error.message || error]);\n }\n });\n });\n };\n Auth09.clickThrough = function (resource) {\n return new Promise(function (resolve) {\n Auth09.publish(BaseEvents_1.BaseEvents.SHOW_CLICKTHROUGH_DIALOGUE, [{\n resource: resource,\n acceptCallback: function () {\n if (resource.clickThroughService) {\n var win_1 = window.open(resource.clickThroughService.id);\n var pollTimer_1 = window.setInterval(function () {\n if (win_1 && win_1.closed) {\n window.clearInterval(pollTimer_1);\n Auth09.publish(BaseEvents_1.BaseEvents.CLICKTHROUGH);\n resolve();\n }\n }, 500);\n }\n }\n }]);\n });\n };\n Auth09.restricted = function (resource) {\n return new Promise(function (resolve, reject) {\n Auth09.publish(BaseEvents_1.BaseEvents.SHOW_RESTRICTED_DIALOGUE, [{\n resource: resource,\n acceptCallback: function () {\n Auth09.publish(BaseEvents_1.BaseEvents.LOAD_FAILED);\n reject(resource);\n }\n }]);\n });\n };\n Auth09.login = function (resource) {\n return new Promise(function (resolve) {\n var options = {};\n if (resource.status === HTTPStatusCode.FORBIDDEN) {\n options.warningMessage = LoginWarningMessages_1.LoginWarningMessages.FORBIDDEN;\n options.showCancelButton = true;\n }\n Auth09.publish(BaseEvents_1.BaseEvents.SHOW_LOGIN_DIALOGUE, [{\n resource: resource,\n loginCallback: function () {\n if (resource.loginService) {\n var win_2 = window.open(resource.loginService.id + \"?t=\" + new Date().getTime());\n var pollTimer_2 = window.setInterval(function () {\n if (win_2 && win_2.closed) {\n window.clearInterval(pollTimer_2);\n Auth09.publish(BaseEvents_1.BaseEvents.LOGIN);\n resolve();\n }\n }, 500);\n }\n },\n logoutCallback: function () {\n if (resource.logoutService) {\n var win_3 = window.open(resource.logoutService.id + \"?t=\" + new Date().getTime());\n var pollTimer_3 = window.setInterval(function () {\n if (win_3 && win_3.closed) {\n window.clearInterval(pollTimer_3);\n Auth09.publish(BaseEvents_1.BaseEvents.LOGOUT);\n resolve();\n }\n }, 500);\n }\n },\n options: options\n }]);\n });\n };\n Auth09.getAccessToken = function (resource, rejectOnError) {\n return new Promise(function (resolve, reject) {\n if (resource.tokenService) {\n var serviceUri = resource.tokenService.id;\n // pick an identifier for this message. We might want to keep track of sent messages\n var msgId = serviceUri + \"|\" + new Date().getTime();\n var receiveAccessToken_1 = function (e) {\n window.removeEventListener(\"message\", receiveAccessToken_1);\n var token = e.data;\n if (token.error) {\n if (rejectOnError) {\n reject(token.errorDescription);\n }\n else {\n resolve(undefined);\n }\n }\n else {\n resolve(token);\n }\n };\n window.addEventListener(\"message\", receiveAccessToken_1, false);\n var tokenUri = serviceUri + \"?messageId=\" + msgId;\n $('#commsFrame').prop('src', tokenUri);\n }\n else {\n reject('Token service not found');\n }\n });\n };\n Auth09.storeAccessToken = function (resource, token, storageStrategy) {\n return new Promise(function (resolve, reject) {\n if (resource.tokenService) {\n Utils.Storage.set(resource.tokenService.id, token, token.expiresIn, new Utils.StorageType(storageStrategy));\n resolve();\n }\n else {\n reject('Token service not found');\n }\n });\n };\n Auth09.getStoredAccessToken = function (resource, storageStrategy) {\n return new Promise(function (resolve, reject) {\n var foundItems = [];\n var item = null;\n // try to match on the tokenService, if the resource has one:\n if (resource.tokenService) {\n item = Utils.Storage.get(resource.tokenService.id, new Utils.StorageType(storageStrategy));\n }\n if (item) {\n foundItems.push(item);\n }\n else {\n // find an access token for the domain\n var domain = Utils.Urls.getUrlParts(resource.dataUri).hostname;\n var items = Utils.Storage.getItems(new Utils.StorageType(storageStrategy));\n for (var i = 0; i < items.length; i++) {\n item = items[i];\n if (item.key.includes(domain)) {\n foundItems.push(item);\n }\n }\n }\n // sort by expiresAt, earliest to most recent.\n foundItems = foundItems.sort(function (a, b) {\n return a.expiresAt - b.expiresAt;\n });\n var foundToken;\n if (foundItems.length) {\n foundToken = foundItems[foundItems.length - 1].value;\n }\n resolve(foundToken);\n });\n };\n Auth09.handleExternalResourceResponse = function (resource) {\n return new Promise(function (resolve, reject) {\n resource.isResponseHandled = true;\n if (resource.status === HTTPStatusCode.OK) {\n resolve(resource);\n }\n else if (resource.status === HTTPStatusCode.MOVED_TEMPORARILY) {\n resolve(resource);\n Auth09.publish(BaseEvents_1.BaseEvents.RESOURCE_DEGRADED, [resource]);\n }\n else {\n if (resource.error.status === HTTPStatusCode.UNAUTHORIZED ||\n resource.error.status === HTTPStatusCode.INTERNAL_SERVER_ERROR) {\n // if the browser doesn't support CORS\n if (!Modernizr.cors) {\n var informationArgs = new InformationArgs_1.InformationArgs(InformationType_1.InformationType.AUTH_CORS_ERROR, null);\n Auth09.publish(BaseEvents_1.BaseEvents.SHOW_INFORMATION, [informationArgs]);\n resolve(resource);\n }\n else {\n reject(resource.error.statusText);\n }\n }\n else if (resource.error.status === HTTPStatusCode.FORBIDDEN) {\n var error = new Error();\n error.message = \"Forbidden\";\n error.name = manifesto.StatusCodes.FORBIDDEN.toString();\n reject(error);\n }\n else {\n reject(resource.error.statusText);\n }\n }\n });\n };\n Auth09.handleDegraded = function (resource) {\n var informationArgs = new InformationArgs_1.InformationArgs(InformationType_1.InformationType.DEGRADED_RESOURCE, resource);\n Auth09.publish(BaseEvents_1.BaseEvents.SHOW_INFORMATION, [informationArgs]);\n };\n return Auth09;\n }());\n exports.Auth09 = Auth09;\n});\n\n", - "define('modules/uv-shared-module/Auth1',[\"require\", \"exports\", \"./BaseEvents\", \"../../Utils\", \"./InformationArgs\", \"./InformationType\"], function (require, exports, BaseEvents_1, Utils_1, InformationArgs_1, InformationType_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Auth1 = /** @class */ (function () {\n function Auth1() {\n }\n Auth1.loadExternalResources = function (resourcesToLoad, storageStrategy, options) {\n return new Promise(function (resolve) {\n Auth1.storageStrategy = storageStrategy;\n // set all resources to Auth API V1\n resourcesToLoad = resourcesToLoad.map(function (resource) {\n resource.authAPIVersion = 1;\n resource.options = options;\n return resource;\n });\n manifesto.Utils.loadExternalResourcesAuth1(resourcesToLoad, Auth1.openContentProviderInteraction, Auth1.openTokenService, Auth1.getStoredAccessToken, Auth1.userInteractedWithContentProvider, Auth1.getContentProviderInteraction, Auth1.handleMovedTemporarily, Auth1.showOutOfOptionsMessages).then(function (r) {\n resolve(r);\n })['catch'](function (error) {\n switch (error.name) {\n case manifesto.StatusCodes.AUTHORIZATION_FAILED.toString():\n Auth1.publish(BaseEvents_1.BaseEvents.LOGIN_FAILED);\n break;\n case manifesto.StatusCodes.FORBIDDEN.toString():\n Auth1.publish(BaseEvents_1.BaseEvents.FORBIDDEN);\n break;\n case manifesto.StatusCodes.RESTRICTED.toString():\n // do nothing\n break;\n default:\n Auth1.publish(BaseEvents_1.BaseEvents.SHOW_MESSAGE, [error.message || error]);\n }\n });\n });\n };\n Auth1.getCookieServiceUrl = function (service) {\n var cookieServiceUrl = service.id + \"?origin=\" + Auth1.getOrigin();\n return cookieServiceUrl;\n };\n Auth1.openContentProviderInteraction = function (service) {\n var cookieServiceUrl = Auth1.getCookieServiceUrl(service);\n return window.open(cookieServiceUrl);\n };\n // determine the postMessage-style origin for a URL\n Auth1.getOrigin = function (url) {\n var urlHolder = window.location;\n if (url) {\n urlHolder = document.createElement('a');\n urlHolder.href = url;\n }\n return urlHolder.protocol + \"//\" + urlHolder.hostname + (urlHolder.port ? ':' + urlHolder.port : '');\n };\n Auth1.userInteractedWithContentProvider = function (contentProviderWindow) {\n return new Promise(function (resolve) {\n // What happens here is forever a mystery to a client application.\n // It can but wait.\n var poll = window.setInterval(function () {\n if (contentProviderWindow.closed) {\n window.clearInterval(poll);\n resolve(true);\n }\n }, 500);\n });\n };\n Auth1.handleMovedTemporarily = function (resource) {\n return new Promise(function (resolve) {\n Auth1.showDegradedMessage(resource);\n resource.isResponseHandled = true;\n resolve();\n });\n };\n Auth1.showDegradedMessage = function (resource) {\n var informationArgs = new InformationArgs_1.InformationArgs(InformationType_1.InformationType.DEGRADED_RESOURCE, resource);\n Auth1.publish(BaseEvents_1.BaseEvents.SHOW_INFORMATION, [informationArgs]);\n };\n Auth1.storeAccessToken = function (resource, token) {\n return new Promise(function (resolve, reject) {\n if (resource.tokenService) {\n Utils.Storage.set(resource.tokenService.id, token, token.expiresIn, new Utils.StorageType(Auth1.storageStrategy));\n resolve();\n }\n else {\n reject('Token service not found');\n }\n });\n };\n Auth1.getStoredAccessToken = function (resource) {\n return new Promise(function (resolve, reject) {\n var foundItems = [];\n var item = null;\n // try to match on the tokenService, if the resource has one:\n if (resource.tokenService) {\n item = Utils.Storage.get(resource.tokenService.id, new Utils.StorageType(Auth1.storageStrategy));\n }\n if (item) {\n foundItems.push(item);\n }\n else {\n // find an access token for the domain\n var domain = Utils.Urls.getUrlParts(resource.dataUri).hostname;\n var items = Utils.Storage.getItems(new Utils.StorageType(Auth1.storageStrategy));\n for (var i = 0; i < items.length; i++) {\n item = items[i];\n if (item.key.includes(domain)) {\n foundItems.push(item);\n }\n }\n }\n // sort by expiresAt, earliest to most recent.\n foundItems = foundItems.sort(function (a, b) {\n return a.expiresAt - b.expiresAt;\n });\n var foundToken = null;\n if (foundItems.length) {\n foundToken = foundItems[foundItems.length - 1].value;\n }\n resolve(foundToken);\n });\n };\n Auth1.getContentProviderInteraction = function (resource, service) {\n return new Promise(function (resolve) {\n // if the info bar has already been shown for degraded logins\n if (resource.isResponseHandled && !resource.authHoldingPage) {\n Auth1.showDegradedMessage(resource);\n resolve(null);\n }\n else if (resource.authHoldingPage) {\n // redirect holding page\n resource.authHoldingPage.location.href = Auth1.getCookieServiceUrl(service);\n resolve(resource.authHoldingPage);\n }\n else {\n Auth1.publish(BaseEvents_1.BaseEvents.SHOW_AUTH_DIALOGUE, [{\n service: service,\n closeCallback: function () {\n resolve(null);\n },\n confirmCallback: function () {\n var win = Auth1.openContentProviderInteraction(service);\n resolve(win);\n },\n cancelCallback: function () {\n resolve(null);\n }\n }]);\n }\n });\n };\n Auth1.openTokenService = function (resource, tokenService) {\n // use a Promise across a postMessage call. Discuss...\n return new Promise(function (resolve, reject) {\n // if necessary, the client can decide not to trust this origin\n var serviceOrigin = Auth1.getOrigin(tokenService.id);\n var messageId = new Date().getTime();\n Auth1.messages[messageId] = {\n \"resolve\": resolve,\n \"reject\": reject,\n \"serviceOrigin\": serviceOrigin,\n \"resource\": resource\n };\n window.addEventListener(\"message\", Auth1.receiveToken, false);\n var tokenUrl = tokenService.id + \"?messageId=\" + messageId + \"&origin=\" + Auth1.getOrigin();\n // load the access token service url in the #commsFrame iframe.\n // when the message event listener (Auth1.receiveToken) receives a message from the iframe\n // it looks in Auth1.messages to find a corresponding message id with the same origin.\n // if found, it stores the returned access token, resolves and deletes the message.\n // resolving the message resolves the openTokenService promise.\n $('#commsFrame').prop('src', tokenUrl);\n // reject any unhandled messages after a configurable timeout\n var postMessageTimeout = 5000;\n setTimeout(function () {\n if (Auth1.messages[messageId]) {\n Auth1.messages[messageId].reject(\"Message unhandled after \" + postMessageTimeout + \"ms, rejecting\");\n delete Auth1.messages[messageId];\n }\n }, postMessageTimeout);\n });\n };\n Auth1.receiveToken = function (event) {\n if (event.data.hasOwnProperty(\"messageId\")) {\n var message_1 = Auth1.messages[event.data.messageId];\n if (message_1 && event.origin == message_1.serviceOrigin) {\n // Any message with a messageId is a success\n Auth1.storeAccessToken(message_1.resource, event.data).then(function () {\n message_1.resolve(event.data); // resolves openTokenService with the token\n delete Auth1.messages[event.data.messageId];\n return;\n });\n }\n }\n };\n Auth1.showOutOfOptionsMessages = function (resource, service) {\n // if the UV is already showing the info bar, no need to show an error message.\n if (resource.status == HTTPStatusCode.MOVED_TEMPORARILY) {\n return;\n }\n var errorMessage = \"\";\n if (service.getFailureHeader()) {\n errorMessage += '

' + service.getFailureHeader() + '

';\n }\n if (service.getFailureDescription()) {\n errorMessage += service.getFailureDescription();\n }\n Auth1.publish(BaseEvents_1.BaseEvents.SHOW_MESSAGE, [Utils_1.UVUtils.sanitize(errorMessage)]);\n };\n Auth1.messages = {};\n return Auth1;\n }());\n exports.Auth1 = Auth1;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/Dialogue',[\"require\", \"exports\", \"./BaseView\", \"./BaseEvents\"], function (require, exports, BaseView_1, BaseEvents_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Dialogue = /** @class */ (function (_super) {\n __extends(Dialogue, _super);\n function Dialogue($element) {\n var _this = _super.call(this, $element, false, false) || this;\n _this.allowClose = true;\n _this.isActive = false;\n _this.isUnopened = true;\n return _this;\n }\n Dialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('dialogue');\n _super.prototype.create.call(this);\n // events.\n this.component.subscribe(BaseEvents_1.BaseEvents.CLOSE_ACTIVE_DIALOGUE, function () {\n if (_this.isActive) {\n if (_this.allowClose) {\n _this.close();\n }\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ESCAPE, function () {\n if (_this.isActive) {\n if (_this.allowClose) {\n _this.close();\n }\n }\n });\n this.$top = $('
');\n this.$element.append(this.$top);\n this.$closeButton = $('');\n this.$middle = $('
');\n this.$element.append(this.$middle);\n this.$content = $('
');\n this.$middle.append(this.$content);\n this.$buttons = $('
');\n this.$middle.append(this.$buttons);\n this.$bottom = $('
');\n this.$element.append(this.$bottom);\n if (this.config.topCloseButtonEnabled) {\n this.$top.append(this.$closeButton);\n }\n else {\n this.$buttons.append(this.$closeButton);\n }\n this.$closeButton.on('click', function (e) {\n e.preventDefault();\n _this.close();\n });\n this.returnFunc = this.close;\n };\n Dialogue.prototype.enableClose = function () {\n this.allowClose = true;\n this.$closeButton.show();\n };\n Dialogue.prototype.disableClose = function () {\n this.allowClose = false;\n this.$closeButton.hide();\n };\n Dialogue.prototype.setDockedPosition = function () {\n var top = Math.floor(this.extension.height() - this.$element.outerHeight(true));\n var left = 0;\n var arrowLeft = 0;\n var normalisedPos = 0;\n if (this.$triggerButton) {\n var verticalPadding = 4;\n var horizontalPadding = 2;\n var a = this.$triggerButton.offset().top;\n var b = this.extension.$element.offset().top;\n var d = this.$element.outerHeight(true);\n var e = (a - b) - d;\n top = e + verticalPadding;\n var f = this.$triggerButton.offset().left;\n var g = this.extension.$element.offset().left;\n var h = f - g;\n normalisedPos = Utils.Maths.normalise(h, 0, this.extension.width());\n left = Math.floor((this.extension.width() * normalisedPos) - ((this.$element.width()) * normalisedPos)) + horizontalPadding;\n arrowLeft = Math.floor(this.$element.width() * normalisedPos);\n }\n this.$bottom.css('backgroundPosition', arrowLeft + 'px 0px');\n this.$element.css({\n 'top': top,\n 'left': left\n });\n };\n Dialogue.prototype.open = function (triggerButton) {\n var _this = this;\n this.$element.attr('aria-hidden', 'false');\n this.$element.show();\n if (triggerButton) {\n this.$triggerButton = $(triggerButton);\n this.$bottom.show();\n }\n else {\n this.$bottom.hide();\n }\n this.isActive = true;\n // set the focus to the default button.\n setTimeout(function () {\n var $defaultButton = _this.$element.find('.default');\n if ($defaultButton.length) {\n $defaultButton.focus();\n }\n else {\n // if there's no default button, focus on the first visible input\n var $input = _this.$element.find('input:visible').first();\n if ($input.length) {\n $input.focus();\n }\n else {\n // if there's no visible first input, focus on the close button\n _this.$closeButton.focus();\n }\n }\n }, 1);\n this.component.publish(BaseEvents_1.BaseEvents.SHOW_OVERLAY);\n if (this.isUnopened) {\n this.isUnopened = false;\n this.afterFirstOpen();\n }\n this.resize();\n };\n Dialogue.prototype.afterFirstOpen = function () {\n };\n Dialogue.prototype.close = function () {\n if (!this.isActive)\n return;\n this.$element.attr('aria-hidden', 'true');\n this.$element.hide();\n this.isActive = false;\n this.component.publish(this.closeCommand);\n this.component.publish(BaseEvents_1.BaseEvents.HIDE_OVERLAY);\n };\n Dialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$element.css({\n 'top': Math.floor((this.extension.height() / 2) - (this.$element.height() / 2)),\n 'left': Math.floor((this.extension.width() / 2) - (this.$element.width() / 2))\n });\n };\n return Dialogue;\n }(BaseView_1.BaseView));\n exports.Dialogue = Dialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/AuthDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\", \"../../Utils\"], function (require, exports, BaseEvents_1, Dialogue_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var AuthDialogue = /** @class */ (function (_super) {\n __extends(AuthDialogue, _super);\n function AuthDialogue($element) {\n return _super.call(this, $element) || this;\n }\n AuthDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('authDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_AUTH_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_AUTH_DIALOGUE;\n this.component.subscribe(this.openCommand, function (e) {\n _this.closeCallback = e.closeCallback;\n _this.confirmCallback = e.confirmCallback;\n _this.cancelCallback = e.cancelCallback;\n _this.service = e.service;\n _this.open();\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$title = $('

');\n this.$content.append(this.$title);\n this.$content.append('\\\r\n
\\\r\n

\\\r\n
');\n this.$buttons.prepend(this._buttonsToAdd());\n this.$message = this.$content.find('.message');\n this.$confirmButton = this.$buttons.find('.confirm');\n this.$confirmButton.text(this.content.confirm);\n this.$cancelButton = this.$buttons.find('.close');\n this.$cancelButton.text(this.content.cancel);\n this.$element.hide();\n this.$confirmButton.on('click', function (e) {\n e.preventDefault();\n if (_this.confirmCallback) {\n _this.confirmCallback();\n }\n _this.close();\n });\n this.$cancelButton.on('click', function (e) {\n e.preventDefault();\n if (_this.cancelCallback) {\n _this.cancelCallback();\n }\n _this.close();\n });\n };\n AuthDialogue.prototype.open = function () {\n _super.prototype.open.call(this);\n var header = this.service.getHeader();\n var description = this.service.getDescription();\n var confirmLabel = this.service.getConfirmLabel();\n if (header) {\n this.$title.text(Utils_1.UVUtils.sanitize(header));\n }\n if (description) {\n this.$message.html(Utils_1.UVUtils.sanitize(description));\n this.$message.targetBlank();\n this.$message.find('a').on('click', function () {\n var url = $(this).attr('href');\n this.component.publish(BaseEvents_1.BaseEvents.EXTERNAL_LINK_CLICKED, url);\n });\n }\n if (confirmLabel) {\n this.$confirmButton.text(Utils_1.UVUtils.sanitize(confirmLabel));\n }\n this.resize();\n };\n AuthDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n AuthDialogue.prototype._buttonsToAdd = function () {\n var buttonsToAdd = '';\n // If the top button is enabled, add an additional close button for consistency.\n if (this.config.topCloseButtonEnabled) {\n buttonsToAdd += '';\n }\n return buttonsToAdd;\n };\n return AuthDialogue;\n }(Dialogue_1.Dialogue));\n exports.AuthDialogue = AuthDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/ClickThroughDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ClickThroughDialogue = /** @class */ (function (_super) {\n __extends(ClickThroughDialogue, _super);\n function ClickThroughDialogue($element) {\n return _super.call(this, $element) || this;\n }\n ClickThroughDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('clickThroughDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_CLICKTHROUGH_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_CLICKTHROUGH_DIALOGUE;\n this.component.subscribe(this.openCommand, function (params) {\n _this.acceptCallback = params.acceptCallback;\n _this.resource = params.resource;\n _this.open();\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$title = $('

');\n this.$content.append(this.$title);\n this.$content.append('\\\n
\\\n

\\\n
\\\n \\\n
\\\n
');\n this.$message = this.$content.find(\".message\");\n this.$acceptTermsButton = this.$content.find(\".acceptTerms\");\n // TODO: get from config this.$acceptTermsButton.text(this.content.acceptTerms); // figure out config\n this.$acceptTermsButton.text(\"Accept Terms and Open\");\n this.$element.hide();\n this.$acceptTermsButton.on('click', function (e) {\n e.preventDefault();\n _this.close();\n _this.component.publish(BaseEvents_1.BaseEvents.ACCEPT_TERMS);\n if (_this.acceptCallback)\n _this.acceptCallback();\n });\n };\n ClickThroughDialogue.prototype.open = function () {\n _super.prototype.open.call(this);\n if (this.resource.clickThroughService) {\n this.$title.text(this.resource.clickThroughService.getProperty('label'));\n this.$message.html(this.resource.clickThroughService.getProperty('description'));\n this.$message.targetBlank();\n }\n this.$message.find('a').on('click', function () {\n var url = $(this).attr('href');\n this.component.publish(BaseEvents_1.BaseEvents.EXTERNAL_LINK_CLICKED, url);\n });\n this.resize();\n };\n ClickThroughDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ClickThroughDialogue;\n }(Dialogue_1.Dialogue));\n exports.ClickThroughDialogue = ClickThroughDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/LoginDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var LoginDialogue = /** @class */ (function (_super) {\n __extends(LoginDialogue, _super);\n function LoginDialogue($element) {\n return _super.call(this, $element) || this;\n }\n LoginDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('loginDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_LOGIN_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_LOGIN_DIALOGUE;\n this.component.subscribe(this.openCommand, function (e) {\n _this.loginCallback = e.loginCallback;\n _this.logoutCallback = e.logoutCallback;\n _this.options = e.options;\n _this.resource = e.resource;\n _this.open();\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$title = $('

');\n this.$content.append(this.$title);\n this.$content.append('\\\n
\\\n

\\\n
\\\n \\\n \\\n \\\n
\\\n
');\n this.$message = this.$content.find('.message');\n this.$loginButton = this.$content.find('.login');\n this.$loginButton.text(this.content.login);\n this.$logoutButton = this.$content.find('.logout');\n this.$logoutButton.text(this.content.logout);\n this.$cancelButton = this.$content.find('.cancel');\n this.$cancelButton.text(this.content.cancel);\n this.$element.hide();\n this.$loginButton.on('click', function (e) {\n e.preventDefault();\n _this.close();\n if (_this.loginCallback)\n _this.loginCallback();\n });\n this.$logoutButton.on('click', function (e) {\n e.preventDefault();\n _this.close();\n if (_this.logoutCallback)\n _this.logoutCallback();\n });\n this.$cancelButton.on('click', function (e) {\n e.preventDefault();\n _this.close();\n });\n this.updateLogoutButton();\n };\n LoginDialogue.prototype.open = function () {\n _super.prototype.open.call(this);\n var message = \"\";\n if (this.resource.loginService) {\n this.$title.text(this.resource.loginService.getProperty('label'));\n message = this.resource.loginService.getProperty('description');\n }\n if (this.options.warningMessage) {\n message = '' + this.extension.data.config.content[this.options.warningMessage] + '' + message + '';\n }\n this.updateLogoutButton();\n this.$message.html(message);\n this.$message.targetBlank();\n this.$message.find('a').on('click', function () {\n var url = $(this).attr('href');\n this.component.publish(BaseEvents_1.BaseEvents.EXTERNAL_LINK_CLICKED, url);\n });\n if (this.options.showCancelButton) {\n this.$cancelButton.show();\n }\n else {\n this.$cancelButton.hide();\n }\n this.resize();\n };\n LoginDialogue.prototype.updateLogoutButton = function () {\n if (this.extension.isLoggedIn) {\n this.$logoutButton.show();\n }\n else {\n this.$logoutButton.hide();\n }\n };\n LoginDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return LoginDialogue;\n }(Dialogue_1.Dialogue));\n exports.LoginDialogue = LoginDialogue;\n});\n\n", - "define('modules/uv-shared-module/StringValue',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var StringValue = /** @class */ (function () {\n function StringValue(value) {\n this.value = \"\";\n if (value) {\n this.value = value.toLowerCase();\n }\n }\n StringValue.prototype.toString = function () {\n return this.value;\n };\n return StringValue;\n }());\n exports.StringValue = StringValue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/MetricType',[\"require\", \"exports\", \"./StringValue\"], function (require, exports, StringValue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var MetricType = /** @class */ (function (_super) {\n __extends(MetricType, _super);\n function MetricType() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MetricType.DESKTOP = new MetricType(\"desktop\");\n MetricType.MOBILELANDSCAPE = new MetricType(\"mobilelandscape\");\n MetricType.MOBILEPORTRAIT = new MetricType(\"mobileportrait\");\n MetricType.NONE = new MetricType(\"none\");\n MetricType.WATCH = new MetricType(\"watch\");\n return MetricType;\n }(StringValue_1.StringValue));\n exports.MetricType = MetricType;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/RestrictedDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var RestrictedDialogue = /** @class */ (function (_super) {\n __extends(RestrictedDialogue, _super);\n function RestrictedDialogue($element) {\n return _super.call(this, $element) || this;\n }\n RestrictedDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('restrictedDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_RESTRICTED_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_RESTRICTED_DIALOGUE;\n this.component.subscribe(this.openCommand, function (e) {\n _this.acceptCallback = e.acceptCallback;\n _this.options = e.options;\n _this.resource = e.resource;\n _this.open();\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$title = $('

');\n this.$content.append(this.$title);\n this.$content.append('\\\n
\\\n

\\\n
\\\n \\\n
\\\n
');\n this.$message = this.$content.find('.message');\n this.$message.targetBlank();\n // todo: revisit?\n //this.$nextVisibleButton = this.$content.find('.nextvisible');\n //this.$nextVisibleButton.text(this.content.nextVisibleItem);\n this.$cancelButton = this.$content.find('.cancel');\n this.$cancelButton.text(this.content.cancel);\n this.$element.hide();\n this.$cancelButton.on('click', function (e) {\n e.preventDefault();\n _this.close();\n });\n };\n RestrictedDialogue.prototype.open = function () {\n _super.prototype.open.call(this);\n this.isAccepted = false;\n var message = \"\";\n if (this.resource.restrictedService) {\n this.$title.text(this.resource.restrictedService.getProperty('label'));\n message = this.resource.restrictedService.getProperty('description');\n }\n this.$message.html(message);\n this.$message.targetBlank();\n this.$message.find('a').on('click', function () {\n var url = $(this).attr('href');\n this.component.publish(BaseEvents_1.BaseEvents.EXTERNAL_LINK_CLICKED, url);\n });\n this.resize();\n };\n RestrictedDialogue.prototype.close = function () {\n _super.prototype.close.call(this);\n if (!this.isAccepted && this.acceptCallback) {\n this.isAccepted = true;\n this.acceptCallback();\n }\n };\n RestrictedDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return RestrictedDialogue;\n }(Dialogue_1.Dialogue));\n exports.RestrictedDialogue = RestrictedDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/GenericDialogue',[\"require\", \"exports\", \"./BaseEvents\", \"./Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var GenericDialogue = /** @class */ (function (_super) {\n __extends(GenericDialogue, _super);\n function GenericDialogue($element) {\n return _super.call(this, $element) || this;\n }\n GenericDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('genericDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_GENERIC_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_GENERIC_DIALOGUE;\n this.component.subscribe(this.openCommand, function (params) {\n _this.acceptCallback = params.acceptCallback;\n _this.showMessage(params);\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$message = $('

');\n this.$content.append(this.$message);\n this.$acceptButton = $(\"\\n \\n \");\n this.$buttons.append(this.$acceptButton);\n // Hide the redundant close button\n this.$buttons.find('.close').hide();\n this.$acceptButton.onPressed(function () {\n _this.accept();\n });\n this.returnFunc = function () {\n if (_this.isActive) {\n _this.accept();\n }\n };\n this.$element.hide();\n };\n GenericDialogue.prototype.accept = function () {\n this.component.publish(BaseEvents_1.BaseEvents.CLOSE_ACTIVE_DIALOGUE);\n if (this.acceptCallback)\n this.acceptCallback();\n };\n GenericDialogue.prototype.showMessage = function (params) {\n this.$message.html(params.message);\n if (params.buttonText) {\n this.$acceptButton.text(params.buttonText);\n }\n else {\n this.$acceptButton.text(this.content.ok);\n }\n if (params.allowClose === false) {\n this.disableClose();\n }\n this.open();\n };\n GenericDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return GenericDialogue;\n }(Dialogue_1.Dialogue));\n exports.GenericDialogue = GenericDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/Shell',[\"require\", \"exports\", \"./BaseEvents\", \"./BaseView\", \"./GenericDialogue\"], function (require, exports, BaseEvents_1, BaseView_1, GenericDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Shell = /** @class */ (function (_super) {\n __extends(Shell, _super);\n function Shell($element) {\n return _super.call(this, $element, true, true) || this;\n }\n Shell.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_OVERLAY, function () {\n _this.$overlays.show();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_OVERLAY, function () {\n _this.$overlays.hide();\n });\n this.$headerPanel = $('
');\n this.$element.append(this.$headerPanel);\n this.$mainPanel = $('
');\n this.$element.append(this.$mainPanel);\n this.$centerPanel = $('
');\n this.$mainPanel.append(this.$centerPanel);\n this.$leftPanel = $('
');\n this.$mainPanel.append(this.$leftPanel);\n this.$rightPanel = $('
');\n this.$mainPanel.append(this.$rightPanel);\n this.$footerPanel = $('
');\n this.$element.append(this.$footerPanel);\n this.$mobileFooterPanel = $('
');\n this.$element.append(this.$mobileFooterPanel);\n this.$overlays = $('
');\n this.$element.append(this.$overlays);\n this.$genericDialogue = $('
');\n this.$overlays.append(this.$genericDialogue);\n this.$overlays.on('click', function (e) {\n if ($(e.target).hasClass('overlays')) {\n e.preventDefault();\n _this.component.publish(BaseEvents_1.BaseEvents.CLOSE_ACTIVE_DIALOGUE);\n }\n });\n // create shared views.\n new GenericDialogue_1.GenericDialogue(this.$genericDialogue);\n };\n Shell.prototype.resize = function () {\n var _this = this;\n _super.prototype.resize.call(this);\n setTimeout(function () {\n _this.$overlays.width(_this.extension.width());\n _this.$overlays.height(_this.extension.height());\n }, 1);\n var mainHeight = this.$element.height() - parseInt(this.$mainPanel.css('paddingTop'))\n - (this.$headerPanel.is(':visible') ? this.$headerPanel.height() : 0)\n - (this.$footerPanel.is(':visible') ? this.$footerPanel.height() : 0)\n - (this.$mobileFooterPanel.is(':visible') ? this.$mobileFooterPanel.height() : 0);\n this.$mainPanel.height(mainHeight);\n };\n return Shell;\n }(BaseView_1.BaseView));\n exports.Shell = Shell;\n});\n\n", - "define('SynchronousRequire',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SynchronousRequire = /** @class */ (function () {\n function SynchronousRequire() {\n }\n SynchronousRequire.load = function (deps, cb) {\n var loaders = [];\n for (var i = 0; i < deps.length; i++) {\n var depLoader = new DependencyLoader(i, deps[i], deps, cb);\n loaders.push(depLoader);\n }\n var sequence = Promise.resolve();\n loaders.forEach(function (loader) {\n sequence = sequence.then(function () {\n return loader.load();\n });\n });\n return sequence;\n };\n return SynchronousRequire;\n }());\n exports.SynchronousRequire = SynchronousRequire;\n var DependencyLoader = /** @class */ (function () {\n function DependencyLoader(index, dep, deps, cb) {\n this._dep = dep;\n this._deps = deps;\n this._cb = cb;\n this._index = index;\n }\n DependencyLoader.prototype.getDependencyIndex = function (dep) {\n return this._deps.findIndex(function (el) { return el.includes(dep); });\n };\n DependencyLoader.prototype.load = function () {\n var that = this;\n return new Promise(function (resolve) {\n requirejs([that._dep], function (dep) {\n that._cb(that._index, dep);\n resolve();\n });\n });\n };\n return DependencyLoader;\n }());\n exports.DependencyLoader = DependencyLoader;\n});\n\n", - "define('modules/uv-shared-module/BaseExtension',[\"require\", \"exports\", \"../../Utils\", \"./Auth09\", \"./Auth1\", \"../../modules/uv-dialogues-module/AuthDialogue\", \"./BaseEvents\", \"../../modules/uv-dialogues-module/ClickThroughDialogue\", \"../../modules/uv-dialogues-module/LoginDialogue\", \"../../modules/uv-shared-module/MetricType\", \"../../modules/uv-dialogues-module/RestrictedDialogue\", \"./Shell\", \"../../SynchronousRequire\"], function (require, exports, Utils_1, Auth09_1, Auth1_1, AuthDialogue_1, BaseEvents_1, ClickThroughDialogue_1, LoginDialogue_1, MetricType_1, RestrictedDialogue_1, Shell_1, SynchronousRequire_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var BaseExtension = /** @class */ (function () {\n function BaseExtension() {\n this.isCreated = false;\n this.isLoggedIn = false;\n this.metric = MetricType_1.MetricType.NONE;\n this.metrics = [];\n this.shifted = false;\n this.tabbing = false;\n }\n BaseExtension.prototype.create = function () {\n var _this = this;\n var that = this;\n Auth09_1.Auth09.publish = this.component.publish;\n Auth1_1.Auth1.publish = this.component.publish;\n this.$element = $(this.component.options.target);\n this.$element.data(\"component\", this.component);\n this.fire(BaseEvents_1.BaseEvents.CREATE, {\n data: this.data,\n settings: this.getSettings(),\n preview: this.getSharePreview()\n });\n this._parseMetrics();\n this._initLocales();\n // add/remove classes.\n this.$element.empty();\n this.$element.removeClass();\n this.$element.addClass('uv');\n if (this.data.locales) {\n this.$element.addClass(this.data.locales[0].name.toLowerCase());\n }\n this.$element.addClass(this.name);\n this.$element.addClass('browser-' + window.browserDetect.browser);\n this.$element.addClass('browser-version-' + window.browserDetect.version);\n this.$element.prop('tabindex', 0);\n if (this.data.embedded) {\n this.$element.addClass('embedded');\n }\n if (this.isMobile()) {\n this.$element.addClass('mobile');\n }\n // todo: deprecate?\n if (this.data.isLightbox) {\n this.$element.addClass('lightbox');\n }\n if (Utils.Documents.supportsFullscreen()) {\n this.$element.addClass('fullscreen-supported');\n }\n this.$element.on('mousemove', function (e) {\n _this.mouseX = e.pageX;\n _this.mouseY = e.pageY;\n });\n // events\n if (!this.data.isReload) {\n var visibilityProp = Utils.Documents.getHiddenProp();\n if (visibilityProp) {\n var event_1 = visibilityProp.replace(/[H|h]idden/, '') + 'visibilitychange';\n document.addEventListener(event_1, function () {\n // resize after a tab has been shown (fixes safari layout issue)\n if (!Utils.Documents.isHidden()) {\n _this.resize();\n }\n });\n }\n if (Utils.Bools.getBool(this.data.config.options.dropEnabled, true)) {\n this.$element.on('drop', (function (e) {\n e.preventDefault();\n var dropUrl = e.originalEvent.dataTransfer.getData('URL');\n var a = Utils.Urls.getUrlParts(dropUrl);\n var iiifResourceUri = Utils.Urls.getQuerystringParameterFromString('manifest', a.search);\n if (!iiifResourceUri) {\n // look for collection param\n iiifResourceUri = Utils.Urls.getQuerystringParameterFromString('collection', a.search);\n }\n //var canvasUri = Utils.Urls.getQuerystringParameterFromString('canvas', url.search);\n if (iiifResourceUri) {\n _this.fire(BaseEvents_1.BaseEvents.DROP, iiifResourceUri);\n var data = {};\n data.iiifResourceUri = iiifResourceUri;\n _this.reload(data);\n }\n }));\n }\n this.$element.on('dragover', (function (e) {\n // allow drop\n e.preventDefault();\n }));\n // keyboard events.\n this.$element.on('keyup keydown', function (e) {\n _this.shifted = e.shiftKey;\n _this.tabbing = e.keyCode === KeyCodes.KeyDown.Tab;\n });\n this.$element.on('keydown', function (e) {\n var event = null;\n var preventDefault = true;\n if (!e.ctrlKey && !e.altKey && !e.shiftKey) {\n if (e.keyCode === KeyCodes.KeyDown.Enter) {\n event = BaseEvents_1.BaseEvents.RETURN;\n preventDefault = false;\n }\n if (e.keyCode === KeyCodes.KeyDown.Escape)\n event = BaseEvents_1.BaseEvents.ESCAPE;\n if (e.keyCode === KeyCodes.KeyDown.PageUp)\n event = BaseEvents_1.BaseEvents.PAGE_UP;\n if (e.keyCode === KeyCodes.KeyDown.PageDown)\n event = BaseEvents_1.BaseEvents.PAGE_DOWN;\n if (e.keyCode === KeyCodes.KeyDown.End)\n event = BaseEvents_1.BaseEvents.END;\n if (e.keyCode === KeyCodes.KeyDown.Home)\n event = BaseEvents_1.BaseEvents.HOME;\n if (e.keyCode === KeyCodes.KeyDown.NumpadPlus || e.keyCode === 171 || e.keyCode === KeyCodes.KeyDown.Equals) {\n event = BaseEvents_1.BaseEvents.PLUS;\n preventDefault = false;\n }\n if (e.keyCode === KeyCodes.KeyDown.NumpadMinus || e.keyCode === 173 || e.keyCode === KeyCodes.KeyDown.Dash) {\n event = BaseEvents_1.BaseEvents.MINUS;\n preventDefault = false;\n }\n if (that.useArrowKeysToNavigate()) {\n if (e.keyCode === KeyCodes.KeyDown.LeftArrow)\n event = BaseEvents_1.BaseEvents.LEFT_ARROW;\n if (e.keyCode === KeyCodes.KeyDown.UpArrow)\n event = BaseEvents_1.BaseEvents.UP_ARROW;\n if (e.keyCode === KeyCodes.KeyDown.RightArrow)\n event = BaseEvents_1.BaseEvents.RIGHT_ARROW;\n if (e.keyCode === KeyCodes.KeyDown.DownArrow)\n event = BaseEvents_1.BaseEvents.DOWN_ARROW;\n }\n }\n if (event) {\n if (preventDefault) {\n e.preventDefault();\n }\n _this.component.publish(event);\n }\n });\n }\n this.component.subscribe(BaseEvents_1.BaseEvents.EXIT_FULLSCREEN, function () {\n if (_this.isOverlayActive()) {\n _this.component.publish(BaseEvents_1.BaseEvents.ESCAPE);\n }\n _this.component.publish(BaseEvents_1.BaseEvents.ESCAPE);\n _this.component.publish(BaseEvents_1.BaseEvents.RESIZE);\n });\n this.$element.append('');\n this.$element.append('');\n //this.$element.append('
WatchMobile PortraitMobile LandscapeDesktop
');\n this.component.subscribe(BaseEvents_1.BaseEvents.ACCEPT_TERMS, function () {\n _this.fire(BaseEvents_1.BaseEvents.ACCEPT_TERMS);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LOGIN_FAILED, function () {\n _this.fire(BaseEvents_1.BaseEvents.LOGIN_FAILED);\n _this.showMessage(_this.data.config.content.authorisationFailedMessage);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LOGIN, function () {\n _this.isLoggedIn = true;\n _this.fire(BaseEvents_1.BaseEvents.LOGIN);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LOGOUT, function () {\n _this.isLoggedIn = false;\n _this.fire(BaseEvents_1.BaseEvents.LOGOUT);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.BOOKMARK, function () {\n _this.bookmark();\n _this.fire(BaseEvents_1.BaseEvents.BOOKMARK);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED, function () {\n _this.fire(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.data.canvasIndex = canvasIndex;\n _this.lastCanvasIndex = _this.helper.canvasIndex;\n _this.helper.canvasIndex = canvasIndex;\n _this.fire(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.data.canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLICKTHROUGH, function () {\n _this.fire(BaseEvents_1.BaseEvents.CLICKTHROUGH);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLOSE_ACTIVE_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.CLOSE_ACTIVE_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLOSE_LEFT_PANEL, function () {\n _this.fire(BaseEvents_1.BaseEvents.CLOSE_LEFT_PANEL);\n _this.resize();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLOSE_RIGHT_PANEL, function () {\n _this.fire(BaseEvents_1.BaseEvents.CLOSE_RIGHT_PANEL);\n _this.resize();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.COLLECTION_INDEX_CHANGED, function (collectionIndex) {\n _this.data.collectionIndex = collectionIndex;\n _this.fire(BaseEvents_1.BaseEvents.COLLECTION_INDEX_CHANGED, _this.data.collectionIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CREATED, function () {\n _this.isCreated = true;\n _this.fire(BaseEvents_1.BaseEvents.CREATED);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.DOWN_ARROW, function () {\n _this.fire(BaseEvents_1.BaseEvents.DOWN_ARROW);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.DOWNLOAD, function (obj) {\n _this.fire(BaseEvents_1.BaseEvents.DOWNLOAD, obj);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.END, function () {\n _this.fire(BaseEvents_1.BaseEvents.END);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ESCAPE, function () {\n _this.fire(BaseEvents_1.BaseEvents.ESCAPE);\n if (_this.isFullScreen() && !_this.isOverlayActive()) {\n _this.component.publish(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN);\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.EXTERNAL_LINK_CLICKED, function (url) {\n _this.fire(BaseEvents_1.BaseEvents.EXTERNAL_LINK_CLICKED, url);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.FEEDBACK, function () {\n _this.feedback();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.FORBIDDEN, function () {\n _this.fire(BaseEvents_1.BaseEvents.FORBIDDEN);\n _this.component.publish(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_DOWNLOAD_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_DOWNLOAD_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_EMBED_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_EMBED_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_EXTERNALCONTENT_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_EXTERNALCONTENT_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_GENERIC_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_GENERIC_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_HELP_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_HELP_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_INFORMATION, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_INFORMATION);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_LOGIN_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_LOGIN_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_OVERLAY, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_OVERLAY);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_RESTRICTED_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_RESTRICTED_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_SETTINGS_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.HIDE_SETTINGS_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HOME, function () {\n _this.fire(BaseEvents_1.BaseEvents.HOME);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFT_ARROW, function () {\n _this.fire(BaseEvents_1.BaseEvents.LEFT_ARROW);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_FINISH, function () {\n _this.fire(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_FINISH);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_START, function () {\n _this.fire(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_START);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_FINISH, function () {\n _this.fire(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_FINISH);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START, function () {\n _this.fire(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LOAD_FAILED, function () {\n _this.fire(BaseEvents_1.BaseEvents.LOAD_FAILED);\n if (!that.lastCanvasIndex == null && that.lastCanvasIndex !== that.helper.canvasIndex) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, that.lastCanvasIndex);\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.MANIFEST_INDEX_CHANGED, function (manifestIndex) {\n _this.data.manifestIndex = manifestIndex;\n _this.fire(BaseEvents_1.BaseEvents.MANIFEST_INDEX_CHANGED, _this.data.manifestIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.NOT_FOUND, function () {\n _this.fire(BaseEvents_1.BaseEvents.NOT_FOUND);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN, function () {\n _this.fire(BaseEvents_1.BaseEvents.OPEN);\n var openUri = Utils.Strings.format(_this.data.config.options.openTemplate, _this.helper.iiifResourceUri);\n window.open(openUri);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_LEFT_PANEL, function () {\n _this.fire(BaseEvents_1.BaseEvents.OPEN_LEFT_PANEL);\n _this.resize();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, function () {\n _this.fire(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_RIGHT_PANEL, function () {\n _this.fire(BaseEvents_1.BaseEvents.OPEN_RIGHT_PANEL);\n _this.resize();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.PAGE_DOWN, function () {\n _this.fire(BaseEvents_1.BaseEvents.PAGE_DOWN);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.PAGE_UP, function () {\n _this.fire(BaseEvents_1.BaseEvents.PAGE_UP);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RANGE_CHANGED, function (range) {\n if (range) {\n _this.data.rangeId = range.id;\n _this.helper.rangeId = range.id;\n _this.fire(BaseEvents_1.BaseEvents.RANGE_CHANGED, _this.data.rangeId);\n }\n else {\n _this.data.rangeId = undefined;\n _this.helper.rangeId = null;\n _this.fire(BaseEvents_1.BaseEvents.RANGE_CHANGED, null);\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RESOURCE_DEGRADED, function (resource) {\n _this.fire(BaseEvents_1.BaseEvents.RESOURCE_DEGRADED);\n Auth09_1.Auth09.handleDegraded(resource);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RETURN, function () {\n _this.fire(BaseEvents_1.BaseEvents.RETURN);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RIGHT_ARROW, function () {\n _this.fire(BaseEvents_1.BaseEvents.RIGHT_ARROW);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RIGHTPANEL_COLLAPSE_FULL_FINISH, function () {\n _this.fire(BaseEvents_1.BaseEvents.RIGHTPANEL_COLLAPSE_FULL_FINISH);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RIGHTPANEL_COLLAPSE_FULL_START, function () {\n _this.fire(BaseEvents_1.BaseEvents.RIGHTPANEL_COLLAPSE_FULL_START);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RIGHTPANEL_EXPAND_FULL_FINISH, function () {\n _this.fire(BaseEvents_1.BaseEvents.RIGHTPANEL_EXPAND_FULL_FINISH);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RIGHTPANEL_EXPAND_FULL_START, function () {\n _this.fire(BaseEvents_1.BaseEvents.RIGHTPANEL_EXPAND_FULL_START);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SEQUENCE_INDEX_CHANGED, function (sequenceIndex) {\n _this.data.sequenceIndex = sequenceIndex;\n _this.fire(BaseEvents_1.BaseEvents.SEQUENCE_INDEX_CHANGED, _this.data.sequenceIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, function (args) {\n _this.fire(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, args);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_DOWNLOAD_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_DOWNLOAD_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_EMBED_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_EMBED_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_EXTERNALCONTENT_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_EXTERNALCONTENT_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_GENERIC_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_GENERIC_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_HELP_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_HELP_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_INFORMATION, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_INFORMATION);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_LOGIN_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_LOGIN_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_CLICKTHROUGH_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_CLICKTHROUGH_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_MESSAGE, function (message) {\n _this.showMessage(message);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_RESTRICTED_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_RESTRICTED_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_OVERLAY, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_OVERLAY);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_SETTINGS_DIALOGUE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_SETTINGS_DIALOGUE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_TERMS_OF_USE, function () {\n _this.fire(BaseEvents_1.BaseEvents.SHOW_TERMS_OF_USE);\n var terms = _this.helper.getLicense();\n if (!terms) {\n var requiredStatement = _this.helper.getRequiredStatement();\n if (requiredStatement && requiredStatement.value) {\n terms = requiredStatement.value;\n }\n }\n if (terms) {\n _this.showMessage(terms);\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.THUMB_SELECTED, function (thumb) {\n _this.fire(BaseEvents_1.BaseEvents.THUMB_SELECTED, thumb.index);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN, function () {\n $('#top').focus();\n _this.component.isFullScreen = !_this.component.isFullScreen;\n if (_this.component.isFullScreen) {\n _this.$element.addClass('fullscreen');\n }\n else {\n _this.$element.removeClass('fullscreen');\n }\n _this.fire(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN, {\n isFullScreen: _this.component.isFullScreen,\n overrideFullScreen: _this.data.config.options.overrideFullScreen\n });\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.UP_ARROW, function () {\n _this.fire(BaseEvents_1.BaseEvents.UP_ARROW);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.UPDATE_SETTINGS, function () {\n _this.fire(BaseEvents_1.BaseEvents.UPDATE_SETTINGS);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.VIEW_FULL_TERMS, function () {\n _this.fire(BaseEvents_1.BaseEvents.VIEW_FULL_TERMS);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.WINDOW_UNLOAD, function () {\n _this.fire(BaseEvents_1.BaseEvents.WINDOW_UNLOAD);\n });\n // create shell and shared views.\n this.shell = new Shell_1.Shell(this.$element);\n // dependencies\n this.getDependencies(function (deps) {\n _this.loadDependencies(deps);\n });\n };\n BaseExtension.prototype.createModules = function () {\n this.$authDialogue = $('
');\n this.shell.$overlays.append(this.$authDialogue);\n this.authDialogue = new AuthDialogue_1.AuthDialogue(this.$authDialogue);\n this.$clickThroughDialogue = $('
');\n this.shell.$overlays.append(this.$clickThroughDialogue);\n this.clickThroughDialogue = new ClickThroughDialogue_1.ClickThroughDialogue(this.$clickThroughDialogue);\n this.$restrictedDialogue = $('
');\n this.shell.$overlays.append(this.$restrictedDialogue);\n this.restrictedDialogue = new RestrictedDialogue_1.RestrictedDialogue(this.$restrictedDialogue);\n this.$loginDialogue = $('
');\n this.shell.$overlays.append(this.$loginDialogue);\n this.loginDialogue = new LoginDialogue_1.LoginDialogue(this.$loginDialogue);\n };\n BaseExtension.prototype.modulesCreated = function () {\n };\n BaseExtension.prototype.getDependencies = function (cb) {\n var that = this;\n var depsUri = this.data.root + '/lib/' + this.name + '-dependencies';\n // check if the deps are already loaded\n var scripts = $('script[data-requiremodule]')\n .filter(function () {\n var attr = $(this).attr('data-requiremodule');\n return (attr.indexOf(that.name) !== -1 && attr.indexOf('dependencies') !== -1);\n });\n if (!scripts.length) {\n requirejs([depsUri], function (getDeps) {\n // getDeps is a function that accepts a file format.\n // it uses this to determine which dependencies are appropriate\n // for example, 'application/vnd.apple.mpegurl' for the AV extension\n // would return hls.min.js, and not dash.all.min.js.\n var canvas = that.helper.getCurrentCanvas();\n var mediaFormats = that.getMediaFormats(canvas);\n var formats = [];\n if (mediaFormats && mediaFormats.length) {\n formats = mediaFormats.map(function (f) {\n return f.getFormat().toString();\n });\n }\n var deps = getDeps(formats);\n var baseUri = that.data.root + '/lib/';\n // for each dependency, prepend baseUri unless it starts with a ! which indicates to ignore it.\n // check for a requirejs.config that sets a specific path, such as the PDF extension\n if (deps.sync) {\n for (var i = 0; i < deps.sync.length; i++) {\n var dep = deps.sync[i];\n if (!dep.startsWith('!')) {\n deps.sync[i] = baseUri + dep;\n }\n }\n }\n if (deps.async) {\n for (var i = 0; i < deps.async.length; i++) {\n var dep = deps.async[i];\n if (!dep.startsWith('!')) {\n deps.async[i] = baseUri + dep;\n }\n }\n }\n cb(deps);\n });\n }\n else {\n cb(null);\n }\n };\n BaseExtension.prototype.loadDependencies = function (deps) {\n var that = this;\n if (!deps) {\n that.dependenciesLoaded();\n }\n else if (deps.sync) {\n // load each sync script.\n // necessary for cases like this: https://github.com/mrdoob/three.js/issues/9602\n // then load the async scripts\n SynchronousRequire_1.SynchronousRequire.load(deps.sync, that.dependencyLoaded).then(function () {\n if (deps.async) {\n requirejs(deps.async, function () {\n that.dependenciesLoaded(arguments);\n });\n }\n else {\n that.dependenciesLoaded();\n }\n });\n }\n else if (deps.async) {\n requirejs(deps.async, function () {\n that.dependenciesLoaded(arguments);\n });\n }\n else {\n that.dependenciesLoaded();\n }\n };\n BaseExtension.prototype.dependencyLoaded = function (index, dep) {\n };\n BaseExtension.prototype.dependenciesLoaded = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n this.createModules();\n this.modulesCreated();\n this.component.publish(BaseEvents_1.BaseEvents.RESIZE); // initial sizing\n setTimeout(function () {\n _this.render();\n _this.component.publish(BaseEvents_1.BaseEvents.CREATED);\n _this._setDefaultFocus();\n }, 1);\n };\n BaseExtension.prototype.render = function () {\n if (!this.isCreated || (this.data.collectionIndex !== this.helper.collectionIndex)) {\n this.component.publish(BaseEvents_1.BaseEvents.COLLECTION_INDEX_CHANGED, this.data.collectionIndex);\n }\n if (!this.isCreated || (this.data.manifestIndex !== this.helper.manifestIndex)) {\n this.component.publish(BaseEvents_1.BaseEvents.MANIFEST_INDEX_CHANGED, this.data.manifestIndex);\n }\n if (!this.isCreated || (this.data.sequenceIndex !== this.helper.sequenceIndex)) {\n this.component.publish(BaseEvents_1.BaseEvents.SEQUENCE_INDEX_CHANGED, this.data.sequenceIndex);\n }\n if (!this.isCreated || (this.data.canvasIndex !== this.helper.canvasIndex)) {\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, this.data.canvasIndex);\n }\n if (!this.isCreated || (this.data.rangeId !== this.helper.rangeId)) {\n if (this.data.rangeId) {\n var range = this.helper.getRangeById(this.data.rangeId);\n if (range) {\n this.component.publish(BaseEvents_1.BaseEvents.RANGE_CHANGED, range);\n }\n else {\n console.warn('range id not found:', this.data.rangeId);\n }\n }\n }\n };\n BaseExtension.prototype._setDefaultFocus = function () {\n var _this = this;\n setTimeout(function () {\n if (_this.data.config.options.allowStealFocus) {\n $('[tabindex=0]').focus();\n }\n }, 1);\n };\n BaseExtension.prototype.width = function () {\n return this.$element.width();\n };\n BaseExtension.prototype.height = function () {\n return this.$element.height();\n };\n BaseExtension.prototype.exitFullScreen = function () {\n this.component.publish(BaseEvents_1.BaseEvents.EXIT_FULLSCREEN);\n };\n BaseExtension.prototype.fire = function (name) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n this.component.fire(name, arguments[1]);\n };\n BaseExtension.prototype.redirect = function (uri) {\n this.fire(BaseEvents_1.BaseEvents.REDIRECT, uri);\n };\n BaseExtension.prototype.refresh = function () {\n this.fire(BaseEvents_1.BaseEvents.REFRESH, null);\n };\n BaseExtension.prototype._initLocales = function () {\n var availableLocales = this.data.config.localisation.locales.slice(0);\n var configuredLocales = this.data.locales;\n var finalLocales = [];\n // loop through configuredLocales array (those passed in when initialising the UV component)\n // if availableLocales (those available in each extension's l10n directory) contains a configured locale, add it to finalLocales.\n // if the configured locale has a label, substitute it\n // mark locale as added.\n // if limitLocales is disabled,\n // loop through remaining availableLocales and add to finalLocales.\n if (configuredLocales) {\n configuredLocales.forEach(function (configuredLocale) {\n var match = availableLocales.filter(function (item) { return item.name === configuredLocale.name; });\n if (match.length) {\n var m = match[0];\n if (configuredLocale.label)\n m.label = configuredLocale.label;\n m.added = true;\n finalLocales.push(m);\n }\n });\n var limitLocales = Utils.Bools.getBool(this.data.config.options.limitLocales, false);\n if (!limitLocales) {\n availableLocales.forEach(function (availableLocale) {\n if (!availableLocale.added) {\n finalLocales.push(availableLocale);\n }\n delete availableLocale.added;\n });\n }\n this.data.locales = finalLocales;\n }\n else {\n console.warn(\"No locales configured\");\n }\n };\n BaseExtension.prototype._parseMetrics = function () {\n var metrics = this.data.config.options.metrics;\n if (metrics) {\n for (var i = 0; i < metrics.length; i++) {\n var m = metrics[i];\n if (typeof (m.type) === \"string\") {\n m.type = new MetricType_1.MetricType(m.type);\n }\n this.metrics.push(m);\n }\n }\n };\n BaseExtension.prototype._updateMetric = function () {\n var _this = this;\n setTimeout(function () {\n // loop through all metrics\n // find one that matches the current dimensions\n // if a metric is found, and it's not the current metric, set it to be the current metric and publish a METRIC_CHANGED event\n // if no metric is found, set MetricType.NONE to be the current metric and publish a METRIC_CHANGED event\n var metricFound = false;\n for (var i = 0; i < _this.metrics.length; i++) {\n var metric = _this.metrics[i];\n // if the current width and height is within this metric's defined range\n if (_this.width() >= metric.minWidth && _this.width() <= metric.maxWidth &&\n _this.height() >= metric.minHeight && _this.height() <= metric.maxHeight) {\n metricFound = true;\n if (_this.metric !== metric.type) {\n _this.metric = metric.type;\n _this.component.publish(BaseEvents_1.BaseEvents.METRIC_CHANGED);\n }\n }\n }\n if (!metricFound) {\n if (_this.metric !== MetricType_1.MetricType.NONE) {\n _this.metric = MetricType_1.MetricType.NONE;\n _this.component.publish(BaseEvents_1.BaseEvents.METRIC_CHANGED);\n }\n }\n }, 1);\n };\n BaseExtension.prototype.resize = function () {\n this._updateMetric();\n this.component.publish(BaseEvents_1.BaseEvents.RESIZE);\n };\n // re-bootstraps the application with new querystring params\n BaseExtension.prototype.reload = function (data) {\n this.component.publish(BaseEvents_1.BaseEvents.RELOAD, data);\n };\n BaseExtension.prototype.isSeeAlsoEnabled = function () {\n return this.data.config.options.seeAlsoEnabled !== false;\n };\n BaseExtension.prototype.getShareUrl = function () {\n // If not embedded on an external domain (this causes CORS errors when fetching parent url)\n if (!this.data.embedded) {\n // Use the current page URL with hash params\n if (Utils.Documents.isInIFrame()) {\n return parent.document.location.href;\n }\n else {\n return document.location.href;\n }\n }\n else {\n // If there's a `related` property of format `text/html` in the manifest\n if (this.helper.hasRelatedPage()) {\n // Use the `related` property in the URL box\n var related = this.helper.getRelated();\n if (related && related.length) {\n related = related[0];\n }\n return related['@id'];\n }\n }\n return null;\n };\n BaseExtension.prototype.getIIIFShareUrl = function () {\n return this.helper.iiifResourceUri + \"?manifest=\" + this.helper.iiifResourceUri;\n };\n BaseExtension.prototype.addTimestamp = function (uri) {\n return uri + \"?t=\" + Utils.Dates.getTimeStamp();\n };\n BaseExtension.prototype.getDomain = function () {\n var parts = Utils.Urls.getUrlParts(this.helper.iiifResourceUri);\n return parts.host;\n };\n BaseExtension.prototype.getAppUri = function () {\n var parts = Utils.Urls.getUrlParts(document.location.href);\n var origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '');\n var pathname = parts.pathname;\n if (!pathname.startsWith('/')) {\n pathname = '/' + pathname;\n }\n pathname = pathname.substr(0, pathname.lastIndexOf('/') + 1); // remove the file name\n var appUri = origin + pathname;\n var root = '';\n if (!Utils.Documents.isInIFrame()) {\n root = this.data.root || '';\n if (root.startsWith('./')) {\n root = root.substr(2);\n }\n if (root && !root.endsWith('/')) {\n root += '/';\n }\n }\n // if root is a URL, use that instead of appUri.\n if (Utils_1.UVUtils.isValidUrl(root)) {\n return root + 'uv.html';\n }\n return appUri + root + 'uv.html';\n };\n BaseExtension.prototype.getSettings = function () {\n if (Utils.Bools.getBool(this.data.config.options.saveUserSettings, false)) {\n var settings = Utils.Storage.get(\"uv.settings\", Utils.StorageType.local);\n if (settings) {\n return $.extend(this.data.config.options, settings.value);\n }\n }\n return this.data.config.options;\n };\n BaseExtension.prototype.updateSettings = function (settings) {\n if (Utils.Bools.getBool(this.data.config.options.saveUserSettings, false)) {\n var storedSettings = Utils.Storage.get(\"uv.settings\", Utils.StorageType.local);\n if (storedSettings) {\n settings = $.extend(storedSettings.value, settings);\n }\n // store for ten years\n Utils.Storage.set(\"uv.settings\", settings, 315360000, Utils.StorageType.local);\n }\n this.data.config.options = $.extend(this.data.config.options, settings);\n };\n BaseExtension.prototype.getLocale = function () {\n return this.helper.options.locale;\n };\n BaseExtension.prototype.getSharePreview = function () {\n var title = this.helper.getLabel();\n // todo: use getThumb (when implemented)\n var canvas = this.helper.getCurrentCanvas();\n var thumbnail = canvas.getProperty('thumbnail');\n if (!thumbnail || !(typeof (thumbnail) === 'string')) {\n thumbnail = canvas.getCanonicalImageUri(this.data.config.options.bookmarkThumbWidth);\n }\n return {\n title: title,\n image: thumbnail\n };\n };\n BaseExtension.prototype.getPagedIndices = function (canvasIndex) {\n if (canvasIndex === void 0) { canvasIndex = this.helper.canvasIndex; }\n return [canvasIndex];\n };\n BaseExtension.prototype.getCurrentCanvases = function () {\n var indices = this.getPagedIndices(this.helper.canvasIndex);\n var canvases = [];\n for (var i = 0; i < indices.length; i++) {\n var index = indices[i];\n var canvas = this.helper.getCanvasByIndex(index);\n canvases.push(canvas);\n }\n return canvases;\n };\n BaseExtension.prototype.getCanvasLabels = function (label) {\n var indices = this.getPagedIndices();\n var labels = \"\";\n if (indices.length === 1) {\n labels = label;\n }\n else {\n for (var i = 1; i <= indices.length; i++) {\n if (labels.length)\n labels += \",\";\n labels += label + \" \" + i;\n }\n }\n return labels;\n };\n BaseExtension.prototype.getCurrentCanvasRange = function () {\n //var rangePath: string = this.currentRangePath ? this.currentRangePath : '';\n //var range: Manifesto.IRange = this.helper.getCanvasRange(this.helper.getCurrentCanvas(), rangePath);\n var range = this.helper.getCanvasRange(this.helper.getCurrentCanvas());\n return range;\n };\n // todo: move to manifold?\n BaseExtension.prototype.getExternalResources = function (resources) {\n var _this = this;\n var indices = this.getPagedIndices();\n var resourcesToLoad = [];\n indices.forEach(function (index) {\n var canvas = _this.helper.getCanvasByIndex(index);\n var r;\n if (!canvas.externalResource) {\n r = new Manifold.ExternalResource(canvas, {\n authApiVersion: _this.data.config.options.authAPIVersion\n });\n }\n else {\n r = canvas.externalResource;\n }\n // reload resources if passed\n if (resources) {\n var found = resources.find(function (f) {\n return f.dataUri === r.dataUri;\n });\n if (found) {\n resourcesToLoad.push(found);\n }\n else {\n resourcesToLoad.push(r);\n }\n }\n else {\n resourcesToLoad.push(r);\n }\n });\n var storageStrategy = this.data.config.options.tokenStorage;\n var authAPIVersion = this.data.config.options.authAPIVersion;\n // if using auth api v1\n if (authAPIVersion === 1) {\n return new Promise(function (resolve) {\n var options = {\n locale: _this.helper.options.locale\n };\n Auth1_1.Auth1.loadExternalResources(resourcesToLoad, storageStrategy, options).then(function (r) {\n _this.resources = r.map(function (resource) {\n return _this._prepareResourceData(resource);\n });\n resolve(_this.resources);\n });\n });\n }\n else {\n return new Promise(function (resolve) {\n Auth09_1.Auth09.loadExternalResources(resourcesToLoad, storageStrategy).then(function (r) {\n _this.resources = r.map(function (resource) {\n return _this._prepareResourceData(resource);\n });\n resolve(_this.resources);\n });\n });\n }\n };\n // copy useful properties over to the data object to be opened in center panel's openMedia method\n // this is the info.json if there is one, which can be opened natively by openseadragon.\n BaseExtension.prototype._prepareResourceData = function (resource) {\n resource.data.hasServiceDescriptor = resource.hasServiceDescriptor();\n // if the data isn't an info.json, give it the necessary viewing properties\n if (!resource.hasServiceDescriptor()) {\n resource.data.id = resource.dataUri;\n resource.data.width = resource.width;\n resource.data.height = resource.height;\n }\n resource.data.index = resource.index;\n return Utils.Objects.toPlainObject(resource.data);\n };\n BaseExtension.prototype.getMediaFormats = function (canvas) {\n var annotations = canvas.getContent();\n if (annotations && annotations.length) {\n var annotation = annotations[0];\n return annotation.getBody();\n }\n else {\n // legacy IxIF compatibility\n var body = {\n id: canvas.id,\n type: canvas.getType(),\n getFormat: function () {\n return '';\n }\n };\n return [body];\n }\n };\n BaseExtension.prototype.viewCanvas = function (canvasIndex) {\n if (this.helper.isCanvasIndexOutOfRange(canvasIndex)) {\n this.showMessage(this.data.config.content.canvasIndexOutOfRange);\n return;\n }\n this.component.publish(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE);\n };\n BaseExtension.prototype.showMessage = function (message, acceptCallback, buttonText, allowClose) {\n this.closeActiveDialogue();\n this.component.publish(BaseEvents_1.BaseEvents.SHOW_GENERIC_DIALOGUE, {\n message: message,\n acceptCallback: acceptCallback,\n buttonText: buttonText,\n allowClose: allowClose\n });\n };\n BaseExtension.prototype.closeActiveDialogue = function () {\n this.component.publish(BaseEvents_1.BaseEvents.CLOSE_ACTIVE_DIALOGUE);\n };\n BaseExtension.prototype.isOverlayActive = function () {\n return this.shell.$overlays.is(':visible');\n };\n BaseExtension.prototype.isDesktopMetric = function () {\n return this.metric.toString() === MetricType_1.MetricType.DESKTOP.toString();\n };\n BaseExtension.prototype.isWatchMetric = function () {\n return this.metric.toString() === MetricType_1.MetricType.WATCH.toString();\n };\n BaseExtension.prototype.isCatchAllMetric = function () {\n return this.metric.toString() === MetricType_1.MetricType.NONE.toString();\n };\n // todo: use redux in manifold to get reset state\n BaseExtension.prototype.viewManifest = function (manifest) {\n var data = {};\n data.iiifResourceUri = this.helper.iiifResourceUri;\n data.collectionIndex = this.helper.getCollectionIndex(manifest);\n data.manifestIndex = manifest.index;\n data.sequenceIndex = 0;\n data.canvasIndex = 0;\n this.reload(data);\n };\n // todo: use redux in manifold to get reset state\n BaseExtension.prototype.viewCollection = function (collection) {\n var data = {};\n //data.iiifResourceUri = this.helper.iiifResourceUri;\n data.iiifResourceUri = collection.parentCollection ? collection.parentCollection.id : this.helper.iiifResourceUri;\n data.collectionIndex = collection.index;\n data.manifestIndex = 0;\n data.sequenceIndex = 0;\n data.canvasIndex = 0;\n this.reload(data);\n };\n BaseExtension.prototype.isFullScreen = function () {\n return this.component.isFullScreen;\n };\n BaseExtension.prototype.isHeaderPanelEnabled = function () {\n return Utils.Bools.getBool(this.data.config.options.headerPanelEnabled, true);\n };\n BaseExtension.prototype.isLeftPanelEnabled = function () {\n if (Utils.Bools.getBool(this.data.config.options.leftPanelEnabled, true)) {\n if (this.helper.hasParentCollection()) {\n return true;\n }\n else if (this.helper.isMultiCanvas()) {\n var viewingHint = this.helper.getViewingHint();\n if (!viewingHint || (viewingHint && viewingHint.toString() !== manifesto.ViewingHint.continuous().toString())) {\n return true;\n }\n }\n }\n return false;\n };\n BaseExtension.prototype.isRightPanelEnabled = function () {\n return Utils.Bools.getBool(this.data.config.options.rightPanelEnabled, true);\n };\n BaseExtension.prototype.isFooterPanelEnabled = function () {\n return Utils.Bools.getBool(this.data.config.options.footerPanelEnabled, true);\n };\n BaseExtension.prototype.isMobile = function () {\n return $.browser.mobile;\n };\n BaseExtension.prototype.useArrowKeysToNavigate = function () {\n return Utils.Bools.getBool(this.data.config.options.useArrowKeysToNavigate, true);\n };\n BaseExtension.prototype.bookmark = function () {\n // override for each extension\n };\n BaseExtension.prototype.feedback = function () {\n this.fire(BaseEvents_1.BaseEvents.FEEDBACK, this.data);\n };\n BaseExtension.prototype.getAlternateLocale = function () {\n var alternateLocale = null;\n if (this.data.locales && this.data.locales.length > 1) {\n alternateLocale = this.data.locales[1];\n }\n return alternateLocale;\n };\n BaseExtension.prototype.getSerializedLocales = function () {\n if (this.data.locales) {\n return this.serializeLocales(this.data.locales);\n }\n return null;\n };\n BaseExtension.prototype.serializeLocales = function (locales) {\n var serializedLocales = '';\n for (var i = 0; i < locales.length; i++) {\n var l = locales[i];\n if (i > 0)\n serializedLocales += ',';\n serializedLocales += l.name;\n if (l.label) {\n serializedLocales += ':' + l.label;\n }\n }\n return serializedLocales;\n };\n BaseExtension.prototype.changeLocale = function (locale) {\n // re-order locales so the passed locale is first\n var data = {};\n if (this.data.locales) {\n data.locales = this.data.locales.slice(0);\n var fromIndex = data.locales.findIndex(function (l) {\n return l.name === locale;\n });\n var toIndex = 0;\n data.locales.splice(toIndex, 0, data.locales.splice(fromIndex, 1)[0]);\n this.reload(data);\n }\n };\n return BaseExtension;\n }());\n exports.BaseExtension = BaseExtension;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-contentleftpanel-module/GalleryView',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/BaseView\"], function (require, exports, BaseEvents_1, BaseView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var GalleryView = /** @class */ (function (_super) {\n __extends(GalleryView, _super);\n function GalleryView($element) {\n var _this = _super.call(this, $element, true, true) || this;\n _this.isOpen = false;\n return _this;\n }\n GalleryView.prototype.create = function () {\n this.setConfig('contentLeftPanel');\n _super.prototype.create.call(this);\n // search preview doesn't work well with the gallery because it loads thumbs in \"chunks\"\n // this.component.subscribe(Events.SEARCH_PREVIEW_START, (e, canvasIndex) => {\n // this.galleryComponent.searchPreviewStart(canvasIndex);\n // });\n // this.component.subscribe(Events.SEARCH_PREVIEW_FINISH, () => {\n // this.galleryComponent.searchPreviewFinish();\n // });\n this.$gallery = $('');\n this.$element.append(this.$gallery);\n // stencil.js demo\n // const gallery = document.createElement('iiif-gallery');\n // gallery.setAttribute('manifest', this.extension.helper.manifest.id);\n // this.$element[0].appendChild(gallery);\n };\n GalleryView.prototype.setup = function () {\n var that = this;\n this.galleryComponent = new IIIFComponents.GalleryComponent({\n target: this.$gallery[0]\n });\n this.galleryComponent.on('thumbSelected', function (thumb) {\n that.component.publish(BaseEvents_1.BaseEvents.GALLERY_THUMB_SELECTED, thumb);\n that.component.publish(BaseEvents_1.BaseEvents.THUMB_SELECTED, thumb);\n }, false);\n this.galleryComponent.on('decreaseSize', function () {\n that.component.publish(BaseEvents_1.BaseEvents.GALLERY_DECREASE_SIZE);\n }, false);\n this.galleryComponent.on('increaseSize', function () {\n that.component.publish(BaseEvents_1.BaseEvents.GALLERY_INCREASE_SIZE);\n }, false);\n };\n GalleryView.prototype.databind = function () {\n this.galleryComponent.options.data = this.galleryData;\n this.galleryComponent.set(this.galleryData);\n this.resize();\n };\n GalleryView.prototype.show = function () {\n var _this = this;\n this.isOpen = true;\n this.$element.show();\n // todo: would be better to have no imperative methods on components and use a reactive pattern\n setTimeout(function () {\n _this.galleryComponent.selectIndex(_this.extension.helper.canvasIndex);\n }, 10);\n };\n GalleryView.prototype.hide = function () {\n this.isOpen = false;\n this.$element.hide();\n };\n GalleryView.prototype.resize = function () {\n _super.prototype.resize.call(this);\n var $main = this.$gallery.find('.main');\n var $header = this.$gallery.find('.header');\n $main.height(this.$element.height() - $header.height());\n };\n return GalleryView;\n }(BaseView_1.BaseView));\n exports.GalleryView = GalleryView;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/BaseExpandPanel',[\"require\", \"exports\", \"./BaseView\"], function (require, exports, BaseView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var BaseExpandPanel = /** @class */ (function (_super) {\n __extends(BaseExpandPanel, _super);\n function BaseExpandPanel($element) {\n var _this = _super.call(this, $element, false, true) || this;\n _this.isExpanded = false;\n _this.isFullyExpanded = false;\n _this.isUnopened = true;\n _this.autoToggled = false;\n _this.expandFullEnabled = true;\n return _this;\n }\n BaseExpandPanel.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n this.$top = $('
');\n this.$element.append(this.$top);\n this.$title = $('
');\n this.$title.prop('title', this.content.title);\n this.$top.append(this.$title);\n this.$expandFullButton = $('');\n this.$expandFullButton.prop('title', this.content.expandFull);\n this.$top.append(this.$expandFullButton);\n if (!Utils.Bools.getBool(this.config.options.expandFullEnabled, true)) {\n this.$expandFullButton.hide();\n }\n this.$collapseButton = $('
');\n this.$collapseButton.prop('title', this.content.collapse);\n this.$top.append(this.$collapseButton);\n this.$closed = $('
');\n this.$element.append(this.$closed);\n this.$expandButton = $('');\n this.$expandButton.prop('title', this.content.expand);\n this.$closed.append(this.$expandButton);\n this.$closedTitle = $('');\n this.$closedTitle.prop('title', this.content.title);\n this.$closed.append(this.$closedTitle);\n this.$main = $('
');\n this.$element.append(this.$main);\n this.$expandButton.onPressed(function () {\n _this.toggle();\n });\n this.$expandFullButton.onPressed(function () {\n _this.expandFull();\n });\n this.$closedTitle.onPressed(function () {\n _this.toggle();\n });\n this.$title.onPressed(function () {\n if (_this.isFullyExpanded) {\n _this.collapseFull();\n }\n else {\n _this.toggle();\n }\n });\n this.$collapseButton.onPressed(function () {\n if (_this.isFullyExpanded) {\n _this.collapseFull();\n }\n else {\n _this.toggle();\n }\n });\n this.$top.hide();\n this.$main.hide();\n };\n BaseExpandPanel.prototype.init = function () {\n _super.prototype.init.call(this);\n };\n BaseExpandPanel.prototype.setTitle = function (title) {\n this.$title.text(title);\n this.$closedTitle.text(title);\n };\n BaseExpandPanel.prototype.toggle = function (autoToggled) {\n var _this = this;\n (autoToggled) ? this.autoToggled = true : this.autoToggled = false;\n // if collapsing, hide contents immediately.\n if (this.isExpanded) {\n this.$top.attr('aria-hidden', 'true');\n this.$main.attr('aria-hidden', 'true');\n this.$closed.attr('aria-hidden', 'false');\n this.$top.hide();\n this.$main.hide();\n this.$closed.show();\n }\n this.$element.stop().animate({\n width: this.getTargetWidth(),\n left: this.getTargetLeft()\n }, this.options.panelAnimationDuration, function () {\n _this.toggled();\n });\n };\n BaseExpandPanel.prototype.toggled = function () {\n this.toggleStart();\n this.isExpanded = !this.isExpanded;\n // if expanded show content when animation finished.\n if (this.isExpanded) {\n this.$top.attr('aria-hidden', 'false');\n this.$main.attr('aria-hidden', 'false');\n this.$closed.attr('aria-hidden', 'true');\n this.$closed.hide();\n this.$top.show();\n this.$main.show();\n }\n this.toggleFinish();\n this.isUnopened = false;\n };\n BaseExpandPanel.prototype.expandFull = function () {\n var _this = this;\n if (!this.isExpanded) {\n this.toggled();\n }\n var targetWidth = this.getFullTargetWidth();\n var targetLeft = this.getFullTargetLeft();\n this.expandFullStart();\n this.$element.stop().animate({\n width: targetWidth,\n left: targetLeft\n }, this.options.panelAnimationDuration, function () {\n _this.expandFullFinish();\n });\n };\n BaseExpandPanel.prototype.collapseFull = function () {\n var _this = this;\n var targetWidth = this.getTargetWidth();\n var targetLeft = this.getTargetLeft();\n this.collapseFullStart();\n this.$element.stop().animate({\n width: targetWidth,\n left: targetLeft\n }, this.options.panelAnimationDuration, function () {\n _this.collapseFullFinish();\n });\n };\n BaseExpandPanel.prototype.getTargetWidth = function () {\n return 0;\n };\n BaseExpandPanel.prototype.getTargetLeft = function () {\n return 0;\n };\n BaseExpandPanel.prototype.getFullTargetWidth = function () {\n return 0;\n };\n BaseExpandPanel.prototype.getFullTargetLeft = function () {\n return 0;\n };\n BaseExpandPanel.prototype.toggleStart = function () {\n };\n BaseExpandPanel.prototype.toggleFinish = function () {\n if (this.isExpanded && !this.autoToggled) {\n this.focusCollapseButton();\n }\n else {\n this.focusExpandButton();\n }\n };\n BaseExpandPanel.prototype.expandFullStart = function () {\n };\n BaseExpandPanel.prototype.expandFullFinish = function () {\n this.isFullyExpanded = true;\n this.$expandFullButton.hide();\n this.focusCollapseButton();\n };\n BaseExpandPanel.prototype.collapseFullStart = function () {\n };\n BaseExpandPanel.prototype.collapseFullFinish = function () {\n this.isFullyExpanded = false;\n if (this.expandFullEnabled) {\n this.$expandFullButton.show();\n }\n this.focusExpandFullButton();\n };\n BaseExpandPanel.prototype.focusExpandButton = function () {\n var _this = this;\n setTimeout(function () {\n _this.$expandButton.focus();\n }, 1);\n };\n BaseExpandPanel.prototype.focusExpandFullButton = function () {\n var _this = this;\n setTimeout(function () {\n _this.$expandFullButton.focus();\n }, 1);\n };\n BaseExpandPanel.prototype.focusCollapseButton = function () {\n var _this = this;\n setTimeout(function () {\n _this.$collapseButton.focus();\n }, 1);\n };\n BaseExpandPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$main.height(this.$element.parent().height() - this.$top.outerHeight(true));\n };\n return BaseExpandPanel;\n }(BaseView_1.BaseView));\n exports.BaseExpandPanel = BaseExpandPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/LeftPanel',[\"require\", \"exports\", \"./BaseEvents\", \"./BaseExpandPanel\"], function (require, exports, BaseEvents_1, BaseExpandPanel_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var LeftPanel = /** @class */ (function (_super) {\n __extends(LeftPanel, _super);\n function LeftPanel($element) {\n return _super.call(this, $element) || this;\n }\n LeftPanel.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n this.$element.width(this.options.panelCollapsedWidth);\n this.component.subscribe(BaseEvents_1.BaseEvents.TOGGLE_EXPAND_LEFT_PANEL, function () {\n if (_this.isFullyExpanded) {\n _this.collapseFull();\n }\n else {\n _this.expandFull();\n }\n });\n };\n LeftPanel.prototype.init = function () {\n _super.prototype.init.call(this);\n var shouldOpenPanel = Utils.Bools.getBool(this.extension.getSettings().leftPanelOpen, this.options.panelOpen);\n if (shouldOpenPanel) {\n this.toggle(true);\n }\n };\n LeftPanel.prototype.getTargetWidth = function () {\n if (this.isFullyExpanded || !this.isExpanded) {\n return this.options.panelExpandedWidth;\n }\n else {\n return this.options.panelCollapsedWidth;\n }\n };\n LeftPanel.prototype.getFullTargetWidth = function () {\n return this.$element.parent().width();\n };\n LeftPanel.prototype.toggleFinish = function () {\n _super.prototype.toggleFinish.call(this);\n if (this.isExpanded) {\n this.component.publish(BaseEvents_1.BaseEvents.OPEN_LEFT_PANEL);\n }\n else {\n this.component.publish(BaseEvents_1.BaseEvents.CLOSE_LEFT_PANEL);\n }\n this.extension.updateSettings({ leftPanelOpen: this.isExpanded });\n };\n LeftPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n if (this.isFullyExpanded) {\n this.$element.width(this.$element.parent().width());\n }\n };\n return LeftPanel;\n }(BaseExpandPanel_1.BaseExpandPanel));\n exports.LeftPanel = LeftPanel;\n});\n\n", - "define('extensions/uv-seadragon-extension/Mode',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Mode = /** @class */ (function () {\n function Mode(value) {\n this.value = value;\n }\n Mode.prototype.toString = function () {\n return this.value;\n };\n Mode.image = new Mode(\"image\");\n Mode.page = new Mode(\"page\");\n return Mode;\n }());\n exports.Mode = Mode;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/ThumbsView',[\"require\", \"exports\", \"./BaseEvents\", \"./BaseView\"], function (require, exports, BaseEvents_1, BaseView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ThumbsView = /** @class */ (function (_super) {\n __extends(ThumbsView, _super);\n function ThumbsView($element) {\n var _this = _super.call(this, $element, true, true) || this;\n _this.isCreated = false;\n _this.isOpen = false;\n return _this;\n }\n ThumbsView.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (index) {\n _this.selectIndex(parseInt(index));\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LOGIN, function () {\n _this.loadThumbs();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLICKTHROUGH, function () {\n _this.loadThumbs();\n });\n this.$thumbs = $('
');\n this.$element.append(this.$thumbs);\n var viewingDirection = this.extension.helper.getViewingDirection() || manifesto.ViewingDirection.leftToRight();\n this.$thumbs.addClass(viewingDirection.toString()); // defaults to \"left-to-right\"\n var that = this;\n $.templates({\n thumbsTemplate: '
index}}\" class=\"{{:~className()}}\" data-src=\"{{>uri}}\" data-visible=\"{{>visible}}\" data-index=\"{{>index}}\">\\\n
height + ~extraHeight()}}px\">
\\\n
\\\n {{:#index + 1}}\\\n label}}\">{{>label}} \\\n {{>data.searchResults}}\\\n
\\\n
\\\n {{if ~separator()}} \\\n
\\\n {{/if}}'\n });\n var extraHeight = this.options.thumbsExtraHeight;\n $.views.helpers({\n separator: function () {\n return false;\n },\n extraHeight: function () {\n return extraHeight;\n },\n className: function () {\n var className = \"thumb\";\n if (this.data.index === 0) {\n className += \" first\";\n }\n if (!this.data.uri) {\n className += \" placeholder\";\n }\n var viewingDirection = that.extension.helper.getViewingDirection();\n if (viewingDirection && (viewingDirection.toString() === manifesto.ViewingDirection.leftToRight().toString() || viewingDirection.toString() === manifesto.ViewingDirection.rightToLeft().toString())) {\n className += \" twoCol\";\n }\n else if (that.extension.helper.isPaged()) {\n className += \" twoCol\";\n }\n else {\n className += \" oneCol\";\n }\n return className;\n },\n searchResultsTitle: function () {\n var searchResults = Number(this.data.data.searchResults);\n if (searchResults) {\n if (searchResults > 1) {\n return Utils.Strings.format(that.content.searchResults, searchResults.toString());\n }\n return Utils.Strings.format(that.content.searchResult, searchResults.toString());\n }\n return '';\n }\n });\n // use unevent to detect scroll stop.\n this.$element.on('scroll', function () {\n _this.scrollStop();\n }, 100);\n this.resize();\n };\n ThumbsView.prototype.databind = function () {\n if (!this.thumbs)\n return;\n this._$thumbsCache = null; // delete cache\n this.createThumbs();\n // do initial load to show padlocks\n this.loadThumbs(0);\n this.selectIndex(this.extension.helper.canvasIndex);\n };\n ThumbsView.prototype.createThumbs = function () {\n var that = this;\n if (!this.thumbs)\n return;\n // get median height\n var heights = [];\n for (var i = 0; i < this.thumbs.length; i++) {\n var thumb = this.thumbs[i];\n heights.push(thumb.height);\n }\n var medianHeight = Utils.Maths.median(heights);\n for (var i = 0; i < this.thumbs.length; i++) {\n var thumb = this.thumbs[i];\n thumb.height = medianHeight;\n }\n this.$thumbs.link($.templates.thumbsTemplate, this.thumbs);\n this.$thumbs.undelegate('.thumb', 'click');\n this.$thumbs.delegate(\".thumb\", \"click\", function (e) {\n e.preventDefault();\n var data = $.view(this).data;\n that.lastThumbClickedIndex = data.index;\n that.component.publish(BaseEvents_1.BaseEvents.THUMB_SELECTED, data);\n });\n this.setLabel();\n this.isCreated = true;\n };\n ThumbsView.prototype.scrollStop = function () {\n var scrollPos = 1 / ((this.$thumbs.height() - this.$element.height()) / this.$element.scrollTop());\n if (scrollPos > 1)\n scrollPos = 1;\n var thumbRangeMid = Math.floor((this.thumbs.length - 1) * scrollPos);\n this.loadThumbs(thumbRangeMid);\n };\n ThumbsView.prototype.loadThumbs = function (index) {\n if (index === void 0) { index = this.extension.helper.canvasIndex; }\n if (!this.thumbs || !this.thumbs.length)\n return;\n var thumbType;\n // get the type of the canvas content\n var canvas = this.extension.helper.getCanvasByIndex(index);\n var annotations = canvas.getContent();\n if (annotations.length) {\n var annotation = annotations[0];\n var body = annotation.getBody();\n if (body.length) {\n var type = body[0].getType();\n if (type) {\n thumbType = type.toString().toLowerCase();\n }\n }\n }\n var thumbRangeMid = index;\n var thumbLoadRange = this.options.thumbsLoadRange;\n var thumbRange = {\n start: (thumbRangeMid > thumbLoadRange) ? thumbRangeMid - thumbLoadRange : 0,\n end: (thumbRangeMid < (this.thumbs.length - 1) - thumbLoadRange) ? thumbRangeMid + thumbLoadRange : this.thumbs.length - 1\n };\n var fadeDuration = this.options.thumbsImageFadeInDuration;\n var that = this;\n for (var i = thumbRange.start; i <= thumbRange.end; i++) {\n var $thumb = this.getThumbByIndex(i);\n var $wrap = $thumb.find('.wrap');\n // if no img has been added yet\n if (!$wrap.hasClass('loading') && !$wrap.hasClass('loaded')) {\n var visible = $thumb.attr('data-visible');\n if (visible !== \"false\") {\n $wrap.removeClass('loadingFailed');\n $wrap.addClass('loading');\n if (thumbType) {\n $wrap.addClass(thumbType);\n }\n var src = $thumb.attr('data-src');\n if (that.config.options.thumbsCacheInvalidation && that.config.options.thumbsCacheInvalidation.enabled) {\n src += that.config.options.thumbsCacheInvalidation.paramType + \"t=\" + Utils.Dates.getTimeStamp();\n }\n var $img = $('\"\"/');\n // fade in on load.\n $img.hide();\n $img.on('load', function () {\n $(this).fadeIn(fadeDuration, function () {\n $(this).parent().switchClass('loading', 'loaded');\n });\n });\n $img.on('error', function () {\n $(this).parent().switchClass('loading', 'loadingFailed');\n });\n $wrap.append($img);\n }\n else {\n $wrap.addClass('hidden');\n }\n }\n }\n };\n ThumbsView.prototype.show = function () {\n var _this = this;\n this.isOpen = true;\n this.$element.show();\n setTimeout(function () {\n _this.selectIndex(_this.extension.helper.canvasIndex);\n }, 1);\n };\n ThumbsView.prototype.hide = function () {\n this.isOpen = false;\n this.$element.hide();\n };\n ThumbsView.prototype.isPDF = function () {\n var canvas = this.extension.helper.getCurrentCanvas();\n var type = canvas.getType();\n if (type) {\n return (type.toString().includes(\"pdf\"));\n }\n return false;\n };\n ThumbsView.prototype.setLabel = function () {\n $(this.$thumbs).find('span.index').hide();\n $(this.$thumbs).find('span.label').show();\n };\n ThumbsView.prototype.addSelectedClassToThumbs = function (index) {\n this.getThumbByIndex(index).addClass('selected');\n };\n ThumbsView.prototype.selectIndex = function (index) {\n // may be authenticating\n if (index === -1)\n return;\n if (!this.thumbs || !this.thumbs.length)\n return;\n this.getAllThumbs().removeClass('selected');\n this.$selectedThumb = this.getThumbByIndex(index);\n this.addSelectedClassToThumbs(index);\n var indices = this.extension.getPagedIndices(index);\n // scroll to thumb if the index change didn't originate\n // within the thumbs view.\n if (!~indices.indexOf(this.lastThumbClickedIndex)) {\n this.$element.scrollTop(this.$selectedThumb.position().top);\n }\n // make sure visible images are loaded.\n this.loadThumbs(index);\n };\n ThumbsView.prototype.getAllThumbs = function () {\n if (!this._$thumbsCache) {\n this._$thumbsCache = this.$thumbs.find('.thumb');\n }\n return this._$thumbsCache;\n };\n ThumbsView.prototype.getThumbByIndex = function (canvasIndex) {\n return this.$thumbs.find('[data-index=\"' + canvasIndex + '\"]');\n };\n ThumbsView.prototype.scrollToThumb = function (canvasIndex) {\n var $thumb = this.getThumbByIndex(canvasIndex);\n this.$element.scrollTop($thumb.position().top);\n };\n ThumbsView.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ThumbsView;\n }(BaseView_1.BaseView));\n exports.ThumbsView = ThumbsView;\n});\n\n", - "define('extensions/uv-seadragon-extension/Events',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Events = /** @class */ (function () {\n function Events() {\n }\n Events.namespace = 'openseadragonExtension.';\n Events.CURRENT_VIEW_URI = Events.namespace + 'currentViewUri';\n Events.IMAGE_SEARCH = Events.namespace + 'imageSearch';\n Events.MODE_CHANGED = Events.namespace + 'modeChanged';\n Events.NEXT_SEARCH_RESULT = Events.namespace + 'nextSearchResult';\n Events.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE = Events.namespace + 'nextImagesSearchResultUnavailable';\n Events.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE = Events.namespace + 'prevImagesSearchResultUnavailable';\n Events.PAGE_SEARCH = Events.namespace + 'pageSearch';\n Events.PAGING_TOGGLED = Events.namespace + 'pagingToggled';\n Events.PREV_SEARCH_RESULT = Events.namespace + 'prevSearchResult';\n Events.PRINT = Events.namespace + 'print';\n Events.ROTATE = Events.namespace + 'rotate';\n Events.SEADRAGON_ANIMATION_FINISH = Events.namespace + 'animationFinish';\n Events.SEADRAGON_ANIMATION_START = Events.namespace + 'animationStart';\n Events.SEADRAGON_ANIMATION = Events.namespace + 'animation';\n Events.SEADRAGON_OPEN = Events.namespace + 'open';\n Events.SEADRAGON_RESIZE = Events.namespace + 'resize';\n Events.SEADRAGON_ROTATION = Events.namespace + 'rotationChanged';\n Events.SEARCH_PREVIEW_FINISH = Events.namespace + 'searchPreviewFinish';\n Events.SEARCH_PREVIEW_START = Events.namespace + 'searchPreviewStart';\n Events.SEARCH = Events.namespace + 'search';\n Events.XYWH_CHANGED = Events.namespace + 'xywhChanged';\n Events.ZOOM_IN = Events.namespace + 'zoomIn';\n Events.ZOOM_OUT = Events.namespace + 'zoomOut';\n return Events;\n }());\n exports.Events = Events;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-contentleftpanel-module/ThumbsView',[\"require\", \"exports\", \"../uv-shared-module/ThumbsView\", \"../../extensions/uv-seadragon-extension/Events\", \"../../extensions/uv-seadragon-extension/Mode\"], function (require, exports, ThumbsView_1, Events_1, Mode_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ThumbsView = /** @class */ (function (_super) {\n __extends(ThumbsView, _super);\n function ThumbsView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ThumbsView.prototype.create = function () {\n var _this = this;\n this.setConfig('contentLeftPanel');\n _super.prototype.create.call(this);\n // todo: this should be a setting\n this.component.subscribe(Events_1.Events.MODE_CHANGED, function () {\n _this.setLabel();\n });\n this.component.subscribe(Events_1.Events.SEARCH_PREVIEW_START, function (canvasIndex) {\n _this.searchPreviewStart(canvasIndex);\n });\n this.component.subscribe(Events_1.Events.SEARCH_PREVIEW_FINISH, function () {\n _this.searchPreviewFinish();\n });\n if (this.extension.helper.isPaged()) {\n this.$thumbs.addClass('paged');\n }\n var that = this;\n $.views.helpers({\n separator: function () {\n // two thumbs per line\n if (that.extension.helper.isPaged()) {\n return ((this.data.index - 1) % 2 == 0) ? false : true;\n }\n return true; // default to one thumbnail per row\n }\n });\n };\n ThumbsView.prototype.addSelectedClassToThumbs = function (index) {\n var indices = this.extension.getPagedIndices(index);\n for (var i = 0; i < indices.length; i++) {\n this.getThumbByIndex(indices[i]).addClass('selected');\n }\n };\n ThumbsView.prototype.isPageModeEnabled = function () {\n // todo: move getMode to BaseExtension. call it getIndexingMode which can be Label or Index\n if (typeof this.extension.getMode === \"function\") {\n return this.config.options.pageModeEnabled && this.extension.getMode().toString() === Mode_1.Mode.page.toString();\n }\n return this.config.options.pageModeEnabled;\n };\n ThumbsView.prototype.searchPreviewStart = function (canvasIndex) {\n this.scrollToThumb(canvasIndex);\n var $thumb = this.getThumbByIndex(canvasIndex);\n $thumb.addClass('searchpreview');\n };\n ThumbsView.prototype.searchPreviewFinish = function () {\n this.scrollToThumb(this.extension.helper.canvasIndex);\n this.getAllThumbs().removeClass('searchpreview');\n };\n ThumbsView.prototype.setLabel = function () {\n if (this.isPDF()) {\n $(this.$thumbs).find('span.index').hide();\n $(this.$thumbs).find('span.label').hide();\n }\n else {\n if (this.isPageModeEnabled()) {\n $(this.$thumbs).find('span.index').hide();\n $(this.$thumbs).find('span.label').show();\n }\n else {\n $(this.$thumbs).find('span.index').show();\n $(this.$thumbs).find('span.label').hide();\n }\n }\n };\n return ThumbsView;\n }(ThumbsView_1.ThumbsView));\n exports.ThumbsView = ThumbsView;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-contentleftpanel-module/TreeView',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/BaseView\"], function (require, exports, BaseEvents_1, BaseView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var TreeView = /** @class */ (function (_super) {\n __extends(TreeView, _super);\n function TreeView($element) {\n var _this = _super.call(this, $element, true, true) || this;\n _this.isOpen = false;\n return _this;\n }\n TreeView.prototype.create = function () {\n this.setConfig('contentLeftPanel');\n _super.prototype.create.call(this);\n this.$tree = $('
');\n this.$element.append(this.$tree);\n };\n TreeView.prototype.setup = function () {\n var that = this;\n this.treeComponent = new IIIFComponents.TreeComponent({\n target: this.$tree[0],\n data: this.treeData\n });\n this.treeComponent.on('treeNodeSelected', function (node) {\n that.component.publish(BaseEvents_1.BaseEvents.TREE_NODE_SELECTED, node);\n }, false);\n this.treeComponent.on('treeNodeMultiSelected', function (node) {\n that.component.publish(BaseEvents_1.BaseEvents.TREE_NODE_MULTISELECTED, node);\n }, false);\n };\n TreeView.prototype.databind = function () {\n this.treeComponent.set(this.treeData);\n this.resize();\n };\n TreeView.prototype.show = function () {\n this.isOpen = true;\n this.$element.show();\n };\n TreeView.prototype.hide = function () {\n this.isOpen = false;\n this.$element.hide();\n };\n TreeView.prototype.selectNode = function (node) {\n if (!this.treeComponent.selectedNode) {\n this.treeComponent.expandParents(node, true);\n var link = this.$tree.find(\"#tree-link-\" + node.id)[0];\n if (link) {\n link.scrollIntoViewIfNeeded();\n }\n }\n this.treeComponent.selectNode(node);\n };\n TreeView.prototype.expandNode = function (node, expanded) {\n this.treeComponent.expandNode(node, expanded);\n };\n TreeView.prototype.getAllNodes = function () {\n return this.treeComponent.getAllNodes();\n };\n TreeView.prototype.deselectCurrentNode = function () {\n this.treeComponent.deselectCurrentNode();\n };\n TreeView.prototype.getNodeById = function (id) {\n return this.treeComponent.getNodeById(id);\n };\n TreeView.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return TreeView;\n }(BaseView_1.BaseView));\n exports.TreeView = TreeView;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-contentleftpanel-module/ContentLeftPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"./GalleryView\", \"../uv-shared-module/LeftPanel\", \"../../extensions/uv-seadragon-extension/Mode\", \"./ThumbsView\", \"./TreeView\"], function (require, exports, BaseEvents_1, GalleryView_1, LeftPanel_1, Mode_1, ThumbsView_1, TreeView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ContentLeftPanel = /** @class */ (function (_super) {\n __extends(ContentLeftPanel, _super);\n function ContentLeftPanel($element) {\n var _this = _super.call(this, $element) || this;\n _this.expandFullEnabled = false;\n _this.isThumbsViewOpen = false;\n _this.isTreeViewOpen = false;\n _this.treeSortType = Manifold.TreeSortType.NONE;\n return _this;\n }\n ContentLeftPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('contentLeftPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, function () {\n _this.databind();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.GALLERY_THUMB_SELECTED, function () {\n _this.collapseFull();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.METRIC_CHANGED, function () {\n if (!_this.extension.isDesktopMetric()) {\n if (_this.isFullyExpanded) {\n _this.collapseFull();\n }\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS, function () {\n _this.databindThumbsView();\n _this.databindGalleryView();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS_CLEARED, function () {\n _this.databindThumbsView();\n _this.databindGalleryView();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS_EMPTY, function () {\n _this.databindThumbsView();\n _this.databindGalleryView();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function () {\n if (_this.isFullyExpanded) {\n _this.collapseFull();\n }\n _this.selectCurrentTreeNode();\n _this.updateTreeTabBySelection();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RANGE_CHANGED, function () {\n if (_this.isFullyExpanded) {\n _this.collapseFull();\n }\n _this.selectCurrentTreeNode();\n _this.updateTreeTabBySelection();\n });\n this.$tabs = $('
');\n this.$main.append(this.$tabs);\n this.$treeButton = $('' + this.content.index + '');\n this.$tabs.append(this.$treeButton);\n this.$thumbsButton = $('' + this.content.thumbnails + '');\n this.$thumbsButton.prop('title', this.content.thumbnails);\n this.$tabs.append(this.$thumbsButton);\n this.$tabsContent = $('
');\n this.$main.append(this.$tabsContent);\n this.$options = $('
');\n this.$tabsContent.append(this.$options);\n this.$topOptions = $('
');\n this.$options.append(this.$topOptions);\n this.$treeSelect = $('');\n this.$topOptions.append(this.$treeSelect);\n this.$bottomOptions = $('
');\n this.$options.append(this.$bottomOptions);\n this.$leftOptions = $('
');\n this.$bottomOptions.append(this.$leftOptions);\n this.$rightOptions = $('
');\n this.$bottomOptions.append(this.$rightOptions);\n this.$treeViewOptions = $('
');\n this.$leftOptions.append(this.$treeViewOptions);\n this.$sortByLabel = $('' + this.content.sortBy + '');\n this.$treeViewOptions.append(this.$sortByLabel);\n this.$sortButtonGroup = $('
');\n this.$treeViewOptions.append(this.$sortButtonGroup);\n this.$sortByDateButton = $('');\n this.$sortButtonGroup.append(this.$sortByDateButton);\n this.$sortByVolumeButton = $('');\n this.$sortButtonGroup.append(this.$sortByVolumeButton);\n this.$views = $('
');\n this.$tabsContent.append(this.$views);\n this.$treeView = $('
');\n this.$views.append(this.$treeView);\n this.$thumbsView = $('
');\n this.$views.append(this.$thumbsView);\n this.$galleryView = $('
');\n this.$views.append(this.$galleryView);\n this.$treeSelect.hide();\n this.$treeSelect.change(function () {\n _this.databindTreeView();\n _this.selectCurrentTreeNode();\n _this.updateTreeTabBySelection();\n });\n this.$sortByDateButton.on('click', function () {\n _this.sortByDate();\n });\n this.$sortByVolumeButton.on('click', function () {\n _this.sortByVolume();\n });\n this.$treeViewOptions.hide();\n this.$treeButton.onPressed(function () {\n _this.openTreeView();\n });\n this.$thumbsButton.onPressed(function () {\n _this.openThumbsView();\n });\n this.setTitle(this.content.title);\n this.$sortByVolumeButton.addClass('on');\n var tabOrderConfig = this.options.tabOrder;\n if (tabOrderConfig) {\n // sort tabs\n tabOrderConfig = tabOrderConfig.toLowerCase();\n tabOrderConfig = tabOrderConfig.replace(/ /g, \"\");\n var tabOrder = tabOrderConfig.split(',');\n if (tabOrder[0] === 'thumbs') {\n this.$treeButton.before(this.$thumbsButton);\n this.$thumbsButton.addClass('first');\n }\n else {\n this.$treeButton.addClass('first');\n }\n }\n };\n ContentLeftPanel.prototype.createTreeView = function () {\n this.treeView = new TreeView_1.TreeView(this.$treeView);\n this.treeView.treeData = this.getTreeData();\n this.treeView.setup();\n this.databindTreeView();\n // populate the tree select drop down when there are multiple top-level ranges\n var topRanges = this.extension.helper.getTopRanges();\n if (topRanges.length > 1) {\n for (var i = 0; i < topRanges.length; i++) {\n var range = topRanges[i];\n this.$treeSelect.append('');\n }\n }\n this.updateTreeViewOptions();\n };\n ContentLeftPanel.prototype.databind = function () {\n this.databindThumbsView();\n this.databindTreeView();\n this.databindGalleryView();\n };\n ContentLeftPanel.prototype.updateTreeViewOptions = function () {\n var treeData = this.getTree();\n if (!treeData) {\n return;\n }\n if (this.isCollection() && this.extension.helper.treeHasNavDates(treeData)) {\n this.$treeViewOptions.show();\n }\n else {\n this.$treeViewOptions.hide();\n }\n if (this.$treeSelect.find('option').length) {\n this.$treeSelect.show();\n }\n else {\n this.$treeSelect.hide();\n }\n };\n ContentLeftPanel.prototype.sortByDate = function () {\n this.treeSortType = Manifold.TreeSortType.DATE;\n this.treeView.treeData = this.getTreeData();\n this.treeView.databind();\n this.selectCurrentTreeNode();\n this.$sortByDateButton.addClass('on');\n this.$sortByVolumeButton.removeClass('on');\n this.resize();\n };\n ContentLeftPanel.prototype.sortByVolume = function () {\n this.treeSortType = Manifold.TreeSortType.NONE;\n this.treeView.treeData = this.getTreeData();\n this.treeView.databind();\n this.selectCurrentTreeNode();\n this.$sortByDateButton.removeClass('on');\n this.$sortByVolumeButton.addClass('on');\n this.resize();\n };\n ContentLeftPanel.prototype.isCollection = function () {\n var treeData = this.getTree();\n if (treeData) {\n return treeData.data.type === manifesto.TreeNodeType.collection().toString();\n }\n throw new Error(\"Tree not available\");\n };\n ContentLeftPanel.prototype.databindTreeView = function () {\n if (!this.treeView)\n return;\n this.treeView.treeData = this.getTreeData();\n this.treeView.databind();\n this.selectCurrentTreeNode();\n };\n ContentLeftPanel.prototype.getTreeData = function () {\n return {\n autoExpand: this._isTreeAutoExpanded(),\n branchNodesExpandOnClick: Utils.Bools.getBool(this.config.options.branchNodesExpandOnClick, true),\n branchNodesSelectable: Utils.Bools.getBool(this.config.options.branchNodesSelectable, false),\n helper: this.extension.helper,\n topRangeIndex: this.getSelectedTopRangeIndex(),\n treeSortType: this.treeSortType\n };\n };\n ContentLeftPanel.prototype._isTreeAutoExpanded = function () {\n var autoExpandTreeEnabled = Utils.Bools.getBool(this.config.options.autoExpandTreeEnabled, false);\n var autoExpandTreeIfFewerThan = this.config.options.autoExpandTreeIfFewerThan || 0;\n if (autoExpandTreeEnabled) {\n // get total number of tree nodes\n var flatTree = this.extension.helper.getFlattenedTree();\n if (flatTree.length < autoExpandTreeIfFewerThan) {\n return true;\n }\n }\n return false;\n };\n ContentLeftPanel.prototype.updateTreeTabByCanvasIndex = function () {\n // update tab to current top range label (if there is one)\n var topRanges = this.extension.helper.getTopRanges();\n if (topRanges.length > 1) {\n var index = this.getCurrentCanvasTopRangeIndex();\n if (index === -1) {\n return;\n }\n var currentRange = topRanges[index];\n this.setTreeTabTitle(Manifesto.LanguageMap.getValue(currentRange.getLabel()));\n }\n else {\n this.setTreeTabTitle(this.content.index);\n }\n };\n ContentLeftPanel.prototype.setTreeTabTitle = function (title) {\n this.$treeButton.text(title);\n this.$treeButton.prop('title', title);\n };\n ContentLeftPanel.prototype.updateTreeTabBySelection = function () {\n var title = null;\n var topRanges = this.extension.helper.getTopRanges();\n if (topRanges.length > 1) {\n if (this.treeView) {\n title = this.getSelectedTree().text();\n }\n else {\n title = Manifesto.LanguageMap.getValue(topRanges[0].getLabel());\n }\n }\n if (title) {\n this.setTreeTabTitle(title);\n }\n else {\n this.setTreeTabTitle(this.content.index);\n }\n };\n ContentLeftPanel.prototype.getViewingHint = function () {\n return this.extension.helper.getViewingHint();\n };\n ContentLeftPanel.prototype.getViewingDirection = function () {\n return this.extension.helper.getViewingDirection();\n };\n ContentLeftPanel.prototype.createThumbsView = function () {\n this.thumbsView = new ThumbsView_1.ThumbsView(this.$thumbsView);\n this.databindThumbsView();\n };\n ContentLeftPanel.prototype.databindThumbsView = function () {\n if (!this.thumbsView)\n return;\n var width;\n var height;\n var viewingHint = this.getViewingHint();\n var viewingDirection = this.getViewingDirection();\n if (viewingDirection && (viewingDirection.toString() === manifesto.ViewingDirection.leftToRight().toString() || viewingDirection.toString() === manifesto.ViewingDirection.rightToLeft().toString())) {\n width = this.config.options.twoColThumbWidth;\n height = this.config.options.twoColThumbHeight;\n }\n else if (viewingHint && viewingHint.toString() === manifesto.ViewingHint.paged().toString()) {\n width = this.config.options.twoColThumbWidth;\n height = this.config.options.twoColThumbHeight;\n }\n else {\n width = this.config.options.oneColThumbWidth;\n height = this.config.options.oneColThumbHeight;\n }\n var thumbs = this.extension.helper.getThumbs(width, height);\n if (viewingDirection && viewingDirection.toString() === manifesto.ViewingDirection.bottomToTop().toString()) {\n thumbs.reverse();\n }\n // add a search result icon for pages with results\n var searchResults = this.extension.annotations;\n if (searchResults && searchResults.length) {\n var _loop_1 = function (i) {\n var searchResult = searchResults[i];\n // find the thumb with the same canvasIndex and add the searchResult\n var thumb = thumbs.en().where(function (t) { return t.index === searchResult.canvasIndex; }).first();\n if (thumb) {\n // clone the data so searchResults isn't persisted on the canvas.\n var data = $.extend(true, {}, thumb.data);\n data.searchResults = searchResult.rects.length;\n thumb.data = data;\n }\n };\n for (var i = 0; i < searchResults.length; i++) {\n _loop_1(i);\n }\n }\n this.thumbsView.thumbs = thumbs;\n this.thumbsView.databind();\n };\n ContentLeftPanel.prototype.createGalleryView = function () {\n this.galleryView = new GalleryView_1.GalleryView(this.$galleryView);\n this.galleryView.galleryData = this.getGalleryData();\n this.galleryView.setup();\n this.databindGalleryView();\n };\n ContentLeftPanel.prototype.databindGalleryView = function () {\n if (!this.galleryView)\n return;\n this.galleryView.galleryData = this.getGalleryData();\n this.galleryView.databind();\n };\n ContentLeftPanel.prototype.getGalleryData = function () {\n return {\n helper: this.extension.helper,\n chunkedResizingThreshold: this.config.options.galleryThumbChunkedResizingThreshold,\n content: this.config.content,\n debug: false,\n imageFadeInDuration: 300,\n initialZoom: 6,\n minLabelWidth: 20,\n pageModeEnabled: this.isPageModeEnabled(),\n scrollStopDuration: 100,\n searchResults: this.extension.annotations,\n sizingEnabled: Modernizr.inputtypes.range,\n thumbHeight: this.config.options.galleryThumbHeight,\n thumbLoadPadding: this.config.options.galleryThumbLoadPadding,\n thumbWidth: this.config.options.galleryThumbWidth,\n viewingDirection: this.getViewingDirection()\n };\n };\n ContentLeftPanel.prototype.isPageModeEnabled = function () {\n // todo: checks if the panel is being used in the openseadragon extension.\n // pass a `isPageModeEnabled` function to the panel's constructor instead?\n if (typeof this.extension.getMode === \"function\") {\n return Utils.Bools.getBool(this.config.options.pageModeEnabled, true) && this.extension.getMode().toString() === Mode_1.Mode.page.toString();\n }\n return Utils.Bools.getBool(this.config.options.pageModeEnabled, true);\n };\n ContentLeftPanel.prototype.getSelectedTree = function () {\n return this.$treeSelect.find(':selected');\n };\n ContentLeftPanel.prototype.getSelectedTopRangeIndex = function () {\n var topRangeIndex = this.getSelectedTree().index();\n if (topRangeIndex === -1) {\n topRangeIndex = 0;\n }\n return topRangeIndex;\n };\n ContentLeftPanel.prototype.getTree = function () {\n var topRangeIndex = this.getSelectedTopRangeIndex();\n return this.extension.helper.getTree(topRangeIndex, Manifold.TreeSortType.NONE);\n };\n ContentLeftPanel.prototype.toggleFinish = function () {\n _super.prototype.toggleFinish.call(this);\n if (this.isUnopened) {\n var treeEnabled = Utils.Bools.getBool(this.config.options.treeEnabled, true);\n var thumbsEnabled = Utils.Bools.getBool(this.config.options.thumbsEnabled, true);\n var treeData = this.getTree();\n if (!treeData || !treeData.nodes.length) {\n treeEnabled = false;\n }\n // hide the tabs if either tree or thumbs are disabled\n if (!treeEnabled || !thumbsEnabled)\n this.$tabs.hide();\n if (thumbsEnabled && this.defaultToThumbsView()) {\n this.openThumbsView();\n }\n else if (treeEnabled) {\n this.openTreeView();\n }\n }\n };\n ContentLeftPanel.prototype.defaultToThumbsView = function () {\n var defaultToTreeEnabled = Utils.Bools.getBool(this.config.options.defaultToTreeEnabled, false);\n var defaultToTreeIfGreaterThan = this.config.options.defaultToTreeIfGreaterThan || 0;\n var treeData = this.getTree();\n if (defaultToTreeEnabled) {\n if (treeData && treeData.nodes.length > defaultToTreeIfGreaterThan) {\n return false;\n }\n }\n return true;\n };\n ContentLeftPanel.prototype.expandFullStart = function () {\n _super.prototype.expandFullStart.call(this);\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START);\n };\n ContentLeftPanel.prototype.expandFullFinish = function () {\n _super.prototype.expandFullFinish.call(this);\n if (this.$treeButton.hasClass('on')) {\n this.openTreeView();\n }\n else if (this.$thumbsButton.hasClass('on')) {\n this.openThumbsView();\n }\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_FINISH);\n };\n ContentLeftPanel.prototype.collapseFullStart = function () {\n _super.prototype.collapseFullStart.call(this);\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_START);\n };\n ContentLeftPanel.prototype.collapseFullFinish = function () {\n _super.prototype.collapseFullFinish.call(this);\n // todo: write a more generic tabs system with base tab class.\n // thumbsView may not necessarily have been created yet.\n // replace thumbsView with galleryView.\n if (this.$thumbsButton.hasClass('on')) {\n this.openThumbsView();\n }\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_FINISH);\n };\n ContentLeftPanel.prototype.openTreeView = function () {\n this.isTreeViewOpen = true;\n this.isThumbsViewOpen = false;\n if (!this.treeView) {\n this.createTreeView();\n }\n this.$treeButton.addClass('on');\n this.$thumbsButton.removeClass('on');\n this.treeView.show();\n if (this.thumbsView)\n this.thumbsView.hide();\n if (this.galleryView)\n this.galleryView.hide();\n this.updateTreeViewOptions();\n this.selectCurrentTreeNode();\n this.resize();\n this.treeView.resize();\n this.component.publish(BaseEvents_1.BaseEvents.OPEN_TREE_VIEW);\n };\n ContentLeftPanel.prototype.openThumbsView = function () {\n this.isTreeViewOpen = false;\n this.isThumbsViewOpen = true;\n if (!this.thumbsView) {\n this.createThumbsView();\n }\n if (this.isFullyExpanded && !this.galleryView) {\n this.createGalleryView();\n }\n this.$treeButton.removeClass('on');\n this.$thumbsButton.addClass('on');\n if (this.treeView)\n this.treeView.hide();\n this.$treeSelect.hide();\n this.$treeViewOptions.hide();\n this.resize();\n if (this.isFullyExpanded) {\n this.thumbsView.hide();\n if (this.galleryView)\n this.galleryView.show();\n if (this.galleryView)\n this.galleryView.resize();\n }\n else {\n if (this.galleryView)\n this.galleryView.hide();\n this.thumbsView.show();\n this.thumbsView.resize();\n }\n this.component.publish(BaseEvents_1.BaseEvents.OPEN_THUMBS_VIEW);\n };\n ContentLeftPanel.prototype.selectTopRangeIndex = function (index) {\n this.$treeSelect.prop('selectedIndex', index);\n };\n ContentLeftPanel.prototype.getCurrentCanvasTopRangeIndex = function () {\n var topRangeIndex = -1;\n var range = this.extension.getCurrentCanvasRange();\n if (range) {\n topRangeIndex = Number(range.path.split('/')[0]);\n }\n return topRangeIndex;\n };\n ContentLeftPanel.prototype.selectCurrentTreeNode = function () {\n // todo: merge selectCurrentTreeNodeByCanvas and selectCurrentTreeNodeByRange\n // the openseadragon extension should keep track of the current range instead of using canvas index\n if (this.extension.name === 'uv-seadragon-extension') {\n this.selectCurrentTreeNodeByCanvas();\n }\n else {\n this.selectCurrentTreeNodeByRange();\n }\n };\n ContentLeftPanel.prototype.selectCurrentTreeNodeByRange = function () {\n if (this.treeView) {\n var range = this.extension.helper.getCurrentRange();\n var node = null;\n if (range && range.treeNode) {\n node = this.treeView.getNodeById(range.treeNode.id);\n }\n if (node) {\n this.treeView.selectNode(node);\n }\n else {\n this.selectTreeNodeByManifest();\n }\n }\n };\n ContentLeftPanel.prototype.selectCurrentTreeNodeByCanvas = function () {\n if (this.treeView) {\n var node = null;\n var currentCanvasTopRangeIndex = this.getCurrentCanvasTopRangeIndex();\n var selectedTopRangeIndex = this.getSelectedTopRangeIndex();\n var usingCorrectTree = currentCanvasTopRangeIndex === selectedTopRangeIndex;\n var range = null;\n if (currentCanvasTopRangeIndex !== -1) {\n range = this.extension.getCurrentCanvasRange();\n //range = this.extension.helper.getCurrentRange();\n if (range && range.treeNode) {\n node = this.treeView.getNodeById(range.treeNode.id);\n }\n }\n // use manifest root node\n // if (!node){\n // id = this.extension.helper.manifest.defaultTree.id;\n // node = this.treeView.getNodeById(id);\n // }\n if (node && usingCorrectTree) {\n this.treeView.selectNode(node);\n }\n else {\n range = this.extension.helper.getCurrentRange();\n if (range && range.treeNode) {\n node = this.treeView.getNodeById(range.treeNode.id);\n }\n if (node) {\n this.treeView.selectNode(node);\n }\n else {\n this.selectTreeNodeByManifest();\n }\n }\n }\n };\n // fall through to this is there's no current range or canvas\n ContentLeftPanel.prototype.selectTreeNodeByManifest = function () {\n var _this = this;\n var collectionIndex = this.extension.helper.collectionIndex;\n var manifestIndex = this.extension.helper.manifestIndex;\n var allNodes = this.treeView.getAllNodes();\n var nodeFound = false;\n allNodes.map(function (node) {\n if (node.isCollection() && node.data.index === collectionIndex) {\n _this.treeView.selectNode(node);\n _this.treeView.expandNode(node, true);\n nodeFound = true;\n }\n if (node.isManifest() && node.data.index === manifestIndex) {\n _this.treeView.selectNode(node);\n nodeFound = true;\n }\n });\n if (!nodeFound) {\n this.treeView.deselectCurrentNode();\n }\n };\n ContentLeftPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$tabsContent.height(this.$main.height() - (this.$tabs.is(':visible') ? this.$tabs.height() : 0) - this.$tabsContent.verticalPadding());\n this.$views.height(this.$tabsContent.height() - this.$options.outerHeight());\n };\n return ContentLeftPanel;\n }(LeftPanel_1.LeftPanel));\n exports.ContentLeftPanel = ContentLeftPanel;\n});\n\n", - "define('modules/uv-shared-module/DownloadOption',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var DownloadOption;\n (function (DownloadOption) {\n DownloadOption[\"CANVAS_RENDERINGS\"] = \"canvasRenderings\";\n DownloadOption[\"CURRENT_VIEW\"] = \"currentView\";\n DownloadOption[\"ENTIRE_DOCUMENT_AS_PDF\"] = \"entireDocumentAsPdf\";\n DownloadOption[\"ENTIRE_DOCUMENT_AS_TEXT\"] = \"entireDocumentAsText\";\n DownloadOption[\"ENTIRE_FILE_AS_ORIGINAL\"] = \"entireFileAsOriginal\";\n DownloadOption[\"IMAGE_RENDERINGS\"] = \"imageRenderings\";\n DownloadOption[\"MANIFEST_RENDERINGS\"] = \"manifestRenderings\";\n DownloadOption[\"RANGE_RENDERINGS\"] = \"rangeRenderings\";\n DownloadOption[\"SELECTION\"] = \"selection\";\n //SEQUENCE_RENDERINGS = \"sequenceRenderings\",\n DownloadOption[\"UNKNOWN\"] = \"unknown\";\n DownloadOption[\"WHOLE_IMAGE_HIGH_RES\"] = \"wholeImageHighRes\";\n DownloadOption[\"WHOLE_IMAGE_LOW_RES\"] = \"wholeImageLowRes\";\n DownloadOption[\"WHOLE_IMAGES_HIGH_RES\"] = \"wholeImagesHighRes\";\n })(DownloadOption = exports.DownloadOption || (exports.DownloadOption = {}));\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/DownloadDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\", \"../uv-shared-module/DownloadOption\"], function (require, exports, BaseEvents_1, Dialogue_1, DownloadOption_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var DownloadDialogue = /** @class */ (function (_super) {\n __extends(DownloadDialogue, _super);\n function DownloadDialogue($element) {\n return _super.call(this, $element) || this;\n }\n DownloadDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('downloadDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_DOWNLOAD_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_DOWNLOAD_DIALOGUE;\n this.component.subscribe(this.openCommand, function (triggerButton) {\n _this.open(triggerButton);\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n // create ui.\n this.$title = $('

' + this.content.title + '

');\n this.$content.append(this.$title);\n this.$noneAvailable = $('
' + this.content.noneAvailable + '
');\n this.$content.append(this.$noneAvailable);\n this.$downloadOptions = $('
    ');\n this.$content.append(this.$downloadOptions);\n this.$footer = $('
    ');\n this.$content.append(this.$footer);\n this.$termsOfUseButton = $('' + this.extension.data.config.content.termsOfUse + '');\n this.$footer.append(this.$termsOfUseButton);\n this.$termsOfUseButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_TERMS_OF_USE);\n });\n // hide\n this.$element.hide();\n this.updateTermsOfUseButton();\n };\n DownloadDialogue.prototype.addEntireFileDownloadOptions = function () {\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.ENTIRE_FILE_AS_ORIGINAL)) {\n this.$downloadOptions.empty();\n // \n // add each file src\n var canvas = this.extension.helper.getCurrentCanvas();\n var renderingFound = false;\n var renderings = canvas.getRenderings();\n for (var i = 0; i < renderings.length; i++) {\n var rendering = renderings[i];\n var renderingFormat = rendering.getFormat();\n var format = '';\n if (renderingFormat) {\n format = renderingFormat.toString();\n }\n this.addEntireFileDownloadOption(rendering.id, Manifesto.LanguageMap.getValue(rendering.getLabel()), format);\n renderingFound = true;\n }\n if (!renderingFound) {\n var annotationFound = false;\n var annotations = canvas.getContent();\n for (var i = 0; i < annotations.length; i++) {\n var annotation = annotations[i];\n var body = annotation.getBody();\n if (body.length) {\n var format = body[0].getFormat();\n if (format) {\n this.addEntireFileDownloadOption(body[0].id, '', format.toString());\n annotationFound = true;\n }\n }\n }\n if (!annotationFound) {\n this.addEntireFileDownloadOption(canvas.id, '', '');\n }\n }\n }\n };\n DownloadDialogue.prototype.addEntireFileDownloadOption = function (uri, label, format) {\n var fileType;\n if (format) {\n fileType = Utils.Files.simplifyMimeType(format);\n }\n else {\n fileType = this.getFileExtension(uri);\n }\n if (!label) {\n label = this.content.entireFileAsOriginal;\n }\n if (fileType) {\n label += \" (\" + fileType + \")\";\n }\n this.$downloadOptions.append('
  1. ' + label + '
  2. ');\n };\n DownloadDialogue.prototype.resetDynamicDownloadOptions = function () {\n this.renderingUrls = [];\n this.renderingUrlsCount = 0;\n this.$downloadOptions.find('li.dynamic').remove();\n };\n DownloadDialogue.prototype.getDownloadOptionsForRenderings = function (resource, defaultLabel, type) {\n var renderings = resource.getRenderings();\n var downloadOptions = [];\n for (var i = 0; i < renderings.length; i++) {\n var rendering = renderings[i];\n if (rendering) {\n var label = Manifesto.LanguageMap.getValue(rendering.getLabel(), this.extension.getLocale());\n var currentId = \"downloadOption\" + ++this.renderingUrlsCount;\n if (label) {\n label += \" ({0})\";\n }\n else {\n label = defaultLabel;\n }\n var mime = Utils.Files.simplifyMimeType(rendering.getFormat().toString());\n label = Utils.Strings.format(label, mime);\n this.renderingUrls[currentId] = rendering.id;\n var $button = $('
  3. ');\n downloadOptions.push({\n type: type,\n button: $button\n });\n }\n }\n return downloadOptions;\n };\n DownloadDialogue.prototype.getSelectedOption = function () {\n return this.$downloadOptions.find(\"li.option input:checked\");\n };\n DownloadDialogue.prototype.getCurrentResourceId = function () {\n var canvas = this.extension.helper.getCurrentCanvas();\n return canvas.externalResource.data.id;\n };\n DownloadDialogue.prototype.getCurrentResourceFormat = function () {\n var id = this.getCurrentResourceId();\n return id.substr(id.lastIndexOf('.') + 1).toLowerCase();\n };\n DownloadDialogue.prototype.updateNoneAvailable = function () {\n if (!this.$downloadOptions.find('li:visible').length) {\n this.$noneAvailable.show();\n }\n else {\n // select first option.\n this.$noneAvailable.hide();\n }\n };\n DownloadDialogue.prototype.updateTermsOfUseButton = function () {\n var requiredStatement = this.extension.helper.getRequiredStatement();\n if (Utils.Bools.getBool(this.extension.data.config.options.termsOfUseEnabled, false) && requiredStatement && requiredStatement.value) {\n this.$termsOfUseButton.show();\n }\n else {\n this.$termsOfUseButton.hide();\n }\n };\n DownloadDialogue.prototype.getFileExtension = function (fileUri) {\n var extension = fileUri.split('.').pop();\n // if it's not a valid file extension\n if (extension.length > 5 || extension.indexOf('/') !== -1) {\n return null;\n }\n return extension;\n };\n DownloadDialogue.prototype.isMediaDownloadEnabled = function () {\n return this.extension.helper.isUIEnabled('mediaDownload');\n };\n DownloadDialogue.prototype.isDownloadOptionAvailable = function (option) {\n switch (option) {\n case DownloadOption_1.DownloadOption.ENTIRE_FILE_AS_ORIGINAL:\n return this.isMediaDownloadEnabled();\n }\n return true;\n };\n DownloadDialogue.prototype.close = function () {\n _super.prototype.close.call(this);\n };\n DownloadDialogue.prototype.resize = function () {\n this.setDockedPosition();\n };\n return DownloadDialogue;\n }(Dialogue_1.Dialogue));\n exports.DownloadDialogue = DownloadDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-av-extension/DownloadDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/DownloadDialogue\", \"../../modules/uv-shared-module/DownloadOption\", \"../../modules/uv-shared-module/BaseEvents\"], function (require, exports, DownloadDialogue_1, DownloadOption_1, BaseEvents_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var DownloadDialogue = /** @class */ (function (_super) {\n __extends(DownloadDialogue, _super);\n function DownloadDialogue($element) {\n return _super.call(this, $element) || this;\n }\n DownloadDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('downloadDialogue');\n _super.prototype.create.call(this);\n this.$entireFileAsOriginal = $('
  4. ');\n this.$downloadOptions.append(this.$entireFileAsOriginal);\n this.$entireFileAsOriginal.hide();\n this.$downloadButton = $('
    ' + this.content.download + '');\n this.$buttons.prepend(this.$downloadButton);\n this.$imageOptionsContainer = $('
  5. ');\n this.$imageOptions = $('
      ');\n this.$imageOptionsContainer.append(this.$imageOptions);\n this.$canvasOptionsContainer = $('
    • ');\n this.$canvasOptions = $('
        ');\n this.$canvasOptionsContainer.append(this.$canvasOptions);\n this.$manifestOptionsContainer = $('
      • ');\n this.$manifestOptions = $('
          ');\n this.$manifestOptionsContainer.append(this.$manifestOptions);\n var that = this;\n this.$downloadButton.on('click', function (e) {\n e.preventDefault();\n var $selectedOption = that.getSelectedOption();\n var id = $selectedOption.attr('id');\n var label = $selectedOption.attr('title');\n var type = DownloadOption_1.DownloadOption.UNKNOWN;\n if (_this.renderingUrls[id]) {\n window.open(_this.renderingUrls[id]);\n }\n else {\n var id_1 = _this.getCurrentResourceId();\n window.open(id_1);\n }\n _this.component.publish(BaseEvents_1.BaseEvents.DOWNLOAD, {\n \"type\": type,\n \"label\": label\n });\n _this.close();\n });\n };\n DownloadDialogue.prototype._isAdaptive = function () {\n var format = this.getCurrentResourceFormat();\n return format === 'mpd' || format === 'm3u8';\n };\n DownloadDialogue.prototype.open = function (triggerButton) {\n _super.prototype.open.call(this, triggerButton);\n var canvas = this.extension.helper.getCurrentCanvas();\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.ENTIRE_FILE_AS_ORIGINAL) && !this._isAdaptive()) {\n var $input = this.$entireFileAsOriginal.find('input');\n var $label = this.$entireFileAsOriginal.find('label');\n var label = Utils.Strings.format(this.content.entireFileAsOriginalWithFormat, this.getCurrentResourceFormat());\n $label.text(label);\n $input.prop('title', label);\n this.$entireFileAsOriginal.show();\n }\n this.resetDynamicDownloadOptions();\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.RANGE_RENDERINGS)) {\n if (canvas.ranges && canvas.ranges.length) {\n for (var i = 0; i < canvas.ranges.length; i++) {\n var range = canvas.ranges[i];\n var renderingOptions = this.getDownloadOptionsForRenderings(range, this.content.entireFileAsOriginal, DownloadOption_1.DownloadOption.CANVAS_RENDERINGS);\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n }\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.IMAGE_RENDERINGS)) {\n var images = canvas.getImages();\n if (images.length) {\n this.$downloadOptions.append(this.$imageOptionsContainer);\n }\n for (var i = 0; i < images.length; i++) {\n var renderingOptions = this.getDownloadOptionsForRenderings(images[i].getResource(), this.content.entireFileAsOriginal, DownloadOption_1.DownloadOption.IMAGE_RENDERINGS);\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.CANVAS_RENDERINGS)) {\n var renderingOptions = this.getDownloadOptionsForRenderings(canvas, this.content.entireFileAsOriginal, DownloadOption_1.DownloadOption.CANVAS_RENDERINGS);\n if (renderingOptions.length) {\n this.$downloadOptions.append(this.$canvasOptionsContainer);\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS)) {\n var renderingOptions = this.getDownloadOptionsForRenderings(this.extension.helper.getCurrentSequence(), this.content.entireDocument, DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS);\n if (!renderingOptions.length) {\n renderingOptions = this.getDownloadOptionsForRenderings(this.extension.helper.manifest, this.content.entireDocument, DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS);\n }\n if (renderingOptions.length) {\n this.$downloadOptions.append(this.$manifestOptionsContainer);\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n }\n if (this.$downloadOptions.length) {\n this.$entireFileAsOriginal.hide();\n }\n if (!this.$downloadOptions.find('li.option:visible').length) {\n this.$noneAvailable.show();\n this.$downloadButton.hide();\n }\n else {\n // select first option.\n this.$downloadOptions.find('li.option input:visible:first').prop('checked', true);\n this.$noneAvailable.hide();\n this.$downloadButton.show();\n }\n this.resize();\n };\n DownloadDialogue.prototype.addDownloadOptionsForRenderings = function (renderingOptions) {\n var _this = this;\n renderingOptions.forEach(function (option) {\n switch (option.type) {\n case DownloadOption_1.DownloadOption.IMAGE_RENDERINGS:\n _this.$imageOptions.append(option.button);\n break;\n case DownloadOption_1.DownloadOption.CANVAS_RENDERINGS:\n _this.$canvasOptions.append(option.button);\n break;\n case DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS:\n _this.$manifestOptions.append(option.button);\n break;\n }\n });\n };\n DownloadDialogue.prototype.isDownloadOptionAvailable = function (option) {\n return this.isMediaDownloadEnabled();\n };\n return DownloadDialogue;\n }(DownloadDialogue_1.DownloadDialogue));\n exports.DownloadDialogue = DownloadDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/FooterPanel',[\"require\", \"exports\", \"./BaseEvents\", \"./BaseView\"], function (require, exports, BaseEvents_1, BaseView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var FooterPanel = /** @class */ (function (_super) {\n __extends(FooterPanel, _super);\n function FooterPanel($element) {\n return _super.call(this, $element) || this;\n }\n FooterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('footerPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN, function () {\n _this.updateFullScreenButton();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.METRIC_CHANGED, function () {\n _this.updateMinimisedButtons();\n _this.updateMoreInfoButton();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, function () {\n _this.updateDownloadButton();\n });\n this.$options = $('
          ');\n this.$element.append(this.$options);\n this.$feedbackButton = $(\"\\n \\n \");\n this.$options.prepend(this.$feedbackButton);\n this.$openButton = $(\"\\n \\n \");\n this.$options.prepend(this.$openButton);\n this.$bookmarkButton = $(\"\\n \\n \");\n this.$options.prepend(this.$bookmarkButton);\n this.$shareButton = $(\"\\n \\n \");\n this.$options.append(this.$shareButton);\n this.$embedButton = $(\"\\n \\n \");\n this.$options.append(this.$embedButton);\n this.$downloadButton = $(\"\\n \\n \");\n this.$options.prepend(this.$downloadButton);\n this.$moreInfoButton = $(\"\\n \\n \");\n this.$options.prepend(this.$moreInfoButton);\n this.$fullScreenBtn = $(\"\\n \\n \");\n this.$options.append(this.$fullScreenBtn);\n this.$openButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.OPEN);\n });\n this.$feedbackButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.FEEDBACK);\n });\n this.$bookmarkButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.BOOKMARK);\n });\n this.$shareButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_SHARE_DIALOGUE, _this.$shareButton);\n });\n this.$embedButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_EMBED_DIALOGUE, _this.$embedButton);\n });\n this.$downloadButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_DOWNLOAD_DIALOGUE, _this.$downloadButton);\n });\n this.$moreInfoButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_MOREINFO_DIALOGUE, _this.$moreInfoButton);\n });\n this.$fullScreenBtn.on('click', function (e) {\n e.preventDefault();\n _this.component.publish(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN);\n });\n if (!Utils.Bools.getBool(this.options.embedEnabled, true)) {\n this.$embedButton.hide();\n }\n this.updateMoreInfoButton();\n this.updateOpenButton();\n this.updateFeedbackButton();\n this.updateBookmarkButton();\n this.updateEmbedButton();\n this.updateDownloadButton();\n this.updateFullScreenButton();\n this.updateShareButton();\n this.updateMinimisedButtons();\n };\n FooterPanel.prototype.updateMinimisedButtons = function () {\n // if configured to always minimise buttons\n if (Utils.Bools.getBool(this.options.minimiseButtons, false)) {\n this.$options.addClass('minimiseButtons');\n return;\n }\n // otherwise, check metric\n if (!this.extension.isDesktopMetric()) {\n this.$options.addClass('minimiseButtons');\n }\n else {\n this.$options.removeClass('minimiseButtons');\n }\n };\n FooterPanel.prototype.updateMoreInfoButton = function () {\n var configEnabled = Utils.Bools.getBool(this.options.moreInfoEnabled, false);\n if (configEnabled && !this.extension.isDesktopMetric() && !this.extension.isCatchAllMetric()) {\n this.$moreInfoButton.show();\n }\n else {\n this.$moreInfoButton.hide();\n }\n };\n FooterPanel.prototype.updateOpenButton = function () {\n var configEnabled = Utils.Bools.getBool(this.options.openEnabled, false);\n if (configEnabled && Utils.Documents.isInIFrame()) {\n this.$openButton.show();\n }\n else {\n this.$openButton.hide();\n }\n };\n FooterPanel.prototype.updateFullScreenButton = function () {\n if (!Utils.Bools.getBool(this.options.fullscreenEnabled, true) || !Utils.Documents.supportsFullscreen()) {\n this.$fullScreenBtn.hide();\n return;\n }\n if (this.extension.data.isLightbox) {\n this.$fullScreenBtn.addClass('lightbox');\n }\n if (this.extension.isFullScreen()) {\n this.$fullScreenBtn.switchClass('fullScreen', 'exitFullscreen');\n this.$fullScreenBtn.find('i').switchClass('uv-icon-fullscreen', 'uv-icon-exit-fullscreen');\n this.$fullScreenBtn.attr('title', this.content.exitFullScreen);\n $(this.$fullScreenBtn[0].firstChild.nextSibling.nextSibling).replaceWith(this.content.exitFullScreen);\n }\n else {\n this.$fullScreenBtn.switchClass('exitFullscreen', 'fullScreen');\n this.$fullScreenBtn.find('i').switchClass('uv-icon-exit-fullscreen', 'uv-icon-fullscreen');\n this.$fullScreenBtn.attr('title', this.content.fullScreen);\n $(this.$fullScreenBtn[0].firstChild.nextSibling.nextSibling).replaceWith(this.content.fullScreen);\n }\n };\n FooterPanel.prototype.updateEmbedButton = function () {\n if (this.extension.helper.isUIEnabled('embed') && Utils.Bools.getBool(this.options.embedEnabled, false)) {\n // current jquery version sets display to 'inline' in mobile version, while this should remain hidden (see media query)\n if (!this.extension.isMobile()) {\n this.$embedButton.show();\n }\n }\n else {\n this.$embedButton.hide();\n }\n };\n FooterPanel.prototype.updateShareButton = function () {\n if (this.extension.helper.isUIEnabled('share') && Utils.Bools.getBool(this.options.shareEnabled, true)) {\n this.$shareButton.show();\n }\n else {\n this.$shareButton.hide();\n }\n };\n FooterPanel.prototype.updateDownloadButton = function () {\n var configEnabled = Utils.Bools.getBool(this.options.downloadEnabled, true);\n if (configEnabled) {\n this.$downloadButton.show();\n }\n else {\n this.$downloadButton.hide();\n }\n };\n FooterPanel.prototype.updateFeedbackButton = function () {\n var configEnabled = Utils.Bools.getBool(this.options.feedbackEnabled, false);\n if (configEnabled) {\n this.$feedbackButton.show();\n }\n else {\n this.$feedbackButton.hide();\n }\n };\n FooterPanel.prototype.updateBookmarkButton = function () {\n var configEnabled = Utils.Bools.getBool(this.options.bookmarkEnabled, false);\n if (configEnabled) {\n this.$bookmarkButton.show();\n }\n else {\n this.$bookmarkButton.hide();\n }\n };\n FooterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return FooterPanel;\n }(BaseView_1.BaseView));\n exports.FooterPanel = FooterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-avmobilefooterpanel-module/MobileFooter',[\"require\", \"exports\", \"../uv-shared-module/FooterPanel\"], function (require, exports, FooterPanel_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var FooterPanel = /** @class */ (function (_super) {\n __extends(FooterPanel, _super);\n function FooterPanel($element) {\n return _super.call(this, $element) || this;\n }\n FooterPanel.prototype.create = function () {\n this.setConfig('mobileFooterPanel');\n _super.prototype.create.call(this);\n };\n FooterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$options.css('left', Math.floor((this.$element.width() / 2) - (this.$options.width() / 2)));\n };\n return FooterPanel;\n }(FooterPanel_1.FooterPanel));\n exports.FooterPanel = FooterPanel;\n});\n\n", - "define('modules/uv-shared-module/Information',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Information = /** @class */ (function () {\n function Information(message, actions) {\n this.message = message;\n this.actions = actions;\n }\n return Information;\n }());\n exports.Information = Information;\n});\n\n", - "define('modules/uv-shared-module/InformationAction',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var InformationAction = /** @class */ (function () {\n function InformationAction() {\n }\n return InformationAction;\n }());\n exports.InformationAction = InformationAction;\n});\n\n", - "define('modules/uv-shared-module/InformationFactory',[\"require\", \"exports\", \"./BaseEvents\", \"./Information\", \"./InformationAction\", \"./InformationType\"], function (require, exports, BaseEvents_1, Information_1, InformationAction_1, InformationType_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var InformationFactory = /** @class */ (function () {\n function InformationFactory(extension) {\n this.extension = extension;\n }\n InformationFactory.prototype.Get = function (args) {\n var _this = this;\n switch (args.informationType) {\n case (InformationType_1.InformationType.AUTH_CORS_ERROR):\n return new Information_1.Information(this.extension.data.config.content.authCORSError, []);\n case (InformationType_1.InformationType.DEGRADED_RESOURCE):\n var actions = [];\n var loginAction = new InformationAction_1.InformationAction();\n var label = args.param.loginService.getConfirmLabel();\n if (!label) {\n label = this.extension.data.config.content.fallbackDegradedLabel;\n }\n loginAction.label = label;\n var resource_1 = args.param;\n loginAction.action = function () {\n resource_1.authHoldingPage = window.open(\"\", \"_blank\");\n _this.extension.component.publish(BaseEvents_1.BaseEvents.HIDE_INFORMATION);\n _this.extension.component.publish(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, [[resource_1]]);\n };\n actions.push(loginAction);\n var message = args.param.loginService.getServiceLabel();\n if (!message) {\n message = this.extension.data.config.content.fallbackDegradedMessage;\n }\n return new Information_1.Information(message, actions);\n }\n };\n return InformationFactory;\n }());\n exports.InformationFactory = InformationFactory;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/HeaderPanel',[\"require\", \"exports\", \"./BaseEvents\", \"./BaseView\", \"../uv-shared-module/InformationFactory\"], function (require, exports, BaseEvents_1, BaseView_1, InformationFactory_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var HeaderPanel = /** @class */ (function (_super) {\n __extends(HeaderPanel, _super);\n function HeaderPanel($element) {\n return _super.call(this, $element, false, false) || this;\n }\n HeaderPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('headerPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_INFORMATION, function (args) {\n _this.showInformation(args);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_INFORMATION, function () {\n _this.hideInformation();\n });\n this.$options = $('
          ');\n this.$element.append(this.$options);\n this.$centerOptions = $('
          ');\n this.$options.append(this.$centerOptions);\n this.$rightOptions = $('
          ');\n this.$options.append(this.$rightOptions);\n //this.$helpButton = $('' + this.content.help + '');\n //this.$rightOptions.append(this.$helpButton);\n this.$localeToggleButton = $('');\n this.$rightOptions.append(this.$localeToggleButton);\n this.$settingsButton = $(\"\\n \\n \");\n this.$settingsButton.attr('title', this.content.settings);\n this.$rightOptions.append(this.$settingsButton);\n this.$informationBox = $('
          \\\n
          \\\n
          \\\n \\\n
          ');\n this.$element.append(this.$informationBox);\n this.$informationBox.hide();\n this.$informationBox.find('.close').attr('title', this.content.close);\n this.$informationBox.find('.close').on('click', function (e) {\n e.preventDefault();\n _this.component.publish(BaseEvents_1.BaseEvents.HIDE_INFORMATION);\n });\n this.$localeToggleButton.on('click', function () {\n _this.extension.changeLocale(String(_this.$localeToggleButton.data('locale')));\n });\n this.$settingsButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_SETTINGS_DIALOGUE);\n });\n if (!Utils.Bools.getBool(this.options.centerOptionsEnabled, true)) {\n this.$centerOptions.hide();\n }\n this.updateLocaleToggle();\n this.updateSettingsButton();\n };\n HeaderPanel.prototype.updateLocaleToggle = function () {\n if (!this.localeToggleIsVisible()) {\n this.$localeToggleButton.hide();\n return;\n }\n var alternateLocale = this.extension.getAlternateLocale();\n var text = alternateLocale.name.split('-')[0].toUpperCase();\n this.$localeToggleButton.data('locale', alternateLocale.name);\n this.$localeToggleButton.attr('title', alternateLocale.label);\n this.$localeToggleButton.text(text);\n };\n HeaderPanel.prototype.updateSettingsButton = function () {\n var settingsEnabled = Utils.Bools.getBool(this.options.settingsButtonEnabled, true);\n if (!settingsEnabled) {\n this.$settingsButton.hide();\n }\n else {\n this.$settingsButton.show();\n }\n };\n HeaderPanel.prototype.localeToggleIsVisible = function () {\n var locales = this.extension.data.locales;\n if (locales) {\n return locales.length > 1 && Utils.Bools.getBool(this.options.localeToggleEnabled, false);\n }\n return false;\n };\n HeaderPanel.prototype.showInformation = function (args) {\n var informationFactory = new InformationFactory_1.InformationFactory(this.extension);\n this.information = informationFactory.Get(args);\n var $message = this.$informationBox.find('.message');\n $message.html(this.information.message).find('a').attr('target', '_top');\n var $actions = this.$informationBox.find('.actions');\n $actions.empty();\n for (var i = 0; i < this.information.actions.length; i++) {\n var action = this.information.actions[i];\n var $action = $('' + action.label + '');\n $action.on('click', action.action);\n $actions.append($action);\n }\n this.$informationBox.attr('aria-hidden', 'false');\n this.$informationBox.show();\n this.$element.addClass('showInformation');\n this.extension.resize();\n };\n HeaderPanel.prototype.hideInformation = function () {\n this.$element.removeClass('showInformation');\n this.$informationBox.attr('aria-hidden', 'true');\n this.$informationBox.hide();\n this.extension.resize();\n };\n HeaderPanel.prototype.getSettings = function () {\n return this.extension.getSettings();\n };\n HeaderPanel.prototype.updateSettings = function (settings) {\n this.extension.updateSettings(settings);\n this.component.publish(BaseEvents_1.BaseEvents.UPDATE_SETTINGS, settings);\n };\n HeaderPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n var headerWidth = this.$element.width();\n var center = headerWidth / 2;\n var containerWidth = this.$centerOptions.outerWidth();\n var pos = center - (containerWidth / 2);\n this.$centerOptions.css({\n left: pos\n });\n if (this.$informationBox.is(':visible')) {\n var $actions = this.$informationBox.find('.actions');\n var $message = this.$informationBox.find('.message');\n $message.width(Math.floor(this.$element.width()) - Math.ceil($message.horizontalMargins()) - Math.ceil($actions.outerWidth(true)) - Math.ceil(this.$informationBox.find('.close').outerWidth(true)) - 2);\n $message.text(this.information.message);\n }\n // hide toggle buttons below minimum width\n if (this.extension.width() < this.extension.data.config.options.minWidthBreakPoint) {\n if (this.localeToggleIsVisible())\n this.$localeToggleButton.hide();\n }\n else {\n if (this.localeToggleIsVisible())\n this.$localeToggleButton.show();\n }\n };\n return HeaderPanel;\n }(BaseView_1.BaseView));\n exports.HeaderPanel = HeaderPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-shared-module/RightPanel',[\"require\", \"exports\", \"./BaseEvents\", \"./BaseExpandPanel\"], function (require, exports, BaseEvents_1, BaseExpandPanel_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var RightPanel = /** @class */ (function (_super) {\n __extends(RightPanel, _super);\n function RightPanel($element) {\n return _super.call(this, $element) || this;\n }\n RightPanel.prototype.create = function () {\n _super.prototype.create.call(this);\n this.$element.width(this.options.panelCollapsedWidth);\n };\n RightPanel.prototype.init = function () {\n var _this = this;\n _super.prototype.init.call(this);\n var shouldOpenPanel = Utils.Bools.getBool(this.extension.getSettings().rightPanelOpen, this.options.panelOpen);\n if (shouldOpenPanel) {\n this.toggle(true);\n }\n this.component.subscribe(BaseEvents_1.BaseEvents.TOGGLE_EXPAND_RIGHT_PANEL, function () {\n if (_this.isFullyExpanded) {\n _this.collapseFull();\n }\n else {\n _this.expandFull();\n }\n });\n };\n RightPanel.prototype.getTargetWidth = function () {\n return this.isExpanded ? this.options.panelCollapsedWidth : this.options.panelExpandedWidth;\n };\n RightPanel.prototype.getTargetLeft = function () {\n return this.isExpanded ? this.$element.parent().width() - this.options.panelCollapsedWidth : this.$element.parent().width() - this.options.panelExpandedWidth;\n };\n RightPanel.prototype.toggleFinish = function () {\n _super.prototype.toggleFinish.call(this);\n if (this.isExpanded) {\n this.component.publish(BaseEvents_1.BaseEvents.OPEN_RIGHT_PANEL);\n }\n else {\n this.component.publish(BaseEvents_1.BaseEvents.CLOSE_RIGHT_PANEL);\n }\n this.extension.updateSettings({ rightPanelOpen: this.isExpanded });\n };\n RightPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$element.css({\n 'left': Math.floor(this.$element.parent().width() - this.$element.outerWidth())\n });\n };\n return RightPanel;\n }(BaseExpandPanel_1.BaseExpandPanel));\n exports.RightPanel = RightPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-moreinforightpanel-module/MoreInfoRightPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/RightPanel\", \"../../Utils\"], function (require, exports, BaseEvents_1, RightPanel_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var MoreInfoRightPanel = /** @class */ (function (_super) {\n __extends(MoreInfoRightPanel, _super);\n function MoreInfoRightPanel($element) {\n return _super.call(this, $element) || this;\n }\n MoreInfoRightPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('moreInfoRightPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function () {\n _this.databind();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RANGE_CHANGED, function () {\n _this.databind();\n });\n this.setTitle(this.config.content.title);\n this.$metadata = $('');\n this.$main.append(this.$metadata);\n this.metadataComponent = new IIIFComponents.MetadataComponent({\n target: this.$metadata[0],\n data: this._getData()\n });\n this.metadataComponent.on('iiifViewerLinkClicked', function (href) {\n // get the hash param.\n var rangeId = Utils.Urls.getHashParameterFromString('rid', href);\n if (rangeId) {\n var range = _this.extension.helper.getRangeById(rangeId);\n if (range) {\n _this.component.publish(BaseEvents_1.BaseEvents.RANGE_CHANGED, range);\n }\n }\n }, false);\n };\n MoreInfoRightPanel.prototype.toggleFinish = function () {\n _super.prototype.toggleFinish.call(this);\n this.databind();\n };\n MoreInfoRightPanel.prototype.databind = function () {\n this.metadataComponent.set(this._getData());\n };\n MoreInfoRightPanel.prototype._getCurrentRange = function () {\n var range = this.extension.helper.getCurrentRange();\n return range;\n };\n MoreInfoRightPanel.prototype._getData = function () {\n return {\n canvasDisplayOrder: this.config.options.canvasDisplayOrder,\n canvases: this.extension.getCurrentCanvases(),\n canvasExclude: this.config.options.canvasExclude,\n canvasLabels: this.extension.getCanvasLabels(this.content.page),\n content: this.config.content,\n copiedMessageDuration: 2000,\n copyToClipboardEnabled: Utils.Bools.getBool(this.config.options.copyToClipboardEnabled, false),\n helper: this.extension.helper,\n licenseFormatter: new Manifold.UriLabeller(this.config.license ? this.config.license : {}),\n limit: this.config.options.textLimit || 4,\n limitType: IIIFComponents.LimitType.LINES,\n limitToRange: Utils.Bools.getBool(this.config.options.limitToRange, false),\n manifestDisplayOrder: this.config.options.manifestDisplayOrder,\n manifestExclude: this.config.options.manifestExclude,\n range: this._getCurrentRange(),\n rtlLanguageCodes: this.config.options.rtlLanguageCodes,\n sanitizer: function (html) {\n return Utils_1.UVUtils.sanitize(html);\n },\n showAllLanguages: this.config.options.showAllLanguages\n };\n };\n MoreInfoRightPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$main.height(this.$element.height() - this.$top.height() - this.$main.verticalMargins());\n };\n return MoreInfoRightPanel;\n }(RightPanel_1.RightPanel));\n exports.MoreInfoRightPanel = MoreInfoRightPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/SettingsDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SettingsDialogue = /** @class */ (function (_super) {\n __extends(SettingsDialogue, _super);\n function SettingsDialogue($element) {\n return _super.call(this, $element) || this;\n }\n SettingsDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('settingsDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_SETTINGS_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_SETTINGS_DIALOGUE;\n this.component.subscribe(this.openCommand, function () {\n _this.open();\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$title = $('

          ');\n this.$content.append(this.$title);\n this.$scroll = $('
          ');\n this.$content.append(this.$scroll);\n this.$version = $('
          ');\n this.$content.append(this.$version);\n this.$website = $('
          ');\n this.$content.append(this.$website);\n this.$locale = $('
          ');\n this.$scroll.append(this.$locale);\n this.$localeLabel = $('');\n this.$locale.append(this.$localeLabel);\n this.$localeDropDown = $('');\n this.$locale.append(this.$localeDropDown);\n // initialise ui.\n this.$title.text(this.content.title);\n this.$website.html(this.content.website);\n this.$website.targetBlank();\n this._createLocalesMenu();\n this.$element.hide();\n };\n SettingsDialogue.prototype.getSettings = function () {\n return this.extension.getSettings();\n };\n SettingsDialogue.prototype.updateSettings = function (settings) {\n this.extension.updateSettings(settings);\n this.component.publish(BaseEvents_1.BaseEvents.UPDATE_SETTINGS, settings);\n };\n SettingsDialogue.prototype.open = function () {\n var _this = this;\n _super.prototype.open.call(this);\n $.getJSON(this.extension.data.root + \"/info.json\", function (pjson) {\n _this.$version.text(\"v\" + pjson.version);\n });\n };\n SettingsDialogue.prototype._createLocalesMenu = function () {\n var _this = this;\n var locales = this.extension.data.locales;\n if (locales && locales.length > 1) {\n for (var i = 0; i < locales.length; i++) {\n var locale = locales[i];\n this.$localeDropDown.append('');\n }\n this.$localeDropDown.val(locales[0].name);\n }\n else {\n this.$locale.hide();\n }\n this.$localeDropDown.change(function () {\n _this.extension.changeLocale(_this.$localeDropDown.val());\n });\n };\n SettingsDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return SettingsDialogue;\n }(Dialogue_1.Dialogue));\n exports.SettingsDialogue = SettingsDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-av-extension/SettingsDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/SettingsDialogue\"], function (require, exports, SettingsDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SettingsDialogue = /** @class */ (function (_super) {\n __extends(SettingsDialogue, _super);\n function SettingsDialogue($element) {\n return _super.call(this, $element) || this;\n }\n SettingsDialogue.prototype.create = function () {\n this.setConfig('settingsDialogue');\n _super.prototype.create.call(this);\n };\n return SettingsDialogue;\n }(SettingsDialogue_1.SettingsDialogue));\n exports.SettingsDialogue = SettingsDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/ShareDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ShareDialogue = /** @class */ (function (_super) {\n __extends(ShareDialogue, _super);\n function ShareDialogue($element) {\n var _this = _super.call(this, $element) || this;\n _this.aspectRatio = .75;\n _this.isEmbedViewVisible = false;\n _this.isShareViewVisible = false;\n _this.maxWidth = 8000;\n _this.maxHeight = _this.maxWidth * _this.aspectRatio;\n _this.minWidth = 200;\n _this.minHeight = _this.minWidth * _this.aspectRatio;\n return _this;\n }\n ShareDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('shareDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_SHARE_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_SHARE_DIALOGUE;\n this.component.subscribe(this.openCommand, function (triggerButton) {\n _this.open(triggerButton);\n if (_this.isShareAvailable()) {\n _this.openShareView();\n }\n else {\n _this.openEmbedView();\n }\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_EMBED_DIALOGUE, function (triggerButton) {\n _this.open(triggerButton);\n _this.openEmbedView();\n });\n this.$tabs = $('
          ');\n this.$content.append(this.$tabs);\n this.$shareButton = $('' + this.content.share + '');\n this.$shareButton.prop('title', this.content.share);\n this.$tabs.append(this.$shareButton);\n this.$embedButton = $('' + this.content.embed + '');\n this.$embedButton.prop('title', this.content.embed);\n this.$tabs.append(this.$embedButton);\n this.$tabsContent = $('
          ');\n this.$content.append(this.$tabsContent);\n this.$footer = $('
          ');\n this.$content.append(this.$footer);\n this.$shareView = $('
          ');\n this.$tabsContent.append(this.$shareView);\n this.$shareHeader = $('
          ');\n this.$shareView.append(this.$shareHeader);\n this.$shareLink = $('');\n this.$shareView.append(this.$shareLink);\n this.$shareInput = $(\"\");\n this.$shareView.append(this.$shareInput);\n this.$shareFrame = $('');\n this.$shareView.append(this.$shareFrame);\n this.$embedView = $('
          ');\n this.$tabsContent.append(this.$embedView);\n this.$embedHeader = $('
          ');\n this.$embedView.append(this.$embedHeader);\n // this.$link = $('');\n // this.$embedView.find('.leftCol').append(this.$link);\n // this.$image = $('');\n // this.$embedView.append(this.$image);\n this.$code = $(\"\");\n this.$embedView.append(this.$code);\n this.$customSize = $('
          ');\n this.$embedView.append(this.$customSize);\n this.$size = $('' + this.content.size + '');\n this.$customSize.append(this.$size);\n this.$customSizeDropDown = $('');\n this.$customSize.append(this.$customSizeDropDown);\n this.$customSizeDropDown.append('');\n this.$customSizeDropDown.append('');\n this.$customSizeDropDown.append('');\n this.$customSizeDropDown.append('');\n this.$widthInput = $('');\n this.$customSize.append(this.$widthInput);\n this.$x = $('x');\n this.$customSize.append(this.$x);\n this.$heightInput = $('');\n this.$customSize.append(this.$heightInput);\n var iiifUrl = this.extension.getIIIFShareUrl();\n this.$iiifButton = $('');\n this.$footer.append(this.$iiifButton);\n this.$termsOfUseButton = $('' + this.extension.data.config.content.termsOfUse + '');\n this.$footer.append(this.$termsOfUseButton);\n this.$widthInput.on('keydown', function (e) {\n return Utils.Numbers.numericalInput(e);\n });\n this.$heightInput.on('keydown', function (e) {\n return Utils.Numbers.numericalInput(e);\n });\n this.$shareInput.focus(function () {\n $(this).select();\n });\n this.$code.focus(function () {\n $(this).select();\n });\n this.$shareButton.onPressed(function () {\n _this.openShareView();\n });\n this.$embedButton.onPressed(function () {\n _this.openEmbedView();\n });\n this.$customSizeDropDown.change(function () {\n _this.update();\n });\n this.$widthInput.change(function () {\n _this.updateHeightRatio();\n _this.update();\n });\n this.$heightInput.change(function () {\n _this.updateWidthRatio();\n _this.update();\n });\n this.$termsOfUseButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_TERMS_OF_USE);\n });\n this.$element.hide();\n this.update();\n };\n ShareDialogue.prototype.open = function (triggerButton) {\n _super.prototype.open.call(this, triggerButton);\n this.update();\n };\n ShareDialogue.prototype.getShareUrl = function () {\n return this.extension.getShareUrl();\n };\n ShareDialogue.prototype.isShareAvailable = function () {\n return !!this.getShareUrl();\n };\n ShareDialogue.prototype.update = function () {\n if (this.isShareAvailable()) {\n this.$shareButton.show();\n }\n else {\n this.$shareButton.hide();\n }\n var $selected = this.getSelectedSize();\n if ($selected.val() === 'custom') {\n this.$widthInput.show();\n this.$x.show();\n this.$heightInput.show();\n }\n else {\n this.$widthInput.hide();\n this.$x.hide();\n this.$heightInput.hide();\n this.currentWidth = Number($selected.data('width'));\n this.currentHeight = Number($selected.data('height'));\n this.$widthInput.val(String(this.currentWidth));\n this.$heightInput.val(String(this.currentHeight));\n }\n this.updateInstructions();\n this.updateShareOptions();\n this.updateShareFrame();\n this.updateTermsOfUseButton();\n };\n ShareDialogue.prototype.updateShareOptions = function () {\n var shareUrl = this.getShareUrl();\n if (shareUrl) {\n this.$shareInput.val(shareUrl);\n this.$shareLink.prop('href', shareUrl);\n this.$shareLink.text(shareUrl);\n }\n if (this.extension.isMobile()) {\n this.$shareInput.hide();\n this.$shareLink.show();\n }\n else {\n this.$shareInput.show();\n this.$shareLink.hide();\n }\n };\n ShareDialogue.prototype.updateInstructions = function () {\n if (Utils.Bools.getBool(this.options.instructionsEnabled, false)) {\n this.$shareHeader.show();\n this.$embedHeader.show();\n this.$shareHeader.text(this.content.shareInstructions);\n this.$embedHeader.text(this.content.embedInstructions);\n }\n else {\n this.$shareHeader.hide();\n this.$embedHeader.hide();\n }\n };\n // updateThumbnail(): void {\n // var canvas: Manifesto.ICanvas = this.extension.helper.getCurrentCanvas();\n // if (!canvas) return;\n // var thumbnail = canvas.getProperty('thumbnail');\n // if (!thumbnail || !_.isString(thumbnail)){\n // thumbnail = canvas.getCanonicalImageUri(this.extension.data.config.options.bookmarkThumbWidth);\n // }\n // this.$link.attr('href', thumbnail);\n // this.$image.attr('src', thumbnail);\n // }\n ShareDialogue.prototype.getSelectedSize = function () {\n return this.$customSizeDropDown.find(':selected');\n };\n ShareDialogue.prototype.updateWidthRatio = function () {\n this.currentHeight = Number(this.$heightInput.val());\n if (this.currentHeight < this.minHeight) {\n this.currentHeight = this.minHeight;\n this.$heightInput.val(String(this.currentHeight));\n }\n else if (this.currentHeight > this.maxHeight) {\n this.currentHeight = this.maxHeight;\n this.$heightInput.val(String(this.currentHeight));\n }\n this.currentWidth = Math.floor(this.currentHeight / this.aspectRatio);\n this.$widthInput.val(String(this.currentWidth));\n };\n ShareDialogue.prototype.updateHeightRatio = function () {\n this.currentWidth = Number(this.$widthInput.val());\n if (this.currentWidth < this.minWidth) {\n this.currentWidth = this.minWidth;\n this.$widthInput.val(String(this.currentWidth));\n }\n else if (this.currentWidth > this.maxWidth) {\n this.currentWidth = this.maxWidth;\n this.$widthInput.val(String(this.currentWidth));\n }\n this.currentHeight = Math.floor(this.currentWidth * this.aspectRatio);\n this.$heightInput.val(String(this.currentHeight));\n };\n ShareDialogue.prototype.updateShareFrame = function () {\n var shareUrl = this.extension.helper.getShareServiceUrl();\n if (!shareUrl) {\n return;\n }\n if (Utils.Bools.getBool(this.config.options.shareFrameEnabled, true) && shareUrl) {\n this.$shareFrame.prop('src', shareUrl);\n this.$shareFrame.show();\n }\n else {\n this.$shareFrame.hide();\n }\n };\n ShareDialogue.prototype.updateTermsOfUseButton = function () {\n var requiredStatement = this.extension.helper.getRequiredStatement();\n if (Utils.Bools.getBool(this.extension.data.config.options.termsOfUseEnabled, false) && requiredStatement && requiredStatement.value) {\n this.$termsOfUseButton.show();\n }\n else {\n this.$termsOfUseButton.hide();\n }\n };\n ShareDialogue.prototype.openShareView = function () {\n this.isShareViewVisible = true;\n this.isEmbedViewVisible = false;\n this.$embedView.hide();\n this.$shareView.show();\n this.$shareButton.addClass('on default');\n this.$embedButton.removeClass('on default');\n this.resize();\n };\n ShareDialogue.prototype.openEmbedView = function () {\n this.isShareViewVisible = false;\n this.isEmbedViewVisible = true;\n this.$embedView.show();\n this.$shareView.hide();\n this.$shareButton.removeClass('on default');\n this.$embedButton.addClass('on default');\n this.resize();\n };\n ShareDialogue.prototype.close = function () {\n _super.prototype.close.call(this);\n };\n ShareDialogue.prototype.getViews = function () {\n return this.$tabsContent.find('.view');\n };\n ShareDialogue.prototype.equaliseViewHeights = function () {\n this.getViews().equaliseHeight(true);\n };\n ShareDialogue.prototype.resize = function () {\n this.equaliseViewHeights();\n this.setDockedPosition();\n };\n return ShareDialogue;\n }(Dialogue_1.Dialogue));\n exports.ShareDialogue = ShareDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-av-extension/ShareDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/ShareDialogue\"], function (require, exports, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ShareDialogue = /** @class */ (function (_super) {\n __extends(ShareDialogue, _super);\n function ShareDialogue($element) {\n return _super.call(this, $element) || this;\n }\n ShareDialogue.prototype.create = function () {\n this.setConfig('shareDialogue');\n _super.prototype.create.call(this);\n };\n ShareDialogue.prototype.update = function () {\n _super.prototype.update.call(this);\n this.code = this.extension.getEmbedScript(this.options.embedTemplate, this.currentWidth, this.currentHeight);\n this.$code.val(this.code);\n };\n ShareDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ShareDialogue;\n }(ShareDialogue_1.ShareDialogue));\n exports.ShareDialogue = ShareDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-av-extension/Extension',[\"require\", \"exports\", \"../../modules/uv-avcenterpanel-module/AVCenterPanel\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-shared-module/BaseExtension\", \"../../modules/uv-contentleftpanel-module/ContentLeftPanel\", \"./DownloadDialogue\", \"../../modules/uv-shared-module/FooterPanel\", \"../../modules/uv-avmobilefooterpanel-module/MobileFooter\", \"../../modules/uv-shared-module/HeaderPanel\", \"../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel\", \"./SettingsDialogue\", \"./ShareDialogue\"], function (require, exports, AVCenterPanel_1, BaseEvents_1, BaseExtension_1, ContentLeftPanel_1, DownloadDialogue_1, FooterPanel_1, MobileFooter_1, HeaderPanel_1, MoreInfoRightPanel_1, SettingsDialogue_1, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Extension = /** @class */ (function (_super) {\n __extends(Extension, _super);\n function Extension() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Extension.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n //requirejs.config({shim: {'uv/lib/hls.min': { deps: ['require'], exports: \"Hls\"}}});\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.viewCanvas(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.TREE_NODE_SELECTED, function (node) {\n _this.fire(BaseEvents_1.BaseEvents.TREE_NODE_SELECTED, node.data.path);\n _this.treeNodeSelected(node);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.THUMB_SELECTED, function (thumb) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, thumb.index);\n });\n };\n Extension.prototype.dependencyLoaded = function (index, dep) {\n if (index === this.getDependencyIndex('waveform-data')) {\n window.WaveformData = dep;\n }\n else if (index === this.getDependencyIndex('hls')) {\n window.Hls = dep; //https://github.com/mrdoob/three.js/issues/9602\n }\n };\n Extension.prototype.createModules = function () {\n _super.prototype.createModules.call(this);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel = new HeaderPanel_1.HeaderPanel(this.shell.$headerPanel);\n }\n else {\n this.shell.$headerPanel.hide();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel = new ContentLeftPanel_1.ContentLeftPanel(this.shell.$leftPanel);\n }\n else {\n this.shell.$leftPanel.hide();\n }\n this.centerPanel = new AVCenterPanel_1.AVCenterPanel(this.shell.$centerPanel);\n if (this.isRightPanelEnabled()) {\n this.rightPanel = new MoreInfoRightPanel_1.MoreInfoRightPanel(this.shell.$rightPanel);\n }\n else {\n this.shell.$rightPanel.hide();\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel = new FooterPanel_1.FooterPanel(this.shell.$footerPanel);\n this.mobileFooterPanel = new MobileFooter_1.FooterPanel(this.shell.$mobileFooterPanel);\n }\n else {\n this.shell.$footerPanel.hide();\n }\n this.$shareDialogue = $('
          ');\n this.shell.$overlays.append(this.$shareDialogue);\n this.shareDialogue = new ShareDialogue_1.ShareDialogue(this.$shareDialogue);\n this.$downloadDialogue = $('
          ');\n this.shell.$overlays.append(this.$downloadDialogue);\n this.downloadDialogue = new DownloadDialogue_1.DownloadDialogue(this.$downloadDialogue);\n this.$settingsDialogue = $('
          ');\n this.shell.$overlays.append(this.$settingsDialogue);\n this.settingsDialogue = new SettingsDialogue_1.SettingsDialogue(this.$settingsDialogue);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel.init();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel.init();\n }\n if (this.isRightPanelEnabled()) {\n this.rightPanel.init();\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel.init();\n }\n };\n Extension.prototype.isLeftPanelEnabled = function () {\n var isEnabled = _super.prototype.isLeftPanelEnabled.call(this);\n var tree = this.helper.getTree();\n if (tree && tree.nodes.length) {\n isEnabled = true;\n }\n return isEnabled;\n };\n Extension.prototype.render = function () {\n _super.prototype.render.call(this);\n };\n Extension.prototype.getEmbedScript = function (template, width, height) {\n var appUri = this.getAppUri();\n var iframeSrc = appUri + \"#?manifest=\" + this.helper.iiifResourceUri + \"&c=\" + this.helper.collectionIndex + \"&m=\" + this.helper.manifestIndex + \"&s=\" + this.helper.sequenceIndex + \"&cv=\" + this.helper.canvasIndex + \"&rid=\" + this.helper.rangeId;\n var script = Utils.Strings.format(template, iframeSrc, width.toString(), height.toString());\n return script;\n };\n Extension.prototype.treeNodeSelected = function (node) {\n var data = node.data;\n if (!data.type)\n return;\n switch (data.type) {\n case manifesto.IIIFResourceType.manifest().toString():\n // do nothing\n break;\n case manifesto.IIIFResourceType.collection().toString():\n // do nothing\n break;\n default:\n this.viewRange(data.path);\n break;\n }\n };\n Extension.prototype.viewRange = function (path) {\n var range = this.helper.getRangeByPath(path);\n if (!range)\n return;\n this.component.publish(BaseEvents_1.BaseEvents.RANGE_CHANGED, range);\n // don't update the canvas index, only when thumbs are clicked\n // if (range.canvases && range.canvases.length) {\n // const canvasId: string = range.canvases[0];\n // const canvas: Manifesto.ICanvas | null = this.helper.getCanvasById(canvasId);\n // if (canvas) {\n // const canvasIndex: number = canvas.index;\n // if (canvasIndex !== this.helper.canvasIndex) {\n // this.component.publish(BaseEvents.CANVAS_INDEX_CHANGED, [canvasIndex]);\n // }\n // }\n // }\n };\n return Extension;\n }(BaseExtension_1.BaseExtension));\n exports.Extension = Extension;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-filelinkcenterpanel-module/FileLinkCenterPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/CenterPanel\", \"../../Utils\"], function (require, exports, BaseEvents_1, CenterPanel_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var FileLinkCenterPanel = /** @class */ (function (_super) {\n __extends(FileLinkCenterPanel, _super);\n function FileLinkCenterPanel($element) {\n return _super.call(this, $element) || this;\n }\n FileLinkCenterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('fileLinkCenterPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, function (resources) {\n _this.openMedia(resources);\n });\n this.$scroll = $('
          ');\n this.$content.append(this.$scroll);\n this.$downloadItems = $('
            ');\n this.$scroll.append(this.$downloadItems);\n this.$downloadItemTemplate = $('
          1. ');\n this.title = this.extension.helper.getLabel();\n };\n FileLinkCenterPanel.prototype.openMedia = function (resources) {\n var _this = this;\n this.extension.getExternalResources(resources).then(function () {\n var canvas = _this.extension.helper.getCurrentCanvas();\n var annotations = canvas.getContent();\n var $item;\n for (var i = 0; i < annotations.length; i++) {\n var annotation = annotations[i];\n if (!annotation.getBody().length) {\n continue;\n }\n $item = _this.$downloadItemTemplate.clone();\n var $fileName = $item.find('.filename');\n var $label = $item.find('.label');\n var $thumb = $item.find('img');\n var $description = $item.find('.description');\n var annotationBody = annotation.getBody()[0];\n var id = annotationBody.getProperty('id');\n if (id) {\n $fileName.prop('href', id);\n $fileName.text(id.substr(id.lastIndexOf('/') + 1));\n }\n var label = Manifesto.LanguageMap.getValue(annotationBody.getLabel());\n if (label) {\n $label.text(Utils_1.UVUtils.sanitize(label));\n }\n var thumbnail = annotation.getProperty('thumbnail');\n if (thumbnail) {\n $thumb.prop('src', thumbnail);\n }\n else {\n $thumb.hide();\n }\n var description = annotationBody.getProperty('description');\n if (description) {\n $description.text(Utils_1.UVUtils.sanitize(description));\n if (id) {\n $description.prop('href', id);\n }\n }\n _this.$downloadItems.append($item);\n }\n });\n };\n FileLinkCenterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n if (this.title) {\n this.$title.text(Utils_1.UVUtils.sanitize(this.title));\n }\n this.$scroll.height(this.$content.height() - this.$scroll.verticalMargins());\n };\n return FileLinkCenterPanel;\n }(CenterPanel_1.CenterPanel));\n exports.FileLinkCenterPanel = FileLinkCenterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/HelpDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var HelpDialogue = /** @class */ (function (_super) {\n __extends(HelpDialogue, _super);\n function HelpDialogue($element) {\n return _super.call(this, $element) || this;\n }\n HelpDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('helpDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_HELP_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_HELP_DIALOGUE;\n this.component.subscribe(this.openCommand, function () {\n _this.open();\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$title = $('

            ');\n this.$content.append(this.$title);\n this.$scroll = $('
            ');\n this.$content.append(this.$scroll);\n this.$message = $('

            ');\n this.$scroll.append(this.$message);\n // initialise ui.\n this.$title.text(this.content.title);\n this.$message.html(this.content.text);\n // ensure anchor tags link to _blank.\n this.$message.targetBlank();\n this.$element.hide();\n };\n HelpDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return HelpDialogue;\n }(Dialogue_1.Dialogue));\n exports.HelpDialogue = HelpDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-resourcesleftpanel-module/ThumbsView',[\"require\", \"exports\", \"../uv-shared-module/ThumbsView\"], function (require, exports, ThumbsView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ThumbsView = /** @class */ (function (_super) {\n __extends(ThumbsView, _super);\n function ThumbsView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ThumbsView.prototype.create = function () {\n this.setConfig('resourcesLeftPanel');\n _super.prototype.create.call(this);\n };\n return ThumbsView;\n }(ThumbsView_1.ThumbsView));\n exports.ThumbsView = ThumbsView;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-resourcesleftpanel-module/ResourcesLeftPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/LeftPanel\", \"./ThumbsView\"], function (require, exports, BaseEvents_1, LeftPanel_1, ThumbsView_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ResourcesLeftPanel = /** @class */ (function (_super) {\n __extends(ResourcesLeftPanel, _super);\n function ResourcesLeftPanel($element) {\n return _super.call(this, $element) || this;\n }\n ResourcesLeftPanel.prototype.create = function () {\n this.setConfig('resourcesLeftPanel');\n _super.prototype.create.call(this);\n this.setTitle(this.content.title);\n /*\n TODO: make tabs work\n this.$tabs = $('
            ');\n this.$main.append(this.$tabs);\n \n this.$thumbsButton = $('' + this.content.thumbnails + '');\n this.$thumbsButton.prop('title', this.content.thumbnails);\n this.$tabs.append(this.$thumbsButton);\n \n this.$resourcesButton = $('' + this.content.resources+ '');\n this.$resourcesButton.prop('title', this.content.resources);\n this.$tabs.append(this.$resourcesButton);\n */\n this.$tabsContent = $('
            ');\n this.$main.append(this.$tabsContent);\n this.$views = $('
            ');\n this.$tabsContent.append(this.$views);\n this.$thumbsView = $('
            ');\n this.$views.append(this.$thumbsView);\n this.$resourcesView = $('
            ');\n this.$resources = $('
              ');\n this.$resourcesView.append(this.$resources);\n this.$views.append(this.$resourcesView);\n this.thumbsView = new ThumbsView_1.ThumbsView(this.$thumbsView);\n this.dataBind();\n };\n ResourcesLeftPanel.prototype.dataBind = function () {\n this.dataBindThumbsView();\n var annotations = this.extension.helper.getCurrentCanvas().getResources();\n if (annotations.length === 0) {\n this.$resourcesView.hide();\n }\n for (var i = 0; i < annotations.length; i++) {\n var annotation = annotations[i];\n var resource = annotation.getResource();\n if (resource) {\n var label = Manifesto.LanguageMap.getValue(resource.getLabel());\n if (label) {\n var mime = Utils.Files.simplifyMimeType(resource.getFormat().toString());\n var $listItem = $('
            • ' + label + ' (' + mime + ')' + '
            • ');\n this.$resources.append($listItem);\n }\n }\n }\n };\n ResourcesLeftPanel.prototype.dataBindThumbsView = function () {\n if (!this.thumbsView)\n return;\n var width;\n var height;\n var viewingDirection = this.extension.helper.getViewingDirection();\n if (viewingDirection && (viewingDirection.toString() === manifesto.ViewingDirection.leftToRight().toString() || viewingDirection.toString() === manifesto.ViewingDirection.rightToLeft().toString())) {\n width = this.config.options.twoColThumbWidth;\n height = this.config.options.twoColThumbHeight;\n }\n else {\n width = this.config.options.oneColThumbWidth;\n height = this.config.options.oneColThumbHeight;\n }\n if (typeof (width) === \"undefined\") {\n width = 100;\n }\n if (typeof (height) === \"undefined\") {\n height = 100;\n }\n this.thumbsView.thumbs = this.extension.helper.getThumbs(width, height);\n // hide thumb selector for single-part manifests\n if (this.thumbsView.thumbs.length < 2) {\n this.$thumbsView.hide();\n }\n this.thumbsView.databind();\n };\n ResourcesLeftPanel.prototype.expandFullStart = function () {\n _super.prototype.expandFullStart.call(this);\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START);\n };\n ResourcesLeftPanel.prototype.expandFullFinish = function () {\n _super.prototype.expandFullFinish.call(this);\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_FINISH);\n };\n ResourcesLeftPanel.prototype.collapseFullStart = function () {\n _super.prototype.collapseFullStart.call(this);\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_START);\n };\n ResourcesLeftPanel.prototype.collapseFullFinish = function () {\n _super.prototype.collapseFullFinish.call(this);\n this.component.publish(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_FINISH);\n };\n ResourcesLeftPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$views.height(this.$main.height());\n this.$resources.height(this.$main.height());\n };\n return ResourcesLeftPanel;\n }(LeftPanel_1.LeftPanel));\n exports.ResourcesLeftPanel = ResourcesLeftPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-default-extension/SettingsDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/SettingsDialogue\"], function (require, exports, SettingsDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SettingsDialogue = /** @class */ (function (_super) {\n __extends(SettingsDialogue, _super);\n function SettingsDialogue($element) {\n return _super.call(this, $element) || this;\n }\n SettingsDialogue.prototype.create = function () {\n this.setConfig('settingsDialogue');\n _super.prototype.create.call(this);\n };\n return SettingsDialogue;\n }(SettingsDialogue_1.SettingsDialogue));\n exports.SettingsDialogue = SettingsDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-default-extension/ShareDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/ShareDialogue\"], function (require, exports, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ShareDialogue = /** @class */ (function (_super) {\n __extends(ShareDialogue, _super);\n function ShareDialogue($element) {\n return _super.call(this, $element) || this;\n }\n ShareDialogue.prototype.create = function () {\n this.setConfig('shareDialogue');\n _super.prototype.create.call(this);\n };\n ShareDialogue.prototype.update = function () {\n _super.prototype.update.call(this);\n this.code = this.extension.getEmbedScript(this.options.embedTemplate, this.currentWidth, this.currentHeight);\n this.$code.val(this.code);\n };\n ShareDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ShareDialogue;\n }(ShareDialogue_1.ShareDialogue));\n exports.ShareDialogue = ShareDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-default-extension/Extension',[\"require\", \"exports\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-shared-module/BaseExtension\", \"../../modules/uv-filelinkcenterpanel-module/FileLinkCenterPanel\", \"../../modules/uv-shared-module/FooterPanel\", \"../../modules/uv-shared-module/HeaderPanel\", \"../../modules/uv-dialogues-module/HelpDialogue\", \"../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel\", \"../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel\", \"./SettingsDialogue\", \"./ShareDialogue\"], function (require, exports, BaseEvents_1, BaseExtension_1, FileLinkCenterPanel_1, FooterPanel_1, HeaderPanel_1, HelpDialogue_1, MoreInfoRightPanel_1, ResourcesLeftPanel_1, SettingsDialogue_1, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Extension = /** @class */ (function (_super) {\n __extends(Extension, _super);\n function Extension() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Extension.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n // listen for mediaelement enter/exit fullscreen events.\n $(window).bind('enterfullscreen', function () {\n _this.component.publish(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN);\n });\n $(window).bind('exitfullscreen', function () {\n _this.component.publish(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.viewCanvas(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.THUMB_SELECTED, function (canvasIndex) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, canvasIndex);\n });\n };\n Extension.prototype.createModules = function () {\n _super.prototype.createModules.call(this);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel = new HeaderPanel_1.HeaderPanel(this.shell.$headerPanel);\n }\n else {\n this.shell.$headerPanel.hide();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel = new ResourcesLeftPanel_1.ResourcesLeftPanel(this.shell.$leftPanel);\n }\n this.centerPanel = new FileLinkCenterPanel_1.FileLinkCenterPanel(this.shell.$centerPanel);\n if (this.isRightPanelEnabled()) {\n this.rightPanel = new MoreInfoRightPanel_1.MoreInfoRightPanel(this.shell.$rightPanel);\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel = new FooterPanel_1.FooterPanel(this.shell.$footerPanel);\n }\n else {\n this.shell.$footerPanel.hide();\n }\n this.$helpDialogue = $('
              ');\n this.shell.$overlays.append(this.$helpDialogue);\n this.helpDialogue = new HelpDialogue_1.HelpDialogue(this.$helpDialogue);\n this.$shareDialogue = $('
              ');\n this.shell.$overlays.append(this.$shareDialogue);\n this.shareDialogue = new ShareDialogue_1.ShareDialogue(this.$shareDialogue);\n this.$settingsDialogue = $('
              ');\n this.shell.$overlays.append(this.$settingsDialogue);\n this.settingsDialogue = new SettingsDialogue_1.SettingsDialogue(this.$settingsDialogue);\n if (this.isLeftPanelEnabled()) {\n this.leftPanel.init();\n }\n if (this.isRightPanelEnabled()) {\n this.rightPanel.init();\n }\n };\n Extension.prototype.render = function () {\n _super.prototype.render.call(this);\n };\n Extension.prototype.isLeftPanelEnabled = function () {\n return Utils.Bools.getBool(this.data.config.options.leftPanelEnabled, true)\n && ((this.helper.isMultiCanvas() || this.helper.isMultiSequence()) || this.helper.hasResources());\n };\n Extension.prototype.getEmbedScript = function (template, width, height) {\n //const configUri: string = this.data.config.uri || '';\n //const script: string = String.format(template, this.getSerializedLocales(), configUri, this.helper.iiifResourceUri, this.helper.collectionIndex, this.helper.manifestIndex, this.helper.sequenceIndex, this.helper.canvasIndex, width, height, this.data.embedScriptUri);\n var appUri = this.getAppUri();\n var iframeSrc = appUri + \"#?manifest=\" + this.helper.iiifResourceUri + \"&c=\" + this.helper.collectionIndex + \"&m=\" + this.helper.manifestIndex + \"&s=\" + this.helper.sequenceIndex + \"&cv=\" + this.helper.canvasIndex;\n var script = Utils.Strings.format(template, iframeSrc, width.toString(), height.toString());\n return script;\n };\n return Extension;\n }(BaseExtension_1.BaseExtension));\n exports.Extension = Extension;\n});\n\n", - "define('modules/uv-shared-module/Bookmark',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Bookmark = /** @class */ (function () {\n function Bookmark() {\n }\n return Bookmark;\n }());\n exports.Bookmark = Bookmark;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-mediaelement-extension/DownloadDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/DownloadDialogue\"], function (require, exports, DownloadDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var DownloadDialogue = /** @class */ (function (_super) {\n __extends(DownloadDialogue, _super);\n function DownloadDialogue($element) {\n return _super.call(this, $element) || this;\n }\n DownloadDialogue.prototype.create = function () {\n this.setConfig('downloadDialogue');\n _super.prototype.create.call(this);\n };\n DownloadDialogue.prototype.open = function (triggerButton) {\n _super.prototype.open.call(this, triggerButton);\n this.addEntireFileDownloadOptions();\n this.updateNoneAvailable();\n this.resize();\n };\n DownloadDialogue.prototype.isDownloadOptionAvailable = function (option) {\n return _super.prototype.isDownloadOptionAvailable.call(this, option);\n };\n return DownloadDialogue;\n }(DownloadDialogue_1.DownloadDialogue));\n exports.DownloadDialogue = DownloadDialogue;\n});\n\n", - "define('extensions/uv-mediaelement-extension/Events',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Events = /** @class */ (function () {\n function Events() {\n }\n Events.namespace = 'mediaelementExtension.';\n Events.MEDIA_ENDED = Events.namespace + 'mediaEnded';\n Events.MEDIA_PAUSED = Events.namespace + 'mediaPaused';\n Events.MEDIA_PLAYED = Events.namespace + 'mediaPlayed';\n return Events;\n }());\n exports.Events = Events;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../../extensions/uv-mediaelement-extension/Events\", \"../uv-shared-module/CenterPanel\", \"../../Utils\"], function (require, exports, BaseEvents_1, Events_1, CenterPanel_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var MediaElementCenterPanel = /** @class */ (function (_super) {\n __extends(MediaElementCenterPanel, _super);\n function MediaElementCenterPanel($element) {\n return _super.call(this, $element) || this;\n }\n MediaElementCenterPanel.prototype.create = function () {\n this.setConfig('mediaelementCenterPanel');\n _super.prototype.create.call(this);\n var that = this;\n // events.\n // only full screen video\n if (this.isVideo()) {\n this.component.subscribe(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN, function () {\n if (that.component.isFullScreen) {\n that.player.enterFullScreen(false);\n }\n else {\n that.player.exitFullScreen(false);\n }\n });\n }\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, function (resources) {\n that.openMedia(resources);\n });\n this.$container = $('
              ');\n this.$content.append(this.$container);\n this.title = this.extension.helper.getLabel();\n };\n MediaElementCenterPanel.prototype.openMedia = function (resources) {\n var _this = this;\n var that = this;\n this.extension.getExternalResources(resources).then(function () {\n _this.$container.empty();\n var canvas = _this.extension.helper.getCurrentCanvas();\n _this.mediaHeight = _this.config.defaultHeight;\n _this.mediaWidth = _this.config.defaultWidth;\n _this.$container.height(_this.mediaHeight);\n _this.$container.width(_this.mediaWidth);\n var poster = _this.extension.getPosterImageUri();\n var sources = [];\n var renderings = canvas.getRenderings();\n if (renderings && renderings.length) {\n canvas.getRenderings().forEach(function (rendering) {\n sources.push({\n type: rendering.getFormat().toString(),\n src: rendering.id\n });\n });\n }\n else {\n var formats = _this.extension.getMediaFormats(_this.extension.helper.getCurrentCanvas());\n if (formats && formats.length) {\n formats.forEach(function (format) {\n var type = format.getFormat();\n if (type) {\n sources.push({\n type: type.toString(),\n src: format.id\n });\n }\n });\n }\n }\n if (_this.isVideo()) {\n _this.$media = $('');\n _this.$container.append(_this.$media);\n _this.player = new MediaElementPlayer($('video')[0], {\n //pluginPath: this.extension.data.root + 'lib/mediaelement/',\n poster: poster,\n features: ['playpause', 'current', 'progress', 'volume'],\n success: function (mediaElement, originalNode) {\n mediaElement.addEventListener('canplay', function () {\n that.resize();\n });\n mediaElement.addEventListener('play', function () {\n that.component.publish(Events_1.Events.MEDIA_PLAYED, Math.floor(mediaElement.currentTime));\n });\n mediaElement.addEventListener('pause', function () {\n // mediaelement creates a pause event before the ended event. ignore this.\n if (Math.floor(mediaElement.currentTime) != Math.floor(mediaElement.duration)) {\n that.component.publish(Events_1.Events.MEDIA_PAUSED, Math.floor(mediaElement.currentTime));\n }\n });\n mediaElement.addEventListener('ended', function () {\n that.component.publish(Events_1.Events.MEDIA_ENDED, Math.floor(mediaElement.duration));\n });\n mediaElement.setSrc(sources);\n }\n });\n }\n else {\n _this.$media = $('');\n _this.$container.append(_this.$media);\n _this.player = new MediaElementPlayer($('audio')[0], {\n poster: poster,\n defaultAudioWidth: 'auto',\n defaultAudioHeight: 'auto',\n showPosterWhenPaused: true,\n showPosterWhenEnded: true,\n success: function (mediaElement, originalNode) {\n var _this = this;\n mediaElement.addEventListener('canplay', function () {\n that.resize();\n });\n mediaElement.addEventListener('play', function () {\n _this.component.publish(Events_1.Events.MEDIA_PLAYED, Math.floor(mediaElement.currentTime));\n });\n mediaElement.addEventListener('pause', function () {\n // mediaelement creates a pause event before the ended event. ignore this.\n if (Math.floor(mediaElement.currentTime) != Math.floor(mediaElement.duration)) {\n _this.component.publish(Events_1.Events.MEDIA_PAUSED, Math.floor(mediaElement.currentTime));\n }\n });\n mediaElement.addEventListener('ended', function () {\n _this.component.publish(Events_1.Events.MEDIA_ENDED, Math.floor(mediaElement.duration));\n });\n mediaElement.setSrc(sources);\n }\n });\n }\n _this.resize();\n });\n };\n MediaElementCenterPanel.prototype.isVideo = function () {\n return this.extension.isVideo();\n };\n MediaElementCenterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n // if in Firefox < v13 don't resize the media container.\n if (window.browserDetect.browser === 'Firefox' && window.browserDetect.version < 13) {\n this.$container.width(this.mediaWidth);\n this.$container.height(this.mediaHeight);\n }\n else {\n // fit media to available space.\n var size = Utils.Dimensions.fitRect(this.mediaWidth, this.mediaHeight, this.$content.width(), this.$content.height());\n this.$container.height(size.height);\n this.$container.width(size.width);\n if (this.player && !this.extension.isFullScreen()) {\n this.$media.width(size.width);\n this.$media.height(size.height);\n }\n }\n var left = Math.floor((this.$content.width() - this.$container.width()) / 2);\n var top = Math.floor((this.$content.height() - this.$container.height()) / 2);\n this.$container.css({\n 'left': left,\n 'top': top\n });\n if (this.title) {\n this.$title.text(Utils_1.UVUtils.sanitize(this.title));\n }\n if (this.player) {\n if (!this.isVideo() || (this.isVideo() && !this.component.isFullScreen)) {\n this.player.setPlayerSize();\n this.player.setControlsSize();\n var $mejs = $('.mejs__container');\n $mejs.css({\n 'margin-top': (this.$container.height() - $mejs.height()) / 2\n });\n }\n }\n };\n return MediaElementCenterPanel;\n }(CenterPanel_1.CenterPanel));\n exports.MediaElementCenterPanel = MediaElementCenterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-mediaelement-extension/SettingsDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/SettingsDialogue\"], function (require, exports, SettingsDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SettingsDialogue = /** @class */ (function (_super) {\n __extends(SettingsDialogue, _super);\n function SettingsDialogue($element) {\n return _super.call(this, $element) || this;\n }\n SettingsDialogue.prototype.create = function () {\n this.setConfig('settingsDialogue');\n _super.prototype.create.call(this);\n };\n return SettingsDialogue;\n }(SettingsDialogue_1.SettingsDialogue));\n exports.SettingsDialogue = SettingsDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-mediaelement-extension/ShareDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/ShareDialogue\"], function (require, exports, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ShareDialogue = /** @class */ (function (_super) {\n __extends(ShareDialogue, _super);\n function ShareDialogue($element) {\n return _super.call(this, $element) || this;\n }\n ShareDialogue.prototype.create = function () {\n this.setConfig('shareDialogue');\n _super.prototype.create.call(this);\n };\n ShareDialogue.prototype.update = function () {\n _super.prototype.update.call(this);\n this.code = this.extension.getEmbedScript(this.options.embedTemplate, this.currentWidth, this.currentHeight);\n this.$code.val(this.code);\n };\n ShareDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ShareDialogue;\n }(ShareDialogue_1.ShareDialogue));\n exports.ShareDialogue = ShareDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-mediaelement-extension/Extension',[\"require\", \"exports\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-shared-module/BaseExtension\", \"../../modules/uv-shared-module/Bookmark\", \"./DownloadDialogue\", \"./Events\", \"../../modules/uv-shared-module/FooterPanel\", \"../../modules/uv-shared-module/HeaderPanel\", \"../../modules/uv-dialogues-module/HelpDialogue\", \"../../modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel\", \"../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel\", \"../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel\", \"./SettingsDialogue\", \"./ShareDialogue\"], function (require, exports, BaseEvents_1, BaseExtension_1, Bookmark_1, DownloadDialogue_1, Events_1, FooterPanel_1, HeaderPanel_1, HelpDialogue_1, MediaElementCenterPanel_1, MoreInfoRightPanel_1, ResourcesLeftPanel_1, SettingsDialogue_1, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Extension = /** @class */ (function (_super) {\n __extends(Extension, _super);\n function Extension() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Extension.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n // listen for mediaelement enter/exit fullscreen events.\n $(window).bind('enterfullscreen', function () {\n _this.component.publish(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN);\n });\n $(window).bind('exitfullscreen', function () {\n _this.component.publish(BaseEvents_1.BaseEvents.TOGGLE_FULLSCREEN);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.viewCanvas(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.THUMB_SELECTED, function (thumb) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, thumb.index);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START, function () {\n _this.shell.$centerPanel.hide();\n _this.shell.$rightPanel.hide();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_FINISH, function () {\n _this.shell.$centerPanel.show();\n _this.shell.$rightPanel.show();\n _this.resize();\n });\n this.component.subscribe(Events_1.Events.MEDIA_ENDED, function () {\n _this.fire(Events_1.Events.MEDIA_ENDED);\n });\n this.component.subscribe(Events_1.Events.MEDIA_PAUSED, function () {\n _this.fire(Events_1.Events.MEDIA_PAUSED);\n });\n this.component.subscribe(Events_1.Events.MEDIA_PLAYED, function () {\n _this.fire(Events_1.Events.MEDIA_PLAYED);\n });\n };\n Extension.prototype.createModules = function () {\n _super.prototype.createModules.call(this);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel = new HeaderPanel_1.HeaderPanel(this.shell.$headerPanel);\n }\n else {\n this.shell.$headerPanel.hide();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel = new ResourcesLeftPanel_1.ResourcesLeftPanel(this.shell.$leftPanel);\n }\n this.centerPanel = new MediaElementCenterPanel_1.MediaElementCenterPanel(this.shell.$centerPanel);\n if (this.isRightPanelEnabled()) {\n this.rightPanel = new MoreInfoRightPanel_1.MoreInfoRightPanel(this.shell.$rightPanel);\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel = new FooterPanel_1.FooterPanel(this.shell.$footerPanel);\n }\n else {\n this.shell.$footerPanel.hide();\n }\n this.$helpDialogue = $('
              ');\n this.shell.$overlays.append(this.$helpDialogue);\n this.helpDialogue = new HelpDialogue_1.HelpDialogue(this.$helpDialogue);\n this.$downloadDialogue = $('
              ');\n this.shell.$overlays.append(this.$downloadDialogue);\n this.downloadDialogue = new DownloadDialogue_1.DownloadDialogue(this.$downloadDialogue);\n this.$shareDialogue = $('
              ');\n this.shell.$overlays.append(this.$shareDialogue);\n this.shareDialogue = new ShareDialogue_1.ShareDialogue(this.$shareDialogue);\n this.$settingsDialogue = $('
              ');\n this.shell.$overlays.append(this.$settingsDialogue);\n this.settingsDialogue = new SettingsDialogue_1.SettingsDialogue(this.$settingsDialogue);\n if (this.isLeftPanelEnabled()) {\n this.leftPanel.init();\n }\n if (this.isRightPanelEnabled()) {\n this.rightPanel.init();\n }\n };\n Extension.prototype.render = function () {\n _super.prototype.render.call(this);\n };\n Extension.prototype.isLeftPanelEnabled = function () {\n return Utils.Bools.getBool(this.data.config.options.leftPanelEnabled, true)\n && ((this.helper.isMultiCanvas() || this.helper.isMultiSequence()) || this.helper.hasResources());\n };\n Extension.prototype.bookmark = function () {\n _super.prototype.bookmark.call(this);\n var canvas = this.extensions.helper.getCurrentCanvas();\n var bookmark = new Bookmark_1.Bookmark();\n bookmark.index = this.helper.canvasIndex;\n bookmark.label = Manifesto.LanguageMap.getValue(canvas.getLabel());\n bookmark.thumb = canvas.getProperty('thumbnail');\n bookmark.title = this.helper.getLabel();\n bookmark.trackingLabel = window.trackingLabel;\n if (this.isVideo()) {\n bookmark.type = manifesto.ResourceType.movingimage().toString();\n }\n else {\n bookmark.type = manifesto.ResourceType.sound().toString();\n }\n this.fire(BaseEvents_1.BaseEvents.BOOKMARK, bookmark);\n };\n Extension.prototype.getEmbedScript = function (template, width, height) {\n //const configUri: string = this.data.config.uri || '';\n //const script: string = String.format(template, this.getSerializedLocales(), configUri, this.helper.iiifResourceUri, this.helper.collectionIndex, this.helper.manifestIndex, this.helper.sequenceIndex, this.helper.canvasIndex, width, height, this.data.embedScriptUri);\n var appUri = this.getAppUri();\n var iframeSrc = appUri + \"#?manifest=\" + this.helper.iiifResourceUri + \"&c=\" + this.helper.collectionIndex + \"&m=\" + this.helper.manifestIndex + \"&s=\" + this.helper.sequenceIndex + \"&cv=\" + this.helper.canvasIndex;\n var script = Utils.Strings.format(template, iframeSrc, width.toString(), height.toString());\n return script;\n };\n // todo: use canvas.getThumbnail()\n Extension.prototype.getPosterImageUri = function () {\n var canvas = this.helper.getCurrentCanvas();\n var annotations = canvas.getContent();\n if (annotations && annotations.length) {\n return annotations[0].getProperty('thumbnail');\n }\n else {\n return canvas.getProperty('thumbnail');\n }\n };\n Extension.prototype.isVideoFormat = function (type) {\n var videoFormats = [manifesto.MediaType.mp4().toString(), manifesto.MediaType.webm().toString()];\n return videoFormats.indexOf(type) != -1;\n };\n Extension.prototype.isVideo = function () {\n var canvas = this.helper.getCurrentCanvas();\n var annotations = canvas.getContent();\n if (annotations && annotations.length) {\n var formats = this.getMediaFormats(canvas);\n for (var i = 0; i < formats.length; i++) {\n var format = formats[i];\n var type = format.getFormat();\n if (type) {\n if (this.isVideoFormat(type.toString())) {\n return true;\n }\n }\n }\n }\n else {\n var type = canvas.getType();\n if (type) {\n return type.toString() === manifesto.ResourceType.movingimage().toString();\n }\n }\n throw (new Error(\"Unable to determine media type\"));\n };\n return Extension;\n }(BaseExtension_1.BaseExtension));\n exports.Extension = Extension;\n});\n\n", - "define('modules/uv-shared-module/AnnotationResults',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var AnnotationResults = /** @class */ (function () {\n function AnnotationResults() {\n }\n return AnnotationResults;\n }());\n exports.AnnotationResults = AnnotationResults;\n});\n\n", - "define('modules/uv-shared-module/Point',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Point = /** @class */ (function () {\n function Point(x, y) {\n this.x = x;\n this.y = y;\n }\n return Point;\n }());\n exports.Point = Point;\n});\n\n", - "define('extensions/uv-seadragon-extension/CroppedImageDimensions',[\"require\", \"exports\", \"../../modules/uv-shared-module/Point\"], function (require, exports, Point_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Size = Utils.Size;\n var CroppedImageDimensions = /** @class */ (function () {\n function CroppedImageDimensions() {\n this.region = new Size(0, 0);\n this.regionPos = new Point_1.Point(0, 0);\n this.size = new Size(0, 0);\n }\n return CroppedImageDimensions;\n }());\n exports.CroppedImageDimensions = CroppedImageDimensions;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-seadragon-extension/DownloadDialogue',[\"require\", \"exports\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-dialogues-module/DownloadDialogue\", \"../../modules/uv-shared-module/DownloadOption\"], function (require, exports, BaseEvents_1, DownloadDialogue_1, DownloadOption_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Size = Manifesto.Size;\n var DownloadDialogue = /** @class */ (function (_super) {\n __extends(DownloadDialogue, _super);\n function DownloadDialogue($element) {\n return _super.call(this, $element) || this;\n }\n DownloadDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('downloadDialogue');\n _super.prototype.create.call(this);\n // create ui.\n this.$settingsButton = $('
              ' + this.content.editSettings + '');\n this.$pagingNote = $('
              ' + this.content.pagingNote + '
              ');\n this.$pagingNote.append(this.$settingsButton);\n this.$content.append(this.$pagingNote);\n this.$imageOptionsContainer = $('
            • ');\n this.$downloadOptions.append(this.$imageOptionsContainer);\n this.$imageOptions = $('
                ');\n this.$imageOptionsContainer.append(this.$imageOptions);\n this.$currentViewAsJpgButton = $('
              • ');\n this.$imageOptions.append(this.$currentViewAsJpgButton);\n this.$currentViewAsJpgButton.hide();\n this.$wholeImageHighResButton = $('
              • ');\n this.$imageOptions.append(this.$wholeImageHighResButton);\n this.$wholeImageHighResButton.hide();\n this.$wholeImagesHighResButton = $('
              • ');\n this.$imageOptions.append(this.$wholeImagesHighResButton);\n this.$wholeImageHighResButton.hide();\n this.$wholeImageLowResAsJpgButton = $('
              • ');\n this.$imageOptions.append(this.$wholeImageLowResAsJpgButton);\n this.$wholeImageLowResAsJpgButton.hide();\n this.$canvasOptionsContainer = $('
              • ');\n this.$downloadOptions.append(this.$canvasOptionsContainer);\n this.$canvasOptions = $('
                  ');\n this.$canvasOptionsContainer.append(this.$canvasOptions);\n this.$manifestOptionsContainer = $('
                • ');\n this.$downloadOptions.append(this.$manifestOptionsContainer);\n this.$manifestOptions = $('
                    ');\n this.$manifestOptionsContainer.append(this.$manifestOptions);\n this.$selectionButton = $('
                  • ');\n this.$manifestOptions.append(this.$selectionButton);\n this.$selectionButton.hide();\n this.$downloadButton = $('' + this.content.download + '');\n this.$buttons.prepend(this.$downloadButton);\n this.$explanatoryTextTemplate = $('');\n var that = this;\n // what happens on download is specific to the extension (except for renderings which need to be moved to the base download dialogue)\n // todo: we need to make everything a list of radio button options in the base class, then we can unify everything into a single render method\n this.$downloadButton.on('click', function (e) {\n e.preventDefault();\n var $selectedOption = that.getSelectedOption();\n var id = $selectedOption.attr('id');\n var label = $selectedOption.attr('title');\n var mime = $selectedOption.data('mime');\n var type = DownloadOption_1.DownloadOption.UNKNOWN;\n var canvas = _this.extension.helper.getCurrentCanvas();\n if (_this.renderingUrls[id]) {\n if (mime) {\n if (mime.toLowerCase().indexOf('pdf') !== -1) {\n type = DownloadOption_1.DownloadOption.ENTIRE_DOCUMENT_AS_PDF;\n }\n else if (mime.toLowerCase().indexOf('txt') !== -1) {\n type = DownloadOption_1.DownloadOption.ENTIRE_DOCUMENT_AS_TEXT;\n }\n }\n if (type = DownloadOption_1.DownloadOption.ENTIRE_DOCUMENT_AS_PDF) {\n //var printService: Manifesto.IService = this.extension.helper.manifest.getService(manifesto.ServiceProfile.printExtensions());\n // if downloading a pdf - if there's a print service, generate an event instead of opening a new window.\n // if (printService && this.extension.isOnHomeDomain()){\n // this.component.publish(Events.PRINT);\n // } else {\n window.open(_this.renderingUrls[id]);\n //}\n }\n }\n else {\n type = id;\n switch (type) {\n case DownloadOption_1.DownloadOption.CURRENT_VIEW:\n var viewer = that.extension.getViewer();\n window.open(that.extension.getCroppedImageUri(canvas, viewer));\n break;\n case DownloadOption_1.DownloadOption.SELECTION:\n Utils.Async.waitFor(function () {\n return !_this.isActive;\n }, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_MULTISELECT_DIALOGUE);\n });\n break;\n case DownloadOption_1.DownloadOption.WHOLE_IMAGE_HIGH_RES:\n window.open(_this.getCanvasHighResImageUri(_this.extension.helper.getCurrentCanvas()));\n break;\n case DownloadOption_1.DownloadOption.WHOLE_IMAGES_HIGH_RES:\n var indices = _this.extension.getPagedIndices();\n for (var i = 0; i < indices.length; i++) {\n window.open(_this.getCanvasHighResImageUri(_this.extension.helper.getCanvasByIndex(indices[i])));\n }\n break;\n case DownloadOption_1.DownloadOption.WHOLE_IMAGE_LOW_RES:\n var imageUri = that.extension.getConfinedImageUri(canvas, that.options.confinedImageSize);\n if (imageUri) {\n window.open(imageUri);\n }\n break;\n }\n }\n _this.component.publish(BaseEvents_1.BaseEvents.DOWNLOAD, {\n \"type\": type,\n \"label\": label\n });\n _this.close();\n });\n this.$settingsButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.HIDE_DOWNLOAD_DIALOGUE);\n _this.component.publish(BaseEvents_1.BaseEvents.SHOW_SETTINGS_DIALOGUE);\n });\n };\n DownloadDialogue.prototype.open = function (triggerButton) {\n _super.prototype.open.call(this, triggerButton);\n var canvas = this.extension.helper.getCurrentCanvas();\n var rotation = this.extension.getViewerRotation();\n var hasNormalDimensions = rotation % 180 == 0;\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.CURRENT_VIEW)) {\n var $input = this.$currentViewAsJpgButton.find('input');\n var $label = this.$currentViewAsJpgButton.find('label');\n var label = this.content.currentViewAsJpg;\n var viewer = this.extension.getViewer();\n var dimensions = this.extension.getCroppedImageDimensions(canvas, viewer);\n // dimensions\n if (dimensions) {\n label = hasNormalDimensions ?\n Utils.Strings.format(label, dimensions.size.width.toString(), dimensions.size.height.toString()) :\n Utils.Strings.format(label, dimensions.size.height.toString(), dimensions.size.width.toString());\n $label.text(label);\n $input.prop('title', label);\n this.$currentViewAsJpgButton.data('width', dimensions.size.width);\n this.$currentViewAsJpgButton.data('height', dimensions.size.height);\n this.$currentViewAsJpgButton.show();\n }\n else {\n this.$currentViewAsJpgButton.hide();\n }\n // explanatory text\n if (Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) {\n var text = this.content.currentViewAsJpgExplanation;\n if (text) {\n var $span = this.$explanatoryTextTemplate.clone();\n $span.text(text);\n $label.append($span);\n }\n }\n }\n else {\n this.$currentViewAsJpgButton.hide();\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.WHOLE_IMAGE_HIGH_RES)) {\n var $input = this.$wholeImageHighResButton.find('input');\n var $label = this.$wholeImageHighResButton.find('label');\n var mime = this.getCanvasMimeType(this.extension.helper.getCurrentCanvas());\n if (mime) {\n mime = Utils.Files.simplifyMimeType(mime);\n }\n else {\n mime = '?';\n }\n // dimensions\n var size = this.getCanvasComputedDimensions(this.extension.helper.getCurrentCanvas());\n if (!size) {\n // if there is no image service, allow the image to be downloaded directly.\n if (canvas.externalResource && !canvas.externalResource.hasServiceDescriptor()) {\n var label = Utils.Strings.format(this.content.wholeImageHighRes, '?', '?', mime);\n $label.text(label);\n $input.prop('title', label);\n this.$wholeImageHighResButton.show();\n }\n else {\n this.$wholeImageHighResButton.hide();\n }\n }\n else {\n var label = hasNormalDimensions ?\n Utils.Strings.format(this.content.wholeImageHighRes, size.width.toString(), size.height.toString(), mime) :\n Utils.Strings.format(this.content.wholeImageHighRes, size.height.toString(), size.width.toString(), mime);\n $label.text(label);\n $input.prop('title', label);\n this.$wholeImageHighResButton.data('width', size.width);\n this.$wholeImageHighResButton.data('height', size.height);\n this.$wholeImageHighResButton.show();\n }\n // explanatory text\n if (Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) {\n var text = this.content.wholeImageHighResExplanation;\n if (text) {\n var $span = this.$explanatoryTextTemplate.clone();\n $span.text(text);\n $label.append($span);\n }\n }\n }\n else {\n this.$wholeImageHighResButton.hide();\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.WHOLE_IMAGES_HIGH_RES)) {\n var $input = this.$wholeImagesHighResButton.find('input');\n var $label = this.$wholeImagesHighResButton.find('label');\n var mime = this.getCanvasMimeType(this.extension.helper.getCurrentCanvas());\n if (mime) {\n mime = Utils.Files.simplifyMimeType(mime);\n }\n else {\n mime = '?';\n }\n var label = Utils.Strings.format(this.content.wholeImagesHighRes, mime);\n $label.text(label);\n $input.prop('title', label);\n this.$wholeImagesHighResButton.show();\n // explanatory text\n if (Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) {\n var text = this.content.wholeImagesHighResExplanation;\n if (text) {\n var $span = this.$explanatoryTextTemplate.clone();\n $span.text(text);\n $label.append($span);\n }\n }\n }\n else {\n this.$wholeImagesHighResButton.hide();\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.WHOLE_IMAGE_LOW_RES)) {\n var $input = this.$wholeImageLowResAsJpgButton.find('input');\n var $label = this.$wholeImageLowResAsJpgButton.find('label');\n var size = this.extension.getConfinedImageDimensions(canvas, this.options.confinedImageSize);\n var label = hasNormalDimensions ?\n Utils.Strings.format(this.content.wholeImageLowResAsJpg, size.width.toString(), size.height.toString()) :\n Utils.Strings.format(this.content.wholeImageLowResAsJpg, size.height.toString(), size.width.toString());\n $label.text(label);\n $input.prop('title', label);\n this.$wholeImageLowResAsJpgButton.data('width', size.width);\n this.$wholeImageLowResAsJpgButton.data('height', size.height);\n this.$wholeImageLowResAsJpgButton.show();\n // explanatory text\n if (Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) {\n var text = this.content.wholeImageLowResAsJpgExplanation;\n if (text) {\n var $span = this.$explanatoryTextTemplate.clone();\n $span.text(text);\n $label.append($span);\n }\n }\n }\n else {\n this.$wholeImageLowResAsJpgButton.hide();\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.SELECTION)) {\n var $input = this.$selectionButton.find('input');\n var $label = this.$selectionButton.find('label');\n $label.text(this.content.downloadSelection);\n $input.prop('title', this.content.downloadSelection);\n this.$selectionButton.show();\n // explanatory text\n if (Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) {\n var text = this.content.selectionExplanation;\n if (text) {\n var $span = this.$explanatoryTextTemplate.clone();\n $span.text(text);\n $label.append($span);\n }\n }\n }\n else {\n this.$selectionButton.hide();\n }\n this.resetDynamicDownloadOptions();\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.RANGE_RENDERINGS)) {\n if (canvas.ranges && canvas.ranges.length) {\n for (var i = 0; i < canvas.ranges.length; i++) {\n var range = canvas.ranges[i];\n var renderingOptions = this.getDownloadOptionsForRenderings(range, this.content.entireFileAsOriginal, DownloadOption_1.DownloadOption.CANVAS_RENDERINGS);\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n }\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.IMAGE_RENDERINGS)) {\n var images = canvas.getImages();\n for (var i = 0; i < images.length; i++) {\n var renderingOptions = this.getDownloadOptionsForRenderings(images[i].getResource(), this.content.entireFileAsOriginal, DownloadOption_1.DownloadOption.IMAGE_RENDERINGS);\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.CANVAS_RENDERINGS)) {\n var renderingOptions = this.getDownloadOptionsForRenderings(canvas, this.content.entireFileAsOriginal, DownloadOption_1.DownloadOption.CANVAS_RENDERINGS);\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS)) {\n var renderingOptions = this.getDownloadOptionsForRenderings(this.extension.helper.getCurrentSequence(), this.content.entireDocument, DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS);\n if (!renderingOptions.length) {\n renderingOptions = this.getDownloadOptionsForRenderings(this.extension.helper.manifest, this.content.entireDocument, DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS);\n }\n this.addDownloadOptionsForRenderings(renderingOptions);\n }\n // hide the current view option if it's equivalent to whole image.\n if (this.isDownloadOptionAvailable(DownloadOption_1.DownloadOption.CURRENT_VIEW)) {\n var currentWidth = parseInt(this.$currentViewAsJpgButton.data('width').toString());\n var currentHeight = parseInt(this.$currentViewAsJpgButton.data('height').toString());\n var wholeWidth = parseInt(this.$wholeImageHighResButton.data('width').toString());\n var wholeHeight = parseInt(this.$wholeImageHighResButton.data('height').toString());\n var percentageWidth = (currentWidth / wholeWidth) * 100;\n var percentageHeight = (currentHeight / wholeHeight) * 100;\n var disabledPercentage = this.options.currentViewDisabledPercentage;\n // if over disabledPercentage of the size of whole image\n if (percentageWidth >= disabledPercentage && percentageHeight >= disabledPercentage) {\n this.$currentViewAsJpgButton.hide();\n }\n else {\n this.$currentViewAsJpgButton.show();\n }\n }\n // order by image area\n var $options = this.$imageOptions.find('li.single');\n $options = $options.sort(function (a, b) {\n var aWidth = $(a).data('width');\n aWidth ? aWidth = parseInt(aWidth.toString()) : 0;\n var aHeight = $(a).data('height');\n aHeight ? aHeight = parseInt(aHeight.toString()) : 0;\n var bWidth = $(b).data('width');\n bWidth ? bWidth = parseInt(bWidth.toString()) : 0;\n var bHeight = $(b).data('height');\n bHeight ? bHeight = parseInt(bHeight.toString()) : 0;\n var aArea = aWidth * aHeight;\n var bArea = bWidth * bHeight;\n if (aArea < bArea) {\n return -1;\n }\n if (aArea > bArea) {\n return 1;\n }\n return 0;\n });\n $options.detach().appendTo(this.$imageOptions);\n // hide empty groups\n var $groups = this.$downloadOptions.find('li.group');\n $groups.each(function (index, group) {\n var $group = $(group);\n $group.show();\n if ($group.find('li.option:hidden').length === $group.find('li.option').length) {\n // all options are hidden, hide group.\n $group.hide();\n }\n });\n this.$downloadOptions.find('li.group:visible').last().addClass('lastVisible');\n if (this.extension.isPagingSettingEnabled() && (this.config.options.downloadPagingNoteEnabled)) {\n this.$pagingNote.show();\n }\n else {\n this.$pagingNote.hide();\n }\n if (!this.$downloadOptions.find('li.option:visible').length) {\n this.$noneAvailable.show();\n this.$downloadButton.hide();\n }\n else {\n // select first option.\n this.$downloadOptions.find('li.option input:visible:first').prop(\"checked\", true);\n this.$noneAvailable.hide();\n this.$downloadButton.show();\n }\n this.resize();\n };\n DownloadDialogue.prototype.addDownloadOptionsForRenderings = function (renderingOptions) {\n var _this = this;\n renderingOptions.forEach(function (option) {\n switch (option.type) {\n case DownloadOption_1.DownloadOption.IMAGE_RENDERINGS:\n _this.$imageOptions.append(option.button);\n break;\n case DownloadOption_1.DownloadOption.CANVAS_RENDERINGS:\n _this.$canvasOptions.append(option.button);\n break;\n case DownloadOption_1.DownloadOption.MANIFEST_RENDERINGS:\n _this.$manifestOptions.append(option.button);\n break;\n }\n });\n };\n DownloadDialogue.prototype.getCanvasImageResource = function (canvas) {\n var images = canvas.getImages();\n if (images[0]) {\n return images[0].getResource();\n }\n return null;\n };\n DownloadDialogue.prototype.getCanvasHighResImageUri = function (canvas) {\n var size = this.getCanvasComputedDimensions(canvas);\n if (size) {\n var width = size.width;\n var uri = canvas.getCanonicalImageUri(width);\n if (canvas.externalResource && canvas.externalResource.hasServiceDescriptor()) {\n var uri_parts = uri.split('/');\n var rotation = this.extension.getViewerRotation();\n uri_parts[uri_parts.length - 2] = String(rotation);\n uri = uri_parts.join('/');\n }\n return uri;\n }\n else if (canvas.externalResource && !canvas.externalResource.hasServiceDescriptor()) {\n // if there is no image service, return the dataUri.\n return canvas.externalResource.dataUri;\n }\n return '';\n };\n DownloadDialogue.prototype.getCanvasMimeType = function (canvas) {\n var resource = this.getCanvasImageResource(canvas);\n if (resource) {\n var format = resource.getFormat();\n if (format) {\n return format.toString();\n }\n }\n return null;\n };\n DownloadDialogue.prototype.getCanvasDimensions = function (canvas) {\n // externalResource may not have loaded yet\n if (canvas.externalResource.data) {\n var width = canvas.externalResource.data.width;\n var height = canvas.externalResource.data.height;\n if (width && height) {\n return new Size(width, height);\n }\n }\n return null;\n };\n DownloadDialogue.prototype.getCanvasComputedDimensions = function (canvas) {\n var imageSize = this.getCanvasDimensions(canvas);\n var requiredSize = canvas.getMaxDimensions();\n if (!imageSize) {\n return null;\n }\n if (!requiredSize) {\n return imageSize;\n }\n if (imageSize.width <= requiredSize.width && imageSize.height <= requiredSize.height) {\n return imageSize;\n }\n var scaleW = requiredSize.width / imageSize.width;\n var scaleH = requiredSize.height / imageSize.height;\n var scale = Math.min(scaleW, scaleH);\n return new Size(Math.floor(imageSize.width * scale), Math.floor(imageSize.height * scale));\n };\n DownloadDialogue.prototype._isLevel0 = function (profile) {\n if (!profile || !profile.length)\n return false;\n return manifesto.Utils.isLevel0ImageProfile(profile[0]);\n };\n DownloadDialogue.prototype.isDownloadOptionAvailable = function (option) {\n if (!this.extension.resources) {\n return false;\n }\n var canvas = this.extension.helper.getCurrentCanvas();\n // if the external resource doesn't have a service descriptor or is level 0\n // only allow wholeImageHighRes\n if (!canvas.externalResource.hasServiceDescriptor() || this._isLevel0(canvas.externalResource.data.profile)) {\n if (option === DownloadOption_1.DownloadOption.WHOLE_IMAGE_HIGH_RES) {\n // if in one-up mode, or in two-up mode with a single page being shown\n if (!this.extension.isPagingSettingEnabled() ||\n this.extension.isPagingSettingEnabled() && this.extension.resources && this.extension.resources.length === 1) {\n return true;\n }\n }\n return false;\n }\n switch (option) {\n case DownloadOption_1.DownloadOption.CURRENT_VIEW:\n case DownloadOption_1.DownloadOption.CANVAS_RENDERINGS:\n case DownloadOption_1.DownloadOption.IMAGE_RENDERINGS:\n case DownloadOption_1.DownloadOption.WHOLE_IMAGE_HIGH_RES:\n // if in one-up mode, or in two-up mode with a single page being shown\n if (!this.extension.isPagingSettingEnabled() ||\n this.extension.isPagingSettingEnabled() && this.extension.resources && this.extension.resources.length === 1) {\n var maxDimensions = canvas.getMaxDimensions();\n if (maxDimensions) {\n if (maxDimensions.width <= this.options.maxImageWidth) {\n return true;\n }\n else {\n return false;\n }\n }\n return true;\n }\n return false;\n case DownloadOption_1.DownloadOption.WHOLE_IMAGES_HIGH_RES:\n if (this.extension.isPagingSettingEnabled() && this.extension.resources && this.extension.resources.length > 1) {\n return true;\n }\n return false;\n case DownloadOption_1.DownloadOption.WHOLE_IMAGE_LOW_RES:\n // hide low-res option if hi-res width is smaller than constraint\n var size = this.getCanvasComputedDimensions(canvas);\n if (!size) {\n return false;\n }\n return (!this.extension.isPagingSettingEnabled() && (size.width > this.options.confinedImageSize));\n case DownloadOption_1.DownloadOption.SELECTION:\n return this.options.selectionEnabled;\n case DownloadOption_1.DownloadOption.RANGE_RENDERINGS:\n if (canvas.ranges && canvas.ranges.length) {\n var range = canvas.ranges[0];\n return range.getRenderings().length > 0;\n }\n return false;\n default:\n return _super.prototype.isDownloadOptionAvailable.call(this, option);\n }\n };\n return DownloadDialogue;\n }(DownloadDialogue_1.DownloadDialogue));\n exports.DownloadDialogue = DownloadDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/ExternalContentDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\"], function (require, exports, BaseEvents_1, Dialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ExternalContentDialogue = /** @class */ (function (_super) {\n __extends(ExternalContentDialogue, _super);\n function ExternalContentDialogue($element) {\n return _super.call(this, $element) || this;\n }\n ExternalContentDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('externalContentDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_EXTERNALCONTENT_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_EXTERNALCONTENT_DIALOGUE;\n this.component.subscribe(this.openCommand, function (params) {\n _this.open();\n _this.$iframe.prop('src', params.uri);\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.$iframe = $('');\n this.$content.append(this.$iframe);\n this.$element.hide();\n };\n ExternalContentDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$iframe.width(this.$content.width());\n this.$iframe.height(this.$content.height());\n };\n return ExternalContentDialogue;\n }(Dialogue_1.Dialogue));\n exports.ExternalContentDialogue = ExternalContentDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-osdmobilefooterpanel-module/MobileFooter',[\"require\", \"exports\", \"../uv-shared-module/FooterPanel\", \"../../extensions/uv-seadragon-extension/Events\"], function (require, exports, FooterPanel_1, Events_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var FooterPanel = /** @class */ (function (_super) {\n __extends(FooterPanel, _super);\n function FooterPanel($element) {\n return _super.call(this, $element) || this;\n }\n FooterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('mobileFooterPanel');\n _super.prototype.create.call(this);\n this.$spacer = $('
                    ');\n this.$options.prepend(this.$spacer);\n this.$rotateButton = $(\"\\n \\n \");\n this.$options.prepend(this.$rotateButton);\n this.$zoomOutButton = $(\"\\n \\n \");\n this.$options.prepend(this.$zoomOutButton);\n this.$zoomInButton = $(\"\\n \\n \");\n this.$options.prepend(this.$zoomInButton);\n this.$zoomInButton.onPressed(function () {\n _this.component.publish(Events_1.Events.ZOOM_IN);\n });\n this.$zoomOutButton.onPressed(function () {\n _this.component.publish(Events_1.Events.ZOOM_OUT);\n });\n this.$rotateButton.onPressed(function () {\n _this.component.publish(Events_1.Events.ROTATE);\n });\n };\n FooterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this.$options.css('left', Math.floor((this.$element.width() / 2) - (this.$options.width() / 2)));\n };\n return FooterPanel;\n }(FooterPanel_1.FooterPanel));\n exports.FooterPanel = FooterPanel;\n});\n\n", - "define('modules/uv-shared-module/AutoComplete',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var AutoComplete = /** @class */ (function () {\n function AutoComplete(element, autoCompleteFunc, parseResultsFunc, onSelect, delay, minChars, positionAbove, allowWords) {\n if (delay === void 0) { delay = 300; }\n if (minChars === void 0) { minChars = 2; }\n if (positionAbove === void 0) { positionAbove = false; }\n if (allowWords === void 0) { allowWords = false; }\n var _this = this;\n this._$element = element;\n this._autoCompleteFunc = autoCompleteFunc;\n this._delay = delay;\n this._minChars = minChars;\n this._onSelect = onSelect;\n this._parseResultsFunc = parseResultsFunc;\n this._positionAbove = positionAbove;\n this._allowWords = allowWords;\n // create ui.\n this._$searchResultsList = $('
                      ');\n if (this._positionAbove) {\n this._$element.parent().prepend(this._$searchResultsList);\n }\n else {\n this._$element.parent().append(this._$searchResultsList);\n }\n this._$searchResultTemplate = $('
                    • ');\n // init ui.\n // callback after set period.\n var typewatch = (function () {\n var timer = 0;\n return function (cb, ms) {\n clearTimeout(timer);\n timer = setTimeout(cb, ms);\n };\n })();\n var that = this;\n this._$element.on(\"keydown\", function (e) {\n var originalEvent = e.originalEvent;\n //that._lastKeyDownWasNavigation = that._isNavigationKeyDown(originalEvent);\n var charCode = Utils.Keyboard.getCharCode(originalEvent);\n var cancelEvent = false;\n if (charCode === KeyCodes.KeyDown.LeftArrow) {\n cancelEvent = true;\n }\n else if (charCode === KeyCodes.KeyDown.RightArrow) {\n cancelEvent = true;\n }\n if (cancelEvent) {\n originalEvent.cancelBubble = true;\n if (originalEvent.stopPropagation)\n originalEvent.stopPropagation();\n }\n });\n // auto complete\n this._$element.on(\"keyup\", function (e) {\n // if pressing enter without a list item selected\n if (!that._getSelectedListItem().length && e.keyCode === KeyCodes.KeyDown.Enter) {\n that._onSelect(that._getTerms());\n return;\n }\n // If there are search results\n if (that._$searchResultsList.is(':visible') && that._results.length) {\n if (e.keyCode === KeyCodes.KeyDown.Enter) {\n that._searchForItem(that._getSelectedListItem());\n }\n else if (e.keyCode === KeyCodes.KeyDown.DownArrow) {\n that._setSelectedResultIndex(1);\n return;\n }\n else if (e.keyCode === KeyCodes.KeyDown.UpArrow) {\n that._setSelectedResultIndex(-1);\n return;\n }\n }\n if (e.keyCode !== KeyCodes.KeyDown.Enter) {\n // after a delay, show autocomplete list.\n typewatch(function () {\n var val = that._getTerms();\n // if there are more than x chars\n // update the autocomplete list.\n if (val && val.length > that._minChars && that._searchForWords(val)) {\n that._search(val);\n }\n else {\n // otherwise, hide the autocomplete list.\n that._clearResults();\n that._hideResults();\n }\n }, that._delay);\n }\n });\n // hide results if clicked outside.\n $(document).on('mouseup', function (e) {\n if (_this._$searchResultsList.parent().has($(e.target)[0]).length === 0) {\n _this._clearResults();\n _this._hideResults();\n }\n });\n this._hideResults();\n }\n AutoComplete.prototype._searchForWords = function (search) {\n if (this._allowWords || !search.includes(' ')) {\n return true;\n }\n else {\n return false;\n }\n };\n AutoComplete.prototype._getTerms = function () {\n return this._$element.val().trim();\n };\n AutoComplete.prototype._setSelectedResultIndex = function (direction) {\n var nextIndex;\n if (direction === 1) {\n nextIndex = this._selectedResultIndex + 1;\n }\n else {\n nextIndex = this._selectedResultIndex - 1;\n }\n var $items = this._$searchResultsList.find('li');\n if (nextIndex < 0) {\n nextIndex = $items.length - 1;\n }\n else if (nextIndex > $items.length - 1) {\n nextIndex = 0;\n }\n this._selectedResultIndex = nextIndex;\n $items.removeClass('selected');\n var $selectedItem = $items.eq(this._selectedResultIndex);\n $selectedItem.addClass('selected');\n var top = $selectedItem.outerHeight(true) * this._selectedResultIndex;\n this._$searchResultsList.scrollTop(top);\n };\n AutoComplete.prototype._search = function (term) {\n this._results = [];\n this._clearResults();\n this._showResults();\n this._$searchResultsList.append('
                    • ');\n this._updateListPosition();\n var that = this;\n this._autoCompleteFunc(term, function (results) {\n that._listResults(results);\n });\n };\n AutoComplete.prototype._clearResults = function () {\n this._$searchResultsList.empty();\n };\n AutoComplete.prototype._hideResults = function () {\n this._$searchResultsList.hide();\n };\n AutoComplete.prototype._showResults = function () {\n this._selectedResultIndex = -1;\n this._$searchResultsList.show();\n };\n AutoComplete.prototype._updateListPosition = function () {\n if (this._positionAbove) {\n this._$searchResultsList.css({\n 'top': this._$searchResultsList.outerHeight(true) * -1\n });\n }\n else {\n this._$searchResultsList.css({\n 'top': this._$element.outerHeight(true)\n });\n }\n };\n AutoComplete.prototype._listResults = function (results) {\n // get an array of strings\n this._results = this._parseResultsFunc(results);\n this._clearResults();\n if (!this._results.length) {\n // don't do this, because there still may be results for the PHRASE but not the word.\n // they won't know until they do the search.\n //this.searchResultsList.append('
                    • no results
                    • ');\n this._hideResults();\n return;\n }\n for (var i = 0; i < this._results.length; i++) {\n var result = this._results[i];\n var $resultItem = this._$searchResultTemplate.clone();\n var $a = $resultItem.find('a');\n $a.text(result);\n this._$searchResultsList.append($resultItem);\n }\n this._updateListPosition();\n var that = this;\n this._$searchResultsList.find('li').on('click', function (e) {\n e.preventDefault();\n that._searchForItem($(this));\n });\n };\n AutoComplete.prototype._searchForItem = function ($item) {\n var term = $item.find('a').text();\n this._$element.val(term);\n this._hideResults();\n this._onSelect(term);\n this._clearResults();\n this._hideResults();\n };\n AutoComplete.prototype._getSelectedListItem = function () {\n return this._$searchResultsList.find('li.selected');\n };\n return AutoComplete;\n }());\n exports.AutoComplete = AutoComplete;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-searchfooterpanel-module/FooterPanel',[\"require\", \"exports\", \"../uv-shared-module/AutoComplete\", \"../uv-shared-module/BaseEvents\", \"../../extensions/uv-seadragon-extension/Events\", \"../uv-shared-module/FooterPanel\", \"../../extensions/uv-seadragon-extension/Mode\", \"../../Utils\"], function (require, exports, AutoComplete_1, BaseEvents_1, Events_1, FooterPanel_1, Mode_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var FooterPanel = /** @class */ (function (_super) {\n __extends(FooterPanel, _super);\n function FooterPanel($element) {\n var _this = _super.call(this, $element) || this;\n _this.placemarkerTouched = false;\n return _this;\n }\n FooterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('searchFooterPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function () {\n _this.canvasIndexChanged();\n _this.setCurrentSearchResultPlacemarker();\n _this.updatePrevButton();\n _this.updateNextButton();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLEAR_ANNOTATIONS, function () {\n _this.clearSearchResults();\n });\n // todo: this should be a setting\n this.component.subscribe(Events_1.Events.MODE_CHANGED, function () {\n _this.settingsChanged();\n });\n this.component.subscribe(Events_1.Events.SEARCH, function (terms) {\n _this.terms = terms;\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS, function (annotationResults) {\n _this.displaySearchResults(annotationResults.annotations, annotationResults.terms);\n _this.setCurrentSearchResultPlacemarker();\n _this.updatePrevButton();\n _this.updateNextButton();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS_EMPTY, function () {\n _this.hideSearchSpinner();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATION_CHANGED, function () {\n _this.updatePrevButton();\n _this.updateNextButton();\n });\n this.$printButton = $(\"\\n \\n \");\n this.$options.prepend(this.$printButton);\n // search input.\n this.$searchContainer = $('
                      ');\n this.$element.prepend(this.$searchContainer);\n this.$searchOptions = $('
                      ');\n this.$searchContainer.append(this.$searchOptions);\n this.$searchLabel = $('' + this.content.searchWithin + '');\n this.$searchOptions.append(this.$searchLabel);\n this.$searchTextContainer = $('
                      ');\n this.$searchOptions.append(this.$searchTextContainer);\n this.$searchText = $('');\n this.$searchTextContainer.append(this.$searchText);\n this.$searchButton = $('');\n this.$searchTextContainer.append(this.$searchButton);\n // search results.\n this.$searchPagerContainer = $('
                      ');\n this.$element.prepend(this.$searchPagerContainer);\n this.$searchPagerControls = $('
                      ');\n this.$searchPagerContainer.prepend(this.$searchPagerControls);\n this.$previousResultButton = $('' + this.content.previousResult + '');\n this.$searchPagerControls.append(this.$previousResultButton);\n this.$searchResultsInfo = $('
                      x \\'y\\'
                      ');\n this.$searchPagerControls.append(this.$searchResultsInfo);\n this.$clearSearchResultsButton = $('' + this.content.clearSearch + '');\n this.$searchResultsInfo.append(this.$clearSearchResultsButton);\n this.$nextResultButton = $('' + this.content.nextResult + '');\n this.$searchPagerControls.append(this.$nextResultButton);\n // placemarker line.\n this.$searchResultsContainer = $('
                      ');\n this.$element.prepend(this.$searchResultsContainer);\n this.$line = $('
                      ');\n this.$searchResultsContainer.append(this.$line);\n this.$pagePositionMarker = $('
                      ');\n this.$searchResultsContainer.append(this.$pagePositionMarker);\n this.$pagePositionLabel = $('
                      ');\n this.$searchResultsContainer.append(this.$pagePositionLabel);\n this.$placemarkerDetails = $('
                      ');\n this.$searchResultsContainer.append(this.$placemarkerDetails);\n this.$placemarkerDetailsTop = $('

                      ');\n this.$placemarkerDetails.append(this.$placemarkerDetailsTop);\n this.$placemarkerDetailsBottom = $('

                      ');\n this.$placemarkerDetails.append(this.$placemarkerDetailsBottom);\n // initialise ui.\n this.$searchPagerContainer.hide();\n this.$placemarkerDetails.hide();\n // ui event handlers.\n var that = this;\n this.$searchButton.on('click', function (e) {\n e.preventDefault();\n _this.search(_this.$searchText.val());\n });\n this.$searchText.on('focus', function () {\n // clear initial text.\n if (_this.$searchText.val() === _this.content.enterKeyword)\n _this.$searchText.val('');\n });\n this.$placemarkerDetails.on('mouseover', function () {\n that.component.publish(Events_1.Events.SEARCH_PREVIEW_START, _this.currentPlacemarkerIndex);\n });\n this.$placemarkerDetails.on('mouseleave', function () {\n $(this).hide();\n that.component.publish(Events_1.Events.SEARCH_PREVIEW_FINISH);\n // reset all placemarkers.\n var placemarkers = that.getSearchResultPlacemarkers();\n placemarkers.removeClass('hover');\n });\n this.$placemarkerDetails.on('click', function () {\n that.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.currentPlacemarkerIndex);\n });\n this.$previousResultButton.on('click', function (e) {\n e.preventDefault();\n if (_this.isPreviousButtonEnabled()) {\n that.component.publish(Events_1.Events.PREV_SEARCH_RESULT);\n }\n });\n this.$nextResultButton.on('click', function (e) {\n e.preventDefault();\n if (_this.isNextButtonEnabled()) {\n that.component.publish(Events_1.Events.NEXT_SEARCH_RESULT);\n }\n });\n this.$clearSearchResultsButton.on('click', function (e) {\n e.preventDefault();\n that.component.publish(BaseEvents_1.BaseEvents.CLEAR_ANNOTATIONS);\n });\n // hide search options if not enabled/supported.\n if (!this.isSearchEnabled()) {\n this.$searchContainer.hide();\n this.$searchPagerContainer.hide();\n this.$searchResultsContainer.hide();\n this.$element.addClass('min');\n }\n if (this.extension.helper.getTotalCanvases() === 1) {\n this.$searchResultsContainer.hide();\n }\n var autocompleteService = this.extension.getAutoCompleteUri();\n if (autocompleteService) {\n new AutoComplete_1.AutoComplete(this.$searchText, function (terms, cb) {\n $.getJSON(Utils.Strings.format(autocompleteService, terms), function (results) {\n cb(results);\n });\n }, function (results) {\n return $.map(results.terms, function (result) {\n return result.match;\n });\n }, function (terms) {\n _this.search(terms);\n }, 300, 2, true, Utils.Bools.getBool(this.options.autocompleteAllowWords, false));\n }\n else {\n this.$searchText.on(\"keyup\", function (e) {\n if (e.keyCode === KeyCodes.KeyDown.Enter) {\n that.search(that.$searchText.val());\n }\n });\n }\n this.$printButton.onPressed(function () {\n that.component.publish(Events_1.Events.PRINT);\n });\n this.updatePrintButton();\n var positionMarkerEnabled = Utils.Bools.getBool(this.config.options.positionMarkerEnabled, true);\n if (!positionMarkerEnabled) {\n this.$pagePositionMarker.hide();\n this.$pagePositionLabel.hide();\n }\n };\n FooterPanel.prototype.isSearchEnabled = function () {\n return this.extension.isSearchEnabled();\n };\n FooterPanel.prototype.isZoomToSearchResultEnabled = function () {\n return Utils.Bools.getBool(this.extension.data.config.options.zoomToSearchResultEnabled, true);\n };\n FooterPanel.prototype.isPreviousButtonEnabled = function () {\n var currentCanvasIndex = this.extension.helper.canvasIndex;\n var firstSearchResultCanvasIndex = this.getFirstSearchResultCanvasIndex();\n var currentSearchResultRectIndex = this.getCurrentSearchResultRectIndex();\n // if zoom to search result is enabled and there is a highlighted search result.\n if (this.isZoomToSearchResultEnabled() && this.extension.currentAnnotationRect) {\n if (currentCanvasIndex < firstSearchResultCanvasIndex) {\n return false;\n }\n else if (currentCanvasIndex === firstSearchResultCanvasIndex) {\n if (currentSearchResultRectIndex === 0) {\n return false;\n }\n }\n return true;\n }\n return (currentCanvasIndex > firstSearchResultCanvasIndex);\n };\n FooterPanel.prototype.isNextButtonEnabled = function () {\n var currentCanvasIndex = this.extension.helper.canvasIndex;\n var lastSearchResultCanvasIndex = this.getLastSearchResultCanvasIndex();\n var currentSearchResultRectIndex = this.getCurrentSearchResultRectIndex();\n // if zoom to search result is enabled and there is a highlighted search result.\n if (this.isZoomToSearchResultEnabled() && this.extension.currentAnnotationRect) {\n if (currentCanvasIndex > lastSearchResultCanvasIndex) {\n return false;\n }\n else if (currentCanvasIndex === lastSearchResultCanvasIndex) {\n if (currentSearchResultRectIndex === this.getLastSearchResultRectIndex()) {\n return false;\n }\n }\n return true;\n }\n return (currentCanvasIndex < lastSearchResultCanvasIndex);\n };\n FooterPanel.prototype.getSearchResults = function () {\n return this.extension.annotations;\n };\n FooterPanel.prototype.getCurrentSearchResultRectIndex = function () {\n return this.extension.getCurrentAnnotationRectIndex();\n };\n FooterPanel.prototype.getFirstSearchResultCanvasIndex = function () {\n var searchResults = this.getSearchResults();\n if (!searchResults)\n return -1;\n var firstSearchResultCanvasIndex = searchResults[0].canvasIndex;\n return firstSearchResultCanvasIndex;\n };\n FooterPanel.prototype.getLastSearchResultCanvasIndex = function () {\n var searchResults = this.getSearchResults();\n if (!searchResults)\n return -1;\n var lastSearchResultCanvasIndex = searchResults[searchResults.length - 1].canvasIndex;\n return lastSearchResultCanvasIndex;\n };\n FooterPanel.prototype.getLastSearchResultRectIndex = function () {\n return this.extension.getLastAnnotationRectIndex();\n };\n FooterPanel.prototype.updateNextButton = function () {\n var searchResults = this.getSearchResults();\n if (searchResults && searchResults.length) {\n if (this.isNextButtonEnabled()) {\n this.$nextResultButton.removeClass('disabled');\n }\n else {\n this.$nextResultButton.addClass('disabled');\n }\n }\n };\n FooterPanel.prototype.updatePrevButton = function () {\n var searchResults = this.getSearchResults();\n if (searchResults && searchResults.length) {\n if (this.isPreviousButtonEnabled()) {\n this.$previousResultButton.removeClass('disabled');\n }\n else {\n this.$previousResultButton.addClass('disabled');\n }\n }\n };\n FooterPanel.prototype.updatePrintButton = function () {\n var configEnabled = Utils.Bools.getBool(this.options.printEnabled, false);\n //var printService: Manifesto.IService = this.extension.helper.manifest.getService(manifesto.ServiceProfile.printExtensions());\n //if (configEnabled && printService && this.extension.isOnHomeDomain()){\n if (configEnabled) {\n this.$printButton.show();\n }\n else {\n this.$printButton.hide();\n }\n };\n FooterPanel.prototype.search = function (terms) {\n this.terms = terms;\n if (this.terms === '' || this.terms === this.content.enterKeyword) {\n this.extension.showMessage(this.config.modules.genericDialogue.content.emptyValue, function () {\n this.$searchText.focus();\n });\n return;\n }\n // blur search field\n this.$searchText.blur();\n this.showSearchSpinner();\n this.component.publish(Events_1.Events.SEARCH, this.terms);\n };\n FooterPanel.prototype.getSearchResultPlacemarkers = function () {\n return this.$searchResultsContainer.find('.searchResultPlacemarker');\n };\n FooterPanel.prototype.setCurrentSearchResultPlacemarker = function () {\n var placemarkers = this.getSearchResultPlacemarkers();\n placemarkers.parent().find('.current').removeClass('current');\n var $current = $('.searchResultPlacemarker[data-index=\"' + this.extension.helper.canvasIndex + '\"]');\n $current.addClass('current');\n };\n FooterPanel.prototype.positionSearchResultPlacemarkers = function () {\n var searchResults = this.getSearchResults();\n if (!searchResults || !searchResults.length)\n return;\n // clear all existing placemarkers\n var placemarkers = this.getSearchResultPlacemarkers();\n placemarkers.remove();\n var pageWidth = this.getPageLineRatio();\n var lineTop = this.$line.position().top;\n var lineLeft = this.$line.position().left;\n var that = this;\n // for each page with a result, place a marker along the line.\n for (var i = 0; i < searchResults.length; i++) {\n var result = searchResults[i];\n var distance = result.canvasIndex * pageWidth;\n var $placemarker = $('
                      ');\n $placemarker[0].ontouchstart = function (e) { that.onPlacemarkerTouchStart.call(this, that); };\n $placemarker.click(function (e) { that.onPlacemarkerClick.call(this, that); });\n $placemarker.mouseenter(function (e) { that.onPlacemarkerMouseEnter.call(this, that); });\n $placemarker.mouseleave(function (e) { that.onPlacemarkerMouseLeave.call(this, e, that); });\n this.$searchResultsContainer.append($placemarker);\n var top_1 = lineTop - $placemarker.height();\n var left = lineLeft + distance - ($placemarker.width() / 2);\n $placemarker.css({\n top: top_1,\n left: left\n });\n }\n };\n FooterPanel.prototype.onPlacemarkerTouchStart = function (that) {\n that.placemarkerTouched = true;\n //const $placemarker: JQuery = $(this);\n //const index: number = parseInt($placemarker.attr('data-index'));\n //this.component.publish(Events.VIEW_PAGE, [index]);\n };\n FooterPanel.prototype.onPlacemarkerClick = function (that) {\n if (that.placemarkerTouched)\n return;\n that.placemarkerTouched = false;\n //const $placemarker: JQuery = $(this);\n //const index: number = parseInt($placemarker.attr('data-index'));\n //this.component.publish(Events.VIEW_PAGE, [index]);\n };\n FooterPanel.prototype.onPlacemarkerMouseEnter = function (that) {\n if (that.placemarkerTouched)\n return;\n var $placemarker = $(this);\n $placemarker.addClass('hover');\n var canvasIndex = parseInt($placemarker.attr('data-index'));\n that.component.publish(Events_1.Events.SEARCH_PREVIEW_START, canvasIndex);\n var $placemarkers = that.getSearchResultPlacemarkers();\n var elemIndex = $placemarkers.index($placemarker[0]);\n that.currentPlacemarkerIndex = canvasIndex;\n that.$placemarkerDetails.show();\n var title = \"{0} {1}\";\n if (that.isPageModeEnabled()) {\n var canvas = that.extension.helper.getCanvasByIndex(canvasIndex);\n var label = Manifesto.LanguageMap.getValue(canvas.getLabel());\n if (!label) {\n label = this.extension.helper.manifest.options.defaultLabel;\n }\n title = Utils.Strings.format(title, that.content.pageCaps, label);\n }\n else {\n title = Utils.Strings.format(title, that.content.imageCaps, String(canvasIndex + 1));\n }\n that.$placemarkerDetailsTop.html(title);\n var searchResults = that.getSearchResults();\n if (searchResults) {\n var result = searchResults[elemIndex];\n var terms = \"\";\n if (that.terms) {\n terms = Utils.Strings.ellipsis(that.terms, that.options.elideDetailsTermsCount);\n }\n var instanceFoundText = that.content.instanceFound;\n var instancesFoundText = that.content.instancesFound;\n var text = '';\n if (result.rects.length === 1) {\n text = Utils.Strings.format(instanceFoundText, terms);\n that.$placemarkerDetailsBottom.html(text);\n }\n else {\n text = Utils.Strings.format(instancesFoundText, String(result.rects.length), terms);\n that.$placemarkerDetailsBottom.html(text);\n }\n }\n var pos = $placemarker.position();\n var top = pos.top - that.$placemarkerDetails.height();\n var left = pos.left;\n if (left < that.$placemarkerDetails.width() / 2) {\n left = 0 - ($placemarker.width() / 2);\n }\n else if (left > that.$line.width() - (that.$placemarkerDetails.width() / 2)) {\n left = that.$line.width() - that.$placemarkerDetails.width() + ($placemarker.width() / 2);\n }\n else {\n left -= (that.$placemarkerDetails.width() / 2);\n }\n that.$placemarkerDetails.css({\n top: top,\n left: left\n });\n };\n FooterPanel.prototype.onPlacemarkerMouseLeave = function (e, that) {\n that.component.publish(Events_1.Events.SEARCH_PREVIEW_FINISH);\n var $placemarker = $(this);\n var newElement = e.toElement || e.relatedTarget;\n var isChild = $(newElement).closest(that.$placemarkerDetails).length;\n if (newElement != that.$placemarkerDetails.get(0) && isChild === 0) {\n that.$placemarkerDetails.hide();\n $placemarker.removeClass('hover');\n }\n };\n FooterPanel.prototype.setPageMarkerPosition = function () {\n if (this.extension.helper.canvasIndex === null)\n return;\n // position placemarker showing current page.\n var pageLineRatio = this.getPageLineRatio();\n var lineTop = this.$line.position().top;\n var lineLeft = this.$line.position().left;\n var position = this.extension.helper.canvasIndex * pageLineRatio;\n var top = lineTop;\n var left = lineLeft + position;\n this.$pagePositionMarker.css({\n top: top,\n left: left\n });\n // if the remaining distance to the right is less than the width of the label\n // shift it to the left.\n var lineWidth = this.$line.width();\n if (left + this.$pagePositionLabel.outerWidth(true) > lineWidth) {\n left -= this.$pagePositionLabel.outerWidth(true);\n this.$pagePositionLabel.removeClass('right');\n this.$pagePositionLabel.addClass('left');\n }\n else {\n this.$pagePositionLabel.removeClass('left');\n this.$pagePositionLabel.addClass('right');\n }\n this.$pagePositionLabel.css({\n top: top,\n left: left\n });\n };\n FooterPanel.prototype.clearSearchResults = function () {\n if (!this.isSearchEnabled()) {\n return;\n }\n // clear all existing placemarkers\n var $placemarkers = this.getSearchResultPlacemarkers();\n $placemarkers.remove();\n // clear search input field.\n this.$searchText.val(this.content.enterKeyword);\n // hide pager.\n this.$searchContainer.show();\n this.$searchPagerContainer.hide();\n // set focus to search box.\n this.$searchText.focus();\n };\n FooterPanel.prototype.getPageLineRatio = function () {\n var lineWidth = this.$line.width();\n // find page/width ratio by dividing the line width by the number of pages in the book.\n if (this.extension.helper.getTotalCanvases() === 1)\n return 0;\n return lineWidth / (this.extension.helper.getTotalCanvases() - 1);\n };\n FooterPanel.prototype.canvasIndexChanged = function () {\n this.setPageMarkerPosition();\n this.setPlacemarkerLabel();\n };\n FooterPanel.prototype.settingsChanged = function () {\n this.setPlacemarkerLabel();\n };\n FooterPanel.prototype.setPlacemarkerLabel = function () {\n var displaying = this.content.displaying;\n var index = this.extension.helper.canvasIndex;\n if (this.isPageModeEnabled()) {\n var canvas = this.extension.helper.getCanvasByIndex(index);\n var label = Manifesto.LanguageMap.getValue(canvas.getLabel());\n if (!label) {\n label = this.content.defaultLabel;\n }\n var lastCanvasOrderLabel = this.extension.helper.getLastCanvasLabel(true);\n if (lastCanvasOrderLabel) {\n this.$pagePositionLabel.html(Utils.Strings.format(displaying, this.content.page, Utils_1.UVUtils.sanitize(label), Utils_1.UVUtils.sanitize(lastCanvasOrderLabel)));\n }\n }\n else {\n this.$pagePositionLabel.html(Utils.Strings.format(displaying, this.content.image, String(index + 1), this.extension.helper.getTotalCanvases().toString()));\n }\n };\n FooterPanel.prototype.isPageModeEnabled = function () {\n return this.config.options.pageModeEnabled && this.extension.getMode().toString() === Mode_1.Mode.page.toString() && !Utils.Bools.getBool(this.config.options.forceImageMode, false);\n };\n FooterPanel.prototype.showSearchSpinner = function () {\n this.$searchText.addClass('searching');\n };\n FooterPanel.prototype.hideSearchSpinner = function () {\n this.$searchText.removeClass('searching');\n };\n FooterPanel.prototype.displaySearchResults = function (results, terms) {\n if (!this.isSearchEnabled()) {\n return;\n }\n this.hideSearchSpinner();\n this.positionSearchResultPlacemarkers();\n // show pager.\n this.$searchContainer.hide();\n this.$searchPagerControls.css({\n 'left': 0\n });\n var $info = this.$searchResultsInfo.find('.info');\n var $number = $info.find('.number');\n var $foundFor = $info.find('.foundFor');\n var $terms = $info.find('.terms');\n if (terms) {\n $info.show();\n $number.text(this.extension.getTotalAnnotationRects());\n if (results.length === 1) {\n $foundFor.html(this.content.resultFoundFor);\n }\n else {\n $foundFor.html(this.content.resultsFoundFor);\n }\n $terms.html(Utils.Strings.ellipsis(terms, this.options.elideResultsTermsCount));\n $terms.prop('title', terms);\n }\n else {\n $info.hide();\n }\n this.$searchPagerContainer.show();\n this.resize();\n };\n FooterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n var searchResults = this.getSearchResults();\n if (searchResults && searchResults.length) {\n this.positionSearchResultPlacemarkers();\n }\n this.setPageMarkerPosition();\n this.$searchPagerContainer.width(this.$element.width());\n var center = this.$element.width() / 2;\n // position search pager controls.\n this.$searchPagerControls.css({\n 'left': center - (this.$searchPagerControls.width() / 2)\n });\n // position search input.\n this.$searchOptions.css({\n 'left': center - (this.$searchOptions.outerWidth() / 2)\n });\n };\n return FooterPanel;\n }(FooterPanel_1.FooterPanel));\n exports.FooterPanel = FooterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-dialogues-module/MoreInfoDialogue',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/Dialogue\", \"../../Utils\"], function (require, exports, BaseEvents_1, Dialogue_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var MoreInfoDialogue = /** @class */ (function (_super) {\n __extends(MoreInfoDialogue, _super);\n function MoreInfoDialogue($element) {\n return _super.call(this, $element) || this;\n }\n MoreInfoDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('moreInfoDialogue');\n _super.prototype.create.call(this);\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_MOREINFO_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_MOREINFO_DIALOGUE;\n this.component.subscribe(this.openCommand, function (triggerButton) {\n _this.open(triggerButton);\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n });\n this.config.content = this.extension.data.config.modules.moreInfoRightPanel.content;\n this.config.options = this.extension.data.config.modules.moreInfoRightPanel.options;\n // create ui\n this.$title = $('

                      ' + this.config.content.title + '

                      ');\n this.$content.append(this.$title);\n this.$metadata = $('');\n this.$content.append(this.$metadata);\n this.metadataComponent = new IIIFComponents.MetadataComponent({\n target: this.$metadata[0]\n });\n // hide\n this.$element.hide();\n };\n MoreInfoDialogue.prototype.open = function (triggerButton) {\n _super.prototype.open.call(this, triggerButton);\n this.metadataComponent.set(this._getData());\n };\n MoreInfoDialogue.prototype._getData = function () {\n return {\n canvasDisplayOrder: this.config.options.canvasDisplayOrder,\n canvases: this.extension.getCurrentCanvases(),\n canvasExclude: this.config.options.canvasExclude,\n canvasLabels: this.extension.getCanvasLabels(this.content.page),\n content: this.config.content,\n copiedMessageDuration: 2000,\n copyToClipboardEnabled: Utils.Bools.getBool(this.config.options.copyToClipboardEnabled, false),\n helper: this.extension.helper,\n licenseFormatter: null,\n limit: this.config.options.textLimit || 4,\n limitType: IIIFComponents.LimitType.LINES,\n manifestDisplayOrder: this.config.options.manifestDisplayOrder,\n manifestExclude: this.config.options.manifestExclude,\n range: this.extension.getCurrentCanvasRange(),\n rtlLanguageCodes: this.config.options.rtlLanguageCodes,\n sanitizer: function (html) {\n return Utils_1.UVUtils.sanitize(html);\n },\n showAllLanguages: this.config.options.showAllLanguages\n };\n };\n MoreInfoDialogue.prototype.close = function () {\n _super.prototype.close.call(this);\n };\n MoreInfoDialogue.prototype.resize = function () {\n this.setDockedPosition();\n };\n return MoreInfoDialogue;\n }(Dialogue_1.Dialogue));\n exports.MoreInfoDialogue = MoreInfoDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-multiselectdialogue-module/MultiSelectDialogue',[\"require\", \"exports\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-shared-module/Dialogue\", \"../../extensions/uv-seadragon-extension/Mode\"], function (require, exports, BaseEvents_1, Dialogue_1, Mode_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var MultiSelectDialogue = /** @class */ (function (_super) {\n __extends(MultiSelectDialogue, _super);\n function MultiSelectDialogue($element) {\n return _super.call(this, $element) || this;\n }\n MultiSelectDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('multiSelectDialogue');\n _super.prototype.create.call(this);\n var that = this;\n this.openCommand = BaseEvents_1.BaseEvents.SHOW_MULTISELECT_DIALOGUE;\n this.closeCommand = BaseEvents_1.BaseEvents.HIDE_MULTISELECT_DIALOGUE;\n this.component.subscribe(this.openCommand, function () {\n _this.open();\n var multiSelectState = _this.extension.helper.getMultiSelectState();\n multiSelectState.setEnabled(true);\n _this.galleryComponent.set(_this.data);\n });\n this.component.subscribe(this.closeCommand, function () {\n _this.close();\n var multiSelectState = _this.extension.helper.getMultiSelectState();\n multiSelectState.setEnabled(false);\n });\n this.$title = $('

                      ');\n this.$content.append(this.$title);\n this.$title.text(this.content.title);\n this.$gallery = $('');\n this.$content.append(this.$gallery);\n this.data = {\n helper: this.extension.helper,\n chunkedResizingThreshold: this.config.options.galleryThumbChunkedResizingThreshold,\n content: this.config.content,\n debug: false,\n imageFadeInDuration: 300,\n initialZoom: 4,\n minLabelWidth: 20,\n pageModeEnabled: this.isPageModeEnabled(),\n searchResults: [],\n scrollStopDuration: 100,\n sizingEnabled: true,\n thumbHeight: this.config.options.galleryThumbHeight,\n thumbLoadPadding: this.config.options.galleryThumbLoadPadding,\n thumbWidth: this.config.options.galleryThumbWidth,\n viewingDirection: this.extension.helper.getViewingDirection()\n };\n this.galleryComponent = new IIIFComponents.GalleryComponent({\n target: this.$gallery[0]\n });\n var $selectButton = this.$gallery.find('a.select');\n $selectButton.addClass('btn btn-primary');\n this.galleryComponent.on('multiSelectionMade', function (ids) {\n _this.component.publish(BaseEvents_1.BaseEvents.MULTISELECTION_MADE, ids);\n that.close();\n }, false);\n this.$element.hide();\n };\n MultiSelectDialogue.prototype.isPageModeEnabled = function () {\n return Utils.Bools.getBool(this.config.options.pageModeEnabled, true) && this.extension.getMode().toString() === Mode_1.Mode.page.toString();\n };\n MultiSelectDialogue.prototype.open = function () {\n _super.prototype.open.call(this);\n };\n MultiSelectDialogue.prototype.close = function () {\n _super.prototype.close.call(this);\n };\n MultiSelectDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n var $main = this.$gallery.find('.main');\n var $header = this.$gallery.find('.header');\n $main.height(this.$content.height() - this.$title.outerHeight() - this.$title.verticalMargins() - $header.height());\n };\n return MultiSelectDialogue;\n }(Dialogue_1.Dialogue));\n exports.MultiSelectDialogue = MultiSelectDialogue;\n});\n\n", - "define('extensions/uv-seadragon-extension/MultiSelectionArgs',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var MultiSelectionArgs = /** @class */ (function () {\n function MultiSelectionArgs() {\n }\n return MultiSelectionArgs;\n }());\n exports.MultiSelectionArgs = MultiSelectionArgs;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-pagingheaderpanel-module/PagingHeaderPanel',[\"require\", \"exports\", \"../uv-shared-module/AutoComplete\", \"../uv-shared-module/BaseEvents\", \"../../extensions/uv-seadragon-extension/Events\", \"../uv-shared-module/HeaderPanel\", \"../../extensions/uv-seadragon-extension/Mode\", \"../../Utils\"], function (require, exports, AutoComplete_1, BaseEvents_1, Events_1, HeaderPanel_1, Mode_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var PagingHeaderPanel = /** @class */ (function (_super) {\n __extends(PagingHeaderPanel, _super);\n function PagingHeaderPanel($element) {\n var _this = _super.call(this, $element) || this;\n _this.firstButtonEnabled = false;\n _this.lastButtonEnabled = false;\n _this.nextButtonEnabled = false;\n _this.prevButtonEnabled = false;\n return _this;\n }\n PagingHeaderPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('pagingHeaderPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.canvasIndexChanged(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, function () {\n _this.modeChanged();\n _this.updatePagingToggle();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED, function () {\n _this.setSearchFieldValue(_this.extension.helper.canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START, function () {\n _this.openGallery();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_START, function () {\n _this.closeGallery();\n });\n this.$prevOptions = $('
                      ');\n this.$centerOptions.append(this.$prevOptions);\n this.$firstButton = $(\"\\n \\n \");\n this.$prevOptions.append(this.$firstButton);\n this.$prevButton = $(\"\\n \\n \");\n this.$prevOptions.append(this.$prevButton);\n this.$modeOptions = $('
                      ');\n this.$centerOptions.append(this.$modeOptions);\n this.$imageModeLabel = $('');\n this.$modeOptions.append(this.$imageModeLabel);\n this.$imageModeOption = $('');\n this.$modeOptions.append(this.$imageModeOption);\n this.$pageModeLabel = $('');\n this.$modeOptions.append(this.$pageModeLabel);\n this.$pageModeOption = $('');\n this.$modeOptions.append(this.$pageModeOption);\n this.$search = $('
                      ');\n this.$centerOptions.append(this.$search);\n this.$searchText = $('');\n this.$search.append(this.$searchText);\n if (Utils.Bools.getBool(this.options.autoCompleteBoxEnabled, true)) {\n this.$searchText.hide();\n this.$autoCompleteBox = $('');\n this.$search.append(this.$autoCompleteBox);\n new AutoComplete_1.AutoComplete(this.$autoCompleteBox, function (term, cb) {\n var results = [];\n var canvases = _this.extension.helper.getCanvases();\n // if in page mode, get canvases by label.\n if (_this.isPageModeEnabled()) {\n for (var i = 0; i < canvases.length; i++) {\n var canvas = canvases[i];\n var label = Manifesto.LanguageMap.getValue(canvas.getLabel());\n if (label && label.startsWith(term)) {\n results.push(label);\n }\n }\n }\n else {\n // get canvas by index\n for (var i = 0; i < canvases.length; i++) {\n var canvas = canvases[i];\n if (canvas.index.toString().startsWith(term)) {\n results.push(canvas.index.toString());\n }\n }\n }\n cb(results);\n }, function (results) {\n return results;\n }, function (terms) {\n _this.search(terms);\n }, 300, 0, Utils.Bools.getBool(this.options.autocompleteAllowWords, false));\n }\n else if (Utils.Bools.getBool(this.options.imageSelectionBoxEnabled, true)) {\n this.$selectionBoxOptions = $('
                      ');\n this.$centerOptions.append(this.$selectionBoxOptions);\n this.$imageSelectionBox = $('');\n this.$selectionBoxOptions.append(this.$imageSelectionBox);\n for (var imageIndex = 0; imageIndex < this.extension.helper.getTotalCanvases(); imageIndex++) {\n var canvas = this.extension.helper.getCanvasByIndex(imageIndex);\n var label = Utils_1.UVUtils.sanitize(Manifesto.LanguageMap.getValue(canvas.getLabel(), this.extension.helper.options.locale));\n this.$imageSelectionBox.append('');\n }\n this.$imageSelectionBox.change(function () {\n var imageIndex = parseInt(_this.$imageSelectionBox.val());\n _this.component.publish(Events_1.Events.IMAGE_SEARCH, imageIndex);\n });\n }\n this.$total = $('');\n this.$search.append(this.$total);\n this.$searchButton = $(\"\" + this.content.go + \"\");\n this.$search.append(this.$searchButton);\n this.$nextOptions = $('
                      ');\n this.$centerOptions.append(this.$nextOptions);\n this.$nextButton = $(\"\\n \\n \");\n this.$nextOptions.append(this.$nextButton);\n this.$lastButton = $(\"\\n \\n \");\n this.$nextOptions.append(this.$lastButton);\n if (this.isPageModeEnabled()) {\n this.$pageModeOption.attr('checked', 'checked');\n this.$pageModeOption.removeAttr('disabled');\n this.$pageModeLabel.removeClass('disabled');\n }\n else {\n this.$imageModeOption.attr('checked', 'checked');\n // disable page mode option.\n this.$pageModeOption.attr('disabled', 'disabled');\n this.$pageModeLabel.addClass('disabled');\n }\n if (this.extension.helper.getManifestType().toString() === manifesto.ManifestType.manuscript().toString()) {\n this.$pageModeLabel.text(this.content.folio);\n }\n else {\n this.$pageModeLabel.text(this.content.page);\n }\n this.$galleryButton = $(\"\\n \\n \");\n this.$rightOptions.prepend(this.$galleryButton);\n this.$pagingToggleButtons = $('
                      ');\n this.$rightOptions.prepend(this.$pagingToggleButtons);\n this.$oneUpButton = $(\"\\n \");\n this.$pagingToggleButtons.append(this.$oneUpButton);\n this.$twoUpButton = $(\"\\n \\n \");\n this.$pagingToggleButtons.append(this.$twoUpButton);\n this.updatePagingToggle();\n this.updateGalleryButton();\n this.$oneUpButton.onPressed(function () {\n var enabled = false;\n _this.updateSettings({ pagingEnabled: enabled });\n _this.component.publish(Events_1.Events.PAGING_TOGGLED, enabled);\n });\n this.$twoUpButton.onPressed(function () {\n var enabled = true;\n _this.updateSettings({ pagingEnabled: enabled });\n _this.component.publish(Events_1.Events.PAGING_TOGGLED, enabled);\n });\n this.$galleryButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.TOGGLE_EXPAND_LEFT_PANEL);\n });\n this.setNavigationTitles();\n this.setTotal();\n var viewingDirection = this.extension.helper.getViewingDirection() || manifesto.ViewingDirection.leftToRight();\n // check if the book has more than one page, otherwise hide prev/next options.\n if (this.extension.helper.getTotalCanvases() === 1) {\n this.$centerOptions.hide();\n }\n // ui event handlers.\n this.$firstButton.onPressed(function () {\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.leftToRight().toString():\n case manifesto.ViewingDirection.topToBottom().toString():\n case manifesto.ViewingDirection.bottomToTop().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.FIRST);\n break;\n case manifesto.ViewingDirection.rightToLeft().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.LAST);\n break;\n }\n });\n this.$prevButton.onPressed(function () {\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.leftToRight().toString():\n case manifesto.ViewingDirection.bottomToTop().toString():\n case manifesto.ViewingDirection.topToBottom().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.PREV);\n break;\n case manifesto.ViewingDirection.rightToLeft().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.NEXT);\n break;\n }\n });\n this.$nextButton.onPressed(function () {\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.leftToRight().toString():\n case manifesto.ViewingDirection.bottomToTop().toString():\n case manifesto.ViewingDirection.topToBottom().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.NEXT);\n break;\n case manifesto.ViewingDirection.rightToLeft().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.PREV);\n break;\n }\n });\n this.$lastButton.onPressed(function () {\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.leftToRight().toString():\n case manifesto.ViewingDirection.topToBottom().toString():\n case manifesto.ViewingDirection.bottomToTop().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.LAST);\n break;\n case manifesto.ViewingDirection.rightToLeft().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.FIRST);\n break;\n }\n });\n // If page mode is disabled, we don't need to show radio buttons since\n // there is only one option:\n if (!this.config.options.pageModeEnabled) {\n this.$imageModeOption.hide();\n this.$pageModeLabel.hide();\n this.$pageModeOption.hide();\n }\n else {\n // Only activate click actions for mode buttons when controls are\n // visible, since otherwise, clicking on the \"Image\" label can\n // trigger unexpected/undesired side effects.\n this.$imageModeOption.on('click', function (e) {\n _this.component.publish(Events_1.Events.MODE_CHANGED, Mode_1.Mode.image.toString());\n });\n this.$pageModeOption.on('click', function (e) {\n _this.component.publish(Events_1.Events.MODE_CHANGED, Mode_1.Mode.page.toString());\n });\n }\n this.$searchText.onEnter(function () {\n _this.$searchText.blur();\n _this.search(_this.$searchText.val());\n });\n this.$searchText.click(function () {\n $(this).select();\n });\n this.$searchButton.onPressed(function () {\n if (_this.options.autoCompleteBoxEnabled) {\n _this.search(_this.$autoCompleteBox.val());\n }\n else {\n _this.search(_this.$searchText.val());\n }\n });\n if (this.options.modeOptionsEnabled === false) {\n this.$modeOptions.hide();\n this.$centerOptions.addClass('modeOptionsDisabled');\n }\n // Search is shown as default\n if (this.options.imageSelectionBoxEnabled === true && this.options.autoCompleteBoxEnabled !== true) {\n this.$search.hide();\n }\n if (this.options.helpEnabled === false) {\n this.$helpButton.hide();\n }\n // todo: discuss on community call\n // Get visible element in centerOptions with greatest tabIndex\n // var $elementWithGreatestTabIndex: JQuery = this.$centerOptions.getVisibleElementWithGreatestTabIndex();\n // // cycle focus back to start.\n // if ($elementWithGreatestTabIndex) {\n // $elementWithGreatestTabIndex.blur(() => {\n // if (this.extension.tabbing && !this.extension.shifted) {\n // this.$nextButton.focus();\n // }\n // });\n // }\n // this.$nextButton.blur(() => {\n // if (this.extension.tabbing && this.extension.shifted) {\n // setTimeout(() => {\n // $elementWithGreatestTabIndex.focus();\n // }, 100);\n // }\n // });\n if (!Utils.Bools.getBool(this.options.pagingToggleEnabled, true)) {\n this.$pagingToggleButtons.hide();\n }\n };\n PagingHeaderPanel.prototype.openGallery = function () {\n this.$oneUpButton.removeClass('on');\n this.$twoUpButton.removeClass('on');\n this.$galleryButton.addClass('on');\n };\n PagingHeaderPanel.prototype.closeGallery = function () {\n this.updatePagingToggle();\n this.$galleryButton.removeClass('on');\n };\n PagingHeaderPanel.prototype.isPageModeEnabled = function () {\n return this.config.options.pageModeEnabled && this.extension.getMode().toString() === Mode_1.Mode.page.toString();\n };\n PagingHeaderPanel.prototype.setNavigationTitles = function () {\n if (this.isPageModeEnabled()) {\n if (this.extension.helper.isRightToLeft()) {\n this.$firstButton.prop('title', this.content.lastPage);\n this.$firstButton.find('span').text(this.content.lastPage);\n this.$prevButton.prop('title', this.content.nextPage);\n this.$prevButton.find('span').text(this.content.nextPage);\n this.$nextButton.prop('title', this.content.previousPage);\n this.$nextButton.find('span').text(this.content.previousPage);\n this.$lastButton.prop('title', this.content.firstPage);\n this.$lastButton.find('span').text(this.content.firstPage);\n }\n else {\n this.$firstButton.prop('title', this.content.firstPage);\n this.$firstButton.find('span').text(this.content.firstPage);\n this.$prevButton.prop('title', this.content.previousPage);\n this.$prevButton.find('span').text(this.content.previousPage);\n this.$nextButton.prop('title', this.content.nextPage);\n this.$nextButton.find('span').text(this.content.nextPage);\n this.$lastButton.prop('title', this.content.lastPage);\n this.$lastButton.find('span').text(this.content.lastPage);\n }\n }\n else {\n if (this.extension.helper.isRightToLeft()) {\n this.$firstButton.prop('title', this.content.lastImage);\n this.$firstButton.find('span').text(this.content.lastPage);\n this.$prevButton.prop('title', this.content.nextImage);\n this.$prevButton.find('span').text(this.content.nextImage);\n this.$nextButton.prop('title', this.content.previousImage);\n this.$nextButton.find('span').text(this.content.previousImage);\n this.$lastButton.prop('title', this.content.firstImage);\n this.$lastButton.find('span').text(this.content.firstImage);\n }\n else {\n this.$firstButton.prop('title', this.content.firstImage);\n this.$firstButton.find('span').text(this.content.firstImage);\n this.$prevButton.prop('title', this.content.previousImage);\n this.$prevButton.find('span').text(this.content.previousImage);\n this.$nextButton.prop('title', this.content.nextImage);\n this.$nextButton.find('span').text(this.content.nextImage);\n this.$lastButton.prop('title', this.content.lastImage);\n this.$lastButton.find('span').text(this.content.lastImage);\n }\n }\n };\n PagingHeaderPanel.prototype.updatePagingToggle = function () {\n if (!this.pagingToggleIsVisible()) {\n this.$pagingToggleButtons.hide();\n return;\n }\n if (this.extension.isPagingSettingEnabled()) {\n this.$oneUpButton.removeClass('on');\n this.$twoUpButton.addClass('on');\n }\n else {\n this.$twoUpButton.removeClass('on');\n this.$oneUpButton.addClass('on');\n }\n };\n PagingHeaderPanel.prototype.pagingToggleIsVisible = function () {\n return Utils.Bools.getBool(this.options.pagingToggleEnabled, true) && this.extension.helper.isPagingAvailable();\n };\n PagingHeaderPanel.prototype.updateGalleryButton = function () {\n if (!this.galleryIsVisible()) {\n this.$galleryButton.hide();\n }\n };\n PagingHeaderPanel.prototype.galleryIsVisible = function () {\n return Utils.Bools.getBool(this.options.galleryButtonEnabled, true) && this.extension.isLeftPanelEnabled();\n };\n PagingHeaderPanel.prototype.setTotal = function () {\n var of = this.content.of;\n if (this.isPageModeEnabled()) {\n this.$total.html(Utils.Strings.format(of, this.extension.helper.getLastCanvasLabel(true)));\n }\n else {\n this.$total.html(Utils.Strings.format(of, this.extension.helper.getTotalCanvases().toString()));\n }\n };\n PagingHeaderPanel.prototype.setSearchFieldValue = function (index) {\n var canvas = this.extension.helper.getCanvasByIndex(index);\n var value = null;\n if (this.isPageModeEnabled()) {\n var orderLabel = Manifesto.LanguageMap.getValue(canvas.getLabel());\n if (orderLabel === \"-\") {\n value = \"\";\n }\n else {\n value = orderLabel;\n }\n }\n else {\n index += 1;\n value = index.toString();\n }\n if (this.options.autoCompleteBoxEnabled) {\n this.$autoCompleteBox.val(value);\n }\n else {\n this.$searchText.val(value);\n }\n };\n PagingHeaderPanel.prototype.search = function (value) {\n if (!value) {\n this.extension.showMessage(this.content.emptyValue);\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED);\n return;\n }\n if (this.isPageModeEnabled()) {\n this.component.publish(Events_1.Events.PAGE_SEARCH, value);\n }\n else {\n var index = void 0;\n if (this.options.autoCompleteBoxEnabled) {\n index = parseInt(this.$autoCompleteBox.val(), 10);\n }\n else {\n index = parseInt(this.$searchText.val(), 10);\n }\n index -= 1;\n if (isNaN(index)) {\n this.extension.showMessage(this.extension.data.config.modules.genericDialogue.content.invalidNumber);\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED);\n return;\n }\n var asset = this.extension.helper.getCanvasByIndex(index);\n if (!asset) {\n this.extension.showMessage(this.extension.data.config.modules.genericDialogue.content.pageNotFound);\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED);\n return;\n }\n this.component.publish(Events_1.Events.IMAGE_SEARCH, index);\n }\n };\n PagingHeaderPanel.prototype.canvasIndexChanged = function (index) {\n this.setSearchFieldValue(index);\n if (this.options.imageSelectionBoxEnabled === true && this.options.autoCompleteBoxEnabled !== true) {\n this.$imageSelectionBox.val(index);\n }\n var viewingDirection = this.extension.helper.getViewingDirection() || manifesto.ViewingDirection.leftToRight();\n if (viewingDirection.toString() === manifesto.ViewingDirection.rightToLeft().toString()) {\n if (this.extension.helper.isFirstCanvas()) {\n this.disableLastButton();\n this.disableNextButton();\n }\n else {\n this.enableLastButton();\n this.enableNextButton();\n }\n if (this.extension.helper.isLastCanvas()) {\n this.disableFirstButton();\n this.disablePrevButton();\n }\n else {\n this.enableFirstButton();\n this.enablePrevButton();\n }\n }\n else {\n if (this.extension.helper.isFirstCanvas()) {\n this.disableFirstButton();\n this.disablePrevButton();\n }\n else {\n this.enableFirstButton();\n this.enablePrevButton();\n }\n if (this.extension.helper.isLastCanvas()) {\n this.disableLastButton();\n this.disableNextButton();\n }\n else {\n this.enableLastButton();\n this.enableNextButton();\n }\n }\n };\n PagingHeaderPanel.prototype.disableFirstButton = function () {\n this.firstButtonEnabled = false;\n this.$firstButton.disable();\n };\n PagingHeaderPanel.prototype.enableFirstButton = function () {\n this.firstButtonEnabled = true;\n this.$firstButton.enable();\n };\n PagingHeaderPanel.prototype.disableLastButton = function () {\n this.lastButtonEnabled = false;\n this.$lastButton.disable();\n };\n PagingHeaderPanel.prototype.enableLastButton = function () {\n this.lastButtonEnabled = true;\n this.$lastButton.enable();\n };\n PagingHeaderPanel.prototype.disablePrevButton = function () {\n this.prevButtonEnabled = false;\n this.$prevButton.disable();\n };\n PagingHeaderPanel.prototype.enablePrevButton = function () {\n this.prevButtonEnabled = true;\n this.$prevButton.enable();\n };\n PagingHeaderPanel.prototype.disableNextButton = function () {\n this.nextButtonEnabled = false;\n this.$nextButton.disable();\n };\n PagingHeaderPanel.prototype.enableNextButton = function () {\n this.nextButtonEnabled = true;\n this.$nextButton.enable();\n };\n PagingHeaderPanel.prototype.modeChanged = function () {\n this.setSearchFieldValue(this.extension.helper.canvasIndex);\n this.setNavigationTitles();\n this.setTotal();\n };\n PagingHeaderPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n // hide toggle buttons below minimum width\n if (this.extension.width() < this.extension.data.config.options.minWidthBreakPoint) {\n if (this.pagingToggleIsVisible())\n this.$pagingToggleButtons.hide();\n if (this.galleryIsVisible())\n this.$galleryButton.hide();\n }\n else {\n if (this.pagingToggleIsVisible())\n this.$pagingToggleButtons.show();\n if (this.galleryIsVisible())\n this.$galleryButton.show();\n }\n };\n return PagingHeaderPanel;\n }(HeaderPanel_1.HeaderPanel));\n exports.PagingHeaderPanel = PagingHeaderPanel;\n});\n\n", - "define('extensions/uv-seadragon-extension/Bounds',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Bounds = /** @class */ (function () {\n function Bounds(x, y, w, h) {\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n }\n Bounds.prototype.toString = function () {\n return this.x + \",\" + this.y + \",\" + this.w + \",\" + this.h;\n };\n Bounds.fromString = function (bounds) {\n var boundsArr = bounds.split(',');\n return new Bounds(Number(boundsArr[0]), Number(boundsArr[1]), Number(boundsArr[2]), Number(boundsArr[3]));\n };\n return Bounds;\n }());\n exports.Bounds = Bounds;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../../extensions/uv-seadragon-extension/Bounds\", \"../uv-shared-module/CenterPanel\", \"../../extensions/uv-seadragon-extension/Events\", \"../../Utils\"], function (require, exports, BaseEvents_1, Bounds_1, CenterPanel_1, Events_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SeadragonCenterPanel = /** @class */ (function (_super) {\n __extends(SeadragonCenterPanel, _super);\n function SeadragonCenterPanel($element) {\n var _this = _super.call(this, $element) || this;\n _this.controlsVisible = false;\n _this.isCreated = false;\n _this.isFirstLoad = true;\n _this.navigatedFromSearch = false;\n _this.nextButtonEnabled = false;\n _this.prevButtonEnabled = false;\n return _this;\n }\n SeadragonCenterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('seadragonCenterPanel');\n _super.prototype.create.call(this);\n this.viewerId = \"osd\" + new Date().getTime();\n this.$viewer = $('
                      ');\n this.$content.prepend(this.$viewer);\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS, function (args) {\n _this.overlayAnnotations();\n _this.zoomToInitialAnnotation();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, function (args) {\n _this.viewer.gestureSettingsMouse.clickToZoom = args.clickToZoomEnabled;\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, function (resources) {\n _this.whenResized(function () {\n if (!_this.isCreated)\n _this.createUI();\n _this.openMedia(resources);\n });\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLEAR_ANNOTATIONS, function () {\n _this.whenCreated(function () {\n _this.extension.currentAnnotationRect = null;\n _this.clearAnnotations();\n });\n });\n this.component.subscribe(Events_1.Events.NEXT_SEARCH_RESULT, function () {\n _this.whenCreated(function () {\n _this.nextAnnotation();\n });\n });\n this.component.subscribe(Events_1.Events.PREV_SEARCH_RESULT, function () {\n _this.whenCreated(function () {\n _this.prevAnnotation();\n });\n });\n this.component.subscribe(Events_1.Events.ZOOM_IN, function () {\n _this.whenCreated(function () {\n _this.zoomIn();\n });\n });\n this.component.subscribe(Events_1.Events.ZOOM_OUT, function () {\n _this.whenCreated(function () {\n _this.zoomOut();\n });\n });\n this.component.subscribe(Events_1.Events.ROTATE, function () {\n _this.whenCreated(function () {\n _this.rotateRight();\n });\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.METRIC_CHANGED, function () {\n _this.whenCreated(function () {\n _this.updateResponsiveView();\n });\n });\n };\n SeadragonCenterPanel.prototype.whenCreated = function (cb) {\n var _this = this;\n Utils.Async.waitFor(function () {\n return _this.isCreated;\n }, cb);\n };\n SeadragonCenterPanel.prototype.zoomIn = function () {\n this.viewer.viewport.zoomTo(this.viewer.viewport.getZoom(true) * 2);\n };\n SeadragonCenterPanel.prototype.zoomOut = function () {\n this.viewer.viewport.zoomTo(this.viewer.viewport.getZoom(true) * 0.5);\n };\n SeadragonCenterPanel.prototype.rotateRight = function () {\n this.viewer.viewport.setRotation(this.viewer.viewport.getRotation() + 90);\n };\n SeadragonCenterPanel.prototype.updateResponsiveView = function () {\n this.setNavigatorVisible();\n if (!this.extension.isDesktopMetric()) {\n this.viewer.autoHideControls = false;\n this.$viewportNavButtons.hide();\n }\n else {\n this.viewer.autoHideControls = true;\n this.$viewportNavButtons.show();\n }\n };\n SeadragonCenterPanel.prototype.createUI = function () {\n var _this = this;\n this.$spinner = $('
                      ');\n this.$content.append(this.$spinner);\n // add to window object for testing automation purposes.\n //window.openSeadragonViewer\n // removed as causing issues for multiple UVs on page\n this.viewer = OpenSeadragon({\n id: this.viewerId,\n ajaxWithCredentials: false,\n showNavigationControl: true,\n showNavigator: true,\n showRotationControl: true,\n showHomeControl: Utils.Bools.getBool(this.config.options.showHomeControl, false),\n showFullPageControl: false,\n defaultZoomLevel: this.config.options.defaultZoomLevel || 0,\n maxZoomPixelRatio: this.config.options.maxZoomPixelRatio || 2,\n controlsFadeDelay: this.config.options.controlsFadeDelay || 250,\n controlsFadeLength: this.config.options.controlsFadeLength || 250,\n navigatorPosition: this.config.options.navigatorPosition || \"BOTTOM_RIGHT\",\n animationTime: this.config.options.animationTime || 1.2,\n visibilityRatio: this.config.options.visibilityRatio || 0.5,\n constrainDuringPan: Utils.Bools.getBool(this.config.options.constrainDuringPan, false),\n immediateRender: Utils.Bools.getBool(this.config.options.immediateRender, false),\n blendTime: this.config.options.blendTime || 0,\n autoHideControls: Utils.Bools.getBool(this.config.options.autoHideControls, true),\n prefixUrl: this.extension.data.root + '/img/',\n gestureSettingsMouse: {\n clickToZoom: Utils.Bools.getBool(this.extension.data.config.options.clickToZoomEnabled, true)\n },\n navImages: {\n zoomIn: {\n REST: 'pixel.gif',\n GROUP: 'pixel.gif',\n HOVER: 'pixel.gif',\n DOWN: 'pixel.gif'\n },\n zoomOut: {\n REST: 'pixel.gif',\n GROUP: 'pixel.gif',\n HOVER: 'pixel.gif',\n DOWN: 'pixel.gif'\n },\n home: {\n REST: 'pixel.gif',\n GROUP: 'pixel.gif',\n HOVER: 'pixel.gif',\n DOWN: 'pixel.gif'\n },\n rotateright: {\n REST: 'pixel.gif',\n GROUP: 'pixel.gif',\n HOVER: 'pixel.gif',\n DOWN: 'pixel.gif'\n },\n rotateleft: {\n REST: 'pixel.gif',\n GROUP: 'pixel.gif',\n HOVER: 'pixel.gif',\n DOWN: 'pixel.gif'\n },\n next: {\n REST: 'pixel.gif',\n GROUP: 'pixel.gif',\n HOVER: 'pixel.gif',\n DOWN: 'pixel.gif'\n },\n previous: {\n REST: 'pixel.gif',\n GROUP: 'pixel.gif',\n HOVER: 'pixel.gif',\n DOWN: 'pixel.gif'\n }\n }\n });\n this.$zoomInButton = this.$viewer.find('div[title=\"Zoom in\"]');\n this.$zoomInButton.attr('tabindex', 0);\n this.$zoomInButton.prop('title', this.content.zoomIn);\n this.$zoomInButton.addClass('zoomIn viewportNavButton');\n this.$zoomOutButton = this.$viewer.find('div[title=\"Zoom out\"]');\n this.$zoomOutButton.attr('tabindex', 0);\n this.$zoomOutButton.prop('title', this.content.zoomOut);\n this.$zoomOutButton.addClass('zoomOut viewportNavButton');\n this.$goHomeButton = this.$viewer.find('div[title=\"Go home\"]');\n this.$goHomeButton.attr('tabindex', 0);\n this.$goHomeButton.prop('title', this.content.goHome);\n this.$goHomeButton.addClass('goHome viewportNavButton');\n this.$rotateButton = this.$viewer.find('div[title=\"Rotate right\"]');\n this.$rotateButton.attr('tabindex', 0);\n this.$rotateButton.prop('title', this.content.rotateRight);\n this.$rotateButton.addClass('rotate viewportNavButton');\n this.$viewportNavButtonsContainer = this.$viewer.find('.openseadragon-container > div:not(.openseadragon-canvas):first');\n this.$viewportNavButtons = this.$viewportNavButtonsContainer.find('.viewportNavButton');\n this.$canvas = $(this.viewer.canvas);\n // disable right click on canvas\n this.$canvas.on('contextmenu', function () { return false; });\n this.$navigator = this.$viewer.find(\".navigator\");\n this.setNavigatorVisible();\n // events\n this.$element.on('mousemove', function () {\n if (_this.controlsVisible)\n return;\n _this.controlsVisible = true;\n _this.viewer.setControlsEnabled(true);\n });\n this.$element.on('mouseleave', function () {\n if (!_this.controlsVisible)\n return;\n _this.controlsVisible = false;\n _this.viewer.setControlsEnabled(false);\n });\n // when mouse move stopped\n this.$element.on('mousemove', function () {\n // if over element, hide controls.\n // When over prev/next buttons keep controls enabled\n if (_this.$prevButton.ismouseover()) {\n return;\n }\n if (_this.$nextButton.ismouseover()) {\n return;\n }\n if (!_this.$viewer.find('.navigator').ismouseover()) {\n if (!_this.controlsVisible)\n return;\n _this.controlsVisible = false;\n _this.viewer.setControlsEnabled(false);\n }\n }, this.config.options.controlsFadeAfterInactive);\n this.viewer.addHandler('tile-drawn', function () {\n _this.$spinner.hide();\n });\n //this.viewer.addHandler(\"open-failed\", () => {\n //});\n this.viewer.addHandler('resize', function (viewer) {\n _this.component.publish(Events_1.Events.SEADRAGON_RESIZE, viewer);\n _this.viewerResize(viewer);\n });\n this.viewer.addHandler('animation-start', function (viewer) {\n _this.component.publish(Events_1.Events.SEADRAGON_ANIMATION_START, viewer);\n });\n this.viewer.addHandler('animation', function (viewer) {\n _this.component.publish(Events_1.Events.SEADRAGON_ANIMATION, viewer);\n });\n this.viewer.addHandler('animation-finish', function (viewer) {\n _this.currentBounds = _this.getViewportBounds();\n _this.updateVisibleAnnotationRects();\n _this.component.publish(Events_1.Events.SEADRAGON_ANIMATION_FINISH, viewer);\n });\n this.viewer.addHandler('rotate', function (args) {\n _this.component.publish(Events_1.Events.SEADRAGON_ROTATION, args.degrees);\n });\n this.title = this.extension.helper.getLabel();\n this.createNavigationButtons();\n this.hidePrevButton();\n this.hideNextButton();\n this.isCreated = true;\n this.resize();\n };\n SeadragonCenterPanel.prototype.createNavigationButtons = function () {\n var _this = this;\n var viewingDirection = this.extension.helper.getViewingDirection() || manifesto.ViewingDirection.leftToRight();\n this.$prevButton = $('
                      ');\n if (this.extension.helper.isRightToLeft()) {\n this.$prevButton.prop('title', this.content.next);\n }\n else {\n this.$prevButton.prop('title', this.content.previous);\n }\n this.$nextButton = $('
                      ');\n if (this.extension.helper.isRightToLeft()) {\n this.$nextButton.prop('title', this.content.previous);\n }\n else {\n this.$nextButton.prop('title', this.content.next);\n }\n this.viewer.addControl(this.$prevButton[0], { anchor: OpenSeadragon.ControlAnchor.TOP_LEFT });\n this.viewer.addControl(this.$nextButton[0], { anchor: OpenSeadragon.ControlAnchor.TOP_RIGHT });\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.bottomToTop().toString():\n case manifesto.ViewingDirection.topToBottom().toString():\n this.$prevButton.addClass('vertical');\n this.$nextButton.addClass('vertical');\n ;\n break;\n }\n var that = this;\n this.$prevButton.onPressed(function (e) {\n e.preventDefault();\n OpenSeadragon.cancelEvent(e);\n if (!that.prevButtonEnabled)\n return;\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.leftToRight().toString():\n case manifesto.ViewingDirection.bottomToTop().toString():\n case manifesto.ViewingDirection.topToBottom().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.PREV);\n break;\n case manifesto.ViewingDirection.rightToLeft().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.NEXT);\n break;\n }\n });\n this.$nextButton.onPressed(function (e) {\n e.preventDefault();\n OpenSeadragon.cancelEvent(e);\n if (!that.nextButtonEnabled)\n return;\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.leftToRight().toString():\n case manifesto.ViewingDirection.bottomToTop().toString():\n case manifesto.ViewingDirection.topToBottom().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.NEXT);\n break;\n case manifesto.ViewingDirection.rightToLeft().toString():\n _this.component.publish(BaseEvents_1.BaseEvents.PREV);\n break;\n }\n });\n // When Prev/Next buttons are focused, make sure the controls are enabled\n this.$prevButton.on('focus', function () {\n if (_this.controlsVisible)\n return;\n _this.controlsVisible = true;\n _this.viewer.setControlsEnabled(true);\n });\n this.$nextButton.on('focus', function () {\n if (_this.controlsVisible)\n return;\n _this.controlsVisible = true;\n _this.viewer.setControlsEnabled(true);\n });\n };\n SeadragonCenterPanel.prototype.openMedia = function (resources) {\n var _this = this;\n this.$spinner.show();\n this.items = [];\n this.extension.getExternalResources(resources).then(function (resources) {\n _this.viewer.close();\n resources = _this.getPagePositions(resources);\n for (var i = 0; i < resources.length; i++) {\n var data = resources[i];\n var tileSource = void 0;\n if (data.hasServiceDescriptor) {\n tileSource = data;\n }\n else {\n tileSource = {\n type: 'image',\n url: data.id,\n buildPyramid: false\n };\n }\n _this.viewer.addTiledImage({\n tileSource: tileSource,\n x: data.x,\n y: data.y,\n width: data.width,\n success: function (item) {\n _this.items.push(item);\n if (_this.items.length === resources.length) {\n _this.openPagesHandler();\n }\n _this.resize();\n }\n });\n }\n });\n };\n SeadragonCenterPanel.prototype.getPagePositions = function (resources) {\n var leftPage;\n var rightPage;\n var topPage;\n var bottomPage;\n var page;\n var nextPage;\n // if there's more than one image, determine alignment strategy\n if (resources.length > 1) {\n if (resources.length === 2) {\n // recto verso\n if (this.extension.helper.isVerticallyAligned()) {\n // vertical alignment\n topPage = resources[0];\n topPage.y = 0;\n bottomPage = resources[1];\n bottomPage.y = topPage.height + this.config.options.pageGap;\n }\n else {\n // horizontal alignment\n leftPage = resources[0];\n leftPage.x = 0;\n rightPage = resources[1];\n rightPage.x = leftPage.width + this.config.options.pageGap;\n }\n }\n else {\n // scroll\n if (this.extension.helper.isVerticallyAligned()) {\n // vertical alignment\n if (this.extension.helper.isTopToBottom()) {\n // top to bottom\n for (var i = 0; i < resources.length - 1; i++) {\n page = resources[i];\n nextPage = resources[i + 1];\n nextPage.y = (page.y || 0) + page.height;\n ;\n }\n }\n else {\n // bottom to top\n for (var i = resources.length; i > 0; i--) {\n page = resources[i];\n nextPage = resources[i - 1];\n nextPage.y = (page.y || 0) - page.height;\n }\n }\n }\n else {\n // horizontal alignment\n if (this.extension.helper.isLeftToRight()) {\n // left to right\n for (var i = 0; i < resources.length - 1; i++) {\n page = resources[i];\n nextPage = resources[i + 1];\n nextPage.x = (page.x || 0) + page.width;\n }\n }\n else {\n // right to left\n for (var i = resources.length - 1; i > 0; i--) {\n page = resources[i];\n nextPage = resources[i - 1];\n nextPage.x = (page.x || 0) - page.width;\n }\n }\n }\n }\n }\n return resources;\n };\n SeadragonCenterPanel.prototype.openPagesHandler = function () {\n this.component.publish(Events_1.Events.SEADRAGON_OPEN);\n if (this.extension.helper.isMultiCanvas() && !this.extension.helper.isContinuous()) {\n this.showPrevButton();\n this.showNextButton();\n $('.navigator').addClass('extraMargin');\n var viewingDirection = this.extension.helper.getViewingDirection() || manifesto.ViewingDirection.leftToRight();\n if (viewingDirection.toString() === manifesto.ViewingDirection.rightToLeft().toString()) {\n if (this.extension.helper.isFirstCanvas()) {\n this.disableNextButton();\n }\n else {\n this.enableNextButton();\n }\n if (this.extension.helper.isLastCanvas()) {\n this.disablePrevButton();\n }\n else {\n this.enablePrevButton();\n }\n }\n else {\n if (this.extension.helper.isFirstCanvas()) {\n this.disablePrevButton();\n }\n else {\n this.enablePrevButton();\n }\n if (this.extension.helper.isLastCanvas()) {\n this.disableNextButton();\n }\n else {\n this.enableNextButton();\n }\n }\n }\n this.setNavigatorVisible();\n this.overlayAnnotations();\n this.updateBounds();\n // this only happens if prev/next search result were clicked and caused a reload\n if (this.navigatedFromSearch) {\n this.navigatedFromSearch = false;\n this.zoomToInitialAnnotation();\n }\n this.isFirstLoad = false;\n };\n SeadragonCenterPanel.prototype.zoomToInitialAnnotation = function () {\n var annotationRect = this.getInitialAnnotationRect();\n this.extension.previousAnnotationRect = null;\n this.extension.currentAnnotationRect = null;\n if (annotationRect && this.isZoomToSearchResultEnabled()) {\n this.zoomToAnnotation(annotationRect);\n }\n };\n SeadragonCenterPanel.prototype.overlayAnnotations = function () {\n var annotations = this.getAnnotationsForCurrentImages();\n for (var i = 0; i < annotations.length; i++) {\n var annotation = annotations[i];\n var overlayRects = this.getAnnotationOverlayRects(annotation);\n for (var k = 0; k < overlayRects.length; k++) {\n var overlayRect = overlayRects[k];\n var div = document.createElement('div');\n div.id = 'searchResult-' + overlayRect.canvasIndex + '-' + overlayRect.resultIndex;\n div.className = 'searchOverlay';\n div.title = Utils_1.UVUtils.sanitize(overlayRect.chars);\n this.viewer.addOverlay(div, overlayRect);\n }\n }\n };\n SeadragonCenterPanel.prototype.updateBounds = function () {\n var settings = this.extension.getSettings();\n // if this is the first load and there are initial bounds, fit to those.\n if (this.isFirstLoad) {\n this.initialRotation = this.extension.data.rotation;\n if (this.initialRotation) {\n this.viewer.viewport.setRotation(parseInt(this.initialRotation));\n }\n this.initialBounds = this.extension.data.xywh;\n if (this.initialBounds) {\n this.initialBounds = Bounds_1.Bounds.fromString(this.initialBounds);\n this.currentBounds = this.initialBounds;\n this.fitToBounds(this.currentBounds);\n }\n }\n else if (settings.preserveViewport) {\n this.fitToBounds(this.currentBounds);\n }\n else {\n this.goHome();\n }\n };\n SeadragonCenterPanel.prototype.goHome = function () {\n this.viewer.viewport.goHome(true);\n };\n SeadragonCenterPanel.prototype.disablePrevButton = function () {\n this.prevButtonEnabled = false;\n this.$prevButton.addClass('disabled');\n };\n SeadragonCenterPanel.prototype.enablePrevButton = function () {\n this.prevButtonEnabled = true;\n this.$prevButton.removeClass('disabled');\n };\n SeadragonCenterPanel.prototype.hidePrevButton = function () {\n this.disablePrevButton();\n this.$prevButton.hide();\n };\n SeadragonCenterPanel.prototype.showPrevButton = function () {\n this.enablePrevButton();\n this.$prevButton.show();\n };\n SeadragonCenterPanel.prototype.disableNextButton = function () {\n this.nextButtonEnabled = false;\n this.$nextButton.addClass('disabled');\n };\n SeadragonCenterPanel.prototype.enableNextButton = function () {\n this.nextButtonEnabled = true;\n this.$nextButton.removeClass('disabled');\n };\n SeadragonCenterPanel.prototype.hideNextButton = function () {\n this.disableNextButton();\n this.$nextButton.hide();\n };\n SeadragonCenterPanel.prototype.showNextButton = function () {\n this.enableNextButton();\n this.$nextButton.show();\n };\n SeadragonCenterPanel.prototype.fitToBounds = function (bounds, immediate) {\n if (immediate === void 0) { immediate = true; }\n var rect = new OpenSeadragon.Rect();\n rect.x = Number(bounds.x);\n rect.y = Number(bounds.y);\n rect.width = Number(bounds.w);\n rect.height = Number(bounds.h);\n this.viewer.viewport.fitBoundsWithConstraints(rect, immediate);\n };\n SeadragonCenterPanel.prototype.getCroppedImageBounds = function () {\n if (!this.viewer || !this.viewer.viewport)\n return null;\n var canvas = this.extension.helper.getCurrentCanvas();\n var dimensions = this.extension.getCroppedImageDimensions(canvas, this.viewer);\n if (dimensions) {\n var bounds = new Bounds_1.Bounds(dimensions.regionPos.x, dimensions.regionPos.y, dimensions.region.width, dimensions.region.height);\n return bounds.toString();\n }\n return null;\n };\n SeadragonCenterPanel.prototype.getViewportBounds = function () {\n if (!this.viewer || !this.viewer.viewport)\n return null;\n var b = this.viewer.viewport.getBounds(true);\n var bounds = new Bounds_1.Bounds(Math.floor(b.x), Math.floor(b.y), Math.floor(b.width), Math.floor(b.height));\n return bounds;\n };\n SeadragonCenterPanel.prototype.viewerResize = function (viewer) {\n if (!viewer.viewport)\n return;\n var center = viewer.viewport.getCenter(true);\n if (!center)\n return;\n // postpone pan for a millisecond - fixes iPad image stretching/squashing issue.\n setTimeout(function () {\n viewer.viewport.panTo(center, true);\n }, 1);\n };\n SeadragonCenterPanel.prototype.clearAnnotations = function () {\n this.$canvas.find('.searchOverlay').hide();\n };\n SeadragonCenterPanel.prototype.getAnnotationsForCurrentImages = function () {\n var annotationsForCurrentImages = [];\n var annotations = this.extension.annotations;\n if (!annotations || !annotations.length)\n return annotationsForCurrentImages;\n var indices = this.extension.getPagedIndices();\n for (var i = 0; i < indices.length; i++) {\n var canvasIndex = indices[i];\n for (var j = 0; j < annotations.length; j++) {\n if (annotations[j].canvasIndex === canvasIndex) {\n annotationsForCurrentImages.push(annotations[j]);\n break;\n }\n }\n }\n return annotationsForCurrentImages;\n };\n SeadragonCenterPanel.prototype.getAnnotationRectsForCurrentImages = function () {\n var annotations = this.getAnnotationsForCurrentImages();\n return annotations.en().selectMany(function (x) { return x.rects; }).toArray();\n };\n SeadragonCenterPanel.prototype.updateVisibleAnnotationRects = function () {\n // after animating, loop through all search result rects and flag their visibility based on whether they are inside the current viewport.\n var annotationRects = this.getAnnotationRectsForCurrentImages();\n for (var i = 0; i < annotationRects.length; i++) {\n var rect = annotationRects[i];\n var viewportBounds = this.viewer.viewport.getBounds();\n rect.isVisible = Utils.Dimensions.hitRect(viewportBounds.x, viewportBounds.y, viewportBounds.width, viewportBounds.height, rect.viewportX, rect.viewportY);\n }\n };\n SeadragonCenterPanel.prototype.getAnnotationRectIndex = function (annotationRect) {\n var annotationRects = this.getAnnotationRectsForCurrentImages();\n return annotationRects.indexOf(annotationRect);\n };\n SeadragonCenterPanel.prototype.isZoomToSearchResultEnabled = function () {\n return Utils.Bools.getBool(this.extension.data.config.options.zoomToSearchResultEnabled, true);\n };\n SeadragonCenterPanel.prototype.prevAnnotation = function () {\n var annotationRects = this.getAnnotationRectsForCurrentImages();\n var currentAnnotationRect = this.extension.currentAnnotationRect;\n var currentAnnotationRectIndex = currentAnnotationRect ? this.getAnnotationRectIndex(currentAnnotationRect) : annotationRects.length;\n //const currentAnnotationRectIndex: number = this.getAnnotationRectIndex(currentAnnotationRect);\n var foundRect = null;\n // if there's no currentAnnotationRect selected, index is the total available annotation rects for the current images.\n // minusing 1 makes the index the last of the available rects for the current images.\n for (var i = currentAnnotationRectIndex - 1; i >= 0; i--) {\n var rect = annotationRects[i];\n // this was removed as users found it confusing.\n // find the prev visible or non-visible rect.\n //if (rect.isVisible) {\n // continue;\n //} else {\n foundRect = rect;\n break;\n //}\n }\n if (foundRect && this.isZoomToSearchResultEnabled()) {\n // if the rect's canvasIndex is less than the current canvasIndex\n if (foundRect.canvasIndex < this.extension.helper.canvasIndex) {\n this.extension.currentAnnotationRect = foundRect;\n this.navigatedFromSearch = true;\n this.component.publish(BaseEvents_1.BaseEvents.ANNOTATION_CANVAS_CHANGED, foundRect);\n }\n else {\n this.zoomToAnnotation(foundRect);\n }\n }\n else {\n this.navigatedFromSearch = true;\n this.component.publish(Events_1.Events.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE);\n }\n };\n SeadragonCenterPanel.prototype.nextAnnotation = function () {\n var annotationRects = this.getAnnotationRectsForCurrentImages();\n var currentAnnotationRect = this.extension.currentAnnotationRect;\n var currentAnnotationRectIndex = currentAnnotationRect ? this.getAnnotationRectIndex(currentAnnotationRect) : -1;\n var foundRect = null;\n // if there's no currentAnnotationRect selected, index is -1.\n // adding 1 makes the index 0 of available rects for the current images.\n for (var i = currentAnnotationRectIndex + 1; i < annotationRects.length; i++) {\n var rect = annotationRects[i];\n // this was removed as users found it confusing.\n // find the next visible or non-visible rect.\n //if (rect.isVisible) {\n // continue;\n //} else {\n foundRect = rect;\n break;\n //}\n }\n if (foundRect && this.isZoomToSearchResultEnabled()) {\n // if the rect's canvasIndex is greater than the current canvasIndex\n if (foundRect.canvasIndex > this.extension.helper.canvasIndex) {\n this.extension.currentAnnotationRect = foundRect;\n this.navigatedFromSearch = true;\n this.component.publish(BaseEvents_1.BaseEvents.ANNOTATION_CANVAS_CHANGED, [foundRect]);\n }\n else {\n this.zoomToAnnotation(foundRect);\n }\n }\n else {\n this.navigatedFromSearch = true;\n this.component.publish(Events_1.Events.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE);\n }\n };\n SeadragonCenterPanel.prototype.getAnnotationRectByIndex = function (index) {\n var annotationRects = this.getAnnotationRectsForCurrentImages();\n if (!annotationRects.length)\n return null;\n return annotationRects[index];\n };\n SeadragonCenterPanel.prototype.getInitialAnnotationRect = function () {\n var _this = this;\n var annotationRects = this.getAnnotationRectsForCurrentImages();\n if (!annotationRects.length)\n return null;\n // if we've got this far it means that a reload has happened\n // check if the lastCanvasIndex is greater or less than the current canvasIndex\n // if greater than, select the last annotation on the current page\n // if less than, select the first annotation on the current page\n // otherwise default to the first annotation\n var previousAnnotationRect = this.extension.previousAnnotationRect;\n if (!previousAnnotationRect) {\n if (this.extension.lastCanvasIndex > this.extension.helper.canvasIndex) {\n return annotationRects.en().where(function (x) { return x.canvasIndex === _this.extension.helper.canvasIndex; }).last();\n }\n }\n return annotationRects.en().where(function (x) { return x.canvasIndex === _this.extension.helper.canvasIndex; }).first();\n };\n SeadragonCenterPanel.prototype.zoomToAnnotation = function (annotationRect) {\n this.extension.previousAnnotationRect = this.extension.currentAnnotationRect || annotationRect;\n this.extension.currentAnnotationRect = annotationRect;\n // if zoomToBoundsEnabled, zoom to the annotation's bounds.\n // otherwise, pan into view preserving the current zoom level.\n if (Utils.Bools.getBool(this.extension.data.config.options.zoomToBoundsEnabled, false)) {\n this.fitToBounds(new Bounds_1.Bounds(annotationRect.viewportX, annotationRect.viewportY, annotationRect.width, annotationRect.height), false);\n }\n else {\n var x = annotationRect.viewportX - ((this.currentBounds.w * 0.5) - annotationRect.width * 0.5);\n var y = annotationRect.viewportY - ((this.currentBounds.h * 0.5) - annotationRect.height * 0.5);\n var w = this.currentBounds.w;\n var h = this.currentBounds.h;\n var bounds = new Bounds_1.Bounds(x, y, w, h);\n this.fitToBounds(bounds);\n }\n this.highlightAnnotationRect(annotationRect);\n this.component.publish(BaseEvents_1.BaseEvents.ANNOTATION_CHANGED);\n };\n SeadragonCenterPanel.prototype.highlightAnnotationRect = function (annotationRect) {\n var $rect = $('#searchResult-' + annotationRect.canvasIndex + '-' + annotationRect.index);\n $rect.addClass('current');\n $('.searchOverlay').not($rect).removeClass('current');\n };\n SeadragonCenterPanel.prototype.getAnnotationOverlayRects = function (annotationGroup) {\n var newRects = [];\n if (!this.extension.resources) {\n return newRects;\n }\n var resource = this.extension.resources.en().where(function (x) { return x.index === annotationGroup.canvasIndex; }).first();\n var index = this.extension.resources.indexOf(resource);\n var offsetX = 0;\n if (index > 0) {\n offsetX = this.extension.resources[index - 1].width;\n }\n for (var i = 0; i < annotationGroup.rects.length; i++) {\n var searchRect = annotationGroup.rects[i];\n var x = (searchRect.x + offsetX) + ((index > 0) ? this.config.options.pageGap : 0);\n var y = searchRect.y;\n var w = searchRect.width;\n var h = searchRect.height;\n var rect = new OpenSeadragon.Rect(x, y, w, h);\n searchRect.viewportX = x;\n searchRect.viewportY = y;\n rect.canvasIndex = searchRect.canvasIndex;\n rect.resultIndex = searchRect.index;\n rect.chars = searchRect.chars;\n newRects.push(rect);\n }\n return newRects;\n };\n SeadragonCenterPanel.prototype.resize = function () {\n var _this = this;\n _super.prototype.resize.call(this);\n this.$viewer.height(this.$content.height() - this.$viewer.verticalMargins());\n this.$viewer.width(this.$content.width() - this.$viewer.horizontalMargins());\n if (!this.isCreated)\n return;\n if (this.title) {\n this.$title.text(Utils_1.UVUtils.sanitize(this.title));\n }\n this.$spinner.css('top', (this.$content.height() / 2) - (this.$spinner.height() / 2));\n this.$spinner.css('left', (this.$content.width() / 2) - (this.$spinner.width() / 2));\n var viewingDirection = this.extension.helper.getViewingDirection() || manifesto.ViewingDirection.leftToRight();\n ;\n if (this.extension.helper.isMultiCanvas() && this.$prevButton && this.$nextButton) {\n var verticalButtonPos = Math.floor(this.$content.width() / 2);\n switch (viewingDirection.toString()) {\n case manifesto.ViewingDirection.bottomToTop().toString():\n this.$prevButton.addClass('down');\n this.$nextButton.addClass('up');\n this.$prevButton.css('left', verticalButtonPos - (this.$prevButton.outerWidth() / 2));\n this.$prevButton.css('top', (this.$content.height() - this.$prevButton.height()));\n this.$nextButton.css('left', (verticalButtonPos * -1) - (this.$nextButton.outerWidth() / 2));\n break;\n case manifesto.ViewingDirection.topToBottom().toString():\n this.$prevButton.css('left', verticalButtonPos - (this.$prevButton.outerWidth() / 2));\n this.$nextButton.css('left', (verticalButtonPos * -1) - (this.$nextButton.outerWidth() / 2));\n this.$nextButton.css('top', (this.$content.height() - this.$nextButton.height()));\n break;\n default:\n this.$prevButton.css('top', (this.$content.height() - this.$prevButton.height()) / 2);\n this.$nextButton.css('top', (this.$content.height() - this.$nextButton.height()) / 2);\n break;\n }\n }\n // stretch navigator, allowing time for OSD to resize\n setTimeout(function () {\n if (_this.extension.helper.isContinuous()) {\n if (_this.extension.helper.isHorizontallyAligned()) {\n var width = _this.$viewer.width() - _this.$viewer.rightMargin();\n _this.$navigator.width(width);\n }\n else {\n _this.$navigator.height(_this.$viewer.height());\n }\n }\n }, 100);\n };\n SeadragonCenterPanel.prototype.setFocus = function () {\n if (!this.$canvas.is(\":focus\")) {\n if (this.extension.data.config.options.allowStealFocus) {\n this.$canvas.focus();\n }\n }\n };\n SeadragonCenterPanel.prototype.setNavigatorVisible = function () {\n var navigatorEnabled = Utils.Bools.getBool(this.extension.getSettings().navigatorEnabled, true) && this.extension.isDesktopMetric();\n this.viewer.navigator.setVisible(navigatorEnabled);\n if (navigatorEnabled) {\n this.$navigator.show();\n }\n else {\n this.$navigator.hide();\n }\n };\n return SeadragonCenterPanel;\n }(CenterPanel_1.CenterPanel));\n exports.SeadragonCenterPanel = SeadragonCenterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-seadragon-extension/SettingsDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/SettingsDialogue\"], function (require, exports, SettingsDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SettingsDialogue = /** @class */ (function (_super) {\n __extends(SettingsDialogue, _super);\n function SettingsDialogue($element) {\n return _super.call(this, $element) || this;\n }\n SettingsDialogue.prototype.create = function () {\n var _this = this;\n this.setConfig('settingsDialogue');\n _super.prototype.create.call(this);\n this.$navigatorEnabled = $('
                      ');\n this.$scroll.append(this.$navigatorEnabled);\n // todo: use .checkboxButton jquery extension\n this.$navigatorEnabledCheckbox = $('');\n this.$navigatorEnabled.append(this.$navigatorEnabledCheckbox);\n this.$navigatorEnabledLabel = $('');\n this.$navigatorEnabled.append(this.$navigatorEnabledLabel);\n this.$pagingEnabled = $('
                      ');\n this.$scroll.append(this.$pagingEnabled);\n this.$pagingEnabledCheckbox = $('');\n this.$pagingEnabled.append(this.$pagingEnabledCheckbox);\n this.$pagingEnabledLabel = $('');\n this.$pagingEnabled.append(this.$pagingEnabledLabel);\n this.$clickToZoomEnabled = $('
                      ');\n this.$scroll.append(this.$clickToZoomEnabled);\n this.$clickToZoomEnabledCheckbox = $('');\n this.$clickToZoomEnabled.append(this.$clickToZoomEnabledCheckbox);\n this.$clickToZoomEnabledLabel = $('');\n this.$clickToZoomEnabled.append(this.$clickToZoomEnabledLabel);\n this.$preserveViewport = $('
                      ');\n this.$scroll.append(this.$preserveViewport);\n this.$preserveViewportCheckbox = $('');\n this.$preserveViewport.append(this.$preserveViewportCheckbox);\n this.$preserveViewportLabel = $('');\n this.$preserveViewport.append(this.$preserveViewportLabel);\n this.$navigatorEnabledCheckbox.change(function () {\n var settings = {};\n if (_this.$navigatorEnabledCheckbox.is(\":checked\")) {\n settings.navigatorEnabled = true;\n }\n else {\n settings.navigatorEnabled = false;\n }\n _this.updateSettings(settings);\n });\n this.$clickToZoomEnabledCheckbox.change(function () {\n var settings = {};\n if (_this.$clickToZoomEnabledCheckbox.is(\":checked\")) {\n settings.clickToZoomEnabled = true;\n }\n else {\n settings.clickToZoomEnabled = false;\n }\n _this.updateSettings(settings);\n });\n this.$pagingEnabledCheckbox.change(function () {\n var settings = {};\n if (_this.$pagingEnabledCheckbox.is(\":checked\")) {\n settings.pagingEnabled = true;\n }\n else {\n settings.pagingEnabled = false;\n }\n _this.updateSettings(settings);\n });\n this.$preserveViewportCheckbox.change(function () {\n var settings = {};\n if (_this.$preserveViewportCheckbox.is(\":checked\")) {\n settings.preserveViewport = true;\n }\n else {\n settings.preserveViewport = false;\n }\n _this.updateSettings(settings);\n });\n };\n SettingsDialogue.prototype.open = function () {\n _super.prototype.open.call(this);\n var settings = this.getSettings();\n if (settings.navigatorEnabled) {\n this.$navigatorEnabledCheckbox.prop(\"checked\", true);\n }\n else {\n this.$navigatorEnabledCheckbox.removeAttr(\"checked\");\n }\n if (settings.clickToZoomEnabled) {\n this.$clickToZoomEnabledCheckbox.prop(\"checked\", true);\n }\n else {\n this.$clickToZoomEnabledCheckbox.removeAttr(\"checked\");\n }\n if (!this.extension.helper.isPagingAvailable()) {\n this.$pagingEnabled.hide();\n }\n else {\n if (settings.pagingEnabled) {\n this.$pagingEnabledCheckbox.prop(\"checked\", true);\n }\n else {\n this.$pagingEnabledCheckbox.removeAttr(\"checked\");\n }\n }\n if (settings.preserveViewport) {\n this.$preserveViewportCheckbox.prop(\"checked\", true);\n }\n else {\n this.$preserveViewportCheckbox.removeAttr(\"checked\");\n }\n };\n return SettingsDialogue;\n }(SettingsDialogue_1.SettingsDialogue));\n exports.SettingsDialogue = SettingsDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-seadragon-extension/ShareDialogue',[\"require\", \"exports\", \"./Events\", \"../../modules/uv-dialogues-module/ShareDialogue\"], function (require, exports, Events_1, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ShareDialogue = /** @class */ (function (_super) {\n __extends(ShareDialogue, _super);\n function ShareDialogue($element) {\n var _this = _super.call(this, $element) || this;\n _this.component.subscribe(Events_1.Events.SEADRAGON_OPEN, function () {\n _this.update();\n });\n _this.component.subscribe(Events_1.Events.SEADRAGON_ANIMATION_FINISH, function () {\n _this.update();\n });\n return _this;\n }\n ShareDialogue.prototype.create = function () {\n this.setConfig('shareDialogue');\n _super.prototype.create.call(this);\n };\n ShareDialogue.prototype.update = function () {\n _super.prototype.update.call(this);\n var xywh = this.extension.getViewportBounds();\n var rotation = this.extension.getViewerRotation();\n this.code = this.extension.getEmbedScript(this.options.embedTemplate, this.currentWidth, this.currentHeight, xywh, rotation);\n this.$code.val(this.code);\n };\n ShareDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ShareDialogue;\n }(ShareDialogue_1.ShareDialogue));\n exports.ShareDialogue = ShareDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-seadragon-extension/Extension',[\"require\", \"exports\", \"../../modules/uv-shared-module/AnnotationResults\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-shared-module/BaseExtension\", \"../../modules/uv-shared-module/Bookmark\", \"../../modules/uv-contentleftpanel-module/ContentLeftPanel\", \"./CroppedImageDimensions\", \"./DownloadDialogue\", \"./Events\", \"../../modules/uv-dialogues-module/ExternalContentDialogue\", \"../../modules/uv-osdmobilefooterpanel-module/MobileFooter\", \"../../modules/uv-searchfooterpanel-module/FooterPanel\", \"../../modules/uv-dialogues-module/HelpDialogue\", \"./Mode\", \"../../modules/uv-dialogues-module/MoreInfoDialogue\", \"../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel\", \"../../modules/uv-multiselectdialogue-module/MultiSelectDialogue\", \"./MultiSelectionArgs\", \"../../modules/uv-pagingheaderpanel-module/PagingHeaderPanel\", \"../../modules/uv-shared-module/Point\", \"../../modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel\", \"./SettingsDialogue\", \"./ShareDialogue\"], function (require, exports, AnnotationResults_1, BaseEvents_1, BaseExtension_1, Bookmark_1, ContentLeftPanel_1, CroppedImageDimensions_1, DownloadDialogue_1, Events_1, ExternalContentDialogue_1, MobileFooter_1, FooterPanel_1, HelpDialogue_1, Mode_1, MoreInfoDialogue_1, MoreInfoRightPanel_1, MultiSelectDialogue_1, MultiSelectionArgs_1, PagingHeaderPanel_1, Point_1, SeadragonCenterPanel_1, SettingsDialogue_1, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var AnnotationGroup = Manifold.AnnotationGroup;\n var Extension = /** @class */ (function (_super) {\n __extends(Extension, _super);\n function Extension() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.annotations = [];\n _this.currentRotation = 0;\n _this.isAnnotating = false;\n return _this;\n }\n Extension.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.METRIC_CHANGED, function () {\n if (!_this.isDesktopMetric()) {\n var settings = {};\n settings.pagingEnabled = false;\n _this.updateSettings(settings);\n _this.component.publish(BaseEvents_1.BaseEvents.UPDATE_SETTINGS);\n _this.shell.$rightPanel.hide();\n }\n else {\n _this.shell.$rightPanel.show();\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.previousAnnotationRect = null;\n _this.currentAnnotationRect = null;\n _this.viewPage(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CLEAR_ANNOTATIONS, function () {\n _this.clearAnnotations();\n _this.component.publish(BaseEvents_1.BaseEvents.ANNOTATIONS_CLEARED);\n _this.fire(BaseEvents_1.BaseEvents.CLEAR_ANNOTATIONS);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.DOWN_ARROW, function () {\n if (!_this.useArrowKeysToNavigate()) {\n _this.centerPanel.setFocus();\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.END, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.helper.getLastPageIndex());\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.FIRST, function () {\n _this.fire(BaseEvents_1.BaseEvents.FIRST);\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.helper.getFirstPageIndex());\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.GALLERY_DECREASE_SIZE, function () {\n _this.fire(BaseEvents_1.BaseEvents.GALLERY_DECREASE_SIZE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.GALLERY_INCREASE_SIZE, function () {\n _this.fire(BaseEvents_1.BaseEvents.GALLERY_INCREASE_SIZE);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.GALLERY_THUMB_SELECTED, function () {\n _this.fire(BaseEvents_1.BaseEvents.GALLERY_THUMB_SELECTED);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HOME, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.helper.getFirstPageIndex());\n });\n this.component.subscribe(Events_1.Events.IMAGE_SEARCH, function (index) {\n _this.fire(Events_1.Events.IMAGE_SEARCH, index);\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, index);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LAST, function () {\n _this.fire(BaseEvents_1.BaseEvents.LAST);\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.helper.getLastPageIndex());\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFT_ARROW, function () {\n if (_this.useArrowKeysToNavigate()) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.getPrevPageIndex());\n }\n else {\n _this.centerPanel.setFocus();\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_START, function () {\n if (_this.isDesktopMetric()) {\n _this.shell.$rightPanel.show();\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_FINISH, function () {\n _this.shell.$centerPanel.show();\n _this.resize();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START, function () {\n _this.shell.$centerPanel.hide();\n _this.shell.$rightPanel.hide();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.MINUS, function () {\n _this.centerPanel.setFocus();\n });\n this.component.subscribe(Events_1.Events.MODE_CHANGED, function (mode) {\n _this.fire(Events_1.Events.MODE_CHANGED, mode);\n _this.mode = new Mode_1.Mode(mode);\n var settings = _this.getSettings();\n _this.component.publish(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, settings);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.MULTISELECTION_MADE, function (ids) {\n var args = new MultiSelectionArgs_1.MultiSelectionArgs();\n args.manifestUri = _this.helper.iiifResourceUri;\n args.allCanvases = ids.length === _this.helper.getCanvases().length;\n args.canvases = ids;\n args.format = _this.data.config.options.multiSelectionMimeType;\n args.sequence = _this.helper.getCurrentSequence().id;\n _this.fire(BaseEvents_1.BaseEvents.MULTISELECTION_MADE, args);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.NEXT, function () {\n _this.fire(BaseEvents_1.BaseEvents.NEXT);\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.getNextPageIndex());\n });\n this.component.subscribe(Events_1.Events.NEXT_SEARCH_RESULT, function () {\n _this.fire(Events_1.Events.NEXT_SEARCH_RESULT);\n });\n this.component.subscribe(Events_1.Events.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE, function () {\n _this.fire(Events_1.Events.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE);\n _this.nextSearchResult();\n });\n this.component.subscribe(Events_1.Events.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE, function () {\n _this.fire(Events_1.Events.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE);\n _this.prevSearchResult();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_THUMBS_VIEW, function () {\n _this.fire(BaseEvents_1.BaseEvents.OPEN_THUMBS_VIEW);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_TREE_VIEW, function () {\n _this.fire(BaseEvents_1.BaseEvents.OPEN_TREE_VIEW);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.PAGE_DOWN, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.getNextPageIndex());\n });\n this.component.subscribe(Events_1.Events.PAGE_SEARCH, function (value) {\n _this.fire(Events_1.Events.PAGE_SEARCH, value);\n _this.viewLabel(value);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.PAGE_UP, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.getPrevPageIndex());\n });\n this.component.subscribe(Events_1.Events.PAGING_TOGGLED, function (obj) {\n _this.fire(Events_1.Events.PAGING_TOGGLED, obj);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.PLUS, function () {\n _this.centerPanel.setFocus();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.PREV, function () {\n _this.fire(BaseEvents_1.BaseEvents.PREV);\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.getPrevPageIndex());\n });\n this.component.subscribe(Events_1.Events.PREV_SEARCH_RESULT, function () {\n _this.fire(Events_1.Events.PREV_SEARCH_RESULT);\n });\n this.component.subscribe(Events_1.Events.PRINT, function () {\n _this.print();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RELOAD, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.CLEAR_ANNOTATIONS);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.RIGHT_ARROW, function () {\n if (_this.useArrowKeysToNavigate()) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.getNextPageIndex());\n }\n else {\n _this.centerPanel.setFocus();\n }\n });\n this.component.subscribe(Events_1.Events.SEADRAGON_ANIMATION, function () {\n _this.fire(Events_1.Events.SEADRAGON_ANIMATION);\n });\n this.component.subscribe(Events_1.Events.SEADRAGON_ANIMATION_FINISH, function (viewer) {\n var bounds = _this.centerPanel.getViewportBounds();\n if (_this.centerPanel && bounds) {\n _this.component.publish(Events_1.Events.XYWH_CHANGED, bounds.toString());\n _this.data.xywh = bounds.toString();\n _this.fire(Events_1.Events.XYWH_CHANGED, _this.data.xywh);\n }\n var canvas = _this.helper.getCurrentCanvas();\n _this.fire(Events_1.Events.CURRENT_VIEW_URI, {\n cropUri: _this.getCroppedImageUri(canvas, _this.getViewer()),\n fullUri: _this.getConfinedImageUri(canvas, canvas.getWidth())\n });\n });\n this.component.subscribe(Events_1.Events.SEADRAGON_ANIMATION_START, function () {\n _this.fire(Events_1.Events.SEADRAGON_ANIMATION_START);\n });\n this.component.subscribe(Events_1.Events.SEADRAGON_OPEN, function () {\n if (!_this.useArrowKeysToNavigate()) {\n _this.centerPanel.setFocus();\n }\n _this.fire(Events_1.Events.SEADRAGON_OPEN);\n });\n this.component.subscribe(Events_1.Events.SEADRAGON_RESIZE, function () {\n _this.fire(Events_1.Events.SEADRAGON_RESIZE);\n });\n this.component.subscribe(Events_1.Events.SEADRAGON_ROTATION, function (rotation) {\n _this.data.rotation = rotation;\n _this.fire(Events_1.Events.SEADRAGON_ROTATION, _this.data.rotation);\n _this.currentRotation = rotation;\n });\n this.component.subscribe(Events_1.Events.SEARCH, function (terms) {\n _this.fire(Events_1.Events.SEARCH, terms);\n _this.search(terms);\n });\n this.component.subscribe(Events_1.Events.SEARCH_PREVIEW_FINISH, function () {\n _this.fire(Events_1.Events.SEARCH_PREVIEW_FINISH);\n });\n this.component.subscribe(Events_1.Events.SEARCH_PREVIEW_START, function () {\n _this.fire(Events_1.Events.SEARCH_PREVIEW_START);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS, function (obj) {\n _this.fire(BaseEvents_1.BaseEvents.ANNOTATIONS, obj);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATION_CANVAS_CHANGED, function (rect) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, rect.canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.ANNOTATIONS_EMPTY, function () {\n _this.fire(BaseEvents_1.BaseEvents.ANNOTATIONS_EMPTY);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.THUMB_SELECTED, function (thumb) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, thumb.index);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.TREE_NODE_SELECTED, function (node) {\n _this.fire(BaseEvents_1.BaseEvents.TREE_NODE_SELECTED, node.data.path);\n _this.treeNodeSelected(node);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.UP_ARROW, function () {\n if (!_this.useArrowKeysToNavigate()) {\n _this.centerPanel.setFocus();\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.UPDATE_SETTINGS, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, _this.helper.canvasIndex);\n var settings = _this.getSettings();\n _this.component.publish(BaseEvents_1.BaseEvents.SETTINGS_CHANGED, settings);\n });\n // this.component.subscribe(Events.VIEW_PAGE, (e: any, index: number) => {\n // this.fire(Events.VIEW_PAGE, index);\n // this.component.publish(BaseEvents.CANVAS_INDEX_CHANGED, [index]);\n // });\n };\n Extension.prototype.createModules = function () {\n _super.prototype.createModules.call(this);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel = new PagingHeaderPanel_1.PagingHeaderPanel(this.shell.$headerPanel);\n }\n else {\n this.shell.$headerPanel.hide();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel = new ContentLeftPanel_1.ContentLeftPanel(this.shell.$leftPanel);\n }\n else {\n this.shell.$leftPanel.hide();\n }\n this.centerPanel = new SeadragonCenterPanel_1.SeadragonCenterPanel(this.shell.$centerPanel);\n if (this.isRightPanelEnabled()) {\n this.rightPanel = new MoreInfoRightPanel_1.MoreInfoRightPanel(this.shell.$rightPanel);\n }\n else {\n this.shell.$rightPanel.hide();\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel = new FooterPanel_1.FooterPanel(this.shell.$footerPanel);\n this.mobileFooterPanel = new MobileFooter_1.FooterPanel(this.shell.$mobileFooterPanel);\n }\n else {\n this.shell.$footerPanel.hide();\n }\n this.$helpDialogue = $('
                      ');\n this.shell.$overlays.append(this.$helpDialogue);\n this.helpDialogue = new HelpDialogue_1.HelpDialogue(this.$helpDialogue);\n this.$moreInfoDialogue = $('
                      ');\n this.shell.$overlays.append(this.$moreInfoDialogue);\n this.moreInfoDialogue = new MoreInfoDialogue_1.MoreInfoDialogue(this.$moreInfoDialogue);\n this.$multiSelectDialogue = $('
                      ');\n this.shell.$overlays.append(this.$multiSelectDialogue);\n this.multiSelectDialogue = new MultiSelectDialogue_1.MultiSelectDialogue(this.$multiSelectDialogue);\n this.$shareDialogue = $('
                      ');\n this.shell.$overlays.append(this.$shareDialogue);\n this.shareDialogue = new ShareDialogue_1.ShareDialogue(this.$shareDialogue);\n this.$downloadDialogue = $('
                      ');\n this.shell.$overlays.append(this.$downloadDialogue);\n this.downloadDialogue = new DownloadDialogue_1.DownloadDialogue(this.$downloadDialogue);\n this.$settingsDialogue = $('
                      ');\n this.shell.$overlays.append(this.$settingsDialogue);\n this.settingsDialogue = new SettingsDialogue_1.SettingsDialogue(this.$settingsDialogue);\n this.$externalContentDialogue = $('
                      ');\n this.shell.$overlays.append(this.$externalContentDialogue);\n this.externalContentDialogue = new ExternalContentDialogue_1.ExternalContentDialogue(this.$externalContentDialogue);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel.init();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel.init();\n }\n if (this.isRightPanelEnabled()) {\n this.rightPanel.init();\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel.init();\n }\n };\n Extension.prototype.render = function () {\n _super.prototype.render.call(this);\n //Utils.Async.waitFor(() => {\n // return this.centerPanel && this.centerPanel.isCreated;\n //}, () => {\n this.checkForAnnotations();\n this.checkForSearchParam();\n this.checkForRotationParam();\n //});\n };\n Extension.prototype.checkForAnnotations = function () {\n if (this.data.annotations) {\n var annotations = this.parseAnnotationList(this.data.annotations);\n this.component.publish(BaseEvents_1.BaseEvents.CLEAR_ANNOTATIONS);\n this.annotate(annotations);\n }\n };\n Extension.prototype.annotate = function (annotations, terms) {\n this.annotations = annotations;\n // sort the annotations by canvasIndex\n this.annotations = annotations.sort(function (a, b) {\n return a.canvasIndex - b.canvasIndex;\n });\n var annotationResults = new AnnotationResults_1.AnnotationResults();\n annotationResults.terms = terms;\n annotationResults.annotations = this.annotations;\n this.component.publish(BaseEvents_1.BaseEvents.ANNOTATIONS, annotationResults);\n // reload current index as it may contain annotations.\n //this.component.publish(BaseEvents.CANVAS_INDEX_CHANGED, [this.helper.canvasIndex]);\n };\n Extension.prototype.checkForSearchParam = function () {\n // if a highlight param is set, use it to search.\n var highlight = this.data.highlight;\n if (highlight) {\n highlight.replace(/\\+/g, \" \").replace(/\"/g, \"\");\n this.component.publish(Events_1.Events.SEARCH, highlight);\n }\n };\n Extension.prototype.checkForRotationParam = function () {\n // if a rotation value is passed, set rotation\n var rotation = this.data.rotation;\n if (rotation) {\n this.component.publish(Events_1.Events.SEADRAGON_ROTATION, rotation);\n }\n };\n Extension.prototype.viewPage = function (canvasIndex) {\n // if it's an invalid canvas index.\n if (canvasIndex === -1)\n return;\n var isReload = false;\n if (canvasIndex === this.helper.canvasIndex) {\n isReload = true;\n }\n if (this.helper.isCanvasIndexOutOfRange(canvasIndex)) {\n this.showMessage(this.data.config.content.canvasIndexOutOfRange);\n canvasIndex = 0;\n }\n if (this.isPagingSettingEnabled() && !isReload) {\n var indices = this.getPagedIndices(canvasIndex);\n // if the page is already displayed, only advance canvasIndex.\n if (indices.includes(this.helper.canvasIndex)) {\n this.viewCanvas(canvasIndex);\n return;\n }\n }\n this.viewCanvas(canvasIndex);\n };\n Extension.prototype.getViewer = function () {\n return this.centerPanel.viewer;\n };\n Extension.prototype.getMode = function () {\n if (this.mode)\n return this.mode;\n switch (this.helper.getManifestType().toString()) {\n case manifesto.ManifestType.monograph().toString():\n return Mode_1.Mode.page;\n case manifesto.ManifestType.manuscript().toString():\n return Mode_1.Mode.page;\n default:\n return Mode_1.Mode.image;\n }\n };\n Extension.prototype.getViewportBounds = function () {\n if (!this.centerPanel)\n return null;\n var bounds = this.centerPanel.getViewportBounds();\n if (bounds) {\n return bounds.toString();\n }\n return null;\n };\n Extension.prototype.getViewerRotation = function () {\n if (!this.centerPanel)\n return null;\n return this.currentRotation;\n };\n Extension.prototype.viewRange = function (path) {\n //this.currentRangePath = path;\n var range = this.helper.getRangeByPath(path);\n if (!range)\n return;\n var canvasId = range.getCanvasIds()[0];\n var index = this.helper.getCanvasIndexById(canvasId);\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, index);\n };\n Extension.prototype.viewLabel = function (label) {\n if (!label) {\n this.showMessage(this.data.config.modules.genericDialogue.content.emptyValue);\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED);\n return;\n }\n var index = this.helper.getCanvasIndexByLabel(label);\n if (index != -1) {\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, index);\n }\n else {\n this.showMessage(this.data.config.modules.genericDialogue.content.pageNotFound);\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGE_FAILED);\n }\n };\n Extension.prototype.treeNodeSelected = function (node) {\n var data = node.data;\n if (!data.type)\n return;\n switch (data.type) {\n case manifesto.IIIFResourceType.manifest().toString():\n this.viewManifest(data);\n break;\n case manifesto.IIIFResourceType.collection().toString():\n // note: this won't get called as the tree component now has branchNodesSelectable = false\n // useful to keep around for reference\n this.viewCollection(data);\n break;\n default:\n this.viewRange(data.path);\n break;\n }\n };\n Extension.prototype.clearAnnotations = function () {\n this.annotations = null;\n // reload current index as it may contain results.\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, this.helper.canvasIndex);\n };\n Extension.prototype.prevSearchResult = function () {\n var foundResult;\n if (!this.annotations)\n return;\n // get the first result with a canvasIndex less than the current index.\n for (var i = this.annotations.length - 1; i >= 0; i--) {\n var result = this.annotations[i];\n if (result.canvasIndex <= this.getPrevPageIndex()) {\n foundResult = result;\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, foundResult.canvasIndex);\n break;\n }\n }\n };\n Extension.prototype.nextSearchResult = function () {\n if (!this.annotations)\n return;\n // get the first result with an index greater than the current index.\n for (var i = 0; i < this.annotations.length; i++) {\n var result = this.annotations[i];\n if (result && result.canvasIndex >= this.getNextPageIndex()) {\n this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, result.canvasIndex);\n break;\n }\n }\n };\n Extension.prototype.bookmark = function () {\n _super.prototype.bookmark.call(this);\n var canvas = this.helper.getCurrentCanvas();\n var bookmark = new Bookmark_1.Bookmark();\n bookmark.index = this.helper.canvasIndex;\n bookmark.label = Manifesto.LanguageMap.getValue(canvas.getLabel());\n bookmark.path = this.getCroppedImageUri(canvas, this.getViewer());\n bookmark.thumb = canvas.getCanonicalImageUri(this.data.config.options.bookmarkThumbWidth);\n bookmark.title = this.helper.getLabel();\n bookmark.trackingLabel = window.trackingLabel;\n bookmark.type = manifesto.ResourceType.image().toString();\n this.fire(BaseEvents_1.BaseEvents.BOOKMARK, bookmark);\n };\n Extension.prototype.print = function () {\n // var args: MultiSelectionArgs = new MultiSelectionArgs();\n // args.manifestUri = this.helper.iiifResourceUri;\n // args.allCanvases = true;\n // args.format = this.data.config.options.printMimeType;\n // args.sequence = this.helper.getCurrentSequence().id;\n window.print();\n this.fire(Events_1.Events.PRINT);\n };\n Extension.prototype.getCroppedImageDimensions = function (canvas, viewer) {\n if (!viewer)\n return null;\n if (!viewer.viewport)\n return null;\n if (!canvas.getHeight() || !canvas.getWidth()) {\n return null;\n }\n var bounds = viewer.viewport.getBounds(true);\n var dimensions = new CroppedImageDimensions_1.CroppedImageDimensions();\n var width = Math.floor(bounds.width);\n var height = Math.floor(bounds.height);\n var x = Math.floor(bounds.x);\n var y = Math.floor(bounds.y);\n // constrain to image bounds\n if (x + width > canvas.getWidth()) {\n width = canvas.getWidth() - x;\n }\n else if (x < 0) {\n width = width + x;\n }\n if (x < 0) {\n x = 0;\n }\n if (y + height > canvas.getHeight()) {\n height = canvas.getHeight() - y;\n }\n else if (y < 0) {\n height = height + y;\n }\n if (y < 0) {\n y = 0;\n }\n width = Math.min(width, canvas.getWidth());\n height = Math.min(height, canvas.getHeight());\n var regionWidth = width;\n var regionHeight = height;\n var maxDimensions = canvas.getMaxDimensions();\n if (maxDimensions) {\n if (width > maxDimensions.width) {\n var newWidth = maxDimensions.width;\n height = Math.round(newWidth * (height / width));\n width = newWidth;\n }\n if (height > maxDimensions.height) {\n var newHeight = maxDimensions.height;\n width = Math.round((width / height) * newHeight);\n height = newHeight;\n }\n }\n dimensions.region = new manifesto.Size(regionWidth, regionHeight);\n dimensions.regionPos = new Point_1.Point(x, y);\n dimensions.size = new manifesto.Size(width, height);\n return dimensions;\n };\n // keep this around for reference\n // getOnScreenCroppedImageDimensions(canvas: Manifesto.ICanvas, viewer: any): CroppedImageDimensions {\n // if (!viewer) return null;\n // if (!viewer.viewport) return null;\n // if (!canvas.getHeight() || !canvas.getWidth()){\n // return null;\n // }\n // var bounds = viewer.viewport.getBounds(true);\n // var containerSize = viewer.viewport.getContainerSize();\n // var zoom = viewer.viewport.getZoom(true);\n // var top = Math.max(0, bounds.y);\n // var left = Math.max(0, bounds.x);\n // // change top to be normalised value proportional to height of image, not width (as per OSD).\n // top = 1 / (canvas.getHeight() / parseInt(String(canvas.getWidth() * top)));\n // // get on-screen pixel sizes.\n // var viewportWidthPx = containerSize.x;\n // var viewportHeightPx = containerSize.y;\n // var imageWidthPx = parseInt(String(viewportWidthPx * zoom));\n // var ratio = canvas.getWidth() / imageWidthPx;\n // var imageHeightPx = parseInt(String(canvas.getHeight() / ratio));\n // var viewportLeftPx = parseInt(String(left * imageWidthPx));\n // var viewportTopPx = parseInt(String(top * imageHeightPx));\n // var rect1Left = 0;\n // var rect1Right = imageWidthPx;\n // var rect1Top = 0;\n // var rect1Bottom = imageHeightPx;\n // var rect2Left = viewportLeftPx;\n // var rect2Right = viewportLeftPx + viewportWidthPx;\n // var rect2Top = viewportTopPx;\n // var rect2Bottom = viewportTopPx + viewportHeightPx;\n // var sizeWidth = Math.max(0, Math.min(rect1Right, rect2Right) - Math.max(rect1Left, rect2Left));\n // var sizeHeight = Math.max(0, Math.min(rect1Bottom, rect2Bottom) - Math.max(rect1Top, rect2Top));\n // // get original image pixel sizes.\n // var ratio2 = canvas.getWidth() / imageWidthPx;\n // var regionWidth = parseInt(String(sizeWidth * ratio2));\n // var regionHeight = parseInt(String(sizeHeight * ratio2));\n // var regionTop = parseInt(String(canvas.getHeight() * top));\n // var regionLeft = parseInt(String(canvas.getWidth() * left));\n // if (regionTop < 0) regionTop = 0;\n // if (regionLeft < 0) regionLeft = 0;\n // var dimensions: CroppedImageDimensions = new CroppedImageDimensions();\n // dimensions.region = new manifesto.Size(regionWidth, regionHeight);\n // dimensions.regionPos = new Point(regionLeft, regionTop);\n // dimensions.size = new manifesto.Size(sizeWidth, sizeHeight);\n // return dimensions;\n // }\n Extension.prototype.getCroppedImageUri = function (canvas, viewer) {\n if (!viewer)\n return null;\n if (!viewer.viewport)\n return null;\n var dimensions = this.getCroppedImageDimensions(canvas, viewer);\n if (!dimensions) {\n return null;\n }\n // construct uri\n // {baseuri}/{id}/{region}/{size}/{rotation}/{quality}.jpg\n var baseUri = this.getImageBaseUri(canvas);\n var id = this.getImageId(canvas);\n if (!id) {\n return null;\n }\n var region = dimensions.regionPos.x + \",\" + dimensions.regionPos.y + \",\" + dimensions.region.width + \",\" + dimensions.region.height;\n var size = dimensions.size.width + ',' + dimensions.size.height;\n var rotation = this.getViewerRotation();\n var quality = 'default';\n return baseUri + \"/\" + id + \"/\" + region + \"/\" + size + \"/\" + rotation + \"/\" + quality + \".jpg\";\n };\n Extension.prototype.getConfinedImageDimensions = function (canvas, width) {\n var dimensions = new manifesto.Size(0, 0);\n dimensions.width = width;\n var normWidth = Utils.Maths.normalise(width, 0, canvas.getWidth());\n dimensions.height = Math.floor(canvas.getHeight() * normWidth);\n return dimensions;\n };\n Extension.prototype.getConfinedImageUri = function (canvas, width) {\n var baseUri = this.getImageBaseUri(canvas);\n // {baseuri}/{id}/{region}/{size}/{rotation}/{quality}.jpg\n var id = this.getImageId(canvas);\n if (!id) {\n return null;\n }\n var region = 'full';\n var dimensions = this.getConfinedImageDimensions(canvas, width);\n var size = dimensions.width + ',' + dimensions.height;\n var rotation = this.getViewerRotation();\n var quality = 'default';\n return baseUri + \"/\" + id + \"/\" + region + \"/\" + size + \"/\" + rotation + \"/\" + quality + \".jpg\";\n };\n Extension.prototype.getImageId = function (canvas) {\n if (canvas.externalResource) {\n var id = canvas.externalResource.data['@id'];\n if (id) {\n return id.substr(id.lastIndexOf(\"/\") + 1);\n }\n }\n return null;\n };\n Extension.prototype.getImageBaseUri = function (canvas) {\n var uri = this.getInfoUri(canvas);\n // First trim off info.json, then trim off ID....\n uri = uri.substr(0, uri.lastIndexOf(\"/\"));\n return uri.substr(0, uri.lastIndexOf(\"/\"));\n };\n Extension.prototype.getInfoUri = function (canvas) {\n var infoUri = null;\n var images = canvas.getImages();\n if (images && images.length) {\n var firstImage = images[0];\n var resource = firstImage.getResource();\n var services = resource.getServices();\n for (var i = 0; i < services.length; i++) {\n var service = services[i];\n var id = service.id;\n if (!id.endsWith('/')) {\n id += '/';\n }\n if (manifesto.Utils.isImageProfile(service.getProfile())) {\n infoUri = id + 'info.json';\n }\n }\n }\n if (!infoUri) {\n // todo: use compiler flag (when available)\n infoUri = 'lib/imageunavailable.json';\n }\n return infoUri;\n };\n Extension.prototype.getEmbedScript = function (template, width, height, zoom, rotation) {\n var config = this.data.config.uri || '';\n var locales = this.getSerializedLocales();\n var appUri = this.getAppUri();\n var iframeSrc = appUri + \"#?manifest=\" + this.helper.iiifResourceUri + \"&c=\" + this.helper.collectionIndex + \"&m=\" + this.helper.manifestIndex + \"&s=\" + this.helper.sequenceIndex + \"&cv=\" + this.helper.canvasIndex + \"&config=\" + config + \"&locales=\" + locales + \"&xywh=\" + zoom + \"&r=\" + rotation;\n var script = Utils.Strings.format(template, iframeSrc, width.toString(), height.toString());\n return script;\n };\n Extension.prototype.getPrevPageIndex = function (canvasIndex) {\n if (canvasIndex === void 0) { canvasIndex = this.helper.canvasIndex; }\n var index;\n if (this.isPagingSettingEnabled()) {\n var indices = this.getPagedIndices(canvasIndex);\n if (this.helper.isRightToLeft()) {\n index = indices[indices.length - 1] - 1;\n }\n else {\n index = indices[0] - 1;\n }\n }\n else {\n index = canvasIndex - 1;\n }\n return index;\n };\n Extension.prototype.isSearchEnabled = function () {\n if (!Utils.Bools.getBool(this.data.config.options.searchWithinEnabled, false)) {\n return false;\n }\n if (!this.helper.getSearchService()) {\n return false;\n }\n return true;\n };\n Extension.prototype.isPagingSettingEnabled = function () {\n if (this.helper.isPagingAvailable()) {\n return this.getSettings().pagingEnabled;\n }\n return false;\n };\n Extension.prototype.getNextPageIndex = function (canvasIndex) {\n if (canvasIndex === void 0) { canvasIndex = this.helper.canvasIndex; }\n var index;\n if (this.isPagingSettingEnabled()) {\n var indices = this.getPagedIndices(canvasIndex);\n if (this.helper.isRightToLeft()) {\n index = indices[0] + 1;\n }\n else {\n index = indices[indices.length - 1] + 1;\n }\n }\n else {\n index = canvasIndex + 1;\n }\n if (index > this.helper.getTotalCanvases() - 1) {\n return -1;\n }\n return index;\n };\n Extension.prototype.getAutoCompleteService = function () {\n var service = this.helper.getSearchService();\n if (!service)\n return null;\n return service.getService(manifesto.ServiceProfile.autoComplete());\n };\n Extension.prototype.getAutoCompleteUri = function () {\n var service = this.getAutoCompleteService();\n if (!service)\n return null;\n return service.id + '?q={0}';\n };\n Extension.prototype.getSearchServiceUri = function () {\n var service = this.helper.getSearchService();\n if (!service)\n return null;\n var uri = service.id;\n uri = uri + \"?q={0}\";\n return uri;\n };\n Extension.prototype.search = function (terms) {\n var _this = this;\n if (this.isAnnotating)\n return;\n this.isAnnotating = true;\n // clear search results\n this.annotations = [];\n var that = this;\n // searching\n var searchUri = this.getSearchServiceUri();\n if (!searchUri)\n return;\n searchUri = Utils.Strings.format(searchUri, encodeURIComponent(terms));\n this.getSearchResults(searchUri, terms, this.annotations, function (annotations) {\n that.isAnnotating = false;\n if (annotations.length) {\n that.annotate(annotations, terms);\n }\n else {\n that.showMessage(that.data.config.modules.genericDialogue.content.noMatches, function () {\n _this.component.publish(BaseEvents_1.BaseEvents.ANNOTATIONS_EMPTY);\n });\n }\n });\n };\n Extension.prototype.getSearchResults = function (searchUri, terms, searchResults, cb) {\n var _this = this;\n $.getJSON(searchUri, function (results) {\n if (results.resources && results.resources.length) {\n searchResults = searchResults.concat(_this.parseAnnotationList(results));\n }\n if (results.next) {\n _this.getSearchResults(results.next, terms, searchResults, cb);\n }\n else {\n cb(searchResults);\n }\n });\n };\n Extension.prototype.parseAnnotationList = function (annotations) {\n var parsed = [];\n var _loop_1 = function (i) {\n var resource = annotations.resources[i];\n var canvasIndex = this_1.helper.getCanvasIndexById(resource.on.match(/(.*)#/)[1]);\n var annotationGroup = new AnnotationGroup(resource, canvasIndex);\n var match = parsed.en().where(function (x) { return x.canvasIndex === annotationGroup.canvasIndex; }).first();\n // if there's already an annotation for the canvas index, add a rect to it, otherwise create a new AnnotationGroup\n if (match) {\n match.addRect(resource);\n }\n else {\n parsed.push(annotationGroup);\n }\n };\n var this_1 = this;\n for (var i = 0; i < annotations.resources.length; i++) {\n _loop_1(i);\n }\n // sort by canvasIndex\n parsed.sort(function (a, b) {\n return a.canvasIndex - b.canvasIndex;\n });\n return parsed;\n };\n Extension.prototype.getAnnotationRects = function () {\n if (this.annotations) {\n return this.annotations.en().selectMany(function (x) { return x.rects; }).toArray();\n }\n return [];\n };\n Extension.prototype.getCurrentAnnotationRectIndex = function () {\n var annotationRects = this.getAnnotationRects();\n if (this.currentAnnotationRect) {\n return annotationRects.indexOf(this.currentAnnotationRect);\n }\n return -1;\n };\n Extension.prototype.getTotalAnnotationRects = function () {\n var annotationRects = this.getAnnotationRects();\n return annotationRects.length;\n };\n Extension.prototype.isFirstAnnotationRect = function () {\n return this.getCurrentAnnotationRectIndex() === 0;\n };\n Extension.prototype.getLastAnnotationRectIndex = function () {\n return this.getTotalAnnotationRects() - 1;\n };\n Extension.prototype.getPagedIndices = function (canvasIndex) {\n if (canvasIndex === void 0) { canvasIndex = this.helper.canvasIndex; }\n var indices = [];\n // if it's a continuous manifest, get all resources.\n if (this.helper.isContinuous()) {\n indices = $.map(this.helper.getCanvases(), function (c, index) {\n return index;\n });\n }\n else {\n if (!this.isPagingSettingEnabled()) {\n indices.push(this.helper.canvasIndex);\n }\n else {\n if (this.helper.isFirstCanvas(canvasIndex) || (this.helper.isLastCanvas(canvasIndex) && this.helper.isTotalCanvasesEven())) {\n indices = [canvasIndex];\n }\n else if (canvasIndex % 2) {\n indices = [canvasIndex, canvasIndex + 1];\n }\n else {\n indices = [canvasIndex - 1, canvasIndex];\n }\n if (this.helper.isRightToLeft()) {\n indices = indices.reverse();\n }\n }\n }\n return indices;\n };\n return Extension;\n }(BaseExtension_1.BaseExtension));\n exports.Extension = Extension;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-pdf-extension/DownloadDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/DownloadDialogue\"], function (require, exports, DownloadDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var DownloadDialogue = /** @class */ (function (_super) {\n __extends(DownloadDialogue, _super);\n function DownloadDialogue($element) {\n return _super.call(this, $element) || this;\n }\n DownloadDialogue.prototype.create = function () {\n this.setConfig('downloadDialogue');\n _super.prototype.create.call(this);\n };\n DownloadDialogue.prototype.open = function (triggerButton) {\n _super.prototype.open.call(this, triggerButton);\n this.addEntireFileDownloadOptions();\n if (!this.$downloadOptions.find('li:visible').length) {\n this.$noneAvailable.show();\n }\n else {\n // select first option.\n this.$noneAvailable.hide();\n }\n this.resize();\n };\n DownloadDialogue.prototype.isDownloadOptionAvailable = function (option) {\n return _super.prototype.isDownloadOptionAvailable.call(this, option);\n };\n return DownloadDialogue;\n }(DownloadDialogue_1.DownloadDialogue));\n exports.DownloadDialogue = DownloadDialogue;\n});\n\n", - "define('extensions/uv-pdf-extension/Events',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Events = /** @class */ (function () {\n function Events() {\n }\n Events.namespace = 'pdfExtension.';\n Events.PDF_LOADED = Events.namespace + 'pdfLoaded';\n Events.PAGE_INDEX_CHANGED = Events.namespace + 'pageIndexChanged';\n Events.SEARCH = Events.namespace + 'search';\n return Events;\n }());\n exports.Events = Events;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-pdfcenterpanel-module/PDFCenterPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/CenterPanel\", \"../../extensions/uv-pdf-extension/Events\"], function (require, exports, BaseEvents_1, CenterPanel_1, Events_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var PDFCenterPanel = /** @class */ (function (_super) {\n __extends(PDFCenterPanel, _super);\n function PDFCenterPanel($element) {\n var _this = _super.call(this, $element) || this;\n _this._maxScale = 5;\n _this._minScale = 0.7;\n _this._nextButtonEnabled = false;\n _this._pageIndex = 1;\n _this._pageIndexPending = null;\n _this._pageRendering = false;\n _this._pdfDoc = null;\n _this._prevButtonEnabled = false;\n _this._scale = 0.7;\n return _this;\n }\n PDFCenterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('pdfCenterPanel');\n _super.prototype.create.call(this);\n this._$pdfContainer = $('
                      ');\n this._$canvas = $('');\n this._$spinner = $('
                      ');\n this._canvas = this._$canvas[0];\n this._ctx = this._canvas.getContext('2d');\n this.$content.append(this._$spinner);\n this._$prevButton = $('
                      ');\n this.$content.append(this._$prevButton);\n this._$nextButton = $('
                      ');\n this.$content.append(this._$nextButton);\n this._$zoomInButton = $('
                      ');\n this.$content.append(this._$zoomInButton);\n this._$zoomOutButton = $('
                      ');\n this.$content.append(this._$zoomOutButton);\n this._$pdfContainer.append(this._$canvas);\n this.$content.prepend(this._$pdfContainer);\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, function (resources) {\n _this.openMedia(resources);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.FIRST, function () {\n if (!_this._pdfDoc) {\n return;\n }\n _this._pageIndex = 1;\n _this._queueRenderPage(_this._pageIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.PREV, function () {\n if (!_this._pdfDoc) {\n return;\n }\n if (_this._pageIndex <= 1) {\n return;\n }\n _this._pageIndex--;\n _this._queueRenderPage(_this._pageIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.NEXT, function () {\n if (!_this._pdfDoc) {\n return;\n }\n if (_this._pageIndex >= _this._pdfDoc.numPages) {\n return;\n }\n _this._pageIndex++;\n _this._queueRenderPage(_this._pageIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LAST, function () {\n if (!_this._pdfDoc) {\n return;\n }\n _this._pageIndex = _this._pdfDoc.numPages;\n _this._queueRenderPage(_this._pageIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function () {\n if (!_this._pdfDoc) {\n return;\n }\n _this._pageIndex = 1;\n _this._queueRenderPage(_this._pageIndex);\n });\n this.component.subscribe(Events_1.Events.SEARCH, function (pageIndex) {\n if (!_this._pdfDoc) {\n return;\n }\n if (pageIndex < 1 || pageIndex > _this._pdfDoc.numPages) {\n return;\n }\n _this._pageIndex = pageIndex;\n _this._queueRenderPage(_this._pageIndex);\n });\n this._$prevButton.onPressed(function (e) {\n e.preventDefault();\n if (!_this._prevButtonEnabled)\n return;\n _this.component.publish(BaseEvents_1.BaseEvents.PREV);\n });\n this.disablePrevButton();\n this._$nextButton.onPressed(function (e) {\n e.preventDefault();\n if (!_this._nextButtonEnabled)\n return;\n _this.component.publish(BaseEvents_1.BaseEvents.NEXT);\n });\n this.disableNextButton();\n this._$zoomInButton.onPressed(function (e) {\n e.preventDefault();\n var newScale = _this._scale + 0.5;\n if (newScale < _this._maxScale) {\n _this._scale = newScale;\n }\n else {\n _this._scale = _this._maxScale;\n }\n _this._render(_this._pageIndex);\n });\n this._$zoomOutButton.onPressed(function (e) {\n e.preventDefault();\n var newScale = _this._scale - 0.5;\n if (newScale > _this._minScale) {\n _this._scale = newScale;\n }\n else {\n _this._scale = _this._minScale;\n }\n _this._render(_this._pageIndex);\n });\n };\n PDFCenterPanel.prototype.disablePrevButton = function () {\n this._prevButtonEnabled = false;\n this._$prevButton.addClass('disabled');\n };\n PDFCenterPanel.prototype.enablePrevButton = function () {\n this._prevButtonEnabled = true;\n this._$prevButton.removeClass('disabled');\n };\n PDFCenterPanel.prototype.hidePrevButton = function () {\n this.disablePrevButton();\n this._$prevButton.hide();\n };\n PDFCenterPanel.prototype.showPrevButton = function () {\n this.enablePrevButton();\n this._$prevButton.show();\n };\n PDFCenterPanel.prototype.disableNextButton = function () {\n this._nextButtonEnabled = false;\n this._$nextButton.addClass('disabled');\n };\n PDFCenterPanel.prototype.enableNextButton = function () {\n this._nextButtonEnabled = true;\n this._$nextButton.removeClass('disabled');\n };\n PDFCenterPanel.prototype.hideNextButton = function () {\n this.disableNextButton();\n this._$nextButton.hide();\n };\n PDFCenterPanel.prototype.showNextButton = function () {\n this.enableNextButton();\n this._$nextButton.show();\n };\n PDFCenterPanel.prototype.openMedia = function (resources) {\n var _this = this;\n this._$spinner.show();\n this.extension.getExternalResources(resources).then(function () {\n var mediaUri = null;\n var canvas = _this.extension.helper.getCurrentCanvas();\n var formats = _this.extension.getMediaFormats(canvas);\n var pdfUri = canvas.id;\n if (formats && formats.length) {\n mediaUri = formats[0].id;\n }\n else {\n mediaUri = canvas.id;\n }\n if (!Utils.Bools.getBool(_this.extension.data.config.options.usePdfJs, false)) {\n window.PDFObject.embed(pdfUri, '#content', { id: \"PDF\" });\n }\n else {\n PDFJS.disableWorker = true;\n PDFJS.getDocument(mediaUri).then(function (pdfDoc) {\n _this._pdfDoc = pdfDoc;\n _this._render(_this._pageIndex);\n _this.component.publish(Events_1.Events.PDF_LOADED, pdfDoc);\n _this._$spinner.hide();\n });\n }\n });\n };\n PDFCenterPanel.prototype._render = function (num) {\n var _this = this;\n if (!Utils.Bools.getBool(this.extension.data.config.options.usePdfJs, false)) {\n return;\n }\n this._pageRendering = true;\n this._$zoomOutButton.enable();\n this._$zoomInButton.enable();\n //disable zoom if not possible\n var lowScale = this._scale - 0.5;\n var highScale = this._scale + 0.5;\n if (lowScale < this._minScale) {\n this._$zoomOutButton.disable();\n }\n if (highScale > this._maxScale) {\n this._$zoomInButton.disable();\n }\n //this._pdfDoc.getPage(num).then((page: any) => {\n this._pdfDoc.getPage(num).then(function (page) {\n if (_this._renderTask) {\n _this._renderTask.cancel();\n }\n // how to fit to the available space\n // const height: number = this.$content.height();\n // this._canvas.height = height;\n // this._viewport = page.getViewport(this._canvas.height / page.getViewport(1.0).height);\n // const width: number = this._viewport.width;\n // this._canvas.width = width;\n // this._$canvas.css({\n // left: (this.$content.width() / 2) - (width / 2)\n // });\n // scale viewport\n _this._viewport = page.getViewport(_this._scale);\n _this._canvas.height = _this._viewport.height;\n _this._canvas.width = _this._viewport.width;\n // Render PDF page into canvas context\n var renderContext = {\n canvasContext: _this._ctx,\n viewport: _this._viewport\n };\n _this._renderTask = page.render(renderContext);\n // Wait for rendering to finish\n _this._renderTask.promise.then(function () {\n _this.component.publish(Events_1.Events.PAGE_INDEX_CHANGED, _this._pageIndex);\n _this._pageRendering = false;\n if (_this._pageIndexPending !== null) {\n // New page rendering is pending\n _this._render(_this._pageIndexPending);\n _this._pageIndexPending = null;\n }\n if (_this._pageIndex === 1) {\n _this.disablePrevButton();\n }\n else {\n _this.enablePrevButton();\n }\n if (_this._pageIndex === _this._pdfDoc.numPages) {\n _this.disableNextButton();\n }\n else {\n _this.enableNextButton();\n }\n }).catch(function (err) {\n //console.log(err);\n });\n });\n };\n PDFCenterPanel.prototype._queueRenderPage = function (num) {\n if (this._pageRendering) {\n this._pageIndexPending = num;\n }\n else {\n this._render(num);\n }\n };\n PDFCenterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n this._$pdfContainer.width(this.$content.width());\n this._$pdfContainer.height(this.$content.height());\n this._$spinner.css('top', (this.$content.height() / 2) - (this._$spinner.height() / 2));\n this._$spinner.css('left', (this.$content.width() / 2) - (this._$spinner.width() / 2));\n this._$prevButton.css({\n top: (this.$content.height() - this._$prevButton.height()) / 2,\n left: this._$prevButton.horizontalMargins()\n });\n this._$nextButton.css({\n top: (this.$content.height() - this._$nextButton.height()) / 2,\n left: this.$content.width() - (this._$nextButton.width() + this._$nextButton.horizontalMargins())\n });\n if (!this._viewport) {\n return;\n }\n this._render(this._pageIndex);\n };\n return PDFCenterPanel;\n }(CenterPanel_1.CenterPanel));\n exports.PDFCenterPanel = PDFCenterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-pdfheaderpanel-module/PDFHeaderPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../../extensions/uv-pdf-extension/Events\", \"../uv-shared-module/HeaderPanel\"], function (require, exports, BaseEvents_1, Events_1, HeaderPanel_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var PDFHeaderPanel = /** @class */ (function (_super) {\n __extends(PDFHeaderPanel, _super);\n function PDFHeaderPanel($element) {\n var _this = _super.call(this, $element) || this;\n _this.firstButtonEnabled = false;\n _this.lastButtonEnabled = false;\n _this.nextButtonEnabled = false;\n _this.prevButtonEnabled = false;\n _this._pageIndex = 0;\n _this._pdfDoc = null;\n return _this;\n }\n PDFHeaderPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('pdfHeaderPanel');\n _super.prototype.create.call(this);\n this.component.subscribe(Events_1.Events.PAGE_INDEX_CHANGED, function (pageIndex) {\n _this._pageIndex = pageIndex;\n _this.render();\n });\n this.component.subscribe(Events_1.Events.PDF_LOADED, function (pdfDoc) {\n _this._pdfDoc = pdfDoc;\n });\n this.$prevOptions = $('
                      ');\n this.$centerOptions.append(this.$prevOptions);\n this.$firstButton = $(\"\\n \\n \");\n this.$prevOptions.append(this.$firstButton);\n this.$firstButton.disable();\n this.$prevButton = $(\"\\n \\n \");\n this.$prevOptions.append(this.$prevButton);\n this.$prevButton.disable();\n this.$search = $('
                      ');\n this.$centerOptions.append(this.$search);\n this.$searchText = $('');\n this.$search.append(this.$searchText);\n this.$total = $('');\n this.$search.append(this.$total);\n this.$searchButton = $('' + this.content.go + '');\n this.$search.append(this.$searchButton);\n this.$searchButton.disable();\n this.$nextOptions = $('
                      ');\n this.$centerOptions.append(this.$nextOptions);\n this.$nextButton = $(\"\\n \\n \");\n this.$nextOptions.append(this.$nextButton);\n this.$nextButton.disable();\n this.$lastButton = $(\"\\n \\n \");\n this.$nextOptions.append(this.$lastButton);\n this.$lastButton.disable();\n // ui event handlers.\n this.$firstButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.FIRST);\n });\n this.$prevButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.PREV);\n });\n this.$nextButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.NEXT);\n });\n this.$lastButton.onPressed(function () {\n _this.component.publish(BaseEvents_1.BaseEvents.LAST);\n });\n this.$searchText.onEnter(function () {\n _this.$searchText.blur();\n _this.search(_this.$searchText.val());\n });\n this.$searchText.click(function () {\n $(this).select();\n });\n this.$searchButton.onPressed(function () {\n _this.search(_this.$searchText.val());\n });\n };\n PDFHeaderPanel.prototype.render = function () {\n // check if the book has more than one page, otherwise hide prev/next options.\n if (this._pdfDoc.numPages === 1) {\n this.$centerOptions.hide();\n }\n else {\n this.$centerOptions.show();\n }\n this.$searchText.val(this._pageIndex);\n var of = this.content.of;\n this.$total.html(Utils.Strings.format(of, this._pdfDoc.numPages.toString()));\n this.$searchButton.enable();\n if (this._pageIndex === 1) {\n this.$firstButton.disable();\n this.$prevButton.disable();\n }\n else {\n this.$firstButton.enable();\n this.$prevButton.enable();\n }\n if (this._pageIndex === this._pdfDoc.numPages) {\n this.$lastButton.disable();\n this.$nextButton.disable();\n }\n else {\n this.$lastButton.enable();\n this.$nextButton.enable();\n }\n };\n PDFHeaderPanel.prototype.search = function (value) {\n if (!value) {\n this.extension.showMessage(this.content.emptyValue);\n return;\n }\n var index = parseInt(this.$searchText.val(), 10);\n if (isNaN(index)) {\n this.extension.showMessage(this.extension.data.config.modules.genericDialogue.content.invalidNumber);\n return;\n }\n this.component.publish(Events_1.Events.SEARCH, index);\n };\n PDFHeaderPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return PDFHeaderPanel;\n }(HeaderPanel_1.HeaderPanel));\n exports.PDFHeaderPanel = PDFHeaderPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-pdf-extension/SettingsDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/SettingsDialogue\"], function (require, exports, SettingsDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SettingsDialogue = /** @class */ (function (_super) {\n __extends(SettingsDialogue, _super);\n function SettingsDialogue($element) {\n return _super.call(this, $element) || this;\n }\n SettingsDialogue.prototype.create = function () {\n this.setConfig('settingsDialogue');\n _super.prototype.create.call(this);\n };\n return SettingsDialogue;\n }(SettingsDialogue_1.SettingsDialogue));\n exports.SettingsDialogue = SettingsDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-pdf-extension/ShareDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/ShareDialogue\"], function (require, exports, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ShareDialogue = /** @class */ (function (_super) {\n __extends(ShareDialogue, _super);\n function ShareDialogue($element) {\n return _super.call(this, $element) || this;\n }\n ShareDialogue.prototype.create = function () {\n this.setConfig('shareDialogue');\n _super.prototype.create.call(this);\n };\n ShareDialogue.prototype.update = function () {\n _super.prototype.update.call(this);\n this.code = this.extension.getEmbedScript(this.options.embedTemplate, this.currentWidth, this.currentHeight);\n this.$code.val(this.code);\n };\n ShareDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ShareDialogue;\n }(ShareDialogue_1.ShareDialogue));\n exports.ShareDialogue = ShareDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-pdf-extension/Extension',[\"require\", \"exports\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-shared-module/BaseExtension\", \"../../modules/uv-shared-module/Bookmark\", \"./DownloadDialogue\", \"../../modules/uv-shared-module/FooterPanel\", \"../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel\", \"../../modules/uv-pdfcenterpanel-module/PDFCenterPanel\", \"../../modules/uv-pdfheaderpanel-module/PDFHeaderPanel\", \"../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel\", \"./SettingsDialogue\", \"./ShareDialogue\"], function (require, exports, BaseEvents_1, BaseExtension_1, Bookmark_1, DownloadDialogue_1, FooterPanel_1, MoreInfoRightPanel_1, PDFCenterPanel_1, PDFHeaderPanel_1, ResourcesLeftPanel_1, SettingsDialogue_1, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Extension = /** @class */ (function (_super) {\n __extends(Extension, _super);\n function Extension() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Extension.prototype.create = function () {\n var _this = this;\n requirejs.config({ paths: { 'pdfjs-dist/build/pdf.combined': this.data.root + '/lib/' + 'pdf.combined' } });\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.viewCanvas(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.THUMB_SELECTED, function (thumb) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, thumb.index);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_EXPAND_FULL_START, function () {\n _this.shell.$centerPanel.hide();\n _this.shell.$rightPanel.hide();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.LEFTPANEL_COLLAPSE_FULL_FINISH, function () {\n _this.shell.$centerPanel.show();\n _this.shell.$rightPanel.show();\n _this.resize();\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.SHOW_OVERLAY, function () {\n if (_this.IsOldIE()) {\n _this.centerPanel.$element.hide();\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.HIDE_OVERLAY, function () {\n if (_this.IsOldIE()) {\n _this.centerPanel.$element.show();\n }\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.EXIT_FULLSCREEN, function () {\n setTimeout(function () {\n _this.resize();\n }, 10); // allow time to exit full screen, then resize\n });\n };\n Extension.prototype.render = function () {\n _super.prototype.render.call(this);\n };\n Extension.prototype.IsOldIE = function () {\n var browser = window.browserDetect.browser;\n var version = window.browserDetect.version;\n if (browser === 'Explorer' && version <= 9)\n return true;\n return false;\n };\n Extension.prototype.isHeaderPanelEnabled = function () {\n return _super.prototype.isHeaderPanelEnabled.call(this) && Utils.Bools.getBool(this.data.config.options.usePdfJs, true);\n };\n Extension.prototype.createModules = function () {\n _super.prototype.createModules.call(this);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel = new PDFHeaderPanel_1.PDFHeaderPanel(this.shell.$headerPanel);\n }\n else {\n this.shell.$headerPanel.hide();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel = new ResourcesLeftPanel_1.ResourcesLeftPanel(this.shell.$leftPanel);\n }\n this.centerPanel = new PDFCenterPanel_1.PDFCenterPanel(this.shell.$centerPanel);\n if (this.isRightPanelEnabled()) {\n this.rightPanel = new MoreInfoRightPanel_1.MoreInfoRightPanel(this.shell.$rightPanel);\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel = new FooterPanel_1.FooterPanel(this.shell.$footerPanel);\n }\n else {\n this.shell.$footerPanel.hide();\n }\n this.$downloadDialogue = $('
                      ');\n this.shell.$overlays.append(this.$downloadDialogue);\n this.downloadDialogue = new DownloadDialogue_1.DownloadDialogue(this.$downloadDialogue);\n this.$shareDialogue = $('
                      ');\n this.shell.$overlays.append(this.$shareDialogue);\n this.shareDialogue = new ShareDialogue_1.ShareDialogue(this.$shareDialogue);\n this.$settingsDialogue = $('
                      ');\n this.shell.$overlays.append(this.$settingsDialogue);\n this.settingsDialogue = new SettingsDialogue_1.SettingsDialogue(this.$settingsDialogue);\n if (this.isLeftPanelEnabled()) {\n this.leftPanel.init();\n }\n if (this.isRightPanelEnabled()) {\n this.rightPanel.init();\n }\n };\n Extension.prototype.bookmark = function () {\n _super.prototype.bookmark.call(this);\n var canvas = this.helper.getCurrentCanvas();\n var bookmark = new Bookmark_1.Bookmark();\n bookmark.index = this.helper.canvasIndex;\n bookmark.label = Manifesto.LanguageMap.getValue(canvas.getLabel());\n bookmark.thumb = canvas.getProperty('thumbnail');\n bookmark.title = this.helper.getLabel();\n bookmark.trackingLabel = window.trackingLabel;\n bookmark.type = manifesto.ResourceType.document().toString();\n this.fire(BaseEvents_1.BaseEvents.BOOKMARK, bookmark);\n };\n Extension.prototype.dependencyLoaded = function (index, dep) {\n if (index === 0) {\n window.PDFObject = dep;\n }\n };\n Extension.prototype.getEmbedScript = function (template, width, height) {\n //const configUri = this.data.config.uri || '';\n //const script = String.format(template, this.getSerializedLocales(), configUri, this.helper.iiifResourceUri, this.helper.collectionIndex, this.helper.manifestIndex, this.helper.sequenceIndex, this.helper.canvasIndex, width, height, this.data.embedScriptUri);\n var appUri = this.getAppUri();\n var iframeSrc = appUri + \"#?manifest=\" + this.helper.iiifResourceUri + \"&c=\" + this.helper.collectionIndex + \"&m=\" + this.helper.manifestIndex + \"&s=\" + this.helper.sequenceIndex + \"&cv=\" + this.helper.canvasIndex;\n var script = Utils.Strings.format(template, iframeSrc, width.toString(), height.toString());\n return script;\n };\n return Extension;\n }(BaseExtension_1.BaseExtension));\n exports.Extension = Extension;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-virtex-extension/DownloadDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/DownloadDialogue\"], function (require, exports, DownloadDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var DownloadDialogue = /** @class */ (function (_super) {\n __extends(DownloadDialogue, _super);\n function DownloadDialogue($element) {\n return _super.call(this, $element) || this;\n }\n DownloadDialogue.prototype.create = function () {\n this.setConfig('downloadDialogue');\n _super.prototype.create.call(this);\n };\n DownloadDialogue.prototype.open = function (triggerButton) {\n _super.prototype.open.call(this, triggerButton);\n this.addEntireFileDownloadOptions();\n this.updateNoneAvailable();\n this.resize();\n };\n DownloadDialogue.prototype.isDownloadOptionAvailable = function (option) {\n return _super.prototype.isDownloadOptionAvailable.call(this, option);\n };\n return DownloadDialogue;\n }(DownloadDialogue_1.DownloadDialogue));\n exports.DownloadDialogue = DownloadDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-virtex-extension/SettingsDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/SettingsDialogue\"], function (require, exports, SettingsDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var SettingsDialogue = /** @class */ (function (_super) {\n __extends(SettingsDialogue, _super);\n function SettingsDialogue($element) {\n return _super.call(this, $element) || this;\n }\n SettingsDialogue.prototype.create = function () {\n this.setConfig('settingsDialogue');\n _super.prototype.create.call(this);\n };\n return SettingsDialogue;\n }(SettingsDialogue_1.SettingsDialogue));\n exports.SettingsDialogue = SettingsDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-virtex-extension/ShareDialogue',[\"require\", \"exports\", \"../../modules/uv-dialogues-module/ShareDialogue\"], function (require, exports, ShareDialogue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var ShareDialogue = /** @class */ (function (_super) {\n __extends(ShareDialogue, _super);\n function ShareDialogue($element) {\n return _super.call(this, $element) || this;\n }\n ShareDialogue.prototype.create = function () {\n this.setConfig('shareDialogue');\n _super.prototype.create.call(this);\n };\n ShareDialogue.prototype.update = function () {\n _super.prototype.update.call(this);\n this.code = this.extension.getEmbedScript(this.options.embedTemplate, this.currentWidth, this.currentHeight);\n this.$code.val(this.code);\n };\n ShareDialogue.prototype.resize = function () {\n _super.prototype.resize.call(this);\n };\n return ShareDialogue;\n }(ShareDialogue_1.ShareDialogue));\n exports.ShareDialogue = ShareDialogue;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('modules/uv-virtexcenterpanel-module/VirtexCenterPanel',[\"require\", \"exports\", \"../uv-shared-module/BaseEvents\", \"../uv-shared-module/CenterPanel\", \"../../Utils\"], function (require, exports, BaseEvents_1, CenterPanel_1, Utils_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var VirtexCenterPanel = /** @class */ (function (_super) {\n __extends(VirtexCenterPanel, _super);\n function VirtexCenterPanel($element) {\n return _super.call(this, $element) || this;\n }\n VirtexCenterPanel.prototype.create = function () {\n var _this = this;\n this.setConfig('virtexCenterPanel');\n _super.prototype.create.call(this);\n var that = this;\n this.component.subscribe(BaseEvents_1.BaseEvents.OPEN_EXTERNAL_RESOURCE, function (resources) {\n that.openMedia(resources);\n });\n this.$navigation = $('
                      ');\n this.$content.prepend(this.$navigation);\n this.$zoomInButton = $(\"\\n \\n \");\n this.$navigation.append(this.$zoomInButton);\n this.$zoomOutButton = $(\"\\n \\n \");\n this.$navigation.append(this.$zoomOutButton);\n this.$vrButton = $(\"\\n \\n \");\n this.$navigation.append(this.$vrButton);\n this.$viewport = $('
                      ');\n this.$content.prepend(this.$viewport);\n this.title = this.extension.helper.getLabel();\n this.$zoomInButton.on('click', function (e) {\n e.preventDefault();\n if (_this.viewport) {\n _this.viewport.zoomIn();\n }\n });\n this.$zoomOutButton.on('click', function (e) {\n e.preventDefault();\n if (_this.viewport) {\n _this.viewport.zoomOut();\n }\n });\n this.$vrButton.on('click', function (e) {\n e.preventDefault();\n if (_this.viewport) {\n _this.viewport.toggleVR();\n }\n });\n if (!this._isVREnabled()) {\n this.$vrButton.hide();\n }\n };\n VirtexCenterPanel.prototype.openMedia = function (resources) {\n var _this = this;\n this.extension.getExternalResources(resources).then(function () {\n _this.$viewport.empty();\n var mediaUri = null;\n var canvas = _this.extension.helper.getCurrentCanvas();\n var formats = _this.extension.getMediaFormats(canvas);\n var resourceType = null;\n // default to threejs format.\n var fileType = new Virtex.FileType(\"application/vnd.threejs+json\");\n if (formats && formats.length) {\n mediaUri = formats[0].id;\n resourceType = formats[0].getFormat();\n }\n else {\n mediaUri = canvas.id;\n }\n if (resourceType) {\n fileType = new Virtex.FileType(resourceType.toString());\n }\n var isAndroid = navigator.userAgent.toLowerCase().indexOf(\"android\") > -1;\n _this.viewport = new Virtex.Viewport({\n target: _this.$viewport[0],\n data: {\n antialias: !isAndroid,\n file: mediaUri,\n fullscreenEnabled: false,\n type: fileType,\n showStats: _this.options.showStats\n }\n });\n if (_this.viewport) {\n _this.viewport.on('vravailable', function () {\n _this.$vrButton.show();\n }, false);\n _this.viewport.on('vrunavailable', function () {\n _this.$vrButton.hide();\n }, false);\n }\n _this.resize();\n });\n };\n VirtexCenterPanel.prototype._isVREnabled = function () {\n return (Utils.Bools.getBool(this.config.options.vrEnabled, false) && WEBVR.isAvailable());\n };\n VirtexCenterPanel.prototype.resize = function () {\n _super.prototype.resize.call(this);\n if (this.title) {\n this.$title.text(Utils_1.UVUtils.sanitize(this.title));\n }\n this.$viewport.width(this.$content.width());\n this.$viewport.height(this.$content.height());\n if (this.viewport) {\n this.viewport.resize();\n }\n };\n return VirtexCenterPanel;\n }(CenterPanel_1.CenterPanel));\n exports.VirtexCenterPanel = VirtexCenterPanel;\n});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('extensions/uv-virtex-extension/Extension',[\"require\", \"exports\", \"../../modules/uv-shared-module/BaseEvents\", \"../../modules/uv-shared-module/BaseExtension\", \"../../modules/uv-shared-module/Bookmark\", \"../../modules/uv-contentleftpanel-module/ContentLeftPanel\", \"./DownloadDialogue\", \"../../modules/uv-shared-module/FooterPanel\", \"../../modules/uv-shared-module/HeaderPanel\", \"../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel\", \"./SettingsDialogue\", \"./ShareDialogue\", \"../../modules/uv-virtexcenterpanel-module/VirtexCenterPanel\"], function (require, exports, BaseEvents_1, BaseExtension_1, Bookmark_1, ContentLeftPanel_1, DownloadDialogue_1, FooterPanel_1, HeaderPanel_1, MoreInfoRightPanel_1, SettingsDialogue_1, ShareDialogue_1, VirtexCenterPanel_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var Extension = /** @class */ (function (_super) {\n __extends(Extension, _super);\n function Extension() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Extension.prototype.create = function () {\n var _this = this;\n _super.prototype.create.call(this);\n this.component.subscribe(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, function (canvasIndex) {\n _this.viewCanvas(canvasIndex);\n });\n this.component.subscribe(BaseEvents_1.BaseEvents.THUMB_SELECTED, function (canvasIndex) {\n _this.component.publish(BaseEvents_1.BaseEvents.CANVAS_INDEX_CHANGED, canvasIndex);\n });\n };\n Extension.prototype.createModules = function () {\n _super.prototype.createModules.call(this);\n if (this.isHeaderPanelEnabled()) {\n this.headerPanel = new HeaderPanel_1.HeaderPanel(this.shell.$headerPanel);\n }\n else {\n this.shell.$headerPanel.hide();\n }\n if (this.isLeftPanelEnabled()) {\n this.leftPanel = new ContentLeftPanel_1.ContentLeftPanel(this.shell.$leftPanel);\n }\n this.centerPanel = new VirtexCenterPanel_1.VirtexCenterPanel(this.shell.$centerPanel);\n if (this.isRightPanelEnabled()) {\n this.rightPanel = new MoreInfoRightPanel_1.MoreInfoRightPanel(this.shell.$rightPanel);\n }\n if (this.isFooterPanelEnabled()) {\n this.footerPanel = new FooterPanel_1.FooterPanel(this.shell.$footerPanel);\n }\n else {\n this.shell.$footerPanel.hide();\n }\n this.$downloadDialogue = $('
                      ');\n this.shell.$overlays.append(this.$downloadDialogue);\n this.downloadDialogue = new DownloadDialogue_1.DownloadDialogue(this.$downloadDialogue);\n this.$shareDialogue = $('
                      ');\n this.shell.$overlays.append(this.$shareDialogue);\n this.shareDialogue = new ShareDialogue_1.ShareDialogue(this.$shareDialogue);\n this.$settingsDialogue = $('
                      ');\n this.shell.$overlays.append(this.$settingsDialogue);\n this.settingsDialogue = new SettingsDialogue_1.SettingsDialogue(this.$settingsDialogue);\n if (this.isLeftPanelEnabled()) {\n this.leftPanel.init();\n }\n else {\n this.shell.$leftPanel.hide();\n }\n if (this.isRightPanelEnabled()) {\n this.rightPanel.init();\n }\n else {\n this.shell.$rightPanel.hide();\n }\n };\n Extension.prototype.render = function () {\n _super.prototype.render.call(this);\n };\n Extension.prototype.dependencyLoaded = function (index, dep) {\n if (index === 0) {\n window.THREE = dep; //https://github.com/mrdoob/three.js/issues/9602\n }\n };\n Extension.prototype.isLeftPanelEnabled = function () {\n return Utils.Bools.getBool(this.data.config.options.leftPanelEnabled, true)\n && (this.helper.isMultiCanvas() || this.helper.isMultiSequence());\n };\n Extension.prototype.bookmark = function () {\n _super.prototype.bookmark.call(this);\n var canvas = this.helper.getCurrentCanvas();\n var bookmark = new Bookmark_1.Bookmark();\n bookmark.index = this.helper.canvasIndex;\n bookmark.label = Manifesto.LanguageMap.getValue(canvas.getLabel());\n bookmark.thumb = canvas.getProperty('thumbnail');\n bookmark.title = this.helper.getLabel();\n bookmark.trackingLabel = window.trackingLabel;\n bookmark.type = manifesto.ResourceType.physicalobject().toString();\n this.fire(BaseEvents_1.BaseEvents.BOOKMARK, bookmark);\n };\n Extension.prototype.getEmbedScript = function (template, width, height) {\n //const configUri: string = this.data.config.uri || '';\n //const script: string = String.format(template, this.getSerializedLocales(), configUri, this.helper.iiifResourceUri, this.helper.collectionIndex, this.helper.manifestIndex, this.helper.sequenceIndex, this.helper.canvasIndex, width, height, this.data.embedScriptUri);\n var appUri = this.getAppUri();\n var iframeSrc = appUri + \"#?manifest=\" + this.helper.iiifResourceUri + \"&c=\" + this.helper.collectionIndex + \"&m=\" + this.helper.manifestIndex + \"&s=\" + this.helper.sequenceIndex + \"&cv=\" + this.helper.canvasIndex;\n var script = Utils.Strings.format(template, iframeSrc, width.toString(), height.toString());\n return script;\n };\n return Extension;\n }(BaseExtension_1.BaseExtension));\n exports.Extension = Extension;\n});\n\n", - "define('PubSub',[\"require\", \"exports\"], function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var PubSub = /** @class */ (function () {\n function PubSub() {\n this.events = {};\n }\n PubSub.prototype.publish = function (name, args) {\n var _this = this;\n var handlers = this.events[name];\n if (handlers === undefined)\n return;\n handlers.forEach(function (handler) {\n handler.call(_this, args);\n });\n };\n PubSub.prototype.subscribe = function (name, handler) {\n var handlers = this.events[name];\n if (handlers === undefined) {\n handlers = this.events[name] = [];\n }\n handlers.push(handler);\n };\n PubSub.prototype.unsubscribe = function (name, handler) {\n var handlers = this.events[name];\n if (handlers === undefined)\n return;\n var handlerIdx = handlers.indexOf(handler);\n handlers.splice(handlerIdx);\n };\n PubSub.prototype.dispose = function () {\n this.events = {};\n };\n return PubSub;\n }());\n exports.PubSub = PubSub;\n});\n\n", - "if (!Element.prototype.scrollIntoViewIfNeeded) {\n Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) {\n centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded;\n var parent = this.parentNode, parentComputedStyle = window.getComputedStyle(parent, undefined), parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue(\"border-top-width\")), parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue(\"border-left-width\")), overTop = this.offsetTop - parent.offsetTop < parent.scrollTop, overBottom = this.offsetTop -\n parent.offsetTop +\n this.clientHeight -\n parentBorderTopWidth >\n parent.scrollTop + parent.clientHeight, overLeft = this.offsetLeft - parent.offsetLeft < parent.scrollLeft, overRight = this.offsetLeft -\n parent.offsetLeft +\n this.clientWidth -\n parentBorderLeftWidth >\n parent.scrollLeft + parent.clientWidth, alignWithTop = overTop && !overBottom;\n if ((overTop || overBottom) && centerIfNeeded) {\n parent.scrollTop =\n this.offsetTop -\n parent.offsetTop -\n parent.clientHeight / 2 -\n parentBorderTopWidth +\n this.clientHeight / 2;\n }\n if ((overLeft || overRight) && centerIfNeeded) {\n parent.scrollLeft =\n this.offsetLeft -\n parent.offsetLeft -\n parent.clientWidth / 2 -\n parentBorderLeftWidth +\n this.clientWidth / 2;\n }\n if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {\n this.scrollIntoView(alignWithTop);\n }\n };\n}\n\ndefine(\"Polyfills\", function(){});\n\n", - "var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\ndefine('UVComponent',[\"require\", \"exports\", \"./modules/uv-shared-module/BaseEvents\", \"./extensions/uv-av-extension/Extension\", \"./extensions/uv-default-extension/Extension\", \"./extensions/uv-mediaelement-extension/Extension\", \"./extensions/uv-seadragon-extension/Extension\", \"./extensions/uv-pdf-extension/Extension\", \"./extensions/uv-virtex-extension/Extension\", \"./Utils\", \"./PubSub\", \"./Polyfills\"], function (require, exports, BaseEvents_1, Extension_1, Extension_2, Extension_3, Extension_4, Extension_5, Extension_6, Utils_1, PubSub_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n var UVComponent = /** @class */ (function (_super) {\n __extends(UVComponent, _super);\n function UVComponent(options) {\n var _this = _super.call(this, options) || this;\n _this.isFullScreen = false;\n _this._pubsub = new PubSub_1.PubSub();\n _this._init();\n _this._resize();\n return _this;\n }\n UVComponent.prototype._init = function () {\n var success = _super.prototype._init.call(this);\n if (!success) {\n console.error(\"UV failed to initialise\");\n }\n this._extensions = {};\n this._extensions[manifesto.ResourceType.canvas().toString()] = {\n type: Extension_4.Extension,\n name: 'uv-seadragon-extension'\n };\n this._extensions[manifesto.ResourceType.image().toString()] = {\n type: Extension_4.Extension,\n name: 'uv-seadragon-extension'\n };\n this._extensions[manifesto.ResourceType.movingimage().toString()] = {\n type: Extension_3.Extension,\n name: 'uv-mediaelement-extension'\n };\n this._extensions[manifesto.ResourceType.physicalobject().toString()] = {\n type: Extension_6.Extension,\n name: 'uv-virtex-extension'\n };\n this._extensions[manifesto.ResourceType.sound().toString()] = {\n type: Extension_3.Extension,\n name: 'uv-mediaelement-extension'\n };\n this._extensions[manifesto.RenderingFormat.pdf().toString()] = {\n type: Extension_5.Extension,\n name: 'uv-pdf-extension'\n };\n // presentation 3\n this._extensions[manifesto.MediaType.jpg().toString()] = {\n type: Extension_4.Extension,\n name: 'uv-seadragon-extension'\n };\n this._extensions[manifesto.MediaType.pdf().toString()] = {\n type: Extension_5.Extension,\n name: 'uv-pdf-extension'\n };\n this._extensions[manifesto.MediaType.mp4().toString()] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions[manifesto.MediaType.webm().toString()] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions[manifesto.MediaType.threejs().toString()] = {\n type: Extension_6.Extension,\n name: 'uv-virtex-extension'\n };\n this._extensions['av'] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions['video'] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions['audio/mp3'] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions['audio/mp4'] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions['application/vnd.apple.mpegurl'] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions['application/dash+xml'] = {\n type: Extension_1.Extension,\n name: 'uv-av-extension'\n };\n this._extensions['default'] = {\n type: Extension_2.Extension,\n name: 'uv-default-extension'\n };\n this.set(this.options.data);\n return success;\n };\n UVComponent.prototype.data = function () {\n return {\n annotations: undefined,\n root: \"./uv\",\n canvasIndex: 0,\n collectionIndex: undefined,\n config: undefined,\n configUri: undefined,\n embedded: false,\n iiifResourceUri: '',\n isLightbox: false,\n isReload: false,\n limitLocales: false,\n locales: [\n {\n name: 'en-GB'\n }\n ],\n manifestIndex: 0,\n rangeId: undefined,\n rotation: 0,\n sequenceIndex: 0,\n xywh: ''\n };\n };\n UVComponent.prototype.set = function (data) {\n // if this is the first set\n if (!this.extension) {\n if (!data.iiifResourceUri) {\n this._error(\"iiifResourceUri is required.\");\n return;\n }\n // remove '/' from root\n if (data.root && data.root.endsWith('/')) {\n data.root = data.root.substring(0, data.root.length - 1);\n }\n this._reload(data);\n }\n else {\n // changing any of these data properties forces the UV to reload.\n if (Utils_1.UVUtils.propertiesChanged(data, this.extension.data, ['collectionIndex', 'manifestIndex', 'config', 'configUri', 'domain', 'embedDomain', 'embedScriptUri', 'iiifResourceUri', 'isHomeDomain', 'isLightbox', 'isOnlyInstance', 'isReload', 'locales', 'root'])) {\n this.extension.data = Object.assign({}, this.extension.data, data);\n this._reload(this.extension.data);\n }\n else {\n // no need to reload, just update.\n this.extension.data = Object.assign({}, this.extension.data, data);\n this.extension.render();\n }\n }\n };\n UVComponent.prototype.get = function (key) {\n if (this.extension) {\n return this.extension.data[key];\n }\n };\n UVComponent.prototype.publish = function (event, args) {\n this._pubsub.publish(event, args);\n };\n UVComponent.prototype.subscribe = function (event, cb) {\n this._pubsub.subscribe(event, cb);\n };\n UVComponent.prototype._reload = function (data) {\n var _this = this;\n this._pubsub.dispose(); // remove any existing event listeners\n this.subscribe(BaseEvents_1.BaseEvents.RELOAD, function (data) {\n _this.fire(BaseEvents_1.BaseEvents.RELOAD, data);\n });\n var $elem = $(this.options.target);\n // empty the containing element\n $elem.empty();\n // add loading class\n $elem.addClass('loading');\n jQuery.support.cors = true;\n var that = this;\n Manifold.loadManifest({\n iiifResourceUri: data.iiifResourceUri,\n collectionIndex: data.collectionIndex,\n manifestIndex: data.manifestIndex || 0,\n sequenceIndex: data.sequenceIndex || 0,\n canvasIndex: data.canvasIndex || 0,\n rangeId: data.rangeId,\n locale: (data.locales) ? data.locales[0].name : undefined\n }).then(function (helper) {\n var trackingLabel = helper.getTrackingLabel();\n trackingLabel += ', URI: ' + (window.location !== window.parent.location) ? document.referrer : document.location;\n window.trackingLabel = trackingLabel;\n var sequence;\n if (data.sequenceIndex !== undefined) {\n sequence = helper.getSequenceByIndex(data.sequenceIndex);\n if (!sequence) {\n that._error(\"Sequence \" + data.sequenceIndex + \" not found.\");\n return;\n }\n }\n var canvas;\n if (data.canvasIndex !== undefined) {\n canvas = helper.getCanvasByIndex(data.canvasIndex);\n }\n if (!canvas) {\n that._error(\"Canvas \" + data.canvasIndex + \" not found.\");\n return;\n }\n var extension = undefined;\n // if the canvas has a duration, use the uv-av-extension\n // const duration: number | null = canvas.getDuration();\n // if (typeof(duration) !== 'undefined') {\n // extension = that._extensions[\"av\"];\n // } else {\n // canvasType will always be \"canvas\" in IIIF presentation 3.0\n // to determine the correct extension to use, we need to inspect canvas.content.items[0].format\n // which is an iana media type: http://www.iana.org/assignments/media-types/media-types.xhtml\n var content = canvas.getContent();\n if (content.length) {\n var annotation = content[0];\n var body = annotation.getBody();\n if (body && body.length) {\n var format = body[0].getFormat();\n if (format) {\n extension = that._extensions[format.toString()];\n if (!extension) {\n // try type\n var type = body[0].getType();\n if (type) {\n extension = that._extensions[type.toString()];\n }\n }\n }\n else {\n var type = body[0].getType();\n if (type) {\n extension = that._extensions[type.toString()];\n }\n }\n }\n }\n else {\n var canvasType = canvas.getType();\n if (canvasType) {\n // try using canvasType\n extension = that._extensions[canvasType.toString()];\n }\n // if there isn't an extension for the canvasType, try the format\n if (!extension) {\n var format = canvas.getProperty('format');\n extension = that._extensions[format];\n }\n }\n //}\n // if there still isn't a matching extension, use the default extension.\n if (!extension) {\n extension = that._extensions['default'];\n }\n that._configure(data, extension, function (config) {\n data.config = config;\n that._injectCss(data, extension, function () {\n that._createExtension(extension, data, helper);\n });\n });\n }).catch(function () {\n that._error('Failed to load manifest.');\n });\n };\n UVComponent.prototype._isCORSEnabled = function () {\n return Modernizr.cors;\n };\n UVComponent.prototype._error = function (message) {\n this.fire(BaseEvents_1.BaseEvents.ERROR, message);\n };\n UVComponent.prototype._configure = function (data, extension, cb) {\n var _this = this;\n this._getConfigExtension(data, extension, function (configExtension) {\n if (data.locales) {\n var configPath = data.root + '/lib/' + extension.name + '.' + data.locales[0].name + '.config.json';\n $.getJSON(configPath, function (config) {\n _this._extendConfig(data, extension, config, configExtension, cb);\n });\n }\n });\n };\n UVComponent.prototype._extendConfig = function (data, extension, config, configExtension, cb) {\n config.name = extension.name;\n // if configUri has been set, extend the existing config object.\n if (configExtension) {\n // save a reference to the config extension uri.\n config.uri = data.configUri;\n $.extend(true, config, configExtension);\n //$.extend(true, config, configExtension, data.config);\n }\n cb(config);\n };\n UVComponent.prototype._getConfigExtension = function (data, extension, cb) {\n if (!data.locales) {\n return;\n }\n var sessionConfig = sessionStorage.getItem(extension.name + '.' + data.locales[0].name);\n var configUri = data.configUri;\n if (sessionConfig) {\n cb(JSON.parse(sessionConfig));\n }\n else if (configUri) {\n if (this._isCORSEnabled()) {\n $.getJSON(configUri, function (configExtension) {\n cb(configExtension);\n });\n }\n else {\n // use jsonp\n var settings = {\n url: configUri,\n type: 'GET',\n dataType: 'jsonp',\n jsonp: 'callback',\n jsonpCallback: 'configExtensionCallback'\n };\n $.ajax(settings);\n window.configExtensionCallback = function (configExtension) {\n cb(configExtension);\n };\n }\n }\n else {\n cb(null);\n }\n };\n UVComponent.prototype._injectCss = function (data, extension, cb) {\n if (!data.locales) {\n return;\n }\n var cssPath = data.root + '/themes/' + data.config.options.theme + '/css/' + extension.name + '/theme.css';\n var locale = data.locales[0].name;\n var themeName = extension.name.toLowerCase() + '-theme-' + locale.toLowerCase();\n var $existingCSS = $('#' + themeName.toLowerCase());\n if (!$existingCSS.length) {\n $('head').append('');\n cb();\n }\n else {\n cb();\n }\n };\n UVComponent.prototype._createExtension = function (extension, data, helper) {\n this.extension = new extension.type();\n if (this.extension) {\n this.extension.component = this;\n this.extension.data = data;\n this.extension.helper = helper;\n this.extension.name = extension.name;\n this.extension.create();\n }\n };\n UVComponent.prototype.exitFullScreen = function () {\n if (this.extension) {\n this.extension.exitFullScreen();\n }\n };\n UVComponent.prototype.resize = function () {\n if (this.extension) {\n this.extension.resize();\n }\n };\n return UVComponent;\n }(_Components.BaseComponent));\n exports.default = UVComponent;\n});\n\n", - "if (typeof jQuery === \"function\") {\n define('jquery', [], function () {\n return jQuery;\n });\n}\n// IE CustomEvent Polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent\n(function () {\n if (typeof window.CustomEvent === \"function\")\n return false;\n function CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent;\n return;\n})();\n// bundled into dist/uv.js\n// - things in src/lib that are generic to all extensions\n// - bundled data providers\n// - UVComponent\nrequirejs([\n './lib/base64.min.js',\n './lib/browserdetect.js',\n './lib/detectmobilebrowser.js',\n './lib/jquery.xdomainrequest.js',\n './lib/modernizr.js',\n './lib/ex.es3.min.js',\n './lib/BaseComponent.js',\n './lib/KeyCodes.js',\n './lib/HTTPStatusCode.js',\n './lib/jquery-plugins.js',\n './lib/ba-tiny-pubsub.js',\n './lib/manifesto.js',\n './lib/manifold.js',\n './lib/Utils.js',\n './lib/xss.min.js',\n 'URLDataProvider',\n 'UVComponent'\n], function (base64, browserdetect, detectmobilebrowser, xdomainrequest, modernizr, sanitize, exjs, basecomponent, keycodes, httpstatuscodes, jqueryplugins, pubsub, manifesto, manifold, utils, URLDataProvider, UVComponent) {\n window.UV = UVComponent.default;\n window.UV.URLDataProvider = URLDataProvider.default;\n window.dispatchEvent(new CustomEvent('uvLoaded', {}));\n});\n\ndefine(\"app\", function(){});\n\n" - ] -} \ No newline at end of file diff --git a/public/uv/favicon.ico b/public/uv/favicon.ico deleted file mode 100644 index b4688e9349..0000000000 Binary files a/public/uv/favicon.ico and /dev/null differ diff --git a/public/uv/helpers.js b/public/uv/helpers.js deleted file mode 100644 index 1bc08524ca..0000000000 --- a/public/uv/helpers.js +++ /dev/null @@ -1,173 +0,0 @@ -function createUV(selector, data, dataProvider) { - var uv; - var isFullScreen = false; - var $container = $(selector); - $container.empty(); - var $parent = $('
                      '); - $container.append($parent); - var $uv = $('
                      '); - $parent.append($uv); - - function resize() { - if (uv) { - if (isFullScreen) { - $parent.width(window.innerWidth); - $parent.height(window.innerHeight); - } else { - $parent.width($container.width()); - $parent.height($container.height()); - } - uv.resize(); - } - } - - window.addEventListener('resize', function() { - resize(); - }); - - uv = new UV({ - target: $uv[0], - data: data - }); - - uv.on('create', function(obj) { - resize(); - }, false); - - uv.on('created', function(obj) { - resize(); - }, false); - - uv.on('collectionIndexChanged', function(collectionIndex) { - dataProvider.set('c', collectionIndex); - }, false); - - uv.on('manifestIndexChanged', function(manifestIndex) { - dataProvider.set('m', manifestIndex); - }, false); - - uv.on('sequenceIndexChanged', function(sequenceIndex) { - dataProvider.set('s', sequenceIndex); - }, false); - - uv.on('canvasIndexChanged', function(canvasIndex) { - dataProvider.set('cv', canvasIndex); - }, false); - - uv.on('rangeChanged', function(rangeId) { - dataProvider.set('rid', rangeId); - }, false); - - uv.on('openseadragonExtension.rotationChanged', function(rotation) { - dataProvider.set('r', rotation); - }, false); - - uv.on('openseadragonExtension.xywhChanged', function(xywh) { - dataProvider.set('xywh', xywh); - }, false); - - uv.on('openseadragonExtension.currentViewUri', function(data) { - //console.log('openseadragonExtension.currentViewUri', obj); - }, false); - - uv.on('reload', function(data) { - data.isReload = true; - uv.set(data); - }, false); - - uv.on('toggleFullScreen', function(data) { - isFullScreen = data.isFullScreen; - - if (data.overrideFullScreen) { - return; - } - - var elem = $parent[0]; - - if (isFullScreen) { - var requestFullScreen = getRequestFullScreen(elem); - if (requestFullScreen) { - requestFullScreen.call(elem); - resize(); - } - } else { - var exitFullScreen = getExitFullScreen(); - if (exitFullScreen) { - exitFullScreen.call(document); - resize(); - } - } - }, false); - - uv.on('error', function(message) { - console.error(message); - }, false); - - uv.on('bookmark', function(data) { - - var absUri = parent.document.URL; - var parts = Utils.Urls.getUrlParts(absUri); - var relUri = parts.pathname + parts.search + parent.document.location.hash; - - if (!relUri.startsWith("/")) { - relUri = "/" + relUri; - } - - data.path = relUri; - - console.log('bookmark', data); - },false); - - $(document).on('fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange', function(e) { - if (e.type === 'webkitfullscreenchange' && !document.webkitIsFullScreen || - e.type === 'fullscreenchange' && !document.fullscreenElement || - e.type === 'mozfullscreenchange' && !document.mozFullScreen || - e.type === 'MSFullscreenChange' && document.msFullscreenElement === null) { - uv.exitFullScreen(); - } - }); - - return uv; -} - -function getRequestFullScreen(elem) { - - if (elem.webkitRequestFullscreen) { - return elem.webkitRequestFullscreen; - } - - if (elem.mozRequestFullScreen) { - return elem.mozRequestFullScreen; - } - - if (elem.msRequestFullscreen) { - return elem.msRequestFullscreen; - } - - if (elem.requestFullscreen) { - return elem.requestFullscreen; - } - - return false; -} - -function getExitFullScreen() { - - if (document.webkitExitFullscreen) { - return document.webkitExitFullscreen; - } - - if (document.msExitFullscreen) { - return document.msExitFullscreen; - } - - if (document.mozCancelFullScreen) { - return document.mozCancelFullScreen; - } - - if (document.exitFullscreen) { - return document.exitFullscreen; - } - - return false; -} \ No newline at end of file diff --git a/public/uv/img/pixel.gif b/public/uv/img/pixel.gif deleted file mode 100644 index 9a4dbb4f0c..0000000000 Binary files a/public/uv/img/pixel.gif and /dev/null differ diff --git a/public/uv/info.json b/public/uv/info.json deleted file mode 100644 index eebc2c7c10..0000000000 --- a/public/uv/info.json +++ /dev/null @@ -1 +0,0 @@ -{ "version": "3.0.27" } diff --git a/public/uv/lib/AVComponent.js b/public/uv/lib/AVComponent.js deleted file mode 100644 index 8f025d543f..0000000000 --- a/public/uv/lib/AVComponent.js +++ /dev/null @@ -1,2304 +0,0 @@ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - } - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var IIIFComponents; -(function (IIIFComponents) { - var AVVolumeControl = /** @class */ (function (_super) { - __extends(AVVolumeControl, _super); - function AVVolumeControl(options) { - var _this = _super.call(this, options) || this; - _this._lastVolume = 1; - _this._data = { - volume: 1 - }; - _this._init(); - _this._resize(); - return _this; - } - AVVolumeControl.prototype._init = function () { - var _this = this; - var success = _super.prototype._init.call(this); - if (!success) { - console.error("Component failed to initialise"); - } - this._$volumeMute = $("\n "); - this._$volumeSlider = $('
                      '); - this._$element.append(this._$volumeMute, this._$volumeSlider); - var that = this; - this._$volumeMute.on('touchstart click', function (e) { - e.preventDefault(); - // start reducer - if (_this._data.volume !== 0) { - // mute - _this._lastVolume = _this._data.volume; - _this._data.volume = 0; - } - else { - // unmute - _this._data.volume = _this._lastVolume; - } - // end reducer - _this.fire(VolumeEvents.VOLUME_CHANGED, _this._data.volume); - }); - this._$volumeSlider.slider({ - value: that._data.volume, - step: 0.1, - orientation: "horizontal", - range: "min", - min: 0, - max: 1, - animate: false, - create: function (evt, ui) { - }, - slide: function (evt, ui) { - // start reducer - that._data.volume = ui.value; - if (that._data.volume === 0) { - that._lastVolume = 0; - } - // end reducer - that.fire(VolumeEvents.VOLUME_CHANGED, that._data.volume); - }, - stop: function (evt, ui) { - } - }); - return success; - }; - AVVolumeControl.prototype.set = function (data) { - this._data = Object.assign(this._data, data); - this._render(); - }; - AVVolumeControl.prototype._render = function () { - if (this._data.volume !== undefined) { - this._$volumeSlider.slider({ - value: this._data.volume - }); - if (this._data.volume === 0) { - var label = this.options.data.content.unmute; - this._$volumeMute.prop('title', label); - this._$volumeMute.find('i').switchClass('on', 'off'); - } - else { - var label = this.options.data.content.mute; - this._$volumeMute.prop('title', label); - this._$volumeMute.find('i').switchClass('off', 'on'); - } - } - }; - AVVolumeControl.prototype._resize = function () { - }; - return AVVolumeControl; - }(_Components.BaseComponent)); - IIIFComponents.AVVolumeControl = AVVolumeControl; - var VolumeEvents = /** @class */ (function () { - function VolumeEvents() { - } - VolumeEvents.VOLUME_CHANGED = 'volumechanged'; - return VolumeEvents; - }()); - IIIFComponents.VolumeEvents = VolumeEvents; - var CanvasInstance = /** @class */ (function (_super) { - __extends(CanvasInstance, _super); - function CanvasInstance(options) { - var _this = _super.call(this, options) || this; - _this._canvasClockFrequency = 25; - _this._canvasClockStartDate = 0; - _this._canvasClockTime = 0; - _this._canvasHeight = 0; - _this._canvasWidth = 0; - _this._data = _this.data(); - _this._highPriorityFrequency = 25; - _this._isPlaying = false; - _this._isStalled = false; - //private _lastCanvasHeight: number | undefined; - //private _lastCanvasWidth: number | undefined; - _this._lowPriorityFrequency = 250; - _this._mediaSyncMarginSecs = 1; - _this._rangeSpanPadding = 0.0; - _this._readyMediaCount = 0; - _this._stallRequestedBy = []; //todo: type - _this._wasPlaying = false; - //private _waveformNeedsRedraw: boolean = true; - _this.ranges = []; - _this.waveforms = []; - _this.isOnlyCanvasInstance = false; - _this.waveformDeltaX = 0; - _this.waveformPageX = 0; - _this._scaleY = function (amplitude, height) { - var range = 256; - return Math.max(_this._data.waveformBarWidth, (amplitude * height / range)); - }; - _this._data = _this.options.data; - _this.$playerElement = $('
                      '); - return _this; - } - CanvasInstance.prototype.loaded = function () { - var _this = this; - _this.$playerElement.removeClass('player--loading'); - return _this; - }; - CanvasInstance.prototype.isPlaying = function () { - return this._isPlaying; - }; - CanvasInstance.prototype.getClockTime = function () { - return this._canvasClockTime; - }; - CanvasInstance.prototype.init = function () { - var _this = this; - if (!this._data || !this._data.content || !this._data.canvas) { - console.warn('unable to initialise, missing canvas or content'); - return; - } - this._$hoverPreviewTemplate = $('
                      '); - this._$canvasContainer = $('
                      '); - this._$optionsContainer = $('
                      '); - this._$rangeTimelineContainer = $('
                      '); - this._$canvasTimelineContainer = $('
                      '); - this._$canvasHoverPreview = this._$hoverPreviewTemplate.clone(); - this._$canvasHoverHighlight = $('
                      '); - this._$rangeHoverPreview = this._$hoverPreviewTemplate.clone(); - this._$rangeHoverHighlight = $('
                      '); - this._$durationHighlight = $('
                      '); - this._$timelineItemContainer = $('
                      '); - this._$controlsContainer = $('
                      '); - this._$prevButton = $("\n "); - this._$playButton = $("\n "); - this._$nextButton = $("\n "); - this._$timeDisplay = $('
                      /
                      '); - this._$canvasTime = this._$timeDisplay.find('.canvas-time'); - this._$canvasDuration = this._$timeDisplay.find('.canvas-duration'); - if (this.isVirtual()) { - this.$playerElement.addClass('virtual'); - } - var $volume = $('
                      '); - this._volume = new AVVolumeControl({ - target: $volume[0], - data: Object.assign({}, this._data) - }); - this._volume.on(VolumeEvents.VOLUME_CHANGED, function (value) { - _this.fire(VolumeEvents.VOLUME_CHANGED, value); - }, false); - this._$controlsContainer.append(this._$prevButton, this._$playButton, this._$nextButton, this._$timeDisplay, $volume); - this._$canvasTimelineContainer.append(this._$canvasHoverPreview, this._$canvasHoverHighlight, this._$durationHighlight); - this._$rangeTimelineContainer.append(this._$rangeHoverPreview, this._$rangeHoverHighlight); - this._$optionsContainer.append(this._$canvasTimelineContainer, this._$rangeTimelineContainer, this._$timelineItemContainer, this._$controlsContainer); - this.$playerElement.append(this._$canvasContainer, this._$optionsContainer); - this._$canvasHoverPreview.hide(); - this._$rangeHoverPreview.hide(); - if (this._data && this._data.helper && this._data.canvas) { - var ranges_1 = []; - // if the canvas is virtual, get the ranges for all sub canvases - if (this.isVirtual()) { - this._data.canvas.canvases.forEach(function (canvas) { - if (_this._data && _this._data.helper) { - var r = _this._data.helper.getCanvasRanges(canvas); - var clonedRanges_1 = []; - // shift the range targets forward by the duration of their previous canvases - r.forEach(function (range) { - var clonedRange = jQuery.extend(true, {}, range); - clonedRanges_1.push(clonedRange); - if (clonedRange.canvases && clonedRange.canvases.length) { - for (var i = 0; i < clonedRange.canvases.length; i++) { - clonedRange.canvases[i] = AVComponentUtils.retargetTemporalComponent(_this._data.canvas.canvases, clonedRange.__jsonld.items[i].id); - } - } - }); - ranges_1.push.apply(ranges_1, clonedRanges_1); - } - }); - } - else { - ranges_1 = ranges_1.concat(this._data.helper.getCanvasRanges(this._data.canvas)); - } - ranges_1.forEach(function (range) { - _this.ranges.push(range); - }); - } - var canvasWidth = this._data.canvas.getWidth(); - var canvasHeight = this._data.canvas.getHeight(); - if (!canvasWidth) { - this._canvasWidth = this.$playerElement.parent().width(); // this._data.defaultCanvasWidth; - } - else { - this._canvasWidth = canvasWidth; - } - if (!canvasHeight) { - this._canvasHeight = this._canvasWidth * this._data.defaultAspectRatio; //this._data.defaultCanvasHeight; - } - else { - this._canvasHeight = canvasHeight; - } - var that = this; - var prevClicks = 0; - var prevTimeout = 0; - this._$prevButton.on('touchstart click', function (e) { - e.preventDefault(); - prevClicks++; - if (prevClicks === 1) { - // single click - //console.log('single'); - _this._previous(false); - prevTimeout = setTimeout(function () { - prevClicks = 0; - prevTimeout = 0; - }, _this._data.doubleClickMS); - } - else { - // double click - //console.log('double'); - _this._previous(true); - clearTimeout(prevTimeout); - prevClicks = 0; - prevTimeout = 0; - } - }); - this._$playButton[0].addEventListener('click', function (e) { - e.preventDefault(); - if (_this._isPlaying) { - _this.pause(); - } - else { - _this.play(); - } - }, false); - this._$nextButton.on('touchstart click', function (e) { - e.preventDefault(); - _this._next(); - }); - this._$canvasTimelineContainer.slider({ - value: 0, - step: 0.01, - orientation: "horizontal", - range: "min", - max: that._getDuration(), - animate: false, - create: function (evt, ui) { - // on create - }, - slide: function (evt, ui) { - that._setCurrentTime(ui.value); - }, - stop: function (evt, ui) { - //this._setCurrentTime(ui.value); - } - }); - this._$canvasTimelineContainer.mouseout(function () { - that._$canvasHoverHighlight.width(0); - that._$canvasHoverPreview.hide(); - }); - this._$rangeTimelineContainer.mouseout(function () { - that._$rangeHoverHighlight.width(0); - that._$rangeHoverPreview.hide(); - }); - this._$canvasTimelineContainer.on("mousemove", function (e) { - _this._updateHoverPreview(e, _this._$canvasTimelineContainer, _this._getDuration()); - }); - this._$rangeTimelineContainer.on("mousemove", function (e) { - if (_this._data.range) { - var duration = _this._data.range.getDuration(); - _this._updateHoverPreview(e, _this._$rangeTimelineContainer, duration ? duration.getLength() : 0); - } - }); - // create annotations - this._contentAnnotations = []; - var items = this._data.canvas.getContent(); // (this._data.canvas).__jsonld.content[0].items; - // always hide timelineItemContainer for now - //if (items.length === 1) { - this._$timelineItemContainer.hide(); - //} - for (var i = 0; i < items.length; i++) { - var item = items[i]; - /* - if (item.motivation != 'painting') { - return null; - } - */ - var mediaSource = void 0; - var bodies = item.getBody(); - if (!bodies.length) { - console.warn('item has no body'); - return; - } - var body = this._getBody(bodies); - if (!body) { - // if no suitable format was found for the current browser, skip this item. - console.warn('unable to find suitable format for', item.id); - continue; - } - var type = body.getType(); - var format = body.getFormat(); - // if (type && type.toString() === 'choice') { - // // Choose first "Choice" item as body - // const tmpItem = item; - // item.body = tmpItem.body[0].items[0]; - // mediaSource = item.body.id.split('#')[0]; - // } else - if (type && type.toString() === 'textualbody') { - //mediaSource = (body).value; - } - else { - mediaSource = body.id.split('#')[0]; - } - /* - var targetFragment = (item.target.indexOf('#') != -1) ? item.target.split('#t=')[1] : '0, '+ canvasClockDuration, - fragmentTimings = targetFragment.split(','), - startTime = parseFloat(fragmentTimings[0]), - endTime = parseFloat(fragmentTimings[1]); - - //TODO: Check format (in "target" as MFID or in "body" as "width", "height" etc.) - var fragmentPosition = [0, 0, 100, 100], - positionTop = fragmentPosition[1], - positionLeft = fragmentPosition[0], - mediaWidth = fragmentPosition[2], - mediaHeight = fragmentPosition[3]; - */ - var target = item.getTarget(); - if (!target) { - console.warn('item has no target'); - return; - } - var xywh = AVComponentUtils.getSpatialComponent(target); - var t = Manifesto.Utils.getTemporalComponent(target); - if (!xywh) { - xywh = [0, 0, this._canvasWidth, this._canvasHeight]; - } - if (!t) { - t = [0, this._getDuration()]; - } - var positionLeft = parseInt(String(xywh[0])), positionTop = parseInt(String(xywh[1])), mediaWidth = parseInt(String(xywh[2])), mediaHeight = parseInt(String(xywh[3])), startTime = parseFloat(String(t[0])), endTime = parseFloat(String(t[1])); - var percentageTop = this._convertToPercentage(positionTop, this._canvasHeight), percentageLeft = this._convertToPercentage(positionLeft, this._canvasWidth), percentageWidth = this._convertToPercentage(mediaWidth, this._canvasWidth), percentageHeight = this._convertToPercentage(mediaHeight, this._canvasHeight); - var temporalOffsets = /[\?|&]t=([^&]+)/g.exec(body.id); - var ot = void 0; - if (temporalOffsets && temporalOffsets[1]) { - ot = temporalOffsets[1].split(','); - } - else { - ot = [null, null]; - } - var offsetStart = (ot[0]) ? parseInt(ot[0]) : ot[0], offsetEnd = (ot[1]) ? parseInt(ot[1]) : ot[1]; - // todo: type this - var itemData = { - 'active': false, - 'end': endTime, - 'endOffset': offsetEnd, - 'format': format, - 'height': percentageHeight, - 'left': percentageLeft, - 'source': mediaSource, - 'start': startTime, - 'startOffset': offsetStart, - 'top': percentageTop, - 'type': type, - 'width': percentageWidth - }; - this._renderMediaElement(itemData); - // waveform - // todo: create annotation.getSeeAlso - var seeAlso = item.getProperty('seeAlso'); - if (seeAlso && seeAlso.length) { - var dat = seeAlso[0].id; - this.waveforms.push(dat); - } - } - this._renderWaveform(); - }; - CanvasInstance.prototype._getBody = function (bodies) { - // if there's an HLS format and HLS is supported in this browser - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - var format = body.getFormat(); - if (format) { - if (AVComponentUtils.isHLSFormat(format) && AVComponentUtils.canPlayHls()) { - return body; - } - } - } - // if there's a Dash format and the browser isn't Safari - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - var format = body.getFormat(); - if (format) { - if (AVComponentUtils.isMpegDashFormat(format) && !AVComponentUtils.isSafari()) { - return body; - } - } - } - // otherwise, return the first format that isn't HLS or Dash - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - var format = body.getFormat(); - if (format) { - if (!AVComponentUtils.isHLSFormat(format) && !AVComponentUtils.isMpegDashFormat(format)) { - return body; - } - } - } - // couldn't find a suitable format - return null; - }; - CanvasInstance.prototype._getDuration = function () { - if (this._data && this._data.canvas) { - return this._data.canvas.getDuration(); - } - return 0; - }; - CanvasInstance.prototype.data = function () { - return { - waveformColor: "#fff", - waveformBarSpacing: 4, - waveformBarWidth: 2, - volume: 1 - }; - }; - CanvasInstance.prototype.isVirtual = function () { - return this._data.canvas instanceof VirtualCanvas; - }; - CanvasInstance.prototype.isVisible = function () { - return !!this._data.visible; - }; - CanvasInstance.prototype.includesVirtualSubCanvas = function (canvasId) { - if (this.isVirtual() && this._data.canvas && this._data.canvas.canvases) { - for (var i = 0; i < this._data.canvas.canvases.length; i++) { - var canvas = this._data.canvas.canvases[i]; - if (Manifesto.Utils.normaliseUrl(canvas.id) === canvasId) { - return true; - } - } - } - return false; - }; - CanvasInstance.prototype.set = function (data) { - var _this = this; - var oldData = Object.assign({}, this._data); - this._data = Object.assign(this._data, data); - var diff = AVComponentUtils.diff(oldData, this._data); - if (diff.includes('visible')) { - if (this._data.canvas) { - if (this._data.visible) { - this._rewind(); - this.$playerElement.show(); - //console.log('show ' + this._data.canvas.id); - } - else { - this.$playerElement.hide(); - this.pause(); - //console.log('hide ' + this._data.canvas.id); - } - this.resize(); - } - } - if (diff.includes('range')) { - if (this._data.helper) { - if (!this._data.range) { - this.fire(AVComponent.Events.RANGE_CHANGED, null); - } - else { - var duration = this._data.range.getDuration(); - if (duration) { - // Only change the current time if the current time is outside of the current time. - if (duration.start >= this._canvasClockTime || duration.end <= this._canvasClockTime) { - this._setCurrentTime(duration.start); - } - if (this._data.autoPlay) { - this.play(); - } - this.fire(AVComponent.Events.RANGE_CHANGED, this._data.range.id, this._data.range); - } - } - } - } - if (diff.includes('volume')) { - this._contentAnnotations.forEach(function ($mediaElement) { - var volume = (_this._data.volume !== undefined) ? _this._data.volume : 1; - $($mediaElement.element).prop('volume', volume); - _this._volume.set({ - volume: _this._data.volume - }); - }); - } - else { - this._render(); - } - if (diff.includes('limitToRange')) { - this._render(); - } - }; - CanvasInstance.prototype._hasRangeChanged = function () { - this._checkMediaSynchronization(); - var range = this._getRangeForCurrentTime(); - if (range && !this._data.limitToRange && (!this._data.range || (this._data.range && range.id !== this._data.range.id))) { - if(this._data.range && this._canvasClockTime <= this._data.range.getDuration().end && this._canvasClockTime >= this._data.range.getDuration().start) { - return - } - this.set({ - range: jQuery.extend(true, { autoChanged: true }, range) - }); - } - }; - CanvasInstance.prototype._getRangeForCurrentTime = function (parentRange) { - var ranges; - if (!parentRange) { - ranges = this.ranges; - } - else { - ranges = parentRange.getRanges(); - } - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - // if the range spans the current time, and is navigable, return it. - // otherwise, try to find a navigable child range. - if (this._rangeSpansCurrentTime(range)) { - if (this._rangeNavigable(range)) { - return range; - } - var childRanges = range.getRanges(); - // if a child range spans the current time, recurse into it - for (var i_1 = 0; i_1 < childRanges.length; i_1++) { - var childRange = childRanges[i_1]; - if (this._rangeSpansCurrentTime(childRange)) { - return this._getRangeForCurrentTime(childRange); - } - } - // this range isn't navigable, and couldn't find a navigable child range. - // therefore return the parent range (if any). - return range.parentRange; - } - } - return undefined; - }; - CanvasInstance.prototype._rangeSpansCurrentTime = function (range) { - if (range.spansTime(Math.ceil(this._canvasClockTime) + this._rangeSpanPadding)) { - return true; - } - return false; - }; - CanvasInstance.prototype._rangeNavigable = function (range) { - var behavior = range.getBehavior(); - if (behavior && behavior.toString() === manifesto.Behavior.nonav().toString()) { - return false; - } - return true; - }; - CanvasInstance.prototype._render = function () { - if (this._data.range) { - var duration = this._data.range.getDuration(); - if (duration) { - // get the total length in seconds. - var totalLength = this._getDuration(); - // get the length of the timeline container - var timelineLength = this._$canvasTimelineContainer.width(); - // get the ratio of seconds to length - var ratio = timelineLength / totalLength; - var start = duration.start * ratio; - var end = duration.end * ratio; - // if the end is on the next canvas - if (end > totalLength || end < start) { - end = totalLength; - } - var width = end - start; - //console.log(width); - if (this.isVirtual() || this.isOnlyCanvasInstance) { - this._$durationHighlight.show(); - // set the start position and width - this._$durationHighlight.css({ - left: start, - width: width - }); - } - else { - this._$durationHighlight.hide(); - } - var that_1 = this; - // try to destroy existing rangeTimelineContainer - if (this._$rangeTimelineContainer.data("ui-sortable")) { - this._$rangeTimelineContainer.slider("destroy"); - } - this._$rangeTimelineContainer.slider({ - value: duration.start, - step: 0.01, - orientation: "horizontal", - range: "min", - min: duration.start, - max: duration.end, - animate: false, - create: function (evt, ui) { - // on create - }, - slide: function (evt, ui) { - that_1._setCurrentTime(ui.value); - }, - stop: function (evt, ui) { - //this._setCurrentTime(ui.value); - } - }); - } - } - else { - this._$durationHighlight.hide(); - } - if (this._data.limitToRange && this._data.range) { - this._$canvasTimelineContainer.hide(); - this._$rangeTimelineContainer.show(); - } - else { - this._$canvasTimelineContainer.show(); - this._$rangeTimelineContainer.hide(); - } - this._updateCurrentTimeDisplay(); - this._updateDurationDisplay(); - this._drawWaveform(); - }; - CanvasInstance.prototype.getCanvasId = function () { - if (this._data && this._data.canvas) { - return this._data.canvas.id; - } - return undefined; - }; - CanvasInstance.prototype._updateHoverPreview = function (e, $container, duration) { - var offset = $container.offset(); - var x = e.pageX - offset.left; - var $hoverArrow = $container.find('.arrow'); - var $hoverHighlight = $container.find('.hover-highlight'); - var $hoverPreview = $container.find('.hover-preview'); - $hoverHighlight.width(x); - var fullWidth = $container.width(); - var ratio = x / fullWidth; - var seconds = Math.min(duration * ratio); - $hoverPreview.find('.label').text(AVComponentUtils.formatTime(seconds)); - var hoverPreviewWidth = $hoverPreview.outerWidth(); - var hoverPreviewHeight = $hoverPreview.outerHeight(); - var left = x - hoverPreviewWidth * 0.5; - var arrowLeft = hoverPreviewWidth * 0.5 - 6; - if (left < 0) { - left = 0; - arrowLeft = x - 6; - } - if (left + hoverPreviewWidth > fullWidth) { - left = fullWidth - hoverPreviewWidth; - arrowLeft = (hoverPreviewWidth - (fullWidth - x)) - 6; - } - $hoverPreview.css({ - left: left, - top: hoverPreviewHeight * -1 + 'px' - }).show(); - $hoverArrow.css({ - left: arrowLeft - }); - }; - CanvasInstance.prototype._previous = function (isDouble) { - if (this._data.limitToRange) { - // if only showing the range, single click rewinds, double click goes to previous range unless navigation is contrained to range - if (isDouble) { - if (this._isNavigationConstrainedToRange()) { - this._rewind(); - } - else { - this.fire(CanvasInstanceEvents.PREVIOUS_RANGE); - } - } - else { - this._rewind(); - } - } - else { - // not limited to range. - // if there is a currentDuration, single click goes to previous range, double click clears current duration and rewinds. - // if there is no currentDuration, single and double click rewinds. - if (this._data.range) { - if (isDouble) { - this.set({ - range: undefined - }); - this._rewind(); - } - else { - this.fire(CanvasInstanceEvents.PREVIOUS_RANGE); - } - } - else { - this._rewind(); - } - } - }; - CanvasInstance.prototype._next = function () { - if (this._data.limitToRange) { - if (this._isNavigationConstrainedToRange()) { - this._fastforward(); - } - else { - this.fire(CanvasInstanceEvents.NEXT_RANGE); - } - } - else { - this.fire(CanvasInstanceEvents.NEXT_RANGE); - } - }; - CanvasInstance.prototype.destroy = function () { - window.clearInterval(this._highPriorityInterval); - window.clearInterval(this._lowPriorityInterval); - window.clearInterval(this._canvasClockInterval); - }; - CanvasInstance.prototype._convertToPercentage = function (pixelValue, maxValue) { - var percentage = (pixelValue / maxValue) * 100; - return percentage; - }; - CanvasInstance.prototype._renderMediaElement = function (data) { - var _this = this; - var $mediaElement; - var type = data.type.toString().toLowerCase(); - switch (type) { - case 'video': - $mediaElement = $('