manifesto.js
Version:
IIIF Presentation API utility library for client and server
1 lines • 72.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("manifesto",[],t):"object"==typeof exports?exports.manifesto=t():e.manifesto=t()}(Object("undefined"!=typeof self?self:this),()=>(()=>{var e={19(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONTINUE=100,t.SWITCHING_PROTOCOLS=101,t.PROCESSING=102,t.OK=200,t.CREATED=201,t.ACCEPTED=202,t.NON_AUTHORITATIVE_INFORMATION=203,t.NO_CONTENT=204,t.RESET_CONTENT=205,t.PARTIAL_CONTENT=206,t.MULTI_STATUS=207,t.MULTIPLE_CHOICES=300,t.MOVED_PERMANENTLY=301,t.MOVED_TEMPORARILY=302,t.SEE_OTHER=303,t.NOT_MODIFIED=304,t.USE_PROXY=305,t.TEMPORARY_REDIRECT=307,t.BAD_REQUEST=400,t.UNAUTHORIZED=401,t.PAYMENT_REQUIRED=402,t.FORBIDDEN=403,t.NOT_FOUND=404,t.METHOD_NOT_ALLOWED=405,t.NOT_ACCEPTABLE=406,t.PROXY_AUTHENTICATION_REQUIRED=407,t.REQUEST_TIME_OUT=408,t.CONFLICT=409,t.GONE=410,t.LENGTH_REQUIRED=411,t.PRECONDITION_FAILED=412,t.REQUEST_ENTITY_TOO_LARGE=413,t.REQUEST_URI_TOO_LARGE=414,t.UNSUPPORTED_MEDIA_TYPE=415,t.REQUESTED_RANGE_NOT_SATISFIABLE=416,t.EXPECTATION_FAILED=417,t.IM_A_TEAPOT=418,t.UNPROCESSABLE_ENTITY=422,t.LOCKED=423,t.FAILED_DEPENDENCY=424,t.UNORDERED_COLLECTION=425,t.UPGRADE_REQUIRED=426,t.PRECONDITION_REQUIRED=428,t.TOO_MANY_REQUESTS=429,t.REQUEST_HEADER_FIELDS_TOO_LARGE=431,t.INTERNAL_SERVER_ERROR=500,t.NOT_IMPLEMENTED=501,t.BAD_GATEWAY=502,t.SERVICE_UNAVAILABLE=503,t.GATEWAY_TIME_OUT=504,t.HTTP_VERSION_NOT_SUPPORTED=505,t.VARIANT_ALSO_NEGOTIATES=506,t.INSUFFICIENT_STORAGE=507,t.BANDWIDTH_LIMIT_EXCEEDED=509,t.NOT_EXTENDED=510,t.NETWORK_AUTHENTICATION_REQUIRED=511},957(e,t){"use strict";var r,n,o,i,a,s,u,l,c,p;Object.defineProperty(t,"__esModule",{value:!0}),t.ViewingHint=t.ViewingDirection=t.ServiceType=t.ServiceProfile=t.RenderingFormat=t.MediaType=t.IIIFResourceType=t.ExternalResourceType=t.Behavior=t.AnnotationMotivation=void 0,function(e){e.BOOKMARKING="oa:bookmarking",e.CLASSIFYING="oa:classifying",e.COMMENTING="oa:commenting",e.DESCRIBING="oa:describing",e.EDITING="oa:editing",e.HIGHLIGHTING="oa:highlighting",e.IDENTIFYING="oa:identifying",e.LINKING="oa:linking",e.MODERATING="oa:moderating",e.PAINTING="sc:painting",e.QUESTIONING="oa:questioning",e.REPLYING="oa:replying",e.TAGGING="oa:tagging",e.TRANSCRIBING="oad:transcribing"}(r||(t.AnnotationMotivation=r={})),function(e){e.AUTO_ADVANCE="auto-advance",e.CONTINUOUS="continuous",e.FACING_PAGES="facing-pages",e.HIDDEN="hidden",e.INDIVIDUALS="individuals",e.MULTI_PART="multi-part",e.NO_NAV="no-nav",e.NON_PAGED="non-paged",e.PAGED="paged",e.REPEAT="repeat",e.SEQUENCE="sequence",e.THUMBNAIL_NAV="thumbnail-nav",e.TOGETHER="together",e.UNORDERED="unordered"}(n||(t.Behavior=n={})),function(e){e.CANVAS="canvas",e.CHOICE="choice",e.OA_CHOICE="oa:choice",e.CONTENT_AS_TEXT="contentastext",e.DATASET="dataset",e.DOCUMENT="document",e.IMAGE="image",e.MODEL="model",e.MOVING_IMAGE="movingimage",e.PDF="pdf",e.PHYSICAL_OBJECT="physicalobject",e.SOUND="sound",e.TEXT="text",e.TEXTUALBODY="textualbody",e.VIDEO="video"}(o||(t.ExternalResourceType=o={})),function(e){e.ANNOTATION="annotation",e.CANVAS="canvas",e.COLLECTION="collection",e.MANIFEST="manifest",e.RANGE="range",e.SEQUENCE="sequence"}(i||(t.IIIFResourceType=i={})),function(e){e.AUDIO_MP4="audio/mp4",e.CORTO="application/corto",e.DICOM="application/dicom",e.DRACO="application/draco",e.EPUB="application/epub+zip",e.GIRDER="image/vnd.kitware.girder",e.GLB="model/gltf-binary",e.GLTF="model/gltf+json",e.IIIF_PRESENTATION_2='application/ld+json;profile="http://iiif.io/api/presentation/2/context.json"',e.IIIF_PRESENTATION_3='application/ld+json;profile="http://iiif.io/api/presentation/3/context.json"',e.JPG="image/jpeg",e.M3U8="application/vnd.apple.mpegurl",e.MP3="audio/mp3",e.MPEG="audio/mpeg",e.MPEG_DASH="application/dash+xml",e.OBJ="model/obj",e.OPF="application/oebps-package+xml",e.PDF="application/pdf",e.PLY="application/ply",e.THREEJS="application/vnd.threejs+json",e.USDZ="model/vnd.usd+zip",e.VIDEO_MP4="video/mp4",e.WAV="audio/wav",e.WEBM="video/webm"}(a||(t.MediaType=a={})),function(e){e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.ODT="application/vnd.oasis.opendocument.text",e.PDF="application/pdf"}(s||(t.RenderingFormat=s={})),function(e){e.IMAGE_0_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/compliance.html#level0",e.IMAGE_0_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/compliance.html#level1",e.IMAGE_0_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/compliance.html#level2",e.IMAGE_0_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/conformance.html#level0",e.IMAGE_0_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/conformance.html#level1",e.IMAGE_0_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/conformance.html#level2",e.IMAGE_1_COMPLIANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",e.IMAGE_1_COMPLIANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",e.IMAGE_1_COMPLIANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",e.IMAGE_1_CONFORMANCE_LEVEL_0="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0",e.IMAGE_1_CONFORMANCE_LEVEL_1="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",e.IMAGE_1_CONFORMANCE_LEVEL_2="http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2",e.IMAGE_1_LEVEL_0="http://iiif.io/api/image/1/level0.json",e.IMAGE_1_PROFILE_LEVEL_0="http://iiif.io/api/image/1/profiles/level0.json",e.IMAGE_1_LEVEL_1="http://iiif.io/api/image/1/level1.json",e.IMAGE_1_PROFILE_LEVEL_1="http://iiif.io/api/image/1/profiles/level1.json",e.IMAGE_1_LEVEL_2="http://iiif.io/api/image/1/level2.json",e.IMAGE_1_PROFILE_LEVEL_2="http://iiif.io/api/image/1/profiles/level2.json",e.IMAGE_2_LEVEL_0="http://iiif.io/api/image/2/level0.json",e.IMAGE_2_PROFILE_LEVEL_0="http://iiif.io/api/image/2/profiles/level0.json",e.IMAGE_2_LEVEL_1="http://iiif.io/api/image/2/level1.json",e.IMAGE_2_PROFILE_LEVEL_1="http://iiif.io/api/image/2/profiles/level1.json",e.IMAGE_2_LEVEL_2="http://iiif.io/api/image/2/level2.json",e.IMAGE_2_PROFILE_LEVEL_2="http://iiif.io/api/image/2/profiles/level2.json",e.AUTH_0_CLICK_THROUGH="http://iiif.io/api/auth/0/login/clickthrough",e.AUTH_0_LOGIN="http://iiif.io/api/auth/0/login",e.AUTH_0_LOGOUT="http://iiif.io/api/auth/0/logout",e.AUTH_0_RESTRICTED="http://iiif.io/api/auth/0/login/restricted",e.AUTH_0_TOKEN="http://iiif.io/api/auth/0/token",e.AUTH_1_CLICK_THROUGH="http://iiif.io/api/auth/1/clickthrough",e.AUTH_1_EXTERNAL="http://iiif.io/api/auth/1/external",e.AUTH_1_KIOSK="http://iiif.io/api/auth/1/kiosk",e.AUTH_1_LOGIN="http://iiif.io/api/auth/1/login",e.AUTH_1_LOGOUT="http://iiif.io/api/auth/1/logout",e.AUTH_1_PROBE="http://iiif.io/api/auth/1/probe",e.AUTH_1_TOKEN="http://iiif.io/api/auth/1/token",e.SEARCH_0="http://iiif.io/api/search/0/search",e.SEARCH_0_AUTO_COMPLETE="http://iiif.io/api/search/0/autocomplete",e.SEARCH_1="http://iiif.io/api/search/1/search",e.SEARCH_1_AUTO_COMPLETE="http://iiif.io/api/search/1/autocomplete",e.TRACKING_EXTENSIONS="http://universalviewer.io/tracking-extensions-profile",e.UI_EXTENSIONS="http://universalviewer.io/ui-extensions-profile",e.PRINT_EXTENSIONS="http://universalviewer.io/print-extensions-profile",e.SHARE_EXTENSIONS="http://universalviewer.io/share-extensions-profile",e.DOWNLOAD_EXTENSIONS="http://universalviewer.io/download-extensions-profile",e.OTHER_MANIFESTATIONS="http://iiif.io/api/otherManifestations.json",e.IXIF="http://wellcomelibrary.org/ld/ixif/0/alpha.json"}(u||(t.ServiceProfile=u={})),function(e){e.IMAGE_SERVICE_2="ImageService2",e.IMAGE_SERVICE_3="ImageService3"}(l||(t.ServiceType=l={})),function(e){e.BOTTOM_TO_TOP="bottom-to-top",e.LEFT_TO_RIGHT="left-to-right",e.RIGHT_TO_LEFT="right-to-left",e.TOP_TO_BOTTOM="top-to-bottom"}(c||(t.ViewingDirection=c={})),function(e){e.CONTINUOUS="continuous",e.INDIVIDUALS="individuals",e.NON_PAGED="non-paged",e.PAGED="paged",e.TOP="top"}(p||(t.ViewingHint=p={}))},916(e,t,r){e.exports=self.fetch||(self.fetch=r(782).default||r(782))},39(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Annotation=void 0;var i=r(799),a=function(e){function t(t,r){return e.call(this,t,r)||this}return o(t,e),t.prototype.getBody=function(){var e=[],t=this.getProperty("body");if(t)if(Array.isArray(t))for(var r=0;r<t.length;r++)if((a=t[r]).items)for(var n=0;n<a.items.length;n++){var o=a.items[n];e.push(new i.AnnotationBody(o,this.options))}else e.push(new i.AnnotationBody(a,this.options));else if(t.items)for(r=0;r<t.items.length;r++){var a=t.items[r];e.push(new i.AnnotationBody(a,this.options))}else e.push(new i.AnnotationBody(t,this.options));return e},t.prototype.getMotivation=function(){return this.getProperty("motivation")||null},t.prototype.getOn=function(){return this.getProperty("on")},t.prototype.getTarget=function(){return this.getProperty("target")},t.prototype.getResource=function(){return new i.Resource(this.getProperty("resource"),this.options)},t}(i.ManifestResource);t.Annotation=a},339(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationBody=void 0;var i=r(799),a=function(e){function t(t,r){return e.call(this,t,r)||this}return o(t,e),t.prototype.getFormat=function(){var e=this.getProperty("format");return e?i.Utils.getMediaType(e):null},t.prototype.getType=function(){return this.getProperty("type")?i.Utils.normaliseType(this.getProperty("type")):null},t.prototype.getValue=function(){return this.getProperty("value")},t.prototype.getLanguage=function(){return this.getProperty("language")},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t}(i.ManifestResource);t.AnnotationBody=a},435(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationList=void 0;var i=r(799),a=function(e){function t(t,r,n){var o=e.call(this,r)||this;return o.label=t,o.options=n,o}return o(t,e),t.prototype.getIIIFResourceType=function(){return i.Utils.normaliseType(this.getProperty("type"))},t.prototype.getLabel=function(){return this.label},t.prototype.getResources=function(){var e=this;return this.getProperty("resources").map(function(t){return new i.Annotation(t,e.options)})},t.prototype.load=function(){var e=this;return new Promise(function(t,r){if(e.isLoaded)t(e);else{var n=e.__jsonld.id;n||(n=e.__jsonld["@id"]),i.Utils.loadManifest(n).then(function(r){e.__jsonld=r,e.context=e.getProperty("context"),e.id=e.getProperty("id"),e.isLoaded=!0,t(e)}).catch(r)}})},t}(i.JSONLDResource);t.AnnotationList=a},556(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationPage=void 0;var i=r(799),a=function(e){function t(t,r){return e.call(this,t,r)||this}return o(t,e),t.prototype.getItems=function(){return this.getProperty("items")},t.prototype.getAnnotations=function(){var e=[],t=this.getProperty("items");if(!t||!Array.isArray(t))return e;for(var r=0;r<t.length;r++){var n=new i.Annotation(t[r],this.options);e.push(n)}return e},t}(i.ManifestResource);t.AnnotationPage=a},98(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Canvas=void 0;var i=r(957),a=r(799),s=function(e){function t(t,r){return e.call(this,t,r)||this}return o(t,e),t.prototype.getCanonicalImageUri=function(e){var t=null,r="default",n=e,o=n+",";if(this.externalResource&&this.externalResource.data&&this.externalResource.data["@id"])t=this.externalResource.data["@id"],n||(n=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)&&(r="native");else{var i=void 0;if((i=this.getImages())&&i.length){var s=i[0].getResource(),u=s.getServices();if(n||(n=s.getWidth()),l=u?u.find(function(e){return a.Utils.isImageProfile(e.getProfile())||a.Utils.isImageServiceType(e.getIIIFResourceType())}):null)t=l.id,r=a.Utils.getImageQuality(l.getProfile());else if(n===s.getWidth())return s.id}if((i=this.getContent())&&i.length){var l,c=i[0].getBody()[0];if(u=c.getServices(),n||(n=c.getWidth()),l=u?u.find(function(e){return a.Utils.isImageServiceType(e.getIIIFResourceType())}):null)t=l.id,r=a.Utils.getImageQuality(l.getProfile());else if(n===c.getWidth())return c.id}if(!t){var p=this.getProperty("thumbnail");if(p){if("string"==typeof p)return p;if(p["@id"])return p["@id"];if(p.length)return p[0].id}}}return t&&t.endsWith("/")&&(t=t.substr(0,t.length-1)),[t,"full",o,0,r+".jpg"].join("/")},t.prototype.getMaxDimensions=function(){var e,t=null;return this.externalResource&&this.externalResource.data&&this.externalResource.data.profile&&(e=this.externalResource.data.profile,Array.isArray(e)&&(e=e.filter(function(e){var t;return null!==(t=e.maxWidth)&&void 0!==t?t:e.maxwidth})[0])&&(t=new a.Size(e.maxWidth,e.maxHeight?e.maxHeight:e.maxWidth))),this.externalResource&&this.externalResource.data&&this.externalResource.data.maxWidth&&(t=new a.Size(this.externalResource.data.maxWidth,this.externalResource.data.maxHeight?this.externalResource.data.maxHeight:this.externalResource.data.maxWidth)),t},t.prototype.getContent=function(){var e=[],t=this.__jsonld.items||this.__jsonld.content;if(!t)return e;var r=null;if(t.length&&(r=new a.AnnotationPage(t[0],this.options)),!r)return e;for(var n=r.getAnnotations(),o=0;o<n.length;o++){var i=n[o];e.push(i)}return e},t.prototype.getAnnotations=function(){var e=[],t=this.__jsonld.annotations;if(!t||!Array.isArray(t))return e;for(var r=0;r<t.length;r++){var n=new a.AnnotationPage(t[r],this.options);e.push(n)}return e},t.prototype.getDuration=function(){return this.getProperty("duration")},t.prototype.getImages=function(){var e=[];if(!this.__jsonld.images)return e;for(var t=0;t<this.__jsonld.images.length;t++){var r=this.__jsonld.images[t],n=new a.Annotation(r,this.options);e.push(n)}return e},t.prototype.getIndex=function(){return this.getProperty("index")},t.prototype.getOtherContent=function(){var e=this,t=(Array.isArray(this.getProperty("otherContent"))?this.getProperty("otherContent"):[this.getProperty("otherContent")]).filter(function(e){return e&&("string"==typeof(t=e["@type"])&&t.toLowerCase()==t.toLowerCase());var t}).map(function(t,r){return new a.AnnotationList(t.label||"Annotation list ".concat(r),t,e.options)}).map(function(e){return e.load()});return Promise.all(t)},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},Object.defineProperty(t.prototype,"imageResources",{get:function(){var e=this;return[this.getImages().map(function(e){return e.getResource()}),this.getContent().map(function(e){return e.getBody()})].flat(1/0).map(function(r){switch(r.getProperty("type").toLowerCase()){case i.ExternalResourceType.CHOICE:case i.ExternalResourceType.OA_CHOICE:return new t({images:[r.getProperty("default"),r.getProperty("item")].flat().map(function(e){return{resource:e}})},e.options).getImages().map(function(e){return e.getResource()});default:return r}}).flat()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resourceAnnotations",{get:function(){return[this.getImages(),this.getContent()].flat(1/0)},enumerable:!1,configurable:!0}),t.prototype.resourceAnnotation=function(e){return this.resourceAnnotations.find(function(t){return t.getResource().id===e||[t.getBody()].flat().some(function(t){return t.id===e})})},t.prototype.onFragment=function(e){var t=this.resourceAnnotation(e);if(t){var r=t.getProperty("on"),n=t.getProperty("target");if(r&&n){var o=(r||n).match(/xywh=(.*)$/);if(o)return o[1].split(",").map(function(e){return parseInt(e,10)})}}},Object.defineProperty(t.prototype,"iiifImageResources",{get:function(){return this.imageResources.filter(function(e){return e&&e.getServices()[0]&&e.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"imageServiceIds",{get:function(){return this.iiifImageResources.map(function(e){return e.getServices()[0].id})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspectRatio",{get:function(){return this.getWidth()/this.getHeight()},enumerable:!1,configurable:!0}),t.prototype.getChoices=function(){for(var e,t=this,r=0,n=this.getContent();r<n.length;r++){var o=n[r].getProperty("body");if(o&&(null===(e=o.type)||void 0===e?void 0:e.toLowerCase())===i.ExternalResourceType.CHOICE&&o.items&&o.items.length)return o.items.map(function(e){return new a.AnnotationBody(e,t.options)})}return[]},t}(a.Resource);t.Canvas=s},214(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Collection=void 0;var i=r(957),a=r(799),s=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.items=[],n._collections=null,n._manifests=null,t.__collection=n,n}return o(t,e),t.prototype.getCollections=function(){return this._collections?this._collections:this._collections=this.items.filter(function(e){return e.isCollection()})},t.prototype.getManifests=function(){return this._manifests?this._manifests:this._manifests=this.items.filter(function(e){return e.isManifest()})},t.prototype.getCollectionByIndex=function(e){for(var t,r=this.getCollections(),n=0;n<r.length;n++){var o=r[n];o.index===e&&(t=o)}if(t)return t.options.index=e,t.load();throw new Error("Collection index not found")},t.prototype.getManifestByIndex=function(e){for(var t,r=this.getManifests(),n=0;n<r.length;n++){var o=r[n];o.index===e&&(t=o)}if(t)return t.options.index=e,t.load();throw new Error("Manifest index not found")},t.prototype.getTotalCollections=function(){return this.getCollections().length},t.prototype.getTotalManifests=function(){return this.getManifests().length},t.prototype.getTotalItems=function(){return this.items.length},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):i.ViewingDirection.LEFT_TO_RIGHT},t.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getDefaultTree=function(){return e.prototype.getDefaultTree.call(this),this.defaultTree.data.type=a.Utils.normaliseType(a.TreeNodeType.COLLECTION),this._parseManifests(this),this._parseCollections(this),a.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},t.prototype._parseManifests=function(e){if(e.getManifests()&&e.getManifests().length)for(var t=0;t<e.getManifests().length;t++){var r=e.getManifests()[t],n=r.getDefaultTree();n.label=r.parentLabel||r.getLabel().getValue(this.options.locale)||"manifest "+(t+1),n.navDate=r.getNavDate(),n.data.id=r.id,n.data.type=a.Utils.normaliseType(a.TreeNodeType.MANIFEST),e.defaultTree.addNode(n)}},t.prototype._parseCollections=function(e){if(e.getCollections()&&e.getCollections().length)for(var t=0;t<e.getCollections().length;t++){var r=e.getCollections()[t],n=r.getDefaultTree();n.label=r.parentLabel||r.getLabel().getValue(this.options.locale)||"collection "+(t+1),n.navDate=r.getNavDate(),n.data.id=r.id,n.data.type=a.Utils.normaliseType(a.TreeNodeType.COLLECTION),e.defaultTree.addNode(n)}},t}(a.IIIFResource);t.Collection=s},858(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Duration=void 0;var r=function(){function e(e,t){this.start=e,this.end=t}return e.prototype.getLength=function(){return this.end-this.start},e}();t.Duration=r},712(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},167(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},672(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},376(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},184(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},107(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.IIIFResource=void 0;var i=r(799),a=r(957),s=function(e){function t(t,r){var n=e.call(this,t,r)||this;n.index=-1,n.isLoaded=!1;var o={defaultLabel:"-",locale:"en-GB",resource:n,pessimisticAccessControl:!1};return n.options=Object.assign(o,r),n}return o(t,e),t.prototype.getAttribution=function(){var e=this.getProperty("attribution");return e?i.PropertyValue.parse(e,this.options.locale):new i.PropertyValue([],this.options.locale)},t.prototype.getDescription=function(){var e=this.getProperty("description");return void 0===e&&(e=this.getProperty("summary")),e?i.PropertyValue.parse(e,this.options.locale):new i.PropertyValue([],this.options.locale)},t.prototype.getSummary=function(){var e=this.getProperty("summary");return void 0===e&&(e=this.getProperty("description")),e?i.PropertyValue.parse(e,this.options.locale):new i.PropertyValue([],this.options.locale)},t.prototype.getHomepage=function(){var e=this.getProperty("homepage");return e?"string"==typeof e?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||e.id):null},t.prototype.getIIIFResourceType=function(){return i.Utils.normaliseType(this.getProperty("type"))},t.prototype.getLogo=function(){var e=this.getProperty("logo");if(!e){var t=this.getProperty("provider");if(!t)return null;var r=t.find(function(e){return void 0!==e.logo});e=r&&void 0!==r.logo?r.logo:null}return e?"string"==typeof e?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||(null==e?void 0:e.id)):null},t.prototype.getLicense=function(){return i.Utils.getLocalisedValue(this.getProperty("license"),this.options.locale)},t.prototype.getRights=function(){var e=this.getProperty("rights");return e?"string"==typeof e?e:(Array.isArray(e)&&e.length&&(e=e[0]),e["@id"]||e.id):null},t.prototype.getNavDate=function(){return new Date(this.getProperty("navDate"))},t.prototype.getRelated=function(){return this.getProperty("related")},t.prototype.getSeeAlso=function(){return this.getProperty("seeAlso")},t.prototype.getTrackingLabel=function(){var e=this.getService(a.ServiceProfile.TRACKING_EXTENSIONS);return e?e.getProperty("trackingLabel"):""},t.prototype.getDefaultTree=function(){return this.defaultTree=new i.TreeNode("root"),this.defaultTree.data=this,this.defaultTree},t.prototype.getRequiredStatement=function(){var e=null,t=this.getProperty("requiredStatement");if(t)(e=new i.LabelValuePair(this.options.locale)).parse(t);else{var r=this.getAttribution();r&&r.length&&((e=new i.LabelValuePair(this.options.locale)).value=r)}return e},t.prototype.isCollection=function(){return this.getIIIFResourceType()===a.IIIFResourceType.COLLECTION},t.prototype.isManifest=function(){return this.getIIIFResourceType()===a.IIIFResourceType.MANIFEST},t.prototype.load=function(){var e=this;return new Promise(function(t){if(e.isLoaded)t(e);else{var r=e.options;r.navDate=e.getNavDate();var n=e.__jsonld.id;n||(n=e.__jsonld["@id"]),i.Utils.loadManifest(n).then(function(n){e.parentLabel=e.getLabel().getValue(r.locale);var o=i.Deserialiser.parse(n,r);(e=Object.assign(e,o)).index=r.index,t(e)})}})},t}(i.ManifestResource);t.IIIFResource=s},739(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},436(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSONLDResource=void 0;var r=function(){function e(e){this.__jsonld=e,this.context=this.getProperty("context"),this.id=this.getProperty("id")}return e.prototype.getProperty=function(e){var t=null;return this.__jsonld&&((t=this.__jsonld[e])||(t=this.__jsonld["@"+e])),t},e}();t.JSONLDResource=r},817(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LabelValuePair=void 0;var n=r(799),o=function(){function e(e){this.label=null,this.value=null,this.defaultLocale=e}return e.prototype.parse=function(e){this.resource=e,this.label=n.PropertyValue.parse(this.resource.label,this.defaultLocale),this.value=n.PropertyValue.parse(this.resource.value,this.defaultLocale)},e.prototype.getLabel=function(e){return null===this.label?null:(Array.isArray(e)&&!e.length&&(e=void 0),this.label.getValue(e||this.defaultLocale))},e.prototype.getLabels=function(e){return null===this.label?[]:(Array.isArray(e)&&!e.length&&(e=void 0),this.label.getValues(e||this.defaultLocale))},e.prototype.setLabel=function(e){null===this.label&&(this.label=new n.PropertyValue([])),this.label.setValue(e,this.defaultLocale)},e.prototype.getValue=function(e,t){return void 0===t&&(t="<br/>"),null===this.value?null:(Array.isArray(e)&&!e.length&&(e=void 0),this.value.getValue(e||this.defaultLocale,t))},e.prototype.getValues=function(e){return null===this.value?[]:(Array.isArray(e)&&!e.length&&(e=void 0),this.value.getValues(e||this.defaultLocale))},e.prototype.setValue=function(e){null===this.value&&(this.value=new n.PropertyValue([])),this.value.setValue(e,this.defaultLocale)},e}();t.LabelValuePair=o},72(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},212(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageMap=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.getValue=function(e,t){return e.getValue(t,"<br/>")},t.getValues=function(e,t){return e.getValues(t)},t}(Array);t.LanguageMap=o},531(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Manifest=void 0;var i=r(957),a=r(799),s=function(e){function t(t,r){var n=e.call(this,t,r)||this;if(n.index=0,n._allRanges=null,n.items=[],n._topRanges=[],n.__jsonld.structures&&n.__jsonld.structures.length)for(var o=n._getTopRanges(),i=0;i<o.length;i++){var a=o[i];n._parseRanges(a,String(i))}return n}return o(t,e),t.prototype.getPosterCanvas=function(){var e=this.getProperty("posterCanvas");return e&&(e=new a.Canvas(e,this.options)),e},t.prototype.getAccompanyingCanvas=function(){var e=this.getProperty("accompanyingCanvas");return e&&(e=new a.Canvas(e,this.options)),e},t.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getDefaultTree=function(){if(e.prototype.getDefaultTree.call(this),this.defaultTree.data.type=a.Utils.normaliseType(a.TreeNodeType.MANIFEST),!this.isLoaded)return this.defaultTree;var t=this.getTopRanges();return t.length&&t[0].getTree(this.defaultTree),a.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},t.prototype._getTopRanges=function(){var e=[];if(this.__jsonld.structures&&this.__jsonld.structures.length){for(var t=0;t<this.__jsonld.structures.length;t++){var r=this.__jsonld.structures[t];r.viewingHint===i.ViewingHint.TOP&&e.push(r)}if(!e.length){var n={};n.ranges=this.__jsonld.structures,e.push(n)}}return e},t.prototype.getTopRanges=function(){return this._topRanges},t.prototype._getRangeById=function(e){if(this.__jsonld.structures&&this.__jsonld.structures.length)for(var t=0;t<this.__jsonld.structures.length;t++){var r=this.__jsonld.structures[t];if(r["@id"]===e||r.id===e)return r}return null},t.prototype._parseRanges=function(e,t,r){var n=null;if("string"==typeof e&&(n=e,e=this._getRangeById(n)),e){var o=new a.Range(e,this.options);o.parentRange=r,o.path=t,r?r.items.push(o):this._topRanges.push(o);var i=e.items||e.members;if(i)for(var s=0;s<i.length;s++){var u=i[s];if(u["@type"]&&"sc:range"===u["@type"].toLowerCase()||u.type&&"range"===u.type.toLowerCase())this._parseRanges(u,t+"/"+s,o);else if(u["@type"]&&"sc:canvas"===u["@type"].toLowerCase()||u.type&&"canvas"===u.type.toLowerCase()){o.canvases||(o.canvases=[]);var l=u.id||u["@id"];o.canvases.push(l)}}else if(e.ranges)for(s=0;s<e.ranges.length;s++)this._parseRanges(e.ranges[s],t+"/"+s,o)}else console.warn("Range:",n,"does not exist")},t.prototype.getAllRanges=function(){if(null!=this._allRanges)return this._allRanges;this._allRanges=[];for(var e=this.getTopRanges(),t=function(t){var n=e[t];n.id&&r._allRanges.push(n);var o=function(e,t){e.add(t);var r=t.getRanges();return r.length?r.reduce(o,e):e},i=Array.from(n.getRanges().reduce(o,new Set));r._allRanges=r._allRanges.concat(i)},r=this,n=0;n<e.length;n++)t(n);return this._allRanges},t.prototype.getRangeById=function(e){for(var t=this.getAllRanges(),r=0;r<t.length;r++){var n=t[r];if(n.id===e)return n}return null},t.prototype.getRangeByPath=function(e){for(var t=this.getAllRanges(),r=0;r<t.length;r++){var n=t[r];if(n.path===e)return n}return null},t.prototype.getSequences=function(){if(this.items.length)return this.items;var e=this.__jsonld.mediaSequences||this.__jsonld.sequences;if(e)for(var t=0;t<e.length;t++){var r=e[t],n=new a.Sequence(r,this.options);this.items.push(n)}else this.__jsonld.items&&(n=new a.Sequence(this.__jsonld.items,this.options),this.items.push(n));return this.items},t.prototype.getSequenceByIndex=function(e){return this.getSequences()[e]},t.prototype.getTotalSequences=function(){return this.getSequences().length},t.prototype.getManifestType=function(){var e=this.getService(i.ServiceProfile.UI_EXTENSIONS);return e?e.getProperty("manifestType"):a.ManifestType.EMPTY},t.prototype.isMultiSequence=function(){return this.getTotalSequences()>1},t.prototype.isPagingEnabled=function(){var e=this.getViewingHint();if(e)return e===i.ViewingHint.PAGED;var t=this.getBehavior();return!!t&&t===i.Behavior.PAGED},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},t.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},t}(a.IIIFResource);t.Manifest=s},315(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ManifestResource=void 0;var i=r(799),a=r(957),s=function(e){function t(t,r){var n=e.call(this,t)||this;return n.options=r,n}return o(t,e),t.prototype.getIIIFResourceType=function(){return i.Utils.normaliseType(this.getProperty("type"))},t.prototype.getLabel=function(){var e=this.getProperty("label");return e?i.PropertyValue.parse(e,this.options.locale):new i.PropertyValue([],this.options.locale)},t.prototype.getDefaultLabel=function(){return this.getLabel().getValue(this.options.locale)},t.prototype.getMetadata=function(){var e=this.getProperty("metadata"),t=[];if(!e)return t;for(var r=0;r<e.length;r++){var n=e[r],o=new i.LabelValuePair(this.options.locale);o.parse(n),t.push(o)}return t},t.prototype.getRendering=function(e){for(var t=this.getRenderings(),r=0;r<t.length;r++){var n=t[r];if(n.getFormat()===e)return n}return null},t.prototype.getRenderings=function(){var e,t=[];if(!(e=this.__jsonld?this.__jsonld.rendering:this.rendering))return t;Array.isArray(e)||(e=[e]);for(var r=0;r<e.length;r++){var n=e[r];t.push(new i.Rendering(n,this.options))}return t},t.prototype.getRequiredStatement=function(){var e=null,t=this.getProperty("requiredStatement");return t&&(e=new i.LabelValuePair(this.options.locale)).parse(t),e},t.prototype.getService=function(e){return i.Utils.getService(this,e)},t.prototype.getServices=function(){return i.Utils.getServices(this)},t.prototype.getThumbnail=function(){var e=this.getProperty("thumbnail");return Array.isArray(e)&&(e=e[0]),e?new i.Thumbnail(e,this.options):null},t.prototype.isAnnotation=function(){return this.getIIIFResourceType()===a.IIIFResourceType.ANNOTATION},t.prototype.isCanvas=function(){return this.getIIIFResourceType()===a.IIIFResourceType.CANVAS},t.prototype.isCollection=function(){return this.getIIIFResourceType()===a.IIIFResourceType.COLLECTION},t.prototype.isManifest=function(){return this.getIIIFResourceType()===a.IIIFResourceType.MANIFEST},t.prototype.isRange=function(){return this.getIIIFResourceType()===a.IIIFResourceType.RANGE},t.prototype.isSequence=function(){return this.getIIIFResourceType()===a.IIIFResourceType.SEQUENCE},t}(i.JSONLDResource);t.ManifestResource=s},43(e,t){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ManifestType=void 0,function(e){e.EMPTY="",e.MANUSCRIPT="manuscript",e.MONOGRAPH="monograph"}(r||(t.ManifestType=r={}))},6(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.PropertyValue=t.LocalizedValue=void 0;var i=r(41),a=function(){function e(e,t,r){void 0===r&&(r="none"),Array.isArray(e)&&1===e.length?this._value=e[0]:this._value=e,"none"!==t&&"@none"!==t||(t=void 0),this._locale=t,this._defaultLocale=r}return e.parseV2Value=function(t,r){return"string"==typeof t?new e(t,void 0,r):t["@value"]?new e(t["@value"],t["@language"],r):null},Object.defineProperty(e.prototype,"value",{get:function(){return Array.isArray(this._value)?this._value.join("<br/>"):this._value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return void 0===this._locale?this._defaultLocale:this._locale},enumerable:!1,configurable:!0}),e.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)},e}();t.LocalizedValue=a;var s=function(e){function t(r,n){void 0===r&&(r=[]);var o=e.apply(this,r)||this;return o.__proto__=t.prototype,o._defaultLocale=n,o}return o(t,e),t.parse=function(e,r){if(!e)return new t([],r);if(Array.isArray(e)){var n=(o=e.map(function(e){return a.parseV2Value(e,r)}).filter(function(e){return null!==e})).reduce(function(e,t){var r=t._locale;return r||(r="none"),e[r]?e[r].addValue(t._value):e[r]=t,e},{});return new t(Object.values(n),r)}return"string"==typeof e?new t([new a(e,void 0,r)],r):e["@language"]||e["@value"]?new t(null!==(o=a.parseV2Value(e))?[o]:[],r):new t(Object.keys(e).map(function(t){var n=e[t];if(!Array.isArray(n))throw new Error("A IIIF v3 localized property value must have an array as the value for a given language.");return new a(n,t,r)}),r);var o},t.prototype.getSuitableLocale=function(e){for(var t=Array.from(this.values()).map(function(e){return e._locale}).filter(function(e){return void 0!==e}),r=function(e){var r=t.find(function(t){return t===e});if(r)return{value:r}},n=0,o=e;n<o.length;n++){var a=r(o[n]);if("object"==typeof a)return a.value}for(var s=function(e){var r=t.find(function(t){return i.Utils.getInexactLocale(t)===i.Utils.getInexactLocale(e)});if(r)return{value:r}},u=0,l=e;u<l.length;u++){var c=s(l[u]);if("object"==typeof c)return c.value}},t.prototype.setValue=function(e,t){var r=void 0;if(t){var n=this.getSuitableLocale([t]);n&&(r=this.find(function(e){return e._locale===n}))}else r=this.find(function(e){return void 0===e._locale});r?r._value=e:this.push(new a(e,t,this._defaultLocale))},t.prototype.getValue=function(e,t){var r=this.getValues(e);return 0===r.length?null:t?r.join(t):r[0]},t.prototype.getValues=function(e){if(!this.length)return[];var t;if(t=e?Array.isArray(e)?e:[e]:[],1===this.length&&void 0===this[0]._locale){var r=this[0]._value;return Array.isArray(r)?r:[r]}var n=this.getSuitableLocale(t);if(n)return r=this.find(function(e){return e._locale===n})._value,Array.isArray(r)?r:[r];var o=!this.find(function(e){return void 0===e._locale});if(o)return r=this[0]._value,Array.isArray(r)?r:[r];var i=this.find(function(e){return void 0===e._locale});return i?Array.isArray(i._value)?i._value:[i._value]:[]},t}(Array);t.PropertyValue=s},845(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Range=void 0;var i=r(799),a=r(957),s=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n._ranges=null,n.canvases=null,n.items=[],n}return o(t,e),t.prototype.getCanvasIds=function(){return this.__jsonld.canvases?this.__jsonld.canvases:this.canvases?this.canvases:[]},t.prototype.getDuration=function(){if(this.canvases&&this.canvases.length){for(var e=[],t=[],r=0,n=this.canvases;r<n.length;r++)if(_=n[r]){var o=_.match(/(.*)#t=([0-9.]+),?([0-9.]+)?/)||[void 0,_],a=o[1],s=o[2],u=o[3];a&&(e.push(parseFloat(s)),t.push(parseFloat(u)))}if(e.length&&t.length)return new i.Duration(Math.min.apply(Math,e),Math.max.apply(Math,t))}else{e=[],t=[];for(var l=0,c=d=this.getRanges();l<c.length;l++)(v=c[l].getDuration())&&(e.push(v.start),t.push(v.end));if(e.length&&t.length)return new i.Duration(Math.min.apply(Math,e),Math.max.apply(Math,t))}var p,f;if(this.canvases&&this.canvases.length)for(var h=0;h<this.canvases.length;h++){var _=this.canvases[h],g=i.Utils.getTemporalComponent(_);g&&g.length>1&&(0===h&&(p=Number(g[0])),h===this.canvases.length-1&&(f=Number(g[1])))}else{var d=this.getRanges();for(h=0;h<d.length;h++){var v;(v=d[h].getDuration())&&(0===h&&(p=v.start),h===d.length-1&&(f=v.end))}}if(void 0!==p&&void 0!==f)return new i.Duration(p,f)},t.prototype.getRanges=function(){return this._ranges?this._ranges:this._ranges=this.items.filter(function(e){return e.isRange()})},t.prototype.getBehavior=function(){var e=this.getProperty("behavior");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")},t.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.getTree=function(e){e.data=this,this.treeNode=e;var t=this.getRanges();if(t&&t.length)for(var r=0;r<t.length;r++){var n=t[r],o=new i.TreeNode;e.addNode(o),this._parseTreeNode(o,n)}return i.Utils.generateTreeNodeIds(e),e},t.prototype.spansTime=function(e){var t=this.getDuration();return!!(t&&e>=t.start&&e<=t.end)},t.prototype._parseTreeNode=function(e,t){e.label=t.getLabel().getValue(this.options.locale),e.data=t,e.data.type=i.Utils.normaliseType(i.TreeNodeType.RANGE),t.treeNode=e;var r=t.getRanges();if(r&&r.length)for(var n=0;n<r.length;n++){var o=r[n];if(o.getBehavior()!==a.Behavior.NO_NAV){var s=new i.TreeNode;e.addNode(s),this._parseTreeNode(s,o)}}},t}(i.ManifestResource);t.Range=s},940(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Rendering=void 0;var i=function(e){function t(t,r){return e.call(this,t,r)||this}return o(t,e),t.prototype.getFormat=function(){return this.getProperty("format")},t}(r(799).ManifestResource);t.Rendering=i},258(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Resource=void 0;var i=r(799),a=function(e){function t(t,r){return e.call(this,t,r)||this}return o(t,e),t.prototype.getFormat=function(){var e=this.getProperty("format");return e?e.toLowerCase():null},t.prototype.getResources=function(){var e=[];if(!this.__jsonld.resources)return e;for(var t=0;t<this.__jsonld.resources.length;t++){var r=this.__jsonld.resources[t],n=new i.Annotation(r,this.options);e.push(n)}return e},t.prototype.getType=function(){var e=this.getProperty("type");return e?i.Utils.normaliseType(e):null},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.getMaxWidth=function(){return this.getProperty("maxWidth")},t.prototype.getMaxHeight=function(){return this.getProperty("maxHeight")?null:this.getMaxWidth()},t}(i.ManifestResource);t.Resource=a},591(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Sequence=void 0;var i=r(957),a=r(799),s=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.items=[],n._thumbnails=null,n}return o(t,e),t.prototype.getCanvases=function(){if(this.items.length)return this.items;var e=this.__jsonld.canvases||this.__jsonld.elements;if(e)for(var t=0;t<e.length;t++){var r=e[t];(n=new a.Canvas(r,this.options)).index=t,this.items.push(n)}else if(this.__jsonld)for(t=0;t<this.__jsonld.length;t++){var n;r=this.__jsonld[t],(n=new a.Canvas(r,this.options)).index=t,this.items.push(n)}return this.items},t.prototype.getCanvasById=function(e){for(var t=0;t<this.getTotalCanvases();t++){var r=this.getCanvasByIndex(t),n=a.Utils.normaliseUrl(r.id);if(a.Utils.normaliseUrl(e)===n)return r}return null},t.prototype.getCanvasByIndex=function(e){return this.getCanvases()[e]},t.prototype.getCanvasIndexById=function(e){for(var t=0;t<this.getTotalCanvases();t++)if(this.getCanvasByIndex(t).id===e)return t;return null},t.prototype.getCanvasIndexByLabel=function(e,t){e=e.trim(),isNaN(e)||(e=parseInt(e,10).toString(),t&&(e+="r"));for(var r,n,o,i=/(\d*)\D+(\d*)/,a=0;a<this.getTotalCanvases();a++){var s=this.getCanvasByIndex(a);if(s.getLabel().getValue(this.options.locale)===e)return a;if((r=i.exec(e))&&(n=r[1],(o=r[2])&&new RegExp("^"+n+"\\D+"+o+"$").test(s.getLabel().toString())))return a}return-1},t.prototype.getLastCanvasLabel=function(e){for(var t=this.getTotalCanvases()-1;t>=0;t--){var r=this.getCanvasByIndex(t).getLabel().getValue(this.options.locale);if(e){if(/^[a-zA-Z0-9]*$/.test(r))return r}else if(r)return r}return this.options.defaultLabel},t.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},t.prototype.getNextPageIndex=function(e,t){var r;if(t){var n=this.getPagedIndices(e),o=this.getViewingDirection();r=o&&o===i.ViewingDirection.RIGHT_TO_LEFT?n[0]+1:n[n.length-1]+1}else r=e+1;return r>this.getLastPageIndex()?-1:r},t.prototype.getPagedIndices=function(e,t){var r=[];if(t){r=this.isFirstCanvas(e)||this.isLastCanvas(e)?[e]:e%2?[e,e+1]:[e-1,e];var n=this.getViewingDirection();n&&n===i.ViewingDirection.RIGHT_TO_LEFT&&(r=r.reverse())}else r.push(e);return r},t.prototype.getPrevPageIndex=function(e,t){var r;if(t){var n=this.getPagedIndices(e),o=this.getViewingDirection();r=o&&o===i.ViewingDirection.RIGHT_TO_LEFT?n[n.length-1]-1:n[0]-1}else r=e-1;return r},t.prototype.getStartCanvasIndex=function(){var e=this.getStartCanvas();if(e)for(var t=0;t<this.getTotalCanvases();t++)if(this.getCanvasByIndex(t).id===e)return t;return 0},t.prototype.getThumbs=function(e,t){for(var r=[],n=this.getTotalCanvases(),o=0;o<n;o++){var i=this.getCanvasByIndex(o),s=new a.Thumb(e,i);r.push(s)}return r},t.prototype.getThumbnails=function(){if(null!=this._thumbnails)return this._thumbnails;this._thumbnails=[];for(var e=this.getCanvases(),t=0;t<e.length;t++){var r=e[t].getThumbnail();r&&this._thumbnails.push(r)}return this._thumbnails},t.prototype.getStartCanvas=function(){return this.getProperty("startCanvas")},t.prototype.getTotalCanvases=function(){return this.getCanvases().length},t.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?this.getProperty("viewingDirection"):this.options.resource.getViewingDirection?this.options.resource.getViewingDirection():null},t.prototype.getViewingHint=function(){var e=this.getProperty("viewingHint");return Array.isArray(e)&&(e=e[0]),e||null},t.prototype.isCanvasIndexOutOfRange=function(e){return e>this.getTotalCanvases()-1},t.prototype.isFirstCanvas=function(e){return 0===e},t.prototype.isLastCanvas=function(e){return e===this.getTotalCanvases()-1},t.prototype.isMultiCanvas=function(){return this.getTotalCanvases()>1},t.prototype.isPagingEnabled=function(){var e=this.getViewingHint();return