diff --git a/.vscode/settings.json b/.vscode/settings.json index b96a6379d..285d055ea 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,4 +8,6 @@ "**/*.js": { "when": "$(basename).ts"}, "**/*.js.map": true } +, +"typescript.check.workspaceVersion": false } \ No newline at end of file diff --git a/README.md b/README.md index 1b062f6df..7be603beb 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ # Universal Viewer -[![Build Status](https://travis-ci.org/UniversalViewer/universalviewer.svg?branch=master)](https://travis-ci.org/UniversalViewer/universalviewer) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/UniversalViewer/universalviewer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Build Status](https://travis-ci.org/UniversalViewer/universalviewer.svg?branch=master)](https://travis-ci.org/UniversalViewer/universalviewer) +   + - npm install universalviewer - -or - - bower install uv + npm install universalviewer --save [Examples](http://universalviewer.io/examples/) @@ -16,25 +14,20 @@ or ## Contributors -![Wellcome Library](https://raw.githubusercontent.com/UniversalViewer/assets/master/wellcome_logo.png "Wellcome Library") -![British Library](https://raw.githubusercontent.com/UniversalViewer/assets/master/bl_logo.png "British Library") -![National Library of Wales](https://raw.githubusercontent.com/UniversalViewer/assets/master/nlw_logo.png "National Library of Wales") -![Villanova University, Falvey Memorial Library](https://raw.githubusercontent.com/UniversalViewer/assets/master/vufalvey_logo.png "Villanova University, Falvey Memorial Library") -![Riksarkivet](https://raw.githubusercontent.com/Riksarkivet/assets/master/logo-en.png "Riksarkivet, The Swedish National Archives") - -## About +![Contributors](https://raw.githubusercontent.com/UniversalViewer/assets/master/logos.jpg "Contributors") -The Universal Viewer is an [open source](https://github.com/UniversalViewer/universalviewer/blob/master/LICENSE.txt) project to enable cultural heritage institutions to present their digital artifacts in an [IIIF-compliant](http://iiif.io/) and highly customisable user interface. +## Features: -Features: - -- [OpenSeadragon](https://openseadragon.github.io/) image zooming using the [IIIF image API](http://iiif.io/api/image/2.0/). -- YouTube-style embedding with deep links to specific pages/zoom regions. -- [Themable](https://universalviewer.gitbooks.io/custom-themes/content/), fork the [UV theme](https://github.com/UniversalViewer/uv-en-GB-theme) on github to create your own. -- Highly [configurable](https://github.com/UniversalViewer/universalviewer/wiki/Configuration) and [extensible](http://universalviewer.gitbooks.io/custom-extensions/content/). -- Supports "IxIF" out of the box, allowing [3D](http://universalviewer.io/examples/?manifest=http://files.universalviewer.io/manifests/nelis/ecorche.json), [audio](http://universalviewer.io/examples/?manifest=http://wellcomelibrary.org/iiif/b17307922/manifest), [video](http://universalviewer.io/examples/?manifest=http://wellcomelibrary.org/iiif/b16659090/manifest), and [pdf](http://universalviewer.io/examples/?manifest=http://wellcomelibrary.org/iiif/b17502792/manifest) viewing experiences. -- Supports search and autocomplete service integration with overlayed search results. -- Internationalised UI using [transifex.com](https://www.transifex.com/) (currently supports English and Welsh. Volunteers for more translations gratefully accepted!) +- ### Zoomable +

OpenSeadragon image zooming using the IIIF image API

+- ### Embeddable +

YouTube-style embedding with deep links to specific pages/zoom regions.

+- ### Themable +

Fork the UV theme on github to create your own.

+- ### Configurable +

The UV has its own visual configuration editor allowing all settings to be customised.

+- ### Extensible +

Supports "IxIF" out of the box, allowing 3D, audio, video, and pdf viewing experiences.

