react-iiif-vault 1.0.6 → 1.0.8

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,6 +1,6 @@
1
- import { jsx as c, jsxs as A, Fragment as H } from "react/jsx-runtime";
1
+ import { jsx as l, jsxs as A, Fragment as H } from "react/jsx-runtime";
2
2
  import * as se from "react";
3
- import q, { useContext as R, useMemo as y, useState as L, useEffect as N, useCallback as P, createContext as _, useRef as j, useLayoutEffect as Ce, Fragment as te, useReducer as rt, forwardRef as Ae, useImperativeHandle as it } from "react";
3
+ import q, { useContext as R, useMemo as y, useState as L, useEffect as N, useCallback as P, createContext as U, useRef as j, useLayoutEffect as Ce, Fragment as te, useReducer as rt, forwardRef as Ae, useImperativeHandle as it } from "react";
4
4
  import { AtlasAuto as ot, ModeContext as at, mergeStyles as st, RegionHighlight as ut, TileSet as ct, HTMLPortal as lt } from "@atlas-viewer/atlas";
5
5
  import { globalVault as Ie, Vault as Se } from "@iiif/helpers/vault";
6
6
  import { createStylesHelper as Me } from "@iiif/helpers/styles";
@@ -28,8 +28,8 @@ var pt = function(t, n) {
28
28
  for (var r, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
29
29
  o[a] = arguments[a];
30
30
  return r = e.call.apply(e, [this].concat(o)) || this, r.state = Pe, r.resetErrorBoundary = function() {
31
- for (var s, l = arguments.length, d = new Array(l), u = 0; u < l; u++)
32
- d[u] = arguments[u];
31
+ for (var s, u = arguments.length, d = new Array(u), c = 0; c < u; c++)
32
+ d[c] = arguments[c];
33
33
  r.props.onReset == null || (s = r.props).onReset.apply(s, d), r.reset();
34
34
  }, r;
35
35
  }
@@ -47,18 +47,18 @@ var pt = function(t, n) {
47
47
  }, n.componentDidUpdate = function(i, o) {
48
48
  var a = this.state.error, s = this.props.resetKeys;
49
49
  if (a !== null && o.error !== null && pt(i.resetKeys, s)) {
50
- var l, d;
51
- (l = (d = this.props).onResetKeysChange) == null || l.call(d, i.resetKeys, s), this.reset();
50
+ var u, d;
51
+ (u = (d = this.props).onResetKeysChange) == null || u.call(d, i.resetKeys, s), this.reset();
52
52
  }
53
53
  }, n.render = function() {
54
- var i = this.state.error, o = this.props, a = o.fallbackRender, s = o.FallbackComponent, l = o.fallback;
54
+ var i = this.state.error, o = this.props, a = o.fallbackRender, s = o.FallbackComponent, u = o.fallback;
55
55
  if (i !== null) {
56
56
  var d = {
57
57
  error: i,
58
58
  resetErrorBoundary: this.resetErrorBoundary
59
59
  };
60
- if (/* @__PURE__ */ se.isValidElement(l))
61
- return l;
60
+ if (/* @__PURE__ */ se.isValidElement(u))
61
+ return u;
62
62
  if (typeof a == "function")
63
63
  return a(d);
64
64
  if (s)
@@ -81,7 +81,7 @@ function re({ value: e, children: t }) {
81
81
  ...n,
82
82
  ...e
83
83
  }), [e, n]);
84
- return /* @__PURE__ */ c(he.Provider, { value: r, children: t });
84
+ return /* @__PURE__ */ l(he.Provider, { value: r, children: t });
85
85
  }
86
86
  const ie = q.createContext({
87
87
  vault: null,
@@ -96,7 +96,7 @@ function Te({
96
96
  children: i
97
97
  }) {
98
98
  const [o, a] = L(() => e || (n ? Ie(t) : t ? new Se(t) : new Se()));
99
- return /* @__PURE__ */ c(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ c(re, { value: r || {}, children: i }) });
99
+ return /* @__PURE__ */ l(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ l(re, { value: r || {}, children: i }) });
100
100
  }
