react-iiif-vault 1.0.2 → 1.0.4

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 V, Fragment as Me } from "react/jsx-runtime";
2
2
  import * as ot from "react";
3
- import ge, { useContext as Q, useMemo as j, useState as J, useEffect as re, useCallback as D, createContext as ce, useRef as ve, useLayoutEffect as ur, Fragment as Je, useReducer as Gi, forwardRef as lr, useImperativeHandle as Ji } from "react";
3
+ import ge, { useContext as Q, useMemo as j, useState as J, useEffect as re, useCallback as D, createContext as ce, useRef as ve, useLayoutEffect as lr, Fragment as Je, useReducer as Gi, forwardRef as fr, useImperativeHandle as Ji } from "react";
4
4
  import { AtlasAuto as Ki, ModeContext as Zi, mergeStyles as Xi, RegionHighlight as en, TileSet as tn, HTMLPortal as rn } from "@atlas-viewer/atlas";
5
- import { serialize as nn, serializeConfigPresentation2 as sn, serializeConfigPresentation3 as an, isSpecificResource as on, HAS_PART as Ke, PART_OF as Ze, frameResource as fr, normalize as cn } from "@iiif/parser";
6
- import { ImageServiceLoader as pr, getImageServices as un, getFixedSizeFromImage as Ht } from "@atlas-viewer/iiif-image-api";
5
+ import { serialize as nn, serializeConfigPresentation2 as sn, serializeConfigPresentation3 as an, isSpecificResource as on, HAS_PART as Ke, PART_OF as Ze, frameResource as pr, normalize as cn } from "@iiif/parser";
6
+ import { ImageServiceLoader as hr, getImageServices as un, getFixedSizeFromImage as Bt } from "@atlas-viewer/iiif-image-api";
7
7
  function mt(t, e) {
8
8
  return mt = Object.setPrototypeOf || function(i, n) {
9
9
  return i.__proto__ = n, i;
@@ -16,14 +16,14 @@ var fn = function(e, r) {
16
16
  return e === void 0 && (e = []), r === void 0 && (r = []), e.length !== r.length || e.some(function(i, n) {
17
17
  return !Object.is(i, r[n]);
18
18
  });
19
- }, Bt = {
19
+ }, zt = {
20
20
  error: null
21
21
  }, pn = /* @__PURE__ */ function(t) {
22
22
  ln(e, t);
23
23
  function e() {
24
24
  for (var i, n = arguments.length, s = new Array(n), a = 0; a < n; a++)
25
25
  s[a] = arguments[a];
26
- return i = t.call.apply(t, [this].concat(s)) || this, i.state = Bt, i.resetErrorBoundary = function() {
26
+ return i = t.call.apply(t, [this].concat(s)) || this, i.state = zt, i.resetErrorBoundary = function() {
27
27
  for (var o, u = arguments.length, h = new Array(u), l = 0; l < u; l++)
28
28
  h[l] = arguments[l];
29
29
  i.props.onReset == null || (o = i.props).onReset.apply(o, h), i.reset();
@@ -36,7 +36,7 @@ var fn = function(e, r) {
36
36
  };
37
37
  var r = e.prototype;
38
38
  return r.reset = function() {
39
- this.setState(Bt);
39
+ this.setState(zt);
40
40
  }, r.componentDidCatch = function(n, s) {
41
41
  var a, o;
42
42
  (a = (o = this.props).onError) == null || a.call(o, n, s);
@@ -71,13 +71,13 @@ const hn = {
71
71
  canvas: void 0,
72
72
  annotation: void 0,
73
73
  annotationPage: void 0
74
- }, Ot = ge.createContext(hn), Ee = () => Q(Ot);
74
+ }, Et = ge.createContext(hn), Ee = () => Q(Et);
75
75
  function et({ value: t, children: e }) {
76
76
  const r = Ee(), i = j(() => ({
77
77
  ...r,
78
78
  ...t
79
79
  }), [t, r]);
80
- return /* @__PURE__ */ x(Ot.Provider, { value: i, children: e });
80
+ return /* @__PURE__ */ x(Et.Provider, { value: i, children: e });
81
81
  }
82
82
  var dn = Object.defineProperty, yn = (t, e, r) => e in t ? dn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ye = (t, e, r) => (yn(t, typeof e != "symbol" ? e + "" : e, r), r);
83
83
  const q = function(t) {
@@ -89,8 +89,8 @@ const q = function(t) {
89
89
  ...i !== void 0 && { meta: i }
90
90
  });
91
91
  };
92
- }, hr = "@iiif/IMPORT_ENTITIES", dr = "@iiif/MODIFY_ENTITY_FIELD", yr = "@iiif/REORDER_ENTITY_FIELD", vr = "@iiif/ADD_REFERENCE", bt = "@iiif/UPDATE_REFERENCE", gr = "@iiif/REMOVE_REFERENCE", mr = "@iiif/ADD_METADATA", br = "@iiif/REMOVE_METADATA", At = "@iiif/UPDATE_METADATA", Ar = "@iiif/REORDER_METADATA", xr = q(hr)(), vn = q(dr)(), gn = q(yr)(), mn = q(vr)(), bn = q(gr)(), An = q(bt)(), xn = q(mr)(), wn = q(At)(), Sn = q(br)(), Mn = q(Ar)(), Cn = {
93
- importEntities: xr,
92
+ }, dr = "@iiif/IMPORT_ENTITIES", yr = "@iiif/MODIFY_ENTITY_FIELD", vr = "@iiif/REORDER_ENTITY_FIELD", gr = "@iiif/ADD_REFERENCE", bt = "@iiif/UPDATE_REFERENCE", mr = "@iiif/REMOVE_REFERENCE", br = "@iiif/ADD_METADATA", Ar = "@iiif/REMOVE_METADATA", At = "@iiif/UPDATE_METADATA", xr = "@iiif/REORDER_METADATA", wr = q(dr)(), vn = q(yr)(), gn = q(vr)(), mn = q(gr)(), bn = q(mr)(), An = q(bt)(), xn = q(br)(), wn = q(At)(), Sn = q(Ar)(), Mn = q(xr)(), Cn = {
93
+ importEntities: wr,
94
94
  modifyEntityField: vn,
95
95
  reorderEntityField: gn,
96
96
  addReference: mn,
@@ -100,23 +100,23 @@ const q = function(t) {
100
100
  removeMetadata: Sn,
101
101
  updateMetadata: wn,
102
102
  reorderMetadata: Mn
103
- }, wr = "@iiif/ADD_MAPPING", Sr = "@iiif/ADD_MAPPINGS", Rn = q(wr)(), Tn = q(Sr)(), Mr = "@iiif/SET_META_VALUE", Cr = "@iiif/SET_META_VALUE_DYNAMIC", Rr = "@iiif/UNSET_META_VALUE", In = q(Mr)(), kn = q(Cr)(), On = q(Rr)(), zt = {
103
+ }, Sr = "@iiif/ADD_MAPPING", Mr = "@iiif/ADD_MAPPINGS", Rn = q(Sr)(), Tn = q(Mr)(), Cr = "@iiif/SET_META_VALUE", Rr = "@iiif/SET_META_VALUE_DYNAMIC", Tr = "@iiif/UNSET_META_VALUE", In = q(Cr)(), kn = q(Rr)(), On = q(Tr)(), Wt = {
104
104
  setMetaValue: In,
105
105
  setMetaValueDynamic: kn,
106
106
  unsetMetaValue: On
107
- }, xt = "RESOURCE_ERROR", Tr = "RESOURCE_LOADING", wt = "RESOURCE_READY", Ir = "@iiif/REQUEST_RESOURCE", kr = "@iiif/REQUEST_ERROR", Or = "@iiif/REQUEST_MISMATCH", Er = "@iiif/REQUEST_COMPLETE", En = "@iiif/REQUEST_OFFLINE_RESOURCE", Pn = q(Ir)(), Pr = q(kr)(), Ln = q(Or)(), Fn = q(Er)(), Et = "@iiif/BATCH", jn = "@iiif/BATCH_IMPORT", St = q(Et)(), $n = (t, e) => {
107
+ }, xt = "RESOURCE_ERROR", Ir = "RESOURCE_LOADING", wt = "RESOURCE_READY", kr = "@iiif/REQUEST_RESOURCE", Or = "@iiif/REQUEST_ERROR", Er = "@iiif/REQUEST_MISMATCH", Pr = "@iiif/REQUEST_COMPLETE", En = "@iiif/REQUEST_OFFLINE_RESOURCE", Pn = q(kr)(), St = q(Or)(), Ln = q(Er)(), Fn = q(Pr)(), Pt = "@iiif/BATCH", jn = "@iiif/BATCH_IMPORT", Mt = q(Pt)(), $n = (t, e) => {
108
108
  const { entities: r, resource: i, mapping: n } = cn(e);
109
109
  if (i.id === void 0)
110
- return [Pr({ id: t, message: "ID is not defined in resource." })];
111
- const s = [xr({ entities: r }), Tn({ mapping: n })];
110
+ return [St({ id: t, message: "ID is not defined in resource." })];
111
+ const s = [wr({ entities: r }), Tn({ mapping: n })];
112
112
  return i.id !== t && (s.push(Rn({ id: t, type: i.type })), s.push(Ln({ requestId: t, actualId: i.id }))), s.push(Fn({ id: t })), s;
113
- }, Wt = Number.isNaN || function(t) {
113
+ }, Qt = Number.isNaN || function(t) {
114
114
  return typeof t == "number" && t !== t;
115
115
  };
116
116
  function Dn(t, e) {
117
- return !!(t === e || Wt(t) && Wt(e));
117
+ return !!(t === e || Qt(t) && Qt(e));
118
118
  }
119
- function Qt(t, e) {
119
+ function Yt(t, e) {
120
120
  if (!Array.isArray(t) || !Array.isArray(e))
121
121
  return t === e;
122
122
  if (t.length !== e.length)
@@ -133,63 +133,79 @@ function ct(t, e, r) {
133
133
  const s = t.iiif.entities[n][i.resourceUri];
134
134
  if (s && s[Ke]) {
135
135
  const a = s[Ke].find((o) => r ? o[Ze] === r.id : o[Ze] === s.id);
136
- return fr(s, a);
136
+ return pr(s, a);
137
137
  }
138
138
  return s;
139
139
  }
140
- function Yt(t, e, { waitTimeout: r = 30 } = {}) {
141
- return async (i, n) => {
140
+ function qn(t) {
141
+ return t && typeof t.then == "function";
142
+ }
143
+ function Gt(t, e, { waitTimeout: r = 30 } = {}) {
144
+ return (i, n) => {
142
145
  const s = t.getStore(), a = s.getState(), o = a.iiif.requests[i];
143
- if (o)
146
+ if (o) {
147
+ if (o.loadingState === wt) {
148
+ const h = ct(a, i);
149
+ if (h)
150
+ return h;
151
+ }
144
152
  switch (o.loadingState) {
145
153
  case xt:
146
154
  break;
147
- case Tr: {
148
- let u, h = !1;
149
- try {
150
- const l = await Promise.race([
151
- new Promise((p, v) => {
152
- h || (u = s.subscribe(() => {
153
- const m = s.getState();
154
- if (m.iiif.requests[i].loadingState === xt) {
155
- v();
156
- return;
157
- }
158
- if (m.iiif.requests[i].loadingState === wt) {
159
- const d = ct(m, i);
160
- d ? p(d) : v();
161
- }
162
- }));
163
- }),
164
- new Promise(
165
- (p, v) => setTimeout(() => {
166
- h = !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 wt: {
179
- const u = ct(a, i);
180
- if (u)
181
- return u;
182
- break;
183
- }
155
+ case Ir:
156
+ return (async () => {
157
+ let h, l = !1;
158
+ try {
159
+ const p = await Promise.race([
160
+ new Promise((v, m) => {
161
+ l || (h = s.subscribe(() => {
162
+ const d = s.getState();
163
+ if (d.iiif.requests[i].loadingState === xt) {
164
+ m();
165
+ return;
166
+ }
167
+ if (d.iiif.requests[i].loadingState === wt) {
168
+ const g = ct(d, 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 (h && h(), p)
183
+ return p;
184
+ } catch {
185
+ h && h();
186
+ }
187
+ })();
184
188
  }
189
+ }
185
190
  t.dispatch(Pn({ id: i }));
191
+ const u = (h) => {
192
+ if (!h)
193
+ return;
194
+ !h.id && !h["@id"] && (h["@type"] && (h["@id"] = i), h.id = i);
195
+ const l = $n(i, h);
196
+ return t.dispatch(Mt({ actions: l })), ct(s.getState(), i);
197
+ };
186
198
  try {
187
- const u = await e(i, n);
188
- !u.id && !u["@id"] && (u["@type"] && (u["@id"] = i), u.id = i);
189
- const h = $n(i, u);
190
- return t.dispatch(St({ actions: h })), ct(s.getState(), i);
191
- } catch (u) {
192
- throw t.dispatch(Pr({ id: i, message: u.toString() })), u;
199
+ const h = e(i, n);
200
+ return qn(h) ? (async () => {
201
+ try {
202
+ return u(await h);
203
+ } catch (l) {
204
+ throw t.dispatch(St({ id: i, message: l.toString() })), l;
205
+ }
206
+ })() : u(h);
207
+ } catch (h) {
208
+ throw t.dispatch(St({ id: i, message: h.toString() })), h;
193
209
  }
194
210
  };
195
211
  }
@@ -208,7 +224,7 @@ function Lr() {
208
224
  Agent: {}
209
225
  };
210
226
  }
211
- const Gt = (t) => {
227
+ const Jt = (t) => {
212
228
  let e;
213
229
  const r = /* @__PURE__ */ new Set(), i = (a, o) => {
214
230
  const u = typeof a == "function" ? a(e) : a;
@@ -220,26 +236,26 @@ const Gt = (t) => {
220
236
  r.clear();
221
237
  } };
222
238
  return e = t(i, n, s), s;
223
- }, qn = (t) => t ? Gt(t) : Gt, _n = (t, e) => (r, i, n) => (n.dispatch = (s) => (r((a) => t(a, s), !1, s), s), n.dispatchFromDevtools = !0, { dispatch: (...s) => n.dispatch(...s), ...e }), Un = _n, Mt = /* @__PURE__ */ new Map(), Ve = (t) => {
224
- const e = Mt.get(t);
239
+ }, _n = (t) => t ? Jt(t) : Jt, Un = (t, e) => (r, i, n) => (n.dispatch = (s) => (r((a) => t(a, s), !1, s), s), n.dispatchFromDevtools = !0, { dispatch: (...s) => n.dispatch(...s), ...e }), Vn = Un, Ct = /* @__PURE__ */ new Map(), Ve = (t) => {
240
+ const e = Ct.get(t);
225
241
  return e ? Object.fromEntries(
226
242
  Object.entries(e.stores).map(([r, i]) => [r, i.getState()])
227
243
  ) : {};
228
- }, Vn = (t, e, r) => {
244
+ }, Nn = (t, e, r) => {
229
245
  if (t === void 0)
230
246
  return {
231
247
  type: "untracked",
232
248
  connection: e.connect(r)
233
249
  };
234
- const i = Mt.get(r.name);
250
+ const i = Ct.get(r.name);
235
251
  if (i)
236
252
  return { type: "tracked", store: t, ...i };
237
253
  const n = {
238
254
  connection: e.connect(r),
239
255
  stores: {}
240
256
  };
241
- return Mt.set(r.name, n), { type: "tracked", store: t, ...n };
242
- }, Nn = (t, e = {}) => (r, i, n) => {
257
+ return Ct.set(r.name, n), { type: "tracked", store: t, ...n };
258
+ }, Hn = (t, e = {}) => (r, i, n) => {
243
259
  const { enabled: s, anonymousActionType: a, store: o, ...u } = e;
244
260
  let h;
245
261
  try {
@@ -248,7 +264,7 @@ const Gt = (t) => {
248
264
  }
249
265
  if (!h)
250
266
  return t(r, i, n);
251
- const { connection: l, ...p } = Vn(o, h, u);
267
+ const { connection: l, ...p } = Nn(o, h, u);
252
268
  let v = !0;
253
269
  n.setState = (g, A, b) => {
254
270
  const w = r(g, A);
@@ -361,7 +377,7 @@ const Gt = (t) => {
361
377
  return;
362
378
  }
363
379
  }), d;
364
- }, Hn = Nn, ut = (t, e) => {
380
+ }, Bn = Hn, ut = (t, e) => {
365
381
  let r;
366
382
  try {
367
383
  r = JSON.parse(t);
@@ -372,7 +388,7 @@ const Gt = (t) => {
372
388
  );
373
389
  }
374
390
  r !== void 0 && e(r);
375
- }, Bn = (t) => (e, r, i) => {
391
+ }, zn = (t) => (e, r, i) => {
376
392
  const n = i.subscribe;
377
393
  return i.subscribe = (s, a, o) => {
378
394
  let u = s;
@@ -389,14 +405,14 @@ const Gt = (t) => {
389
405
  }
390
406
  return n(u);
391
407
  }, t(e, r, i);
392
- }, zn = Bn, Wn = (t = {}, e) => {
408
+ }, Wn = zn, Qn = (t = {}, e) => {
393
409
  switch (e.type) {
394
- case wr:
410
+ case Sr:
395
411
  return {
396
412
  ...t,
397
413
  [e.payload.id]: e.payload.type
398
414
  };
399
- case Sr:
415
+ case Mr:
400
416
  return {
401
417
  ...t,
402
418
  ...e.payload.mapping
@@ -408,7 +424,7 @@ const Gt = (t) => {
408
424
  function lt(t, e, r, i) {
409
425
  return !(!t[r] || !t[r][e] || !t[r][e][i] || !Array.isArray(t[r][e][i]));
410
426
  }
411
- function Qn(t, e) {
427
+ function Yn(t, e) {
412
428
  const r = {}, i = [];
413
429
  for (const [n, s] of Object.entries(t || {})) {
414
430
  i.push(n);
@@ -429,7 +445,7 @@ function C(t) {
429
445
  function ft(t, e) {
430
446
  return typeof t > "u" ? e : t;
431
447
  }
432
- const Yn = (t = Lr(), e) => {
448
+ const Gn = (t = Lr(), e) => {
433
449
  var r;
434
450
  const i = (n, s) => ({
435
451
  ...t,
@@ -442,13 +458,13 @@ const Yn = (t = Lr(), e) => {
442
458
  }
443
459
  });
444
460
  switch (e.type) {
445
- case dr: {
461
+ case yr: {
446
462
  if (!t[C(e).type] || !t[C(e).type][C(e).id])
447
463
  return t;
448
464
  const n = t[C(e).type][C(e).id];
449
465
  return typeof n == "string" ? t : i(n, { [C(e).key]: C(e).value });
450
466
  }
451
- case yr: {
467
+ case vr: {
452
468
  if (!lt(t, C(e).id, C(e).type, C(e).key))
453
469
  return t;
454
470
  const n = t[C(e).type][C(e).id];
@@ -457,7 +473,7 @@ const Yn = (t = Lr(), e) => {
457
473
  const s = Array.from(n[C(e).key]), [a] = s.splice(C(e).startIndex, 1);
458
474
  return s.splice(C(e).endIndex, 0, a), i(n, { [C(e).key]: s });
459
475
  }
460
- case hr: {
476
+ case dr: {
461
477
  const n = Object.keys(C(e).entities), s = { ...t };
462
478
  for (const a of n) {
463
479
  const o = C(e).entities[a], u = { ...t[a] || {} };
@@ -465,20 +481,20 @@ const Yn = (t = Lr(), e) => {
465
481
  const l = Object.keys(o || {}) || [];
466
482
  if (o && l) {
467
483
  for (const p of l)
468
- h = !0, u[p] = t[a][p] ? Qn(t[a][p], o[p]) : o[p];
484
+ h = !0, u[p] = t[a][p] ? Yn(t[a][p], o[p]) : o[p];
469
485
  h && (s[a] = u);
470
486
  }
471
487
  }
472
488
  return s;
473
489
  }
474
- case vr: {
490
+ case gr: {
475
491
  if (!lt(t, C(e).id, C(e).type, C(e).key))
476
492
  return t;
477
493
  const n = t[C(e).type][C(e).id], s = Array.from(n[C(e).key]);
478
494
  return s.splice(ft(C(e).index, s.length + 1), 0, C(e).reference), i(n, { [C(e).key]: s });
479
495
  }
480
496
  case bt:
481
- case gr: {
497
+ case mr: {
482
498
  if (!lt(t, C(e).id, C(e).type, C(e).key))
483
499
  return t;
484
500
  const n = t[C(e).type][C(e).id], s = Array.from(n[C(e).key]), a = ft(
@@ -487,7 +503,7 @@ const Yn = (t = Lr(), e) => {
487
503
  );
488
504
  return a === -1 || ((r = s[a]) == null ? void 0 : r.id) !== C(e).reference.id ? t : (e.type === bt ? s.splice(a, 1, C(e).reference) : s.splice(a, 1), i(n, { [C(e).key]: s }));
489
505
  }
490
- case mr: {
506
+ case br: {
491
507
  const n = t[C(e).type][C(e).id];
492
508
  if (!n)
493
509
  return t;
@@ -497,7 +513,7 @@ const Yn = (t = Lr(), e) => {
497
513
  value: a.label
498
514
  }), i(n, { metadata: s });
499
515
  }
500
- case Ar: {
516
+ case xr: {
501
517
  const n = t[C(e).type][C(e).id];
502
518
  if (typeof n == "string" || !n)
503
519
  return t;
@@ -505,27 +521,27 @@ const Yn = (t = Lr(), e) => {
505
521
  return s.splice(C(e).endIndex, 0, a), i(n, { metadata: s });
506
522
  }
507
523
  case At:
508
- case br: {
524
+ case Ar: {
509
525
  const n = t[C(e).type][C(e).id], s = Array.from(n.metadata || []), a = C(e).atIndex;
510
526
  return typeof a > "u" || a === -1 || !s[a] ? t : (e.type === At ? s.splice(a, 1, { label: C(e).label, value: C(e).value }) : s.splice(a, 1), i(n, { metadata: s }));
511
527
  }
512
528
  default:
513
529
  return t;
514
530
  }
515
- }, Gn = (t = {}, e) => {
531
+ }, Jn = (t = {}, e) => {
516
532
  switch (e.type) {
517
- case Ir:
533
+ case kr:
518
534
  case En:
519
535
  return {
520
536
  ...t,
521
537
  [e.payload.id]: {
522
538
  requestUri: e.payload.id,
523
- loadingState: Tr,
539
+ loadingState: Ir,
524
540
  uriMismatch: !1,
525
541
  resourceUri: e.payload.id
526
542
  }
527
543
  };
528
- case Or:
544
+ case Er:
529
545
  return {
530
546
  ...t,
531
547
  [e.payload.requestId]: {
@@ -540,7 +556,7 @@ const Yn = (t = Lr(), e) => {
540
556
  resourceUri: e.payload.actualId
541
557
  }
542
558
  };
543
- case kr:
559
+ case Or:
544
560
  return {
545
561
  ...t,
546
562
  [e.payload.id]: {
@@ -549,7 +565,7 @@ const Yn = (t = Lr(), e) => {
549
565
  error: e.payload.message
550
566
  }
551
567
  };
552
- case Er:
568
+ case Pr:
553
569
  return {
554
570
  ...t,
555
571
  [e.payload.id]: {
@@ -560,10 +576,10 @@ const Yn = (t = Lr(), e) => {
560
576
  };
561
577
  }
562
578
  return t;
563
- }, Jn = (t = {}, e) => {
579
+ }, Kn = (t = {}, e) => {
564
580
  const { id: r, updateValue: i, value: n, meta: s, key: a } = e && e.payload || {};
565
581
  switch (e.type) {
566
- case Mr:
582
+ case Cr:
567
583
  return {
568
584
  ...t,
569
585
  [r]: {
@@ -574,7 +590,7 @@ const Yn = (t = Lr(), e) => {
574
590
  }
575
591
  }
576
592
  };
577
- case Cr:
593
+ case Rr:
578
594
  return {
579
595
  ...t,
580
596
  [r]: {
@@ -585,7 +601,7 @@ const Yn = (t = Lr(), e) => {
585
601
  }
586
602
  }
587
603
  };
588
- case Rr:
604
+ case Tr:
589
605
  return t[r] && t[r][s] && t[r][s][a] ? {
590
606
  ...t,
591
607
  [r]: {
@@ -612,8 +628,8 @@ function Fr(t = {}) {
612
628
  return n ? s : r;
613
629
  };
614
630
  }
615
- function Kn(t) {
616
- return (e, r) => r && r.type === Et ? r.payload.actions.reduce(t, e) : r && r.type === jn ? {
631
+ function Zn(t) {
632
+ return (e, r) => r && r.type === Pt ? r.payload.actions.reduce(t, e) : r && r.type === jn ? {
617
633
  ...e,
618
634
  iiif: {
619
635
  ...e.iiif,
@@ -621,13 +637,13 @@ function Kn(t) {
621
637
  }
622
638
  } : t(e, r);
623
639
  }
624
- const Zn = Fr({
625
- mapping: Wn,
626
- entities: Yn,
627
- requests: Gn,
628
- meta: Jn
640
+ const Xn = Fr({
641
+ mapping: Qn,
642
+ entities: Gn,
643
+ requests: Jn,
644
+ meta: Kn
629
645
  });
630
- function Xn() {
646
+ function es() {
631
647
  return {
632
648
  iiif: {
633
649
  entities: Lr(),
@@ -637,16 +653,16 @@ function Xn() {
637
653
  }
638
654
  };
639
655
  }
640
- function es(t = {}) {
656
+ function ts(t = {}) {
641
657
  const {
642
658
  enableDevtools: e = !1,
643
659
  iiifStoreName: r = "iiif",
644
- defaultState: i = Xn(),
660
+ defaultState: i = es(),
645
661
  customReducers: n = {}
646
- } = t, s = Kn(Fr({ [r]: Zn, ...n }));
647
- return qn(zn(Hn(Un(s, i), { enabled: e })));
662
+ } = t, s = Zn(Fr({ [r]: Xn, ...n }));
663
+ return _n(Wn(Bn(Vn(s, i), { enabled: e })));
648
664
  }
649
- function ts(t) {
665
+ function rs(t) {
650
666
  return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, r) {
651
667
  var i = t.get(e);
652
668
  i ? i.push(r) : t.set(e, [r]);
@@ -683,14 +699,14 @@ function z(t, e, r, i = !0) {
683
699
  }
684
700
  });
685
701
  }
686
- const we = Symbol.for("_refs_"), xe = Symbol.for("_reactive_"), Te = Symbol.for("_defined_"), Jt = Symbol.for("_parent_");
687
- function rs(t, e = !1, r) {
702
+ const we = Symbol.for("_refs_"), xe = Symbol.for("_reactive_"), Te = Symbol.for("_defined_"), Kt = Symbol.for("_parent_");
703
+ function is(t, e = !1, r) {
688
704
  const i = {
689
705
  id: "",
690
706
  type: "unknown",
691
707
  [Te]: [],
692
708
  [we]: {},
693
- [Jt]: r || null,
709
+ [Kt]: r || null,
694
710
  [xe]: 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 rs(t, e = !1, r) {
714
730
  unwrap() {
715
731
  if (!this.id)
716
732
  throw new Error("Invalid object");
717
- const n = this[Jt];
733
+ const n = this[Kt];
718
734
  return t.get(this.id, { parent: n ? { id: n, type: "unknown" } : void 0 });
719
735
  },
720
736
  toPresentation3() {
@@ -757,7 +773,7 @@ function rs(t, e = !1, r) {
757
773
  };
758
774
  return z("items", i, t), z("annotations", i, t), z("structures", i, t), z("seeAlso", i, t), z("rendering", i, t), z("partOf", i, t), z("start", i, t, !1), z("supplementary", i, t), z("homepage", i, t), z("thumbnail", i, t), z("placeholderCanvas", i, t, !1), z("accompanyingCanvas", i, t, !1), z("provider", i, t), z("body", i, t), z("logo", i, t), i;
759
775
  }
760
- function is(t) {
776
+ function ns(t) {
761
777
  return !!t[Te];
762
778
  }
763
779
  function jr(t) {
@@ -768,10 +784,10 @@ function Se(t, e, r = !1, i) {
768
784
  return t.map((o) => Se(o, e, r));
769
785
  if (!t || !t.type || !t.id)
770
786
  return t;
771
- const n = rs(e, r), s = Object.create(n), a = Object.assign(s, t);
787
+ const n = is(e, r), s = Object.create(n), a = Object.assign(s, t);
772
788
  return r && a.reactive(), a;
773
789
  }
774
- function Kt(t) {
790
+ function Zt(t) {
775
791
  switch (t) {
776
792
  case "Image":
777
793
  case "Video":
@@ -790,7 +806,7 @@ function Kt(t) {
790
806
  }
791
807
  return t;
792
808
  }
793
- let Ct = class {
809
+ let Rt = class {
794
810
  constructor(e, r) {
795
811
  ye(this, "options"), ye(this, "store"), ye(this, "emitter"), ye(this, "isBatching", !1), ye(this, "batchQueue", []), ye(this, "remoteFetcher"), ye(this, "staticFetcher"), ye(this, "defaultFetcher", (i) => fetch(i).then((n) => n.json())), this.options = Object.assign(
796
812
  {
@@ -799,16 +815,16 @@ let Ct = class {
799
815
  enableDevtools: !0
800
816
  },
801
817
  e || {}
802
- ), this.store = r || es({
818
+ ), this.store = r || ts({
803
819
  customReducers: this.options.reducers,
804
820
  defaultState: this.options.defaultState,
805
821
  enableDevtools: this.options.enableDevtools
806
- }), this.emitter = ts(), this.remoteFetcher = Yt(this, this.options.customFetcher), this.staticFetcher = Yt(this, (i, n) => n);
822
+ }), this.emitter = rs(), this.remoteFetcher = Gt(this, this.options.customFetcher), this.staticFetcher = Gt(this, (i, n) => n);
807
823
  }
808
824
  batch(e) {
809
825
  this.isBatching = !0;
810
826
  try {
811
- e(this), this.isBatching = !1, this.dispatch(St({ actions: this.batchQueue }));
827
+ e(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 Ct = class {
817
833
  async asyncBatch(e) {
818
834
  this.isBatching = !0;
819
835
  try {
820
- await e(this), this.isBatching = !1, this.dispatch(St({ actions: this.batchQueue }));
836
+ await e(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 Ct = class {
837
853
  if (this.isBatching)
838
854
  this.batchQueue.push(e);
839
855
  else {
840
- if (e.type === Et) {
856
+ if (e.type === Pt) {
841
857
  for (const n of e.payload.actions)
842
858
  this.emitter.emit(n.type, { action: n, state: this.store.getState() });
843
859
  this.store.dispatch(e);
@@ -877,7 +893,7 @@ let Ct = class {
877
893
  return e.map((p) => this.get(p, i));
878
894
  const a = this.getState();
879
895
  if (on(e) && !i.preserveSpecificResources && (e = e.source), typeof e == "string") {
880
- const p = Kt(r || a.iiif.mapping[e]);
896
+ const p = Zt(r || a.iiif.mapping[e]);
881
897
  if (!p)
882
898
  return n ? null : { id: e, type: "unknown" };
883
899
  e = { id: e, type: p };
@@ -886,7 +902,7 @@ let Ct = class {
886
902
  const p = Array.isArray(e.partOf) ? e.partOf[0] : e.partOf;
887
903
  p && (typeof p == "string" && (s = p), typeof p.id == "string" && (s = p.id));
888
904
  }
889
- const o = Kt(r || (e == null ? void 0 : e.type)), u = e == null ? void 0 : e.id, h = a.iiif.entities[o];
905
+ const o = Zt(r || (e == null ? void 0 : e.type)), u = e == null ? void 0 : e.id, h = a.iiif.entities[o];
890
906
  if (!h) {
891
907
  const p = a.iiif.requests[u];
892
908
  return p && p.resourceUri !== u ? this.get(p.resourceUri, i) : n ? null : e;
@@ -894,7 +910,7 @@ let Ct = class {
894
910
  const l = h[e.id];
895
911
  if (l && l[Ke]) {
896
912
  const p = l[Ke].find((v) => s ? v[Ze] === s : v[Ze] === l.id);
897
- return fr(l, p);
913
+ return pr(l, p);
898
914
  }
899
915
  return h[e.id] || (n ? null : e);
900
916
  }
@@ -931,14 +947,26 @@ let Ct = class {
931
947
  }
932
948
  load(e, r) {
933
949
  const i = typeof e == "string" ? e : e.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(e, r) {
953
+ const i = typeof e == "string" ? e : e.id;
954
+ return this.staticFetcher(i, r);
955
+ }
956
+ loadManifestSync(e, r) {
957
+ const i = typeof e == "string" ? e : e.id;
958
+ return this.loadSync(i, r);
959
+ }
960
+ loadCollectionSync(e, r) {
961
+ const i = typeof e == "string" ? e : e.id;
962
+ return this.loadSync(i, r);
935
963
  }
936
964
  areInputsEqual(e, r) {
937
- return Qt(e, r);
965
+ return Yt(e, r);
938
966
  }
939
967
  subscribe(e, r, i) {
940
968
  return typeof i > "u" && (typeof r > "u" || r === !1 || r === !0) && (i = r, r = e, e = (n) => n), this.store.subscribe(e, (n) => r(n, this), {
941
- equalityFn: Qt,
969
+ equalityFn: Yt,
942
970
  fireImmediately: !i
943
971
  });
944
972
  }
@@ -971,16 +999,16 @@ let Ct = class {
971
999
  return Se(this.get(e, { skipSelfReturn: !1 }), this);
972
1000
  }
973
1001
  isWrapped(e) {
974
- return is(e);
1002
+ return ns(e);
975
1003
  }
976
1004
  setMetaValue([e, r, i], n) {
977
1005
  this.dispatch(
978
- typeof n == "function" ? zt.setMetaValueDynamic({
1006
+ typeof n == "function" ? Wt.setMetaValueDynamic({
979
1007
  id: e,
980
1008
  meta: r,
981
1009
  key: i,
982
1010
  updateValue: n
983
- }) : zt.setMetaValue({
1011
+ }) : Wt.setMetaValue({
984
1012
  id: e,
985
1013
  meta: r,
986
1014
  key: i,
@@ -989,18 +1017,18 @@ let Ct = class {
989
1017
  );
990
1018
  }
991
1019
  };
992
- function ns() {
1020
+ function ss() {
993
1021
  return typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
994
1022
  }
995
1023
  function $r(t) {
996
- const e = ns();
1024
+ const e = ss();
997
1025
  try {
998
1026
  const i = e.IIIF_VAULT;
999
1027
  if (i)
1000
1028
  return i;
1001
1029
  } catch {
1002
1030
  }
1003
- const r = new Ct(t);
1031
+ const r = new Rt(t);
1004
1032
  try {
1005
1033
  e.IIIF_VAULT = r;
1006
1034
  } catch {
@@ -1019,7 +1047,7 @@ function Dr({
1019
1047
  resources: i,
1020
1048
  children: n
1021
1049
  }) {
1022
- const [s, a] = J(() => t || (r ? $r(e) : e ? new Ct(e) : new Ct()));
1050
+ const [s, a] = J(() => t || (r ? $r(e) : e ? new Rt(e) : new Rt()));
1023
1051
  return /* @__PURE__ */ x(tt.Provider, { value: { vault: s, setVaultInstance: a }, children: /* @__PURE__ */ x(et, { value: i || {}, children: n }) });
1024
1052
  }
1025
1053
  const W = () => {
@@ -1028,7 +1056,7 @@ const W = () => {
1028
1056
  throw new Error("Vault not found. Ensure you have your provider set up correctly.");
1029
1057
  return t;
1030
1058
  };
1031
- function ss(t, { noCache: e = !1 } = {}) {
1059
+ function as(t, { noCache: e = !1 } = {}) {
1032
1060
  const r = typeof t == "string" ? t : t.id, i = W(), [n, s] = J(r), [a, o] = J(void 0), u = j(() => i.get(r, { skipSelfReturn: !0 }) || void 0, [r, i]), [h, l] = J(u);
1033
1061
  return re(() => {
1034
1062
  (async () => {
@@ -1048,17 +1076,17 @@ function ss(t, { noCache: e = !1 } = {}) {
1048
1076
  cached: !!(h && h === u)
1049
1077
  };
1050
1078
  }
1051
- function as(t, e) {
1052
- const { id: r, isLoaded: i, error: n, resource: s, requestId: a, cached: o } = ss(
1079
+ function os(t, e) {
1080
+ const { id: r, isLoaded: i, error: n, resource: s, requestId: a, cached: o } = as(
1053
1081
  t,
1054
1082
  e
1055
1083
  );
1056
1084
  return { id: r, isLoaded: i, error: n, manifest: s, requestId: a, cached: o };
1057
1085
  }
1058
- function os({ manifest: t, children: e }) {
1086
+ function cs({ manifest: t, children: e }) {
1059
1087
  return /* @__PURE__ */ x(et, { value: { manifest: t }, children: e });
1060
1088
  }
1061
- function Pt({ canvas: t, children: e }) {
1089
+ function Lt({ canvas: t, children: e }) {
1062
1090
  return /* @__PURE__ */ x(et, { value: { canvas: t }, children: e });
1063
1091
  }
1064
1092
  function Y(t, e = []) {
@@ -1091,7 +1119,7 @@ function Pe(t = {}, e = []) {
1091
1119
  return i ? i(a) : a;
1092
1120
  }, [a, i, ...e]);
1093
1121
  }
1094
- function cs({ range: t, children: e }) {
1122
+ function us({ range: t, children: e }) {
1095
1123
  return /* @__PURE__ */ x(et, { value: { range: t }, children: e });
1096
1124
  }
1097
1125
  function _r(t, e) {
@@ -1104,7 +1132,7 @@ function _r(t, e) {
1104
1132
  }
1105
1133
  return r;
1106
1134
  }
1107
- function us(t, e, { disablePaging: r, skipNonPaged: i } = {}) {
1135
+ function ls(t, e, { disablePaging: r, skipNonPaged: i } = {}) {
1108
1136
  const n = e.behavior, s = n.includes("paged"), a = s ? !1 : n.includes("continuous"), o = s || a ? !1 : n.includes("individuals"), u = e.type === "Manifest" ? e.items : _r(t, e);
1109
1137
  if (a)
1110
1138
  return [u, [u.map((d, g) => g)]];
@@ -1134,20 +1162,20 @@ function us(t, e, { disablePaging: r, skipNonPaged: i } = {}) {
1134
1162
  }
1135
1163
  return l.length && p(), [u, h];
1136
1164
  }
1137
- function ls(t = {}, e = []) {
1165
+ function fs(t = {}, e = []) {
1138
1166
  const { id: r, selector: i } = t, n = Ee(), s = r || n.range, a = Y((o) => s ? o.iiif.entities.Range[s] : void 0, [s]);
1139
1167
  return j(() => {
1140
1168
  if (a)
1141
1169
  return i ? i(a) : a;
1142
1170
  }, [a, i, ...e]);
1143
1171
  }
1144
- function fs({ startCanvas: t, disablePaging: e }) {
1172
+ function ps({ startCanvas: t, disablePaging: e }) {
1145
1173
  var d;
1146
- const r = W(), i = Pe(), n = ls(), [s, a] = J(void 0), o = n || i;
1174
+ const r = W(), i = Pe(), n = fs(), [s, a] = J(void 0), o = n || i;
1147
1175
  if (!o)
1148
1176
  throw new Error("Nothing selected");
1149
1177
  const [u, h] = j(
1150
- () => us(r, o, { disablePaging: e }),
1178
+ () => ls(r, o, { disablePaging: e }),
1151
1179
  [r, o]
1152
1180
  ), l = D(
1153
1181
  (g) => {
@@ -1189,8 +1217,8 @@ const Le = () => {
1189
1217
  setSequenceIndex: Le,
1190
1218
  currentSequenceIndex: 0
1191
1219
  });
1192
- function ps(t) {
1193
- const e = Pe(), { cursor: r, visibleItems: i, next: n, sequence: s, items: a, setCanvasIndex: o, setCanvasId: u, previous: h, setSequenceIndex: l } = fs({
1220
+ function hs(t) {
1221
+ const e = Pe(), { cursor: r, visibleItems: i, next: n, sequence: s, items: a, setCanvasIndex: o, setCanvasId: u, previous: h, setSequenceIndex: l } = ps({
1194
1222
  startCanvas: t.startCanvas,
1195
1223
  disablePaging: t.pagingEnabled === !1
1196
1224
  }), p = j(
@@ -1208,31 +1236,31 @@ function ps(t) {
1208
1236
  }),
1209
1237
  [s, a, u, n, h, a, o, l, r]
1210
1238
  );
1211
- return e ? /* @__PURE__ */ x(it.Provider, { value: p, children: /* @__PURE__ */ x(rt.Provider, { value: i, children: /* @__PURE__ */ x(Pt, { canvas: i[0], children: t.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." }));
1239
+ return e ? i.length === 0 ? null : /* @__PURE__ */ x(it.Provider, { value: p, children: /* @__PURE__ */ x(rt.Provider, { value: i, children: /* @__PURE__ */ x(Lt, { canvas: i[0], children: t.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." }));
1212
1240
  }
1213
- function hs(t) {
1214
- const e = as(t.manifest);
1241
+ function ds(t) {
1242
+ const e = os(t.manifest);
1215
1243
  if (!e)
1216
1244
  return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." });
1217
1245
  if (e.error)
1218
1246
  return /* @__PURE__ */ x("div", { children: e.error.toString() });
1219
1247
  if (!e.isLoaded)
1220
1248
  return /* @__PURE__ */ x("div", { children: "Loading..." });
1221
- const r = /* @__PURE__ */ x(ps, { ...t, children: t.children });
1222
- return /* @__PURE__ */ x(os, { manifest: e.id, children: t.rangeId ? /* @__PURE__ */ x(cs, { range: t.rangeId, children: r }) : r });
1249
+ const r = /* @__PURE__ */ x(hs, { ...t, children: t.children });
1250
+ return /* @__PURE__ */ x(cs, { manifest: e.id, children: t.rangeId ? /* @__PURE__ */ x(us, { range: t.rangeId, children: r }) : r });
1223
1251
  }
1224
- function ds() {
1252
+ function ys() {
1225
1253
  return Q(it);
1226
1254
  }
1227
- function ys() {
1255
+ function vs() {
1228
1256
  return {
1229
1257
  VaultContext: Q(tt),
1230
- ResourceContext: Q(Ot),
1258
+ ResourceContext: Q(Et),
1231
1259
  SimpleViewerReactContext: Q(it),
1232
1260
  VisibleCanvasReactContext: Q(rt)
1233
1261
  };
1234
1262
  }
1235
- function vs(t) {
1263
+ function gs(t) {
1236
1264
  return /* @__PURE__ */ x(Dr, { vault: t.bridge.VaultContext.vault || void 0, resources: t.bridge.ResourceContext, children: /* @__PURE__ */ x(rt.Provider, { value: t.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ x(it.Provider, { value: t.bridge.SimpleViewerReactContext, children: t.children }) }) });
1237
1265
  }
1238
1266
  const se = function(t) {
@@ -1244,28 +1272,28 @@ const se = function(t) {
1244
1272
  ...i !== void 0 && { meta: i }
1245
1273
  });
1246
1274
  };
1247
- }, gs = "@iiif/IMPORT_ENTITIES", ms = "@iiif/MODIFY_ENTITY_FIELD", bs = "@iiif/REORDER_ENTITY_FIELD", As = "@iiif/ADD_REFERENCE", xs = "@iiif/UPDATE_REFERENCE", ws = "@iiif/REMOVE_REFERENCE", Ss = "@iiif/ADD_METADATA", Ms = "@iiif/REMOVE_METADATA", Cs = "@iiif/UPDATE_METADATA", Rs = "@iiif/REORDER_METADATA", Ts = se(gs)(), Is = se(ms)(), ks = se(bs)(), Os = se(As)(), Es = se(ws)(), Ps = se(xs)(), Ls = se(Ss)(), Fs = se(Cs)(), js = se(Ms)(), $s = se(Rs)(), pt = {
1248
- importEntities: Ts,
1249
- modifyEntityField: Is,
1250
- reorderEntityField: ks,
1251
- addReference: Os,
1252
- removeReference: Es,
1253
- updateReference: Ps,
1254
- addMetadata: Ls,
1255
- removeMetadata: js,
1256
- updateMetadata: Fs,
1257
- reorderMetadata: $s
1275
+ }, ms = "@iiif/IMPORT_ENTITIES", bs = "@iiif/MODIFY_ENTITY_FIELD", As = "@iiif/REORDER_ENTITY_FIELD", xs = "@iiif/ADD_REFERENCE", ws = "@iiif/UPDATE_REFERENCE", Ss = "@iiif/REMOVE_REFERENCE", Ms = "@iiif/ADD_METADATA", Cs = "@iiif/REMOVE_METADATA", Rs = "@iiif/UPDATE_METADATA", Ts = "@iiif/REORDER_METADATA", Is = se(ms)(), ks = se(bs)(), Os = se(As)(), Es = se(xs)(), Ps = se(Ss)(), Ls = se(ws)(), Fs = se(Ms)(), js = se(Rs)(), $s = se(Cs)(), Ds = se(Ts)(), pt = {
1276
+ importEntities: Is,
1277
+ modifyEntityField: ks,
1278
+ reorderEntityField: Os,
1279
+ addReference: Es,
1280
+ removeReference: Ps,
1281
+ updateReference: Ls,
1282
+ addMetadata: Fs,
1283
+ removeMetadata: $s,
1284
+ updateMetadata: js,
1285
+ reorderMetadata: Ds
1258
1286
  };
1259
- function Ds() {
1287
+ function qs() {
1260
1288
  const e = W().getStore();
1261
1289
  return j(() => (r) => e.dispatch(r), [e]);
1262
1290
  }
1263
- function Zt(t) {
1291
+ function Xt(t) {
1264
1292
  return typeof t != "string" && t && t.bindToVault;
1265
1293
  }
1266
- function qs() {
1267
- const t = W(), e = ve([]), r = Ds(), i = j(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
1268
- ur(() => {
1294
+ function _s() {
1295
+ const t = W(), e = ve([]), r = qs(), i = j(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
1296
+ lr(() => {
1269
1297
  const o = {
1270
1298
  id: i,
1271
1299
  type: "AnnotationPage",
@@ -1299,7 +1327,7 @@ function qs() {
1299
1327
  ), s = D(
1300
1328
  (o, u) => {
1301
1329
  if (i) {
1302
- if (Zt(o)) {
1330
+ if (Xt(o)) {
1303
1331
  const p = o;
1304
1332
  p.__vault || p.bindToVault(t), o = typeof p.source == "string" ? p.source : p.source.id, e.current[o] = p;
1305
1333
  } else
@@ -1322,7 +1350,7 @@ function qs() {
1322
1350
  [i]
1323
1351
  ), a = D(
1324
1352
  (o) => {
1325
- i && (Zt(o) ? o = typeof o.source == "string" ? o.source : o.source.id : typeof o != "string" && (o = o.id), e.current[o] && e.current[o].beforeRemove(), t.get({ id: i, type: "AnnotationPage" }) && r(
1353
+ i && (Xt(o) ? o = typeof o.source == "string" ? o.source : o.source.id : typeof o != "string" && (o = o.id), e.current[o] && e.current[o].beforeRemove(), t.get({ id: i, type: "AnnotationPage" }) && r(
1326
1354
  pt.removeReference({
1327
1355
  id: i,
1328
1356
  type: "AnnotationPage",
@@ -1345,7 +1373,7 @@ function qs() {
1345
1373
  ];
1346
1374
  }
1347
1375
  const Ur = ce(null);
1348
- function _s() {
1376
+ function Us() {
1349
1377
  const t = Q(Ur);
1350
1378
  return [
1351
1379
  t.fullPage,
@@ -1355,8 +1383,8 @@ function _s() {
1355
1383
  }
1356
1384
  ];
1357
1385
  }
1358
- function Us({ children: t }) {
1359
- const [e, { addAnnotation: r, removeAnnotation: i }] = qs();
1386
+ function Vs({ children: t }) {
1387
+ const [e, { addAnnotation: r, removeAnnotation: i }] = _s();
1360
1388
  return /* @__PURE__ */ x(
1361
1389
  Ur.Provider,
1362
1390
  {
@@ -1365,7 +1393,7 @@ function Us({ children: t }) {
1365
1393
  }
1366
1394
  );
1367
1395
  }
1368
- function Vs({
1396
+ function Ns({
1369
1397
  width: t,
1370
1398
  style: e,
1371
1399
  height: r,
@@ -1378,9 +1406,9 @@ function Vs({
1378
1406
  /* @__PURE__ */ x("button", { onClick: n, children: "Reset" })
1379
1407
  ] });
1380
1408
  }
1381
- const Lt = ce(null);
1382
- function Ns() {
1383
- return Q(Lt);
1409
+ const Ft = ce(null);
1410
+ function Hs() {
1411
+ return Q(Ft);
1384
1412
  }
1385
1413
  const Vr = ce(
1386
1414
  () => {
@@ -1404,19 +1432,19 @@ function me(t = {}, e = []) {
1404
1432
  }
1405
1433
  const Hr = ce(() => {
1406
1434
  });
1407
- function Hs(t) {
1435
+ function Bs(t) {
1408
1436
  const e = me(), r = Q(Hr);
1409
1437
  re(() => e && e.id ? (r(e.id, t), () => r(e.id, -1)) : () => {
1410
1438
  }, [e, t]);
1411
1439
  }
1412
- function Bs({
1440
+ function zs({
1413
1441
  children: t,
1414
1442
  errorFallback: e,
1415
1443
  outerContainerProps: r = {},
1416
1444
  worldScale: i,
1417
1445
  ...n
1418
1446
  }) {
1419
- const [s, a] = J(), o = ys(), u = e || Vs, [h, l] = J({}), p = Object.entries(h), [v, m] = J({}), d = Object.entries(v), [g, A] = J({}), b = j(() => i || Math.max(...Object.values(g)), [g]), w = j(() => ({ maxOverZoom: b || 1, ...n.runtimeOptions || {} }), [b, n.runtimeOptions]), R = D((T, P) => {
1447
+ const [s, a] = J(), o = vs(), u = e || Ns, [h, l] = J({}), p = Object.entries(h), [v, m] = J({}), d = Object.entries(v), [g, A] = J({}), b = j(() => i || Math.max(...Object.values(g)), [g]), w = j(() => ({ maxOverZoom: b || 1, ...n.runtimeOptions || {} }), [b, n.runtimeOptions]), R = D((T, P) => {
1420
1448
  A((E) => {
1421
1449
  if (P === -1) {
1422
1450
  const { [T]: M, ...$ } = E;
@@ -1446,7 +1474,7 @@ function Bs({
1446
1474
  a(T), n.onCreated && n.onCreated(T);
1447
1475
  },
1448
1476
  runtimeOptions: w,
1449
- children: /* @__PURE__ */ x(Lt.Provider, { value: s, children: /* @__PURE__ */ x(Hr.Provider, { value: R, children: /* @__PURE__ */ x(Vr.Provider, { value: O, children: /* @__PURE__ */ x(Nr.Provider, { value: F, children: /* @__PURE__ */ x(vs, { bridge: o, children: /* @__PURE__ */ x(Zi.Provider, { value: n.mode || "explore", children: /* @__PURE__ */ x(Us, { children: t }) }) }) }) }) }) })
1477
+ children: /* @__PURE__ */ x(Ft.Provider, { value: s, children: /* @__PURE__ */ x(Hr.Provider, { value: R, children: /* @__PURE__ */ x(Vr.Provider, { value: O, children: /* @__PURE__ */ x(Nr.Provider, { value: F, children: /* @__PURE__ */ x(gs, { bridge: o, children: /* @__PURE__ */ x(Zi.Provider, { value: n.mode || "explore", children: /* @__PURE__ */ x(Vs, { children: t }) }) }) }) }) }) })
1450
1478
  }
1451
1479
  ),
1452
1480
  /* @__PURE__ */ x("div", { children: d.map(([T, { element: P, props: E }]) => /* @__PURE__ */ x(ge.Fragment, { children: /* @__PURE__ */ x(P, { ...E || {} }) }, T)) })
@@ -1472,7 +1500,7 @@ const Ne = {}, Br = {
1472
1500
  return e ? r[e] : r;
1473
1501
  }
1474
1502
  };
1475
- function zs(t = Br) {
1503
+ function Ws(t = Br) {
1476
1504
  return {
1477
1505
  addEventListener(e, r, i, n) {
1478
1506
  if (e)
@@ -1510,7 +1538,7 @@ function zs(t = Br) {
1510
1538
  };
1511
1539
  }
1512
1540
  function zr(t, e) {
1513
- const r = W(), i = j(() => zs(r), [r]), n = Y(() => t && t.id ? r.getResourceMeta(t.id, "eventManager") : null, [t]);
1541
+ const r = W(), i = j(() => Ws(r), [r]), n = Y(() => t && t.id ? r.getResourceMeta(t.id, "eventManager") : null, [t]);
1514
1542
  return j(() => t ? i.getListenersAsProps(t, e) : {}, [n, t, r, e]);
1515
1543
  }
1516
1544
  const He = {}, Wr = {
@@ -1554,7 +1582,7 @@ function Xe(t, e) {
1554
1582
  return n ? e ? n[e] : n : void 0;
1555
1583
  }, [t, e]);
1556
1584
  }
1557
- var Ws = Object.defineProperty, Qs = (t, e, r) => e in t ? Ws(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, We = (t, e, r) => (Qs(t, typeof e != "symbol" ? e + "" : e, r), r), Ys = /* @__PURE__ */ function() {
1585
+ var Qs = Object.defineProperty, Ys = (t, e, r) => e in t ? Qs(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, We = (t, e, r) => (Ys(t, typeof e != "symbol" ? e + "" : e, r), r), Gs = /* @__PURE__ */ function() {
1558
1586
  function t(e, r) {
1559
1587
  var i = [], n = !0, s = !1, a = void 0;
1560
1588
  try {
@@ -1587,7 +1615,7 @@ var Ws = Object.defineProperty, Qs = (t, e, r) => e in t ? Ws(t, e, { enumerable
1587
1615
  x: h + s,
1588
1616
  y: l + a
1589
1617
  };
1590
- }, Gs = function(t, e) {
1618
+ }, Js = function(t, e) {
1591
1619
  var r = e === 1.5707963267948966 ? 0.551915024494 : e === -1.5707963267948966 ? -0.551915024494 : 1.3333333333333333 * Math.tan(e / 4), i = Math.cos(t), n = Math.sin(t), s = Math.cos(t + e), a = Math.sin(t + e);
1592
1620
  return [{
1593
1621
  x: i - n * r,
@@ -1599,15 +1627,15 @@ var Ws = Object.defineProperty, Qs = (t, e, r) => e in t ? Ws(t, e, { enumerable
1599
1627
  x: s,
1600
1628
  y: a
1601
1629
  }];
1602
- }, Xt = function(t, e, r, i) {
1630
+ }, er = function(t, e, r, i) {
1603
1631
  var n = t * i - e * r < 0 ? -1 : 1, s = t * r + e * i;
1604
1632
  return s > 1 && (s = 1), s < -1 && (s = -1), n * Math.acos(s);
1605
- }, Js = function(t, e, r, i, n, s, a, o, u, h, l, p) {
1633
+ }, Ks = function(t, e, r, i, n, s, a, o, u, h, l, p) {
1606
1634
  var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(p, 2), A = v * m - v * g - m * d;
1607
1635
  A < 0 && (A = 0), A /= v * g + m * d, A = Math.sqrt(A) * (a === o ? -1 : 1);
1608
- var b = A * n / s * p, w = A * -s / n * l, R = h * b - u * w + (t + r) / 2, O = u * b + h * w + (e + i) / 2, F = (l - b) / n, T = (p - w) / s, P = (-l - b) / n, E = (-p - w) / s, M = Xt(1, 0, F, T), $ = Xt(F, T, P, E);
1636
+ var b = A * n / s * p, w = A * -s / n * l, R = h * b - u * w + (t + r) / 2, O = u * b + h * w + (e + i) / 2, F = (l - b) / n, T = (p - w) / s, P = (-l - b) / n, E = (-p - w) / s, M = er(1, 0, F, T), $ = er(F, T, P, E);
1609
1637
  return o === 0 && $ > 0 && ($ -= je), o === 1 && $ < 0 && ($ += je), [R, O, M, $];
1610
- }, Ks = function(t) {
1638
+ }, Zs = function(t) {
1611
1639
  var e = t.px, r = t.py, i = t.cx, n = t.cy, s = t.rx, a = t.ry, o = t.xAxisRotation, u = o === void 0 ? 0 : o, h = t.largeArcFlag, l = h === void 0 ? 0 : h, p = t.sweepFlag, v = p === void 0 ? 0 : p, m = [];
1612
1640
  if (s === 0 || a === 0)
1613
1641
  return [];
@@ -1617,12 +1645,12 @@ var Ws = Object.defineProperty, Qs = (t, e, r) => e in t ? Ws(t, e, { enumerable
1617
1645
  s = Math.abs(s), a = Math.abs(a);
1618
1646
  var w = Math.pow(A, 2) / Math.pow(s, 2) + Math.pow(b, 2) / Math.pow(a, 2);
1619
1647
  w > 1 && (s *= Math.sqrt(w), a *= Math.sqrt(w));
1620
- var R = Js(e, r, i, n, s, a, l, v, d, g, A, b), O = Ys(R, 4), F = O[0], T = O[1], P = O[2], E = O[3], M = Math.abs(E) / (je / 4);
1648
+ var R = Ks(e, r, i, n, s, a, l, v, d, g, A, b), O = Gs(R, 4), F = O[0], T = O[1], P = O[2], E = O[3], M = Math.abs(E) / (je / 4);
1621
1649
  Math.abs(1 - M) < 1e-7 && (M = 1);
1622
1650
  var $ = Math.max(Math.ceil(M), 1);
1623
1651
  E /= $;
1624
1652
  for (var ie = 0; ie < $; ie++)
1625
- m.push(Gs(P, E)), P += E;
1653
+ m.push(Js(P, E)), P += E;
1626
1654
  return m.map(function(K) {
1627
1655
  var U = ht(K[0], s, a, g, d, F, T), N = U.x, X = U.y, ne = ht(K[1], s, a, g, d, F, T), Ae = ne.x, k = ne.y, H = ht(K[2], s, a, g, d, F, T), Z = H.x, pe = H.y;
1628
1656
  return { x1: N, y1: X, x2: Ae, y2: k, x: Z, y: pe };
@@ -1631,12 +1659,12 @@ var Ws = Object.defineProperty, Qs = (t, e, r) => e in t ? Ws(t, e, { enumerable
1631
1659
  function Yr(t) {
1632
1660
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1633
1661
  }
1634
- var Zs = ea, dt = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, Xs = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
1635
- function ea(t) {
1662
+ var Xs = ta, dt = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, ea = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
1663
+ function ta(t) {
1636
1664
  var e = [];
1637
- return t.replace(Xs, function(r, i, n) {
1665
+ return t.replace(ea, function(r, i, n) {
1638
1666
  var s = i.toLowerCase();
1639
- for (n = ra(n), s == "m" && n.length > 2 && (e.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
1667
+ for (n = ia(n), s == "m" && n.length > 2 && (e.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
1640
1668
  if (n.length == dt[s])
1641
1669
  return n.unshift(i), e.push(n);
1642
1670
  if (n.length < dt[s])
@@ -1645,14 +1673,14 @@ function ea(t) {
1645
1673
  }
1646
1674
  }), e;
1647
1675
  }
1648
- var ta = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
1649
- function ra(t) {
1650
- var e = t.match(ta);
1676
+ var ra = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
1677
+ function ia(t) {
1678
+ var e = t.match(ra);
1651
1679
  return e ? e.map(Number) : [];
1652
1680
  }
1653
- const ia = /* @__PURE__ */ Yr(Zs);
1654
- var na = sa;
1655
- function sa(t) {
1681
+ const na = /* @__PURE__ */ Yr(Xs);
1682
+ var sa = aa;
1683
+ function aa(t) {
1656
1684
  var e = 0, r = 0, i = 0, n = 0;
1657
1685
  return t.map(function(s) {
1658
1686
  s = s.slice();
@@ -1691,9 +1719,9 @@ function sa(t) {
1691
1719
  return s;
1692
1720
  });
1693
1721
  }
1694
- const aa = /* @__PURE__ */ Yr(na);
1695
- function oa(t) {
1696
- const e = ia(t), r = aa(e);
1722
+ const oa = /* @__PURE__ */ Yr(sa);
1723
+ function ca(t) {
1724
+ const e = na(t), r = oa(e);
1697
1725
  let i, n = 0, s = 0, a = 0, o = 0, u, h, l = 0, p = 0;
1698
1726
  const v = [];
1699
1727
  for (let m = 0; m < r.length; m++) {
@@ -1723,7 +1751,7 @@ function oa(t) {
1723
1751
  break;
1724
1752
  case "A":
1725
1753
  {
1726
- const A = Ks({
1754
+ const A = Zs({
1727
1755
  px: l,
1728
1756
  py: p,
1729
1757
  cx: d[6],
@@ -1780,15 +1808,15 @@ function oa(t) {
1780
1808
  * See the License for the specific language governing permissions and
1781
1809
  * limitations under the License.
1782
1810
  */
1783
- function ca(t, e, r, i = 1) {
1811
+ function ua(t, e, r, i = 1) {
1784
1812
  return new Gr(t, e, r).subdivide(i);
1785
1813
  }
1786
- function ua(t, e, r, i, n = 1) {
1787
- return new Ft(
1814
+ function la(t, e, r, i, n = 1) {
1815
+ return new jt(
1788
1816
  new Float64Array([t.x, t.y, e.x, e.y, r.x, r.y, i.x, i.y])
1789
1817
  ).subdivide(n);
1790
1818
  }
1791
- function la(t) {
1819
+ function fa(t) {
1792
1820
  return t.x * t.x + t.y * t.y;
1793
1821
  }
1794
1822
  function $e(t) {
@@ -1821,7 +1849,7 @@ class Gr {
1821
1849
  return h.push(1), h.map((l) => this.eval(l));
1822
1850
  }
1823
1851
  }
1824
- class Ft {
1852
+ class jt {
1825
1853
  /// Argument is array of coordinate values [x0, y0, x1, y1, x2, y2, x3, y3].
1826
1854
  constructor(e) {
1827
1855
  We(this, "c"), this.c = e;
@@ -1849,11 +1877,11 @@ class Ft {
1849
1877
  const a = (r - e) / 3, o = this.deriv(e);
1850
1878
  i[2] = n.x + a * o.x, i[3] = n.y + a * o.y;
1851
1879
  const u = this.deriv(r);
1852
- return i[4] = s.x - a * u.x, i[5] = s.y - a * u.y, i[6] = s.x, i[7] = s.y, new Ft(i);
1880
+ return i[4] = s.x - a * u.x, i[5] = s.y - a * u.y, i[6] = s.x, i[7] = s.y, new jt(i);
1853
1881
  }
1854
1882
  // Very fancy subdivision scheme
1855
1883
  subdivide(e) {
1856
- const r = 0.1 * e, i = e - r, n = Math.sqrt(i), s = la(this.weightsum(1, -3, 3, -1)), a = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), o = [];
1884
+ const r = 0.1 * e, i = e - r, n = Math.sqrt(i), s = fa(this.weightsum(1, -3, 3, -1)), a = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), o = [];
1857
1885
  let u = 0;
1858
1886
  for (let d = 0; d < a; d++) {
1859
1887
  const g = d / a, A = (d + 1) / a, b = this.subsegment(g, A).midpoint_quadbez(), w = b.mapToBasic(), R = $e(w.x0), O = $e(w.x2), F = Math.sqrt(w.scale);
@@ -1881,7 +1909,7 @@ class Ft {
1881
1909
  return p.push({ x: this.c[6], y: this.c[7] }), p;
1882
1910
  }
1883
1911
  }
1884
- const fa = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, pa = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, er = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
1912
+ const pa = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, ha = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, tr = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
1885
1913
  function Qe(t, {
1886
1914
  domParser: e,
1887
1915
  svgPreprocessor: r,
@@ -1935,7 +1963,7 @@ function Qe(t, {
1935
1963
  iiifRenderingHints: i
1936
1964
  });
1937
1965
  }
1938
- if (va(t)) {
1966
+ if (ga(t)) {
1939
1967
  const n = [];
1940
1968
  if (t.region) {
1941
1969
  const s = Qe(
@@ -1951,7 +1979,7 @@ function Qe(t, {
1951
1979
  });
1952
1980
  }
1953
1981
  if (t.type === "FragmentSelector") {
1954
- const n = fa.exec(t.value);
1982
+ const n = pa.exec(t.value);
1955
1983
  if (n) {
1956
1984
  const a = {
1957
1985
  type: "BoxSelector",
@@ -1969,7 +1997,7 @@ function Qe(t, {
1969
1997
  iiifRenderingHints: i
1970
1998
  });
1971
1999
  }
1972
- const s = t.value.match(pa);
2000
+ const s = t.value.match(ha);
1973
2001
  if (s) {
1974
2002
  const a = {
1975
2003
  type: "TemporalSelector",
@@ -2013,7 +2041,7 @@ function Qe(t, {
2013
2041
  // urx
2014
2042
  Math.max(...n.map((v) => v[1]))
2015
2043
  // ury
2016
- ], { style: a, svg: o } = ya(p.element) ?? { svg: o });
2044
+ ], { style: a, svg: o } = va(p.element) ?? { svg: o });
2017
2045
  }
2018
2046
  const h = {
2019
2047
  type: "SvgSelector",
@@ -2035,7 +2063,7 @@ function Qe(t, {
2035
2063
  iiifRenderingHints: i
2036
2064
  });
2037
2065
  }
2038
- function ha(t) {
2066
+ function da(t) {
2039
2067
  const e = t.map((i) => i[0]).reduce(
2040
2068
  (i, n) => (i[n] += 1, i),
2041
2069
  { C: 0, Q: 0, L: 0, M: 0 }
@@ -2065,8 +2093,8 @@ function Jr(t) {
2065
2093
  const i = r.getAttribute("d");
2066
2094
  if (!i)
2067
2095
  continue;
2068
- const n = oa(i);
2069
- return { element: r, points: da(n), shapeType: ha(n) };
2096
+ const n = ca(i);
2097
+ return { element: r, points: ya(n), shapeType: da(n) };
2070
2098
  }
2071
2099
  case "circle": {
2072
2100
  const i = parseFloat(r.getAttribute("cx") ?? "0"), n = parseFloat(r.getAttribute("cy") ?? "0"), s = parseFloat(r.getAttribute("r") ?? "0");
@@ -2132,7 +2160,7 @@ function Jr(t) {
2132
2160
  }
2133
2161
  return null;
2134
2162
  }
2135
- function da(t) {
2163
+ function ya(t) {
2136
2164
  const e = [];
2137
2165
  for (let r = 0; r < t.length; r++) {
2138
2166
  const i = e[e.length - 1] ?? [0, 0], n = t[r];
@@ -2143,7 +2171,7 @@ function da(t) {
2143
2171
  continue;
2144
2172
  case "C":
2145
2173
  e.push(
2146
- ...ua(
2174
+ ...la(
2147
2175
  { x: i[0], y: i[1] },
2148
2176
  { x: n[1], y: n[2] },
2149
2177
  { x: n[3], y: n[4] },
@@ -2154,7 +2182,7 @@ function da(t) {
2154
2182
  continue;
2155
2183
  case "Q":
2156
2184
  e.push(
2157
- ...ca(
2185
+ ...ua(
2158
2186
  { x: i[0], y: i[1] },
2159
2187
  { x: n[1], y: n[2] },
2160
2188
  { x: n[3], y: n[4] }
@@ -2166,14 +2194,14 @@ function da(t) {
2166
2194
  }
2167
2195
  return e;
2168
2196
  }
2169
- function ya(t) {
2197
+ function va(t) {
2170
2198
  const e = {};
2171
2199
  if (t.hasAttribute("fill") ? (e.fill = t.getAttribute("fill"), t.removeAttribute("fill")) : t.style.fill && (e.fill = t.style.fill), e.fill) {
2172
- const i = er.exec(e.fill);
2200
+ const i = tr.exec(e.fill);
2173
2201
  i && (e.fillOpacity = parseFloat(i[4]), e.fill = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
2174
2202
  }
2175
2203
  if (t.hasAttribute("fill-opacity") ? (e.fillOpacity = parseFloat(t.getAttribute("fill-opacity")), t.removeAttribute("fill-opacity")) : t.style.fillOpacity && (e.fillOpacity = parseFloat(t.style.fillOpacity)), t.hasAttribute("stroke") ? (e.stroke = t.getAttribute("stroke"), t.removeAttribute("stroke")) : t.style.stroke && (e.stroke = t.style.stroke), e.stroke) {
2176
- const i = er.exec(e.stroke);
2204
+ const i = tr.exec(e.stroke);
2177
2205
  i && (e.strokeOpacity = parseFloat(i[4]), e.stroke = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
2178
2206
  }
2179
2207
  t.hasAttribute("stroke-opacity") ? (e.strokeOpacity = parseFloat(t.getAttribute("stroke-opacity")), t.removeAttribute("stroke-opacity")) : t.style.strokeOpacity && (e.strokeOpacity = parseFloat(t.style.strokeOpacity)), t.hasAttribute("stroke-width") ? (e.strokeWidth = t.getAttribute("stroke-width"), t.removeAttribute("stroke-width")) : t.style.strokeWidth && (e.strokeWidth = t.style.strokeWidth), t.hasAttribute("stroke-dasharray") ? (e.strokeDasharray = t.getAttribute("stroke-dasharray"), t.removeAttribute("stroke-dasharray")) : t.style.strokeDasharray && (e.strokeDasharray = t.style.strokeDasharray);
@@ -2183,14 +2211,14 @@ function ya(t) {
2183
2211
  throw new Error("Could not find root SVG element");
2184
2212
  return { svg: r.outerHTML, style: Object.keys(e).length > 0 ? e : void 0 };
2185
2213
  }
2186
- function va(t) {
2214
+ function ga(t) {
2187
2215
  return !!t && t.type === "iiif:ImageApiSelector" && t.type === "iiif:ImageApiSelector";
2188
2216
  }
2189
2217
  function ee(t) {
2190
2218
  if (t.iiifRenderingHints) {
2191
2219
  const e = t.iiifRenderingHints;
2192
2220
  if (e.rotation) {
2193
- const r = ga(e.rotation);
2221
+ const r = ma(e.rotation);
2194
2222
  if (r)
2195
2223
  if (t.selectors.length)
2196
2224
  for (const i of t.selectors)
@@ -2205,7 +2233,7 @@ function ee(t) {
2205
2233
  delete t.iiifRenderingHints;
2206
2234
  return t;
2207
2235
  }
2208
- function ga(t) {
2236
+ function ma(t) {
2209
2237
  let e = parseFloat(t);
2210
2238
  return e && t.startsWith("!") && (e = 360 - e), e && (e = e % 360), e !== e ? 0 : e || 0;
2211
2239
  }
@@ -2327,7 +2355,7 @@ const Zr = ({
2327
2355
  }
2328
2356
  ) : null;
2329
2357
  };
2330
- function ma(t = {}, e = []) {
2358
+ function ba(t = {}, e = []) {
2331
2359
  const { id: r, selector: i } = t, n = Ee(), s = r || n.annotationPage, a = Y(
2332
2360
  (o) => s ? o.iiif.entities.AnnotationPage[s] : void 0,
2333
2361
  [s]
@@ -2337,12 +2365,12 @@ function ma(t = {}, e = []) {
2337
2365
  return i ? i(a) : a;
2338
2366
  }, [a, ...e]);
2339
2367
  }
2340
- const Rt = ({
2368
+ const Tt = ({
2341
2369
  className: t,
2342
2370
  page: e
2343
2371
  }) => {
2344
2372
  var s;
2345
- const r = ma({ id: e.id }) || e, i = Xe(r, "atlas"), n = Xe(r, "html");
2373
+ const r = ba({ id: e.id }) || e, i = Xe(r, "atlas"), n = Xe(r, "html");
2346
2374
  return Y((a) => r.id ? a.iiif.entities.AnnotationPage[r.id] : null, []), /* @__PURE__ */ x(Je, { children: (s = r.items) == null ? void 0 : s.map((a) => /* @__PURE__ */ x(
2347
2375
  Zr,
2348
2376
  {
@@ -2418,7 +2446,7 @@ function Xr({
2418
2446
  t + (e.service ? "server" : "no-service")
2419
2447
  );
2420
2448
  }
2421
- var ba = Object.defineProperty, Aa = (t, e, r) => e in t ? ba(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ye = (t, e, r) => (Aa(t, typeof e != "symbol" ? e + "" : e, r), r), xa = /* @__PURE__ */ function() {
2449
+ var Aa = Object.defineProperty, xa = (t, e, r) => e in t ? Aa(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ye = (t, e, r) => (xa(t, typeof e != "symbol" ? e + "" : e, r), r), wa = /* @__PURE__ */ function() {
2422
2450
  function t(e, r) {
2423
2451
  var i = [], n = !0, s = !1, a = void 0;
2424
2452
  try {
@@ -2451,7 +2479,7 @@ var ba = Object.defineProperty, Aa = (t, e, r) => e in t ? ba(t, e, { enumerable
2451
2479
  x: h + s,
2452
2480
  y: l + a
2453
2481
  };
2454
- }, wa = function(t, e) {
2482
+ }, Sa = function(t, e) {
2455
2483
  var r = e === 1.5707963267948966 ? 0.551915024494 : e === -1.5707963267948966 ? -0.551915024494 : 1.3333333333333333 * Math.tan(e / 4), i = Math.cos(t), n = Math.sin(t), s = Math.cos(t + e), a = Math.sin(t + e);
2456
2484
  return [{
2457
2485
  x: i - n * r,
@@ -2463,15 +2491,15 @@ var ba = Object.defineProperty, Aa = (t, e, r) => e in t ? ba(t, e, { enumerable
2463
2491
  x: s,
2464
2492
  y: a
2465
2493
  }];
2466
- }, tr = function(t, e, r, i) {
2494
+ }, rr = function(t, e, r, i) {
2467
2495
  var n = t * i - e * r < 0 ? -1 : 1, s = t * r + e * i;
2468
2496
  return s > 1 && (s = 1), s < -1 && (s = -1), n * Math.acos(s);
2469
- }, Sa = function(t, e, r, i, n, s, a, o, u, h, l, p) {
2497
+ }, Ma = function(t, e, r, i, n, s, a, o, u, h, l, p) {
2470
2498
  var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(p, 2), A = v * m - v * g - m * d;
2471
2499
  A < 0 && (A = 0), A /= v * g + m * d, A = Math.sqrt(A) * (a === o ? -1 : 1);
2472
- var b = A * n / s * p, w = A * -s / n * l, R = h * b - u * w + (t + r) / 2, O = u * b + h * w + (e + i) / 2, F = (l - b) / n, T = (p - w) / s, P = (-l - b) / n, E = (-p - w) / s, M = tr(1, 0, F, T), $ = tr(F, T, P, E);
2500
+ var b = A * n / s * p, w = A * -s / n * l, R = h * b - u * w + (t + r) / 2, O = u * b + h * w + (e + i) / 2, F = (l - b) / n, T = (p - w) / s, P = (-l - b) / n, E = (-p - w) / s, M = rr(1, 0, F, T), $ = rr(F, T, P, E);
2473
2501
  return o === 0 && $ > 0 && ($ -= De), o === 1 && $ < 0 && ($ += De), [R, O, M, $];
2474
- }, Ma = function(t) {
2502
+ }, Ca = function(t) {
2475
2503
  var e = t.px, r = t.py, i = t.cx, n = t.cy, s = t.rx, a = t.ry, o = t.xAxisRotation, u = o === void 0 ? 0 : o, h = t.largeArcFlag, l = h === void 0 ? 0 : h, p = t.sweepFlag, v = p === void 0 ? 0 : p, m = [];
2476
2504
  if (s === 0 || a === 0)
2477
2505
  return [];
@@ -2481,26 +2509,26 @@ var ba = Object.defineProperty, Aa = (t, e, r) => e in t ? ba(t, e, { enumerable
2481
2509
  s = Math.abs(s), a = Math.abs(a);
2482
2510
  var w = Math.pow(A, 2) / Math.pow(s, 2) + Math.pow(b, 2) / Math.pow(a, 2);
2483
2511
  w > 1 && (s *= Math.sqrt(w), a *= Math.sqrt(w));
2484
- var R = Sa(e, r, i, n, s, a, l, v, d, g, A, b), O = xa(R, 4), F = O[0], T = O[1], P = O[2], E = O[3], M = Math.abs(E) / (De / 4);
2512
+ var R = Ma(e, r, i, n, s, a, l, v, d, g, A, b), O = wa(R, 4), F = O[0], T = O[1], P = O[2], E = O[3], M = Math.abs(E) / (De / 4);
2485
2513
  Math.abs(1 - M) < 1e-7 && (M = 1);
2486
2514
  var $ = Math.max(Math.ceil(M), 1);
2487
2515
  E /= $;
2488
2516
  for (var ie = 0; ie < $; ie++)
2489
- m.push(wa(P, E)), P += E;
2517
+ m.push(Sa(P, E)), P += E;
2490
2518
  return m.map(function(K) {
2491
2519
  var U = yt(K[0], s, a, g, d, F, T), N = U.x, X = U.y, ne = yt(K[1], s, a, g, d, F, T), Ae = ne.x, k = ne.y, H = yt(K[2], s, a, g, d, F, T), Z = H.x, pe = H.y;
2492
2520
  return { x1: N, y1: X, x2: Ae, y2: k, x: Z, y: pe };
2493
2521
  });
2494
- }, Ca = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2522
+ }, Ra = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2495
2523
  function ei(t) {
2496
2524
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
2497
2525
  }
2498
- var Ra = Ia, vt = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, Ta = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
2499
- function Ia(t) {
2526
+ var Ta = ka, vt = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }, Ia = /([astvzqmhlc])([^astvzqmhlc]*)/ig;
2527
+ function ka(t) {
2500
2528
  var e = [];
2501
- return t.replace(Ta, function(r, i, n) {
2529
+ return t.replace(Ia, function(r, i, n) {
2502
2530
  var s = i.toLowerCase();
2503
- for (n = Oa(n), s == "m" && n.length > 2 && (e.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
2531
+ for (n = Ea(n), s == "m" && n.length > 2 && (e.push([i].concat(n.splice(0, 2))), s = "l", i = i == "m" ? "l" : "L"); ; ) {
2504
2532
  if (n.length == vt[s])
2505
2533
  return n.unshift(i), e.push(n);
2506
2534
  if (n.length < vt[s])
@@ -2509,14 +2537,14 @@ function Ia(t) {
2509
2537
  }
2510
2538
  }), e;
2511
2539
  }
2512
- var ka = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
2513
- function Oa(t) {
2514
- var e = t.match(ka);
2540
+ var Oa = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;
2541
+ function Ea(t) {
2542
+ var e = t.match(Oa);
2515
2543
  return e ? e.map(Number) : [];
2516
2544
  }
2517
- const Ea = /* @__PURE__ */ ei(Ra);
2518
- var Pa = La;
2519
- function La(t) {
2545
+ const Pa = /* @__PURE__ */ ei(Ta);
2546
+ var La = Fa;
2547
+ function Fa(t) {
2520
2548
  var e = 0, r = 0, i = 0, n = 0;
2521
2549
  return t.map(function(s) {
2522
2550
  s = s.slice();
@@ -2555,9 +2583,9 @@ function La(t) {
2555
2583
  return s;
2556
2584
  });
2557
2585
  }
2558
- const Fa = /* @__PURE__ */ ei(Pa);
2559
- function ja(t) {
2560
- const e = Ea(t), r = Fa(e);
2586
+ const ja = /* @__PURE__ */ ei(La);
2587
+ function $a(t) {
2588
+ const e = Pa(t), r = ja(e);
2561
2589
  let i, n = 0, s = 0, a = 0, o = 0, u, h, l = 0, p = 0;
2562
2590
  const v = [];
2563
2591
  for (let m = 0; m < r.length; m++) {
@@ -2587,7 +2615,7 @@ function ja(t) {
2587
2615
  break;
2588
2616
  case "A":
2589
2617
  {
2590
- const A = Ma({
2618
+ const A = Ca({
2591
2619
  px: l,
2592
2620
  py: p,
2593
2621
  cx: d[6],
@@ -2644,15 +2672,15 @@ function ja(t) {
2644
2672
  * See the License for the specific language governing permissions and
2645
2673
  * limitations under the License.
2646
2674
  */
2647
- function $a(t, e, r, i = 1) {
2675
+ function Da(t, e, r, i = 1) {
2648
2676
  return new ti(t, e, r).subdivide(i);
2649
2677
  }
2650
- function Da(t, e, r, i, n = 1) {
2651
- return new jt(
2678
+ function qa(t, e, r, i, n = 1) {
2679
+ return new $t(
2652
2680
  new Float64Array([t.x, t.y, e.x, e.y, r.x, r.y, i.x, i.y])
2653
2681
  ).subdivide(n);
2654
2682
  }
2655
- function qa(t) {
2683
+ function _a(t) {
2656
2684
  return t.x * t.x + t.y * t.y;
2657
2685
  }
2658
2686
  function qe(t) {
@@ -2685,7 +2713,7 @@ class ti {
2685
2713
  return h.push(1), h.map((l) => this.eval(l));
2686
2714
  }
2687
2715
  }
2688
- class jt {
2716
+ class $t {
2689
2717
  /// Argument is array of coordinate values [x0, y0, x1, y1, x2, y2, x3, y3].
2690
2718
  constructor(e) {
2691
2719
  Ye(this, "c"), this.c = e;
@@ -2713,11 +2741,11 @@ class jt {
2713
2741
  const a = (r - e) / 3, o = this.deriv(e);
2714
2742
  i[2] = n.x + a * o.x, i[3] = n.y + a * o.y;
2715
2743
  const u = this.deriv(r);
2716
- return i[4] = s.x - a * u.x, i[5] = s.y - a * u.y, i[6] = s.x, i[7] = s.y, new jt(i);
2744
+ return i[4] = s.x - a * u.x, i[5] = s.y - a * u.y, i[6] = s.x, i[7] = s.y, new $t(i);
2717
2745
  }
2718
2746
  // Very fancy subdivision scheme
2719
2747
  subdivide(e) {
2720
- const r = 0.1 * e, i = e - r, n = Math.sqrt(i), s = qa(this.weightsum(1, -3, 3, -1)), a = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), o = [];
2748
+ const r = 0.1 * e, i = e - r, n = Math.sqrt(i), s = _a(this.weightsum(1, -3, 3, -1)), a = Math.ceil(Math.pow(s / (432 * r * r), 1 / 6)), o = [];
2721
2749
  let u = 0;
2722
2750
  for (let d = 0; d < a; d++) {
2723
2751
  const g = d / a, A = (d + 1) / a, b = this.subsegment(g, A).midpoint_quadbez(), w = b.mapToBasic(), R = qe(w.x0), O = qe(w.x2), F = Math.sqrt(w.scale);
@@ -2745,7 +2773,7 @@ class jt {
2745
2773
  return p.push({ x: this.c[6], y: this.c[7] }), p;
2746
2774
  }
2747
2775
  }
2748
- const _a = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, Ua = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, rr = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
2776
+ const Ua = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, Va = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, ir = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
2749
2777
  function Ge(t, {
2750
2778
  domParser: e,
2751
2779
  svgPreprocessor: r,
@@ -2799,7 +2827,7 @@ function Ge(t, {
2799
2827
  iiifRenderingHints: i
2800
2828
  });
2801
2829
  }
2802
- if (Ba(t)) {
2830
+ if (za(t)) {
2803
2831
  const n = [];
2804
2832
  if (t.region) {
2805
2833
  const s = Ge(
@@ -2815,7 +2843,7 @@ function Ge(t, {
2815
2843
  });
2816
2844
  }
2817
2845
  if (t.type === "FragmentSelector") {
2818
- const n = _a.exec(t.value);
2846
+ const n = Ua.exec(t.value);
2819
2847
  if (n) {
2820
2848
  const a = {
2821
2849
  type: "BoxSelector",
@@ -2833,7 +2861,7 @@ function Ge(t, {
2833
2861
  iiifRenderingHints: i
2834
2862
  });
2835
2863
  }
2836
- const s = t.value.match(Ua);
2864
+ const s = t.value.match(Va);
2837
2865
  if (s) {
2838
2866
  const a = {
2839
2867
  type: "TemporalSelector",
@@ -2877,7 +2905,7 @@ function Ge(t, {
2877
2905
  // urx
2878
2906
  Math.max(...n.map((v) => v[1]))
2879
2907
  // ury
2880
- ], { style: a, svg: o } = Ha(p.element) ?? { svg: o });
2908
+ ], { style: a, svg: o } = Ba(p.element) ?? { svg: o });
2881
2909
  }
2882
2910
  const h = {
2883
2911
  type: "SvgSelector",
@@ -2899,7 +2927,7 @@ function Ge(t, {
2899
2927
  iiifRenderingHints: i
2900
2928
  });
2901
2929
  }
2902
- function Va(t) {
2930
+ function Na(t) {
2903
2931
  const e = t.map((i) => i[0]).reduce(
2904
2932
  (i, n) => (i[n] += 1, i),
2905
2933
  { C: 0, Q: 0, L: 0, M: 0 }
@@ -2929,8 +2957,8 @@ function ri(t) {
2929
2957
  const i = r.getAttribute("d");
2930
2958
  if (!i)
2931
2959
  continue;
2932
- const n = ja(i);
2933
- return { element: r, points: Na(n), shapeType: Va(n) };
2960
+ const n = $a(i);
2961
+ return { element: r, points: Ha(n), shapeType: Na(n) };
2934
2962
  }
2935
2963
  case "circle": {
2936
2964
  const i = parseFloat(r.getAttribute("cx") ?? "0"), n = parseFloat(r.getAttribute("cy") ?? "0"), s = parseFloat(r.getAttribute("r") ?? "0");
@@ -2996,7 +3024,7 @@ function ri(t) {
2996
3024
  }
2997
3025
  return null;
2998
3026
  }
2999
- function Na(t) {
3027
+ function Ha(t) {
3000
3028
  const e = [];
3001
3029
  for (let r = 0; r < t.length; r++) {
3002
3030
  const i = e[e.length - 1] ?? [0, 0], n = t[r];
@@ -3007,7 +3035,7 @@ function Na(t) {
3007
3035
  continue;
3008
3036
  case "C":
3009
3037
  e.push(
3010
- ...Da(
3038
+ ...qa(
3011
3039
  { x: i[0], y: i[1] },
3012
3040
  { x: n[1], y: n[2] },
3013
3041
  { x: n[3], y: n[4] },
@@ -3018,7 +3046,7 @@ function Na(t) {
3018
3046
  continue;
3019
3047
  case "Q":
3020
3048
  e.push(
3021
- ...$a(
3049
+ ...Da(
3022
3050
  { x: i[0], y: i[1] },
3023
3051
  { x: n[1], y: n[2] },
3024
3052
  { x: n[3], y: n[4] }
@@ -3030,14 +3058,14 @@ function Na(t) {
3030
3058
  }
3031
3059
  return e;
3032
3060
  }
3033
- function Ha(t) {
3061
+ function Ba(t) {
3034
3062
  const e = {};
3035
3063
  if (t.hasAttribute("fill") ? (e.fill = t.getAttribute("fill"), t.removeAttribute("fill")) : t.style.fill && (e.fill = t.style.fill), e.fill) {
3036
- const i = rr.exec(e.fill);
3064
+ const i = ir.exec(e.fill);
3037
3065
  i && (e.fillOpacity = parseFloat(i[4]), e.fill = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
3038
3066
  }
3039
3067
  if (t.hasAttribute("fill-opacity") ? (e.fillOpacity = parseFloat(t.getAttribute("fill-opacity")), t.removeAttribute("fill-opacity")) : t.style.fillOpacity && (e.fillOpacity = parseFloat(t.style.fillOpacity)), t.hasAttribute("stroke") ? (e.stroke = t.getAttribute("stroke"), t.removeAttribute("stroke")) : t.style.stroke && (e.stroke = t.style.stroke), e.stroke) {
3040
- const i = rr.exec(e.stroke);
3068
+ const i = ir.exec(e.stroke);
3041
3069
  i && (e.strokeOpacity = parseFloat(i[4]), e.stroke = `rgb(${i[1]}, ${i[2]}, ${i[3]})`);
3042
3070
  }
3043
3071
  t.hasAttribute("stroke-opacity") ? (e.strokeOpacity = parseFloat(t.getAttribute("stroke-opacity")), t.removeAttribute("stroke-opacity")) : t.style.strokeOpacity && (e.strokeOpacity = parseFloat(t.style.strokeOpacity)), t.hasAttribute("stroke-width") ? (e.strokeWidth = t.getAttribute("stroke-width"), t.removeAttribute("stroke-width")) : t.style.strokeWidth && (e.strokeWidth = t.style.strokeWidth), t.hasAttribute("stroke-dasharray") ? (e.strokeDasharray = t.getAttribute("stroke-dasharray"), t.removeAttribute("stroke-dasharray")) : t.style.strokeDasharray && (e.strokeDasharray = t.style.strokeDasharray);
@@ -3047,14 +3075,14 @@ function Ha(t) {
3047
3075
  throw new Error("Could not find root SVG element");
3048
3076
  return { svg: r.outerHTML, style: Object.keys(e).length > 0 ? e : void 0 };
3049
3077
  }
3050
- function Ba(t) {
3078
+ function za(t) {
3051
3079
  return !!t && t.type === "iiif:ImageApiSelector" && t.type === "iiif:ImageApiSelector";
3052
3080
  }
3053
3081
  function te(t) {
3054
3082
  if (t.iiifRenderingHints) {
3055
3083
  const e = t.iiifRenderingHints;
3056
3084
  if (e.rotation) {
3057
- const r = za(e.rotation);
3085
+ const r = Wa(e.rotation);
3058
3086
  if (r)
3059
3087
  if (t.selectors.length)
3060
3088
  for (const i of t.selectors)
@@ -3069,7 +3097,7 @@ function te(t) {
3069
3097
  delete t.iiifRenderingHints;
3070
3098
  return t;
3071
3099
  }
3072
- function za(t) {
3100
+ function Wa(t) {
3073
3101
  let e = parseFloat(t);
3074
3102
  return e && t.startsWith("!") && (e = 360 - e), e && (e = e % 360), e !== e ? 0 : e || 0;
3075
3103
  }
@@ -3144,11 +3172,11 @@ function Fe(t, e = {}) {
3144
3172
  selectors: []
3145
3173
  };
3146
3174
  }
3147
- var Wa = Object.defineProperty, Qa = (t, e, r) => e in t ? Wa(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ir = (t, e, r) => (Qa(t, typeof e != "symbol" ? e + "" : e, r), r);
3148
- function Ya(t) {
3175
+ var Qa = Object.defineProperty, Ya = (t, e, r) => e in t ? Qa(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, nr = (t, e, r) => (Ya(t, typeof e != "symbol" ? e + "" : e, r), r);
3176
+ function Ga(t) {
3149
3177
  return Array.isArray(t) ? t : t ? [t] : [];
3150
3178
  }
3151
- const nr = [
3179
+ const sr = [
3152
3180
  "sc:Collection",
3153
3181
  "sc:Manifest",
3154
3182
  "sc:Canvas",
@@ -3161,7 +3189,7 @@ const nr = [
3161
3189
  "Service",
3162
3190
  "ContentResource"
3163
3191
  ];
3164
- function Ga(t) {
3192
+ function Ja(t) {
3165
3193
  if (typeof t > "u" || t === null)
3166
3194
  throw new Error("Null or undefined is not a valid entity.");
3167
3195
  if (Array.isArray(t))
@@ -3169,9 +3197,9 @@ function Ga(t) {
3169
3197
  if (typeof t != "object")
3170
3198
  throw new Error(`${typeof t} is not a valid entity`);
3171
3199
  if (typeof t["@type"] == "string") {
3172
- const e = nr.indexOf(t["@type"]);
3200
+ const e = sr.indexOf(t["@type"]);
3173
3201
  if (e !== -1)
3174
- return nr[e];
3202
+ return sr[e];
3175
3203
  }
3176
3204
  if (t.profile)
3177
3205
  return "Service";
@@ -3179,9 +3207,9 @@ function Ga(t) {
3179
3207
  return "ContentResource";
3180
3208
  throw new Error("Resource type is not known");
3181
3209
  }
3182
- class $t {
3210
+ class Dt {
3183
3211
  constructor(e, r = {}) {
3184
- ir(this, "traversals"), ir(this, "options"), this.traversals = {
3212
+ nr(this, "traversals"), nr(this, "options"), this.traversals = {
3185
3213
  collection: [],
3186
3214
  manifest: [],
3187
3215
  canvas: [],
@@ -3202,7 +3230,7 @@ class $t {
3202
3230
  };
3203
3231
  }
3204
3232
  static all(e) {
3205
- return new $t({
3233
+ return new Dt({
3206
3234
  collection: [e],
3207
3235
  manifest: [e],
3208
3236
  canvas: [e],
@@ -3330,7 +3358,7 @@ class $t {
3330
3358
  traverseUnknown(e) {
3331
3359
  if (!e["@type"] || typeof e == "string")
3332
3360
  return e;
3333
- switch (Ga(e)) {
3361
+ switch (Ja(e)) {
3334
3362
  case "sc:Collection":
3335
3363
  return this.traverseCollection(e);
3336
3364
  case "sc:Manifest":
@@ -3403,7 +3431,7 @@ class $t {
3403
3431
  }, e);
3404
3432
  }
3405
3433
  }
3406
- const Ja = "http://library.stanford.edu/iiif/image-api/compliance.html#level0", ii = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", ni = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", Ka = "http://library.stanford.edu/iiif/image-api/conformance.html#level0", si = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", ai = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", Za = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", oi = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", ci = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", Xa = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", ui = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", li = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", eo = "http://iiif.io/api/image/1/level0.json", to = "http://iiif.io/api/image/1/profiles/level0.json", fi = "http://iiif.io/api/image/1/level1.json", pi = "http://iiif.io/api/image/1/profiles/level1.json", hi = "http://iiif.io/api/image/1/level2.json", di = "http://iiif.io/api/image/1/profiles/level2.json", ro = "http://iiif.io/api/image/2/level0.json", io = "http://iiif.io/api/image/2/profiles/level0.json", yi = "http://iiif.io/api/image/2/level1.json", vi = "http://iiif.io/api/image/2/profiles/level1.json", gi = "http://iiif.io/api/image/2/level2.json", mi = "http://iiif.io/api/image/2/profiles/level2.json", no = "level0", bi = "level1", Ai = "level2", so = "http://iiif.io/api/image/2/level0", xi = "http://iiif.io/api/image/2/level1", wi = "http://iiif.io/api/image/2/level2", ao = [
3434
+ const Ka = "http://library.stanford.edu/iiif/image-api/compliance.html#level0", ii = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", ni = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", Za = "http://library.stanford.edu/iiif/image-api/conformance.html#level0", si = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", ai = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", Xa = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", oi = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", ci = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", eo = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", ui = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", li = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", to = "http://iiif.io/api/image/1/level0.json", ro = "http://iiif.io/api/image/1/profiles/level0.json", fi = "http://iiif.io/api/image/1/level1.json", pi = "http://iiif.io/api/image/1/profiles/level1.json", hi = "http://iiif.io/api/image/1/level2.json", di = "http://iiif.io/api/image/1/profiles/level2.json", io = "http://iiif.io/api/image/2/level0.json", no = "http://iiif.io/api/image/2/profiles/level0.json", yi = "http://iiif.io/api/image/2/level1.json", vi = "http://iiif.io/api/image/2/profiles/level1.json", gi = "http://iiif.io/api/image/2/level2.json", mi = "http://iiif.io/api/image/2/profiles/level2.json", so = "level0", bi = "level1", Ai = "level2", ao = "http://iiif.io/api/image/2/level0", xi = "http://iiif.io/api/image/2/level1", wi = "http://iiif.io/api/image/2/level2", oo = [
3407
3435
  xi,
3408
3436
  wi,
3409
3437
  ii,
@@ -3424,35 +3452,35 @@ const Ja = "http://library.stanford.edu/iiif/image-api/compliance.html#level0",
3424
3452
  mi,
3425
3453
  bi,
3426
3454
  Ai
3427
- ], oo = [
3428
- so,
3455
+ ], co = [
3456
+ ao,
3429
3457
  xi,
3430
3458
  wi,
3431
- Ja,
3459
+ Ka,
3432
3460
  ii,
3433
3461
  ni,
3434
- Ka,
3462
+ Za,
3435
3463
  si,
3436
3464
  ai,
3437
- Za,
3465
+ Xa,
3438
3466
  oi,
3439
3467
  ci,
3440
- Xa,
3468
+ eo,
3441
3469
  ui,
3442
3470
  li,
3443
- eo,
3444
3471
  to,
3472
+ ro,
3445
3473
  fi,
3446
3474
  pi,
3447
3475
  hi,
3448
3476
  di,
3449
- ro,
3450
3477
  io,
3478
+ no,
3451
3479
  yi,
3452
3480
  vi,
3453
3481
  gi,
3454
3482
  mi,
3455
- no,
3483
+ so,
3456
3484
  bi,
3457
3485
  Ai
3458
3486
  ];
@@ -3461,7 +3489,7 @@ function ue(t) {
3461
3489
  (typeof t[e] > "u" || t[e] === null) && delete t[e];
3462
3490
  return t;
3463
3491
  }
3464
- const Tt = {
3492
+ const It = {
3465
3493
  attributionLabel: "Attribution",
3466
3494
  lang: "none",
3467
3495
  providerId: "http://example.org/provider",
@@ -3488,14 +3516,14 @@ function Re(t, e = "none") {
3488
3516
  function Si(t) {
3489
3517
  if (Array.isArray(t))
3490
3518
  return Si(t.find((e) => typeof e == "string"));
3491
- if (oo.indexOf(t) !== -1)
3519
+ if (co.indexOf(t) !== -1)
3492
3520
  return "level2";
3493
- if (ao.indexOf(t) !== -1)
3521
+ if (oo.indexOf(t) !== -1)
3494
3522
  return "level1";
3495
3523
  if (typeof t == "string")
3496
3524
  return t;
3497
3525
  }
3498
- function co(t) {
3526
+ function uo(t) {
3499
3527
  const e = Array.isArray(t) ? t : [t];
3500
3528
  for (const r of e)
3501
3529
  switch (r) {
@@ -3509,7 +3537,7 @@ function co(t) {
3509
3537
  return "ImageApiSelector";
3510
3538
  }
3511
3539
  }
3512
- function uo(t) {
3540
+ function lo(t) {
3513
3541
  switch (t) {
3514
3542
  case "http://iiif.io/api/image/2/level0.json":
3515
3543
  case "http://iiif.io/api/image/2/level1.json":
@@ -3538,24 +3566,24 @@ function uo(t) {
3538
3566
  return "AutoCompleteService1";
3539
3567
  }
3540
3568
  }
3541
- function sr(t) {
3569
+ function ar(t) {
3542
3570
  for (const e of ["sc", "oa", "dcterms", "dctypes", "iiif"])
3543
3571
  if (t.startsWith(`${e}:`))
3544
3572
  return t.slice(e.length + 1);
3545
3573
  return t;
3546
3574
  }
3547
- const lo = ["Collection", "Manifest", "Annotation", "AnnotationPage", "Range", "Service"];
3548
- function Dt(t) {
3575
+ const fo = ["Collection", "Manifest", "Annotation", "AnnotationPage", "Range", "Service"];
3576
+ function qt(t) {
3549
3577
  const e = t["@id"] || t.id;
3550
3578
  let r = t["@type"] || t.type;
3551
3579
  const i = t.profile || void 0, n = t["@context"] || void 0;
3552
3580
  if (i) {
3553
- const s = uo(i);
3581
+ const s = lo(i);
3554
3582
  if (s)
3555
3583
  return s;
3556
3584
  }
3557
3585
  if (n) {
3558
- const s = co(n);
3586
+ const s = uo(n);
3559
3587
  if (s)
3560
3588
  return s;
3561
3589
  }
@@ -3581,7 +3609,7 @@ function Dt(t) {
3581
3609
  return "TextualBody";
3582
3610
  }
3583
3611
  }
3584
- if (r && lo.indexOf(r) !== -1)
3612
+ if (r && fo.indexOf(r) !== -1)
3585
3613
  return r;
3586
3614
  if (t.format) {
3587
3615
  if (t.format.startsWith("image/"))
@@ -3593,16 +3621,16 @@ function Dt(t) {
3593
3621
  }
3594
3622
  return e && (e.endsWith(".jpg") || e.endsWith(".png") || e.endsWith(".jpeg")) ? "Image" : r || "unknown";
3595
3623
  }
3596
- const fo = /http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;
3597
- function po(t) {
3598
- const e = t.match(fo);
3624
+ const po = /http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;
3625
+ function ho(t) {
3626
+ const e = t.match(po);
3599
3627
  return e ? e[0] : t;
3600
3628
  }
3601
- function ho(t, e = "Rights/License", r = "none") {
3629
+ function yo(t, e = "Rights/License", r = "none") {
3602
3630
  let i = null;
3603
3631
  const n = [], s = Array.isArray(t) ? t : [t];
3604
3632
  for (const a of s) {
3605
- const o = a ? po(a) : void 0;
3633
+ const o = a ? ho(a) : void 0;
3606
3634
  if (o && (o.indexOf("creativecommons.org") !== -1 || o.indexOf("rightsstatements.org") !== -1)) {
3607
3635
  o.startsWith("https://") ? i = `http://${o.slice(8)}` : i = o;
3608
3636
  continue;
@@ -3614,7 +3642,7 @@ function ho(t, e = "Rights/License", r = "none") {
3614
3642
  }
3615
3643
  return [i, n];
3616
3644
  }
3617
- const yo = [
3645
+ const vo = [
3618
3646
  "http://iiif.io/api/presentation/2/context.json",
3619
3647
  "http://iiif.io/api/image/2/context.json",
3620
3648
  "http://iiif.io/api/image/1/context.json",
@@ -3625,34 +3653,34 @@ const yo = [
3625
3653
  "http://iiif.io/api/auth/0/context.json",
3626
3654
  "http://iiif.io/api/annex/openannotation/context.json"
3627
3655
  ];
3628
- function vo(t) {
3656
+ function go(t) {
3629
3657
  if (t) {
3630
3658
  const e = Array.isArray(t) ? t : [t], r = [];
3631
3659
  for (const i of e)
3632
- i === "http://iiif.io/api/presentation/2/context.json" && r.push("http://iiif.io/api/presentation/3/context.json"), yo.indexOf(i) === -1 && r.push(i);
3660
+ i === "http://iiif.io/api/presentation/2/context.json" && r.push("http://iiif.io/api/presentation/3/context.json"), vo.indexOf(i) === -1 && r.push(i);
3633
3661
  if (e.length)
3634
3662
  return r.length === 1 ? r[0] : r;
3635
3663
  }
3636
3664
  }
3637
- function go(t) {
3665
+ function mo(t) {
3638
3666
  return t ? t.map((e) => ({
3639
3667
  label: Re(e.label),
3640
3668
  value: Re(e.value)
3641
3669
  })) : [];
3642
3670
  }
3643
- let ar = 0;
3671
+ let or = 0;
3644
3672
  function Mi(t, e) {
3645
3673
  const r = encodeURI(t.id || t["@id"] || "").trim();
3646
- return r && e ? `${r}/${e}` : r || (ar++, `http://example.org/${t["@type"]}${e ? `/${e}` : ""}/${ar}`);
3674
+ return r && e ? `${r}/${e}` : r || (or++, `http://example.org/${t["@type"]}${e ? `/${e}` : ""}/${or}`);
3647
3675
  }
3648
3676
  function le(t) {
3649
3677
  const e = [...t.behavior || []];
3650
3678
  t.viewingHint && e.push(t.viewingHint);
3651
3679
  let r;
3652
- return Array.isArray(t.motivation) ? r = t.motivation.map(sr) : t.motivation && (r = sr(t.motivation)), {
3653
- "@context": t["@context"] ? vo(t["@context"]) : void 0,
3680
+ return Array.isArray(t.motivation) ? r = t.motivation.map(ar) : t.motivation && (r = ar(t.motivation)), {
3681
+ "@context": t["@context"] ? go(t["@context"]) : void 0,
3654
3682
  id: (t["@id"] || Mi(t)).trim(),
3655
- type: Dt(t),
3683
+ type: qt(t),
3656
3684
  behavior: e.length ? e : void 0,
3657
3685
  height: t.height ? t.height : void 0,
3658
3686
  width: t.width ? t.width : void 0,
@@ -3665,24 +3693,24 @@ function le(t) {
3665
3693
  };
3666
3694
  }
3667
3695
  function fe(t) {
3668
- const [e, r] = ho(t.license), i = [...t.metadata ? go(t.metadata) : [], ...r];
3696
+ const [e, r] = yo(t.license), i = [...t.metadata ? mo(t.metadata) : [], ...r];
3669
3697
  return {
3670
3698
  rights: e,
3671
3699
  metadata: i.length ? i : void 0,
3672
3700
  label: t.label ? Re(t.label) : void 0,
3673
3701
  requiredStatement: t.attribution ? {
3674
- label: Re(Tt.attributionLabel),
3702
+ label: Re(It.attributionLabel),
3675
3703
  value: Re(t.attribution)
3676
3704
  } : void 0,
3677
3705
  navDate: t.navDate,
3678
3706
  summary: t.description ? Re(t.description) : void 0,
3679
- thumbnail: mo(t.thumbnail)
3707
+ thumbnail: bo(t.thumbnail)
3680
3708
  };
3681
3709
  }
3682
- function mo(t) {
3710
+ function bo(t) {
3683
3711
  return t && (Array.isArray(t) ? t : [t]).map((e) => typeof e == "string" ? { id: e, type: "Image" } : (e.type === "unknown" && (e.type = "Image"), e));
3684
3712
  }
3685
- function bo(t) {
3713
+ function Ao(t) {
3686
3714
  if (!t.within)
3687
3715
  return;
3688
3716
  const e = Array.isArray(t.within) ? t.within : [t.within], r = [];
@@ -3697,7 +3725,7 @@ function bo(t) {
3697
3725
  } else
3698
3726
  i["@id"] && r.push({
3699
3727
  id: i["@id"],
3700
- type: Dt(i)
3728
+ type: qt(i)
3701
3729
  });
3702
3730
  return r.length ? r : void 0;
3703
3731
  }
@@ -3706,29 +3734,29 @@ function be(t) {
3706
3734
  return {
3707
3735
  provider: t.logo || e.length ? [
3708
3736
  {
3709
- id: Tt.providerId,
3737
+ id: It.providerId,
3710
3738
  type: "Agent",
3711
3739
  homepage: e.length ? [e[0]] : void 0,
3712
3740
  logo: t.logo ? Array.isArray(t.logo) ? t.logo : [t.logo] : void 0,
3713
- label: Re(Tt.providerName)
3741
+ label: Re(It.providerName)
3714
3742
  }
3715
3743
  ] : void 0,
3716
- partOf: bo(t),
3744
+ partOf: Ao(t),
3717
3745
  rendering: t.rendering,
3718
3746
  seeAlso: t.seeAlso,
3719
3747
  start: t.startCanvas,
3720
- service: t.service ? Ya(t.service) : void 0,
3748
+ service: t.service ? Ga(t.service) : void 0,
3721
3749
  supplementary: r ? [r] : void 0
3722
3750
  };
3723
3751
  }
3724
- function Ao(t) {
3752
+ function xo(t) {
3725
3753
  return {
3726
3754
  chars: t.chars,
3727
3755
  format: t.format ? t.format : void 0,
3728
3756
  language: t.language
3729
3757
  };
3730
3758
  }
3731
- function xo(t) {
3759
+ function wo(t) {
3732
3760
  return ue({
3733
3761
  ...le(t),
3734
3762
  ...fe(t),
@@ -3736,7 +3764,7 @@ function xo(t) {
3736
3764
  items: t.members
3737
3765
  });
3738
3766
  }
3739
- function wo(t) {
3767
+ function So(t) {
3740
3768
  const e = [], r = [];
3741
3769
  let i;
3742
3770
  for (const s of t.sequences || [])
@@ -3751,7 +3779,7 @@ function wo(t) {
3751
3779
  structures: t.structures
3752
3780
  });
3753
3781
  }
3754
- function So(t) {
3782
+ function Mo(t) {
3755
3783
  return ue({
3756
3784
  ...le(t),
3757
3785
  ...fe(t),
@@ -3766,7 +3794,7 @@ function So(t) {
3766
3794
  ] : void 0
3767
3795
  });
3768
3796
  }
3769
- function Mo(t) {
3797
+ function Co(t) {
3770
3798
  return ue({
3771
3799
  ...le(t),
3772
3800
  ...fe(t),
@@ -3774,7 +3802,7 @@ function Mo(t) {
3774
3802
  items: t.resources && t.resources.length ? t.resources : void 0
3775
3803
  });
3776
3804
  }
3777
- function Co(t) {
3805
+ function Ro(t) {
3778
3806
  return !t.canvases || t.canvases.length === 0 ? {
3779
3807
  canvases: [],
3780
3808
  behavior: []
@@ -3784,7 +3812,7 @@ function Co(t) {
3784
3812
  startCanvas: t.startCanvas
3785
3813
  };
3786
3814
  }
3787
- function Ro(t) {
3815
+ function To(t) {
3788
3816
  function e(r) {
3789
3817
  if (Array.isArray(r)) {
3790
3818
  if (r.length > 1)
@@ -3806,7 +3834,7 @@ function Ro(t) {
3806
3834
  return {
3807
3835
  type: "SpecificResource",
3808
3836
  source: i,
3809
- selector: kt(r.selector)
3837
+ selector: Ot(r.selector)
3810
3838
  };
3811
3839
  } else
3812
3840
  return encodeURI(r["@id"]).trim();
@@ -3816,19 +3844,19 @@ function Ro(t) {
3816
3844
  ...fe(t),
3817
3845
  ...be(t),
3818
3846
  target: e(t.on),
3819
- body: Array.isArray(t.resource) ? t.resource.map(It) : It(t.resource)
3847
+ body: Array.isArray(t.resource) ? t.resource.map(kt) : kt(t.resource)
3820
3848
  });
3821
3849
  }
3822
- function It(t) {
3850
+ function kt(t) {
3823
3851
  const e = t;
3824
3852
  return ue({
3825
3853
  ...le(e),
3826
3854
  ...fe(e),
3827
3855
  ...be(e),
3828
- ...Ao(e)
3856
+ ...xo(e)
3829
3857
  });
3830
3858
  }
3831
- function To(t) {
3859
+ function Io(t) {
3832
3860
  const e = [];
3833
3861
  return t.default && t.default !== "rdf:nil" && e.push(t.default), t.item && t.item !== "rdf:nil" && e.push(...t.item), {
3834
3862
  ...le(t),
@@ -3836,7 +3864,7 @@ function To(t) {
3836
3864
  items: e
3837
3865
  };
3838
3866
  }
3839
- function Io(t) {
3867
+ function ko(t) {
3840
3868
  return ue({
3841
3869
  ...le(t),
3842
3870
  ...fe(t),
@@ -3844,34 +3872,34 @@ function Io(t) {
3844
3872
  items: t.members
3845
3873
  });
3846
3874
  }
3847
- function ko(t) {
3875
+ function Oo(t) {
3848
3876
  const { "@id": e, "@type": r, "@context": i, profile: n, ...s } = t, a = {};
3849
- return e && (a["@id"] = e), a["@type"] = Dt(t), a["@type"] === "unknown" && (i && i.length && (a["@context"] = i), a["@type"] = "Service"), n && (a.profile = Si(n)), ue({
3877
+ return e && (a["@id"] = e), a["@type"] = qt(t), a["@type"] === "unknown" && (i && i.length && (a["@context"] = i), a["@type"] = "Service"), n && (a.profile = Si(n)), ue({
3850
3878
  ...a,
3851
3879
  ...s
3852
3880
  });
3853
3881
  }
3854
- function Oo(t) {
3882
+ function Eo(t) {
3855
3883
  return ue({
3856
3884
  ...le(t),
3857
3885
  ...fe(t),
3858
3886
  ...be(t)
3859
3887
  });
3860
3888
  }
3861
- new $t({
3862
- collection: [xo],
3863
- manifest: [wo],
3864
- canvas: [So],
3865
- annotationList: [Mo],
3866
- sequence: [Co],
3867
- annotation: [Ro],
3868
- contentResource: [It],
3869
- choice: [To],
3870
- range: [Io],
3871
- service: [ko],
3872
- layer: [Oo]
3889
+ new Dt({
3890
+ collection: [wo],
3891
+ manifest: [So],
3892
+ canvas: [Mo],
3893
+ annotationList: [Co],
3894
+ sequence: [Ro],
3895
+ annotation: [To],
3896
+ contentResource: [kt],
3897
+ choice: [Io],
3898
+ range: [ko],
3899
+ service: [Oo],
3900
+ layer: [Eo]
3873
3901
  });
3874
- function kt(t) {
3902
+ function Ot(t) {
3875
3903
  if ((Array.isArray(t["@type"]) && t["@type"].includes("oa:SvgSelector") || t["@type"] == "oa:SvgSelector") && ("chars" in t || "value" in t))
3876
3904
  return {
3877
3905
  type: "SvgSelector",
@@ -3884,9 +3912,9 @@ function kt(t) {
3884
3912
  };
3885
3913
  if (t["@type"] === "oa:Choice")
3886
3914
  return [
3887
- kt(t.default),
3915
+ Ot(t.default),
3888
3916
  ...(Array.isArray(t.item) ? t.item : [t.item]).map(
3889
- kt
3917
+ Ot
3890
3918
  )
3891
3919
  ];
3892
3920
  if (t["@type"] == "iiif:ImageApiSelector")
@@ -3897,12 +3925,12 @@ function kt(t) {
3897
3925
  };
3898
3926
  throw new Error(`Unsupported selector type: ${t["@type"]}`);
3899
3927
  }
3900
- var or = { exports: {} };
3928
+ var cr = { exports: {} };
3901
3929
  (function(t, e) {
3902
3930
  var r = Object.defineProperty, i = (s, a, o) => a in s ? r(s, a, { enumerable: !0, configurable: !0, writable: !0, value: o }) : s[a] = o, n = (s, a, o) => (i(s, typeof a != "symbol" ? a + "" : a, o), o);
3903
3931
  (function(s, a) {
3904
3932
  a(e);
3905
- })(Ca, function(s) {
3933
+ })(Ra, function(s) {
3906
3934
  const a = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", o = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", u = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", h = "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", d = "http://iiif.io/api/image/1/level1.json", g = "http://iiif.io/api/image/1/profiles/level1.json", A = "http://iiif.io/api/image/1/level2.json", b = "http://iiif.io/api/image/1/profiles/level2.json", w = "http://iiif.io/api/image/2/level1.json", R = "http://iiif.io/api/image/2/profiles/level1.json", O = "http://iiif.io/api/image/2/level2.json", F = "http://iiif.io/api/image/2/profiles/level2.json", T = "level1", P = "level2", E = "http://iiif.io/api/image/2/level1", M = "http://iiif.io/api/image/2/level2", $ = [E, M, a, o, u, h, l, p, v, m, d, g, A, b, w, R, O, F, T, P], ie = ["http://iiif.io/api/image/2/level0", E, M, "http://library.stanford.edu/iiif/image-api/compliance.html#level0", a, o, "http://library.stanford.edu/iiif/image-api/conformance.html#level0", u, h, "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", d, g, A, b, "http://iiif.io/api/image/2/level0.json", "http://iiif.io/api/image/2/profiles/level0.json", w, R, O, F, "level0", T, P], K = ["sc:Collection", "sc:Manifest", "sc:Canvas", "sc:AnnotationList", "oa:Annotation", "sc:Range", "sc:Layer", "sc:Sequence", "oa:Choice", "Service", "ContentResource"];
3907
3935
  class U {
3908
3936
  constructor(c, y = {}) {
@@ -4197,25 +4225,25 @@ var or = { exports: {} };
4197
4225
  return y.length === 1 ? y[0] : y;
4198
4226
  }
4199
4227
  }
4200
- let _t = 0;
4201
- function Ut(f, c) {
4228
+ let Ut = 0;
4229
+ function Vt(f, c) {
4202
4230
  const y = encodeURI(f.id || f["@id"] || "").trim();
4203
- return y && c ? `${y}/${c}` : y || (_t++, `http://example.org/${f["@type"]}${c ? `/${c}` : ""}/${_t}`);
4231
+ return y && c ? `${y}/${c}` : y || (Ut++, `http://example.org/${f["@type"]}${c ? `/${c}` : ""}/${Ut}`);
4204
4232
  }
4205
4233
  function ae(f) {
4206
4234
  const c = [...f.behavior || []];
4207
4235
  let y;
4208
- return f.viewingHint && c.push(f.viewingHint), Array.isArray(f.motivation) ? y = f.motivation.map(Z) : f.motivation && (y = Z(f.motivation)), { "@context": f["@context"] ? Hi(f["@context"]) : void 0, id: (f["@id"] || Ut(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 };
4236
+ return f.viewingHint && c.push(f.viewingHint), Array.isArray(f.motivation) ? y = f.motivation.map(Z) : f.motivation && (y = Z(f.motivation)), { "@context": f["@context"] ? Hi(f["@context"]) : void 0, id: (f["@id"] || Vt(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 };
4209
4237
  }
4210
4238
  function oe(f) {
4211
4239
  const [c, y] = function(I, B = "Rights/License", _e = "none") {
4212
4240
  let Ue = null;
4213
- const Vt = [], Yi = Array.isArray(I) ? I : [I];
4214
- for (const Nt of Yi) {
4215
- const de = Nt ? Vi(Nt) : void 0;
4216
- !de || de.indexOf("creativecommons.org") === -1 && de.indexOf("rightsstatements.org") === -1 ? de && Vt.push({ label: { [_e]: [B] }, value: { [_e]: [de] } }) : Ue = de.startsWith("https://") ? `http://${de.slice(8)}` : de;
4241
+ const Nt = [], Yi = Array.isArray(I) ? I : [I];
4242
+ for (const Ht of Yi) {
4243
+ const de = Ht ? Vi(Ht) : void 0;
4244
+ !de || de.indexOf("creativecommons.org") === -1 && de.indexOf("rightsstatements.org") === -1 ? de && Nt.push({ label: { [_e]: [B] }, value: { [_e]: [de] } }) : Ue = de.startsWith("https://") ? `http://${de.slice(8)}` : de;
4217
4245
  }
4218
- return [Ue, Vt];
4246
+ return [Ue, Nt];
4219
4247
  }(f.license), S = [...f.metadata ? (L = f.metadata, L ? L.map((I) => ({ label: k(I.label), value: k(I.value) })) : []) : [], ...y];
4220
4248
  var L;
4221
4249
  return { rights: c, metadata: S.length ? S : void 0, label: f.label ? k(f.label) : void 0, requiredStatement: f.attribution ? { label: k(X), value: k(f.attribution) } : void 0, navDate: f.navDate, summary: f.description ? k(f.description) : void 0, thumbnail: Bi(f.thumbnail) };
@@ -4251,7 +4279,7 @@ var or = { exports: {} };
4251
4279
  const L = ae(f);
4252
4280
  return y.length && (L.behavior ? L.behavior.push(...y) : L.behavior = y), N({ ...L, ...oe(f), ...he(f), start: S, items: c, structures: f.structures });
4253
4281
  }], canvas: [function(f) {
4254
- return N({ ...ae(f), ...oe(f), ...he(f), annotations: f.otherContent && f.otherContent.length ? f.otherContent : void 0, items: f.images && f.images.length ? [{ id: Ut(f, "annotation-page"), type: "AnnotationPage", items: f.images }] : void 0 });
4282
+ return N({ ...ae(f), ...oe(f), ...he(f), annotations: f.otherContent && f.otherContent.length ? f.otherContent : void 0, items: f.images && f.images.length ? [{ id: Vt(f, "annotation-page"), type: "AnnotationPage", items: f.images }] : void 0 });
4255
4283
  }], annotationList: [function(f) {
4256
4284
  return N({ ...ae(f), ...oe(f), ...he(f), items: f.resources && f.resources.length ? f.resources : void 0 });
4257
4285
  }], sequence: [function(f) {
@@ -4307,7 +4335,7 @@ var or = { exports: {} };
4307
4335
  };
4308
4336
  s.upgrade = Qi, Object.defineProperties(s, { __esModule: { value: !0 }, [Symbol.toStringTag]: { value: "Module" } });
4309
4337
  });
4310
- })(or, or.exports);
4338
+ })(cr, cr.exports);
4311
4339
  function Ci(t, e) {
4312
4340
  const { selector: r, source: i } = Fe(e);
4313
4341
  if (i.id !== t.id)
@@ -4330,16 +4358,16 @@ function Ci(t, e) {
4330
4358
  i
4331
4359
  ];
4332
4360
  }
4333
- const Eo = {
4361
+ const Po = {
4334
4362
  makeChoice: () => {
4335
4363
  }
4336
- }, gt = { type: "unknown" }, _ = (t) => ({ type: "unknown", reason: t, annotations: { pages: [] } }), Po = (t, e) => ({ type: "empty", width: t, height: e, annotations: { pages: [] }, image: null, images: [] });
4337
- function Lo(t, e) {
4364
+ }, gt = { type: "unknown" }, _ = (t) => ({ type: "unknown", reason: t, annotations: { pages: [] } }), Lo = (t, e) => ({ type: "empty", width: t, height: e, annotations: { pages: [] }, image: null, images: [] });
4365
+ function Fo(t, e) {
4338
4366
  var i;
4339
4367
  const r = (i = t == null ? void 0 : t.iiif) == null ? void 0 : i.meta[e];
4340
4368
  return r ? r.annotationPageManager : null;
4341
4369
  }
4342
- function Fo(t, e) {
4370
+ function jo(t, e) {
4343
4371
  return Y(
4344
4372
  (r) => {
4345
4373
  const i = [];
@@ -4348,7 +4376,7 @@ function Fo(t, e) {
4348
4376
  const n = Object.keys(r.iiif.entities.AnnotationPage);
4349
4377
  for (const s of n)
4350
4378
  if (!e || e.indexOf(s) !== -1) {
4351
- const a = Lo(r, s);
4379
+ const a = Fo(r, s);
4352
4380
  a && a.views && a.views[t] && i.push(s);
4353
4381
  }
4354
4382
  return i;
@@ -4356,7 +4384,7 @@ function Fo(t, e) {
4356
4384
  [t, e]
4357
4385
  );
4358
4386
  }
4359
- function jo({
4387
+ function $o({
4360
4388
  canvas: t,
4361
4389
  manifest: e,
4362
4390
  all: r,
@@ -4376,18 +4404,18 @@ function jo({
4376
4404
  n.indexOf(s.id) === -1 && n.push(s.id);
4377
4405
  return n;
4378
4406
  }
4379
- function $o(t, e) {
4407
+ function Do(t, e) {
4380
4408
  var i;
4381
4409
  const r = (i = t == null ? void 0 : t.iiif) == null ? void 0 : i.meta[e];
4382
4410
  return r ? r.annotationPageManager : null;
4383
4411
  }
4384
- function Do(t, e = {}) {
4385
- const r = W(), i = Pe(), n = me(), s = qr(), a = j(() => jo({
4412
+ function qo(t, e = {}) {
4413
+ const r = W(), i = Pe(), n = me(), s = qr(), a = j(() => $o({
4386
4414
  all: e.all,
4387
4415
  manifest: i,
4388
4416
  canvas: n,
4389
4417
  canvases: s
4390
- }), [e.all, n, s, i]), o = Fo(t, e.all ? void 0 : a), u = D(
4418
+ }), [e.all, n, s, i]), o = jo(t, e.all ? void 0 : a), u = D(
4391
4419
  (l) => {
4392
4420
  t && r.setMetaValue(
4393
4421
  [l, "annotationPageManager", "views"],
@@ -4406,7 +4434,7 @@ function Do(t, e = {}) {
4406
4434
  if (p != null && p.deselectOthers) {
4407
4435
  const d = Object.keys(v.iiif.entities.AnnotationPage);
4408
4436
  for (const g of d) {
4409
- const A = $o(v, g);
4437
+ const A = Do(v, g);
4410
4438
  A && A.views && A.views[t] && m.push(g);
4411
4439
  }
4412
4440
  }
@@ -4429,14 +4457,14 @@ function Do(t, e = {}) {
4429
4457
  setPageDisabled: u
4430
4458
  };
4431
4459
  }
4432
- function qo(t, e) {
4460
+ function _o(t, e) {
4433
4461
  return Y((r, i) => i.get(t.map((n) => ({ id: n, type: e }))), [t, e]);
4434
4462
  }
4435
- const _o = ge.createContext(new pr());
4463
+ const Uo = ge.createContext(new hr());
4436
4464
  function Ri() {
4437
- return Q(_o);
4465
+ return Q(Uo);
4438
4466
  }
4439
- function Uo() {
4467
+ function Vo() {
4440
4468
  const t = Ri(), [e, r] = J({}), i = ve(!1);
4441
4469
  return re(() => () => {
4442
4470
  i.current = !0;
@@ -4468,7 +4496,7 @@ function Uo() {
4468
4496
  [t, e]
4469
4497
  ), e];
4470
4498
  }
4471
- function Vo(t = {}) {
4499
+ function No(t = {}) {
4472
4500
  const e = Kr(), r = me(t.canvasId ? { id: t.canvasId } : void 0);
4473
4501
  return Y(
4474
4502
  (i, n) => {
@@ -4484,7 +4512,7 @@ function Vo(t = {}) {
4484
4512
  [r]
4485
4513
  );
4486
4514
  }
4487
- function No(t) {
4515
+ function Ho(t) {
4488
4516
  return t.type === "SpecificResource" ? [t.source, { selector: t.selector }] : [t, { selector: null }];
4489
4517
  }
4490
4518
  const Be = {}, Ti = {
@@ -4507,7 +4535,7 @@ const Be = {}, Ti = {
4507
4535
  return e ? r[e] : r;
4508
4536
  }
4509
4537
  };
4510
- function Ho(t = Ti) {
4538
+ function Bo(t = Ti) {
4511
4539
  function e(n) {
4512
4540
  const s = n ? typeof n == "string" ? t.get(n) : n : null;
4513
4541
  if (!s)
@@ -4526,7 +4554,7 @@ function Ho(t = Ti) {
4526
4554
  throw new Error("getPaintables() accept either a canvas or list of annotations");
4527
4555
  const p = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
4528
4556
  for (const v of p) {
4529
- const [m, { selector: d }] = No(v), g = t.get(m), A = (g.type || "unknown").toLowerCase();
4557
+ const [m, { selector: d }] = Ho(v), g = t.get(m), A = (g.type || "unknown").toLowerCase();
4530
4558
  if (A === "choice") {
4531
4559
  const b = t.get(g.items, { parent: g.id }), w = s.length ? s.map((R) => b.find((O) => O.id === R)).filter(Boolean) : [b[0]];
4532
4560
  w.length === 0 && w.push(b[0]), u = {
@@ -4565,8 +4593,8 @@ function Ho(t = Ti) {
4565
4593
  extractChoices: i
4566
4594
  };
4567
4595
  }
4568
- function Bo(t, e = []) {
4569
- const r = W(), i = j(() => Ho(r), []), n = Vo({ enableSingleAnnotation: t == null ? void 0 : t.enableSingleAnnotation }), [s, a] = J((t == null ? void 0 : t.defaultChoices) || []), o = j(
4596
+ function zo(t, e = []) {
4597
+ const r = W(), i = j(() => Bo(r), []), n = No({ enableSingleAnnotation: t == null ? void 0 : t.enableSingleAnnotation }), [s, a] = J((t == null ? void 0 : t.defaultChoices) || []), o = j(
4570
4598
  () => i.getPaintables(n, s),
4571
4599
  [r, n, s, ...e]
4572
4600
  ), h = { makeChoice: D(
@@ -4598,7 +4626,50 @@ function Bo(t, e = []) {
4598
4626
  ) };
4599
4627
  return [o, h];
4600
4628
  }
4601
- function zo(t, e, r) {
4629
+ const Wo = ["model/gltf-binary"];
4630
+ function Qo(t, e) {
4631
+ const i = e.items[0].resource;
4632
+ return i.format ? Wo.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4633
+ type: "3d-model",
4634
+ model: i
4635
+ } : _("Unknown format");
4636
+ }
4637
+ function Yo(t, e) {
4638
+ var i;
4639
+ if (!t.duration)
4640
+ return _("No duration on canvas");
4641
+ if (e.items.length > 1)
4642
+ return _("Only one audio source supported");
4643
+ const r = (i = e.items[0]) == null ? void 0 : i.resource;
4644
+ return r ? r.format ? {
4645
+ type: "media",
4646
+ media: {
4647
+ annotationId: e.items[0].annotationId,
4648
+ duration: t.duration,
4649
+ url: r.id,
4650
+ type: "Sound",
4651
+ target: {
4652
+ type: "TemporalSelector",
4653
+ temporal: {
4654
+ startTime: 0,
4655
+ endTime: t.duration
4656
+ }
4657
+ },
4658
+ format: r.format,
4659
+ selector: {
4660
+ type: "TemporalSelector",
4661
+ temporal: {
4662
+ startTime: 0,
4663
+ endTime: t.duration
4664
+ }
4665
+ }
4666
+ },
4667
+ annotations: {
4668
+ pages: []
4669
+ }
4670
+ } : _("Audio does not have format") : _("Unknown audio");
4671
+ }
4672
+ function Go(t, e, r) {
4602
4673
  const i = [];
4603
4674
  for (const n of e.items) {
4604
4675
  const s = n.resource && n.resource.type === "SpecificResource" ? n.resource.source : n.resource;
@@ -4660,51 +4731,34 @@ function zo(t, e, r) {
4660
4731
  choice: e.choice
4661
4732
  };
4662
4733
  }
4663
- const Wo = ["model/gltf-binary"];
4664
- function Qo(t, e) {
4665
- const i = e.items[0].resource;
4666
- return i.format ? Wo.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4667
- type: "3d-model",
4668
- model: i
4669
- } : _("Unknown format");
4670
- }
4671
- function Yo(t, e) {
4672
- var i;
4673
- if (!t.duration)
4674
- return _("No duration on canvas");
4675
- if (e.items.length > 1)
4676
- return _("Only one audio source supported");
4677
- const r = (i = e.items[0]) == null ? void 0 : i.resource;
4678
- return r ? r.format ? {
4679
- type: "media",
4680
- media: {
4681
- annotationId: e.items[0].annotationId,
4682
- duration: t.duration,
4683
- url: r.id,
4684
- type: "Sound",
4685
- target: {
4686
- type: "TemporalSelector",
4687
- temporal: {
4688
- startTime: 0,
4689
- endTime: t.duration
4690
- }
4691
- },
4692
- format: r.format,
4693
- selector: {
4694
- type: "TemporalSelector",
4695
- temporal: {
4696
- startTime: 0,
4697
- endTime: t.duration
4698
- }
4699
- }
4700
- },
4701
- annotations: {
4702
- pages: []
4734
+ function Ii(t, e = {}, r) {
4735
+ const i = t.language || r || "none";
4736
+ switch (t.type) {
4737
+ case "TextualBody": {
4738
+ typeof t.value < "u" && (e[i] = t.value);
4739
+ break;
4703
4740
  }
4704
- } : _("Audio does not have format") : _("Unknown audio");
4741
+ case "List":
4742
+ case "Composite":
4743
+ case "Choice":
4744
+ t.items && t.items.forEach((n) => Ii(n, e, i));
4745
+ }
4746
+ return e;
4705
4747
  }
4706
- const Go = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4707
4748
  function Jo(t, e) {
4749
+ const r = [];
4750
+ return e.items.forEach((i) => {
4751
+ if (i.resource) {
4752
+ const [n] = Ci(t, i.target);
4753
+ r.push({ annotationId: i.annotationId, text: Ii(i.resource), target: n });
4754
+ }
4755
+ }), {
4756
+ type: "textual-content",
4757
+ items: r
4758
+ };
4759
+ }
4760
+ const Ko = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4761
+ function Zo(t, e) {
4708
4762
  var a;
4709
4763
  const r = e.items.filter((o) => o.type === "video");
4710
4764
  if (!t.duration)
@@ -4742,7 +4796,7 @@ function Jo(t, e) {
4742
4796
  };
4743
4797
  if (n) {
4744
4798
  s.type = "VideoYouTube";
4745
- const o = i.id.match(Go);
4799
+ const o = i.id.match(Ko);
4746
4800
  if (!o[1])
4747
4801
  return _("Video is not known youtube video");
4748
4802
  s.youTubeId = o[1];
@@ -4755,55 +4809,30 @@ function Jo(t, e) {
4755
4809
  }
4756
4810
  };
4757
4811
  }
4758
- function Ii(t, e = {}, r) {
4759
- const i = t.language || r || "none";
4760
- switch (t.type) {
4761
- case "TextualBody": {
4762
- typeof t.value < "u" && (e[i] = t.value);
4763
- break;
4764
- }
4765
- case "List":
4766
- case "Composite":
4767
- case "Choice":
4768
- t.items && t.items.forEach((n) => Ii(n, e, i));
4769
- }
4770
- return e;
4771
- }
4772
- function Ko(t, e) {
4773
- const r = [];
4774
- return e.items.forEach((i) => {
4775
- if (i.resource) {
4776
- const [n] = Ci(t, i.target);
4777
- r.push({ annotationId: i.annotationId, text: Ii(i.resource), target: n });
4778
- }
4779
- }), {
4780
- type: "textual-content",
4781
- items: r
4782
- };
4783
- }
4784
- function Zo(t) {
4785
- const e = Pe(), r = me(), i = W(), [n, s] = Uo(), { enabledPageIds: a } = Do((t == null ? void 0 : t.annotationPageManagerId) || (e == null ? void 0 : e.id) || (r == null ? void 0 : r.id), {
4812
+ function Xo({ canvas: t, paintables: e, supports: r, loadImageService: i }) {
4813
+ if (!t)
4814
+ return console.log("No canvas"), gt;
4815
+ if (e.types.length === 0)
4816
+ return r.indexOf("empty") !== -1 ? Lo(t.width, t.height) : (console.log("No paintables"), gt);
4817
+ if (e.types.length !== 1)
4818
+ if (e.types.length === 2 && e.types.indexOf("text") !== -1)
4819
+ e.types = e.types.filter((s) => s !== "text");
4820
+ else
4821
+ return r.indexOf("complex-timeline") === -1 ? _("Complex timeline not supported") : _("ComplexTimelineStrategy not yet supported");
4822
+ const n = e.types[0];
4823
+ return n === "image" ? r.indexOf("images") === -1 ? _("Image not supported") : Go(t, e, i) : n === "Model" || n === "model" ? r.indexOf("3d-model") === -1 ? _("3D not supported") : Qo(t, e) : n === "textualbody" ? r.indexOf("textual-content") === -1 ? _("Textual content not supported") : Jo(t, e) : n === "sound" || n === "audio" ? r.indexOf("media") === -1 ? _("Media not supported") : Yo(t, e) : n === "video" ? r.indexOf("media") === -1 ? _("Media not supported") : Zo(t, e) : gt;
4824
+ }
4825
+ function ec(t) {
4826
+ const e = Pe(), r = me(), i = W(), [n, s] = Vo(), { enabledPageIds: a } = qo((t == null ? void 0 : t.annotationPageManagerId) || (e == null ? void 0 : e.id) || (r == null ? void 0 : r.id), {
4786
4827
  all: !1
4787
- }), o = qo(a, "AnnotationPage"), u = (t == null ? void 0 : t.strategies) || [
4828
+ }), o = _o(a, "AnnotationPage"), u = (t == null ? void 0 : t.strategies) || [
4788
4829
  "empty",
4789
4830
  "images",
4790
4831
  "media",
4791
4832
  "textual-content",
4792
4833
  "complex-timeline"
4793
- ], [h, l] = Bo(t, [s]), p = j(() => {
4794
- if (!r)
4795
- return console.log("No canvas"), gt;
4796
- if (h.types.length === 0)
4797
- return u.indexOf("empty") !== -1 ? Po(r.width, r.height) : (console.log("No paintables"), gt);
4798
- if (h.types.length !== 1)
4799
- if (h.types.length === 2 && h.types.indexOf("text") !== -1)
4800
- h.types = h.types.filter((m) => m !== "text");
4801
- else
4802
- return u.indexOf("complex-timeline") === -1 ? _("Complex timeline not supported") : _("ComplexTimelineStrategy not yet supported");
4803
- const v = h.types[0];
4804
- return v === "image" ? u.indexOf("images") === -1 ? _("Image not supported") : zo(r, h, n) : v === "Model" || v === "model" ? u.indexOf("3d-model") === -1 ? _("3D not supported") : Qo(r, h) : v === "textualbody" ? u.indexOf("textual-content") === -1 ? _("Textual content not supported") : Ko(r, h) : v === "sound" || v === "audio" ? u.indexOf("media") === -1 ? _("Media not supported") : Yo(r, h) : v === "video" ? u.indexOf("media") === -1 ? _("Media not supported") : Jo(r, h) : (console.log("No idea"), gt);
4805
- }, [r, h, i, l.makeChoice]);
4806
- return j(() => p.type === "unknown" ? [p, Eo] : [
4834
+ ], [h, l] = zo(t, [s]), p = j(() => Xo({ canvas: r, paintables: h, supports: u, loadImageService: n }), [r, h, i, l.makeChoice]);
4835
+ return j(() => p.type === "unknown" ? [p, Po] : [
4807
4836
  {
4808
4837
  ...p,
4809
4838
  annotations: { pages: o }
@@ -4811,7 +4840,7 @@ function Zo(t) {
4811
4840
  l
4812
4841
  ], [p, o]);
4813
4842
  }
4814
- const Xo = (t, e = []) => {
4843
+ const tc = (t, e = []) => {
4815
4844
  const r = W();
4816
4845
  re(() => {
4817
4846
  t(r);
@@ -4835,20 +4864,20 @@ const Xo = (t, e = []) => {
4835
4864
  if (r)
4836
4865
  return e ? r[e] : r;
4837
4866
  }
4838
- }, ec = new pr();
4839
- function tc(t = ki, e = {}) {
4840
- const r = e.imageServiceLoader || ec;
4867
+ }, rc = new hr();
4868
+ function ic(t = ki, e = {}) {
4869
+ const r = e.imageServiceLoader || rc;
4841
4870
  async function i(n, s, a = !1, o = [], u) {
4842
4871
  const h = () => r.getThumbnailFromResource(void 0, s, a, o);
4843
4872
  if (!n)
4844
4873
  return await r.getThumbnailFromResource(void 0, s, a, o);
4845
4874
  if (typeof n == "string") {
4846
- const p = Ht(n);
4875
+ const p = Bt(n);
4847
4876
  return p && o.push(p), await r.getThumbnailFromResource(void 0, s, a, o);
4848
4877
  }
4849
4878
  const l = t.get(n, { skipSelfReturn: !1 });
4850
4879
  if (typeof l == "string")
4851
- return { best: Ht(l), fallback: [], log: [] };
4880
+ return { best: Bt(l), fallback: [], log: [] };
4852
4881
  if (!l)
4853
4882
  return await h();
4854
4883
  switch (await (async (p) => {
@@ -4897,13 +4926,13 @@ function tc(t = ki, e = {}) {
4897
4926
  getBestThumbnailAtSize: i
4898
4927
  };
4899
4928
  }
4900
- function rc(t, e, { canvasId: r, manifestId: i } = {}) {
4901
- const n = W(), s = Ri(), a = j(() => tc(n, { imageServiceLoader: s }), [n, s]), [o, u] = J(), h = Pe(i ? { id: i } : void 0), l = me(r ? { id: r } : void 0), p = l || h, v = ve(!1);
4929
+ function nc(t, e, { canvasId: r, manifestId: i } = {}) {
4930
+ const n = W(), s = Ri(), a = j(() => ic(n, { imageServiceLoader: s }), [n, s]), [o, u] = J(), h = Pe(i ? { id: i } : void 0), l = me(r ? { id: r } : void 0), p = l || h, v = ve(!1);
4902
4931
  if (re(() => (v.current = !1, () => {
4903
4932
  v.current = !0;
4904
4933
  }), []), !p)
4905
4934
  throw new Error("Must be called under a manifest or canvas context.");
4906
- return Xo(
4935
+ return tc(
4907
4936
  (m) => {
4908
4937
  a.getBestThumbnailAtSize(p, t, e).then((d) => {
4909
4938
  d.best && !v.current && u(d.best);
@@ -4912,10 +4941,10 @@ function rc(t, e, { canvasId: r, manifestId: i } = {}) {
4912
4941
  [p]
4913
4942
  ), o;
4914
4943
  }
4915
- function ic(t) {
4944
+ function sc(t) {
4916
4945
  return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: t };
4917
4946
  }
4918
- function nc(t, e) {
4947
+ function ac(t, e) {
4919
4948
  switch (e.type) {
4920
4949
  case "FINISHED":
4921
4950
  return { ...t, isFinished: !0, isPlaying: !1, playRequested: !1 };
@@ -4938,13 +4967,13 @@ function nc(t, e) {
4938
4967
  }
4939
4968
  return t;
4940
4969
  }
4941
- function sc(t) {
4970
+ function oc(t) {
4942
4971
  const e = Math.round(t);
4943
4972
  return `${Math.floor(e / 60)}:${`${e % 60}`.padStart(2, "0")}`;
4944
4973
  }
4945
- function qt(t) {
4946
- const [e, r] = Gi(nc, ic(t.duration)), i = ve(null), n = ve(null), s = ve(null), a = ve(!1), o = D(() => {
4947
- n.current && i.current && (n.current.innerHTML = sc(i.current.currentTime), s.current && (s.current.style.width = `${i.current.currentTime / t.duration * 100}%`), a.current !== i.current.muted && (a.current = i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
4974
+ function _t(t) {
4975
+ const [e, r] = Gi(ac, sc(t.duration)), i = ve(null), n = ve(null), s = ve(null), a = ve(!1), o = D(() => {
4976
+ n.current && i.current && (n.current.innerHTML = oc(i.current.currentTime), s.current && (s.current.style.width = `${i.current.currentTime / t.duration * 100}%`), a.current !== i.current.muted && (a.current = i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
4948
4977
  }, [t.duration]), u = D(() => {
4949
4978
  i.current && (r({ type: "PLAY_REQUESTED" }), i.current.play().then(() => {
4950
4979
  r({ type: "PLAY" });
@@ -4992,7 +5021,7 @@ function qt(t) {
4992
5021
  }
4993
5022
  ];
4994
5023
  }
4995
- const ac = ce(null), oc = ce(null), cc = ce(null);
5024
+ const cc = ce(null), uc = ce(null), lc = ce(null);
4996
5025
  function Oi({
4997
5026
  actions: t,
4998
5027
  state: e,
@@ -5001,10 +5030,10 @@ function Oi({
5001
5030
  progress: n,
5002
5031
  element: s
5003
5032
  }) {
5004
- return /* @__PURE__ */ x(cc.Provider, { value: { currentTime: i, progress: n, element: s }, children: /* @__PURE__ */ x(oc.Provider, { value: t, children: /* @__PURE__ */ x(ac.Provider, { value: e, children: r }) }) });
5033
+ return /* @__PURE__ */ x(lc.Provider, { value: { currentTime: i, progress: n, element: s }, children: /* @__PURE__ */ x(uc.Provider, { value: t, children: /* @__PURE__ */ x(cc.Provider, { value: e, children: r }) }) });
5005
5034
  }
5006
5035
  function Ei({ media: t, children: e }) {
5007
- const [{ element: r, currentTime: i, progress: n }, s, a] = qt({ duration: t.duration });
5036
+ const [{ element: r, currentTime: i, progress: n }, s, a] = _t({ duration: t.duration });
5008
5037
  return /* @__PURE__ */ V(
5009
5038
  Oi,
5010
5039
  {
@@ -5055,7 +5084,7 @@ function Fi({
5055
5084
  mediaControlsDeps: e,
5056
5085
  children: r
5057
5086
  }) {
5058
- const [{ element: i, currentTime: n, progress: s }, a, o] = qt({ duration: t.duration });
5087
+ const [{ element: i, currentTime: n, progress: s }, a, o] = _t({ duration: t.duration });
5059
5088
  return Oe("overlay", "video-element", Li, {
5060
5089
  element: i,
5061
5090
  media: t,
@@ -5117,18 +5146,18 @@ function Di({ style: t }) {
5117
5146
  }
5118
5147
  );
5119
5148
  }
5120
- const uc = ge.createContext("en");
5149
+ const fc = ge.createContext("en");
5121
5150
  function qi() {
5122
- return ge.useContext(uc);
5151
+ return ge.useContext(fc);
5123
5152
  }
5124
- function cr(t) {
5153
+ function ur(t) {
5125
5154
  return t.indexOf("-") !== -1 ? t.slice(0, t.indexOf("-")) : t;
5126
5155
  }
5127
- function lc({ as: t, language: e, children: r, viewingDirection: i, ...n }) {
5156
+ function pc({ as: t, language: e, children: r, viewingDirection: i, ...n }) {
5128
5157
  const s = qi();
5129
- return j(() => cr(s) === cr(e), [s, e]) ? t ? /* @__PURE__ */ x(t, { ...n, children: r }) : /* @__PURE__ */ x("span", { ...n, children: r }) : t ? /* @__PURE__ */ x(t, { ...n, lang: e, dir: i, children: r }) : /* @__PURE__ */ x("span", { ...n, lang: e, dir: i, children: r });
5158
+ return j(() => ur(s) === ur(e), [s, e]) ? t ? /* @__PURE__ */ x(t, { ...n, children: r }) : /* @__PURE__ */ x("span", { ...n, children: r }) : t ? /* @__PURE__ */ x(t, { ...n, lang: e, dir: i, children: r }) : /* @__PURE__ */ x("span", { ...n, lang: e, dir: i, children: r });
5130
5159
  }
5131
- function fc(t, e, r) {
5160
+ function hc(t, e, r) {
5132
5161
  if (e.length === 0)
5133
5162
  return;
5134
5163
  if (e.length === 1)
@@ -5143,15 +5172,15 @@ function fc(t, e, r) {
5143
5172
  return n;
5144
5173
  return e.indexOf("none") !== -1 ? "none" : e.indexOf("@none") !== -1 ? "@none" : e[0];
5145
5174
  }
5146
- const pc = (t, e = []) => {
5175
+ const dc = (t, e = []) => {
5147
5176
  const r = qi();
5148
5177
  return j(() => {
5149
5178
  const i = t();
5150
- return fc(r, i, []);
5179
+ return hc(r, i, []);
5151
5180
  }, [r, ...e]);
5152
5181
  };
5153
- function hc(t, e) {
5154
- const r = pc(() => Object.keys(t || {}), [t]);
5182
+ function yc(t, e) {
5183
+ const r = dc(() => Object.keys(t || {}), [t]);
5155
5184
  return [
5156
5185
  j(() => {
5157
5186
  if (!t)
@@ -5165,10 +5194,10 @@ function hc(t, e) {
5165
5194
  r
5166
5195
  ];
5167
5196
  }
5168
- const dc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5169
- const [s, a] = hc(i, e);
5197
+ const vc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5198
+ const [s, a] = yc(i, e);
5170
5199
  return a ? /* @__PURE__ */ x(
5171
- lc,
5200
+ pc,
5172
5201
  {
5173
5202
  ...n,
5174
5203
  as: t,
@@ -5191,7 +5220,7 @@ const dc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children:
5191
5220
  }
5192
5221
  );
5193
5222
  };
5194
- function yc({
5223
+ function gc({
5195
5224
  element: t,
5196
5225
  media: e,
5197
5226
  playPause: r
@@ -5229,13 +5258,13 @@ function yc({
5229
5258
  )
5230
5259
  ] }) : null;
5231
5260
  }
5232
- function vc({
5261
+ function mc({
5233
5262
  media: t,
5234
5263
  mediaControlsDeps: e,
5235
5264
  children: r
5236
5265
  }) {
5237
- const [{ element: i, currentTime: n, progress: s }, a, o] = qt({ duration: t.duration });
5238
- return Oe("overlay", "video-element", yc, {
5266
+ const [{ element: i, currentTime: n, progress: s }, a, o] = _t({ duration: t.duration });
5267
+ return Oe("overlay", "video-element", gc, {
5239
5268
  element: i,
5240
5269
  media: t,
5241
5270
  playPause: o.playPause
@@ -5262,7 +5291,7 @@ function _i({
5262
5291
  onClickPaintingAnnotation: b,
5263
5292
  children: w
5264
5293
  }) {
5265
- const R = me(), O = zr(R, ["deep-zoom"]), [F] = _s(), T = Ns(), P = W(), E = j(() => Qr(P), [P]), [M, $] = Zo({
5294
+ const R = me(), O = zr(R, ["deep-zoom"]), [F] = Us(), T = Hs(), P = W(), E = j(() => Qr(P), [P]), [M, $] = ec({
5266
5295
  strategies: l || ["images"],
5267
5296
  defaultChoices: n == null ? void 0 : n.map(({ id: k }) => k)
5268
5297
  }), ie = M.type === "images" ? M.choice : void 0, K = j(() => d ? 1 : Math.max(
@@ -5272,7 +5301,7 @@ function _i({
5272
5301
  return (k.width || 0) / ((H = k.target) == null ? void 0 : H.spatial.width);
5273
5302
  }) : []
5274
5303
  ), [d, M]);
5275
- Hs(K), re(() => {
5304
+ Bs(K), re(() => {
5276
5305
  i && i($);
5277
5306
  }, [M.annotations]), re(() => {
5278
5307
  if (n)
@@ -5280,19 +5309,19 @@ function _i({
5280
5309
  typeof k.opacity < "u" && E.applyStyles({ id: k.id }, "atlas", {
5281
5310
  opacity: k.opacity
5282
5311
  });
5283
- }, [n]), ur(() => {
5312
+ }, [n]), lr(() => {
5284
5313
  r && r(ie);
5285
5314
  }, [ie]), Oe(
5286
5315
  T && (M.type === "images" || M.type === "empty" || M.type === "textual-content" && a) ? "overlay" : "none",
5287
5316
  `canvas-portal-controls-${R == null ? void 0 : R.id}`,
5288
- Lt.Provider,
5317
+ Ft.Provider,
5289
5318
  a ? {
5290
5319
  value: T || null,
5291
5320
  children: a(M)
5292
5321
  } : {},
5293
5322
  [R, T, M, ...u || []]
5294
5323
  );
5295
- const U = rc({ maxWidth: 256, maxHeight: 256 });
5324
+ const U = nc({ maxWidth: 256, maxHeight: 256 });
5296
5325
  if (!R)
5297
5326
  return null;
5298
5327
  const N = R.accompanyingCanvas, X = U && U.type === "fixed" ? /* @__PURE__ */ x("world-object", { height: R.height, width: R.width, x: t, y: e, children: /* @__PURE__ */ x(
@@ -5315,8 +5344,8 @@ function _i({
5315
5344
  return null;
5316
5345
  }
5317
5346
  const ne = /* @__PURE__ */ V(Je, { children: [
5318
- F ? /* @__PURE__ */ x(Rt, { page: F }) : null,
5319
- M.annotations && M.annotations.pages ? M.annotations.pages.map((k) => /* @__PURE__ */ x(Rt, { page: k }, k.id)) : null,
5347
+ F ? /* @__PURE__ */ x(Tt, { page: F }) : null,
5348
+ M.annotations && M.annotations.pages ? M.annotations.pages.map((k) => /* @__PURE__ */ x(Tt, { page: k }, k.id)) : null,
5320
5349
  w
5321
5350
  ] }), Ae = M.type === "images" ? M.images.length : 0;
5322
5351
  return /* @__PURE__ */ V(Me, { children: [
@@ -5340,7 +5369,7 @@ function _i({
5340
5369
  pe.stopPropagation(), b(k.annotationId, k, pe);
5341
5370
  } : void 0,
5342
5371
  target: ((Z = k.target) == null ? void 0 : Z.spatial) || void 0,
5343
- children: /* @__PURE__ */ x("div", { "data-textual-content": !0, children: /* @__PURE__ */ x(dc, { enableDangerouslySetInnerHTML: !0, children: k.text }) })
5372
+ children: /* @__PURE__ */ x("div", { "data-textual-content": !0, children: /* @__PURE__ */ x(vc, { enableDangerouslySetInnerHTML: !0, children: k.text }) })
5344
5373
  },
5345
5374
  H
5346
5375
  ),
@@ -5372,7 +5401,7 @@ function _i({
5372
5401
  ] }) : M.media.type === "Video" ? /* @__PURE__ */ V(Fi, { media: M.media, mediaControlsDeps: h, children: [
5373
5402
  X,
5374
5403
  o ? o(M) : null
5375
- ] }) : M.media.type === "VideoYouTube" && A ? /* @__PURE__ */ V(vc, { media: M.media, mediaControlsDeps: h, children: [
5404
+ ] }) : M.media.type === "VideoYouTube" && A ? /* @__PURE__ */ V(mc, { media: M.media, mediaControlsDeps: h, children: [
5376
5405
  X,
5377
5406
  o ? o(M) : null
5378
5407
  ] }) : null }) : null
@@ -5380,15 +5409,15 @@ function _i({
5380
5409
  },
5381
5410
  `${R.id}/${M.type}/${Ae}`
5382
5411
  ),
5383
- M.type === "media" && M.media.type === "Sound" && N ? /* @__PURE__ */ x(Pt, { canvas: N.id, children: /* @__PURE__ */ x(_i, { renderViewerControls: a }) }) : null
5412
+ M.type === "media" && M.media.type === "Sound" && N ? /* @__PURE__ */ x(Lt, { canvas: N.id, children: /* @__PURE__ */ x(_i, { renderViewerControls: a }) }) : null
5384
5413
  ] });
5385
5414
  }
5386
- function gc() {
5415
+ function bc() {
5387
5416
  const t = Q(tt);
5388
5417
  return t && t.vault ? t.vault : $r();
5389
5418
  }
5390
- const mc = lr(function(e, r) {
5391
- const i = Pe(), n = qr(), s = ds(), { ViewerControls: a, MediaControls: o } = e.components || {};
5419
+ const Ac = fr(function(e, r) {
5420
+ const i = Pe(), n = qr(), s = ys(), { ViewerControls: a, MediaControls: o } = e.components || {};
5392
5421
  if (Ji(r, () => s, [s]), !i)
5393
5422
  return /* @__PURE__ */ x("div", {});
5394
5423
  let u = 0;
@@ -5401,7 +5430,7 @@ const mc = lr(function(e, r) {
5401
5430
  mode: e.mode,
5402
5431
  children: n.map((h, l) => {
5403
5432
  const p = u;
5404
- return u += h.width + (e.spacing || 0), /* @__PURE__ */ x(Pt, { canvas: h.id, children: /* @__PURE__ */ x(
5433
+ return u += h.width + (e.spacing || 0), /* @__PURE__ */ x(Lt, { canvas: h.id, children: /* @__PURE__ */ x(
5405
5434
  G.RenderCanvas,
5406
5435
  {
5407
5436
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
@@ -5419,10 +5448,10 @@ const mc = lr(function(e, r) {
5419
5448
  ),
5420
5449
  e.children
5421
5450
  ] });
5422
- }), G = lr(function({ children: e, height: r, annotations: i, canvasProps: n, spacing: s, header: a, components: o, mode: u, ...h }, l) {
5423
- const p = gc();
5424
- return /* @__PURE__ */ x(Dr, { vault: p, children: /* @__PURE__ */ x(hs, { ...h, children: /* @__PURE__ */ x(
5425
- mc,
5451
+ }), G = fr(function({ children: e, height: r, annotations: i, canvasProps: n, spacing: s, header: a, components: o, mode: u, ...h }, l) {
5452
+ const p = bc();
5453
+ return /* @__PURE__ */ x(Dr, { vault: p, children: /* @__PURE__ */ x(ds, { ...h, children: /* @__PURE__ */ x(
5454
+ Ac,
5426
5455
  {
5427
5456
  ref: l,
5428
5457
  height: r,
@@ -5438,9 +5467,9 @@ const mc = lr(function(e, r) {
5438
5467
  });
5439
5468
  G.RenderImage = Xr;
5440
5469
  G.RenderCanvas = _i;
5441
- G.RenderAnnotationPage = Rt;
5470
+ G.RenderAnnotationPage = Tt;
5442
5471
  G.RenderAnnotation = Zr;
5443
- G.Viewer = Bs;
5472
+ G.Viewer = zs;
5444
5473
  G.CanvasBackground = Di;
5445
5474
  G.Audio = Pi;
5446
5475
  G.Video = Fi;