mirador
Version:
An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.
3,289 lines • 141 kB
JavaScript
import { $ as e, C as t, D as n, G as r, J as i, K as a, Q as o, S as s, T as c, Y as l, Z as u, a as d, c as f, d as p, f as m, ft as h, l as g, m as _, n as v, nt as y, o as b, q as x, rt as S, tt as C, u as w, ut as T, v as E, w as D, x as O } from "./getters-B4oepJRC.js";
//#region node_modules/lodash/_isKey.js
var k = /* @__PURE__ */ T(((e, t) => {
var n = S(), r = o(), i = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, a = /^\w*$/;
function s(e, t) {
if (n(e)) return !1;
var o = typeof e;
return o == "number" || o == "symbol" || o == "boolean" || e == null || r(e) ? !0 : a.test(e) || !i.test(e) || t != null && e in Object(t);
}
t.exports = s;
})), A = /* @__PURE__ */ T(((e, t) => {
t.exports = l()(Object, "create");
})), ee = /* @__PURE__ */ T(((e, t) => {
var n = A();
function r() {
this.__data__ = n ? n(null) : {}, this.size = 0;
}
t.exports = r;
})), te = /* @__PURE__ */ T(((e, t) => {
function n(e) {
var t = this.has(e) && delete this.__data__[e];
return this.size -= +!!t, t;
}
t.exports = n;
})), ne = /* @__PURE__ */ T(((e, t) => {
var n = A(), r = "__lodash_hash_undefined__", i = Object.prototype.hasOwnProperty;
function a(e) {
var t = this.__data__;
if (n) {
var a = t[e];
return a === r ? void 0 : a;
}
return i.call(t, e) ? t[e] : void 0;
}
t.exports = a;
})), re = /* @__PURE__ */ T(((e, t) => {
var n = A(), r = Object.prototype.hasOwnProperty;
function i(e) {
var t = this.__data__;
return n ? t[e] !== void 0 : r.call(t, e);
}
t.exports = i;
})), ie = /* @__PURE__ */ T(((e, t) => {
var n = A(), r = "__lodash_hash_undefined__";
function i(e, t) {
var i = this.__data__;
return this.size += +!this.has(e), i[e] = n && t === void 0 ? r : t, this;
}
t.exports = i;
})), ae = /* @__PURE__ */ T(((e, t) => {
var n = ee(), r = te(), i = ne(), a = re(), o = ie();
function s(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1]);
}
}
s.prototype.clear = n, s.prototype.delete = r, s.prototype.get = i, s.prototype.has = a, s.prototype.set = o, t.exports = s;
})), oe = /* @__PURE__ */ T(((e, t) => {
function n() {
this.__data__ = [], this.size = 0;
}
t.exports = n;
})), se = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
return e === t || e !== e && t !== t;
}
t.exports = n;
})), j = /* @__PURE__ */ T(((e, t) => {
var n = se();
function r(e, t) {
for (var r = e.length; r--;) if (n(e[r][0], t)) return r;
return -1;
}
t.exports = r;
})), ce = /* @__PURE__ */ T(((e, t) => {
var n = j(), r = Array.prototype.splice;
function i(e) {
var t = this.__data__, i = n(t, e);
return i < 0 ? !1 : (i == t.length - 1 ? t.pop() : r.call(t, i, 1), --this.size, !0);
}
t.exports = i;
})), le = /* @__PURE__ */ T(((e, t) => {
var n = j();
function r(e) {
var t = this.__data__, r = n(t, e);
return r < 0 ? void 0 : t[r][1];
}
t.exports = r;
})), ue = /* @__PURE__ */ T(((e, t) => {
var n = j();
function r(e) {
return n(this.__data__, e) > -1;
}
t.exports = r;
})), de = /* @__PURE__ */ T(((e, t) => {
var n = j();
function r(e, t) {
var r = this.__data__, i = n(r, e);
return i < 0 ? (++this.size, r.push([e, t])) : r[i][1] = t, this;
}
t.exports = r;
})), M = /* @__PURE__ */ T(((e, t) => {
var n = oe(), r = ce(), i = le(), a = ue(), o = de();
function s(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1]);
}
}
s.prototype.clear = n, s.prototype.delete = r, s.prototype.get = i, s.prototype.has = a, s.prototype.set = o, t.exports = s;
})), fe = /* @__PURE__ */ T(((e, t) => {
var n = ae(), r = M(), a = i();
function o() {
this.size = 0, this.__data__ = {
hash: new n(),
map: new (a || r)(),
string: new n()
};
}
t.exports = o;
})), pe = /* @__PURE__ */ T(((e, t) => {
function n(e) {
var t = typeof e;
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
}
t.exports = n;
})), N = /* @__PURE__ */ T(((e, t) => {
var n = pe();
function r(e, t) {
var r = e.__data__;
return n(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
}
t.exports = r;
})), me = /* @__PURE__ */ T(((e, t) => {
var n = N();
function r(e) {
var t = n(this, e).delete(e);
return this.size -= +!!t, t;
}
t.exports = r;
})), he = /* @__PURE__ */ T(((e, t) => {
var n = N();
function r(e) {
return n(this, e).get(e);
}
t.exports = r;
})), ge = /* @__PURE__ */ T(((e, t) => {
var n = N();
function r(e) {
return n(this, e).has(e);
}
t.exports = r;
})), _e = /* @__PURE__ */ T(((e, t) => {
var n = N();
function r(e, t) {
var r = n(this, e), i = r.size;
return r.set(e, t), this.size += r.size == i ? 0 : 1, this;
}
t.exports = r;
})), ve = /* @__PURE__ */ T(((e, t) => {
var n = fe(), r = me(), i = he(), a = ge(), o = _e();
function s(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1]);
}
}
s.prototype.clear = n, s.prototype.delete = r, s.prototype.get = i, s.prototype.has = a, s.prototype.set = o, t.exports = s;
})), ye = /* @__PURE__ */ T(((e, t) => {
var n = ve(), r = "Expected a function";
function i(e, t) {
if (typeof e != "function" || t != null && typeof t != "function") throw TypeError(r);
var a = function() {
var n = arguments, r = t ? t.apply(this, n) : n[0], i = a.cache;
if (i.has(r)) return i.get(r);
var o = e.apply(this, n);
return a.cache = i.set(r, o) || i, o;
};
return a.cache = new (i.Cache || n)(), a;
}
i.Cache = n, t.exports = i;
})), be = /* @__PURE__ */ T(((e, t) => {
var n = ye(), r = 500;
function i(e) {
var t = n(e, function(e) {
return i.size === r && i.clear(), e;
}), i = t.cache;
return t;
}
t.exports = i;
})), xe = /* @__PURE__ */ T(((e, t) => {
var n = be(), r = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, i = /\\(\\)?/g;
t.exports = n(function(e) {
var t = [];
return e.charCodeAt(0) === 46 && t.push(""), e.replace(r, function(e, n, r, a) {
t.push(r ? a.replace(i, "$1") : n || e);
}), t;
});
})), Se = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e);
return i;
}
t.exports = n;
})), Ce = /* @__PURE__ */ T(((e, t) => {
var n = C(), r = Se(), i = S(), a = o(), s = 1 / 0, c = n ? n.prototype : void 0, l = c ? c.toString : void 0;
function u(e) {
if (typeof e == "string") return e;
if (i(e)) return r(e, u) + "";
if (a(e)) return l ? l.call(e) : "";
var t = e + "";
return t == "0" && 1 / e == -s ? "-0" : t;
}
t.exports = u;
})), we = /* @__PURE__ */ T(((e, t) => {
var n = Ce();
function r(e) {
return e == null ? "" : n(e);
}
t.exports = r;
})), P = /* @__PURE__ */ T(((e, t) => {
var n = S(), r = k(), i = xe(), a = we();
function o(e, t) {
return n(e) ? e : r(e, t) ? [e] : i(a(e));
}
t.exports = o;
})), F = /* @__PURE__ */ T(((e, t) => {
var n = o(), r = 1 / 0;
function i(e) {
if (typeof e == "string" || n(e)) return e;
var t = e + "";
return t == "0" && 1 / e == -r ? "-0" : t;
}
t.exports = i;
})), Te = /* @__PURE__ */ T(((e, t) => {
var n = P(), r = F();
function i(e, t) {
t = n(t, e);
for (var i = 0, a = t.length; e != null && i < a;) e = e[r(t[i++])];
return i && i == a ? e : void 0;
}
t.exports = i;
})), Ee = /* @__PURE__ */ T(((e, t) => {
var n = x();
function r(e, t, r) {
t == "__proto__" && n ? n(e, t, {
configurable: !0,
enumerable: !0,
value: r,
writable: !0
}) : e[t] = r;
}
t.exports = r;
})), De = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
for (var n = -1, r = e == null ? 0 : e.length, i = 0, a = []; ++n < r;) {
var o = e[n];
t(o, n, e) && (a[i++] = o);
}
return a;
}
t.exports = n;
})), Oe = /* @__PURE__ */ T(((e, t) => {
function n(e) {
return function(t, n, r) {
for (var i = -1, a = Object(t), o = r(t), s = o.length; s--;) {
var c = o[e ? s : ++i];
if (n(a[c], c, a) === !1) break;
}
return t;
};
}
t.exports = n;
})), ke = /* @__PURE__ */ T(((e, t) => {
t.exports = Oe()();
})), Ae = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
for (var n = -1, r = Array(e); ++n < e;) r[n] = t(n);
return r;
}
t.exports = n;
})), je = /* @__PURE__ */ T(((e, t) => {
var n = Ae(), r = D(), i = S(), o = O(), s = a(), c = E(), l = Object.prototype.hasOwnProperty;
function u(e, t) {
var a = i(e), u = !a && r(e), d = !a && !u && o(e), f = !a && !u && !d && c(e), p = a || u || d || f, m = p ? n(e.length, String) : [], h = m.length;
for (var g in e) (t || l.call(e, g)) && !(p && (g == "length" || d && (g == "offset" || g == "parent") || f && (g == "buffer" || g == "byteLength" || g == "byteOffset") || s(g, h))) && m.push(g);
return m;
}
t.exports = u;
})), I = /* @__PURE__ */ T(((e, t) => {
var r = je(), i = n(), a = s();
function o(e) {
return a(e) ? r(e) : i(e);
}
t.exports = o;
})), Me = /* @__PURE__ */ T(((e, t) => {
var n = ke(), r = I();
function i(e, t) {
return e && n(e, t, r);
}
t.exports = i;
})), Ne = /* @__PURE__ */ T(((e, t) => {
var n = s();
function r(e, t) {
return function(r, i) {
if (r == null) return r;
if (!n(r)) return e(r, i);
for (var a = r.length, o = t ? a : -1, s = Object(r); (t ? o-- : ++o < a) && i(s[o], o, s) !== !1;);
return r;
};
}
t.exports = r;
})), Pe = /* @__PURE__ */ T(((e, t) => {
var n = Me();
t.exports = Ne()(n);
})), Fe = /* @__PURE__ */ T(((e, t) => {
var n = M();
function r() {
this.__data__ = new n(), this.size = 0;
}
t.exports = r;
})), Ie = /* @__PURE__ */ T(((e, t) => {
function n(e) {
var t = this.__data__, n = t.delete(e);
return this.size = t.size, n;
}
t.exports = n;
})), Le = /* @__PURE__ */ T(((e, t) => {
function n(e) {
return this.__data__.get(e);
}
t.exports = n;
})), Re = /* @__PURE__ */ T(((e, t) => {
function n(e) {
return this.__data__.has(e);
}
t.exports = n;
})), ze = /* @__PURE__ */ T(((e, t) => {
var n = M(), r = i(), a = ve(), o = 200;
function s(e, t) {
var i = this.__data__;
if (i instanceof n) {
var s = i.__data__;
if (!r || s.length < o - 1) return s.push([e, t]), this.size = ++i.size, this;
i = this.__data__ = new a(s);
}
return i.set(e, t), this.size = i.size, this;
}
t.exports = s;
})), Be = /* @__PURE__ */ T(((e, t) => {
var n = M(), r = Fe(), i = Ie(), a = Le(), o = Re(), s = ze();
function c(e) {
var t = this.__data__ = new n(e);
this.size = t.size;
}
c.prototype.clear = r, c.prototype.delete = i, c.prototype.get = a, c.prototype.has = o, c.prototype.set = s, t.exports = c;
})), Ve = /* @__PURE__ */ T(((e, t) => {
function n(e) {
return this.__data__.set(e, "__lodash_hash_undefined__"), this;
}
t.exports = n;
})), He = /* @__PURE__ */ T(((e, t) => {
function n(e) {
return this.__data__.has(e);
}
t.exports = n;
})), Ue = /* @__PURE__ */ T(((e, t) => {
var n = ve(), r = Ve(), i = He();
function a(e) {
var t = -1, r = e == null ? 0 : e.length;
for (this.__data__ = new n(); ++t < r;) this.add(e[t]);
}
a.prototype.add = a.prototype.push = r, a.prototype.has = i, t.exports = a;
})), We = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
for (var n = -1, r = e == null ? 0 : e.length; ++n < r;) if (t(e[n], n, e)) return !0;
return !1;
}
t.exports = n;
})), Ge = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
return e.has(t);
}
t.exports = n;
})), Ke = /* @__PURE__ */ T(((e, t) => {
var n = Ue(), r = We(), i = Ge(), a = 1, o = 2;
function s(e, t, s, c, l, u) {
var d = s & a, f = e.length, p = t.length;
if (f != p && !(d && p > f)) return !1;
var m = u.get(e), h = u.get(t);
if (m && h) return m == t && h == e;
var g = -1, _ = !0, v = s & o ? new n() : void 0;
for (u.set(e, t), u.set(t, e); ++g < f;) {
var y = e[g], b = t[g];
if (c) var x = d ? c(b, y, g, t, e, u) : c(y, b, g, e, t, u);
if (x !== void 0) {
if (x) continue;
_ = !1;
break;
}
if (v) {
if (!r(t, function(e, t) {
if (!i(v, t) && (y === e || l(y, e, s, c, u))) return v.push(t);
})) {
_ = !1;
break;
}
} else if (!(y === b || l(y, b, s, c, u))) {
_ = !1;
break;
}
}
return u.delete(e), u.delete(t), _;
}
t.exports = s;
})), qe = /* @__PURE__ */ T(((e, t) => {
t.exports = y().Uint8Array;
})), Je = /* @__PURE__ */ T(((e, t) => {
function n(e) {
var t = -1, n = Array(e.size);
return e.forEach(function(e, r) {
n[++t] = [r, e];
}), n;
}
t.exports = n;
})), Ye = /* @__PURE__ */ T(((e, t) => {
function n(e) {
var t = -1, n = Array(e.size);
return e.forEach(function(e) {
n[++t] = e;
}), n;
}
t.exports = n;
})), Xe = /* @__PURE__ */ T(((e, t) => {
var n = C(), r = qe(), i = se(), a = Ke(), o = Je(), s = Ye(), c = 1, l = 2, u = "[object Boolean]", d = "[object Date]", f = "[object Error]", p = "[object Map]", m = "[object Number]", h = "[object RegExp]", g = "[object Set]", _ = "[object String]", v = "[object Symbol]", y = "[object ArrayBuffer]", b = "[object DataView]", x = n ? n.prototype : void 0, S = x ? x.valueOf : void 0;
function w(e, t, n, x, C, w, T) {
switch (n) {
case b:
if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1;
e = e.buffer, t = t.buffer;
case y: return !(e.byteLength != t.byteLength || !w(new r(e), new r(t)));
case u:
case d:
case m: return i(+e, +t);
case f: return e.name == t.name && e.message == t.message;
case h:
case _: return e == t + "";
case p: var E = o;
case g:
var D = x & c;
if (E ||= s, e.size != t.size && !D) return !1;
var O = T.get(e);
if (O) return O == t;
x |= l, T.set(e, t);
var k = a(E(e), E(t), x, C, w, T);
return T.delete(e), k;
case v: if (S) return S.call(e) == S.call(t);
}
return !1;
}
t.exports = w;
})), Ze = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
for (var n = -1, r = t.length, i = e.length; ++n < r;) e[i + n] = t[n];
return e;
}
t.exports = n;
})), Qe = /* @__PURE__ */ T(((e, t) => {
var n = Ze(), r = S();
function i(e, t, i) {
var a = t(e);
return r(e) ? a : n(a, i(e));
}
t.exports = i;
})), $e = /* @__PURE__ */ T(((e, t) => {
function n() {
return [];
}
t.exports = n;
})), et = /* @__PURE__ */ T(((e, t) => {
var n = De(), r = $e(), i = Object.prototype.propertyIsEnumerable, a = Object.getOwnPropertySymbols;
t.exports = a ? function(e) {
return e == null ? [] : (e = Object(e), n(a(e), function(t) {
return i.call(e, t);
}));
} : r;
})), tt = /* @__PURE__ */ T(((e, t) => {
var n = Qe(), r = et(), i = I();
function a(e) {
return n(e, i, r);
}
t.exports = a;
})), nt = /* @__PURE__ */ T(((e, t) => {
var n = tt(), r = 1, i = Object.prototype.hasOwnProperty;
function a(e, t, a, o, s, c) {
var l = a & r, u = n(e), d = u.length;
if (d != n(t).length && !l) return !1;
for (var f = d; f--;) {
var p = u[f];
if (!(l ? p in t : i.call(t, p))) return !1;
}
var m = c.get(e), h = c.get(t);
if (m && h) return m == t && h == e;
var g = !0;
c.set(e, t), c.set(t, e);
for (var _ = l; ++f < d;) {
p = u[f];
var v = e[p], y = t[p];
if (o) var b = l ? o(y, v, p, t, e, c) : o(v, y, p, e, t, c);
if (!(b === void 0 ? v === y || s(v, y, a, o, c) : b)) {
g = !1;
break;
}
_ ||= p == "constructor";
}
if (g && !_) {
var x = e.constructor, S = t.constructor;
x != S && "constructor" in e && "constructor" in t && !(typeof x == "function" && x instanceof x && typeof S == "function" && S instanceof S) && (g = !1);
}
return c.delete(e), c.delete(t), g;
}
t.exports = a;
})), rt = /* @__PURE__ */ T(((e, t) => {
var n = Be(), r = Ke(), i = Xe(), a = nt(), o = c(), s = S(), l = O(), u = E(), d = 1, f = "[object Arguments]", p = "[object Array]", m = "[object Object]", h = Object.prototype.hasOwnProperty;
function g(e, t, c, g, _, v) {
var y = s(e), b = s(t), x = y ? p : o(e), S = b ? p : o(t);
x = x == f ? m : x, S = S == f ? m : S;
var C = x == m, w = S == m, T = x == S;
if (T && l(e)) {
if (!l(t)) return !1;
y = !0, C = !1;
}
if (T && !C) return v ||= new n(), y || u(e) ? r(e, t, c, g, _, v) : i(e, t, x, c, g, _, v);
if (!(c & d)) {
var E = C && h.call(e, "__wrapped__"), D = w && h.call(t, "__wrapped__");
if (E || D) {
var O = E ? e.value() : e, k = D ? t.value() : t;
return v ||= new n(), _(O, k, c, g, v);
}
}
return T ? (v ||= new n(), a(e, t, c, g, _, v)) : !1;
}
t.exports = g;
})), it = /* @__PURE__ */ T(((t, n) => {
var r = rt(), i = e();
function a(e, t, n, o, s) {
return e === t ? !0 : e == null || t == null || !i(e) && !i(t) ? e !== e && t !== t : r(e, t, n, o, a, s);
}
n.exports = a;
})), at = /* @__PURE__ */ T(((e, t) => {
var n = Be(), r = it(), i = 1, a = 2;
function o(e, t, o, s) {
var c = o.length, l = c, u = !s;
if (e == null) return !l;
for (e = Object(e); c--;) {
var d = o[c];
if (u && d[2] ? d[1] !== e[d[0]] : !(d[0] in e)) return !1;
}
for (; ++c < l;) {
d = o[c];
var f = d[0], p = e[f], m = d[1];
if (u && d[2]) {
if (p === void 0 && !(f in e)) return !1;
} else {
var h = new n();
if (s) var g = s(p, m, f, e, t, h);
if (!(g === void 0 ? r(m, p, i | a, s, h) : g)) return !1;
}
}
return !0;
}
t.exports = o;
})), ot = /* @__PURE__ */ T(((e, t) => {
var n = u();
function r(e) {
return e === e && !n(e);
}
t.exports = r;
})), st = /* @__PURE__ */ T(((e, t) => {
var n = ot(), r = I();
function i(e) {
for (var t = r(e), i = t.length; i--;) {
var a = t[i], o = e[a];
t[i] = [
a,
o,
n(o)
];
}
return t;
}
t.exports = i;
})), ct = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
return function(n) {
return n != null && n[e] === t && (t !== void 0 || e in Object(n));
};
}
t.exports = n;
})), lt = /* @__PURE__ */ T(((e, t) => {
var n = at(), r = st(), i = ct();
function a(e) {
var t = r(e);
return t.length == 1 && t[0][2] ? i(t[0][0], t[0][1]) : function(r) {
return r === e || n(r, e, t);
};
}
t.exports = a;
})), ut = /* @__PURE__ */ T(((e, t) => {
var n = Te();
function r(e, t, r) {
var i = e == null ? void 0 : n(e, t);
return i === void 0 ? r : i;
}
t.exports = r;
})), dt = /* @__PURE__ */ T(((e, t) => {
function n(e, t) {
return e != null && t in Object(e);
}
t.exports = n;
})), ft = /* @__PURE__ */ T(((e, n) => {
var r = P(), i = D(), o = S(), s = a(), c = t(), l = F();
function u(e, t, n) {
t = r(t, e);
for (var a = -1, u = t.length, d = !1; ++a < u;) {
var f = l(t[a]);
if (!(d = e != null && n(e, f))) break;
e = e[f];
}
return d || ++a != u ? d : (u = e == null ? 0 : e.length, !!u && c(u) && s(f, u) && (o(e) || i(e)));
}
n.exports = u;
})), pt = /* @__PURE__ */ T(((e, t) => {
var n = dt(), r = ft();
function i(e, t) {
return e != null && r(e, t, n);
}
t.exports = i;
})), mt = /* @__PURE__ */ T(((e, t) => {
var n = it(), r = ut(), i = pt(), a = k(), o = ot(), s = ct(), c = F(), l = 1, u = 2;
function d(e, t) {
return a(e) && o(t) ? s(c(e), t) : function(a) {
var o = r(a, e);
return o === void 0 && o === t ? i(a, e) : n(t, o, l | u);
};
}
t.exports = d;
})), ht = /* @__PURE__ */ T(((e, t) => {
function n(e) {
return function(t) {
return t?.[e];
};
}
t.exports = n;
})), gt = /* @__PURE__ */ T(((e, t) => {
var n = Te();
function r(e) {
return function(t) {
return n(t, e);
};
}
t.exports = r;
})), _t = /* @__PURE__ */ T(((e, t) => {
var n = ht(), r = gt(), i = k(), a = F();
function o(e) {
return i(e) ? n(a(e)) : r(e);
}
t.exports = o;
})), vt = /* @__PURE__ */ T(((e, t) => {
var n = lt(), i = mt(), a = r(), o = S(), s = _t();
function c(e) {
return typeof e == "function" ? e : e == null ? a : typeof e == "object" ? o(e) ? i(e[0], e[1]) : n(e) : s(e);
}
t.exports = c;
})), yt = /* @__PURE__ */ T(((e, t) => {
var n = C(), r = D(), i = S(), a = n ? n.isConcatSpreadable : void 0;
function o(e) {
return i(e) || r(e) || !!(a && e && e[a]);
}
t.exports = o;
})), bt = /* @__PURE__ */ T(((e, t) => {
var n = Ze(), r = yt();
function i(e, t, a, o, s) {
var c = -1, l = e.length;
for (a ||= r, s ||= []; ++c < l;) {
var u = e[c];
t > 0 && a(u) ? t > 1 ? i(u, t - 1, a, o, s) : n(s, u) : o || (s[s.length] = u);
}
return s;
}
t.exports = i;
})), xt = /* @__PURE__ */ T(((e, t) => {
var n = bt();
function r(e) {
return e != null && e.length ? n(e, 1) : [];
}
t.exports = r;
})), L = /* @__PURE__ */ h(xt(), 1), St = class {
constructor(e, t = "single") {
this.canvases = e, this.viewType = t, this._groupings = null;
}
getCanvases(e) {
switch (this.viewType) {
case "book": return this.groupings()[Math.ceil(e / 2)];
default: return this.groupings()[e];
}
}
groupings() {
if (this._groupings) return this._groupings;
if (this.viewType === "scroll") return [this.canvases];
if (this.viewType !== "book") return this.canvases.map((e) => [e]);
let e = [];
return this.canvases.forEach((t, n) => {
if (n === 0) {
e.push([t]);
return;
}
n % 2 == 0 ? e[Math.ceil(n / 2)].push(t) : e.push([t]);
}), this._groupings = e, e;
}
}, Ct = /* @__PURE__ */ T(((e, t) => {
(function(n, r) {
typeof e == "object" && typeof t == "object" ? t.exports = r() : typeof define == "function" && define.amd ? define("manifesto", [], r) : typeof e == "object" ? e.manifesto = r() : n.manifesto = r();
})(Object(typeof self < "u" ? self : e), () => (() => {
var e = {
7019(e, t) {
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;
},
3957(e, t) {
var n, r, i, a, o, s, c, l, u, d;
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";
}(n || (t.AnnotationMotivation = n = {})), 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";
}(r || (t.Behavior = r = {})), 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";
}(i || (t.ExternalResourceType = i = {})), function(e) {
e.ANNOTATION = "annotation", e.CANVAS = "canvas", e.COLLECTION = "collection", e.MANIFEST = "manifest", e.RANGE = "range", e.SEQUENCE = "sequence";
}(a || (t.IIIFResourceType = a = {})), 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";
}(o || (t.MediaType = o = {})), 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";
}(c || (t.ServiceProfile = c = {})), 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";
}(u || (t.ViewingDirection = u = {})), function(e) {
e.CONTINUOUS = "continuous", e.INDIVIDUALS = "individuals", e.NON_PAGED = "non-paged", e.PAGED = "paged", e.TOP = "top";
}(d || (t.ViewingHint = d = {}));
},
916(e, t, n) {
e.exports = self.fetch || (self.fetch = n(6782).default || n(6782));
},
1873(e, t, n) {
e.exports = n(9325).Symbol;
},
4528(e) {
e.exports = function(e, t) {
for (var n = -1, r = t.length, i = e.length; ++n < r;) e[i + n] = t[n];
return e;
};
},
3120(e, t, n) {
var r = n(4528), i = n(5891);
e.exports = function e(t, n, a, o, s) {
var c = -1, l = t.length;
for (a ||= i, s ||= []; ++c < l;) {
var u = t[c];
n > 0 && a(u) ? n > 1 ? e(u, n - 1, a, o, s) : r(s, u) : o || (s[s.length] = u);
}
return s;
};
},
2552(e, t, n) {
var r = n(1873), i = n(659), a = n(9350), o = r ? r.toStringTag : void 0;
e.exports = function(e) {
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : o && o in Object(e) ? i(e) : a(e);
};
},
7534(e, t, n) {
var r = n(2552), i = n(346);
e.exports = function(e) {
return i(e) && r(e) == "[object Arguments]";
};
},
4840(e, t, n) {
e.exports = typeof n.g == "object" && n.g && n.g.Object === Object && n.g;
},
659(e, t, n) {
var r = n(1873), i = Object.prototype, a = i.hasOwnProperty, o = i.toString, s = r ? r.toStringTag : void 0;
e.exports = function(e) {
var t = a.call(e, s), n = e[s];
try {
e[s] = void 0;
var r = !0;
} catch {}
var i = o.call(e);
return r && (t ? e[s] = n : delete e[s]), i;
};
},
5891(e, t, n) {
var r = n(1873), i = n(2428), a = n(6449), o = r ? r.isConcatSpreadable : void 0;
e.exports = function(e) {
return a(e) || i(e) || !!(o && e && e[o]);
};
},
9350(e) {
var t = Object.prototype.toString;
e.exports = function(e) {
return t.call(e);
};
},
9325(e, t, n) {
var r = n(4840), i = typeof self == "object" && self && self.Object === Object && self;
e.exports = r || i || Function("return this")();
},
5970(e, t, n) {
var r = n(3120);
e.exports = function(e) {
return e != null && e.length ? r(e, 1) : [];
};
},
3176(e, t, n) {
var r = n(3120), i = 1 / 0;
e.exports = function(e) {
return e != null && e.length ? r(e, i) : [];
};
},
2428(e, t, n) {
var r = n(7534), i = n(346), a = Object.prototype, o = a.hasOwnProperty, s = a.propertyIsEnumerable;
e.exports = r(function() {
return arguments;
}()) ? r : function(e) {
return i(e) && o.call(e, "callee") && !s.call(e, "callee");
};
},
6449(e) {
e.exports = Array.isArray;
},
346(e) {
e.exports = function(e) {
return typeof e == "object" && !!e;
};
},
3039(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Annotation = void 0;
var a = n(4799);
t.Annotation = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(t, e), t.prototype.getBody = function() {
var e = [], t = this.getProperty("body");
if (t) {
if (Array.isArray(t)) for (var n = 0; n < t.length; n++) if ((o = t[n]).items) for (var r = 0; r < o.items.length; r++) {
var i = o.items[r];
e.push(new a.AnnotationBody(i, this.options));
}
else e.push(new a.AnnotationBody(o, this.options));
else if (t.items) for (n = 0; n < t.items.length; n++) {
var o = t.items[n];
e.push(new a.AnnotationBody(o, this.options));
}
else e.push(new a.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 a.Resource(this.getProperty("resource"), this.options);
}, t;
}(a.ManifestResource);
},
2339(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.AnnotationBody = void 0;
var a = n(4799);
t.AnnotationBody = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(t, e), t.prototype.getFormat = function() {
var e = this.getProperty("format");
return e ? a.Utils.getMediaType(e) : null;
}, t.prototype.getType = function() {
return this.getProperty("type") ? a.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;
}(a.ManifestResource);
},
3435(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.AnnotationList = void 0;
var a = n(4799);
t.AnnotationList = function(e) {
function t(t, n, r) {
var i = e.call(this, n) || this;
return i.label = t, i.options = r, i;
}
return i(t, e), t.prototype.getIIIFResourceType = function() {
return a.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 a.Annotation(t, e.options);
});
}, t.prototype.load = function() {
var e = this;
return new Promise(function(t, n) {
if (e.isLoaded) t(e);
else {
var r = e.__jsonld.id;
r ||= e.__jsonld["@id"], a.Utils.loadManifest(r).then(function(n) {
e.__jsonld = n, e.context = e.getProperty("context"), e.id = e.getProperty("id"), e.isLoaded = !0, t(e);
}).catch(n);
}
});
}, t;
}(a.JSONLDResource);
},
3556(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.AnnotationPage = void 0;
var a = n(4799);
t.AnnotationPage = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(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 n = 0; n < t.length; n++) {
var r = new a.Annotation(t[n], this.options);
e.push(r);
}
return e;
}, t;
}(a.ManifestResource);
},
8098(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}), a = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(t, "__esModule", { value: !0 }), t.Canvas = void 0;
var o = n(3957), s = n(4799), c = a(n(5970)), l = a(n(3176));
t.Canvas = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(t, e), t.prototype.getCanonicalImageUri = function(e) {
var t = null, n = "default", r = e, i = r + ",";
if (this.externalResource && this.externalResource.data && this.externalResource.data["@id"]) t = this.externalResource.data["@id"], r ||= 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) && (n = "native");
else {
var a = void 0;
if ((a = this.getImages()) && a.length) {
var o = a[0].getResource(), c = o.getServices();
if (r ||= o.getWidth(), l = c ? c.find(function(e) {
return s.Utils.isImageProfile(e.getProfile()) || s.Utils.isImageServiceType(e.getIIIFResourceType());
}) : null) t = l.id, n = s.Utils.getImageQuality(l.getProfile());
else if (r === o.getWidth()) return o.id;
}
if ((a = this.getContent()) && a.length) {
var l, u = a[0].getBody()[0];
if (c = u.getServices(), r ||= u.getWidth(), l = c ? c.find(function(e) {
return s.Utils.isImageServiceType(e.getIIIFResourceType());
}) : null) t = l.id, n = s.Utils.getImageQuality(l.getProfile());
else if (r === u.getWidth()) return u.id;
}
if (!t) {
var d = this.getProperty("thumbnail");
if (d) {
if (typeof d == "string") return d;
if (d["@id"]) return d["@id"];
if (d.length) return d[0].id;
}
}
}
return t && t.endsWith("/") && (t = t.substr(0, t.length - 1)), [
t,
"full",
i,
0,
n + ".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) {
return e.maxWidth ?? e.maxwidth;
})[0]) && (t = new s.Size(e.maxWidth, e.maxHeight ? e.maxHeight : e.maxWidth))), this.externalResource && this.externalResource.data && this.externalResource.data.maxWidth && (t = new s.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 n = null;
if (t.length && (n = new s.AnnotationPage(t[0], this.options)), !n) return e;
for (var r = n.getAnnotations(), i = 0; i < r.length; i++) {
var a = r[i];
e.push(a);
}
return e;
}, t.prototype.getAnnotations = function() {
var e = [], t = this.__jsonld.annotations;
if (!t || !Array.isArray(t)) return e;
for (var n = 0; n < t.length; n++) {
var r = new s.AnnotationPage(t[n], this.options);
e.push(r);
}
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 n = this.__jsonld.images[t], r = new s.Annotation(n, this.options);
e.push(r);
}
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 && typeof (t = e["@type"]) == "string" && t.toLowerCase() == t.toLowerCase();
var t;
}).map(function(t, n) {
return new s.AnnotationList(t.label || `Annotation list ${n}`, 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, n = (0, l.default)([this.getImages().map(function(e) {
return e.getResource();
}), this.getContent().map(function(e) {
return e.getBody();
})]);
return (0, c.default)(n.map(function(n) {
switch (n.getProperty("type").toLowerCase()) {
case o.ExternalResourceType.CHOICE:
case o.ExternalResourceType.OA_CHOICE: return new t({ images: (0, c.default)([n.getProperty("default"), n.getProperty("item")]).map(function(e) {
return { resource: e };
}) }, e.options).getImages().map(function(e) {
return e.getResource();
});
default: return n;
}
}));
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(t.prototype, "resourceAnnotations", {
get: function() {
return (0, l.default)([this.getImages(), this.getContent()]);
},
enumerable: !1,
configurable: !0
}), t.prototype.resourceAnnotation = function(e) {
return this.resourceAnnotations.find(function(t) {
return t.getResource().id === e || (0, c.default)(Array(t.getBody())).some(function(t) {
return t.id === e;
});
});
}, t.prototype.onFragment = function(e) {
var t = this.resourceAnnotation(e);
if (t) {
var n = t.getProperty("on"), r = t.getProperty("target");
if (n && r) {
var i = (n || r).match(/xywh=(.*)$/);
if (i) return i[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 = this, t = 0, n = this.getContent(); t < n.length; t++) {
var r = n[t].getProperty("body");
if (r && r.type?.toLowerCase() === o.ExternalResourceType.CHOICE && r.items && r.items.length) return r.items.map(function(t) {
return new s.AnnotationBody(t, e.options);
});
}
return [];
}, t;
}(s.Resource);
},
8214(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Collection = void 0;
var a = n(3957), o = n(4799);
t.Collection = function(e) {
function t(t, n) {
var r = e.call(this, t, n) || this;
return r.items = [], r._collections = null, r._manifests = null, t.__collection = r, r;
}
return i(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, n = this.getCollections(), r = 0; r < n.length; r++) {
var i = n[r];
i.index === e && (t = i);
}
if (t) return t.options.index = e, t.load();
throw Error("Collection index not found");
}, t.prototype.getManifestByIndex = function(e) {
for (var t, n = this.getManifests(), r = 0; r < n.length; r++) {
var i = n[r];
i.index === e && (t = i);
}
if (t) return t.options.index = e, t.load();
throw 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") : a.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 = o.Utils.normaliseType(o.TreeNodeType.COLLECTION), this._parseManifests(this), this._parseCollections(this), o.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 n = e.getManifests()[t], r = n.getDefaultTree();
r.label = n.parentLabel || n.getLabel().getValue(this.options.locale) || "manifest " + (t + 1), r.navDate = n.getNavDate(), r.data.id = n.id, r.data.type = o.Utils.normaliseType(o.TreeNodeType.MANIFEST), e.defaultTree.addNode(r);
}
}, t.prototype._parseCollections = function(e) {
if (e.getCollections() && e.getCollections().length) for (var t = 0; t < e.getCollections().length; t++) {
var n = e.getCollections()[t], r = n.getDefaultTree();
r.label = n.parentLabel || n.getLabel().getValue(this.options.locale) || "collection " + (t + 1), r.navDate = n.getNavDate(), r.data.id = n.id, r.data.type = o.Utils.normaliseType(o.TreeNodeType.COLLECTION), e.defaultTree.addNode(r);
}
}, t;
}(o.IIIFResource);
},
1858(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.Duration = void 0, t.Duration = function() {
function e(e, t) {
this.start = e, this.end = t;
}
return e.prototype.getLength = function() {
return this.end - this.start;
}, e;
}();
},
2712(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 });
},
3167(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 });
},
672(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 });
},
7376(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 });
},
2184(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 });
},
107(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.IIIFResource = void 0;
var a = n(4799), o = n(3957);
t.IIIFResource = function(e) {
function t(t, n) {
var r = e.call(this, t, n) || this;
return r.index = -1, r.isLoaded = !1, r.options = Object.assign({
defaultLabel: "-",
locale: "en-GB",
resource: r,
pessimisticAccessControl: !1
}, n), r;
}
return i(t, e), t.prototype.getAttribution = function() {
var e = this.getProperty("attribution");
return e ? a.PropertyValue.parse(e, this.options.locale) : new a.PropertyValue([], this.options.locale);
}, t.prototype.getDescription = function() {
var e = this.getProperty("description");
return e === void 0 && (e = this.getProperty("summary")), e ? a.PropertyValue.parse(e, this.options.locale) : new a.PropertyValue([], this.options.locale);
}, t.prototype.getSummary = function() {
var e = this.getProperty("summary");
return e === void 0 && (e = this.getProperty("description")), e ? a.PropertyValue.parse(e, this.options.locale) : new a.PropertyValue([], this.options.locale);
}, t.prototype.getHomepage = function() {
var e = this.getProperty("homepage");
return e ? typeof e == "string" ? e : (Array.isArray(e) && e.length && (e = e[0]), e["@id"] || e.id) : null;
}, t.prototype.getIIIFResourceType = function() {
return a.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 n = t.find(function(e) {
return e.logo !== void 0;
});
e = n && n.logo !== void 0 ? n.logo : null;
}
return e ? typeof e == "string" ? e : (Array.isArray(e) && e.length && (e = e[0]), e["@id"] || e?.id) : null;
}, t.prototype.getLicense = function() {
return a.Utils.getLocalisedValue(this.getProperty("license"), this.options.locale);
}, t.prototype.getRights = function() {
var e = this.getProperty("rights");
return e ? typeof e == "string" ? 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(o.ServiceProfile.TRACKING_EXTENSIONS);
return e ? e.getProperty("trackingLabel") : "";
}, t.prototype.getDefaultTree = function() {
return this.defaultTree = new a.TreeNode("root"), this.defaultTree.data = this, this.defaultTree;
}, t.prototype.getRequiredStatement = function() {
var e = null, t = this.getProperty("requiredStatement");
if (t) (e = new a.LabelValuePair(this.options.locale)).parse(t);
else {
var n = this.getAttribution();
n && n.length && ((e = new a.LabelValuePair(this.options.locale)).value = n);
}
return e;
}, t.prototype.isCollection = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.COLLECTION;
}, t.prototype.isManifest = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.MANIFEST;
}, t.prototype.load = function() {
var e = this;
return new Promise(function(t) {
if (e.isLoaded) t(e);
else {
var n = e.options;
n.navDate = e.getNavDate();
var r = e.__jsonld.id;
r ||= e.__jsonld["@id"], a.Utils.loadManifest(r).then(function(r) {
e.parentLabel = e.getLabel().getValue(n.locale);
var i = a.Deserialiser.parse(r, n);
(e = Object.assign(e, i)).index = n.index, t(e);
});
}
});
}, t;
}(a.ManifestResource);
},
6739(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 });
},
7436(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.JSONLDResource = void 0, t.JSONLDResource = 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;
}();
},
2817(e, t, n) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.LabelValuePair = void 0;
var r = n(4799);
t.LabelValuePair = function() {
function e(e) {
this.label = null, this.value = null, this.defaultLocale = e;
}
return e.prototype.parse = function(e) {
this.resource = e, this.label = r.PropertyValue.parse(this.resource.label, this.defaultLocale), this.value = r.PropertyValue.parse(this.resource.value, this.defaultLocale);
}, e.prototype.getLabel = function(e) {
return this.label === null ? null : (Array.isArray(e) && !e.length && (e = void 0), this.label.getValue(e || this.defaultLocale));
}, e.prototype.getLabels = function(e) {
return this.label === null ? [] : (Array.isArray(e) && !e.length && (e = void 0), this.label.getValues(e || this.defaultLocale));
}, e.prototype.setLabel = function(e) {
this.label === null && (this.label = new r.PropertyValue([])), this.label.setValue(e, this.defaultLocale);
}, e.prototype.getValue = function(e, t) {
return t === void 0 && (t = "<br/>"), this.value === null ? null : (Array.isArray(e) && !e.length && (e = void 0), this.value.getValue(e || this.defaultLocale, t));
}, e.prototype.getValues = function(e) {
return this.value === null ? [] : (Array.isArray(e) && !e.length && (e = void 0), this.value.getValues(e || this.defaultLocale));
}, e.prototype.setValue = function(e) {
this.value === null && (this.value = new r.PropertyValue([])), this.value.setValue(e, this.defaultLocale);
}, e;
}();
},
72(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 });
},
212(e, t) {
var n, r = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, n(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function r() {
this.constructor = e;
}
n(e, t), e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.LanguageMap = void 0, t.LanguageMap = function(e) {
function t() {
return e !== null && e.apply(this, arguments) || this;
}
return r(t, e), t.getValue = function(e, t) {
return e.getValue(t, "<br/>");
}, t.getValues = function(e, t) {
return e.getValues(t);
}, t;
}(Array);
},
4531(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Manifest = void 0;
var a = n(3957), o = n(4799);
t.Manifest = function(e) {
function t(t, n) {
var r = e.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 i = r._getTopRanges(), a = 0; a < i.length; a++) {
var o = i[a];
r._parseRanges(o, String(a));
}
return r;
}
return i(t, e), t.prototype.getPosterCanvas = function() {
var e = this.getProperty("posterCanvas");
return e &&= new o.Canvas(e, this.options), e;
}, t.prototype.getAccompanyingCanvas = function() {
var e = this.getProperty("accompanyingCanvas");
return e &&= new o.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 = o.Utils.normaliseType(o.TreeNodeType.MANIFEST), !this.isLoaded) return this.defaultTree;
var t = this.getTopRanges();
return t.length && t[0].getTree(this.defaultTree), o.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 n = this.__jsonld.structures[t];
n.viewingHint === a.ViewingHint.TOP && e.push(n);
}
if (!e.length) {
var r = {};
r.ranges = this.__jsonld.structures, e.push(r);
}
}
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 n = this.__jsonld.structures[t];
if (n["@id"] === e || n.id === e) return n;
}
return null;
}, t.prototype._parseRanges = function(e, t, n) {
var r = null;
if (typeof e == "string" && (r = e, e = this._getRangeById(r)), e) {
var i = new o.Range(e, this.options);
i.parentRange = n, i.path = t, n ? n.items.push(i) : this._topRanges.push(i);
var a = e.items || e.members;
if (a) for (var s = 0; s < a.length; s++) {
var c = a[s];
if (c["@type"] && c["@type"].toLowerCase() === "sc:range" || c.type && c.type.toLowerCase() === "range") this._parseRanges(c, t + "/" + s, i);
else if (c["@type"] && c["@type"].toLowerCase() === "sc:canvas" || c.type && c.type.toLowerCase() === "canvas") {
i.canvases ||= [];
var l = c.id || c["@id"];
i.canvases.push(l);
}
}
else if (e.ranges) for (s = 0; s < e.ranges.length; s++) this._parseRanges(e.ranges[s], t + "/" + s, i);
} else console.warn("Range:", r, "does not exist");
}, t.prototype.getAllRanges = function() {
if (this._allRanges != null) return this._allRanges;
this._allRanges = [];
for (var e = this.getTopRanges(), t = function(t) {
var r = e[t];
r.id && n._allRanges.push(r);
var i = function(e, t) {
e.add(t);
var n = t.getRanges();
return n.length ? n.reduce(i, e) : e;
}, a = Array.from(r.getRanges().reduce(i, /* @__PURE__ */ new Set()));
n._allRanges = n._allRanges.concat(a);
}, n = this, r = 0; r < e.length; r++) t(r);
return this._allRanges;
}, t.prototype.getRangeById = function(e) {
for (var t = this.getAllRanges(), n = 0; n < t.length; n++) {
var r = t[n];
if (r.id === e) return r;
}
return null;
}, t.prototype.getRangeByPath = function(e) {
for (var t = this.getAllRanges(), n = 0; n < t.length; n++) {
var r = t[n];
if (r.path === e) return r;
}
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 n = e[t], r = new o.Sequence(n, this.options);
this.items.push(r);
}
else this.__jsonld.items && (r = new o.Sequence(this.__jsonld.items, this.options), this.items.push(r));
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(a.ServiceProfile.UI_EXTENSIONS);
return e ? e.getProperty("manifestType") : o.ManifestType.EMPTY;
}, t.prototype.isMultiSequence = function() {
return this.getTotalSequences() > 1;
}, t.prototype.isPagingEnabled = function() {
var e = this.getViewingHint();
if (e) return e === a.ViewingHint.PAGED;
var t = this.getBehavior();
return !!t && t === a.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;
}(o.IIIFResource);
},
2315(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.ManifestResource = void 0;
var a = n(4799), o = n(3957);
t.ManifestResource = function(e) {
function t(t, n) {
var r = e.call(this, t) || this;
return r.options = n, r;
}
return i(t, e), t.prototype.getIIIFResourceType = function() {
return a.Utils.normaliseType(this.getProperty("type"));
}, t.prototype.getLabel = function() {
var e = this.getProperty("label");
return e ? a.PropertyValue.parse(e, this.options.locale) : new a.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 n = 0; n < e.length; n++) {
var r = e[n], i = new a.LabelValuePair(this.options.locale);
i.parse(r), t.push(i);
}
return t;
}, t.prototype.getRendering = function(e) {
for (var t = this.getRenderings(), n = 0; n < t.length; n++) {
var r = t[n];
if (r.getFormat() === e) return r;
}
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 n = 0; n < e.length; n++) {
var r = e[n];
t.push(new a.Rendering(r, this.options));
}
return t;
}, t.prototype.getRequiredStatement = function() {
var e = null, t = this.getProperty("requiredStatement");
return t && (e = new a.LabelValuePair(this.options.locale)).parse(t), e;
}, t.prototype.getService = function(e) {
return a.Utils.getService(this, e);
}, t.prototype.getServices = function() {
return a.Utils.getServices(this);
}, t.prototype.getThumbnail = function() {
var e = this.getProperty("thumbnail");
return Array.isArray(e) && (e = e[0]), e ? new a.Thumbnail(e, this.options) : null;
}, t.prototype.isAnnotation = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.ANNOTATION;
}, t.prototype.isCanvas = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.CANVAS;
}, t.prototype.isCollection = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.COLLECTION;
}, t.prototype.isManifest = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.MANIFEST;
}, t.prototype.isRange = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.RANGE;
}, t.prototype.isSequence = function() {
return this.getIIIFResourceType() === o.IIIFResourceType.SEQUENCE;
}, t;
}(a.JSONLDResource);
},
3043(e, t) {
var n;
Object.defineProperty(t, "__esModule", { value: !0 }), t.ManifestType = void 0, function(e) {
e.EMPTY = "", e.MANUSCRIPT = "manuscript", e.MONOGRAPH = "monograph";
}(n || (t.ManifestType = n = {}));
},
2006(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.PropertyValue = t.LocalizedValue = void 0;
var a = n(41), o = function() {
function e(e, t, n) {
n === void 0 && (n = "none"), this._value = Array.isArray(e) && e.length === 1 ? e[0] : e, t !== "none" && t !== "@none" || (t = void 0), this._locale = t, this._defaultLocale = n;
}
return e.parseV2Value = function(t, n) {
return typeof t == "string" ? new e(t, void 0, n) : t["@value"] ? new e(t["@value"], t["@language"], n) : 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 this._locale === void 0 ? 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 = o, t.PropertyValue = function(e) {
function t(n, r) {
n === void 0 && (n = []);
var i = e.apply(this, n) || this;
return i.__proto__ = t.prototype, i._defaultLocale = r, i;
}
return i(t, e), t.parse = function(e, n) {
if (!e) return new t([], n);
if (Array.isArray(e)) {
var r = (i = e.map(function(e) {
return o.parseV2Value(e, n);
}).filter(function(e) {
return e !== null;
})).reduce(function(e, t) {
var n = t._locale;
return n ||= "none", e[n] ? e[n].addValue(t._value) : e[n] = t, e;
}, {});
return new t(Object.values(r), n);
}
return typeof e == "string" ? new t([new o(e, void 0, n)], n) : e["@language"] || e["@value"] ? new t((i = o.parseV2Value(e)) === null ? [] : [i], n) : new t(Object.keys(e).map(function(t) {
var r = e[t];
if (!Array.isArray(r)) throw Error("A IIIF v3 localized property value must have an array as the value for a given language.");
return new o(r, t, n);
}), n);
var i;
}, t.prototype.getSuitableLocale = function(e) {
for (var t = Array.from(this.values()).map(function(e) {
return e._locale;
}).filter(function(e) {
return e !== void 0;
}), n = function(e) {
var n = t.find(function(t) {
return t === e;
});
if (n) return { value: n };
}, r = 0, i = e; r < i.length; r++) {
var o = n(i[r]);
if (typeof o == "object") return o.value;
}
for (var s = function(e) {
var n = t.find(function(t) {
return a.Utils.getInexactLocale(t) === a.Utils.getInexactLocale(e);
});
if (n) return { value: n };
}, c = 0, l = e; c < l.length; c++) {
var u = s(l[c]);
if (typeof u == "object") return u.value;
}
}, t.prototype.setValue = function(e, t) {
var n = void 0;
if (t) {
var r = this.getSuitableLocale([t]);
r && (n = this.find(function(e) {
return e._locale === r;
}));
} else n = this.find(function(e) {
return e._locale === void 0;
});
n ? n._value = e : this.push(new o(e, t, this._defaultLocale));
}, t.prototype.getValue = function(e, t) {
var n = this.getValues(e);
return n.length === 0 ? null : t ? n.join(t) : n[0];
}, t.prototype.getValues = function(e) {
if (!this.length) return [];
var t;
if (t = e ? Array.isArray(e) ? e : [e] : [], this.length === 1 && this[0]._locale === void 0) {
var n = this[0]._value;
return Array.isArray(n) ? n : [n];
}
var r = this.getSuitableLocale(t);
if (r) return n = this.find(function(e) {
return e._locale === r;
})._value, Array.isArray(n) ? n : [n];
if (!this.find(function(e) {
return e._locale === void 0;
})) return n = this[0]._value, Array.isArray(n) ? n : [n];
var i = this.find(function(e) {
return e._locale === void 0;
});
return i ? Array.isArray(i._value) ? i._value : [i._value] : [];
}, t;
}(Array);
},
3845(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Range = void 0;
var a = n(4799), o = n(3957);
t.Range = function(e) {
function t(t, n) {
var r = e.call(this, t, n) || this;
return r._ranges = null, r.canvases = null, r.items = [], r;
}
return i(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 = [], n = 0, r = this.canvases; n < r.length; n++) if (m = r[n]) {
var i = m.match(/(.*)#t=([0-9.]+),?([0-9.]+)?/) || [void 0, m], o = i[1], s = i[2], c = i[3];
o && (e.push(parseFloat(s)), t.push(parseFloat(c)));
}
if (e.length && t.length) return new a.Duration(Math.min.apply(Math, e), Math.max.apply(Math, t));
} else {
e = [], t = [];
for (var l = 0, u = g = this.getRanges(); l < u.length; l++) (_ = u[l].getDuration()) && (e.push(_.start), t.push(_.end));
if (e.length && t.length) return new a.Duration(Math.min.apply(Math, e), Math.max.apply(Math, t));
}
var d, f;
if (this.canvases && this.canvases.length) for (var p = 0; p < this.canvases.length; p++) {
var m = this.canvases[p], h = a.Utils.getTemporalComponent(m);
h && h.length > 1 && (p === 0 && (d = Number(h[0])), p === this.canvases.length - 1 && (f = Number(h[1])));
}
else {
var g = this.getRanges();
for (p = 0; p < g.length; p++) {
var _;
(_ = g[p].getDuration()) && (p === 0 && (d = _.start), p === g.length - 1 && (f = _.end));
}
}
if (d !== void 0 && f !== void 0) return new a.Duration(d, 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 n = 0; n < t.length; n++) {
var r = t[n], i = new a.TreeNode();
e.addNode(i), this._parseTreeNode(i, r);
}
return a.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 = a.Utils.normaliseType(a.TreeNodeType.RANGE), t.treeNode = e;
var n = t.getRanges();
if (n && n.length) for (var r = 0; r < n.length; r++) {
var i = n[r];
if (i.getBehavior() !== o.Behavior.NO_NAV) {
var s = new a.TreeNode();
e.addNode(s), this._parseTreeNode(s, i);
}
}
}, t;
}(a.ManifestResource);
},
6940(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Rendering = void 0, t.Rendering = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(t, e), t.prototype.getFormat = function() {
return this.getProperty("format");
}, t;
}(n(4799).ManifestResource);
},
258(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Resource = void 0;
var a = n(4799);
t.Resource = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(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 n = this.__jsonld.resources[t], r = new a.Annotation(n, this.options);
e.push(r);
}
return e;
}, t.prototype.getType = function() {
var e = this.getProperty("type");
return e ? a.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;
}(a.ManifestResource);
},
4591(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Sequence = void 0;
var a = n(3957), o = n(4799);
t.Sequence = function(e) {
function t(t, n) {
var r = e.call(this, t, n) || this;
return r.items = [], r._thumbnails = null, r;
}
return i(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 n = e[t];
(r = new o.Canvas(n, this.options)).index = t, this.items.push(r);
}
else if (this.__jsonld) for (t = 0; t < this.__jsonld.length; t++) {
var r;
n = this.__jsonld[t], (r = new o.Canvas(n, this.options)).index = t, this.items.push(r);
}
return this.items;
}, t.prototype.getCanvasById = function(e) {
for (var t = 0; t < this.getTotalCanvases(); t++) {
var n = this.getCanvasByIndex(t), r = o.Utils.normaliseUrl(n.id);
if (o.Utils.normaliseUrl(e) === r) return n;
}
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 n, r, i, a = /(\d*)\D+(\d*)/, o = 0; o < this.getTotalCanvases(); o++) {
var s = this.getCanvasByIndex(o);
if (s.getLabel().getValue(this.options.locale) === e || (n = a.exec(e)) && (r = n[1], (i = n[2]) && RegExp("^" + r + "\\D+" + i + "$").test(s.getLabel().toString()))) return o;
}
return -1;
}, t.prototype.getLastCanvasLabel = function(e) {
for (var t = this.getTotalCanvases() - 1; t >= 0; t--) {
var n = this.getCanvasByIndex(t).getLabel().getValue(this.options.locale);
if (e) {
if (/^[a-zA-Z0-9]*$/.test(n)) return n;
} else if (n) return n;
}
return this.options.defaultLabel;
}, t.prototype.getLastPageIndex = function() {
return this.getTotalCanvases() - 1;
}, t.prototype.getNextPageIndex = function(e, t) {
var n;
if (t) {
var r = this.getPagedIndices(e), i = this.getViewingDirection();
n = i && i === a.ViewingDirection.RIGHT_TO_LEFT ? r[0] + 1 : r[r.length - 1] + 1;
} else n = e + 1;
return n > this.getLastPageIndex() ? -1 : n;
}, t.prototype.getPagedIndices = function(e, t) {
var n = [];
if (t) {
n = this.isFirstCanvas(e) || this.isLastCanvas(e) ? [e] : e % 2 ? [e, e + 1] : [e - 1, e];
var r = this.getViewingDirection();
r && r === a.ViewingDirection.RIGHT_TO_LEFT && (n = n.reverse());
} else n.push(e);
return n;
}, t.prototype.getPrevPageIndex = function(e, t) {
var n;
if (t) {
var r = this.getPagedIndices(e), i = this.getViewingDirection();
n = i && i === a.ViewingDirection.RIGHT_TO_LEFT ? r[r.length - 1] - 1 : r[0] - 1;
} else n = e - 1;
return n;
}, 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 n = [], r = this.getTotalCanvases(), i = 0; i < r; i++) {
var a = this.getCanvasByIndex(i), s = new o.Thumb(e, a);
n.push(s);
}
return n;
}, t.prototype.getThumbnails = function() {
if (this._thumbnails != null) return this._thumbnails;
this._thumbnails = [];
for (var e = this.getCanvases(), t = 0; t < e.length; t++) {
var n = e[t].getThumbnail();
n && this._thumbnails.push(n);
}
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 e === 0;
}, 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 !!e && e === a.ViewingHint.PAGED;
}, t.prototype.isTotalCanvasesEven = function() {
return this.getTotalCanvases() % 2 == 0;
}, t;
}(o.ManifestResource);
},
4029(e, t, n) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.Deserialiser = void 0;
var r = n(4799);
t.Deserialiser = function() {
function e() {}
return e.parse = function(e, t) {
return typeof e == "string" && (e = JSON.parse(e)), this.parseJson(e, t);
}, e.parseJson = function(e, t) {
var n;
if (t && t.navDate && !isNaN(t.navDate.getTime()) && (e.navDate = t.navDate.toString()), e["@type"]) switch (e["@type"]) {
case "sc:Collection":
n = this.parseCollection(e, t);
break;
case "sc:Manifest":
n = this.parseManifest(e, t);
break;
default: return null;
}
else switch (e.type) {
case "Collection":
n = this.parseCollection(e, t);
break;
case "Manifest":
n = this.parseManifest(e, t);
break;
default: return null;
}
return n.isLoaded = !0, n;
}, e.parseCollection = function(e, t) {
var n = new r.Collection(e, t);
return t ? (n.index = t.index || 0, t.resource && (n.parentCollection = t.resource.parentCollection)) : n.index = 0, this.parseCollections(n, t), this.parseManifests(n, t), this.parseItems(n, t), n;
}, e.parseCollections = function(e, t) {
var n;
if (e.__jsonld.collections ? n = e.__jsonld.collections : e.__jsonld.items && (n = e.__jsonld.items.filter(function(e) {
return e.type.toLowerCase() === "collection";
})), n) for (var r = 0; r < n.length; r++) {
t && (t.index = r);
var i = this.parseCollection(n[r], t);
i.index = r, i.parentCollection = e, e.items.push(i);
}
}, e.parseManifest = function(e, t) {
return new r.Manifest(e, t);
}, e.parseManifests = function(e, t) {
var n;
if (e.__jsonld.manifests ? n = e.__jsonld.manifests : e.__jsonld.items && (n = e.__jsonld.items.filter(function(e) {
return e.type.toLowerCase() === "manifest";
})), n) for (var r = 0; r < n.length; r++) {
var i = this.parseManifest(n[r], t);
i.index = r, i.parentCollection = e, e.items.push(i);
}
}, e.parseItem = function(e, t) {
if (e["@type"]) {
if (e["@type"].toLowerCase() === "sc:manifest") return this.parseManifest(e, t);
if (e["@type"].toLowerCase() === "sc:collection") return this.parseCollection(e, t);
} else if (e.type) {
if (e.type.toLowerCase() === "manifest") return this.parseManifest(e, t);
if (e.type.toLowerCase() === "collection") return this.parseCollection(e, t);
}
return null;
}, e.parseItems = function(e, t) {
var n = e.__jsonld.members || e.__jsonld.items;
if (n) for (var r = function(r) {
t && (t.index = r);
var a = i.parseItem(n[r], t);
return a ? e.items.filter(function(e) {
return e.id === a.id;
})[0] ? "continue" : (a.index = r, a.parentCollection = e, void e.items.push(a)) : { value: void 0 };
}, i = this, a = 0; a < n.length; a++) {
var o = r(a);
if (typeof o == "object") return o.value;
}
}, e;
}();
},
9579(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Service = void 0;
var a = n(4799);
t.Service = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(t, e), t.prototype.getProfile = function() {
var e = this.getProperty("profile");
return e ||= this.getProperty("dcterms:conformsTo"), Array.isArray(e) ? e[0] : e;
}, t.prototype.getConfirmLabel = function() {
return a.Utils.getLocalisedValue(this.getProperty("confirmLabel"), this.options.locale);
}, t.prototype.getDescription = function() {
return a.Utils.getLocalisedValue(this.getProperty("description"), this.options.locale);
}, t.prototype.getFailureDescription = function() {
return a.Utils.getLocalisedValue(this.getProperty("failureDescription"), this.options.locale);
}, t.prototype.getFailureHeader = function() {
return a.Utils.getLocalisedValue(this.getProperty("failureHeader"), this.options.locale);
}, t.prototype.getHeader = function() {
return a.Utils.getLocalisedValue(this.getProperty("header"), this.options.locale);
}, t.prototype.getServiceLabel = function() {
return a.Utils.getLocalisedValue(this.getProperty("label"), this.options.locale);
}, t.prototype.getInfoUri = function() {
var e = this.id;
return e.endsWith("/") || (e += "/"), e + "info.json";
}, t;
}(a.ManifestResource);
},
2639(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.Size = void 0, t.Size = function(e, t) {
this.width = e, this.height = t;
};
},
5633(e, t) {
var n;
Object.defineProperty(t, "__esModule", { value: !0 }), t.StatusCode = void 0, function(e) {
e[e.AUTHORIZATION_FAILED = 1] = "AUTHORIZATION_FAILED", e[e.FORBIDDEN = 2] = "FORBIDDEN", e[e.INTERNAL_SERVER_ERROR = 3] = "INTERNAL_SERVER_ERROR", e[e.RESTRICTED = 4] = "RESTRICTED";
}(n || (t.StatusCode = n = {}));
},
9692(e, t) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.Thumb = void 0, t.Thumb = function(e, t) {
this.data = t, this.index = t.index, this.width = e;
var n = t.getHeight() / t.getWidth();
this.height = n ? Math.floor(this.width * n) : e, this.uri = t.getCanonicalImageUri(e), this.label = t.getLabel().getValue(), this.viewingHint = t.getViewingHint();
};
},
4204(e, t, n) {
var r, i = 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 n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, r(e, t);
}, function(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e;
}
r(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.Thumbnail = void 0, t.Thumbnail = function(e) {
function t(t, n) {
return e.call(this, t, n) || this;
}
return i(t, e), t;
}(n(4799).Resource);
},
8570(e, t, n) {
Object.defineProperty(t, "__esModule", { value: !0 }), t.TreeNode = void 0;
var r = n(4799);
t.TreeNode = function() {
function e(e, t) {
this.label = e, this.data = t || {}, this.nodes = [];
}
return e.prototype.addNode = function(e) {
this.nodes.push(e), e.parentNode = this;
}, e.prototype.isCollection = function() {
return this.data.type === r.Utils.normaliseType(r.TreeNodeType.COLLECTION);
}, e.prototype.isManifest = function() {
return this.data.type === r.Utils.normaliseType(r.TreeNodeType.MANIFEST);
}, e.prototype.isRange = function() {
return this.data.type === r.Utils.normaliseType(r.TreeNodeType.RANGE);
}, e;
}();
},
6386(e, t) {
var n;
Object.defineProperty(t, "__esModule", { value: !0 }), t.TreeNodeType = void 0, function(e) {
e.COLLECTION = "collection", e.MANIFEST = "manifest", e.RANGE = "range";
}(n || (t.TreeNodeType = n = {}));
},
41(e, t, n) {
var r = this && this.__awaiter || function(e, t, n, r) {
return new (n ||= Promise)(function(i, a) {
function o(e) {
try {
c(r.next(e));
} catch (e) {
a(e);
}
}
function s(e) {
try {
c(r.throw(e));
} catch (e) {
a(e);
}
}
function c(e) {
var t;
e.done ? i(e.value) : (t = e.value, t instanceof n ? t : new n(function(e) {
e(t);
})).then(o, s);
}
c((r = r.apply(e, t || [])).next());
});
}, i = this && this.__generator || function(e, t) {
var n, r, i, a = {
label: 0,
sent: function() {
if (1 & i[0]) throw i[1];
return i[1];
},
trys: [],
ops: []
}, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
return o.next = s(0), o.throw = s(1), o.return = s(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() {
return this;
}), o;
function s(s) {
return function(c) {
return function(s) {
if (n) throw TypeError("Generator is already executing.");
for (; o && (o = 0, s[0] && (a = 0)), a;) try {
if (n = 1, r && (i = 2 & s[0] ? r.return : s[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, s[1])).done) return i;
switch (r = 0, i && (s = [2 & s[0], i.value]), s[0]) {
case 0:
case 1:
i = s;
break;
case 4: return a.label++, {
value: s[1],
done: !1
};
case 5:
a.label++, r = s[1], s = [0];
continue;
case 7:
s = a.ops.pop(), a.trys.pop();
continue;
default:
if (!((i = (i = a.trys).length > 0 && i[i.length - 1]) || s[0] !== 6 && s[0] !== 2)) {
a = 0;
continue;
}
if (s[0] === 3 && (!i || s[1] > i[0] && s[1] < i[3])) {
a.label = s[1];
break;
}
if (s[0] === 6 && a.label < i[1]) {
a.label = i[1], i = s;
break;
}
if (i && a.label < i[2]) {
a.label = i[2], a.ops.push(s);
break;
}
i[2] && a.ops.pop(), a.trys.pop();
continue;
}
s = t.call(e, a);
} catch (e) {
s = [6, e], r = 0;
} finally {
n = i = 0;
}
if (5 & s[0]) throw s[1];
return {
value: s[0] ? s[1] : void 0,
done: !0
};
}([s, c]);
};
}
};
Object.defineProperty(t, "__esModule", { value: !0 }), t.Utils = void 0;
var a = n(4799), o = n(3957), s = n(7019);
n(916), t.Utils = function() {
function e() {}
return e.getMediaType = function(e) {
return (e = (e = e.toLowerCase()).split(";")[0]).trim();
}, e.getImageQuality = function(e) {
return e === o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1 || e === o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2 || e === o.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1 || e === o.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2 || e === o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1 || e === o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2 || e === o.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1 || e === o.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2 || e === o.ServiceProfile.IMAGE_1_LEVEL_1 || e === o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1 || e === o.ServiceProfile.IMAGE_1_LEVEL_2 || e === o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2 ? "native" : "default";
}, e.getInexactLocale = function(e) {
return e.indexOf("-") === -1 ? e : e.substr(0, e.indexOf("-"));
}, e.getLocalisedValue = function(e, t) {
if (!Array.isArray(e)) return e;
for (var n = 0; n < e.length; n++) {
var r = e[n];
if (t === r["@language"]) return r["@value"];
}
var i = t.substr(0, t.indexOf("-"));
for (n = 0; n < e.length; n++) {
var a = e[n];
if (a["@language"] === i) return a["@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 i = 0; i < t.nodes.length; i++) {
var a = t.nodes[i];
e.generateTreeNodeIds(a, i);
}
}, e.normaliseType = function(e) {
return (e = (e || "").toLowerCase()).indexOf(":") === -1 ? e : e.split(":")[1];
}, e.normaliseUrl = function(e) {
return (e = e.substr(e.indexOf("://"))).indexOf("#") !== -1 && (e = e.split("#")[0]), e;
}, e.normalisedUrlsMatch = function(t, n) {
return e.normaliseUrl(t) === e.normaliseUrl(n);
}, e.isImageProfile = function(t) {
return !!(e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2));
}, e.isImageServiceType = function(e) {
return e !== null && e.toLowerCase() === o.ServiceType.IMAGE_SERVICE_2.toLowerCase() || e === o.ServiceType.IMAGE_SERVICE_3.toLowerCase();
}, e.isLevel0ImageProfile = function(t) {
return !!(e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_LEVEL_0) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_PROFILE_LEVEL_0));
}, e.isLevel1ImageProfile = function(t) {
return !!(e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_LEVEL_1) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_PROFILE_LEVEL_1));
}, e.isLevel2ImageProfile = function(t) {
return !!(e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_COMPLIANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_COMPLIANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_0_CONFORMANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_CONFORMANCE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_1_PROFILE_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_LEVEL_2) || e.normalisedUrlsMatch(t, o.ServiceProfile.IMAGE_2_PROFILE_LEVEL_2));
}, e.parseManifest = function(e, t) {
return a.Deserialiser.parse(e, t);
}, e.checkStatus = function(e) {
if (e.ok) return e;
var t = Error(e.statusText);
return t.response = e, Promise.reject(t);
}, e.loadManifest = function(t) {
return new Promise(function(n, r) {
fetch(t).then(e.checkStatus).then(function(e) {
return e.json();
}).then(function(e) {
n(e);
}).catch(function(e) {
r();
});
});
}, e.loadExternalResourcesAuth1 = function(t, n, r, i, a, o, s, c) {
return new Promise(function(l, u) {
var d = t.map(function(t) {
return e.loadExternalResourceAuth1(t, n, r, i, a, o, s, c);
});
Promise.all(d).then(function() {
l(t);
}).catch(function(e) {
u(e);
});
});
}, e.loadExternalResourceAuth1 = function(t, n, a, o, c, l, u, d) {
return r(this, void 0, void 0, function() {
var r;
return i(this, function(i) {
switch (i.label) {
case 0: return [4, o(t)];
case 1: return (r = i.sent()) ? [4, t.getData(r)] : [3, 6];
case 2: return i.sent(), t.status === s.OK ? [2, t] : [3, 3];
case 3: return [4, e.doAuthChain(t, n, a, c, l, u, d)];
case 4: i.sent(), i.label = 5;
case 5:
if (t.status === s.OK || t.status === s.MOVED_TEMPORARILY) return [2, t];
throw e.createAuthorizationFailedError();
case 6: return [4, t.getData()];
case 7: return i.sent(), t.status !== s.MOVED_TEMPORARILY && t.status !== s.UNAUTHORIZED ? [3, 9] : [4, e.doAuthChain(t, n, a, c, l, u, d)];
case 8: i.sent(), i.label = 9;
case 9:
if (t.status === s.OK || t.status === s.MOVED_TEMPORARILY) return [2, t];
throw e.createAuthorizationFailedError();
}
});
});
}, e.doAuthChain = function(t, n, a, o, c, l, u) {
return r(this, void 0, void 0, function() {
var r, d, f, p, m, h, g, _;
return i(this, function(i) {
switch (i.label) {
case 0: return t.isAccessControlled() ? ((r = t.externalService) && (r.options = t.options), (d = t.kioskService) && (d.options = t.options), (f = t.clickThroughService) && (f.options = t.options), (p = t.loginService) && (p.options = t.options), t.isResponseHandled || t.status !== s.MOVED_TEMPORARILY ? [3, 2] : [4, l(t)]) : [2, t];
case 1:
case 3:
case 6:
case 10:
case 14: return i.sent(), [2, t];
case 2: return m = null, h = null, (m = r) ? (h = m, [4, e.attemptResourceWithToken(t, a, m)]) : [3, 4];
case 4: return (m = d) ? (h = m, (g = n(m)) ? [4, o(g)] : [3, 7]) : [3, 7];
case 5:
case 9:
case 13: return i.sent(), [4, e.attemptResourceWithToken(t, a, m)];
case 7: return (m = f) ? (h = m, [4, c(t, m)]) : [3, 11];
case 8: return (_ = i.sent()) ? [4, o(_)] : [3, 11];
case 11: return (m = p) ? (h = m, [4, c(t, m)]) : [3, 15];
case 12: return (_ = i.sent()) ? [4, o(_)] : [3, 15];
case 15: return h && u(t, h), [2];
}
});
});
}, e.attemptResourceWithToken = function(e, t, n) {
return r(this, void 0, void 0, function() {
var r, a;
return i(this, function(i) {
switch (i.label) {
case 0: return (r = n.getService(o.ServiceProfile.AUTH_1_TOKEN)) ? [4, t(e, r)] : [3, 3];
case 1: return (a = i.sent()) && a.accessToken ? [4, e.getData(a)] : [3, 3];
case 2: return i.sent(), [2, e];
case 3: return [2];
}
});
});
}, e.loadExternalResourcesAuth09 = function(t, n, r, i, a, o, s, c, l, u) {
return new Promise(function(d, f) {
var p = t.map(function(t) {
return e.loadExternalResourceAuth09(t, n, r, i, a, o, s, c, l, u);
});
Promise.all(p).then(function() {
d(t);
}).catch(function(e) {
f(e);
});
});
}, e.loadExternalResourceAuth09 = function(t, n, r, i, a, o, c, l, u, d) {
return new Promise(function(f, p) {
d && d.pessimisticAccessControl ? t.getData().then(function() {
t.isAccessControlled() ? t.clickThroughService ? (f(r(t)), f(i(t))) : a(t).then(function() {
o(t, !0).then(function(n) {
t.getData(n).then(function() {
f(u(t));
}).catch(function(t) {
p(e.createInternalServerError(t));
});
}).catch(function(t) {
p(e.createInternalServerError(t));
});
}).catch(function(t) {
p(e.createInternalServerError(t));
}) : f(t);
}).catch(function(t) {
p(e.createInternalServerError(t));
}) : l(t, n).then(function(d) {
d ? t.getData(d).then(function() {
t.status === s.OK ? f(u(t)) : e.authorize(t, n, r, i, a, o, c, l).then(function() {
f(u(t));
}).catch(function(t) {
p(e.createAuthorizationFailedError());
});
}).catch(function(t) {
p(e.createAuthorizationFailedError());
}) : e.authorize(t, n, r, i, a, o, c, l).then(function() {
f(u(t));
}).catch(function(t) {
p(e.createAuthorizationFailedError());
});
}).catch(function(t) {
p(e.createAuthorizationFailedError());
});
});
}, e.createError = function(e, t) {
var n = /* @__PURE__ */ Error();
return n.message = t, n.name = String(e), n;
}, e.createAuthorizationFailedError = function() {
return e.createError(a.StatusCode.AUTHORIZATION_FAILED, "Authorization failed");
}, e.createRestrictedError = function() {
return e.createError(a.StatusCode.RESTRICTED, "Restricted");
}, e.createInternalServerError = function(t) {
return e.createError(a.StatusCode.INTERNAL_SERVER_ERROR, t);
}, e.authorize = function(t, n, r, i, a, o, c, l) {
return new Promise(function(u, d) {
t.getData().then(function() {
t.isAccessControlled() ? l(t, n).then(function(l) {
l ? t.getData(l).then(function() {
t.status === s.OK ? u(t) : e.showAuthInteraction(t, n, r, i, a, o, c, u, d);
}).catch(function(t) {
d(e.createInternalServerError(t));
}) : o(t, !1).then(function(l) {
l ? c(t, l, n).then(function() {
t.getData(l).then(function() {
t.status === s.OK ? u(t) : e.showAuthInteraction(t, n, r, i, a, o, c, u, d);
}).catch(function(t) {
d(e.createInternalServerError(t));
});
}).catch(function(t) {
d(e.createInternalServerError(t));
}) : e.showAuthInteraction(t, n, r, i, a, o, c, u, d);
});
}).catch(function(t) {
d(e.createInternalServerError(t));
}) : u(t);
});
});
}, e.showAuthInteraction = function(t, n, r, i, a, o, c, l, u) {
t.status !== s.MOVED_TEMPORARILY || t.isResponseHandled ? t.clickThroughService && !t.isResponseHandled ? r(t).then(function() {
o(t, !0).then(function(r) {
c(t, r, n).then(function() {
t.getData(r).then(function() {
l(t);
}).catch(function(t) {
u(e.createInternalServerError(t));
});
}).catch(function(t) {
u(e.createInternalServerError(t));
});
}).catch(function(t) {
u(e.createInternalServerError(t));
});
}) : a(t).then(function() {
o(t, !0).then(function(r) {
c(t, r, n).then(function() {
t.getData(r).then(function() {
l(t);
}).catch(function(t) {
u(e.createInternalServerError(t));
});
}).catch(function(t) {
u(e.createInternalServerError(t));
});
}).catch(function(t) {
u(e.createInternalServerError(t));
});
}) : l(t);
}, e.getService = function(e, t) {
for (var n = this.getServices(e), r = 0; r < n.length; r++) {
var i = n[r];
if (i.getProfile() === t) return i;
}
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 i = 0; i < Object.keys(t).length; i++) if (typeof t[Object.keys(t)[i]] == "object") {
var a = e.traverseAndFind(t[Object.keys(t)[i]], n, r);
if (a != null) return a;
}
}, e.getServices = function(t, n) {
var r = n === void 0 ? {} : n, i = r.onlyService, o = i !== void 0 && i, s = r.onlyServices, c = s !== void 0 && s, l = r.skipParentResources, u = [];
(l === void 0 || !l) && t && t.options && t.options.resource && t.options.resource !== t && u.push.apply(u, e.getServices(t.options.resource, { onlyServices: !0 }));
var d = c ? [] : (t.__jsonld || t).service || [];
if (Array.isArray(d) || (d = [d]), o || d.push.apply(d, (t.__jsonld || t).services || []), d.length === 0) return u;
for (var f = 0; f < d.length; f++) {
var p = d[f];
if (typeof p == "string") {
var m = this.getResourceById(t.options.resource, p);
m && u.push(new a.Service(m.__jsonld || m, t.options));
} else u.push(new a.Service(p, t.options));
}
return u;
}, e.getTemporalComponent = function(e) {
var t = /t=([^&]+)/g.exec(e), n = null;
return t && t[1] && (n = t[1].split(",")), n;
}, e;
}();
},
8156(e, t, n) {
var r = this && this.__createBinding || (Object.create ? function(e, t, n, r) {
r === void 0 && (r = n);
var i = Object.getOwnPropertyDescriptor(t, n);
i && !("get" in i ? !t.__esModule : i.writable || i.configurable) || (i = {
enumerable: !0,
get: function() {
return t[n];
}
}), Object.defineProperty(e, r, i);
} : function(e, t, n, r) {
r === void 0 && (r = n), e[r] = t[n];
}), i = this && this.__exportStar || function(e, t) {
for (var n in e) n === "default" || Object.prototype.hasOwnProperty.call(t, n) || r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }), t.parseManifest = t.loadManifest = void 0, i(n(4799), t);
var a = n(41);
t.loadManifest = function(e) {
return a.Utils.loadManifest(e);
}, t.parseManifest = function(e, t) {
return a.Utils.parseManifest(e, t);
};
},
4799(e, t, n) {
var r = this && this.__createBinding || (Object.create ? function(e, t, n, r) {
r === void 0 && (r = n);
var i = Object.getOwnPropertyDescriptor(t, n);
i && !("get" in i ? !t.__esModule : i.writable || i.configurable) || (i = {
enumerable: !0,
get: function() {
return t[n];
}
}), Object.defineProperty(e, r, i);
} : function(e, t, n, r) {
r === void 0 && (r = n), e[r] = t[n];
}), i = this && this.__exportStar || function(e, t) {
for (var n in e) n === "default" || Object.prototype.hasOwnProperty.call(t, n) || r(t, e, n);
};
Object.defineProperty(t, "__esModule", { value: !0 }), i(n(7436), t), i(n(2315), t), i(n(258), t), i(n(107), t), i(n(3039), t), i(n(2339), t), i(n(3435), t), i(n(3556), t), i(n(8098), t), i(n(8214), t), i(n(1858), t), i(n(2712), t), i(n(3167), t), i(n(672), t), i(n(7376), t), i(n(2184), t), i(n(6739), t), i(n(2817), t), i(n(72), t), i(n(212), t), i(n(2006), t), i(n(4531), t), i(n(3043), t), i(n(3845), t), i(n(6940), t), i(n(4591), t), i(n(4029), t), i(n(9579), t), i(n(2639), t), i(n(5633), t), i(n(9692), t), i(n(4204), t), i(n(8570), t), i(n(6386), t), i(n(41), t);
},
6782(e, t, n) {
function r(e, t) {
return t ||= {}, new Promise(function(n, r) {
var i = new XMLHttpRequest(), a = [], o = [], s = {}, c = function() {
return {
ok: (i.status / 100 | 0) == 2,
statusText: i.statusText,
status: i.status,
url: i.responseURL,
text: function() {
return Promise.resolve(i.responseText);
},
json: function() {
return Promise.resolve(i.responseText).then(JSON.parse);
},
blob: function() {
return Promise.resolve(new Blob([i.response]));
},
clone: c,
headers: {
keys: function() {
return a;
},
entries: function() {
return o;
},
get: function(e) {
return s[e.toLowerCase()];
},
has: function(e) {
return e.toLowerCase() in s;
}
}
};
};
for (var l in i.open(t.method || "get", e, !0), i.onload = function() {
i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(e, t, n) {
a.push(t = t.toLowerCase()), o.push([t, n]), s[t] = s[t] ? s[t] + "," + n : n;
}), n(c());
}, i.onerror = r, i.withCredentials = t.credentials == "include", t.headers) i.setRequestHeader(l, t.headers[l]);
i.send(t.body || null);
});
}
n.r(t), n.d(t, { default: () => r });
}
}, t = {};
function n(r) {
var i = t[r];
if (i !== void 0) return i.exports;
var a = t[r] = { exports: {} };
return e[r].call(a.exports, a, a.exports, n), a.exports;
}
return n.d = (e, t) => {
for (var r in t) n.o(t, r) && !n.o(e, r) && Object.defineProperty(e, r, {
enumerable: !0,
get: t[r]
});
}, n.g = function() {
if (typeof globalThis == "object") return globalThis;
try {
return this || Function("return this")();
} catch {
if (typeof window == "object") return window;
}
}(), n.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t), n.r = (e) => {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
}, n(8156);
})());
})), R = Ct();
function z(e) {
return e.getServices().find((e) => e.getProfile && R.Utils.isImageProfile(e.getProfile() || "") || R.Utils.isImageServiceType(e.getIIIFResourceType() || ""));
}
//#endregion
//#region src/lib/MiradorCanvas.js
var B = /* @__PURE__ */ h((/* @__PURE__ */ T(((e, t) => {
var n = bt(), r = 1 / 0;
function i(e) {
return e != null && e.length ? n(e, r) : [];
}
t.exports = i;
})))(), 1), wt = class {
constructor(e) {
this.canvas = e;
}
get id() {
return this.canvas.id;
}
getWidth() {
return this.canvas.getWidth();
}
getHeight() {
return this.canvas.getHeight();
}
get aspectRatio() {
return this.canvas.getWidth() / this.canvas.getHeight();
}
get annotationListUris() {
return (0, L.default)(Array(this.canvas.__jsonld.otherContent)).filter((e) => e && (typeof e == "string" || e["@type"] === "sc:AnnotationList")).map((e) => typeof e == "string" ? e : e["@id"]);
}
get canvasAnnotationPages() {
return (0, L.default)(Array(this.canvas.__jsonld.annotations)).filter((e) => e && e.type === "AnnotationPage");
}
get imageResource() {
return this.imageResources[0];
}
get imageResources() {
let e = (0, B.default)([this.canvas.getImages().map((e) => e.getResource()), this.canvas.getContent().map((e) => e.__jsonld.body.type === "Choice" ? e.__jsonld.body : e.getBody())]);
return (0, L.default)(e.map((e) => {
switch (e.type || e.getProperty("type")) {
case "Choice": return new R.Canvas({ images: e.items.map((e) => ({ resource: e })) }, this.canvas.options).getImages().map((e, t) => {
let n = e.getResource();
return n && (n.preferred = !t), n;
});
case "oa:Choice": return new R.Canvas({ images: (0, B.default)([e.getProperty("default"), e.getProperty("item")]).map((e) => ({ resource: e })) }, this.canvas.options).getImages().map((e, t) => {
let n = e.getResource();
return n && (n.preferred = !t), n;
});
default: {
let t = e;
return t.preferred = !0, t;
}
}
}));
}
get textResources() {
let e = (0, B.default)([this.canvas.getContent().map((e) => e.getBody())]);
return (0, L.default)(e.filter((e) => e.getProperty("type") === "Text"));
}
get videoResources() {
let e = (0, B.default)([this.canvas.getContent().map((e) => e.getBody())]);
return (0, L.default)(e.filter((e) => e.getProperty("type") === "Video"));
}
get audioResources() {
let e = (0, B.default)([this.canvas.getContent().map((e) => e.getBody())]);
return (0, L.default)(e.filter((e) => e.getProperty("type") === "Sound"));
}
get v2VttContent() {
let e = (0, B.default)([this.canvas.getContent().map((e) => e.getBody())]);
return (0, L.default)(e.filter((e) => e.getProperty("format") === "text/vtt"));
}
get v3VttContent() {
let e = (0, B.default)(this.canvasAnnotationPages.map((e) => new R.AnnotationPage(e, this.canvas.options).getItems().map((e) => new R.Annotation(e, this.canvas.options).getBody())));
return (0, L.default)(e.filter((e) => e.getProperty("format") === "text/vtt"));
}
get resourceAnnotations() {
return (0, B.default)([this.canvas.getImages(), this.canvas.getContent()]);
}
resourceAnnotation(e) {
return this.resourceAnnotations.find((t) => t.getResource().id === e || (0, L.default)(Array(t.getBody())).some((t) => t.id === e));
}
onFragment(e) {
let t = this.resourceAnnotation(e);
if (!t) return;
let n = t.getProperty("on"), r = t.getProperty("target"), i = (n || r).match(/xywh=(.*)$/);
if (i) return i[1].split(",").map((e) => parseInt(e, 10));
}
get iiifImageResources() {
return this.imageResources.filter((e) => e && z(e)?.id);
}
get imageServiceIds() {
return this.iiifImageResources.map((e) => e && z(e)?.id);
}
get service() {
return this.canvas.__jsonld.service;
}
getLabel(e = void 0) {
return this.canvas.getLabel().length > 0 ? this.canvas.getLabel().getValue(e) : String(this.canvas.index + 1);
}
}, Tt = class {
constructor(e) {
this.manifest = e;
}
get startCanvas() {
let e, t = this.manifest.getSequences()[0];
if (t) {
if (e = t.getProperty("startCanvas"), !e) {
let n = this.manifest.getProperty("start") || t.getProperty("start");
e = n && (n.id || n.source);
}
return e && t.getCanvasById(e) || void 0;
}
}
canvasAt(e) {
let t = this.manifest.getSequences()[0], n = t && t.getCanvases();
return n && n[e];
}
}, V = _([], (e, t) => (e) => e && new wt(e)), Et = _([], (e) => (e) => e && new Tt(e));
//#endregion
//#region src/lib/asArray.js
function H(e) {
return e === void 0 ? [] : Array.isArray(e) ? e : [e];
}
//#endregion
//#region node_modules/lodash/_arrayAggregator.js
var Dt = /* @__PURE__ */ T(((e, t) => {
function n(e, t, n, r) {
for (var i = -1, a = e == null ? 0 : e.length; ++i < a;) {
var o = e[i];
t(r, o, n(o), e);
}
return r;
}
t.exports = n;
})), Ot = /* @__PURE__ */ T(((e, t) => {
var n = Pe();
function r(e, t, r, i) {
return n(e, function(e, n, a) {
t(i, e, r(e), a);
}), i;
}
t.exports = r;
})), kt = /* @__PURE__ */ T(((e, t) => {
var n = Dt(), r = Ot(), i = vt(), a = S();
function o(e, t) {
return function(o, s) {
var c = a(o) ? n : r, l = t ? t() : {};
return c(o, e, i(s, 2), l);
};
}
t.exports = o;
})), At = /* @__PURE__ */ h((/* @__PURE__ */ T(((e, t) => {
var n = Ee(), r = kt(), i = Object.prototype.hasOwnProperty;
t.exports = r(function(e, t, r) {
i.call(e, r) ? e[r].push(t) : n(e, r, [t]);
});
})))(), 1);
function U(e) {
return m(e).companionWindows || p;
}
var jt = _([U, (e, { companionWindowId: t }) => t], (e, t) => t && e[t]), Mt = _([jt], (e) => e && e.locale), Nt = _([d, U], (e, t) => e && t[e.thumbnailNavigationId] && t[e.thumbnailNavigationId].position), Pt = _([f, U], (e, t) => (Object.keys(e) || []).reduce((n, r) => ({
...n,
[r]: (0, At.default)(e[r].companionWindowIds, (e) => t[e] && t[e].position)
}), {})), Ft = _([f, U], (e, t) => (Object.keys(e) || []).reduce((n, r) => ({
...n,
[r]: (0, At.default)(e[r].companionWindowIds.map((e) => t[e]), (e) => e.position)
}), {})), It = _([(e, { windowId: t }) => t, Ft], (e, t) => t[e] || p), Lt = _([(e, { windowId: t }) => t, Pt], (e, t) => t[e] || p), Rt = _([It, (e, { position: t }) => t], (e, t) => e[t] || w), zt = _([It, (e, { content: t }) => t], (e, t) => [].concat(...Object.values(e)).filter((e) => e.content === t)), Bt = _([Lt, (e, { position: t }) => t], (e, t) => e[t] || w), Vt = _([(e, { position: t }) => t, d], (e, t) => {
if (!t) return !1;
let { companionAreaOpen: n, sideBarOpen: r } = t;
return e !== "left" || !!(n && r);
}), Ht = _([It], (e) => {
let t = 0, n = 0;
return [].concat(...Object.values(e)).forEach((e) => {
e.position.match(/right/) && (t += 235), e.position.match(/bottom/) && (n += 201);
}), {
height: n,
width: t
};
}), Ut = /* @__PURE__ */ T(((e, t) => {
var n = function(e) {
return r(e) && !i(e);
};
function r(e) {
return !!e && typeof e == "object";
}
function i(e) {
var t = Object.prototype.toString.call(e);
return t === "[object RegExp]" || t === "[object Date]" || o(e);
}
var a = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.element") : 60103;
function o(e) {
return e.$$typeof === a;
}
function s(e) {
return Array.isArray(e) ? [] : {};
}
function c(e, t) {
return t.clone !== !1 && t.isMergeableObject(e) ? g(s(e), e, t) : e;
}
function l(e, t, n) {
return e.concat(t).map(function(e) {
return c(e, n);
});
}
function u(e, t) {
if (!t.customMerge) return g;
var n = t.customMerge(e);
return typeof n == "function" ? n : g;
}
function d(e) {
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
return Object.propertyIsEnumerable.call(e, t);
}) : [];
}
function f(e) {
return Object.keys(e).concat(d(e));
}
function p(e, t) {
try {
return t in e;
} catch {
return !1;
}
}
function m(e, t) {
return p(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
}
function h(e, t, n) {
var r = {};
return n.isMergeableObject(e) && f(e).forEach(function(t) {
r[t] = c(e[t], n);
}), f(t).forEach(function(i) {
m(e, i) || (r[i] = p(e, i) && n.isMergeableObject(t[i]) ? u(i, n)(e[i], t[i], n) : c(t[i], n));
}), r;
}
function g(e, t, r) {
r ||= {}, r.arrayMerge = r.arrayMerge || l, r.isMergeableObject = r.isMergeableObject || n, r.cloneUnlessOtherwiseSpecified = c;
var i = Array.isArray(t);
return i === Array.isArray(e) ? i ? r.arrayMerge(e, t, r) : h(e, t, r) : c(t, r);
}
g.all = function(e, t) {
if (!Array.isArray(e)) throw Error("first argument should be an array");
return e.reduce(function(e, n) {
return g(e, n, t);
}, {});
}, t.exports = g;
})), Wt = /* @__PURE__ */ h(Ut(), 1);
function W(e) {
return m(e || {}).config || p;
}
function Gt(e) {
let t = W(e).export;
return Object.entries(t).reduce((t, [n, r]) => (r === !0 ? t[n] = e[n] : r.filter && (t[n] = Object.entries(e[n]).filter(r.filter).reduce((e, [t, n]) => (e[t] = n, e), {})), t), {});
}
var Kt = _([W], ({ availableLanguages: e, language: t }) => Object.keys(e).map((n) => ({
current: n === t,
label: e[n],
locale: n
}))), qt = _([g, W], (e, t) => e.showZoomControls === void 0 ? t.workspace.showZoomControls : e.showZoomControls), Jt = _([W], ({ theme: e, themes: t, selectedTheme: n }) => (0, Wt.default)(e, t[n] || {})), Yt = _([W], ({ themes: e }) => Object.keys(e)), Xt = _([W], ({ id: e }) => e), Zt = _([W], ({ theme: e }) => e.direction || "ltr"), Qt = _([W], ({ requests: e }) => e || p), $t = _([W], ({ thumbnails: e }) => e || p);
//#endregion
//#region src/lib/ThumbnailFactory.js
function en(e) {
let t = e.getProfile();
return t.endsWith("#level1") || t.endsWith("#level2") ? !1 : t === "level0" || R.Utils.isLevel0ImageProfile(t);
}
function tn(e) {
let t = e.getProfile();
return t.endsWith("#level0") || t.endsWith("#level1") ? !1 : t === "level2" || R.Utils.isLevel2ImageProfile(t);
}
function nn(e) {
return H(e.getProperty("type") || []).some((e) => e.startsWith("ImageService"));
}
function rn(e) {
let t = e && e.getServices().find((e) => nn(e) || R.Utils.isImageProfile(e.getProfile()));
if (t) return t;
}
var an = class e {
constructor(e = {}, { getMiradorCanvas: t, getMiradorManifest: n }) {
this.iiifOpts = e, this.getMiradorCanvas = t, this.getMiradorManifest = n;
}
static staticImageUrl(e) {
return {
height: e.getProperty("height"),
url: e.id,
width: e.getProperty("width")
};
}
static getPreferredImage(e) {
return e.iiifImageResources[0] || e.imageResource;
}
static selectBestImageSize(e, t) {
let n = H(e.getProperty("sizes")), r = {
default: !0,
height: e.getProperty("height") || 2 ** 53 - 1,
width: e.getProperty("width") || 2 ** 53 - 1
}, i = (e) => e.width * e.height - t;
if (r = n.reduce((e, t) => {
let n = i(t);
return n < 0 ? e : Math.abs(n) < Math.abs(i(e)) ? t : e;
}, r), r.width * r.height > t * 6 && (r = n.reduce((e, t) => Math.abs(i(t)) < Math.abs(i(e)) ? t : e, r)), !r.default) return r;
}
iiifThumbnailUrl(t) {
let n, r, i, a = 120, o = 120, { maxHeight: s, maxWidth: c } = this.iiifOpts;
s && (a = Math.max(s, 120)), c && (o = Math.max(c, 120));
let l = rn(t);
if (!l) return e.staticImageUrl(t);
let u = t.getWidth() && t.getHeight() && t.getWidth() / t.getHeight(), d = c && s ? c * s : a * o, f = e.selectBestImageSize(l, d);
if (f) r = f.width, i = f.height, n = `${r},${i}`;
else if (en(l)) {
if (!l.getProperty("height") && !l.getProperty("width")) return e.staticImageUrl(t);
} else s && c ? tn(l) ? (n = `!${o},${a}`, r = o, i = a, u && u > 1 && (i = Math.round(o / u)), u && u < 1 && (r = Math.round(a * u))) : o / a < u ? (n = `${o},`, r = o, u && (i = Math.round(o / u))) : (n = `,${a}`, i = a, u && (r = Math.round(a * u))) : s && !c ? (n = `,${a}`, i = a, u && (r = Math.round(a * u))) : !s && c ? (n = `${o},`, r = o, u && (i = Math.round(o / u))) : (n = ",120", i = 120, u && (r = Math.round(i * u)));
let p = R.Utils.getImageQuality(l.getProfile()), m = l.id.replace(/\/+$/, ""), h = this.getFormat(l);
return {
height: i,
url: [
m,
"full",
n,
0,
`${p}.${h}`
].join("/"),
width: r
};
}
getFormat(e) {
let { preferredFormats: t = [] } = this.iiifOpts, n = e.getProperty("preferredFormats");
if (!n) return "jpg";
let r = n.filter((e) => t.includes(e));
return r[0] ? r[0] : !n.includes("jpg") && t.includes("jpg") ? "jpg" : n[0] ? n[0] : "jpg";
}
getSourceContentResource(t) {
let n = t.getThumbnail();
if (n) return typeof n.__jsonld == "string" ? n.__jsonld : !t.isCollection() && !t.isManifest() && !t.isCanvas() && t.getType() === "image" && rn(t) && !rn(n) ? t : n;
if (t.isCollection()) {
let e = t.getManifests()[0];
return e ? this.getSourceContentResource(e) : void 0;
}
if (t.isManifest()) {
let e = this.getMiradorManifest(t), n = e.startCanvas || e.canvasAt(0);
return n ? this.getSourceContentResource(n) : void 0;
}
if (t.isCanvas()) {
let n = e.getPreferredImage(this.getMiradorCanvas(t));
return n ? this.getSourceContentResource(n) : void 0;
}
if (t.getType() === "image") return t;
}
get(e) {
if (!e) return;
let t = this.getSourceContentResource(e);
if (t) return typeof t == "string" ? { url: t } : this.iiifThumbnailUrl(t);
}
};
function on(e, t = {}) {
return new an(t, {
getMiradorCanvas: (e) => new wt(e),
getMiradorManifest: (e) => new Tt(e)
}).get(e);
}
//#endregion
//#region src/state/selectors/thumbnails.js
var sn = _([
$t,
(e, t, n) => t,
(e, t, n) => n
], (e, t, n) => ({
maxHeight: t,
maxWidth: n,
preferredFormats: e.preferredFormats
})), cn = _([
sn,
V,
Et
], (e, t, n) => new an(e, {
getMiradorCanvas: t,
getMiradorManifest: n
}));
//#endregion
//#region src/state/selectors/manifests.js
function ln(e, t) {
if (!e) return;
let n = R.Utils.parseManifest(structuredClone(e), t ? { locale: t } : void 0);
if (n) return typeof n.getSequences != "function" && (n.getSequences = () => []), n;
}
var un = _([
Mt,
W,
(e, { locale: t }) => t
], (e, t = {}, n) => n || e || t.language || t.fallbackLanguages), dn = Object.freeze({ missing: !0 }), fn = _([v], (e) => e || dn), pn = _([v], (e) => e && e.error), mn = _(v, (e) => e && ln(e.json)), G = _(mn, (e, { json: t }) => t, (e, t) => t && ln(t) || e), K = _([G, un], (e, t) => t ?? (e && e.options && e.options.locale && e.options.locale.replace(/-.*$/, "")));
function q(e) {
return _([G], (t) => t && t.getProperty(e));
}
var hn = _([q("provider"), K], (e, t) => e && e[0].label && R.PropertyValue.parse(e[0].label).getValue(t)), gn = Object.freeze({}), _n = _([q("provider"), (e) => cn(e, gn)], (e, t) => {
let n = e && e[0] && e[0].logo && e[0].logo[0];
return n ? t.get(new R.Resource(n))?.url : null;
}), vn = _([G, _n], (e, t) => t || e && e.getLogo()), yn = _([q("homepage"), K], (e, t) => e && H(e).map((e) => ({
label: R.PropertyValue.parse(e.label).getValue(t),
value: e.id || e["@id"]
}))), bn = _([G, K], (e, t) => e && e.getRenderings().map((e) => ({
label: e.getLabel().getValue(t),
value: e.id
}))), xn = _([q("seeAlso"), K], (e, t) => e && H(e).map((e) => ({
format: e.format,
label: R.PropertyValue.parse(e.label).getValue(t),
value: e.id || e["@id"]
}))), Sn = xn, Cn = _([q("related"), K], (e, t) => e && H(e).map((e) => typeof e == "string" ? { value: e } : {
format: e.format,
label: R.PropertyValue.parse(e.label).getValue(t),
value: e.id || e["@id"]
})), wn = _([G], (e) => e && H(e.getRequiredStatement()).flatMap((e) => {
let t = e?.getValues() ?? [];
if (!t.length) return [];
let n = e?.getLabels() ?? [];
return Array.from({ length: Math.max(n.length, t.length) }, (e, t) => t).filter((e) => t[e]).map((e) => ({
label: n[e] ?? null,
values: [t[e]]
}));
})), Tn = _([
q("rights"),
q("license"),
K
], (e, t, n) => {
let r = e || t;
return H(R.PropertyValue.parse(r).getValues(n));
});
function En(e, t) {
let n = G(e, t), r = cn(e, 80, 120);
if (!n) return;
let i = r.get(n);
return i && i.url;
}
var Dn = _([G, K], (e, t) => e && e.getLabel().getValue(t)), On = _([un, G], (e, t) => t && t.getDescription().getValue(e)), kn = _([q("summary"), K], (e, t) => e && R.PropertyValue.parse(e).getValue(t)), An = _([G], (e) => e && e.id);
function jn(e, t = void 0) {
return e && e.getMetadata().map((e) => ({
label: e.getLabel(t),
values: e.getValues(t)
}));
}
var Mn = _([G, K], (e, t) => e && jn(e, t));
function Nn(e) {
let t = /* @__PURE__ */ new Set([]), n = (e) => {
if (e && typeof e == "object") {
if (e["@language"] && e["@value"]) {
t.add(e["@language"]);
return;
}
Object.keys(e).forEach((e) => {
t.add(e);
});
}
};
return Array.isArray(e) ? e.forEach((e) => n(e)) : n(e), [...t];
}
function Pn(e) {
if (!e) return [];
let t = e.getProperty("metadata") || [], n = {};
for (let e = 0; e < t.length; e += 1) {
let r = t[e];
Nn(r.label).forEach((e) => {
n[e] = !0;
}), Nn(r.value).forEach((e) => {
n[e] = !0;
});
}
return Object.keys(n);
}
var Fn = _([G], (e) => Pn(e)), In = _([G], (e) => e && (e.getService("http://iiif.io/api/search/0/search") || e.getService("http://iiif.io/api/search/1/search")) || null), Ln = _([In], (e) => {
let t = e && (e.getService("http://iiif.io/api/search/0/autocomplete") || e.getService("http://iiif.io/api/search/1/autocomplete"));
return t && t;
}), Rn = _([G], (e) => {
if (!e || !e.getTopRanges) return null;
let t = e.getTopRanges(), n = t.filter((e) => e.getProperty("viewingHint") === "top"), r = [];
return n.length === 0 && t.length === 1 && (r = t[0].getRanges().filter((e) => e.getBehavior() === "sequence")), [].concat(e.getSequences(), r);
}), J = _([
Rn,
d,
(e, { sequenceId: t }) => t
], (e, t, n) => {
if (!e) return null;
if (n || t && t.sequenceId) {
let r = e.find((e) => e.id === (n || t.sequenceId));
if (r) return r;
}
return e[0];
}), zn = _([d, J], (e, t) => (t && e && e.canvasId && t.getCanvasById(e.canvasId) || {}).index || 0), Y = _([J, G], (e, t) => t && (e && e.getViewingHint() || t.getViewingHint()) || null), Bn = _([
d,
J,
G
], (e, t, n) => e && e.viewingDirection || t && t.getViewingDirection() || n && n.getViewingDirection() || null), Vn = _([J, G], (e, t) => {
if (!t || !e) return [];
let n = e && e.getProperty("behavior");
if (n) return Array.isArray(n) ? n : [n];
let r = t.getProperty("behavior");
return r ? Array.isArray(r) ? r : [r] : [];
}), Hn = _([J, G], (e, t) => e && e.getProperty("type") && e.isRange() ? e.getTree(new R.TreeNode("root")) : t && t.getDefaultTree());
//#endregion
//#region src/state/selectors/workspace.js
function Un(e) {
return m(e).elasticLayout;
}
var Wn = _([g], (e) => e.isFullscreenEnabled);
function Gn(e) {
let [t] = m(e).errors.items;
return m(e).errors[t];
}
var Kn = _([g], ({ type: e }) => e), qn = _([g], ({ focusedWindowId: e }) => e), Jn = (e, { windowId: t }) => qn(e) === t, Yn = _([W, d], ({ window: e }, t = {}) => ({
...e,
...t
}));
function Xn(e) {
let t = {};
return Object.keys(f(e)).forEach((n) => {
t[n] = Dn(e, { windowId: n });
}), t;
}
var Zn = _([f], (e) => Object.values(e).filter((e) => e.maximized === !0).map((e) => e.id)), Qn = _([
d,
Yn,
Y,
Vn
], (e, { views: t = [], defaultView: n }, r, i) => {
if (e && e.view) return e.view;
let a = (t || []).find((e) => e.behaviors && e.behaviors.some((e) => r === e || i.includes(e)));
return a && a.key || n;
}), $n = _([
Y,
Vn,
Yn
], (e, t, { views: n = [], defaultView: r }) => (n || []).reduce((n, i) => ((i.key === r || !i.behaviors || i.behaviors.some((n) => e === n || t.includes(n))) && n.push(i.key), n), [])), er = _([
Kn,
d,
(e) => b(e).length > 1
], (e, t, n) => e === "elastic" || n && t && t.maximized === !1), tr = (e) => m(e).infoResponses, nr = _([J], (e) => e && e.getCanvases() || w), X = _([J, (e, { canvasId: t }) => t], (e, t) => {
if (!(!e || !t)) return e.getCanvasById(t);
}), Z = _([J, d], (e, t) => {
if (!(!e || !t)) return t.canvasId ? e.getCanvasById(t.canvasId) : e.getCanvasByIndex(0);
}), rr = _([d], (e) => e && (e.visibleCanvases || e.canvasId && [e.canvasId]) || w), Q = _([rr, nr], (e, t) => (t || []).filter((t) => e.includes(t.id))), $ = _([nr, Qn], (e, t) => e && new St(e, t).groupings()), ir = _([$, (e, { canvasId: t }) => t], (e, t) => e && e.find((e) => e.some((e) => e.id === t)) || w), ar = _([$, Z], (e, t, n) => {
if (!e || !t) return;
let r = e.findIndex((e) => e.some((e) => e.id === t.id));
if (!(r < 0 || r + 1 >= e.length)) return e[r + 1];
}), or = _([$, Z], (e, t, n) => {
if (!e || !t) return;
let r = e.findIndex((e) => e.some((e) => e.id === t.id));
if (!(r < 1)) return e[r - 1];
}), sr = _([X, K], (e, t) => e && (e.getLabel().length > 0 ? e.getLabel().getValue(t) : String(e.index + 1))), cr = _([X, K], (e, t) => e && jn(e, t)), lr = _([X], (e) => e && e.getProperty("description")), ur = _([Q, V], (e, t) => (0, L.default)(e.map((e) => t(e).imageResources)).filter((e) => !z(e))), dr = _([Q, V], (e, t) => (0, L.default)(e.map((e) => t(e).textResources))), fr = _([Q, V], (e, t) => (0, L.default)(e.map((e) => t(e).videoResources))), pr = _([Q, V], (e, t) => (0, L.default)(e.map((e) => {
let n = t(e);
return n.v3VttContent.length ? n.v3VttContent : n.v2VttContent;
}))), mr = _([Q, V], (e, t) => (0, L.default)(e.map((e) => t(e).audioResources))), hr = _([
(e, { infoId: t }) => t,
X,
V,
tr
], (e, t, n, r) => {
let i = e;
if (!e) {
if (!t) return;
let e = n(t).iiifImageResources[0];
i = e && z(e)?.id;
}
return i && r[i] && !r[i].isFetching && r[i];
});
//#endregion
export { xn as $, qe as $t, Kn as A, zt as At, un as B, z as Bt, er as C, $t as Ct, qn as D, Bt as Dt, Un as E, jt as Et, Hn as F, H as Ft, K as G, vt as Gt, On as H, St as Ht, Bn as I, V as It, hn as J, et as Jt, vn as K, it as Kt, Y as L, Et as Lt, zn as M, Nt as Mt, J as N, Ht as Nt, Wn as O, Mt as Ot, Vn as P, kt as Pt, In as Q, Ye as Qt, Rn as R, Tt as Rt, Yn as S, Yt as St, Qn as T, Vt as Tt, pn as U, xt as Ut, Ln as V, Ct as Vt, yn as W, bt as Wt, Sn as X, Qe as Xt, Cn as Y, $e as Yt, bn as Z, Ze as Zt, Q as _, Kt as _t, sr as a, je as an, G as at, $n as b, Jt as bt, Z as c, Te as cn, wn as ct, mr as d, we as dn, cn as dt, Ge as en, fn as et, pr as f, Se as fn, an as ft, fr as g, Gt as gt, dr as h, Xt as ht, $ as i, I as in, An as it, Jn as j, Rt as jt, Gn as k, U as kt, ar as l, F as ln, Tn as lt, ur as m, se as mn, W as mt, lr as n, Be as nn, En as nt, cr as o, De as on, Fn as ot, rr as p, xe as pn, on as pt, Mn as q, tt as qt, ir as r, Pe as rn, Dn as rt, nr as s, Ee as sn, _n as st, X as t, Ue as tn, kn as tt, or as u, P as un, sn as ut, hr as v, Qt as vt, Xn as w, Ut as wt, Zn as x, Zt as xt, tr as y, qt as yt, jn as z, wt as zt };
//# sourceMappingURL=canvases-CeUwRIFA.js.map