[More about the Universal Viewer](https://github.com/UniversalViewer/universalviewer/wiki/About) @@ -89,11 +82,9 @@ To build the distribution version of the UV, just run (on the command line, in t A versioned `uv-major.minor.patch` folder along with compressed .zip and .tar files will appear in the `/dist` folder. Use these in your website, or alternatively use: - bower install uv --save + npm install universalviewer --save -which will download the distribution folder to `bower_components`. - -See https://github.com/UniversalViewer/demo-site for examples. +which will download the distribution folder to `node_modules`. ### Examples diff --git a/bower.json b/bower.json index 80a21cb11..8bbc30e27 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "Universal Viewer", - "version": "1.8.38", + "version": "2.0.0", "description": "The Universal Viewer is an open source project to enable cultural heritage institutions to present their digital artifacts in an IIIF-compliant and highly customisable user interface.", "repository": { "type": "git", diff --git a/config.js b/config.js index db2bc358a..08413a460 100644 --- a/config.js +++ b/config.js @@ -16,6 +16,8 @@ var Config = (function () { ], typings: [ 'node_modules/base-component/dist/base-component.d.ts', + 'node_modules/base-component/typings/corejs.d.ts', + 'node_modules/base-component/typings/jquery.d.ts', 'node_modules/jquery-plugins/typings/jquery-plugins.d.ts', 'node_modules/key-codes/dist/key-codes.d.ts', 'node_modules/manifold/dist/manifold.bundle.d.ts', diff --git a/dist/uv-1.8.38/lib/app.js b/dist/uv-1.8.38/lib/app.js deleted file mode 100644 index 4e94a24dc..000000000 --- a/dist/uv-1.8.38/lib/app.js +++ /dev/null @@ -1,8 +0,0 @@ -var requirejs,require,define;!function(global){function commentReplace(e,t,i,n){return n||""}function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var i;for(i=0;i-1&&(!e[i]||!t(e[i],i,e));i-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var i;for(i in e)if(hasProp(e,i)&&t(e[i],i))break}function mixin(e,t,i,n){return t&&eachProp(t,function(t,o){(i||!hasProp(e,o))&&(!n||"object"!=typeof t||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[o]=t:(e[o]||(e[o]={}),mixin(e[o],t,i,n)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,i,n){var o=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return o.requireType=e,o.requireModules=n,i&&(o.originalError=i),o}function newContext(e){function t(e){var t,i;for(t=0;t0&&(e.splice(t-1,2),t-=2)}}function i(e,i,n){var o,s,r,a,l,h,u,c,p,d,g,f,m=i&&i.split("/"),v=x.map,$=v&&v["*"];if(e&&(e=e.split("/"),u=e.length-1,x.nodeIdCompat&&jsSuffixRegExp.test(e[u])&&(e[u]=e[u].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&m&&(f=m.slice(0,m.length-1),e=f.concat(e)),t(e),e=e.join("/")),n&&v&&(m||$)){r=e.split("/");e:for(a=r.length;a>0;a-=1){if(h=r.slice(0,a).join("/"),m)for(l=m.length;l>0;l-=1)if(s=getOwn(v,m.slice(0,l).join("/")),s&&(s=getOwn(s,h))){c=s,p=a;break e}!d&&$&&getOwn($,h)&&(d=getOwn($,h),g=a)}!c&&d&&(c=d,p=g),c&&(r.splice(0,p,c),e=r.join("/"))}return o=getOwn(x.pkgs,e),o?o:e}function n(e){isBrowser&&each(scripts(),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===E.contextName?(t.parentNode.removeChild(t),!0):void 0})}function o(e){var t=getOwn(x.paths,e);return t&&isArray(t)&&t.length>1?(t.shift(),E.require.undef(e),E.makeRequire(null,{skipMap:!0})([e]),!0):void 0}function s(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function r(e,t,n,o){var r,a,l,h,u=null,c=t?t.name:null,p=e,d=!0,g="";return e||(d=!1,e="_@r"+(R+=1)),h=s(e),u=h[0],e=h[1],u&&(u=i(u,c,o),a=getOwn(T,u)),e&&(u?g=a&&a.normalize?a.normalize(e,function(e){return i(e,c,o)}):-1===e.indexOf("!")?i(e,c,o):e:(g=i(e,c,o),h=s(g),u=h[0],g=h[1],n=!0,r=E.nameToUrl(g))),l=!u||a||n?"":"_unnormalized"+(P+=1),{prefix:u,name:g,parentMap:t,unnormalized:!!l,url:r,originalName:p,isDefine:d,id:(u?u+"!"+g:g)+l}}function a(e){var t=e.id,i=getOwn(S,t);return i||(i=S[t]=new E.Module(e)),i}function l(e,t,i){var n=e.id,o=getOwn(S,n);!hasProp(T,n)||o&&!o.defineEmitComplete?(o=a(e),o.error&&"error"===t?i(o.error):o.on(t,i)):"defined"===t&&i(T[n])}function h(e,t){var i=e.requireModules,n=!1;t?t(e):(each(i,function(t){var i=getOwn(S,t);i&&(i.error=e,i.events.error&&(n=!0,i.emit("error",e)))}),n||req.onError(e))}function u(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(E.defQueueMap[t]=!0),I.push(e)}),globalDefQueue=[])}function c(e){delete S[e],delete C[e]}function p(e,t,i){var n=e.map.id;e.error?e.emit("error",e.error):(t[n]=!0,each(e.depMaps,function(n,o){var s=n.id,r=getOwn(S,s);!r||e.depMatched[o]||i[s]||(getOwn(t,s)?(e.defineDep(o,T[s]),e.check()):p(r,t,i))}),i[n]=!0)}function d(){var e,t,i=1e3*x.waitSeconds,s=i&&E.startTime+i<(new Date).getTime(),r=[],a=[],l=!1,u=!0;if(!$){if($=!0,eachProp(C,function(e){var i=e.map,h=i.id;if(e.enabled&&(i.isDefine||a.push(e),!e.error))if(!e.inited&&s)o(h)?(t=!0,l=!0):(r.push(h),n(h));else if(!e.inited&&e.fetched&&i.isDefine&&(l=!0,!i.prefix))return u=!1}),s&&r.length)return e=makeError("timeout","Load timeout for modules: "+r,null,r),e.contextName=E.contextName,h(e);u&&each(a,function(e){p(e,{},{})}),s&&!t||!l||!isBrowser&&!isWebWorker||y||(y=setTimeout(function(){y=0,d()},50)),$=!1}}function g(e){hasProp(T,e[0])||a(r(e[0],null,!0)).init(e[1],e[2])}function f(e,t,i,n){e.detachEvent&&!isOpera?n&&e.detachEvent(n,t):e.removeEventListener(i,t,!1)}function m(e){var t=e.currentTarget||e.srcElement;return f(t,E.onScriptLoad,"load","onreadystatechange"),f(t,E.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function v(){var e;for(u();I.length;){if(e=I.shift(),null===e[0])return h(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));g(e)}E.defQueueMap={}}var $,b,E,w,y,x={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},S={},C={},_={},I=[],T={},D={},O={},R=1,P=1;return w={require:function(e){return e.require?e.require:e.require=E.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?T[e.map.id]=e.exports:e.exports=T[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(x.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(_,e.id)||{},this.map=e,this.shim=getOwn(x.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,i,n){n=n||{},this.inited||(this.factory=t,i?this.on("error",i):this.events.error&&(i=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=i,this.inited=!0,this.ignore=n.ignore,n.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,E.startTime=(new Date).getTime();var e=this.map;return this.shim?void E.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,E.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,i=this.map.id,n=this.depExports,o=this.exports,s=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(s)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=E.execCb(i,s,n,o)}catch(r){e=r}else o=E.execCb(i,s,n,o);if(this.map.isDefine&&void 0===o&&(t=this.module,t?o=t.exports:this.usingExports&&(o=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",h(this.error=e)}else o=s;if(this.exports=o,this.map.isDefine&&!this.ignore&&(T[i]=o,req.onResourceLoad)){var a=[];each(this.depMaps,function(e){a.push(e.normalizedMap||e)}),req.onResourceLoad(E,this.map,a)}c(i),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(E.defQueueMap,i)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,n=r(e.prefix);this.depMaps.push(n),l(n,"defined",bind(this,function(n){var o,s,u,p=getOwn(O,this.map.id),d=this.map.name,g=this.map.parentMap?this.map.parentMap.name:null,f=E.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(n.normalize&&(d=n.normalize(d,function(e){return i(e,g,!0)})||""),s=r(e.prefix+"!"+d,this.map.parentMap),l(s,"defined",bind(this,function(e){this.map.normalizedMap=s,this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),u=getOwn(S,s.id),void(u&&(this.depMaps.push(s),this.events.error&&u.on("error",bind(this,function(e){this.emit("error",e)})),u.enable()))):p?(this.map.url=E.nameToUrl(p),void this.load()):(o=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),o.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(S,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&c(e.map.id)}),h(e)}),o.fromText=bind(this,function(i,n){var s=e.name,l=r(s),u=useInteractive;n&&(i=n),u&&(useInteractive=!1),a(l),hasProp(x.config,t)&&(x.config[s]=x.config[t]);try{req.exec(i)}catch(c){return h(makeError("fromtexteval","fromText eval for "+t+" failed: "+c,c,[t]))}u&&(useInteractive=!0),this.depMaps.push(l),E.completeLoad(s),f([s],o)}),void n.load(e.name,f,o,x))})),E.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){C[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var i,n,o;if("string"==typeof e){if(e=r(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=getOwn(w,e.id))return void(this.depExports[t]=o(this));this.depCount+=1,l(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?l(e,"error",bind(this,this.errback)):this.events.error&&l(e,"error",bind(this,function(e){this.emit("error",e)}))}i=e.id,n=S[i],hasProp(w,i)||!n||n.enabled||E.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(S,e.id);t&&!t.enabled&&E.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var i=this.events[e];i||(i=this.events[e]=[]),i.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},E={config:x,contextName:e,registry:S,defined:T,urlFetched:D,defQueue:I,defQueueMap:{},Module:b,makeModuleMap:r,nextTick:req.nextTick,onError:h,configure:function(e){if(e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/"),"string"==typeof e.urlArgs){var t=e.urlArgs;e.urlArgs=function(e,i){return(-1===i.indexOf("?")?"?":"&")+t}}var i=x.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(x[t]||(x[t]={}),mixin(x[t],e,!0,!0)):x[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(O[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=E.makeShimExports(e)),i[t]=e}),x.shim=i),e.packages&&each(e.packages,function(e){var t,i;e="string"==typeof e?{name:e}:e,i=e.name,t=e.location,t&&(x.paths[i]=e.location),x.pkgs[i]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(S,function(e,t){e.inited||e.map.unnormalized||(e.map=r(t,null,!0))}),(e.deps||e.callback)&&E.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,o){function s(i,n,l){var u,c,p;return o.enableBuildCallback&&n&&isFunction(n)&&(n.__requireJsBuild=!0),"string"==typeof i?isFunction(n)?h(makeError("requireargs","Invalid require call"),l):t&&hasProp(w,i)?w[i](S[t.id]):req.get?req.get(E,i,t,s):(c=r(i,t,!1,!0),u=c.id,hasProp(T,u)?T[u]:h(makeError("notloaded",'Module name "'+u+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),E.nextTick(function(){v(),p=a(r(null,t)),p.skipMap=o.skipMap,p.init(i,n,l,{enabled:!0}),d()}),s)}return o=o||{},mixin(s,{isBrowser:isBrowser,toUrl:function(e){var n,o=e.lastIndexOf("."),s=e.split("/")[0],r="."===s||".."===s;return-1!==o&&(!r||o>1)&&(n=e.substring(o,e.length),e=e.substring(0,o)),E.nameToUrl(i(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(T,r(e,t,!1,!0).id)},specified:function(e){return e=r(e,t,!1,!0).id,hasProp(T,e)||hasProp(S,e)}}),t||(s.undef=function(e){u();var i=r(e,t,!0),o=getOwn(S,e);o.undefed=!0,n(e),delete T[e],delete D[i.url],delete _[e],eachReverse(I,function(t,i){t[0]===e&&I.splice(i,1)}),delete E.defQueueMap[e],o&&(o.events.defined&&(_[e]=o.events),c(e))}),s},enable:function(e){var t=getOwn(S,e.id);t&&a(e).enable()},completeLoad:function(e){var t,i,n,s=getOwn(x.shim,e)||{},r=s.exports;for(u();I.length;){if(i=I.shift(),null===i[0]){if(i[0]=e,t)break;t=!0}else i[0]===e&&(t=!0);g(i)}if(E.defQueueMap={},n=getOwn(S,e),!t&&!hasProp(T,e)&&n&&!n.inited){if(!(!x.enforceDefine||r&&getGlobal(r)))return o(e)?void 0:h(makeError("nodefine","No define call for "+e,null,[e]));g([e,s.deps||[],s.exportsFn])}d()},nameToUrl:function(e,t,i){var n,o,s,r,a,l,h,u=getOwn(x.pkgs,e);if(u&&(e=u),h=getOwn(O,e))return E.nameToUrl(h,t,i);if(req.jsExtRegExp.test(e))a=e+(t||"");else{for(n=x.paths,o=e.split("/"),s=o.length;s>0;s-=1)if(r=o.slice(0,s).join("/"),l=getOwn(n,r)){isArray(l)&&(l=l[0]),o.splice(0,s,l);break}a=o.join("/"),a+=t||(/^data\:|^blob\:|\?/.test(a)||i?"":".js"),a=("/"===a.charAt(0)||a.match(/^[\w\+\.\-]+:/)?"":x.baseUrl)+a}return x.urlArgs&&!/^blob\:/.test(a)?a+x.urlArgs(e,a):a},load:function(e,t){req.load(E,e,t)},execCb:function(e,t,i,n){return t.apply(n,i)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=m(e);E.completeLoad(t.id)}},onScriptError:function(e){var t=m(e);if(!o(t.id)){var i=[];return eachProp(S,function(e,n){0!==n.indexOf("_@r")&&each(e.depMaps,function(e){return e.id===t.id?(i.push(n),!0):void 0})}),h(makeError("scripterror",'Script error for "'+t.id+(i.length?'", needed by: '+i.join(", "):'"'),e,[t.id]))}}},E.require=E.makeRequire(),E}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){return"interactive"===e.readyState?interactiveScript=e:void 0}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.2.0",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}"undefined"==typeof require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,i,n){var o,s,r=defContextName;return isArray(e)||"string"==typeof e||(s=e,isArray(t)?(e=t,t=i,i=n):e=[]),s&&s.context&&(r=s.context),o=getOwn(contexts,r),o||(o=contexts[r]=req.s.newContext(r)),s&&o.configure(s),o.require(e,t,i)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,i){var n=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return n.type=e.scriptType||"text/javascript",n.charset="utf-8",n.async=!0,n},req.load=function(e,t,i){var n,o=e&&e.config||{};if(isBrowser)return n=req.createNode(o,t,i),n.setAttribute("data-requirecontext",e.contextName),n.setAttribute("data-requiremodule",t),!n.attachEvent||n.attachEvent.toString&&n.attachEvent.toString().indexOf("[native code")<0||isOpera?(n.addEventListener("load",e.onScriptLoad,!1),n.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,n.attachEvent("onreadystatechange",e.onScriptLoad)),n.src=i,o.onNodeCreated&&o.onNodeCreated(n,o,t,i),currentlyAddingScript=n,baseElement?head.insertBefore(n,baseElement):head.appendChild(n),currentlyAddingScript=null,n;if(isWebWorker)try{setTimeout(function(){},0),importScripts(i),e.completeLoad(t)}catch(s){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+i,s,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){return head||(head=e.parentNode),dataMain=e.getAttribute("data-main"),dataMain?(mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0):void 0}),define=function(e,t,i){var n,o;"string"!=typeof e&&(i=t,t=e,e=null),isArray(t)||(i=t,t=null),!t&&isFunction(i)&&(t=[],i.length&&(i.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(e,i){t.push(i)}),t=(1===i.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(n=currentlyAddingScript||getInteractiveScript(),n&&(e||(e=n.getAttribute("data-requiremodule")),o=contexts[n.getAttribute("data-requirecontext")])),o?(o.defQueue.push([e,t,i]),o.defQueueMap[e]=!0):globalDefQueue.push([e,t,i])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this),define("requireLib",function(){}),define("modules/uv-shared-module/BaseCommands",["require","exports"],function(e,t){var i=function(){function e(){}return e.namespace="uv.",e.ACCEPT_TERMS=e.namespace+"onAcceptTerms",e.BOOKMARK=e.namespace+"onBookmark",e.CANVAS_INDEX_CHANGE_FAILED=e.namespace+"onCanvasIndexChangeFailed",e.CANVAS_INDEX_CHANGED=e.namespace+"onCanvasIndexChanged",e.CLICKTHROUGH=e.namespace+"onClickthrough",e.CLOSE_ACTIVE_DIALOGUE=e.namespace+"onCloseActiveDialogue",e.CLOSE_LEFT_PANEL=e.namespace+"onCloseLeftPanel",e.CLOSE_RIGHT_PANEL=e.namespace+"onCloseRightPanel",e.CREATED=e.namespace+"onCreated",e.DOWN_ARROW=e.namespace+"onDownArrow",e.DOWNLOAD=e.namespace+"onDownload",e.DROP=e.namespace+"onDrop",e.END=e.namespace+"onEnd",e.ESCAPE=e.namespace+"onEscape",e.EXTERNAL_LINK_CLICKED=e.namespace+"onExternalLinkClicked",e.FEEDBACK=e.namespace+"onFeedback",e.FORBIDDEN=e.namespace+"onForbidden",e.HIDE_CLICKTHROUGH_DIALOGUE=e.namespace+"onHideClickthroughDialogue",e.HIDE_DOWNLOAD_DIALOGUE=e.namespace+"onHideDownloadDialogue",e.HIDE_EMBED_DIALOGUE=e.namespace+"onHideEmbedDialogue",e.HIDE_EXTERNALCONTENT_DIALOGUE=e.namespace+"onHideExternalContentDialogue",e.HIDE_GENERIC_DIALOGUE=e.namespace+"onHideGenericDialogue",e.HIDE_HELP_DIALOGUE=e.namespace+"onHideHelpDialogue",e.HIDE_INFORMATION=e.namespace+"onHideInformation",e.HIDE_LOGIN_DIALOGUE=e.namespace+"onHideLoginDialogue",e.HIDE_MOREINFO_DIALOGUE=e.namespace+"onHideMoreInfoDialogue",e.HIDE_OVERLAY=e.namespace+"onHideOverlay",e.HIDE_RESTRICTED_DIALOGUE=e.namespace+"onHideRestrictedDialogue",e.HIDE_SETTINGS_DIALOGUE=e.namespace+"onHideSettingsDialogue",e.HIDE_SHARE_DIALOGUE=e.namespace+"onHideShareDialogue",e.HOME=e.namespace+"onHome",e.LEFT_ARROW=e.namespace+"onLeftArrow",e.LEFTPANEL_COLLAPSE_FULL_FINISH=e.namespace+"onLeftPanelCollapseFullFinish",e.LEFTPANEL_COLLAPSE_FULL_START=e.namespace+"onLeftPanelCollapseFullStart",e.LEFTPANEL_EXPAND_FULL_FINISH=e.namespace+"onLeftPanelExpandFullFinish",e.LEFTPANEL_EXPAND_FULL_START=e.namespace+"onLeftPanelExpandFullStart",e.LOAD_FAILED=e.namespace+"onLoadFailed",e.LOAD=e.namespace+"onLoad",e.LOGIN_FAILED=e.namespace+"onLoginFailed",e.LOGIN=e.namespace+"onLogin",e.LOGOUT=e.namespace+"onLogout",e.METRIC_CHANGED=e.namespace+"onMetricChanged",e.MINUS=e.namespace+"onMinus",e.NOT_FOUND=e.namespace+"onNotFound",e.OPEN_EXTERNAL_RESOURCE=e.namespace+"onOpenExternalResource",e.OPEN_LEFT_PANEL=e.namespace+"onOpenLeftPanel",e.OPEN_RIGHT_PANEL=e.namespace+"onOpenRightPanel",e.OPEN=e.namespace+"onOpen",e.PAGE_DOWN=e.namespace+"onPageDown",e.PAGE_UP=e.namespace+"onPageUp",e.PARENT_EXIT_FULLSCREEN=e.namespace+"onParentExitFullScreen",e.PLUS=e.namespace+"onPlus",e.REDIRECT=e.namespace+"onRedirect",e.REFRESH=e.namespace+"onRefresh",e.RESIZE=e.namespace+"onResize",e.RESOURCE_DEGRADED=e.namespace+"onResourceDegraded",e.RETRY=e.namespace+"onRetry",e.RETURN=e.namespace+"onReturn",e.RIGHT_ARROW=e.namespace+"onRightArrow",e.RIGHTPANEL_COLLAPSE_FULL_FINISH=e.namespace+"onRightPanelCollapseFullFinish",e.RIGHTPANEL_COLLAPSE_FULL_START=e.namespace+"onRightPanelCollapseFullStart",e.RIGHTPANEL_EXPAND_FULL_FINISH=e.namespace+"onRightPanelExpandFullFinish",e.RIGHTPANEL_EXPAND_FULL_START=e.namespace+"onRightPanelExpandFullStart",e.SEQUENCE_INDEX_CHANGED=e.namespace+"onSequenceIndexChanged",e.SETTINGS_CHANGED=e.namespace+"onSettingsChanged",e.SHOW_CLICKTHROUGH_DIALOGUE=e.namespace+"onShowClickThroughDialogue",e.SHOW_DOWNLOAD_DIALOGUE=e.namespace+"onShowDownloadDialogue",e.SHOW_EMBED_DIALOGUE=e.namespace+"onShowEmbedDialogue",e.SHOW_EXTERNALCONTENT_DIALOGUE=e.namespace+"onShowExternalContentDialogue",e.SHOW_GENERIC_DIALOGUE=e.namespace+"onShowGenericDialogue",e.SHOW_HELP_DIALOGUE=e.namespace+"onShowHelpDialogue",e.SHOW_INFORMATION=e.namespace+"onShowInformation",e.SHOW_LOGIN_DIALOGUE=e.namespace+"onShowLoginDialogue",e.SHOW_MOREINFO_DIALOGUE=e.namespace+"onShowMoreInfoDialogue",e.SHOW_OVERLAY=e.namespace+"onShowOverlay",e.SHOW_RESTRICTED_DIALOGUE=e.namespace+"onShowRestrictedDialogue",e.SHOW_SETTINGS_DIALOGUE=e.namespace+"onShowSettingsDialogue",e.SHOW_SHARE_DIALOGUE=e.namespace+"onShowShareDialogue",e.SHOW_TERMS_OF_USE=e.namespace+"onShowTermsOfUse",e.THUMB_SELECTED=e.namespace+"onThumbSelected",e.TOGGLE_EXPAND_LEFT_PANEL=e.namespace+"onToggleExpandLeftPanel",e.TOGGLE_EXPAND_RIGHT_PANEL=e.namespace+"onToggleExpandRightPanel",e.TOGGLE_FULLSCREEN=e.namespace+"onToggleFullScreen",e.UP_ARROW=e.namespace+"onUpArrow",e.UPDATE_SETTINGS=e.namespace+"onUpdateSettings",e.VIEW_FULL_TERMS=e.namespace+"onViewFullTerms",e.WINDOW_UNLOAD=e.namespace+"onWindowUnload",e}();return i}),define("Params",["require","exports"],function(e,t){var i;return function(e){e[e.collectionIndex=0]="collectionIndex",e[e.manifestIndex=1]="manifestIndex",e[e.sequenceIndex=2]="sequenceIndex",e[e.canvasIndex=3]="canvasIndex",e[e.zoom=4]="zoom",e[e.rotation=5]="rotation",e[e.highlight=6]="highlight",e[e.anchor=7]="anchor"}(i||(i={})),i}),define("BootstrapParams",["require","exports","./Params"],function(e,t,i){var n=function(){function e(){this.paramMap=["c","m","s","cv","z","r","h","a"],this.config=Utils.Urls.getQuerystringParameter("config"),this.domain=Utils.Urls.getQuerystringParameter("domain"),this.embedDomain=Utils.Urls.getQuerystringParameter("embedDomain"),this.embedScriptUri=Utils.Urls.getQuerystringParameter("embedScriptUri"),this.isHomeDomain="true"===Utils.Urls.getQuerystringParameter("isHomeDomain"),this.isLightbox="true"===Utils.Urls.getQuerystringParameter("isLightbox"),this.isOnlyInstance="true"===Utils.Urls.getQuerystringParameter("isOnlyInstance"),this.isReload="true"===Utils.Urls.getQuerystringParameter("isReload");var e=Utils.Urls.getQuerystringParameter("jsonp");this.jsonp=null===e?null:!("false"===e||"0"===e),this.manifestUri=Utils.Urls.getQuerystringParameter("manifestUri");var t=Utils.Urls.getQuerystringParameter("locale")||"en-GB";this.setLocale(t),this.collectionIndex=this.getParam(i.collectionIndex),this.manifestIndex=this.getParam(i.manifestIndex),this.sequenceIndex=this.getParam(i.sequenceIndex),this.canvasIndex=this.getParam(i.canvasIndex)}return e.prototype.getLocaleName=function(){return this.localeName},e.prototype.getParam=function(e){if(this.hashParamsAvailable()){var t=parseInt(Utils.Urls.getHashParameter(this.paramMap[e],parent.document));if(t||0===t)return t}return parseInt(Utils.Urls.getQuerystringParameter(this.paramMap[e]))||0},e.prototype.hashParamsAvailable=function(){return this.isHomeDomain&&!this.isReload&&this.isOnlyInstance},e.prototype.setLocale=function(e){this.locale=e,this.locales=[];for(var t=this.locale.split(","),i=0;i #app").data("bootstrapper"),e.call(this,t,i,n)}return __extends(t,e),t.prototype.create=function(){e.prototype.create.call(this),this.extension=this.bootstrapper.extension,this.config={},this.config.content={},this.config.options={},this.content=this.config.content,this.options=this.config.options;var t=this;t.modules.length&&(t.modules=t.modules.reverse(),_.each(t.modules,function(e){t.config=$.extend(!0,t.config,t.extension.config.modules[e])}))},t.prototype.init=function(){},t.prototype.setConfig=function(e){this.modules.push(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/Dialogue",["require","exports","./BaseView","./BaseCommands"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!1,!1),this.allowClose=!0,this.isActive=!1,this.isUnopened=!0}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("dialogue"),e.prototype.create.call(this),$.subscribe(n.CLOSE_ACTIVE_DIALOGUE,function(){t.isActive&&t.allowClose&&t.close()}),$.subscribe(n.ESCAPE,function(){t.isActive&&t.allowClose&&t.close()}),this.$top=$('
'),this.$element.append(this.$top),this.$closeButton=$(''+this.content.close+""),this.$top.append(this.$closeButton),this.$middle=$('
'),this.$element.append(this.$middle),this.$content=$('
'),this.$middle.append(this.$content),this.$bottom=$('
'),this.$element.append(this.$bottom),this.$closeButton.on("click",function(e){e.preventDefault(),t.close()}),this.returnFunc=this.close},t.prototype.enableClose=function(){this.allowClose=!0,this.$closeButton.show()},t.prototype.disableClose=function(){this.allowClose=!1,this.$closeButton.hide()},t.prototype.setDockedPosition=function(){var e=Math.floor(this.extension.height()-this.$element.outerHeight(!0)),t=0,i=0;if(this.$triggerButton){var n=Math.normalise(this.$triggerButton.offset().left,0,this.extension.width());t=Math.floor(this.extension.width()*n-this.$element.width()*n),i=this.$element.width()*n}this.$bottom.css("backgroundPosition",i+"px 0px"),this.$element.css({top:e,left:t})},t.prototype.open=function(e){var t=this;this.$element.show(),e&&e.length?(this.$triggerButton=e,this.$bottom.show()):this.$bottom.hide(),this.isActive=!0,setTimeout(function(){var e=t.$element.find(".default");if(e.length)e.focus();else{var i=t.$element.find("input:visible").first();i.length?i.focus():t.$closeButton.focus()}},1),$.publish(n.SHOW_OVERLAY),this.isUnopened&&(this.isUnopened=!1,this.afterFirstOpen()),this.resize()},t.prototype.afterFirstOpen=function(){},t.prototype.close=function(){this.isActive&&(this.$element.hide(),this.isActive=!1,$.publish(this.closeCommand),$.publish(n.HIDE_OVERLAY))},t.prototype.resize=function(){e.prototype.resize.call(this),this.$element.css({top:Math.floor(this.extension.height()/2-this.$element.height()/2),left:Math.floor(this.extension.width()/2-this.$element.width()/2)})},t}(i);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ClickThroughDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("clickThroughDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_CLICKTHROUGH_DIALOGUE,this.closeCommand=i.HIDE_CLICKTHROUGH_DIALOGUE, -$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("

"),this.$content.append(this.$title),this.$content.append('

'),this.$message=this.$content.find(".message"),this.$acceptTermsButton=this.$content.find(".acceptTerms"),this.$acceptTermsButton.text("Accept Terms and Open"),this.$element.hide(),this.$acceptTermsButton.on("click",function(e){e.preventDefault(),t.close(),$.publish(i.ACCEPT_TERMS),t.acceptCallback&&t.acceptCallback()})},t.prototype.open=function(){e.prototype.open.call(this),this.$title.text(this.resource.clickThroughService.getProperty("label")),this.$message.html(this.resource.clickThroughService.getProperty("description")),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.resize()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o}),define("modules/uv-shared-module/InformationArgs",["require","exports"],function(e,t){var i=function(){function e(e,t){this.informationType=e,this.param=t}return e}();return i}),define("modules/uv-shared-module/InformationType",["require","exports"],function(e,t){var i;return function(e){e[e.AUTH_CORS_ERROR=0]="AUTH_CORS_ERROR",e[e.DEGRADED_RESOURCE=1]="DEGRADED_RESOURCE"}(i||(i={})),i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/LoginDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("loginDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_LOGIN_DIALOGUE,this.closeCommand=i.HIDE_LOGIN_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.loginCallback=i.loginCallback,t.logoutCallback=i.logoutCallback,t.options=i.options,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("

"),this.$content.append(this.$title),this.$content.append('

'),this.$message=this.$content.find(".message"),this.$loginButton=this.$content.find(".login"),this.$loginButton.text(this.content.login),this.$logoutButton=this.$content.find(".logout"),this.$logoutButton.text(this.content.logout),this.$cancelButton=this.$content.find(".cancel"),this.$cancelButton.text(this.content.cancel),this.$element.hide(),this.$loginButton.on("click",function(e){e.preventDefault(),t.close(),t.loginCallback&&t.loginCallback()}),this.$logoutButton.on("click",function(e){e.preventDefault(),t.close(),t.logoutCallback&&t.logoutCallback()}),this.$cancelButton.on("click",function(e){e.preventDefault(),t.close()}),this.updateLogoutButton()},t.prototype.open=function(){e.prototype.open.call(this),this.$title.text(this.resource.loginService.getProperty("label"));var t=this.resource.loginService.getProperty("description");this.options.warningMessage&&(t=''+this.extension.config.content[this.options.warningMessage]+''+t+""),this.updateLogoutButton(),this.$message.html(t),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.options.showCancelButton?this.$cancelButton.show():this.$cancelButton.hide(),this.resize()},t.prototype.updateLogoutButton=function(){this.extension.isLoggedIn?this.$logoutButton.show():this.$logoutButton.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o}),define("modules/uv-shared-module/LoginWarningMessages",["require","exports"],function(e,t){var i=function(){function e(){}return e.FORBIDDEN="forbiddenResourceMessage",e}();return i}),define("modules/uv-shared-module/Metric",["require","exports"],function(e,t){var i=function(){function e(e,t){this.minWidth=e,this.maxWidth=t}return e}();return i}),define("modules/uv-shared-module/Metrics",["require","exports","./Metric"],function(e,t,i){var n=function(){function e(){}return e.MOBILE_LANDSCAPE=new i(0,640),e.LAPTOP=new i(640,1/0),e}();return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/RestrictedDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("restrictedDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_RESTRICTED_DIALOGUE,this.closeCommand=i.HIDE_RESTRICTED_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.options=i.options,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("

"),this.$content.append(this.$title),this.$content.append('

'),this.$message=this.$content.find(".message"),this.$message.targetBlank(),this.$cancelButton=this.$content.find(".cancel"),this.$cancelButton.text(this.content.cancel),this.$element.hide(),this.$cancelButton.on("click",function(e){e.preventDefault(),t.close()})},t.prototype.open=function(){e.prototype.open.call(this),this.isAccepted=!1,this.$title.text(this.resource.restrictedService.getProperty("label"));var t=this.resource.restrictedService.getProperty("description");this.$message.html(t),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.resize()},t.prototype.close=function(){e.prototype.close.call(this),!this.isAccepted&&this.acceptCallback&&(this.isAccepted=!0,this.acceptCallback())},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/GenericDialogue",["require","exports","./BaseCommands","./Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("genericDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_GENERIC_DIALOGUE,this.closeCommand=i.HIDE_GENERIC_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.showMessage(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$message=$("

"),this.$content.append(this.$message),this.$acceptButton=$(''),this.$content.append(this.$acceptButton),this.$acceptButton.text(this.content.ok),this.$acceptButton.onPressed(function(){t.accept()}),this.returnFunc=function(){t.isActive&&t.accept()},this.$element.hide()},t.prototype.accept=function(){$.publish(i.CLOSE_ACTIVE_DIALOGUE),this.acceptCallback&&this.acceptCallback()},t.prototype.showMessage=function(e){this.$message.html(e.message),e.buttonText?this.$acceptButton.text(e.buttonText):this.$acceptButton.text(this.content.ok),e.allowClose===!1&&this.disableClose(),this.open()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/Shell",["require","exports","./BaseCommands","./BaseView","./GenericDialogue"],function(e,t,i,n,o){var s=function(e){function t(i){t.$element=i,e.call(this,t.$element,!0,!0)}return __extends(t,e),t.prototype.create=function(){e.prototype.create.call(this),$.subscribe(i.SHOW_OVERLAY,function(){t.$overlays.show()}),$.subscribe(i.HIDE_OVERLAY,function(){t.$overlays.hide()}),t.$headerPanel=$('
'),t.$element.append(t.$headerPanel),t.$mainPanel=$('
'),t.$element.append(t.$mainPanel),t.$centerPanel=$('
'),t.$mainPanel.append(t.$centerPanel),t.$leftPanel=$('
'),t.$mainPanel.append(t.$leftPanel),t.$rightPanel=$('
'),t.$mainPanel.append(t.$rightPanel),t.$footerPanel=$('
'),t.$element.append(t.$footerPanel),t.$mobileFooterPanel=$('
'),t.$element.append(t.$mobileFooterPanel),t.$overlays=$('
'),t.$element.append(t.$overlays),t.$genericDialogue=$('
'),t.$overlays.append(t.$genericDialogue),t.$overlays.on("click",function(e){$(e.target).hasClass("overlays")&&(e.preventDefault(),$.publish(i.CLOSE_ACTIVE_DIALOGUE))}),new o(t.$genericDialogue)},t.prototype.resize=function(){e.prototype.resize.call(this),t.$overlays.width(this.extension.width()),t.$overlays.height(this.extension.height());var i=this.$element.height()-parseInt(t.$mainPanel.css("marginTop"))-(t.$headerPanel.is(":visible")?t.$headerPanel.height():0)-(t.$footerPanel.is(":visible")?t.$footerPanel.height():0)-(t.$mobileFooterPanel.is(":visible")?t.$mobileFooterPanel.height():0);t.$mainPanel.height(i)},t}(n);return s}),define("modules/uv-shared-module/BaseExtension",["require","exports","./BaseCommands","../../BootstrapParams","../../modules/uv-dialogues-module/ClickThroughDialogue","./InformationArgs","./InformationType","../../modules/uv-dialogues-module/LoginDialogue","./LoginWarningMessages","../../modules/uv-shared-module/Metrics","../../Params","../../modules/uv-dialogues-module/RestrictedDialogue","./Shell"],function(e,t,i,n,o,s,r,a,l,h,u,c,p){var d=function(){function t(e){this.isCreated=!1,this.isLoggedIn=!1,this.shifted=!1,this.tabbing=!1,this.bootstrapper=e,this.config=this.bootstrapper.config,this.jsonp=this.bootstrapper.params.jsonp,this.locale=this.bootstrapper.params.getLocaleName(),this.isHomeDomain=this.bootstrapper.params.isHomeDomain,this.isReload=this.bootstrapper.params.isReload,this.embedDomain=this.bootstrapper.params.embedDomain,this.isOnlyInstance=this.bootstrapper.params.isOnlyInstance,this.embedScriptUri=this.bootstrapper.params.embedScriptUri,this.domain=this.bootstrapper.params.domain,this.isLightbox=this.bootstrapper.params.isLightbox}return t.prototype.create=function(e){var t=this,o=this;this.$element=$("#app"),this.$element.data("bootstrapper",this.bootstrapper);var s=$(window);if(this.embedWidth=s.width(),this.embedHeight=s.height(),this.$element.width(this.embedWidth),this.$element.height(this.embedHeight),!this.isReload&&Utils.Documents.isInIFrame()&&(this.bootstrapper.socket=new easyXDM.Socket({onMessage:function(e,i){e=$.parseJSON(e),t.handleParentFrameEvent(e)}})),this.triggerSocket(i.LOAD,{bootstrapper:{config:this.bootstrapper.config,params:this.bootstrapper.params},settings:this.getSettings(),preview:this.getSharePreview()}),this.$element.empty(),this.$element.removeClass(),this.$element.addClass("browser-"+window.browserDetect.browser),this.$element.addClass("browser-version-"+window.browserDetect.version),this.isHomeDomain||this.$element.addClass("embedded"),this.isLightbox&&this.$element.addClass("lightbox"),$(document).on("mousemove",function(e){t.mouseX=e.pageX,t.mouseY=e.pageY}),!this.isReload){window.onresize=function(){var e=$(window);$("body").height(e.height()),t.resize()};var r=Utils.Documents.getHiddenProp();if(r){var a=r.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(a,function(){Utils.Documents.isHidden()||t.resize()})}Utils.Bools.getBool(this.config.options.dropEnabled,!0)&&this.$element.on("drop",function(e){e.preventDefault();var o=e.originalEvent.dataTransfer.getData("URL"),s=Utils.Urls.getUrlParts(o),r=Utils.Urls.getQuerystringParameterFromString("manifest",s.search);if(r){t.triggerSocket(i.DROP,r);var a=new n;a.manifestUri=r,t.reload(a)}}),this.$element.on("dragover",function(e){e.preventDefault()}),$(document).on("keyup keydown",function(e){t.shifted=e.shiftKey,t.tabbing=e.keyCode===KeyCodes.KeyDown.Tab}),$(document).keydown(function(e){var t=null,n=!0;e.ctrlKey||e.altKey||e.shiftKey||(e.keyCode===KeyCodes.KeyDown.Enter&&(t=i.RETURN,n=!1),e.keyCode===KeyCodes.KeyDown.Escape&&(t=i.ESCAPE),e.keyCode===KeyCodes.KeyDown.PageUp&&(t=i.PAGE_UP),e.keyCode===KeyCodes.KeyDown.PageDown&&(t=i.PAGE_DOWN),e.keyCode===KeyCodes.KeyDown.End&&(t=i.END),e.keyCode===KeyCodes.KeyDown.Home&&(t=i.HOME),(e.keyCode===KeyCodes.KeyDown.NumpadPlus||171===e.keyCode||e.keyCode===KeyCodes.KeyDown.Equals)&&(t=i.PLUS,n=!1),(e.keyCode===KeyCodes.KeyDown.NumpadMinus||173===e.keyCode||e.keyCode===KeyCodes.KeyDown.Dash)&&(t=i.MINUS,n=!1),o.useArrowKeysToNavigate()&&(e.keyCode===KeyCodes.KeyDown.LeftArrow&&(t=i.LEFT_ARROW),e.keyCode===KeyCodes.KeyDown.UpArrow&&(t=i.UP_ARROW),e.keyCode===KeyCodes.KeyDown.RightArrow&&(t=i.RIGHT_ARROW),e.keyCode===KeyCodes.KeyDown.DownArrow&&(t=i.DOWN_ARROW))),t&&(n&&e.preventDefault(),$.publish(t))}),this.bootstrapper.params.isHomeDomain&&Utils.Documents.isInIFrame()&&$.subscribe(i.PARENT_EXIT_FULLSCREEN,function(){t.isOverlayActive()&&$.publish(i.ESCAPE),$.publish(i.ESCAPE),$.publish(i.RESIZE)})}this.$element.append(''),this.$element.append(''),$.subscribe(i.ACCEPT_TERMS,function(){t.triggerSocket(i.ACCEPT_TERMS)}),$.subscribe(i.LOGIN_FAILED,function(){t.triggerSocket(i.LOGIN_FAILED),t.showMessage(t.config.content.authorisationFailedMessage)}),$.subscribe(i.LOGIN,function(){t.isLoggedIn=!0,t.triggerSocket(i.LOGIN)}),$.subscribe(i.LOGOUT,function(){t.isLoggedIn=!1,t.triggerSocket(i.LOGOUT)}),$.subscribe(i.BOOKMARK,function(){t.bookmark(),t.triggerSocket(i.BOOKMARK)}),$.subscribe(i.CANVAS_INDEX_CHANGE_FAILED,function(){t.triggerSocket(i.CANVAS_INDEX_CHANGE_FAILED)}),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,n){t.triggerSocket(i.CANVAS_INDEX_CHANGED,n)}),$.subscribe(i.CLICKTHROUGH,function(){t.triggerSocket(i.CLICKTHROUGH)}),$.subscribe(i.CLOSE_ACTIVE_DIALOGUE,function(){t.triggerSocket(i.CLOSE_ACTIVE_DIALOGUE)}),$.subscribe(i.CLOSE_LEFT_PANEL,function(){t.triggerSocket(i.CLOSE_LEFT_PANEL),t.resize()}),$.subscribe(i.CLOSE_RIGHT_PANEL,function(){t.triggerSocket(i.CLOSE_RIGHT_PANEL),t.resize()}),$.subscribe(i.CREATED,function(){t.isCreated=!0,t.triggerSocket(i.CREATED)}),$.subscribe(i.DOWN_ARROW,function(){t.triggerSocket(i.DOWN_ARROW)}),$.subscribe(i.DOWNLOAD,function(e,n){t.triggerSocket(i.DOWNLOAD,n)}),$.subscribe(i.END,function(){t.triggerSocket(i.END)}),$.subscribe(i.ESCAPE,function(){t.triggerSocket(i.ESCAPE),t.isFullScreen()&&!t.isOverlayActive()&&$.publish(i.TOGGLE_FULLSCREEN)}),$.subscribe(i.EXTERNAL_LINK_CLICKED,function(e,n){t.triggerSocket(i.EXTERNAL_LINK_CLICKED,n)}),$.subscribe(i.FEEDBACK,function(){t.feedback()}),$.subscribe(i.FORBIDDEN,function(){t.triggerSocket(i.FORBIDDEN),$.publish(i.OPEN_EXTERNAL_RESOURCE)}),$.subscribe(i.HIDE_DOWNLOAD_DIALOGUE,function(){t.triggerSocket(i.HIDE_DOWNLOAD_DIALOGUE)}),$.subscribe(i.HIDE_EMBED_DIALOGUE,function(){t.triggerSocket(i.HIDE_EMBED_DIALOGUE)}),$.subscribe(i.HIDE_EXTERNALCONTENT_DIALOGUE,function(){t.triggerSocket(i.HIDE_EXTERNALCONTENT_DIALOGUE)}),$.subscribe(i.HIDE_GENERIC_DIALOGUE,function(){t.triggerSocket(i.HIDE_GENERIC_DIALOGUE)}),$.subscribe(i.HIDE_HELP_DIALOGUE,function(){t.triggerSocket(i.HIDE_HELP_DIALOGUE)}),$.subscribe(i.HIDE_INFORMATION,function(){t.triggerSocket(i.HIDE_INFORMATION)}),$.subscribe(i.HIDE_LOGIN_DIALOGUE,function(){t.triggerSocket(i.HIDE_LOGIN_DIALOGUE)}),$.subscribe(i.HIDE_OVERLAY,function(){t.triggerSocket(i.HIDE_OVERLAY)}),$.subscribe(i.HIDE_RESTRICTED_DIALOGUE,function(){t.triggerSocket(i.HIDE_RESTRICTED_DIALOGUE)}),$.subscribe(i.HIDE_SETTINGS_DIALOGUE,function(){t.triggerSocket(i.HIDE_SETTINGS_DIALOGUE)}),$.subscribe(i.HOME,function(){t.triggerSocket(i.HOME)}),$.subscribe(i.LEFT_ARROW,function(){t.triggerSocket(i.LEFT_ARROW)}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(){t.triggerSocket(i.LEFTPANEL_COLLAPSE_FULL_FINISH)}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_START,function(){t.triggerSocket(i.LEFTPANEL_COLLAPSE_FULL_START)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_FINISH,function(){t.triggerSocket(i.LEFTPANEL_EXPAND_FULL_FINISH)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(){t.triggerSocket(i.LEFTPANEL_EXPAND_FULL_START)}),$.subscribe(i.LOAD_FAILED,function(){t.triggerSocket(i.LOAD_FAILED),_.isNull(o.lastCanvasIndex)||o.lastCanvasIndex===o.helper.canvasIndex||t.viewCanvas(o.lastCanvasIndex)}),$.subscribe(i.NOT_FOUND,function(){t.triggerSocket(i.NOT_FOUND)}),$.subscribe(i.OPEN,function(){t.triggerSocket(i.OPEN);var e=String.format(t.config.options.openTemplate,t.helper.iiifResourceUri);window.open(e)}),$.subscribe(i.OPEN_LEFT_PANEL,function(){t.triggerSocket(i.OPEN_LEFT_PANEL),t.resize()}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(){t.triggerSocket(i.OPEN_EXTERNAL_RESOURCE)}),$.subscribe(i.OPEN_RIGHT_PANEL,function(){t.triggerSocket(i.OPEN_RIGHT_PANEL),t.resize()}),$.subscribe(i.PAGE_DOWN,function(){t.triggerSocket(i.PAGE_DOWN)}),$.subscribe(i.PAGE_UP,function(){t.triggerSocket(i.PAGE_UP)}),$.subscribe(i.RESOURCE_DEGRADED,function(e,n){t.triggerSocket(i.RESOURCE_DEGRADED),t.handleDegraded(n)}),$.subscribe(i.RETURN,function(){t.triggerSocket(i.RETURN)}),$.subscribe(i.RIGHT_ARROW,function(){t.triggerSocket(i.RIGHT_ARROW)}),$.subscribe(i.RIGHTPANEL_COLLAPSE_FULL_FINISH,function(){t.triggerSocket(i.RIGHTPANEL_COLLAPSE_FULL_FINISH)}),$.subscribe(i.RIGHTPANEL_COLLAPSE_FULL_START,function(){t.triggerSocket(i.RIGHTPANEL_COLLAPSE_FULL_START)}),$.subscribe(i.RIGHTPANEL_EXPAND_FULL_FINISH,function(){t.triggerSocket(i.RIGHTPANEL_EXPAND_FULL_FINISH)}),$.subscribe(i.RIGHTPANEL_EXPAND_FULL_START,function(){t.triggerSocket(i.RIGHTPANEL_EXPAND_FULL_START)}),$.subscribe(i.SEQUENCE_INDEX_CHANGED,function(){t.triggerSocket(i.SEQUENCE_INDEX_CHANGED)}),$.subscribe(i.SETTINGS_CHANGED,function(e,n){t.triggerSocket(i.SETTINGS_CHANGED,n)}),$.subscribe(i.SHOW_DOWNLOAD_DIALOGUE,function(){t.triggerSocket(i.SHOW_DOWNLOAD_DIALOGUE)}),$.subscribe(i.SHOW_EMBED_DIALOGUE,function(){t.triggerSocket(i.SHOW_EMBED_DIALOGUE)}),$.subscribe(i.SHOW_EXTERNALCONTENT_DIALOGUE,function(){t.triggerSocket(i.SHOW_EXTERNALCONTENT_DIALOGUE)}),$.subscribe(i.SHOW_GENERIC_DIALOGUE,function(){t.triggerSocket(i.SHOW_GENERIC_DIALOGUE)}),$.subscribe(i.SHOW_HELP_DIALOGUE,function(){t.triggerSocket(i.SHOW_HELP_DIALOGUE)}),$.subscribe(i.SHOW_INFORMATION,function(){t.triggerSocket(i.SHOW_INFORMATION)}),$.subscribe(i.SHOW_LOGIN_DIALOGUE,function(){t.triggerSocket(i.SHOW_LOGIN_DIALOGUE)}),$.subscribe(i.SHOW_CLICKTHROUGH_DIALOGUE,function(){t.triggerSocket(i.SHOW_CLICKTHROUGH_DIALOGUE)}),$.subscribe(i.SHOW_RESTRICTED_DIALOGUE,function(){t.triggerSocket(i.SHOW_RESTRICTED_DIALOGUE)}),$.subscribe(i.SHOW_OVERLAY,function(){t.triggerSocket(i.SHOW_OVERLAY)}),$.subscribe(i.SHOW_SETTINGS_DIALOGUE,function(){t.triggerSocket(i.SHOW_SETTINGS_DIALOGUE)}),$.subscribe(i.SHOW_TERMS_OF_USE,function(){t.triggerSocket(i.SHOW_TERMS_OF_USE);var e=t.helper.getAttribution();t.showMessage(e)}),$.subscribe(i.THUMB_SELECTED,function(e,n){t.triggerSocket(i.THUMB_SELECTED,n.index)}),$.subscribe(i.TOGGLE_FULLSCREEN,function(){$("#top").focus(),t.bootstrapper.isFullScreen=!t.bootstrapper.isFullScreen,t.triggerSocket(i.TOGGLE_FULLSCREEN,{isFullScreen:t.bootstrapper.isFullScreen,overrideFullScreen:t.config.options.overrideFullScreen})}),$.subscribe(i.UP_ARROW,function(){t.triggerSocket(i.UP_ARROW)}),$.subscribe(i.UPDATE_SETTINGS,function(){t.triggerSocket(i.UPDATE_SETTINGS)}),$.subscribe(i.VIEW_FULL_TERMS,function(){t.triggerSocket(i.VIEW_FULL_TERMS)}),$.subscribe(i.WINDOW_UNLOAD,function(){t.triggerSocket(i.WINDOW_UNLOAD)}),this.shell=new p(this.$element),e?this.loadDependencies(e):this.getDependencies(function(e){t.loadDependencies(e)})},t.prototype.createModules=function(){this.$clickThroughDialogue=$('
'),p.$overlays.append(this.$clickThroughDialogue),this.clickThroughDialogue=new o(this.$clickThroughDialogue),this.$restrictedDialogue=$(''),p.$overlays.append(this.$restrictedDialogue),this.restrictedDialogue=new c(this.$restrictedDialogue),this.$loginDialogue=$(''),p.$overlays.append(this.$loginDialogue),this.loginDialogue=new a(this.$loginDialogue)},t.prototype.modulesCreated=function(){},t.prototype.getDependencies=function(t){var i=this,n=window.DEBUG?"../../extensions/"+this.name+"/dependencies":this.name+"-dependencies",o=$("script[data-requiremodule]").filter(function(){var e=$(this).attr("data-requiremodule");return-1!=e.indexOf(i.name)&&-1!=e.indexOf("dependencies")});o.length?t(null):e([n],function(e){for(var n=window.DEBUG?"../../extensions/"+i.name+"/lib/":"",o=0;on.minWidth&&this.width()<=n.maxWidth&&this.metric!==n&&(this.metric=n,$.publish(i.METRIC_CHANGED))}},t.prototype.resize=function(){this._updateMetric(),$.publish(i.RESIZE)},t.prototype.handleParentFrameEvent=function(e){var t=this;Utils.Async.waitFor(function(){return t.isCreated},function(){switch(e.eventName){case i.TOGGLE_FULLSCREEN:$.publish(i.TOGGLE_FULLSCREEN,e.eventObject);break;case i.PARENT_EXIT_FULLSCREEN:$.publish(i.PARENT_EXIT_FULLSCREEN)}})},t.prototype.reload=function(e){var t=new n;e&&(t=$.extend(t,e)),t.isReload=!0,$.disposePubSub(),this.bootstrapper.bootstrap(t)},t.prototype.getCanvasIndexParam=function(){return this.bootstrapper.params.getParam(u.canvasIndex)},t.prototype.getSequenceIndexParam=function(){return this.bootstrapper.params.getParam(u.sequenceIndex)},t.prototype.isSeeAlsoEnabled=function(){return this.config.options.seeAlsoEnabled!==!1},t.prototype.getShareUrl=function(){if(this.isDeepLinkingEnabled())return Utils.Documents.isInIFrame()?parent.document.location.href:document.location.href;if(this.helper.hasRelatedPage()){var e=this.helper.getRelated();return e.length&&(e=e[0]),e["@id"]}return null},t.prototype.getIIIFShareUrl=function(){return this.helper.iiifResourceUri+"?manifest="+this.helper.iiifResourceUri},t.prototype.addTimestamp=function(e){return e+"?t="+Utils.Dates.getTimeStamp()},t.prototype.isDeepLinkingEnabled=function(){return this.isHomeDomain&&this.isOnlyInstance},t.prototype.isOnHomeDomain=function(){return this.isDeepLinkingEnabled()},t.prototype.getDomain=function(){var e=Utils.Urls.getUrlParts(this.helper.iiifResourceUri);return e.host},t.prototype.getEmbedDomain=function(){return this.embedDomain},t.prototype.getSettings=function(){if(Utils.Bools.getBool(this.config.options.saveUserSettings,!1)){var e=Utils.Storage.get("uv.settings",Utils.StorageType.local);if(e)return $.extend(this.config.options,e.value)}return this.config.options},t.prototype.updateSettings=function(e){if(Utils.Bools.getBool(this.config.options.saveUserSettings,!1)){var t=Utils.Storage.get("uv.settings",Utils.StorageType.local);t&&(e=$.extend(t.value,e)),Utils.Storage.set("uv.settings",e,31536e4,Utils.StorageType.local)}this.config.options=$.extend(this.config.options,e)},t.prototype.sanitize=function(e){var t=document.createElement("div"),i=$(t);i.html(e);var n=new Sanitize({elements:["a","b","br","img","p","i","span"],attributes:{a:["href"],img:["src","alt"]},protocols:{a:{href:["http","https"]}}});return i.html(n.clean_node(t)),i.html()},t.prototype.getLocales=function(){if(this.locales)return this.locales;var e=this.config.localisation.locales.clone(),t=this.bootstrapper.params.locales,i=[];_.each(t,function(t){var n=_.filter(e,function(e){return e.name===t.name});if(n.length){var o=n[0];t.label&&(o.label=t.label),o.added=!0,i.push(o)}});var n=Utils.Bools.getBool(this.config.options.limitLocales,!1);return n||_.each(e,function(e){e.added||i.push(e),delete e.added}),this.locales=i},t.prototype.getAlternateLocale=function(){for(var e,t=this.getLocales(),i=0;i0&&(t+=","),t+=n.name,n.label&&(t+=":"+n.label)}return t},t.prototype.getSerializedLocales=function(){return this.serializeLocales(this.locales)},t.prototype.getSharePreview=function(){var e={};e.title=this.helper.getLabel();var t=this.helper.getCurrentCanvas(),i=t.getProperty("thumbnail");return i&&_.isString(i)||(i=t.getCanonicalImageUri(this.config.options.bookmarkThumbWidth)),e.image=i,e},t.prototype.getPagedIndices=function(e){return"undefined"==typeof e&&(e=this.helper.canvasIndex),[e]},t.prototype.getCurrentCanvases=function(){for(var e=this.getPagedIndices(this.helper.canvasIndex),t=[],i=0;i"+this.content.title+""),this.$content.append(this.$title),this.$noneAvailable=$('
'+this.content.noneAvailable+"
"),this.$content.append(this.$noneAvailable),this.$downloadOptions=$('
    '),this.$content.append(this.$downloadOptions),this.$footer=$(''),this.$content.append(this.$footer),this.$termsOfUseButton=$(''+this.extension.config.content.termsOfUse+""),this.$footer.append(this.$termsOfUseButton),this.$termsOfUseButton.onPressed(function(){$.publish(i.SHOW_TERMS_OF_USE)}),this.$element.hide(),this.updateTermsOfUseButton()},t.prototype.addEntireFileDownloadOptions=function(){var e=this;if(this.isDownloadOptionAvailable(o.entireFileAsOriginal)){this.$downloadOptions.empty();var t=this.extension.helper.getCurrentCanvas(),i=!1;_.each(t.getRenderings(),function(t){var n=t.getFormat(),o="";n&&(o=n.toString()),e.addEntireFileDownloadOption(t.id,Manifesto.TranslationCollection.getValue(t.getLabel()),o),i=!0}),i||this.addEntireFileDownloadOption(t.id,null,null)}},t.prototype.addEntireFileDownloadOption=function(e,t,i){t?t+=" ({0})":t=this.content.entireFileAsOriginal;var n;n=i?Utils.Files.simplifyMimeType(i):this.getFileExtension(e),this.$downloadOptions.append('
  1. '+String.format(t,n)+"
  2. ")},t.prototype.updateNoneAvailable=function(){this.$downloadOptions.find("li:visible").length?this.$noneAvailable.hide():this.$noneAvailable.show()},t.prototype.updateTermsOfUseButton=function(){var e=this.extension.helper.getAttribution();Utils.Bools.getBool(this.extension.config.options.termsOfUseEnabled,!1)&&e?this.$termsOfUseButton.show():this.$termsOfUseButton.hide()},t.prototype.getFileExtension=function(e){return e.split(".").pop()},t.prototype.isDownloadOptionAvailable=function(e){switch(e){case o.entireFileAsOriginal:this.extension.helper.manifest.getService(manifesto.ServiceProfile.uiExtensions());if(!this.extension.helper.isUIEnabled("mediaDownload"))return!1}return!0},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){this.setDockedPosition()},t}(n);return s});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.updateNoneAvailable(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ShareDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t),this.aspectRatio=.75,this.isEmbedViewVisible=!1,this.isShareViewVisible=!1,this.maxHeight=this.maxWidth*this.aspectRatio,this.maxWidth=8e3,this.minHeight=this.minWidth*this.aspectRatio,this.minWidth=200}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("shareDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_SHARE_DIALOGUE,this.closeCommand=i.HIDE_SHARE_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i),t.isShareAvailable()?t.openShareView():t.openEmbedView()}),$.subscribe(this.closeCommand,function(e){t.close()}),$.subscribe(i.SHOW_EMBED_DIALOGUE,function(e,i){t.open(i),t.openEmbedView()}),this.$tabs=$('
    '),this.$content.append(this.$tabs),this.$shareButton=$('
    "),this.$shareButton.prop("title",this.content.share),this.$tabs.append(this.$shareButton),this.$embedButton=$(''+this.content.embed+""),this.$embedButton.prop("title",this.content.embed),this.$tabs.append(this.$embedButton),this.$tabsContent=$('
    '),this.$content.append(this.$tabsContent),this.$footer=$(''),this.$content.append(this.$footer),this.$shareView=$('
    '),this.$tabsContent.append(this.$shareView),this.$shareHeader=$('
    '),this.$shareView.append(this.$shareHeader),this.$shareLink=$(''),this.$shareView.append(this.$shareLink),this.$shareInput=$(''),this.$shareView.append(this.$shareInput),this.$shareFrame=$(''),this.$shareView.append(this.$shareFrame),this.$embedView=$('
    '),this.$tabsContent.append(this.$embedView),this.$embedHeader=$('
    '),this.$embedView.append(this.$embedHeader),this.$code=$(''),this.$embedView.append(this.$code),this.$customSize=$('
    '),this.$embedView.append(this.$customSize),this.$size=$(''+this.content.size+""),this.$customSize.append(this.$size),this.$customSizeDropDown=$(''),this.$customSize.append(this.$customSizeDropDown),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append(''),this.$customSizeDropDown.append('"),this.$widthInput=$(''),this.$customSize.append(this.$widthInput),this.$x=$('x'),this.$customSize.append(this.$x),this.$heightInput=$(''),this.$customSize.append(this.$heightInput);var n=this.extension.getIIIFShareUrl();this.$iiifButton=$(''),this.$footer.append(this.$iiifButton),this.$termsOfUseButton=$(''+this.extension.config.content.termsOfUse+""),this.$footer.append(this.$termsOfUseButton),this.$widthInput.on("keydown",function(e){return Utils.Numbers.numericalInput(e)}),this.$heightInput.on("keydown",function(e){return Utils.Numbers.numericalInput(e)}),this.$shareInput.focus(function(){$(this).select()}),this.$code.focus(function(){$(this).select()}),this.$shareButton.onPressed(function(){t.openShareView()}),this.$embedButton.onPressed(function(){t.openEmbedView()}),this.$customSizeDropDown.change(function(){t.update()}),this.$widthInput.change(function(){t.updateHeightRatio(),t.update()}),this.$heightInput.change(function(){t.updateWidthRatio(),t.update()}),this.$termsOfUseButton.onPressed(function(){$.publish(i.SHOW_TERMS_OF_USE)}),this.$element.hide(),this.updateInstructions(),this.updateShareOptions(),this.updateShareFrame(),this.updateTermsOfUseButton()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.update()},t.prototype.getShareUrl=function(){return this.extension.getShareUrl()},t.prototype.isShareAvailable=function(){return!!this.getShareUrl()},t.prototype.update=function(){this.isShareAvailable()?this.$shareButton.show():this.$shareButton.hide();var e=this.getSelectedSize();"custom"===e.val()?(this.$widthInput.show(),this.$x.show(),this.$heightInput.show()):(this.$widthInput.hide(),this.$x.hide(),this.$heightInput.hide(),this.currentWidth=Number(e.data("width")),this.currentHeight=Number(e.data("height")),this.$widthInput.val(String(this.currentWidth)),this.$heightInput.val(String(this.currentHeight)))},t.prototype.updateShareOptions=function(){this.$shareInput.val(this.getShareUrl()),this.$shareLink.prop("href",this.getShareUrl()),this.$shareLink.text(this.getShareUrl()),$.browser.mobile?(this.$shareInput.hide(),this.$shareLink.show()):(this.$shareInput.show(),this.$shareLink.hide())},t.prototype.updateInstructions=function(){Utils.Bools.getBool(this.options.instructionsEnabled,!1)?(this.$shareHeader.show(),this.$embedHeader.show(),this.$shareHeader.text(this.content.shareInstructions),this.$embedHeader.text(this.content.embedInstructions)):(this.$shareHeader.hide(),this.$embedHeader.hide())},t.prototype.getSelectedSize=function(){return this.$customSizeDropDown.find(":selected")},t.prototype.updateWidthRatio=function(){this.currentHeight=Number(this.$heightInput.val()),this.currentHeightthis.maxHeight&&(this.currentHeight=this.maxHeight,this.$heightInput.val(String(this.currentHeight))),this.currentWidth=Math.floor(this.currentHeight/this.aspectRatio),this.$widthInput.val(String(this.currentWidth))},t.prototype.updateHeightRatio=function(){this.currentWidth=Number(this.$widthInput.val()),this.currentWidththis.maxWidth&&(this.currentWidth=this.maxWidth,this.$widthInput.val(String(this.currentWidth))),this.currentHeight=Math.floor(this.currentWidth*this.aspectRatio),this.$heightInput.val(String(this.currentHeight))},t.prototype.updateShareFrame=function(){var e=this.extension.helper.getShareServiceUrl();Utils.Bools.getBool(this.config.options.shareFrameEnabled,!0)&&e?(this.$shareFrame.prop("src",e),this.$shareFrame.show()):this.$shareFrame.hide()},t.prototype.updateTermsOfUseButton=function(){var e=this.extension.helper.getAttribution();Utils.Bools.getBool(this.extension.config.options.termsOfUseEnabled,!1)&&e?this.$termsOfUseButton.show():this.$termsOfUseButton.hide()},t.prototype.openShareView=function(){this.isShareViewVisible=!0,this.isEmbedViewVisible=!1,this.$embedView.hide(),this.$shareView.show(),this.$shareButton.addClass("on default"),this.$embedButton.removeClass("on default"),this.resize()},t.prototype.openEmbedView=function(){this.isShareViewVisible=!1,this.isEmbedViewVisible=!0,this.$embedView.show(),this.$shareView.hide(),this.$shareButton.removeClass("on default"),this.$embedButton.addClass("on default"),this.resize()},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.getViews=function(){return this.$tabsContent.find(".view")},t.prototype.equaliseViewHeights=function(){this.getViews().equaliseHeight(!0)},t.prototype.resize=function(){this.equaliseViewHeights(),this.setDockedPosition()},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/FooterPanel",["require","exports","./BaseCommands","./BaseView","./Metrics"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("footerPanel"),e.prototype.create.call(this),$.subscribe(i.TOGGLE_FULLSCREEN,function(){t.updateFullScreenButton()}),$.subscribe(i.METRIC_CHANGED,function(){t.updateMinimisedButtons(),t.updateMoreInfoButton()}),$.subscribe(i.SETTINGS_CHANGED,function(){t.updateDownloadButton()}),this.$options=$('
    '),this.$element.append(this.$options),this.$feedbackButton=$('"),this.$options.prepend(this.$feedbackButton),this.$openButton=$(''+this.content.open+""),this.$options.prepend(this.$openButton),this.$bookmarkButton=$(''+this.content.bookmark+""),this.$options.prepend(this.$bookmarkButton),this.$shareButton=$('"),this.$options.append(this.$shareButton),this.$embedButton=$(''+this.content.embed+""),this.$options.append(this.$embedButton),this.$downloadButton=$(''+this.content.download+""),this.$options.prepend(this.$downloadButton),this.$moreInfoButton=$(''+this.content.moreInfo+""),this.$options.prepend(this.$moreInfoButton),this.$fullScreenBtn=$(''+this.content.fullScreen+""),this.$options.append(this.$fullScreenBtn),this.$openButton.onPressed(function(){$.publish(i.OPEN)}),this.$feedbackButton.onPressed(function(){$.publish(i.FEEDBACK)}),this.$bookmarkButton.onPressed(function(){$.publish(i.BOOKMARK)}),this.$shareButton.onPressed(function(){$.publish(i.SHOW_SHARE_DIALOGUE,[t.$shareButton])}),this.$embedButton.onPressed(function(){$.publish(i.SHOW_EMBED_DIALOGUE,[t.$embedButton])}),this.$downloadButton.onPressed(function(){$.publish(i.SHOW_DOWNLOAD_DIALOGUE,[t.$downloadButton])}),this.$moreInfoButton.onPressed(function(){$.publish(i.SHOW_MOREINFO_DIALOGUE,[t.$moreInfoButton])}),this.$fullScreenBtn.on("click",function(e){e.preventDefault(),$.publish(i.TOGGLE_FULLSCREEN)}),Utils.Bools.getBool(this.options.embedEnabled,!0)||this.$embedButton.hide(),this.updateMoreInfoButton(),this.updateOpenButton(),this.updateFeedbackButton(),this.updateBookmarkButton(),this.updateEmbedButton(),this.updateDownloadButton(),this.updateFullScreenButton(),this.updateShareButton(),this.updateMinimisedButtons()},t.prototype.updateMinimisedButtons=function(){return Utils.Bools.getBool(this.options.minimiseButtons,!1)?void this.$options.addClass("minimiseButtons"):void(this.extension.metric===o.MOBILE_LANDSCAPE?this.$options.addClass("minimiseButtons"):this.$options.removeClass("minimiseButtons"))},t.prototype.updateMoreInfoButton=function(){var e=Utils.Bools.getBool(this.options.moreInfoEnabled,!1);e&&this.extension.metric===o.MOBILE_LANDSCAPE?this.$moreInfoButton.show():this.$moreInfoButton.hide()},t.prototype.updateOpenButton=function(){var e=Utils.Bools.getBool(this.options.openEnabled,!1);e&&!this.extension.isHomeDomain?this.$openButton.show():this.$openButton.hide()},t.prototype.updateFullScreenButton=function(){Utils.Bools.getBool(this.options.fullscreenEnabled,!0)||this.$fullScreenBtn.hide(),this.extension.isLightbox&&this.$fullScreenBtn.addClass("lightbox"),this.extension.isFullScreen()?(this.$fullScreenBtn.swapClass("fullScreen","exitFullscreen"),this.$fullScreenBtn.text(this.content.exitFullScreen),this.$fullScreenBtn.attr("title",this.content.exitFullScreen)):(this.$fullScreenBtn.swapClass("exitFullscreen","fullScreen"),this.$fullScreenBtn.text(this.content.fullScreen),this.$fullScreenBtn.attr("title",this.content.fullScreen))},t.prototype.updateEmbedButton=function(){this.extension.helper.isUIEnabled("embed")&&Utils.Bools.getBool(this.options.embedEnabled,!1)?$.browser.mobile||this.$embedButton.show():this.$embedButton.hide()},t.prototype.updateShareButton=function(){this.extension.helper.isUIEnabled("share")&&Utils.Bools.getBool(this.options.shareEnabled,!0)?this.$shareButton.show():this.$shareButton.hide()},t.prototype.updateDownloadButton=function(){var e=Utils.Bools.getBool(this.options.downloadEnabled,!0);e?this.$downloadButton.show():this.$downloadButton.hide()},t.prototype.updateFeedbackButton=function(){var e=Utils.Bools.getBool(this.options.feedbackEnabled,!1);e?this.$feedbackButton.show():this.$feedbackButton.hide()},t.prototype.updateBookmarkButton=function(){var e=Utils.Bools.getBool(this.options.bookmarkEnabled,!1);e?this.$bookmarkButton.show():this.$bookmarkButton.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return s}),define("modules/uv-shared-module/Information",["require","exports"],function(e,t){var i=function(){function e(e,t){this.message=e,this.actions=t}return e}();return i}),define("modules/uv-shared-module/InformationAction",["require","exports"],function(e,t){var i=function(){function e(){}return e}();return i}),define("modules/uv-shared-module/InformationFactory",["require","exports","./BaseCommands","./Information","./InformationAction","./InformationType"],function(e,t,i,n,o,s){var r=function(){function e(e){this.extension=e}return e.prototype.Get=function(e){switch(e.informationType){case s.AUTH_CORS_ERROR:return new n(this.extension.config.content.authCORSError,[]);case s.DEGRADED_RESOURCE:var t=[],r=new o;return r.label=this.extension.config.content.degradedResourceLogin,r.action=function(){$.publish(i.HIDE_INFORMATION),$.publish(i.OPEN_EXTERNAL_RESOURCE,[[e.param]])},t.push(r),new n(this.extension.config.content.degradedResourceMessage,t)}},e}();return r});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/HeaderPanel",["require","exports","./BaseCommands","./BaseView","../uv-shared-module/InformationFactory"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t,!1,!1)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("headerPanel"),e.prototype.create.call(this),$.subscribe(i.SHOW_INFORMATION,function(e,i){t.showInformation(i)}),$.subscribe(i.HIDE_INFORMATION,function(){t.hideInformation()}),this.$options=$('
    '),this.$element.append(this.$options),this.$centerOptions=$('
    '),this.$options.append(this.$centerOptions),this.$rightOptions=$('
    '),this.$options.append(this.$rightOptions),this.$localeToggleButton=$(''),this.$rightOptions.append(this.$localeToggleButton),this.$settingsButton=$(''),this.$settingsButton.attr("title",this.content.settings),this.$rightOptions.append(this.$settingsButton),this.$informationBox=$('
    '),this.$element.append(this.$informationBox),this.$informationBox.hide(),this.$informationBox.find(".close").attr("title",this.content.close),this.$informationBox.find(".close").on("click",function(e){e.preventDefault(),$.publish(i.HIDE_INFORMATION)}),this.$localeToggleButton.on("click",function(){t.extension.changeLocale(String(t.$localeToggleButton.data("locale")))}),this.$settingsButton.onPressed(function(){$.publish(i.SHOW_SETTINGS_DIALOGUE)}),this.updateLocaleToggle(),this.updateSettingsButton()},t.prototype.updateLocaleToggle=function(){if(!this.localeToggleIsVisible())return void this.$localeToggleButton.hide();var e=this.extension.getAlternateLocale(),t=e.name.split("-")[0].toUpperCase();this.$localeToggleButton.data("locale",e.name),this.$localeToggleButton.attr("title",e.label),this.$localeToggleButton.text(t)},t.prototype.updateSettingsButton=function(){var e=Utils.Bools.getBool(this.options.settingsButtonEnabled,!0);e?this.$settingsButton.show():this.$settingsButton.hide()},t.prototype.localeToggleIsVisible=function(){return this.extension.getLocales().length>1&&Utils.Bools.getBool(this.options.localeToggleEnabled,!1)},t.prototype.showInformation=function(e){var t=new o(this.extension);this.information=t.Get(e);var i=this.$informationBox.find(".message");i.html(this.information.message).find("a").attr("target","_top");var n=this.$informationBox.find(".actions");n.empty();for(var s=0;s'+r.label+"");a.on("click",r.action),n.append(a)}this.$informationBox.show(),this.$element.addClass("showInformation"),this.extension.resize()},t.prototype.hideInformation=function(){this.$element.removeClass("showInformation"),this.$informationBox.hide(),this.extension.resize()},t.prototype.getSettings=function(){return this.extension.getSettings()},t.prototype.updateSettings=function(e){this.extension.updateSettings(e),$.publish(i.UPDATE_SETTINGS,[e])},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.$element.width(),i=t/2,n=this.$centerOptions.outerWidth(),o=i-n/2;if(this.$centerOptions.css({left:o}),this.$informationBox.is(":visible")){var s=this.$informationBox.find(".actions"),r=this.$informationBox.find(".message");r.width(this.$element.width()-r.horizontalMargins()-s.outerWidth(!0)-this.$informationBox.find(".close").outerWidth(!0)-1),r.ellipsisFill(this.information.message)}this.extension.width()"),this.$content.append(this.$title),this.$scroll=$('
    '),this.$content.append(this.$scroll),this.$message=$("

    "),this.$scroll.append(this.$message),this.$title.text(this.content.title),this.$message.html(this.content.text),this.$message.targetBlank(),this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/CenterPanel",["require","exports","./Shell","./BaseView"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!1,!0)}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$title=$('
    '),this.$element.append(this.$title),this.$content=$('
    '),this.$element.append(this.$content),this.$attribution=$('
    '),this.$attribution.find(".header .title").text(this.content.attribution),this.$content.append(this.$attribution),this.$attribution.hide(),this.$closeAttributionButton=this.$attribution.find(".header .close"),this.$closeAttributionButton.on("click",function(e){e.preventDefault(),t.$attribution.hide()}),Utils.Bools.getBool(this.options.titleEnabled,!0)||this.$title.hide()},t.prototype.updateAttribution=function(){var e=this,t=this.extension.helper.getAttribution(),i=Utils.Bools.getBool(this.options.attributionEnabled,!0);if(t&&i){this.$attribution.show();var n=this.$attribution.find(".attribution-text"),o=this.$attribution.find(".license"),s=this.$attribution.find(".logo");n.html(this.extension.sanitize(t)),n.find("img").one("load",function(){e.resize()}).each(function(){this.complete&&$(this).load()}),n.targetBlank(),n.toggleExpandText(this.options.trimAttributionCount,function(){e.resize()}),o.hide(),s.hide()}},t.prototype.resize=function(){e.prototype.resize.call(this);var t=i.$leftPanel.is(":visible")?Math.floor(i.$leftPanel.width()):0,n=i.$rightPanel.is(":visible")?Math.floor(i.$rightPanel.width()):0,o=Math.floor(this.$element.parent().width()-t-n);this.$element.css({left:t,width:o});var s;s=this.options&&this.options.titleEnabled===!1?0:this.$title.height(),this.$content.height(this.$element.height()-s),this.$content.width(this.$element.width()),this.$attribution&&this.$attribution.is(":visible")&&this.$attribution.css("top",this.$content.height()-this.$attribution.outerHeight()-this.$attribution.verticalMargins())},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-mediaelement-extension/Commands","../uv-shared-module/CenterPanel"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("mediaelementCenterPanel"),e.prototype.create.call(this);var t=this;this.extension.isVideo()&&$.subscribe(i.TOGGLE_FULLSCREEN,function(e){t.bootstrapper.isFullScreen?(t.$container.css("backgroundColor","#000"),t.player.enterFullScreen(!1)):(t.$container.css("backgroundColor","transparent"),t.player.exitFullScreen(!1))}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.openMedia(i)}),this.$container=$('
    '),this.$content.append(this.$container),this.title=this.extension.helper.getLabel()},t.prototype.openMedia=function(e){var t=this,i=this;this.extension.getExternalResources(e).then(function(){t.$container.empty();var e=t.extension.helper.getCurrentCanvas();t.mediaHeight=t.config.defaultHeight,t.mediaWidth=t.config.defaultWidth,t.$container.height(t.mediaHeight),t.$container.width(t.mediaWidth);var o=Utils.Dates.getTimeStamp(),s=t.extension.getPosterImageUri(),r=s?' poster="'+s+'"':"",a=[];if(_.each(e.getRenderings(),function(e){a.push({type:e.getFormat().toString(),src:e.id})}),t.extension.isVideo())t.media=t.$container.append('"),t.player=new MediaElementPlayer("#"+o,{type:["video/mp4","video/webm","video/flv"],plugins:["flash"],alwaysShowControls:!1,autosizeProgress:!1,success:function(e){ -e.addEventListener("canplay",function(e){i.resize()}),e.addEventListener("play",function(e){$.publish(n.MEDIA_PLAYED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("pause",function(e){Math.floor(i.player.media.currentTime)!=Math.floor(i.player.media.duration)&&$.publish(n.MEDIA_PAUSED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("ended",function(e){$.publish(n.MEDIA_ENDED,[Math.floor(i.player.media.duration)])}),e.setSrc(a);try{e.load()}catch(t){}}});else{var l=0;for(var h in a)if("audio/mp3"===a[h].type){l=h;break}t.media=t.$container.append('"),t.player=new MediaElementPlayer("#"+o,{plugins:["flash"],alwaysShowControls:!1,autosizeProgress:!1,defaultVideoWidth:i.mediaWidth,defaultVideoHeight:i.mediaHeight,success:function(e){e.addEventListener("canplay",function(e){i.resize()}),e.addEventListener("play",function(e){$.publish(n.MEDIA_PLAYED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("pause",function(e){Math.floor(i.player.media.currentTime)!=Math.floor(i.player.media.duration)&&$.publish(n.MEDIA_PAUSED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("ended",function(e){$.publish(n.MEDIA_ENDED,[Math.floor(i.player.media.duration)])});try{e.load()}catch(t){}}})}t.resize()})},t.prototype.resize=function(){if(e.prototype.resize.call(this),"Firefox"===window.browserDetect.browser&&window.browserDetect.version<13)this.$container.width(this.mediaWidth),this.$container.height(this.mediaHeight);else{var t=Utils.Measurements.Dimensions.fitRect(this.mediaWidth,this.mediaHeight,this.$content.width(),this.$content.height());this.$container.height(t.height),this.$container.width(t.width)}this.player&&!this.extension.isFullScreen()&&this.player.resize();var i=Math.floor((this.$content.width()-this.$container.width())/2),n=Math.floor((this.$content.height()-this.$container.height())/2);this.$container.css({left:i,top:n}),this.$title.ellipsisFill(this.title)},t}(o);return s});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/BaseExpandPanel",["require","exports","./BaseView"],function(e,t,i){var n=function(e){function t(t){e.call(this,t,!1,!0),this.isExpanded=!1,this.isFullyExpanded=!1,this.isUnopened=!0,this.autoToggled=!1,this.expandFullEnabled=!0}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$top=$('
    '),this.$element.append(this.$top),this.$title=$('
    '),this.$title.prop("title",this.content.title),this.$top.append(this.$title),this.$expandFullButton=$(''),this.$expandFullButton.prop("title",this.content.expandFull),this.$top.append(this.$expandFullButton),Utils.Bools.getBool(this.config.options.expandFullEnabled,!0)||this.$expandFullButton.hide(),this.$collapseButton=$('
    '),this.$collapseButton.prop("title",this.content.collapse),this.$top.append(this.$collapseButton),this.$closed=$('
    '),this.$element.append(this.$closed),this.$expandButton=$(''),this.$expandButton.prop("title",this.content.expand),this.$closed.append(this.$expandButton),this.$closedTitle=$(''),this.$closedTitle.prop("title",this.content.title),this.$closed.append(this.$closedTitle),this.$main=$('
    '),this.$element.append(this.$main),this.$expandButton.onPressed(function(){t.toggle()}),this.$expandFullButton.onPressed(function(){t.expandFull()}),this.$closedTitle.onPressed(function(){t.toggle()}),this.$title.onPressed(function(){t.isFullyExpanded?t.collapseFull():t.toggle()}),this.$collapseButton.onPressed(function(){t.isFullyExpanded?t.collapseFull():t.toggle()}),this.$top.hide(),this.$main.hide()},t.prototype.init=function(){e.prototype.init.call(this)},t.prototype.setTitle=function(e){this.$title.text(e),this.$closedTitle.text(e)},t.prototype.toggle=function(e){var t=this;e?this.autoToggled=!0:this.autoToggled=!1,this.isExpanded&&(this.$top.hide(),this.$main.hide(),this.$closed.show()),this.$element.stop().animate({width:this.getTargetWidth(),left:this.getTargetLeft()},this.options.panelAnimationDuration,function(){t.toggled()})},t.prototype.toggled=function(){this.toggleStart(),this.isExpanded=!this.isExpanded,this.isExpanded&&(this.$closed.hide(),this.$top.show(),this.$main.show()),this.toggleFinish(),this.isUnopened=!1},t.prototype.expandFull=function(){var e=this,t=this.getFullTargetWidth(),i=this.getFullTargetLeft();this.expandFullStart(),this.$element.stop().animate({width:t,left:i},this.options.panelAnimationDuration,function(){e.expandFullFinish()})},t.prototype.collapseFull=function(){var e=this,t=this.getTargetWidth(),i=this.getTargetLeft();this.collapseFullStart(),this.$element.stop().animate({width:t,left:i},this.options.panelAnimationDuration,function(){e.collapseFullFinish()})},t.prototype.getTargetWidth=function(){return 0},t.prototype.getTargetLeft=function(){return 0},t.prototype.getFullTargetWidth=function(){return 0},t.prototype.getFullTargetLeft=function(){return 0},t.prototype.toggleStart=function(){},t.prototype.toggleFinish=function(){this.isExpanded&&!this.autoToggled?this.focusCollapseButton():this.focusExpandButton()},t.prototype.expandFullStart=function(){},t.prototype.expandFullFinish=function(){this.isFullyExpanded=!0,this.$expandFullButton.hide(),this.focusCollapseButton()},t.prototype.collapseFullStart=function(){},t.prototype.collapseFullFinish=function(){this.isFullyExpanded=!1,this.expandFullEnabled&&this.$expandFullButton.show(),this.focusExpandFullButton()},t.prototype.focusExpandButton=function(){var e=this;setTimeout(function(){e.$expandButton.focus()},1)},t.prototype.focusExpandFullButton=function(){var e=this;setTimeout(function(){e.$expandFullButton.focus()},1)},t.prototype.focusCollapseButton=function(){var e=this;setTimeout(function(){e.$collapseButton.focus()},1)},t.prototype.resize=function(){e.prototype.resize.call(this),this.$main.height(this.$element.parent().height()-this.$top.outerHeight(!0))},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/RightPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){e.prototype.create.call(this),this.$element.width(this.options.panelCollapsedWidth)},t.prototype.init=function(){var t=this;e.prototype.init.call(this),this.options.panelOpen&&this.toggle(!0),$.subscribe(i.TOGGLE_EXPAND_RIGHT_PANEL,function(){t.isFullyExpanded?t.collapseFull():t.expandFull()})},t.prototype.getTargetWidth=function(){return this.isExpanded?this.options.panelCollapsedWidth:this.options.panelExpandedWidth},t.prototype.getTargetLeft=function(){return this.isExpanded?this.$element.parent().width()-this.options.panelCollapsedWidth:this.$element.parent().width()-this.options.panelExpandedWidth},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.isExpanded?$.publish(i.OPEN_RIGHT_PANEL):$.publish(i.CLOSE_RIGHT_PANEL)},t.prototype.resize=function(){e.prototype.resize.call(this),this.$element.css({left:Math.floor(this.$element.parent().width()-this.$element.outerWidth())})},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-moreinforightpanel-module/MoreInfoRightPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/RightPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("moreInfoRightPanel"),e.prototype.create.call(this),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.databind()}),this.setTitle(this.config.content.title),this.$metadata=$(''),this.$main.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent(this._getOptions())},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.databind()},t.prototype.databind=function(){this.component.options=this._getOptions(),this.component.databind()},t.prototype._getOptions=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:this.extension.getCanvasLabels(this.content.page),content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),element:".rightPanel .iiif-metadata-component",helper:this.extension.helper,licenseFormatter:null,limit:this.config.options.textLimit||4,limitType:IIIFComponents.MetadataComponentOptions.LimitType.LINES,manifestDisplayOrder:this.config.options.manifestDisplayOrder,manifestExclude:this.config.options.manifestExclude,range:this.extension.getCurrentCanvasRange(),rtlLanguageCodes:this.config.options.rtlLanguageCodes,sanitizer:function(t){return e.extension.sanitize(t)},showAllLanguages:this.config.options.showAllLanguages}},t.prototype.resize=function(){e.prototype.resize.call(this),this.$main.height(this.$element.height()-this.$top.height()-this.$main.verticalMargins())},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/LeftPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$element.width(this.options.panelCollapsedWidth),$.subscribe(i.TOGGLE_EXPAND_LEFT_PANEL,function(){t.isFullyExpanded?t.collapseFull():t.expandFull()})},t.prototype.init=function(){e.prototype.init.call(this),this.options.panelOpen&&this.toggle(!0)},t.prototype.getTargetWidth=function(){return this.isFullyExpanded||!this.isExpanded?this.options.panelExpandedWidth:this.options.panelCollapsedWidth},t.prototype.getFullTargetWidth=function(){return this.$element.parent().width()},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.isExpanded?$.publish(i.OPEN_LEFT_PANEL):$.publish(i.CLOSE_LEFT_PANEL)},t.prototype.resize=function(){e.prototype.resize.call(this),this.isFullyExpanded&&this.$element.width(this.$element.parent().width())},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-shared-module/ThumbsView",["require","exports","./BaseCommands","./BaseView"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!0,!0),this.isCreated=!1,this.isOpen=!1}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.selectIndex(parseInt(i))}),$.subscribe(i.LOGIN,function(){t.loadThumbs()}),$.subscribe(i.CLICKTHROUGH,function(){t.loadThumbs()}),this.$thumbs=$('
    '),this.$element.append(this.$thumbs),this.$thumbs.addClass(this.extension.helper.getViewingDirection().toString());var n=this;$.templates({thumbsTemplate:'
    {{:#index + 1}} {{>label}} 
    {{if ~separator()}}
    {{/if}}'});var o=this.options.thumbsExtraHeight;$.views.helpers({separator:function(){return!1},extraHeight:function(){return o},className:function(){var e="thumb";0===this.data.index&&(e+=" first"),this.data.uri||(e+=" placeholder");var t=n.extension.helper.getViewingDirection().toString();return e+=t===manifesto.ViewingDirection.topToBottom().toString()||t===manifesto.ViewingDirection.bottomToTop().toString()?" oneCol":" twoCol"}}),this.$element.on("scroll",function(){t.scrollStop()},100),this.resize()},t.prototype.databind=function(){this.thumbs&&this.createThumbs()},t.prototype.createThumbs=function(){var e=this;if(!this.isCreated&&this.thumbs){for(var t=[],n=0;n1&&(e=1);var t=Math.floor((this.thumbs.length-1)*e);this.loadThumbs(t)},t.prototype.loadThumbs=function(e){if(this.thumbs&&this.thumbs.length){_.isUndefined(e)&&(e=this.extension.helper.canvasIndex);for(var t=e,i=this.options.thumbsLoadRange,n={start:t>i?t-i:0,end:t');$(u).hide().load(function(){$(this).fadeIn(o,function(){$(this).parent().swapClass("loading","loaded")})}).error(function(){$(this).parent().swapClass("loading","loadingFailed")}),a.append(u)}else a.addClass("hidden")}}}},t.prototype.show=function(){var e=this;this.isOpen=!0,this.$element.show(),setTimeout(function(){e.selectIndex(e.extension.helper.canvasIndex)},1)},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.isPDF=function(){return this.extension.helper.getElementType().toString().contains("pdf")},t.prototype.setLabel=function(){$(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").show()},t.prototype.addSelectedClassToThumbs=function(e){this.getThumbByIndex(e).addClass("selected")},t.prototype.selectIndex=function(e){-1!=e&&this.thumbs&&this.thumbs.length&&(this.getAllThumbs().removeClass("selected"),this.$selectedThumb=this.getThumbByIndex(e),this.addSelectedClassToThumbs(e),this.lastThumbClickedIndex!=e&&this.$element.scrollTop(this.$selectedThumb.position().top),this.loadThumbs(e))},t.prototype.getAllThumbs=function(){return this._thumbsCache||(this._thumbsCache=this.$thumbs.find(".thumb")),this._thumbsCache},t.prototype.getThumbByIndex=function(e){return this.$thumbs.find('[data-index="'+e+'"]')},t.prototype.scrollToThumb=function(e){var t=this.getThumbByIndex(e);this.$element.scrollTop(t.position().top)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-resourcesleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView"],function(e,t,i){var n=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-resourcesleftpanel-module/ResourcesLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/LeftPanel","./ThumbsView"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this),this.setTitle(this.content.title),this.$tabsContent=$('
    '),this.$main.append(this.$tabsContent),this.$views=$('
    '),this.$tabsContent.append(this.$views),this.$thumbsView=$('
    '),this.$views.append(this.$thumbsView),this.$resourcesView=$('
    '),this.$resources=$("
      "),this.$resourcesView.append(this.$resources),this.$views.append(this.$resourcesView),this.thumbsView=new o(this.$thumbsView),this.dataBind()},t.prototype.dataBind=function(){this.dataBindThumbsView();var e=this.extension.helper.getResources();0===e.length&&this.$resourcesView.hide();for(var t=0;t'+Manifesto.TranslationCollection.getValue(n.getLabel())+" ("+Utils.Files.simplifyMimeType(n.getFormat().toString())+")");this.$resources.append(o)}},t.prototype.dataBindThumbsView=function(){if(this.thumbsView){var e,t,i=this.extension.helper.getViewingDirection().toString();i===manifesto.ViewingDirection.topToBottom().toString()||i===manifesto.ViewingDirection.bottomToTop().toString()?(e=this.config.options.oneColThumbWidth,t=this.config.options.oneColThumbHeight):(e=this.config.options.twoColThumbWidth,t=this.config.options.twoColThumbHeight),"undefined"==typeof e&&(e=100),"undefined"==typeof t&&(t=100),this.thumbsView.thumbs=this.extension.helper.getThumbs(e,t),this.thumbsView.thumbs.length<2&&this.$thumbsView.hide(),this.thumbsView.databind()}},t.prototype.expandFullStart=function(){e.prototype.expandFullStart.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_START)},t.prototype.expandFullFinish=function(){e.prototype.expandFullFinish.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_FINISH)},t.prototype.collapseFullStart=function(){e.prototype.collapseFullStart.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_START)},t.prototype.collapseFullFinish=function(){e.prototype.collapseFullFinish.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_FINISH)},t.prototype.resize=function(){e.prototype.resize.call(this),this.$views.height(this.$main.height()),this.$resources.height(this.$main.height())},t}(n);return s}),define("_Version",["require","exports"],function(e,t){t.Version="1.8.38"});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/SettingsDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue","../../_Version"],function(e,t,i,n,o,s){var r=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_SETTINGS_DIALOGUE,this.closeCommand=i.HIDE_SETTINGS_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("

      "),this.$content.append(this.$title),this.$scroll=$('
      '),this.$content.append(this.$scroll),this.$version=$('
      '),this.$content.append(this.$version),this.$website=$('
      '),this.$content.append(this.$website),this.$locale=$('
      '),this.$scroll.append(this.$locale),this.$localeLabel=$('"),this.$locale.append(this.$localeLabel),this.$localeDropDown=$(''),this.$locale.append(this.$localeDropDown),this.$title.text(this.content.title),this.$version.text("v"+s.Version),this.$website.html(this.content.website),this.$website.targetBlank();for(var n=this.extension.getLocales(),o=0;o'+r.label+"")}this.$localeDropDown.val(this.extension.locale),this.$localeDropDown.change(function(){t.extension.changeLocale(t.$localeDropDown.val())}),this.extension.getLocales().length<2&&this.$locale.hide(),this.$element.hide()},t.prototype.getSettings=function(){return this.extension.getSettings()},t.prototype.updateSettings=function(e){this.extension.updateSettings(e),$.publish(n.UPDATE_SETTINGS,[e])},t.prototype.open=function(){e.prototype.open.call(this)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(o);return r});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-mediaelement-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./Commands","./DownloadDialogue","./ShareDialogue","../../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","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,u,c,p,d,g,f){var m=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t),$(window).bind("enterfullscreen",function(){$.publish(i.TOGGLE_FULLSCREEN)}),$(window).bind("exitfullscreen",function(){$.publish(i.TOGGLE_FULLSCREEN)}),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){f.$centerPanel.hide(),f.$rightPanel.hide()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){f.$centerPanel.show(),f.$rightPanel.show(),n.resize()}),$.subscribe(s.MEDIA_ENDED,function(e){n.triggerSocket(s.MEDIA_ENDED)}),$.subscribe(s.MEDIA_PAUSED,function(e){n.triggerSocket(s.MEDIA_PAUSED)}),$.subscribe(s.MEDIA_PLAYED,function(e){n.triggerSocket(s.MEDIA_PLAYED)})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new h(f.$headerPanel):f.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new d(f.$leftPanel)),this.centerPanel=new c(f.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new p(f.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new l(f.$footerPanel):f.$footerPanel.hide(),this.$helpDialogue=$('
      '),f.$overlays.append(this.$helpDialogue),this.helpDialogue=new u(this.$helpDialogue),this.$downloadDialogue=$('
      '),f.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$(''),f.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('
      '),f.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new g(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()},t.prototype.isLeftPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)&&(this.helper.isMultiCanvas()||this.helper.isMultiSequence()||this.helper.hasResources())},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.extensions.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,this.isVideo()?n.type=manifesto.ElementType.movingimage().toString():n.type=manifesto.ElementType.sound().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t.prototype.getPosterImageUri=function(){return this.helper.getCurrentCanvas().getProperty("thumbnail")},t.prototype.isVideo=function(){var e=this.helper.getElementType();return e.toString()===manifesto.ElementType.movingimage().toString()},t}(n);return m});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.$downloadOptions.find("li:visible").length?this.$noneAvailable.hide():this.$noneAvailable.show(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-pdfcenterpanel-module/PDFCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/CenterPanel","../../Params"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("pdfCenterPanel"),e.prototype.create.call(this),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.openMedia(i)})},t.prototype.openMedia=function(e){var t=this,i=this;this.extension.getExternalResources(e).then(function(){var e=t.extension.helper.getCurrentCanvas(),n=e.id,s=window.browserDetect.browser,r=window.browserDetect.version;if("Explorer"===s&&10>r||!t.config.options.usePdfJs)new PDFObject({url:n,id:"PDF"}).embed("content");else{var a;a=window.DEBUG?"modules/uv-pdfcenterpanel-module/html/viewer.html":"html/uv-pdfcenterpanel-module/viewer.html",t.$content.load(a,function(){window.DEBUG?PDFJS.workerSrc="extensions/uv-pdf-extension/lib/pdf.worker.min.js":PDFJS.workerSrc="lib/pdf.worker.min.js",PDFJS.DEFAULT_URL=n;var e=1+parseInt(i.extension.getParam(o.anchor))||0;PDFView.initialBookmark="page="+e,window.webViewerLoad(),t.resize()})}})},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return s});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-pdf-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-pdfcenterpanel-module/PDFCenterPanel","../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,u,c,p,d){var g=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t.index)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){d.$centerPanel.hide(),d.$rightPanel.hide()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){d.$centerPanel.show(),d.$rightPanel.show(),n.resize()}),$.subscribe(i.SHOW_OVERLAY,function(e,t){n.IsOldIE()&&n.centerPanel.$element.hide()}),$.subscribe(i.HIDE_OVERLAY,function(e,t){n.IsOldIE()&&n.centerPanel.$element.show()})},t.prototype.IsOldIE=function(){var e=window.browserDetect.browser,t=window.browserDetect.version;return"Explorer"===e&&9>=t?!0:!1},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new l(d.$headerPanel):d.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new c(d.$leftPanel)),this.centerPanel=new u(d.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new h(d.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new a(d.$footerPanel):d.$footerPanel.hide(),this.$downloadDialogue=$('
      '),d.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new s(this.$downloadDialogue),this.$shareDialogue=$(''),d.$overlays.append(this.$shareDialogue),this.shareDialogue=new r(this.$shareDialogue), -this.$settingsDialogue=$('
      '),d.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new p(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.document().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t}(n);return g}),define("extensions/uv-seadragon-extension/Commands",["require","exports"],function(e,t){var i=function(){function e(){}return e.namespace="seadragonExtension.",e.CLEAR_SEARCH=e.namespace+"onClearSearch",e.CURRENT_VIEW_URI=e.namespace+"onCurrentViewUri",e.FIRST=e.namespace+"onFirst",e.GALLERY_DECREASE_SIZE=e.namespace+"onGalleryDecreaseSize",e.GALLERY_INCREASE_SIZE=e.namespace+"onGalleryIncreaseSize",e.GALLERY_THUMB_SELECTED=e.namespace+"onGalleryThumbSelected",e.HIDE_MULTISELECT_DIALOGUE=e.namespace+"onHideMultiSelectDialogue",e.IMAGE_SEARCH=e.namespace+"onImageSearch",e.LAST=e.namespace+"onLast",e.MODE_CHANGED=e.namespace+"onModeChanged",e.MULTISELECT_CHANGE=e.namespace+"onMultiSelectChange",e.MULTISELECTION_MADE=e.namespace+"onMultiSelectionMade",e.NEXT_SEARCH_RESULT=e.namespace+"onNextSearchResult",e.NEXT=e.namespace+"onNext",e.OPEN_THUMBS_VIEW=e.namespace+"onOpenThumbsView",e.OPEN_TREE_VIEW=e.namespace+"onOpenTreeView",e.PAGE_SEARCH=e.namespace+"onPageSearch",e.PAGING_TOGGLED=e.namespace+"onPagingToggled",e.PREV_SEARCH_RESULT=e.namespace+"onPrevSearchResult",e.PREV=e.namespace+"onPrev",e.PRINT=e.namespace+"onPrint",e.ROTATE=e.namespace+"onRotate",e.SEADRAGON_ANIMATION_FINISH=e.namespace+"onAnimationfinish",e.SEADRAGON_ANIMATION_START=e.namespace+"onAnimationStart",e.SEADRAGON_ANIMATION=e.namespace+"onAnimation",e.SEADRAGON_OPEN=e.namespace+"onOpen",e.SEADRAGON_RESIZE=e.namespace+"onResize",e.SEADRAGON_ROTATION=e.namespace+"onRotation",e.SEARCH_PREVIEW_FINISH=e.namespace+"onSearchPreviewFinish",e.SEARCH_PREVIEW_START=e.namespace+"onSearchPreviewStart",e.SEARCH_RESULTS_EMPTY=e.namespace+"onSearchResultsEmpty",e.SEARCH_RESULTS=e.namespace+"onSearchResults",e.SEARCH=e.namespace+"onSearch",e.SHOW_MULTISELECT_DIALOGUE=e.namespace+"onShowMultiSelectDialogue",e.THUMB_MULTISELECTED=e.namespace+"onThumbMultiSelected",e.TREE_NODE_MULTISELECTED=e.namespace+"onTreeNodeMultiSelected",e.TREE_NODE_SELECTED=e.namespace+"onTreeNodeSelected",e.VIEW_PAGE=e.namespace+"onViewPage",e.ZOOM_IN=e.namespace+"onZoomIn",e.ZOOM_OUT=e.namespace+"onZoomOut",e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-contentleftpanel-module/GalleryView",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/BaseView","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t,!0,!0),this.isOpen=!1}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$gallery=$(''),this.$element.append(this.$gallery)},t.prototype.setup=function(){this.component=new IIIFComponents.GalleryComponent(this.galleryOptions),this.component.on("thumbSelected",function(e){var t=e[0];$.publish(o.GALLERY_THUMB_SELECTED,[t]),$.publish(i.THUMB_SELECTED,[t])}),this.component.on("decreaseSize",function(){$.publish(o.GALLERY_DECREASE_SIZE)}),this.component.on("increaseSize",function(){$.publish(o.GALLERY_INCREASE_SIZE)})},t.prototype.databind=function(){this.component.options=this.galleryOptions,this.component.databind(),this.resize()},t.prototype.show=function(){var e=this;this.isOpen=!0,this.$element.show(),setTimeout(function(){e.component.selectIndex(e.extension.helper.canvasIndex)},10)},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this);var t=$(this.galleryOptions.element),i=t.find(".main"),n=t.find(".header");i.height(this.$element.height()-n.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/Mode",["require","exports"],function(e,t){var i=function(){function e(e){this.value=e}return e.prototype.toString=function(){return this.value},e.image=new e("image"),e.page=new e("page"),e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-contentleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView","../../extensions/uv-seadragon-extension/Commands","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o){var s=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("contentLeftPanel"),e.prototype.create.call(this),$.subscribe(n.MODE_CHANGED,function(e,i){t.setLabel()}),$.subscribe(n.SEARCH_PREVIEW_START,function(e,i){t.searchPreviewStart(i)}),$.subscribe(n.SEARCH_PREVIEW_FINISH,function(){t.searchPreviewFinish()}),this.extension.helper.isPaged()&&this.$thumbs.addClass("paged");var i=this;$.views.helpers({separator:function(){return i.extension.helper.isVerticallyAligned()?!0:i.extension.helper.isPaged()?(this.data.index-1)%2==0?!1:!0:!1}})},t.prototype.addSelectedClassToThumbs=function(e){var t=this;if(this.extension.isPagingSettingEnabled()){var i=this.extension.getPagedIndices(e);_.each(i,function(e){t.getThumbByIndex(e).addClass("selected")})}else this.getThumbByIndex(e).addClass("selected")},t.prototype.isPageModeEnabled=function(){return"function"==typeof this.extension.getMode?this.config.options.pageModeEnabled&&this.extension.getMode().toString()===o.page.toString():this.config.options.pageModeEnabled},t.prototype.searchPreviewStart=function(e){this.scrollToThumb(e);var t=this.getThumbByIndex(e);t.addClass("searchpreview")},t.prototype.searchPreviewFinish=function(){this.scrollToThumb(this.extension.helper.canvasIndex),this.getAllThumbs().removeClass("searchpreview")},t.prototype.setLabel=function(){this.isPDF()?($(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").hide()):this.isPageModeEnabled()?($(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").show()):($(this.$thumbs).find("span.index").show(),$(this.$thumbs).find("span.label").hide())},t}(i);return s});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-contentleftpanel-module/TreeView",["require","exports","../uv-shared-module/BaseView","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t,!0,!0),this.isOpen=!1}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$tree=$('
      '),this.$element.append(this.$tree)},t.prototype.setup=function(){this.component=new IIIFComponents.TreeComponent(this.treeOptions),this.component.on("treeNodeSelected",function(e){var t=e[0];$.publish(n.TREE_NODE_SELECTED,[t])}),this.component.on("treeNodeMultiSelected",function(e){var t=e[0];$.publish(n.TREE_NODE_MULTISELECTED,[t])})},t.prototype.databind=function(){this.component.options=this.treeOptions,this.component.databind(),this.resize()},t.prototype.show=function(){this.isOpen=!0,this.$element.show()},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.selectNode=function(e){this.component.selectNode(e)},t.prototype.deselectCurrentNode=function(){this.component.deselectCurrentNode()},t.prototype.getNodeById=function(e){return this.component.getNodeById(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-contentleftpanel-module/ContentLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Commands","./GalleryView","../uv-shared-module/LeftPanel","../uv-shared-module/Metrics","../../extensions/uv-seadragon-extension/Mode","./ThumbsView","./TreeView"],function(e,t,i,n,o,s,r,a,l,h){var u=function(e){function t(t){e.call(this,t),this.expandFullEnabled=!1,this.isThumbsViewOpen=!1,this.isTreeViewOpen=!1,this.treeSortType=Manifold.TreeSortType.NONE}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("contentLeftPanel"),e.prototype.create.call(this);$.subscribe(i.SETTINGS_CHANGED,function(){t.databind()}),$.subscribe(n.GALLERY_THUMB_SELECTED,function(){t.collapseFull()}),$.subscribe(i.METRIC_CHANGED,function(){t.extension.metric===r.MOBILE_LANDSCAPE&&t.isFullyExpanded&&t.collapseFull()}),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.isFullyExpanded&&t.collapseFull(),t.selectCurrentTreeNode(),t.updateTreeTabBySelection()}),this.$tabs=$('
      '),this.$main.append(this.$tabs),this.$treeButton=$('
      '+this.content.index+""),this.$tabs.append(this.$treeButton),this.$thumbsButton=$(''+this.content.thumbnails+""),this.$thumbsButton.prop("title",this.content.thumbnails),this.$tabs.append(this.$thumbsButton),this.$tabsContent=$('
      '),this.$main.append(this.$tabsContent),this.$options=$('
      '),this.$tabsContent.append(this.$options),this.$topOptions=$('
      '),this.$options.append(this.$topOptions),this.$treeSelect=$(""),this.$topOptions.append(this.$treeSelect),this.$bottomOptions=$('
      '),this.$options.append(this.$bottomOptions),this.$leftOptions=$('
      '),this.$bottomOptions.append(this.$leftOptions),this.$rightOptions=$('
      '),this.$bottomOptions.append(this.$rightOptions),this.$treeViewOptions=$('
      '),this.$leftOptions.append(this.$treeViewOptions),this.$sortByLabel=$(''+this.content.sortBy+""),this.$treeViewOptions.append(this.$sortByLabel),this.$sortButtonGroup=$('
      '),this.$treeViewOptions.append(this.$sortButtonGroup),this.$sortByDateButton=$('"),this.$sortButtonGroup.append(this.$sortByDateButton),this.$sortByVolumeButton=$('"),this.$sortButtonGroup.append(this.$sortByVolumeButton),this.$views=$('
      '),this.$tabsContent.append(this.$views),this.$treeView=$('
      '),this.$views.append(this.$treeView),this.$thumbsView=$('
      '),this.$views.append(this.$thumbsView),this.$galleryView=$('
      '),this.$views.append(this.$galleryView),this.$treeSelect.hide(),this.$treeSelect.change(function(){t.databindTreeView(),t.selectCurrentTreeNode(),t.updateTreeTabBySelection()}),this.$sortByDateButton.on("click",function(){t.sortByDate()}),this.$sortByVolumeButton.on("click",function(){t.sortByVolume()}),this.$treeViewOptions.hide(),this.$treeButton.onPressed(function(){t.openTreeView(),$.publish(n.OPEN_TREE_VIEW)}),this.$thumbsButton.onPressed(function(){t.openThumbsView(),$.publish(n.OPEN_THUMBS_VIEW)}),this.setTitle(this.content.title),this.$sortByVolumeButton.addClass("on");var o=this.options.tabOrder;if(o){o=o.toLowerCase(),o=o.replace(/ /g,"");var s=o.split(",");"thumbs"===s[0]?(this.$treeButton.before(this.$thumbsButton),this.$thumbsButton.addClass("first")):this.$treeButton.addClass("first")}},t.prototype.createTreeView=function(){this.treeView=new h(this.$treeView),this.treeView.treeOptions=this.getTreeOptions(),this.treeView.setup(),this.databindTreeView();var e=this.extension.helper.getTopRanges();if(e.length>1)for(var t=0;t'+Manifesto.TranslationCollection.getValue(i.getLabel())+"")}this.updateTreeViewOptions()},t.prototype.databind=function(){this.databindThumbsView(),this.databindTreeView(),this.databindGalleryView()},t.prototype.updateTreeViewOptions=function(){var e=this.getTreeData();this.isCollection()&&this.extension.helper.treeHasNavDates(e)?this.$treeViewOptions.show():this.$treeViewOptions.hide(),this.$treeSelect.find("option").length?this.$treeSelect.show():this.$treeSelect.hide()},t.prototype.sortByDate=function(){this.treeSortType=Manifold.TreeSortType.DATE,this.treeView.treeOptions=this.getTreeOptions(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.addClass("on"),this.$sortByVolumeButton.removeClass("on"),this.resize()},t.prototype.sortByVolume=function(){this.treeSortType=Manifold.TreeSortType.NONE,this.treeView.treeOptions=this.getTreeOptions(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.removeClass("on"),this.$sortByVolumeButton.addClass("on"),this.resize()},t.prototype.isCollection=function(){var e=this.getTreeData();return e.data.type===manifesto.TreeNodeType.collection().toString()},t.prototype.databindTreeView=function(){this.treeView&&(this.treeView.treeOptions=this.getTreeOptions(),this.treeView.databind(),this.selectCurrentTreeNode())},t.prototype.getTreeOptions=function(){return{element:".views .treeView .iiif-tree-component",helper:this.extension.helper,topRangeIndex:this.getSelectedTopRangeIndex(),treeSortType:this.treeSortType}},t.prototype.updateTreeTabByCanvasIndex=function(){var e=this.extension.helper.getTopRanges();if(e.length>1){var t=this.getCurrentCanvasTopRangeIndex(),i=e[t];this.setTreeTabTitle(Manifesto.TranslationCollection.getValue(i.getLabel()))}else this.setTreeTabTitle(this.content.index)},t.prototype.setTreeTabTitle=function(e){this.$treeButton.text(e),this.$treeButton.prop("title",e)},t.prototype.updateTreeTabBySelection=function(){var e,t=this.extension.helper.getTopRanges();t.length>1&&(e=this.treeView?this.getSelectedTree().text():Manifesto.TranslationCollection.getValue(t[0].getLabel())),e?this.setTreeTabTitle(e):this.setTreeTabTitle(this.content.index)},t.prototype.getViewingDirection=function(){return this.extension.helper.getViewingDirection()},t.prototype.createThumbsView=function(){this.thumbsView=new l(this.$thumbsView),this.databindThumbsView()},t.prototype.databindThumbsView=function(){if(this.thumbsView){var e,t,i=this.getViewingDirection().toString();i===manifesto.ViewingDirection.topToBottom().toString()||i===manifesto.ViewingDirection.bottomToTop().toString()?(e=this.config.options.oneColThumbWidth,t=this.config.options.oneColThumbHeight):(e=this.config.options.twoColThumbWidth,t=this.config.options.twoColThumbHeight);var n=this.extension.helper.getThumbs(e,t);i===manifesto.ViewingDirection.bottomToTop().toString()&&n.reverse(),this.thumbsView.thumbs=n,this.thumbsView.databind()}},t.prototype.createGalleryView=function(){this.galleryView=new o(this.$galleryView),this.galleryView.galleryOptions=this.getGalleryOptions(),this.galleryView.setup(),this.databindGalleryView()},t.prototype.databindGalleryView=function(){this.galleryView&&(this.galleryView.galleryOptions=this.getGalleryOptions(),this.galleryView.databind())},t.prototype.getGalleryOptions=function(){return{element:".views .galleryView .iiif-gallery-component",helper:this.extension.helper,chunkedResizingEnabled:this.config.options.galleryThumbChunkedResizingEnabled,chunkedResizingThreshold:this.config.options.galleryThumbChunkedResizingThreshold,content:this.config.content,debug:!1,imageFadeInDuration:300,initialZoom:6,pageModeEnabled:this.isPageModeEnabled(),scrollStopDuration:100,sizingEnabled:Modernizr.inputtypes.range,thumbHeight:this.config.options.galleryThumbHeight,thumbLoadPadding:this.config.options.galleryThumbLoadPadding,thumbWidth:this.config.options.galleryThumbWidth,viewingDirection:this.getViewingDirection()}},t.prototype.isPageModeEnabled=function(){return"function"==typeof this.extension.getMode?Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)&&this.extension.getMode().toString()===a.page.toString():Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)},t.prototype.getSelectedTree=function(){return this.$treeSelect.find(":selected")},t.prototype.getSelectedTopRangeIndex=function(){var e=this.getSelectedTree().index();return-1===e&&(e=0),e},t.prototype.getTreeData=function(){var e=this.getSelectedTopRangeIndex();return this.extension.helper.getTree(e,Manifold.TreeSortType.NONE)},t.prototype.toggleFinish=function(){if(e.prototype.toggleFinish.call(this),this.isUnopened){var t=Utils.Bools.getBool(this.config.options.treeEnabled,!0),i=Utils.Bools.getBool(this.config.options.thumbsEnabled,!0),n=this.getTreeData();n&&n.nodes.length||(t=!1),t&&i||this.$tabs.hide(),i&&this.defaultToThumbsView()?this.openThumbsView():t&&this.openTreeView()}},t.prototype.defaultToThumbsView=function(){var e=Utils.Bools.getBool(this.config.options.defaultToTreeEnabled,!1),t=this.config.options.defaultToTreeIfGreaterThan||0,i=this.getTreeData();return e&&i.nodes.length>t?!1:!0},t.prototype.expandFullStart=function(){e.prototype.expandFullStart.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_START)},t.prototype.expandFullFinish=function(){e.prototype.expandFullFinish.call(this),this.$treeButton.hasClass("on")?this.openTreeView():this.$thumbsButton.hasClass("on")&&this.openThumbsView(),$.publish(i.LEFTPANEL_EXPAND_FULL_FINISH)},t.prototype.collapseFullStart=function(){e.prototype.collapseFullStart.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_START)},t.prototype.collapseFullFinish=function(){e.prototype.collapseFullFinish.call(this),this.$thumbsButton.hasClass("on")&&this.openThumbsView(),$.publish(i.LEFTPANEL_COLLAPSE_FULL_FINISH)},t.prototype.openTreeView=function(){this.isTreeViewOpen=!0,this.isThumbsViewOpen=!1,this.treeView||this.createTreeView(),this.$treeButton.addClass("on"),this.$thumbsButton.removeClass("on"),this.treeView.show(),this.thumbsView&&this.thumbsView.hide(),this.galleryView&&this.galleryView.hide(),this.updateTreeViewOptions(),this.selectCurrentTreeNode(),this.resize(),this.treeView.resize()},t.prototype.openThumbsView=function(){this.isTreeViewOpen=!1,this.isThumbsViewOpen=!0,this.thumbsView||this.createThumbsView(),this.isFullyExpanded&&!this.galleryView&&this.createGalleryView(),this.$treeButton.removeClass("on"),this.$thumbsButton.addClass("on"),this.treeView&&this.treeView.hide(),this.$treeSelect.hide(),this.$treeViewOptions.hide(),this.resize(),this.isFullyExpanded?(this.thumbsView.hide(),this.galleryView&&this.galleryView.show(),this.galleryView&&this.galleryView.resize()):(this.galleryView&&this.galleryView.hide(),this.thumbsView.show(),this.thumbsView.resize())},t.prototype.selectTopRangeIndex=function(e){this.$treeSelect.prop("selectedIndex",e)},t.prototype.getCurrentCanvasTopRangeIndex=function(){var e=-1,t=this.extension.getCurrentCanvasRange();return t&&(e=Number(t.path.split("/")[0])),e},t.prototype.selectCurrentTreeNode=function(){if(this.treeView){var e,t=this.getCurrentCanvasTopRangeIndex(),i=this.getSelectedTopRangeIndex(),n=t===i;if(-1!=t){var o=this.extension.getCurrentCanvasRange();o&&o.treeNode&&(e=this.treeView.getNodeById(o.treeNode.id))}e&&n?this.treeView.selectNode(e):this.treeView.deselectCurrentNode()}},t.prototype.resize=function(){e.prototype.resize.call(this),this.$tabsContent.height(this.$main.height()-(this.$tabs.is(":visible")?this.$tabs.height():0)-this.$tabsContent.verticalPadding()),this.$views.height(this.$tabsContent.height()-this.$options.outerHeight())},t}(s);return u}),define("modules/uv-shared-module/Point",["require","exports"],function(e,t){var i=function(){function e(e,t){this.x=e,this.y=t}return e}();return i}),define("extensions/uv-seadragon-extension/CroppedImageDimensions",["require","exports","../../modules/uv-shared-module/Point"],function(e,t,i){var n=Utils.Measurements.Size,o=function(){function e(){this.region=new n(0,0),this.regionPos=new i(0,0),this.size=new n(0,0)}return e}();return o}),define("extensions/uv-seadragon-extension/DownloadType",["require","exports"],function(e,t){var i=function(){function e(){}return e.CURRENTVIEW="currentView",e.ENTIREDOCUMENTASPDF="entireDocumentAsPdf",e.ENTIREDOCUMENTASTEXT="entireDocumentAsText",e.WHOLEIMAGEHIGHRES="wholeImageHighRes",e.WHOLEIMAGESHIGHRES="wholeImageHighRes",e.WHOLEIMAGELOWRES="wholeImageLowRes",e.UNKNOWN="unknown",e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/DownloadDialogue",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-dialogues-module/DownloadDialogue","./Commands","../../modules/uv-shared-module/DownloadOption","./DownloadType"],function(e,t,i,n,o,s,r){var a=Utils.Measurements.Size,l=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("downloadDialogue"),e.prototype.create.call(this),this.$imageOptionsContainer=$('
    • '),this.$downloadOptions.append(this.$imageOptionsContainer),this.$imageOptions=$("
        "),this.$imageOptionsContainer.append(this.$imageOptions),this.$currentViewAsJpgButton=$('
      • '),this.$imageOptions.append(this.$currentViewAsJpgButton),this.$currentViewAsJpgButton.hide(),this.$wholeImageHighResButton=$('
      • '),this.$imageOptions.append(this.$wholeImageHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImagesHighResButton=$('
      • '),this.$imageOptions.append(this.$wholeImagesHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImageLowResAsJpgButton=$('
      • "),this.$imageOptions.append(this.$wholeImageLowResAsJpgButton),this.$wholeImageLowResAsJpgButton.hide(),this.$canvasOptionsContainer=$('
      • '),this.$downloadOptions.append(this.$canvasOptionsContainer),this.$canvasOptions=$("
          "),this.$canvasOptionsContainer.append(this.$canvasOptions),this.$sequenceOptionsContainer=$('
        • '),this.$downloadOptions.append(this.$sequenceOptionsContainer),this.$sequenceOptions=$("
            "),this.$sequenceOptionsContainer.append(this.$sequenceOptions),this.$selectionButton=$('
          • '),this.$sequenceOptions.append(this.$selectionButton),this.$selectionButton.hide(),this.$buttonsContainer=$('
            '),this.$content.append(this.$buttonsContainer),this.$downloadButton=$(''+this.content.download+""),this.$buttonsContainer.append(this.$downloadButton),this.$explanatoryTextTemplate=$('');var n=this;this.$downloadButton.on("click",function(e){e.preventDefault();var a=n.getSelectedOption(),l=a.attr("id"),h=a.attr("title"),u=a.data("mime"),c=r.UNKNOWN,p=t.extension.helper.getCurrentCanvas();if(t.renderingUrls[l])u&&(-1!==u.toLowerCase().indexOf("pdf")?c=r.ENTIREDOCUMENTASPDF:-1!==u.toLowerCase().indexOf("txt")&&(c=r.ENTIREDOCUMENTASTEXT)),(c=r.ENTIREDOCUMENTASPDF)&&window.open(t.renderingUrls[l]);else switch(l){case s.currentViewAsJpg.toString():var d=n.extension.getViewer();window.open(n.extension.getCroppedImageUri(p,d)),c=r.CURRENTVIEW;break;case s.selection.toString():Utils.Async.waitFor(function(){return!t.isActive},function(){$.publish(o.SHOW_MULTISELECT_DIALOGUE)});break;case s.wholeImageHighRes.toString():window.open(t.getCanvasHighResImageUri(t.extension.helper.getCurrentCanvas())),c=r.WHOLEIMAGEHIGHRES;break;case s.wholeImagesHighRes.toString():for(var g=t.extension.getPagedIndices(),f=0;f=S&&x>=S?this.$currentViewAsJpgButton.hide():this.$currentViewAsJpgButton.show()}var C=this.$imageOptions.find("li.single");C=C.sort(function(e,t){var i=$(e).data("width");i?i=parseInt(i.toString()):0;var n=$(e).data("height");n?n=parseInt(n.toString()):0;var o=$(t).data("width");o?o=parseInt(o.toString()):0;var s=$(t).data("height");s?s=parseInt(s.toString()):0;var r=i*n,a=o*s;return a>r?-1:r>a?1:0}),C.detach().appendTo(this.$imageOptions);var _=this.$downloadOptions.find("li.group");_.each(function(e,t){var i=$(t);i.show(),i.find("li.option:hidden").length===i.find("li.option").length&&i.hide()}),this.$downloadOptions.find("li.group:visible").last().addClass("lastVisible"),this.$downloadOptions.find("li.option:visible").length?(this.$downloadOptions.find("li.option input:visible:first").prop("checked",!0),this.$noneAvailable.hide(),this.$downloadButton.show()):(this.$noneAvailable.show(),this.$downloadButton.hide()),this.resize()},t.prototype.resetDynamicDownloadOptions=function(){this.renderingUrls=[],this.renderingUrlsCount=0,this.$downloadOptions.find("li.dynamic").remove()},t.prototype.addDownloadOptionsForRenderings=function(e,t,i){for(var n=e.getRenderings(),o=0;o");switch(i){case s.dynamicImageRenderings:this.$imageOptions.append(u);break;case s.dynamicCanvasRenderings:this.$canvasOptions.append(u);break;case s.dynamicSequenceRenderings:this.$sequenceOptions.append(u)}}}},t.prototype.getSelectedOption=function(){return this.$downloadOptions.find("li.option input:checked")},t.prototype.getCanvasImageResource=function(e){var t=e.getImages();return t[0]?t[0].getResource():null},t.prototype.getCanvasHighResImageUri=function(e){var t=this.getCanvasComputedDimensions(e);if(t){var i=t.width,n=e.getCanonicalImageUri(i),o=n.split("/"),s=this.extension.getViewerRotation();return o[o.length-2]=String(s),n=o.join("/")}return""},t.prototype.getCanvasMimeType=function(e){var t=this.getCanvasImageResource(e),i=t.getFormat();return i?i.toString():null},t.prototype.getCanvasDimensions=function(e){return e.externalResource.data?new a(e.externalResource.data.width,e.externalResource.data.height):new a(0,0)},t.prototype.getCanvasMaxDimensions=function(e){return e.externalResource.data&&e.externalResource.data.profile[1]?new a(e.externalResource.data.profile[1].maxWidth,e.externalResource.data.profile[1].maxHeight):null},t.prototype.getCanvasComputedDimensions=function(e){var t=this.getCanvasDimensions(e),i=this.getCanvasMaxDimensions(e);if(!i)return null;var n=t.width,o=t.height;if(!_.isUndefined(i.width)&&i.width1?!0:!1;case s.wholeImageLowResAsJpg:var n=this.getCanvasComputedDimensions(this.extension.helper.getCurrentCanvas());return n?!this.extension.isPagingSettingEnabled()&&n.width>this.options.confinedImageSize:!1;case s.selection:return this.options.selectionEnabled;default:return e.prototype.isDownloadOptionAvailable.call(this,t)}},t}(n);return l});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/ExternalContentDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("externalContentDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_EXTERNALCONTENT_DIALOGUE,this.closeCommand=i.HIDE_EXTERNALCONTENT_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(),t.$iframe.prop("src",i.uri)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$iframe=$(""),this.$content.append(this.$iframe),this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this),this.$iframe.width(this.$content.width()),this.$iframe.height(this.$content.height())},t}(n);return o}),define("modules/uv-shared-module/AutoComplete",["require","exports"],function(e,t){var i=function(){function e(e,t,i,n,o,s,r){var a=this;void 0===o&&(o=300),void 0===s&&(s=2),void 0===r&&(r=!1),this.validKeyDownCodes=[KeyCodes.KeyDown.Backspace,KeyCodes.KeyDown.Spacebar,KeyCodes.KeyDown.Tab,KeyCodes.KeyDown.LeftArrow,KeyCodes.KeyDown.RightArrow,KeyCodes.KeyDown.Delete],this.lastKeyDownWasValid=!1,this.$element=e,this.autoCompleteFunc=t,this.delay=o,this.minChars=s,this.onSelect=n,this.parseResultsFunc=i,this.positionAbove=r,this.$searchResultsList=$('
              '),this.positionAbove?this.$element.parent().prepend(this.$searchResultsList):this.$element.parent().append(this.$searchResultsList),this.$searchResultTemplate=$('
            • ');var l=function(){var e=0;return function(t,i){clearTimeout(e),e=setTimeout(t,i)}}(),h=this;this.$element.on("keydown",function(e){var t=e.originalEvent;h.lastKeyDownWasValid=h.isValidKeyDown(t);var i=Utils.Keyboard.getCharCode(t),n=!1;i===KeyCodes.KeyDown.LeftArrow?n=!0:i===KeyCodes.KeyDown.RightArrow&&(n=!0),n&&(t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation())}),this.$element.on("keypress",function(e){var t=h.isValidKeyPress(e.originalEvent);return h.lastKeyDownWasValid||t?!0:(e.preventDefault(),!1)}),this.$element.on("keyup",function(e){if(!h.getSelectedListItem().length&&e.keyCode===KeyCodes.KeyDown.Enter)return void h.onSelect(h.getTerms());if(h.$searchResultsList.is(":visible")&&h.results.length)if(e.keyCode===KeyCodes.KeyDown.Enter)h.searchForItem(h.getSelectedListItem());else{if(e.keyCode===KeyCodes.KeyDown.DownArrow)return void h.setSelectedResultIndex(1);if(e.keyCode===KeyCodes.KeyDown.UpArrow)return void h.setSelectedResultIndex(-1)}e.keyCode!==KeyCodes.KeyDown.Enter&&l(function(){var e=h.getTerms();e&&e.length>h.minChars&&!e.contains(" ")?h.search(e):(h.clearResults(),h.hideResults())},h.delay)}),$(document).on("mouseup",function(e){0===a.$searchResultsList.parent().has($(e.target)[0]).length&&(a.clearResults(),a.hideResults())}),this.hideResults()}return e.prototype.isValidKeyDown=function(e){return this.validKeyDownCodes.contains(Utils.Keyboard.getCharCode(e))},e.prototype.isValidKeyPress=function(e){var t=String.fromCharCode(Utils.Keyboard.getCharCode(e));return t.isAlphanumeric()},e.prototype.getTerms=function(){return this.$element.val().trim()},e.prototype.setSelectedResultIndex=function(e){var t;t=1===e?this.selectedResultIndex+1:this.selectedResultIndex-1;var i=this.$searchResultsList.find("li");0>t?t=i.length-1:t>i.length-1&&(t=0),this.selectedResultIndex=t,i.removeClass("selected");var n=i.eq(this.selectedResultIndex);n.addClass("selected");var o=n.outerHeight(!0)*this.selectedResultIndex;this.$searchResultsList.scrollTop(o)},e.prototype.search=function(e){this.results=[],this.clearResults(),this.showResults(),this.$searchResultsList.append('
            • '),this.updateListPosition();var t=this;this.autoCompleteFunc(e,function(e){t.listResults(e)})},e.prototype.clearResults=function(){this.$searchResultsList.empty()},e.prototype.hideResults=function(){this.$searchResultsList.hide()},e.prototype.showResults=function(){this.selectedResultIndex=-1,this.$searchResultsList.show()},e.prototype.updateListPosition=function(){this.positionAbove?this.$searchResultsList.css({top:-1*this.$searchResultsList.outerHeight(!0)}):this.$searchResultsList.css({top:this.$element.outerHeight(!0)})},e.prototype.listResults=function(e){if(this.results=this.parseResultsFunc(e),this.clearResults(),!this.results.length)return void this.hideResults();for(var t=0;t'+this.content.print+""),this.$options.prepend(this.$printButton),this.$searchContainer=$(''),this.$element.prepend(this.$searchContainer),this.$searchOptions=$('
              '),this.$searchContainer.append(this.$searchOptions),this.$searchLabel=$(''+this.content.searchWithin+""),this.$searchOptions.append(this.$searchLabel),this.$searchTextContainer=$('
              '),this.$searchOptions.append(this.$searchTextContainer),this.$searchText=$(''),this.$searchTextContainer.append(this.$searchText),this.$searchButton=$(''),this.$searchTextContainer.append(this.$searchButton),this.$searchPagerContainer=$('
              '),this.$element.prepend(this.$searchPagerContainer),this.$searchPagerControls=$('
              '),this.$searchPagerContainer.prepend(this.$searchPagerControls),this.$previousResultButton=$(''+this.content.previousResult+""),this.$searchPagerControls.append(this.$previousResultButton),this.$searchResultsInfo=$('
              x \'y\'
              '),this.$searchPagerControls.append(this.$searchResultsInfo),this.$clearSearchResultsButton=$(''+this.content.clearSearch+""),this.$searchResultsInfo.append(this.$clearSearchResultsButton),this.$nextResultButton=$(''+this.content.nextResult+""),this.$searchPagerControls.append(this.$nextResultButton),this.$searchResultsContainer=$('
              '),this.$element.prepend(this.$searchResultsContainer),this.$line=$('
              '),this.$searchResultsContainer.append(this.$line),this.$pagePositionMarker=$('
              '),this.$searchResultsContainer.append(this.$pagePositionMarker),this.$pagePositionLabel=$('
              '),this.$searchResultsContainer.append(this.$pagePositionLabel),this.$placemarkerDetails=$('
              '),this.$searchResultsContainer.append(this.$placemarkerDetails),this.$placemarkerDetailsTop=$("

              "),this.$placemarkerDetails.append(this.$placemarkerDetailsTop),this.$placemarkerDetailsBottom=$("

              "),this.$placemarkerDetails.append(this.$placemarkerDetailsBottom),this.$searchPagerContainer.hide(),this.$placemarkerDetails.hide();var n=this;this.$searchButton.on("click",function(e){e.preventDefault(),t.search(t.$searchText.val())}),this.$searchText.on("focus",function(){t.$searchText.val()===t.content.enterKeyword&&t.$searchText.val("")}),this.$placemarkerDetails.on("mouseover",function(){$.publish(o.SEARCH_PREVIEW_START,[t.currentPlacemarkerIndex])}),this.$placemarkerDetails.on("mouseleave",function(){$(this).hide(),$.publish(o.SEARCH_PREVIEW_FINISH);var e=n.getSearchResultPlacemarkers();e.removeClass("hover")}),this.$placemarkerDetails.on("click",function(e){$.publish(o.VIEW_PAGE,[t.currentPlacemarkerIndex])}),this.$previousResultButton.on("click",function(e){e.preventDefault(),$.publish(o.PREV_SEARCH_RESULT)}),this.$nextResultButton.on("click",function(e){e.preventDefault(),$.publish(o.NEXT_SEARCH_RESULT)}),this.$clearSearchResultsButton.on("click",function(e){e.preventDefault(),$.publish(o.CLEAR_SEARCH),t.clearSearchResults()}),this.extension.isSearchWithinEnabled()||(this.$searchContainer.hide(),this.$searchPagerContainer.hide(),this.$searchResultsContainer.hide(),this.$element.addClass("min"));var r=this.extension.getAutoCompleteUri();r&&new s(this.$searchText,function(e,t){$.getJSON(String.format(r,e),function(e){t(e)})},function(e){return _.map(e.terms,function(e){return e.match})},function(e){t.search(e)},300,2,!0),this.$printButton.onPressed(function(){$.publish(o.PRINT)}),this.updatePrintButton();var a=Utils.Bools.getBool(this.config.options.positionMarkerEnabled,!0);a||(this.$pagePositionMarker.hide(),this.$pagePositionLabel.hide())},t.prototype.updatePrintButton=function(){var e=Utils.Bools.getBool(this.options.printEnabled,!1);e?this.$printButton.show():this.$printButton.hide()},t.prototype.search=function(e){return this.terms=e,""===this.terms||this.terms===this.content.enterKeyword?void this.extension.showMessage(this.config.modules.genericDialogue.content.emptyValue,function(){this.$searchText.focus()}):(this.$searchText.blur(),void $.publish(o.SEARCH,[this.terms]))},t.prototype.getSearchResultPlacemarkers=function(){return this.$searchResultsContainer.find(".searchResultPlacemarker")},t.prototype.setCurrentSearchResultPlacemarker=function(){var e=this.getSearchResultPlacemarkers();e.parent().find(".current").removeClass("current");var t=$('.searchResultPlacemarker[data-index="'+this.extension.helper.canvasIndex+'"]');t.addClass("current")},t.prototype.positionSearchResultPlacemarkers=function(){var e=this.extension.searchResults;if(e.length){var t=this.getSearchResultPlacemarkers();t.remove();for(var i=this.getPageLineRatio(),n=this.$line.position().top,o=this.$line.position().left,s=this,r=0;r');h[0].ontouchstart=function(e){s.onPlacemarkerTouchStart.call(this,s)},h.click(function(e){s.onPlacemarkerClick.call(this,s)}),h.mouseenter(function(e){s.onPlacemarkerMouseEnter.call(this,s)}),h.mouseleave(function(e){s.onPlacemarkerMouseLeave.call(this,e,s)}),this.$searchResultsContainer.append(h);var u=n-h.height(),c=o+l-h.width()/2;h.css({top:u,left:c})}}},t.prototype.onPlacemarkerTouchStart=function(e){e.placemarkerTouched=!0;var t=$(this),i=parseInt(t.attr("data-index"));$.publish(o.VIEW_PAGE,[i])},t.prototype.onPlacemarkerClick=function(e){if(!e.placemarkerTouched){e.placemarkerTouched=!1;var t=$(this),i=parseInt(t.attr("data-index"));$.publish(o.VIEW_PAGE,[i])}},t.prototype.onPlacemarkerMouseEnter=function(e){if(!e.placemarkerTouched){var t=$(this);t.addClass("hover");var i=parseInt(t.attr("data-index"));$.publish(o.SEARCH_PREVIEW_START,[i]);var n=e.getSearchResultPlacemarkers(),s=n.index(t[0]);e.currentPlacemarkerIndex=i,e.$placemarkerDetails.show();var a="{0} {1}",l=e.extension.getMode();if(l.toString()===r.page.toString()){var h=e.extension.helper.getCanvasByIndex(i),u=Manifesto.TranslationCollection.getValue(h.getLabel());""===u&&(u=this.extension.helper.manifest.options.defaultLabel),a=String.format(a,e.content.pageCaps,u)}else a=String.format(a,e.content.imageCaps,i+1);e.$placemarkerDetailsTop.html(a);var c,p=e.extension.searchResults[s],d=Utils.Strings.ellipsis(e.terms,e.options.elideDetailsTermsCount);1===p.rects.length?(c=e.content.instanceFound,c=String.format(c,d)):(c=e.content.instancesFound,c=String.format(c,p.rects.length,d)),e.$placemarkerDetailsBottom.html(c);var g=t.position(),f=g.top-e.$placemarkerDetails.height(),m=g.left;me.$line.width()-e.$placemarkerDetails.width()/2?m=e.$line.width()-e.$placemarkerDetails.width()+t.width()/2:m-=e.$placemarkerDetails.width()/2,e.$placemarkerDetails.css({top:f,left:m})}},t.prototype.onPlacemarkerMouseLeave=function(e,t){$.publish(o.SEARCH_PREVIEW_FINISH);var i=$(this),n=e.toElement||e.relatedTarget,s=$(n).closest(t.$placemarkerDetails).length;n!=t.$placemarkerDetails.get(0)&&0==s&&(t.$placemarkerDetails.hide(),i.removeClass("hover"))},t.prototype.setPageMarkerPosition=function(){if(null!=this.extension.helper.canvasIndex){var e=this.getPageLineRatio(),t=this.$line.position().top,i=this.$line.position().left,n=this.extension.helper.canvasIndex*e,o=t,s=i+n;this.$pagePositionMarker.css({top:o,left:s});var r=this.$line.width();s+this.$pagePositionLabel.outerWidth(!0)>r?(s-=this.$pagePositionLabel.outerWidth(!0),this.$pagePositionLabel.removeClass("right"),this.$pagePositionLabel.addClass("left")):(this.$pagePositionLabel.removeClass("left"),this.$pagePositionLabel.addClass("right")),this.$pagePositionLabel.css({top:o,left:s})}},t.prototype.clearSearchResults=function(){this.extension.searchResults=[];var e=this.getSearchResultPlacemarkers();e.remove(),this.$searchText.val(this.content.enterKeyword),this.$searchContainer.show(),this.$searchPagerContainer.hide(),this.$searchText.focus()},t.prototype.getPageLineRatio=function(){var e=this.$line.width();return 1===this.extension.helper.getTotalCanvases()?0:e/(this.extension.helper.getTotalCanvases()-1)},t.prototype.canvasIndexChanged=function(){this.setPageMarkerPosition(),this.setPlacemarkerLabel()},t.prototype.settingsChanged=function(){this.setPlacemarkerLabel()},t.prototype.setPlacemarkerLabel=function(){var e=this.content.displaying,t=this.extension.helper.canvasIndex;if(this.isPageModeEnabled()){var i=this.extension.helper.getCanvasByIndex(t),n=Manifesto.TranslationCollection.getValue(i.getLabel());""===n&&(n=this.content.defaultLabel);var o=this.extension.helper.getLastCanvasLabel(!0);this.$pagePositionLabel.html(String.format(e,this.content.page,this.extension.sanitize(n),this.extension.sanitize(o)))}else this.$pagePositionLabel.html(String.format(e,this.content.image,t+1,this.extension.helper.getTotalCanvases()))},t.prototype.isPageModeEnabled=function(){return this.config.options.pageModeEnabled&&this.extension.getMode().toString()===r.page.toString()},t.prototype.displaySearchResults=function(e,t){if(t){this.positionSearchResultPlacemarkers(),this.$searchContainer.hide(),this.$searchPagerControls.css({left:0});var i=this.$searchPagerContainer.find(".number");i.text(t.resources.length);var n=this.$searchResultsInfo.find(".foundFor");1===t.resources.length?n.html(this.content.resultFoundFor):n.html(this.content.resultsFoundFor);var o=this.$searchPagerContainer.find(".terms");o.html(Utils.Strings.ellipsis(e,this.options.elideResultsTermsCount)),o.prop("title",e),this.$searchPagerContainer.show(),this.resize()}},t.prototype.resize=function(){e.prototype.resize.call(this),this.extension.searchResults.length&&this.positionSearchResultPlacemarkers(),this.setPageMarkerPosition(),this.$searchPagerContainer.width(this.$element.width());var t=this.$element.width()/2;this.$searchPagerControls.css({left:t-this.$searchPagerControls.width()/2}),this.$searchOptions.css({left:t-this.$searchOptions.outerWidth()/2})},t}(n);return a});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-osdmobilefooterpanel-module/MobileFooter",["require","exports","../uv-shared-module/FooterPanel","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){this.setConfig("mobileFooterPanel"),e.prototype.create.call(this),this.$spacer=$('
              '),this.$options.prepend(this.$spacer),this.$rotateButton=$(''+this.content.rotateRight+""),this.$options.prepend(this.$rotateButton),this.$zoomOutButton=$(''+this.content.zoomOut+""),this.$options.prepend(this.$zoomOutButton),this.$zoomInButton=$(''+this.content.zoomIn+""),this.$options.prepend(this.$zoomInButton),this.$zoomInButton.onPressed(function(){$.publish(n.ZOOM_IN)}),this.$zoomOutButton.onPressed(function(){$.publish(n.ZOOM_OUT)}),this.$rotateButton.onPressed(function(){$.publish(n.ROTATE)})},t.prototype.resize=function(){e.prototype.resize.call(this),this.$options.css("left",Math.floor(this.$element.width()/2-this.$options.width()/2))},t}(i);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-dialogues-module/MoreInfoDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){var o=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("moreInfoDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_MOREINFO_DIALOGUE,this.closeCommand=i.HIDE_MOREINFO_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.config.content=this.extension.config.modules.moreInfoRightPanel.content,this.config.options=this.extension.config.modules.moreInfoRightPanel.options,this.$title=$("

              "+this.config.content.title+"

              "),this.$content.append(this.$title),this.$metadata=$(''),this.$content.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent(this._getOptions()),this.$element.hide()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.component.databind()},t.prototype._getOptions=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:"Left Page, Right Page",content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),element:".overlay.moreInfo .iiif-metadata-component",helper:this.extension.helper,licenseFormatter:null,limit:this.config.options.textLimit||4,limitType:IIIFComponents.MetadataComponentOptions.LimitType.LINES,manifestDisplayOrder:this.config.options.manifestDisplayOrder,manifestExclude:this.config.options.manifestExclude,range:this.extension.getCurrentCanvasRange(),rtlLanguageCodes:this.config.options.rtlLanguageCodes,sanitizer:function(t){return e.extension.sanitize(t)},showAllLanguages:this.config.options.showAllLanguages}},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){this.setDockedPosition()},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-multiselectdialogue-module/MultiSelectDialogue",["require","exports","../../extensions/uv-seadragon-extension/Commands","../../modules/uv-shared-module/Dialogue","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o){var s=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("multiSelectDialogue"),e.prototype.create.call(this);var n=this;this.openCommand=i.SHOW_MULTISELECT_DIALOGUE,this.closeCommand=i.HIDE_MULTISELECT_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open();var n=t.extension.helper.getMultiSelectState();n.setEnabled(!0),t.component.databind()}),$.subscribe(this.closeCommand,function(e){t.close();var i=t.extension.helper.getMultiSelectState();i.setEnabled(!1)}),this.$title=$("

              "),this.$content.append(this.$title),this.$title.text(this.content.title),this.$gallery=$(''),this.$content.append(this.$gallery),this.options={element:".overlay.multiSelect .iiif-gallery-component",helper:this.extension.helper,chunkedResizingEnabled:this.config.options.galleryThumbChunkedResizingEnabled,chunkedResizingThreshold:this.config.options.galleryThumbChunkedResizingThreshold,content:this.config.content,debug:!1,imageFadeInDuration:300,initialZoom:4,pageModeEnabled:this.isPageModeEnabled(),scrollStopDuration:100,sizingEnabled:!0,thumbHeight:this.config.options.galleryThumbHeight,thumbLoadPadding:this.config.options.galleryThumbLoadPadding,thumbWidth:this.config.options.galleryThumbWidth,viewingDirection:this.extension.helper.getViewingDirection()},this.component=new IIIFComponents.GalleryComponent(this.options);var o=$(this.options.element).find("a.select");o.addClass("btn btn-primary"),this.component.on("multiSelectionMade",function(e){var t=e[0];$.publish(i.MULTISELECTION_MADE,[t]),n.close()}),this.$element.hide()},t.prototype.isPageModeEnabled=function(){return Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)&&this.extension.getMode().toString()===o.page.toString()},t.prototype.open=function(){e.prototype.open.call(this)},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){e.prototype.resize.call(this);var t=$(this.options.element),i=t.find(".main"),n=t.find(".header");i.height(this.$content.height()-this.$title.outerHeight()-this.$title.verticalMargins()-n.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/MultiSelectionArgs",["require","exports"],function(e,t){var i=function(){function e(){}return e}();return i});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("modules/uv-pagingheaderpanel-module/PagingHeaderPanel",["require","exports","../uv-shared-module/AutoComplete","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Commands","../uv-shared-module/HeaderPanel","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o,s,r){var a=function(e){function t(t){e.call(this,t),this.firstButtonEnabled=!1,this.lastButtonEnabled=!1,this.nextButtonEnabled=!1,this.prevButtonEnabled=!1}return __extends(t,e),t.prototype.create=function(){var t=this;if(this.setConfig("pagingHeaderPanel"),e.prototype.create.call(this),$.subscribe(n.CANVAS_INDEX_CHANGED,function(e,i){t.canvasIndexChanged(i)}),$.subscribe(n.SETTINGS_CHANGED,function(e){t.modeChanged(),t.updatePagingToggle()}),$.subscribe(n.CANVAS_INDEX_CHANGE_FAILED,function(e){t.setSearchFieldValue(t.extension.helper.canvasIndex)}),$.subscribe(n.LEFTPANEL_EXPAND_FULL_START,function(e){t.openGallery()}),$.subscribe(n.LEFTPANEL_COLLAPSE_FULL_START,function(e){t.closeGallery()}),this.$prevOptions=$('
              '),this.$centerOptions.append(this.$prevOptions),this.$firstButton=$(''),this.$prevOptions.append(this.$firstButton),this.$prevButton=$(''),this.$prevOptions.append(this.$prevButton),this.$modeOptions=$('
              '),this.$centerOptions.append(this.$modeOptions),this.$imageModeLabel=$('"),this.$modeOptions.append(this.$imageModeLabel),this.$imageModeOption=$(''),this.$modeOptions.append(this.$imageModeOption),this.$pageModeLabel=$(''),this.$modeOptions.append(this.$pageModeLabel),this.$pageModeOption=$(''),this.$modeOptions.append(this.$pageModeOption),this.$search=$(''),this.$centerOptions.append(this.$search),this.$searchText=$(''),this.$search.append(this.$searchText),Utils.Bools.getBool(this.options.autoCompleteBoxEnabled,!0))this.$searchText.hide(),this.$autoCompleteBox=$(''),this.$search.append(this.$autoCompleteBox),new i(this.$autoCompleteBox,function(e,i){var n=[],o=t.extension.helper.getCanvases();if(t.isPageModeEnabled())for(var s=0;s'),this.$centerOptions.append(this.$selectionBoxOptions),this.$imageSelectionBox=$(''),this.$selectionBoxOptions.append(this.$imageSelectionBox);for(var s=0;s"+l+"")}this.$imageSelectionBox.change(function(){var e=parseInt(t.$imageSelectionBox.val());$.publish(o.IMAGE_SEARCH,[e])})}this.$total=$(''),this.$search.append(this.$total),this.$searchButton=$(''+this.content.go+""),this.$search.append(this.$searchButton),this.$nextOptions=$('
              '),this.$centerOptions.append(this.$nextOptions),this.$nextButton=$(''),this.$nextOptions.append(this.$nextButton),this.$lastButton=$(''),this.$nextOptions.append(this.$lastButton),this.isPageModeEnabled()?(this.$pageModeOption.attr("checked","checked"),this.$pageModeOption.removeAttr("disabled"),this.$pageModeLabel.removeClass("disabled")):(this.$imageModeOption.attr("checked","checked"),this.$pageModeOption.attr("disabled","disabled"),this.$pageModeLabel.addClass("disabled")),this.extension.helper.getManifestType().toString()===manifesto.ManifestType.manuscript().toString()?this.$pageModeLabel.text(this.content.folio):this.$pageModeLabel.text(this.content.page),this.$galleryButton=$(''),this.$rightOptions.prepend(this.$galleryButton),this.$pagingToggleButtons=$('
              '),this.$rightOptions.prepend(this.$pagingToggleButtons),this.$oneUpButton=$(''),this.$pagingToggleButtons.append(this.$oneUpButton),this.$twoUpButton=$(''),this.$pagingToggleButtons.append(this.$twoUpButton),this.updatePagingToggle(),this.updateGalleryButton(),this.$oneUpButton.onPressed(function(){var e=!1;t.updateSettings({pagingEnabled:e}),$.publish(o.PAGING_TOGGLED,[e])}),this.$twoUpButton.onPressed(function(){var e=!0;t.updateSettings({pagingEnabled:e}),$.publish(o.PAGING_TOGGLED,[e])}),this.$galleryButton.onPressed(function(){$.publish(n.TOGGLE_EXPAND_LEFT_PANEL)}),this.setTitles(),this.setTotal();var h=this.extension.helper.getViewingDirection();1===this.extension.helper.getTotalCanvases()&&this.$centerOptions.hide(), -this.$firstButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.topToBottom().toString():case manifesto.ViewingDirection.bottomToTop().toString():$.publish(o.FIRST);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.LAST)}}),this.$prevButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(o.PREV);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.NEXT)}}),this.$nextButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(o.NEXT);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.PREV)}}),this.$lastButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.topToBottom().toString():case manifesto.ViewingDirection.bottomToTop().toString():$.publish(o.LAST);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.FIRST)}}),this.config.options.pageModeEnabled?(this.$imageModeOption.on("click",function(e){$.publish(o.MODE_CHANGED,[r.image.toString()])}),this.$pageModeOption.on("click",function(e){$.publish(o.MODE_CHANGED,[r.page.toString()])})):(this.$imageModeOption.hide(),this.$pageModeLabel.hide(),this.$pageModeOption.hide()),this.$searchText.onEnter(function(){t.$searchText.blur(),t.search(t.$searchText.val())}),this.$searchText.click(function(){$(this).select()}),this.$searchButton.onPressed(function(){t.options.autoCompleteBoxEnabled?t.search(t.$autoCompleteBox.val()):t.search(t.$searchText.val())}),this.options.modeOptionsEnabled===!1&&(this.$modeOptions.hide(),this.$centerOptions.addClass("modeOptionsDisabled")),this.options.imageSelectionBoxEnabled===!0&&this.options.autoCompleteBoxEnabled!==!0&&this.$search.hide(),this.options.helpEnabled===!1&&this.$helpButton.hide(),Utils.Bools.getBool(this.options.pagingToggleEnabled,!0)||this.$pagingToggleButtons.hide()},t.prototype.openGallery=function(){this.$oneUpButton.removeClass("on"),this.$twoUpButton.removeClass("on"),this.$galleryButton.addClass("on")},t.prototype.closeGallery=function(){this.updatePagingToggle(),this.$galleryButton.removeClass("on")},t.prototype.isPageModeEnabled=function(){return this.config.options.pageModeEnabled&&this.extension.getMode().toString()===r.page.toString()},t.prototype.setTitles=function(){this.isPageModeEnabled()?(this.$firstButton.prop("title",this.content.firstPage),this.$prevButton.prop("title",this.content.previousPage),this.$nextButton.prop("title",this.content.nextPage),this.$lastButton.prop("title",this.content.lastPage)):(this.$firstButton.prop("title",this.content.firstImage),this.$prevButton.prop("title",this.content.previousImage),this.$nextButton.prop("title",this.content.nextImage),this.$lastButton.prop("title",this.content.lastImage)),this.$searchButton.prop("title",this.content.go)},t.prototype.updatePagingToggle=function(){return this.pagingToggleIsVisible()?void(this.extension.isPagingSettingEnabled()?(this.$oneUpButton.removeClass("on"),this.$twoUpButton.addClass("on")):(this.$twoUpButton.removeClass("on"),this.$oneUpButton.addClass("on"))):void this.$pagingToggleButtons.hide()},t.prototype.pagingToggleIsVisible=function(){return Utils.Bools.getBool(this.options.pagingToggleEnabled,!0)&&this.extension.helper.isPagingAvailable()},t.prototype.updateGalleryButton=function(){this.galleryIsVisible()||this.$galleryButton.hide()},t.prototype.galleryIsVisible=function(){return Utils.Bools.getBool(this.options.galleryButtonEnabled,!0)&&this.extension.isLeftPanelEnabled()},t.prototype.setTotal=function(){var e=this.content.of;this.isPageModeEnabled()?this.$total.html(String.format(e,this.extension.helper.getLastCanvasLabel(!0))):this.$total.html(String.format(e,this.extension.helper.getTotalCanvases()))},t.prototype.setSearchFieldValue=function(e){var t,i=this.extension.helper.getCanvasByIndex(e);if(this.isPageModeEnabled()){var n=Manifesto.TranslationCollection.getValue(i.getLabel());t="-"===n?"":n}else e+=1,t=e;this.options.autoCompleteBoxEnabled?this.$autoCompleteBox.val(t):this.$searchText.val(t)},t.prototype.search=function(e){if(!e)return this.extension.showMessage(this.content.emptyValue),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);if(this.isPageModeEnabled())$.publish(o.PAGE_SEARCH,[e]);else{var t;if(t=this.options.autoCompleteBoxEnabled?parseInt(this.$autoCompleteBox.val(),10):parseInt(this.$searchText.val(),10),t-=1,isNaN(t))return this.extension.showMessage(this.extension.config.modules.genericDialogue.content.invalidNumber),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);var i=this.extension.helper.getCanvasByIndex(t);if(!i)return this.extension.showMessage(this.extension.config.modules.genericDialogue.content.pageNotFound),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);$.publish(o.IMAGE_SEARCH,[t])}},t.prototype.canvasIndexChanged=function(e){this.setSearchFieldValue(e),this.options.imageSelectionBoxEnabled===!0&&this.options.autoCompleteBoxEnabled!==!0&&this.$imageSelectionBox.val(e);var t=this.extension.helper.getViewingDirection();t.toString()===manifesto.ViewingDirection.rightToLeft().toString()?(this.extension.helper.isFirstCanvas()?(this.disableLastButton(),this.disableNextButton()):(this.enableLastButton(),this.enableNextButton()),this.extension.helper.isLastCanvas()?(this.disableFirstButton(),this.disablePrevButton()):(this.enableFirstButton(),this.enablePrevButton())):(this.extension.helper.isFirstCanvas()?(this.disableFirstButton(),this.disablePrevButton()):(this.enableFirstButton(),this.enablePrevButton()),this.extension.helper.isLastCanvas()?(this.disableLastButton(),this.disableNextButton()):(this.enableLastButton(),this.enableNextButton()))},t.prototype.disableFirstButton=function(){this.firstButtonEnabled=!1,this.$firstButton.disable()},t.prototype.enableFirstButton=function(){this.firstButtonEnabled=!0,this.$firstButton.enable()},t.prototype.disableLastButton=function(){this.lastButtonEnabled=!1,this.$lastButton.disable()},t.prototype.enableLastButton=function(){this.lastButtonEnabled=!0,this.$lastButton.enable()},t.prototype.disablePrevButton=function(){this.prevButtonEnabled=!1,this.$prevButton.disable()},t.prototype.enablePrevButton=function(){this.prevButtonEnabled=!0,this.$prevButton.enable()},t.prototype.disableNextButton=function(){this.nextButtonEnabled=!1,this.$nextButton.disable()},t.prototype.enableNextButton=function(){this.nextButtonEnabled=!0,this.$nextButton.enable()},t.prototype.modeChanged=function(){this.setSearchFieldValue(this.extension.helper.canvasIndex),this.setTitles(),this.setTotal()},t.prototype.resize=function(){e.prototype.resize.call(this),this.extension.width()'),this.$content.prepend(this.$viewer),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){Utils.Async.waitFor(function(){return t.isResized},function(){t.isCreated||t.createUI(),t.openMedia(i)})}),$.subscribe(n.ZOOM_IN,function(){Utils.Async.waitFor(function(){return t.isCreated},function(){t.zoomIn()})}),$.subscribe(n.ZOOM_OUT,function(){Utils.Async.waitFor(function(){return t.isCreated},function(){t.zoomOut()})}),$.subscribe(n.ROTATE,function(){Utils.Async.waitFor(function(){return t.isCreated},function(){t.rotateRight()})}),$.subscribe(i.METRIC_CHANGED,function(){Utils.Async.waitFor(function(){return t.isCreated},function(){t.updateResponsiveView()})})},t.prototype.zoomIn=function(){this.viewer.viewport.zoomTo(2*this.viewer.viewport.getZoom(!0))},t.prototype.zoomOut=function(){this.viewer.viewport.zoomTo(.5*this.viewer.viewport.getZoom(!0))},t.prototype.rotateRight=function(){this.viewer.viewport.setRotation(this.viewer.viewport.getRotation()+90)},t.prototype.updateResponsiveView=function(){this.setNavigatorVisible(),this.extension.metric===s.MOBILE_LANDSCAPE?(this.viewer.autoHideControls=!1,this.$viewportNavButtons.hide()):(this.viewer.autoHideControls=!0,this.$viewportNavButtons.show())},t.prototype.createUI=function(){var e=this;this.$spinner=$('
              '),this.$content.append(this.$spinner),this.updateAttribution();var t=window.DEBUG?"modules/uv-seadragoncenterpanel-module/img/":"themes/"+this.extension.config.options.theme+"/img/uv-seadragoncenterpanel-module/";window.openSeadragonViewer=this.viewer=OpenSeadragon({id:"viewer",ajaxWithCredentials:!1,showNavigationControl:!0,showNavigator:!0,showRotationControl:!0,showHomeControl:Utils.Bools.getBool(this.config.options.showHomeControl,!1),showFullPageControl:!1,defaultZoomLevel:this.config.options.defaultZoomLevel||0,controlsFadeDelay:this.config.options.controlsFadeDelay||250,controlsFadeLength:this.config.options.controlsFadeLength||250,navigatorPosition:this.config.options.navigatorPosition||"BOTTOM_RIGHT",animationTime:this.config.options.animationTime||1.2,visibilityRatio:this.config.options.visibilityRatio||.5,constrainDuringPan:Utils.Bools.getBool(this.config.options.constrainDuringPan,!1),immediateRender:Utils.Bools.getBool(this.config.options.immediateRender,!1),blendTime:this.config.options.blendTime||0,autoHideControls:Utils.Bools.getBool(this.config.options.autoHideControls,!0),prefixUrl:t,navImages:{zoomIn:{REST:"zoom_in.png",GROUP:"zoom_in.png",HOVER:"zoom_in.png",DOWN:"zoom_in.png"},zoomOut:{REST:"zoom_out.png",GROUP:"zoom_out.png",HOVER:"zoom_out.png",DOWN:"zoom_out.png"},home:{REST:"home.png",GROUP:"home.png",HOVER:"home.png",DOWN:"home.png"},rotateright:{REST:"rotate_right.png",GROUP:"rotate_right.png",HOVER:"rotate_right.png",DOWN:"rotate_right.png"},rotateleft:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"},next:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"},previous:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"}}}),this.$zoomInButton=this.$viewer.find('div[title="Zoom in"]'),this.$zoomInButton.attr("tabindex",0),this.$zoomInButton.prop("title",this.content.zoomIn),this.$zoomInButton.addClass("zoomIn viewportNavButton"),this.$zoomOutButton=this.$viewer.find('div[title="Zoom out"]'),this.$zoomOutButton.attr("tabindex",0),this.$zoomOutButton.prop("title",this.content.zoomOut),this.$zoomOutButton.addClass("zoomOut viewportNavButton"),this.$goHomeButton=this.$viewer.find('div[title="Go home"]'),this.$goHomeButton.attr("tabindex",0),this.$goHomeButton.prop("title",this.content.goHome),this.$goHomeButton.addClass("goHome viewportNavButton"),this.$rotateButton=this.$viewer.find('div[title="Rotate right"]'),this.$rotateButton.attr("tabindex",0),this.$rotateButton.prop("title",this.content.rotateRight),this.$rotateButton.addClass("rotate viewportNavButton"),this.$viewportNavButtonsContainer=this.$viewer.find(".openseadragon-container > div:not(.openseadragon-canvas):first"),this.$viewportNavButtons=this.$viewportNavButtonsContainer.find(".viewportNavButton"),this.$navigator=this.$viewer.find(".navigator"),this.setNavigatorVisible(),this.$element.on("mousemove",function(t){e.controlsVisible||(e.controlsVisible=!0,e.viewer.setControlsEnabled(!0))}),this.$element.on("mouseleave",function(t){e.controlsVisible&&(e.controlsVisible=!1,e.viewer.setControlsEnabled(!1))}),this.$element.on("mousemove",function(t){if(!e.$viewer.find(".navigator").ismouseover()){if(!e.controlsVisible)return;e.controlsVisible=!1,e.viewer.setControlsEnabled(!1)}},this.config.options.controlsFadeAfterInactive),this.viewer.addHandler("tile-drawn",function(){e.$spinner.hide()}),this.viewer.addHandler("resize",function(t){$.publish(n.SEADRAGON_RESIZE,[t]),e.viewerResize(t)}),this.viewer.addHandler("animation-start",function(e){$.publish(n.SEADRAGON_ANIMATION_START,[e])}),this.viewer.addHandler("animation",function(e){$.publish(n.SEADRAGON_ANIMATION,[e])}),this.viewer.addHandler("animation-finish",function(t){e.currentBounds=e.getBounds(),$.publish(n.SEADRAGON_ANIMATION_FINISH,[t])}),this.viewer.addHandler("rotate",function(e){$.publish(n.SEADRAGON_ROTATION,[e.degrees])}),this.title=this.extension.helper.getLabel(),this.createNavigationButtons(),this.hidePrevButton(),this.hideNextButton(),this.isCreated=!0,this.resize()},t.prototype.createNavigationButtons=function(){var e=this.extension.helper.getViewingDirection();switch(this.$prevButton=$(''),this.$prevButton.prop("title",this.content.previous),this.$nextButton=$(''),this.$nextButton.prop("title",this.content.next),this.viewer.addControl(this.$prevButton[0],{anchor:OpenSeadragon.ControlAnchor.TOP_LEFT}),this.viewer.addControl(this.$nextButton[0],{anchor:OpenSeadragon.ControlAnchor.TOP_RIGHT}),e.toString()){case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():this.$prevButton.addClass("vertical"),this.$nextButton.addClass("vertical")}var t=this;this.$prevButton.onPressed(function(i){if(i.preventDefault(),OpenSeadragon.cancelEvent(i),t.prevButtonEnabled)switch(e.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(n.PREV);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(n.NEXT)}}),this.$nextButton.onPressed(function(i){if(i.preventDefault(),OpenSeadragon.cancelEvent(i),t.nextButtonEnabled)switch(e.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(n.NEXT);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(n.PREV)}})},t.prototype.openMedia=function(e){var t=this;this.$spinner.show(),this.items=[],this.extension.getExternalResources(e).then(function(e){t.viewer.close(),e=t.getPagePositions(e);for(var i=0;i1)if(2===e.length)this.extension.helper.isVerticallyAligned()?(n=e[0],n.y=0,o=e[1],o.y=n.height+this.config.options.pageGap):(t=e[0],t.x=0,i=e[1],i.x=t.width+this.config.options.pageGap);else if(this.extension.helper.isVerticallyAligned())if(this.extension.helper.isTopToBottom())for(var a=0;a0;a--)s=e[a],r=e[a-1],r.y=(s.y||0)-s.height;else if(this.extension.helper.isLeftToRight())for(var a=0;a0;a--)s=e[a],r=e[a-1],r.x=(s.x||0)-s.width;return e},t.prototype.openPagesHandler=function(){if($.publish(n.SEADRAGON_OPEN),this.isFirstLoad)this.initialRotation=this.extension.getParam(r.rotation),this.initialRotation&&this.viewer.viewport.setRotation(parseInt(this.initialRotation)),this.initialBounds=this.extension.getParam(r.zoom),this.initialBounds?(this.initialBounds=this.deserialiseBounds(this.initialBounds),this.currentBounds=this.initialBounds,this.fitToBounds(this.currentBounds)):this.goHome();else{var e=this.extension.getSettings();e.preserveViewport&&this.currentBounds?this.fitToBounds(this.currentBounds):this.goHome()}if(this.extension.helper.isMultiCanvas()&&!this.extension.helper.isContinuous()){this.showPrevButton(),this.showNextButton(),$(".navigator").addClass("extraMargin");var t=this.extension.helper.getViewingDirection();t.toString()===manifesto.ViewingDirection.rightToLeft().toString()?(this.extension.helper.isFirstCanvas()?this.disableNextButton():this.enableNextButton(),this.extension.helper.isLastCanvas()?this.disablePrevButton():this.enablePrevButton()):(this.extension.helper.isFirstCanvas()?this.disablePrevButton():this.enablePrevButton(),this.extension.helper.isLastCanvas()?this.disableNextButton():this.enableNextButton())}this.setNavigatorVisible(),this.isFirstLoad=!1,this.overlaySearchResults()},t.prototype.goHome=function(){this.viewer.viewport.goHome(!0)},t.prototype.disablePrevButton=function(){this.prevButtonEnabled=!1,this.$prevButton.addClass("disabled")},t.prototype.enablePrevButton=function(){this.prevButtonEnabled=!0,this.$prevButton.removeClass("disabled")},t.prototype.hidePrevButton=function(){this.disablePrevButton(),this.$prevButton.hide()},t.prototype.showPrevButton=function(){this.enablePrevButton(),this.$prevButton.show()},t.prototype.disableNextButton=function(){this.nextButtonEnabled=!1,this.$nextButton.addClass("disabled")},t.prototype.enableNextButton=function(){this.nextButtonEnabled=!0,this.$nextButton.removeClass("disabled")},t.prototype.hideNextButton=function(){this.disableNextButton(),this.$nextButton.hide()},t.prototype.showNextButton=function(){this.enableNextButton(),this.$nextButton.show()},t.prototype.serialiseBounds=function(e){return e.x+","+e.y+","+e.width+","+e.height},t.prototype.deserialiseBounds=function(e){var t=e.split(",");return{x:Number(t[0]),y:Number(t[1]),width:Number(t[2]),height:Number(t[3])}},t.prototype.fitToBounds=function(e){var t=new OpenSeadragon.Rect;t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,this.viewer.viewport.fitBounds(t,!0)},t.prototype.getBounds=function(){if(!this.viewer||!this.viewer.viewport)return null;var e=this.viewer.viewport.getBounds(!0);return{x:Math.roundToDecimalPlace(e.x,4),y:Math.roundToDecimalPlace(e.y,4),width:Math.roundToDecimalPlace(e.width,4),height:Math.roundToDecimalPlace(e.height,4)}},t.prototype.viewerResize=function(e){if(e.viewport){var t=e.viewport.getCenter(!0);t&&setTimeout(function(){e.viewport.panTo(t,!0)},1)}},t.prototype.overlaySearchResults=function(){var e=this.extension.searchResults;if(e.length)for(var t=this.extension.getPagedIndices(),i=0;i0&&(n=this.extension.resources[t-1].width);for(var o=0;o0?this.config.options.pageGap:0),a=Number(s.y),l=Number(s.width),h=Number(s.height),u=new OpenSeadragon.Rect(r,a,l,h);i.push(u)}return i},t.prototype.resize=function(){var t=this;if(e.prototype.resize.call(this),this.$viewer.height(this.$content.height()-this.$viewer.verticalMargins()),this.$viewer.width(this.$content.width()-this.$viewer.horizontalMargins()),this.isCreated){this.currentBounds&&this.fitToBounds(this.currentBounds),this.$title.ellipsisFill(this.extension.sanitize(this.title)),this.$spinner.css("top",this.$content.height()/2-this.$spinner.height()/2),this.$spinner.css("left",this.$content.width()/2-this.$spinner.width()/2);var i=this.extension.helper.getViewingDirection();if(this.extension.helper.isMultiCanvas()&&this.$prevButton&&this.$nextButton){var n=Math.floor(this.$content.width()/2);switch(i.toString()){case manifesto.ViewingDirection.bottomToTop().toString():this.$prevButton.addClass("down"),this.$nextButton.addClass("up"),this.$prevButton.css("left",n-this.$prevButton.outerWidth()/2),this.$prevButton.css("top",this.$content.height()-this.$prevButton.height()),this.$nextButton.css("left",-1*n-this.$nextButton.outerWidth()/2);break;case manifesto.ViewingDirection.topToBottom().toString():this.$prevButton.css("left",n-this.$prevButton.outerWidth()/2),this.$nextButton.css("left",-1*n-this.$nextButton.outerWidth()/2),this.$nextButton.css("top",this.$content.height()-this.$nextButton.height());break;default:this.$prevButton.css("top",(this.$content.height()-this.$prevButton.height())/2),this.$nextButton.css("top",(this.$content.height()-this.$nextButton.height())/2)}}setTimeout(function(){if(t.extension.helper.isContinuous())if(t.extension.helper.isHorizontallyAligned()){var e=t.$viewer.width()-t.$viewer.rightMargin();t.$navigator.width(e)}else t.$navigator.height(t.$viewer.height())},100)}},t.prototype.setFocus=function(){var e=$(this.viewer.canvas);e.is(":focus")||e.focus()},t.prototype.setNavigatorVisible=function(){var e=Utils.Bools.getBool(this.extension.getSettings().navigatorEnabled,!0)&&this.extension.metric!==s.MOBILE_LANDSCAPE;this.viewer.navigator.setVisible(e),e?this.$navigator.show():this.$navigator.hide()},t}(o);return a}),define("extensions/uv-seadragon-extension/SearchResultRect",["require","exports"],function(e,t){var i=function(){function e(e){this.index=e.resource.resultIndex;var t=e.on.match(/.*xywh=(\d*),(\d*),(\d*),(\d*)/);this.x=t[1],this.y=t[2],this.width=t[3],this.height=t[4]}return e}();return i}),define("extensions/uv-seadragon-extension/SearchResult",["require","exports","./SearchResultRect"],function(e,t,i){var n=function(){function e(e,t){this.rects=[],this.canvasIndex=t.getCanvasIndexById(e.on.match(/(.*)#/)[1]),this.addRect(e)}return e.prototype.addRect=function(e){var t=new i(e);this.rects.push(t),this.rects.sort(function(e,t){return e.index-t.index})},e}();return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){var n=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.$navigatorEnabled=$(''),this.$scroll.append(this.$navigatorEnabled),this.$navigatorEnabledCheckbox=$(''),this.$navigatorEnabled.append(this.$navigatorEnabledCheckbox),this.$navigatorEnabledLabel=$('"),this.$navigatorEnabled.append(this.$navigatorEnabledLabel),this.$pagingEnabled=$('
              '),this.$scroll.append(this.$pagingEnabled),this.$pagingEnabledCheckbox=$(''),this.$pagingEnabled.append(this.$pagingEnabledCheckbox),this.$pagingEnabledLabel=$('"),this.$pagingEnabled.append(this.$pagingEnabledLabel),this.$preserveViewport=$('
              '),this.$scroll.append(this.$preserveViewport),this.$preserveViewportCheckbox=$(''),this.$preserveViewport.append(this.$preserveViewportCheckbox),this.$preserveViewportLabel=$('"),this.$preserveViewport.append(this.$preserveViewportLabel),this.$navigatorEnabledCheckbox.change(function(){var e={};t.$navigatorEnabledCheckbox.is(":checked")?e.navigatorEnabled=!0:e.navigatorEnabled=!1,t.updateSettings(e)}),this.$pagingEnabledCheckbox.change(function(){var e={};t.$pagingEnabledCheckbox.is(":checked")?e.pagingEnabled=!0:e.pagingEnabled=!1,t.updateSettings(e)}),this.$preserveViewportCheckbox.change(function(){var e={};t.$preserveViewportCheckbox.is(":checked")?e.preserveViewport=!0:e.preserveViewport=!1,t.updateSettings(e)})},t.prototype.open=function(){e.prototype.open.call(this);var t=this.getSettings();t.navigatorEnabled?this.$navigatorEnabledCheckbox.prop("checked",!0):this.$navigatorEnabledCheckbox.removeAttr("checked"),this.extension.helper.isPagingAvailable()?t.pagingEnabled?this.$pagingEnabledCheckbox.prop("checked",!0):this.$pagingEnabledCheckbox.removeAttr("checked"):this.$pagingEnabled.hide(),t.preserveViewport?this.$preserveViewportCheckbox.prop("checked",!0):this.$preserveViewportCheckbox.removeAttr("checked")},t}(i);return n});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue","./Commands"],function(e,t,i,n){var o=function(e){function t(t){var i=this;e.call(this,t),$.subscribe(n.SEADRAGON_OPEN,function(){i.update()}),$.subscribe(n.SEADRAGON_ANIMATION_FINISH,function(){i.update()})}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this);var t=this.extension.getViewerBounds(),i=this.extension.getViewerRotation();this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight,t,i),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-seadragon-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./Commands","../../modules/uv-contentleftpanel-module/ContentLeftPanel","./CroppedImageDimensions","./DownloadDialogue","../../modules/uv-dialogues-module/ExternalContentDialogue","../../modules/uv-searchfooterpanel-module/FooterPanel","../../modules/uv-dialogues-module/HelpDialogue","../../modules/uv-shared-module/Metrics","../../modules/uv-osdmobilefooterpanel-module/MobileFooter","./Mode","../../modules/uv-dialogues-module/MoreInfoDialogue","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-multiselectdialogue-module/MultiSelectDialogue","./MultiSelectionArgs","../../modules/uv-pagingheaderpanel-module/PagingHeaderPanel","../../Params","../../modules/uv-shared-module/Point","../../modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel","./SearchResult","./SettingsDialogue","./ShareDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,u,c,p,d,g,f,m,v,b,E,w,y,x,S,C,I,T){var D=Utils.Measurements.Size,O=function(e){function t(t){e.call(this,t),this.currentRotation=0,this.iiifImageUriTemplate="{0}/{1}/{2}/{3}/{4}/{5}.jpg",this.searchResults=[]}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t);$.subscribe(i.METRIC_CHANGED,function(){if(n.metric===p.MOBILE_LANDSCAPE){var e={};e.pagingEnabled=!1,n.updateSettings(e),$.publish(i.UPDATE_SETTINGS),T.$rightPanel.hide()}else T.$rightPanel.show()}),$.subscribe(s.CLEAR_SEARCH,function(e){n.triggerSocket(s.CLEAR_SEARCH)}),$.subscribe(i.DOWN_ARROW,function(e){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(i.END,function(e){n.viewPage(n.helper.getLastPageIndex())}),$.subscribe(s.FIRST,function(e){n.triggerSocket(s.FIRST),n.viewPage(n.helper.getFirstPageIndex())}),$.subscribe(s.GALLERY_DECREASE_SIZE,function(e){n.triggerSocket(s.GALLERY_DECREASE_SIZE)}),$.subscribe(s.GALLERY_INCREASE_SIZE,function(e){n.triggerSocket(s.GALLERY_INCREASE_SIZE)}),$.subscribe(s.GALLERY_THUMB_SELECTED,function(e){n.triggerSocket(s.GALLERY_THUMB_SELECTED)}),$.subscribe(i.HOME,function(e){n.viewPage(n.helper.getFirstPageIndex())}),$.subscribe(s.IMAGE_SEARCH,function(e,t){n.triggerSocket(s.IMAGE_SEARCH,t),n.viewPage(t)}),$.subscribe(s.LAST,function(e){n.triggerSocket(s.LAST),n.viewPage(n.helper.getLastPageIndex())}),$.subscribe(i.LEFT_ARROW,function(e){n.useArrowKeysToNavigate()?n.viewPage(n.getPrevPageIndex()):n.centerPanel.setFocus()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_START,function(e){n.metric!==p.MOBILE_LANDSCAPE&&T.$rightPanel.show()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){T.$centerPanel.show(),n.resize()}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){T.$centerPanel.hide(),T.$rightPanel.hide()}),$.subscribe(i.MINUS,function(e){n.centerPanel.setFocus()}),$.subscribe(s.MODE_CHANGED,function(e,t){n.triggerSocket(s.MODE_CHANGED,t),n.mode=new g(t);var o=n.getSettings();$.publish(i.SETTINGS_CHANGED,[o])}),$.subscribe(s.MULTISELECTION_MADE,function(e,t){var i=new b;i.manifestUri=n.helper.iiifResourceUri,i.allCanvases=t.length===n.helper.getCanvases().length,i.canvases=t,i.format=n.config.options.multiSelectionMimeType,i.sequence=n.helper.getCurrentSequence().id,n.triggerSocket(s.MULTISELECTION_MADE,i)}),$.subscribe(s.NEXT,function(e){n.triggerSocket(s.NEXT),n.viewPage(n.getNextPageIndex())}),$.subscribe(s.NEXT_SEARCH_RESULT,function(){n.triggerSocket(s.NEXT_SEARCH_RESULT),n.nextSearchResult()}),$.subscribe(s.OPEN_THUMBS_VIEW,function(e){n.triggerSocket(s.OPEN_THUMBS_VIEW)}),$.subscribe(s.OPEN_TREE_VIEW,function(e){n.triggerSocket(s.OPEN_TREE_VIEW)}),$.subscribe(i.PAGE_DOWN,function(e){n.viewPage(n.getNextPageIndex())}),$.subscribe(s.PAGE_SEARCH,function(e,t){n.triggerSocket(s.PAGE_SEARCH,t),n.viewLabel(t)}),$.subscribe(i.PAGE_UP,function(e){n.viewPage(n.getPrevPageIndex())}),$.subscribe(s.PAGING_TOGGLED,function(e,t){n.triggerSocket(s.PAGING_TOGGLED,t)}),$.subscribe(i.PLUS,function(e){n.centerPanel.setFocus()}),$.subscribe(s.PREV,function(e){n.triggerSocket(s.PREV),n.viewPage(n.getPrevPageIndex())}),$.subscribe(s.PREV_SEARCH_RESULT,function(){n.triggerSocket(s.PREV_SEARCH_RESULT),n.prevSearchResult()}),$.subscribe(s.PRINT,function(){n.print()}),$.subscribe(i.RIGHT_ARROW,function(e){n.useArrowKeysToNavigate()?n.viewPage(n.getNextPageIndex()):n.centerPanel.setFocus()}),$.subscribe(s.SEADRAGON_ANIMATION,function(){n.triggerSocket(s.SEADRAGON_ANIMATION)}),$.subscribe(s.SEADRAGON_ANIMATION_FINISH,function(e,t){n.centerPanel&&n.centerPanel.currentBounds&&n.setParam(w.zoom,n.centerPanel.serialiseBounds(n.centerPanel.currentBounds));var i=n.helper.getCurrentCanvas();n.triggerSocket(s.CURRENT_VIEW_URI,{cropUri:n.getCroppedImageUri(i,n.getViewer()),fullUri:n.getConfinedImageUri(i,i.getWidth())})}),$.subscribe(s.SEADRAGON_ANIMATION_START,function(){n.triggerSocket(s.SEADRAGON_ANIMATION_START)}),$.subscribe(s.SEADRAGON_OPEN,function(){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(s.SEADRAGON_RESIZE,function(){n.triggerSocket(s.SEADRAGON_RESIZE)}),$.subscribe(s.SEADRAGON_ROTATION,function(e,t){n.triggerSocket(s.SEADRAGON_ROTATION),n.currentRotation=t,n.setParam(w.rotation,t)}),$.subscribe(s.SEARCH,function(e,t){ -n.triggerSocket(s.SEARCH,t),n.searchWithin(t)}),$.subscribe(s.SEARCH_PREVIEW_FINISH,function(e){n.triggerSocket(s.SEARCH_PREVIEW_FINISH)}),$.subscribe(s.SEARCH_PREVIEW_START,function(e){n.triggerSocket(s.SEARCH_PREVIEW_START)}),$.subscribe(s.SEARCH_RESULTS,function(e,t){n.triggerSocket(s.SEARCH_RESULTS,t)}),$.subscribe(s.SEARCH_RESULTS_EMPTY,function(e){n.triggerSocket(s.SEARCH_RESULTS_EMPTY)}),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewPage(t.index)}),$.subscribe(s.TREE_NODE_SELECTED,function(e,t){n.triggerSocket(s.TREE_NODE_SELECTED,t.data.path),n.treeNodeSelected(t)}),$.subscribe(i.UP_ARROW,function(e){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(i.UPDATE_SETTINGS,function(e){n.viewPage(n.helper.canvasIndex,!0);var t=n.getSettings();$.publish(i.SETTINGS_CHANGED,[t])}),$.subscribe(s.VIEW_PAGE,function(e,t){n.triggerSocket(s.VIEW_PAGE,t),n.viewPage(t)}),Utils.Async.waitFor(function(){return n.centerPanel&&n.centerPanel.isCreated},function(){n.checkForSearchParam(),n.checkForRotationParam()})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new E(T.$headerPanel):T.$headerPanel.hide(),this.isLeftPanelEnabled()?this.leftPanel=new r(T.$leftPanel):T.$leftPanel.hide(),this.centerPanel=new x(T.$centerPanel),this.isRightPanelEnabled()?this.rightPanel=new m(T.$rightPanel):T.$rightPanel.hide(),this.isFooterPanelEnabled()?(this.footerPanel=new u(T.$footerPanel),this.mobileFooterPanel=new d(T.$mobileFooterPanel)):T.$footerPanel.hide(),this.$helpDialogue=$('
              '),T.$overlays.append(this.$helpDialogue),this.helpDialogue=new c(this.$helpDialogue),this.$moreInfoDialogue=$('
              '),T.$overlays.append(this.$moreInfoDialogue),this.moreInfoDialogue=new f(this.$moreInfoDialogue),this.$multiSelectDialogue=$('
              '),T.$overlays.append(this.$multiSelectDialogue),this.multiSelectDialogue=new v(this.$multiSelectDialogue),this.$shareDialogue=$(''),T.$overlays.append(this.$shareDialogue),this.shareDialogue=new I(this.$shareDialogue),this.$downloadDialogue=$('
              '),T.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new l(this.$downloadDialogue),this.$settingsDialogue=$('
              '),T.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new C(this.$settingsDialogue),this.$externalContentDialogue=$('
              '),T.$overlays.append(this.$externalContentDialogue),this.externalContentDialogue=new h(this.$externalContentDialogue),this.isHeaderPanelEnabled()&&this.headerPanel.init(),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init(),this.isFooterPanelEnabled()&&this.footerPanel.init()},t.prototype.checkForSearchParam=function(){if(this.isDeepLinkingEnabled()){var e=this.getParam(w.highlight);e&&(e.replace(/\+/g," ").replace(/"/g,""),$.publish(s.SEARCH,[e]))}},t.prototype.checkForRotationParam=function(){if(this.isDeepLinkingEnabled()){var e=Number(this.getParam(w.rotation));e&&$.publish(s.SEADRAGON_ROTATION,[e])}},t.prototype.viewPage=function(e,t){if(-1!==e){if(this.helper.isCanvasIndexOutOfRange(e)&&(this.showMessage(this.config.content.canvasIndexOutOfRange),e=0),this.isPagingSettingEnabled()&&!t){var i=this.getPagedIndices(e);if(i.contains(this.helper.canvasIndex))return void this.viewCanvas(e)}this.viewCanvas(e)}},t.prototype.getViewer=function(){return this.centerPanel.viewer},t.prototype.getMode=function(){if(this.mode)return this.mode;switch(this.helper.getManifestType().toString()){case manifesto.ManifestType.monograph().toString():return g.page;case manifesto.ManifestType.manuscript().toString():return g.page;default:return g.image}},t.prototype.getViewerBounds=function(){if(!this.centerPanel)return null;var e=this.centerPanel.getBounds();return e?this.centerPanel.serialiseBounds(e):""},t.prototype.getViewerRotation=function(){return this.centerPanel?this.currentRotation:null},t.prototype.viewRange=function(e){var t=this.helper.getRangeByPath(e);if(t){var i=t.getCanvasIds()[0],n=this.helper.getCanvasIndexById(i);this.viewPage(n)}},t.prototype.viewLabel=function(e){if(!e)return this.showMessage(this.config.modules.genericDialogue.content.emptyValue),void $.publish(i.CANVAS_INDEX_CHANGE_FAILED);var t=this.helper.getCanvasIndexByLabel(e);-1!=t?this.viewPage(t):(this.showMessage(this.config.modules.genericDialogue.content.pageNotFound),$.publish(i.CANVAS_INDEX_CHANGE_FAILED))},t.prototype.treeNodeSelected=function(e){var t=e.data;if(t.type)switch(t.type){case manifesto.IIIFResourceType.manifest().toString():this.viewManifest(t);break;case manifesto.IIIFResourceType.collection().toString():this.viewCollection(t);break;default:this.viewRange(t.path)}},t.prototype.clearSearch=function(){this.searchResults=[],this.viewPage(this.helper.canvasIndex)},t.prototype.prevSearchResult=function(){for(var e=this.searchResults.length-1;e>=0;e--){var t=this.searchResults[e];if(t.canvasIndexthis.helper.canvasIndex){this.viewPage(t.canvasIndex);break}}},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getCroppedImageUri(t,this.getViewer()),n.thumb=t.getCanonicalImageUri(this.config.options.bookmarkThumbWidth),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.image().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.print=function(){window.print(),this.triggerSocket(s.PRINT)},t.prototype.getCroppedImageDimensions=function(e,t){if(!t)return null;if(!t.viewport)return null;if(!e.getHeight()||!e.getWidth())return null;var i=t.viewport.getBounds(!0),n=new a,o=Math.floor(i.width),s=Math.floor(i.height),r=Math.floor(i.x),l=Math.floor(i.y);r+o>e.getWidth()?o=e.getWidth()-r:0>r&&(o+=r,r=0),l+s>e.getHeight()?s=e.getHeight()-l:0>l&&(s+=l,l=0),o=Math.min(o,e.getWidth()),s=Math.min(s,e.getHeight());var h=o,u=s;if(e.externalResource.data&&e.externalResource.data.profile[1]){var c=new D(e.externalResource.data.profile[1].maxWidth,e.externalResource.data.profile[1].maxHeight);if(!_.isUndefined(c.width)&&!_.isUndefined(c.height)){if(o>c.width){var p=c.width;s=Math.round(p*(s/o)),o=p}if(s>c.height){var d=c.height;o=Math.round(o/s*d),s=d}}}return n.region=new D(h,u),n.regionPos=new y(r,l),n.size=new D(o,s),n},t.prototype.getCroppedImageUri=function(e,t){if(!t)return null;if(!t.viewport)return null;var i=this.getCroppedImageDimensions(e,t),n=this.getImageBaseUri(e),o=this.getImageId(e),s=i.regionPos.x+","+i.regionPos.y+","+i.region.width+","+i.region.height,r=i.size.width+","+i.size.height,a=this.getViewerRotation(),l="default";return String.format(this.iiifImageUriTemplate,n,o,s,r,a,l)},t.prototype.getConfinedImageDimensions=function(e,t){var i=new D(0,0);i.width=t;var n=Math.normalise(t,0,e.getWidth());return i.height=Math.floor(e.getHeight()*n),i},t.prototype.getConfinedImageUri=function(e,t){var i=this.getImageBaseUri(e),n=this.getImageId(e),o="full",s=this.getConfinedImageDimensions(e,t),r=s.width+","+s.height,a=this.getViewerRotation(),l="default",h=String.format(this.iiifImageUriTemplate,i,n,o,r,a,l);return h},t.prototype.getImageId=function(e){var t=this.getInfoUri(e);return t=t.substr(0,t.lastIndexOf("/")),t.substr(t.lastIndexOf("/")+1)},t.prototype.getImageBaseUri=function(e){var t=this.getInfoUri(e);return t=t.substr(0,t.lastIndexOf("/")),t.substr(0,t.lastIndexOf("/"))},t.prototype.getInfoUri=function(e){var t,i=e.getImages();if(i&&i.length)for(var n=i[0],o=n.getResource(),s=o.getServices(),r=0;rthis.helper.getTotalCanvases()-1?-1:t},t.prototype.getAutoCompleteService=function(){var e=this.helper.getSearchWithinService();return e?e.getService(manifesto.ServiceProfile.autoComplete()):null},t.prototype.getAutoCompleteUri=function(){var e=this.getAutoCompleteService();return e?e.id+"?q={0}":null},t.prototype.getSearchWithinServiceUri=function(){var e=this.helper.getSearchWithinService();if(!e)return null;var t=e.id;return t+="?q={0}"},t.prototype.searchWithin=function(e){var t=this;this.doSearchWithin(e,function(i){i.resources&&i.resources.length?($.publish(s.SEARCH_RESULTS,[{terms:e,results:i}]),t.viewPage(t.helper.canvasIndex,!0)):t.showMessage(t.config.modules.genericDialogue.content.noMatches,function(){$.publish(s.SEARCH_RESULTS_EMPTY)})})},t.prototype.doSearchWithin=function(e,t){var i=this,n=this.getSearchWithinServiceUri();n=String.format(n,e),$.getJSON(n,function(e){e.resources&&e.resources.length&&i.parseSearchWithinResults(e),t(e)})},t.prototype.parseSearchWithinResults=function(e){this.searchResults=[];for(var t=0;t'),this.$content.prepend(this.$navigation),this.$zoomInButton=$(''),this.$navigation.append(this.$zoomInButton),this.$zoomOutButton=$(''),this.$navigation.append(this.$zoomOutButton),this.$viewport=$('
              '),this.$content.prepend(this.$viewport),this.title=this.extension.helper.getLabel(),this.updateAttribution(),this.$zoomInButton.on("click",function(e){e.preventDefault(),t.viewport.zoomIn()}),this.$zoomOutButton.on("click",function(e){e.preventDefault(),t.viewport.zoomOut()})},t.prototype.openMedia=function(e){var t=this;this.extension.getExternalResources(e).then(function(){t.$viewport.empty();var e=t.extension.helper.getCurrentCanvas();t.viewport=virtex.create({element:"#content .virtex",object:e.id,showStats:t.options.showStats}),t.resize()})},t.prototype.resize=function(){e.prototype.resize.call(this),this.$title.ellipsisFill(this.title),this.$viewport.width(this.$content.width()),this.$viewport.height(this.$content.height())},t}(n);return o});var __extends=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};define("extensions/uv-virtex-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","../../modules/uv-contentleftpanel-module/ContentLeftPanel","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell","../../modules/uv-virtexcenterpanel-module/VirtexCenterPanel"],function(e,t,i,n,o,s,r,a,l,h,u,c,p,d){var g=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t)})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new h(p.$headerPanel):p.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new s(p.$leftPanel)),this.centerPanel=new d(p.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new u(p.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new l(p.$footerPanel):p.$footerPanel.hide(),this.$downloadDialogue=$('
              '),p.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$(''),p.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('
              '),p.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new c(this.$settingsDialogue),this.isLeftPanelEnabled()?this.leftPanel.init():p.$leftPanel.hide(),this.isRightPanelEnabled()?this.rightPanel.init():p.$rightPanel.hide()},t.prototype.isLeftPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)&&(this.helper.isMultiCanvas()||this.helper.isMultiSequence())},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.physicalobject().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t}(n);return g}),"function"==typeof jQuery&&define("jquery",[],function(){return jQuery}),require(["Bootstrapper","extensions/uv-mediaelement-extension/Extension","extensions/uv-pdf-extension/Extension","extensions/uv-seadragon-extension/Extension","extensions/uv-virtex-extension/Extension"],function(e,t,i,n,o){var s={};s[manifesto.ElementType.canvas().toString()]={type:n,name:"uv-seadragon-extension"},s[manifesto.ElementType.movingimage().toString()]={type:t,name:"uv-mediaelement-extension"},s[manifesto.ElementType.physicalobject().toString()]={type:o,name:"uv-virtex-extension"},s[manifesto.ElementType.sound().toString()]={type:t,name:"uv-mediaelement-extension"},s[manifesto.RenderingFormat.pdf().toString()]={type:i,name:"uv-pdf-extension"};var r=new e(s);r.bootstrap()}),define("app",function(){}); \ No newline at end of file diff --git a/dist/uv-1.8.38/lib/bundle.min.js b/dist/uv-1.8.38/lib/bundle.min.js deleted file mode 100644 index 53f0b9706..000000000 --- a/dist/uv-1.8.38/lib/bundle.min.js +++ /dev/null @@ -1,11 +0,0 @@ -function Sanitize(){var i,options;for(options=arguments[0]||{},this.config={},this.config.elements=options.elements?options.elements:[],this.config.attributes=options.attributes?options.attributes:{},this.config.attributes[Sanitize.ALL]=this.config.attributes[Sanitize.ALL]?this.config.attributes[Sanitize.ALL]:[],this.config.allow_comments=!!options.allow_comments&&options.allow_comments,this.allowed_elements={},this.config.protocols=options.protocols?options.protocols:{},this.config.add_attributes=options.add_attributes?options.add_attributes:{},this.dom=options.dom?options.dom:document,i=0;i0;)this.current_element.removeChild(this.current_element.firstChild);parent_element.appendChild(this.current_element)}if(!this.config.remove_all_contents&&!this.config.remove_element_contents[name])for(i=0;ichars){var trimmedText=text.substr(0,chars);trimmedText=trimmedText.substr(0,Math.min(trimmedText.length,trimmedText.lastIndexOf(" "))),$self.empty().html(trimmedText+"…")}})},$.fn.ellipsisFill=function(text){var textPassed=!0;return text||(textPassed=!1),this.each(function(){var $self=$(this);if(textPassed||(text=$self.text()),$self.empty(),$self.spanElem=$(''),$self.append($self.spanElem),$self.css("overflow","hidden"),$self.spanElem.css("white-space","nowrap"),$self.spanElem.html(text),$self.spanElem.width()>$self.width())for(var lastText;$self.spanElem.width()>$self.width();){var t=$self.spanElem.html();if(t=t.substring(0,t.lastIndexOf(" "))+"…",t===lastText)break;$self.spanElem.html(t),lastText=t}})},$.fn.ellipsisFixed=function(chars,buttonText){return this.each(function(){var $self=$(this),text=$self.text();$self.empty();var $span=$(""),$ellipsis=$('');if(buttonText?$ellipsis.html(buttonText):$ellipsis.html("…"),$ellipsis.click(function(e){e.preventDefault();var $this=$(this);$span.html(text),$this.remove()}),text.length>chars){var trimmedText=text.substr(0,chars);trimmedText=trimmedText.substr(0,Math.min(trimmedText.length,trimmedText.lastIndexOf(" "))),$span.html(trimmedText+" "),$span.append($ellipsis)}else $span.html(text);$self.append($span)})},$.fn.ellipsisHtmlFixed=function(chars,cb){return this.each(function(){var $self=$(this),expandedText=$self.html(),$trunc=$("");if($trunc.html($self.html().replace(/\s[\s]*/g," ").trim()),!($trunc.text().trim().length<=chars)){for(;$trunc.text().trim().length>chars;)$trunc.removeLastWord(chars);var collapsedText=$trunc.html(),expanded=!1;$self.toggle=function(){$self.empty();var $toggleButton=$('');expanded?($self.html(expandedText+" "),$toggleButton.text("less"),$toggleButton.toggleClass("less","more")):($self.html(collapsedText+"… "),$toggleButton.text("more"),$toggleButton.toggleClass("more","less")),$toggleButton.one("click",function(e){e.preventDefault(),$self.toggle()}),expanded=!expanded,$self.append($toggleButton),cb&&cb()},$self.toggle()}})},$.fn.enable=function(){return this.each(function(){var $this=$(this);$this.removeClass("disabled"),$this.attr("tabindex",$this.data("tabindex"))})},$.fn.equaliseHeight=function(reset,average){var maxHeight=-1,minHeight=Number.MAX_VALUE,heights=[];reset&&this.each(function(){$(this).height("auto")}),this.each(function(){var currentHeight=$(this).height();heights.push(currentHeight),maxHeight=maxHeight>currentHeight?maxHeight:currentHeight,minHeight=minHeightmaxTabIndex&&(maxTabIndex=tabIndex,$elementWithGreatestTabIndex=$el)}),$elementWithGreatestTabIndex},$.fn.horizontalMargins=function(){var $self=$(this);return parseInt($self.css("marginLeft"))+parseInt($self.css("marginRight"))},$.fn.leftMargin=function(){var $self=$(this);return parseInt($self.css("marginLeft"))},$.fn.rightMargin=function(){var $self=$(this);return parseInt($self.css("marginRight"))},$.fn.horizontalPadding=function(){var $self=$(this);return parseInt($self.css("paddingLeft"))+parseInt($self.css("paddingRight"))},$.fn.leftPadding=function(){var $self=$(this);return parseInt($self.css("paddingLeft"))},$.fn.rightPadding=function(){var $self=$(this);return parseInt($self.css("paddingRight"))},$.mlp={x:0,y:0},$(documentHandler),$.fn.ismouseover=function(overThis){var result=!1;return this.eq(0).each(function(){var $current=$(this).is("iframe")?$(this).contents().find("body"):$(this),offset=$current.offset();result=offset.left<=$.mlp.x&&offset.left+$current.outerWidth()>$.mlp.x&&offset.top<=$.mlp.y&&offset.top+$current.outerHeight()>$.mlp.y}),result};var timer,on=$.fn.on;$.fn.on=function(){var args=Array.apply(null,arguments),last=args[args.length-1];if(isNaN(last)||1===last&&args.pop())return on.apply(this,args);var delay=args.pop(),fn=args.pop();return args.push(function(){var self=this,params=arguments;clearTimeout(timer),timer=setTimeout(function(){fn.apply(self,params)},delay)}),on.apply(this,args)},$.fn.onEnter=function(cb){return this.each(function(){var $this=$(this);$this.on("keyup",function(e){13===e.keyCode&&(e.preventDefault(),cb())})})},$.fn.onPressed=function(cb){return this.each(function(){var $this=$(this);$this.on("touchstart click",function(e){e.preventDefault(),cb(e)}),$this.on("keyup",function(e){13===e.keyCode&&(e.preventDefault(),cb(e))})})},$.fn.removeLastWord=function(chars,depth){return"undefined"==typeof chars&&(chars=8),"undefined"==typeof depth&&(depth=0),this.each(function(){var $self=$(this);if($self.contents().length>0){var $lastElement=$self.contents().last();if(3===$lastElement[0].nodeType){var words=$lastElement.text().trim().split(" ");if(words.length>1)return words.splice(words.length-1,1),void($lastElement[0].data=words.join(" "));if("undefined"!=typeof chars&&1===words.length&&words[0].length>chars)return void($lastElement[0].data=words.join(" ").substring(0,chars))}$lastElement.removeLastWord(chars,depth+1)}else depth>0&&$self.remove()})},$.fn.swapClass=function(removeClass,addClass){return this.each(function(){$(this).removeClass(removeClass).addClass(addClass)})},$.fn.targetBlank=function(){return this.each(function(){$(this).find("a").prop("target","_blank")})},$.fn.toggleClass=function(class1,class2){return this.each(function(){var $this=$(this);$this.hasClass(class1)?$(this).removeClass(class1).addClass(class2):$(this).removeClass(class2).addClass(class1)})},$.fn.toggleExpandText=function(chars,lessText,moreText,cb){return this.each(function(){var $self=$(this),expandedText=$self.html();if(!(chars>expandedText.length)){var expanded=!1,collapsedText=expandedText.substr(0,chars);collapsedText=collapsedText.substr(0,Math.min(collapsedText.length,collapsedText.lastIndexOf(" "))),$self.toggle=function(){$self.empty();var $toggleButton=$('');expanded?($self.html(expandedText+" "),$toggleButton.text(lessText),$toggleButton.toggleClass("less","more")):($self.html(collapsedText+" "),$toggleButton.text(moreText),$toggleButton.toggleClass("more","less")),$toggleButton.one("click",function(e){e.preventDefault(),$self.toggle()}),expanded=!expanded,$self.append($toggleButton),cb&&cb()},$self.toggle()}})},$.fn.toggleExpandTextByLines=function(lines,lessText,moreText,cb){return this.each(function(){for(var $self=$(this),expandedText=$self.html(),$buttonPad=$('morepad'),stringsByLine=[expandedText],lastHeight=$self.height();$self.text().length>0;){$self.removeLastWord();var html=$self.html();$self.append($buttonPad),lastHeight>$self.height()&&(stringsByLine.unshift(html),lastHeight=$self.height()),$buttonPad.remove()}if(stringsByLine.length<=lines)return void $self.html(expandedText);var collapsedText=stringsByLine[lines-1],expanded=!1;$self.toggle=function(){$self.empty();var $toggleButton=$('');expanded?($self.html(expandedText+" "),$toggleButton.text(lessText),$toggleButton.toggleClass("less","more")):($self.html(collapsedText+"… "),$toggleButton.text(moreText),$toggleButton.toggleClass("more","less")),$toggleButton.one("click",function(e){e.preventDefault(),$self.toggle()}),expanded=!expanded,$self.append($toggleButton),cb&&cb()},$self.toggle()})},$.fn.toggleText=function(text1,text2){return this.each(function(){var $this=$(this);$this.text()===text1?$(this).text(text2):$(this).text(text1)})},$.fn.updateAttr=function(attrName,oldVal,newVal){return this.each(function(){var $this=$(this),attr=$this.attr(attrName);attr&&0===attr.indexOf(oldVal)&&(attr=attr.replace(oldVal,newVal),$this.attr(attrName,attr))})},$.fn.verticalMargins=function(){var $self=$(this);return parseInt($self.css("marginTop"))+parseInt($self.css("marginBottom"))},$.fn.verticalPadding=function(){var $self=$(this);return parseInt($self.css("paddingTop"))+parseInt($self.css("paddingBottom"))}}(jQuery),!function(a){var b=null;a.initPubSub=function(){b=a({})},a.subscribe=function(){b||a.initPubSub(),b.on.apply(b,arguments)},a.unsubscribe=function(){b||a.initPubSub(),b.off.apply(b,arguments)},a.disposePubSub=function(){b=null},a.publish=function(){b||a.initPubSub(),b.trigger.apply(b,arguments)}}(jQuery);var KeyCodes;!function(KeyCodes){var KeyDown;!function(KeyDown){KeyDown.Backspace=8,KeyDown.Tab=9,KeyDown.Enter=13,KeyDown.Shift=16,KeyDown.Ctrl=17,KeyDown.Alt=18,KeyDown.PauseBreak=19,KeyDown.CapsLock=20,KeyDown.Escape=27,KeyDown.Spacebar=32,KeyDown.PageUp=33,KeyDown.PageDown=34,KeyDown.End=35,KeyDown.Home=36,KeyDown.LeftArrow=37,KeyDown.UpArrow=38,KeyDown.RightArrow=39,KeyDown.DownArrow=40,KeyDown.PrintScrn=44,KeyDown.Insert=45,KeyDown.Delete=46,KeyDown.Zero=48,KeyDown.One=49,KeyDown.Two=50,KeyDown.Three=51,KeyDown.Four=52,KeyDown.Five=53,KeyDown.Six=54,KeyDown.Seven=55,KeyDown.Eight=56,KeyDown.Nine=57,KeyDown.a=65,KeyDown.b=66,KeyDown.c=67,KeyDown.d=68,KeyDown.e=69,KeyDown.f=70,KeyDown.g=71,KeyDown.h=72,KeyDown.i=73,KeyDown.j=74,KeyDown.k=75,KeyDown.l=76,KeyDown.m=77,KeyDown.n=78,KeyDown.o=79,KeyDown.p=80,KeyDown.q=81,KeyDown.r=82,KeyDown.s=83,KeyDown.t=84,KeyDown.u=85,KeyDown.v=86,KeyDown.w=87,KeyDown.x=88,KeyDown.y=89,KeyDown.z=90,KeyDown.LeftWindowKey=91,KeyDown.RightWindowKey=92,KeyDown.SelectKey=93,KeyDown.Numpad0=96,KeyDown.Numpad1=97,KeyDown.Numpad2=98,KeyDown.Numpad3=99,KeyDown.Numpad4=100,KeyDown.Numpad5=101,KeyDown.Numpad6=102,KeyDown.Numpad7=103,KeyDown.Numpad8=104,KeyDown.Numpad9=105,KeyDown.Multiply=106,KeyDown.NumpadPlus=107,KeyDown.NumpadMinus=109,KeyDown.DecimalPoint=110,KeyDown.Divide=111,KeyDown.F1=112,KeyDown.F2=113,KeyDown.F3=114,KeyDown.F4=115,KeyDown.F5=116,KeyDown.F6=117,KeyDown.F7=118,KeyDown.F8=119,KeyDown.F9=120,KeyDown.F10=121,KeyDown.F11=122,KeyDown.F12=123, -KeyDown.NumLock=144,KeyDown.ScrollLock=145,KeyDown.Semicolon=186,KeyDown.Equals=187,KeyDown.Comma=188,KeyDown.LessThan=188,KeyDown.Dash=189,KeyDown.Period=190,KeyDown.GreaterThan=190,KeyDown.ForwardSlash=191,KeyDown.QuestionMark=191,KeyDown.GraveAccent=192,KeyDown.Tilde=192,KeyDown.OpenCurlyBracket=219,KeyDown.OpenSquareBracket=219,KeyDown.BackSlash=220,KeyDown.VerticalPipe=220,KeyDown.CloseCurlyBracket=221,KeyDown.CloseSquareBracket=221,KeyDown.Quote=222,KeyDown.CommandFF=224}(KeyDown=KeyCodes.KeyDown||(KeyCodes.KeyDown={}))}(KeyCodes||(KeyCodes={}));var KeyCodes;!function(KeyCodes){var KeyPress;!function(KeyPress){KeyPress.Backspace=8,KeyPress.Enter=13,KeyPress.Spacebar=32,KeyPress.Hash=35,KeyPress.GraveAccent=39,KeyPress.ForwardSlash=32,KeyPress.Asterisk=42,KeyPress.Plus=43,KeyPress.Comma=44,KeyPress.Minus=45,KeyPress.Period=46,KeyPress.ForwardSlash=47,KeyPress.Zero=48,KeyPress.One=49,KeyPress.Two=50,KeyPress.Three=51,KeyPress.Four=52,KeyPress.Five=53,KeyPress.Six=54,KeyPress.Seven=55,KeyPress.Eight=56,KeyPress.Nine=57,KeyPress.Colon=58,KeyPress.Semicolon=59,KeyPress.LessThan=60,KeyPress.Equals=61,KeyPress.GreaterThan=62,KeyPress.QuestionMark=63,KeyPress.At=64,KeyPress.OpenSquareBracket=91,KeyPress.BackSlash=92,KeyPress.CloseSquareBracket=93,KeyPress.a=97,KeyPress.b=98,KeyPress.c=99,KeyPress.d=100,KeyPress.e=101,KeyPress.f=102,KeyPress.g=103,KeyPress.h=104,KeyPress.i=105,KeyPress.j=106,KeyPress.k=107,KeyPress.l=108,KeyPress.m=109,KeyPress.n=110,KeyPress.o=111,KeyPress.p=112,KeyPress.q=113,KeyPress.r=114,KeyPress.s=115,KeyPress.t=116,KeyPress.u=117,KeyPress.v=118,KeyPress.w=119,KeyPress.x=120,KeyPress.y=121,KeyPress.z=122,KeyPress.OpenCurlyBracket=123,KeyPress.VerticalPipe=124,KeyPress.CloseCurlyBracket=125,KeyPress.Tilde=126}(KeyPress=KeyCodes.KeyPress||(KeyCodes.KeyPress={}))}(KeyCodes||(KeyCodes={}));var exjs;!function(r){r.version="0.4.0"}(exjs||(exjs={}));var exjs;!function(r){Array.isArray||(Array.isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)})}(exjs||(exjs={}));var exjs;!function(r){var e=function(){function r(){}return r.prototype.getEnumerator=function(){return{moveNext:function(){return!1},current:void 0}},r.prototype.aggregate=function(r,e){for(var t=r,n=this.getEnumerator();n.moveNext();)t=e(t,n.current);return t},r.prototype.all=function(r){if(r)for(var e=this.getEnumerator(),t=0;e.moveNext();){if(!r(e.current,t))return!1;t++}return!0},r.prototype.any=function(r){for(var e=this.getEnumerator(),t=0;e.moveNext();){if(!r)return!0;if(r(e.current,t))return!0;t++}return!1},r.prototype.append=function(){for(var r=[],e=0;e-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;u>t;t++)r.call(e,o[t],n[t],this)},e.prototype.get=function(r){var e=this._keys.indexOf(r);return this._values[e]},e.prototype.has=function(r){return this._keys.indexOf(r)>-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(2>o){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){r.call(this),this.getEnumerator=function(){return e(t)},this.toArray=function(){return t.slice(0)}}return __extends(t,r),t}(r.Enumerable);try{Object.defineProperty(Array.prototype,"en",{value:t,enumerable:!1,writable:!1,configurable:!1})}catch(o){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;i>u&&!c;u++)c=!!e(n[u],t.current);if(!c)return n.push(o.current=t.current),!0}return!1}};return o}r.Enumerable.prototype.distinct=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.distinct=r.Enumerable.prototype.distinct)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,t){t=t||function(r,e){return r===e};var n,o={current:void 0,moveNext:function(){for(n||(n=r.getEnumerator()),o.current=void 0;n.moveNext();){for(var u=!1,i=e.getEnumerator();i.moveNext()&&!u;)u=t(n.current,i.current);if(!u)return o.current=n.current,!0}return!1}};return o}r.Enumerable.prototype.except=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.except=r.Enumerable.prototype.except)}(exjs||(exjs={})),Function.prototype.fromJson=function(r,e){function t(r,e){if(null==r)return r;if(e instanceof Function)return e(r);if(e instanceof Array){if(e=e[0],!(e instanceof Function&&r instanceof Array))return;for(var t=[],n=0;n-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,s=i.length;s>p;p++)if(t(o,i[p])){a=p;break}var f;0>a?(i.push(o),u.push(f=new n(o))):f=u[a],f._add(c.current)}return u}var n=function(r){function e(e){var t=this;r.call(this),this.key=e,this._arr=[],this.getEnumerator=function(){return t._arr.en().getEnumerator()}}return __extends(e,r),e.prototype._add=function(r){this._arr.push(r)},e}(r.Enumerable);r.Enumerable.prototype.groupBy=function(t,n){var o=this,u=new r.Enumerable;return u.getEnumerator=function(){return e(o,t,n)},u},r.List&&(r.List.prototype.groupBy=r.Enumerable.prototype.groupBy)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u={current:void 0,moveNext:function(){for(o||(o=r.en(e).distinct().getEnumerator()),u.current=void 0;o.moveNext();){for(var i=!1,c=t.getEnumerator();c.moveNext()&&!i;)i=n(o.current,c.current);if(i)return u.current=o.current,!0}return!1}};return u}r.Enumerable.prototype.intersect=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.intersect=r.Enumerable.prototype.intersect)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n,o,u,i){i=i||function(r,e){return r===e};var c,a,p=0,s={current:void 0,moveNext:function(){if(s.current=void 0,!c){if(c=e.getEnumerator(),!c.moveNext())return!1;a=r.en(t).toArray()}var f;do{for(;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){e.call(this),this.Source=r,o=o||function(r,e){return r>e?1:e>r?-1:0};var u=n===!0?-1:1;this.Sorter=function(r,e){return u*o(t(r),t(e))}}return __extends(t,e),t.prototype.getEnumerator=function(){var e,t=this.Source,n=this.Sorter,o=0,u={current:void 0,moveNext:function(){return e||(e=r.en(t).toArray(),e.sort(n)),u.current=void 0,!(o>=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){r.call(this,e,t,n,o);var u=e.Sorter,i=this.Sorter;this.Sorter=function(r,e){return u(r,e)||i(r,e)}}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(2>o){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;e>o;o++)if(!t.moveNext())return!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}function t(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;t.moveNext();o++)if(!e(n.current=t.current,o))return!0;return n.current=void 0,!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}r.Enumerable.prototype.skip=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.skipWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.skip=r.Enumerable.prototype.skip,r.List.prototype.skipWhile=r.Enumerable.prototype.skipWhile)}(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()),n++,!(n>e)&&(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,s=i.length;s>a&&!p;a++)p=n(i[a],u.current);if(!p)return c.current=u.current,!0}return!1}};return c}r.Enumerable.prototype.union=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.union=r.Enumerable.prototype.union)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){t||(t=r.getEnumerator());for(var o;t.moveNext();)if(e(o=t.current))return n.current=o,!0;return!1}};return n}r.Enumerable.prototype.where=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.where=r.Enumerable.prototype.where)}(exjs||(exjs={}));var exjs;!function(r){function e(e){var n=new r.Enumerable;return n.getEnumerator=function(){return t(e)},n}function t(r){var e=r.getEnumerator(),t={current:void 0,moveNext:void 0};return t.moveNext=function(){return e.moveNext()?(t.current=e.current,!0):(t.current=void 0,!1)},t}r.en=e}(exjs||(exjs={}));var ex=exjs.en,exjs;!function(r){function e(r,e,t){var n,o,u={current:void 0,moveNext:function(){return n||(n=r.getEnumerator()),o||(o=e.getEnumerator()),u.current=void 0,!(!n.moveNext()||!o.moveNext())&&(u.current=t(n.current,o.current),!0)}};return u}r.Enumerable.prototype.zip=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.zip=r.Enumerable.prototype.zip)}(exjs||(exjs={})),Array.prototype.clone||(Array.prototype.clone=function(){return this.slice(0)}),Array.prototype.contains||(Array.prototype.contains=function(val){return-1!==this.indexOf(val)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(searchElement,fromIndex){var i=fromIndex||0,j=this.length;for(i;j>i;i++)if(this[i]===searchElement)return i;return-1}),Array.prototype.indexOfTest=function(test,fromIndex){var i=fromIndex||0,j=this.length;for(i;j>i;i++)if(test(this[i]))return i;return-1},Array.prototype.insert=function(item,index){this.splice(index,0,item)},Array.prototype.last||(Array.prototype.last=function(){return this[this.length-1]}),Array.prototype.move=function(fromIndex,toIndex){this.splice(toIndex,0,this.splice(fromIndex,1)[0])},Array.prototype.remove=function(item){var index=this.indexOf(item);index>-1&&this.splice(index,1)},Array.prototype.removeAt=function(index){this.splice(index,1)},Math.clamp=function(value,min,max){return Math.min(Math.max(value,min),max)},Math.constrain=function(value,low,high){return Math.clamp(value,low,high)},Math.degreesToRadians=function(degrees){return Math.TAU*(degrees/360)},Math.distanceBetween=function(x1,y1,x2,y2){return Math.sqrt(Math.sq(x2-x1)+Math.sq(y2-y1))},Math.lerp=function(start,stop,amount){return start+(stop-start)*amount},Math.mag=function(a,b,c){return Math.sqrt(a*a+b*b+c*c)},Math.map=function(value,start1,stop1,start2,stop2){return start2+(stop2-start2)*((value-start1)/(stop1-start1))},Math.median=function(values){values.sort(function(a,b){return a-b});var half=Math.floor(values.length/2);return values.length%2?values[half]:(values[half-1]+values[half])/2},Math.normalise=function(num,min,max){return(num-min)/(max-min)},Math.radiansToDegrees=function(radians){return 360*radians/Math.TAU},Math.randomBetween=function(low,high){return high||(high=low,low=0),low>=high?low:low+(high-low)*Math.random()},Math.roundToDecimalPlace=function(num,dec){return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec)},Math.sq=function(n){return n*n},Math.TAU=2*Math.PI,Number.prototype.isInteger||(Number.prototype.isInteger=function(){return this%1===0}),"function"!=typeof Object.create&&(Object.create=function(o,props){function F(){}F.prototype=o;var result=new F;if("object"==typeof props)for(var prop in props)props.hasOwnProperty(prop)&&(result[prop]=props[prop].value);return result}),Object.keys||(Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if("object"!=typeof obj&&"function"!=typeof obj||null===obj)throw new TypeError("Object.keys called on non-object");var result=[];for(var prop in obj)hasOwnProperty.call(obj,prop)&&result.push(prop);if(hasDontEnumBug)for(var i=0;dontEnumsLength>i;i++)hasOwnProperty.call(obj,dontEnums[i])&&result.push(dontEnums[i]);return result}}()),String.prototype.b64_to_utf8=function(){return decodeURIComponent(escape(window.atob(this)))},String.prototype.contains=function(str){return-1!==this.indexOf(str)},String.prototype.endsWith||(String.prototype.endsWith=function(str){return-1!==this.indexOf(str,this.length-str.length)}),String.format=function(){for(var s=arguments[0],i=0;ii;i++)chr=this.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return hash.toString()},String.prototype.isAlphanumeric=function(){return/^[a-zA-Z0-9]*$/.test(this)},String.prototype.ltrim=function(){return this.replace(/^\s+/,"")},String.prototype.rtrim=function(){return this.replace(/\s+$/,"")},String.prototype.startsWith||(String.prototype.startsWith=function(str){return 0==this.indexOf(str)}),String.prototype.toCssClass=function(){return this.replace(/[^a-z0-9]/g,function(s){var c=s.charCodeAt(0);return 32==c?"-":c>=65&&90>=c?"_"+s.toLowerCase():"__"+("000"+c.toString(16)).slice(-4)})},String.prototype.toFileName=function(){return this.replace(/[^a-z0-9]/gi,"_").toLowerCase()},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),String.prototype.utf8_to_b64=function(){return window.btoa(unescape(encodeURIComponent(this)))};var HTTPStatusCode;!function(HTTPStatusCode){HTTPStatusCode.CONTINUE=100,HTTPStatusCode.SWITCHING_PROTOCOLS=101,HTTPStatusCode.PROCESSING=102,HTTPStatusCode.OK=200,HTTPStatusCode.CREATED=201,HTTPStatusCode.ACCEPTED=202,HTTPStatusCode.NON_AUTHORITATIVE_INFORMATION=203,HTTPStatusCode.NO_CONTENT=204,HTTPStatusCode.RESET_CONTENT=205,HTTPStatusCode.PARTIAL_CONTENT=206,HTTPStatusCode.MULTI_STATUS=207,HTTPStatusCode.MULTIPLE_CHOICES=300,HTTPStatusCode.MOVED_PERMANENTLY=301,HTTPStatusCode.MOVED_TEMPORARILY=302,HTTPStatusCode.SEE_OTHER=303,HTTPStatusCode.NOT_MODIFIED=304,HTTPStatusCode.USE_PROXY=305,HTTPStatusCode.TEMPORARY_REDIRECT=307,HTTPStatusCode.BAD_REQUEST=400,HTTPStatusCode.UNAUTHORIZED=401,HTTPStatusCode.PAYMENT_REQUIRED=402,HTTPStatusCode.FORBIDDEN=403,HTTPStatusCode.NOT_FOUND=404,HTTPStatusCode.METHOD_NOT_ALLOWED=405,HTTPStatusCode.NOT_ACCEPTABLE=406,HTTPStatusCode.PROXY_AUTHENTICATION_REQUIRED=407,HTTPStatusCode.REQUEST_TIME_OUT=408,HTTPStatusCode.CONFLICT=409,HTTPStatusCode.GONE=410,HTTPStatusCode.LENGTH_REQUIRED=411,HTTPStatusCode.PRECONDITION_FAILED=412,HTTPStatusCode.REQUEST_ENTITY_TOO_LARGE=413,HTTPStatusCode.REQUEST_URI_TOO_LARGE=414,HTTPStatusCode.UNSUPPORTED_MEDIA_TYPE=415,HTTPStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE=416,HTTPStatusCode.EXPECTATION_FAILED=417,HTTPStatusCode.IM_A_TEAPOT=418,HTTPStatusCode.UNPROCESSABLE_ENTITY=422,HTTPStatusCode.LOCKED=423,HTTPStatusCode.FAILED_DEPENDENCY=424,HTTPStatusCode.UNORDERED_COLLECTION=425,HTTPStatusCode.UPGRADE_REQUIRED=426,HTTPStatusCode.PRECONDITION_REQUIRED=428,HTTPStatusCode.TOO_MANY_REQUESTS=429,HTTPStatusCode.REQUEST_HEADER_FIELDS_TOO_LARGE=431,HTTPStatusCode.INTERNAL_SERVER_ERROR=500,HTTPStatusCode.NOT_IMPLEMENTED=501,HTTPStatusCode.BAD_GATEWAY=502,HTTPStatusCode.SERVICE_UNAVAILABLE=503,HTTPStatusCode.GATEWAY_TIME_OUT=504,HTTPStatusCode.HTTP_VERSION_NOT_SUPPORTED=505,HTTPStatusCode.VARIANT_ALSO_NEGOTIATES=506,HTTPStatusCode.INSUFFICIENT_STORAGE=507,HTTPStatusCode.BANDWIDTH_LIMIT_EXCEEDED=509,HTTPStatusCode.NOT_EXTENDED=510,HTTPStatusCode.NETWORK_AUTHENTICATION_REQUIRED=511}(HTTPStatusCode||(HTTPStatusCode={})),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{ -var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.manifesto=f()}}(function(){var define;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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}for(var i="function"==typeof require&&require,o=0;o-1||this.externalResource.data["@context"].indexOf("/1.1/context.json")>-1||this.externalResource.data["@context"].indexOf("/1/context.json")>-1)&&(quality="native");else{var images=this.getImages();if(images&&images.length){var firstImage=images[0],resource=firstImage.getResource(),services=resource.getServices();if(width||(width=resource.getWidth()),services.length){var service=services[0];id=service.id,quality=Manifesto.Utils.getImageQuality(service.getProfile())}}if(!id)return"undefined"==typeof this.__jsonld.thumbnail?null:this.__jsonld.thumbnail}size=width+",";var uri=[id,region,size,rotation,quality+".jpg"].join("/");return uri},Canvas.prototype.getImages=function(){var images=[];if(!this.__jsonld.images)return images;for(var i=0;i1},Manifest.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?new Manifesto.ViewingDirection(this.getProperty("viewingDirection")):Manifesto.ViewingDirection.LEFTTORIGHT},Manifest.prototype.getViewingHint=function(){return this.getProperty("viewingHint")?new Manifesto.ViewingHint(this.getProperty("viewingHint")):Manifesto.ViewingHint.EMPTY},Manifest}(Manifesto.IIIFResource);Manifesto.Manifest=Manifest}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var Collection=function(_super){function Collection(jsonld,options){_super.call(this,jsonld,options),this.members=[],this._collections=null,this._manifests=null,jsonld.__collection=this}return __extends(Collection,_super),Collection.prototype.getCollections=function(){return this._collections?this._collections:this._collections=this.members.en().where(function(m){return m.isCollection()}).toArray()},Collection.prototype.getManifests=function(){return this._manifests?this._manifests:this._manifests=this.members.en().where(function(m){return m.isManifest()}).toArray()},Collection.prototype.getCollectionByIndex=function(collectionIndex){var collection=this.getCollections()[collectionIndex];return collection.options.index=collectionIndex,collection.load()},Collection.prototype.getManifestByIndex=function(manifestIndex){var manifest=this.getManifests()[manifestIndex];return manifest.options.index=manifestIndex,manifest.load()},Collection.prototype.getTotalCollections=function(){return this.getCollections().length},Collection.prototype.getTotalManifests=function(){return this.getManifests().length},Collection.prototype.getTotalMembers=function(){return this.members.length},Collection.prototype.getDefaultTree=function(){return _super.prototype.getDefaultTree.call(this),this.defaultTree.data.type=Manifesto.TreeNodeType.COLLECTION.toString(),this._parseManifests(this),this._parseCollections(this),Manifesto.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},Collection.prototype._parseManifests=function(parentCollection){if(parentCollection.getManifests()&&parentCollection.getManifests().length)for(var i=0;i=0;i--){var canvas=this.getCanvasByIndex(i),label=Manifesto.TranslationCollection.getValue(canvas.getLabel(),this.options.locale);if(alphanumeric){var regExp=/^[a-zA-Z0-9]*$/;if(regExp.test(label))return label}else if(label)return label}return this.options.defaultLabel},Sequence.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},Sequence.prototype.getNextPageIndex=function(canvasIndex,pagingEnabled){var index;if(pagingEnabled){var indices=this.getPagedIndices(canvasIndex);index=this.getViewingDirection().toString()===Manifesto.ViewingDirection.RIGHTTOLEFT.toString()?indices[0]+1:_last(indices)+1}else index=canvasIndex+1;return index>this.getLastPageIndex()?-1:index},Sequence.prototype.getPagedIndices=function(canvasIndex,pagingEnabled){var indices=[];return pagingEnabled?(indices=this.isFirstCanvas(canvasIndex)||this.isLastCanvas(canvasIndex)?[canvasIndex]:canvasIndex%2?[canvasIndex,canvasIndex+1]:[canvasIndex-1,canvasIndex],this.getViewingDirection().toString()===Manifesto.ViewingDirection.RIGHTTOLEFT.toString()&&(indices=indices.reverse())):indices.push(canvasIndex),indices},Sequence.prototype.getPrevPageIndex=function(canvasIndex,pagingEnabled){var index;if(pagingEnabled){var indices=this.getPagedIndices(canvasIndex);index=this.getViewingDirection().toString()===Manifesto.ViewingDirection.RIGHTTOLEFT.toString()?_last(indices)-1:indices[0]-1}else index=canvasIndex-1;return index},Sequence.prototype.getStartCanvasIndex=function(){var startCanvas=this.getStartCanvas();if(startCanvas)for(var i=0;ithis.getTotalCanvases()-1},Sequence.prototype.isFirstCanvas=function(canvasIndex){return 0===canvasIndex},Sequence.prototype.isLastCanvas=function(canvasIndex){return canvasIndex===this.getTotalCanvases()-1},Sequence.prototype.isMultiCanvas=function(){return this.getTotalCanvases()>1},Sequence.prototype.isPagingEnabled=function(){return this.getViewingHint().toString()===Manifesto.ViewingHint.PAGED.toString()},Sequence.prototype.isTotalCanvasesEven=function(){return this.getTotalCanvases()%2===0},Sequence}(Manifesto.ManifestResource);Manifesto.Sequence=Sequence}(Manifesto||(Manifesto={}));var Manifesto,_isString=require("lodash.isstring");!function(Manifesto){var Deserialiser=function(){function Deserialiser(){}return Deserialiser.parse=function(manifest,options){return this.parseJson(JSON.parse(manifest),options)},Deserialiser.parseJson=function(json,options){var resource;switch(options&&options.navDate&&!isNaN(options.navDate.getTime())&&(json.navDate=options.navDate.toString()),json["@type"]){case"sc:Collection":resource=this.parseCollection(json,options);break;case"sc:Manifest":resource=this.parseManifest(json,options);break;default:return null}return resource.isLoaded=!0,resource},Deserialiser.parseCollection=function(json,options){var collection=new Manifesto.Collection(json,options);return options?collection.index=options.index||0:collection.index=0,this.parseCollections(collection,options),this.parseManifests(collection,options),this.parseMembers(collection,options),collection},Deserialiser.parseCollections=function(collection,options){var children=collection.__jsonld.collections;if(children)for(var i=0;i=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(length){return+length!=length&&(length=0),Buffer.alloc(+length)}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"binary":case"raw":case"raws":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if((void 0===start||start<0)&&(start=0),start>this.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if(end>>>=0,start>>>=0,end<=start)return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function arrayIndexOf(arr,val,byteOffset,encoding){function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}var indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&(encoding=String(encoding).toLowerCase(),"ucs2"===encoding||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}for(var foundIndex=-1,i=byteOffset;iremaining&&(length=remaining)):length=remaining;var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128===(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte,tempCodePoint>127&&(codePoint=tempCodePoint));break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128===(192&secondByte)&&128===(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte,tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint));break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128===(192&secondByte)&&128===(192&thirdByte)&&128===(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte,tempCodePoint>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint))}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;ilen)&&(end=len);for(var out="",i=start;ilength)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!==0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}function isnan(val){return val!==val}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(arr){return arr.__proto__=Buffer.prototype,arr},Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)},Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),""},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(start>>>=0,end>>>=0,thisStart>>>=0,thisEnd>>>=0,this===target)return 0;for(var x=thisEnd-thisStart,y=end-start,len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;i2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset>>=0,0===this.length)return-1;if(byteOffset>=this.length)return-1;if(byteOffset<0&&(byteOffset=Math.max(this.length+byteOffset,0)),"string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(this,val,byteOffset,encoding);if("number"==typeof val)return Buffer.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,val,byteOffset):arrayIndexOf(this,[val],byteOffset,encoding);throw new TypeError("val must be string, number or Buffer")},Buffer.prototype.includes=function(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else{if(!isFinite(offset))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");offset=0|offset,isFinite(length)?(length=0|length,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0)}var remaining=this.length-offset;if((void 0===length||length>remaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"binary":return binaryWrite(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start,end=void 0===end?len:~~end,start<0?(start+=len,start<0&&(start=0)):start>len&&(start=len),end<0?(end+=len,end<0&&(end=0)):end>len&&(end=len),end0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?(255-this[offset]+1)*-1:this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,byteLength=0|byteLength,!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1,i=0;for(this[offset]=255&value;++i=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){ -return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,end=void 0===end?this.length:end>>>0,val||(val=0);var i;if("number"==typeof val)for(i=start;i0)throw new Error("Invalid string. Length must be a multiple of 4");placeHolders="="===b64[len-2]?2:"="===b64[len-1]?1:0,arr=new Arr(3*len/4-placeHolders),l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i>16&255,arr[L++]=tmp>>8&255,arr[L++]=255&tmp;return 2===placeHolders?(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[L++]=255&tmp):1===placeHolders&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[L++]=tmp>>8&255,arr[L++]=255&tmp),arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]}function encodeChunk(uint8,start,end){for(var tmp,output=[],i=start;ilen2?len2:i+maxChunkLength));return 1===extraBytes?(tmp=uint8[len-1],output+=lookup[tmp>>2],output+=lookup[tmp<<4&63],output+="=="):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],output+=lookup[tmp>>10],output+=lookup[tmp>>4&63],output+=lookup[tmp<<2&63],output+="="),parts.push(output),parts.join("")}exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array;init()},{}],5:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:(s?-1:1)*(1/0);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias),value*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],6:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},{}],7:[function(require,module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;var err=new Error('Uncaught, unspecified "error" event. ('+er+")");throw err.context=er,err}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),len=listeners.length,i=0;i0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],8:[function(require,module,exports){var http=require("http"),https=module.exports;for(var key in http)http.hasOwnProperty(key)&&(https[key]=http[key]);https.request=function(params,cb){return params||(params={}),params.scheme="https",params.protocol="https:",http.request.call(this,params,cb)}},{http:27}],9:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],10:[function(require,module,exports){module.exports=function(obj){return!(null==obj||!(obj._isBuffer||obj.constructor&&"function"==typeof obj.constructor.isBuffer&&obj.constructor.isBuffer(obj)))}},{}],11:[function(require,module,exports){function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=cachedSetTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex1)for(var i=1;i1&&(result=parts[0]+"@",string=parts[1]),string=string.replace(regexSeparators,".");var labels=string.split("."),encoded=map(labels,fn).join(".");return result+encoded}function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter=55296&&value<=56319&&counter65535&&(value-=65536,output+=stringFromCharCode(value>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value)}).join("")}function basicToDigit(codePoint){return codePoint-48<10?codePoint-22:codePoint-65<26?codePoint-65:codePoint-97<26?codePoint-97:base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((0!=flag)<<5)}function adapt(delta,numPoints,firstTime){var k=0;for(delta=firstTime?floor(delta/damp):delta>>1,delta+=floor(delta/numPoints);delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var out,basic,j,index,oldi,w,k,digit,t,baseMinusT,output=[],inputLength=input.length,i=0,n=initialN,bias=initialBias;for(basic=input.lastIndexOf(delimiter),basic<0&&(basic=0),j=0;j=128&&error("not-basic"),output.push(input.charCodeAt(j));for(index=basic>0?basic+1:0;index=inputLength&&error("invalid-input"),digit=basicToDigit(input.charCodeAt(index++)),(digit>=base||digit>floor((maxInt-i)/w))&&error("overflow"),i+=digit*w,t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(digitfloor(maxInt/baseMinusT)&&error("overflow"),w*=baseMinusT;out=output.length+1,bias=adapt(i-oldi,out,0==oldi),floor(i/out)>maxInt-n&&error("overflow"),n+=floor(i/out),i%=out,output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,inputLength,handledCPCountPlusOne,baseMinusT,qMinusT,output=[];for(input=ucs2decode(input),inputLength=input.length,n=initialN,delta=0,bias=initialBias,j=0;j=n&¤tValuefloor((maxInt-delta)/handledCPCountPlusOne)&&error("overflow"),delta+=(m-n)*handledCPCountPlusOne,n=m,j=0;jmaxInt&&error("overflow"),currentValue==n){for(q=delta,k=base;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;if(punycode={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return punycode});else if(freeExports&&freeModule)if(module.exports==freeExports)freeModule.exports=punycode;else for(key in punycode)punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);else root.punycode=punycode}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;i=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],14:[function(require,module,exports){"use strict";function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i0)if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var _e=new Error("stream.unshift() after end event");stream.emit("error",_e)}else{var skipAdd;!state.decoder||addToFront||encoding||(chunk=state.decoder.write(chunk),skipAdd=!state.objectMode&&0===chunk.length),addToFront||(state.reading=!1),skipAdd||(state.flowing&&0===state.length&&!state.sync?(stream.emit("data",chunk),stream.read(0)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream))),maybeReadMore(stream,state)}else addToFront||(state.reading=!1);return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function howMuchToRead(n,state){return 0===state.length&&state.ended?0:state.objectMode?0===n?0:1:null===n||isNaN(n)?state.flowing&&state.buffer.length?state.buffer[0].length:state.length:n<=0?0:(n>state.highWaterMark&&(state.highWaterMark=computeNewHighWaterMark(n)),n>state.length?state.ended?state.length:(state.needReadable=!0,0):n)}function chunkInvalid(state,chunk){var er=null;return Buffer.isBuffer(chunk)||"string"==typeof chunk||null===chunk||void 0===chunk||state.objectMode||(er=new TypeError("Invalid non-string/buffer chunk")),er}function onEofChunk(stream,state){if(!state.ended){if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,emitReadable(stream)}}function emitReadable(stream){var state=stream._readableState;state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,state.sync?processNextTick(emitReadable_,stream):emitReadable_(stream))}function emitReadable_(stream){debug("emit readable"),stream.emit("readable"),flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,processNextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(var len=state.length;!state.reading&&!state.flowing&&!state.ended&&state.length=length)ret=stringMode?list.join(""):1===list.length?list[0]:Buffer.concat(list,length),list.length=0;else if(n0)throw new Error('"endReadable()" called on non-empty stream');state.endEmitted||(state.ended=!0,processNextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){state.endEmitted||0!==state.length||(state.endEmitted=!0,stream.readable=!1,stream.emit("end"))}function forEach(xs,f){for(var i=0,l=xs.length;i0)&&(state.emittedReadable=!1),0===n&&state.needReadable&&(state.length>=state.highWaterMark||state.ended))return debug("read: emitReadable",state.length,state.ended),0===state.length&&state.ended?endReadable(this):emitReadable(this),null;if(n=howMuchToRead(n,state),0===n&&state.ended)return 0===state.length&&endReadable(this),null;var doRead=state.needReadable;debug("need readable",doRead),(0===state.length||state.length-n0?fromList(n,state):null,null===ret&&(state.needReadable=!0,n=0),state.length-=n,0!==state.length||state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&0===state.length&&endReadable(this),null!==ret&&this.emit("data",ret),ret},Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))},Readable.prototype.pipe=function(dest,pipeOpts){function onunpipe(readable){debug("onunpipe"),readable===src&&cleanup()}function onend(){debug("onend"),dest.end()}function cleanup(){debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",cleanup),src.removeListener("data",ondata),cleanedUp=!0,!state.awaitDrain||dest._writableState&&!dest._writableState.needDrain||ondrain()}function ondata(chunk){debug("ondata");var ret=dest.write(chunk);!1===ret&&((1===state.pipesCount&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp&&(debug("false write response, pause",src._readableState.awaitDrain),src._readableState.awaitDrain++),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror), -0===EElistenerCount(dest,"error")&&dest.emit("error",er)}function onclose(){dest.removeListener("finish",onfinish),unpipe()}function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}function unpipe(){debug("unpipe"),src.unpipe(dest)}var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest)}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==!1)&&dest!==process.stdout&&dest!==process.stderr,endFn=doEnd?onend:cleanup;state.endEmitted?processNextTick(endFn):src.once("end",endFn),dest.on("unpipe",onunpipe);var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=!1;return src.on("data",ondata),prependListener(dest,"error",onerror),dest.once("close",onclose),dest.once("finish",onfinish),dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest},Readable.prototype.unpipe=function(dest){var state=this._readableState;if(0===state.pipesCount)return this;if(1===state.pipesCount)return dest&&dest!==state.pipes?this:(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this),this);if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var _i=0;_i-1?setImmediate:processNextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var Stream,internalUtil={deprecate:require("util-deprecate")};!function(){try{Stream=require("stream")}catch(_){}finally{Stream||(Stream=require("events").EventEmitter)}}();var Buffer=require("buffer").Buffer,bufferShim=require("buffer-shims");util.inherits(Writable,Stream);var Duplex;WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(_){}}();var Duplex;Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1;return"function"==typeof encoding&&(cb=encoding,encoding=null),Buffer.isBuffer(chunk)?encoding="buffer":encoding||(encoding=state.defaultEncoding),"function"!=typeof cb&&(cb=nop),state.ended?writeAfterEnd(this,cb):validChunk(this,state,chunk,cb)&&(state.pendingcb++,ret=writeOrBuffer(this,state,chunk,encoding,cb)),ret},Writable.prototype.cork=function(){var state=this._writableState;state.corked++},Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,state.writing||state.corked||state.finished||state.bufferProcessing||!state.bufferedRequest||clearBuffer(this,state))},Writable.prototype.setDefaultEncoding=function(encoding){if("string"==typeof encoding&&(encoding=encoding.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);return this._writableState.defaultEncoding=encoding,this},Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;"function"==typeof chunk?(cb=chunk,chunk=null,encoding=null):"function"==typeof encoding&&(cb=encoding,encoding=null),null!==chunk&&void 0!==chunk&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||state.finished||endWritable(this,state,cb)}}).call(this,require("_process"))},{"./_stream_duplex":16,_process:11,buffer:3,"buffer-shims":21,"core-util-is":22,events:7,inherits:9,"process-nextick-args":24,"util-deprecate":25}],21:[function(require,module,exports){(function(global){"use strict";var buffer=require("buffer"),Buffer=buffer.Buffer,SlowBuffer=buffer.SlowBuffer,MAX_LEN=buffer.kMaxLength||2147483647;exports.alloc=function(size,fill,encoding){if("function"==typeof Buffer.alloc)return Buffer.alloc(size,fill,encoding);if("number"==typeof encoding)throw new TypeError("encoding must not be number");if("number"!=typeof size)throw new TypeError("size must be a number");if(size>MAX_LEN)throw new RangeError("size is too large");var enc=encoding,_fill=fill;void 0===_fill&&(enc=void 0,_fill=0);var buf=new Buffer(size);if("string"==typeof _fill)for(var fillBuf=new Buffer(_fill,enc),flen=fillBuf.length,i=-1;++iMAX_LEN)throw new RangeError("size is too large");return new Buffer(size)},exports.from=function(value,encodingOrOffset,length){if("function"==typeof Buffer.from&&(!global.Uint8Array||Uint8Array.from!==Buffer.from))return Buffer.from(value,encodingOrOffset,length);if("number"==typeof value)throw new TypeError('"value" argument must not be a number');if("string"==typeof value)return new Buffer(value,encodingOrOffset);if("undefined"!=typeof ArrayBuffer&&value instanceof ArrayBuffer){var offset=encodingOrOffset;if(1===arguments.length)return new Buffer(value);"undefined"==typeof offset&&(offset=0);var len=length;if("undefined"==typeof len&&(len=value.byteLength-offset),offset>=value.byteLength)throw new RangeError("'offset' is out of bounds");if(len>value.byteLength-offset)throw new RangeError("'length' is out of bounds");return new Buffer(value.slice(offset,offset+len))}if(Buffer.isBuffer(value)){var out=new Buffer(value.length);return value.copy(out,0,0,value.length),out}if(value){if(Array.isArray(value)||"undefined"!=typeof ArrayBuffer&&value.buffer instanceof ArrayBuffer||"length"in value)return new Buffer(value);if("Buffer"===value.type&&Array.isArray(value.data))return new Buffer(value.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},exports.allocUnsafeSlow=function(size){if("function"==typeof Buffer.allocUnsafeSlow)return Buffer.allocUnsafeSlow(size);if("number"!=typeof size)throw new TypeError("size must be a number");if(size>=MAX_LEN)throw new RangeError("size is too large");return new SlowBuffer(size)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:3}],22:[function(require,module,exports){(function(Buffer){function isArray(arg){return Array.isArray?Array.isArray(arg):"[object Array]"===objectToString(arg)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNullOrUndefined(arg){return null==arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isSymbol(arg){return"symbol"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return"[object Date]"===objectToString(d)}function isError(e){return"[object Error]"===objectToString(e)||e instanceof Error}function isFunction(arg){return"function"==typeof arg}function isPrimitive(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||"undefined"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=Buffer.isBuffer}).call(this,{isBuffer:require("../../../../insert-module-globals/node_modules/is-buffer/index.js")})},{"../../../../insert-module-globals/node_modules/is-buffer/index.js":10}],23:[function(require,module,exports){arguments[4][6][0].apply(exports,arguments)},{dup:6}],24:[function(require,module,exports){(function(process){"use strict";function nextTick(fn,arg1,arg2,arg3){if("function"!=typeof fn)throw new TypeError('"callback" argument must be a function');var args,i,len=arguments.length;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function(){fn.call(null,arg1)});case 3:return process.nextTick(function(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function(){fn.call(null,arg1,arg2,arg3)});default:for(args=new Array(len-1),i=0;iself._pos){var newData=response.substr(self._pos);if("x-user-defined"===self._charset){for(var buffer=new Buffer(newData.length),i=0;iself._pos&&(self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))),self._pos=reader.result.byteLength)},reader.onload=function(){self.push(null)},reader.readAsArrayBuffer(response)}self._xhr.readyState===rStates.DONE&&"ms-stream"!==self._mode&&self.push(null); -}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer)},{"./capability":28,_process:11,buffer:3,inherits:9,"readable-stream":26}],31:[function(require,module,exports){module.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],32:[function(require,module,exports){var Buffer=require("buffer").Buffer;module.exports=function(buf){if(buf instanceof Uint8Array){if(0===buf.byteOffset&&buf.byteLength===buf.buffer.byteLength)return buf.buffer;if("function"==typeof buf.buffer.slice)return buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength)}if(Buffer.isBuffer(buf)){for(var arrayCopy=new Uint8Array(buf.length),len=buf.length,i=0;i=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;if(buffer.copy(this.charBuffer,this.charReceived,0,available),this.charReceived+=available,this.charReceived=55296&&charCode<=56319)){if(this.charReceived=this.charLength=0,0===buffer.length)return charStr;break}this.charLength+=this.surrogateSize,charStr=""}this.detectIncompleteChar(buffer);var end=buffer.length;this.charLength&&(buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end),end-=this.charReceived),charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1,charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;return this.charLength+=size,this.charReceived+=size,this.charBuffer.copy(this.charBuffer,size,0,size),buffer.copy(this.charBuffer,0,0,size),charStr.substring(0,end)}return charStr},StringDecoder.prototype.detectIncompleteChar=function(buffer){for(var i=buffer.length>=3?3:buffer.length;i>0;i--){var c=buffer[buffer.length-i];if(1==i&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i},StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length&&(res=this.write(buffer)),this.charReceived){var cr=this.charReceived,buf=this.charBuffer,enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res}},{buffer:3}],34:[function(require,module,exports){"use strict";function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&util.isObject(url)&&url instanceof Url)return url;var u=new Url;return u.parse(url,parseQueryString,slashesDenoteHost),u}function urlFormat(obj){return util.isString(obj)&&(obj=urlParse(obj)),obj instanceof Url?obj.format():Url.prototype.format.call(obj)}function urlResolve(source,relative){return urlParse(source,!1,!0).resolve(relative)}function urlResolveObject(source,relative){return source?urlParse(source,!1,!0).resolveObject(relative):relative}var punycode=require("punycode"),util=require("./util");exports.parse=urlParse,exports.resolve=urlResolve,exports.resolveObject=urlResolveObject,exports.format=urlFormat,exports.Url=Url;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util.isString(url))throw new TypeError("Parameter 'url' must be a string, not "+typeof url);var queryIndex=url.indexOf("?"),splitter=queryIndex!==-1&&queryIndex127?"x":part[j];if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i),notHost=hostparts.slice(i+1),bit=part.match(hostnamePartStart);bit&&(validParts.push(bit[1]),notHost.unshift(bit[2])),notHost.length&&(rest="/"+notHost.join(".")+rest),this.hostname=validParts.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),ipv6Hostname||(this.hostname=punycode.toASCII(this.hostname));var p=this.port?":"+this.port:"",h=this.hostname||"";this.host=h+p,this.href+=this.host,ipv6Hostname&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==rest[0]&&(rest="/"+rest))}if(!unsafeProtocol[lowerProto])for(var i=0,l=autoEscape.length;i0)&&result.host.split("@");authInHost&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift())}return result.search=relative.search,result.query=relative.query,util.isNull(result.pathname)&&util.isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.href=result.format(),result}if(!srcPath.length)return result.pathname=null,result.search?result.path="/"+result.search:result.path=null,result.href=result.format(),result;for(var last=srcPath.slice(-1)[0],hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&("."===last||".."===last)||""===last,up=0,i=srcPath.length;i>=0;i--)last=srcPath[i],"."===last?srcPath.splice(i,1):".."===last?(srcPath.splice(i,1),up++):up&&(srcPath.splice(i,1),up--);if(!mustEndAbs&&!removeAllDots)for(;up--;up)srcPath.unshift("..");!mustEndAbs||""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0)||srcPath.unshift(""),hasTrailingSlash&&"/"!==srcPath.join("/").substr(-1)&&srcPath.push("");var isAbsolute=""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0);if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=!!(result.host&&result.host.indexOf("@")>0)&&result.host.split("@");authInHost&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift())}return mustEndAbs=mustEndAbs||result.host&&srcPath.length,mustEndAbs&&!isAbsolute&&srcPath.unshift(""),srcPath.length?result.pathname=srcPath.join("/"):(result.pathname=null,result.path=null),util.isNull(result.pathname)&&util.isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.auth=relative.auth||result.auth,result.slashes=result.slashes||relative.slashes,result.href=result.format(),result},Url.prototype.parseHost=function(){var host=this.host,port=portPattern.exec(host);port&&(port=port[0],":"!==port&&(this.port=port.substr(1)),host=host.substr(0,host.length-port.length)),host&&(this.hostname=host)}},{"./util":35,punycode:12,querystring:15}],35:[function(require,module,exports){"use strict";module.exports={isString:function(arg){return"string"==typeof arg},isObject:function(arg){return"object"==typeof arg&&null!==arg},isNull:function(arg){return null===arg},isNullOrUndefined:function(arg){return null==arg}}},{}],36:[function(require,module,exports){function extend(){for(var target={},i=0;i2?sources[length-2]:void 0,guard=length>2?sources[2]:void 0,thisArg=length>1?sources[length-1]:void 0;for("function"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer="function"==typeof thisArg?thisArg:void 0,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?void 0:customizer,length=1);++index-1&&value%1==0&&value-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}var reIsUint=/^\d+$/,MAX_SAFE_INTEGER=9007199254740991,getLength=baseProperty("length");module.exports=isIterateeCall},{}],43:[function(require,module,exports){function restParam(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(void 0===start?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);++index-1&&value%1==0&&value-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,allowIndexes=!!length&&isLength(length)&&(isArray(object)||isArguments(object)),index=-1,result=[];++index0;++index-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,propertyIsEnumerable=objectProto.propertyIsEnumerable,getLength=baseProperty("length");module.exports=isArguments},{}],47:[function(require,module,exports){function baseClamp(number,lower,upper){return number===number&&(void 0!==upper&&(number=number<=upper?number:upper),void 0!==lower&&(number=number>=lower?number:lower)),number}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function isSymbol(value){return"symbol"==typeof value||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toInteger(value){if(!value)return 0===value?value:0;if(value=toNumber(value),value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}var remainder=value%1;return value===value?remainder?value-remainder:value:0}function toNumber(value){if(isObject(value)){var other=isFunction(value.valueOf)?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toString(value){if("string"==typeof value)return value;if(null==value)return"";if(isSymbol(value))return Symbol?symbolToString.call(value):"";var result=value+"";return"0"==result&&1/value==-INFINITY?"-0":result}function endsWith(string,target,position){string=toString(string),target="string"==typeof target?target:target+"";var length=string.length;return position=void 0===position?length:baseClamp(toInteger(position),0,length),position-=target.length,position>=0&&string.indexOf(target,position)==position}var root=require("lodash._root"),INFINITY=1/0,MAX_INTEGER=1.7976931348623157e308,NAN=NaN,funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,objectProto=Object.prototype,objectToString=objectProto.toString,Symbol=root.Symbol,symbolProto=Symbol?Symbol.prototype:void 0,symbolToString=Symbol?symbolProto.toString:void 0;module.exports=endsWith},{"lodash._root":48}],48:[function(require,module,exports){(function(global){function checkGlobal(value){return value&&value.Object===Object?value:null}var objectTypes={"function":!0,object:!0},freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType?exports:void 0,freeModule=objectTypes[typeof module]&&module&&!module.nodeType?module:void 0,freeGlobal=checkGlobal(freeExports&&freeModule&&"object"==typeof global&&global),freeSelf=checkGlobal(objectTypes[typeof self]&&self),freeWindow=checkGlobal(objectTypes[typeof window]&&window),thisGlobal=checkGlobal(objectTypes[typeof this]&&this),root=freeGlobal||freeWindow!==(thisGlobal&&thisGlobal.window)&&freeWindow||freeSelf||thisGlobal||Function("return this")();module.exports=root}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}function getNative(object,key){var value=null==object?void 0:object[key];return isNative(value)?value:void 0}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isFunction(value){return isObject(value)&&objToString.call(value)==funcTag}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isNative(value){return null!=value&&(isFunction(value)?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value))}var arrayTag="[object Array]",funcTag="[object Function]",reIsHostCtor=/^\[object .+?Constructor\]$/,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp("^"+fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nativeIsArray=getNative(Array,"isArray"),MAX_SAFE_INTEGER=9007199254740991,isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag};module.exports=isArray},{}],50:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}function isString(value){return"string"==typeof value||isObjectLike(value)&&objToString.call(value)==stringTag}var stringTag="[object String]",objectProto=Object.prototype,objToString=objectProto.toString;module.exports=isString},{}],51:[function(require,module,exports){function last(array){var length=array?array.length:0;return length?array[length-1]:void 0}module.exports=last},{}],52:[function(require,module,exports){function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];return baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)}),result}function baseProperty(key){return function(object){return null==object?void 0:object[key]}}function isArrayLike(value){return null!=value&&isLength(getLength(value))}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function map(collection,iteratee,thisArg){var func=isArray(collection)?arrayMap:baseMap;return iteratee=baseCallback(iteratee,thisArg,3),func(collection,iteratee)}var arrayMap=require("lodash._arraymap"),baseCallback=require("lodash._basecallback"),baseEach=require("lodash._baseeach"),isArray=require("lodash.isarray"),MAX_SAFE_INTEGER=9007199254740991,getLength=baseProperty("length");module.exports=map},{"lodash._arraymap":53,"lodash._basecallback":54,"lodash._baseeach":59,"lodash.isarray":49}],53:[function(require,module,exports){function arrayMap(array,iteratee){for(var index=-1,length=array.length,result=Array(length);++indexlength?0:length+start),end=void 0===end||end>length?length:+end||0,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++indexarrLength))return!1;for(;++index-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObjectLike(value){return!!value&&"object"==typeof value}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objectToString.call(value)]}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=isTypedArray},{}],57:[function(require,module,exports){arguments[4][41][0].apply(exports,arguments)},{dup:41}],58:[function(require,module,exports){function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function pairs(object){object=toObject(object);for(var index=-1,props=keys(object),length=props.length,result=Array(length);++index-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}var keys=require("lodash.keys"),MAX_SAFE_INTEGER=9007199254740991,baseEach=createBaseEach(baseForOwn),baseFor=createBaseFor(),getLength=baseProperty("length");module.exports=baseEach},{"lodash.keys":60}],60:[function(require,module,exports){arguments[4][44][0].apply(exports,arguments)},{dup:44,"lodash._getnative":61,"lodash.isarguments":62,"lodash.isarray":49}],61:[function(require,module,exports){arguments[4][45][0].apply(exports,arguments)},{dup:45}],62:[function(require,module,exports){arguments[4][46][0].apply(exports,arguments)},{dup:46}]},{},[1])(1)}),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.manifold=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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}for(var i="function"==typeof require&&require,o=0;o0&&msie<11)if(9===msie){var settings={url:that._options.iiifResourceUri,type:"GET",dataType:"jsonp",jsonp:"callback",jsonpCallback:"manifestCallback"};$.ajax(settings),window.manifestCallback=function(json){that._loaded(that,JSON.stringify(json),resolve,reject)}}else 10===msie&&$.getJSON(that._options.iiifResourceUri,function(json){that._loaded(that,JSON.stringify(json),resolve,reject)});else manifesto.loadManifest(that._options.iiifResourceUri).then(function(json){that._loaded(that,json,resolve,reject)})})},Bootstrapper.prototype._loaded=function(bootstrapper,json,resolve,reject){var iiifResource=manifesto.create(json,{locale:bootstrapper._options.locale});if(bootstrapper._options.iiifResource||(bootstrapper._options.iiifResource=iiifResource),iiifResource.getIIIFResourceType().toString()===manifesto.IIIFResourceType.collection().toString()){var collections=iiifResource.getCollections();collections&&collections.length?iiifResource.getCollectionByIndex(bootstrapper._options.collectionIndex).then(function(collection){collection||reject("Collection index not found"),0===collection.getTotalManifests()&&0===bootstrapper._options.manifestIndex&&collection.getTotalCollections()>0&&(bootstrapper._options.collectionIndex=0,bootstrapper._options.iiifResourceUri=collection.id,bootstrapper.bootstrap()),collection.getManifestByIndex(bootstrapper._options.manifestIndex).then(function(manifest){bootstrapper._options.manifest=manifest;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)})}):iiifResource.getManifestByIndex(bootstrapper._options.manifestIndex).then(function(manifest){bootstrapper._options.manifest=manifest;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)})}else{bootstrapper._options.manifest=iiifResource;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)}},Bootstrapper.prototype._msieversion=function(){var ua=window.navigator.userAgent,msie=ua.indexOf("MSIE ");return msie>0?parseInt(ua.substring(msie+5,ua.indexOf(".",msie))):0},Bootstrapper}();Manifold.Bootstrapper=Bootstrapper}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var ExternalResource=function(){function ExternalResource(resource,dataUriFunc){this.isResponseHandled=!1,resource.externalResource=this,this.dataUri=dataUriFunc(resource),this._parseAuthServices(resource)}return ExternalResource.prototype._parseAuthServices=function(resource){this.clickThroughService=manifesto.getService(resource,manifesto.ServiceProfile.clickThrough().toString()),this.loginService=manifesto.getService(resource,manifesto.ServiceProfile.login().toString()),this.restrictedService=manifesto.getService(resource,manifesto.ServiceProfile.restricted().toString()),this.clickThroughService?(this.logoutService=this.clickThroughService.getService(manifesto.ServiceProfile.logout().toString()),this.tokenService=this.clickThroughService.getService(manifesto.ServiceProfile.token().toString())):this.loginService?(this.logoutService=this.loginService.getService(manifesto.ServiceProfile.logout().toString()),this.tokenService=this.loginService.getService(manifesto.ServiceProfile.token().toString())):this.restrictedService&&(this.logoutService=this.restrictedService.getService(manifesto.ServiceProfile.logout().toString()),this.tokenService=this.restrictedService.getService(manifesto.ServiceProfile.token().toString()))},ExternalResource.prototype.isAccessControlled=function(){return!!(this.clickThroughService||this.loginService||this.restrictedService)},ExternalResource.prototype.hasServiceDescriptor=function(){return this.dataUri.endsWith("info.json")},ExternalResource.prototype.getData=function(accessToken){var that=this;return new Promise(function(resolve,reject){var type="GET";if(!that.hasServiceDescriptor()){if(!that.isAccessControlled())return that.status=HTTPStatusCode.OK,void resolve(that);type="HEAD"}$.ajax({url:that.dataUri,type:type,dataType:"json",beforeSend:function(xhr){accessToken&&xhr.setRequestHeader("Authorization","Bearer "+accessToken.accessToken)}}).done(function(data){if(data){var uri=unescape(data["@id"]);that.data=data,that._parseAuthServices(that.data),uri.endsWith("/info.json")&&(uri=uri.substr(0,uri.lastIndexOf("/")));var dataUri=that.dataUri;dataUri.endsWith("/info.json")&&(dataUri=dataUri.substr(0,dataUri.lastIndexOf("/"))),uri!==dataUri&&that.loginService?that.status=HTTPStatusCode.MOVED_TEMPORARILY:that.status=HTTPStatusCode.OK,resolve(that)}else that.status=HTTPStatusCode.OK,resolve(that)}).fail(function(error){that.status=error.status,that.error=error,error.responseJSON&&that._parseAuthServices(error.responseJSON),resolve(that)})})},ExternalResource}();Manifold.ExternalResource=ExternalResource}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var Helper=function(){function Helper(options){this.options=options,this.iiifResource=this.options.iiifResource,this.iiifResourceUri=this.options.iiifResourceUri,this.manifest=this.options.manifest,this.collectionIndex=this.options.collectionIndex||0,this.manifestIndex=this.options.manifestIndex||0,this.sequenceIndex=this.options.sequenceIndex||0,this.canvasIndex=this.options.canvasIndex||0}return Helper.prototype.getAutoCompleteService=function(){var service=this.getSearchWithinService();return service?service.getService(manifesto.ServiceProfile.autoComplete()):null},Helper.prototype.getAttribution=function(){return Manifesto.TranslationCollection.getValue(this.manifest.getAttribution())},Helper.prototype.getCanvases=function(){return this.getCurrentSequence().getCanvases()},Helper.prototype.getCanvasById=function(id){return this.getCurrentSequence().getCanvasById(id)},Helper.prototype.getCanvasesById=function(ids){for(var canvases=[],i=0;i'},metadataItem=new Manifesto.MetadataItem(this.options.locale);metadataItem.parse(item),metadataItem.isRootLevel=!0,manifestGroup.addItem(metadataItem)}return metadataGroups.push(manifestGroup),options?this._parseMetadataOptions(options,metadataGroups):metadataGroups},Helper.prototype._parseMetadataOptions=function(options,metadataGroups){var sequence=this.getCurrentSequence(),sequenceMetadata=sequence.getMetadata();if(sequenceMetadata&&sequenceMetadata.length){var sequenceGroup=new Manifold.MetadataGroup(sequence);sequenceGroup.addMetadata(sequenceMetadata),metadataGroups.push(sequenceGroup)}if(options.range){var rangeGroups=this._getRangeMetadata([],options.range);rangeGroups=rangeGroups.reverse(),metadataGroups=metadataGroups.concat(rangeGroups)}if(options.canvases&&options.canvases.length)for(var i=0;i0},Helper.prototype.isBottomToTop=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.bottomToTop().toString()},Helper.prototype.isCanvasIndexOutOfRange=function(index){return this.getCurrentSequence().isCanvasIndexOutOfRange(index)},Helper.prototype.isContinuous=function(){return this.getViewingHint().toString()===manifesto.ViewingHint.continuous().toString()},Helper.prototype.isFirstCanvas=function(index){return"undefined"!=typeof index?this.getCurrentSequence().isFirstCanvas(index):this.getCurrentSequence().isFirstCanvas(this.canvasIndex)},Helper.prototype.isHorizontallyAligned=function(){return this.isLeftToRight()||this.isRightToLeft()},Helper.prototype.isLastCanvas=function(index){return"undefined"!=typeof index?this.getCurrentSequence().isLastCanvas(index):this.getCurrentSequence().isLastCanvas(this.canvasIndex)},Helper.prototype.isLeftToRight=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.leftToRight().toString()},Helper.prototype.isMultiCanvas=function(){return this.getCurrentSequence().isMultiCanvas()},Helper.prototype.isMultiSequence=function(){return this.manifest.isMultiSequence()},Helper.prototype.isPaged=function(){return this.getViewingHint().toString()===manifesto.ViewingHint.paged().toString()},Helper.prototype.isPagingAvailable=function(){return this.isPagingEnabled()&&this.getTotalCanvases()>2},Helper.prototype.isPagingEnabled=function(){return this.getCurrentSequence().isPagingEnabled()},Helper.prototype.isRightToLeft=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.rightToLeft().toString(); -},Helper.prototype.isTopToBottom=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.topToBottom().toString()},Helper.prototype.isTotalCanvasesEven=function(){return this.getCurrentSequence().isTotalCanvasesEven()},Helper.prototype.isUIEnabled=function(name){var uiExtensions=this.manifest.getService(manifesto.ServiceProfile.uiExtensions());if(uiExtensions){var disableUI=uiExtensions.getProperty("disableUI");if(disableUI&&(disableUI.contains(name)||disableUI.contains(name.toLowerCase())))return!1}return!0},Helper.prototype.isVerticallyAligned=function(){return this.isTopToBottom()||this.isBottomToTop()},Helper.prototype.createDateNodes=function(rootNode,nodes){for(var i=0;i=n.data.startYear&&year<=n.data.endYear)return n}return null},Helper.prototype.getMonthNode=function(yearNode,month){for(var i=0;i0&&this.getAllSelectedCanvases().length===this.canvases.length},MultiSelectState.prototype.allRangesSelected=function(){return this.ranges.length>0&&this.getAllSelectedRanges().length===this.ranges.length},MultiSelectState.prototype.allSelected=function(){return this.allRangesSelected()&&this.allCanvasesSelected()},MultiSelectState.prototype.getAll=function(){return this.canvases.concat(this.ranges)},MultiSelectState.prototype.getAllSelectedCanvases=function(){return this.canvases.en().where(function(c){return c.multiSelected}).toArray()},MultiSelectState.prototype.getAllSelectedRanges=function(){return this.ranges.en().where(function(r){return r.multiSelected}).toArray()},MultiSelectState.prototype.getCanvasById=function(id){return this.canvases.en().where(function(c){return c.id===id}).first()},MultiSelectState.prototype.getCanvasesByIds=function(ids){for(var canvases=[],i=0;i'+label+""},UriLabeller}();Manifold.UriLabeller=UriLabeller}(Manifold||(Manifold={}))},{}]},{},[1])(1)}),function(t,e,o){"use strict";function r(t,e,r,p){r=r||"width";var n,l,m,c=(e.match(s)||[])[2],f="px"===c?1:d[c+"toPx"],u=/r?em/i;if(f||u.test(c)&&!p)t=f?t:"rem"===c?i:"fontSize"===r?t.parentNode||t:t,f=f||parseFloat(a(t,"fontSize")),m=parseFloat(e)*f;else{n=t.style,l=n[r];try{n[r]=e}catch(x){return 0}m=n[r]?parseFloat(a(t,r)):0,n[r]=l!==o?l:null}return m}function a(t,e){var o,n,i,l,d,c=/^top|bottom/,f=["paddingTop","paddingBottom","borderTop","borderBottom"],u=4;if(o=m?m(t)[e]:(n=t.style["pixel"+e.charAt(0).toUpperCase()+e.slice(1)])?n+"px":"fontSize"===e?r(t,"1em","left",1)+"px":t.currentStyle[e],i=(o.match(s)||[])[2],"%"===i&&p)if(c.test(e)){for(l=(d=t.parentNode||t).offsetHeight;u--;)l-=parseFloat(a(d,f[u]));o=parseFloat(o)/100*l+"px"}else o=r(t,o);else("auto"===o||i&&"px"!==i)&&m?o=0:i&&"px"!==i&&!m&&(o=r(t,o)+"px");return o}var p,n=e.createElement("test"),i=e.documentElement,l=e.defaultView,m=l&&l.getComputedStyle,s=/^(-?[\d+\.\-]+)([a-z]+|%)$/i,d={},c=[1/25.4,1/2.54,1/72,1/6],f=["mm","cm","pt","pc","in","mozmm"],u=6;for(i.appendChild(n),m&&(n.style.marginTop="1%",p="1%"===m(n).marginTop);u--;)d[f[u]+"toPx"]=c[u]?c[u]*d.inToPx:r(n,"1"+f[u]);i.removeChild(n),n=o,t.Length={toPx:r}}(this,this.document);var Utils;!function(Utils){var Async=function(){function Async(){}return Async.waitFor=function(test,successCallback,failureCallback,interval,maxTries,numTries){interval||(interval=200),maxTries||(maxTries=100),numTries||(numTries=0),numTries+=1,numTries>maxTries?failureCallback&&failureCallback():test()?successCallback():setTimeout(function(){Async.waitFor(test,successCallback,failureCallback,interval,maxTries,numTries)},interval)},Async}();Utils.Async=Async}(Utils||(Utils={}));var Utils;!function(Utils){var Bools=function(){function Bools(){}return Bools.getBool=function(val,defaultVal){return null===val||"undefined"==typeof val?defaultVal:val},Bools}();Utils.Bools=Bools}(Utils||(Utils={}));var Utils;!function(Utils){var Clipboard=function(){function Clipboard(){}return Clipboard.copy=function(text){var $tempDiv=$("
              "),brRegex=//gi;text=text.replace(brRegex,"\n"),$("body").append($tempDiv),$tempDiv.append(text);var $tempInput=$("