react-iiif-vault 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  import { jsx as x, jsxs as N, Fragment as Me } from "react/jsx-runtime";
2
2
  import * as at from "react";
3
- import me, { useContext as H, useMemo as E, useState as B, useEffect as K, useCallback as D, createContext as ce, useRef as ge, useLayoutEffect as hr, Fragment as Ke, useReducer as an, forwardRef as yr, useImperativeHandle as cn } from "react";
3
+ import me, { useContext as H, useMemo as E, useState as B, useEffect as K, useCallback as D, createContext as ce, useRef as ge, useLayoutEffect as yr, Fragment as Ke, useReducer as an, forwardRef as vr, useImperativeHandle as cn } from "react";
4
4
  import { AtlasAuto as un, ModeContext as ln, mergeStyles as fn, RegionHighlight as pn, TileSet as dn, HTMLPortal as hn } from "@atlas-viewer/atlas";
5
- import { serialize as yn, serializeConfigPresentation2 as vn, serializeConfigPresentation3 as gn, isSpecificResource as mn, HAS_PART as Ze, PART_OF as Xe, frameResource as vr, normalize as bn } from "@iiif/parser";
6
- import { ImageServiceLoader as gr, getImageServices as mt, getFixedSizeFromImage as Yt } from "@atlas-viewer/iiif-image-api";
5
+ import { serialize as yn, serializeConfigPresentation2 as vn, serializeConfigPresentation3 as gn, isSpecificResource as mn, HAS_PART as Ze, PART_OF as Xe, frameResource as gr, normalize as bn } from "@iiif/parser";
6
+ import { ImageServiceLoader as mr, getImageServices as mt, getFixedSizeFromImage as Gt } from "@atlas-viewer/iiif-image-api";
7
7
  function bt(e, t) {
8
8
  return bt = Object.setPrototypeOf || function(i, n) {
9
9
  return i.__proto__ = n, i;
@@ -16,17 +16,17 @@ var xn = function(t, r) {
16
16
  return t === void 0 && (t = []), r === void 0 && (r = []), t.length !== r.length || t.some(function(i, n) {
17
17
  return !Object.is(i, r[n]);
18
18
  });
19
- }, Gt = {
19
+ }, Jt = {
20
20
  error: null
21
21
  }, wn = /* @__PURE__ */ function(e) {
22
22
  An(t, e);
23
23
  function t() {
24
24
  for (var i, n = arguments.length, s = new Array(n), o = 0; o < n; o++)
25
25
  s[o] = arguments[o];
26
- return i = e.call.apply(e, [this].concat(s)) || this, i.state = Gt, i.resetErrorBoundary = function() {
27
- for (var a, u = arguments.length, d = new Array(u), l = 0; l < u; l++)
28
- d[l] = arguments[l];
29
- i.props.onReset == null || (a = i.props).onReset.apply(a, d), i.reset();
26
+ return i = e.call.apply(e, [this].concat(s)) || this, i.state = Jt, i.resetErrorBoundary = function() {
27
+ for (var a, u = arguments.length, f = new Array(u), l = 0; l < u; l++)
28
+ f[l] = arguments[l];
29
+ i.props.onReset == null || (a = i.props).onReset.apply(a, f), i.reset();
30
30
  }, i;
31
31
  }
32
32
  t.getDerivedStateFromError = function(n) {
@@ -36,29 +36,29 @@ var xn = function(t, r) {
36
36
  };
37
37
  var r = t.prototype;
38
38
  return r.reset = function() {
39
- this.setState(Gt);
39
+ this.setState(Jt);
40
40
  }, r.componentDidCatch = function(n, s) {
41
41
  var o, a;
42
42
  (o = (a = this.props).onError) == null || o.call(a, n, s);
43
43
  }, r.componentDidUpdate = function(n, s) {
44
44
  var o = this.state.error, a = this.props.resetKeys;
45
45
  if (o !== null && s.error !== null && xn(n.resetKeys, a)) {
46
- var u, d;
47
- (u = (d = this.props).onResetKeysChange) == null || u.call(d, n.resetKeys, a), this.reset();
46
+ var u, f;
47
+ (u = (f = this.props).onResetKeysChange) == null || u.call(f, n.resetKeys, a), this.reset();
48
48
  }
49
49
  }, r.render = function() {
50
50
  var n = this.state.error, s = this.props, o = s.fallbackRender, a = s.FallbackComponent, u = s.fallback;
51
51
  if (n !== null) {
52
- var d = {
52
+ var f = {
53
53
  error: n,
54
54
  resetErrorBoundary: this.resetErrorBoundary
55
55
  };
56
56
  if (/* @__PURE__ */ at.isValidElement(u))
57
57
  return u;
58
58
  if (typeof o == "function")
59
- return o(d);
59
+ return o(f);
60
60
  if (a)
61
- return /* @__PURE__ */ at.createElement(a, d);
61
+ return /* @__PURE__ */ at.createElement(a, f);
62
62
  throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
63
63
  }
64
64
  return this.props.children;
@@ -71,13 +71,13 @@ const Sn = {
71
71
  canvas: void 0,
72
72
  annotation: void 0,
73
73
  annotationPage: void 0
74
- }, Et = me.createContext(Sn), be = () => H(Et);
74
+ }, Pt = me.createContext(Sn), be = () => H(Pt);
75
75
  function Te({ value: e, children: t }) {
76
76
  const r = be(), i = E(() => ({
77
77
  ...r,
78
78
  ...e
79
79
  }), [e, r]);
80
- return /* @__PURE__ */ x(Et.Provider, { value: i, children: t });
80
+ return /* @__PURE__ */ x(Pt.Provider, { value: i, children: t });
81
81
  }
82
82
  var Cn = Object.defineProperty, Mn = (e, t, r) => t in e ? Cn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ve = (e, t, r) => (Mn(e, typeof t != "symbol" ? t + "" : t, r), r);
83
83
  const q = function(e) {
@@ -89,8 +89,8 @@ const q = function(e) {
89
89
  ...i !== void 0 && { meta: i }
90
90
  });
91
91
  };
92
- }, mr = "@iiif/IMPORT_ENTITIES", br = "@iiif/MODIFY_ENTITY_FIELD", Ar = "@iiif/REORDER_ENTITY_FIELD", xr = "@iiif/ADD_REFERENCE", At = "@iiif/UPDATE_REFERENCE", wr = "@iiif/REMOVE_REFERENCE", Sr = "@iiif/ADD_METADATA", Cr = "@iiif/REMOVE_METADATA", xt = "@iiif/UPDATE_METADATA", Mr = "@iiif/REORDER_METADATA", Rr = q(mr)(), Rn = q(br)(), In = q(Ar)(), Tn = q(xr)(), kn = q(wr)(), On = q(At)(), En = q(Sr)(), Pn = q(xt)(), Ln = q(Cr)(), Fn = q(Mr)(), jn = {
93
- importEntities: Rr,
92
+ }, br = "@iiif/IMPORT_ENTITIES", Ar = "@iiif/MODIFY_ENTITY_FIELD", xr = "@iiif/REORDER_ENTITY_FIELD", wr = "@iiif/ADD_REFERENCE", At = "@iiif/UPDATE_REFERENCE", Sr = "@iiif/REMOVE_REFERENCE", Cr = "@iiif/ADD_METADATA", Mr = "@iiif/REMOVE_METADATA", xt = "@iiif/UPDATE_METADATA", Rr = "@iiif/REORDER_METADATA", Ir = q(br)(), Rn = q(Ar)(), In = q(xr)(), Tn = q(wr)(), kn = q(Sr)(), On = q(At)(), En = q(Cr)(), Pn = q(xt)(), Ln = q(Mr)(), Fn = q(Rr)(), jn = {
93
+ importEntities: Ir,
94
94
  modifyEntityField: Rn,
95
95
  reorderEntityField: In,
96
96
  addReference: Tn,
@@ -100,23 +100,23 @@ const q = function(e) {
100
100
  removeMetadata: Ln,
101
101
  updateMetadata: Pn,
102
102
  reorderMetadata: Fn
103
- }, Ir = "@iiif/ADD_MAPPING", Tr = "@iiif/ADD_MAPPINGS", $n = q(Ir)(), Dn = q(Tr)(), kr = "@iiif/SET_META_VALUE", Or = "@iiif/SET_META_VALUE_DYNAMIC", Er = "@iiif/UNSET_META_VALUE", qn = q(kr)(), _n = q(Or)(), Un = q(Er)(), Jt = {
103
+ }, Tr = "@iiif/ADD_MAPPING", kr = "@iiif/ADD_MAPPINGS", $n = q(Tr)(), Dn = q(kr)(), Or = "@iiif/SET_META_VALUE", Er = "@iiif/SET_META_VALUE_DYNAMIC", Pr = "@iiif/UNSET_META_VALUE", qn = q(Or)(), _n = q(Er)(), Un = q(Pr)(), Kt = {
104
104
  setMetaValue: qn,
105
105
  setMetaValueDynamic: _n,
106
106
  unsetMetaValue: Un
107
- }, wt = "RESOURCE_ERROR", Pr = "RESOURCE_LOADING", St = "RESOURCE_READY", Lr = "@iiif/REQUEST_RESOURCE", Fr = "@iiif/REQUEST_ERROR", jr = "@iiif/REQUEST_MISMATCH", $r = "@iiif/REQUEST_COMPLETE", Vn = "@iiif/REQUEST_OFFLINE_RESOURCE", Nn = q(Lr)(), Dr = q(Fr)(), Hn = q(jr)(), Bn = q($r)(), Pt = "@iiif/BATCH", zn = "@iiif/BATCH_IMPORT", Ct = q(Pt)(), Wn = (e, t) => {
107
+ }, wt = "RESOURCE_ERROR", Lr = "RESOURCE_LOADING", St = "RESOURCE_READY", Fr = "@iiif/REQUEST_RESOURCE", jr = "@iiif/REQUEST_ERROR", $r = "@iiif/REQUEST_MISMATCH", Dr = "@iiif/REQUEST_COMPLETE", Vn = "@iiif/REQUEST_OFFLINE_RESOURCE", Nn = q(Fr)(), Ct = q(jr)(), Hn = q($r)(), Bn = q(Dr)(), Lt = "@iiif/BATCH", zn = "@iiif/BATCH_IMPORT", Mt = q(Lt)(), Wn = (e, t) => {
108
108
  const { entities: r, resource: i, mapping: n } = bn(t);
109
109
  if (i.id === void 0)
110
- return [Dr({ id: e, message: "ID is not defined in resource." })];
111
- const s = [Rr({ entities: r }), Dn({ mapping: n })];
110
+ return [Ct({ id: e, message: "ID is not defined in resource." })];
111
+ const s = [Ir({ entities: r }), Dn({ mapping: n })];
112
112
  return i.id !== e && (s.push($n({ id: e, type: i.type })), s.push(Hn({ requestId: e, actualId: i.id }))), s.push(Bn({ id: e })), s;
113
- }, Kt = Number.isNaN || function(e) {
113
+ }, Zt = Number.isNaN || function(e) {
114
114
  return typeof e == "number" && e !== e;
115
115
  };
116
116
  function Qn(e, t) {
117
- return !!(e === t || Kt(e) && Kt(t));
117
+ return !!(e === t || Zt(e) && Zt(t));
118
118
  }
119
- function Zt(e, t) {
119
+ function Xt(e, t) {
120
120
  if (!Array.isArray(e) || !Array.isArray(t))
121
121
  return e === t;
122
122
  if (e.length !== t.length)
@@ -133,63 +133,79 @@ function ct(e, t, r) {
133
133
  const s = e.iiif.entities[n][i.resourceUri];
134
134
  if (s && s[Ze]) {
135
135
  const o = s[Ze].find((a) => r ? a[Xe] === r.id : a[Xe] === s.id);
136
- return vr(s, o);
136
+ return gr(s, o);
137
137
  }
138
138
  return s;
139
139
  }
140
- function Xt(e, t, { waitTimeout: r = 30 } = {}) {
141
- return async (i, n) => {
140
+ function Yn(e) {
141
+ return e && typeof e.then == "function";
142
+ }
143
+ function er(e, t, { waitTimeout: r = 30 } = {}) {
144
+ return (i, n) => {
142
145
  const s = e.getStore(), o = s.getState(), a = o.iiif.requests[i];
143
- if (a)
146
+ if (a) {
147
+ if (a.loadingState === St) {
148
+ const f = ct(o, i);
149
+ if (f)
150
+ return f;
151
+ }
144
152
  switch (a.loadingState) {
145
153
  case wt:
146
154
  break;
147
- case Pr: {
148
- let u, d = !1;
149
- try {
150
- const l = await Promise.race([
151
- new Promise((p, v) => {
152
- d || (u = s.subscribe(() => {
153
- const m = s.getState();
154
- if (m.iiif.requests[i].loadingState === wt) {
155
- v();
156
- return;
157
- }
158
- if (m.iiif.requests[i].loadingState === St) {
159
- const h = ct(m, i);
160
- h ? p(h) : v();
161
- }
162
- }));
163
- }),
164
- new Promise(
165
- (p, v) => setTimeout(() => {
166
- d = !0, v();
167
- }, r * 60 * 1e3)
168
- )
169
- ]);
170
- if (u && u(), l)
171
- return l;
172
- } catch {
173
- u && u();
174
- break;
175
- }
176
- break;
177
- }
178
- case St: {
179
- const u = ct(o, i);
180
- if (u)
181
- return u;
182
- break;
183
- }
155
+ case Lr:
156
+ return (async () => {
157
+ let f, l = !1;
158
+ try {
159
+ const d = await Promise.race([
160
+ new Promise((v, m) => {
161
+ l || (f = s.subscribe(() => {
162
+ const h = s.getState();
163
+ if (h.iiif.requests[i].loadingState === wt) {
164
+ m();
165
+ return;
166
+ }
167
+ if (h.iiif.requests[i].loadingState === St) {
168
+ const g = ct(h, i);
169
+ g ? v(g) : m();
170
+ }
171
+ }));
172
+ }),
173
+ new Promise(
174
+ (v, m) => setTimeout(
175
+ () => {
176
+ l = !0, m();
177
+ },
178
+ r * 60 * 1e3
179
+ )
180
+ )
181
+ ]);
182
+ if (f && f(), d)
183
+ return d;
184
+ } catch {
185
+ f && f();
186
+ }
187
+ })();
184
188
  }
189
+ }
185
190
  e.dispatch(Nn({ id: i }));
191
+ const u = (f) => {
192
+ if (!f)
193
+ return;
194
+ !f.id && !f["@id"] && (f["@type"] && (f["@id"] = i), f.id = i);
195
+ const l = Wn(i, f);
196
+ return e.dispatch(Mt({ actions: l })), ct(s.getState(), i);
197
+ };
186
198
  try {
187
- const u = await t(i, n);
188
- !u.id && !u["@id"] && (u["@type"] && (u["@id"] = i), u.id = i);
189
- const d = Wn(i, u);
190
- return e.dispatch(Ct({ actions: d })), ct(s.getState(), i);
191
- } catch (u) {
192
- throw e.dispatch(Dr({ id: i, message: u.toString() })), u;
199
+ const f = t(i, n);
200
+ return Yn(f) ? (async () => {
201
+ try {
202
+ return u(await f);
203
+ } catch (l) {
204
+ throw e.dispatch(Ct({ id: i, message: l.toString() })), l;
205
+ }
206
+ })() : u(f);
207
+ } catch (f) {
208
+ throw e.dispatch(Ct({ id: i, message: f.toString() })), f;
193
209
  }
194
210
  };
195
211
  }
@@ -208,47 +224,47 @@ function qr() {
208
224
  Agent: {}
209
225
  };
210
226
  }
211
- const er = (e) => {
227
+ const tr = (e) => {
212
228
  let t;
213
229
  const r = /* @__PURE__ */ new Set(), i = (o, a) => {
214
230
  const u = typeof o == "function" ? o(t) : o;
215
231
  if (!Object.is(u, t)) {
216
- const d = t;
217
- t = a ?? typeof u != "object" ? u : Object.assign({}, t, u), r.forEach((l) => l(t, d));
232
+ const f = t;
233
+ t = a ?? typeof u != "object" ? u : Object.assign({}, t, u), r.forEach((l) => l(t, f));
218
234
  }
219
235
  }, n = () => t, s = { setState: i, getState: n, subscribe: (o) => (r.add(o), () => r.delete(o)), destroy: () => {
220
236
  r.clear();
221
237
  } };
222
238
  return t = e(i, n, s), s;
223
- }, Yn = (e) => e ? er(e) : er, Gn = (e, t) => (r, i, n) => (n.dispatch = (s) => (r((o) => e(o, s), !1, s), s), n.dispatchFromDevtools = !0, { dispatch: (...s) => n.dispatch(...s), ...t }), Jn = Gn, Mt = /* @__PURE__ */ new Map(), Ne = (e) => {
224
- const t = Mt.get(e);
239
+ }, Gn = (e) => e ? tr(e) : tr, Jn = (e, t) => (r, i, n) => (n.dispatch = (s) => (r((o) => e(o, s), !1, s), s), n.dispatchFromDevtools = !0, { dispatch: (...s) => n.dispatch(...s), ...t }), Kn = Jn, Rt = /* @__PURE__ */ new Map(), Ne = (e) => {
240
+ const t = Rt.get(e);
225
241
  return t ? Object.fromEntries(
226
242
  Object.entries(t.stores).map(([r, i]) => [r, i.getState()])
227
243
  ) : {};
228
- }, Kn = (e, t, r) => {
244
+ }, Zn = (e, t, r) => {
229
245
  if (e === void 0)
230
246
  return {
231
247
  type: "untracked",
232
248
  connection: t.connect(r)
233
249
  };
234
- const i = Mt.get(r.name);
250
+ const i = Rt.get(r.name);
235
251
  if (i)
236
252
  return { type: "tracked", store: e, ...i };
237
253
  const n = {
238
254
  connection: t.connect(r),
239
255
  stores: {}
240
256
  };
241
- return Mt.set(r.name, n), { type: "tracked", store: e, ...n };
242
- }, Zn = (e, t = {}) => (r, i, n) => {
257
+ return Rt.set(r.name, n), { type: "tracked", store: e, ...n };
258
+ }, Xn = (e, t = {}) => (r, i, n) => {
243
259
  const { enabled: s, anonymousActionType: o, store: a, ...u } = t;
244
- let d;
260
+ let f;
245
261
  try {
246
- d = (s ?? !1) && window.__REDUX_DEVTOOLS_EXTENSION__;
262
+ f = (s ?? !1) && window.__REDUX_DEVTOOLS_EXTENSION__;
247
263
  } catch {
248
264
  }
249
- if (!d)
265
+ if (!f)
250
266
  return e(r, i, n);
251
- const { connection: l, ...p } = Kn(a, d, u);
267
+ const { connection: l, ...d } = Zn(a, f, u);
252
268
  let v = !0;
253
269
  n.setState = (g, b, A) => {
254
270
  const w = r(g, b);
@@ -270,11 +286,11 @@ const er = (e) => {
270
286
  const b = v;
271
287
  v = !1, r(...g), v = b;
272
288
  }, h = e(n.setState, i, n);
273
- if (p.type === "untracked" ? l == null || l.init(h) : (p.stores[p.store] = n, l == null || l.init(
289
+ if (d.type === "untracked" ? l == null || l.init(h) : (d.stores[d.store] = n, l == null || l.init(
274
290
  Object.fromEntries(
275
- Object.entries(p.stores).map(([g, b]) => [
291
+ Object.entries(d.stores).map(([g, b]) => [
276
292
  g,
277
- g === p.store ? h : b.getState()
293
+ g === d.store ? h : b.getState()
278
294
  ])
279
295
  )
280
296
  )), n.dispatchFromDevtools && typeof n.dispatch == "function") {
@@ -361,7 +377,7 @@ const er = (e) => {
361
377
  return;
362
378
  }
363
379
  }), h;
364
- }, Xn = Zn, ut = (e, t) => {
380
+ }, es = Xn, ut = (e, t) => {
365
381
  let r;
366
382
  try {
367
383
  r = JSON.parse(e);
@@ -372,16 +388,16 @@ const er = (e) => {
372
388
  );
373
389
  }
374
390
  r !== void 0 && t(r);
375
- }, es = (e) => (t, r, i) => {
391
+ }, ts = (e) => (t, r, i) => {
376
392
  const n = i.subscribe;
377
393
  return i.subscribe = (s, o, a) => {
378
394
  let u = s;
379
395
  if (o) {
380
- const d = (a == null ? void 0 : a.equalityFn) || Object.is;
396
+ const f = (a == null ? void 0 : a.equalityFn) || Object.is;
381
397
  let l = s(i.getState());
382
- u = (p) => {
383
- const v = s(p);
384
- if (!d(l, v)) {
398
+ u = (d) => {
399
+ const v = s(d);
400
+ if (!f(l, v)) {
385
401
  const m = l;
386
402
  o(l = v, m);
387
403
  }
@@ -389,14 +405,14 @@ const er = (e) => {
389
405
  }
390
406
  return n(u);
391
407
  }, e(t, r, i);
392
- }, ts = es, rs = (e = {}, t) => {
408
+ }, rs = ts, is = (e = {}, t) => {
393
409
  switch (t.type) {
394
- case Ir:
410
+ case Tr:
395
411
  return {
396
412
  ...e,
397
413
  [t.payload.id]: t.payload.type
398
414
  };
399
- case Tr:
415
+ case kr:
400
416
  return {
401
417
  ...e,
402
418
  ...t.payload.mapping
@@ -408,7 +424,7 @@ const er = (e) => {
408
424
  function lt(e, t, r, i) {
409
425
  return !(!e[r] || !e[r][t] || !e[r][t][i] || !Array.isArray(e[r][t][i]));
410
426
  }
411
- function is(e, t) {
427
+ function ns(e, t) {
412
428
  const r = {}, i = [];
413
429
  for (const [n, s] of Object.entries(e || {})) {
414
430
  i.push(n);
@@ -429,7 +445,7 @@ function R(e) {
429
445
  function ft(e, t) {
430
446
  return typeof e > "u" ? t : e;
431
447
  }
432
- const ns = (e = qr(), t) => {
448
+ const ss = (e = qr(), t) => {
433
449
  var r;
434
450
  const i = (n, s) => ({
435
451
  ...e,
@@ -442,13 +458,13 @@ const ns = (e = qr(), t) => {
442
458
  }
443
459
  });
444
460
  switch (t.type) {
445
- case br: {
461
+ case Ar: {
446
462
  if (!e[R(t).type] || !e[R(t).type][R(t).id])
447
463
  return e;
448
464
  const n = e[R(t).type][R(t).id];
449
465
  return typeof n == "string" ? e : i(n, { [R(t).key]: R(t).value });
450
466
  }
451
- case Ar: {
467
+ case xr: {
452
468
  if (!lt(e, R(t).id, R(t).type, R(t).key))
453
469
  return e;
454
470
  const n = e[R(t).type][R(t).id];
@@ -457,28 +473,28 @@ const ns = (e = qr(), t) => {
457
473
  const s = Array.from(n[R(t).key]), [o] = s.splice(R(t).startIndex, 1);
458
474
  return s.splice(R(t).endIndex, 0, o), i(n, { [R(t).key]: s });
459
475
  }
460
- case mr: {
476
+ case br: {
461
477
  const n = Object.keys(R(t).entities), s = { ...e };
462
478
  for (const o of n) {
463
479
  const a = R(t).entities[o], u = { ...e[o] || {} };
464
- let d = !1;
480
+ let f = !1;
465
481
  const l = Object.keys(a || {}) || [];
466
482
  if (a && l) {
467
- for (const p of l)
468
- d = !0, u[p] = e[o][p] ? is(e[o][p], a[p]) : a[p];
469
- d && (s[o] = u);
483
+ for (const d of l)
484
+ f = !0, u[d] = e[o][d] ? ns(e[o][d], a[d]) : a[d];
485
+ f && (s[o] = u);
470
486
  }
471
487
  }
472
488
  return s;
473
489
  }
474
- case xr: {
490
+ case wr: {
475
491
  if (!lt(e, R(t).id, R(t).type, R(t).key))
476
492
  return e;
477
493
  const n = e[R(t).type][R(t).id], s = Array.from(n[R(t).key]);
478
494
  return s.splice(ft(R(t).index, s.length + 1), 0, R(t).reference), i(n, { [R(t).key]: s });
479
495
  }
480
496
  case At:
481
- case wr: {
497
+ case Sr: {
482
498
  if (!lt(e, R(t).id, R(t).type, R(t).key))
483
499
  return e;
484
500
  const n = e[R(t).type][R(t).id], s = Array.from(n[R(t).key]), o = ft(
@@ -487,7 +503,7 @@ const ns = (e = qr(), t) => {
487
503
  );
488
504
  return o === -1 || ((r = s[o]) == null ? void 0 : r.id) !== R(t).reference.id ? e : (t.type === At ? s.splice(o, 1, R(t).reference) : s.splice(o, 1), i(n, { [R(t).key]: s }));
489
505
  }
490
- case Sr: {
506
+ case Cr: {
491
507
  const n = e[R(t).type][R(t).id];
492
508
  if (!n)
493
509
  return e;
@@ -497,7 +513,7 @@ const ns = (e = qr(), t) => {
497
513
  value: o.label
498
514
  }), i(n, { metadata: s });
499
515
  }
500
- case Mr: {
516
+ case Rr: {
501
517
  const n = e[R(t).type][R(t).id];
502
518
  if (typeof n == "string" || !n)
503
519
  return e;
@@ -505,27 +521,27 @@ const ns = (e = qr(), t) => {
505
521
  return s.splice(R(t).endIndex, 0, o), i(n, { metadata: s });
506
522
  }
507
523
  case xt:
508
- case Cr: {
524
+ case Mr: {
509
525
  const n = e[R(t).type][R(t).id], s = Array.from(n.metadata || []), o = R(t).atIndex;
510
526
  return typeof o > "u" || o === -1 || !s[o] ? e : (t.type === xt ? s.splice(o, 1, { label: R(t).label, value: R(t).value }) : s.splice(o, 1), i(n, { metadata: s }));
511
527
  }
512
528
  default:
513
529
  return e;
514
530
  }
515
- }, ss = (e = {}, t) => {
531
+ }, os = (e = {}, t) => {
516
532
  switch (t.type) {
517
- case Lr:
533
+ case Fr:
518
534
  case Vn:
519
535
  return {
520
536
  ...e,
521
537
  [t.payload.id]: {
522
538
  requestUri: t.payload.id,
523
- loadingState: Pr,
539
+ loadingState: Lr,
524
540
  uriMismatch: !1,
525
541
  resourceUri: t.payload.id
526
542
  }
527
543
  };
528
- case jr:
544
+ case $r:
529
545
  return {
530
546
  ...e,
531
547
  [t.payload.requestId]: {
@@ -540,7 +556,7 @@ const ns = (e = qr(), t) => {
540
556
  resourceUri: t.payload.actualId
541
557
  }
542
558
  };
543
- case Fr:
559
+ case jr:
544
560
  return {
545
561
  ...e,
546
562
  [t.payload.id]: {
@@ -549,7 +565,7 @@ const ns = (e = qr(), t) => {
549
565
  error: t.payload.message
550
566
  }
551
567
  };
552
- case $r:
568
+ case Dr:
553
569
  return {
554
570
  ...e,
555
571
  [t.payload.id]: {
@@ -560,10 +576,10 @@ const ns = (e = qr(), t) => {
560
576
  };
561
577
  }
562
578
  return e;
563
- }, os = (e = {}, t) => {
579
+ }, as = (e = {}, t) => {
564
580
  const { id: r, updateValue: i, value: n, meta: s, key: o } = t && t.payload || {};
565
581
  switch (t.type) {
566
- case kr:
582
+ case Or:
567
583
  return {
568
584
  ...e,
569
585
  [r]: {
@@ -574,7 +590,7 @@ const ns = (e = qr(), t) => {
574
590
  }
575
591
  }
576
592
  };
577
- case Or:
593
+ case Er:
578
594
  return {
579
595
  ...e,
580
596
  [r]: {
@@ -585,7 +601,7 @@ const ns = (e = qr(), t) => {
585
601
  }
586
602
  }
587
603
  };
588
- case Er:
604
+ case Pr:
589
605
  return e[r] && e[r][s] && e[r][s][o] ? {
590
606
  ...e,
591
607
  [r]: {
@@ -612,8 +628,8 @@ function _r(e = {}) {
612
628
  return n ? s : r;
613
629
  };
614
630
  }
615
- function as(e) {
616
- return (t, r) => r && r.type === Pt ? r.payload.actions.reduce(e, t) : r && r.type === zn ? {
631
+ function cs(e) {
632
+ return (t, r) => r && r.type === Lt ? r.payload.actions.reduce(e, t) : r && r.type === zn ? {
617
633
  ...t,
618
634
  iiif: {
619
635
  ...t.iiif,
@@ -621,13 +637,13 @@ function as(e) {
621
637
  }
622
638
  } : e(t, r);
623
639
  }
624
- const cs = _r({
625
- mapping: rs,
626
- entities: ns,
627
- requests: ss,
628
- meta: os
640
+ const us = _r({
641
+ mapping: is,
642
+ entities: ss,
643
+ requests: os,
644
+ meta: as
629
645
  });
630
- function us() {
646
+ function ls() {
631
647
  return {
632
648
  iiif: {
633
649
  entities: qr(),
@@ -637,16 +653,16 @@ function us() {
637
653
  }
638
654
  };
639
655
  }
640
- function ls(e = {}) {
656
+ function fs(e = {}) {
641
657
  const {
642
658
  enableDevtools: t = !1,
643
659
  iiifStoreName: r = "iiif",
644
- defaultState: i = us(),
660
+ defaultState: i = ls(),
645
661
  customReducers: n = {}
646
- } = e, s = as(_r({ [r]: cs, ...n }));
647
- return Yn(ts(Xn(Jn(s, i), { enabled: t })));
662
+ } = e, s = cs(_r({ [r]: us, ...n }));
663
+ return Gn(rs(es(Kn(s, i), { enabled: t })));
648
664
  }
649
- function fs(e) {
665
+ function ps(e) {
650
666
  return { all: e = e || /* @__PURE__ */ new Map(), on: function(t, r) {
651
667
  var i = e.get(t);
652
668
  i ? i.push(r) : e.set(t, [r]);
@@ -683,14 +699,14 @@ function G(e, t, r, i = !0) {
683
699
  }
684
700
  });
685
701
  }
686
- const Se = Symbol.for("_refs_"), we = Symbol.for("_reactive_"), Oe = Symbol.for("_defined_"), tr = Symbol.for("_parent_");
687
- function ps(e, t = !1, r) {
702
+ const Se = Symbol.for("_refs_"), we = Symbol.for("_reactive_"), Oe = Symbol.for("_defined_"), rr = Symbol.for("_parent_");
703
+ function ds(e, t = !1, r) {
688
704
  const i = {
689
705
  id: "",
690
706
  type: "unknown",
691
707
  [Oe]: [],
692
708
  [Se]: {},
693
- [tr]: r || null,
709
+ [rr]: r || null,
694
710
  [we]: null,
695
711
  is(n) {
696
712
  return typeof n == "string" ? this.id === n : n.id ? n.id === this.id : !1;
@@ -714,7 +730,7 @@ function ps(e, t = !1, r) {
714
730
  unwrap() {
715
731
  if (!this.id)
716
732
  throw new Error("Invalid object");
717
- const n = this[tr];
733
+ const n = this[rr];
718
734
  return e.get(this.id, { parent: n ? { id: n, type: "unknown" } : void 0 });
719
735
  },
720
736
  toPresentation3() {
@@ -757,7 +773,7 @@ function ps(e, t = !1, r) {
757
773
  };
758
774
  return G("items", i, e), G("annotations", i, e), G("structures", i, e), G("seeAlso", i, e), G("rendering", i, e), G("partOf", i, e), G("start", i, e, !1), G("supplementary", i, e), G("homepage", i, e), G("thumbnail", i, e), G("placeholderCanvas", i, e, !1), G("accompanyingCanvas", i, e, !1), G("provider", i, e), G("body", i, e), G("logo", i, e), i;
759
775
  }
760
- function ds(e) {
776
+ function hs(e) {
761
777
  return !!e[Oe];
762
778
  }
763
779
  function Ur(e) {
@@ -768,10 +784,10 @@ function Ce(e, t, r = !1, i) {
768
784
  return e.map((a) => Ce(a, t, r));
769
785
  if (!e || !e.type || !e.id)
770
786
  return e;
771
- const n = ps(t, r), s = Object.create(n), o = Object.assign(s, e);
787
+ const n = ds(t, r), s = Object.create(n), o = Object.assign(s, e);
772
788
  return r && o.reactive(), o;
773
789
  }
774
- function rr(e) {
790
+ function ir(e) {
775
791
  switch (e) {
776
792
  case "Image":
777
793
  case "Video":
@@ -790,7 +806,7 @@ function rr(e) {
790
806
  }
791
807
  return e;
792
808
  }
793
- let Rt = class {
809
+ let It = class {
794
810
  constructor(t, r) {
795
811
  ve(this, "options"), ve(this, "store"), ve(this, "emitter"), ve(this, "isBatching", !1), ve(this, "batchQueue", []), ve(this, "remoteFetcher"), ve(this, "staticFetcher"), ve(this, "defaultFetcher", (i) => fetch(i).then((n) => n.json())), this.options = Object.assign(
796
812
  {
@@ -799,16 +815,16 @@ let Rt = class {
799
815
  enableDevtools: !0
800
816
  },
801
817
  t || {}
802
- ), this.store = r || ls({
818
+ ), this.store = r || fs({
803
819
  customReducers: this.options.reducers,
804
820
  defaultState: this.options.defaultState,
805
821
  enableDevtools: this.options.enableDevtools
806
- }), this.emitter = fs(), this.remoteFetcher = Xt(this, this.options.customFetcher), this.staticFetcher = Xt(this, (i, n) => n);
822
+ }), this.emitter = ps(), this.remoteFetcher = er(this, this.options.customFetcher), this.staticFetcher = er(this, (i, n) => n);
807
823
  }
808
824
  batch(t) {
809
825
  this.isBatching = !0;
810
826
  try {
811
- t(this), this.isBatching = !1, this.dispatch(Ct({ actions: this.batchQueue }));
827
+ t(this), this.isBatching = !1, this.dispatch(Mt({ actions: this.batchQueue }));
812
828
  } catch (r) {
813
829
  throw this.batchQueue = [], this.isBatching = !1, r;
814
830
  }
@@ -817,7 +833,7 @@ let Rt = class {
817
833
  async asyncBatch(t) {
818
834
  this.isBatching = !0;
819
835
  try {
820
- await t(this), this.isBatching = !1, this.dispatch(Ct({ actions: this.batchQueue }));
836
+ await t(this), this.isBatching = !1, this.dispatch(Mt({ actions: this.batchQueue }));
821
837
  } catch (r) {
822
838
  throw this.batchQueue = [], this.isBatching = !1, r;
823
839
  }
@@ -837,7 +853,7 @@ let Rt = class {
837
853
  if (this.isBatching)
838
854
  this.batchQueue.push(t);
839
855
  else {
840
- if (t.type === Pt) {
856
+ if (t.type === Lt) {
841
857
  for (const n of t.payload.actions)
842
858
  this.emitter.emit(n.type, { action: n, state: this.store.getState() });
843
859
  this.store.dispatch(t);
@@ -874,29 +890,29 @@ let Rt = class {
874
890
  const { skipSelfReturn: n = !0 } = i || {};
875
891
  let s = i.parent ? typeof i.parent == "string" ? i.parent : i.parent.id : void 0;
876
892
  if (Array.isArray(t))
877
- return t.map((p) => this.get(p, i));
893
+ return t.map((d) => this.get(d, i));
878
894
  const o = this.getState();
879
895
  if (mn(t) && !i.preserveSpecificResources && (t = t.source), typeof t == "string") {
880
- const p = rr(r || o.iiif.mapping[t]);
881
- if (!p)
896
+ const d = ir(r || o.iiif.mapping[t]);
897
+ if (!d)
882
898
  return n ? null : { id: t, type: "unknown" };
883
- t = { id: t, type: p };
899
+ t = { id: t, type: d };
884
900
  }
885
901
  if (t && t.partOf && !s && !i.skipPartOfCheck) {
886
- const p = Array.isArray(t.partOf) ? t.partOf[0] : t.partOf;
887
- p && (typeof p == "string" && (s = p), typeof p.id == "string" && (s = p.id));
902
+ const d = Array.isArray(t.partOf) ? t.partOf[0] : t.partOf;
903
+ d && (typeof d == "string" && (s = d), typeof d.id == "string" && (s = d.id));
888
904
  }
889
- const a = rr(r || (t == null ? void 0 : t.type)), u = t == null ? void 0 : t.id, d = o.iiif.entities[a];
890
- if (!d) {
891
- const p = o.iiif.requests[u];
892
- return p && p.resourceUri !== u ? this.get(p.resourceUri, i) : n ? null : t;
905
+ const a = ir(r || (t == null ? void 0 : t.type)), u = t == null ? void 0 : t.id, f = o.iiif.entities[a];
906
+ if (!f) {
907
+ const d = o.iiif.requests[u];
908
+ return d && d.resourceUri !== u ? this.get(d.resourceUri, i) : n ? null : t;
893
909
  }
894
- const l = d[t.id];
910
+ const l = f[t.id];
895
911
  if (l && l[Ze]) {
896
- const p = l[Ze].find((v) => s ? v[Xe] === s : v[Xe] === l.id);
897
- return vr(l, p);
912
+ const d = l[Ze].find((v) => s ? v[Xe] === s : v[Xe] === l.id);
913
+ return gr(l, d);
898
914
  }
899
- return d[t.id] || (n ? null : t);
915
+ return f[t.id] || (n ? null : t);
900
916
  }
901
917
  select(t) {
902
918
  return t(this.getState());
@@ -931,14 +947,26 @@ let Rt = class {
931
947
  }
932
948
  load(t, r) {
933
949
  const i = typeof t == "string" ? t : t.id;
934
- return r ? this.staticFetcher(i, r) : this.remoteFetcher(i);
950
+ return r ? Promise.resolve(this.staticFetcher(i, r)) : Promise.resolve(this.remoteFetcher(i));
951
+ }
952
+ loadSync(t, r) {
953
+ const i = typeof t == "string" ? t : t.id;
954
+ return this.staticFetcher(i, r);
955
+ }
956
+ loadManifestSync(t, r) {
957
+ const i = typeof t == "string" ? t : t.id;
958
+ return this.loadSync(i, r);
959
+ }
960
+ loadCollectionSync(t, r) {
961
+ const i = typeof t == "string" ? t : t.id;
962
+ return this.loadSync(i, r);
935
963
  }
936
964
  areInputsEqual(t, r) {
937
- return Zt(t, r);
965
+ return Xt(t, r);
938
966
  }
939
967
  subscribe(t, r, i) {
940
968
  return typeof i > "u" && (typeof r > "u" || r === !1 || r === !0) && (i = r, r = t, t = (n) => n), this.store.subscribe(t, (n) => r(n, this), {
941
- equalityFn: Zt,
969
+ equalityFn: Xt,
942
970
  fireImmediately: !i
943
971
  });
944
972
  }
@@ -971,16 +999,16 @@ let Rt = class {
971
999
  return Ce(this.get(t, { skipSelfReturn: !1 }), this);
972
1000
  }
973
1001
  isWrapped(t) {
974
- return ds(t);
1002
+ return hs(t);
975
1003
  }
976
1004
  setMetaValue([t, r, i], n) {
977
1005
  this.dispatch(
978
- typeof n == "function" ? Jt.setMetaValueDynamic({
1006
+ typeof n == "function" ? Kt.setMetaValueDynamic({
979
1007
  id: t,
980
1008
  meta: r,
981
1009
  key: i,
982
1010
  updateValue: n
983
- }) : Jt.setMetaValue({
1011
+ }) : Kt.setMetaValue({
984
1012
  id: t,
985
1013
  meta: r,
986
1014
  key: i,
@@ -989,18 +1017,18 @@ let Rt = class {
989
1017
  );
990
1018
  }
991
1019
  };
992
- function hs() {
1020
+ function ys() {
993
1021
  return typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
994
1022
  }
995
1023
  function Vr(e) {
996
- const t = hs();
1024
+ const t = ys();
997
1025
  try {
998
1026
  const i = t.IIIF_VAULT;
999
1027
  if (i)
1000
1028
  return i;
1001
1029
  } catch {
1002
1030
  }
1003
- const r = new Rt(e);
1031
+ const r = new It(e);
1004
1032
  try {
1005
1033
  t.IIIF_VAULT = r;
1006
1034
  } catch {
@@ -1019,7 +1047,7 @@ function Nr({
1019
1047
  resources: i,
1020
1048
  children: n
1021
1049
  }) {
1022
- const [s, o] = B(() => e || (r ? Vr(t) : t ? new Rt(t) : new Rt()));
1050
+ const [s, o] = B(() => e || (r ? Vr(t) : t ? new It(t) : new It()));
1023
1051
  return /* @__PURE__ */ x(tt.Provider, { value: { vault: s, setVaultInstance: o }, children: /* @__PURE__ */ x(Te, { value: i || {}, children: n }) });
1024
1052
  }
1025
1053
  const V = () => {
@@ -1029,36 +1057,36 @@ const V = () => {
1029
1057
  return e;
1030
1058
  };
1031
1059
  function Hr(e, { noCache: t = !1 } = {}) {
1032
- const r = typeof e == "string" ? e : e.id, i = V(), [n, s] = B(r), [o, a] = B(void 0), u = E(() => i.get(r, { skipSelfReturn: !0 }) || void 0, [r, i]), [d, l] = B(u);
1060
+ const r = typeof e == "string" ? e : e.id, i = V(), [n, s] = B(r), [o, a] = B(void 0), u = E(() => i.get(r, { skipSelfReturn: !0 }) || void 0, [r, i]), [f, l] = B(u);
1033
1061
  return K(() => {
1034
1062
  (async () => {
1035
1063
  try {
1036
- const p = u && !t ? u : await i.load(r), v = p ? p.id || p["@id"] : null;
1037
- p && n !== v && s(v), l(p);
1038
- } catch (p) {
1039
- a(p);
1064
+ const d = u && !t ? u : await i.load(r), v = d ? d.id || d["@id"] : null;
1065
+ d && n !== v && s(v), l(d);
1066
+ } catch (d) {
1067
+ a(d);
1040
1068
  }
1041
1069
  })();
1042
1070
  }, [r, t]), {
1043
- isLoaded: !!d,
1071
+ isLoaded: !!f,
1044
1072
  id: n,
1045
1073
  requestId: r,
1046
1074
  error: o,
1047
- resource: d,
1048
- cached: !!(d && d === u)
1075
+ resource: f,
1076
+ cached: !!(f && f === u)
1049
1077
  };
1050
1078
  }
1051
- function ys(e, t) {
1079
+ function vs(e, t) {
1052
1080
  const { id: r, isLoaded: i, error: n, resource: s, requestId: o, cached: a } = Hr(
1053
1081
  e,
1054
1082
  t
1055
1083
  );
1056
1084
  return { id: r, isLoaded: i, error: n, manifest: s, requestId: o, cached: a };
1057
1085
  }
1058
- function vs({ manifest: e, children: t }) {
1086
+ function gs({ manifest: e, children: t }) {
1059
1087
  return /* @__PURE__ */ x(Te, { value: { manifest: e }, children: t });
1060
1088
  }
1061
- function Lt({ canvas: e, children: t }) {
1089
+ function Ft({ canvas: e, children: t }) {
1062
1090
  return /* @__PURE__ */ x(Te, { value: { canvas: e }, children: t });
1063
1091
  }
1064
1092
  function Q(e, t = []) {
@@ -1091,17 +1119,17 @@ function ke(e = {}, t = []) {
1091
1119
  return i ? i(o) : o;
1092
1120
  }, [o, i, ...t]);
1093
1121
  }
1094
- function gs({ range: e, children: t }) {
1122
+ function ms({ range: e, children: t }) {
1095
1123
  return /* @__PURE__ */ x(Te, { value: { range: e }, children: t });
1096
1124
  }
1097
- function ms(e, t) {
1125
+ function bs(e, t) {
1098
1126
  for (const r of t.items) {
1099
1127
  if (r.type === "Canvas")
1100
1128
  return r;
1101
1129
  if (r.type === "SpecificResource")
1102
1130
  return r.source;
1103
1131
  if (r.type === "Range") {
1104
- const i = ms(e, e.get(r));
1132
+ const i = bs(e, e.get(r));
1105
1133
  if (i)
1106
1134
  return i;
1107
1135
  }
@@ -1118,7 +1146,7 @@ function zr(e, t) {
1118
1146
  }
1119
1147
  return r;
1120
1148
  }
1121
- function Tc(e, t, r) {
1149
+ function kc(e, t, r) {
1122
1150
  for (const i of t.structures) {
1123
1151
  const n = Wr(e, e.get(i), r);
1124
1152
  if (n)
@@ -1140,12 +1168,12 @@ function Wr(e, t, r) {
1140
1168
  }
1141
1169
  return null;
1142
1170
  }
1143
- function kc(e, t, r, i = !1) {
1171
+ function Oc(e, t, r, i = !1) {
1144
1172
  const n = t.behavior, s = r ? e.get(r) : null;
1145
1173
  if (!s)
1146
1174
  return [];
1147
- const o = s.behavior, a = i ? !1 : n.includes("paged"), u = a ? !1 : n.includes("continuous"), d = a || u ? !1 : n.includes("individuals"), l = o.includes("facing-pages"), p = o.includes("non-paged");
1148
- if (l || p || d || i)
1175
+ const o = s.behavior, a = i ? !1 : n.includes("paged"), u = a ? !1 : n.includes("continuous"), f = a || u ? !1 : n.includes("individuals"), l = o.includes("facing-pages"), d = o.includes("non-paged");
1176
+ if (l || d || f || i)
1149
1177
  return [{ id: s.id, type: "Canvas" }];
1150
1178
  const [v, m] = Qr(e, t);
1151
1179
  if (u)
@@ -1164,70 +1192,70 @@ function Qr(e, t, { disablePaging: r, skipNonPaged: i } = {}) {
1164
1192
  return [u, [u.map((h, g) => g)]];
1165
1193
  if (a || !s || r)
1166
1194
  return [u, u.map((h, g) => [g])];
1167
- const d = [];
1195
+ const f = [];
1168
1196
  let l = [];
1169
- const p = () => {
1170
- l.length && (d.push([...l]), l = []);
1197
+ const d = () => {
1198
+ l.length && (f.push([...l]), l = []);
1171
1199
  };
1172
1200
  let v = 0, m = !1;
1173
1201
  for (let h = 0; h < u.length; h++) {
1174
1202
  const g = e.get(u[h]);
1175
1203
  if (g.behavior.includes("non-paged")) {
1176
- h === v && v++, i || (p(), d.push([h]), p());
1204
+ h === v && v++, i || (d(), f.push([h]), d());
1177
1205
  continue;
1178
1206
  }
1179
1207
  if (h === v || g.behavior.includes("facing-pages")) {
1180
- l.length && (m = !0), p(), d.push([h]), p();
1208
+ l.length && (m = !0), d(), f.push([h]), d();
1181
1209
  continue;
1182
1210
  }
1183
1211
  if (l.push(h), m) {
1184
- p(), m = !1;
1212
+ d(), m = !1;
1185
1213
  continue;
1186
1214
  }
1187
- l.length > 1 && p();
1215
+ l.length > 1 && d();
1188
1216
  }
1189
- return l.length && p(), [u, d];
1217
+ return l.length && d(), [u, f];
1190
1218
  }
1191
- function bs(e = {}, t = []) {
1219
+ function As(e = {}, t = []) {
1192
1220
  const { id: r, selector: i } = e, n = be(), s = r || n.range, o = Q((a) => s ? a.iiif.entities.Range[s] : void 0, [s]);
1193
1221
  return E(() => {
1194
1222
  if (o)
1195
1223
  return i ? i(o) : o;
1196
1224
  }, [o, i, ...t]);
1197
1225
  }
1198
- function As({ startCanvas: e, disablePaging: t }) {
1226
+ function xs({ startCanvas: e, disablePaging: t }) {
1199
1227
  var h;
1200
- const r = V(), i = ke(), n = bs(), [s, o] = B(void 0), a = n || i;
1228
+ const r = V(), i = ke(), n = As(), [s, o] = B(void 0), a = n || i;
1201
1229
  if (!a)
1202
1230
  throw new Error("Nothing selected");
1203
- const [u, d] = E(
1231
+ const [u, f] = E(
1204
1232
  () => Qr(r, a, { disablePaging: t }),
1205
1233
  [r, a]
1206
1234
  ), l = D(
1207
1235
  (g) => {
1208
- const b = d.findIndex((A) => A.includes(g));
1236
+ const b = f.findIndex((A) => A.includes(g));
1209
1237
  o(b === -1 ? 0 : b);
1210
1238
  },
1211
- [u, d]
1212
- ), p = D(
1239
+ [u, f]
1240
+ ), d = D(
1213
1241
  (g) => {
1214
1242
  const b = u.findIndex((A) => A.id === g);
1215
1243
  b !== -1 ? l(b) : o(0);
1216
1244
  },
1217
- [u, d]
1245
+ [u, f]
1218
1246
  ), v = D(() => {
1219
- o((g) => g >= d.length ? g : g + 1);
1220
- }, [d]), m = D(() => {
1247
+ o((g) => g >= f.length ? g : g + 1);
1248
+ }, [f]), m = D(() => {
1221
1249
  o((g) => g <= 0 ? 0 : g - 1);
1222
- }, [d]);
1223
- return typeof s > "u" && (e ? p(e) : o(0)), {
1224
- visibleItems: ((h = d[s]) == null ? void 0 : h.map((g) => u[g].id)) || [],
1250
+ }, [f]);
1251
+ return typeof s > "u" && (e ? d(e) : o(0)), {
1252
+ visibleItems: ((h = f[s]) == null ? void 0 : h.map((g) => u[g].id)) || [],
1225
1253
  cursor: s,
1226
1254
  items: u,
1227
- sequence: d,
1255
+ sequence: f,
1228
1256
  setSequenceIndex: o,
1229
1257
  setCanvasIndex: l,
1230
- setCanvasId: p,
1258
+ setCanvasId: d,
1231
1259
  next: v,
1232
1260
  previous: m
1233
1261
  };
@@ -1243,50 +1271,50 @@ const Fe = () => {
1243
1271
  setSequenceIndex: Fe,
1244
1272
  currentSequenceIndex: 0
1245
1273
  });
1246
- function xs(e) {
1247
- const t = ke(), { cursor: r, visibleItems: i, next: n, sequence: s, items: o, setCanvasIndex: a, setCanvasId: u, previous: d, setSequenceIndex: l } = As({
1274
+ function ws(e) {
1275
+ const t = ke(), { cursor: r, visibleItems: i, next: n, sequence: s, items: o, setCanvasIndex: a, setCanvasId: u, previous: f, setSequenceIndex: l } = xs({
1248
1276
  startCanvas: e.startCanvas,
1249
1277
  disablePaging: e.pagingEnabled === !1
1250
- }), p = E(
1278
+ }), d = E(
1251
1279
  () => ({
1252
1280
  sequence: s,
1253
1281
  items: o,
1254
1282
  // Extra functions.
1255
1283
  setCurrentCanvasId: u,
1256
1284
  nextCanvas: n,
1257
- previousCanvas: d,
1285
+ previousCanvas: f,
1258
1286
  totalCanvases: o.length,
1259
1287
  setCurrentCanvasIndex: a,
1260
1288
  setSequenceIndex: l,
1261
1289
  currentSequenceIndex: r
1262
1290
  }),
1263
- [s, o, u, n, d, o, a, l, r]
1291
+ [s, o, u, n, f, o, a, l, r]
1264
1292
  );
1265
- return t ? /* @__PURE__ */ x(it.Provider, { value: p, children: /* @__PURE__ */ x(rt.Provider, { value: i, children: /* @__PURE__ */ x(Lt, { canvas: i[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." }));
1293
+ return t ? /* @__PURE__ */ x(it.Provider, { value: d, children: /* @__PURE__ */ x(rt.Provider, { value: i, children: /* @__PURE__ */ x(Ft, { canvas: i[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." }));
1266
1294
  }
1267
- function ws(e) {
1268
- const t = ys(e.manifest);
1295
+ function Ss(e) {
1296
+ const t = vs(e.manifest);
1269
1297
  if (!t)
1270
1298
  return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." });
1271
1299
  if (t.error)
1272
1300
  return /* @__PURE__ */ x("div", { children: t.error.toString() });
1273
1301
  if (!t.isLoaded)
1274
1302
  return /* @__PURE__ */ x("div", { children: "Loading..." });
1275
- const r = /* @__PURE__ */ x(xs, { ...e, children: e.children });
1276
- return /* @__PURE__ */ x(vs, { manifest: t.id, children: e.rangeId ? /* @__PURE__ */ x(gs, { range: e.rangeId, children: r }) : r });
1303
+ const r = /* @__PURE__ */ x(ws, { ...e, children: e.children });
1304
+ return /* @__PURE__ */ x(gs, { manifest: t.id, children: e.rangeId ? /* @__PURE__ */ x(ms, { range: e.rangeId, children: r }) : r });
1277
1305
  }
1278
- function Ss() {
1306
+ function Cs() {
1279
1307
  return H(it);
1280
1308
  }
1281
- function Cs() {
1309
+ function Ms() {
1282
1310
  return {
1283
1311
  VaultContext: H(tt),
1284
- ResourceContext: H(Et),
1312
+ ResourceContext: H(Pt),
1285
1313
  SimpleViewerReactContext: H(it),
1286
1314
  VisibleCanvasReactContext: H(rt)
1287
1315
  };
1288
1316
  }
1289
- function Ms(e) {
1317
+ function Rs(e) {
1290
1318
  return /* @__PURE__ */ x(Nr, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ x(rt.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ x(it.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
1291
1319
  }
1292
1320
  const se = function(e) {
@@ -1298,28 +1326,28 @@ const se = function(e) {
1298
1326
  ...i !== void 0 && { meta: i }
1299
1327
  });
1300
1328
  };
1301
- }, Rs = "@iiif/IMPORT_ENTITIES", Is = "@iiif/MODIFY_ENTITY_FIELD", Ts = "@iiif/REORDER_ENTITY_FIELD", ks = "@iiif/ADD_REFERENCE", Os = "@iiif/UPDATE_REFERENCE", Es = "@iiif/REMOVE_REFERENCE", Ps = "@iiif/ADD_METADATA", Ls = "@iiif/REMOVE_METADATA", Fs = "@iiif/UPDATE_METADATA", js = "@iiif/REORDER_METADATA", $s = se(Rs)(), Ds = se(Is)(), qs = se(Ts)(), _s = se(ks)(), Us = se(Es)(), Vs = se(Os)(), Ns = se(Ps)(), Hs = se(Fs)(), Bs = se(Ls)(), zs = se(js)(), pt = {
1302
- importEntities: $s,
1303
- modifyEntityField: Ds,
1304
- reorderEntityField: qs,
1305
- addReference: _s,
1306
- removeReference: Us,
1307
- updateReference: Vs,
1308
- addMetadata: Ns,
1309
- removeMetadata: Bs,
1310
- updateMetadata: Hs,
1311
- reorderMetadata: zs
1329
+ }, Is = "@iiif/IMPORT_ENTITIES", Ts = "@iiif/MODIFY_ENTITY_FIELD", ks = "@iiif/REORDER_ENTITY_FIELD", Os = "@iiif/ADD_REFERENCE", Es = "@iiif/UPDATE_REFERENCE", Ps = "@iiif/REMOVE_REFERENCE", Ls = "@iiif/ADD_METADATA", Fs = "@iiif/REMOVE_METADATA", js = "@iiif/UPDATE_METADATA", $s = "@iiif/REORDER_METADATA", Ds = se(Is)(), qs = se(Ts)(), _s = se(ks)(), Us = se(Os)(), Vs = se(Ps)(), Ns = se(Es)(), Hs = se(Ls)(), Bs = se(js)(), zs = se(Fs)(), Ws = se($s)(), pt = {
1330
+ importEntities: Ds,
1331
+ modifyEntityField: qs,
1332
+ reorderEntityField: _s,
1333
+ addReference: Us,
1334
+ removeReference: Vs,
1335
+ updateReference: Ns,
1336
+ addMetadata: Hs,
1337
+ removeMetadata: zs,
1338
+ updateMetadata: Bs,
1339
+ reorderMetadata: Ws
1312
1340
  };
1313
- function Ws() {
1341
+ function Qs() {
1314
1342
  const t = V().getStore();
1315
1343
  return E(() => (r) => t.dispatch(r), [t]);
1316
1344
  }
1317
- function ir(e) {
1345
+ function nr(e) {
1318
1346
  return typeof e != "string" && e && e.bindToVault;
1319
1347
  }
1320
- function Qs() {
1321
- const e = V(), t = ge([]), r = Ws(), i = E(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
1322
- hr(() => {
1348
+ function Ys() {
1349
+ const e = V(), t = ge([]), r = Qs(), i = E(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
1350
+ yr(() => {
1323
1351
  const a = {
1324
1352
  id: i,
1325
1353
  type: "AnnotationPage",
@@ -1353,13 +1381,13 @@ function Qs() {
1353
1381
  ), s = D(
1354
1382
  (a, u) => {
1355
1383
  if (i) {
1356
- if (ir(a)) {
1357
- const p = a;
1358
- p.__vault || p.bindToVault(e), a = typeof p.source == "string" ? p.source : p.source.id, t.current[a] = p;
1384
+ if (nr(a)) {
1385
+ const d = a;
1386
+ d.__vault || d.bindToVault(e), a = typeof d.source == "string" ? d.source : d.source.id, t.current[a] = d;
1359
1387
  } else
1360
1388
  typeof a != "string" && (a = a.id);
1361
- const d = e.get({ id: i, type: "AnnotationPage" }), l = e.get({ id: a, type: "Annotation" });
1362
- d && l && (d.items.find((p) => p.id === l.id) || r(
1389
+ const f = e.get({ id: i, type: "AnnotationPage" }), l = e.get({ id: a, type: "Annotation" });
1390
+ f && l && (f.items.find((d) => d.id === l.id) || r(
1363
1391
  pt.addReference({
1364
1392
  id: i,
1365
1393
  type: "AnnotationPage",
@@ -1376,7 +1404,7 @@ function Qs() {
1376
1404
  [i]
1377
1405
  ), o = D(
1378
1406
  (a) => {
1379
- i && (ir(a) ? a = typeof a.source == "string" ? a.source : a.source.id : typeof a != "string" && (a = a.id), t.current[a] && t.current[a].beforeRemove(), e.get({ id: i, type: "AnnotationPage" }) && r(
1407
+ i && (nr(a) ? a = typeof a.source == "string" ? a.source : a.source.id : typeof a != "string" && (a = a.id), t.current[a] && t.current[a].beforeRemove(), e.get({ id: i, type: "AnnotationPage" }) && r(
1380
1408
  pt.removeReference({
1381
1409
  id: i,
1382
1410
  type: "AnnotationPage",
@@ -1399,7 +1427,7 @@ function Qs() {
1399
1427
  ];
1400
1428
  }
1401
1429
  const Yr = ce(null);
1402
- function Ys() {
1430
+ function Gs() {
1403
1431
  const e = H(Yr);
1404
1432
  return [
1405
1433
  e.fullPage,
@@ -1409,8 +1437,8 @@ function Ys() {
1409
1437
  }
1410
1438
  ];
1411
1439
  }
1412
- function Gs({ children: e }) {
1413
- const [t, { addAnnotation: r, removeAnnotation: i }] = Qs();
1440
+ function Js({ children: e }) {
1441
+ const [t, { addAnnotation: r, removeAnnotation: i }] = Ys();
1414
1442
  return /* @__PURE__ */ x(
1415
1443
  Yr.Provider,
1416
1444
  {
@@ -1419,7 +1447,7 @@ function Gs({ children: e }) {
1419
1447
  }
1420
1448
  );
1421
1449
  }
1422
- function Js({
1450
+ function Ks({
1423
1451
  width: e,
1424
1452
  style: t,
1425
1453
  height: r,
@@ -1432,9 +1460,9 @@ function Js({
1432
1460
  /* @__PURE__ */ x("button", { onClick: n, children: "Reset" })
1433
1461
  ] });
1434
1462
  }
1435
- const Ft = ce(null);
1436
- function Ks() {
1437
- return H(Ft);
1463
+ const jt = ce(null);
1464
+ function Zs() {
1465
+ return H(jt);
1438
1466
  }
1439
1467
  const Gr = ce(
1440
1468
  () => {
@@ -1458,19 +1486,19 @@ function ue(e = {}, t = []) {
1458
1486
  }
1459
1487
  const Kr = ce(() => {
1460
1488
  });
1461
- function Zs(e) {
1489
+ function Xs(e) {
1462
1490
  const t = ue(), r = H(Kr);
1463
1491
  K(() => t && t.id ? (r(t.id, e), () => r(t.id, -1)) : () => {
1464
1492
  }, [t, e]);
1465
1493
  }
1466
- function Xs({
1494
+ function eo({
1467
1495
  children: e,
1468
1496
  errorFallback: t,
1469
1497
  outerContainerProps: r = {},
1470
1498
  worldScale: i,
1471
1499
  ...n
1472
1500
  }) {
1473
- const [s, o] = B(), a = Cs(), u = t || Js, [d, l] = B({}), p = Object.entries(d), [v, m] = B({}), h = Object.entries(v), [g, b] = B({}), A = E(() => i || Math.max(...Object.values(g)), [g]), w = E(() => ({ maxOverZoom: A || 1, ...n.runtimeOptions || {} }), [A, n.runtimeOptions]), C = D((I, L) => {
1501
+ const [s, o] = B(), a = Ms(), u = t || Ks, [f, l] = B({}), d = Object.entries(f), [v, m] = B({}), h = Object.entries(v), [g, b] = B({}), A = E(() => i || Math.max(...Object.values(g)), [g]), w = E(() => ({ maxOverZoom: A || 1, ...n.runtimeOptions || {} }), [A, n.runtimeOptions]), C = D((I, L) => {
1474
1502
  b((P) => {
1475
1503
  if (L === -1) {
1476
1504
  const { [I]: M, ...$ } = P;
@@ -1495,12 +1523,12 @@ function Xs({
1495
1523
  {
1496
1524
  ...n,
1497
1525
  containerProps: { style: { position: "relative" }, ...n.containerProps || {} },
1498
- htmlChildren: /* @__PURE__ */ x(Me, { children: p.map(([I, { element: L, props: P }]) => /* @__PURE__ */ x(me.Fragment, { children: /* @__PURE__ */ x(L, { ...P || {} }) }, I)) }),
1526
+ htmlChildren: /* @__PURE__ */ x(Me, { children: d.map(([I, { element: L, props: P }]) => /* @__PURE__ */ x(me.Fragment, { children: /* @__PURE__ */ x(L, { ...P || {} }) }, I)) }),
1499
1527
  onCreated: (I) => {
1500
1528
  o(I), n.onCreated && n.onCreated(I);
1501
1529
  },
1502
1530
  runtimeOptions: w,
1503
- children: /* @__PURE__ */ x(Ft.Provider, { value: s, children: /* @__PURE__ */ x(Kr.Provider, { value: C, children: /* @__PURE__ */ x(Gr.Provider, { value: T, children: /* @__PURE__ */ x(Jr.Provider, { value: j, children: /* @__PURE__ */ x(Ms, { bridge: a, children: /* @__PURE__ */ x(ln.Provider, { value: n.mode || "explore", children: /* @__PURE__ */ x(Gs, { children: e }) }) }) }) }) }) })
1531
+ children: /* @__PURE__ */ x(jt.Provider, { value: s, children: /* @__PURE__ */ x(Kr.Provider, { value: C, children: /* @__PURE__ */ x(Gr.Provider, { value: T, children: /* @__PURE__ */ x(Jr.Provider, { value: j, children: /* @__PURE__ */ x(Rs, { bridge: a, children: /* @__PURE__ */ x(ln.Provider, { value: n.mode || "explore", children: /* @__PURE__ */ x(Js, { children: e }) }) }) }) }) }) })
1504
1532
  }
1505
1533
  ),
1506
1534
  /* @__PURE__ */ x("div", { children: h.map(([I, { element: L, props: P }]) => /* @__PURE__ */ x(me.Fragment, { children: /* @__PURE__ */ x(L, { ...P || {} }) }, I)) })
@@ -1556,8 +1584,8 @@ function Xr(e = Zr) {
1556
1584
  for (const o of Object.keys(n))
1557
1585
  s[o] = (a) => {
1558
1586
  const u = e.get(i);
1559
- for (const { callback: d, scope: l } of n[o] || [])
1560
- (!l || r && l.indexOf(r) !== -1) && d(a, u);
1587
+ for (const { callback: f, scope: l } of n[o] || [])
1588
+ (!l || r && l.indexOf(r) !== -1) && f(a, u);
1561
1589
  };
1562
1590
  return s;
1563
1591
  }
@@ -1587,7 +1615,7 @@ const Be = {}, ti = {
1587
1615
  return t ? r[t] : r;
1588
1616
  }
1589
1617
  };
1590
- function jt(e = ti) {
1618
+ function $t(e = ti) {
1591
1619
  return {
1592
1620
  applyStyles(t, r, i) {
1593
1621
  const n = typeof t == "string" ? t : t.id;
@@ -1600,7 +1628,7 @@ function jt(e = ti) {
1600
1628
  };
1601
1629
  }
1602
1630
  function et(e, t) {
1603
- const r = V(), i = E(() => jt(r), [r]);
1631
+ const r = V(), i = E(() => $t(r), [r]);
1604
1632
  return Q(() => {
1605
1633
  if (!e)
1606
1634
  return null;
@@ -1608,14 +1636,14 @@ function et(e, t) {
1608
1636
  return n ? t ? n[t] : n : void 0;
1609
1637
  }, [e, t]);
1610
1638
  }
1611
- var eo = Object.defineProperty, to = (e, t, r) => t in e ? eo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Qe = (e, t, r) => (to(e, typeof t != "symbol" ? t + "" : t, r), r), ro = /* @__PURE__ */ function() {
1639
+ var to = Object.defineProperty, ro = (e, t, r) => t in e ? to(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Qe = (e, t, r) => (ro(e, typeof t != "symbol" ? t + "" : t, r), r), io = /* @__PURE__ */ function() {
1612
1640
  function e(t, r) {
1613
1641
  var i = [], n = !0, s = !1, o = void 0;
1614
1642
  try {
1615
1643
  for (var a = t[Symbol.iterator](), u; !(n = (u = a.next()).done) && (i.push(u.value), !(r && i.length === r)); n = !0)
1616
1644
  ;
1617
- } catch (d) {
1618
- s = !0, o = d;
1645
+ } catch (f) {
1646
+ s = !0, o = f;
1619
1647
  } finally {
1620
1648
  try {
1621
1649
  !n && a.return && a.return();
@@ -1636,12 +1664,12 @@ var eo = Object.defineProperty, to = (e, t, r) => t in e ? eo(e, t, { enumerable
1636
1664
  }(), $e = Math.PI * 2, dt = function(e, t, r, i, n, s, o) {
1637
1665
  var a = e.x, u = e.y;
1638
1666
  a *= t, u *= r;
1639
- var d = i * a - n * u, l = n * a + i * u;
1667
+ var f = i * a - n * u, l = n * a + i * u;
1640
1668
  return {
1641
- x: d + s,
1669
+ x: f + s,
1642
1670
  y: l + o
1643
1671
  };
1644
- }, io = function(e, t) {
1672
+ }, no = function(e, t) {
1645
1673
  var r = t === 1.5707963267948966 ? 0.551915024494 : t === -1.5707963267948966 ? -0.551915024494 : 1.3333333333333333 * Math.tan(t / 4), i = Math.cos(e), n = Math.sin(e), s = Math.cos(e + t), o = Math.sin(e + t);
1646
1674
  return [{
1647
1675
  x: i - n * r,
@@ -1653,16 +1681,16 @@ var eo = Object.defineProperty, to = (e, t, r) => t in e ? eo(e, t, { enumerable
1653
1681
  x: s,
1654
1682
  y: o
1655
1683
  }];
1656
- }, nr = function(e, t, r, i) {
1684
+ }, sr = function(e, t, r, i) {
1657
1685
  var n = e * i - t * r < 0 ? -1 : 1, s = e * r + t * i;
1658
1686
  return s > 1 && (s = 1), s < -1 && (s = -1), n * Math.acos(s);
1659
- }, no = function(e, t, r, i, n, s, o, a, u, d, l, p) {
1660
- var v = Math.pow(n, 2), m = Math.pow(s, 2), h = Math.pow(l, 2), g = Math.pow(p, 2), b = v * m - v * g - m * h;
1687
+ }, so = function(e, t, r, i, n, s, o, a, u, f, l, d) {
1688
+ var v = Math.pow(n, 2), m = Math.pow(s, 2), h = Math.pow(l, 2), g = Math.pow(d, 2), b = v * m - v * g - m * h;
1661
1689
  b < 0 && (b = 0), b /= v * g + m * h, b = Math.sqrt(b) * (o === a ? -1 : 1);
1662
- var A = b * n / s * p, w = b * -s / n * l, C = d * A - u * w + (e + r) / 2, T = u * A + d * w + (t + i) / 2, j = (l - A) / n, I = (p - w) / s, L = (-l - A) / n, P = (-p - w) / s, M = nr(1, 0, j, I), $ = nr(j, I, L, P);
1690
+ var A = b * n / s * d, w = b * -s / n * l, C = f * A - u * w + (e + r) / 2, T = u * A + f * w + (t + i) / 2, j = (l - A) / n, I = (d - w) / s, L = (-l - A) / n, P = (-d - w) / s, M = sr(1, 0, j, I), $ = sr(j, I, L, P);
1663
1691
  return a === 0 && $ > 0 && ($ -= $e), a === 1 && $ < 0 && ($ += $e), [C, T, M, $];
1664
- }, so = function(e) {
1665
- var t = e.px, r = e.py, i = e.cx, n = e.cy, s = e.rx, o = e.ry, a = e.xAxisRotation, u = a === void 0 ? 0 : a, d = e.largeArcFlag, l = d === void 0 ? 0 : d, p = e.sweepFlag, v = p === void 0 ? 0 : p, m = [];
1692
+ }, oo = function(e) {
1693
+ var t = e.px, r = e.py, i = e.cx, n = e.cy, s = e.rx, o = e.ry, a = e.xAxisRotation, u = a === void 0 ? 0 : a, f = e.largeArcFlag, l = f === void 0 ? 0 : f, d = e.sweepFlag, v = d === void 0 ? 0 : d, m = [];
1666
1694
  if (s === 0 || o === 0)
1667
1695
  return [];
1668
1696
  var h = Math.sin(u * $e / 360), g = Math.cos(u * $e / 360), b = g * (t - i) / 2 + h * (r - n) / 2, A = -h * (t - i) / 2 + g * (r - n) / 2;
@@ -1671,12 +1699,12 @@ var eo = Object.defineProperty, to = (e, t, r) => t in e ? eo(e, t, { enumerable
1671
1699
  s = Math.abs(s), o = Math.abs(o);
1672
1700
  var w = Math.pow(b, 2) / Math.pow(s, 2) + Math.pow(A, 2) / Math.pow(o, 2);
1673
1701
  w > 1 && (s *= Math.sqrt(w), o *= Math.sqrt(w));
1674
- var C = no(t, r, i, n, s, o, l, v, h, g, b, A), T = ro(C, 4), j = T[0], I = T[1], L = T[2], P = T[3], M = Math.abs(P) / ($e / 4);
1702
+ var C = so(t, r, i, n, s, o, l, v, h, g, b, A), T = io(C, 4), j = T[0], I = T[1], L = T[2], P = T[3], M = Math.abs(P) / ($e / 4);
1675
1703
  Math.abs(1 - M) < 1e-7 && (M = 1);
1676
1704
  var $ = Math.max(Math.ceil(M), 1);
1677
1705
  P /= $;
1678
1706
  for (var ie = 0; ie < $; ie++)
1679
- m.push(io(L, P)), L += P;
1707
+ m.push(no(L, P)), L += P;
1680
1708
  return m.map(function(Z) {
1681
1709
  var U = dt(Z[0], s, o, g, h, j, I), z = U.x, ee = U.y, ne = dt(Z[1], s, o, g, h, j, I), xe = ne.x, O = ne.y, W = dt(Z[2], s, o, g, h, j, I), X = W.x, de = W.y;
1682
1710
  return { x1: z, y1: ee, x2: xe, y2: O, x: X, y: de };
@@ -1685,12 +1713,12 @@ var eo = Object.defineProperty, to = (e, t, r) => t in e ? eo(e, t, { enumerable
1685
1713
  function ri(e) {
1686
1714
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1687
1715
  }
1688
- var oo = co, ht = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, ao = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
1689
- function co(e) {
1716
+ var ao = uo, ht = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, co = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
1717
+ function uo(e) {
1690
1718
  var t = [];
1691
- return e.replace(ao, function(r, i, n) {
1719
+ return e.replace(co, function(r, i, n) {
1692
1720
  var s = i.toLowerCase();
1693
- for (n = lo(n), s == "m" && n.length > 2 && (t.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
1721
+ for (n = fo(n), s == "m" && n.length > 2 && (t.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
1694
1722
  if (n.length == ht[s])
1695
1723
  return n.unshift(i), t.push(n);
1696
1724
  if (n.length < ht[s])
@@ -1699,14 +1727,14 @@ function co(e) {
1699
1727
  }
1700
1728
  }), t;
1701
1729
  }
1702
- var uo = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
1703
- function lo(e) {
1704
- var t = e.match(uo);
1730
+ var lo = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
1731
+ function fo(e) {
1732
+ var t = e.match(lo);
1705
1733
  return t ? t.map(Number) : [];
1706
1734
  }
1707
- const fo = /* @__PURE__ */ ri(oo);
1708
- var po = ho;
1709
- function ho(e) {
1735
+ const po = /* @__PURE__ */ ri(ao);
1736
+ var ho = yo;
1737
+ function yo(e) {
1710
1738
  var t = 0, r = 0, i = 0, n = 0;
1711
1739
  return e.map(function(s) {
1712
1740
  s = s.slice();
@@ -1745,10 +1773,10 @@ function ho(e) {
1745
1773
  return s;
1746
1774
  });
1747
1775
  }
1748
- const yo = /* @__PURE__ */ ri(po);
1749
- function vo(e) {
1750
- const t = fo(e), r = yo(t);
1751
- let i, n = 0, s = 0, o = 0, a = 0, u, d, l = 0, p = 0;
1776
+ const vo = /* @__PURE__ */ ri(ho);
1777
+ function go(e) {
1778
+ const t = po(e), r = vo(t);
1779
+ let i, n = 0, s = 0, o = 0, a = 0, u, f, l = 0, d = 0;
1752
1780
  const v = [];
1753
1781
  for (let m = 0; m < r.length; m++) {
1754
1782
  let h = r[m];
@@ -1765,21 +1793,21 @@ function vo(e) {
1765
1793
  break;
1766
1794
  case "S":
1767
1795
  {
1768
- let b = l, A = p;
1796
+ let b = l, A = d;
1769
1797
  (i === "C" || i == "S") && (b += b - o, A += A - a), h = ["C", b, A, h[1], h[2], h[3], h[4]];
1770
1798
  }
1771
1799
  break;
1772
1800
  case "T":
1773
- i === "Q" || i == "T" ? (u = l * 2 - u, d = p * 2 - d) : (u = l, d = p), h = ["Q", u, d, h[1], h[2]];
1801
+ i === "Q" || i == "T" ? (u = l * 2 - u, f = d * 2 - f) : (u = l, f = d), h = ["Q", u, f, h[1], h[2]];
1774
1802
  break;
1775
1803
  case "Q":
1776
- u = h[1], d = h[2];
1804
+ u = h[1], f = h[2];
1777
1805
  break;
1778
1806
  case "A":
1779
1807
  {
1780
- const b = so({
1808
+ const b = oo({
1781
1809
  px: l,
1782
- py: p,
1810
+ py: d,
1783
1811
  cx: h[6],
1784
1812
  cy: h[7],
1785
1813
  rx: h[1],
@@ -1799,7 +1827,7 @@ function vo(e) {
1799
1827
  h = ["L", n, s];
1800
1828
  break;
1801
1829
  }
1802
- i = g, l = h[h.length - 2], p = h[h.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (o = h[h.length - 4], a = h[h.length - 3]) : (o = l, a = p), v.push(h);
1830
+ i = g, l = h[h.length - 2], d = h[h.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (o = h[h.length - 4], a = h[h.length - 3]) : (o = l, a = d), v.push(h);
1803
1831
  }
1804
1832
  return v;
1805
1833
  }
@@ -1834,15 +1862,15 @@ function vo(e) {
1834
1862
  * See the License for the specific language governing permissions and
1835
1863
  * limitations under the License.
1836
1864
  */
1837
- function go(e, t, r, i = 1) {
1865
+ function mo(e, t, r, i = 1) {
1838
1866
  return new ii(e, t, r).subdivide(i);
1839
1867
  }
1840
- function mo(e, t, r, i, n = 1) {
1841
- return new $t(
1868
+ function bo(e, t, r, i, n = 1) {
1869
+ return new Dt(
1842
1870
  new Float64Array([e.x, e.y, t.x, t.y, r.x, r.y, i.x, i.y])
1843
1871
  ).subdivide(n);
1844
1872
  }
1845
- function bo(e) {
1873
+ function Ao(e) {
1846
1874
  return e.x * e.x + e.y * e.y;
1847
1875
  }
1848
1876
  function De(e) {
@@ -1863,19 +1891,19 @@ class ii {
1863
1891
  };
1864
1892
  }
1865
1893
  mapToBasic() {
1866
- const { x: t, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: o } = this.end, a = 2 * i - t - s, u = 2 * n - r - o, d = (i - t) * a + (n - r) * u, l = (s - i) * a + (o - n) * u, p = (s - t) * u - (o - r) * a, v = d / p, m = l / p, h = Math.abs(p) / (Math.hypot(a, u) * Math.abs(m - v));
1867
- return { x0: t, x2: s, scale: h, cross: p };
1894
+ const { x: t, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: o } = this.end, a = 2 * i - t - s, u = 2 * n - r - o, f = (i - t) * a + (n - r) * u, l = (s - i) * a + (o - n) * u, d = (s - t) * u - (o - r) * a, v = f / d, m = l / d, h = Math.abs(d) / (Math.hypot(a, u) * Math.abs(m - v));
1895
+ return { x0: t, x2: s, scale: h, cross: d };
1868
1896
  }
1869
1897
  subdivide(t) {
1870
- const r = this.mapToBasic(), i = De(r.x0), n = De(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / t), o = Math.ceil(s), a = Ee(i), u = Ee(n), d = [0];
1898
+ const r = this.mapToBasic(), i = De(r.x0), n = De(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / t), o = Math.ceil(s), a = Ee(i), u = Ee(n), f = [0];
1871
1899
  for (let l = 1; l < o; l++) {
1872
- const p = (Ee(i + (n - i) * l / o) - a) / (u - a);
1873
- d.push(p);
1900
+ const d = (Ee(i + (n - i) * l / o) - a) / (u - a);
1901
+ f.push(d);
1874
1902
  }
1875
- return d.push(1), d.map((l) => this.eval(l));
1903
+ return f.push(1), f.map((l) => this.eval(l));
1876
1904
  }
1877
1905
  }
1878
- class $t {
1906
+ class Dt {
1879
1907
  /// Argument is array of coordinate values [x0, y0, x1, y1, x2, y2, x3, y3].
1880
1908
  constructor(t) {
1881
1909
  Qe(this, "c"), this.c = t;
@@ -1903,11 +1931,11 @@ class $t {
1903
1931
  const o = (r - t) / 3, a = this.deriv(t);
1904
1932
  i[2] = n.x + o * a.x, i[3] = n.y + o * a.y;
1905
1933
  const u = this.deriv(r);
1906
- return i[4] = s.x - o * u.x, i[5] = s.y - o * u.y, i[6] = s.x, i[7] = s.y, new $t(i);
1934
+ return i[4] = s.x - o * u.x, i[5] = s.y - o * u.y, i[6] = s.x, i[7] = s.y, new Dt(i);
1907
1935
  }
1908
1936
  // Very fancy subdivision scheme
1909
1937
  subdivide(t) {
1910
- const r = 0.1 * t, i = t - r, n = Math.sqrt(i), s = bo(this.weightsum(1, -3, 3, -1)), o = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), a = [];
1938
+ const r = 0.1 * t, i = t - r, n = Math.sqrt(i), s = Ao(this.weightsum(1, -3, 3, -1)), o = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), a = [];
1911
1939
  let u = 0;
1912
1940
  for (let h = 0; h < o; h++) {
1913
1941
  const g = h / o, b = (h + 1) / o, A = this.subsegment(g, b).midpoint_quadbez(), w = A.mapToBasic(), C = De(w.x0), T = De(w.x2), j = Math.sqrt(w.scale);
@@ -1923,19 +1951,19 @@ class $t {
1923
1951
  val: I
1924
1952
  }), u += I;
1925
1953
  }
1926
- const d = 0.5 * u / n, l = Math.ceil(d), p = [{ x: this.c[0], y: this.c[1] }];
1954
+ const f = 0.5 * u / n, l = Math.ceil(f), d = [{ x: this.c[0], y: this.c[1] }];
1927
1955
  let v = 0, m = 0;
1928
1956
  for (let h = 1; h < l; h++) {
1929
1957
  const g = u * h / l;
1930
1958
  for (; v + a[m].val < g; )
1931
1959
  v += a[m].val, m++;
1932
1960
  const b = a[m].a0, A = a[m].a2, w = Ee(b), C = Ee(A), T = b + (A - b) * (g - v) / a[m].val, j = (Ee(T) - w) / (C - w);
1933
- p.push(a[m].quad.eval(j));
1961
+ d.push(a[m].quad.eval(j));
1934
1962
  }
1935
- return p.push({ x: this.c[6], y: this.c[7] }), p;
1963
+ return d.push({ x: this.c[6], y: this.c[7] }), d;
1936
1964
  }
1937
1965
  }
1938
- const Ao = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, xo = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, sr = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
1966
+ const xo = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, wo = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, or = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
1939
1967
  function Ye(e, {
1940
1968
  domParser: t,
1941
1969
  svgPreprocessor: r,
@@ -1989,7 +2017,7 @@ function Ye(e, {
1989
2017
  iiifRenderingHints: i
1990
2018
  });
1991
2019
  }
1992
- if (Mo(e)) {
2020
+ if (Ro(e)) {
1993
2021
  const n = [];
1994
2022
  if (e.region) {
1995
2023
  const s = Ye(
@@ -2005,7 +2033,7 @@ function Ye(e, {
2005
2033
  });
2006
2034
  }
2007
2035
  if (e.type === "FragmentSelector") {
2008
- const n = Ao.exec(e.value);
2036
+ const n = xo.exec(e.value);
2009
2037
  if (n) {
2010
2038
  const o = {
2011
2039
  type: "BoxSelector",
@@ -2023,7 +2051,7 @@ function Ye(e, {
2023
2051
  iiifRenderingHints: i
2024
2052
  });
2025
2053
  }
2026
- const s = e.value.match(xo);
2054
+ const s = e.value.match(wo);
2027
2055
  if (s) {
2028
2056
  const o = {
2029
2057
  type: "TemporalSelector",
@@ -2057,8 +2085,8 @@ function Ye(e, {
2057
2085
  selectors: [],
2058
2086
  iiifRenderingHints: i
2059
2087
  });
2060
- const p = ni(l);
2061
- p && (n = p.points, u = p.shapeType, s = [
2088
+ const d = ni(l);
2089
+ d && (n = d.points, u = d.shapeType, s = [
2062
2090
  Math.min(...n.map((v) => v[0])),
2063
2091
  // llx
2064
2092
  Math.min(...n.map((v) => v[1])),
@@ -2067,9 +2095,9 @@ function Ye(e, {
2067
2095
  // urx
2068
2096
  Math.max(...n.map((v) => v[1]))
2069
2097
  // ury
2070
- ], { style: o, svg: a } = Co(p.element) ?? { svg: a });
2098
+ ], { style: o, svg: a } = Mo(d.element) ?? { svg: a });
2071
2099
  }
2072
- const d = {
2100
+ const f = {
2073
2101
  type: "SvgSelector",
2074
2102
  svg: a,
2075
2103
  svgShape: u,
@@ -2078,8 +2106,8 @@ function Ye(e, {
2078
2106
  spatial: s ? { unit: "pixel", x: s[0], y: s[1], width: s[2] - s[0], height: s[3] - s[1] } : void 0
2079
2107
  };
2080
2108
  return te({
2081
- selector: d,
2082
- selectors: [d],
2109
+ selector: f,
2110
+ selectors: [f],
2083
2111
  iiifRenderingHints: i
2084
2112
  });
2085
2113
  }
@@ -2089,7 +2117,7 @@ function Ye(e, {
2089
2117
  iiifRenderingHints: i
2090
2118
  });
2091
2119
  }
2092
- function wo(e) {
2120
+ function So(e) {
2093
2121
  const t = e.map((i) => i[0]).reduce(
2094
2122
  (i, n) => (i[n] += 1, i),
2095
2123
  { C: 0, Q: 0, L: 0, M: 0 }
@@ -2119,8 +2147,8 @@ function ni(e) {
2119
2147
  const i = r.getAttribute("d");
2120
2148
  if (!i)
2121
2149
  continue;
2122
- const n = vo(i);
2123
- return { element: r, points: So(n), shapeType: wo(n) };
2150
+ const n = go(i);
2151
+ return { element: r, points: Co(n), shapeType: So(n) };
2124
2152
  }
2125
2153
  case "circle": {
2126
2154
  const i = parseFloat(r.getAttribute("cx") ?? "0"), n = parseFloat(r.getAttribute("cy") ?? "0"), s = parseFloat(r.getAttribute("r") ?? "0");
@@ -2139,8 +2167,8 @@ function ni(e) {
2139
2167
  continue;
2140
2168
  const a = [];
2141
2169
  for (let u = 0; u <= 360; u += 12) {
2142
- const d = Math.tan(u / 360 * Math.PI), l = s * (1 - d ** 2) / (1 + d ** 2), p = o * 2 * d / (1 + d ** 2);
2143
- a.push([i + l, n + p]);
2170
+ const f = Math.tan(u / 360 * Math.PI), l = s * (1 - f ** 2) / (1 + f ** 2), d = o * 2 * f / (1 + f ** 2);
2171
+ a.push([i + l, n + d]);
2144
2172
  }
2145
2173
  return { element: r, points: a, shapeType: "ellipse" };
2146
2174
  }
@@ -2186,7 +2214,7 @@ function ni(e) {
2186
2214
  }
2187
2215
  return null;
2188
2216
  }
2189
- function So(e) {
2217
+ function Co(e) {
2190
2218
  const t = [];
2191
2219
  for (let r = 0; r < e.length; r++) {
2192
2220
  const i = t[t.length - 1] ?? [0, 0], n = e[r];
@@ -2197,7 +2225,7 @@ function So(e) {
2197
2225
  continue;
2198
2226
  case "C":
2199
2227
  t.push(
2200
- ...mo(
2228
+ ...bo(
2201
2229
  { x: i[0], y: i[1] },
2202
2230
  { x: n[1], y: n[2] },
2203
2231
  { x: n[3], y: n[4] },
@@ -2208,7 +2236,7 @@ function So(e) {
2208
2236
  continue;
2209
2237
  case "Q":
2210
2238
  t.push(
2211
- ...go(
2239
+ ...mo(
2212
2240
  { x: i[0], y: i[1] },
2213
2241
  { x: n[1], y: n[2] },
2214
2242
  { x: n[3], y: n[4] }
@@ -2220,14 +2248,14 @@ function So(e) {
2220
2248
  }
2221
2249
  return t;
2222
2250
  }
2223
- function Co(e) {
2251
+ function Mo(e) {
2224
2252
  const t = {};
2225
2253
  if (e.hasAttribute("fill") ? (t.fill = e.getAttribute("fill"), e.removeAttribute("fill")) : e.style.fill && (t.fill = e.style.fill), t.fill) {
2226
- const i = sr.exec(t.fill);
2254
+ const i = or.exec(t.fill);
2227
2255
  i && (t.fillOpacity = parseFloat(i[4]), t.fill = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
2228
2256
  }
2229
2257
  if (e.hasAttribute("fill-opacity") ? (t.fillOpacity = parseFloat(e.getAttribute("fill-opacity")), e.removeAttribute("fill-opacity")) : e.style.fillOpacity && (t.fillOpacity = parseFloat(e.style.fillOpacity)), e.hasAttribute("stroke") ? (t.stroke = e.getAttribute("stroke"), e.removeAttribute("stroke")) : e.style.stroke && (t.stroke = e.style.stroke), t.stroke) {
2230
- const i = sr.exec(t.stroke);
2258
+ const i = or.exec(t.stroke);
2231
2259
  i && (t.strokeOpacity = parseFloat(i[4]), t.stroke = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
2232
2260
  }
2233
2261
  e.hasAttribute("stroke-opacity") ? (t.strokeOpacity = parseFloat(e.getAttribute("stroke-opacity")), e.removeAttribute("stroke-opacity")) : e.style.strokeOpacity && (t.strokeOpacity = parseFloat(e.style.strokeOpacity)), e.hasAttribute("stroke-width") ? (t.strokeWidth = e.getAttribute("stroke-width"), e.removeAttribute("stroke-width")) : e.style.strokeWidth && (t.strokeWidth = e.style.strokeWidth), e.hasAttribute("stroke-dasharray") ? (t.strokeDasharray = e.getAttribute("stroke-dasharray"), e.removeAttribute("stroke-dasharray")) : e.style.strokeDasharray && (t.strokeDasharray = e.style.strokeDasharray);
@@ -2237,14 +2265,14 @@ function Co(e) {
2237
2265
  throw new Error("Could not find root SVG element");
2238
2266
  return { svg: r.outerHTML, style: Object.keys(t).length > 0 ? t : void 0 };
2239
2267
  }
2240
- function Mo(e) {
2268
+ function Ro(e) {
2241
2269
  return !!e && e.type === "iiif:ImageApiSelector" && e.type === "iiif:ImageApiSelector";
2242
2270
  }
2243
2271
  function te(e) {
2244
2272
  if (e.iiifRenderingHints) {
2245
2273
  const t = e.iiifRenderingHints;
2246
2274
  if (t.rotation) {
2247
- const r = Ro(t.rotation);
2275
+ const r = Io(t.rotation);
2248
2276
  if (r)
2249
2277
  if (e.selectors.length)
2250
2278
  for (const i of e.selectors)
@@ -2259,7 +2287,7 @@ function te(e) {
2259
2287
  delete e.iiifRenderingHints;
2260
2288
  return e;
2261
2289
  }
2262
- function Ro(e) {
2290
+ function Io(e) {
2263
2291
  let t = parseFloat(e);
2264
2292
  return t && e.startsWith("!") && (t = 360 - t), t && (t = t % 360), t !== t ? 0 : t || 0;
2265
2293
  }
@@ -2336,24 +2364,24 @@ function Re(e, t = {}) {
2336
2364
  }
2337
2365
  function si(e = {}, t = []) {
2338
2366
  const { id: r, selector: i } = e, n = be(), s = V(), o = r || n.annotation, a = Q(
2339
- (d) => o ? d.iiif.entities.Annotation[o] : void 0,
2367
+ (f) => o ? f.iiif.entities.Annotation[o] : void 0,
2340
2368
  [o]
2341
2369
  ), u = Q(
2342
- (d) => a && a.body ? a.body.map((l) => l ? l.type === "SpecificResource" ? {
2370
+ (f) => a && a.body ? a.body.map((l) => l ? l.type === "SpecificResource" ? {
2343
2371
  ...l,
2344
2372
  source: s.get(l)
2345
- } : l ? d.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
2373
+ } : l ? f.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
2346
2374
  [a]
2347
2375
  );
2348
2376
  return E(() => {
2349
2377
  if (!a)
2350
2378
  return;
2351
- const d = {
2379
+ const f = {
2352
2380
  ...a,
2353
2381
  body: u,
2354
2382
  target: Re(a.target, { typeMap: s.getState().iiif.mapping })
2355
2383
  };
2356
- return i ? i(d) : d;
2384
+ return i ? i(f) : f;
2357
2385
  }, [a, i, u, ...t]);
2358
2386
  }
2359
2387
  const oi = ({
@@ -2362,14 +2390,14 @@ const oi = ({
2362
2390
  className: r,
2363
2391
  interactive: i
2364
2392
  }) => {
2365
- const n = si({ id: e }), s = et(n, "atlas"), o = et(n, "html"), a = ei(n, ["atlas"]), u = ue(), d = E(() => fn(t, s), [t, s]);
2393
+ const n = si({ id: e }), s = et(n, "atlas"), o = et(n, "html"), a = ei(n, ["atlas"]), u = ue(), f = E(() => fn(t, s), [t, s]);
2366
2394
  return u && n && n.target && n.target.selector && n.target.selector.type === "BoxSelector" && n.target.source && (n.target.source.id === u.id || n.target.source === u.id) ? /* @__PURE__ */ x(
2367
2395
  pn,
2368
2396
  {
2369
2397
  id: n.id,
2370
2398
  isEditing: !0,
2371
2399
  region: n.target.selector.spatial,
2372
- style: d,
2400
+ style: f,
2373
2401
  className: (o == null ? void 0 : o.className) || r,
2374
2402
  interactive: !!(o != null && o.href || i),
2375
2403
  href: (o == null ? void 0 : o.href) || null,
@@ -2381,7 +2409,7 @@ const oi = ({
2381
2409
  }
2382
2410
  ) : null;
2383
2411
  };
2384
- function Io(e = {}, t = []) {
2412
+ function To(e = {}, t = []) {
2385
2413
  const { id: r, selector: i } = e, n = be(), s = r || n.annotationPage, o = Q(
2386
2414
  (a) => s ? a.iiif.entities.AnnotationPage[s] : void 0,
2387
2415
  [s]
@@ -2391,12 +2419,12 @@ function Io(e = {}, t = []) {
2391
2419
  return i ? i(o) : o;
2392
2420
  }, [o, ...t]);
2393
2421
  }
2394
- const It = ({
2422
+ const Tt = ({
2395
2423
  className: e,
2396
2424
  page: t
2397
2425
  }) => {
2398
2426
  var s;
2399
- const r = Io({ id: t.id }) || t, i = et(r, "atlas"), n = et(r, "html");
2427
+ const r = To({ id: t.id }) || t, i = et(r, "atlas"), n = et(r, "html");
2400
2428
  return Q((o) => r.id ? o.iiif.entities.AnnotationPage[r.id] : null, []), /* @__PURE__ */ x(Ke, { children: (s = r.items) == null ? void 0 : s.map((o) => /* @__PURE__ */ x(
2401
2429
  oi,
2402
2430
  {
@@ -2417,9 +2445,9 @@ function ai({
2417
2445
  children: o,
2418
2446
  selector: a,
2419
2447
  onClick: u,
2420
- enableSizes: d
2448
+ enableSizes: f
2421
2449
  }) {
2422
- var p, v;
2450
+ var d, v;
2423
2451
  const l = E(() => {
2424
2452
  if (!(!a || a.spatial.x === 0 && a.spatial.y === 0))
2425
2453
  return a.spatial;
@@ -2443,10 +2471,10 @@ function ai({
2443
2471
  imageService: t.service,
2444
2472
  thumbnail: r && r.type === "fixed" ? r : void 0
2445
2473
  },
2446
- enableSizes: d,
2474
+ enableSizes: f,
2447
2475
  x: 0,
2448
2476
  y: 0,
2449
- width: (p = t.target) == null ? void 0 : p.spatial.width,
2477
+ width: (d = t.target) == null ? void 0 : d.spatial.width,
2450
2478
  height: (v = t.target) == null ? void 0 : v.spatial.height,
2451
2479
  crop: l
2452
2480
  }
@@ -2472,14 +2500,14 @@ function ai({
2472
2500
  e + (t.service ? "server" : "no-service")
2473
2501
  );
2474
2502
  }
2475
- var To = Object.defineProperty, ko = (e, t, r) => t in e ? To(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ge = (e, t, r) => (ko(e, typeof t != "symbol" ? t + "" : t, r), r), Oo = /* @__PURE__ */ function() {
2503
+ var ko = Object.defineProperty, Oo = (e, t, r) => t in e ? ko(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ge = (e, t, r) => (Oo(e, typeof t != "symbol" ? t + "" : t, r), r), Eo = /* @__PURE__ */ function() {
2476
2504
  function e(t, r) {
2477
2505
  var i = [], n = !0, s = !1, o = void 0;
2478
2506
  try {
2479
2507
  for (var a = t[Symbol.iterator](), u; !(n = (u = a.next()).done) && (i.push(u.value), !(r && i.length === r)); n = !0)
2480
2508
  ;
2481
- } catch (d) {
2482
- s = !0, o = d;
2509
+ } catch (f) {
2510
+ s = !0, o = f;
2483
2511
  } finally {
2484
2512
  try {
2485
2513
  !n && a.return && a.return();
@@ -2500,12 +2528,12 @@ var To = Object.defineProperty, ko = (e, t, r) => t in e ? To(e, t, { enumerable
2500
2528
  }(), qe = Math.PI * 2, yt = function(e, t, r, i, n, s, o) {
2501
2529
  var a = e.x, u = e.y;
2502
2530
  a *= t, u *= r;
2503
- var d = i * a - n * u, l = n * a + i * u;
2531
+ var f = i * a - n * u, l = n * a + i * u;
2504
2532
  return {
2505
- x: d + s,
2533
+ x: f + s,
2506
2534
  y: l + o
2507
2535
  };
2508
- }, Eo = function(e, t) {
2536
+ }, Po = function(e, t) {
2509
2537
  var r = t === 1.5707963267948966 ? 0.551915024494 : t === -1.5707963267948966 ? -0.551915024494 : 1.3333333333333333 * Math.tan(t / 4), i = Math.cos(e), n = Math.sin(e), s = Math.cos(e + t), o = Math.sin(e + t);
2510
2538
  return [{
2511
2539
  x: i - n * r,
@@ -2517,16 +2545,16 @@ var To = Object.defineProperty, ko = (e, t, r) => t in e ? To(e, t, { enumerable
2517
2545
  x: s,
2518
2546
  y: o
2519
2547
  }];
2520
- }, or = function(e, t, r, i) {
2548
+ }, ar = function(e, t, r, i) {
2521
2549
  var n = e * i - t * r < 0 ? -1 : 1, s = e * r + t * i;
2522
2550
  return s > 1 && (s = 1), s < -1 && (s = -1), n * Math.acos(s);
2523
- }, Po = function(e, t, r, i, n, s, o, a, u, d, l, p) {
2524
- var v = Math.pow(n, 2), m = Math.pow(s, 2), h = Math.pow(l, 2), g = Math.pow(p, 2), b = v * m - v * g - m * h;
2551
+ }, Lo = function(e, t, r, i, n, s, o, a, u, f, l, d) {
2552
+ var v = Math.pow(n, 2), m = Math.pow(s, 2), h = Math.pow(l, 2), g = Math.pow(d, 2), b = v * m - v * g - m * h;
2525
2553
  b < 0 && (b = 0), b /= v * g + m * h, b = Math.sqrt(b) * (o === a ? -1 : 1);
2526
- var A = b * n / s * p, w = b * -s / n * l, C = d * A - u * w + (e + r) / 2, T = u * A + d * w + (t + i) / 2, j = (l - A) / n, I = (p - w) / s, L = (-l - A) / n, P = (-p - w) / s, M = or(1, 0, j, I), $ = or(j, I, L, P);
2554
+ var A = b * n / s * d, w = b * -s / n * l, C = f * A - u * w + (e + r) / 2, T = u * A + f * w + (t + i) / 2, j = (l - A) / n, I = (d - w) / s, L = (-l - A) / n, P = (-d - w) / s, M = ar(1, 0, j, I), $ = ar(j, I, L, P);
2527
2555
  return a === 0 && $ > 0 && ($ -= qe), a === 1 && $ < 0 && ($ += qe), [C, T, M, $];
2528
- }, Lo = function(e) {
2529
- var t = e.px, r = e.py, i = e.cx, n = e.cy, s = e.rx, o = e.ry, a = e.xAxisRotation, u = a === void 0 ? 0 : a, d = e.largeArcFlag, l = d === void 0 ? 0 : d, p = e.sweepFlag, v = p === void 0 ? 0 : p, m = [];
2556
+ }, Fo = function(e) {
2557
+ var t = e.px, r = e.py, i = e.cx, n = e.cy, s = e.rx, o = e.ry, a = e.xAxisRotation, u = a === void 0 ? 0 : a, f = e.largeArcFlag, l = f === void 0 ? 0 : f, d = e.sweepFlag, v = d === void 0 ? 0 : d, m = [];
2530
2558
  if (s === 0 || o === 0)
2531
2559
  return [];
2532
2560
  var h = Math.sin(u * qe / 360), g = Math.cos(u * qe / 360), b = g * (t - i) / 2 + h * (r - n) / 2, A = -h * (t - i) / 2 + g * (r - n) / 2;
@@ -2535,26 +2563,26 @@ var To = Object.defineProperty, ko = (e, t, r) => t in e ? To(e, t, { enumerable
2535
2563
  s = Math.abs(s), o = Math.abs(o);
2536
2564
  var w = Math.pow(b, 2) / Math.pow(s, 2) + Math.pow(A, 2) / Math.pow(o, 2);
2537
2565
  w > 1 && (s *= Math.sqrt(w), o *= Math.sqrt(w));
2538
- var C = Po(t, r, i, n, s, o, l, v, h, g, b, A), T = Oo(C, 4), j = T[0], I = T[1], L = T[2], P = T[3], M = Math.abs(P) / (qe / 4);
2566
+ var C = Lo(t, r, i, n, s, o, l, v, h, g, b, A), T = Eo(C, 4), j = T[0], I = T[1], L = T[2], P = T[3], M = Math.abs(P) / (qe / 4);
2539
2567
  Math.abs(1 - M) < 1e-7 && (M = 1);
2540
2568
  var $ = Math.max(Math.ceil(M), 1);
2541
2569
  P /= $;
2542
2570
  for (var ie = 0; ie < $; ie++)
2543
- m.push(Eo(L, P)), L += P;
2571
+ m.push(Po(L, P)), L += P;
2544
2572
  return m.map(function(Z) {
2545
2573
  var U = yt(Z[0], s, o, g, h, j, I), z = U.x, ee = U.y, ne = yt(Z[1], s, o, g, h, j, I), xe = ne.x, O = ne.y, W = yt(Z[2], s, o, g, h, j, I), X = W.x, de = W.y;
2546
2574
  return { x1: z, y1: ee, x2: xe, y2: O, x: X, y: de };
2547
2575
  });
2548
- }, Fo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2576
+ }, jo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2549
2577
  function ci(e) {
2550
2578
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
2551
2579
  }
2552
- var jo = Do, vt = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, $o = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
2553
- function Do(e) {
2580
+ var $o = qo, vt = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, Do = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
2581
+ function qo(e) {
2554
2582
  var t = [];
2555
- return e.replace($o, function(r, i, n) {
2583
+ return e.replace(Do, function(r, i, n) {
2556
2584
  var s = i.toLowerCase();
2557
- for (n = _o(n), s == "m" && n.length > 2 && (t.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
2585
+ for (n = Uo(n), s == "m" && n.length > 2 && (t.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
2558
2586
  if (n.length == vt[s])
2559
2587
  return n.unshift(i), t.push(n);
2560
2588
  if (n.length < vt[s])
@@ -2563,14 +2591,14 @@ function Do(e) {
2563
2591
  }
2564
2592
  }), t;
2565
2593
  }
2566
- var qo = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
2567
- function _o(e) {
2568
- var t = e.match(qo);
2594
+ var _o = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
2595
+ function Uo(e) {
2596
+ var t = e.match(_o);
2569
2597
  return t ? t.map(Number) : [];
2570
2598
  }
2571
- const Uo = /* @__PURE__ */ ci(jo);
2572
- var Vo = No;
2573
- function No(e) {
2599
+ const Vo = /* @__PURE__ */ ci($o);
2600
+ var No = Ho;
2601
+ function Ho(e) {
2574
2602
  var t = 0, r = 0, i = 0, n = 0;
2575
2603
  return e.map(function(s) {
2576
2604
  s = s.slice();
@@ -2609,10 +2637,10 @@ function No(e) {
2609
2637
  return s;
2610
2638
  });
2611
2639
  }
2612
- const Ho = /* @__PURE__ */ ci(Vo);
2613
- function Bo(e) {
2614
- const t = Uo(e), r = Ho(t);
2615
- let i, n = 0, s = 0, o = 0, a = 0, u, d, l = 0, p = 0;
2640
+ const Bo = /* @__PURE__ */ ci(No);
2641
+ function zo(e) {
2642
+ const t = Vo(e), r = Bo(t);
2643
+ let i, n = 0, s = 0, o = 0, a = 0, u, f, l = 0, d = 0;
2616
2644
  const v = [];
2617
2645
  for (let m = 0; m < r.length; m++) {
2618
2646
  let h = r[m];
@@ -2629,21 +2657,21 @@ function Bo(e) {
2629
2657
  break;
2630
2658
  case "S":
2631
2659
  {
2632
- let b = l, A = p;
2660
+ let b = l, A = d;
2633
2661
  (i === "C" || i == "S") && (b += b - o, A += A - a), h = ["C", b, A, h[1], h[2], h[3], h[4]];
2634
2662
  }
2635
2663
  break;
2636
2664
  case "T":
2637
- i === "Q" || i == "T" ? (u = l * 2 - u, d = p * 2 - d) : (u = l, d = p), h = ["Q", u, d, h[1], h[2]];
2665
+ i === "Q" || i == "T" ? (u = l * 2 - u, f = d * 2 - f) : (u = l, f = d), h = ["Q", u, f, h[1], h[2]];
2638
2666
  break;
2639
2667
  case "Q":
2640
- u = h[1], d = h[2];
2668
+ u = h[1], f = h[2];
2641
2669
  break;
2642
2670
  case "A":
2643
2671
  {
2644
- const b = Lo({
2672
+ const b = Fo({
2645
2673
  px: l,
2646
- py: p,
2674
+ py: d,
2647
2675
  cx: h[6],
2648
2676
  cy: h[7],
2649
2677
  rx: h[1],
@@ -2663,7 +2691,7 @@ function Bo(e) {
2663
2691
  h = ["L", n, s];
2664
2692
  break;
2665
2693
  }
2666
- i = g, l = h[h.length - 2], p = h[h.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (o = h[h.length - 4], a = h[h.length - 3]) : (o = l, a = p), v.push(h);
2694
+ i = g, l = h[h.length - 2], d = h[h.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (o = h[h.length - 4], a = h[h.length - 3]) : (o = l, a = d), v.push(h);
2667
2695
  }
2668
2696
  return v;
2669
2697
  }
@@ -2698,15 +2726,15 @@ function Bo(e) {
2698
2726
  * See the License for the specific language governing permissions and
2699
2727
  * limitations under the License.
2700
2728
  */
2701
- function zo(e, t, r, i = 1) {
2729
+ function Wo(e, t, r, i = 1) {
2702
2730
  return new ui(e, t, r).subdivide(i);
2703
2731
  }
2704
- function Wo(e, t, r, i, n = 1) {
2705
- return new Dt(
2732
+ function Qo(e, t, r, i, n = 1) {
2733
+ return new qt(
2706
2734
  new Float64Array([e.x, e.y, t.x, t.y, r.x, r.y, i.x, i.y])
2707
2735
  ).subdivide(n);
2708
2736
  }
2709
- function Qo(e) {
2737
+ function Yo(e) {
2710
2738
  return e.x * e.x + e.y * e.y;
2711
2739
  }
2712
2740
  function _e(e) {
@@ -2727,19 +2755,19 @@ class ui {
2727
2755
  };
2728
2756
  }
2729
2757
  mapToBasic() {
2730
- const { x: t, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: o } = this.end, a = 2 * i - t - s, u = 2 * n - r - o, d = (i - t) * a + (n - r) * u, l = (s - i) * a + (o - n) * u, p = (s - t) * u - (o - r) * a, v = d / p, m = l / p, h = Math.abs(p) / (Math.hypot(a, u) * Math.abs(m - v));
2731
- return { x0: t, x2: s, scale: h, cross: p };
2758
+ const { x: t, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: o } = this.end, a = 2 * i - t - s, u = 2 * n - r - o, f = (i - t) * a + (n - r) * u, l = (s - i) * a + (o - n) * u, d = (s - t) * u - (o - r) * a, v = f / d, m = l / d, h = Math.abs(d) / (Math.hypot(a, u) * Math.abs(m - v));
2759
+ return { x0: t, x2: s, scale: h, cross: d };
2732
2760
  }
2733
2761
  subdivide(t) {
2734
- const r = this.mapToBasic(), i = _e(r.x0), n = _e(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / t), o = Math.ceil(s), a = Pe(i), u = Pe(n), d = [0];
2762
+ const r = this.mapToBasic(), i = _e(r.x0), n = _e(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / t), o = Math.ceil(s), a = Pe(i), u = Pe(n), f = [0];
2735
2763
  for (let l = 1; l < o; l++) {
2736
- const p = (Pe(i + (n - i) * l / o) - a) / (u - a);
2737
- d.push(p);
2764
+ const d = (Pe(i + (n - i) * l / o) - a) / (u - a);
2765
+ f.push(d);
2738
2766
  }
2739
- return d.push(1), d.map((l) => this.eval(l));
2767
+ return f.push(1), f.map((l) => this.eval(l));
2740
2768
  }
2741
2769
  }
2742
- class Dt {
2770
+ class qt {
2743
2771
  /// Argument is array of coordinate values [x0, y0, x1, y1, x2, y2, x3, y3].
2744
2772
  constructor(t) {
2745
2773
  Ge(this, "c"), this.c = t;
@@ -2767,11 +2795,11 @@ class Dt {
2767
2795
  const o = (r - t) / 3, a = this.deriv(t);
2768
2796
  i[2] = n.x + o * a.x, i[3] = n.y + o * a.y;
2769
2797
  const u = this.deriv(r);
2770
- return i[4] = s.x - o * u.x, i[5] = s.y - o * u.y, i[6] = s.x, i[7] = s.y, new Dt(i);
2798
+ return i[4] = s.x - o * u.x, i[5] = s.y - o * u.y, i[6] = s.x, i[7] = s.y, new qt(i);
2771
2799
  }
2772
2800
  // Very fancy subdivision scheme
2773
2801
  subdivide(t) {
2774
- const r = 0.1 * t, i = t - r, n = Math.sqrt(i), s = Qo(this.weightsum(1, -3, 3, -1)), o = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), a = [];
2802
+ const r = 0.1 * t, i = t - r, n = Math.sqrt(i), s = Yo(this.weightsum(1, -3, 3, -1)), o = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), a = [];
2775
2803
  let u = 0;
2776
2804
  for (let h = 0; h < o; h++) {
2777
2805
  const g = h / o, b = (h + 1) / o, A = this.subsegment(g, b).midpoint_quadbez(), w = A.mapToBasic(), C = _e(w.x0), T = _e(w.x2), j = Math.sqrt(w.scale);
@@ -2787,19 +2815,19 @@ class Dt {
2787
2815
  val: I
2788
2816
  }), u += I;
2789
2817
  }
2790
- const d = 0.5 * u / n, l = Math.ceil(d), p = [{ x: this.c[0], y: this.c[1] }];
2818
+ const f = 0.5 * u / n, l = Math.ceil(f), d = [{ x: this.c[0], y: this.c[1] }];
2791
2819
  let v = 0, m = 0;
2792
2820
  for (let h = 1; h < l; h++) {
2793
2821
  const g = u * h / l;
2794
2822
  for (; v + a[m].val < g; )
2795
2823
  v += a[m].val, m++;
2796
2824
  const b = a[m].a0, A = a[m].a2, w = Pe(b), C = Pe(A), T = b + (A - b) * (g - v) / a[m].val, j = (Pe(T) - w) / (C - w);
2797
- p.push(a[m].quad.eval(j));
2825
+ d.push(a[m].quad.eval(j));
2798
2826
  }
2799
- return p.push({ x: this.c[6], y: this.c[7] }), p;
2827
+ return d.push({ x: this.c[6], y: this.c[7] }), d;
2800
2828
  }
2801
2829
  }
2802
- const Yo = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, Go = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, ar = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
2830
+ const Go = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, Jo = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, cr = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
2803
2831
  function Je(e, {
2804
2832
  domParser: t,
2805
2833
  svgPreprocessor: r,
@@ -2853,7 +2881,7 @@ function Je(e, {
2853
2881
  iiifRenderingHints: i
2854
2882
  });
2855
2883
  }
2856
- if (Xo(e)) {
2884
+ if (ea(e)) {
2857
2885
  const n = [];
2858
2886
  if (e.region) {
2859
2887
  const s = Je(
@@ -2869,7 +2897,7 @@ function Je(e, {
2869
2897
  });
2870
2898
  }
2871
2899
  if (e.type === "FragmentSelector") {
2872
- const n = Yo.exec(e.value);
2900
+ const n = Go.exec(e.value);
2873
2901
  if (n) {
2874
2902
  const o = {
2875
2903
  type: "BoxSelector",
@@ -2887,7 +2915,7 @@ function Je(e, {
2887
2915
  iiifRenderingHints: i
2888
2916
  });
2889
2917
  }
2890
- const s = e.value.match(Go);
2918
+ const s = e.value.match(Jo);
2891
2919
  if (s) {
2892
2920
  const o = {
2893
2921
  type: "TemporalSelector",
@@ -2921,8 +2949,8 @@ function Je(e, {
2921
2949
  selectors: [],
2922
2950
  iiifRenderingHints: i
2923
2951
  });
2924
- const p = li(l);
2925
- p && (n = p.points, u = p.shapeType, s = [
2952
+ const d = li(l);
2953
+ d && (n = d.points, u = d.shapeType, s = [
2926
2954
  Math.min(...n.map((v) => v[0])),
2927
2955
  // llx
2928
2956
  Math.min(...n.map((v) => v[1])),
@@ -2931,9 +2959,9 @@ function Je(e, {
2931
2959
  // urx
2932
2960
  Math.max(...n.map((v) => v[1]))
2933
2961
  // ury
2934
- ], { style: o, svg: a } = Zo(p.element) ?? { svg: a });
2962
+ ], { style: o, svg: a } = Xo(d.element) ?? { svg: a });
2935
2963
  }
2936
- const d = {
2964
+ const f = {
2937
2965
  type: "SvgSelector",
2938
2966
  svg: a,
2939
2967
  svgShape: u,
@@ -2942,8 +2970,8 @@ function Je(e, {
2942
2970
  spatial: s ? { unit: "pixel", x: s[0], y: s[1], width: s[2] - s[0], height: s[3] - s[1] } : void 0
2943
2971
  };
2944
2972
  return re({
2945
- selector: d,
2946
- selectors: [d],
2973
+ selector: f,
2974
+ selectors: [f],
2947
2975
  iiifRenderingHints: i
2948
2976
  });
2949
2977
  }
@@ -2953,7 +2981,7 @@ function Je(e, {
2953
2981
  iiifRenderingHints: i
2954
2982
  });
2955
2983
  }
2956
- function Jo(e) {
2984
+ function Ko(e) {
2957
2985
  const t = e.map((i) => i[0]).reduce(
2958
2986
  (i, n) => (i[n] += 1, i),
2959
2987
  { C: 0, Q: 0, L: 0, M: 0 }
@@ -2983,8 +3011,8 @@ function li(e) {
2983
3011
  const i = r.getAttribute("d");
2984
3012
  if (!i)
2985
3013
  continue;
2986
- const n = Bo(i);
2987
- return { element: r, points: Ko(n), shapeType: Jo(n) };
3014
+ const n = zo(i);
3015
+ return { element: r, points: Zo(n), shapeType: Ko(n) };
2988
3016
  }
2989
3017
  case "circle": {
2990
3018
  const i = parseFloat(r.getAttribute("cx") ?? "0"), n = parseFloat(r.getAttribute("cy") ?? "0"), s = parseFloat(r.getAttribute("r") ?? "0");
@@ -3003,8 +3031,8 @@ function li(e) {
3003
3031
  continue;
3004
3032
  const a = [];
3005
3033
  for (let u = 0; u <= 360; u += 12) {
3006
- const d = Math.tan(u / 360 * Math.PI), l = s * (1 - d ** 2) / (1 + d ** 2), p = o * 2 * d / (1 + d ** 2);
3007
- a.push([i + l, n + p]);
3034
+ const f = Math.tan(u / 360 * Math.PI), l = s * (1 - f ** 2) / (1 + f ** 2), d = o * 2 * f / (1 + f ** 2);
3035
+ a.push([i + l, n + d]);
3008
3036
  }
3009
3037
  return { element: r, points: a, shapeType: "ellipse" };
3010
3038
  }
@@ -3050,7 +3078,7 @@ function li(e) {
3050
3078
  }
3051
3079
  return null;
3052
3080
  }
3053
- function Ko(e) {
3081
+ function Zo(e) {
3054
3082
  const t = [];
3055
3083
  for (let r = 0; r < e.length; r++) {
3056
3084
  const i = t[t.length - 1] ?? [0, 0], n = e[r];
@@ -3061,7 +3089,7 @@ function Ko(e) {
3061
3089
  continue;
3062
3090
  case "C":
3063
3091
  t.push(
3064
- ...Wo(
3092
+ ...Qo(
3065
3093
  { x: i[0], y: i[1] },
3066
3094
  { x: n[1], y: n[2] },
3067
3095
  { x: n[3], y: n[4] },
@@ -3072,7 +3100,7 @@ function Ko(e) {
3072
3100
  continue;
3073
3101
  case "Q":
3074
3102
  t.push(
3075
- ...zo(
3103
+ ...Wo(
3076
3104
  { x: i[0], y: i[1] },
3077
3105
  { x: n[1], y: n[2] },
3078
3106
  { x: n[3], y: n[4] }
@@ -3084,14 +3112,14 @@ function Ko(e) {
3084
3112
  }
3085
3113
  return t;
3086
3114
  }
3087
- function Zo(e) {
3115
+ function Xo(e) {
3088
3116
  const t = {};
3089
3117
  if (e.hasAttribute("fill") ? (t.fill = e.getAttribute("fill"), e.removeAttribute("fill")) : e.style.fill && (t.fill = e.style.fill), t.fill) {
3090
- const i = ar.exec(t.fill);
3118
+ const i = cr.exec(t.fill);
3091
3119
  i && (t.fillOpacity = parseFloat(i[4]), t.fill = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
3092
3120
  }
3093
3121
  if (e.hasAttribute("fill-opacity") ? (t.fillOpacity = parseFloat(e.getAttribute("fill-opacity")), e.removeAttribute("fill-opacity")) : e.style.fillOpacity && (t.fillOpacity = parseFloat(e.style.fillOpacity)), e.hasAttribute("stroke") ? (t.stroke = e.getAttribute("stroke"), e.removeAttribute("stroke")) : e.style.stroke && (t.stroke = e.style.stroke), t.stroke) {
3094
- const i = ar.exec(t.stroke);
3122
+ const i = cr.exec(t.stroke);
3095
3123
  i && (t.strokeOpacity = parseFloat(i[4]), t.stroke = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
3096
3124
  }
3097
3125
  e.hasAttribute("stroke-opacity") ? (t.strokeOpacity = parseFloat(e.getAttribute("stroke-opacity")), e.removeAttribute("stroke-opacity")) : e.style.strokeOpacity && (t.strokeOpacity = parseFloat(e.style.strokeOpacity)), e.hasAttribute("stroke-width") ? (t.strokeWidth = e.getAttribute("stroke-width"), e.removeAttribute("stroke-width")) : e.style.strokeWidth && (t.strokeWidth = e.style.strokeWidth), e.hasAttribute("stroke-dasharray") ? (t.strokeDasharray = e.getAttribute("stroke-dasharray"), e.removeAttribute("stroke-dasharray")) : e.style.strokeDasharray && (t.strokeDasharray = e.style.strokeDasharray);
@@ -3101,14 +3129,14 @@ function Zo(e) {
3101
3129
  throw new Error("Could not find root SVG element");
3102
3130
  return { svg: r.outerHTML, style: Object.keys(t).length > 0 ? t : void 0 };
3103
3131
  }
3104
- function Xo(e) {
3132
+ function ea(e) {
3105
3133
  return !!e && e.type === "iiif:ImageApiSelector" && e.type === "iiif:ImageApiSelector";
3106
3134
  }
3107
3135
  function re(e) {
3108
3136
  if (e.iiifRenderingHints) {
3109
3137
  const t = e.iiifRenderingHints;
3110
3138
  if (t.rotation) {
3111
- const r = ea(t.rotation);
3139
+ const r = ta(t.rotation);
3112
3140
  if (r)
3113
3141
  if (e.selectors.length)
3114
3142
  for (const i of e.selectors)
@@ -3123,7 +3151,7 @@ function re(e) {
3123
3151
  delete e.iiifRenderingHints;
3124
3152
  return e;
3125
3153
  }
3126
- function ea(e) {
3154
+ function ta(e) {
3127
3155
  let t = parseFloat(e);
3128
3156
  return t && e.startsWith("!") && (t = 360 - t), t && (t = t % 360), t !== t ? 0 : t || 0;
3129
3157
  }
@@ -3198,11 +3226,11 @@ function je(e, t = {}) {
3198
3226
  selectors: []
3199
3227
  };
3200
3228
  }
3201
- var ta = Object.defineProperty, ra = (e, t, r) => t in e ? ta(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, cr = (e, t, r) => (ra(e, typeof t != "symbol" ? t + "" : t, r), r);
3202
- function ia(e) {
3229
+ var ra = Object.defineProperty, ia = (e, t, r) => t in e ? ra(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ur = (e, t, r) => (ia(e, typeof t != "symbol" ? t + "" : t, r), r);
3230
+ function na(e) {
3203
3231
  return Array.isArray(e) ? e : e ? [e] : [];
3204
3232
  }
3205
- const ur = [
3233
+ const lr = [
3206
3234
  "sc:Collection",
3207
3235
  "sc:Manifest",
3208
3236
  "sc:Canvas",
@@ -3215,7 +3243,7 @@ const ur = [
3215
3243
  "Service",
3216
3244
  "ContentResource"
3217
3245
  ];
3218
- function na(e) {
3246
+ function sa(e) {
3219
3247
  if (typeof e > "u" || e === null)
3220
3248
  throw new Error("Null or undefined is not a valid entity.");
3221
3249
  if (Array.isArray(e))
@@ -3223,9 +3251,9 @@ function na(e) {
3223
3251
  if (typeof e != "object")
3224
3252
  throw new Error(`${typeof e} is not a valid entity`);
3225
3253
  if (typeof e["@type"] == "string") {
3226
- const t = ur.indexOf(e["@type"]);
3254
+ const t = lr.indexOf(e["@type"]);
3227
3255
  if (t !== -1)
3228
- return ur[t];
3256
+ return lr[t];
3229
3257
  }
3230
3258
  if (e.profile)
3231
3259
  return "Service";
@@ -3233,9 +3261,9 @@ function na(e) {
3233
3261
  return "ContentResource";
3234
3262
  throw new Error("Resource type is not known");
3235
3263
  }
3236
- class qt {
3264
+ class _t {
3237
3265
  constructor(t, r = {}) {
3238
- cr(this, "traversals"), cr(this, "options"), this.traversals = {
3266
+ ur(this, "traversals"), ur(this, "options"), this.traversals = {
3239
3267
  collection: [],
3240
3268
  manifest: [],
3241
3269
  canvas: [],
@@ -3256,7 +3284,7 @@ class qt {
3256
3284
  };
3257
3285
  }
3258
3286
  static all(t) {
3259
- return new qt({
3287
+ return new _t({
3260
3288
  collection: [t],
3261
3289
  manifest: [t],
3262
3290
  canvas: [t],
@@ -3384,7 +3412,7 @@ class qt {
3384
3412
  traverseUnknown(t) {
3385
3413
  if (!t["@type"] || typeof t == "string")
3386
3414
  return t;
3387
- switch (na(t)) {
3415
+ switch (sa(t)) {
3388
3416
  case "sc:Collection":
3389
3417
  return this.traverseCollection(t);
3390
3418
  case "sc:Manifest":
@@ -3457,7 +3485,7 @@ class qt {
3457
3485
  }, t);
3458
3486
  }
3459
3487
  }
3460
- const sa = "http://library.stanford.edu/iiif/image-api/compliance.html#level0", fi = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", pi = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", oa = "http://library.stanford.edu/iiif/image-api/conformance.html#level0", di = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", hi = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", aa = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", yi = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", vi = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", ca = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", gi = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", mi = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", ua = "http://iiif.io/api/image/1/level0.json", la = "http://iiif.io/api/image/1/profiles/level0.json", bi = "http://iiif.io/api/image/1/level1.json", Ai = "http://iiif.io/api/image/1/profiles/level1.json", xi = "http://iiif.io/api/image/1/level2.json", wi = "http://iiif.io/api/image/1/profiles/level2.json", fa = "http://iiif.io/api/image/2/level0.json", pa = "http://iiif.io/api/image/2/profiles/level0.json", Si = "http://iiif.io/api/image/2/level1.json", Ci = "http://iiif.io/api/image/2/profiles/level1.json", Mi = "http://iiif.io/api/image/2/level2.json", Ri = "http://iiif.io/api/image/2/profiles/level2.json", da = "level0", Ii = "level1", Ti = "level2", ha = "http://iiif.io/api/image/2/level0", ki = "http://iiif.io/api/image/2/level1", Oi = "http://iiif.io/api/image/2/level2", ya = [
3488
+ const oa = "http://library.stanford.edu/iiif/image-api/compliance.html#level0", fi = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", pi = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", aa = "http://library.stanford.edu/iiif/image-api/conformance.html#level0", di = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", hi = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", ca = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", yi = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", vi = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", ua = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", gi = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", mi = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", la = "http://iiif.io/api/image/1/level0.json", fa = "http://iiif.io/api/image/1/profiles/level0.json", bi = "http://iiif.io/api/image/1/level1.json", Ai = "http://iiif.io/api/image/1/profiles/level1.json", xi = "http://iiif.io/api/image/1/level2.json", wi = "http://iiif.io/api/image/1/profiles/level2.json", pa = "http://iiif.io/api/image/2/level0.json", da = "http://iiif.io/api/image/2/profiles/level0.json", Si = "http://iiif.io/api/image/2/level1.json", Ci = "http://iiif.io/api/image/2/profiles/level1.json", Mi = "http://iiif.io/api/image/2/level2.json", Ri = "http://iiif.io/api/image/2/profiles/level2.json", ha = "level0", Ii = "level1", Ti = "level2", ya = "http://iiif.io/api/image/2/level0", ki = "http://iiif.io/api/image/2/level1", Oi = "http://iiif.io/api/image/2/level2", va = [
3461
3489
  ki,
3462
3490
  Oi,
3463
3491
  fi,
@@ -3478,35 +3506,35 @@ const sa = "http://library.stanford.edu/iiif/image-api/compliance.html#level0",
3478
3506
  Ri,
3479
3507
  Ii,
3480
3508
  Ti
3481
- ], va = [
3482
- ha,
3509
+ ], ga = [
3510
+ ya,
3483
3511
  ki,
3484
3512
  Oi,
3485
- sa,
3513
+ oa,
3486
3514
  fi,
3487
3515
  pi,
3488
- oa,
3516
+ aa,
3489
3517
  di,
3490
3518
  hi,
3491
- aa,
3519
+ ca,
3492
3520
  yi,
3493
3521
  vi,
3494
- ca,
3522
+ ua,
3495
3523
  gi,
3496
3524
  mi,
3497
- ua,
3498
3525
  la,
3526
+ fa,
3499
3527
  bi,
3500
3528
  Ai,
3501
3529
  xi,
3502
3530
  wi,
3503
- fa,
3504
3531
  pa,
3532
+ da,
3505
3533
  Si,
3506
3534
  Ci,
3507
3535
  Mi,
3508
3536
  Ri,
3509
- da,
3537
+ ha,
3510
3538
  Ii,
3511
3539
  Ti
3512
3540
  ];
@@ -3515,7 +3543,7 @@ function le(e) {
3515
3543
  (typeof e[t] > "u" || e[t] === null) && delete e[t];
3516
3544
  return e;
3517
3545
  }
3518
- const Tt = {
3546
+ const kt = {
3519
3547
  attributionLabel: "Attribution",
3520
3548
  lang: "none",
3521
3549
  providerId: "http://example.org/provider",
@@ -3542,14 +3570,14 @@ function Ie(e, t = "none") {
3542
3570
  function Ei(e) {
3543
3571
  if (Array.isArray(e))
3544
3572
  return Ei(e.find((t) => typeof t == "string"));
3545
- if (va.indexOf(e) !== -1)
3573
+ if (ga.indexOf(e) !== -1)
3546
3574
  return "level2";
3547
- if (ya.indexOf(e) !== -1)
3575
+ if (va.indexOf(e) !== -1)
3548
3576
  return "level1";
3549
3577
  if (typeof e == "string")
3550
3578
  return e;
3551
3579
  }
3552
- function ga(e) {
3580
+ function ma(e) {
3553
3581
  const t = Array.isArray(e) ? e : [e];
3554
3582
  for (const r of t)
3555
3583
  switch (r) {
@@ -3563,7 +3591,7 @@ function ga(e) {
3563
3591
  return "ImageApiSelector";
3564
3592
  }
3565
3593
  }
3566
- function ma(e) {
3594
+ function ba(e) {
3567
3595
  switch (e) {
3568
3596
  case "http://iiif.io/api/image/2/level0.json":
3569
3597
  case "http://iiif.io/api/image/2/level1.json":
@@ -3592,24 +3620,24 @@ function ma(e) {
3592
3620
  return "AutoCompleteService1";
3593
3621
  }
3594
3622
  }
3595
- function lr(e) {
3623
+ function fr(e) {
3596
3624
  for (const t of ["sc", "oa", "dcterms", "dctypes", "iiif"])
3597
3625
  if (e.startsWith(`${t}:`))
3598
3626
  return e.slice(t.length + 1);
3599
3627
  return e;
3600
3628
  }
3601
- const ba = ["Collection", "Manifest", "Annotation", "AnnotationPage", "Range", "Service"];
3602
- function _t(e) {
3629
+ const Aa = ["Collection", "Manifest", "Annotation", "AnnotationPage", "Range", "Service"];
3630
+ function Ut(e) {
3603
3631
  const t = e["@id"] || e.id;
3604
3632
  let r = e["@type"] || e.type;
3605
3633
  const i = e.profile || void 0, n = e["@context"] || void 0;
3606
3634
  if (i) {
3607
- const s = ma(i);
3635
+ const s = ba(i);
3608
3636
  if (s)
3609
3637
  return s;
3610
3638
  }
3611
3639
  if (n) {
3612
- const s = ga(n);
3640
+ const s = ma(n);
3613
3641
  if (s)
3614
3642
  return s;
3615
3643
  }
@@ -3635,7 +3663,7 @@ function _t(e) {
3635
3663
  return "TextualBody";
3636
3664
  }
3637
3665
  }
3638
- if (r && ba.indexOf(r) !== -1)
3666
+ if (r && Aa.indexOf(r) !== -1)
3639
3667
  return r;
3640
3668
  if (e.format) {
3641
3669
  if (e.format.startsWith("image/"))
@@ -3647,16 +3675,16 @@ function _t(e) {
3647
3675
  }
3648
3676
  return t && (t.endsWith(".jpg") || t.endsWith(".png") || t.endsWith(".jpeg")) ? "Image" : r || "unknown";
3649
3677
  }
3650
- const Aa = /http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;
3651
- function xa(e) {
3652
- const t = e.match(Aa);
3678
+ const xa = /http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;
3679
+ function wa(e) {
3680
+ const t = e.match(xa);
3653
3681
  return t ? t[0] : e;
3654
3682
  }
3655
- function wa(e, t = "Rights/License", r = "none") {
3683
+ function Sa(e, t = "Rights/License", r = "none") {
3656
3684
  let i = null;
3657
3685
  const n = [], s = Array.isArray(e) ? e : [e];
3658
3686
  for (const o of s) {
3659
- const a = o ? xa(o) : void 0;
3687
+ const a = o ? wa(o) : void 0;
3660
3688
  if (a && (a.indexOf("creativecommons.org") !== -1 || a.indexOf("rightsstatements.org") !== -1)) {
3661
3689
  a.startsWith("https://") ? i = `http://${a.slice(8)}` : i = a;
3662
3690
  continue;
@@ -3668,7 +3696,7 @@ function wa(e, t = "Rights/License", r = "none") {
3668
3696
  }
3669
3697
  return [i, n];
3670
3698
  }
3671
- const Sa = [
3699
+ const Ca = [
3672
3700
  "http://iiif.io/api/presentation/2/context.json",
3673
3701
  "http://iiif.io/api/image/2/context.json",
3674
3702
  "http://iiif.io/api/image/1/context.json",
@@ -3679,34 +3707,34 @@ const Sa = [
3679
3707
  "http://iiif.io/api/auth/0/context.json",
3680
3708
  "http://iiif.io/api/annex/openannotation/context.json"
3681
3709
  ];
3682
- function Ca(e) {
3710
+ function Ma(e) {
3683
3711
  if (e) {
3684
3712
  const t = Array.isArray(e) ? e : [e], r = [];
3685
3713
  for (const i of t)
3686
- i === "http://iiif.io/api/presentation/2/context.json" && r.push("http://iiif.io/api/presentation/3/context.json"), Sa.indexOf(i) === -1 && r.push(i);
3714
+ i === "http://iiif.io/api/presentation/2/context.json" && r.push("http://iiif.io/api/presentation/3/context.json"), Ca.indexOf(i) === -1 && r.push(i);
3687
3715
  if (t.length)
3688
3716
  return r.length === 1 ? r[0] : r;
3689
3717
  }
3690
3718
  }
3691
- function Ma(e) {
3719
+ function Ra(e) {
3692
3720
  return e ? e.map((t) => ({
3693
3721
  label: Ie(t.label),
3694
3722
  value: Ie(t.value)
3695
3723
  })) : [];
3696
3724
  }
3697
- let fr = 0;
3725
+ let pr = 0;
3698
3726
  function Pi(e, t) {
3699
3727
  const r = encodeURI(e.id || e["@id"] || "").trim();
3700
- return r && t ? `${r}/${t}` : r || (fr++, `http://example.org/${e["@type"]}${t ? `/${t}` : ""}/${fr}`);
3728
+ return r && t ? `${r}/${t}` : r || (pr++, `http://example.org/${e["@type"]}${t ? `/${t}` : ""}/${pr}`);
3701
3729
  }
3702
3730
  function fe(e) {
3703
3731
  const t = [...e.behavior || []];
3704
3732
  e.viewingHint && t.push(e.viewingHint);
3705
3733
  let r;
3706
- return Array.isArray(e.motivation) ? r = e.motivation.map(lr) : e.motivation && (r = lr(e.motivation)), {
3707
- "@context": e["@context"] ? Ca(e["@context"]) : void 0,
3734
+ return Array.isArray(e.motivation) ? r = e.motivation.map(fr) : e.motivation && (r = fr(e.motivation)), {
3735
+ "@context": e["@context"] ? Ma(e["@context"]) : void 0,
3708
3736
  id: (e["@id"] || Pi(e)).trim(),
3709
- type: _t(e),
3737
+ type: Ut(e),
3710
3738
  behavior: t.length ? t : void 0,
3711
3739
  height: e.height ? e.height : void 0,
3712
3740
  width: e.width ? e.width : void 0,
@@ -3719,24 +3747,24 @@ function fe(e) {
3719
3747
  };
3720
3748
  }
3721
3749
  function pe(e) {
3722
- const [t, r] = wa(e.license), i = [...e.metadata ? Ma(e.metadata) : [], ...r];
3750
+ const [t, r] = Sa(e.license), i = [...e.metadata ? Ra(e.metadata) : [], ...r];
3723
3751
  return {
3724
3752
  rights: t,
3725
3753
  metadata: i.length ? i : void 0,
3726
3754
  label: e.label ? Ie(e.label) : void 0,
3727
3755
  requiredStatement: e.attribution ? {
3728
- label: Ie(Tt.attributionLabel),
3756
+ label: Ie(kt.attributionLabel),
3729
3757
  value: Ie(e.attribution)
3730
3758
  } : void 0,
3731
3759
  navDate: e.navDate,
3732
3760
  summary: e.description ? Ie(e.description) : void 0,
3733
- thumbnail: Ra(e.thumbnail)
3761
+ thumbnail: Ia(e.thumbnail)
3734
3762
  };
3735
3763
  }
3736
- function Ra(e) {
3764
+ function Ia(e) {
3737
3765
  return e && (Array.isArray(e) ? e : [e]).map((t) => typeof t == "string" ? { id: t, type: "Image" } : (t.type === "unknown" && (t.type = "Image"), t));
3738
3766
  }
3739
- function Ia(e) {
3767
+ function Ta(e) {
3740
3768
  if (!e.within)
3741
3769
  return;
3742
3770
  const t = Array.isArray(e.within) ? e.within : [e.within], r = [];
@@ -3751,7 +3779,7 @@ function Ia(e) {
3751
3779
  } else
3752
3780
  i["@id"] && r.push({
3753
3781
  id: i["@id"],
3754
- type: _t(i)
3782
+ type: Ut(i)
3755
3783
  });
3756
3784
  return r.length ? r : void 0;
3757
3785
  }
@@ -3760,29 +3788,29 @@ function Ae(e) {
3760
3788
  return {
3761
3789
  provider: e.logo || t.length ? [
3762
3790
  {
3763
- id: Tt.providerId,
3791
+ id: kt.providerId,
3764
3792
  type: "Agent",
3765
3793
  homepage: t.length ? [t[0]] : void 0,
3766
3794
  logo: e.logo ? Array.isArray(e.logo) ? e.logo : [e.logo] : void 0,
3767
- label: Ie(Tt.providerName)
3795
+ label: Ie(kt.providerName)
3768
3796
  }
3769
3797
  ] : void 0,
3770
- partOf: Ia(e),
3798
+ partOf: Ta(e),
3771
3799
  rendering: e.rendering,
3772
3800
  seeAlso: e.seeAlso,
3773
3801
  start: e.startCanvas,
3774
- service: e.service ? ia(e.service) : void 0,
3802
+ service: e.service ? na(e.service) : void 0,
3775
3803
  supplementary: r ? [r] : void 0
3776
3804
  };
3777
3805
  }
3778
- function Ta(e) {
3806
+ function ka(e) {
3779
3807
  return {
3780
3808
  chars: e.chars,
3781
3809
  format: e.format ? e.format : void 0,
3782
3810
  language: e.language
3783
3811
  };
3784
3812
  }
3785
- function ka(e) {
3813
+ function Oa(e) {
3786
3814
  return le({
3787
3815
  ...fe(e),
3788
3816
  ...pe(e),
@@ -3790,7 +3818,7 @@ function ka(e) {
3790
3818
  items: e.members
3791
3819
  });
3792
3820
  }
3793
- function Oa(e) {
3821
+ function Ea(e) {
3794
3822
  const t = [], r = [];
3795
3823
  let i;
3796
3824
  for (const s of e.sequences || [])
@@ -3805,7 +3833,7 @@ function Oa(e) {
3805
3833
  structures: e.structures
3806
3834
  });
3807
3835
  }
3808
- function Ea(e) {
3836
+ function Pa(e) {
3809
3837
  return le({
3810
3838
  ...fe(e),
3811
3839
  ...pe(e),
@@ -3820,7 +3848,7 @@ function Ea(e) {
3820
3848
  ] : void 0
3821
3849
  });
3822
3850
  }
3823
- function Pa(e) {
3851
+ function La(e) {
3824
3852
  return le({
3825
3853
  ...fe(e),
3826
3854
  ...pe(e),
@@ -3828,7 +3856,7 @@ function Pa(e) {
3828
3856
  items: e.resources && e.resources.length ? e.resources : void 0
3829
3857
  });
3830
3858
  }
3831
- function La(e) {
3859
+ function Fa(e) {
3832
3860
  return !e.canvases || e.canvases.length === 0 ? {
3833
3861
  canvases: [],
3834
3862
  behavior: []
@@ -3838,7 +3866,7 @@ function La(e) {
3838
3866
  startCanvas: e.startCanvas
3839
3867
  };
3840
3868
  }
3841
- function Fa(e) {
3869
+ function ja(e) {
3842
3870
  function t(r) {
3843
3871
  if (Array.isArray(r)) {
3844
3872
  if (r.length > 1)
@@ -3860,7 +3888,7 @@ function Fa(e) {
3860
3888
  return {
3861
3889
  type: "SpecificResource",
3862
3890
  source: i,
3863
- selector: Ot(r.selector)
3891
+ selector: Et(r.selector)
3864
3892
  };
3865
3893
  } else
3866
3894
  return encodeURI(r["@id"]).trim();
@@ -3870,19 +3898,19 @@ function Fa(e) {
3870
3898
  ...pe(e),
3871
3899
  ...Ae(e),
3872
3900
  target: t(e.on),
3873
- body: Array.isArray(e.resource) ? e.resource.map(kt) : kt(e.resource)
3901
+ body: Array.isArray(e.resource) ? e.resource.map(Ot) : Ot(e.resource)
3874
3902
  });
3875
3903
  }
3876
- function kt(e) {
3904
+ function Ot(e) {
3877
3905
  const t = e;
3878
3906
  return le({
3879
3907
  ...fe(t),
3880
3908
  ...pe(t),
3881
3909
  ...Ae(t),
3882
- ...Ta(t)
3910
+ ...ka(t)
3883
3911
  });
3884
3912
  }
3885
- function ja(e) {
3913
+ function $a(e) {
3886
3914
  const t = [];
3887
3915
  return e.default && e.default !== "rdf:nil" && t.push(e.default), e.item && e.item !== "rdf:nil" && t.push(...e.item), {
3888
3916
  ...fe(e),
@@ -3890,7 +3918,7 @@ function ja(e) {
3890
3918
  items: t
3891
3919
  };
3892
3920
  }
3893
- function $a(e) {
3921
+ function Da(e) {
3894
3922
  return le({
3895
3923
  ...fe(e),
3896
3924
  ...pe(e),
@@ -3898,34 +3926,34 @@ function $a(e) {
3898
3926
  items: e.members
3899
3927
  });
3900
3928
  }
3901
- function Da(e) {
3929
+ function qa(e) {
3902
3930
  const { "@id": t, "@type": r, "@context": i, profile: n, ...s } = e, o = {};
3903
- return t && (o["@id"] = t), o["@type"] = _t(e), o["@type"] === "unknown" && (i && i.length && (o["@context"] = i), o["@type"] = "Service"), n && (o.profile = Ei(n)), le({
3931
+ return t && (o["@id"] = t), o["@type"] = Ut(e), o["@type"] === "unknown" && (i && i.length && (o["@context"] = i), o["@type"] = "Service"), n && (o.profile = Ei(n)), le({
3904
3932
  ...o,
3905
3933
  ...s
3906
3934
  });
3907
3935
  }
3908
- function qa(e) {
3936
+ function _a(e) {
3909
3937
  return le({
3910
3938
  ...fe(e),
3911
3939
  ...pe(e),
3912
3940
  ...Ae(e)
3913
3941
  });
3914
3942
  }
3915
- new qt({
3916
- collection: [ka],
3917
- manifest: [Oa],
3918
- canvas: [Ea],
3919
- annotationList: [Pa],
3920
- sequence: [La],
3921
- annotation: [Fa],
3922
- contentResource: [kt],
3923
- choice: [ja],
3924
- range: [$a],
3925
- service: [Da],
3926
- layer: [qa]
3943
+ new _t({
3944
+ collection: [Oa],
3945
+ manifest: [Ea],
3946
+ canvas: [Pa],
3947
+ annotationList: [La],
3948
+ sequence: [Fa],
3949
+ annotation: [ja],
3950
+ contentResource: [Ot],
3951
+ choice: [$a],
3952
+ range: [Da],
3953
+ service: [qa],
3954
+ layer: [_a]
3927
3955
  });
3928
- function Ot(e) {
3956
+ function Et(e) {
3929
3957
  if ((Array.isArray(e["@type"]) && e["@type"].includes("oa:SvgSelector") || e["@type"] == "oa:SvgSelector") && ("chars" in e || "value" in e))
3930
3958
  return {
3931
3959
  type: "SvgSelector",
@@ -3938,9 +3966,9 @@ function Ot(e) {
3938
3966
  };
3939
3967
  if (e["@type"] === "oa:Choice")
3940
3968
  return [
3941
- Ot(e.default),
3969
+ Et(e.default),
3942
3970
  ...(Array.isArray(e.item) ? e.item : [e.item]).map(
3943
- Ot
3971
+ Et
3944
3972
  )
3945
3973
  ];
3946
3974
  if (e["@type"] == "iiif:ImageApiSelector")
@@ -3951,13 +3979,13 @@ function Ot(e) {
3951
3979
  };
3952
3980
  throw new Error(`Unsupported selector type: ${e["@type"]}`);
3953
3981
  }
3954
- var pr = { exports: {} };
3982
+ var dr = { exports: {} };
3955
3983
  (function(e, t) {
3956
3984
  var r = Object.defineProperty, i = (s, o, a) => o in s ? r(s, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[o] = a, n = (s, o, a) => (i(s, typeof o != "symbol" ? o + "" : o, a), a);
3957
3985
  (function(s, o) {
3958
3986
  o(t);
3959
- })(Fo, function(s) {
3960
- const o = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", a = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", u = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", d = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", l = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", p = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", v = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", m = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", h = "http://iiif.io/api/image/1/level1.json", g = "http://iiif.io/api/image/1/profiles/level1.json", b = "http://iiif.io/api/image/1/level2.json", A = "http://iiif.io/api/image/1/profiles/level2.json", w = "http://iiif.io/api/image/2/level1.json", C = "http://iiif.io/api/image/2/profiles/level1.json", T = "http://iiif.io/api/image/2/level2.json", j = "http://iiif.io/api/image/2/profiles/level2.json", I = "level1", L = "level2", P = "http://iiif.io/api/image/2/level1", M = "http://iiif.io/api/image/2/level2", $ = [P, M, o, a, u, d, l, p, v, m, h, g, b, A, w, C, T, j, I, L], ie = ["http://iiif.io/api/image/2/level0", P, M, "http://library.stanford.edu/iiif/image-api/compliance.html#level0", o, a, "http://library.stanford.edu/iiif/image-api/conformance.html#level0", u, d, "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", l, p, "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", v, m, "http://iiif.io/api/image/1/level0.json", "http://iiif.io/api/image/1/profiles/level0.json", h, g, b, A, "http://iiif.io/api/image/2/level0.json", "http://iiif.io/api/image/2/profiles/level0.json", w, C, T, j, "level0", I, L], Z = ["sc:Collection", "sc:Manifest", "sc:Canvas", "sc:AnnotationList", "oa:Annotation", "sc:Range", "sc:Layer", "sc:Sequence", "oa:Choice", "Service", "ContentResource"];
3987
+ })(jo, function(s) {
3988
+ const o = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", a = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", u = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", f = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", l = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", d = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", v = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", m = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", h = "http://iiif.io/api/image/1/level1.json", g = "http://iiif.io/api/image/1/profiles/level1.json", b = "http://iiif.io/api/image/1/level2.json", A = "http://iiif.io/api/image/1/profiles/level2.json", w = "http://iiif.io/api/image/2/level1.json", C = "http://iiif.io/api/image/2/profiles/level1.json", T = "http://iiif.io/api/image/2/level2.json", j = "http://iiif.io/api/image/2/profiles/level2.json", I = "level1", L = "level2", P = "http://iiif.io/api/image/2/level1", M = "http://iiif.io/api/image/2/level2", $ = [P, M, o, a, u, f, l, d, v, m, h, g, b, A, w, C, T, j, I, L], ie = ["http://iiif.io/api/image/2/level0", P, M, "http://library.stanford.edu/iiif/image-api/compliance.html#level0", o, a, "http://library.stanford.edu/iiif/image-api/conformance.html#level0", u, f, "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", l, d, "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", v, m, "http://iiif.io/api/image/1/level0.json", "http://iiif.io/api/image/1/profiles/level0.json", h, g, b, A, "http://iiif.io/api/image/2/level0.json", "http://iiif.io/api/image/2/profiles/level0.json", w, C, T, j, "level0", I, L], Z = ["sc:Collection", "sc:Manifest", "sc:Canvas", "sc:AnnotationList", "oa:Annotation", "sc:Range", "sc:Layer", "sc:Sequence", "oa:Choice", "Service", "ContentResource"];
3961
3989
  class U {
3962
3990
  constructor(c, y = {}) {
3963
3991
  n(this, "traversals"), n(this, "options"), this.traversals = { collection: [], manifest: [], canvas: [], annotationList: [], sequence: [], annotation: [], contentResource: [], choice: [], range: [], service: [], layer: [], ...c }, this.options = { convertPropsToArray: !0, mergeMemberProperties: !0, allowUndefinedReturn: !1, ...y };
@@ -4113,16 +4141,16 @@ var pr = { exports: {} };
4113
4141
  }, c);
4114
4142
  }
4115
4143
  }
4116
- function z(f) {
4117
- for (const c in f)
4118
- f[c] !== void 0 && f[c] !== null || delete f[c];
4119
- return f;
4144
+ function z(p) {
4145
+ for (const c in p)
4146
+ p[c] !== void 0 && p[c] !== null || delete p[c];
4147
+ return p;
4120
4148
  }
4121
4149
  const ee = "Attribution", ne = "http://example.org/provider", xe = "Unknown";
4122
- function O(f, c = "none") {
4123
- if (!f)
4150
+ function O(p, c = "none") {
4151
+ if (!p)
4124
4152
  return {};
4125
- const y = Array.isArray(f) ? f : [f], S = {};
4153
+ const y = Array.isArray(p) ? p : [p], S = {};
4126
4154
  for (const F of y) {
4127
4155
  if (typeof F == "string") {
4128
4156
  S[c] = S[c] ? S[c] : [], S[c].push(F || "");
@@ -4137,20 +4165,20 @@ var pr = { exports: {} };
4137
4165
  }
4138
4166
  return S;
4139
4167
  }
4140
- function W(f) {
4141
- return Array.isArray(f) ? W(f.find((c) => typeof c == "string")) : ie.indexOf(f) !== -1 ? "level2" : $.indexOf(f) !== -1 ? "level1" : typeof f == "string" ? f : void 0;
4168
+ function W(p) {
4169
+ return Array.isArray(p) ? W(p.find((c) => typeof c == "string")) : ie.indexOf(p) !== -1 ? "level2" : $.indexOf(p) !== -1 ? "level1" : typeof p == "string" ? p : void 0;
4142
4170
  }
4143
- function X(f) {
4171
+ function X(p) {
4144
4172
  for (const c of ["sc", "oa", "dcterms", "dctypes", "iiif"])
4145
- if (f.startsWith(`${c}:`))
4146
- return f.slice(c.length + 1);
4147
- return f;
4173
+ if (p.startsWith(`${c}:`))
4174
+ return p.slice(c.length + 1);
4175
+ return p;
4148
4176
  }
4149
4177
  const de = ["Collection", "Manifest", "Annotation", "AnnotationPage", "Range", "Service"];
4150
- function nt(f) {
4151
- const c = f["@id"] || f.id;
4152
- let y = f["@type"] || f.type;
4153
- const S = f.profile || void 0, F = f["@context"] || void 0;
4178
+ function nt(p) {
4179
+ const c = p["@id"] || p.id;
4180
+ let y = p["@type"] || p.type;
4181
+ const S = p.profile || void 0, F = p["@context"] || void 0;
4154
4182
  if (S) {
4155
4183
  const k = function(Y) {
4156
4184
  switch (Y) {
@@ -4226,92 +4254,92 @@ var pr = { exports: {} };
4226
4254
  }
4227
4255
  if (y && de.indexOf(y) !== -1)
4228
4256
  return y;
4229
- if (f.format) {
4230
- if (f.format.startsWith("image/"))
4257
+ if (p.format) {
4258
+ if (p.format.startsWith("image/"))
4231
4259
  return "Image";
4232
- if (f.format.startsWith("text/") || f.format === "application/pdf")
4260
+ if (p.format.startsWith("text/") || p.format === "application/pdf")
4233
4261
  return "Text";
4234
- if (f.format.startsWith("application/"))
4262
+ if (p.format.startsWith("application/"))
4235
4263
  return "Dataset";
4236
4264
  }
4237
4265
  return c && (c.endsWith(".jpg") || c.endsWith(".png") || c.endsWith(".jpeg")) ? "Image" : y || "unknown";
4238
4266
  }
4239
4267
  const Ki = /http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;
4240
- function Zi(f) {
4241
- const c = f.match(Ki);
4242
- return c ? c[0] : f;
4268
+ function Zi(p) {
4269
+ const c = p.match(Ki);
4270
+ return c ? c[0] : p;
4243
4271
  }
4244
4272
  const Xi = ["http://iiif.io/api/presentation/2/context.json", "http://iiif.io/api/image/2/context.json", "http://iiif.io/api/image/1/context.json", "http://library.stanford.edu/iiif/image-api/1.1/context.json", "http://iiif.io/api/search/1/context.json", "http://iiif.io/api/search/0/context.json", "http://iiif.io/api/auth/1/context.json", "http://iiif.io/api/auth/0/context.json", "http://iiif.io/api/annex/openannotation/context.json"];
4245
- function en(f) {
4246
- if (f) {
4247
- const c = Array.isArray(f) ? f : [f], y = [];
4273
+ function en(p) {
4274
+ if (p) {
4275
+ const c = Array.isArray(p) ? p : [p], y = [];
4248
4276
  for (const S of c)
4249
4277
  S === "http://iiif.io/api/presentation/2/context.json" && y.push("http://iiif.io/api/presentation/3/context.json"), Xi.indexOf(S) === -1 && y.push(S);
4250
4278
  if (c.length)
4251
4279
  return y.length === 1 ? y[0] : y;
4252
4280
  }
4253
4281
  }
4254
- let Bt = 0;
4255
- function zt(f, c) {
4256
- const y = encodeURI(f.id || f["@id"] || "").trim();
4257
- return y && c ? `${y}/${c}` : y || (Bt++, `http://example.org/${f["@type"]}${c ? `/${c}` : ""}/${Bt}`);
4282
+ let zt = 0;
4283
+ function Wt(p, c) {
4284
+ const y = encodeURI(p.id || p["@id"] || "").trim();
4285
+ return y && c ? `${y}/${c}` : y || (zt++, `http://example.org/${p["@type"]}${c ? `/${c}` : ""}/${zt}`);
4258
4286
  }
4259
- function oe(f) {
4260
- const c = [...f.behavior || []];
4287
+ function oe(p) {
4288
+ const c = [...p.behavior || []];
4261
4289
  let y;
4262
- return f.viewingHint && c.push(f.viewingHint), Array.isArray(f.motivation) ? y = f.motivation.map(X) : f.motivation && (y = X(f.motivation)), { "@context": f["@context"] ? en(f["@context"]) : void 0, id: (f["@id"] || zt(f)).trim(), type: nt(f), behavior: c.length ? c : void 0, height: f.height ? f.height : void 0, width: f.width ? f.width : void 0, motivation: y, viewingDirection: f.viewingDirection, profile: f.profile, format: f.format ? f.format : void 0, duration: void 0, timeMode: void 0 };
4290
+ return p.viewingHint && c.push(p.viewingHint), Array.isArray(p.motivation) ? y = p.motivation.map(X) : p.motivation && (y = X(p.motivation)), { "@context": p["@context"] ? en(p["@context"]) : void 0, id: (p["@id"] || Wt(p)).trim(), type: nt(p), behavior: c.length ? c : void 0, height: p.height ? p.height : void 0, width: p.width ? p.width : void 0, motivation: y, viewingDirection: p.viewingDirection, profile: p.profile, format: p.format ? p.format : void 0, duration: void 0, timeMode: void 0 };
4263
4291
  }
4264
- function ae(f) {
4292
+ function ae(p) {
4265
4293
  const [c, y] = function(k, Y = "Rights/License", Ue = "none") {
4266
4294
  let Ve = null;
4267
- const Wt = [], on = Array.isArray(k) ? k : [k];
4268
- for (const Qt of on) {
4269
- const ye = Qt ? Zi(Qt) : void 0;
4270
- !ye || ye.indexOf("creativecommons.org") === -1 && ye.indexOf("rightsstatements.org") === -1 ? ye && Wt.push({ label: { [Ue]: [Y] }, value: { [Ue]: [ye] } }) : Ve = ye.startsWith("https://") ? `http://${ye.slice(8)}` : ye;
4295
+ const Qt = [], on = Array.isArray(k) ? k : [k];
4296
+ for (const Yt of on) {
4297
+ const ye = Yt ? Zi(Yt) : void 0;
4298
+ !ye || ye.indexOf("creativecommons.org") === -1 && ye.indexOf("rightsstatements.org") === -1 ? ye && Qt.push({ label: { [Ue]: [Y] }, value: { [Ue]: [ye] } }) : Ve = ye.startsWith("https://") ? `http://${ye.slice(8)}` : ye;
4271
4299
  }
4272
- return [Ve, Wt];
4273
- }(f.license), S = [...f.metadata ? (F = f.metadata, F ? F.map((k) => ({ label: O(k.label), value: O(k.value) })) : []) : [], ...y];
4300
+ return [Ve, Qt];
4301
+ }(p.license), S = [...p.metadata ? (F = p.metadata, F ? F.map((k) => ({ label: O(k.label), value: O(k.value) })) : []) : [], ...y];
4274
4302
  var F;
4275
- return { rights: c, metadata: S.length ? S : void 0, label: f.label ? O(f.label) : void 0, requiredStatement: f.attribution ? { label: O(ee), value: O(f.attribution) } : void 0, navDate: f.navDate, summary: f.description ? O(f.description) : void 0, thumbnail: tn(f.thumbnail) };
4303
+ return { rights: c, metadata: S.length ? S : void 0, label: p.label ? O(p.label) : void 0, requiredStatement: p.attribution ? { label: O(ee), value: O(p.attribution) } : void 0, navDate: p.navDate, summary: p.description ? O(p.description) : void 0, thumbnail: tn(p.thumbnail) };
4276
4304
  }
4277
- function tn(f) {
4278
- return f && (Array.isArray(f) ? f : [f]).map((c) => typeof c == "string" ? { id: c, type: "Image" } : (c.type === "unknown" && (c.type = "Image"), c));
4305
+ function tn(p) {
4306
+ return p && (Array.isArray(p) ? p : [p]).map((c) => typeof c == "string" ? { id: c, type: "Image" } : (c.type === "unknown" && (c.type = "Image"), c));
4279
4307
  }
4280
- function rn(f) {
4281
- if (!f.within)
4308
+ function rn(p) {
4309
+ if (!p.within)
4282
4310
  return;
4283
- const c = Array.isArray(f.within) ? f.within : [f.within], y = [];
4311
+ const c = Array.isArray(p.within) ? p.within : [p.within], y = [];
4284
4312
  for (const S of c)
4285
- typeof S == "string" ? S && f["@type"] === "sc:Manifest" && y.push({ id: S, type: "Collection" }) : S["@id"] && y.push({ id: S["@id"], type: nt(S) });
4313
+ typeof S == "string" ? S && p["@type"] === "sc:Manifest" && y.push({ id: S, type: "Collection" }) : S["@id"] && y.push({ id: S["@id"], type: nt(S) });
4286
4314
  return y.length ? y : void 0;
4287
4315
  }
4288
- function he(f) {
4289
- const c = f.related ? Array.isArray(f.related) ? f.related : [f.related] : [], y = f.contentLayer;
4290
- return { provider: f.logo || c.length ? [{ id: ne, type: "Agent", homepage: c.length ? [c[0]] : void 0, logo: f.logo ? Array.isArray(f.logo) ? f.logo : [f.logo] : void 0, label: O(xe) }] : void 0, partOf: rn(f), rendering: f.rendering, seeAlso: f.seeAlso, start: f.startCanvas, service: f.service ? (S = f.service, Array.isArray(S) ? S : S ? [S] : []) : void 0, supplementary: y ? [y] : void 0 };
4316
+ function he(p) {
4317
+ const c = p.related ? Array.isArray(p.related) ? p.related : [p.related] : [], y = p.contentLayer;
4318
+ return { provider: p.logo || c.length ? [{ id: ne, type: "Agent", homepage: c.length ? [c[0]] : void 0, logo: p.logo ? Array.isArray(p.logo) ? p.logo : [p.logo] : void 0, label: O(xe) }] : void 0, partOf: rn(p), rendering: p.rendering, seeAlso: p.seeAlso, start: p.startCanvas, service: p.service ? (S = p.service, Array.isArray(S) ? S : S ? [S] : []) : void 0, supplementary: y ? [y] : void 0 };
4291
4319
  var S;
4292
4320
  }
4293
- function st(f) {
4294
- const c = f;
4321
+ function st(p) {
4322
+ const c = p;
4295
4323
  return z({ ...oe(c), ...ae(c), ...he(c), ...(y = c, { chars: y.chars, format: y.format ? y.format : void 0, language: y.language }) });
4296
4324
  var y;
4297
4325
  }
4298
- const nn = new U({ collection: [function(f) {
4299
- return z({ ...oe(f), ...ae(f), ...he(f), items: f.members });
4300
- }], manifest: [function(f) {
4326
+ const nn = new U({ collection: [function(p) {
4327
+ return z({ ...oe(p), ...ae(p), ...he(p), items: p.members });
4328
+ }], manifest: [function(p) {
4301
4329
  const c = [], y = [];
4302
4330
  let S;
4303
- for (const k of f.sequences || [])
4331
+ for (const k of p.sequences || [])
4304
4332
  k.canvases.length && c.push(...k.canvases), k.behavior && y.push(...k.behavior), k.startCanvas && (S = k.startCanvas);
4305
- const F = oe(f);
4306
- return y.length && (F.behavior ? F.behavior.push(...y) : F.behavior = y), z({ ...F, ...ae(f), ...he(f), start: S, items: c, structures: f.structures });
4307
- }], canvas: [function(f) {
4308
- return z({ ...oe(f), ...ae(f), ...he(f), annotations: f.otherContent && f.otherContent.length ? f.otherContent : void 0, items: f.images && f.images.length ? [{ id: zt(f, "annotation-page"), type: "AnnotationPage", items: f.images }] : void 0 });
4309
- }], annotationList: [function(f) {
4310
- return z({ ...oe(f), ...ae(f), ...he(f), items: f.resources && f.resources.length ? f.resources : void 0 });
4311
- }], sequence: [function(f) {
4312
- return f.canvases && f.canvases.length !== 0 ? { canvases: f.canvases, behavior: f.viewingHint ? [f.viewingHint] : [], startCanvas: f.startCanvas } : { canvases: [], behavior: [] };
4313
- }], annotation: [function(f) {
4314
- return z({ ...oe(f), ...ae(f), ...he(f), target: function c(y) {
4333
+ const F = oe(p);
4334
+ return y.length && (F.behavior ? F.behavior.push(...y) : F.behavior = y), z({ ...F, ...ae(p), ...he(p), start: S, items: c, structures: p.structures });
4335
+ }], canvas: [function(p) {
4336
+ return z({ ...oe(p), ...ae(p), ...he(p), annotations: p.otherContent && p.otherContent.length ? p.otherContent : void 0, items: p.images && p.images.length ? [{ id: Wt(p, "annotation-page"), type: "AnnotationPage", items: p.images }] : void 0 });
4337
+ }], annotationList: [function(p) {
4338
+ return z({ ...oe(p), ...ae(p), ...he(p), items: p.resources && p.resources.length ? p.resources : void 0 });
4339
+ }], sequence: [function(p) {
4340
+ return p.canvases && p.canvases.length !== 0 ? { canvases: p.canvases, behavior: p.viewingHint ? [p.viewingHint] : [], startCanvas: p.startCanvas } : { canvases: [], behavior: [] };
4341
+ }], annotation: [function(p) {
4342
+ return z({ ...oe(p), ...ae(p), ...he(p), target: function c(y) {
4315
4343
  if (Array.isArray(y)) {
4316
4344
  if (y.length > 1)
4317
4345
  return { type: "List", items: y.map(c) };
@@ -4333,36 +4361,36 @@ var pr = { exports: {} };
4333
4361
  return { type: "SpecificResource", source: S, selector: ot(y.selector) };
4334
4362
  }
4335
4363
  return encodeURI(y["@id"]).trim();
4336
- }(f.on), body: Array.isArray(f.resource) ? f.resource.map(st) : st(f.resource) });
4337
- }], contentResource: [st], choice: [function(f) {
4364
+ }(p.on), body: Array.isArray(p.resource) ? p.resource.map(st) : st(p.resource) });
4365
+ }], contentResource: [st], choice: [function(p) {
4338
4366
  const c = [];
4339
- return f.default && f.default !== "rdf:nil" && c.push(f.default), f.item && f.item !== "rdf:nil" && c.push(...f.item), { ...oe(f), ...ae(f), items: c };
4340
- }], range: [function(f) {
4341
- return z({ ...oe(f), ...ae(f), ...he(f), items: f.members });
4342
- }], service: [function(f) {
4343
- const { "@id": c, "@type": y, "@context": S, profile: F, ...k } = f, Y = {};
4344
- return c && (Y["@id"] = c), Y["@type"] = nt(f), Y["@type"] === "unknown" && (S && S.length && (Y["@context"] = S), Y["@type"] = "Service"), F && (Y.profile = W(F)), z({ ...Y, ...k });
4345
- }], layer: [function(f) {
4346
- return z({ ...oe(f), ...ae(f), ...he(f) });
4367
+ return p.default && p.default !== "rdf:nil" && c.push(p.default), p.item && p.item !== "rdf:nil" && c.push(...p.item), { ...oe(p), ...ae(p), items: c };
4368
+ }], range: [function(p) {
4369
+ return z({ ...oe(p), ...ae(p), ...he(p), items: p.members });
4370
+ }], service: [function(p) {
4371
+ const { "@id": c, "@type": y, "@context": S, profile: F, ...k } = p, Y = {};
4372
+ return c && (Y["@id"] = c), Y["@type"] = nt(p), Y["@type"] === "unknown" && (S && S.length && (Y["@context"] = S), Y["@type"] = "Service"), F && (Y.profile = W(F)), z({ ...Y, ...k });
4373
+ }], layer: [function(p) {
4374
+ return z({ ...oe(p), ...ae(p), ...he(p) });
4347
4375
  }] });
4348
- function ot(f) {
4349
- if ((Array.isArray(f["@type"]) && f["@type"].includes("oa:SvgSelector") || f["@type"] == "oa:SvgSelector") && ("chars" in f || "value" in f))
4350
- return { type: "SvgSelector", value: "chars" in f ? f.chars : f.value };
4351
- if (f["@type"] === "oa:FragmentSelector")
4352
- return { type: "FragmentSelector", value: f.value };
4353
- if (f["@type"] === "oa:Choice")
4354
- return [ot(f.default), ...(Array.isArray(f.item) ? f.item : [f.item]).map(ot)];
4355
- if (f["@type"] == "iiif:ImageApiSelector")
4356
- return { type: "ImageApiSelector", region: "region" in f ? f.region : void 0, rotation: "rotation" in f ? f.rotation : void 0 };
4357
- throw new Error(`Unsupported selector type: ${f["@type"]}`);
4376
+ function ot(p) {
4377
+ if ((Array.isArray(p["@type"]) && p["@type"].includes("oa:SvgSelector") || p["@type"] == "oa:SvgSelector") && ("chars" in p || "value" in p))
4378
+ return { type: "SvgSelector", value: "chars" in p ? p.chars : p.value };
4379
+ if (p["@type"] === "oa:FragmentSelector")
4380
+ return { type: "FragmentSelector", value: p.value };
4381
+ if (p["@type"] === "oa:Choice")
4382
+ return [ot(p.default), ...(Array.isArray(p.item) ? p.item : [p.item]).map(ot)];
4383
+ if (p["@type"] == "iiif:ImageApiSelector")
4384
+ return { type: "ImageApiSelector", region: "region" in p ? p.region : void 0, rotation: "rotation" in p ? p.rotation : void 0 };
4385
+ throw new Error(`Unsupported selector type: ${p["@type"]}`);
4358
4386
  }
4359
- const sn = function(f) {
4360
- return f && f["@context"] && (f["@context"] === "http://iiif.io/api/presentation/2/context.json" || f["@context"].indexOf("http://iiif.io/api/presentation/2/context.json") !== -1 || f["@context"] === "http://www.shared-canvas.org/ns/context.json") || f["@context"] === "http://iiif.io/api/image/2/context.json" ? nn.traverseUnknown(f) : f;
4387
+ const sn = function(p) {
4388
+ return p && p["@context"] && (p["@context"] === "http://iiif.io/api/presentation/2/context.json" || p["@context"].indexOf("http://iiif.io/api/presentation/2/context.json") !== -1 || p["@context"] === "http://www.shared-canvas.org/ns/context.json") || p["@context"] === "http://iiif.io/api/image/2/context.json" ? nn.traverseUnknown(p) : p;
4361
4389
  };
4362
4390
  s.upgrade = sn, Object.defineProperties(s, { __esModule: { value: !0 }, [Symbol.toStringTag]: { value: "Module" } });
4363
4391
  });
4364
- })(pr, pr.exports);
4365
- function Oc(e) {
4392
+ })(dr, dr.exports);
4393
+ function Ec(e) {
4366
4394
  return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
4367
4395
  }
4368
4396
  function Li(e, t) {
@@ -4387,16 +4415,16 @@ function Li(e, t) {
4387
4415
  i
4388
4416
  ];
4389
4417
  }
4390
- const _a = {
4418
+ const Ua = {
4391
4419
  makeChoice: () => {
4392
4420
  }
4393
- }, gt = { type: "unknown" }, _ = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), Ua = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
4394
- function Va(e, t) {
4421
+ }, gt = { type: "unknown" }, _ = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), Va = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
4422
+ function Na(e, t) {
4395
4423
  var i;
4396
4424
  const r = (i = e == null ? void 0 : e.iiif) == null ? void 0 : i.meta[t];
4397
4425
  return r ? r.annotationPageManager : null;
4398
4426
  }
4399
- function Na(e, t) {
4427
+ function Ha(e, t) {
4400
4428
  return Q(
4401
4429
  (r) => {
4402
4430
  const i = [];
@@ -4405,7 +4433,7 @@ function Na(e, t) {
4405
4433
  const n = Object.keys(r.iiif.entities.AnnotationPage);
4406
4434
  for (const s of n)
4407
4435
  if (!t || t.indexOf(s) !== -1) {
4408
- const o = Va(r, s);
4436
+ const o = Na(r, s);
4409
4437
  o && o.views && o.views[e] && i.push(s);
4410
4438
  }
4411
4439
  return i;
@@ -4413,7 +4441,7 @@ function Na(e, t) {
4413
4441
  [e, t]
4414
4442
  );
4415
4443
  }
4416
- function Ha({
4444
+ function Ba({
4417
4445
  canvas: e,
4418
4446
  manifest: t,
4419
4447
  all: r,
@@ -4433,37 +4461,37 @@ function Ha({
4433
4461
  n.indexOf(s.id) === -1 && n.push(s.id);
4434
4462
  return n;
4435
4463
  }
4436
- function Ba(e, t) {
4464
+ function za(e, t) {
4437
4465
  var i;
4438
4466
  const r = (i = e == null ? void 0 : e.iiif) == null ? void 0 : i.meta[t];
4439
4467
  return r ? r.annotationPageManager : null;
4440
4468
  }
4441
- function za(e, t = {}) {
4442
- const r = V(), i = ke(), n = ue(), s = Br(), o = E(() => Ha({
4469
+ function Wa(e, t = {}) {
4470
+ const r = V(), i = ke(), n = ue(), s = Br(), o = E(() => Ba({
4443
4471
  all: t.all,
4444
4472
  manifest: i,
4445
4473
  canvas: n,
4446
4474
  canvases: s
4447
- }), [t.all, n, s, i]), a = Na(e, t.all ? void 0 : o), u = D(
4475
+ }), [t.all, n, s, i]), a = Ha(e, t.all ? void 0 : o), u = D(
4448
4476
  (l) => {
4449
4477
  e && r.setMetaValue(
4450
4478
  [l, "annotationPageManager", "views"],
4451
- (p) => p && !p[e] ? p : {
4452
- ...p || {},
4479
+ (d) => d && !d[e] ? d : {
4480
+ ...d || {},
4453
4481
  [e]: !1
4454
4482
  }
4455
4483
  );
4456
4484
  },
4457
4485
  [e, r]
4458
- ), d = D(
4459
- (l, p = {}) => {
4486
+ ), f = D(
4487
+ (l, d = {}) => {
4460
4488
  if (!e)
4461
4489
  return;
4462
4490
  const v = r.getState(), m = [];
4463
- if (p != null && p.deselectOthers) {
4491
+ if (d != null && d.deselectOthers) {
4464
4492
  const h = Object.keys(v.iiif.entities.AnnotationPage);
4465
4493
  for (const g of h) {
4466
- const b = Ba(v, g);
4494
+ const b = za(v, g);
4467
4495
  b && b.views && b.views[e] && m.push(g);
4468
4496
  }
4469
4497
  }
@@ -4482,31 +4510,31 @@ function za(e, t = {}) {
4482
4510
  return {
4483
4511
  availablePageIds: o,
4484
4512
  enabledPageIds: a,
4485
- setPageEnabled: d,
4513
+ setPageEnabled: f,
4486
4514
  setPageDisabled: u
4487
4515
  };
4488
4516
  }
4489
- function Wa(e, t) {
4517
+ function Qa(e, t) {
4490
4518
  return Q((r, i) => i.get(e.map((n) => ({ id: n, type: t }))), [e, t]);
4491
4519
  }
4492
- const Qa = me.createContext(new gr());
4493
- function Ut() {
4494
- return H(Qa);
4520
+ const Ya = me.createContext(new mr());
4521
+ function Vt() {
4522
+ return H(Ya);
4495
4523
  }
4496
- function Ya() {
4497
- const e = Ut(), [t, r] = B({}), i = ge(!1);
4524
+ function Ga() {
4525
+ const e = Vt(), [t, r] = B({}), i = ge(!1);
4498
4526
  return K(() => () => {
4499
4527
  i.current = !0;
4500
4528
  }, []), [D(
4501
4529
  (s, { height: o, width: a }) => {
4502
4530
  if (s) {
4503
- const u = s.id || s["@id"], d = e.loadServiceSync({
4531
+ const u = s.id || s["@id"], f = e.loadServiceSync({
4504
4532
  id: u,
4505
4533
  width: s.width || a,
4506
4534
  height: s.height || o,
4507
4535
  source: s
4508
4536
  });
4509
- d ? s = d : t[u] || (i.current || r((l) => ({
4537
+ f ? s = f : t[u] || (i.current || r((l) => ({
4510
4538
  ...l,
4511
4539
  [u]: "loading"
4512
4540
  })), e.loadService({
@@ -4525,7 +4553,7 @@ function Ya() {
4525
4553
  [e, t]
4526
4554
  ), t];
4527
4555
  }
4528
- function Vt(e = {}) {
4556
+ function Nt(e = {}) {
4529
4557
  const t = si(), r = ue(e.canvasId ? { id: e.canvasId } : void 0);
4530
4558
  return Q(
4531
4559
  (i, n) => {
@@ -4541,7 +4569,7 @@ function Vt(e = {}) {
4541
4569
  [r]
4542
4570
  );
4543
4571
  }
4544
- function Ga(e) {
4572
+ function Ja(e) {
4545
4573
  return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
4546
4574
  }
4547
4575
  const ze = {}, Fi = {
@@ -4564,7 +4592,7 @@ const ze = {}, Fi = {
4564
4592
  return t ? r[t] : r;
4565
4593
  }
4566
4594
  };
4567
- function Ja(e = Fi) {
4595
+ function Ka(e = Fi) {
4568
4596
  function t(n) {
4569
4597
  const s = n ? typeof n == "string" ? e.get(n) : n : null;
4570
4598
  if (!s)
@@ -4577,13 +4605,13 @@ function Ja(e = Fi) {
4577
4605
  function r(n, s = []) {
4578
4606
  const o = Array.isArray(n) ? n : t(n), a = [];
4579
4607
  let u = null;
4580
- const d = [];
4608
+ const f = [];
4581
4609
  for (const l of o) {
4582
4610
  if (l.type !== "Annotation")
4583
4611
  throw new Error("getPaintables() accept either a canvas or list of annotations");
4584
- const p = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
4585
- for (const v of p) {
4586
- const [m, { selector: h }] = Ga(v), g = e.get(m), b = (g.type || "unknown").toLowerCase();
4612
+ const d = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
4613
+ for (const v of d) {
4614
+ const [m, { selector: h }] = Ja(v), g = e.get(m), b = (g.type || "unknown").toLowerCase();
4587
4615
  if (b === "choice") {
4588
4616
  const A = e.get(g.items, { parent: g.id }), w = s.length ? s.map((C) => A.find((T) => T.id === C)).filter(Boolean) : [A[0]];
4589
4617
  w.length === 0 && w.push(A[0]), u = {
@@ -4594,10 +4622,10 @@ function Ja(e = Fi) {
4594
4622
  selected: w.indexOf(C) !== -1
4595
4623
  })),
4596
4624
  label: m.label
4597
- }, p.push(...w);
4625
+ }, d.push(...w);
4598
4626
  continue;
4599
4627
  }
4600
- a.indexOf(b) === -1 && a.push(b), d.push({
4628
+ a.indexOf(b) === -1 && a.push(b), f.push({
4601
4629
  type: b,
4602
4630
  annotationId: l.id,
4603
4631
  resource: g,
@@ -4608,7 +4636,7 @@ function Ja(e = Fi) {
4608
4636
  }
4609
4637
  return {
4610
4638
  types: a,
4611
- items: d,
4639
+ items: f,
4612
4640
  choice: u
4613
4641
  };
4614
4642
  }
@@ -4622,12 +4650,12 @@ function Ja(e = Fi) {
4622
4650
  extractChoices: i
4623
4651
  };
4624
4652
  }
4625
- function Ka(e, t = []) {
4626
- const r = V(), i = E(() => Ja(r), []), n = Vt({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [s, o] = B((e == null ? void 0 : e.defaultChoices) || []), a = E(
4653
+ function Za(e, t = []) {
4654
+ const r = V(), i = E(() => Ka(r), []), n = Nt({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [s, o] = B((e == null ? void 0 : e.defaultChoices) || []), a = E(
4627
4655
  () => i.getPaintables(n, s),
4628
4656
  [r, n, s, ...t]
4629
- ), d = { makeChoice: D(
4630
- (l, { deselectOthers: p = !0, deselect: v = !1 } = {}) => {
4657
+ ), f = { makeChoice: D(
4658
+ (l, { deselectOthers: d = !0, deselect: v = !1 } = {}) => {
4631
4659
  if (a.choice) {
4632
4660
  if (a.choice.type !== "single-choice")
4633
4661
  throw new Error("Complex choice not supported yet");
@@ -4640,7 +4668,7 @@ function Ka(e, t = []) {
4640
4668
  }
4641
4669
  return g;
4642
4670
  }
4643
- if (p)
4671
+ if (d)
4644
4672
  return [l];
4645
4673
  const h = [...m];
4646
4674
  if (h.length === 0 && a.items.length) {
@@ -4653,9 +4681,9 @@ function Ka(e, t = []) {
4653
4681
  },
4654
4682
  [a.choice]
4655
4683
  ) };
4656
- return [a, d];
4684
+ return [a, f];
4657
4685
  }
4658
- function Za(e, t, r) {
4686
+ function Xa(e, t, r) {
4659
4687
  const i = [];
4660
4688
  for (const n of t.items) {
4661
4689
  const s = n.resource && n.resource.type === "SpecificResource" ? n.resource.source : n.resource;
@@ -4674,8 +4702,8 @@ function Za(e, t, r) {
4674
4702
  width: Number(e.width),
4675
4703
  height: Number(e.height)
4676
4704
  }
4677
- }, [u, d] = Li(e, n.target);
4678
- if (d.id !== e.id)
4705
+ }, [u, f] = Li(e, n.target);
4706
+ if (f.id !== e.id)
4679
4707
  continue;
4680
4708
  n.resource.width && n.resource.height && (n.resource.width, n.resource.height);
4681
4709
  let l = n.resource.type === "SpecificResource" ? Re(n.resource) : null;
@@ -4687,7 +4715,7 @@ function Za(e, t, r) {
4687
4715
  });
4688
4716
  m && (l = m);
4689
4717
  }
4690
- const p = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
4718
+ const d = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
4691
4719
  type: "BoxSelector",
4692
4720
  spatial: {
4693
4721
  x: l.selector.spatial.x,
@@ -4701,12 +4729,12 @@ function Za(e, t, r) {
4701
4729
  id: s.id,
4702
4730
  type: "Image",
4703
4731
  annotationId: n.annotationId,
4704
- width: Number(u || p ? s.width : e.width),
4705
- height: Number(u || p ? s.height : e.height),
4732
+ width: Number(u || d ? s.width : e.width),
4733
+ height: Number(u || d ? s.height : e.height),
4706
4734
  service: o,
4707
4735
  sizes: o && o.sizes ? o.sizes : s.width && s.height ? [{ width: s.width, height: s.height }] : [],
4708
4736
  target: u && u.type !== "PointSelector" ? u : a,
4709
- selector: p
4737
+ selector: d
4710
4738
  };
4711
4739
  i.push(v);
4712
4740
  }
@@ -4717,15 +4745,15 @@ function Za(e, t, r) {
4717
4745
  choice: t.choice
4718
4746
  };
4719
4747
  }
4720
- const Xa = ["model/gltf-binary"];
4721
- function ec(e, t) {
4748
+ const ec = ["model/gltf-binary"];
4749
+ function tc(e, t) {
4722
4750
  const i = t.items[0].resource;
4723
- return i.format ? Xa.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4751
+ return i.format ? ec.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4724
4752
  type: "3d-model",
4725
4753
  model: i
4726
4754
  } : _("Unknown format");
4727
4755
  }
4728
- function tc(e, t) {
4756
+ function rc(e, t) {
4729
4757
  var i;
4730
4758
  if (!e.duration)
4731
4759
  return _("No duration on canvas");
@@ -4760,8 +4788,8 @@ function tc(e, t) {
4760
4788
  }
4761
4789
  } : _("Audio does not have format") : _("Unknown audio");
4762
4790
  }
4763
- const rc = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4764
- function ic(e, t) {
4791
+ const ic = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4792
+ function nc(e, t) {
4765
4793
  var o;
4766
4794
  const r = t.items.filter((a) => a.type === "video");
4767
4795
  if (!e.duration)
@@ -4799,7 +4827,7 @@ function ic(e, t) {
4799
4827
  };
4800
4828
  if (n) {
4801
4829
  s.type = "VideoYouTube";
4802
- const a = i.id.match(rc);
4830
+ const a = i.id.match(ic);
4803
4831
  if (!a[1])
4804
4832
  return _("Video is not known youtube video");
4805
4833
  s.youTubeId = a[1];
@@ -4826,7 +4854,7 @@ function ji(e, t = {}, r) {
4826
4854
  }
4827
4855
  return t;
4828
4856
  }
4829
- function nc(e, t) {
4857
+ function sc(e, t) {
4830
4858
  const r = [];
4831
4859
  return t.items.forEach((i) => {
4832
4860
  if (i.resource) {
@@ -4838,37 +4866,37 @@ function nc(e, t) {
4838
4866
  items: r
4839
4867
  };
4840
4868
  }
4841
- function sc(e) {
4842
- const t = ke(), r = ue(), i = V(), [n, s] = Ya(), { enabledPageIds: o } = za((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (r == null ? void 0 : r.id), {
4869
+ function oc(e) {
4870
+ const t = ke(), r = ue(), i = V(), [n, s] = Ga(), { enabledPageIds: o } = Wa((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (r == null ? void 0 : r.id), {
4843
4871
  all: !1
4844
- }), a = Wa(o, "AnnotationPage"), u = (e == null ? void 0 : e.strategies) || [
4872
+ }), a = Qa(o, "AnnotationPage"), u = (e == null ? void 0 : e.strategies) || [
4845
4873
  "empty",
4846
4874
  "images",
4847
4875
  "media",
4848
4876
  "textual-content",
4849
4877
  "complex-timeline"
4850
- ], [d, l] = Ka(e, [s]), p = E(() => {
4878
+ ], [f, l] = Za(e, [s]), d = E(() => {
4851
4879
  if (!r)
4852
4880
  return console.log("No canvas"), gt;
4853
- if (d.types.length === 0)
4854
- return u.indexOf("empty") !== -1 ? Ua(r.width, r.height) : (console.log("No paintables"), gt);
4855
- if (d.types.length !== 1)
4856
- if (d.types.length === 2 && d.types.indexOf("text") !== -1)
4857
- d.types = d.types.filter((m) => m !== "text");
4881
+ if (f.types.length === 0)
4882
+ return u.indexOf("empty") !== -1 ? Va(r.width, r.height) : (console.log("No paintables"), gt);
4883
+ if (f.types.length !== 1)
4884
+ if (f.types.length === 2 && f.types.indexOf("text") !== -1)
4885
+ f.types = f.types.filter((m) => m !== "text");
4858
4886
  else
4859
4887
  return u.indexOf("complex-timeline") === -1 ? _("Complex timeline not supported") : _("ComplexTimelineStrategy not yet supported");
4860
- const v = d.types[0];
4861
- return v === "image" ? u.indexOf("images") === -1 ? _("Image not supported") : Za(r, d, n) : v === "Model" || v === "model" ? u.indexOf("3d-model") === -1 ? _("3D not supported") : ec(r, d) : v === "textualbody" ? u.indexOf("textual-content") === -1 ? _("Textual content not supported") : nc(r, d) : v === "sound" || v === "audio" ? u.indexOf("media") === -1 ? _("Media not supported") : tc(r, d) : v === "video" ? u.indexOf("media") === -1 ? _("Media not supported") : ic(r, d) : (console.log("No idea"), gt);
4862
- }, [r, d, i, l.makeChoice]);
4863
- return E(() => p.type === "unknown" ? [p, _a] : [
4888
+ const v = f.types[0];
4889
+ return v === "image" ? u.indexOf("images") === -1 ? _("Image not supported") : Xa(r, f, n) : v === "Model" || v === "model" ? u.indexOf("3d-model") === -1 ? _("3D not supported") : tc(r, f) : v === "textualbody" ? u.indexOf("textual-content") === -1 ? _("Textual content not supported") : sc(r, f) : v === "sound" || v === "audio" ? u.indexOf("media") === -1 ? _("Media not supported") : rc(r, f) : v === "video" ? u.indexOf("media") === -1 ? _("Media not supported") : nc(r, f) : (console.log("No idea"), gt);
4890
+ }, [r, f, i, l.makeChoice]);
4891
+ return E(() => d.type === "unknown" ? [d, Ua] : [
4864
4892
  {
4865
- ...p,
4893
+ ...d,
4866
4894
  annotations: { pages: a }
4867
4895
  },
4868
4896
  l
4869
- ], [p, a]);
4897
+ ], [d, a]);
4870
4898
  }
4871
- const oc = (e, t = []) => {
4899
+ const ac = (e, t = []) => {
4872
4900
  const r = V();
4873
4901
  K(() => {
4874
4902
  e(r);
@@ -4892,52 +4920,52 @@ const oc = (e, t = []) => {
4892
4920
  if (r)
4893
4921
  return t ? r[t] : r;
4894
4922
  }
4895
- }, ac = new gr();
4896
- function cc(e = $i, t = {}) {
4897
- const r = t.imageServiceLoader || ac;
4923
+ }, cc = new mr();
4924
+ function uc(e = $i, t = {}) {
4925
+ const r = t.imageServiceLoader || cc;
4898
4926
  async function i(n, s, o = !1, a = [], u) {
4899
- const d = () => r.getThumbnailFromResource(void 0, s, o, a);
4927
+ const f = () => r.getThumbnailFromResource(void 0, s, o, a);
4900
4928
  if (!n)
4901
4929
  return await r.getThumbnailFromResource(void 0, s, o, a);
4902
4930
  if (typeof n == "string") {
4903
- const p = Yt(n);
4904
- return p && a.push(p), await r.getThumbnailFromResource(void 0, s, o, a);
4931
+ const d = Gt(n);
4932
+ return d && a.push(d), await r.getThumbnailFromResource(void 0, s, o, a);
4905
4933
  }
4906
4934
  const l = e.get(n, { skipSelfReturn: !1 });
4907
4935
  if (typeof l == "string")
4908
- return { best: Yt(l), fallback: [], log: [] };
4936
+ return { best: Gt(l), fallback: [], log: [] };
4909
4937
  if (!l)
4910
- return await d();
4911
- switch (await (async (p) => {
4912
- if (p && p.thumbnail && p.thumbnail.length) {
4913
- const v = e.get(p.thumbnail[0]), m = await r.getImageCandidates(v, o);
4938
+ return await f();
4939
+ switch (await (async (d) => {
4940
+ if (d && d.thumbnail && d.thumbnail.length) {
4941
+ const v = e.get(d.thumbnail[0]), m = await r.getImageCandidates(v, o);
4914
4942
  m && m.length && a.push(...m);
4915
4943
  }
4916
4944
  })(l), l.type) {
4917
4945
  case "Annotation": {
4918
- const p = Array.isArray(l.body) ? l.body : [l.body], v = e.get(p[0]);
4946
+ const d = Array.isArray(l.body) ? l.body : [l.body], v = e.get(d[0]);
4919
4947
  return u && !v.width && (v.width = u.width, v.height = u.height), await r.getThumbnailFromResource(v, s, o, a);
4920
4948
  }
4921
4949
  case "Canvas": {
4922
- const p = l;
4923
- return i(p.items[0], s, o, a, {
4924
- width: p.width,
4925
- height: p.height
4950
+ const d = l;
4951
+ return i(d.items[0], s, o, a, {
4952
+ width: d.width,
4953
+ height: d.height
4926
4954
  });
4927
4955
  }
4928
4956
  case "AnnotationPage":
4929
4957
  return i(l.items[0], s, o, a, u);
4930
4958
  case "Choice": {
4931
- const p = l;
4932
- return !p.items || p.items[0] ? await d() : i(p.items[0], s, o, a, u);
4959
+ const d = l;
4960
+ return !d.items || d.items[0] ? await f() : i(d.items[0], s, o, a, u);
4933
4961
  }
4934
4962
  case "Collection": {
4935
- const p = l.items[0];
4936
- return p ? i(p, s, o, a, u) : await d();
4963
+ const d = l.items[0];
4964
+ return d ? i(d, s, o, a, u) : await f();
4937
4965
  }
4938
4966
  case "Manifest": {
4939
- const p = l.items[0];
4940
- return p ? i(p, s, o, a, u) : await d();
4967
+ const d = l.items[0];
4968
+ return d ? i(d, s, o, a, u) : await f();
4941
4969
  }
4942
4970
  case "SpecificResource":
4943
4971
  case "Image":
@@ -4948,31 +4976,31 @@ function cc(e = $i, t = {}) {
4948
4976
  case "Video":
4949
4977
  return u && !l.width && (l.width = u.width, l.height = u.height), r.getThumbnailFromResource(l, s, o, a);
4950
4978
  }
4951
- return await d();
4979
+ return await f();
4952
4980
  }
4953
4981
  return {
4954
4982
  getBestThumbnailAtSize: i
4955
4983
  };
4956
4984
  }
4957
- function uc(e, t, { canvasId: r, manifestId: i } = {}) {
4958
- const n = V(), s = Ut(), o = E(() => cc(n, { imageServiceLoader: s }), [n, s]), [a, u] = B(), d = ke(i ? { id: i } : void 0), l = ue(r ? { id: r } : void 0), p = l || d, v = ge(!1);
4985
+ function lc(e, t, { canvasId: r, manifestId: i } = {}) {
4986
+ const n = V(), s = Vt(), o = E(() => uc(n, { imageServiceLoader: s }), [n, s]), [a, u] = B(), f = ke(i ? { id: i } : void 0), l = ue(r ? { id: r } : void 0), d = l || f, v = ge(!1);
4959
4987
  if (K(() => (v.current = !1, () => {
4960
4988
  v.current = !0;
4961
- }), []), !p)
4989
+ }), []), !d)
4962
4990
  throw new Error("Must be called under a manifest or canvas context.");
4963
- return oc(
4991
+ return ac(
4964
4992
  (m) => {
4965
- o.getBestThumbnailAtSize(p, e, t).then((h) => {
4993
+ o.getBestThumbnailAtSize(d, e, t).then((h) => {
4966
4994
  h.best && !v.current && u(h.best);
4967
4995
  });
4968
4996
  },
4969
- [p]
4997
+ [d]
4970
4998
  ), a;
4971
4999
  }
4972
- function lc(e) {
5000
+ function fc(e) {
4973
5001
  return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: e };
4974
5002
  }
4975
- function fc(e, t) {
5003
+ function pc(e, t) {
4976
5004
  switch (t.type) {
4977
5005
  case "FINISHED":
4978
5006
  return { ...e, isFinished: !0, isPlaying: !1, playRequested: !1 };
@@ -4995,22 +5023,22 @@ function fc(e, t) {
4995
5023
  }
4996
5024
  return e;
4997
5025
  }
4998
- function pc(e) {
5026
+ function dc(e) {
4999
5027
  const t = Math.round(e);
5000
5028
  return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
5001
5029
  }
5002
- function Nt(e) {
5003
- const [t, r] = an(fc, lc(e.duration)), i = ge(null), n = ge(null), s = ge(null), o = ge(!1), a = D(() => {
5004
- n.current && i.current && (n.current.innerHTML = pc(i.current.currentTime), s.current && (s.current.style.width = `${i.current.currentTime / e.duration * 100}%`), o.current !== i.current.muted && (o.current = i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
5030
+ function Ht(e) {
5031
+ const [t, r] = an(pc, fc(e.duration)), i = ge(null), n = ge(null), s = ge(null), o = ge(!1), a = D(() => {
5032
+ n.current && i.current && (n.current.innerHTML = dc(i.current.currentTime), s.current && (s.current.style.width = `${i.current.currentTime / e.duration * 100}%`), o.current !== i.current.muted && (o.current = i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
5005
5033
  }, [e.duration]), u = D(() => {
5006
5034
  i.current && (r({ type: "PLAY_REQUESTED" }), i.current.play().then(() => {
5007
5035
  r({ type: "PLAY" });
5008
5036
  }), a());
5009
- }, [a]), d = D(() => {
5037
+ }, [a]), f = D(() => {
5010
5038
  i.current && (i.current.duration > 0 && i.current.paused ? u() : l());
5011
5039
  }, [a]), l = D(() => {
5012
5040
  i.current && (i.current.pause(), r({ type: "PAUSE" }), a());
5013
- }, [a]), p = D(() => {
5041
+ }, [a]), d = D(() => {
5014
5042
  i.current && (i.current.muted = !i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
5015
5043
  }, []), v = D(() => {
5016
5044
  i.current && (i.current.muted = !0, r({ type: "MUTE" }));
@@ -5039,10 +5067,10 @@ function Nt(e) {
5039
5067
  {
5040
5068
  play: u,
5041
5069
  pause: l,
5042
- playPause: d,
5070
+ playPause: f,
5043
5071
  mute: v,
5044
5072
  unmute: m,
5045
- toggleMute: p,
5073
+ toggleMute: d,
5046
5074
  setVolume: h,
5047
5075
  setDurationPercent: g,
5048
5076
  setTime: b
@@ -5050,19 +5078,19 @@ function Nt(e) {
5050
5078
  ];
5051
5079
  }
5052
5080
  const Di = ce(null), qi = ce(null), _i = ce(null);
5053
- function Ec() {
5081
+ function Pc() {
5054
5082
  const e = H(Di);
5055
5083
  if (!e)
5056
5084
  throw new Error("Ctx not found");
5057
5085
  return e;
5058
5086
  }
5059
- function Pc() {
5087
+ function Lc() {
5060
5088
  const e = H(qi);
5061
5089
  if (!e)
5062
5090
  throw new Error("Ctx not found");
5063
5091
  return e;
5064
5092
  }
5065
- function Lc() {
5093
+ function Fc() {
5066
5094
  const e = H(_i);
5067
5095
  if (!e)
5068
5096
  throw new Error("Ctx not found");
@@ -5079,7 +5107,7 @@ function Ui({
5079
5107
  return /* @__PURE__ */ x(_i.Provider, { value: { currentTime: i, progress: n, element: s }, children: /* @__PURE__ */ x(qi.Provider, { value: e, children: /* @__PURE__ */ x(Di.Provider, { value: t, children: r }) }) });
5080
5108
  }
5081
5109
  function Vi({ media: e, children: t }) {
5082
- const [{ element: r, currentTime: i, progress: n }, s, o] = Nt({ duration: e.duration });
5110
+ const [{ element: r, currentTime: i, progress: n }, s, o] = Ht({ duration: e.duration });
5083
5111
  return /* @__PURE__ */ N(
5084
5112
  Ui,
5085
5113
  {
@@ -5130,7 +5158,7 @@ function Bi({
5130
5158
  mediaControlsDeps: t,
5131
5159
  children: r
5132
5160
  }) {
5133
- const [{ element: i, currentTime: n, progress: s }, o, a] = Nt({ duration: e.duration });
5161
+ const [{ element: i, currentTime: n, progress: s }, o, a] = Ht({ duration: e.duration });
5134
5162
  return Le("overlay", "video-element", Hi, {
5135
5163
  element: i,
5136
5164
  media: e,
@@ -5193,18 +5221,18 @@ function Qi({ style: e }) {
5193
5221
  );
5194
5222
  }
5195
5223
  const Yi = me.createContext("en");
5196
- function Fc(e) {
5224
+ function jc(e) {
5197
5225
  return /* @__PURE__ */ x(Yi.Provider, { value: e.language, children: e.children });
5198
5226
  }
5199
- function Ht() {
5227
+ function Bt() {
5200
5228
  return me.useContext(Yi);
5201
5229
  }
5202
- function dr(e) {
5230
+ function hr(e) {
5203
5231
  return e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : e;
5204
5232
  }
5205
- function dc({ as: e, language: t, children: r, viewingDirection: i, ...n }) {
5206
- const s = Ht();
5207
- return E(() => dr(s) === dr(t), [s, t]) ? e ? /* @__PURE__ */ x(e, { ...n, children: r }) : /* @__PURE__ */ x("span", { ...n, children: r }) : e ? /* @__PURE__ */ x(e, { ...n, lang: t, dir: i, children: r }) : /* @__PURE__ */ x("span", { ...n, lang: t, dir: i, children: r });
5233
+ function hc({ as: e, language: t, children: r, viewingDirection: i, ...n }) {
5234
+ const s = Bt();
5235
+ return E(() => hr(s) === hr(t), [s, t]) ? e ? /* @__PURE__ */ x(e, { ...n, children: r }) : /* @__PURE__ */ x("span", { ...n, children: r }) : e ? /* @__PURE__ */ x(e, { ...n, lang: t, dir: i, children: r }) : /* @__PURE__ */ x("span", { ...n, lang: t, dir: i, children: r });
5208
5236
  }
5209
5237
  function Gi(e, t, r) {
5210
5238
  if (t.length === 0)
@@ -5221,15 +5249,15 @@ function Gi(e, t, r) {
5221
5249
  return n;
5222
5250
  return t.indexOf("none") !== -1 ? "none" : t.indexOf("@none") !== -1 ? "@none" : t[0];
5223
5251
  }
5224
- const hc = (e, t = []) => {
5225
- const r = Ht();
5252
+ const yc = (e, t = []) => {
5253
+ const r = Bt();
5226
5254
  return E(() => {
5227
5255
  const i = e();
5228
5256
  return Gi(r, i, []);
5229
5257
  }, [r, ...t]);
5230
5258
  };
5231
- function yc(e, t) {
5232
- const r = hc(() => Object.keys(e || {}), [e]);
5259
+ function vc(e, t) {
5260
+ const r = yc(() => Object.keys(e || {}), [e]);
5233
5261
  return [
5234
5262
  E(() => {
5235
5263
  if (!e)
@@ -5243,8 +5271,8 @@ function yc(e, t) {
5243
5271
  r
5244
5272
  ];
5245
5273
  }
5246
- function jc() {
5247
- const e = Ht();
5274
+ function $c() {
5275
+ const e = Bt();
5248
5276
  return function(r, i, n) {
5249
5277
  const s = Object.keys(r || {}), o = Gi(e, s, []);
5250
5278
  if (!r)
@@ -5256,10 +5284,10 @@ function jc() {
5256
5284
  `) : "";
5257
5285
  };
5258
5286
  }
5259
- const vc = ({ as: e, defaultText: t, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5260
- const [s, o] = yc(i, t);
5287
+ const gc = ({ as: e, defaultText: t, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5288
+ const [s, o] = vc(i, t);
5261
5289
  return o ? /* @__PURE__ */ x(
5262
- dc,
5290
+ hc,
5263
5291
  {
5264
5292
  ...n,
5265
5293
  as: e,
@@ -5282,7 +5310,7 @@ const vc = ({ as: e, defaultText: t, enableDangerouslySetInnerHTML: r, children:
5282
5310
  }
5283
5311
  );
5284
5312
  };
5285
- function gc({
5313
+ function mc({
5286
5314
  element: e,
5287
5315
  media: t,
5288
5316
  playPause: r
@@ -5320,13 +5348,13 @@ function gc({
5320
5348
  )
5321
5349
  ] }) : null;
5322
5350
  }
5323
- function mc({
5351
+ function bc({
5324
5352
  media: e,
5325
5353
  mediaControlsDeps: t,
5326
5354
  children: r
5327
5355
  }) {
5328
- const [{ element: i, currentTime: n, progress: s }, o, a] = Nt({ duration: e.duration });
5329
- return Le("overlay", "video-element", gc, {
5356
+ const [{ element: i, currentTime: n, progress: s }, o, a] = Ht({ duration: e.duration });
5357
+ return Le("overlay", "video-element", mc, {
5330
5358
  element: i,
5331
5359
  media: e,
5332
5360
  playPause: a.playPause
@@ -5342,9 +5370,9 @@ function Ji({
5342
5370
  renderViewerControls: o,
5343
5371
  renderMediaControls: a,
5344
5372
  viewControlsDeps: u,
5345
- mediaControlsDeps: d,
5373
+ mediaControlsDeps: f,
5346
5374
  strategies: l,
5347
- throwOnUnknown: p,
5375
+ throwOnUnknown: d,
5348
5376
  backgroundStyle: v,
5349
5377
  alwaysShowBackground: m,
5350
5378
  keepCanvasScale: h = !1,
@@ -5353,7 +5381,7 @@ function Ji({
5353
5381
  onClickPaintingAnnotation: A,
5354
5382
  children: w
5355
5383
  }) {
5356
- const C = ue(), T = ei(C, ["deep-zoom"]), [j] = Ys(), I = Ks(), L = V(), P = E(() => jt(L), [L]), [M, $] = sc({
5384
+ const C = ue(), T = ei(C, ["deep-zoom"]), [j] = Gs(), I = Zs(), L = V(), P = E(() => $t(L), [L]), [M, $] = oc({
5357
5385
  strategies: l || ["images"],
5358
5386
  defaultChoices: n == null ? void 0 : n.map(({ id: O }) => O)
5359
5387
  }), ie = M.type === "images" ? M.choice : void 0, Z = E(() => h ? 1 : Math.max(
@@ -5363,7 +5391,7 @@ function Ji({
5363
5391
  return (O.width || 0) / ((W = O.target) == null ? void 0 : W.spatial.width);
5364
5392
  }) : []
5365
5393
  ), [h, M]);
5366
- Zs(Z), K(() => {
5394
+ Xs(Z), K(() => {
5367
5395
  i && i($);
5368
5396
  }, [M.annotations]), K(() => {
5369
5397
  if (n)
@@ -5371,19 +5399,19 @@ function Ji({
5371
5399
  typeof O.opacity < "u" && P.applyStyles({ id: O.id }, "atlas", {
5372
5400
  opacity: O.opacity
5373
5401
  });
5374
- }, [n]), hr(() => {
5402
+ }, [n]), yr(() => {
5375
5403
  r && r(ie);
5376
5404
  }, [ie]), Le(
5377
5405
  I && (M.type === "images" || M.type === "empty" || M.type === "textual-content" && o) ? "overlay" : "none",
5378
5406
  `canvas-portal-controls-${C == null ? void 0 : C.id}`,
5379
- Ft.Provider,
5407
+ jt.Provider,
5380
5408
  o ? {
5381
5409
  value: I || null,
5382
5410
  children: o(M)
5383
5411
  } : {},
5384
5412
  [C, I, M, ...u || []]
5385
5413
  );
5386
- const U = uc({ maxWidth: 256, maxHeight: 256 });
5414
+ const U = lc({ maxWidth: 256, maxHeight: 256 });
5387
5415
  if (!C)
5388
5416
  return null;
5389
5417
  const z = C.accompanyingCanvas, ee = U && U.type === "fixed" ? /* @__PURE__ */ x("world-object", { height: C.height, width: C.width, x: e, y: t, children: /* @__PURE__ */ x(
@@ -5401,13 +5429,13 @@ function Ji({
5401
5429
  if (M.type === "unknown") {
5402
5430
  if (ee)
5403
5431
  return ee;
5404
- if (p)
5432
+ if (d)
5405
5433
  throw new Error(M.reason || "Unknown image strategy");
5406
5434
  return null;
5407
5435
  }
5408
5436
  const ne = /* @__PURE__ */ N(Ke, { children: [
5409
- j ? /* @__PURE__ */ x(It, { page: j }) : null,
5410
- M.annotations && M.annotations.pages ? M.annotations.pages.map((O) => /* @__PURE__ */ x(It, { page: O }, O.id)) : null,
5437
+ j ? /* @__PURE__ */ x(Tt, { page: j }) : null,
5438
+ M.annotations && M.annotations.pages ? M.annotations.pages.map((O) => /* @__PURE__ */ x(Tt, { page: O }, O.id)) : null,
5411
5439
  w
5412
5440
  ] }), xe = M.type === "images" ? M.images.length : 0;
5413
5441
  return /* @__PURE__ */ N(Me, { children: [
@@ -5431,7 +5459,7 @@ function Ji({
5431
5459
  de.stopPropagation(), A(O.annotationId, O, de);
5432
5460
  } : void 0,
5433
5461
  target: ((X = O.target) == null ? void 0 : X.spatial) || void 0,
5434
- children: /* @__PURE__ */ x("div", { "data-textual-content": !0, children: /* @__PURE__ */ x(vc, { enableDangerouslySetInnerHTML: !0, children: O.text }) })
5462
+ children: /* @__PURE__ */ x("div", { "data-textual-content": !0, children: /* @__PURE__ */ x(gc, { enableDangerouslySetInnerHTML: !0, children: O.text }) })
5435
5463
  },
5436
5464
  W
5437
5465
  ),
@@ -5457,13 +5485,13 @@ function Ji({
5457
5485
  ne
5458
5486
  ] }) : null,
5459
5487
  M.type === "3d-model" ? /* @__PURE__ */ x(Wi, { model: M.model }) : null,
5460
- M.type === "media" ? /* @__PURE__ */ x(Me, { children: M.media.type === "Sound" ? /* @__PURE__ */ N(Ni, { media: M.media, mediaControlsDeps: d, children: [
5488
+ M.type === "media" ? /* @__PURE__ */ x(Me, { children: M.media.type === "Sound" ? /* @__PURE__ */ N(Ni, { media: M.media, mediaControlsDeps: f, children: [
5461
5489
  ee,
5462
5490
  a ? a(M) : null
5463
- ] }) : M.media.type === "Video" ? /* @__PURE__ */ N(Bi, { media: M.media, mediaControlsDeps: d, children: [
5491
+ ] }) : M.media.type === "Video" ? /* @__PURE__ */ N(Bi, { media: M.media, mediaControlsDeps: f, children: [
5464
5492
  ee,
5465
5493
  a ? a(M) : null
5466
- ] }) : M.media.type === "VideoYouTube" && b ? /* @__PURE__ */ N(mc, { media: M.media, mediaControlsDeps: d, children: [
5494
+ ] }) : M.media.type === "VideoYouTube" && b ? /* @__PURE__ */ N(bc, { media: M.media, mediaControlsDeps: f, children: [
5467
5495
  ee,
5468
5496
  a ? a(M) : null
5469
5497
  ] }) : null }) : null
@@ -5471,15 +5499,15 @@ function Ji({
5471
5499
  },
5472
5500
  `${C.id}/${M.type}/${xe}`
5473
5501
  ),
5474
- M.type === "media" && M.media.type === "Sound" && z ? /* @__PURE__ */ x(Lt, { canvas: z.id, children: /* @__PURE__ */ x(Ji, { renderViewerControls: o }) }) : null
5502
+ M.type === "media" && M.media.type === "Sound" && z ? /* @__PURE__ */ x(Ft, { canvas: z.id, children: /* @__PURE__ */ x(Ji, { renderViewerControls: o }) }) : null
5475
5503
  ] });
5476
5504
  }
5477
- function bc() {
5505
+ function Ac() {
5478
5506
  const e = H(tt);
5479
5507
  return e && e.vault ? e.vault : Vr();
5480
5508
  }
5481
- const Ac = yr(function(t, r) {
5482
- const i = ke(), n = Br(), s = Ss(), { ViewerControls: o, MediaControls: a } = t.components || {};
5509
+ const xc = vr(function(t, r) {
5510
+ const i = ke(), n = Br(), s = Cs(), { ViewerControls: o, MediaControls: a } = t.components || {};
5483
5511
  if (cn(r, () => s, [s]), !i)
5484
5512
  return /* @__PURE__ */ x("div", {});
5485
5513
  let u = 0;
@@ -5490,30 +5518,30 @@ const Ac = yr(function(t, r) {
5490
5518
  {
5491
5519
  height: t.height,
5492
5520
  mode: t.mode,
5493
- children: n.map((d, l) => {
5494
- const p = u;
5495
- return u += d.width + (t.spacing || 0), /* @__PURE__ */ x(Lt, { canvas: d.id, children: /* @__PURE__ */ x(
5521
+ children: n.map((f, l) => {
5522
+ const d = u;
5523
+ return u += f.width + (t.spacing || 0), /* @__PURE__ */ x(Ft, { canvas: f.id, children: /* @__PURE__ */ x(
5496
5524
  J.RenderCanvas,
5497
5525
  {
5498
5526
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
5499
5527
  renderViewerControls: l === 0 && o ? () => /* @__PURE__ */ x(o, {}) : void 0,
5500
5528
  renderMediaControls: l === 0 && a ? () => /* @__PURE__ */ x(a, {}) : void 0,
5501
- x: p,
5529
+ x: d,
5502
5530
  ...t.canvasProps || {},
5503
5531
  children: t.annotations
5504
5532
  },
5505
- d.id
5506
- ) }, d.id);
5533
+ f.id
5534
+ ) }, f.id);
5507
5535
  })
5508
5536
  },
5509
5537
  t.reuseAtlas ? "" : s.currentSequenceIndex
5510
5538
  ),
5511
5539
  t.children
5512
5540
  ] });
5513
- }), J = yr(function({ children: t, height: r, annotations: i, canvasProps: n, spacing: s, header: o, components: a, mode: u, ...d }, l) {
5514
- const p = bc();
5515
- return /* @__PURE__ */ x(Nr, { vault: p, children: /* @__PURE__ */ x(ws, { ...d, children: /* @__PURE__ */ x(
5516
- Ac,
5541
+ }), J = vr(function({ children: t, height: r, annotations: i, canvasProps: n, spacing: s, header: o, components: a, mode: u, ...f }, l) {
5542
+ const d = Ac();
5543
+ return /* @__PURE__ */ x(Nr, { vault: d, children: /* @__PURE__ */ x(Ss, { ...f, children: /* @__PURE__ */ x(
5544
+ xc,
5517
5545
  {
5518
5546
  ref: l,
5519
5547
  height: r,
@@ -5529,9 +5557,9 @@ const Ac = yr(function(t, r) {
5529
5557
  });
5530
5558
  J.RenderImage = ai;
5531
5559
  J.RenderCanvas = Ji;
5532
- J.RenderAnnotationPage = It;
5560
+ J.RenderAnnotationPage = Tt;
5533
5561
  J.RenderAnnotation = oi;
5534
- J.Viewer = Xs;
5562
+ J.Viewer = eo;
5535
5563
  J.CanvasBackground = Qi;
5536
5564
  J.Audio = Ni;
5537
5565
  J.Video = Bi;
@@ -5539,21 +5567,21 @@ J.Model = Wi;
5539
5567
  J.AudioHTML = Vi;
5540
5568
  J.VideoHTML = Hi;
5541
5569
  J.ModelHTML = zi;
5542
- function $c({ annotation: e, children: t }) {
5570
+ function Dc({ annotation: e, children: t }) {
5543
5571
  return /* @__PURE__ */ x(Te, { value: { annotation: e }, children: t });
5544
5572
  }
5545
- function Dc({ annotationPage: e, children: t }) {
5573
+ function qc({ annotationPage: e, children: t }) {
5546
5574
  return /* @__PURE__ */ x(Te, { value: { annotationPage: e }, children: t });
5547
5575
  }
5548
- function qc({ collection: e, children: t }) {
5576
+ function _c({ collection: e, children: t }) {
5549
5577
  return /* @__PURE__ */ x(Te, { value: { collection: e }, children: t });
5550
5578
  }
5551
- function _c(e, t = {}) {
5552
- return Vt(t);
5579
+ function Uc(e, t = {}) {
5580
+ return Nt(t);
5553
5581
  }
5554
- function Uc(e, t = !1) {
5582
+ function Vc(e, t = !1) {
5555
5583
  }
5556
- function Vc(e) {
5584
+ function Nc(e) {
5557
5585
  const r = be().manifest, i = e ? e.map((n) => typeof n == "string" ? n : n == null ? void 0 : n.id) : [];
5558
5586
  return Q(
5559
5587
  (n) => {
@@ -5568,7 +5596,7 @@ function Vc(e) {
5568
5596
  [i.join("/")]
5569
5597
  );
5570
5598
  }
5571
- function Nc(e, t = []) {
5599
+ function Hc(e, t = []) {
5572
5600
  const { id: r, selector: i } = e, n = be(), s = r || n.collection, o = Q(
5573
5601
  (a) => s ? a.iiif.entities.Collection[s] : void 0,
5574
5602
  [s]
@@ -5578,7 +5606,7 @@ function Nc(e, t = []) {
5578
5606
  return i ? i(o) : o;
5579
5607
  }, [o, i, ...t]);
5580
5608
  }
5581
- function Hc(e, t, r, i, n = []) {
5609
+ function Bc(e, t, r, i, n = []) {
5582
5610
  const s = V(), o = E(() => Xr(s), [s]);
5583
5611
  K(() => {
5584
5612
  const a = e;
@@ -5588,15 +5616,15 @@ function Hc(e, t, r, i, n = []) {
5588
5616
  };
5589
5617
  }, [o, e, t, ...n]);
5590
5618
  }
5591
- function Bc(e, t) {
5619
+ function zc(e, t) {
5592
5620
  const { id: r, isLoaded: i, error: n, resource: s, requestId: o, cached: a } = Hr(
5593
5621
  e,
5594
5622
  t
5595
5623
  );
5596
5624
  return { id: r, isLoaded: i, error: n, manifest: s, requestId: o, cached: a };
5597
5625
  }
5598
- function xc({ cacheKey: e } = {}) {
5599
- const t = ue(), r = Vt(), i = V(), n = Ut(), [s, o] = B(void 0), [a, u] = B(!1), [d, l] = B("idle"), [p, v] = B(void 0), m = t ? t.id : "undefined", h = E(() => {
5626
+ function wc({ cacheKey: e } = {}) {
5627
+ const t = ue(), r = Nt(), i = V(), n = Vt(), [s, o] = B(void 0), [a, u] = B(!1), [f, l] = B("idle"), [d, v] = B(void 0), m = t ? t.id : "undefined", h = E(() => {
5600
5628
  try {
5601
5629
  if (t && r.length) {
5602
5630
  const b = r[0], A = i.get(b.body[0]), C = mt(A)[0];
@@ -5609,7 +5637,7 @@ function xc({ cacheKey: e } = {}) {
5609
5637
  } catch (b) {
5610
5638
  console.error(b);
5611
5639
  }
5612
- }, [m, e, t]), g = d === "success" && s ? s : h;
5640
+ }, [m, e, t]), g = f === "success" && s ? s : h;
5613
5641
  return K(() => {
5614
5642
  (async () => {
5615
5643
  try {
@@ -5636,12 +5664,12 @@ function xc({ cacheKey: e } = {}) {
5636
5664
  }, [m, e]), E(() => ({
5637
5665
  data: g,
5638
5666
  isFetching: a,
5639
- status: d,
5640
- error: p
5641
- }), [g, a, d, p]);
5667
+ status: f,
5668
+ error: d
5669
+ }), [g, a, f, d]);
5642
5670
  }
5643
- function zc() {
5644
- const e = xc();
5671
+ function Wc() {
5672
+ const e = wc();
5645
5673
  return {
5646
5674
  isLoading: e.isFetching,
5647
5675
  tile: e.data ? {
@@ -5653,106 +5681,106 @@ function zc() {
5653
5681
  } : null
5654
5682
  };
5655
5683
  }
5656
- function Wc() {
5684
+ function Qc() {
5657
5685
  const e = ke();
5658
5686
  return e ? e.service.find(
5659
5687
  (t) => t.profile === "SearchService1" || t.profile === "http://iiif.io/api/search/1/search"
5660
5688
  ) : void 0;
5661
5689
  }
5662
- function Qc() {
5690
+ function Yc() {
5663
5691
  const e = V();
5664
- return E(() => jt(e), [e]);
5692
+ return E(() => $t(e), [e]);
5665
5693
  }
5666
5694
  export {
5667
- $c as AnnotationContext,
5668
- Dc as AnnotationPageContext,
5669
- Lt as CanvasContext,
5695
+ Dc as AnnotationContext,
5696
+ qc as AnnotationPageContext,
5697
+ Ft as CanvasContext,
5670
5698
  J as CanvasPanel,
5671
- qc as CollectionContext,
5672
- Ms as ContextBridge,
5673
- Qa as ImageServiceLoaderContext,
5674
- xs as InnerViewerProvider,
5675
- Fc as LanguageProvider,
5676
- dc as LanguageString,
5677
- vc as LocaleString,
5678
- vs as ManifestContext,
5699
+ _c as CollectionContext,
5700
+ Rs as ContextBridge,
5701
+ Ya as ImageServiceLoaderContext,
5702
+ ws as InnerViewerProvider,
5703
+ jc as LanguageProvider,
5704
+ hc as LanguageString,
5705
+ gc as LocaleString,
5706
+ gs as ManifestContext,
5679
5707
  Ui as MediaPlayerProvider,
5680
- gs as RangeContext,
5708
+ ms as RangeContext,
5681
5709
  tt as ReactVaultContext,
5682
5710
  Te as ResourceProvider,
5683
- Et as ResourceReactContext,
5684
- ws as SimpleViewerProvider,
5711
+ Pt as ResourceReactContext,
5712
+ Ss as SimpleViewerProvider,
5685
5713
  it as SimpleViewerReactContext,
5686
5714
  Nr as VaultProvider,
5687
- Ft as ViewerPresetContext,
5688
- Gs as VirtualAnnotationProvider,
5715
+ jt as ViewerPresetContext,
5716
+ Js as VirtualAnnotationProvider,
5689
5717
  rt as VisibleCanvasReactContext,
5690
- _a as emptyActions,
5691
- Ua as emptyStrategy,
5718
+ Ua as emptyActions,
5719
+ Va as emptyStrategy,
5692
5720
  Re as expandTarget,
5693
5721
  zr as findAllCanvasesInRange,
5694
- ms as findFirstCanvasFromRange,
5695
- Tc as findManifestSelectedRange,
5722
+ bs as findFirstCanvasFromRange,
5723
+ kc as findManifestSelectedRange,
5696
5724
  Wr as findSelectedRange,
5697
- Ha as flattenAnnotationPageIds,
5698
- pc as formatTime,
5699
- Za as getImageStrategy,
5725
+ Ba as flattenAnnotationPageIds,
5726
+ dc as formatTime,
5727
+ Xa as getImageStrategy,
5700
5728
  Qr as getManifestSequence,
5701
5729
  Li as getParsedTargetSelector,
5702
- kc as getVisibleCanvasesFromCanvasId,
5703
- Mo as isImageApiSelector,
5704
- Ro as parseRotation,
5730
+ Oc as getVisibleCanvasesFromCanvasId,
5731
+ Ro as isImageApiSelector,
5732
+ Io as parseRotation,
5705
5733
  Ye as parseSelector,
5706
- Oc as parseSpecificResource,
5734
+ Ec as parseSpecificResource,
5707
5735
  gt as unknownResponse,
5708
5736
  _ as unsupportedStrategy,
5709
5737
  si as useAnnotation,
5710
- Io as useAnnotationPage,
5711
- za as useAnnotationPageManager,
5712
- _c as useAnnotationsAtTime,
5738
+ To as useAnnotationPage,
5739
+ Wa as useAnnotationPageManager,
5740
+ Uc as useAnnotationsAtTime,
5713
5741
  ue as useCanvas,
5714
- Uc as useCanvasClock,
5715
- As as useCanvasSequence,
5716
- Vc as useCanvasSubset,
5717
- hc as useClosestLanguage,
5718
- Nc as useCollection,
5719
- Cs as useContextBridge,
5720
- jc as useCreateLocaleString,
5721
- Ws as useDispatch,
5722
- Hc as useEventListener,
5723
- bc as useExistingVault,
5724
- Bc as useExternalCollection,
5725
- ys as useExternalManifest,
5742
+ Vc as useCanvasClock,
5743
+ xs as useCanvasSequence,
5744
+ Nc as useCanvasSubset,
5745
+ yc as useClosestLanguage,
5746
+ Hc as useCollection,
5747
+ Ms as useContextBridge,
5748
+ $c as useCreateLocaleString,
5749
+ Qs as useDispatch,
5750
+ Bc as useEventListener,
5751
+ Ac as useExistingVault,
5752
+ zc as useExternalCollection,
5753
+ vs as useExternalManifest,
5726
5754
  Hr as useExternalResource,
5727
- Ht as useIIIFLanguage,
5728
- xc as useImageService,
5729
- Ut as useImageServiceLoader,
5730
- zc as useImageTile,
5731
- Ya as useLoadImageService,
5732
- yc as useLocaleString,
5755
+ Bt as useIIIFLanguage,
5756
+ wc as useImageService,
5757
+ Vt as useImageServiceLoader,
5758
+ Wc as useImageTile,
5759
+ Ga as useLoadImageService,
5760
+ vc as useLocaleString,
5733
5761
  ke as useManifest,
5734
- Pc as useMediaActions,
5735
- Lc as useMediaElements,
5736
- Ec as useMediaState,
5737
- Ka as usePaintables,
5738
- Vt as usePaintingAnnotations,
5739
- bs as useRange,
5740
- sc as useRenderingStrategy,
5762
+ Lc as useMediaActions,
5763
+ Fc as useMediaElements,
5764
+ Pc as useMediaState,
5765
+ Za as usePaintables,
5766
+ Nt as usePaintingAnnotations,
5767
+ As as useRange,
5768
+ oc as useRenderingStrategy,
5741
5769
  be as useResourceContext,
5742
5770
  ei as useResourceEvents,
5743
- Wa as useResources,
5744
- Wc as useSearchService,
5745
- Nt as useSimpleMediaPlayer,
5746
- Ss as useSimpleViewer,
5747
- Qc as useStyleHelper,
5771
+ Qa as useResources,
5772
+ Qc as useSearchService,
5773
+ Ht as useSimpleMediaPlayer,
5774
+ Cs as useSimpleViewer,
5775
+ Yc as useStyleHelper,
5748
5776
  et as useStyles,
5749
- uc as useThumbnail,
5777
+ lc as useThumbnail,
5750
5778
  V as useVault,
5751
- oc as useVaultEffect,
5779
+ ac as useVaultEffect,
5752
5780
  Q as useVaultSelector,
5753
- Ks as useViewerPreset,
5754
- Qs as useVirtualAnnotationPage,
5755
- Ys as useVirtualAnnotationPageContext,
5781
+ Zs as useViewerPreset,
5782
+ Ys as useVirtualAnnotationPage,
5783
+ Gs as useVirtualAnnotationPageContext,
5756
5784
  Br as useVisibleCanvases
5757
5785
  };
5758
5786
  //# sourceMappingURL=index.mjs.map