universalviewer
Version:
The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎
82 lines • 179 kB
JavaScript
import{a as le,c as kt,e as Ft,f as Dt,g as Ut}from"./chunk-FEXGFX4C.js";import{a as y}from"./chunk-M4MN2QTO.js";import{a as H,b as Mt,c as P,d as wt,f as Y,i as Nt,l as Ot,m as Bt,n as U,o as dt,p as St,q as G}from"./chunk-YB7AEQFU.js";import{b as V,e as j,f as Ht,g as w}from"./chunk-5XPHF4E5.js";import{c as ae,d as et}from"./chunk-L67DAW3A.js";var te=ae((ht,Lt)=>{(function(a,o){typeof ht=="object"&&typeof Lt=="object"?Lt.exports=o():typeof define=="function"&&define.amd?define("IIIFMetadataComponent",[],o):typeof ht=="object"?ht.IIIFMetadataComponent=o():a.IIIFMetadataComponent=o()})(typeof self<"u"?self:ht,function(){return function(a){var o={};function l(u){if(o[u])return o[u].exports;var i=o[u]={i:u,l:!1,exports:{}};return a[u].call(i.exports,i,i.exports,l),i.l=!0,i.exports}return l.m=a,l.c=o,l.d=function(u,i,c){l.o(u,i)||Object.defineProperty(u,i,{enumerable:!0,get:c})},l.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},l.t=function(u,i){if(1&i&&(u=l(u)),8&i||4&i&&typeof u=="object"&&u&&u.__esModule)return u;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:u}),2&i&&typeof u!="string")for(var s in u)l.d(c,s,function(m){return u[m]}.bind(null,s));return c},l.n=function(u){var i=u&&u.__esModule?function(){return u.default}:function(){return u};return l.d(i,"a",i),i},l.o=function(u,i){return Object.prototype.hasOwnProperty.call(u,i)},l.p="",l(l.s=1)}([function(a,o,l){"use strict";l.r(o),l.d(o,"Async",function(){return i}),l.d(o,"Bools",function(){return c}),l.d(o,"Clipboard",function(){return s}),l.d(o,"Colors",function(){return m}),l.d(o,"Dates",function(){return b}),l.d(o,"Device",function(){return h}),l.d(o,"Documents",function(){return f}),l.d(o,"Events",function(){return d}),l.d(o,"Files",function(){return e}),l.d(o,"Keyboard",function(){return t}),l.d(o,"Maths",function(){return n}),l.d(o,"Size",function(){return r}),l.d(o,"Dimensions",function(){return p}),l.d(o,"Numbers",function(){return v}),l.d(o,"Objects",function(){return I}),l.d(o,"Storage",function(){return x}),l.d(o,"StorageItem",function(){return O}),l.d(o,"StorageType",function(){return u}),l.d(o,"Strings",function(){return S}),l.d(o,"Urls",function(){return C});var u,i=function(){function _(){}return _.waitFor=function(g,E,T,A,L,R){A||(A=200),L||(L=100),R||(R=0),(R+=1)>L?T&&T():g()?E():setTimeout(function(){_.waitFor(g,E,T,A,L,R)},A)},_}(),c=function(){function _(){}return _.getBool=function(g,E){return g??E},_}(),s=function(){function _(){}return _.supportsCopy=function(){return document.queryCommandSupported&&document.queryCommandSupported("copy")},_.copy=function(g){g=_.convertBrToNewLine(g);var E=document.createElement("textarea");E.value=g,_.hideButKeepEnabled(E),document.body.appendChild(E),E.focus(),E.select(),document.execCommand("copy"),document.body.removeChild(E)},_.hideButKeepEnabled=function(g){g.style.position="fixed",g.style.top="0",g.style.left="0",g.style.width="2em",g.style.height="2em",g.style.padding="0",g.style.border="none",g.style.outline="none",g.style.boxShadow="none",g.style.background="transparent"},_.convertBrToNewLine=function(g){return g=g.replace(/<br\s*[\/]?>/gi,`
`)},_}(),m=function(){function _(){}return _.float32ColorToARGB=function(g){return[(4278190080&g)>>>24,(16711680&g)>>>16,(65280&g)>>>8,255&g]},_._componentToHex=function(g){var E=g.toString(16);return E.length==1?"0"+E:E},_.rgbToHexString=function(g){return _.coalesce(g),"#"+_._componentToHex(g[0])+_._componentToHex(g[1])+_._componentToHex(g[2])},_.argbToHexString=function(g){return"#"+_._componentToHex(g[0])+_._componentToHex(g[1])+_._componentToHex(g[2])+_._componentToHex(g[3])},_.coalesce=function(g){for(var E=1;E<g.length;E++)g[E]===void 0&&(g[E]=g[E-1])},_}(),b=function(){function _(){}return _.getTimeStamp=function(){return new Date().getTime()},_}(),h=function(){function _(){}return _.getPixelRatio=function(g){return(window.devicePixelRatio||1)/(g.webkitBackingStorePixelRatio||g.mozBackingStorePixelRatio||g.msBackingStorePixelRatio||g.oBackingStorePixelRatio||g.backingStorePixelRatio||1)},_.isTouch=function(){return"ontouchstart"in window||window.navigator.msMaxTouchPoints>0},_}(),f=function(){function _(){}return _.isInIFrame=function(){try{return window.self!==window.top}catch{return!0}},_.supportsFullscreen=function(){var g=document.documentElement;return(g.requestFullscreen||g.mozRequestFullScreen||g.webkitRequestFullScreen||g.msRequestFullscreen)!==void 0},_.isHidden=function(){return!!_.getHiddenProp()},_.getHiddenProp=function(){var g=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var E=0;E<g.length;E++)if(g[E]+"Hidden"in document)return g[E]+"Hidden";return null},_}(),d=function(){function _(){}return _.debounce=function(g,E){return E=E||100,function(){if(!g.debouncing){var T=Array.prototype.slice.apply(arguments);g.lastReturnVal=g.apply(window,T),g.debouncing=!0}return clearTimeout(g.debounceTimeout),g.debounceTimeout=setTimeout(function(){g.debouncing=!1},E),g.lastReturnVal}},_}(),e=function(){function _(){}return _.simplifyMimeType=function(g){switch(g){case"text/plain":return"txt";case"image/jpeg":return"jpg";case"application/msword":return"doc";case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return"docx";default:var E=g.split("/");return E[E.length-1]}},_}(),t=function(){function _(){}return _.getCharCode=function(g){return typeof g.which=="number"?g.which:g.keyCode},_}(),n=function(){function _(){}return _.normalise=function(g,E,T){return(g-E)/(T-E)},_.median=function(g){g.sort(function(T,A){return T-A});var E=Math.floor(g.length/2);return g.length%2?g[E]:(g[E-1]+g[E])/2},_.clamp=function(g,E,T){return Math.min(Math.max(g,E),T)},_}(),r=function(_,g){this.width=_,this.height=g},p=function(){function _(){}return _.fitRect=function(g,E,T,A){var L,R=0,q=0;return E/g<A/T?(R=g*(L=T/g),q=E*L):(R=g*(L=A/E),q=E*L),new r(Math.floor(R),Math.floor(q))},_.hitRect=function(g,E,T,A,L,R){return L>g&&L<g+T&&R>E&&R<E+A},_}(),v=function(){function _(){}return _.numericalInput=function(g){return g.keyCode==46||g.keyCode==8||g.keyCode==9||g.keyCode==27||g.keyCode==65&&g.ctrlKey===!0||g.keyCode>=35&&g.keyCode<=39||!(g.shiftKey||(g.keyCode<48||g.keyCode>57)&&(g.keyCode<96||g.keyCode>105))||(g.preventDefault(),!1)},_}(),I=function(){function _(){}return _.toPlainObject=function(g){g=Object(g);var E={};for(var T in g)E[T]=g[T];return E},_}(),x=function(){function _(){}return _.clear=function(g){switch(g===void 0&&(g=u.MEMORY),g){case u.MEMORY:this._memoryStorage={};break;case u.SESSION:sessionStorage.clear();break;case u.LOCAL:localStorage.clear()}},_.clearExpired=function(g){g===void 0&&(g=u.MEMORY);for(var E=this.getItems(g),T=0;T<E.length;T++){var A=E[T];this._isExpired(A)&&this.remove(A.key)}},_.get=function(g,E){E===void 0&&(E=u.MEMORY);var T=null;switch(E){case u.MEMORY:T=this._memoryStorage[g];break;case u.SESSION:T=sessionStorage.getItem(g);break;case u.LOCAL:T=localStorage.getItem(g)}if(!T)return null;var A=null;try{A=JSON.parse(T)}catch{return null}return A?this._isExpired(A)?null:(A.key=g,A):null},_._isExpired=function(g){return!(new Date().getTime()<g.expiresAt)},_.getItems=function(g){g===void 0&&(g=u.MEMORY);var E=[];switch(g){case u.MEMORY:for(var T=Object.keys(this._memoryStorage),A=0;A<T.length;A++)(R=this.get(T[A],u.MEMORY))&&E.push(R);break;case u.SESSION:for(A=0;A<sessionStorage.length;A++)(L=sessionStorage.key(A))&&(R=this.get(L,u.SESSION))&&E.push(R);break;case u.LOCAL:for(A=0;A<localStorage.length;A++){var L,R;(L=localStorage.key(A))&&(R=this.get(L,u.LOCAL))&&E.push(R)}}return E},_.remove=function(g,E){switch(E===void 0&&(E=u.MEMORY),E){case u.MEMORY:delete this._memoryStorage[g];break;case u.SESSION:sessionStorage.removeItem(g);break;case u.LOCAL:localStorage.removeItem(g)}},_.set=function(g,E,T,A){A===void 0&&(A=u.MEMORY);var L=1e3*T,R=new O;switch(R.value=E,R.expiresAt=new Date().getTime()+L,A){case u.MEMORY:this._memoryStorage[g]=JSON.stringify(R);break;case u.SESSION:sessionStorage.setItem(g,JSON.stringify(R));break;case u.LOCAL:localStorage.setItem(g,JSON.stringify(R))}return R},_._memoryStorage={},_}(),O=function(){};(function(_){_.MEMORY="memory",_.SESSION="session",_.LOCAL="local"})(u||(u={}));var S=function(){function _(){}return _.ellipsis=function(g,E){if(g.length<=E)return g;var T=g.substr(0,E),A=T.lastIndexOf(" ");return A!=-1&&(T=T.substr(0,Math.min(T.length,A))),T+"…"},_.htmlDecode=function(g){var E=document.createElement("div");return E.innerHTML=g,E.firstChild.nodeValue},_.format=function(g){for(var E=[],T=1;T<arguments.length;T++)E[T-1]=arguments[T];for(var A=0;A<E.length;A++){var L=new RegExp("\\{"+A+"\\}","gm");g=g.replace(L,E[A])}return g},_.isAlphanumeric=function(g){return/^[a-zA-Z0-9]*$/.test(g)},_.toCssClass=function(g){return g.replace(/[^a-z0-9]/g,function(E){var T=E.charCodeAt(0);return T==32?"-":T>=65&&T<=90?"_"+E.toLowerCase():"__"+("000"+T.toString(16)).slice(-4)})},_.toFileName=function(g){return g.replace(/[^a-z0-9]/gi,"_").toLowerCase()},_.utf8_to_b64=function(g){return window.btoa(unescape(encodeURIComponent(g)))},_}(),C=function(){function _(){}return _.getHashParameter=function(g,E){return E||(E=window.document),E&&E.location?this.getHashParameterFromString(g,E.location.hash):null},_.getHashParameterFromString=function(g,E){var T=new RegExp("#.*[?&]"+g+"=([^&]+)(&|$)").exec(E);return T?decodeURIComponent(T[1].replace(/\+/g," ")):null},_.setHashParameter=function(g,E,T){if(T||(T=window.document),T&&T.location){var A="#?"+this.updateURIKeyValuePair(T.location.hash.replace("#?",""),g,E),L=T.URL;L.indexOf("#")!=-1&&(L=L.substr(0,L.indexOf("#"))),T.location.replace(L+A)}},_.getQuerystringParameter=function(g,E){return E||(E=window),this.getQuerystringParameterFromString(g,E.location.search)},_.getQuerystringParameterFromString=function(g,E){g=g.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var T=new RegExp("[\\?&]"+g+"=([^&#]*)").exec(E);return T?decodeURIComponent(T[1].replace(/\+/g," ")):null},_.setQuerystringParameter=function(g,E,T){if(T||(T=window.document),T&&T.location){var A=this.updateURIKeyValuePair(T.location.hash.replace("#?",""),g,E);window.location.search=A}},_.updateURIKeyValuePair=function(g,E,T){E=encodeURIComponent(E),T=encodeURIComponent(T);var A=g.split("&");A[0]==""&&A.shift();for(var L,R=A.length;R--;)if((L=A[R].split("="))[0]==E){L[1]=T,A[R]=L.join("=");break}return R<0&&(A[A.length]=[E,T].join("=")),A.join("&")},_.getUrlParts=function(g){var E=document.createElement("a");return E.href=g,E},_.convertToRelativeUrl=function(g){var E=this.getUrlParts(g),T=E.pathname+E.searchWithin;return T.startsWith("/")||(T="/"+T),T},_}()},function(a,o,l){a.exports=l(2)},function(a,o,l){"use strict";var u,i=this&&this.__extends||(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var p in r)Object.prototype.hasOwnProperty.call(r,p)&&(n[p]=r[p])})(e,t)},function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}u(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(o,"__esModule",{value:!0}),o.Events=o.MetadataComponent=o.LimitType=void 0;var c,s=l(3),m=l(4),b=l(0),h=l(5);(function(e){e.LINES="lines",e.CHARS="chars"})(c||(o.LimitType=c={}));var f=function(e){function t(n){var r=e.call(this,n)||this;return r._data=r.data(),r._data=r.options.data,r._init(),r._resize(),r}return i(t,e),t.prototype._init=function(){return e.prototype._init.call(this),this._$element=$(this.el),this._$metadataGroupTemplate=$('<div class="group"> <div class="header"></div> <div class="items"></div> </div>'),this._$metadataItemTemplate=$('<div class="item"> <div class="label"></div> <div class="values"></div> </div>'),this._$metadataItemValueTemplate=$('<div class="value"></div>'),this._$metadataItemURIValueTemplate=$('<a class="value" href="" target="_blank"></a>'),this._$copyTextTemplate=$('<div class="copyText" alt="'+this.options.data.content.copyToClipboard+'" title="'+this.options.data.content.copyToClipboard+'"> <div class="copiedText">'+this.options.data.content.copiedToClipboard+" </div> </div>"),this._$metadataGroups=$('<div class="groups"></div>'),this._$element.append(this._$metadataGroups),this._$noData=$('<div class="noData">'+this.options.data.content.noData+"</div>"),this._$element.append(this._$noData),!0},t.prototype.data=function(){return{aggregateValues:"",canvases:null,canvasDisplayOrder:"",metadataGroupOrder:"",canvasExclude:"",canvasLabels:"",content:{attribution:"Attribution",canvasHeader:"About the canvas",copiedToClipboard:"Copied to clipboard",copyToClipboard:"Copy to clipboard",description:"Description",imageHeader:"About the image",less:"less",lessAriaLabelTemplate:"Less information: Hide {0}",license:"License",rights:"Rights",logo:"Logo",manifestHeader:"About the item",more:"more",moreAriaLabelTemplate:"More information: Reveal {0}",noData:"No data to display",rangeHeader:"About the range",sequenceHeader:"About the sequence"},copiedMessageDuration:2e3,copyToClipboardEnabled:!1,helper:null,licenseFormatter:null,limit:4,limitType:c.LINES,limitToRange:!1,manifestDisplayOrder:"",manifestExclude:"",range:null,rtlLanguageCodes:"ar, ara, dv, div, he, heb, ur, urd",sanitizer:function(n){return n},showAllLanguages:!1}},t.prototype._getManifestGroup=function(){return this._metadataGroups.filter(function(n){return n.resource.isManifest()})[0]},t.prototype._getCanvasGroups=function(){return this._metadataGroups.filter(function(n){return n.resource.isCanvas()})},t.prototype.set=function(n){var r=this;if(this._data=Object.assign(this._data,n),this._data&&this._data.helper){var p,v={canvases:this._data.canvases,licenseFormatter:this._data.licenseFormatter,range:this._data.range};if(this._metadataGroups=this._data.helper.getMetadata(v),this._data.manifestDisplayOrder&&((p=this._getManifestGroup()).items=this._sortItems(p.items,this._readCSV(this._data.manifestDisplayOrder))),this._data.canvasDisplayOrder&&this._getCanvasGroups().forEach(function(x,O){x.items=r._sortItems(x.items,r._readCSV(r._data.canvasDisplayOrder))}),this._data.metadataGroupOrder&&(this._metadataGroups=this._sortGroups(this._metadataGroups,this._readCSV(this._data.metadataGroupOrder))),this._data.canvasLabels&&this._label(this._getCanvasGroups(),this._readCSV(this._data.canvasLabels,!1)),this._data.manifestExclude&&((p=this._getManifestGroup()).items=this._exclude(p.items,this._readCSV(this._data.manifestExclude))),this._data.canvasExclude&&this._getCanvasGroups().forEach(function(x,O){x.items=r._exclude(x.items,r._readCSV(r._data.canvasExclude))}),this._data.limitToRange){var I=[];this._metadataGroups.forEach(function(x,O){x.resource.isRange()&&I.push(x)}),I.length&&(this._metadataGroups=I)}this._render()}},t.prototype._sortItems=function(n,r){var p=this,v=[],I=n.slice(0);return r.forEach(function(x,O){var S=I.filter(function(_){return p._normalise(_.getLabel())===x})[0];if(S){v.push(S);var C=I.indexOf(S);C>-1&&I.splice(C,1)}}),I.forEach(function(x,O){v.push(x)}),v},t.prototype._sortGroups=function(n,r){var p=[],v=n.slice(0);return r.forEach(function(I,x){var O=v.filter(function(C){return C.resource.getIIIFResourceType().toLowerCase()==I.toLowerCase()})[0];if(O){p.push(O);var S=v.indexOf(O);S>-1&&v.splice(S,1)}}),p},t.prototype._label=function(n,r){n.forEach(function(p,v){p.label=r[v]})},t.prototype._exclude=function(n,r){var p=this;return r.forEach(function(v,I){var x=n.filter(function(S){return p._normalise(S.getLabel())===v})[0];if(x){var O=n.indexOf(x);O>-1&&n.splice(O,1)}}),n},t.prototype._normalise=function(n){return n?n.toLowerCase().replace(/ /g,""):null},t.prototype._render=function(){var n=this;this._metadataGroups.length?(this._$noData.hide(),this._$metadataGroups.empty(),this._metadataGroups.forEach(function(r,p){var v=n._buildMetadataGroup(r);n._$metadataGroups.append(v);var I=v.find(".value"),x=v.find(".item");if(n._data.limit&&n._data.content)if(n._data.limitType===c.LINES){var O=[x,n._data.limit,n._data.content.less,n._data.content.more,function(){},n._data.content.lessAriaLabelTemplate,n._data.content.moreAriaLabelTemplate];setTimeout(function(){h.default.apply(n,O)},100)}else n._data.limitType===c.CHARS&&I.ellipsisHtmlFixed(n._data.limit,function(){})})):this._$noData.show()},t.prototype._buildMetadataGroup=function(n){var r=this._$metadataGroupTemplate.clone(),p=r.find(">.header");if(this._data.content){if(n.resource.isManifest()&&this._data.content.manifestHeader)(I=this._sanitize(this._data.content.manifestHeader))&&p.html(I);else if(n.resource.isSequence()&&this._data.content.sequenceHeader)(I=this._sanitize(this._data.content.sequenceHeader))&&p.html(I);else if(n.resource.isRange()&&this._data.content.rangeHeader)(I=this._sanitize(this._data.content.rangeHeader))&&p.html(I);else if(n.resource.isCanvas()&&(n.label||this._data.content.canvasHeader)){var v=n.label||this._data.content.canvasHeader;p.html(this._sanitize(v))}else if(n.resource.isAnnotation()&&this._data.content.imageHeader){var I;(I=this._sanitize(this._data.content.imageHeader))&&p.html(I)}}p.text()||p.hide();for(var x=r.find(".items"),O=0;O<n.items.length;O++){var S=n.items[O],C=this._buildMetadataItem(S);x.append(C)}return r},t.prototype._buildMetadataItem=function(n){var r,p,v=this._$metadataItemTemplate.clone(),I=v.find(".label"),x=v.find(".values"),O=n.getLabel(),S=O,C=new RegExp("/w+:(/?/?)[^s]+/gm","i");if(this._data.content&&S&&n.isRootLevel)switch(S.toLowerCase()){case"attribution":S=this._data.content.attribution;break;case"description":S=this._data.content.description;break;case"license":S=this._data.content.license;break;case"logo":S=this._data.content.logo;break;case"rights":S=this._data.content.rights}S=this._sanitize(S),I.html(S),this._addReadingDirection(I,this._getLabelLocale(n)),v.addClass(b.Strings.toCssClass(S));var _=this._getValueLocale(n),g=(r=n.value)===null||r===void 0?void 0:r.getValue(_);if(!O||O.toLowerCase()!=="license"&&O.toLowerCase()!=="rights"||C.exec(g)===null)if(this._data.showAllLanguages&&n.value&&n.value.length>1)for(var E=[],T=0;T<n.value.length;T++){var A=n.value[T]._locale;if(A&&!E.includes(A)){var L=n.getValue(A,"<br/>");L&&(p=this._buildMetadataItemValue(L,A),E.push(A),x.append(p))}}else{for(var R=this._getValueLocale(n),q=!1,$t=0,Rt=n.getValues(R);$t<Rt.length;$t++){var pt;(pt=Rt[$t])&&(q=!0,p=this._buildMetadataItemValue(pt,R),x.append(p))}q||(pt=n.getValue())&&(p=this._buildMetadataItemValue(pt,R),x.append(p))}else p=this._buildMetadataItemURIValue(g),x.append(p);this._data.copyToClipboardEnabled&&b.Clipboard.supportsCopy()&&I.text()&&this._addCopyButton(v,I,x);var Pt=this;return v.find("a.iiif-viewer-link").length>0&&v.on("click","a.iiif-viewer-link",function(rt){rt.preventDefault();var at=$(rt.target),re=at.attr("data-uv-navigate")||at.prop("href");Pt.fire(d.IIIF_VIEWER_LINK_CLICKED,re)}),v.find("[data-uv-navigate]").length>0&&v.on("click","[data-uv-navigate]",function(rt){rt.preventDefault();var at=$(rt.target).attr("data-uv-navigate")||null;at&&Pt.fire(d.IIIF_VIEWER_LINK_CLICKED,at)}),v},t.prototype._getLabelLocale=function(n){var r;if(!this._data||!this._data.helper)return"";var p=this._data.helper.options.locale;if(!((r=n.label)===null||r===void 0)&&r.length){var v=n.label[0].locale;if(v.toLowerCase()!==p.toLowerCase())return v}return p},t.prototype._getValueLocale=function(n){return this._data&&this._data.helper?this._data.helper.options.locale:""},t.prototype._buildMetadataItemValue=function(n,r){n=(n=this._sanitize(n)).replace(`
`,"<br>");var p=this._$metadataItemValueTemplate.clone();return p.html(n),p.find("a").each(function(){var v=$(this);v.hasClass("iiif-viewer-link")||v.prop("target","_blank")}),r&&(p.prop("lang",r),this._addReadingDirection(p,r)),p},t.prototype._buildMetadataItemURIValue=function(n){n=this._sanitize(n);var r=this._$metadataItemURIValueTemplate.clone();return r.prop("href",n),r.text(n),r},t.prototype._addReadingDirection=function(n,r){r=s.Utils.getInexactLocale(r),this._readCSV(this._data.rtlLanguageCodes).filter(function(p){return p===r}).length>0&&(n.prop("dir","rtl"),n.addClass("rtl"))},t.prototype._addCopyButton=function(n,r,p){var v=this._$copyTextTemplate.clone(),I=v.children();r.append(v),b.Device.isTouch()?v.show():(n.on("mouseenter",function(){v.show()}),n.on("mouseleave",function(){v.hide()}),v.on("mouseleave",function(){I.hide()}));var x=this,O=p.text();v.on("click",function(S){x._copyItemValues(v,O)})},t.prototype._copyItemValues=function(n,r){b.Clipboard.copy(r);var p=n.find(".copiedText");p.show(),setTimeout(function(){p.hide()},this._data.copiedMessageDuration)},t.prototype._readCSV=function(n,r){r===void 0&&(r=!0);var p=[];if(n&&(p=n.split(","),r))for(var v=0;v<p.length;v++)p[v]=this._normalise(p[v]);return p},t.prototype._sanitize=function(n){return this._data.sanitizer?this._data.sanitizer(n):null},t.prototype._resize=function(){},t}(m.BaseComponent);o.MetadataComponent=f;var d=function(){function e(){}return e.IIIF_VIEWER_LINK_CLICKED="iiifViewerLinkClicked",e}();o.Events=d},function(a,o,l){typeof self<"u",a.exports=function(u){var i={};function c(s){if(i[s])return i[s].exports;var m=i[s]={i:s,l:!1,exports:{}};return u[s].call(m.exports,m,m.exports,c),m.l=!0,m.exports}return c.m=u,c.c=i,c.d=function(s,m,b){c.o(s,m)||Object.defineProperty(s,m,{enumerable:!0,get:b})},c.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},c.t=function(s,m){if(1&m&&(s=c(s)),8&m||4&m&&typeof s=="object"&&s&&s.__esModule)return s;var b=Object.create(null);if(c.r(b),Object.defineProperty(b,"default",{enumerable:!0,value:s}),2&m&&typeof s!="string")for(var h in s)c.d(b,h,function(f){return s[f]}.bind(null,h));return b},c.n=function(s){var m=s&&s.__esModule?function(){return s.default}:function(){return s};return c.d(m,"a",m),m},c.o=function(s,m){return Object.prototype.hasOwnProperty.call(s,m)},c.p="",c(c.s=7)}([function(u,i,c){"use strict";var s=this&&this.__createBinding||(Object.create?function(b,h,f,d){d===void 0&&(d=f);var e=Object.getOwnPropertyDescriptor(h,f);e&&!("get"in e?!h.__esModule:e.writable||e.configurable)||(e={enumerable:!0,get:function(){return h[f]}}),Object.defineProperty(b,d,e)}:function(b,h,f,d){d===void 0&&(d=f),b[d]=h[f]}),m=this&&this.__exportStar||function(b,h){for(var f in b)f==="default"||Object.prototype.hasOwnProperty.call(h,f)||s(h,b,f)};Object.defineProperty(i,"__esModule",{value:!0}),m(c(9),i),m(c(10),i),m(c(11),i),m(c(12),i),m(c(13),i),m(c(14),i),m(c(15),i),m(c(16),i),m(c(17),i),m(c(31),i),m(c(32),i),m(c(33),i),m(c(34),i),m(c(35),i),m(c(36),i),m(c(37),i),m(c(38),i),m(c(39),i),m(c(40),i),m(c(41),i),m(c(42),i),m(c(45),i),m(c(46),i),m(c(47),i),m(c(48),i),m(c(49),i),m(c(50),i),m(c(51),i),m(c(52),i),m(c(53),i),m(c(54),i),m(c(55),i),m(c(56),i),m(c(57),i),m(c(3),i)},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),function(s){s.BOOKMARKING="oa:bookmarking",s.CLASSIFYING="oa:classifying",s.COMMENTING="oa:commenting",s.DESCRIBING="oa:describing",s.EDITING="oa:editing",s.HIGHLIGHTING="oa:highlighting",s.IDENTIFYING="oa:identifying",s.LINKING="oa:linking",s.MODERATING="oa:moderating",s.PAINTING="sc:painting",s.QUESTIONING="oa:questioning",s.REPLYING="oa:replying",s.TAGGING="oa:tagging",s.TRANSCRIBING="oad:transcribing"}(i.AnnotationMotivation||(i.AnnotationMotivation={})),function(s){s.AUTO_ADVANCE="auto-advance",s.CONTINUOUS="continuous",s.FACING_PAGES="facing-pages",s.HIDDEN="hidden",s.INDIVIDUALS="individuals",s.MULTI_PART="multi-part",s.NO_NAV="no-nav",s.NON_PAGED="non-paged",s.PAGED="paged",s.REPEAT="repeat",s.SEQUENCE="sequence",s.THUMBNAIL_NAV="thumbnail-nav",s.TOGETHER="together",s.UNORDERED="unordered"}(i.Behavior||(i.Behavior={})),function(s){s.CANVAS="canvas",s.CHOICE="choice",s.OA_CHOICE="oa:choice",s.CONTENT_AS_TEXT="contentastext",s.DATASET="dataset",s.DOCUMENT="document",s.IMAGE="image",s.MODEL="model",s.MOVING_IMAGE="movingimage",s.PDF="pdf",s.PHYSICAL_OBJECT="physicalobject",s.SOUND="sound",s.TEXT="text",s.TEXTUALBODY="textualbody",s.VIDEO="video"}(i.ExternalResourceType||(i.ExternalResourceType={})),function(s){s.ANNOTATION="annotation",s.CANVAS="canvas",s.COLLECTION="collection",s.MANIFEST="manifest",s.RANGE="range",s.SEQUENCE="sequence"}(i.IIIFResourceType||(i.IIIFResourceType={})),function(s){s.AUDIO_MP4="audio/mp4",s.CORTO="application/corto",s.DICOM="application/dicom",s.DRACO="application/draco",s.EPUB="application/epub+zip",s.GIRDER="image/vnd.kitware.girder",s.GLB="model/gltf-binary",s.GLTF="model/gltf+json",s.IIIF_PRESENTATION_2='application/ld+json;profile="http://iiif.io/api/presentation/2/context.json"',s.IIIF_PRESENTATION_3='application/ld+json;profile="http://iiif.io/api/presentation/3/context.json"',s.JPG="image/jpeg",s.M3U8="application/vnd.apple.mpegurl",s.MP3="audio/mp3",s.MPEG_DASH="application/dash+xml",s.OBJ="text/plain",s.OPF="application/oebps-package+xml",s.PDF="application/pdf",s.PLY="application/ply",s.THREEJS="application/vnd.threejs+json",s.USDZ="model/vnd.usd+zip",s.VIDEO_MP4="video/mp4",s.WAV="audio/wav",s.WEBM="video/webm"}(i.MediaType||(i.MediaType={})),function(s){s.DOC="application/msword",s.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.PDF="application/pdf"}(i.RenderingFormat||(i.RenderingFormat={})),function(s){s.IMAGE_0_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/compliance.html#level0",s.IMAGE_0_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/compliance.html#level1",s.IMAGE_0_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/compliance.html#level2",s.IMAGE_0_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/conformance.html#level0",s.IMAGE_0_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/conformance.html#level1",s.IMAGE_0_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/conformance.html#level2",s.IMAGE_1_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",s.IMAGE_1_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",s.IMAGE_1_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",s.IMAGE_1_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",s.IMAGE_1_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",s.IMAGE_1_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",s.IMAGE_1_LEVEL_0="http://iiif.io/api/image/1/level0.json",s.IMAGE_1_PROFILE_LEVEL_0="http://iiif.io/api/image/1/profiles/level0.json",s.IMAGE_1_LEVEL_1="http://iiif.io/api/image/1/level1.json",s.IMAGE_1_PROFILE_LEVEL_1="http://iiif.io/api/image/1/profiles/level1.json",s.IMAGE_1_LEVEL_2="http://iiif.io/api/image/1/level2.json",s.IMAGE_1_PROFILE_LEVEL_2="http://iiif.io/api/image/1/profiles/level2.json",s.IMAGE_2_LEVEL_0="http://iiif.io/api/image/2/level0.json",s.IMAGE_2_PROFILE_LEVEL_0="http://iiif.io/api/image/2/profiles/level0.json",s.IMAGE_2_LEVEL_1="http://iiif.io/api/image/2/level1.json",s.IMAGE_2_PROFILE_LEVEL_1="http://iiif.io/api/image/2/profiles/level1.json",s.IMAGE_2_LEVEL_2="http://iiif.io/api/image/2/level2.json",s.IMAGE_2_PROFILE_LEVEL_2="http://iiif.io/api/image/2/profiles/level2.json",s.AUTH_0_CLICK_THROUGH="http://iiif.io/api/auth/0/login/clickthrough",s.AUTH_0_LOGIN="http://iiif.io/api/auth/0/login",s.AUTH_0_LOGOUT="http://iiif.io/api/auth/0/logout",s.AUTH_0_RESTRICTED="http://iiif.io/api/auth/0/login/restricted",s.AUTH_0_TOKEN="http://iiif.io/api/auth/0/token",s.AUTH_1_CLICK_THROUGH="http://iiif.io/api/auth/1/clickthrough",s.AUTH_1_EXTERNAL="http://iiif.io/api/auth/1/external",s.AUTH_1_KIOSK="http://iiif.io/api/auth/1/kiosk",s.AUTH_1_LOGIN="http://iiif.io/api/auth/1/login",s.AUTH_1_LOGOUT="http://iiif.io/api/auth/1/logout",s.AUTH_1_PROBE="http://iiif.io/api/auth/1/probe",s.AUTH_1_TOKEN="http://iiif.io/api/auth/1/token",s.SEARCH_0="http://iiif.io/api/search/0/search",s.SEARCH_0_AUTO_COMPLETE="http://iiif.io/api/search/0/autocomplete",s.SEARCH_1="http://iiif.io/api/search/1/search",s.SEARCH_1_AUTO_COMPLETE="http://iiif.io/api/search/1/autocomplete",s.TRACKING_EXTENSIONS="http://universalviewer.io/tracking-extensions-profile",s.UI_EXTENSIONS="http://universalviewer.io/ui-extensions-profile",s.PRINT_EXTENSIONS="http://universalviewer.io/print-extensions-profile",s.SHARE_EXTENSIONS="http://universalviewer.io/share-extensions-profile",s.DOWNLOAD_EXTENSIONS="http://universalviewer.io/download-extensions-profile",s.OTHER_MANIFESTATIONS="http://iiif.io/api/otherManifestations.json",s.IXIF="http://wellcomelibrary.org/ld/ixif/0/alpha.json"}(i.ServiceProfile||(i.ServiceProfile={})),function(s){s.IMAGE_SERVICE_2="ImageService2",s.IMAGE_SERVICE_3="ImageService3"}(i.ServiceType||(i.ServiceType={})),function(s){s.BOTTOM_TO_TOP="bottom-to-top",s.LEFT_TO_RIGHT="left-to-right",s.RIGHT_TO_LEFT="right-to-left",s.TOP_TO_BOTTOM="top-to-bottom"}(i.ViewingDirection||(i.ViewingDirection={})),function(s){s.CONTINUOUS="continuous",s.INDIVIDUALS="individuals",s.NON_PAGED="non-paged",s.PAGED="paged",s.TOP="top"}(i.ViewingHint||(i.ViewingHint={}))},function(u,i,c){var s=c(21).Symbol;u.exports=s},function(u,i,c){"use strict";var s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(p,v){function I(S){try{O(r.next(S))}catch(C){v(C)}}function x(S){try{O(r.throw(S))}catch(C){v(C)}}function O(S){var C;S.done?p(S.value):(C=S.value,C instanceof n?C:new n(function(_){_(C)})).then(I,x)}O((r=r.apply(e,t||[])).next())})},m=this&&this.__generator||function(e,t){var n,r,p,v={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},I=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return I.next=x(0),I.throw=x(1),I.return=x(2),typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function x(O){return function(S){return function(C){if(n)throw new TypeError("Generator is already executing.");for(;I&&(I=0,C[0]&&(v=0)),v;)try{if(n=1,r&&(p=2&C[0]?r.return:C[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,C[1])).done)return p;switch(r=0,p&&(C=[2&C[0],p.value]),C[0]){case 0:case 1:p=C;break;case 4:return v.label++,{value:C[1],done:!1};case 5:v.label++,r=C[1],C=[0];continue;case 7:C=v.ops.pop(),v.trys.pop();continue;default:if(!((p=(p=v.trys).length>0&&p[p.length-1])||C[0]!==6&&C[0]!==2)){v=0;continue}if(C[0]===3&&(!p||C[1]>p[0]&&C[1]<p[3])){v.label=C[1];break}if(C[0]===6&&v.label<p[1]){v.label=p[1],p=C;break}if(p&&v.label<p[2]){v.label=p[2],v.ops.push(C);break}p[2]&&v.ops.pop(),v.trys.pop();continue}C=t.call(e,v)}catch(_){C=[6,_],r=0}finally{n=p=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([O,S])}}};Object.defineProperty(i,"__esModule",{value:!0}),i.Utils=void 0;var b=c(0),h=c(1),f=c(43);c(44);var d=function(){function e(){}return e.getMediaType=function(t){return(t=(t=t.toLowerCase()).split(";")[0]).trim()},e.getImageQuality=function(t){return t===h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1||t===h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2||t===h.ServiceProfile.IMAGE_1_LEVEL_1||t===h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1||t===h.ServiceProfile.IMAGE_1_LEVEL_2||t===h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2?"native":"default"},e.getInexactLocale=function(t){return t.indexOf("-")!==-1?t.substr(0,t.indexOf("-")):t},e.getLocalisedValue=function(t,n){if(!Array.isArray(t))return t;for(var r=0;r<t.length;r++){var p=t[r];if(n===p["@language"])return p["@value"]}var v=n.substr(0,n.indexOf("-"));for(r=0;r<t.length;r++){var I=t[r];if(I["@language"]===v)return I["@value"]}return null},e.generateTreeNodeIds=function(t,n){var r;n===void 0&&(n=0),r=t.parentNode?t.parentNode.id+"-"+n:"0",t.id=r;for(var p=0;p<t.nodes.length;p++){var v=t.nodes[p];e.generateTreeNodeIds(v,p)}},e.normaliseType=function(t){return(t=(t||"").toLowerCase()).indexOf(":")!==-1?t.split(":")[1]:t},e.normaliseUrl=function(t){return(t=t.substr(t.indexOf("://"))).indexOf("#")!==-1&&(t=t.split("#")[0]),t},e.normalisedUrlsMatch=function(t,n){return e.normaliseUrl(t)===e.normaliseUrl(n)},e.isImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},e.isImageServiceType=function(t){return t!==null&&t.toLowerCase()===h.ServiceType.IMAGE_SERVICE_2.toLowerCase()||t===h.ServiceType.IMAGE_SERVICE_3.toLowerCase()},e.isLevel0ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_0)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0))},e.isLevel1ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_1)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1))},e.isLevel2ImageProfile=function(t){return!!(e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_LEVEL_2)||e.normalisedUrlsMatch(t,h.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2))},e.parseManifest=function(t,n){return b.Deserialiser.parse(t,n)},e.checkStatus=function(t){if(t.ok)return t;var n=new Error(t.statusText);return n.response=t,Promise.reject(n)},e.loadManifest=function(t){return new Promise(function(n,r){fetch(t).then(e.checkStatus).then(function(p){return p.json()}).then(function(p){n(p)}).catch(function(p){r()})})},e.loadExternalResourcesAuth1=function(t,n,r,p,v,I,x,O){return new Promise(function(S,C){var _=t.map(function(g){return e.loadExternalResourceAuth1(g,n,r,p,v,I,x,O)});Promise.all(_).then(function(){S(t)}).catch(function(g){C(g)})})},e.loadExternalResourceAuth1=function(t,n,r,p,v,I,x,O){return s(this,void 0,void 0,function(){var S;return m(this,function(C){switch(C.label){case 0:return[4,p(t)];case 1:return(S=C.sent())?[4,t.getData(S)]:[3,6];case 2:return C.sent(),t.status!==f.OK?[3,3]:[2,t];case 3:return[4,e.doAuthChain(t,n,r,v,I,x,O)];case 4:C.sent(),C.label=5;case 5:if(t.status===f.OK||t.status===f.MOVED_TEMPORARILY)return[2,t];throw e.createAuthorizationFailedError();case 6:return[4,t.getData()];case 7:return C.sent(),t.status!==f.MOVED_TEMPORARILY&&t.status!==f.UNAUTHORIZED?[3,9]:[4,e.doAuthChain(t,n,r,v,I,x,O)];case 8:C.sent(),C.label=9;case 9:if(t.status===f.OK||t.status===f.MOVED_TEMPORARILY)return[2,t];throw e.createAuthorizationFailedError()}})})},e.doAuthChain=function(t,n,r,p,v,I,x){return s(this,void 0,void 0,function(){var O,S,C,_,g,E,T,A;return m(this,function(L){switch(L.label){case 0:return t.isAccessControlled()?((O=t.externalService)&&(O.options=t.options),(S=t.kioskService)&&(S.options=t.options),(C=t.clickThroughService)&&(C.options=t.options),(_=t.loginService)&&(_.options=t.options),t.isResponseHandled||t.status!==f.MOVED_TEMPORARILY?[3,2]:[4,I(t)]):[2,t];case 1:return L.sent(),[2,t];case 2:return g=null,E=null,(g=O)?(E=g,[4,e.attemptResourceWithToken(t,r,g)]):[3,4];case 3:return L.sent(),[2,t];case 4:return(g=S)?(E=g,(T=n(g))?[4,p(T)]:[3,7]):[3,7];case 5:return L.sent(),[4,e.attemptResourceWithToken(t,r,g)];case 6:return L.sent(),[2,t];case 7:return(g=C)?(E=g,[4,v(t,g)]):[3,11];case 8:return(A=L.sent())?[4,p(A)]:[3,11];case 9:return L.sent(),[4,e.attemptResourceWithToken(t,r,g)];case 10:return L.sent(),[2,t];case 11:return(g=_)?(E=g,[4,v(t,g)]):[3,15];case 12:return(A=L.sent())?[4,p(A)]:[3,15];case 13:return L.sent(),[4,e.attemptResourceWithToken(t,r,g)];case 14:return L.sent(),[2,t];case 15:return E&&x(t,E),[2]}})})},e.attemptResourceWithToken=function(t,n,r){return s(this,void 0,void 0,function(){var p,v;return m(this,function(I){switch(I.label){case 0:return(p=r.getService(h.ServiceProfile.AUTH_1_TOKEN))?[4,n(t,p)]:[3,3];case 1:return(v=I.sent())&&v.accessToken?[4,t.getData(v)]:[3,3];case 2:return I.sent(),[2,t];case 3:return[2]}})})},e.loadExternalResourcesAuth09=function(t,n,r,p,v,I,x,O,S,C){return new Promise(function(_,g){var E=t.map(function(T){return e.loadExternalResourceAuth09(T,n,r,p,v,I,x,O,S,C)});Promise.all(E).then(function(){_(t)}).catch(function(T){g(T)})})},e.loadExternalResourceAuth09=function(t,n,r,p,v,I,x,O,S,C){return new Promise(function(_,g){C&&C.pessimisticAccessControl?t.getData().then(function(){t.isAccessControlled()?t.clickThroughService?(_(r(t)),_(p(t))):v(t).then(function(){I(t,!0).then(function(E){t.getData(E).then(function(){_(S(t))}).catch(function(T){g(e.createInternalServerError(T))})}).catch(function(E){g(e.createInternalServerError(E))})}).catch(function(E){g(e.createInternalServerError(E))}):_(t)}).catch(function(E){g(e.createInternalServerError(E))}):O(t,n).then(function(E){E?t.getData(E).then(function(){t.status===f.OK?_(S(t)):e.authorize(t,n,r,p,v,I,x,O).then(function(){_(S(t))}).catch(function(T){g(e.createAuthorizationFailedError())})}).catch(function(T){g(e.createAuthorizationFailedError())}):e.authorize(t,n,r,p,v,I,x,O).then(function(){_(S(t))}).catch(function(T){g(e.createAuthorizationFailedError())})}).catch(function(E){g(e.createAuthorizationFailedError())})})},e.createError=function(t,n){var r=new Error;return r.message=n,r.name=String(t),r},e.createAuthorizationFailedError=function(){return e.createError(b.StatusCode.AUTHORIZATION_FAILED,"Authorization failed")},e.createRestrictedError=function(){return e.createError(b.StatusCode.RESTRICTED,"Restricted")},e.createInternalServerError=function(t){return e.createError(b.StatusCode.INTERNAL_SERVER_ERROR,t)},e.authorize=function(t,n,r,p,v,I,x,O){return new Promise(function(S,C){t.getData().then(function(){t.isAccessControlled()?O(t,n).then(function(_){_?t.getData(_).then(function(){t.status===f.OK?S(t):e.showAuthInteraction(t,n,r,p,v,I,x,S,C)}).catch(function(g){C(e.createInternalServerError(g))}):I(t,!1).then(function(g){g?x(t,g,n).then(function(){t.getData(g).then(function(){t.status===f.OK?S(t):e.showAuthInteraction(t,n,r,p,v,I,x,S,C)}).catch(function(E){C(e.createInternalServerError(E))})}).catch(function(E){C(e.createInternalServerError(E))}):e.showAuthInteraction(t,n,r,p,v,I,x,S,C)})}).catch(function(_){C(e.createInternalServerError(_))}):S(t)})})},e.showAuthInteraction=function(t,n,r,p,v,I,x,O,S){t.status!==f.MOVED_TEMPORARILY||t.isResponseHandled?t.clickThroughService&&!t.isResponseHandled?r(t).then(function(){I(t,!0).then(function(C){x(t,C,n).then(function(){t.getData(C).then(function(){O(t)}).catch(function(_){S(e.createInternalServerError(_))})}).catch(function(_){S(e.createInternalServerError(_))})}).catch(function(C){S(e.createInternalServerError(C))})}):v(t).then(function(){I(t,!0).then(function(C){x(t,C,n).then(function(){t.getData(C).then(function(){O(t)}).catch(function(_){S(e.createInternalServerError(_))})}).catch(function(_){S(e.createInternalServerError(_))})}).catch(function(C){S(e.createInternalServerError(C))})}):O(t)},e.getService=function(t,n){for(var r=this.getServices(t),p=0;p<r.length;p++){var v=r[p];if(v.getProfile()===n)return v}return null},e.getResourceById=function(t,n){return e.traverseAndFind(t.__jsonld,"@id",n)},e.traverseAndFind=function(t,n,r){if(t.hasOwnProperty(n)&&t[n]===r)return t;for(var p=0;p<Object.keys(t).length;p++)if(typeof t[Object.keys(t)[p]]=="object"){var v=e.traverseAndFind(t[Object.keys(t)[p]],n,r);if(v!=null)return v}},e.getServices=function(t,n){var r=n===void 0?{}:n,p=r.onlyService,v=p!==void 0&&p,I=r.onlyServices,x=I!==void 0&&I,O=r.skipParentResources,S=[];(O===void 0||!O)&&t&&t.options&&t.options.resource&&t.options.resource!==t&&S.push.apply(S,e.getServices(t.options.resource,{onlyServices:!0}));var C=x?[]:(t.__jsonld||t).service||[];if(Array.isArray(C)||(C=[C]),v||C.push.apply(C,(t.__jsonld||t).services||[]),C.length===0)return S;for(var _=0;_<C.length;_++){var g=C[_];if(typeof g=="string"){var E=this.getResourceById(t.options.resource,g);E&&S.push(new b.Service(E.__jsonld||E,t.options))}else S.push(new b.Service(g,t.options))}return S},e.getTemporalComponent=function(t){var n=/t=([^&]+)/g.exec(t),r=null;return n&&n[1]&&(r=n[1].split(",")),r},e}();i.Utils=d},function(u,i,c){var s=c(19),m=c(20);u.exports=function b(h,f,d,e,t){var n=-1,r=h.length;for(d||(d=m),t||(t=[]);++n<r;){var p=h[n];f>0&&d(p)?f>1?b(p,f-1,d,e,t):s(t,p):e||(t[t.length]=p)}return t}},function(u,i){u.exports=function(c){return c!=null&&typeof c=="object"}},function(u,i,c){"use strict";c.r(i),i.default=function(s,m){return m=m||{},new Promise(function(b,h){var f=new XMLHttpRequest,d=[],e=[],t={},n=function(){return{ok:(f.status/100|0)==2,statusText:f.statusText,status:f.status,url:f.responseURL,text:function(){return Promise.resolve(f.responseText)},json:function(){return Promise.resolve(JSON.parse(f.responseText))},blob:function(){return Promise.resolve(new Blob([f.response]))},clone:n,headers:{keys:function(){return d},entries:function(){return e},get:function(p){return t[p.toLowerCase()]},has:function(p){return p.toLowerCase()in t}}}};for(var r in f.open(m.method||"get",s,!0),f.onload=function(){f.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(p,v,I){d.push(v=v.toLowerCase()),e.push([v,I]),t[v]=t[v]?t[v]+","+I:I}),b(n())},f.onerror=h,f.withCredentials=m.credentials=="include",m.headers)f.setRequestHeader(r,m.headers[r]);f.send(m.body||null)})}},function(u,i,c){u.exports=c(8)},function(u,i,c){"use strict";var s=this&&this.__createBinding||(Object.create?function(h,f,d,e){e===void 0&&(e=d);var t=Object.getOwnPropertyDescriptor(f,d);t&&!("get"in t?!f.__esModule:t.writable||t.configurable)||(t={enumerable:!0,get:function(){return f[d]}}),Object.defineProperty(h,e,t)}:function(h,f,d,e){e===void 0&&(e=d),h[e]=f[d]}),m=this&&this.__exportStar||function(h,f){for(var d in h)d==="default"||Object.prototype.hasOwnProperty.call(f,d)||s(f,h,d)};Object.defineProperty(i,"__esModule",{value:!0}),i.parseManifest=i.loadManifest=void 0,m(c(0),i);var b=c(3);i.loadManifest=function(h){return b.Utils.loadManifest(h)},i.parseManifest=function(h,f){return b.Utils.parseManifest(h,f)}},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.JSONLDResource=void 0;var s=function(){function m(b){this.__jsonld=b,this.context=this.getProperty("context"),this.id=this.getProperty("id")}return m.prototype.getProperty=function(b){var h=null;return this.__jsonld&&((h=this.__jsonld[b])||(h=this.__jsonld["@"+b])),h},m}();i.JSONLDResource=s},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.ManifestResource=void 0;var b=c(0),h=c(1),f=function(d){function e(t,n){var r=d.call(this,t)||this;return r.options=n,r}return m(e,d),e.prototype.getIIIFResourceType=function(){return b.Utils.normaliseType(this.getProperty("type"))},e.prototype.getLabel=function(){var t=this.getProperty("label");return t?b.PropertyValue.parse(t,this.options.locale):new b.PropertyValue([],this.options.locale)},e.prototype.getDefaultLabel=function(){return this.getLabel().getValue(this.options.locale)},e.prototype.getMetadata=function(){var t=this.getProperty("metadata"),n=[];if(!t)return n;for(var r=0;r<t.length;r++){var p=t[r],v=new b.LabelValuePair(this.options.locale);v.parse(p),n.push(v)}return n},e.prototype.getRendering=function(t){for(var n=this.getRenderings(),r=0;r<n.length;r++){var p=n[r];if(p.getFormat()===t)return p}return null},e.prototype.getRenderings=function(){var t,n=[];if(!(t=this.__jsonld?this.__jsonld.rendering:this.rendering))return n;Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++){var p=t[r];n.push(new b.Rendering(p,this.options))}return n},e.prototype.getRequiredStatement=function(){var t=null,n=this.getProperty("requiredStatement");return n&&(t=new b.LabelValuePair(this.options.locale)).parse(n),t},e.prototype.getService=function(t){return b.Utils.getService(this,t)},e.prototype.getServices=function(){return b.Utils.getServices(this)},e.prototype.getThumbnail=function(){var t=this.getProperty("thumbnail");return Array.isArray(t)&&(t=t[0]),t?new b.Thumbnail(t,this.options):null},e.prototype.isAnnotation=function(){return this.getIIIFResourceType()===h.IIIFResourceType.ANNOTATION},e.prototype.isCanvas=function(){return this.getIIIFResourceType()===h.IIIFResourceType.CANVAS},e.prototype.isCollection=function(){return this.getIIIFResourceType()===h.IIIFResourceType.COLLECTION},e.prototype.isManifest=function(){return this.getIIIFResourceType()===h.IIIFResourceType.MANIFEST},e.prototype.isRange=function(){return this.getIIIFResourceType()===h.IIIFResourceType.RANGE},e.prototype.isSequence=function(){return this.getIIIFResourceType()===h.IIIFResourceType.SEQUENCE},e}(b.JSONLDResource);i.ManifestResource=f},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(f,d){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(f,d)},function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function e(){this.constructor=f}s(f,d),f.prototype=d===null?Object.create(d):(e.prototype=d.prototype,new e)});Object.defineProperty(i,"__esModule",{value:!0}),i.Resource=void 0;var b=c(0),h=function(f){function d(e,t){return f.call(this,e,t)||this}return m(d,f),d.prototype.getFormat=function(){var e=this.getProperty("format");return e?e.toLowerCase():null},d.prototype.getResources=function(){var e=[];if(!this.__jsonld.resources)return e;for(var t=0;t<this.__jsonld.resources.length;t++){var n=this.__jsonld.resources[t],r=new b.Annotation(n,this.options);e.push(r)}return e},d.prototype.getType=function(){var e=this.getProperty("type");return e?b.Utils.normaliseType(e):null},d.prototype.getWidth=function(){return this.getProperty("width")},d.prototype.getHeight=function(){return this.getProperty("height")},d.prototype.getMaxWidth=function(){return this.getProperty("maxWidth")},d.prototype.getMaxHeight=function(){return this.getProperty("maxHeight")?null:this.getMaxWidth()},d}(b.ManifestResource);i.Resource=h},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.IIIFResource=void 0;var b=c(0),h=c(1),f=function(d){function e(t,n){var r=d.call(this,t,n)||this;r.index=-1,r.isLoaded=!1;var p={defaultLabel:"-",locale:"en-GB",resource:r,pessimisticAccessControl:!1};return r.options=Object.assign(p,n),r}return m(e,d),e.prototype.getAttribution=function(){var t=this.getProperty("attribution");return t?b.PropertyValue.parse(t,this.options.locale):new b.PropertyValue([],this.options.locale)},e.prototype.getDescription=function(){var t=this.getProperty("description");return t?b.PropertyValue.parse(t,this.options.locale):new b.PropertyValue([],this.options.locale)},e.prototype.getHomepage=function(){var t=this.getProperty("homepage");return t?typeof t=="string"?t:(Array.isArray(t)&&t.length&&(t=t[0]),t["@id"]||t.id):null},e.prototype.getIIIFResourceType=function(){return b.Utils.normaliseType(this.getProperty("type"))},e.prototype.getLogo=function(){var t=this.getProperty("logo");if(!t){var n=this.getProperty("provider");if(!n)return null;var r=n.find(function(p){return p.logo!==void 0});t=r&&r.logo!==void 0?r.logo:null}return t?typeof t=="string"?t:(Array.isArray(t)&&t.length&&(t=t[0]),t["@id"]||t?.id):null},e.prototype.getLicense=function(){return b.Utils.getLocalisedValue(this.getProperty("license"),this.options.locale)},e.prototype.getRights=function(){var t=this.getProperty("rights");return t?typeof t=="string"?t:(Array.isArray(t)&&t.length&&(t=t[0]),t["@id"]||t.id):null},e.prototype.getNavDate=function(){return new Date(this.getProperty("navDate"))},e.prototype.getRelated=function(){return this.getProperty("related")},e.prototype.getSeeAlso=function(){return this.getProperty("seeAlso")},e.prototype.getTrackingLabel=function(){var t=this.getService(h.ServiceProfile.TRACKING_EXTENSIONS);return t?t.getProperty("trackingLabel"):""},e.prototype.getDefaultTree=function(){return this.defaultTree=new b.TreeNode("root"),this.defaultTree.data=this,this.defaultTree},e.prototype.getRequiredStatement=function(){var t=null,n=this.getProperty("requiredStatement");if(n)(t=new b.LabelValuePair(this.options.locale)).parse(n);else{var r=this.getAttribution();r&&r.length&&((t=new b.LabelValuePair(this.options.locale)).value=r)}return t},e.prototype.isCollection=function(){return this.getIIIFResourceType()===h.IIIFResourceType.COLLECTION},e.prototype.isManifest=function(){return this.getIIIFResourceType()===h.IIIFResourceType.MANIFEST},e.prototype.load=function(){var t=this;return new Promise(function(n){if(t.isLoaded)n(t);else{var r=t.options;r.navDate=t.getNavDate();var p=t.__jsonld.id;p||(p=t.__jsonld["@id"]),b.Utils.loadManifest(p).then(function(v){t.parentLabel=t.getLabel().getValue(r.locale);var I=b.Deserialiser.parse(v,r);(t=Object.assign(t,I)).index=r.index,n(t)})}})},e}(b.ManifestResource);i.IIIFResource=f},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(f,d){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(f,d)},function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function e(){this.constructor=f}s(f,d),f.prototype=d===null?Object.create(d):(e.prototype=d.prototype,new e)});Object.defineProperty(i,"__esModule",{value:!0}),i.Annotation=void 0;var b=c(0),h=function(f){function d(e,t){return f.call(this,e,t)||this}return m(d,f),d.prototype.getBody=function(){var e=[],t=this.getProperty("body");if(t)if(Array.isArray(t))for(var n=0;n<t.length;n++)if((v=t[n]).items)for(var r=0;r<v.items.length;r++){var p=v.items[r];e.push(new b.AnnotationBody(p,this.options))}else e.push(new b.AnnotationBody(v,this.options));else if(t.items)for(n=0;n<t.items.length;n++){var v=t.items[n];e.push(new b.AnnotationBody(v,this.options))}else e.push(new b.AnnotationBody(t,this.options));return e},d.prototype.getMotivation=function(){return this.getProperty("motivation")||null},d.prototype.getOn=function(){return this.getProperty("on")},d.prototype.getTarget=function(){return this.getProperty("target")},d.prototype.getResource=function(){return new b.Resource(this.getProperty("resource"),this.options)},d}(b.ManifestResource);i.Annotation=h},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(f,d){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(f,d)},function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function e(){this.constructor=f}s(f,d),f.prototype=d===null?Object.create(d):(e.prototype=d.prototype,new e)});Object.defineProperty(i,"__esModule",{value:!0}),i.AnnotationBody=void 0;var b=c(0),h=function(f){function d(e,t){return f.call(this,e,t)||this}return m(d,f),d.prototype.getFormat=function(){var e=this.getProperty("format");return e?b.Utils.getMediaType(e):null},d.prototype.getType=function(){return this.getProperty("type")?b.Utils.normaliseType(this.getProperty("type")):null},d.prototype.getWidth=function(){return this.getProperty("width")},d.prototype.getHeight=function(){return this.getProperty("height")},d}(b.ManifestResource);i.AnnotationBody=h},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(f,d){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(f,d)},function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function e(){this.constructor=f}s(f,d),f.prototype=d===null?Object.create(d):(e.prototype=d.prototype,new e)});Object.defineProperty(i,"__esModule",{value:!0}),i.AnnotationList=void 0;var b=c(0),h=function(f){function d(e,t,n){var r=f.call(this,t)||this;return r.label=e,r.options=n,r}return m(d,f),d.prototype.getIIIFResourceType=function(){return b.Utils.normaliseType(this.getProperty("type"))},d.prototype.getLabel=function(){return this.label},d.prototype.getResources=function(){var e=this;return this.getProperty("resources").map(function(t){return new b.Annotation(t,e.options)})},d.prototype.load=function(){var e=this;return new Promise(function(t,n){if(e.isLoaded)t(e);else{var r=e.__jsonld.id;r||(r=e.__jsonld["@id"]),b.Utils.loadManifest(r).then(function(p){e.__jsonld=p,e.context=e.getProperty("context"),e.id=e.getProperty("id"),e.isLoaded=!0,t(e)}).catch(n)}})},d}(b.JSONLDResource);i.AnnotationList=h},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(h,f){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,e){d.__proto__=e}||function(d,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])})(h,f)},function(h,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function d(){this.constructor=h}s(h,f),h.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)});Object.defineProperty(i,"__esModule",{value:!0}),i.AnnotationPage=void 0;var b=function(h){function f(d,e){return h.call(this,d,e)||this}return m(f,h),f.prototype.getItems=function(){return this.getProperty("items")},f}(c(0).ManifestResource);i.AnnotationPage=b},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(n,r){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,v){p.__proto__=v}||function(p,v){for(var I in v)Object.prototype.hasOwnProperty.call(v,I)&&(p[I]=v[I])})(n,r)},function(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function p(){this.constructor=n}s(n,r),n.prototype=r===null?Object.create(r):(p.prototype=r.prototype,new p)}),b=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(i,"__esModule",{value:!0}),i.Canvas=void 0;var h=c(1),f=c(0),d=b(c(18)),e=b(c(30)),t=function(n){function r(p,v){return n.call(this,p,v)||this}return m(r,n),r.prototype.getCanonicalImageUri=function(p){var v,I=null,x="default",O=p;if(this.externalResource&&this.externalResource.data&&this.externalResource.data["@id"])I=this.externalResource.data["@id"],O||(O=this.externalResource.data.width),this.externalResource.data["@context"]&&(this.externalResource.data["@context"].indexOf("/1.0/context.json")>-1||this.externalResource.data["@context"].indexOf("/1.1/context.json")>-1||this.externalResource.data["@context"].indexOf("/1/context.json")>-1)&&(x="native");else{var S=void 0;if((S=this.getImages())&&S.length){var C=S[0].getResource(),_=C.getServices();if(O||(O=C.getWidth()),g=_?_.find(function(A){return f.Utils.isImageProfile(A.getProfile())||f.Utils.isImageServiceType(A.getIIIFResourceType())}):null)I=g.id,x=f.Utils.getImageQuality(g.getProfile());else if(O===C.getWidth())return C.id}if((S=this.getContent())&&S.length){var g,E=S[0].getBody()[0];if(_=E.getServices(),O||(O=E.getWidth()),g=_?_.find(function(A){return f.Utils.isImageServiceType(A.getIIIFResourceType())}):null)I=g.id,x=f.Utils.getImageQuality(g.getProfile());else if(O===E.getWidth())return E.id}if(!I){var T=this.getProperty("thumbnail");if(T){if(typeof T=="string")return T;if(T["@id"])return T["@id"];if(T.length)return T[0].id}}}return v=O+",",I&&I.endsWith("/")&&(I=I.substr(0,I.length-1)),[I,"full",v,0,x+".jpg"].join("/")},r.prototype.getMaxDimensions=function(){var p,v=null;return this.externalResource&&this.externalResource.data&&this.externalResource.data.profile&&(p=this.externalResource.data.profile,Array.isArray(p)&&(p=p.filter(function(I){var x;return(x=I.maxWidth)!==null&&x!==void 0?x:I.maxwidth})[0])&&(v=new f.Size(p.maxWidth,p.maxHeight?p.maxHeight:p.maxWidth))),v},r.prototype.getContent=function(){var p=[],v=this.__jsonld.items||this.__jsonld.content;if(!v)return p;var I=null;if(v.length&&(I=new f.AnnotationPage(v[0],this.options)),!I)return p;for(var x=I.getItems(),O=0;O<x.length;O++){var S=x[O],C=new f.Annotation(S,this.options);p.push(C)}return p},r.prototype.getDuration=function(){return this.getProperty("duration")},r.prototype.getImages=function(){var p=[];if(!this.__jsonld.images)return p;for(var v=0;v<this.__jsonld.images.length;v++){var I=this.__jsonld.images[v],x=new f.Annotation(I,this.options);p.push(x)}return p},r.prototype.getIndex=function(){return this.getProperty("index")},r.prototype.getOtherContent=function(){var p=this,v=(Array.isArray(this.getProperty("otherContent"))?this.getProperty("otherContent"):[this.getProperty("otherContent")]).filter(function(I){return I&&typeof(x=I["@type"])=="string"&&x.toLowerCase()==x.toLowerCase();var x}).map(function(I,x){return new f.AnnotationList(I.label||"Annotation list ".concat(x),I,p.options)}).map(function(I){return I.load()});return Promise.all(v)},r.prototype.getWidth=function(){return this.getProperty("width")},r.prototype.getHeight=function(){return this.getProperty("height")},r.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},Object.defineProperty(r.prototype,"imageResources",{get:function(){var p=this,v=(0,e.default)([this.getImages().map(function(I){return I.getResource()}),this.getContent().map(function(I){return I.getBody()})]);return(0,d.default)(v.map(function(I){switch(I.getProperty("type").toLowerCase()){case h.ExternalResourceType.CHOICE:case h.ExternalResourceType.OA_CHOICE:return new r({images:(0,d.default)([I.getProperty("default"),I.getProperty("item")]).map(function(x){return{resource:x}})},p.options).getImages().map(function(x){return x.getResource()});default:return I}}))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"resourceAnnotations",{get:function(){return(0,e.default)([this.getImages(),this.getContent()])},enumerable:!1,configurable:!0}),r.prototype.resourceAnnotation=function(p){return this.resourceAnnotations.find(function(v){return v.getResource().id===p||(0,d.default)(new Array(v.getBody())).some(function(I){return I.id===p})})},r.prototype.onFragment=function(p){var v=this.resourceAnnotation(p);if(v){var I=v.getProperty("on"),x=v.getProperty("target");if(I&&x){var O=(I||x).match(/xywh=(.*)$/);if(O)return O[1].split(",").map(function(S){return parseInt(S,10)})}}},Object.defineProperty(r.prototype,"iiifImageResources",{get:function(){return this.imageResources.filter(function(p){return p&&p.getServices()[0]&&p.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"imageServiceIds",{get:function(){return this.iiifImageResources.map(function(p){return p.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"aspectRatio",{get:function(){return this.getWidth()/this.getHeight()},enumerable:!1,configurable:!0}),r}(f.Resource);i.Canvas=t},function(u,i,c){var s=c(4);u.exports=function(m){return m!=null&&m.length?s(m,1):[]}},function(u,i){u.exports=function(c,s){for(var m=-1,b=s.length,h=c.length;++m<b;)c[h+m]=s[m];return c}},function(u,i,c){var s=c(2),m=c(24),b=c(29),h=s?s.isConcatSpreadable:void 0;u.exports=function(f){return b(f)||m(f)||!!(h&&f&&f[h])}},function(u,i,c){var s=c(22),m=typeof self=="object"&&self&&self.Object===Object&&self,b=s||m||Function("return this")();u.exports=b},function(u,i,c){(function(s){var m=typeof s=="object"&&s&&s.Object===Object&&s;u.exports=m}).call(this,c(23))},function(u,i){var c;c=function(){return this}();try{c=c||new Function("return this")()}catch{typeof window=="object"&&(c=window)}u.exports=c},function(u,i,c){var s=c(25),m=c(5),b=Object.prototype,h=b.hasOwnProperty,f=b.propertyIsEnumerable,d=s(function(){return arguments}())?s:function(e){return m(e)&&h.call(e,"callee")&&!f.call(e,"callee")};u.exports=d},function(u,i,c){var s=c(26),m=c(5);u.exports=function(b){return m(b)&&s(b)=="[object Arguments]"}},function(u,i,c){var s=c(2),m=c(27),b=c(28),h=s?s.toStringTag:void 0;u.exports=function(f){return f==null?f===void 0?"[object Undefined]":"[object Null]":h&&h in Object(f)?m(f):b(f)}},function(u,i,c){var s=c(2),m=Object.prototype,b=m.hasOwnProperty,h=m.toString,f=s?s.toStringTag:void 0;u.exports=function(d){var e=b.call(d,f),t=d[f];try{d[f]=void 0;var n=!0}catch{}var r=h.call(d);return n&&(e?d[f]=t:delete d[f]),r}},function(u,i){var c=Object.prototype.toString;u.exports=function(s){return c.call(s)}},function(u,i){var c=Array.isArray;u.exports=c},function(u,i,c){var s=c(4);u.exports=function(m){return m!=null&&m.length?s(m,1/0):[]}},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.Collection=void 0;var b=c(1),h=c(0),f=function(d){function e(t,n){var r=d.call(this,t,n)||this;return r.items=[],r._collections=null,r._manifests=null,t.__collection=r,r}return m(e,d),e.prototype.getCollections=function(){return this._collections?this._collections:this._collections=this.items.filter(function(t){return t.isCollection()})},e.prototype.getManifests=function(){return this._manifests?this._manifests:this._manifests=this.items.filter(function(t){return t.isManifest()})},e.prototype.getCollectionByIndex=function(t){for(var n,r=this.getCollections(),p=0;p<r.length;p++){var v=r[p];v.index===t&&(n=v)}if(n)return n.options.index=t,n.load();throw new Error("Collection index not found")},e.prototype.getManifestByIndex=function(t){for(var n,r=this.getManifests(),p=0;p<r.length;p++){var v=r[p];v.index===t&&(n=v)}if(n)return n.options.index=t,n.load();throw new Error("Manifest index not found")},e.prototype.getTotalCollections=function(){return this.getCollections().length},e.prototype.getTotalManifests=function(){return this.getManifests().length},e.prototype.getTotalItems=function(){return this.items.length},e.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):b.ViewingDirection.LEFT_TO_RIGHT},e.prototype.getBehavior=function(){var t=this.getProperty("behavior");return Array.isArray(t)&&(t=t[0]),t||null},e.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},e.prototype.getDefaultTree=function(){return d.prototype.getDefaultTree.call(this),this.defaultTree.data.type=h.Utils.normaliseType(h.TreeNodeType.COLLECTION),this._parseManifests(this),this._parseCollections(this),h.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},e.prototype._parseManifests=function(t){if(t.getManifests()&&t.getManifests().length)for(var n=0;n<t.getManifests().length;n++){var r=t.getManifests()[n],p=r.getDefaultTree();p.label=r.parentLabel||r.getLabel().getValue(this.options.locale)||"manifest "+(n+1),p.navDate=r.getNavDate(),p.data.id=r.id,p.data.type=h.Utils.normaliseType(h.TreeNodeType.MANIFEST),t.defaultTree.addNode(p)}},e.prototype._parseCollections=function(t){if(t.getCollections()&&t.getCollections().length)for(var n=0;n<t.getCollections().length;n++){var r=t.getCollections()[n],p=r.getDefaultTree();p.label=r.parentLabel||r.getLabel().getValue(this.options.locale)||"collection "+(n+1),p.navDate=r.getNavDate(),p.data.id=r.id,p.data.type=h.Utils.normaliseType(h.TreeNodeType.COLLECTION),t.defaultTree.addNode(p)}},e}(h.IIIFResource);i.Collection=f},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Duration=void 0;var s=function(){function m(b,h){this.start=b,this.end=h}return m.prototype.getLength=function(){return this.end-this.start},m}();i.Duration=s},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0})},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0})},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0})},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0})},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0})},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0})},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.LabelValuePair=void 0;var s=c(0),m=function(){function b(h){this.defaultLocale=h}return b.prototype.parse=function(h){this.resource=h,this.label=s.PropertyValue.parse(this.resource.label,this.defaultLocale),this.value=s.PropertyValue.parse(this.resource.value,this.defaultLocale)},b.prototype.getLabel=function(h){return this.label===null?null:(Array.isArray(h)&&!h.length&&(h=void 0),this.label.getValue(h||this.defaultLocale))},b.prototype.setLabel=function(h){this.label===null&&(this.label=new s.PropertyValue([])),this.label.setValue(h,this.defaultLocale)},b.prototype.getValue=function(h,f){return f===void 0&&(f="<br/>"),this.value===null?null:(Array.isArray(h)&&!h.length&&(h=void 0),this.value.getValue(h||this.defaultLocale,f))},b.prototype.getValues=function(h){return this.value===null?[]:(Array.isArray(h)&&!h.length&&(h=void 0),this.value.getValues(h||this.defaultLocale))},b.prototype.setValue=function(h){this.value===null&&(this.value=new s.PropertyValue([])),this.value.setValue(h,this.defaultLocale)},b}();i.LabelValuePair=m},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0})},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(h,f){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,e){d.__proto__=e}||function(d,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])})(h,f)},function(h,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function d(){this.constructor=h}s(h,f),h.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)});Object.defineProperty(i,"__esModule",{value:!0}),i.LanguageMap=void 0;var b=function(h){function f(){return h!==null&&h.apply(this,arguments)||this}return m(f,h),f.getValue=function(d,e){return d.getValue(e,"<br/>")},f.getValues=function(d,e){return d.getValues(e)},f}(Array);i.LanguageMap=b},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.PropertyValue=i.LocalizedValue=void 0;var b=c(3),h=function(){function d(e,t,n){n===void 0&&(n="none"),Array.isArray(e)&&e.length===1?this._value=e[0]:this._value=e,t!=="none"&&t!=="@none"||(t=void 0),this._locale=t,this._defaultLocale=n}return d.parseV2Value=function(e,t){return typeof e=="string"?new d(e,void 0,t):e["@value"]?new d(e["@value"],e["@language"],t):null},Object.defineProperty(d.prototype,"value",{get:function(){return Array.isArray(this._value)?this._value.join("<br/>"):this._value},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"locale",{get:function(){return this._locale===void 0?this._defaultLocale:this._locale},enumerable:!1,configurable:!0}),d.prototype.addValue=function(e){Array.isArray(this._value)||(this._value=[this._value]),Array.isArray(e)?this._value=this._value.concat(e):this._value.push(e)},d}();i.LocalizedValue=h;var f=function(d){function e(t,n){t===void 0&&(t=[]);var r=d.apply(this,t)||this;return r.__proto__=e.prototype,r._defaultLocale=n,r}return m(e,d),e.parse=function(t,n){if(!t)return new e([],n);if(Array.isArray(t)){var r=(p=t.map(function(v){return h.parseV2Value(v,n)}).filter(function(v){return v!==null})).reduce(function(v,I){var x=I._locale;return x||(x="none"),v[x]?v[x].addValue(I._value):v[x]=I,v},{});return new e(Object.values(r),n)}return typeof t=="string"?new e([new h(t,void 0,n)],n):t["@language"]||t["@value"]?new e((p=h.parseV2Value(t))!==null?[p]:[],n):new e(Object.keys(t).map(function(v){var I=t[v];if(!Array.isArray(I))throw new Error("A IIIF v3 localized property value must have an array as the value for a given language.");return new h(I,v,n)}),n);var p},e.prototype.getSuitableLocale=function(t){for(var n=Array.from(this.values()).map(function(_){return _._locale}).filter(function(_){return _!==void 0}),r=function(_){var g=n.find(function(E){return E===_});if(g)return{value:g}},p=0,v=t;p<v.length;p++){var I=r(v[p]);if(typeof I=="object")return I.value}for(var x=function(_){var g=n.find(function(E){return b.Utils.getInexactLocale(E)===b.Utils.getInexactLocale(_)});if(g)return{value:g}},O=0,S=t;O<S.length;O++){var C=x(S[O]);if(typeof C=="object")return C.value}},e.prototype.setValue=function(t,n){var r=void 0;if(n){var p=this.getSuitableLocale([n]);p&&(r=this.find(function(v){return v._locale===p}))}else r=this.find(function(v){return v._locale===void 0});r?r._value=t:this.push(new h(t,n,this._defaultLocale))},e.prototype.getValue=function(t,n){var r=this.getValues(t);return r.length===0?null:n?r.join(n):r[0]},e.prototype.getValues=function(t){if(!this.length)return[];var n;if(n=t?Array.isArray(t)?t:[t]:[],this.length===1&&this[0]._locale===void 0){var r=this[0]._value;return Array.isArray(r)?r:[r]}var p=this.getSuitableLocale(n);if(p)return r=this.find(function(I){return I._locale===p})._value,Array.isArray(r)?r:[r];if(!this.find(function(I){return I._locale===void 0}))return r=this[0]._value,Array.isArray(r)?r:[r];var v=this.find(function(I){return I._locale===void 0});return v?Array.isArray(v._value)?v._value:[v._value]:[]},e}(Array);i.PropertyValue=f},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.CONTINUE=100,i.SWITCHING_PROTOCOLS=101,i.PROCESSING=102,i.OK=200,i.CREATED=201,i.ACCEPTED=202,i.NON_AUTHORITATIVE_INFORMATION=203,i.NO_CONTENT=204,i.RESET_CONTENT=205,i.PARTIAL_CONTENT=206,i.MULTI_STATUS=207,i.MULTIPLE_CHOICES=300,i.MOVED_PERMANENTLY=301,i.MOVED_TEMPORARILY=302,i.SEE_OTHER=303,i.NOT_MODIFIED=304,i.USE_PROXY=305,i.TEMPORARY_REDIRECT=307,i.BAD_REQUEST=400,i.UNAUTHORIZED=401,i.PAYMENT_REQUIRED=402,i.FORBIDDEN=403,i.NOT_FOUND=404,i.METHOD_NOT_ALLOWED=405,i.NOT_ACCEPTABLE=406,i.PROXY_AUTHENTICATION_REQUIRED=407,i.REQUEST_TIME_OUT=408,i.CONFLICT=409,i.GONE=410,i.LENGTH_REQUIRED=411,i.PRECONDITION_FAILED=412,i.REQUEST_ENTITY_TOO_LARGE=413,i.REQUEST_URI_TOO_LARGE=414,i.UNSUPPORTED_MEDIA_TYPE=415,i.REQUESTED_RANGE_NOT_SATISFIABLE=416,i.EXPECTATION_FAILED=417,i.IM_A_TEAPOT=418,i.UNPROCESSABLE_ENTITY=422,i.LOCKED=423,i.FAILED_DEPENDENCY=424,i.UNORDERED_COLLECTION=425,i.UPGRADE_REQUIRED=426,i.PRECONDITION_REQUIRED=428,i.TOO_MANY_REQUESTS=429,i.REQUEST_HEADER_FIELDS_TOO_LARGE=431,i.INTERNAL_SERVER_ERROR=500,i.NOT_IMPLEMENTED=501,i.BAD_GATEWAY=502,i.SERVICE_UNAVAILABLE=503,i.GATEWAY_TIME_OUT=504,i.HTTP_VERSION_NOT_SUPPORTED=505,i.VARIANT_ALSO_NEGOTIATES=506,i.INSUFFICIENT_STORAGE=507,i.BANDWIDTH_LIMIT_EXCEEDED=509,i.NOT_EXTENDED=510,i.NETWORK_AUTHENTICATION_REQUIRED=511},function(u,i,c){u.exports=window.fetch||(window.fetch=c(6).default||c(6))},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.Manifest=void 0;var b=c(1),h=c(0),f=function(d){function e(t,n){var r=d.call(this,t,n)||this;if(r.index=0,r._allRanges=null,r.items=[],r._topRanges=[],r.__jsonld.structures&&r.__jsonld.structures.length)for(var p=r._getTopRanges(),v=0;v<p.length;v++){var I=p[v];r._parseRanges(I,String(v))}return r}return m(e,d),e.prototype.getPosterCanvas=function(){var t=this.getProperty("posterCanvas");return t&&(t=new h.Canvas(t,this.options)),t},e.prototype.getAccompanyingCanvas=function(){var t=this.getProperty("accompanyingCanvas");return t&&(t=new h.Canvas(t,this.options)),t},e.prototype.getBehavior=function(){var t=this.getProperty("behavior");return Array.isArray(t)&&(t=t[0]),t||null},e.prototype.getDefaultTree=function(){if(d.prototype.getDefaultTree.call(this),this.defaultTree.data.type=h.Utils.normaliseType(h.TreeNodeType.MANIFEST),!this.isLoaded)return this.defaultTree;var t=this.getTopRanges();return t.length&&t[0].getTree(this.defaultTree),h.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},e.prototype._getTopRanges=function(){var t=[];if(this.__jsonld.structures&&this.__jsonld.structures.length){for(var n=0;n<this.__jsonld.structures.length;n++){var r=this.__jsonld.structures[n];r.viewingHint===b.ViewingHint.TOP&&t.push(r)}if(!t.length){var p={};p.ranges=this.__jsonld.structures,t.push(p)}}return t},e.prototype.getTopRanges=function(){return this._topRanges},e.prototype._getRangeById=function(t){if(this.__jsonld.structures&&this.__jsonld.structures.length)for(var n=0;n<this.__jsonld.structures.length;n++){var r=this.__jsonld.structures[n];if(r["@id"]===t||r.id===t)return r}return null},e.prototype._parseRanges=function(t,n,r){var p,v=null;if(typeof t=="string"&&(v=t,t=this._getRangeById(v)),t){(p=new h.Range(t,this.options)).parentRange=r,p.path=n,r?r.items.push(p):this._topRanges.push(p);var I=t.items||t.members;if(I)for(var x=0;x<I.length;x++){var O=I[x];if(O["@type"]&&O["@type"].toLowerCase()==="sc:range"||O.type&&O.type.toLowerCase()==="range")this._parseRanges(O,n+"/"+x,p);else if(O["@type"]&&O["@type"].toLowerCase()==="sc:canvas"||O.type&&O.type.toLowerCase()==="canvas"){p.canvases||(p.canvases=[]);var S=O.id||O["@id"];p.canvases.push(S)}}else if(t.ranges)for(x=0;x<t.ranges.length;x++)this._parseRanges(t.ranges[x],n+"/"+x,p)}else console.warn("Range:",v,"does not exist")},e.prototype.getAllRanges=function(){if(this._allRanges!=null)return this._allRanges;this._allRanges=[];for(var t=this.getTopRanges(),n=function(v){var I=t[v];I.id&&r._allRanges.push(I);var x=function(S,C){S.add(C);var _=C.getRanges();return _.length?_.reduce(x,S):S},O=Array.from(I.getRanges().reduce(x,new Set));r._allRanges=r._allRanges.concat(O)},r=this,p=0;p<t.length;p++)n(p);return this._allRanges},e.prototype.getRangeById=function(t){for(var n=this.getAllRanges(),r=0;r<n.length;r++){var p=n[r];if(p.id===t)return p}return null},e.prototype.getRangeByPath=function(t){for(var n=this.getAllRanges(),r=0;r<n.length;r++){var p=n[r];if(p.path===t)return p}return null},e.prototype.getSequences=function(){if(this.items.length)return this.items;var t=this.__jsonld.mediaSequences||this.__jsonld.sequences;if(t)for(var n=0;n<t.length;n++){var r=t[n],p=new h.Sequence(r,this.options);this.items.push(p)}else this.__jsonld.items&&(p=new h.Sequence(this.__jsonld.items,this.options),this.items.push(p));return this.items},e.prototype.getSequenceByIndex=function(t){return this.getSequences()[t]},e.prototype.getTotalSequences=function(){return this.getSequences().length},e.prototype.getManifestType=function(){var t=this.getService(b.ServiceProfile.UI_EXTENSIONS);return t?t.getProperty("manifestType"):h.ManifestType.EMPTY},e.prototype.isMultiSequence=function(){return this.getTotalSequences()>1},e.prototype.isPagingEnabled=function(){var t=this.getViewingHint();if(t)return t===b.ViewingHint.PAGED;var n=this.getBehavior();return!!n&&n===b.Behavior.PAGED},e.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},e.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},e}(h.IIIFResource);i.Manifest=f},function(u,i,c){"use strict";var s;Object.defineProperty(i,"__esModule",{value:!0}),i.ManifestType=void 0,function(m){m.EMPTY="",m.MANUSCRIPT="manuscript",m.MONOGRAPH="monograph"}(s||(i.ManifestType=s={}))},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.Range=void 0;var b=c(0),h=c(1),f=function(d){function e(t,n){var r=d.call(this,t,n)||this;return r._ranges=null,r.canvases=null,r.items=[],r}return m(e,d),e.prototype.getCanvasIds=function(){return this.__jsonld.canvases?this.__jsonld.canvases:this.canvases?this.canvases:[]},e.prototype.getDuration=function(){if(this.canvases&&this.canvases.length){for(var t=[],n=[],r=0,p=this.canvases;r<p.length;r++)if(T=p[r]){var v=T.match(/(.*)#t=([0-9.]+),?([0-9.]+)?/)||[void 0,T],I=v[1],x=v[2],O=v[3];I&&(t.push(parseFloat(x)),n.push(parseFloat(O)))}if(t.length&&n.length)return new b.Duration(Math.min.apply(Math,t),Math.max.apply(Math,n))}else{t=[],n=[];for(var S=0,C=L=this.getRanges();S<C.length;S++)(R=C[S].getDuration())&&(t.push(R.start),n.push(R.end));if(t.length&&n.length)return new b.Duration(Math.min.apply(Math,t),Math.max.apply(Math,n))}var _,g;if(this.canvases&&this.canvases.length)for(var E=0;E<this.canvases.length;E++){var T=this.canvases[E],A=b.Utils.getTemporalComponent(T);A&&A.length>1&&(E===0&&(_=Number(A[0])),E===this.canvases.length-1&&(g=Number(A[1])))}else{var L=this.getRanges();for(E=0;E<L.length;E++){var R;(R=L[E].getDuration())&&(E===0&&(_=R.start),E===L.length-1&&(g=R.end))}}if(_!==void 0&&g!==void 0)return new b.Duration(_,g)},e.prototype.getRanges=function(){return this._ranges?this._ranges:this._ranges=this.items.filter(function(t){return t.isRange()})},e.prototype.getBehavior=function(){var t=this.getProperty("behavior");return Array.isArray(t)&&(t=t[0]),t||null},e.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},e.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},e.prototype.getTree=function(t){t.data=this,this.treeNode=t;var n=this.getRanges();if(n&&n.length)for(var r=0;r<n.length;r++){var p=n[r],v=new b.TreeNode;t.addNode(v),this._parseTreeNode(v,p)}return b.Utils.generateTreeNodeIds(t),t},e.prototype.spansTime=function(t){var n=this.getDuration();return!!(n&&t>=n.start&&t<=n.end)},e.prototype._parseTreeNode=function(t,n){t.label=n.getLabel().getValue(this.options.locale),t.data=n,t.data.type=b.Utils.normaliseType(b.TreeNodeType.RANGE),n.treeNode=t;var r=n.getRanges();if(r&&r.length)for(var p=0;p<r.length;p++){var v=r[p];if(v.getBehavior()!==h.Behavior.NO_NAV){var I=new b.TreeNode;t.addNode(I),this._parseTreeNode(I,v)}}},e}(b.ManifestResource);i.Range=f},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(h,f){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,e){d.__proto__=e}||function(d,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])})(h,f)},function(h,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function d(){this.constructor=h}s(h,f),h.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)});Object.defineProperty(i,"__esModule",{value:!0}),i.Rendering=void 0;var b=function(h){function f(d,e){return h.call(this,d,e)||this}return m(f,h),f.prototype.getFormat=function(){return this.getProperty("format")},f}(c(0).ManifestResource);i.Rendering=b},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(d,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(d,e)},function(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=d}s(d,e),d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});Object.defineProperty(i,"__esModule",{value:!0}),i.Sequence=void 0;var b=c(1),h=c(0),f=function(d){function e(t,n){var r=d.call(this,t,n)||this;return r.items=[],r._thumbnails=null,r}return m(e,d),e.prototype.getCanvases=function(){if(this.items.length)return this.items;var t=this.__jsonld.canvases||this.__jsonld.elements;if(t)for(var n=0;n<t.length;n++){var r=t[n];(p=new h.Canvas(r,this.options)).index=n,this.items.push(p)}else if(this.__jsonld)for(n=0;n<this.__jsonld.length;n++){var p;r=this.__jsonld[n],(p=new h.Canvas(r,this.options)).index=n,this.items.push(p)}return this.items},e.prototype.getCanvasById=function(t){for(var n=0;n<this.getTotalCanvases();n++){var r=this.getCanvasByIndex(n),p=h.Utils.normaliseUrl(r.id);if(h.Utils.normaliseUrl(t)===p)return r}return null},e.prototype.getCanvasByIndex=function(t){return this.getCanvases()[t]},e.prototype.getCanvasIndexById=function(t){for(var n=0;n<this.getTotalCanvases();n++)if(this.getCanvasByIndex(n).id===t)return n;return null},e.prototype.getCanvasIndexByLabel=function(t,n){t=t.trim(),isNaN(t)||(t=parseInt(t,10).toString(),n&&(t+="r"));for(var r,p,v,I=/(\d*)\D+(\d*)/,x=0;x<this.getTotalCanvases();x++){var O=this.getCanvasByIndex(x);if(O.getLabel().getValue(this.options.locale)===t||(r=I.exec(t))&&(p=r[1],(v=r[2])&&new RegExp("^"+p+"\\D+"+v+"$").test(O.getLabel().toString())))return x}return-1},e.prototype.getLastCanvasLabel=function(t){for(var n=this.getTotalCanvases()-1;n>=0;n--){var r=this.getCanvasByIndex(n).getLabel().getValue(this.options.locale);if(t){if(/^[a-zA-Z0-9]*$/.test(r))return r}else if(r)return r}return this.options.defaultLabel},e.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},e.prototype.getNextPageIndex=function(t,n){var r;if(n){var p=this.getPagedIndices(t),v=this.getViewingDirection();r=v&&v===b.ViewingDirection.RIGHT_TO_LEFT?p[0]+1:p[p.length-1]+1}else r=t+1;return r>this.getLastPageIndex()?-1:r},e.prototype.getPagedIndices=function(t,n){var r=[];if(n){r=this.isFirstCanvas(t)||this.isLastCanvas(t)?[t]:t%2?[t,t+1]:[t-1,t];var p=this.getViewingDirection();p&&p===b.ViewingDirection.RIGHT_TO_LEFT&&(r=r.reverse())}else r.push(t);return r},e.prototype.getPrevPageIndex=function(t,n){var r;if(n){var p=this.getPagedIndices(t),v=this.getViewingDirection();r=v&&v===b.ViewingDirection.RIGHT_TO_LEFT?p[p.length-1]-1:p[0]-1}else r=t-1;return r},e.prototype.getStartCanvasIndex=function(){var t=this.getStartCanvas();if(t){for(var n=0;n<this.getTotalCanvases();n++)if(this.getCanvasByIndex(n).id===t)return n}return 0},e.prototype.getThumbs=function(t,n){for(var r=[],p=this.getTotalCanvases(),v=0;v<p;v++){var I=this.getCanvasByIndex(v),x=new h.Thumb(t,I);r.push(x)}return r},e.prototype.getThumbnails=function(){if(this._thumbnails!=null)return this._thumbnails;this._thumbnails=[];for(var t=this.getCanvases(),n=0;n<t.length;n++){var r=t[n].getThumbnail();r&&this._thumbnails.push(r)}return this._thumbnails},e.prototype.getStartCanvas=function(){return this.getProperty("startCanvas")},e.prototype.getTotalCanvases=function(){return this.getCanvases().length},e.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):this.options.resource.getViewingDirection?this.options.resource.getViewingDirection():null},e.prototype.getViewingHint=function(){return this.getProperty("viewingHint")},e.prototype.isCanvasIndexOutOfRange=function(t){return t>this.getTotalCanvases()-1},e.prototype.isFirstCanvas=function(t){return t===0},e.prototype.isLastCanvas=function(t){return t===this.getTotalCanvases()-1},e.prototype.isMultiCanvas=function(){return this.getTotalCanvases()>1},e.prototype.isPagingEnabled=function(){var t=this.getViewingHint();return!!t&&t===b.ViewingHint.PAGED},e.prototype.isTotalCanvasesEven=function(){return this.getTotalCanvases()%2==0},e}(h.ManifestResource);i.Sequence=f},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Deserialiser=void 0;var s=c(0),m=function(){function b(){}return b.parse=function(h,f){return typeof h=="string"&&(h=JSON.parse(h)),this.parseJson(h,f)},b.parseJson=function(h,f){var d;if(f&&f.navDate&&!isNaN(f.navDate.getTime())&&(h.navDate=f.navDate.toString()),h["@type"])switch(h["@type"]){case"sc:Collection":d=this.parseCollection(h,f);break;case"sc:Manifest":d=this.parseManifest(h,f);break;default:return null}else switch(h.type){case"Collection":d=this.parseCollection(h,f);break;case"Manifest":d=this.parseManifest(h,f);break;default:return null}return d.isLoaded=!0,d},b.parseCollection=function(h,f){var d=new s.Collection(h,f);return f?(d.index=f.index||0,f.resource&&(d.parentCollection=f.resource.parentCollection)):d.index=0,this.parseCollections(d,f),this.parseManifests(d,f),this.parseItems(d,f),d},b.parseCollections=function(h,f){var d;if(h.__jsonld.collections?d=h.__jsonld.collections:h.__jsonld.items&&(d=h.__jsonld.items.filter(function(n){return n.type.toLowerCase()==="collection"})),d)for(var e=0;e<d.length;e++){f&&(f.index=e);var t=this.parseCollection(d[e],f);t.index=e,t.parentCollection=h,h.items.push(t)}},b.parseManifest=function(h,f){return new s.Manifest(h,f)},b.parseManifests=function(h,f){var d;if(h.__jsonld.manifests?d=h.__jsonld.manifests:h.__jsonld.items&&(d=h.__jsonld.items.filter(function(n){return n.type.toLowerCase()==="manifest"})),d)for(var e=0;e<d.length;e++){var t=this.parseManifest(d[e],f);t.index=e,t.parentCollection=h,h.items.push(t)}},b.parseItem=function(h,f){if(h["@type"]){if(h["@type"].toLowerCase()==="sc:manifest")return this.parseManifest(h,f);if(h["@type"].toLowerCase()==="sc:collection")return this.parseCollection(h,f)}else if(h.type){if(h.type.toLowerCase()==="manifest")return this.parseManifest(h,f);if(h.type.toLowerCase()==="collection")return this.parseCollection(h,f)}return null},b.parseItems=function(h,f){var d=h.__jsonld.members||h.__jsonld.items;if(d)for(var e=function(p){f&&(f.index=p);var v=t.parseItem(d[p],f);return v?h.items.filter(function(I){return I.id===v.id})[0]?"continue":(v.index=p,v.parentCollection=h,void h.items.push(v)):{value:void 0}},t=this,n=0;n<d.length;n++){var r=e(n);if(typeof r=="object")return r.value}},b}();i.Deserialiser=m},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(f,d){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(f,d)},function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function e(){this.constructor=f}s(f,d),f.prototype=d===null?Object.create(d):(e.prototype=d.prototype,new e)});Object.defineProperty(i,"__esModule",{value:!0}),i.Service=void 0;var b=c(0),h=function(f){function d(e,t){return f.call(this,e,t)||this}return m(d,f),d.prototype.getProfile=function(){var e=this.getProperty("profile");return e||(e=this.getProperty("dcterms:conformsTo")),Array.isArray(e)?e[0]:e},d.prototype.getConfirmLabel=function(){return b.Utils.getLocalisedValue(this.getProperty("confirmLabel"),this.options.locale)},d.prototype.getDescription=function(){return b.Utils.getLocalisedValue(this.getProperty("description"),this.options.locale)},d.prototype.getFailureDescription=function(){return b.Utils.getLocalisedValue(this.getProperty("failureDescription"),this.options.locale)},d.prototype.getFailureHeader=function(){return b.Utils.getLocalisedValue(this.getProperty("failureHeader"),this.options.locale)},d.prototype.getHeader=function(){return b.Utils.getLocalisedValue(this.getProperty("header"),this.options.locale)},d.prototype.getServiceLabel=function(){return b.Utils.getLocalisedValue(this.getProperty("label"),this.options.locale)},d.prototype.getInfoUri=function(){var e=this.id;return e.endsWith("/")||(e+="/"),e+"info.json"},d}(b.ManifestResource);i.Service=h},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Size=void 0,i.Size=function(s,m){this.width=s,this.height=m}},function(u,i,c){"use strict";var s;Object.defineProperty(i,"__esModule",{value:!0}),i.StatusCode=void 0,function(m){m[m.AUTHORIZATION_FAILED=1]="AUTHORIZATION_FAILED",m[m.FORBIDDEN=2]="FORBIDDEN",m[m.INTERNAL_SERVER_ERROR=3]="INTERNAL_SERVER_ERROR",m[m.RESTRICTED=4]="RESTRICTED"}(s||(i.StatusCode=s={}))},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Thumb=void 0,i.Thumb=function(s,m){this.data=m,this.index=m.index,this.width=s;var b=m.getHeight()/m.getWidth();this.height=b?Math.floor(this.width*b):s,this.uri=m.getCanonicalImageUri(s),this.label=m.getLabel().getValue(),this.viewingHint=m.getViewingHint()}},function(u,i,c){"use strict";var s,m=this&&this.__extends||(s=function(h,f){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,e){d.__proto__=e}||function(d,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])})(h,f)},function(h,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function d(){this.constructor=h}s(h,f),h.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)});Object.defineProperty(i,"__esModule",{value:!0}),i.Thumbnail=void 0;var b=function(h){function f(d,e){return h.call(this,d,e)||this}return m(f,h),f}(c(0).Resource);i.Thumbnail=b},function(u,i,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.TreeNode=void 0;var s=c(0),m=function(){function b(h,f){this.label=h,this.data=f||{},this.nodes=[]}return b.prototype.addNode=function(h){this.nodes.push(h),h.parentNode=this},b.prototype.isCollection=function(){return this.data.type===s.Utils.normaliseType(s.TreeNodeType.COLLECTION)},b.prototype.isManifest=function(){return this.data.type===s.Utils.normaliseType(s.TreeNodeType.MANIFEST)},b.prototype.isRange=function(){return this.data.type===s.Utils.normaliseType(s.TreeNodeType.RANGE)},b}();i.TreeNode=m},function(u,i,c){"use strict";var s;Object.defineProperty(i,"__esModule",{value:!0}),i.TreeNodeType=void 0,function(m){m.COLLECTION="collection",m.MANIFEST="manifest",m.RANGE="range"}(s||(i.TreeNodeType=s={}))}])},function(a,o,l){"use strict";l.r(o),l.d(o,"BaseComponent",function(){return u});var u=function(){function i(c){this.options=c,this.options.data=Object.assign({},this.data(),c.data)}return i.prototype._init=function(){return this.el=this.options.target,this.el?(this.el.innerHTML="",!0):(console.warn("element not found"),!1)},i.prototype.data=function(){return{}},i.prototype.on=function(c,s,m){var b=this._e||(this._e={});(b[c]||(b[c]=[])).push({fn:s,ctx:m})},i.prototype.fire=function(c){for(var s=[],m=1;m<arguments.length;m++)s[m-1]=arguments[m];for(var b=[].slice.call(arguments,1),h=((this._e||(this._e={}))[c]||[]).slice(),f=0,d=h.length;f<d;f++)h[f].fn.apply(h[f].ctx,b)},i.prototype._resize=function(){},i.prototype.set=function(c){},i}()},function(a,o,l){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(s,m,b,h,f,d,e){return d===void 0&&(d="Less information: Hide {0}"),e===void 0&&(e="More information: Reveal {0}"),s.each(function(){var t=$(this),n=t.find(".label");t.find(".value").each(function(r,p){for(var v=$(p),I=v.html(),x=n.contents().filter(function(){return this.nodeType===Node.TEXT_NODE}).text().trim(),O=$('<span>… <a href="#" class="toggle more">morepad</a></span>'),S=[I],C=t.height();v.text().length>0;){c(v);var _=v.html();v.append(O);var g=v.height();g!==void 0&&C!==void 0&&C>g&&(S.unshift(_),C=v.height()),O.remove()}if(S.length<=m)v.html(I);else{var E=S[m-1],T=!1;v.toggle=function(){v.empty();var A=$('<a href="#" class="toggle"></a>');if(T){var L=u.Strings.format(d,x);v.html(I+" "),A.text(b),i(A,"less","more"),A.attr("aria-label",L)}else{var R=u.Strings.format(e,x);v.html(E+"… "),A.text(h),i(A,"more","less"),A.attr("aria-label",R)}A.one("click",function(q){q.preventDefault(),v.toggle()}),T=!T,v.append(A),f&&f()},v.toggle()}})})};var u=l(0);function i(s,m,b){return s.each(function(){$(this).removeClass(m).addClass(b)})}function c(s,m,b){return m===void 0&&(m=8),b===void 0&&(b=0),s.each(function(){var h=$(this);if(h.contents().length>0){var f=h.contents().last();if(f[0].nodeType===3){var d=f.text().trim().split(" ");if(d.length>1)return d.splice(d.length-1,1),void(f[0].data=d.join(" "));if(m!==void 0&&d.length===1&&d[0].length>m)return void(f[0].data=d.join(" ").substring(0,m))}c(f,m,b+1)}else b>0&&h.remove()})}}])})});var it=class{constructor(o,l){this.informationType=o;this.param=l}};var lt=class{};lt.FORBIDDEN="forbiddenResourceMessage";var K=et(kt());var Q=et(Ft());var ue=H(),nt=class a{static loadExternalResources(o,l){return new Promise(u=>{K.Utils.loadExternalResourcesAuth09(o,l,a.clickThrough,a.restricted,a.login,a.getAccessToken,a.storeAccessToken,a.getStoredAccessToken,a.handleExternalResourceResponse).then(i=>{u(i)}).catch(i=>{switch(i.name){case K.StatusCode.AUTHORIZATION_FAILED.toString():a.publish(y.LOGIN_FAILED);break;case K.StatusCode.FORBIDDEN.toString():a.publish(y.FORBIDDEN);break;case K.StatusCode.RESTRICTED.toString():break;default:a.publish(y.SHOW_MESSAGE,[i.message||i])}})})}static clickThrough(o){return new Promise(l=>{a.publish(y.SHOW_CLICKTHROUGH_DIALOGUE,[{resource:o,acceptCallback:()=>{if(o.clickThroughService){let u=window.open(o.clickThroughService.id),i=window.setInterval(()=>{u&&u.closed&&(window.clearInterval(i),a.publish(y.CLICKTHROUGH),l())},500)}}}])})}static restricted(o){return new Promise((l,u)=>{a.publish(y.SHOW_RESTRICTED_DIALOGUE,[{resource:o,acceptCallback:()=>{a.publish(w.LOAD_FAILED),u(o)}}])})}static login(o){return new Promise(l=>{let u={};o.status===Q.FORBIDDEN&&(u.warningMessage=lt.FORBIDDEN,u.showCancelButton=!0),console.log("login"),a.publish(y.SHOW_LOGIN_DIALOGUE,[{resource:o,loginCallback:()=>{if(o.loginService){let i=window.open(o.loginService.id+"?t="+new Date().getTime()),c=window.setInterval(function(){i&&i.closed&&(window.clearInterval(c),a.publish(y.LOGIN),l())},500)}},logoutCallback:()=>{if(o.logoutService){let i=window.open(o.logoutService.id+"?t="+new Date().getTime()),c=window.setInterval(function(){i&&i.closed&&(window.clearInterval(c),a.publish(y.LOGOUT),l())},500)}},options:u}])})}static getAccessToken(o,l){return new Promise((u,i)=>{if(o.tokenService){let c=o.tokenService.id,s=c+"|"+new Date().getTime(),m=h=>{window.removeEventListener("message",m);let f=h.data;f.error?i(l?f.errorDescription:void 0):u(f)};window.addEventListener("message",m,!1);let b=c+"?messageId="+s;ue("#commsFrame").prop("src",b)}else i("Token service not found")})}static storeAccessToken(o,l,u){return new Promise((i,c)=>{o.tokenService?(U.set(o.tokenService.id,l,l.expiresIn,u),i()):c("Token service not found")})}static getStoredAccessToken(o,l){return new Promise((u,i)=>{let c=[],s=null;if(o.tokenService&&(s=U.get(o.tokenService.id,l)),s)c.push(s);else{let b=G.getUrlParts(o.dataUri).hostname,h=U.getItems(l);for(let f=0;f<h.length;f++)s=h[f],s.key.includes(b)&&c.push(s)}c=c.sort((b,h)=>b.expiresAt-h.expiresAt);let m;c.length&&(m=c[c.length-1].value,u(m))})}static handleExternalResourceResponse(o){return new Promise((l,u)=>{if(o.isResponseHandled=!0,o.status===Q.OK)l(o);else if(o.status===Q.MOVED_TEMPORARILY)l(o),a.publish(y.RESOURCE_DEGRADED,[o]);else if(o.error.status===Q.UNAUTHORIZED||o.error.status===Q.INTERNAL_SERVER_ERROR)u(o.error.statusText);else if(o.error.status===Q.FORBIDDEN){let i=new Error;i.message="Forbidden",i.name=K.StatusCode.FORBIDDEN.toString(),u(i)}else u(o.error.statusText)})}static handleDegraded(o){let l=new it(1,o);a.publish(y.SHOW_INFORMATION,[l])}};var ot=et(kt());var Vt=et(Ft()),ce=H(),M=class M{static loadExternalResources(o,l,u){return new Promise(i=>{M.storageStrategy=l,o=o.map(c=>(c.authAPIVersion=1,c.options=u,c)),ot.Utils.loadExternalResourcesAuth1(o,M.openContentProviderInteraction,M.openTokenService,M.getStoredAccessToken,M.userInteractedWithContentProvider,M.getContentProviderInteraction,M.handleMovedTemporarily,M.showOutOfOptionsMessages).then(c=>{i(c)}).catch(c=>{switch(c.name){case ot.StatusCode.AUTHORIZATION_FAILED.toString():M.publish(y.LOGIN_FAILED);break;case ot.StatusCode.FORBIDDEN.toString():M.publish(y.FORBIDDEN);break;case ot.StatusCode.RESTRICTED.toString():break;default:M.publish(y.SHOW_MESSAGE,[c.message||c])}})})}static getCookieServiceUrl(o){return o.id+"?origin="+M.getOrigin()}static openContentProviderInteraction(o){let l=M.getCookieServiceUrl(o);return window.open(l)}static getOrigin(o){let l=window.location;return o&&(l=document.createElement("a"),l.href=o),l.protocol+"//"+l.hostname+(l.port?":"+l.port:"")}static userInteractedWithContentProvider(o){return new Promise(l=>{let u=window.setInterval(()=>{o.closed&&(window.clearInterval(u),l(!0))},500)})}static handleMovedTemporarily(o){return new Promise(l=>{M.showDegradedMessage(o),o.isResponseHandled=!0,l()})}static showDegradedMessage(o){if(o.kioskService)M.publish(y.OPEN_EXTERNAL_RESOURCE,[[o]]);else{let l=new it(1,o);M.publish(y.SHOW_INFORMATION,[l])}}static storeAccessToken(o,l){return new Promise((u,i)=>{o.tokenService?(U.set(o.tokenService.id,l,l.expiresIn||3600,M.storageStrategy),u()):i("Token service not found")})}static getStoredAccessToken(o){return new Promise((l,u)=>{let i=[],c=null;if(o.tokenService&&(c=U.get(o.tokenService.id,M.storageStrategy)),c)i.push(c);else{let m=G.getUrlParts(o.dataUri).hostname,b=U.getItems(M.storageStrategy);for(let h=0;h<b.length;h++)c=b[h],c.key.includes(m)&&i.push(c)}i=i.sort((m,b)=>m.expiresAt-b.expiresAt);let s=null;i.length&&(s=i[i.length-1].value),l(s)})}static getContentProviderInteraction(o,l){return new Promise(u=>{o.isResponseHandled&&!o.authHoldingPage?(M.showDegradedMessage(o),u(null)):o.authHoldingPage?(o.authHoldingPage.location.href=M.getCookieServiceUrl(l),u(o.authHoldingPage)):M.publish(y.SHOW_AUTH_DIALOGUE,[{service:l,closeCallback:()=>{u(null)},confirmCallback:()=>{let i=M.openContentProviderInteraction(l);u(i)},cancelCallback:()=>{u(null)}}])})}static openTokenService(o,l){return new Promise((u,i)=>{let c=M.getOrigin(l.id),s=new Date().getTime();M.messages[s]={resolve:u,reject:i,serviceOrigin:c,resource:o},window.addEventListener("message",M.receiveToken,!1);let m=l.id+"?messageId="+s+"&origin="+M.getOrigin();ce("#commsFrame").prop("src",m);let b=5e3;setTimeout(()=>{M.messages[s]&&(M.messages[s].reject("Message unhandled after "+b+"ms, rejecting"),delete M.messages[s])},b)})}static receiveToken(o){if(o.data.hasOwnProperty("messageId")){let l=M.messages[o.data.messageId];l&&o.origin==l.serviceOrigin&&M.storeAccessToken(l.resource,o.data).then(()=>{l.resolve(o.data),delete M.messages[o.data.messageId]})}}static showOutOfOptionsMessages(o,l){if(o.status==Vt.MOVED_TEMPORARILY)return;let u="";l.getFailureHeader()&&(u+="<p>"+l.getFailureHeader()+"</p>"),l.getFailureDescription()&&(u+=l.getFailureDescription()),M.publish(y.SHOW_MESSAGE,[V(u)])}};M.messages={};var ut=M;var ft=class{constructor(o,l,u){this.isResized=!1;this.$element=o,this.fitToParentWidth=l||!1,this.fitToParentHeight=u||!1,this.create()}create(){this.extensionHost?.subscribe(w.RESIZE,()=>{this.resize()})}whenResized(o){Mt.waitFor(()=>this.isResized,o)}onAccessibleClick(o,l,u=!0,i=!1){u&&o.on("click",c=>{l(c)}),o.on("keydown",c=>{let s=c.target.nodeName==="A"&&!i;(c.which===32&&!s||c.which===13)&&(c.preventDefault(),l(c))})}resize(){let o=this.$element.parent();this.fitToParentWidth&&this.$element.width(o.width()),this.fitToParentHeight&&this.$element.height(o.height()),this.isResized=!0}};var he=H(),D=class extends ft{constructor(o,l,u){super(o,l,u)}create(){this.extensionHost=this.$element.closest(".uv-iiif-extension-host").data("component"),super.create(),this.extension=this.extensionHost.extension,this.config={},this.config.content={},this.config.options={};var o=this;o.modules&&o.modules.length&&(o.modules=o.modules.reverse(),o.modules.forEach(l=>{o.config=he.extend(!0,o.config,o.extension.data.config.modules[l])})),this.content=this.config.content,this.options=this.config.options}init(){}setConfig(o){this.modules||(this.modules=[]),this.modules.push(o)}resize(){super.resize()}};var tt=H(),F=class extends D{constructor(l){super(l,!1,!1);this.allowClose=!0;this.isActive=!1;this.isUnopened=!0}create(){this.setConfig("dialogue"),super.create(),this.extensionHost.subscribe(y.CLOSE_ACTIVE_DIALOGUE,()=>{this.isActive&&this.allowClose&&this.close()}),this.extensionHost.subscribe(y.ESCAPE,()=>{this.isActive&&this.allowClose&&this.close()}),this.$top=tt('<div class="top"></div>'),this.$element.append(this.$top),this.$closeButton=tt('<button type="button" class="btn btn-default close" tabindex="0">'+this.content.close+"</button>"),this.$middle=tt('<div class="middle"></div>'),this.$element.append(this.$middle),this.$content=tt('<div class="content"></div>'),this.$middle.append(this.$content),this.$buttons=tt('<div class="buttons"></div>'),this.$middle.append(this.$buttons),this.$bottom=tt('<div class="bottom"></div>'),this.$element.append(this.$bottom),this.options.topCloseButtonEnabled?this.$top.append(this.$closeButton):this.$buttons.append(this.$closeButton),this.$closeButton.on("click",l=>{l.preventDefault(),this.close()}),this.returnFunc=this.close}enableClose(){this.allowClose=!0,this.$closeButton.show()}disableClose(){this.allowClose=!1,this.$closeButton.hide()}setDockedPosition(){let l=Math.floor(this.extension.height()-this.$element.outerHeight(!0)),u=0,i=0,c=0;if(this.$triggerButton){let b=this.$triggerButton.offset().top,h=this.extension.$element.offset().top,f=this.$element.outerHeight(!0);l=b-h-f+4;let e=this.$triggerButton.offset().left,t=this.extension.$element.offset().left,n=e-t;c=Nt.normalise(n,0,this.extension.width()),u=Math.floor(this.extension.width()*c-this.$element.width()*c)+2,i=Math.floor(this.$element.width()*c)}this.$bottom.css("backgroundPosition",i+"px 0px"),this.$element.css({top:l,left:u})}open(l){this.extensionHost.publish(y.CLOSE_ACTIVE_DIALOGUE),this.$element.attr("aria-hidden","false"),this.$element.show(),l?(this.$triggerButton=tt(l),this.$bottom.show()):this.$bottom.hide(),this.isActive=!0,setTimeout(()=>{let u=this.$element.find(".default");if(u.length)u.focus();else{let i=this.$element.find("input:visible, select:visible").first();i.length?i.focus():this.$closeButton.focus()}},1),this.$element.on("keydown",u=>this.handleKeydown(u)),this.extensionHost.publish(y.SHOW_OVERLAY),this.isUnopened&&(this.isUnopened=!1,this.afterFirstOpen()),this.resize()}afterFirstOpen(){}close(){this.isActive&&(this.$element.attr("aria-hidden","true"),this.$element.hide(),this.isActive=!1,this.$element.off("keydown"),this.extensionHost.publish(this.closeCommand),this.extensionHost.publish(y.HIDE_OVERLAY))}resize(){super.resize(),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)})}handleKeydown(l){if(l.key==="Tab"){let i=this.$element.find('a[href], button, textarea, input[type="text"], input[type="radio"], input[type="checkbox"], select, [tabindex="0"]').filter(":visible"),c=i.first()[0],s=i.last()[0],m=document.activeElement;l.shiftKey?m===c&&(l.preventDefault(),s.focus()):m===s&&(l.preventDefault(),c.focus())}}};var jt=H(),gt=class extends F{constructor(o){super(o)}create(){this.setConfig("authDialogue"),super.create(),this.openCommand=y.SHOW_AUTH_DIALOGUE,this.closeCommand=y.HIDE_AUTH_DIALOGUE,this.extensionHost.subscribe(this.openCommand,o=>{let l=Array.isArray(o)?o[0]:o;this.closeCallback=l.closeCallback,this.confirmCallback=l.confirmCallback,this.cancelCallback=l.cancelCallback,this.service=l.service,this.open()}),this.extensionHost.subscribe(this.closeCommand,()=>{this.close()}),this.$title=jt('<div role="heading" class="heading"></div>'),this.$content.append(this.$title),this.$content.append(' <div> <p class="message scroll"></p> </div>'),this.$buttons.prepend(this._buttonsToAdd()),this.$message=this.$content.find(".message"),this.$confirmButton=this.$buttons.find(".confirm"),this.$confirmButton.text(this.content.confirm),this.$cancelButton=this.$buttons.find(".close"),this.$cancelButton.text(this.content.cancel),this.$element.hide(),this.$confirmButton.on("click",o=>{o.preventDefault(),this.confirmCallback&&this.confirmCallback(),this.close()}),this.$cancelButton.on("click",o=>{o.preventDefault(),this.cancelCallback&&this.cancelCallback(),this.close()})}open(){if(!this.service){console.error("NO SERVICE");return}super.open();let o=this.service.getHeader(),l=this.service.getDescription(),u=this.service.getConfirmLabel();o&&this.$title.text(V(o)),l&&(this.$message.html(V(l)),this.$message.targetBlank(),this.$message.find("a").on("click",function(){let i=jt(this).attr("href");this.extensionHost.publish(y.EXTERNAL_LINK_CLICKED,i)})),u&&this.$confirmButton.text(V(u)),this.resize()}resize(){super.resize()}_buttonsToAdd(){var o='<a class="confirm btn btn-primary" href="#" target="_parent"></a>';return this.options.topCloseButtonEnabled&&(o+='<button class="close btn btn-default"></button>'),o}};var Qt=H(),mt=class extends F{constructor(o){super(o)}create(){this.setConfig("clickThroughDialogue"),super.create(),this.openCommand=y.SHOW_CLICKTHROUGH_DIALOGUE,this.closeCommand=y.HIDE_CLICKTHROUGH_DIALOGUE,this.extensionHost.subscribe(this.openCommand,o=>{this.acceptCallback=o.acceptCallback,this.resource=o.resource,this.open()}),this.extensionHost.subscribe(this.closeCommand,()=>{this.close()}),this.$title=Qt('<div role="heading" class="heading"></div>'),this.$content.append(this.$title),this.$content.append(' <div> <p class="message scroll"></p> <div class="buttons"> <a class="acceptTerms btn btn-primary" href="#" target="_parent"></a> </div> </div>'),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",o=>{o.preventDefault(),this.close(),this.extensionHost.publish(y.ACCEPT_TERMS),this.acceptCallback&&this.acceptCallback()})}open(){super.open(),this.resource.clickThroughService&&(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 o=Qt(this).attr("href");this.extensionHost.publish(y.EXTERNAL_LINK_CLICKED,o)}),this.resize()}resize(){super.resize()}};var zt=H(),vt=class extends F{constructor(o){super(o)}create(){this.setConfig("loginDialogue"),super.create(),this.openCommand=y.SHOW_LOGIN_DIALOGUE,this.closeCommand=y.HIDE_LOGIN_DIALOGUE,this.extensionHost.subscribe(this.openCommand,o=>{this.loginCallback=o.loginCallback,this.logoutCallback=o.logoutCallback,this.options=o.options,this.resource=o.resource,this.open()}),this.extensionHost.subscribe(this.closeCommand,()=>{this.close()}),this.$title=zt('<div role="heading" class="heading"></div>'),this.$content.append(this.$title),this.$content.append(' <div> <p class="message scroll"></p> <div class="buttons"> <a class="logout btn btn-primary" href="#" target="_parent"></a> <a class="login btn btn-primary" href="#" target="_parent"></a> <a class="cancel btn btn-primary" href="#"></a> </div> </div>'),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",o=>{o.preventDefault(),this.close(),this.loginCallback&&this.loginCallback()}),this.$logoutButton.on("click",o=>{o.preventDefault(),this.close(),this.logoutCallback&&this.logoutCallback()}),this.$cancelButton.on("click",o=>{o.preventDefault(),this.close()}),this.updateLogoutButton()}open(){super.open();let o="";this.resource.loginService&&(this.$title.text(this.resource.loginService.getProperty("label")),o=this.resource.loginService.getProperty("description")),this.options.warningMessage&&(o='<span class="warning">'+this.extension.data.config.content[this.options.warningMessage]+'</span><span class="description">'+o+"</span>"),this.updateLogoutButton(),this.$message.html(o),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var l=zt(this).attr("href");this.extensionHost.publish(y.EXTERNAL_LINK_CLICKED,l)}),this.options.showCancelButton?this.$cancelButton.show():this.$cancelButton.hide(),this.resize()}updateLogoutButton(){this.extension.isLoggedIn?this.$logoutButton.show():this.$logoutButton.hide()}resize(){super.resize()}};var Jt=H(),bt=class extends F{constructor(o){super(o)}create(){this.setConfig("restrictedDialogue"),super.create(),this.openCommand=y.SHOW_RESTRICTED_DIALOGUE,this.closeCommand=y.HIDE_RESTRICTED_DIALOGUE,this.extensionHost.subscribe(this.openCommand,o=>{this.acceptCallback=o.acceptCallback,this.options=o.options,this.resource=o.resource,this.open()}),this.extensionHost.subscribe(this.closeCommand,()=>{this.close()}),this.$title=Jt('<div role="heading" class="heading"></div>'),this.$content.append(this.$title),this.$content.append(' <div> <p class="message scroll"></p> <div class="buttons"> <a class="cancel btn btn-primary" href="#" target="_parent"></a> </div> </div>'),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",o=>{o.preventDefault(),this.close()})}open(){super.open(),this.isAccepted=!1;let o="";this.resource.restrictedService&&(this.$title.text(this.resource.restrictedService.getProperty("label")),o=this.resource.restrictedService.getProperty("description")),this.$message.html(o),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var l=Jt(this).attr("href");this.extensionHost.publish(y.EXTERNAL_LINK_CLICKED,l)}),this.resize()}close(){super.close(),!this.isAccepted&&this.acceptCallback&&(this.isAccepted=!0,this.acceptCallback())}resize(){super.resize()}};var Wt=H(),Et=class extends F{constructor(o){super(o)}create(){this.setConfig("genericDialogue"),super.create(),this.openCommand=y.SHOW_GENERIC_DIALOGUE,this.closeCommand=y.HIDE_GENERIC_DIALOGUE,this.extensionHost.subscribe(this.openCommand,o=>{this.acceptCallback=o.acceptCallback,this.showMessage(o)}),this.extensionHost.subscribe(this.closeCommand,()=>{this.close()}),this.$message=Wt("<p></p>"),this.$content.append(this.$message),this.$acceptButton=Wt(`
<button class="btn btn-primary accept default">
${this.content.ok}
</button>
`),this.$buttons.append(this.$acceptButton),this.$buttons.find(".close").hide(),this.$acceptButton.onPressed(()=>{this.accept()}),this.returnFunc=()=>{this.isActive&&this.accept()},this.$element.hide()}accept(){this.extensionHost.publish(y.CLOSE_ACTIVE_DIALOGUE),this.acceptCallback&&this.acceptCallback()}showMessage(o){this.$message.html(o.message),o.buttonText?this.$acceptButton.text(o.buttonText):this.$acceptButton.text(this.content.ok),o.allowClose===!1&&this.disableClose(),this.open()}resize(){super.resize()}};var z=H(),_t=class extends D{constructor(o){super(o,!0,!0)}create(){super.create(),this.extensionHost.subscribe(y.SHOW_OVERLAY,()=>{this.$overlays.show()}),this.extensionHost.subscribe(y.HIDE_OVERLAY,()=>{this.$overlays.hide()}),this.$element.append('<a class="sr-only" href="#download-btn">'+this.extension.data.config.content.skipToDownload+"</a>"),this.$headerPanel=z('<div class="headerPanel"></div>'),this.$element.append(this.$headerPanel),this.$mainPanel=z('<div class="mainPanel"></div>'),this.$element.append(this.$mainPanel),this.$centerPanel=z('<div class="centerPanel"></div>'),this.$centerPanel.append('<h2 class="sr-only">'+this.extension.data.config.content.mediaViewer+"</h2>"),this.$mainPanel.append(this.$centerPanel),this.$leftPanel=z('<div class="leftPanel"></div>'),this.$mainPanel.append(this.$leftPanel),this.$rightPanel=z('<div class="rightPanel"></div>'),this.$mainPanel.append(this.$rightPanel),this.$footerPanel=z('<div class="footerPanel"></div>'),this.$element.append(this.$footerPanel),this.$mobileFooterPanel=z('<div class="mobileFooterPanel"></div>'),this.$element.append(this.$mobileFooterPanel),this.$overlays=z('<div class="overlays"></div>'),this.$element.append(this.$overlays),this.$overlays.hide(),this.$genericDialogue=z('<div class="overlay genericDialogue" aria-hidden="true"></div>'),this.$overlays.append(this.$genericDialogue),this.$overlays.on("click",o=>{z(o.target).hasClass("overlays")&&(o.preventDefault(),this.extensionHost.publish(y.CLOSE_ACTIVE_DIALOGUE))}),new Et(this.$genericDialogue)}resize(){super.resize(),setTimeout(()=>{this.$overlays.width(this.extension.width()),this.$overlays.height(this.extension.height())},1);let o=this.$element.height()-parseInt(this.$mainPanel.css("paddingTop"))-(j(this.$headerPanel)?this.$headerPanel.height():0)-(j(this.$footerPanel)?this.$footerPanel.height():0)-(j(this.$mobileFooterPanel)?this.$mobileFooterPanel.height():0);this.$mainPanel.height(o)}};var Xt=et(le());var k;(function(a){a[a.Backspace=8]="Backspace",a[a.Tab=9]="Tab",a[a.Enter=13]="Enter",a[a.Shift=16]="Shift",a[a.Ctrl=17]="Ctrl",a[a.Alt=18]="Alt",a[a.PauseBreak=19]="PauseBreak",a[a.CapsLock=20]="CapsLock",a[a.Escape=27]="Escape",a[a.Spacebar=32]="Spacebar",a[a.PageUp=33]="PageUp",a[a.PageDown=34]="PageDown",a[a.End=35]="End",a[a.Home=36]="Home",a[a.LeftArrow=37]="LeftArrow",a[a.UpArrow=38]="UpArrow",a[a.RightArrow=39]="RightArrow",a[a.DownArrow=40]="DownArrow",a[a.PrintScrn=44]="PrintScrn",a[a.Insert=45]="Insert",a[a.Delete=46]="Delete",a[a.Zero=48]="Zero",a[a.One=49]="One",a[a.Two=50]="Two",a[a.Three=51]="Three",a[a.Four=52]="Four",a[a.Five=53]="Five",a[a.Six=54]="Six",a[a.Seven=55]="Seven",a[a.Eight=56]="Eight",a[a.Nine=57]="Nine",a[a.a=65]="a",a[a.b=66]="b",a[a.c=67]="c",a[a.d=68]="d",a[a.e=69]="e",a[a.f=70]="f",a[a.g=71]="g",a[a.h=72]="h",a[a.i=73]="i",a[a.j=74]="j",a[a.k=75]="k",a[a.l=76]="l",a[a.m=77]="m",a[a.n=78]="n",a[a.o=79]="o",a[a.p=80]="p",a[a.q=81]="q",a[a.r=82]="r",a[a.s=83]="s",a[a.t=84]="t",a[a.u=85]="u",a[a.v=86]="v",a[a.w=87]="w",a[a.x=88]="x",a[a.y=89]="y",a[a.z=90]="z",a[a.LeftWindowKey=91]="LeftWindowKey",a[a.RightWindowKey=92]="RightWindowKey",a[a.SelectKey=93]="SelectKey",a[a.Numpad0=96]="Numpad0",a[a.Numpad1=97]="Numpad1",a[a.Numpad2=98]="Numpad2",a[a.Numpad3=99]="Numpad3",a[a.Numpad4=100]="Numpad4",a[a.Numpad5=101]="Numpad5",a[a.Numpad6=102]="Numpad6",a[a.Numpad7=103]="Numpad7",a[a.Numpad8=104]="Numpad8",a[a.Numpad9=105]="Numpad9",a[a.Multiply=106]="Multiply",a[a.NumpadPlus=107]="NumpadPlus",a[a.NumpadMinus=109]="NumpadMinus",a[a.DecimalPoint=110]="DecimalPoint",a[a.Divide=111]="Divide",a[a.F1=112]="F1",a[a.F2=113]="F2",a[a.F3=114]="F3",a[a.F4=115]="F4",a[a.F5=116]="F5",a[a.F6=117]="F6",a[a.F7=118]="F7",a[a.F8=119]="F8",a[a.F9=120]="F9",a[a.F10=121]="F10",a[a.F11=122]="F11",a[a.F12=123]="F12",a[a.NumLock=144]="NumLock",a[a.ScrollLock=145]="ScrollLock",a[a.Semicolon=186]="Semicolon",a[a.Equals=187]="Equals",a[a.Comma=188]="Comma",a[a.LessThan=188]="LessThan",a[a.Dash=189]="Dash",a[a.Period=190]="Period",a[a.GreaterThan=190]="GreaterThan",a[a.ForwardSlash=191]="ForwardSlash",a[a.QuestionMark=191]="QuestionMark",a[a.GraveAccent=192]="GraveAccent",a[a.Tilde=192]="Tilde",a[a.OpenCurlyBracket=219]="OpenCurlyBracket",a[a.OpenSquareBracket=219]="OpenSquareBracket",a[a.BackSlash=220]="BackSlash",a[a.VerticalPipe=220]="VerticalPipe",a[a.CloseCurlyBracket=221]="CloseCurlyBracket",a[a.CloseSquareBracket=221]="CloseSquareBracket",a[a.Quote=222]="Quote",a[a.CommandFF=224]="CommandFF"})(k||(k={}));var qt;(function(a){a[a.Backspace=8]="Backspace",a[a.Enter=13]="Enter",a[a.Spacebar=32]="Spacebar",a[a.Hash=35]="Hash",a[a.GraveAccent=39]="GraveAccent",a[a.DoubleQuote=34]="DoubleQuote",a[a.Asterisk=42]="Asterisk",a[a.Plus=43]="Plus",a[a.Comma=44]="Comma",a[a.Minus=45]="Minus",a[a.Period=46]="Period",a[a.ForwardSlash=47]="ForwardSlash",a[a.Zero=48]="Zero",a[a.One=49]="One",a[a.Two=50]="Two",a[a.Three=51]="Three",a[a.Four=52]="Four",a[a.Five=53]="Five",a[a.Six=54]="Six",a[a.Seven=55]="Seven",a[a.Eight=56]="Eight",a[a.Nine=57]="Nine",a[a.Colon=58]="Colon",a[a.Semicolon=59]="Semicolon",a[a.LessThan=60]="LessThan",a[a.Equals=61]="Equals",a[a.GreaterThan=62]="GreaterThan",a[a.QuestionMark=63]="QuestionMark",a[a.At=64]="At",a[a.OpenSquareBracket=91]="OpenSquareBracket",a[a.BackSlash=92]="BackSlash",a[a.CloseSquareBracket=93]="CloseSquareBracket",a[a.a=97]="a",a[a.b=98]="b",a[a.c=99]="c",a[a.d=100]="d",a[a.e=101]="e",a[a.f=102]="f",a[a.g=103]="g",a[a.h=104]="h",a[a.i=105]="i",a[a.j=106]="j",a[a.k=107]="k",a[a.l=108]="l",a[a.m=109]="m",a[a.n=110]="n",a[a.o=111]="o",a[a.p=112]="p",a[a.q=113]="q",a[a.r=114]="r",a[a.s=115]="s",a[a.t=116]="t",a[a.u=117]="u",a[a.v=118]="v",a[a.w=119]="w",a[a.x=120]="x",a[a.y=121]="y",a[a.z=122]="z",a[a.OpenCurlyBracket=123]="OpenCurlyBracket",a[a.VerticalPipe=124]="VerticalPipe",a[a.CloseCurlyBracket=125]="CloseCurlyBracket",a[a.Tilde=126]="Tilde"})(qt||(qt={}));var J=H(),Yt=class{constructor(){this.annotations=[];this.isCreated=!1;this.isLoggedIn=!1;this.metrics=[];this.shifted=!1;this.tabbing=!1;this.locales={};this.defaultConfig={};this.localeLoaders={"en-GB":()=>import("./en-GB-NZX2ZWUE.js"),"cy-GB":()=>import("./cy-GB-U3P4USVK.js"),"fr-FR":()=>import("./fr-FR-52NLPE7H.js"),"pl-PL":()=>import("./pl-PL-2SE72SET.js"),"sv-SE":()=>import("./sv-SE-EUXIBEVC.js")}}create(){let o=this;if(this.browserDetect=new At,this.browserDetect.init(),nt.publish=this.extensionHost.publish.bind(this.extensionHost),ut.publish=this.extensionHost.publish.bind(this.extensionHost),this.$element=J(this.extensionHost.options.target),this.$element.data("component",this.extensionHost),this._parseMetrics(),this._updateMetric(),this._initLocales(),this.$element.empty(),this.$element.removeClass(),this.$element.addClass("uv-iiif-extension-host"),this.$element.addClass("loading"),this.data.locales?(this.$element.addClass(this.data.locales[0].name.toLowerCase()),this.$element.prop("lang",this.data.locales[0].name.substring(0,2))):this.$element.prop("lang",Ht[0].name.substring(0,2)),this.isRightPanelEnabled()&&this.$element.addClass("right-panel-enabled"),this.isLeftPanelEnabled()&&this.$element.addClass("left-panel-enabled"),this.isFooterPanelEnabled()&&this.$element.addClass("footer-panel-enabled"),this.$element.addClass(this.type.name),this.$element.addClass("browser-"+this.browserDetect.browser),this.$element.addClass("browser-version-"+this.browserDetect.version),this.$element.prop("tabindex",-1),this.data.embedded&&this.$element.addClass("embedded"),this.isMobile()&&this.$element.addClass("mobile"),Y.supportsFullscreen()&&this.$element.addClass("fullscreen-supported"),this.isFullScreen()&&this.$element.addClass("fullscreen"),this.$element.on("mousemove",l=>{this.mouseX=l.pageX,this.mouseY=l.pageY}),!this.data.isReload){let l=Y.getHiddenProp();if(l){let u=l.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(u,()=>{Y.isHidden()||this.resize()})}P.getBool(this.data.config.options.dropEnabled,!0)&&this.$element.on("drop",u=>{u.preventDefault();let i=u.originalEvent.dataTransfer.getData("URL"),c=G.getUrlParts(i),s=G.getQuerystringParameterFromString("manifest",c.search);if(s||(s=G.getQuerystringParameterFromString("collection",c.search)),s){this.fire(w.DROP,s);let m={};m.iiifManifestId=s,this.reload(m)}}),this.$element.on("dragover",u=>{u.preventDefault()}),this.$element.on("keyup keydown",u=>{this.shifted=u.shiftKey,this.tabbing=u.keyCode===k.Tab}),this.$element.on("keydown",u=>{let i=null,c=!0;!u.ctrlKey&&!u.altKey&&!u.shiftKey&&(u.keyCode===k.Enter&&(i=y.RETURN,c=!1),u.keyCode===k.Escape&&(i=y.ESCAPE),u.keyCode===k.PageUp&&(i=y.PAGE_UP),u.keyCode===k.PageDown&&(i=y.PAGE_DOWN),u.keyCode===k.End&&(i=y.END),u.keyCode===k.Home&&(i=y.HOME),(u.keyCode===k.NumpadPlus||u.keyCode===171||u.keyCode===k.Equals)&&(i=y.PLUS,c=!1),(u.keyCode===k.NumpadMinus||u.keyCode===173||u.keyCode===k.Dash)&&(i=y.MINUS,c=!1),o.useArrowKeysToNavigate()&&(u.keyCode===k.LeftArrow&&(i=y.LEFT_ARROW),u.keyCode===k.UpArrow&&(i=y.UP_ARROW),u.keyCode===k.RightArrow&&(i=y.RIGHT_ARROW),u.keyCode===k.DownArrow&&(i=y.DOWN_ARROW))),i&&(c&&u.preventDefault(),this.extensionHost.publish(i))})}this.extensionHost.subscribe(w.EXIT_FULLSCREEN,()=>{this.isOverlayActive()&&this.extensionHost.publish(y.ESCAPE),this.extensionHost.publish(y.ESCAPE),this.extensionHost.publish(w.RESIZE)}),this.$element.append('<iframe id="commsFrame"></iframe>'),this.extensionHost.subscribeAll((l,u)=>{[w.LOAD,w.DROP,w.TOGGLE_FULLSCREEN,w.EXTERNAL_RESOURCE_OPENED,w.RELOAD].includes(l)||this.fire(l,u)}),this.extensionHost.subscribe(w.EXTERNAL_RESOURCE_OPENED,()=>{this.fire(w.EXTERNAL_RESOURCE_OPENED)}),this.extensionHost.subscribe(y.LOGIN_FAILED,()=>{this.showMessage(this.data.config.content.authorisationFailedMessage)}),this.extensionHost.subscribe(y.LOGIN,()=>{this.isLoggedIn=!0}),this.extensionHost.subscribe(y.LOGOUT,()=>{this.isLoggedIn=!1}),this.extensionHost.subscribe(y.BOOKMARK,()=>{this.bookmark()}),this.extensionHost.subscribe(y.CANVAS_INDEX_CHANGE,l=>{this.data.canvasIndex=l,this.lastCanvasIndex=this.helper.canvasIndex,this.helper.canvasIndex=l}),this.extensionHost.subscribe(y.CLOSE_LEFT_PANEL,()=>{o.$element.hasClass("loading")&&o.$element.removeClass("loading"),this.resize()}),this.extensionHost.subscribe(y.CLOSE_RIGHT_PANEL,()=>{this.resize()}),this.extensionHost.subscribe(y.COLLECTION_INDEX_CHANGE,l=>{this.data.collectionIndex=l}),this.extensionHost.subscribe(w.CREATED,()=>{this.isCreated=!0}),this.extensionHost.subscribe(y.ESCAPE,()=>{this.isFullScreen()&&!this.isOverlayActive()&&this.extensionHost.publish(w.TOGGLE_FULLSCREEN)}),this.extensionHost.subscribe(w.LOAD,()=>{setTimeout(()=>{this.extensionHost.publish(w.RESIZE),this.fire(w.LOAD,this.helper.getCurrentCanvas().id),this.$element.removeClass("loading")},100)}),this.extensionHost.subscribe(y.FEEDBACK,()=>{this.feedback()}),this.extensionHost.subscribe(y.FORBIDDEN,()=>{this.extensionHost.publish(y.OPEN_EXTERNAL_RESOURCE)}),this.extensionHost.subscribe(w.LOAD_FAILED,()=>{!o.lastCanvasIndex==null&&o.lastCanvasIndex!==o.helper.canvasIndex&&this.extensionHost.publish(y.CANVAS_INDEX_CHANGE,o.lastCanvasIndex)}),this.extensionHost.subscribe(y.MANIFEST_INDEX_CHANGE,l=>{this.data.manifestIndex=l}),this.extensionHost.subscribe(y.OPEN,()=>{let l=St.format(this.data.config.options.openTemplate,this.helper.manifestUri);window.open(l)}),this.extensionHost.subscribe(y.OPEN_LEFT_PANEL,()=>{this.$element.hasClass("loading")||this.resize()}),this.extensionHost.subscribe(y.OPEN_RIGHT_PANEL,()=>{this.$element.hasClass("loading")||this.resize()}),this.extensionHost.subscribe(y.RANGE_CHANGE,l=>{l?(this.data.rangeId=l.id,this.helper.rangeId=l.id):(this.data.rangeId=void 0,this.helper.rangeId=void 0)}),this.extensionHost.subscribe(y.RESOURCE_DEGRADED,l=>{nt.handleDegraded(l)}),this.extensionHost.subscribe(y.SHOW_MESSAGE,l=>{this.showMessage(l)}),this.extensionHost.subscribe(y.SHOW_TERMS_OF_USE,()=>{let l=this.helper.getLicense();if(!l){let u=this.helper.getRequiredStatement();u&&u.value&&(l=u.value)}l&&this.showMessage(l)}),this.extensionHost.subscribe(w.TOGGLE_FULLSCREEN,()=>{let l=this.data.config.options.overrideFullScreen;this.extensionHost.isFullScreen=!this.extensionHost.isFullScreen,l||(J("#top").focus(),this.extensionHost.isFullScreen?this.$element.addClass("fullscreen"):this.$element.removeClass("fullscreen")),this.fire(w.TOGGLE_FULLSCREEN,{isFullScreen:this.extensionHost.isFullScreen,overrideFullScreen:l})}),this.shell=new _t(this.$element),this.createModules(),this.extensionHost.publish(w.RESIZE),setTimeout(()=>{this.render(),this.extensionHost.publish(w.CREATED),this._setDefaultFocus()},1)}async loadConfig(o,l){return this.translateLocale(this.defaultConfig,o)}async translateLocale(o,l){let i=await(this.localeLoaders[l]||this.localeLoaders["en-GB"])()||{},c=JSON.stringify(o);for(let s in i){let m=s.replace("$",""),b=new RegExp(`\\$${m}\\b`,"g");c=c.replace(b,i[s])}return c=JSON.parse(c),c}createModules(){this.$authDialogue=J('<div class="overlay auth" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$authDialogue),this.authDialogue=new gt(this.$authDialogue),this.$clickThroughDialogue=J('<div class="overlay clickthrough" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$clickThroughDialogue),this.clickThroughDialogue=new mt(this.$clickThroughDialogue),this.$restrictedDialogue=J('<div class="overlay login" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$restrictedDialogue),this.restrictedDialogue=new bt(this.$restrictedDialogue),this.$loginDialogue=J('<div class="overlay login" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$loginDialogue),this.loginDialogue=new vt(this.$loginDialogue)}_setDefaultFocus(){setTimeout(()=>{this.data.config.options.allowStealFocus&&J("[tabindex=0]").focus()},1)}width(){return this.$element.width()}height(){return this.$element.height()}exitFullScreen(){this.extensionHost.publish(w.EXIT_FULLSCREEN)}fire(o,...l){this.data.debug&&console.log(o,arguments[1]),this.extensionHost.fire(o,arguments[1])}redirect(o){this.fire(y.REDIRECT,o)}refresh(){this.fire(y.REFRESH,null)}render(){if((!this.isCreated||this.data.collectionIndex!==this.helper.collectionIndex)&&this.extensionHost.publish(y.COLLECTION_INDEX_CHANGE,this.data.collectionIndex),(!this.isCreated||this.data.manifestIndex!==this.helper.manifestIndex)&&this.data.iiifManifestId!==void 0&&this.extensionHost.publish(y.MANIFEST_INDEX_CHANGE,this.data.manifestIndex),(!this.isCreated||this.data.canvasIndex!==this.helper.canvasIndex)&&(this.data.canvasIndex===void 0&&(this.data.canvasIndex=0),this.data.canvasId&&(this.data.canvasIndex=this.helper.canvasIndex),this.extensionHost.publish(y.CANVAS_INDEX_CHANGE,this.data.canvasIndex)),(!this.isCreated||this.data.rangeId!==this.helper.rangeId)&&this.data.rangeId){let o=this.helper.getRangeById(this.data.rangeId);o?this.extensionHost.publish(y.RANGE_CHANGE,o):console.warn("range id not found:",this.data.rangeId)}}_initLocales(){let o=this.data.config.localisation.locales.slice(0),l=this.data.locales,u=[];l?(l.forEach(c=>{let s=o.filter(b=>b.name===c.name);if(s.length){var m=s[0];c.label&&(m.label=c.label),m.added=!0,u.push(m)}}),P.getBool(this.data.config.options.limitLocales,!1)||o.forEach(c=>{c.added||u.push(c),delete c.added}),this.data.locales=u):console.warn("No locales configured")}_parseMetrics(){let o=this.data.config.options.metrics;if(o)for(let l=0;l<o.length;l++){let u=o[l];this.metrics.push(u)}}_updateMetric(){for(let l=this.metrics.length-1;l>=0;l--){let u=this.metrics[l];if(window.innerWidth>=u.minWidth){if(this.metric!==u.type){this.metric=u.type;for(var o=0;o<this.metrics.length;o++)this.$element.removeClass(this.metrics[o].type);this.$element.addClass(u.type),this.extensionHost.publish(y.METRIC_CHANGE)}break}}}resize(){this._updateMetric(),this.extensionHost.publish(w.RESIZE)}reload(o){this.extensionHost.publish(w.RELOAD,o)}isSeeAlsoEnabled(){return this.data.config.options.seeAlsoEnabled!==!1}getShareUrl(){if(this.data.embedded){if(this.helper.hasRelatedPage()){var o=this.helper.getRelated();return o&&o.length&&(o=o[0]),o["@id"]}let l=this.helper.manifest,u=l&&l.getHomepage();if(u)return u}else return Y.isInIFrame()?parent.document.location.href:document.location.href;return null}getIIIFShareUrl(o=!1){let l;return o&&(this.helper.manifest?l=this.helper.manifest.id:l=this.helper.manifestUri),`${l}?manifest=${l}`}getDomain(){return G.getUrlParts(this.helper.manifestUri).host}getSettings(){if(P.getBool(this.data.config.options.saveUserSettings,!1)){let o=U.get("uv.settings",dt.LOCAL);if(o)return J.extend(this.data.config.options,o.value)}return this.data.config.options}updateSettings(o){if(P.getBool(this.data.config.options.saveUserSettings,!1)){let l=U.get("uv.settings",dt.LOCAL);l&&(o=J.extend(l.value,o)),U.set("uv.settings",o,31536e4,dt.LOCAL)}this.data.config.options=J.extend(this.data.config.options,o)}getLocale(){return this.helper.options.locale}getSharePreview(){let o=this.helper.getLabel(),l=this.helper.getCurrentCanvas(),u=l.getProperty("thumbnail");return(!u||typeof u!="string")&&(u=l.getCanonicalImageUri(this.data.config.options.bookmarkThumbWidth)),{title:o,image:u}}getAppUri(){let o=this.data.config.modules.shareDialogue.options,l=o?.embedHost??`${window.location.protocol}//${window.location.hostname}`,u=o?.embedPort??window.location.port,i=o?.embedPath??"/uv.html";return`${l}${u?`:${u}`:""}${i}`}buildEmbedScript(o,l,u,i){let c=this.getAppUri(),s=this.helper.getLabel()??"";return(i?.size??0)>0&&(c+=`#?${i.toString()}`),St.format(o,c,l.toString(),u.toString(),s)}getPagedIndices(o=this.helper.canvasIndex){return[o]}getCurrentCanvases(){let o=this.getPagedIndices(this.helper.canvasIndex),l=[];for(let u=0;u<o.length;u++){let i=o[u],c=this.helper.getCanvasByIndex(i);c&&l.push(c)}return l}getCanvasLabels(o){let l=this.getPagedIndices(),u="";if(l.length===1)u=o;else for(let i=1;i<=l.length;i++)u.length&&(u+=","),u+=o+" "+i;return u}getCurrentCanvasRange(){return this.helper.getCanvasRange(this.helper.getCurrentCanvas())}getExternalResources(o){let l=this.getPagedIndices(),u=[];l.forEach(s=>{let m=this.helper.getCanvasByIndex(s),b;if(m.externalResource?b=m.externalResource:b=new Dt(m,{authApiVersion:this.data.config.options.authAPIVersion}),o){let h=o.find(f=>f.dataUri===b.dataUri);h?u.push(h):u.push(b)}else u.push(b)});let i=this.data.config.options.tokenStorage;return this.data.config.options.authAPIVersion===1?new Promise(s=>{let m={locale:this.helper.options.locale};ut.loadExternalResources(u,i,m).then(b=>{this.resources=b.map(h=>this._prepareResourceData(h)),s(this.resources)})}):new Promise(s=>{nt.loadExternalResources(u,i).then(m=>{this.resources=m.map(b=>this._prepareResourceData(b)),s(this.resources)})})}_prepareResourceData(o){return o.data.hasServiceDescriptor=o.hasServiceDescriptor(),o.hasServiceDescriptor()||(o.data.id=o.dataUri,o.data.width=o.width,o.data.height=o.height),o.data.index=o.index,Bt.toPlainObject(o.data)}getMediaFormats(o){let l=o.getContent();return l&&l.length?l[0].getBody():[{id:o.id,type:o.getType(),getFormat:function(){return""}}]}viewCanvas(o){if(this.helper.isCanvasIndexOutOfRange(o)){this.showMessage(this.data.config.content.canvasIndexOutOfRange);return}this.extensionHost.publish(y.OPEN_EXTERNAL_RESOURCE)}showMessage(o,l,u,i){this.closeActiveDialogue(),this.extensionHost.publish(y.SHOW_GENERIC_DIALOGUE,{message:o,acceptCallback:l,buttonText:u,allowClose:i})}closeActiveDialogue(){this.extensionHost.publish(y.CLOSE_ACTIVE_DIALOGUE)}isOverlayActive(){return j(this.shell.$overlays)}isDesktopMetric(){return this.metric==="lg"||this.metric==="xl"}isMobileMetric(){return this.metric==="sm"||this.metric==="md"}isMetric(o){return typeof o=="string"?this.metric===o:o.some(l=>this.metric===l)}viewManifest(o){let l={};l.iiifManifestId=this.helper.manifestUri,l.collectionIndex=this.helper.getCollectionIndex(o),l.manifestIndex=o.index,l.canvasIndex=0,this.reload(l)}viewCollection(o){let l={};l.iiifManifestId=o.parentCollection?o.parentCollection.id:this.helper.manifestUri,l.collectionIndex=o.index,l.manifestIndex=0,l.canvasIndex=0,this.reload(l)}isFullScreen(){return this.extensionHost.isFullScreen}isHeaderPanelEnabled(){return P.getBool(this.data.config.options.headerPanelEnabled,!0)}isLeftPanelEnabled(){if(P.getBool(this.data.config.options.leftPanelEnabled,!0)){if(this.helper.hasParentCollection())return!0;if(this.helper.isMultiCanvas()){let o=this.helper.getViewingHint();if(!o||o&&o!==Xt.ViewingHint.CONTINUOUS)return!0}}return!1}isRightPanelEnabled(){return P.getBool(this.data.config.options.rightPanelEnabled,!0)}isFooterPanelEnabled(){return P.getBool(this.data.config.options.footerPanelEnabled,!0)}isMobile(){let o=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|android|ipad|playbook|silk|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(o)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(o.substr(0,4))}useArrowKeysToNavigate(){return P.getBool(this.data.config.options.useArrowKeysToNavigate,!0)}bookmark(){}feedback(){this.fire(y.FEEDBACK,this.data)}getAlternateLocale(){let o=null;return this.data.locales&&this.data.locales.length>1&&(o=this.data.locales[1]),o}getSerializedLocales(){return this.data.locales?this.serializeLocales(this.data.locales):null}serializeLocales(o){let l="";for(let u=0;u<o.length;u++){let i=o[u];u>0&&(l+=","),l+=i.name,i.label&&(l+=":"+i.label)}return l}changeLocale(o){let l={};if(this.data.locales){l.locales=this.data.locales.slice(0);let u=l.locales.findIndex(c=>c.name===o);l.locales.splice(0,0,l.locales.splice(u,1)[0]),this.reload(l)}}dispose(){this.store?.setState(null)}},At=class{constructor(){this.dataBrowser=[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer"},{string:navigator.userAgent,subString:"Trident",identity:"Explorer"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Safari",identity:"Safari"},{string:navigator.userAgent,subString:"Opera",identity:"Opera"}]}init(){this.browser=this.searchString(this.dataBrowser)||"Other",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"Unknown",this.browser=="Explorer"&&this.version=="7"&&navigator.userAgent.match(/Trident/i)&&(this.version=this.searchVersionIE())}searchString(o){for(var l=0;l<o.length;l++){var u=o[l].string;if(this.versionSearchString=o[l].subString,u.indexOf(o[l].subString)!=-1)return o[l].identity}}searchVersion(o){var l=o.indexOf(this.versionSearchString);if(l!=-1)return parseFloat(o.substring(l+this.versionSearchString.length+1))}searchVersionIE(){var o=navigator.userAgent.toString().toLowerCase(),l=/(trident)(?:.*rv:([\w.]+))?/.exec(o)||/(msie) ([\w.]+)/.exec(o)||["",null,-1],u="unknown";return l!==null&&l.length===3&&l[2]&&(u=l[2].split(".")[0]),u}};var N=H(),Zt=class extends D{constructor(o){super(o)}create(){this.setConfig("footerPanel"),super.create(),this.extensionHost.subscribe(w.TOGGLE_FULLSCREEN,()=>{this.updateFullScreenButton(),this.extensionHost.isFullScreen||setTimeout(()=>{this.resize()},1001)}),this.extensionHost.subscribe(y.METRIC_CHANGE,()=>{this.updateMinimisedButtons(),this.updateMoreInfoButton()}),this.extensionHost.subscribe(y.SETTINGS_CHANGE,()=>{this.updateDownloadButton()}),this.$options=N('<div class="options"></div>'),this.$element.append(this.$options),this.$leftOptions=N('<div class="left-options"></div>'),this.$options.prepend(this.$leftOptions),this.$mainOptions=N('<div class="main-options"></div>'),this.$options.append(this.$mainOptions),this.$rightOptions=N('<div class="right-options"></div>'),this.$options.append(this.$rightOptions),this.$feedbackButton=N(`
<button class="feedback btn imageBtn" title="${this.content.feedback}">
<i class="uv-icon uv-icon-feedback" aria-hidden="true"></i>
<span class="sr-only">${this.content.feedback}</span>
</button>
`),this.$mainOptions.prepend(this.$feedbackButton),this.$openButton=N(`
<button class="open btn imageBtn" title="${this.content.open}">
<i class="uv-icon-open" aria-hidden="true"></i>
<span class="sr-only">${this.content.open}</span>
</button>
`),this.$mainOptions.prepend(this.$openButton),this.$bookmarkButton=N(`
<button class="bookmark btn imageBtn" title="${this.content.bookmark}">
<i class="uv-icon uv-icon-bookmark" aria-hidden="true"></i>
<span class="sr-only">${this.content.bookmark}</span>
</button>
`),this.$mainOptions.prepend(this.$bookmarkButton),this.$shareButton=N(`
<button class="share btn imageBtn" title="${this.content.share}">
<i class="uv-icon uv-icon-share" aria-hidden="true"></i>
<span class="sr-only">${this.content.share}</span>
</button>
`),this.$mainOptions.append(this.$shareButton),this.$embedButton=N(`
<button class="embed btn imageBtn" title="${this.content.embed}">
<i class="uv-icon uv-icon-embed" aria-hidden="true"></i>
<span class="sr-only">${this.content.embed}</span>
</button>
`),this.$mainOptions.append(this.$embedButton),this.$downloadButton=N(`
<button class="download btn imageBtn" title="${this.content.download}" id="download-btn">
<i class="uv-icon uv-icon-download" aria-hidden="true"></i>
<span class="sr-only">${this.content.download}</span>
</button>
`),this.$mainOptions.prepend(this.$downloadButton),this.$fullScreenBtn=N(`
<button class="fullScreen btn imageBtn" title="${this.content.fullScreen}">
<i class="uv-icon uv-icon-fullscreen" aria-hidden="true"></i>
<span class="sr-only">${this.content.fullScreen}</span>
</button>
`),this.$mainOptions.append(this.$fullScreenBtn),this.$moreInfoButton=N(`
<button class="moreInfo btn imageBtn" title="${N(".mainPanel.rightPanelOpen").length!==0?this.content.closeRightPanel:this.content.openRightPanel}">
<i class="uv-icon uv-icon-more-info" aria-hidden="true"></i>
<span class="sr-only">${N(".mainPanel.rightPanelOpen").length!==0?this.content.closeRightPanel:this.content.openRightPanel}</span>
</button>
`),this.$rightOptions.append(this.$moreInfoButton),this.$toggleLeftPanelButton=N(`
<button class="toggleLeftPanelButton btn imageBtn" title="${N(".mainPanel.leftPanelOpen").length!==0?this.content.closeLeftPanel:this.content.openLeftPanel}">
<i class="uv-icon uv-icon-toggle-left-panel" aria-hidden="true"></i>
<span class="sr-only">${N(".mainPanel.leftPanelOpen").length!==0?this.content.closeLeftPanel:this.content.openLeftPanel}</span>
</button>
`),this.$leftOptions.append(this.$toggleLeftPanelButton),(N(".leftPanel").css("display")==="none"||N(".leftPanel").contents().length===0)&&this.$toggleLeftPanelButton.hide(),this.$openButton.onPressed(()=>{this.extensionHost.publish(y.OPEN)}),this.$feedbackButton.onPressed(()=>{this.extensionHost.publish(y.FEEDBACK)}),this.$bookmarkButton.onPressed(()=>{this.extensionHost.publish(y.BOOKMARK)}),this.$shareButton.onPressed(()=>{this.extensionHost.publish(y.SHOW_SHARE_DIALOGUE,this.$shareButton)}),this.$embedButton.onPressed(()=>{this.extensionHost.publish(y.SHOW_EMBED_DIALOGUE,this.$embedButton)}),this.$downloadButton.onPressed(()=>{this.extensionHost.publish(y.SHOW_DOWNLOAD_DIALOGUE,this.$downloadButton)}),this.$moreInfoButton.onPressed(()=>{this.extensionHost.publish(y.TOGGLE_RIGHT_PANEL,this.$moreInfoButton);let o=N(".mainPanel.rightPanelOpen").length!==0?this.content.closeRightPanel:this.content.openRightPanel;this.$moreInfoButton.attr("title",o),this.$moreInfoButton.find(".sr-only").text(o)}),this.$toggleLeftPanelButton.onPressed(()=>{this.extensionHost.publish(y.TOGGLE_LEFT_PANEL,this.$moreInfoButton);let o=N(".mainPanel.leftPanelOpen").length!==0?this.content.closeLeftPanel:this.content.openLeftPanel;this.$toggleLeftPanelButton.attr("title",o),this.$toggleLeftPanelButton.find(".sr-only").text(o)}),this.onAccessibleClick(this.$fullScreenBtn,o=>{o.preventDefault(),this.extensionHost.publish(w.TOGGLE_FULLSCREEN)},!0),P.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()}updateMinimisedButtons(){P.getBool(this.options.minimiseButtons,!1)||!this.extension.isDesktopMetric()?this.$options.find("span").addClass("sr-only"):this.$options.find("span").removeClass("sr-only")}updateMoreInfoButton(){}updateOpenButton(){P.getBool(this.options.openEnabled,!1)&&Y.isInIFrame()?this.$openButton.show():this.$openButton.hide()}updateFullScreenButton(){if(!P.getBool(this.options.fullscreenEnabled,!0)||!Y.supportsFullscreen()){this.$fullScreenBtn.hide();return}this.extension.isFullScreen()?(this.$fullScreenBtn.switchClass("fullScreen","exitFullscreen"),this.$fullScreenBtn.find("i").switchClass("uv-icon-fullscreen","uv-icon-exit-fullscreen"),this.$fullScreenBtn.attr("title",this.content.exitFullScreen),N(this.$fullScreenBtn[0].firstChild.nextSibling.nextSibling).replaceWith(this.content.exitFullScreen)):(this.$fullScreenBtn.switchClass("exitFullscreen","fullScreen"),this.$fullScreenBtn.find("i").switchClass("uv-icon-exit-fullscreen","uv-icon-fullscreen"),this.$fullScreenBtn.attr("title",this.content.fullScreen),N(this.$fullScreenBtn[0].firstChild.nextSibling.nextSibling).replaceWith(this.content.fullScreen))}updateEmbedButton(){this.extension.helper.isUIEnabled("embed")&&P.getBool(this.options.embedEnabled,!1)?this.extension.isMobile()||this.$embedButton.show():this.$embedButton.hide()}updateShareButton(){this.extension.helper.isUIEnabled("share")&&P.getBool(this.options.shareEnabled,!0)?this.$shareButton.show():this.$shareButton.hide()}updateDownloadButton(){P.getBool(this.options.downloadEnabled,!0)?this.$downloadButton.show():this.$downloadButton.hide()}updateFeedbackButton(){P.getBool(this.options.feedbackEnabled,!1)?this.$feedbackButton.show():this.$feedbackButton.hide()}updateBookmarkButton(){P.getBool(this.options.bookmarkEnabled,!1)?this.$bookmarkButton.show():this.$bookmarkButton.hide()}resize(){super.resize()}};var ct=class{constructor(o,l){this.message=o;this.actions=l}};var It=class{constructor(){}};var yt=class{constructor(o){this.extension=o}Get(o){switch(o.informationType){case 0:return new ct(this.extension.data.config.content.authCORSError,[]);case 1:let l=[],u=new It,i;o.param.loginService?i=o.param.loginService.getConfirmLabel():i=o.param.kioskService.getConfirmLabel(),i||(i=this.extension.data.config.content.fallbackDegradedLabel||"login"),u.label=i;let c=o.param;u.action=()=>{o.param.loginService&&(c.authHoldingPage=window.open("","_blank")),this.extension.extensionHost.publish(y.HIDE_INFORMATION),this.extension.extensionHost.publish(y.OPEN_EXTERNAL_RESOURCE,[[c]])},l.push(u);let s;return o.param.loginService?s=o.param.loginService.getServiceLabel():s=o.param.kioskService.getServiceLabel(),s||(s=this.extension.data.config.content.fallbackDegradedMessage),new ct(s,l)}}};var X=H(),Kt=class extends D{constructor(o){super(o,!1,!1)}create(){this.setConfig("headerPanel"),super.create(),this.extensionHost.subscribe(y.SHOW_INFORMATION,l=>{this.showInformation(Array.isArray(l)?l[0]:l)}),this.extensionHost.subscribe(y.HIDE_INFORMATION,()=>{this.hideInformation()}),this.$options=X('<div class="options"></div>'),this.$element.append(this.$options),this.$centerOptions=X('<div class="centerOptions"></div>'),this.$options.append(this.$centerOptions),this.$rightOptions=X('<div class="rightOptions"></div>'),this.$options.append(this.$rightOptions),this.$localeToggleButton=X('<a class="localeToggle" tabindex="0"></a>'),this.$rightOptions.append(this.$localeToggleButton),this.$settingsButton=X(`
<button class="btn imageBtn settings" tabindex="0" title="${this.content.settings}">
<i class="uv-icon-settings" aria-hidden="true"></i>
</button>
`),this.$settingsButton.attr("title",this.content.settings),this.$rightOptions.append(this.$settingsButton),this.$helpButton=X(`
<a class="btn imageBtn help" tabindex="0" title="${this.content.help}" role="button">
<i class="uv-icon-help" aria-hidden="true"></i>
</a>
`),this.$rightOptions.append(this.$helpButton),this.$informationBox=X('<div class="informationBox" aria-hidden="true"> <div class="message"></div> <div class="actions"></div> <button type="button" class="close"> <span aria-hidden="true">×</span> </button> </div>'),this.$element.append(this.$informationBox),this.$informationBox.hide();var o=this.$informationBox.find(".close");o.attr("aria-label",this.content.close),o.attr("title",this.content.close),o.on("click",l=>{l.preventDefault(),this.extensionHost.publish(y.HIDE_INFORMATION)}),this.$localeToggleButton.on("click",()=>{this.extension.changeLocale(String(this.$localeToggleButton.data("locale")))}),this.$settingsButton.onPressed(()=>{this.extensionHost.publish(y.SHOW_SETTINGS_DIALOGUE,this.$settingsButton)}),P.getBool(this.options.centerOptionsEnabled,!0)||this.$centerOptions.hide(),this.updateLocaleToggle(),this.updateSettingsButton()}updateLocaleToggle(){if(!this.localeToggleIsVisible()){this.$localeToggleButton.hide();return}let o=this.extension.getAlternateLocale(),l=o.name.split("-")[0].toUpperCase();this.$localeToggleButton.data("locale",o.name),this.$localeToggleButton.attr("title",o.label),this.$localeToggleButton.text(l)}updateSettingsButton(){P.getBool(this.options.settingsButtonEnabled,!0)?this.$settingsButton.show():this.$settingsButton.hide()}localeToggleIsVisible(){let o=this.extension.data.locales;return o?o.length>1&&P.getBool(this.options.localeToggleEnabled,!1):!1}showInformation(o){let l=new yt(this.extension);if(this.information=l.Get(o),!!this.information){var u=this.$informationBox.find(".message");u.html(this.information.message).find("a").attr("target","_top");var i=this.$informationBox.find(".actions");i.empty();for(let c=0;c<this.information.actions.length;c++){let s=this.information.actions[c],m=X('<a href="#" class="btn btn-default">'+s.label+"</a>");m.on("click",s.action),i.append(m)}this.extensionHost.publish(y.MESSAGE_DISPLAYED,this.information),this.$informationBox.attr("aria-hidden","false"),this.$informationBox.show(),this.$element.addClass("showInformation"),this.extension.resize()}}hideInformation(){this.$element.removeClass("showInformation"),this.$informationBox.attr("aria-hidden","true"),this.$informationBox.hide(),this.extension.resize()}getSettings(){return this.extension.getSettings()}updateSettings(o){this.extension.updateSettings(o),this.extensionHost.publish(y.UPDATE_SETTINGS,o)}resize(){super.resize();let l=this.$element.width()/2,u=this.$centerOptions.outerWidth(),i=l-u/2;if(this.$centerOptions.css({left:i}),j(this.$informationBox)){let c=this.$informationBox.find(".actions"),s=this.$informationBox.find(".message");s.width(Math.floor(this.$element.width())-Math.ceil(s.horizontalMargins())-Math.ceil(c.outerWidth(!0))-Math.ceil(this.$informationBox.find(".close").outerWidth(!0))-2),this.information&&s.text(this.information.message)}this.$helpButton.onPressed(()=>{window.open(this.options.helpUrl)}),this.options.helpEnabled&&this.options.helpUrl?this.$helpButton.show():this.$helpButton.hide(),this.extension.isMobileMetric()?this.localeToggleIsVisible()&&this.$localeToggleButton.hide():this.localeToggleIsVisible()&&this.$localeToggleButton.show()}};var Z=H(),st=class extends D{constructor(l,u=!1,i=!0){super(l,u,i);this.isExpanded=!1;this.isFullyExpanded=!1;this.isUnopened=!0;this.autoToggled=!1;this.expandFullEnabled=!0}create(){super.create(),this.$top=Z('<div class="top"></div>'),this.$element.append(this.$top),this.$title=Z('<h2 class="title"></h2>'),this.$top.append(this.$title),this.$expandFullButton=Z('<a class="expandFullButton" tabindex="0"></a>'),this.$top.append(this.$expandFullButton),P.getBool(this.config.options.expandFullEnabled,!0)||this.$expandFullButton.hide(),this.$collapseButton=Z('<button role="button" class="collapseButton" tabindex="0"></button>'),this.$top.append(this.$collapseButton),this.$closed=Z('<div class="closed"></div>'),this.$element.append(this.$closed),this.$expandButton=Z('<button role="button" class="expandButton" tabindex="0"></button>'),this.$expandButton.prop("title",this.content.expand),this.$closed.append(this.$expandButton),this.$closedTitle=Z('<a class="title"></a>'),this.$closed.append(this.$closedTitle),this.$main=Z('<div class="main"></div>'),this.$element.append(this.$main),this.onAccessibleClick(this.$expandButton,()=>{this.toggle()}),this.$expandFullButton.on("click",()=>{this.expandFull()}),this.$closedTitle.on("click",()=>{this.toggle()}),this.$title.on("click",()=>{this.isFullyExpanded?this.collapseFull():this.toggle()}),this.onAccessibleClick(this.$collapseButton,()=>{this.isFullyExpanded?this.collapseFull():this.toggle()})}init(){super.init()}setTitle(l){this.$title.text(l),this.$closedTitle.text(l)}toggle(l){let u=this.extension.getSettings(),i=u.reducedAnimation,c=document.documentElement.style.getPropertyValue("--uv-animation-duration");this.options.panelAnimationDuration&&document.documentElement.style.setProperty("--uv-animation-duration",`${this.options.panelAnimationDuration}ms`),l?this.autoToggled=!0:this.autoToggled=!1,this.$element.toggleClass("open"),this.isExpanded&&(this.$top.attr("aria-hidden","true"),this.$main.attr("aria-hidden","true"),this.$closed.attr("aria-hidden","false"));let s=0;i||(s=(this.options.panelAnimationDuration??u.animationDuration??250)+50),setTimeout(()=>{this.toggled(),c&&document.documentElement.style.setProperty("--uv-animation-duration",`${c}`)},s)}toggled(){this.toggleStart(),this.isExpanded=!this.isExpanded,this.isExpanded&&(this.$top.attr("aria-hidden","false"),this.$main.attr("aria-hidden","false"),this.$closed.attr("aria-hidden","true")),this.toggleFinish(),this.isUnopened=!1}expandFull(){let l=this.extension.getSettings(),u=l.reducedAnimation,i=document.documentElement.style.getPropertyValue("--uv-animation-duration");this.options.panelAnimationDuration&&document.documentElement.style.setProperty("--uv-animation-duration",`${this.options.panelAnimationDuration*2}ms`),this.expandFullStart();let c=0;u||(c=(this.options.panelAnimationDuration??l.animationDuration??250)+50,c=c*2),setTimeout(()=>{this.isExpanded||this.toggled(),this.expandFullFinish(),i&&document.documentElement.style.setProperty("--uv-animation-duration",`${i}`)},c)}collapseFull(){let l=this.extension.getSettings(),u=l.reducedAnimation,i=document.documentElement.style.getPropertyValue("--uv-animation-duration");this.options.panelAnimationDuration&&document.documentElement.style.setProperty("--uv-animation-duration",`${this.options.panelAnimationDuration*2}ms`),this.collapseFullStart();let c=0;u||(c=(this.options.panelAnimationDuration??l.animationDuration??250)+50,c=c*2),setTimeout(()=>{this.collapseFullFinish(),i&&document.documentElement.style.setProperty("--uv-animation-duration",`${i}`)},c)}getTargetWidth(){return 0}getTargetLeft(){return 0}getFullTargetWidth(){return 0}getFullTargetLeft(){return 0}toggleStart(){}toggleFinish(){this.isExpanded&&!this.autoToggled?this.focusCollapseButton():this.focusExpandButton()}expandFullStart(){}expandFullFinish(){this.isFullyExpanded=!0,this.$expandFullButton.hide()}collapseFullStart(){}collapseFullFinish(){this.isFullyExpanded=!1,this.expandFullEnabled&&this.$expandFullButton.show(),this.focusExpandFullButton()}focusExpandButton(){setTimeout(()=>{this.$expandButton.focus()},1)}focusExpandFullButton(){setTimeout(()=>{this.$expandFullButton.focus()},1)}focusCollapseButton(){setTimeout(()=>{this.$collapseButton.focus()},1)}resize(){super.resize(),this.$main.height(this.$element.height()-this.$top.outerHeight(!0))}};var xt=class extends st{constructor(o){super(o,!1,!1)}create(){super.create()}init(){super.init(),P.getBool(this.extension.getSettings().rightPanelOpen,this.options.panelOpen)&&this.toggle(!0),this.extensionHost.subscribe(y.TOGGLE_EXPAND_RIGHT_PANEL,()=>{this.isFullyExpanded?this.collapseFull():this.expandFull()}),this.extensionHost.subscribe(y.TOGGLE_RIGHT_PANEL,()=>{this.toggle()}),this.extensionHost.subscribe(y.TOGGLE_LEFT_PANEL,()=>{this.extension.isMetric("sm")&&this.isExpanded&&this.toggle(!0)})}getTargetWidth(){return this.isExpanded?this.options.panelCollapsedWidth:this.options.panelExpandedWidth}getTargetLeft(){return this.isExpanded?this.$element.parent().width()-this.options.panelCollapsedWidth:this.$element.parent().width()-this.options.panelExpandedWidth}toggleFinish(){super.toggleFinish(),this.isExpanded?this.extensionHost.publish(y.OPEN_RIGHT_PANEL):this.extensionHost.publish(y.CLOSE_RIGHT_PANEL),this.extension.updateSettings({rightPanelOpen:this.isExpanded}),setTimeout(()=>{this.$element.toggleClass("open-finished")},100)}resize(){super.resize()}toggle(o){this.isExpanded?this.$element.parent().removeClass("rightPanelOpen"):this.$element.parent().addClass("rightPanelOpen"),super.toggle(o)}expandFull(){super.expandFull()}};var Ct=et(te()),de=H(),ee=class extends xt{constructor(o){super(o)}create(){this.setConfig("moreInfoRightPanel"),super.create(),this.extensionHost.subscribe(y.CANVAS_INDEX_CHANGE,()=>{this.databind()}),this.extensionHost.subscribe(y.RANGE_CHANGE,()=>{this.databind()}),this.setTitle(this.config.content.title),this.$metadata=de('<article class="iiif-metadata-component"></article>'),this.$main.append(this.$metadata),this.metadataComponent=new Ct.MetadataComponent({target:this.$metadata[0],data:this._getData()}),this.metadataComponent.on("iiifViewerLinkClicked",o=>{let l=G.getHashParameterFromString("rid",o),u=G.getHashParameterFromString("t",o);if(l&&u===null){let i=this.extension.helper.getRangeById(l);i&&this.extensionHost.publish(y.RANGE_CHANGE,i)}if(u!==null){let i=Number(u);if(!Number.isNaN(i))if(l){let c=this.extension.helper.getRangeById(l);c&&this.extensionHost.publish(y.RANGE_TIME_CHANGE,{rangeId:c.id,time:i})}else this.extensionHost.publish(y.CURRENT_TIME_CHANGE,i)}},!1)}toggleFinish(){super.toggleFinish(),this.databind()}databind(){this.metadataComponent.set(this._getData())}_getCurrentRange(){return this.extension.helper.getCurrentRange()}_getData(){let o=this.extension.getCurrentCanvases();return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:o,canvasExclude:this.config.options.canvasExclude,canvasLabels:this.extension.getCanvasLabels(this.content.page),content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:P.getBool(this.config.options.copyToClipboardEnabled,!1),helper:this.extension.helper,licenseFormatter:new Ut(this.content.license?this.content.license:{}),limit:this.config.options.textLimit||4,limitType:Ct.LimitType.LINES,limitToRange:P.getBool(this.config.options.limitToRange,!1),manifestDisplayOrder:this.config.options.manifestDisplayOrder,manifestExclude:this.config.options.manifestExclude,range:this._getCurrentRange(),rtlLanguageCodes:this.config.options.rtlLanguageCodes,sanitizer:l=>V(l),showAllLanguages:this.config.options.showAllLanguages}}resize(){super.resize(),this.$main.height(this.$element.height()-this.$top.height()-this.$main.verticalMargins()),this.$main.attr("tabindex",0),this.$main.attr("aria-label",this.config.content.title),this.$metadata.height()<=this.$main.height()&&(this.$main.removeAttr("tabindex"),this.$main.removeAttr("aria-label"))}};var Tt=H(),ie=class extends D{constructor(l){super(l,!1,!0);this.subtitleExpanded=!1;this.isAttributionOpen=!1;this.attributionExplicitlyClosed=!1;this.attributionPosition=6;this.isAttributionLoaded=!1}create(){super.create(),this.$title=Tt('<h1 class="title"></h1>'),this.$element.append(this.$title),this.$subtitle=Tt(`<div class="subtitle">
<div class="wrapper">
<button type="button" class="expand-btn" aria-label="Expand">
<span aria-hidden="true">+</span>
</button>
<span class="text"></span>
</div>
</div>`),this.$element.append(this.$subtitle),this.$subtitleWrapper=this.$subtitle.find(".wrapper"),this.$subtitleExpand=this.$subtitle.find(".expand-btn"),this.$subtitleText=this.$subtitle.find(".text"),this.$content=Tt('<div id="content" class="content"></div>'),this.$element.append(this.$content),this.$attribution=Tt(`
<div class="attribution">
<div class="header">
<div class="title"></div>
<button type="button" class="close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="main">
<div class="attribution-text"></div>
<div class="license"></div>
<div class="logo"></div>
</div>
</div>
`),this.$attribution.find(".header .title").text(this.content.attribution),this.$content.append(this.$attribution),this.closeAttribution(),this.$closeAttributionButton=this.$attribution.find(".header .close"),this.$closeAttributionButton.attr("aria-label",this.content.closeAttribution),this.$closeAttributionButton.on("click",l=>{l.preventDefault(),this.closeAttribution(!0)}),this.$subtitleExpand.on("click",l=>{l.preventDefault(),this.subtitleExpanded=!this.subtitleExpanded,this.subtitleExpanded?(this.$subtitleWrapper.addClass("expanded"),this.$subtitleExpand.text("-")):(this.$subtitleWrapper.removeClass("expanded"),this.$subtitleExpand.text("+")),this.resize()}),P.getBool(this.options.titleEnabled,!0)?this.$title.show():this.$title.hide(),P.getBool(this.options.subtitleEnabled,!1)?this.$subtitle.show():this.$subtitle.hide(),this.whenResized(()=>{this.updateRequiredStatement()}),this.extensionHost.subscribe(y.RANGE_CHANGE,()=>{this.updateRequiredStatement()}),this.extensionHost.subscribe(y.CANVAS_INDEX_CHANGE,()=>{this.updateRequiredStatement()}),this.extensionHost.subscribe(y.MANIFEST_INDEX_CHANGE,()=>{this.updateRequiredStatement()})}openAttribution(){this.attributionExplicitlyClosed||(this.$attribution.show(),this.isAttributionOpen=!0)}closeAttribution(l=!1){this.attributionExplicitlyClosed=this.attributionExplicitlyClosed||l,this.$attribution.hide(),this.isAttributionOpen=!1}updateRequiredStatement(){if(this.isAttributionLoaded)return;let l=P.getBool(this.config.options.mostSpecificRequiredStatement,!1),u=l?this.extension.helper.getMostSpecificRequiredStatement():this.extension.helper.getRequiredStatement(),i=P.getBool(this.options.requiredStatementEnabled,!0);if(!u||!u.value||!i)return;this.openAttribution();let c=this.$attribution.find(".title"),s=this.$attribution.find(".attribution-text"),m=this.$attribution.find(".license"),b=this.$attribution.find(".logo");if(u.label){let h=V(u.label);c.html(h)}else c.text(this.content.attribution);if(u.value){let h=V(u.value);s.html(h);let f=()=>this.resize();s.find("img").one("load",()=>{this.resize()}).each(function(){this.complete&&f()}),s.find("img").one("error",()=>{f()}),s.targetBlank()}m.hide(),b.hide(),this.resize(),l||(this.isAttributionLoaded=!0)}resize(){super.resize();let l,u;this.options&&this.options.titleEnabled===!1||!j(this.$title)?l=0:l=this.$title.outerHeight(!0),this.options&&this.options.subtitleEnabled===!1||!j(this.$subtitle)?u=0:u=this.$subtitle.outerHeight(!0),this.$content.height(this.$element.height()-l-u),this.$content.width(this.$element.width());let i=this.$attribution.find(".attribution-text");if(i.css("maxHeight",`calc(${this.$content.height()}px - 100px)`),i.css("overflow-y","auto"),this.$attribution&&this.isAttributionOpen){switch(this.attributionPosition){case 6:this.$attribution.css("bottom",0),this.$attribution.css("left",0);break;case 8:this.$attribution.css("bottom",0),this.$attribution.css("right",0);break}this.$content.width()<=this.$attribution.width()?this.$attribution.hide():this.$attribution.show()}this.subtitle&&this.options.subtitleEnabled?(this.$subtitleText.html(V(this.subtitle.replace(/<br\s*[\/]?>/gi,"; "))),this.$subtitleText.removeClass("elided"),this.$subtitle.show(),this.$subtitleWrapper.css("max-height",this.$content.height()+this.$subtitle.outerHeight()),this.$subtitleWrapper.width(this.$content.width()),this.subtitleExpanded?this.$subtitleText.width(this.$content.width()-this.$subtitleText.horizontalMargins()-2):(this.$subtitleText.width("auto"),this.$subtitleWrapper.width("auto"),this.$subtitleExpand.hide(),this.$subtitleText.width()>this.$content.width()&&(this.$subtitleExpand.show(),this.$subtitleText.addClass("elided"),this.$subtitleText.width(this.$content.width()-(this.$subtitleExpand.outerWidth()+this.$subtitleText.horizontalMargins()))))):this.$subtitle.hide()}};var ne=class extends st{constructor(o){super(o,!1,!1)}create(){super.create(),this.extensionHost.subscribe(y.TOGGLE_EXPAND_LEFT_PANEL,()=>{this.isFullyExpanded?this.collapseFull():this.expandFull()})}init(){super.init(),P.getBool(this.extension.getSettings().leftPanelOpen,this.options.panelOpen&&!this.extension.isMetric("sm"))&&this.toggle(!0),this.extensionHost.subscribe(y.TOGGLE_LEFT_PANEL,()=>{this.toggle()}),this.extensionHost.subscribe(y.TOGGLE_RIGHT_PANEL,()=>{this.extension.isMetric("sm")&&this.isExpanded&&this.toggle(!0)}),this.extensionHost.subscribe(y.THUMB_SELECTED,()=>{this.extension.isMetric("sm")&&this.toggle()})}getTargetWidth(){return this.isFullyExpanded||!this.isExpanded?this.options.panelExpandedWidth:this.options.panelCollapsedWidth}getFullTargetWidth(){return this.$element.parent().width()}toggleFinish(){super.toggleFinish(),this.isExpanded?this.extensionHost.publish(y.OPEN_LEFT_PANEL):this.extensionHost.publish(y.CLOSE_LEFT_PANEL),this.extension.updateSettings({leftPanelOpen:this.isExpanded}),this.$element.toggleClass("open-finished")}resize(){super.resize()}toggle(o){this.isExpanded?this.$element.parent().removeClass("leftPanelOpen"):this.$element.parent().addClass("leftPanelOpen"),super.toggle(o)}expandFull(){this.$element.parent().addClass("leftPanelOpenFull"),this.$element.addClass("open"),super.expandFull()}collapseFull(){this.$element.parent().removeClass("leftPanelOpenFull"),this.$element.parent().hasClass("leftPanelOpen")||this.$element.parent().addClass("leftPanelOpen"),super.collapseFull()}};var W=H(),oe=class extends F{constructor(o){super(o)}create(){this.setConfig("settingsDialogue"),super.create(),this.openCommand=y.SHOW_SETTINGS_DIALOGUE,this.closeCommand=y.HIDE_SETTINGS_DIALOGUE;let o;this.extensionHost.subscribe(this.openCommand,l=>{o=l,this.open()}),this.extensionHost.subscribe(this.closeCommand,()=>{o&&o.focus(),this.close()}),this.$title=W('<div role="heading" class="heading"></div>'),this.$content.append(this.$title),this.$scroll=W('<div class="scroll"></div>'),this.$content.append(this.$scroll),this.$version=W('<div class="version"></div>'),this.$content.append(this.$version),this.$website=W('<div class="website"></div>'),this.$content.append(this.$website),this.$locale=W('<div class="setting locale"></div>'),this.$scroll.append(this.$locale),this.$localeLabel=W('<label for="locale">'+this.content.locale+"</label>"),this.$locale.append(this.$localeLabel),this.$localeDropDown=W('<select id="locale"></select>'),this.$locale.append(this.$localeDropDown),this.$title.text(this.content.title),this.$website.html(this.content.website),this.$website.targetBlank(),this._createLocalesMenu(),this._createAccessibilityMenu(),this.$element.hide()}getSettings(){return this.extension.getSettings()}updateSettings(o){this.extension.updateSettings(o),this.extensionHost.publish(y.UPDATE_SETTINGS,o)}open(){super.open(),this.$version.text("v"+process.env.PACKAGE_VERSION)}_createLocalesMenu(){let o=this.extension.data.locales;if(o&&o.length>1){for(let l=0;l<o.length;l++){let u=o[l];this.$localeDropDown.append('<option value="'+u.name+'">'+u.label+"</option>")}this.$localeDropDown.val(o[0].name)}else this.$locale.hide();this.$localeDropDown.change(()=>{this.extension.changeLocale(this.$localeDropDown.val())})}resize(){super.resize()}_createAccessibilityMenu(){this.$reducedAnimation=W('<div class="setting reducedAnimation"></div>'),this.$scroll.append(this.$reducedAnimation),this.$reducedAnimationCheckbox=W('<input id="reducedAnimation" type="checkbox" tabindex="0" />'),this.$reducedAnimation.append(this.$reducedAnimationCheckbox),this.$reducedAnimationLabel=W('<label for="reducedAnimation">'+this.content.reducedMotion+"</label>"),this.$reducedAnimation.append(this.$reducedAnimationLabel);let o=this.getSettings();o.animationDuration&&document.documentElement.style.setProperty("--uv-animation-duration",`${o.animationDuration}ms`),o.reducedAnimation?(document.documentElement.style.setProperty("--uv-animation","0"),this.$reducedAnimationCheckbox.prop("checked",!0)):(document.documentElement.style.setProperty("--uv-animation","1"),this.$reducedAnimationCheckbox.removeAttr("checked")),this.$reducedAnimationCheckbox.change(()=>{let l={};this.$reducedAnimationCheckbox.is(":checked")?(l.reducedAnimation=!0,document.documentElement.style.setProperty("--uv-animation","0")):(l.reducedAnimation=!1,document.documentElement.style.setProperty("--uv-animation","1")),this.updateSettings(l)})}};var B=H(),se=class extends F{constructor(l){super(l);this.copyToClipboardEnabled=!0;this.isShareViewVisible=!1;this.shareManifestsEnabled=!1;this.isEmbedViewVisible=!1;this.aspectRatio=.75;this.maxWidth=8e3;this.maxHeight=this.maxWidth*this.aspectRatio;this.minWidth=200;this.minHeight=this.minWidth*this.aspectRatio}create(){this.setConfig("shareDialogue"),super.create(),this.$element.attr("role","region"),this.$element.attr("aria-label",this.content.share),this.openCommand=y.SHOW_SHARE_DIALOGUE,this.closeCommand=y.HIDE_SHARE_DIALOGUE,this.shareManifestsEnabled=this.options.shareManifestsEnabled||!1;let l;this.extensionHost.subscribe(this.openCommand,m=>{l=m,this.open(m)}),this.extensionHost.subscribe(this.closeCommand,()=>{l&&l.focus(),this.close()}),this.extensionHost.subscribe(y.SHOW_EMBED_DIALOGUE,m=>{this.open(m),m&&B(m).is(".embed.btn")&&setTimeout(()=>{this.$embedCode.focus()},2)});let u=B(`<div role="heading" class="heading">${this.content.share}</div>`);this.$content.append(u),this.$urlSection=B(`<div class="share__section"><label class="share__label" for="embedCode">${this.content.shareLink}</label></div>`);let i=this.getShareUrl();this.$urlInput=B(`<input class="copy-input" id="urlInput" type="text" value="${i}" readonly/>`),this.$urlInput.focus(function(){B(this).select()}),this.$urlSection.append(this.$urlInput),this.$content.append(this.$urlSection),this.$manifestSection=B(`<div class="share__section"><label class="share__label" for="manifestCode">${this.content.iiif}</label></div>`);let c=this.extension.getIIIFShareUrl(this.shareManifestsEnabled);this.$manifestInput=B(`<input class="copy-input" id="manifestInput" type="text" value="${c}" readonly/>`),this.$manifestInput.focus(function(){B(this).select()}),this.$manifestSection.append(this.$manifestInput),this.$content.append(this.$manifestSection),this.$embedSection=B(`<div class="share__section"><label class="share__label" for="embedCode">${this.content.embed}</label></div>`),this.$embedCode=B('<input class="copy-input" id="embedCode" type="text" readonly/>'),this.$embedCode.focus(function(){B(this).select()}),this.$embedSection.append(this.$embedCode),this.$content.append(this.$embedSection),this.$customSize=B('<div class="customSize"></div>'),this.$size=B(`<label for="size" class="size">${this.content.size}</label>`),this.$customSize.append(this.$size),this.$customSizeDropDown=B(`<select class="embed-size-select" id="size" aria-label="${this.content.size}"></select>`),this.$customSizeDropDown.append('<option value="small" data-width="560" data-height="420">560 x 420</option>'),this.$customSizeDropDown.append('<option value="medium" data-width="640" data-height="480">640 x 480</option>'),this.$customSizeDropDown.append('<option value="large" data-width="800" data-height="600">800 x 600</option>'),this.$customSizeDropDown.append(`<option value="custom">${this.content.customSize}</option>`),this.$customSizeDropDown.change(()=>{this.update()}),this.$customSize.append(this.$customSizeDropDown),this.$widthInput=B(`<input class="width" type="text" maxlength="10" aria-label="${this.content.width}"/>`),this.$widthInput.on("keydown",m=>Ot.numericalInput(m)),this.$widthInput.change(()=>{this.updateHeightRatio(),this.update()}),this.$customSize.append(this.$widthInput),this.$embedSection.append(this.$customSize),this.$x=B('<span class="x">x</span>'),this.$customSize.append(this.$x),this.$heightInput=B(`<input class="height" type="text" maxlength="10" aria-label="${this.content.height}"/>`),this.$heightInput.on("keydown",m=>Ot.numericalInput(m)),this.$heightInput.change(()=>{this.updateWidthRatio(),this.update()}),this.$customSize.append(this.$heightInput);let s=B('<div class="iiif-section"></div>');this.$iiifButton=B(`<a class="imageBtn iiif" href="${c}" title="${this.content.iiif}" target="_blank"></a>`),s.append(this.$iiifButton),this.$content.append(s),this.$termsOfUseButton=B(`<a href="#">${this.extension.data.config?.content.termsOfUse}</a>`),s.append(this.$termsOfUseButton),this.shareManifestsEnabled?this.$manifestSection.show():this.$manifestSection.hide(),P.getBool(this.config.options.embedEnabled,!1)?this.$embedSection.show():this.$embedSection.hide(),this.onAccessibleClick(this.$termsOfUseButton,()=>{this.extensionHost.publish(y.SHOW_TERMS_OF_USE)}),P.getBool(this.config.options.copyToClipboardEnabled,!0)&&(this.addCopyButton(this.$urlInput),this.addCopyButton(this.$embedCode),this.addCopyButton(this.$manifestInput)),this.$element.hide(),this.update()}open(l){super.open(l),this.update()}getShareUrl(){return this.extension.getShareUrl()}isShareAvailable(){return!!this.getShareUrl()}addCopyButton(l){let u=B(`<button class="copyBtn" aria-label="${this.content.copyToClipboard}">${this.content.copyBtn}</button>`);this.onAccessibleClick(u,()=>{wt.copy(l.val()),l.focus()},!0,!0);let i=B('<div class="copy-group"></div>');i.append(u),i.insertBefore(l),l.insertBefore(u)}update(){this.isShareAvailable()?this.$urlSection.show():this.$urlSection.hide();let l=this.getSelectedSize();l.val()==="custom"?(this.$widthInput.show(),this.$x.show(),this.$heightInput.show()):(this.$widthInput.hide(),this.$x.hide(),this.$heightInput.hide(),this.currentWidth=Number(l.data("width")),this.currentHeight=Number(l.data("height")),this.$widthInput.val(String(this.currentWidth)),this.$heightInput.val(String(this.currentHeight))),this.updateShareOptions(),this.updateTermsOfUseButton()}updateShareOptions(){let l=this.getShareUrl();l&&this.$urlInput.val(l)}getSelectedSize(){return this.$customSizeDropDown.find(":selected")}updateWidthRatio(){this.currentHeight=Number(this.$heightInput.val()),this.currentHeight<this.minHeight?(this.currentHeight=this.minHeight,this.$heightInput.val(String(this.currentHeight))):this.currentHeight>this.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))}updateHeightRatio(){this.currentWidth=Number(this.$widthInput.val()),this.currentWidth<this.minWidth?(this.currentWidth=this.minWidth,this.$widthInput.val(String(this.currentWidth))):this.currentWidth>this.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))}updateTermsOfUseButton(){let l=this.extension.helper.getRequiredStatement();P.getBool(this.extension.data.config?.options.termsOfUseEnabled,!0)&&l&&l.value?this.$termsOfUseButton.show():this.$termsOfUseButton.hide()}close(){super.close()}resize(){this.setDockedPosition()}};export{D as a,ie as b,F as c,k as d,Yt as e,ne as f,Zt as g,Kt as h,ee as i,oe as j,se as k};