101
101
  const T = () => {
102
102
  const { vault: e } = R(ie);
@@ -105,12 +105,12 @@ const T = () => {
105
105
  return e;
106
106
  };
107
107
  function xt(e, { noCache: t = !1 } = {}) {
108
- const n = typeof e == "string" ? e : e.id, r = T(), [i, o] = L(n), [a, s] = L(void 0), l = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, u] = L(l);
108
+ const n = typeof e == "string" ? e : e.id, r = T(), [i, o] = L(n), [a, s] = L(void 0), u = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, c] = L(u);
109
109
  return N(() => {
110
110
  (async () => {
111
111
  try {
112
- const f = l && !t ? l : await r.load(n), p = f ? f.id || f["@id"] : null;
113
- f && i !== p && o(p), u(f);
112
+ const f = u && !t ? u : await r.load(n), p = f ? f.id || f["@id"] : null;
113
+ f && i !== p && o(p), c(f);
114
114
  } catch (f) {
115
115
  s(f);
116
116
  }
@@ -121,7 +121,7 @@ function xt(e, { noCache: t = !1 } = {}) {
121
121
  requestId: n,
122
122
  error: a,
123
123
  resource: d,
124
- cached: !!(d && d === l)
124
+ cached: !!(d && d === u)
125
125
  };
126
126
  }
127
127
  function wt(e, t) {
@@ -132,10 +132,10 @@ function wt(e, t) {
132
132
  return { id: n, isLoaded: r, error: i, manifest: o, requestId: a, cached: s };
133
133
  }
134
134
  function St({ manifest: e, children: t }) {
135
- return /* @__PURE__ */ c(re, { value: { manifest: e }, children: t });
135
+ return /* @__PURE__ */ l(re, { value: { manifest: e }, children: t });
136
136
  }
137
137
  function ge({ canvas: e, children: t }) {
138
- return /* @__PURE__ */ c(re, { value: { canvas: e }, children: t });
138
+ return /* @__PURE__ */ l(re, { value: { canvas: e }, children: t });
139
139
  }
140
140
  function V(e, t = []) {
141
141
  const n = T(), [r, i] = L(() => e(n.getState(), n));
@@ -168,7 +168,7 @@ function K(e = {}, t = []) {
168
168
  }, [a, r, ...t]);
169
169
  }
170
170
  function Pt({ range: e, children: t }) {
171
- return /* @__PURE__ */ c(re, { value: { range: e }, children: t });
171
+ return /* @__PURE__ */ l(re, { value: { range: e }, children: t });
172
172
  }
173
173
  function Ve(e, t) {
174
174
  var r;
@@ -181,34 +181,34 @@ function Ve(e, t) {
181
181
  return n;
182
182
  }
183
183
  function bt(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
184
- const i = t.behavior, o = i.includes("paged"), a = o ? !1 : i.includes("continuous"), s = o || a ? !1 : i.includes("individuals"), l = t.type === "Manifest" ? t.items : Ve(e, t);
184
+ const i = t.behavior, o = i.includes("paged"), a = o ? !1 : i.includes("continuous"), s = o || a ? !1 : i.includes("individuals"), u = t.type === "Manifest" ? t.items : Ve(e, t);
185
185
  if (a)
186
- return [l, [l.map((m, g) => g)]];
186
+ return [u, [u.map((m, g) => g)]];
187
187
  if (s || !o || n)
188
- return [l, l.map((m, g) => [g])];
188
+ return [u, u.map((m, g) => [g])];
189
189
  const d = [];
190
- let u = [];
190
+ let c = [];
191
191
  const f = () => {
192
- u.length && (d.push([...u]), u = []);
192
+ c.length && (d.push([...c]), c = []);
193
193
  };
194
194
  let p = 0, v = !1;
195
- for (let m = 0; m < l.length; m++) {
196
- const g = e.get(l[m]);
195
+ for (let m = 0; m < u.length; m++) {
196
+ const g = e.get(u[m]);
197
197
  if (g.behavior.includes("non-paged")) {
198
198
  m === p && p++, r || (f(), d.push([m]), f());
199
199
  continue;
200
200
  }
201
201
  if (m === p || g.behavior.includes("facing-pages")) {
202
- u.length && (v = !0), f(), d.push([m]), f();
202
+ c.length && (v = !0), f(), d.push([m]), f();
203
203
  continue;
204
204
  }
205
- if (u.push(m), v) {
205
+ if (c.push(m), v) {
206
206
  f(), v = !1;
207
207
  continue;
208
208
  }
209
- u.length > 1 && f();
209
+ c.length > 1 && f();
210
210
  }
211
- return u.length && f(), [l, d];
211
+ return c.length && f(), [u, d];
212
212
  }
213
213
  function Et(e = {}, t = []) {
214
214
  const { id: n, selector: r } = e, i = z(), o = n || i.range, a = V((s) => o ? s.iiif.entities.Range[o] : void 0, [o]);
@@ -222,40 +222,40 @@ function Ct({ startCanvas: e, disablePaging: t }) {
222
222
  const n = T(), r = K(), i = Et(), [o, a] = L(void 0), s = i || r;
223
223
  if (!s)
224
224
  throw new Error("Nothing selected");
225
- const [l, d] = y(
225
+ const [u, d] = y(
226
226
  () => bt(n, s, { disablePaging: t }),
227
227
  [n, s]
228
- ), u = P(
228
+ ), c = P(
229
229
  (g) => {
230
230
  const w = d.findIndex((x) => x.includes(g));
231
231
  a(w === -1 ? 0 : w);
232
232
  },
233
- [l, d]
233
+ [u, d]
234
234
  ), f = P(
235
235
  (g) => {
236
- const w = l.findIndex((x) => x.id === g);
237
- w !== -1 ? u(w) : a(0);
236
+ const w = u.findIndex((x) => x.id === g);
237
+ w !== -1 ? c(w) : a(0);
238
238
  },
239
- [l, d]
239
+ [u, d]
240
240
  ), p = P(() => {
241
241
  a((g) => g >= d.length ? g : g + 1);
242
242
  }, [d]), v = P(() => {
243
243
  a((g) => g <= 0 ? 0 : g - 1);
244
244
  }, [d]);
245
245
  return typeof o > "u" && (e ? f(e) : a(0)), {
246
- visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) => l[g].id)) || [],
246
+ visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) => u[g].id)) || [],
247
247
  cursor: o,
248
- items: l,
248
+ items: u,
249
249
  sequence: d,
250
250
  setSequenceIndex: a,
251
- setCanvasIndex: u,
251
+ setCanvasIndex: c,
252
252
  setCanvasId: f,
253
253
  next: p,
254
254
  previous: v
255
255
  };
256
256
  }
257
257
  const J = () => {
258
- }, ae = _({
258
+ }, ae = U({
259
259
  setCurrentCanvasId: J,
260
260
  setCurrentCanvasIndex: J,
261
261
  nextCanvas: J,
@@ -266,7 +266,7 @@ const J = () => {
266
266
  currentSequenceIndex: 0
267
267
  });
268
268
  function At(e) {
269
- const t = K(), { cursor: n, visibleItems: r, next: i, sequence: o, items: a, setCanvasIndex: s, setCanvasId: l, previous: d, setSequenceIndex: u } = Ct({
269
+ const t = K(), { cursor: n, visibleItems: r, next: i, sequence: o, items: a, setCanvasIndex: s, setCanvasId: u, previous: d, setSequenceIndex: c } = Ct({
270
270
  startCanvas: e.startCanvas,
271
271
  disablePaging: e.pagingEnabled === !1
272
272
  }), f = y(
@@ -274,28 +274,28 @@ function At(e) {
274
274
  sequence: o,
275
275
  items: a,
276
276
  // Extra functions.
277
- setCurrentCanvasId: l,
277
+ setCurrentCanvasId: u,
278
278
  nextCanvas: i,
279
279
  previousCanvas: d,
280
280
  totalCanvases: a.length,
281
281
  setCurrentCanvasIndex: s,
282
- setSequenceIndex: u,
282
+ setSequenceIndex: c,
283
283
  currentSequenceIndex: n
284
284
  }),
285
- [o, a, l, i, d, a, s, u, n]
285
+ [o, a, u, i, d, a, s, c, n]
286
286
  );
287
- return t ? r.length === 0 ? null : /* @__PURE__ */ c(ae.Provider, { value: f, children: /* @__PURE__ */ c(oe.Provider, { value: r, children: /* @__PURE__ */ c(ge, { canvas: r[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ c("div", { children: "Sorry, something went wrong." }));
287
+ return t ? r.length === 0 ? null : /* @__PURE__ */ l(ae.Provider, { value: f, children: /* @__PURE__ */ l(oe.Provider, { value: r, children: /* @__PURE__ */ l(ge, { canvas: r[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ l("div", { children: "Sorry, something went wrong." }));
288
288
  }
289
289
  function It(e) {
290
290
  const t = wt(e.manifest);
291
291
  if (!t)
292
- return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ c("div", { children: "Sorry, something went wrong." });
292
+ return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ l("div", { children: "Sorry, something went wrong." });
293
293
  if (t.error)
294
- return /* @__PURE__ */ c("div", { children: t.error.toString() });
294
+ return /* @__PURE__ */ l("div", { children: t.error.toString() });
295
295
  if (!t.isLoaded)
296
- return /* @__PURE__ */ c("div", { children: "Loading..." });
297
- const n = /* @__PURE__ */ c(At, { ...e, children: e.children });
298
- return /* @__PURE__ */ c(St, { manifest: t.id, children: e.rangeId ? /* @__PURE__ */ c(Pt, { range: e.rangeId, children: n }) : n });
296
+ return /* @__PURE__ */ l("div", { children: "Loading..." });
297
+ const n = /* @__PURE__ */ l(At, { ...e, children: e.children });
298
+ return /* @__PURE__ */ l(St, { manifest: t.id, children: e.rangeId ? /* @__PURE__ */ l(Pt, { range: e.rangeId, children: n }) : n });
299
299
  }
300
300
  function Mt() {
301
301
  return R(ae);
@@ -309,7 +309,7 @@ function Tt() {
309
309
  };
310
310
  }
311
311
  function Rt(e) {
312
- return /* @__PURE__ */ c(Te, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ c(oe.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ c(ae.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
312
+ return /* @__PURE__ */ l(Te, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ l(oe.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ l(ae.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
313
313
  }
314
314
  const F = function(e) {
315
315
  return function() {
@@ -320,7 +320,7 @@ const F = function(e) {
320
320
  ...r !== void 0 && { meta: r }
321
321
  });
322
322
  };
323
- }, Vt = "@iiif/IMPORT_ENTITIES", Ot = "@iiif/MODIFY_ENTITY_FIELD", Lt = "@iiif/REORDER_ENTITY_FIELD", kt = "@iiif/ADD_REFERENCE", Nt = "@iiif/UPDATE_REFERENCE", Ft = "@iiif/REMOVE_REFERENCE", Ut = "@iiif/ADD_METADATA", _t = "@iiif/REMOVE_METADATA", Dt = "@iiif/UPDATE_METADATA", jt = "@iiif/REORDER_METADATA", qt = F(Vt)(), $t = F(Ot)(), Bt = F(Lt)(), Ht = F(kt)(), Yt = F(Ft)(), zt = F(Nt)(), Kt = F(Ut)(), Wt = F(Dt)(), Gt = F(_t)(), Qt = F(jt)(), ue = {
323
+ }, Vt = "@iiif/IMPORT_ENTITIES", Ot = "@iiif/MODIFY_ENTITY_FIELD", Lt = "@iiif/REORDER_ENTITY_FIELD", kt = "@iiif/ADD_REFERENCE", Nt = "@iiif/UPDATE_REFERENCE", Ft = "@iiif/REMOVE_REFERENCE", Dt = "@iiif/ADD_METADATA", Ut = "@iiif/REMOVE_METADATA", _t = "@iiif/UPDATE_METADATA", jt = "@iiif/REORDER_METADATA", qt = F(Vt)(), $t = F(Ot)(), Bt = F(Lt)(), Ht = F(kt)(), Yt = F(Ft)(), zt = F(Nt)(), Kt = F(Dt)(), Wt = F(_t)(), Gt = F(Ut)(), Qt = F(jt)(), ue = {
324
324
  importEntities: qt,
325
325
  modifyEntityField: $t,
326
326
  reorderEntityField: Bt,
@@ -373,15 +373,15 @@ function Zt() {
373
373
  (s) => r ? s.iiif.entities.AnnotationPage[r] : null,
374
374
  [r]
375
375
  ), o = P(
376
- (s, l) => {
376
+ (s, u) => {
377
377
  if (r) {
378
378
  if (be(s)) {
379
379
  const f = s;
380
380
  f.__vault || f.bindToVault(e), s = typeof f.source == "string" ? f.source : f.source.id, t.current[s] = f;
381
381
  } else
382
382
  typeof s != "string" && (s = s.id);
383
- const d = e.get({ id: r, type: "AnnotationPage" }), u = e.get({ id: s, type: "Annotation" });
384
- d && u && (d.items.find((f) => f.id === u.id) || n(
383
+ const d = e.get({ id: r, type: "AnnotationPage" }), c = e.get({ id: s, type: "Annotation" });
384
+ d && c && (d.items.find((f) => f.id === c.id) || n(
385
385
  ue.addReference({
386
386
  id: r,
387
387
  type: "AnnotationPage",
@@ -390,7 +390,7 @@ function Zt() {
390
390
  id: s,
391
391
  type: "Annotation"
392
392
  },
393
- index: l
393
+ index: u
394
394
  })
395
395
  ));
396
396
  }
@@ -420,7 +420,7 @@ function Zt() {
420
420
  }
421
421
  ];
422
422
  }
423
- const Oe = _(null);
423
+ const Oe = U(null);
424
424
  function Xt() {
425
425
  const e = R(Oe);
426
426
  return [
@@ -433,7 +433,7 @@ function Xt() {
433
433
  }
434
434
  function en({ children: e }) {
435
435
  const [t, { addAnnotation: n, removeAnnotation: r }] = Zt();
436
- return /* @__PURE__ */ c(
436
+ return /* @__PURE__ */ l(
437
437
  Oe.Provider,
438
438
  {
439
439
  value: y(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
@@ -449,19 +449,19 @@ function tn({
449
449
  resetErrorBoundary: i
450
450
  }) {
451
451
  return /* @__PURE__ */ A("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
452
- /* @__PURE__ */ c("h3", { children: "Error occurred" }),
453
- /* @__PURE__ */ c("p", { children: r.message }),
454
- /* @__PURE__ */ c("button", { onClick: i, children: "Reset" })
452
+ /* @__PURE__ */ l("h3", { children: "Error occurred" }),
453
+ /* @__PURE__ */ l("p", { children: r.message }),
454
+ /* @__PURE__ */ l("button", { onClick: i, children: "Reset" })
455
455
  ] });
456
456
  }
457
- const me = _(null);
457
+ const me = U(null);
458
458
  function nn() {
459
459
  return R(me);
460
460
  }
461
- const Le = _(
461
+ const Le = U(
462
462
  () => {
463
463
  }
464
- ), ke = _(
464
+ ), ke = U(
465
465
  () => {
466
466
  }
467
467
  );
@@ -478,7 +478,7 @@ function $(e = {}, t = []) {
478
478
  return r ? r(a) : a;
479
479
  }, [a, r, ...t]);
480
480
  }
481
- const Ne = _(() => {
481
+ const Ne = U(() => {
482
482
  });
483
483
  function rn(e) {
484
484
  const t = $(), n = R(Ne);
@@ -492,40 +492,40 @@ function on({
492
492
  worldScale: r,
493
493
  ...i
494
494
  }) {
495
- const [o, a] = L(), s = Tt(), l = t || tn, [d, u] = L({}), f = Object.entries(d), [p, v] = L({}), m = Object.entries(p), [g, w] = L({}), x = y(() => r || Math.max(...Object.values(g)), [g]), I = y(() => ({ maxOverZoom: x || 1, ...i.runtimeOptions || {} }), [x, i.runtimeOptions]), b = P((E, M) => {
495
+ const [o, a] = L(), s = Tt(), u = t || tn, [d, c] = L({}), f = Object.entries(d), [p, v] = L({}), m = Object.entries(p), [g, w] = L({}), x = y(() => r || Math.max(...Object.values(g)), [g]), I = y(() => ({ maxOverZoom: x || 1, ...i.runtimeOptions || {} }), [x, i.runtimeOptions]), b = P((E, M) => {
496
496
  w((k) => {
497
497
  if (M === -1) {
498
- const { [E]: h, ...U } = k;
499
- return U;
498
+ const { [E]: h, ...D } = k;
499
+ return D;
500
500
  }
501
501
  return { ...k, [E]: M };
502
502
  });
503
503
  }, []), W = P((E, M, k) => {
504
- u(({ [E]: h, ...U }) => M ? {
505
- ...U,
504
+ c(({ [E]: h, ...D }) => M ? {
505
+ ...D,
506
506
  [E]: { element: M, props: k }
507
- } : U);
507
+ } : D);
508
508
  }, []), Z = P((E, M, k) => {
509
- v(({ [E]: h, ...U }) => M ? {
510
- ...U,
509
+ v(({ [E]: h, ...D }) => M ? {
510
+ ...D,
511
511
  [E]: { element: M, props: k }
512
- } : U);
512
+ } : D);
513
513
  }, []);
514
- return /* @__PURE__ */ A(vt, { resetKeys: [], fallbackRender: (E) => /* @__PURE__ */ c(l, { ...i, ...E }), children: [
515
- /* @__PURE__ */ c(
514
+ return /* @__PURE__ */ A(vt, { resetKeys: [], fallbackRender: (E) => /* @__PURE__ */ l(u, { ...i, ...E }), children: [
515
+ /* @__PURE__ */ l(
516
516
  ot,
517
517
  {
518
518
  ...i,
519
519
  containerProps: { style: { position: "relative" }, ...i.containerProps || {} },
520
- htmlChildren: /* @__PURE__ */ c(H, { children: f.map(([E, { element: M, props: k }]) => /* @__PURE__ */ c(q.Fragment, { children: /* @__PURE__ */ c(M, { ...k || {} }) }, E)) }),
520
+ htmlChildren: /* @__PURE__ */ l(H, { children: f.map(([E, { element: M, props: k }]) => /* @__PURE__ */ l(q.Fragment, { children: /* @__PURE__ */ l(M, { ...k || {} }) }, E)) }),
521
521
  onCreated: (E) => {
522
522
  a(E), i.onCreated && i.onCreated(E);
523
523
  },
524
524
  runtimeOptions: I,
525
- children: /* @__PURE__ */ c(me.Provider, { value: o, children: /* @__PURE__ */ c(Ne.Provider, { value: b, children: /* @__PURE__ */ c(Le.Provider, { value: W, children: /* @__PURE__ */ c(ke.Provider, { value: Z, children: /* @__PURE__ */ c(Rt, { bridge: s, children: /* @__PURE__ */ c(at.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ c(en, { children: e }) }) }) }) }) }) })
525
+ children: /* @__PURE__ */ l(me.Provider, { value: o, children: /* @__PURE__ */ l(Ne.Provider, { value: b, children: /* @__PURE__ */ l(Le.Provider, { value: W, children: /* @__PURE__ */ l(ke.Provider, { value: Z, children: /* @__PURE__ */ l(Rt, { bridge: s, children: /* @__PURE__ */ l(at.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ l(en, { children: e }) }) }) }) }) }) })
526
526
  }
527
527
  ),
528
- /* @__PURE__ */ c("div", { children: m.map(([E, { element: M, props: k }]) => /* @__PURE__ */ c(q.Fragment, { children: /* @__PURE__ */ c(M, { ...k || {} }) }, E)) })
528
+ /* @__PURE__ */ l("div", { children: m.map(([E, { element: M, props: k }]) => /* @__PURE__ */ l(q.Fragment, { children: /* @__PURE__ */ l(M, { ...k || {} }) }, E)) })
529
529
  ] });
530
530
  }
531
531
  const X = {}, Fe = {
@@ -577,15 +577,15 @@ function an(e = Fe) {
577
577
  if (i && r)
578
578
  for (const a of Object.keys(i))
579
579
  o[a] = (s) => {
580
- const l = e.get(r);
581
- for (const { callback: d, scope: u } of i[a] || [])
582
- (!u || n && u.indexOf(n) !== -1) && d(s, l);
580
+ const u = e.get(r);
581
+ for (const { callback: d, scope: c } of i[a] || [])
582
+ (!c || n && c.indexOf(n) !== -1) && d(s, u);
583
583
  };
584
584
  return o;
585
585
  }
586
586
  };
587
587
  }
588
- function Ue(e, t) {
588
+ function De(e, t) {
589
589
  const n = T(), r = y(() => an(n), [n]), i = V(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
590
590
  return y(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
591
591
  }
@@ -598,15 +598,15 @@ function ne(e, t) {
598
598
  return i ? t ? i[t] : i : void 0;
599
599
  }, [e, t]);
600
600
  }
601
- function _e(e = {}, t = []) {
601
+ function Ue(e = {}, t = []) {
602
602
  const { id: n, selector: r } = e, i = z(), o = T(), a = n || i.annotation, s = V(
603
603
  (d) => a ? d.iiif.entities.Annotation[a] : void 0,
604
604
  [a]
605
- ), l = V(
606
- (d) => s && s.body ? s.body.map((u) => u ? u.type === "SpecificResource" ? {
607
- ...u,
608
- source: o.get(u)
609
- } : u ? d.iiif.entities[u.type][u.id] : null : null).filter(Boolean) : [],
605
+ ), u = V(
606
+ (d) => s && s.body ? s.body.map((c) => c ? c.type === "SpecificResource" ? {
607
+ ...c,
608
+ source: o.get(c)
609
+ } : c ? d.iiif.entities[c.type][c.id] : null : null).filter(Boolean) : [],
610
610
  [s]
611
611
  );
612
612
  return y(() => {
@@ -614,20 +614,20 @@ function _e(e = {}, t = []) {
614
614
  return;
615
615
  const d = {
616
616
  ...s,
617
- body: l,
617
+ body: u,
618
618
  target: le(s.target, { typeMap: o.getState().iiif.mapping })
619
619
  };
620
620
  return r ? r(d) : d;
621
- }, [s, r, l, ...t]);
621
+ }, [s, r, u, ...t]);
622
622
  }
623
- const De = ({
623
+ const _e = ({
624
624
  id: e,
625
625
  style: t,
626
626
  className: n,
627
627
  interactive: r
628
628
  }) => {
629
- const i = _e({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Ue(i, ["atlas"]), l = $(), d = y(() => st(t, o), [t, o]);
630
- return l && i && i.target && i.target.selector && i.target.selector.type === "BoxSelector" && i.target.source && (i.target.source.id === l.id || i.target.source === l.id) ? /* @__PURE__ */ c(
629
+ const i = Ue({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = De(i, ["atlas"]), u = $(), d = y(() => st(t, o), [t, o]);
630
+ return u && i && i.target && i.target.selector && i.target.selector.type === "BoxSelector" && i.target.source && (i.target.source.id === u.id || i.target.source === u.id) ? /* @__PURE__ */ l(
631
631
  ut,
632
632
  {
633
633
  id: i.id,
@@ -661,8 +661,8 @@ const fe = ({
661
661
  }) => {
662
662
  var o;
663
663
  const n = sn({ id: t.id }) || t, r = ne(n, "atlas"), i = ne(n, "html");
664
- return V((a) => n.id ? a.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ c(te, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ c(
665
- De,
664
+ return V((a) => n.id ? a.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ l(te, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ l(
665
+ _e,
666
666
  {
667
667
  id: a.id,
668
668
  style: r,
@@ -680,24 +680,24 @@ function je({
680
680
  y: o = 0,
681
681
  children: a,
682
682
  selector: s,
683
- onClick: l,
683
+ onClick: u,
684
684
  enableSizes: d
685
685
  }) {
686
686
  var f, p;
687
- const u = y(() => {
687
+ const c = y(() => {
688
688
  if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
689
689
  return s.spatial;
690
690
  }, [s]);
691
- return /* @__PURE__ */ c(
691
+ return /* @__PURE__ */ l(
692
692
  "world-object",
693
693
  {
694
694
  x: i + t.target.spatial.x,
695
695
  y: o + t.target.spatial.y,
696
696
  width: t.target.spatial.width,
697
697
  height: t.target.spatial.height,
698
- onClick: l,
698
+ onClick: u,
699
699
  children: t.service ? /* @__PURE__ */ A(te, { children: [
700
- /* @__PURE__ */ c(
700
+ /* @__PURE__ */ l(
701
701
  ct,
702
702
  {
703
703
  tiles: {
@@ -712,22 +712,22 @@ function je({
712
712
  y: 0,
713
713
  width: (f = t.target) == null ? void 0 : f.spatial.width,
714
714
  height: (p = t.target) == null ? void 0 : p.spatial.height,
715
- crop: u
715
+ crop: c
716
716
  }
717
717
  ),
718
718
  a
719
719
  ] }, "service") : /* @__PURE__ */ A(te, { children: [
720
- /* @__PURE__ */ c(
720
+ /* @__PURE__ */ l(
721
721
  "world-image",
722
722
  {
723
- onClick: l,
723
+ onClick: u,
724
724
  uri: t.id,
725
725
  target: { x: 0, y: 0, width: t.target.spatial.width, height: t.target.spatial.height },
726
726
  display: t.width && t.height ? {
727
727
  width: t.width,
728
728
  height: t.height
729
729
  } : void 0,
730
- crop: u
730
+ crop: c
731
731
  }
732
732
  ),
733
733
  a
@@ -815,10 +815,10 @@ function gn(e, t = {}) {
815
815
  manifest: r,
816
816
  canvas: i,
817
817
  canvases: o
818
- }), [t.all, i, o, r]), s = dn(e, t.all ? void 0 : a), l = P(
819
- (u) => {
818
+ }), [t.all, i, o, r]), s = dn(e, t.all ? void 0 : a), u = P(
819
+ (c) => {
820
820
  e && n.setMetaValue(
821
- [u, "annotationPageManager", "views"],
821
+ [c, "annotationPageManager", "views"],
822
822
  (f) => f && !f[e] ? f : {
823
823
  ...f || {},
824
824
  [e]: !1
@@ -827,7 +827,7 @@ function gn(e, t = {}) {
827
827
  },
828
828
  [e, n]
829
829
  ), d = P(
830
- (u, f = {}) => {
830
+ (c, f = {}) => {
831
831
  if (!e)
832
832
  return;
833
833
  const p = n.getState(), v = [];
@@ -839,22 +839,22 @@ function gn(e, t = {}) {
839
839
  }
840
840
  }
841
841
  for (const m of v)
842
- l(m);
842
+ u(m);
843
843
  n.setMetaValue(
844
- [u, "annotationPageManager", "views"],
844
+ [c, "annotationPageManager", "views"],
845
845
  (m) => m && m[e] ? m : {
846
846
  ...m || {},
847
847
  [e]: !0
848
848
  }
849
849
  );
850
850
  },
851
- [e, l, n]
851
+ [e, u, n]
852
852
  );
853
853
  return {
854
854
  availablePageIds: a,
855
855
  enabledPageIds: s,
856
856
  setPageEnabled: d,
857
- setPageDisabled: l
857
+ setPageDisabled: u
858
858
  };
859
859
  }
860
860
  function mn(e, t) {
@@ -871,23 +871,23 @@ function vn() {
871
871
  }, []), [P(
872
872
  (o, { height: a, width: s }) => {
873
873
  if (o) {
874
- const l = o.id || o["@id"], d = e.loadServiceSync({
875
- id: l,
874
+ const u = o.id || o["@id"], d = e.loadServiceSync({
875
+ id: u,
876
876
  width: o.width || s,
877
877
  height: o.height || a,
878
878
  source: o
879
879
  });
880
- d ? o = d : t[l] || (r.current || n((u) => ({
881
- ...u,
882
- [l]: "loading"
880
+ d ? o = d : t[u] || (r.current || n((c) => ({
881
+ ...c,
882
+ [u]: "loading"
883
883
  })), e.loadService({
884
- id: l,
884
+ id: u,
885
885
  width: o.width || s,
886
886
  height: o.height || a
887
887
  }).then(() => {
888
- r.current || n((u) => ({
889
- ...u,
890
- [l]: "done"
888
+ r.current || n((c) => ({
889
+ ...c,
890
+ [u]: "done"
891
891
  }));
892
892
  }));
893
893
  }
@@ -897,7 +897,7 @@ function vn() {
897
897
  ), t];
898
898
  }
899
899
  function yn(e = {}) {
900
- const t = _e(), n = $(e.canvasId ? { id: e.canvasId } : void 0);
900
+ const t = Ue(), n = $(e.canvasId ? { id: e.canvasId } : void 0);
901
901
  return V(
902
902
  (r, i) => {
903
903
  if (!n)
@@ -941,23 +941,23 @@ function wn(e = Be) {
941
941
  if (!o)
942
942
  return [];
943
943
  const a = e.get(o.items, { parent: o }), s = [];
944
- for (const l of a)
945
- s.push(...e.get(l.items, { parent: l }));
944
+ for (const u of a)
945
+ s.push(...e.get(u.items, { parent: u }));
946
946
  return s;
947
947
  }
948
948
  function n(i, o = []) {
949
949
  const a = Array.isArray(i) ? i : t(i), s = [];
950
- let l = null;
950
+ let u = null;
951
951
  const d = [];
952
- for (const u of a) {
953
- if (u.type !== "Annotation")
952
+ for (const c of a) {
953
+ if (c.type !== "Annotation")
954
954
  throw new Error("getPaintables() accept either a canvas or list of annotations");
955
- const f = Array.from(Array.isArray(u.body) ? u.body : [u.body]);
955
+ const f = Array.from(Array.isArray(c.body) ? c.body : [c.body]);
956
956
  for (const p of f) {
957
957
  const [v, { selector: m }] = xn(p), g = e.get(v), w = (g.type || "unknown").toLowerCase();
958
958
  if (w === "choice") {
959
959
  const x = e.get(g.items, { parent: g.id }), I = o.length ? o.map((b) => x.find((W) => W.id === b)).filter(Boolean) : [x[0]];
960
- I.length === 0 && I.push(x[0]), l = {
960
+ I.length === 0 && I.push(x[0]), u = {
961
961
  type: "single-choice",
962
962
  items: x.map((b) => ({
963
963
  id: b.id,
@@ -970,9 +970,9 @@ function wn(e = Be) {
970
970
  }
971
971
  s.indexOf(w) === -1 && s.push(w), d.push({
972
972
  type: w,
973
- annotationId: u.id,
973
+ annotationId: c.id,
974
974
  resource: g,
975
- target: u.target,
975
+ target: c.target,
976
976
  selector: m
977
977
  });
978
978
  }
@@ -980,7 +980,7 @@ function wn(e = Be) {
980
980
  return {
981
981
  types: s,
982
982
  items: d,
983
- choice: l
983
+ choice: u
984
984
  };
985
985
  }
986
986
  function r(i) {
@@ -998,13 +998,13 @@ function Sn(e, t = []) {
998
998
  () => r.getPaintables(i, o),
999
999
  [n, i, o, ...t]
1000
1000
  ), d = { makeChoice: P(
1001
- (u, { deselectOthers: f = !0, deselect: p = !1 } = {}) => {
1001
+ (c, { deselectOthers: f = !0, deselect: p = !1 } = {}) => {
1002
1002
  if (s.choice) {
1003
1003
  if (s.choice.type !== "single-choice")
1004
1004
  throw new Error("Complex choice not supported yet");
1005
1005
  a((v) => {
1006
1006
  if (p) {
1007
- const g = v.filter((w) => w !== u);
1007
+ const g = v.filter((w) => w !== c);
1008
1008
  if (g.length === 0) {
1009
1009
  const w = s.items[0].resource.id;
1010
1010
  return w ? [w] : [];
@@ -1012,13 +1012,13 @@ function Sn(e, t = []) {
1012
1012
  return g;
1013
1013
  }
1014
1014
  if (f)
1015
- return [u];
1015
+ return [c];
1016
1016
  const m = [...v];
1017
1017
  if (m.length === 0 && s.items.length) {
1018
1018
  const g = s.items[0].resource.id;
1019
1019
  g && m.push(g);
1020
1020
  }
1021
- return v.indexOf(u) !== -1 ? v : [...v, u];
1021
+ return v.indexOf(c) !== -1 ? v : [...v, c];
1022
1022
  });
1023
1023
  }
1024
1024
  },
@@ -1088,26 +1088,26 @@ function Cn(e, t, n) {
1088
1088
  width: Number(e.width),
1089
1089
  height: Number(e.height)
1090
1090
  }
1091
- }, [l, d] = qe(e, i.target);
1091
+ }, [u, d] = qe(e, i.target);
1092
1092
  if (d.id !== e.id)
1093
1093
  continue;
1094
1094
  i.resource.width && i.resource.height && (i.resource.width, i.resource.height);
1095
- let u = i.resource.type === "SpecificResource" ? le(i.resource) : null;
1095
+ let c = i.resource.type === "SpecificResource" ? le(i.resource) : null;
1096
1096
  if (i.selector) {
1097
1097
  const v = le({
1098
1098
  type: "SpecificResource",
1099
1099
  source: i.resource,
1100
1100
  selector: i.selector
1101
1101
  });
1102
- v && (u = v);
1102
+ v && (c = v);
1103
1103
  }
1104
- const f = u && u.selector && (u.selector.type === "BoxSelector" || u.selector.type === "TemporalBoxSelector") ? {
1104
+ const f = c && c.selector && (c.selector.type === "BoxSelector" || c.selector.type === "TemporalBoxSelector") ? {
1105
1105
  type: "BoxSelector",
1106
1106
  spatial: {
1107
- x: u.selector.spatial.x,
1108
- y: u.selector.spatial.y,
1109
- width: u.selector.spatial.width,
1110
- height: u.selector.spatial.height
1107
+ x: c.selector.spatial.x,
1108
+ y: c.selector.spatial.y,
1109
+ width: c.selector.spatial.width,
1110
+ height: c.selector.spatial.height
1111
1111
  }
1112
1112
  } : void 0;
1113
1113
  a && !a.id && (a.id = a["@id"]);
@@ -1115,11 +1115,11 @@ function Cn(e, t, n) {
1115
1115
  id: o.id,
1116
1116
  type: "Image",
1117
1117
  annotationId: i.annotationId,
1118
- width: Number(l || f ? o.width : e.width),
1119
- height: Number(l || f ? o.height : e.height),
1118
+ width: Number(u || f ? o.width : e.width),
1119
+ height: Number(u || f ? o.height : e.height),
1120
1120
  service: a,
1121
1121
  sizes: a && a.sizes ? a.sizes : o.width && o.height ? [{ width: o.width, height: o.height }] : [],
1122
- target: l && l.type !== "PointSelector" ? l : s,
1122
+ target: u && u.type !== "PointSelector" ? u : s,
1123
1123
  selector: f
1124
1124
  };
1125
1125
  r.push(p);
@@ -1159,23 +1159,24 @@ function An(e, t) {
1159
1159
  }
1160
1160
  const In = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1161
1161
  function Mn(e, t) {
1162
- var a;
1163
- const n = t.items.filter((s) => s.type === "video");
1164
- if (!e.duration)
1165
- return C("No duration on canvas");
1166
- if (n.length > 1)
1162
+ var s;
1163
+ const n = t.items.filter((u) => u.type === "video");
1164
+ let r = !1;
1165
+ if (e.duration || (r = !0), n.length > 1)
1167
1166
  return C("Only one video source supported");
1168
- const r = (a = n[0]) == null ? void 0 : a.resource, i = !!(r.service || []).find(
1169
- (s) => (s.profile || "").includes("youtube.com")
1167
+ const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
1168
+ (u) => (u.profile || "").includes("youtube.com")
1170
1169
  );
1171
- if (!r)
1170
+ if (!o && r)
1171
+ return C("Video does not have duration");
1172
+ if (!i)
1172
1173
  return C("Unknown video");
1173
- if ((!r.format || r.format === "text/html") && !i)
1174
+ if ((!i.format || i.format === "text/html") && !o)
1174
1175
  return C("Video does not have format");
1175
- const o = {
1176
+ const a = {
1176
1177
  annotationId: t.items[0].annotationId,
1177
1178
  duration: e.duration,
1178
- url: r.id,
1179
+ url: i.id,
1179
1180
  type: "Video",
1180
1181
  items: [],
1181
1182
  target: {
@@ -1185,7 +1186,7 @@ function Mn(e, t) {
1185
1186
  endTime: e.duration
1186
1187
  }
1187
1188
  },
1188
- format: r.format,
1189
+ format: i.format,
1189
1190
  selector: {
1190
1191
  type: "TemporalSelector",
1191
1192
  temporal: {
@@ -1194,16 +1195,16 @@ function Mn(e, t) {
1194
1195
  }
1195
1196
  }
1196
1197
  };
1197
- if (i) {
1198
- o.type = "VideoYouTube";
1199
- const s = r.id.match(In);
1200
- if (!s[1])
1198
+ if (o) {
1199
+ a.type = "VideoYouTube";
1200
+ const u = i.id.match(In);
1201
+ if (!u[1])
1201
1202
  return C("Video is not known youtube video");
1202
- o.youTubeId = s[1];
1203
+ a.youTubeId = u[1];
1203
1204
  }
1204
1205
  return {
1205
1206
  type: "media",
1206
- media: o,
1207
+ media: a,
1207
1208
  annotations: {
1208
1209
  pages: []
1209
1210
  }
@@ -1225,19 +1226,19 @@ function Tn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
1225
1226
  function Rn(e) {
1226
1227
  const t = K(), n = $(), r = T(), [i, o] = vn(), { enabledPageIds: a } = gn((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
1227
1228
  all: !1
1228
- }), s = mn(a, "AnnotationPage"), l = (e == null ? void 0 : e.strategies) || [
1229
+ }), s = mn(a, "AnnotationPage"), u = (e == null ? void 0 : e.strategies) || [
1229
1230
  "empty",
1230
1231
  "images",
1231
1232
  "media",
1232
1233
  "textual-content",
1233
1234
  "complex-timeline"
1234
- ], [d, u] = Sn(e, [o]), f = y(() => Tn({ canvas: n, paintables: d, supports: l, loadImageService: i }), [n, d, r, u.makeChoice]);
1235
+ ], [d, c] = Sn(e, [o]), f = y(() => Tn({ canvas: n, paintables: d, supports: u, loadImageService: i }), [n, d, r, c.makeChoice]);
1235
1236
  return y(() => f.type === "unknown" ? [f, un] : [
1236
1237
  {
1237
1238
  ...f,
1238
1239
  annotations: { pages: s }
1239
1240
  },
1240
- u
1241
+ c
1241
1242
  ], [f, s]);
1242
1243
  }
1243
1244
  const Vn = (e, t = []) => {
@@ -1247,7 +1248,7 @@ const Vn = (e, t = []) => {
1247
1248
  }, [n, ...t]);
1248
1249
  };
1249
1250
  function On(e, t, { canvasId: n, manifestId: r } = {}) {
1250
- const i = T(), o = $e(), a = y(() => gt(i, { imageServiceLoader: o }), [i, o]), [s, l] = L(), d = K(r ? { id: r } : void 0), u = $(n ? { id: n } : void 0), f = u || d, p = j(!1);
1251
+ const i = T(), o = $e(), a = y(() => gt(i, { imageServiceLoader: o }), [i, o]), [s, u] = L(), d = K(r ? { id: r } : void 0), c = $(n ? { id: n } : void 0), f = c || d, p = j(!1);
1251
1252
  if (N(() => (p.current = !1, () => {
1252
1253
  p.current = !0;
1253
1254
  }), []), !f)
@@ -1255,7 +1256,7 @@ function On(e, t, { canvasId: n, manifestId: r } = {}) {
1255
1256
  return Vn(
1256
1257
  (v) => {
1257
1258
  a.getBestThumbnailAtSize(f, e, t).then((m) => {
1258
- m.best && !p.current && l(m.best);
1259
+ m.best && !p.current && u(m.best);
1259
1260
  });
1260
1261
  },
1261
1262
  [f]
@@ -1294,13 +1295,13 @@ function Nn(e) {
1294
1295
  function pe(e) {
1295
1296
  const [t, n] = rt(kn, Ln(e.duration)), r = j(null), i = j(null), o = j(null), a = j(!1), s = P(() => {
1296
1297
  i.current && r.current && (i.current.innerHTML = Nn(r.current.currentTime), o.current && (o.current.style.width = `${r.current.currentTime / e.duration * 100}%`), a.current !== r.current.muted && (a.current = r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
1297
- }, [e.duration]), l = P(() => {
1298
+ }, [e.duration]), u = P(() => {
1298
1299
  r.current && (n({ type: "PLAY_REQUESTED" }), r.current.play().then(() => {
1299
1300
  n({ type: "PLAY" });
1300
1301
  }), s());
1301
1302
  }, [s]), d = P(() => {
1302
- r.current && (r.current.duration > 0 && r.current.paused ? l() : u());
1303
- }, [s]), u = P(() => {
1303
+ r.current && (r.current.duration > 0 && r.current.paused ? u() : c());
1304
+ }, [s]), c = P(() => {
1304
1305
  r.current && (r.current.pause(), n({ type: "PAUSE" }), s());
1305
1306
  }, [s]), f = P(() => {
1306
1307
  r.current && (r.current.muted = !r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
@@ -1329,8 +1330,8 @@ function pe(e) {
1329
1330
  { element: r, currentTime: i, progress: o },
1330
1331
  t,
1331
1332
  {
1332
- play: l,
1333
- pause: u,
1333
+ play: u,
1334
+ pause: c,
1334
1335
  playPause: d,
1335
1336
  mute: p,
1336
1337
  unmute: v,
@@ -1341,7 +1342,7 @@ function pe(e) {
1341
1342
  }
1342
1343
  ];
1343
1344
  }
1344
- const Fn = _(null), Un = _(null), _n = _(null);
1345
+ const Fn = U(null), Dn = U(null), Un = U(null);
1345
1346
  function Ye({
1346
1347
  actions: e,
1347
1348
  state: t,
@@ -1350,7 +1351,7 @@ function Ye({
1350
1351
  progress: i,
1351
1352
  element: o
1352
1353
  }) {
1353
- return /* @__PURE__ */ c(_n.Provider, { value: { currentTime: r, progress: i, element: o }, children: /* @__PURE__ */ c(Un.Provider, { value: e, children: /* @__PURE__ */ c(Fn.Provider, { value: t, children: n }) }) });
1354
+ return /* @__PURE__ */ l(Un.Provider, { value: { currentTime: r, progress: i, element: o }, children: /* @__PURE__ */ l(Dn.Provider, { value: e, children: /* @__PURE__ */ l(Fn.Provider, { value: t, children: n }) }) });
1354
1355
  }
1355
1356
  function ze({ media: e, children: t }) {
1356
1357
  const [{ element: n, currentTime: r, progress: i }, o, a] = pe({ duration: e.duration });
@@ -1363,7 +1364,7 @@ function ze({ media: e, children: t }) {
1363
1364
  progress: i,
1364
1365
  element: n,
1365
1366
  children: [
1366
- /* @__PURE__ */ c("audio", { ref: n, src: e.url }),
1367
+ /* @__PURE__ */ l("audio", { ref: n, src: e.url }),
1367
1368
  t
1368
1369
  ]
1369
1370
  }
@@ -1382,7 +1383,7 @@ function We({
1382
1383
  playPause: n
1383
1384
  }) {
1384
1385
  return /* @__PURE__ */ A("div", { className: "video-container", part: "video-container", onClick: n, children: [
1385
- /* @__PURE__ */ c("style", { children: `
1386
+ /* @__PURE__ */ l("style", { children: `
1386
1387
  .video-container {
1387
1388
  position: absolute;
1388
1389
  top: 0;
@@ -1396,7 +1397,7 @@ function We({
1396
1397
  pointer-events: visible;
1397
1398
  }
1398
1399
  ` }),
1399
- /* @__PURE__ */ c("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1400
+ /* @__PURE__ */ l("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1400
1401
  ] });
1401
1402
  }
1402
1403
  function Ge({
@@ -1426,7 +1427,7 @@ function Ge({
1426
1427
  }
1427
1428
  function Qe({ model: e }) {
1428
1429
  return /* @__PURE__ */ A(H, { children: [
1429
- /* @__PURE__ */ c("style", { children: `
1430
+ /* @__PURE__ */ l("style", { children: `
1430
1431
  .model-container {
1431
1432
  position: absolute;
1432
1433
  top: 0;
@@ -1440,7 +1441,7 @@ function Qe({ model: e }) {
1440
1441
  pointer-events: visible;
1441
1442
  }
1442
1443
  ` }),
1443
- /* @__PURE__ */ c("div", { className: "model-container", children: /* @__PURE__ */ c(
1444
+ /* @__PURE__ */ l("div", { className: "model-container", children: /* @__PURE__ */ l(
1444
1445
  "model-viewer",
1445
1446
  {
1446
1447
  "interaction-prompt": "none",
@@ -1457,7 +1458,7 @@ function Je({ model: e, name: t }) {
1457
1458
  }
1458
1459
  function Ze({ style: e }) {
1459
1460
  const t = $();
1460
- return !t || !t.height || !t.width ? null : /* @__PURE__ */ c(
1461
+ return !t || !t.height || !t.width ? null : /* @__PURE__ */ l(
1461
1462
  "box",
1462
1463
  {
1463
1464
  interactive: !1,
@@ -1466,16 +1467,16 @@ function Ze({ style: e }) {
1466
1467
  }
1467
1468
  );
1468
1469
  }
1469
- const Dn = q.createContext("en");
1470
+ const _n = q.createContext("en");
1470
1471
  function Xe() {
1471
- return q.useContext(Dn);
1472
+ return q.useContext(_n);
1472
1473
  }
1473
1474
  function Ee(e) {
1474
1475
  return e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : e;
1475
1476
  }
1476
1477
  function jn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
1477
1478
  const o = Xe();
1478
- return y(() => Ee(o) === Ee(t), [o, t]) ? e ? /* @__PURE__ */ c(e, { ...i, children: n }) : /* @__PURE__ */ c("span", { ...i, children: n }) : e ? /* @__PURE__ */ c(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ c("span", { ...i, lang: t, dir: r, children: n });
1479
+ return y(() => Ee(o) === Ee(t), [o, t]) ? e ? /* @__PURE__ */ l(e, { ...i, children: n }) : /* @__PURE__ */ l("span", { ...i, children: n }) : e ? /* @__PURE__ */ l(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ l("span", { ...i, lang: t, dir: r, children: n });
1479
1480
  }
1480
1481
  function qn(e, t, n) {
1481
1482
  if (t.length === 0)
@@ -1516,7 +1517,7 @@ function Bn(e, t) {
1516
1517
  }
1517
1518
  const Hn = ({ as: e, defaultText: t, enableDangerouslySetInnerHTML: n, children: r, ...i }) => {
1518
1519
  const [o, a] = Bn(r, t);
1519
- return a ? /* @__PURE__ */ c(
1520
+ return a ? /* @__PURE__ */ l(
1520
1521
  jn,
1521
1522
  {
1522
1523
  ...i,
@@ -1528,7 +1529,7 @@ const Hn = ({ as: e, defaultText: t, enableDangerouslySetInnerHTML: n, children:
1528
1529
  } : void 0,
1529
1530
  children: n ? void 0 : o
1530
1531
  }
1531
- ) : e ? /* @__PURE__ */ c(e, { ...i, children: o }) : /* @__PURE__ */ c(
1532
+ ) : e ? /* @__PURE__ */ l(e, { ...i, children: o }) : /* @__PURE__ */ l(
1532
1533
  "span",
1533
1534
  {
1534
1535
  ...i,
@@ -1547,7 +1548,7 @@ function Yn({
1547
1548
  }) {
1548
1549
  const r = j(null);
1549
1550
  return t.youTubeId ? /* @__PURE__ */ A("div", { className: "video-container", part: "video-container", onClick: n, children: [
1550
- /* @__PURE__ */ c("style", { children: `
1551
+ /* @__PURE__ */ l("style", { children: `
1551
1552
  .video-container {
1552
1553
  position: absolute;
1553
1554
  top: 0;
@@ -1566,7 +1567,7 @@ function Yn({
1566
1567
  object-fit: contain;
1567
1568
  }
1568
1569
  ` }),
1569
- /* @__PURE__ */ c(
1570
+ /* @__PURE__ */ l(
1570
1571
  "iframe",
1571
1572
  {
1572
1573
  className: "video-yt",
@@ -1599,9 +1600,9 @@ function et({
1599
1600
  isStatic: o,
1600
1601
  renderViewerControls: a,
1601
1602
  renderMediaControls: s,
1602
- viewControlsDeps: l,
1603
+ viewControlsDeps: u,
1603
1604
  mediaControlsDeps: d,
1604
- strategies: u,
1605
+ strategies: c,
1605
1606
  throwOnUnknown: f,
1606
1607
  backgroundStyle: p,
1607
1608
  alwaysShowBackground: v,
@@ -1611,8 +1612,8 @@ function et({
1611
1612
  onClickPaintingAnnotation: x,
1612
1613
  children: I
1613
1614
  }) {
1614
- const b = $(), W = Ue(b, ["deep-zoom"]), [Z] = Xt(), E = nn(), M = T(), k = y(() => Me(M), [M]), [h, U] = Rn({
1615
- strategies: u || ["images"],
1615
+ const b = $(), W = De(b, ["deep-zoom"]), [Z] = Xt(), E = nn(), M = T(), k = y(() => Me(M), [M]), [h, D] = Rn({
1616
+ strategies: c || ["images"],
1616
1617
  defaultChoices: i == null ? void 0 : i.map(({ id: S }) => S)
1617
1618
  }), ve = h.type === "images" ? h.choice : void 0, tt = y(() => m ? 1 : Math.max(
1618
1619
  1,
@@ -1622,7 +1623,7 @@ function et({
1622
1623
  }) : []
1623
1624
  ), [m, h]);
1624
1625
  rn(tt), N(() => {
1625
- r && r(U);
1626
+ r && r(D);
1626
1627
  }, [h.annotations]), N(() => {
1627
1628
  if (i)
1628
1629
  for (const S of i)
@@ -1639,19 +1640,19 @@ function et({
1639
1640
  value: E || null,
1640
1641
  children: a(h)
1641
1642
  } : {},
1642
- [b, E, h, ...l || []]
1643
+ [b, E, h, ...u || []]
1643
1644
  );
1644
- const D = On({ maxWidth: 256, maxHeight: 256 });
1645
+ const _ = On({ maxWidth: 256, maxHeight: 256 });
1645
1646
  if (!b)
1646
1647
  return null;
1647
- const ye = b.accompanyingCanvas, G = D && D.type === "fixed" ? /* @__PURE__ */ c("world-object", { height: b.height, width: b.width, x: e, y: t, children: /* @__PURE__ */ c(
1648
+ const ye = b.accompanyingCanvas, G = _ && _.type === "fixed" ? /* @__PURE__ */ l("world-object", { height: b.height, width: b.width, x: e, y: t, children: /* @__PURE__ */ l(
1648
1649
  "world-image",
1649
1650
  {
1650
- uri: D.id,
1651
+ uri: _.id,
1651
1652
  target: { x: 0, y: 0, width: b.width, height: b.height },
1652
- display: D.width && D.height ? {
1653
- width: D.width,
1654
- height: D.height
1653
+ display: _.width && _.height ? {
1654
+ width: _.width,
1655
+ height: _.height
1655
1656
  } : void 0,
1656
1657
  crop: void 0
1657
1658
  }
@@ -1664,8 +1665,8 @@ function et({
1664
1665
  return null;
1665
1666
  }
1666
1667
  const xe = /* @__PURE__ */ A(te, { children: [
1667
- Z ? /* @__PURE__ */ c(fe, { page: Z }) : null,
1668
- h.annotations && h.annotations.pages ? h.annotations.pages.map((S) => /* @__PURE__ */ c(fe, { page: S }, S.id)) : null,
1668
+ Z ? /* @__PURE__ */ l(fe, { page: Z }) : null,
1669
+ h.annotations && h.annotations.pages ? h.annotations.pages.map((S) => /* @__PURE__ */ l(fe, { page: S }, S.id)) : null,
1669
1670
  I
1670
1671
  ] }), nt = h.type === "images" ? h.images.length : 0;
1671
1672
  return /* @__PURE__ */ A(H, { children: [
@@ -1678,18 +1679,18 @@ function et({
1678
1679
  y: t,
1679
1680
  ...W,
1680
1681
  children: [
1681
- h.type === "empty" || v ? /* @__PURE__ */ c(Ze, { style: p }) : null,
1682
+ h.type === "empty" || v ? /* @__PURE__ */ l(Ze, { style: p }) : null,
1682
1683
  h.type === "textual-content" ? h.items.map((S, B) => {
1683
1684
  var Q;
1684
1685
  return /* @__PURE__ */ A(H, { children: [
1685
- /* @__PURE__ */ c(
1686
+ /* @__PURE__ */ l(
1686
1687
  lt,
1687
1688
  {
1688
1689
  onClick: x ? (we) => {
1689
1690
  we.stopPropagation(), x(S.annotationId, S, we);
1690
1691
  } : void 0,
1691
1692
  target: ((Q = S.target) == null ? void 0 : Q.spatial) || void 0,
1692
- children: /* @__PURE__ */ c("div", { "data-textual-content": !0, children: /* @__PURE__ */ c(Hn, { enableDangerouslySetInnerHTML: !0, children: S.text }) })
1693
+ children: /* @__PURE__ */ l("div", { "data-textual-content": !0, children: /* @__PURE__ */ l(Hn, { enableDangerouslySetInnerHTML: !0, children: S.text }) })
1693
1694
  },
1694
1695
  B
1695
1696
  ),
@@ -1697,13 +1698,13 @@ function et({
1697
1698
  ] });
1698
1699
  }) : null,
1699
1700
  h.type === "images" ? /* @__PURE__ */ A(H, { children: [
1700
- h.images.map((S, B) => /* @__PURE__ */ c(
1701
+ h.images.map((S, B) => /* @__PURE__ */ l(
1701
1702
  je,
1702
1703
  {
1703
1704
  isStatic: o,
1704
1705
  image: S,
1705
1706
  id: S.id,
1706
- thumbnail: B === 0 ? D : void 0,
1707
+ thumbnail: B === 0 ? _ : void 0,
1707
1708
  selector: S.selector,
1708
1709
  enableSizes: g,
1709
1710
  onClick: x ? (Q) => {
@@ -1714,8 +1715,8 @@ function et({
1714
1715
  )),
1715
1716
  xe
1716
1717
  ] }) : null,
1717
- h.type === "3d-model" ? /* @__PURE__ */ c(Je, { model: h.model }) : null,
1718
- h.type === "media" ? /* @__PURE__ */ c(H, { children: h.media.type === "Sound" ? /* @__PURE__ */ A(Ke, { media: h.media, mediaControlsDeps: d, children: [
1718
+ h.type === "3d-model" ? /* @__PURE__ */ l(Je, { model: h.model }) : null,
1719
+ h.type === "media" ? /* @__PURE__ */ l(H, { children: h.media.type === "Sound" ? /* @__PURE__ */ A(Ke, { media: h.media, mediaControlsDeps: d, children: [
1719
1720
  G,
1720
1721
  s ? s(h) : null
1721
1722
  ] }) : h.media.type === "Video" ? /* @__PURE__ */ A(Ge, { media: h.media, mediaControlsDeps: d, children: [
@@ -1729,7 +1730,7 @@ function et({
1729
1730
  },
1730
1731
  `${b.id}/${h.type}/${nt}`
1731
1732
  ),
1732
- h.type === "media" && h.media.type === "Sound" && ye ? /* @__PURE__ */ c(ge, { canvas: ye.id, children: /* @__PURE__ */ c(et, { renderViewerControls: a }) }) : null
1733
+ h.type === "media" && h.media.type === "Sound" && ye ? /* @__PURE__ */ l(ge, { canvas: ye.id, children: /* @__PURE__ */ l(et, { renderViewerControls: a }) }) : null
1733
1734
  ] });
1734
1735
  }
1735
1736
  function Kn() {
@@ -1739,23 +1740,23 @@ function Kn() {
1739
1740
  const Wn = Ae(function(t, n) {
1740
1741
  const r = K(), i = Re(), o = Mt(), { ViewerControls: a, MediaControls: s } = t.components || {};
1741
1742
  if (it(n, () => o, [o]), !r)
1742
- return /* @__PURE__ */ c("div", {});
1743
- let l = 0;
1743
+ return /* @__PURE__ */ l("div", {});
1744
+ let u = 0;
1744
1745
  return /* @__PURE__ */ A(H, { children: [
1745
1746
  t.header,
1746
- /* @__PURE__ */ c(
1747
+ /* @__PURE__ */ l(
1747
1748
  O.Viewer,
1748
1749
  {
1749
1750
  height: t.height,
1750
1751
  mode: t.mode,
1751
- children: i.map((d, u) => {
1752
- const f = l;
1753
- return l += d.width + (t.spacing || 0), /* @__PURE__ */ c(ge, { canvas: d.id, children: /* @__PURE__ */ c(
1752
+ children: i.map((d, c) => {
1753
+ const f = u;
1754
+ return u += d.width + (t.spacing || 0), /* @__PURE__ */ l(ge, { canvas: d.id, children: /* @__PURE__ */ l(
1754
1755
  O.RenderCanvas,
1755
1756
  {
1756
1757
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
1757
- renderViewerControls: u === 0 && a ? () => /* @__PURE__ */ c(a, {}) : void 0,
1758
- renderMediaControls: u === 0 && s ? () => /* @__PURE__ */ c(s, {}) : void 0,
1758
+ renderViewerControls: c === 0 && a ? () => /* @__PURE__ */ l(a, {}) : void 0,
1759
+ renderMediaControls: c === 0 && s ? () => /* @__PURE__ */ l(s, {}) : void 0,
1759
1760
  x: f,
1760
1761
  ...t.canvasProps || {},
1761
1762
  children: t.annotations
@@ -1768,19 +1769,19 @@ const Wn = Ae(function(t, n) {
1768
1769
  ),
1769
1770
  t.children
1770
1771
  ] });
1771
- }), O = Ae(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: l, ...d }, u) {
1772
+ }), O = Ae(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: u, ...d }, c) {
1772
1773
  const f = Kn();
1773
- return /* @__PURE__ */ c(Te, { vault: f, children: /* @__PURE__ */ c(It, { ...d, children: /* @__PURE__ */ c(
1774
+ return /* @__PURE__ */ l(Te, { vault: f, children: /* @__PURE__ */ l(It, { ...d, children: /* @__PURE__ */ l(
1774
1775
  Wn,
1775
1776
  {
1776
- ref: u,
1777
+ ref: c,
1777
1778
  height: n,
1778
1779
  components: s,
1779
1780
  spacing: o,
1780
1781
  canvasProps: i,
1781
1782
  annotations: r,
1782
1783
  header: a,
1783
- mode: l,
1784
+ mode: u,
1784
1785
  children: t
1785
1786
  }
1786
1787
  ) }) });
@@ -1788,7 +1789,7 @@ const Wn = Ae(function(t, n) {
1788
1789
  O.RenderImage = je;
1789
1790
  O.RenderCanvas = et;
1790
1791
  O.RenderAnnotationPage = fe;
1791
- O.RenderAnnotation = De;
1792
+ O.RenderAnnotation = _e;
1792
1793
  O.Viewer = on;
1793
1794
  O.CanvasBackground = Ze;
1794
1795
  O.Audio = Ke;