react-iiif-vault 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  import { jsx as x, jsxs as 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,17 +16,17 @@ 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() {
27
- for (var o, u = arguments.length, h = new Array(u), l = 0; l < u; l++)
28
- h[l] = arguments[l];
29
- i.props.onReset == null || (o = i.props).onReset.apply(o, h), i.reset();
26
+ return i = t.call.apply(t, [this].concat(s)) || this, i.state = zt, i.resetErrorBoundary = function() {
27
+ for (var o, u = arguments.length, p = new Array(u), l = 0; l < u; l++)
28
+ p[l] = arguments[l];
29
+ i.props.onReset == null || (o = i.props).onReset.apply(o, p), i.reset();
30
30
  }, i;
31
31
  }
32
32
  e.getDerivedStateFromError = function(n) {
@@ -36,29 +36,29 @@ 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);
43
43
  }, r.componentDidUpdate = function(n, s) {
44
44
  var a = this.state.error, o = this.props.resetKeys;
45
45
  if (a !== null && s.error !== null && fn(n.resetKeys, o)) {
46
- var u, h;
47
- (u = (h = this.props).onResetKeysChange) == null || u.call(h, n.resetKeys, o), this.reset();
46
+ var u, p;
47
+ (u = (p = this.props).onResetKeysChange) == null || u.call(p, n.resetKeys, o), this.reset();
48
48
  }
49
49
  }, r.render = function() {
50
50
  var n = this.state.error, s = this.props, a = s.fallbackRender, o = s.FallbackComponent, u = s.fallback;
51
51
  if (n !== null) {
52
- var h = {
52
+ var p = {
53
53
  error: n,
54
54
  resetErrorBoundary: this.resetErrorBoundary
55
55
  };
56
56
  if (/* @__PURE__ */ ot.isValidElement(u))
57
57
  return u;
58
58
  if (typeof a == "function")
59
- return a(h);
59
+ return a(p);
60
60
  if (o)
61
- return /* @__PURE__ */ ot.createElement(o, h);
61
+ return /* @__PURE__ */ ot.createElement(o, p);
62
62
  throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
63
63
  }
64
64
  return this.props.children;
@@ -71,13 +71,13 @@ const 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 p = ct(a, i);
149
+ if (p)
150
+ return p;
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 p, l = !1;
158
+ try {
159
+ const h = await Promise.race([
160
+ new Promise((v, m) => {
161
+ l || (p = 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 (p && p(), h)
183
+ return h;
184
+ } catch {
185
+ p && p();
186
+ }
187
+ })();
184
188
  }
189
+ }
185
190
  t.dispatch(Pn({ id: i }));
191
+ const u = (p) => {
192
+ if (!p)
193
+ return;
194
+ !p.id && !p["@id"] && (p["@type"] && (p["@id"] = i), p.id = i);
195
+ const l = $n(i, p);
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 p = e(i, n);
200
+ return qn(p) ? (async () => {
201
+ try {
202
+ return u(await p);
203
+ } catch (l) {
204
+ throw t.dispatch(St({ id: i, message: l.toString() })), l;
205
+ }
206
+ })() : u(p);
207
+ } catch (p) {
208
+ throw t.dispatch(St({ id: i, message: p.toString() })), p;
193
209
  }
194
210
  };
195
211
  }
@@ -208,47 +224,47 @@ 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;
215
231
  if (!Object.is(u, e)) {
216
- const h = e;
217
- e = o ?? typeof u != "object" ? u : Object.assign({}, e, u), r.forEach((l) => l(e, h));
232
+ const p = e;
233
+ e = o ?? typeof u != "object" ? u : Object.assign({}, e, u), r.forEach((l) => l(e, p));
218
234
  }
219
235
  }, n = () => e, s = { setState: i, getState: n, subscribe: (a) => (r.add(a), () => r.delete(a)), destroy: () => {
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
- let h;
260
+ let p;
245
261
  try {
246
- h = (s ?? !1) && window.__REDUX_DEVTOOLS_EXTENSION__;
262
+ p = (s ?? !1) && window.__REDUX_DEVTOOLS_EXTENSION__;
247
263
  } catch {
248
264
  }
249
- if (!h)
265
+ if (!p)
250
266
  return t(r, i, n);
251
- const { connection: l, ...p } = Vn(o, h, u);
267
+ const { connection: l, ...h } = Nn(o, p, u);
252
268
  let v = !0;
253
269
  n.setState = (g, A, b) => {
254
270
  const w = r(g, A);
@@ -270,11 +286,11 @@ const Gt = (t) => {
270
286
  const A = v;
271
287
  v = !1, r(...g), v = A;
272
288
  }, d = t(n.setState, i, n);
273
- if (p.type === "untracked" ? l == null || l.init(d) : (p.stores[p.store] = n, l == null || l.init(
289
+ if (h.type === "untracked" ? l == null || l.init(d) : (h.stores[h.store] = n, l == null || l.init(
274
290
  Object.fromEntries(
275
- Object.entries(p.stores).map(([g, A]) => [
291
+ Object.entries(h.stores).map(([g, A]) => [
276
292
  g,
277
- g === p.store ? d : A.getState()
293
+ g === h.store ? d : A.getState()
278
294
  ])
279
295
  )
280
296
  )), n.dispatchFromDevtools && typeof n.dispatch == "function") {
@@ -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,16 +388,16 @@ 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;
379
395
  if (a) {
380
- const h = (o == null ? void 0 : o.equalityFn) || Object.is;
396
+ const p = (o == null ? void 0 : o.equalityFn) || Object.is;
381
397
  let l = s(i.getState());
382
- u = (p) => {
383
- const v = s(p);
384
- if (!h(l, v)) {
398
+ u = (h) => {
399
+ const v = s(h);
400
+ if (!p(l, v)) {
385
401
  const m = l;
386
402
  a(l = v, m);
387
403
  }
@@ -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,28 +473,28 @@ 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] || {} };
464
- let h = !1;
480
+ let p = !1;
465
481
  const l = Object.keys(o || {}) || [];
466
482
  if (o && l) {
467
- for (const p of l)
468
- h = !0, u[p] = t[a][p] ? Qn(t[a][p], o[p]) : o[p];
469
- h && (s[a] = u);
483
+ for (const h of l)
484
+ p = !0, u[h] = t[a][h] ? Yn(t[a][h], o[h]) : o[h];
485
+ p && (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);
@@ -874,29 +890,29 @@ let Ct = class {
874
890
  const { skipSelfReturn: n = !0 } = i || {};
875
891
  let s = i.parent ? typeof i.parent == "string" ? i.parent : i.parent.id : void 0;
876
892
  if (Array.isArray(e))
877
- return e.map((p) => this.get(p, i));
893
+ return e.map((h) => this.get(h, 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]);
881
- if (!p)
896
+ const h = Zt(r || a.iiif.mapping[e]);
897
+ if (!h)
882
898
  return n ? null : { id: e, type: "unknown" };
883
- e = { id: e, type: p };
899
+ e = { id: e, type: h };
884
900
  }
885
901
  if (e && e.partOf && !s && !i.skipPartOfCheck) {
886
- const p = Array.isArray(e.partOf) ? e.partOf[0] : e.partOf;
887
- p && (typeof p == "string" && (s = p), typeof p.id == "string" && (s = p.id));
902
+ const h = Array.isArray(e.partOf) ? e.partOf[0] : e.partOf;
903
+ h && (typeof h == "string" && (s = h), typeof h.id == "string" && (s = h.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];
890
- if (!h) {
891
- const p = a.iiif.requests[u];
892
- return p && p.resourceUri !== u ? this.get(p.resourceUri, i) : n ? null : e;
905
+ const o = Zt(r || (e == null ? void 0 : e.type)), u = e == null ? void 0 : e.id, p = a.iiif.entities[o];
906
+ if (!p) {
907
+ const h = a.iiif.requests[u];
908
+ return h && h.resourceUri !== u ? this.get(h.resourceUri, i) : n ? null : e;
893
909
  }
894
- const l = h[e.id];
910
+ const l = p[e.id];
895
911
  if (l && l[Ke]) {
896
- const p = l[Ke].find((v) => s ? v[Ze] === s : v[Ze] === l.id);
897
- return fr(l, p);
912
+ const h = l[Ke].find((v) => s ? v[Ze] === s : v[Ze] === l.id);
913
+ return pr(l, h);
898
914
  }
899
- return h[e.id] || (n ? null : e);
915
+ return p[e.id] || (n ? null : e);
900
916
  }
901
917
  select(e) {
902
918
  return e(this.getState());
@@ -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,37 +1056,37 @@ 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 } = {}) {
1032
- 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);
1059
+ function as(t, { noCache: e = !1 } = {}) {
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]), [p, l] = J(u);
1033
1061
  return re(() => {
1034
1062
  (async () => {
1035
1063
  try {
1036
- const p = u && !e ? u : await i.load(r), v = p ? p.id || p["@id"] : null;
1037
- p && n !== v && s(v), l(p);
1038
- } catch (p) {
1039
- o(p);
1064
+ const h = u && !e ? u : await i.load(r), v = h ? h.id || h["@id"] : null;
1065
+ h && n !== v && s(v), l(h);
1066
+ } catch (h) {
1067
+ o(h);
1040
1068
  }
1041
1069
  })();
1042
1070
  }, [r, e]), {
1043
- isLoaded: !!h,
1071
+ isLoaded: !!p,
1044
1072
  id: n,
1045
1073
  requestId: r,
1046
1074
  error: a,
1047
- resource: h,
1048
- cached: !!(h && h === u)
1075
+ resource: p,
1076
+ cached: !!(p && p === 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,76 +1132,76 @@ 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)]];
1111
1139
  if (o || !s || r)
1112
1140
  return [u, u.map((d, g) => [g])];
1113
- const h = [];
1141
+ const p = [];
1114
1142
  let l = [];
1115
- const p = () => {
1116
- l.length && (h.push([...l]), l = []);
1143
+ const h = () => {
1144
+ l.length && (p.push([...l]), l = []);
1117
1145
  };
1118
1146
  let v = 0, m = !1;
1119
1147
  for (let d = 0; d < u.length; d++) {
1120
1148
  const g = t.get(u[d]);
1121
1149
  if (g.behavior.includes("non-paged")) {
1122
- d === v && v++, i || (p(), h.push([d]), p());
1150
+ d === v && v++, i || (h(), p.push([d]), h());
1123
1151
  continue;
1124
1152
  }
1125
1153
  if (d === v || g.behavior.includes("facing-pages")) {
1126
- l.length && (m = !0), p(), h.push([d]), p();
1154
+ l.length && (m = !0), h(), p.push([d]), h();
1127
1155
  continue;
1128
1156
  }
1129
1157
  if (l.push(d), m) {
1130
- p(), m = !1;
1158
+ h(), m = !1;
1131
1159
  continue;
1132
1160
  }
1133
- l.length > 1 && p();
1161
+ l.length > 1 && h();
1134
1162
  }
1135
- return l.length && p(), [u, h];
1163
+ return l.length && h(), [u, p];
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
- const [u, h] = j(
1150
- () => us(r, o, { disablePaging: e }),
1177
+ const [u, p] = j(
1178
+ () => ls(r, o, { disablePaging: e }),
1151
1179
  [r, o]
1152
1180
  ), l = D(
1153
1181
  (g) => {
1154
- const A = h.findIndex((b) => b.includes(g));
1182
+ const A = p.findIndex((b) => b.includes(g));
1155
1183
  a(A === -1 ? 0 : A);
1156
1184
  },
1157
- [u, h]
1158
- ), p = D(
1185
+ [u, p]
1186
+ ), h = D(
1159
1187
  (g) => {
1160
1188
  const A = u.findIndex((b) => b.id === g);
1161
1189
  A !== -1 ? l(A) : a(0);
1162
1190
  },
1163
- [u, h]
1191
+ [u, p]
1164
1192
  ), v = D(() => {
1165
- a((g) => g >= h.length ? g : g + 1);
1166
- }, [h]), m = D(() => {
1193
+ a((g) => g >= p.length ? g : g + 1);
1194
+ }, [p]), m = D(() => {
1167
1195
  a((g) => g <= 0 ? 0 : g - 1);
1168
- }, [h]);
1169
- return typeof s > "u" && (t ? p(t) : a(0)), {
1170
- visibleItems: ((d = h[s]) == null ? void 0 : d.map((g) => u[g].id)) || [],
1196
+ }, [p]);
1197
+ return typeof s > "u" && (t ? h(t) : a(0)), {
1198
+ visibleItems: ((d = p[s]) == null ? void 0 : d.map((g) => u[g].id)) || [],
1171
1199
  cursor: s,
1172
1200
  items: u,
1173
- sequence: h,
1201
+ sequence: p,
1174
1202
  setSequenceIndex: a,
1175
1203
  setCanvasIndex: l,
1176
- setCanvasId: p,
1204
+ setCanvasId: h,
1177
1205
  next: v,
1178
1206
  previous: m
1179
1207
  };
@@ -1189,50 +1217,50 @@ 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: p, setSequenceIndex: l } = ps({
1194
1222
  startCanvas: t.startCanvas,
1195
1223
  disablePaging: t.pagingEnabled === !1
1196
- }), p = j(
1224
+ }), h = j(
1197
1225
  () => ({
1198
1226
  sequence: s,
1199
1227
  items: a,
1200
1228
  // Extra functions.
1201
1229
  setCurrentCanvasId: u,
1202
1230
  nextCanvas: n,
1203
- previousCanvas: h,
1231
+ previousCanvas: p,
1204
1232
  totalCanvases: a.length,
1205
1233
  setCurrentCanvasIndex: o,
1206
1234
  setSequenceIndex: l,
1207
1235
  currentSequenceIndex: r
1208
1236
  }),
1209
- [s, a, u, n, h, a, o, l, r]
1237
+ [s, a, u, n, p, 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 ? /* @__PURE__ */ x(it.Provider, { value: h, 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,13 +1327,13 @@ function qs() {
1299
1327
  ), s = D(
1300
1328
  (o, u) => {
1301
1329
  if (i) {
1302
- if (Zt(o)) {
1303
- const p = o;
1304
- p.__vault || p.bindToVault(t), o = typeof p.source == "string" ? p.source : p.source.id, e.current[o] = p;
1330
+ if (Xt(o)) {
1331
+ const h = o;
1332
+ h.__vault || h.bindToVault(t), o = typeof h.source == "string" ? h.source : h.source.id, e.current[o] = h;
1305
1333
  } else
1306
1334
  typeof o != "string" && (o = o.id);
1307
- const h = t.get({ id: i, type: "AnnotationPage" }), l = t.get({ id: o, type: "Annotation" });
1308
- h && l && (h.items.find((p) => p.id === l.id) || r(
1335
+ const p = t.get({ id: i, type: "AnnotationPage" }), l = t.get({ id: o, type: "Annotation" });
1336
+ p && l && (p.items.find((h) => h.id === l.id) || r(
1309
1337
  pt.addReference({
1310
1338
  id: i,
1311
1339
  type: "AnnotationPage",
@@ -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 }), [b]), R = D((T, P) => {
1447
+ const [s, a] = J(), o = vs(), u = e || Ns, [p, l] = J({}), h = Object.entries(p), [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;
@@ -1441,12 +1469,12 @@ function Bs({
1441
1469
  {
1442
1470
  ...n,
1443
1471
  containerProps: { style: { position: "relative" }, ...n.containerProps || {} },
1444
- htmlChildren: /* @__PURE__ */ x(Me, { children: p.map(([T, { element: P, props: E }]) => /* @__PURE__ */ x(ge.Fragment, { children: /* @__PURE__ */ x(P, { ...E || {} }) }, T)) }),
1472
+ htmlChildren: /* @__PURE__ */ x(Me, { children: h.map(([T, { element: P, props: E }]) => /* @__PURE__ */ x(ge.Fragment, { children: /* @__PURE__ */ x(P, { ...E || {} }) }, T)) }),
1445
1473
  onCreated: (T) => {
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)
@@ -1502,15 +1530,15 @@ function zs(t = Br) {
1502
1530
  for (const a of Object.keys(n))
1503
1531
  s[a] = (o) => {
1504
1532
  const u = t.get(i);
1505
- for (const { callback: h, scope: l } of n[a] || [])
1506
- (!l || r && l.indexOf(r) !== -1) && h(o, u);
1533
+ for (const { callback: p, scope: l } of n[a] || [])
1534
+ (!l || r && l.indexOf(r) !== -1) && p(o, u);
1507
1535
  };
1508
1536
  return s;
1509
1537
  }
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,14 +1582,14 @@ 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 {
1561
1589
  for (var o = e[Symbol.iterator](), u; !(n = (u = o.next()).done) && (i.push(u.value), !(r && i.length === r)); n = !0)
1562
1590
  ;
1563
- } catch (h) {
1564
- s = !0, a = h;
1591
+ } catch (p) {
1592
+ s = !0, a = p;
1565
1593
  } finally {
1566
1594
  try {
1567
1595
  !n && o.return && o.return();
@@ -1582,12 +1610,12 @@ var Ws = Object.defineProperty, Qs = (t, e, r) => e in t ? Ws(t, e, { enumerable
1582
1610
  }(), je = Math.PI * 2, ht = function(t, e, r, i, n, s, a) {
1583
1611
  var o = t.x, u = t.y;
1584
1612
  o *= e, u *= r;
1585
- var h = i * o - n * u, l = n * o + i * u;
1613
+ var p = i * o - n * u, l = n * o + i * u;
1586
1614
  return {
1587
- x: h + s,
1615
+ x: p + 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,16 +1627,16 @@ 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) {
1606
- 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;
1633
+ }, Ks = function(t, e, r, i, n, s, a, o, u, p, l, h) {
1634
+ var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(h, 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 * h, w = A * -s / n * l, R = p * b - u * w + (t + r) / 2, O = u * b + p * w + (e + i) / 2, F = (l - b) / n, T = (h - w) / s, P = (-l - b) / n, E = (-h - 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) {
1611
- 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 = [];
1638
+ }, Zs = function(t) {
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, p = t.largeArcFlag, l = p === void 0 ? 0 : p, h = t.sweepFlag, v = h === void 0 ? 0 : h, m = [];
1612
1640
  if (s === 0 || a === 0)
1613
1641
  return [];
1614
1642
  var d = Math.sin(u * je / 360), g = Math.cos(u * je / 360), A = g * (e - i) / 2 + d * (r - n) / 2, b = -d * (e - i) / 2 + g * (r - n) / 2;
@@ -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,10 +1719,10 @@ 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);
1697
- let i, n = 0, s = 0, a = 0, o = 0, u, h, l = 0, p = 0;
1722
+ const oa = /* @__PURE__ */ Yr(sa);
1723
+ function ca(t) {
1724
+ const e = na(t), r = oa(e);
1725
+ let i, n = 0, s = 0, a = 0, o = 0, u, p, l = 0, h = 0;
1698
1726
  const v = [];
1699
1727
  for (let m = 0; m < r.length; m++) {
1700
1728
  let d = r[m];
@@ -1711,21 +1739,21 @@ function oa(t) {
1711
1739
  break;
1712
1740
  case "S":
1713
1741
  {
1714
- let A = l, b = p;
1742
+ let A = l, b = h;
1715
1743
  (i === "C" || i == "S") && (A += A - a, b += b - o), d = ["C", A, b, d[1], d[2], d[3], d[4]];
1716
1744
  }
1717
1745
  break;
1718
1746
  case "T":
1719
- i === "Q" || i == "T" ? (u = l * 2 - u, h = p * 2 - h) : (u = l, h = p), d = ["Q", u, h, d[1], d[2]];
1747
+ i === "Q" || i == "T" ? (u = l * 2 - u, p = h * 2 - p) : (u = l, p = h), d = ["Q", u, p, d[1], d[2]];
1720
1748
  break;
1721
1749
  case "Q":
1722
- u = d[1], h = d[2];
1750
+ u = d[1], p = d[2];
1723
1751
  break;
1724
1752
  case "A":
1725
1753
  {
1726
- const A = Ks({
1754
+ const A = Zs({
1727
1755
  px: l,
1728
- py: p,
1756
+ py: h,
1729
1757
  cx: d[6],
1730
1758
  cy: d[7],
1731
1759
  rx: d[1],
@@ -1745,7 +1773,7 @@ function oa(t) {
1745
1773
  d = ["L", n, s];
1746
1774
  break;
1747
1775
  }
1748
- i = g, l = d[d.length - 2], p = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = p), v.push(d);
1776
+ i = g, l = d[d.length - 2], h = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = h), v.push(d);
1749
1777
  }
1750
1778
  return v;
1751
1779
  }
@@ -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) {
@@ -1809,19 +1837,19 @@ class Gr {
1809
1837
  };
1810
1838
  }
1811
1839
  mapToBasic() {
1812
- const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, h = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, p = (s - e) * u - (a - r) * o, v = h / p, m = l / p, d = Math.abs(p) / (Math.hypot(o, u) * Math.abs(m - v));
1813
- return { x0: e, x2: s, scale: d, cross: p };
1840
+ const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, p = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, h = (s - e) * u - (a - r) * o, v = p / h, m = l / h, d = Math.abs(h) / (Math.hypot(o, u) * Math.abs(m - v));
1841
+ return { x0: e, x2: s, scale: d, cross: h };
1814
1842
  }
1815
1843
  subdivide(e) {
1816
- const r = this.mapToBasic(), i = $e(r.x0), n = $e(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = Ie(i), u = Ie(n), h = [0];
1844
+ const r = this.mapToBasic(), i = $e(r.x0), n = $e(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = Ie(i), u = Ie(n), p = [0];
1817
1845
  for (let l = 1; l < a; l++) {
1818
- const p = (Ie(i + (n - i) * l / a) - o) / (u - o);
1819
- h.push(p);
1846
+ const h = (Ie(i + (n - i) * l / a) - o) / (u - o);
1847
+ p.push(h);
1820
1848
  }
1821
- return h.push(1), h.map((l) => this.eval(l));
1849
+ return p.push(1), p.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);
@@ -1869,19 +1897,19 @@ class Ft {
1869
1897
  val: T
1870
1898
  }), u += T;
1871
1899
  }
1872
- const h = 0.5 * u / n, l = Math.ceil(h), p = [{ x: this.c[0], y: this.c[1] }];
1900
+ const p = 0.5 * u / n, l = Math.ceil(p), h = [{ x: this.c[0], y: this.c[1] }];
1873
1901
  let v = 0, m = 0;
1874
1902
  for (let d = 1; d < l; d++) {
1875
1903
  const g = u * d / l;
1876
1904
  for (; v + o[m].val < g; )
1877
1905
  v += o[m].val, m++;
1878
1906
  const A = o[m].a0, b = o[m].a2, w = Ie(A), R = Ie(b), O = A + (b - A) * (g - v) / o[m].val, F = (Ie(O) - w) / (R - w);
1879
- p.push(o[m].quad.eval(F));
1907
+ h.push(o[m].quad.eval(F));
1880
1908
  }
1881
- return p.push({ x: this.c[6], y: this.c[7] }), p;
1909
+ return h.push({ x: this.c[6], y: this.c[7] }), h;
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",
@@ -2003,8 +2031,8 @@ function Qe(t, {
2003
2031
  selectors: [],
2004
2032
  iiifRenderingHints: i
2005
2033
  });
2006
- const p = Jr(l);
2007
- p && (n = p.points, u = p.shapeType, s = [
2034
+ const h = Jr(l);
2035
+ h && (n = h.points, u = h.shapeType, s = [
2008
2036
  Math.min(...n.map((v) => v[0])),
2009
2037
  // llx
2010
2038
  Math.min(...n.map((v) => v[1])),
@@ -2013,9 +2041,9 @@ 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(h.element) ?? { svg: o });
2017
2045
  }
2018
- const h = {
2046
+ const p = {
2019
2047
  type: "SvgSelector",
2020
2048
  svg: o,
2021
2049
  svgShape: u,
@@ -2024,8 +2052,8 @@ function Qe(t, {
2024
2052
  spatial: s ? { unit: "pixel", x: s[0], y: s[1], width: s[2] - s[0], height: s[3] - s[1] } : void 0
2025
2053
  };
2026
2054
  return ee({
2027
- selector: h,
2028
- selectors: [h],
2055
+ selector: p,
2056
+ selectors: [p],
2029
2057
  iiifRenderingHints: i
2030
2058
  });
2031
2059
  }
@@ -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");
@@ -2085,8 +2113,8 @@ function Jr(t) {
2085
2113
  continue;
2086
2114
  const o = [];
2087
2115
  for (let u = 0; u <= 360; u += 12) {
2088
- const h = Math.tan(u / 360 * Math.PI), l = s * (1 - h ** 2) / (1 + h ** 2), p = a * 2 * h / (1 + h ** 2);
2089
- o.push([i + l, n + p]);
2116
+ const p = Math.tan(u / 360 * Math.PI), l = s * (1 - p ** 2) / (1 + p ** 2), h = a * 2 * p / (1 + p ** 2);
2117
+ o.push([i + l, n + h]);
2090
2118
  }
2091
2119
  return { element: r, points: o, shapeType: "ellipse" };
2092
2120
  }
@@ -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
  }
@@ -2282,24 +2310,24 @@ function Ce(t, e = {}) {
2282
2310
  }
2283
2311
  function Kr(t = {}, e = []) {
2284
2312
  const { id: r, selector: i } = t, n = Ee(), s = W(), a = r || n.annotation, o = Y(
2285
- (h) => a ? h.iiif.entities.Annotation[a] : void 0,
2313
+ (p) => a ? p.iiif.entities.Annotation[a] : void 0,
2286
2314
  [a]
2287
2315
  ), u = Y(
2288
- (h) => o && o.body ? o.body.map((l) => l ? l.type === "SpecificResource" ? {
2316
+ (p) => o && o.body ? o.body.map((l) => l ? l.type === "SpecificResource" ? {
2289
2317
  ...l,
2290
2318
  source: s.get(l)
2291
- } : l ? h.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
2319
+ } : l ? p.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
2292
2320
  [o]
2293
2321
  );
2294
2322
  return j(() => {
2295
2323
  if (!o)
2296
2324
  return;
2297
- const h = {
2325
+ const p = {
2298
2326
  ...o,
2299
2327
  body: u,
2300
2328
  target: Ce(o.target, { typeMap: s.getState().iiif.mapping })
2301
2329
  };
2302
- return i ? i(h) : h;
2330
+ return i ? i(p) : p;
2303
2331
  }, [o, i, u, ...e]);
2304
2332
  }
2305
2333
  const Zr = ({
@@ -2308,14 +2336,14 @@ const Zr = ({
2308
2336
  className: r,
2309
2337
  interactive: i
2310
2338
  }) => {
2311
- const n = Kr({ id: t }), s = Xe(n, "atlas"), a = Xe(n, "html"), o = zr(n, ["atlas"]), u = me(), h = j(() => Xi(e, s), [e, s]);
2339
+ const n = Kr({ id: t }), s = Xe(n, "atlas"), a = Xe(n, "html"), o = zr(n, ["atlas"]), u = me(), p = j(() => Xi(e, s), [e, s]);
2312
2340
  return u && n && n.target && n.target.selector && n.target.selector.type === "BoxSelector" && n.target.source && (n.target.source.id === u.id || n.target.source === u.id) ? /* @__PURE__ */ x(
2313
2341
  en,
2314
2342
  {
2315
2343
  id: n.id,
2316
2344
  isEditing: !0,
2317
2345
  region: n.target.selector.spatial,
2318
- style: h,
2346
+ style: p,
2319
2347
  className: (a == null ? void 0 : a.className) || r,
2320
2348
  interactive: !!(a != null && a.href || i),
2321
2349
  href: (a == null ? void 0 : a.href) || null,
@@ -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
  {
@@ -2363,9 +2391,9 @@ function Xr({
2363
2391
  children: a,
2364
2392
  selector: o,
2365
2393
  onClick: u,
2366
- enableSizes: h
2394
+ enableSizes: p
2367
2395
  }) {
2368
- var p, v;
2396
+ var h, v;
2369
2397
  const l = j(() => {
2370
2398
  if (!(!o || o.spatial.x === 0 && o.spatial.y === 0))
2371
2399
  return o.spatial;
@@ -2389,10 +2417,10 @@ function Xr({
2389
2417
  imageService: e.service,
2390
2418
  thumbnail: r && r.type === "fixed" ? r : void 0
2391
2419
  },
2392
- enableSizes: h,
2420
+ enableSizes: p,
2393
2421
  x: 0,
2394
2422
  y: 0,
2395
- width: (p = e.target) == null ? void 0 : p.spatial.width,
2423
+ width: (h = e.target) == null ? void 0 : h.spatial.width,
2396
2424
  height: (v = e.target) == null ? void 0 : v.spatial.height,
2397
2425
  crop: l
2398
2426
  }
@@ -2418,14 +2446,14 @@ 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 {
2425
2453
  for (var o = e[Symbol.iterator](), u; !(n = (u = o.next()).done) && (i.push(u.value), !(r && i.length === r)); n = !0)
2426
2454
  ;
2427
- } catch (h) {
2428
- s = !0, a = h;
2455
+ } catch (p) {
2456
+ s = !0, a = p;
2429
2457
  } finally {
2430
2458
  try {
2431
2459
  !n && o.return && o.return();
@@ -2446,12 +2474,12 @@ var ba = Object.defineProperty, Aa = (t, e, r) => e in t ? ba(t, e, { enumerable
2446
2474
  }(), De = Math.PI * 2, yt = function(t, e, r, i, n, s, a) {
2447
2475
  var o = t.x, u = t.y;
2448
2476
  o *= e, u *= r;
2449
- var h = i * o - n * u, l = n * o + i * u;
2477
+ var p = i * o - n * u, l = n * o + i * u;
2450
2478
  return {
2451
- x: h + s,
2479
+ x: p + 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,16 +2491,16 @@ 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) {
2470
- 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;
2497
+ }, Ma = function(t, e, r, i, n, s, a, o, u, p, l, h) {
2498
+ var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(h, 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 * h, w = A * -s / n * l, R = p * b - u * w + (t + r) / 2, O = u * b + p * w + (e + i) / 2, F = (l - b) / n, T = (h - w) / s, P = (-l - b) / n, E = (-h - 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) {
2475
- 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 = [];
2502
+ }, Ca = function(t) {
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, p = t.largeArcFlag, l = p === void 0 ? 0 : p, h = t.sweepFlag, v = h === void 0 ? 0 : h, m = [];
2476
2504
  if (s === 0 || a === 0)
2477
2505
  return [];
2478
2506
  var d = Math.sin(u * De / 360), g = Math.cos(u * De / 360), A = g * (e - i) / 2 + d * (r - n) / 2, b = -d * (e - i) / 2 + g * (r - n) / 2;
@@ -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,10 +2583,10 @@ 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);
2561
- let i, n = 0, s = 0, a = 0, o = 0, u, h, l = 0, p = 0;
2586
+ const ja = /* @__PURE__ */ ei(La);
2587
+ function $a(t) {
2588
+ const e = Pa(t), r = ja(e);
2589
+ let i, n = 0, s = 0, a = 0, o = 0, u, p, l = 0, h = 0;
2562
2590
  const v = [];
2563
2591
  for (let m = 0; m < r.length; m++) {
2564
2592
  let d = r[m];
@@ -2575,21 +2603,21 @@ function ja(t) {
2575
2603
  break;
2576
2604
  case "S":
2577
2605
  {
2578
- let A = l, b = p;
2606
+ let A = l, b = h;
2579
2607
  (i === "C" || i == "S") && (A += A - a, b += b - o), d = ["C", A, b, d[1], d[2], d[3], d[4]];
2580
2608
  }
2581
2609
  break;
2582
2610
  case "T":
2583
- i === "Q" || i == "T" ? (u = l * 2 - u, h = p * 2 - h) : (u = l, h = p), d = ["Q", u, h, d[1], d[2]];
2611
+ i === "Q" || i == "T" ? (u = l * 2 - u, p = h * 2 - p) : (u = l, p = h), d = ["Q", u, p, d[1], d[2]];
2584
2612
  break;
2585
2613
  case "Q":
2586
- u = d[1], h = d[2];
2614
+ u = d[1], p = d[2];
2587
2615
  break;
2588
2616
  case "A":
2589
2617
  {
2590
- const A = Ma({
2618
+ const A = Ca({
2591
2619
  px: l,
2592
- py: p,
2620
+ py: h,
2593
2621
  cx: d[6],
2594
2622
  cy: d[7],
2595
2623
  rx: d[1],
@@ -2609,7 +2637,7 @@ function ja(t) {
2609
2637
  d = ["L", n, s];
2610
2638
  break;
2611
2639
  }
2612
- i = g, l = d[d.length - 2], p = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = p), v.push(d);
2640
+ i = g, l = d[d.length - 2], h = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = h), v.push(d);
2613
2641
  }
2614
2642
  return v;
2615
2643
  }
@@ -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) {
@@ -2673,19 +2701,19 @@ class ti {
2673
2701
  };
2674
2702
  }
2675
2703
  mapToBasic() {
2676
- const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, h = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, p = (s - e) * u - (a - r) * o, v = h / p, m = l / p, d = Math.abs(p) / (Math.hypot(o, u) * Math.abs(m - v));
2677
- return { x0: e, x2: s, scale: d, cross: p };
2704
+ const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, p = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, h = (s - e) * u - (a - r) * o, v = p / h, m = l / h, d = Math.abs(h) / (Math.hypot(o, u) * Math.abs(m - v));
2705
+ return { x0: e, x2: s, scale: d, cross: h };
2678
2706
  }
2679
2707
  subdivide(e) {
2680
- const r = this.mapToBasic(), i = qe(r.x0), n = qe(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = ke(i), u = ke(n), h = [0];
2708
+ const r = this.mapToBasic(), i = qe(r.x0), n = qe(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = ke(i), u = ke(n), p = [0];
2681
2709
  for (let l = 1; l < a; l++) {
2682
- const p = (ke(i + (n - i) * l / a) - o) / (u - o);
2683
- h.push(p);
2710
+ const h = (ke(i + (n - i) * l / a) - o) / (u - o);
2711
+ p.push(h);
2684
2712
  }
2685
- return h.push(1), h.map((l) => this.eval(l));
2713
+ return p.push(1), p.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);
@@ -2733,19 +2761,19 @@ class jt {
2733
2761
  val: T
2734
2762
  }), u += T;
2735
2763
  }
2736
- const h = 0.5 * u / n, l = Math.ceil(h), p = [{ x: this.c[0], y: this.c[1] }];
2764
+ const p = 0.5 * u / n, l = Math.ceil(p), h = [{ x: this.c[0], y: this.c[1] }];
2737
2765
  let v = 0, m = 0;
2738
2766
  for (let d = 1; d < l; d++) {
2739
2767
  const g = u * d / l;
2740
2768
  for (; v + o[m].val < g; )
2741
2769
  v += o[m].val, m++;
2742
2770
  const A = o[m].a0, b = o[m].a2, w = ke(A), R = ke(b), O = A + (b - A) * (g - v) / o[m].val, F = (ke(O) - w) / (R - w);
2743
- p.push(o[m].quad.eval(F));
2771
+ h.push(o[m].quad.eval(F));
2744
2772
  }
2745
- return p.push({ x: this.c[6], y: this.c[7] }), p;
2773
+ return h.push({ x: this.c[6], y: this.c[7] }), h;
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",
@@ -2867,8 +2895,8 @@ function Ge(t, {
2867
2895
  selectors: [],
2868
2896
  iiifRenderingHints: i
2869
2897
  });
2870
- const p = ri(l);
2871
- p && (n = p.points, u = p.shapeType, s = [
2898
+ const h = ri(l);
2899
+ h && (n = h.points, u = h.shapeType, s = [
2872
2900
  Math.min(...n.map((v) => v[0])),
2873
2901
  // llx
2874
2902
  Math.min(...n.map((v) => v[1])),
@@ -2877,9 +2905,9 @@ 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(h.element) ?? { svg: o });
2881
2909
  }
2882
- const h = {
2910
+ const p = {
2883
2911
  type: "SvgSelector",
2884
2912
  svg: o,
2885
2913
  svgShape: u,
@@ -2888,8 +2916,8 @@ function Ge(t, {
2888
2916
  spatial: s ? { unit: "pixel", x: s[0], y: s[1], width: s[2] - s[0], height: s[3] - s[1] } : void 0
2889
2917
  };
2890
2918
  return te({
2891
- selector: h,
2892
- selectors: [h],
2919
+ selector: p,
2920
+ selectors: [p],
2893
2921
  iiifRenderingHints: i
2894
2922
  });
2895
2923
  }
@@ -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");
@@ -2949,8 +2977,8 @@ function ri(t) {
2949
2977
  continue;
2950
2978
  const o = [];
2951
2979
  for (let u = 0; u <= 360; u += 12) {
2952
- const h = Math.tan(u / 360 * Math.PI), l = s * (1 - h ** 2) / (1 + h ** 2), p = a * 2 * h / (1 + h ** 2);
2953
- o.push([i + l, n + p]);
2980
+ const p = Math.tan(u / 360 * Math.PI), l = s * (1 - p ** 2) / (1 + p ** 2), h = a * 2 * p / (1 + p ** 2);
2981
+ o.push([i + l, n + h]);
2954
2982
  }
2955
2983
  return { element: r, points: o, shapeType: "ellipse" };
2956
2984
  }
@@ -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,13 +3925,13 @@ 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) {
3906
- 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"];
3933
+ })(Ra, function(s) {
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", p = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", l = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", h = "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, p, l, h, 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, p, "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", l, h, "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 = {}) {
3909
3937
  n(this, "traversals"), n(this, "options"), this.traversals = { collection: [], manifest: [], canvas: [], annotationList: [], sequence: [], annotation: [], contentResource: [], choice: [], range: [], service: [], layer: [], ...c }, this.options = { convertPropsToArray: !0, mergeMemberProperties: !0, allowUndefinedReturn: !1, ...y };
@@ -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,37 +4404,37 @@ 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"],
4394
- (p) => p && !p[t] ? p : {
4395
- ...p || {},
4422
+ (h) => h && !h[t] ? h : {
4423
+ ...h || {},
4396
4424
  [t]: !1
4397
4425
  }
4398
4426
  );
4399
4427
  },
4400
4428
  [t, r]
4401
- ), h = D(
4402
- (l, p = {}) => {
4429
+ ), p = D(
4430
+ (l, h = {}) => {
4403
4431
  if (!t)
4404
4432
  return;
4405
4433
  const v = r.getState(), m = [];
4406
- if (p != null && p.deselectOthers) {
4434
+ if (h != null && h.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
  }
@@ -4425,31 +4453,31 @@ function Do(t, e = {}) {
4425
4453
  return {
4426
4454
  availablePageIds: a,
4427
4455
  enabledPageIds: o,
4428
- setPageEnabled: h,
4456
+ setPageEnabled: p,
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;
4443
4471
  }, []), [D(
4444
4472
  (s, { height: a, width: o }) => {
4445
4473
  if (s) {
4446
- const u = s.id || s["@id"], h = t.loadServiceSync({
4474
+ const u = s.id || s["@id"], p = t.loadServiceSync({
4447
4475
  id: u,
4448
4476
  width: s.width || o,
4449
4477
  height: s.height || a,
4450
4478
  source: s
4451
4479
  });
4452
- h ? s = h : e[u] || (i.current || r((l) => ({
4480
+ p ? s = p : e[u] || (i.current || r((l) => ({
4453
4481
  ...l,
4454
4482
  [u]: "loading"
4455
4483
  })), t.loadService({
@@ -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)
@@ -4520,13 +4548,13 @@ function Ho(t = Ti) {
4520
4548
  function r(n, s = []) {
4521
4549
  const a = Array.isArray(n) ? n : e(n), o = [];
4522
4550
  let u = null;
4523
- const h = [];
4551
+ const p = [];
4524
4552
  for (const l of a) {
4525
4553
  if (l.type !== "Annotation")
4526
4554
  throw new Error("getPaintables() accept either a canvas or list of annotations");
4527
- const p = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
4528
- for (const v of p) {
4529
- const [m, { selector: d }] = No(v), g = t.get(m), A = (g.type || "unknown").toLowerCase();
4555
+ const h = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
4556
+ for (const v of h) {
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 = {
@@ -4537,10 +4565,10 @@ function Ho(t = Ti) {
4537
4565
  selected: w.indexOf(R) !== -1
4538
4566
  })),
4539
4567
  label: m.label
4540
- }, p.push(...w);
4568
+ }, h.push(...w);
4541
4569
  continue;
4542
4570
  }
4543
- o.indexOf(A) === -1 && o.push(A), h.push({
4571
+ o.indexOf(A) === -1 && o.push(A), p.push({
4544
4572
  type: A,
4545
4573
  annotationId: l.id,
4546
4574
  resource: g,
@@ -4551,7 +4579,7 @@ function Ho(t = Ti) {
4551
4579
  }
4552
4580
  return {
4553
4581
  types: o,
4554
- items: h,
4582
+ items: p,
4555
4583
  choice: u
4556
4584
  };
4557
4585
  }
@@ -4565,12 +4593,12 @@ 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
- ), h = { makeChoice: D(
4573
- (l, { deselectOthers: p = !0, deselect: v = !1 } = {}) => {
4600
+ ), p = { makeChoice: D(
4601
+ (l, { deselectOthers: h = !0, deselect: v = !1 } = {}) => {
4574
4602
  if (o.choice) {
4575
4603
  if (o.choice.type !== "single-choice")
4576
4604
  throw new Error("Complex choice not supported yet");
@@ -4583,7 +4611,7 @@ function Bo(t, e = []) {
4583
4611
  }
4584
4612
  return g;
4585
4613
  }
4586
- if (p)
4614
+ if (h)
4587
4615
  return [l];
4588
4616
  const d = [...m];
4589
4617
  if (d.length === 0 && o.items.length) {
@@ -4596,9 +4624,9 @@ function Bo(t, e = []) {
4596
4624
  },
4597
4625
  [o.choice]
4598
4626
  ) };
4599
- return [o, h];
4627
+ return [o, p];
4600
4628
  }
4601
- function zo(t, e, r) {
4629
+ function Wo(t, e, r) {
4602
4630
  const i = [];
4603
4631
  for (const n of e.items) {
4604
4632
  const s = n.resource && n.resource.type === "SpecificResource" ? n.resource.source : n.resource;
@@ -4617,8 +4645,8 @@ function zo(t, e, r) {
4617
4645
  width: Number(t.width),
4618
4646
  height: Number(t.height)
4619
4647
  }
4620
- }, [u, h] = Ci(t, n.target);
4621
- if (h.id !== t.id)
4648
+ }, [u, p] = Ci(t, n.target);
4649
+ if (p.id !== t.id)
4622
4650
  continue;
4623
4651
  n.resource.width && n.resource.height && (n.resource.width, n.resource.height);
4624
4652
  let l = n.resource.type === "SpecificResource" ? Ce(n.resource) : null;
@@ -4630,7 +4658,7 @@ function zo(t, e, r) {
4630
4658
  });
4631
4659
  m && (l = m);
4632
4660
  }
4633
- const p = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
4661
+ const h = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
4634
4662
  type: "BoxSelector",
4635
4663
  spatial: {
4636
4664
  x: l.selector.spatial.x,
@@ -4644,12 +4672,12 @@ function zo(t, e, r) {
4644
4672
  id: s.id,
4645
4673
  type: "Image",
4646
4674
  annotationId: n.annotationId,
4647
- width: Number(u || p ? s.width : t.width),
4648
- height: Number(u || p ? s.height : t.height),
4675
+ width: Number(u || h ? s.width : t.width),
4676
+ height: Number(u || h ? s.height : t.height),
4649
4677
  service: a,
4650
4678
  sizes: a && a.sizes ? a.sizes : s.width && s.height ? [{ width: s.width, height: s.height }] : [],
4651
4679
  target: u && u.type !== "PointSelector" ? u : o,
4652
- selector: p
4680
+ selector: h
4653
4681
  };
4654
4682
  i.push(v);
4655
4683
  }
@@ -4660,15 +4688,15 @@ function zo(t, e, r) {
4660
4688
  choice: e.choice
4661
4689
  };
4662
4690
  }
4663
- const Wo = ["model/gltf-binary"];
4664
- function Qo(t, e) {
4691
+ const Qo = ["model/gltf-binary"];
4692
+ function Yo(t, e) {
4665
4693
  const i = e.items[0].resource;
4666
- return i.format ? Wo.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4694
+ return i.format ? Qo.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4667
4695
  type: "3d-model",
4668
4696
  model: i
4669
4697
  } : _("Unknown format");
4670
4698
  }
4671
- function Yo(t, e) {
4699
+ function Go(t, e) {
4672
4700
  var i;
4673
4701
  if (!t.duration)
4674
4702
  return _("No duration on canvas");
@@ -4703,8 +4731,8 @@ function Yo(t, e) {
4703
4731
  }
4704
4732
  } : _("Audio does not have format") : _("Unknown audio");
4705
4733
  }
4706
- const Go = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4707
- function Jo(t, e) {
4734
+ const Jo = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4735
+ function Ko(t, e) {
4708
4736
  var a;
4709
4737
  const r = e.items.filter((o) => o.type === "video");
4710
4738
  if (!t.duration)
@@ -4742,7 +4770,7 @@ function Jo(t, e) {
4742
4770
  };
4743
4771
  if (n) {
4744
4772
  s.type = "VideoYouTube";
4745
- const o = i.id.match(Go);
4773
+ const o = i.id.match(Jo);
4746
4774
  if (!o[1])
4747
4775
  return _("Video is not known youtube video");
4748
4776
  s.youTubeId = o[1];
@@ -4769,7 +4797,7 @@ function Ii(t, e = {}, r) {
4769
4797
  }
4770
4798
  return e;
4771
4799
  }
4772
- function Ko(t, e) {
4800
+ function Zo(t, e) {
4773
4801
  const r = [];
4774
4802
  return e.items.forEach((i) => {
4775
4803
  if (i.resource) {
@@ -4781,37 +4809,37 @@ function Ko(t, e) {
4781
4809
  items: r
4782
4810
  };
4783
4811
  }
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(t) {
4813
+ 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
4814
  all: !1
4787
- }), o = qo(a, "AnnotationPage"), u = (t == null ? void 0 : t.strategies) || [
4815
+ }), o = _o(a, "AnnotationPage"), u = (t == null ? void 0 : t.strategies) || [
4788
4816
  "empty",
4789
4817
  "images",
4790
4818
  "media",
4791
4819
  "textual-content",
4792
4820
  "complex-timeline"
4793
- ], [h, l] = Bo(t, [s]), p = j(() => {
4821
+ ], [p, l] = zo(t, [s]), h = j(() => {
4794
4822
  if (!r)
4795
4823
  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");
4824
+ if (p.types.length === 0)
4825
+ return u.indexOf("empty") !== -1 ? Lo(r.width, r.height) : (console.log("No paintables"), gt);
4826
+ if (p.types.length !== 1)
4827
+ if (p.types.length === 2 && p.types.indexOf("text") !== -1)
4828
+ p.types = p.types.filter((m) => m !== "text");
4801
4829
  else
4802
4830
  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] : [
4831
+ const v = p.types[0];
4832
+ return v === "image" ? u.indexOf("images") === -1 ? _("Image not supported") : Wo(r, p, n) : v === "Model" || v === "model" ? u.indexOf("3d-model") === -1 ? _("3D not supported") : Yo(r, p) : v === "textualbody" ? u.indexOf("textual-content") === -1 ? _("Textual content not supported") : Zo(r, p) : v === "sound" || v === "audio" ? u.indexOf("media") === -1 ? _("Media not supported") : Go(r, p) : v === "video" ? u.indexOf("media") === -1 ? _("Media not supported") : Ko(r, p) : (console.log("No idea"), gt);
4833
+ }, [r, p, i, l.makeChoice]);
4834
+ return j(() => h.type === "unknown" ? [h, Po] : [
4807
4835
  {
4808
- ...p,
4836
+ ...h,
4809
4837
  annotations: { pages: o }
4810
4838
  },
4811
4839
  l
4812
- ], [p, o]);
4840
+ ], [h, o]);
4813
4841
  }
4814
- const Xo = (t, e = []) => {
4842
+ const ec = (t, e = []) => {
4815
4843
  const r = W();
4816
4844
  re(() => {
4817
4845
  t(r);
@@ -4835,52 +4863,52 @@ const Xo = (t, e = []) => {
4835
4863
  if (r)
4836
4864
  return e ? r[e] : r;
4837
4865
  }
4838
- }, ec = new pr();
4839
- function tc(t = ki, e = {}) {
4840
- const r = e.imageServiceLoader || ec;
4866
+ }, tc = new hr();
4867
+ function rc(t = ki, e = {}) {
4868
+ const r = e.imageServiceLoader || tc;
4841
4869
  async function i(n, s, a = !1, o = [], u) {
4842
- const h = () => r.getThumbnailFromResource(void 0, s, a, o);
4870
+ const p = () => r.getThumbnailFromResource(void 0, s, a, o);
4843
4871
  if (!n)
4844
4872
  return await r.getThumbnailFromResource(void 0, s, a, o);
4845
4873
  if (typeof n == "string") {
4846
- const p = Ht(n);
4847
- return p && o.push(p), await r.getThumbnailFromResource(void 0, s, a, o);
4874
+ const h = Bt(n);
4875
+ return h && o.push(h), await r.getThumbnailFromResource(void 0, s, a, o);
4848
4876
  }
4849
4877
  const l = t.get(n, { skipSelfReturn: !1 });
4850
4878
  if (typeof l == "string")
4851
- return { best: Ht(l), fallback: [], log: [] };
4879
+ return { best: Bt(l), fallback: [], log: [] };
4852
4880
  if (!l)
4853
- return await h();
4854
- switch (await (async (p) => {
4855
- if (p && p.thumbnail && p.thumbnail.length) {
4856
- const v = t.get(p.thumbnail[0]), m = await r.getImageCandidates(v, a);
4881
+ return await p();
4882
+ switch (await (async (h) => {
4883
+ if (h && h.thumbnail && h.thumbnail.length) {
4884
+ const v = t.get(h.thumbnail[0]), m = await r.getImageCandidates(v, a);
4857
4885
  m && m.length && o.push(...m);
4858
4886
  }
4859
4887
  })(l), l.type) {
4860
4888
  case "Annotation": {
4861
- const p = Array.isArray(l.body) ? l.body : [l.body], v = t.get(p[0]);
4889
+ const h = Array.isArray(l.body) ? l.body : [l.body], v = t.get(h[0]);
4862
4890
  return u && !v.width && (v.width = u.width, v.height = u.height), await r.getThumbnailFromResource(v, s, a, o);
4863
4891
  }
4864
4892
  case "Canvas": {
4865
- const p = l;
4866
- return i(p.items[0], s, a, o, {
4867
- width: p.width,
4868
- height: p.height
4893
+ const h = l;
4894
+ return i(h.items[0], s, a, o, {
4895
+ width: h.width,
4896
+ height: h.height
4869
4897
  });
4870
4898
  }
4871
4899
  case "AnnotationPage":
4872
4900
  return i(l.items[0], s, a, o, u);
4873
4901
  case "Choice": {
4874
- const p = l;
4875
- return !p.items || p.items[0] ? await h() : i(p.items[0], s, a, o, u);
4902
+ const h = l;
4903
+ return !h.items || h.items[0] ? await p() : i(h.items[0], s, a, o, u);
4876
4904
  }
4877
4905
  case "Collection": {
4878
- const p = l.items[0];
4879
- return p ? i(p, s, a, o, u) : await h();
4906
+ const h = l.items[0];
4907
+ return h ? i(h, s, a, o, u) : await p();
4880
4908
  }
4881
4909
  case "Manifest": {
4882
- const p = l.items[0];
4883
- return p ? i(p, s, a, o, u) : await h();
4910
+ const h = l.items[0];
4911
+ return h ? i(h, s, a, o, u) : await p();
4884
4912
  }
4885
4913
  case "SpecificResource":
4886
4914
  case "Image":
@@ -4891,31 +4919,31 @@ function tc(t = ki, e = {}) {
4891
4919
  case "Video":
4892
4920
  return u && !l.width && (l.width = u.width, l.height = u.height), r.getThumbnailFromResource(l, s, a, o);
4893
4921
  }
4894
- return await h();
4922
+ return await p();
4895
4923
  }
4896
4924
  return {
4897
4925
  getBestThumbnailAtSize: i
4898
4926
  };
4899
4927
  }
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);
4928
+ function ic(t, e, { canvasId: r, manifestId: i } = {}) {
4929
+ const n = W(), s = Ri(), a = j(() => rc(n, { imageServiceLoader: s }), [n, s]), [o, u] = J(), p = Pe(i ? { id: i } : void 0), l = me(r ? { id: r } : void 0), h = l || p, v = ve(!1);
4902
4930
  if (re(() => (v.current = !1, () => {
4903
4931
  v.current = !0;
4904
- }), []), !p)
4932
+ }), []), !h)
4905
4933
  throw new Error("Must be called under a manifest or canvas context.");
4906
- return Xo(
4934
+ return ec(
4907
4935
  (m) => {
4908
- a.getBestThumbnailAtSize(p, t, e).then((d) => {
4936
+ a.getBestThumbnailAtSize(h, t, e).then((d) => {
4909
4937
  d.best && !v.current && u(d.best);
4910
4938
  });
4911
4939
  },
4912
- [p]
4940
+ [h]
4913
4941
  ), o;
4914
4942
  }
4915
- function ic(t) {
4943
+ function nc(t) {
4916
4944
  return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: t };
4917
4945
  }
4918
- function nc(t, e) {
4946
+ function sc(t, e) {
4919
4947
  switch (e.type) {
4920
4948
  case "FINISHED":
4921
4949
  return { ...t, isFinished: !0, isPlaying: !1, playRequested: !1 };
@@ -4938,22 +4966,22 @@ function nc(t, e) {
4938
4966
  }
4939
4967
  return t;
4940
4968
  }
4941
- function sc(t) {
4969
+ function ac(t) {
4942
4970
  const e = Math.round(t);
4943
4971
  return `${Math.floor(e / 60)}:${`${e % 60}`.padStart(2, "0")}`;
4944
4972
  }
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" })));
4973
+ function _t(t) {
4974
+ const [e, r] = Gi(sc, nc(t.duration)), i = ve(null), n = ve(null), s = ve(null), a = ve(!1), o = D(() => {
4975
+ n.current && i.current && (n.current.innerHTML = ac(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
4976
  }, [t.duration]), u = D(() => {
4949
4977
  i.current && (r({ type: "PLAY_REQUESTED" }), i.current.play().then(() => {
4950
4978
  r({ type: "PLAY" });
4951
4979
  }), o());
4952
- }, [o]), h = D(() => {
4980
+ }, [o]), p = D(() => {
4953
4981
  i.current && (i.current.duration > 0 && i.current.paused ? u() : l());
4954
4982
  }, [o]), l = D(() => {
4955
4983
  i.current && (i.current.pause(), r({ type: "PAUSE" }), o());
4956
- }, [o]), p = D(() => {
4984
+ }, [o]), h = D(() => {
4957
4985
  i.current && (i.current.muted = !i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
4958
4986
  }, []), v = D(() => {
4959
4987
  i.current && (i.current.muted = !0, r({ type: "MUTE" }));
@@ -4982,17 +5010,17 @@ function qt(t) {
4982
5010
  {
4983
5011
  play: u,
4984
5012
  pause: l,
4985
- playPause: h,
5013
+ playPause: p,
4986
5014
  mute: v,
4987
5015
  unmute: m,
4988
- toggleMute: p,
5016
+ toggleMute: h,
4989
5017
  setVolume: d,
4990
5018
  setDurationPercent: g,
4991
5019
  setTime: A
4992
5020
  }
4993
5021
  ];
4994
5022
  }
4995
- const ac = ce(null), oc = ce(null), cc = ce(null);
5023
+ const oc = ce(null), cc = ce(null), uc = ce(null);
4996
5024
  function Oi({
4997
5025
  actions: t,
4998
5026
  state: e,
@@ -5001,10 +5029,10 @@ function Oi({
5001
5029
  progress: n,
5002
5030
  element: s
5003
5031
  }) {
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 }) }) });
5032
+ return /* @__PURE__ */ x(uc.Provider, { value: { currentTime: i, progress: n, element: s }, children: /* @__PURE__ */ x(cc.Provider, { value: t, children: /* @__PURE__ */ x(oc.Provider, { value: e, children: r }) }) });
5005
5033
  }
5006
5034
  function Ei({ media: t, children: e }) {
5007
- const [{ element: r, currentTime: i, progress: n }, s, a] = qt({ duration: t.duration });
5035
+ const [{ element: r, currentTime: i, progress: n }, s, a] = _t({ duration: t.duration });
5008
5036
  return /* @__PURE__ */ V(
5009
5037
  Oi,
5010
5038
  {
@@ -5055,7 +5083,7 @@ function Fi({
5055
5083
  mediaControlsDeps: e,
5056
5084
  children: r
5057
5085
  }) {
5058
- const [{ element: i, currentTime: n, progress: s }, a, o] = qt({ duration: t.duration });
5086
+ const [{ element: i, currentTime: n, progress: s }, a, o] = _t({ duration: t.duration });
5059
5087
  return Oe("overlay", "video-element", Li, {
5060
5088
  element: i,
5061
5089
  media: t,
@@ -5117,18 +5145,18 @@ function Di({ style: t }) {
5117
5145
  }
5118
5146
  );
5119
5147
  }
5120
- const uc = ge.createContext("en");
5148
+ const lc = ge.createContext("en");
5121
5149
  function qi() {
5122
- return ge.useContext(uc);
5150
+ return ge.useContext(lc);
5123
5151
  }
5124
- function cr(t) {
5152
+ function ur(t) {
5125
5153
  return t.indexOf("-") !== -1 ? t.slice(0, t.indexOf("-")) : t;
5126
5154
  }
5127
- function lc({ as: t, language: e, children: r, viewingDirection: i, ...n }) {
5155
+ function fc({ as: t, language: e, children: r, viewingDirection: i, ...n }) {
5128
5156
  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 });
5157
+ 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
5158
  }
5131
- function fc(t, e, r) {
5159
+ function pc(t, e, r) {
5132
5160
  if (e.length === 0)
5133
5161
  return;
5134
5162
  if (e.length === 1)
@@ -5143,15 +5171,15 @@ function fc(t, e, r) {
5143
5171
  return n;
5144
5172
  return e.indexOf("none") !== -1 ? "none" : e.indexOf("@none") !== -1 ? "@none" : e[0];
5145
5173
  }
5146
- const pc = (t, e = []) => {
5174
+ const hc = (t, e = []) => {
5147
5175
  const r = qi();
5148
5176
  return j(() => {
5149
5177
  const i = t();
5150
- return fc(r, i, []);
5178
+ return pc(r, i, []);
5151
5179
  }, [r, ...e]);
5152
5180
  };
5153
- function hc(t, e) {
5154
- const r = pc(() => Object.keys(t || {}), [t]);
5181
+ function dc(t, e) {
5182
+ const r = hc(() => Object.keys(t || {}), [t]);
5155
5183
  return [
5156
5184
  j(() => {
5157
5185
  if (!t)
@@ -5165,10 +5193,10 @@ function hc(t, e) {
5165
5193
  r
5166
5194
  ];
5167
5195
  }
5168
- const dc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5169
- const [s, a] = hc(i, e);
5196
+ const yc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5197
+ const [s, a] = dc(i, e);
5170
5198
  return a ? /* @__PURE__ */ x(
5171
- lc,
5199
+ fc,
5172
5200
  {
5173
5201
  ...n,
5174
5202
  as: t,
@@ -5191,7 +5219,7 @@ const dc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children:
5191
5219
  }
5192
5220
  );
5193
5221
  };
5194
- function yc({
5222
+ function vc({
5195
5223
  element: t,
5196
5224
  media: e,
5197
5225
  playPause: r
@@ -5229,13 +5257,13 @@ function yc({
5229
5257
  )
5230
5258
  ] }) : null;
5231
5259
  }
5232
- function vc({
5260
+ function gc({
5233
5261
  media: t,
5234
5262
  mediaControlsDeps: e,
5235
5263
  children: r
5236
5264
  }) {
5237
- const [{ element: i, currentTime: n, progress: s }, a, o] = qt({ duration: t.duration });
5238
- return Oe("overlay", "video-element", yc, {
5265
+ const [{ element: i, currentTime: n, progress: s }, a, o] = _t({ duration: t.duration });
5266
+ return Oe("overlay", "video-element", vc, {
5239
5267
  element: i,
5240
5268
  media: t,
5241
5269
  playPause: o.playPause
@@ -5251,9 +5279,9 @@ function _i({
5251
5279
  renderViewerControls: a,
5252
5280
  renderMediaControls: o,
5253
5281
  viewControlsDeps: u,
5254
- mediaControlsDeps: h,
5282
+ mediaControlsDeps: p,
5255
5283
  strategies: l,
5256
- throwOnUnknown: p,
5284
+ throwOnUnknown: h,
5257
5285
  backgroundStyle: v,
5258
5286
  alwaysShowBackground: m,
5259
5287
  keepCanvasScale: d = !1,
@@ -5262,7 +5290,7 @@ function _i({
5262
5290
  onClickPaintingAnnotation: b,
5263
5291
  children: w
5264
5292
  }) {
5265
- const R = me(), O = zr(R, ["deep-zoom"]), [F] = _s(), T = Ns(), P = W(), E = j(() => Qr(P), [P]), [M, $] = Zo({
5293
+ const R = me(), O = zr(R, ["deep-zoom"]), [F] = Us(), T = Hs(), P = W(), E = j(() => Qr(P), [P]), [M, $] = Xo({
5266
5294
  strategies: l || ["images"],
5267
5295
  defaultChoices: n == null ? void 0 : n.map(({ id: k }) => k)
5268
5296
  }), ie = M.type === "images" ? M.choice : void 0, K = j(() => d ? 1 : Math.max(
@@ -5272,7 +5300,7 @@ function _i({
5272
5300
  return (k.width || 0) / ((H = k.target) == null ? void 0 : H.spatial.width);
5273
5301
  }) : []
5274
5302
  ), [d, M]);
5275
- Hs(K), re(() => {
5303
+ Bs(K), re(() => {
5276
5304
  i && i($);
5277
5305
  }, [M.annotations]), re(() => {
5278
5306
  if (n)
@@ -5280,19 +5308,19 @@ function _i({
5280
5308
  typeof k.opacity < "u" && E.applyStyles({ id: k.id }, "atlas", {
5281
5309
  opacity: k.opacity
5282
5310
  });
5283
- }, [n]), ur(() => {
5311
+ }, [n]), lr(() => {
5284
5312
  r && r(ie);
5285
5313
  }, [ie]), Oe(
5286
5314
  T && (M.type === "images" || M.type === "empty" || M.type === "textual-content" && a) ? "overlay" : "none",
5287
5315
  `canvas-portal-controls-${R == null ? void 0 : R.id}`,
5288
- Lt.Provider,
5316
+ Ft.Provider,
5289
5317
  a ? {
5290
5318
  value: T || null,
5291
5319
  children: a(M)
5292
5320
  } : {},
5293
5321
  [R, T, M, ...u || []]
5294
5322
  );
5295
- const U = rc({ maxWidth: 256, maxHeight: 256 });
5323
+ const U = ic({ maxWidth: 256, maxHeight: 256 });
5296
5324
  if (!R)
5297
5325
  return null;
5298
5326
  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(
@@ -5310,13 +5338,13 @@ function _i({
5310
5338
  if (M.type === "unknown") {
5311
5339
  if (X)
5312
5340
  return X;
5313
- if (p)
5341
+ if (h)
5314
5342
  throw new Error(M.reason || "Unknown image strategy");
5315
5343
  return null;
5316
5344
  }
5317
5345
  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,
5346
+ F ? /* @__PURE__ */ x(Tt, { page: F }) : null,
5347
+ M.annotations && M.annotations.pages ? M.annotations.pages.map((k) => /* @__PURE__ */ x(Tt, { page: k }, k.id)) : null,
5320
5348
  w
5321
5349
  ] }), Ae = M.type === "images" ? M.images.length : 0;
5322
5350
  return /* @__PURE__ */ V(Me, { children: [
@@ -5340,7 +5368,7 @@ function _i({
5340
5368
  pe.stopPropagation(), b(k.annotationId, k, pe);
5341
5369
  } : void 0,
5342
5370
  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 }) })
5371
+ children: /* @__PURE__ */ x("div", { "data-textual-content": !0, children: /* @__PURE__ */ x(yc, { enableDangerouslySetInnerHTML: !0, children: k.text }) })
5344
5372
  },
5345
5373
  H
5346
5374
  ),
@@ -5366,13 +5394,13 @@ function _i({
5366
5394
  ne
5367
5395
  ] }) : null,
5368
5396
  M.type === "3d-model" ? /* @__PURE__ */ x($i, { model: M.model }) : null,
5369
- M.type === "media" ? /* @__PURE__ */ x(Me, { children: M.media.type === "Sound" ? /* @__PURE__ */ V(Pi, { media: M.media, mediaControlsDeps: h, children: [
5397
+ M.type === "media" ? /* @__PURE__ */ x(Me, { children: M.media.type === "Sound" ? /* @__PURE__ */ V(Pi, { media: M.media, mediaControlsDeps: p, children: [
5370
5398
  X,
5371
5399
  o ? o(M) : null
5372
- ] }) : M.media.type === "Video" ? /* @__PURE__ */ V(Fi, { media: M.media, mediaControlsDeps: h, children: [
5400
+ ] }) : M.media.type === "Video" ? /* @__PURE__ */ V(Fi, { media: M.media, mediaControlsDeps: p, children: [
5373
5401
  X,
5374
5402
  o ? o(M) : null
5375
- ] }) : M.media.type === "VideoYouTube" && A ? /* @__PURE__ */ V(vc, { media: M.media, mediaControlsDeps: h, children: [
5403
+ ] }) : M.media.type === "VideoYouTube" && A ? /* @__PURE__ */ V(gc, { media: M.media, mediaControlsDeps: p, children: [
5376
5404
  X,
5377
5405
  o ? o(M) : null
5378
5406
  ] }) : null }) : null
@@ -5380,15 +5408,15 @@ function _i({
5380
5408
  },
5381
5409
  `${R.id}/${M.type}/${Ae}`
5382
5410
  ),
5383
- M.type === "media" && M.media.type === "Sound" && N ? /* @__PURE__ */ x(Pt, { canvas: N.id, children: /* @__PURE__ */ x(_i, { renderViewerControls: a }) }) : null
5411
+ M.type === "media" && M.media.type === "Sound" && N ? /* @__PURE__ */ x(Lt, { canvas: N.id, children: /* @__PURE__ */ x(_i, { renderViewerControls: a }) }) : null
5384
5412
  ] });
5385
5413
  }
5386
- function gc() {
5414
+ function mc() {
5387
5415
  const t = Q(tt);
5388
5416
  return t && t.vault ? t.vault : $r();
5389
5417
  }
5390
- const mc = lr(function(e, r) {
5391
- const i = Pe(), n = qr(), s = ds(), { ViewerControls: a, MediaControls: o } = e.components || {};
5418
+ const bc = fr(function(e, r) {
5419
+ const i = Pe(), n = qr(), s = ys(), { ViewerControls: a, MediaControls: o } = e.components || {};
5392
5420
  if (Ji(r, () => s, [s]), !i)
5393
5421
  return /* @__PURE__ */ x("div", {});
5394
5422
  let u = 0;
@@ -5399,30 +5427,30 @@ const mc = lr(function(e, r) {
5399
5427
  {
5400
5428
  height: e.height,
5401
5429
  mode: e.mode,
5402
- children: n.map((h, l) => {
5403
- const p = u;
5404
- return u += h.width + (e.spacing || 0), /* @__PURE__ */ x(Pt, { canvas: h.id, children: /* @__PURE__ */ x(
5430
+ children: n.map((p, l) => {
5431
+ const h = u;
5432
+ return u += p.width + (e.spacing || 0), /* @__PURE__ */ x(Lt, { canvas: p.id, children: /* @__PURE__ */ x(
5405
5433
  G.RenderCanvas,
5406
5434
  {
5407
5435
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
5408
5436
  renderViewerControls: l === 0 && a ? () => /* @__PURE__ */ x(a, {}) : void 0,
5409
5437
  renderMediaControls: l === 0 && o ? () => /* @__PURE__ */ x(o, {}) : void 0,
5410
- x: p,
5438
+ x: h,
5411
5439
  ...e.canvasProps || {},
5412
5440
  children: e.annotations
5413
5441
  },
5414
- h.id
5415
- ) }, h.id);
5442
+ p.id
5443
+ ) }, p.id);
5416
5444
  })
5417
5445
  },
5418
5446
  e.reuseAtlas ? "" : s.currentSequenceIndex
5419
5447
  ),
5420
5448
  e.children
5421
5449
  ] });
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,
5450
+ }), G = fr(function({ children: e, height: r, annotations: i, canvasProps: n, spacing: s, header: a, components: o, mode: u, ...p }, l) {
5451
+ const h = mc();
5452
+ return /* @__PURE__ */ x(Dr, { vault: h, children: /* @__PURE__ */ x(ds, { ...p, children: /* @__PURE__ */ x(
5453
+ bc,
5426
5454
  {
5427
5455
  ref: l,
5428
5456
  height: r,
@@ -5438,9 +5466,9 @@ const mc = lr(function(e, r) {
5438
5466
  });
5439
5467
  G.RenderImage = Xr;
5440
5468
  G.RenderCanvas = _i;
5441
- G.RenderAnnotationPage = Rt;
5469
+ G.RenderAnnotationPage = Tt;
5442
5470
  G.RenderAnnotation = Zr;
5443
- G.Viewer = Bs;
5471
+ G.Viewer = zs;
5444
5472
  G.CanvasBackground = Di;
5445
5473
  G.Audio = Pi;
5446
5474
  G.Video = Fi;