react-iiif-vault 1.0.8 → 1.0.10

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.
Files changed (67) hide show
  1. package/.build/types/canvas-panel/Viewer.d.ts +1 -1
  2. package/.build/types/canvas-panel/index.d.ts +2 -1
  3. package/.build/types/canvas-panel/render/Audio.d.ts +1 -1
  4. package/.build/types/canvas-panel/render/Canvas.d.ts +2 -2
  5. package/.build/types/canvas-panel/render/CanvasBackground.d.ts +1 -1
  6. package/.build/types/canvas-panel/render/DefaultCanvasFallback.d.ts +1 -1
  7. package/.build/types/canvas-panel/render/Image.d.ts +1 -1
  8. package/.build/types/canvas-panel/render/Model.d.ts +1 -1
  9. package/.build/types/canvas-panel/render/Video.d.ts +1 -1
  10. package/.build/types/canvas-panel/render/VideoYouTube.d.ts +1 -1
  11. package/.build/types/components/CanvasAnnotations.d.ts +10 -0
  12. package/.build/types/components/CombinedMetadata.d.ts +4 -0
  13. package/.build/types/components/Image.d.ts +15 -0
  14. package/.build/types/components/ManifestMetadata.d.ts +4 -0
  15. package/.build/types/components/Metadata.d.ts +39 -0
  16. package/.build/types/components/SequenceThumbnails.d.ts +29 -0
  17. package/.build/types/components/SingleCanvasThumbnail.d.ts +20 -0
  18. package/.build/types/context/AnnotationContext.d.ts +1 -1
  19. package/.build/types/context/AnnotationPageContext.d.ts +1 -1
  20. package/.build/types/context/CanvasContext.d.ts +1 -1
  21. package/.build/types/context/CollectionContext.d.ts +1 -1
  22. package/.build/types/context/ContextBridge.d.ts +1 -1
  23. package/.build/types/context/ManifestContext.d.ts +1 -1
  24. package/.build/types/context/MediaContext.d.ts +1 -1
  25. package/.build/types/context/RangeContext.d.ts +1 -1
  26. package/.build/types/context/ResourceContext.d.ts +2 -2
  27. package/.build/types/context/VaultContext.d.ts +1 -1
  28. package/.build/types/demo/media-controls.d.ts +1 -1
  29. package/.build/types/demo/viewer-controls.d.ts +1 -1
  30. package/.build/types/features/rendering-strategy/3d-strategy.d.ts +1 -1
  31. package/.build/types/features/rendering-strategy/image-strategy.d.ts +1 -1
  32. package/.build/types/features/rendering-strategy/resource-types.d.ts +7 -7
  33. package/.build/types/features/rendering-strategy/strategies.d.ts +5 -5
  34. package/.build/types/features/rendering-strategy/textual-content-strategy.d.ts +1 -1
  35. package/.build/types/hooks/useEventListener.d.ts +1 -1
  36. package/.build/types/hooks/useExistingVault.d.ts +2 -1
  37. package/.build/types/hooks/useExternalResource.d.ts +1 -1
  38. package/.build/types/hooks/useImage.d.ts +10 -0
  39. package/.build/types/hooks/useLoadImageService.d.ts +1 -1
  40. package/.build/types/hooks/useRenderingStrategy.d.ts +3 -3
  41. package/.build/types/hooks/useSimpleMediaPlayer.d.ts +2 -2
  42. package/.build/types/hooks/useVirtualAnnotationPageContext.d.ts +81 -81
  43. package/.build/types/index.d.ts +8 -0
  44. package/.build/types/utility/i18n-utils.d.ts +8 -6
  45. package/.build/types/viewers/SimpleViewerContext.d.ts +2 -2
  46. package/.build/types/viewers/SimpleViewerContext.hooks.d.ts +2 -0
  47. package/.build/types/viewers/SimpleViewerContext.types.d.ts +8 -4
  48. package/README.md +495 -177
  49. package/dist/bundle/cjs/index.js +7 -6
  50. package/dist/bundle/cjs/index.js.map +1 -1
  51. package/dist/bundle/esm/index.mjs +2391 -1186
  52. package/dist/bundle/esm/index.mjs.map +1 -1
  53. package/dist/canvas-panel/cjs/canvas-panel.js +5 -5
  54. package/dist/canvas-panel/cjs/canvas-panel.js.map +1 -1
  55. package/dist/canvas-panel/esm/canvas-panel.mjs +596 -547
  56. package/dist/canvas-panel/esm/canvas-panel.mjs.map +1 -1
  57. package/dist/index.umd.js +78 -76
  58. package/dist/index.umd.js.map +1 -1
  59. package/dist/react17/cjs/index.js +7 -6
  60. package/dist/react17/cjs/index.js.map +1 -1
  61. package/dist/react17/esm/index.mjs +2391 -1186
  62. package/dist/react17/esm/index.mjs.map +1 -1
  63. package/dist/utils/cjs/utils.js +1 -1
  64. package/dist/utils/cjs/utils.js.map +1 -1
  65. package/dist/utils/esm/utils.mjs +21 -21
  66. package/dist/utils/esm/utils.mjs.map +1 -1
  67. package/package.json +24 -22
@@ -1,116 +1,137 @@
1
- import { jsx as l, jsxs as A, Fragment as H } from "react/jsx-runtime";
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 U, useRef as j, useLayoutEffect as Ce, Fragment as te, useReducer as rt, forwardRef as Ae, useImperativeHandle as it } from "react";
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
- import { globalVault as Ie, Vault as Se } from "@iiif/helpers/vault";
6
- import { createStylesHelper as Me } from "@iiif/helpers/styles";
1
+ import { jsx as u, jsxs as I, Fragment as $ } from "react/jsx-runtime";
2
+ import B, { createContext as F, Component as rt, createElement as Pe, isValidElement as it, useContext as T, useMemo as y, useState as L, useEffect as N, useCallback as P, useRef as q, useLayoutEffect as Ie, Fragment as te, useReducer as ot, forwardRef as Me, useImperativeHandle as at } from "react";
3
+ import { AtlasAuto as st, ModeContext as ut, mergeStyles as ct, RegionHighlight as lt, TileSet as dt, HTMLPortal as ft } from "@atlas-viewer/atlas";
4
+ import { globalVault as Ae, Vault as be } from "@iiif/helpers/vault";
5
+ import { createStylesHelper as Te } from "@iiif/helpers/styles";
7
6
  import { expandTarget as le } from "@iiif/helpers/annotation-targets";
8
- import { expandTarget as dt } from "@iiif/helpers";
9
- import { ImageServiceLoader as ft, getImageServices as ht } from "@atlas-viewer/iiif-image-api";
10
- import { createThumbnailHelper as gt } from "@iiif/helpers/thumbnail";
11
- function de(e, t) {
12
- return de = Object.setPrototypeOf || function(r, i) {
13
- return r.__proto__ = i, r;
14
- }, de(e, t);
15
- }
16
- function mt(e, t) {
17
- e.prototype = Object.create(t.prototype), e.prototype.constructor = e, de(e, t);
18
- }
19
- var pt = function(t, n) {
20
- return t === void 0 && (t = []), n === void 0 && (n = []), t.length !== n.length || t.some(function(r, i) {
21
- return !Object.is(r, n[i]);
22
- });
23
- }, Pe = {
7
+ import { expandTarget as ht } from "@iiif/helpers";
8
+ import { ImageServiceLoader as gt, getImageServices as mt } from "@atlas-viewer/iiif-image-api";
9
+ import { createThumbnailHelper as vt } from "@iiif/helpers/thumbnail";
10
+ const pt = F(null), se = {
11
+ didCatch: !1,
24
12
  error: null
25
- }, vt = /* @__PURE__ */ function(e) {
26
- mt(t, e);
27
- function t() {
28
- for (var r, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
29
- o[a] = arguments[a];
30
- return r = e.call.apply(e, [this].concat(o)) || this, r.state = Pe, r.resetErrorBoundary = function() {
31
- for (var s, u = arguments.length, d = new Array(u), c = 0; c < u; c++)
32
- d[c] = arguments[c];
33
- r.props.onReset == null || (s = r.props).onReset.apply(s, d), r.reset();
34
- }, r;
13
+ };
14
+ class yt extends rt {
15
+ constructor(t) {
16
+ super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = se;
35
17
  }
36
- t.getDerivedStateFromError = function(i) {
18
+ static getDerivedStateFromError(t) {
37
19
  return {
38
- error: i
20
+ didCatch: !0,
21
+ error: t
39
22
  };
40
- };
41
- var n = t.prototype;
42
- return n.reset = function() {
43
- this.setState(Pe);
44
- }, n.componentDidCatch = function(i, o) {
45
- var a, s;
46
- (a = (s = this.props).onError) == null || a.call(s, i, o);
47
- }, n.componentDidUpdate = function(i, o) {
48
- var a = this.state.error, s = this.props.resetKeys;
49
- if (a !== null && o.error !== null && pt(i.resetKeys, s)) {
50
- var u, d;
51
- (u = (d = this.props).onResetKeysChange) == null || u.call(d, i.resetKeys, s), this.reset();
23
+ }
24
+ resetErrorBoundary() {
25
+ const {
26
+ error: t
27
+ } = this.state;
28
+ if (t !== null) {
29
+ for (var n, r, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
30
+ o[a] = arguments[a];
31
+ (n = (r = this.props).onReset) === null || n === void 0 || n.call(r, {
32
+ args: o,
33
+ reason: "imperative-api"
34
+ }), this.setState(se);
35
+ }
36
+ }
37
+ componentDidCatch(t, n) {
38
+ var r, i;
39
+ (r = (i = this.props).onError) === null || r === void 0 || r.call(i, t, n);
40
+ }
41
+ componentDidUpdate(t, n) {
42
+ const {
43
+ didCatch: r
44
+ } = this.state, {
45
+ resetKeys: i
46
+ } = this.props;
47
+ if (r && n.error !== null && xt(t.resetKeys, i)) {
48
+ var o, a;
49
+ (o = (a = this.props).onReset) === null || o === void 0 || o.call(a, {
50
+ next: i,
51
+ prev: t.resetKeys,
52
+ reason: "keys"
53
+ }), this.setState(se);
52
54
  }
53
- }, n.render = function() {
54
- var i = this.state.error, o = this.props, a = o.fallbackRender, s = o.FallbackComponent, u = o.fallback;
55
- if (i !== null) {
56
- var d = {
57
- error: i,
55
+ }
56
+ render() {
57
+ const {
58
+ children: t,
59
+ fallbackRender: n,
60
+ FallbackComponent: r,
61
+ fallback: i
62
+ } = this.props, {
63
+ didCatch: o,
64
+ error: a
65
+ } = this.state;
66
+ let s = t;
67
+ if (o) {
68
+ const c = {
69
+ error: a,
58
70
  resetErrorBoundary: this.resetErrorBoundary
59
71
  };
60
- if (/* @__PURE__ */ se.isValidElement(u))
61
- return u;
62
- if (typeof a == "function")
63
- return a(d);
64
- if (s)
65
- return /* @__PURE__ */ se.createElement(s, d);
66
- throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
72
+ if (typeof n == "function")
73
+ s = n(c);
74
+ else if (r)
75
+ s = Pe(r, c);
76
+ else if (i === null || it(i))
77
+ s = i;
78
+ else
79
+ throw a;
67
80
  }
68
- return this.props.children;
69
- }, t;
70
- }(se.Component);
71
- const yt = {
81
+ return Pe(pt.Provider, {
82
+ value: {
83
+ didCatch: o,
84
+ error: a,
85
+ resetErrorBoundary: this.resetErrorBoundary
86
+ }
87
+ }, s);
88
+ }
89
+ }
90
+ function xt() {
91
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
92
+ return e.length !== t.length || e.some((n, r) => !Object.is(n, t[r]));
93
+ }
94
+ const wt = {
72
95
  collection: void 0,
73
96
  manifest: void 0,
74
97
  range: void 0,
75
98
  canvas: void 0,
76
99
  annotation: void 0,
77
100
  annotationPage: void 0
78
- }, he = q.createContext(yt), z = () => R(he);
101
+ }, fe = B.createContext(wt), z = () => T(fe);
79
102
  function re({ value: e, children: t }) {
80
103
  const n = z(), r = y(() => ({
81
104
  ...n,
82
105
  ...e
83
106
  }), [e, n]);
84
- return /* @__PURE__ */ l(he.Provider, { value: r, children: t });
107
+ return /* @__PURE__ */ u(fe.Provider, { value: r, children: t });
85
108
  }
86
- const ie = q.createContext({
109
+ const ie = B.createContext({
87
110
  vault: null,
88
111
  setVaultInstance: (e) => {
89
112
  }
90
113
  });
91
- function Te({
114
+ function he({
92
115
  vault: e,
93
116
  vaultOptions: t,
94
117
  useGlobal: n,
95
118
  resources: r,
96
119
  children: i
97
120
  }) {
98
- const [o, a] = L(() => e || (n ? Ie(t) : t ? new Se(t) : new Se()));
99
- return /* @__PURE__ */ l(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ l(re, { value: r || {}, children: i }) });
121
+ const [o, a] = L(() => e || (n ? Ae(t) : t ? new be(t) : new be()));
122
+ return /* @__PURE__ */ u(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ u(re, { value: r || {}, children: i }) });
100
123
  }
101
- const T = () => {
102
- const { vault: e } = R(ie);
103
- if (e === null)
104
- throw new Error("Vault not found. Ensure you have your provider set up correctly.");
105
- return e;
106
- };
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), u = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, c] = L(u);
124
+ function ge(e) {
125
+ const t = T(ie);
126
+ return e || (t && t.vault ? t.vault : Ae());
127
+ }
128
+ function St(e, { noCache: t = !1 } = {}) {
129
+ const n = typeof e == "string" ? e : e.id, r = ge(), [i, o] = L(n), [a, s] = L(void 0), c = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, l] = L(c);
109
130
  return N(() => {
110
131
  (async () => {
111
132
  try {
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);
133
+ const f = c && !t ? c : await r.load(n), v = f ? f.id || f["@id"] : null;
134
+ f && i !== v && o(v), l(f);
114
135
  } catch (f) {
115
136
  s(f);
116
137
  }
@@ -121,24 +142,30 @@ function xt(e, { noCache: t = !1 } = {}) {
121
142
  requestId: n,
122
143
  error: a,
123
144
  resource: d,
124
- cached: !!(d && d === u)
145
+ cached: !!(d && d === c)
125
146
  };
126
147
  }
127
- function wt(e, t) {
128
- const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } = xt(
148
+ function Pt(e, t) {
149
+ const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } = St(
129
150
  e,
130
151
  t
131
152
  );
132
153
  return { id: n, isLoaded: r, error: i, manifest: o, requestId: a, cached: s };
133
154
  }
134
- function St({ manifest: e, children: t }) {
135
- return /* @__PURE__ */ l(re, { value: { manifest: e }, children: t });
155
+ function bt({ manifest: e, children: t }) {
156
+ return /* @__PURE__ */ u(re, { value: { manifest: e }, children: t });
136
157
  }
137
- function ge({ canvas: e, children: t }) {
138
- return /* @__PURE__ */ l(re, { value: { canvas: e }, children: t });
158
+ function me({ canvas: e, children: t }) {
159
+ return /* @__PURE__ */ u(re, { value: { canvas: e }, children: t });
139
160
  }
140
- function V(e, t = []) {
141
- const n = T(), [r, i] = L(() => e(n.getState(), n));
161
+ const O = () => {
162
+ const { vault: e } = T(ie);
163
+ if (e === null)
164
+ throw new Error("Vault not found. Ensure you have your provider set up correctly.");
165
+ return e;
166
+ };
167
+ function R(e, t = []) {
168
+ const n = O(), [r, i] = L(() => e(n.getState(), n));
142
169
  return N(() => n.subscribe(
143
170
  (o) => e(o, n),
144
171
  (o) => {
@@ -147,18 +174,18 @@ function V(e, t = []) {
147
174
  !1
148
175
  ), t), r;
149
176
  }
150
- const oe = q.createContext([]);
177
+ const oe = B.createContext([]);
151
178
  function Re() {
152
- const e = R(oe);
153
- return V(
179
+ const e = T(oe);
180
+ return R(
154
181
  (t) => e.map((n) => t.iiif.entities.Canvas[n]).filter(Boolean),
155
182
  [e]
156
183
  );
157
184
  }
158
185
  function K(e = {}, t = []) {
159
186
  const { id: n, selector: r } = e, i = z();
160
- T();
161
- const o = n || i.manifest, a = V(
187
+ O();
188
+ const o = n || i.manifest, a = R(
162
189
  (s) => o ? s.iiif.entities.Manifest[o] : void 0,
163
190
  [o]
164
191
  );
@@ -167,8 +194,8 @@ function K(e = {}, t = []) {
167
194
  return r ? r(a) : a;
168
195
  }, [a, r, ...t]);
169
196
  }
170
- function Pt({ range: e, children: t }) {
171
- return /* @__PURE__ */ l(re, { value: { range: e }, children: t });
197
+ function Ct({ range: e, children: t }) {
198
+ return /* @__PURE__ */ u(re, { value: { range: e }, children: t });
172
199
  }
173
200
  function Ve(e, t) {
174
201
  var r;
@@ -180,82 +207,84 @@ function Ve(e, t) {
180
207
  }
181
208
  return n;
182
209
  }
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"), u = t.type === "Manifest" ? t.items : Ve(e, t);
210
+ function Et(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
211
+ const i = t.behavior, o = i.includes("paged"), a = o ? !1 : i.includes("continuous"), s = o || a ? !1 : i.includes("individuals"), c = t.type === "Manifest" ? t.items : Ve(e, t);
185
212
  if (a)
186
- return [u, [u.map((m, g) => g)]];
213
+ return [c, [c.map((m, g) => g)]];
187
214
  if (s || !o || n)
188
- return [u, u.map((m, g) => [g])];
215
+ return [c, c.map((m, g) => [g])];
189
216
  const d = [];
190
- let c = [];
217
+ let l = [];
191
218
  const f = () => {
192
- c.length && (d.push([...c]), c = []);
219
+ l.length && (d.push([...l]), l = []);
193
220
  };
194
- let p = 0, v = !1;
195
- for (let m = 0; m < u.length; m++) {
196
- const g = e.get(u[m]);
221
+ let v = 0, p = !1;
222
+ for (let m = 0; m < c.length; m++) {
223
+ const g = e.get(c[m]);
197
224
  if (g.behavior.includes("non-paged")) {
198
- m === p && p++, r || (f(), d.push([m]), f());
225
+ m === v && v++, r || (f(), d.push([m]), f());
199
226
  continue;
200
227
  }
201
- if (m === p || g.behavior.includes("facing-pages")) {
202
- c.length && (v = !0), f(), d.push([m]), f();
228
+ if (m === v || g.behavior.includes("facing-pages")) {
229
+ l.length && (p = !0), f(), d.push([m]), f();
203
230
  continue;
204
231
  }
205
- if (c.push(m), v) {
206
- f(), v = !1;
232
+ if (l.push(m), p) {
233
+ f(), p = !1;
207
234
  continue;
208
235
  }
209
- c.length > 1 && f();
236
+ l.length > 1 && f();
210
237
  }
211
- return c.length && f(), [u, d];
238
+ return l.length && f(), [c, d];
212
239
  }
213
- function Et(e = {}, t = []) {
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]);
240
+ function It(e = {}, t = []) {
241
+ const { id: n, selector: r } = e, i = z(), o = n || i.range, a = R((s) => o ? s.iiif.entities.Range[o] : void 0, [o]);
215
242
  return y(() => {
216
243
  if (a)
217
244
  return r ? r(a) : a;
218
245
  }, [a, r, ...t]);
219
246
  }
220
- function Ct({ startCanvas: e, disablePaging: t }) {
247
+ function Mt({ startCanvas: e, disablePaging: t }) {
221
248
  var m;
222
- const n = T(), r = K(), i = Et(), [o, a] = L(void 0), s = i || r;
249
+ const n = O(), r = K(), i = It(), [o, a] = L(void 0), s = i || r;
223
250
  if (!s)
224
251
  throw new Error("Nothing selected");
225
- const [u, d] = y(
226
- () => bt(n, s, { disablePaging: t }),
227
- [n, s]
228
- ), c = P(
252
+ const [c, d] = y(
253
+ () => Et(n, s, { disablePaging: t }),
254
+ [n, s, t]
255
+ ), l = P(
229
256
  (g) => {
230
257
  const w = d.findIndex((x) => x.includes(g));
231
258
  a(w === -1 ? 0 : w);
232
259
  },
233
- [u, d]
260
+ [c, d]
234
261
  ), f = P(
235
262
  (g) => {
236
- const w = u.findIndex((x) => x.id === g);
237
- w !== -1 ? c(w) : a(0);
263
+ const w = c.findIndex((x) => x.id === g);
264
+ w !== -1 ? l(w) : a(0);
238
265
  },
239
- [u, d]
240
- ), p = P(() => {
241
- a((g) => g >= d.length ? g : g + 1);
242
- }, [d]), v = P(() => {
266
+ [c, d]
267
+ ), v = P(() => {
268
+ a((g) => g >= d.length - 1 ? g : g + 1);
269
+ }, [d]), p = P(() => {
243
270
  a((g) => g <= 0 ? 0 : g - 1);
244
271
  }, [d]);
245
272
  return typeof o > "u" && (e ? f(e) : a(0)), {
246
- visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) => u[g].id)) || [],
273
+ visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) => c[g].id)) || [],
247
274
  cursor: o,
248
- items: u,
275
+ items: c,
249
276
  sequence: d,
277
+ hasPrevious: o > 0,
278
+ hasNext: o < d.length - 1,
250
279
  setSequenceIndex: a,
251
- setCanvasIndex: c,
280
+ setCanvasIndex: l,
252
281
  setCanvasId: f,
253
- next: p,
254
- previous: v
282
+ next: v,
283
+ previous: p
255
284
  };
256
285
  }
257
286
  const J = () => {
258
- }, ae = U({
287
+ }, ae = F({
259
288
  setCurrentCanvasId: J,
260
289
  setCurrentCanvasIndex: J,
261
290
  nextCanvas: J,
@@ -263,55 +292,71 @@ const J = () => {
263
292
  items: [],
264
293
  sequence: [],
265
294
  setSequenceIndex: J,
266
- currentSequenceIndex: 0
295
+ currentSequenceIndex: 0,
296
+ hasNext: !1,
297
+ hasPrevious: !1
267
298
  });
268
299
  function At(e) {
269
- const t = K(), { cursor: n, visibleItems: r, next: i, sequence: o, items: a, setCanvasIndex: s, setCanvasId: u, previous: d, setSequenceIndex: c } = Ct({
300
+ const t = K(), {
301
+ cursor: n,
302
+ visibleItems: r,
303
+ next: i,
304
+ sequence: o,
305
+ items: a,
306
+ setCanvasIndex: s,
307
+ setCanvasId: c,
308
+ previous: d,
309
+ setSequenceIndex: l,
310
+ hasNext: f,
311
+ hasPrevious: v
312
+ } = Mt({
270
313
  startCanvas: e.startCanvas,
271
314
  disablePaging: e.pagingEnabled === !1
272
- }), f = y(
315
+ }), p = y(
273
316
  () => ({
274
317
  sequence: o,
275
318
  items: a,
276
319
  // Extra functions.
277
- setCurrentCanvasId: u,
320
+ setCurrentCanvasId: c,
278
321
  nextCanvas: i,
279
322
  previousCanvas: d,
280
323
  totalCanvases: a.length,
281
324
  setCurrentCanvasIndex: s,
282
- setSequenceIndex: c,
283
- currentSequenceIndex: n
325
+ setSequenceIndex: l,
326
+ currentSequenceIndex: n,
327
+ hasNext: f,
328
+ hasPrevious: v
284
329
  }),
285
- [o, a, u, i, d, a, s, c, n]
330
+ [o, a, c, i, d, a, s, l, n]
286
331
  );
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
- }
289
- function It(e) {
290
- const t = wt(e.manifest);
291
- if (!t)
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
- if (t.error)
294
- return /* @__PURE__ */ l("div", { children: t.error.toString() });
295
- if (!t.isLoaded)
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
- }
300
- function Mt() {
301
- return R(ae);
302
- }
303
- function Tt() {
332
+ return t ? r.length === 0 ? null : /* @__PURE__ */ u(ae.Provider, { value: p, children: /* @__PURE__ */ u(oe.Provider, { value: r, children: /* @__PURE__ */ u(me, { canvas: r[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ u("div", { children: "Sorry, something went wrong." }));
333
+ }
334
+ function Tt(e) {
335
+ const t = ge(e.vault), n = Pt(e.manifest);
336
+ if (!n)
337
+ return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ u("div", { children: "Sorry, something went wrong." });
338
+ if (n.error)
339
+ return /* @__PURE__ */ u("div", { children: n.error.toString() });
340
+ if (!n.isLoaded)
341
+ return /* @__PURE__ */ u("div", { children: "Loading..." });
342
+ const r = /* @__PURE__ */ u(At, { ...e, children: e.children });
343
+ return /* @__PURE__ */ u(he, { vault: t, children: /* @__PURE__ */ u(bt, { manifest: n.id, children: e.rangeId ? /* @__PURE__ */ u(Ct, { range: e.rangeId, children: r }) : r }) });
344
+ }
345
+ function Rt() {
346
+ return T(ae);
347
+ }
348
+ function Vt() {
304
349
  return {
305
- VaultContext: R(ie),
306
- ResourceContext: R(he),
307
- SimpleViewerReactContext: R(ae),
308
- VisibleCanvasReactContext: R(oe)
350
+ VaultContext: T(ie),
351
+ ResourceContext: T(fe),
352
+ SimpleViewerReactContext: T(ae),
353
+ VisibleCanvasReactContext: T(oe)
309
354
  };
310
355
  }
311
- function Rt(e) {
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 }) }) });
356
+ function Ot(e) {
357
+ return /* @__PURE__ */ u(he, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ u(oe.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ u(ae.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
313
358
  }
314
- const F = function(e) {
359
+ const U = function(e) {
315
360
  return function() {
316
361
  const t = { type: e, getType: () => e, toString: () => e };
317
362
  return (n, r) => ({
@@ -320,28 +365,28 @@ const F = function(e) {
320
365
  ...r !== void 0 && { meta: r }
321
366
  });
322
367
  };
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
- importEntities: qt,
368
+ }, Lt = "@iiif/IMPORT_ENTITIES", kt = "@iiif/MODIFY_ENTITY_FIELD", Nt = "@iiif/REORDER_ENTITY_FIELD", Ft = "@iiif/ADD_REFERENCE", Ut = "@iiif/UPDATE_REFERENCE", Dt = "@iiif/REMOVE_REFERENCE", _t = "@iiif/ADD_METADATA", qt = "@iiif/REMOVE_METADATA", Bt = "@iiif/UPDATE_METADATA", jt = "@iiif/REORDER_METADATA", Ht = U(Lt)(), $t = U(kt)(), Yt = U(Nt)(), zt = U(Ft)(), Kt = U(Dt)(), Wt = U(Ut)(), Gt = U(_t)(), Qt = U(Bt)(), Jt = U(qt)(), Zt = U(jt)(), ue = {
369
+ importEntities: Ht,
325
370
  modifyEntityField: $t,
326
- reorderEntityField: Bt,
327
- addReference: Ht,
328
- removeReference: Yt,
329
- updateReference: zt,
330
- addMetadata: Kt,
331
- removeMetadata: Gt,
332
- updateMetadata: Wt,
333
- reorderMetadata: Qt
371
+ reorderEntityField: Yt,
372
+ addReference: zt,
373
+ removeReference: Kt,
374
+ updateReference: Wt,
375
+ addMetadata: Gt,
376
+ removeMetadata: Jt,
377
+ updateMetadata: Qt,
378
+ reorderMetadata: Zt
334
379
  };
335
- function Jt() {
336
- const t = T().getStore();
380
+ function Xt() {
381
+ const t = O().getStore();
337
382
  return y(() => (n) => t.dispatch(n), [t]);
338
383
  }
339
- function be(e) {
384
+ function Ce(e) {
340
385
  return typeof e != "string" && e && e.bindToVault;
341
386
  }
342
- function Zt() {
343
- const e = T(), t = j([]), n = Jt(), r = y(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
344
- Ce(() => {
387
+ function en() {
388
+ const e = O(), t = q([]), n = Xt(), r = y(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
389
+ Ie(() => {
345
390
  const s = {
346
391
  id: r,
347
392
  type: "AnnotationPage",
@@ -369,19 +414,19 @@ function Zt() {
369
414
  })
370
415
  );
371
416
  }, [r]);
372
- const i = V(
417
+ const i = R(
373
418
  (s) => r ? s.iiif.entities.AnnotationPage[r] : null,
374
419
  [r]
375
420
  ), o = P(
376
- (s, u) => {
421
+ (s, c) => {
377
422
  if (r) {
378
- if (be(s)) {
423
+ if (Ce(s)) {
379
424
  const f = s;
380
425
  f.__vault || f.bindToVault(e), s = typeof f.source == "string" ? f.source : f.source.id, t.current[s] = f;
381
426
  } else
382
427
  typeof s != "string" && (s = s.id);
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(
428
+ const d = e.get({ id: r, type: "AnnotationPage" }), l = e.get({ id: s, type: "Annotation" });
429
+ d && l && (d.items.find((f) => f.id === l.id) || n(
385
430
  ue.addReference({
386
431
  id: r,
387
432
  type: "AnnotationPage",
@@ -390,7 +435,7 @@ function Zt() {
390
435
  id: s,
391
436
  type: "Annotation"
392
437
  },
393
- index: u
438
+ index: c
394
439
  })
395
440
  ));
396
441
  }
@@ -398,7 +443,7 @@ function Zt() {
398
443
  [r]
399
444
  ), a = P(
400
445
  (s) => {
401
- r && (be(s) ? s = typeof s.source == "string" ? s.source : s.source.id : typeof s != "string" && (s = s.id), t.current[s] && t.current[s].beforeRemove(), e.get({ id: r, type: "AnnotationPage" }) && n(
446
+ r && (Ce(s) ? s = typeof s.source == "string" ? s.source : s.source.id : typeof s != "string" && (s = s.id), t.current[s] && t.current[s].beforeRemove(), e.get({ id: r, type: "AnnotationPage" }) && n(
402
447
  ue.removeReference({
403
448
  id: r,
404
449
  type: "AnnotationPage",
@@ -420,9 +465,9 @@ function Zt() {
420
465
  }
421
466
  ];
422
467
  }
423
- const Oe = U(null);
424
- function Xt() {
425
- const e = R(Oe);
468
+ const Oe = F(null);
469
+ function tn() {
470
+ const e = T(Oe);
426
471
  return [
427
472
  e.fullPage,
428
473
  {
@@ -431,9 +476,9 @@ function Xt() {
431
476
  }
432
477
  ];
433
478
  }
434
- function en({ children: e }) {
435
- const [t, { addAnnotation: n, removeAnnotation: r }] = Zt();
436
- return /* @__PURE__ */ l(
479
+ function nn({ children: e }) {
480
+ const [t, { addAnnotation: n, removeAnnotation: r }] = en();
481
+ return /* @__PURE__ */ u(
437
482
  Oe.Provider,
438
483
  {
439
484
  value: y(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
@@ -441,91 +486,91 @@ function en({ children: e }) {
441
486
  }
442
487
  );
443
488
  }
444
- function tn({
489
+ function rn({
445
490
  width: e,
446
491
  style: t,
447
492
  height: n,
448
493
  error: r,
449
494
  resetErrorBoundary: i
450
495
  }) {
451
- return /* @__PURE__ */ A("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
452
- /* @__PURE__ */ l("h3", { children: "Error occurred" }),
453
- /* @__PURE__ */ l("p", { children: r.message }),
454
- /* @__PURE__ */ l("button", { onClick: i, children: "Reset" })
496
+ return /* @__PURE__ */ I("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
497
+ /* @__PURE__ */ u("h3", { children: "Error occurred" }),
498
+ /* @__PURE__ */ u("p", { children: r.message }),
499
+ /* @__PURE__ */ u("button", { onClick: i, children: "Reset" })
455
500
  ] });
456
501
  }
457
- const me = U(null);
458
- function nn() {
459
- return R(me);
502
+ const ve = F(null);
503
+ function on() {
504
+ return T(ve);
460
505
  }
461
- const Le = U(
506
+ const Le = F(
462
507
  () => {
463
508
  }
464
- ), ke = U(
509
+ ), ke = F(
465
510
  () => {
466
511
  }
467
512
  );
468
513
  function Y(e, t, n, r, i = []) {
469
- const o = R(e === "portal" ? ke : Le);
514
+ const o = T(e === "portal" ? ke : Le);
470
515
  N(() => (e !== "none" && o(t, n, r), () => {
471
516
  o(t, null);
472
517
  }), [t, e, o, ...i]);
473
518
  }
474
- function $(e = {}, t = []) {
475
- const { id: n, selector: r } = e, i = z(), o = n || i.canvas, a = V((s) => o ? s.iiif.entities.Canvas[o] : void 0, [o]);
519
+ function j(e = {}, t = []) {
520
+ const { id: n, selector: r } = e, i = z(), o = n || i.canvas, a = R((s) => o ? s.iiif.entities.Canvas[o] : void 0, [o]);
476
521
  return y(() => {
477
522
  if (a)
478
523
  return r ? r(a) : a;
479
524
  }, [a, r, ...t]);
480
525
  }
481
- const Ne = U(() => {
526
+ const Ne = F(() => {
482
527
  });
483
- function rn(e) {
484
- const t = $(), n = R(Ne);
528
+ function an(e) {
529
+ const t = j(), n = T(Ne);
485
530
  N(() => t && t.id ? (n(t.id, e), () => n(t.id, -1)) : () => {
486
531
  }, [t, e]);
487
532
  }
488
- function on({
533
+ function sn({
489
534
  children: e,
490
535
  errorFallback: t,
491
536
  outerContainerProps: n = {},
492
537
  worldScale: r,
493
538
  ...i
494
539
  }) {
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) => {
540
+ const [o, a] = L(), s = Vt(), c = t || rn, [d, l] = L({}), f = Object.entries(d), [v, p] = L({}), m = Object.entries(v), [g, w] = L({}), x = y(() => r || Math.max(...Object.values(g)), [g]), M = y(() => ({ maxOverZoom: x || 1, ...i.runtimeOptions || {} }), [x, i.runtimeOptions]), b = P((C, A) => {
496
541
  w((k) => {
497
- if (M === -1) {
498
- const { [E]: h, ...D } = k;
542
+ if (A === -1) {
543
+ const { [C]: h, ...D } = k;
499
544
  return D;
500
545
  }
501
- return { ...k, [E]: M };
546
+ return { ...k, [C]: A };
502
547
  });
503
- }, []), W = P((E, M, k) => {
504
- c(({ [E]: h, ...D }) => M ? {
548
+ }, []), W = P((C, A, k) => {
549
+ l(({ [C]: h, ...D }) => A ? {
505
550
  ...D,
506
- [E]: { element: M, props: k }
551
+ [C]: { element: A, props: k }
507
552
  } : D);
508
- }, []), Z = P((E, M, k) => {
509
- v(({ [E]: h, ...D }) => M ? {
553
+ }, []), Z = P((C, A, k) => {
554
+ p(({ [C]: h, ...D }) => A ? {
510
555
  ...D,
511
- [E]: { element: M, props: k }
556
+ [C]: { element: A, props: k }
512
557
  } : D);
513
558
  }, []);
514
- return /* @__PURE__ */ A(vt, { resetKeys: [], fallbackRender: (E) => /* @__PURE__ */ l(u, { ...i, ...E }), children: [
515
- /* @__PURE__ */ l(
516
- ot,
559
+ return /* @__PURE__ */ I(yt, { resetKeys: [], fallbackRender: (C) => /* @__PURE__ */ u(c, { ...i, ...C }), children: [
560
+ /* @__PURE__ */ u(
561
+ st,
517
562
  {
518
563
  ...i,
519
564
  containerProps: { style: { position: "relative" }, ...i.containerProps || {} },
520
- htmlChildren: /* @__PURE__ */ l(H, { children: f.map(([E, { element: M, props: k }]) => /* @__PURE__ */ l(q.Fragment, { children: /* @__PURE__ */ l(M, { ...k || {} }) }, E)) }),
521
- onCreated: (E) => {
522
- a(E), i.onCreated && i.onCreated(E);
565
+ htmlChildren: /* @__PURE__ */ u($, { children: f.map(([C, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, C)) }),
566
+ onCreated: (C) => {
567
+ a(C), i.onCreated && i.onCreated(C);
523
568
  },
524
- runtimeOptions: I,
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 }) }) }) }) }) }) })
569
+ runtimeOptions: M,
570
+ children: /* @__PURE__ */ u(ve.Provider, { value: o, children: /* @__PURE__ */ u(Ne.Provider, { value: b, children: /* @__PURE__ */ u(Le.Provider, { value: W, children: /* @__PURE__ */ u(ke.Provider, { value: Z, children: /* @__PURE__ */ u(Ot, { bridge: s, children: /* @__PURE__ */ u(ut.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ u(nn, { children: e }) }) }) }) }) }) })
526
571
  }
527
572
  ),
528
- /* @__PURE__ */ l("div", { children: m.map(([E, { element: M, props: k }]) => /* @__PURE__ */ l(q.Fragment, { children: /* @__PURE__ */ l(M, { ...k || {} }) }, E)) })
573
+ /* @__PURE__ */ u("div", { children: m.map(([C, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, C)) })
529
574
  ] });
530
575
  }
531
576
  const X = {}, Fe = {
@@ -548,7 +593,7 @@ const X = {}, Fe = {
548
593
  return t ? n[t] : n;
549
594
  }
550
595
  };
551
- function an(e = Fe) {
596
+ function un(e = Fe) {
552
597
  return {
553
598
  addEventListener(t, n, r, i) {
554
599
  if (t)
@@ -577,36 +622,36 @@ function an(e = Fe) {
577
622
  if (i && r)
578
623
  for (const a of Object.keys(i))
579
624
  o[a] = (s) => {
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);
625
+ const c = e.get(r);
626
+ for (const { callback: d, scope: l } of i[a] || [])
627
+ (!l || n && l.indexOf(n) !== -1) && d(s, c);
583
628
  };
584
629
  return o;
585
630
  }
586
631
  };
587
632
  }
588
- function De(e, t) {
589
- const n = T(), r = y(() => an(n), [n]), i = V(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
633
+ function Ue(e, t) {
634
+ const n = O(), r = y(() => un(n), [n]), i = R(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
590
635
  return y(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
591
636
  }
592
637
  function ne(e, t) {
593
- const n = T(), r = y(() => Me(n), [n]);
594
- return V(() => {
638
+ const n = O(), r = y(() => Te(n), [n]);
639
+ return R(() => {
595
640
  if (!e)
596
641
  return null;
597
642
  const i = r.getAppliedStyles(e.id);
598
643
  return i ? t ? i[t] : i : void 0;
599
644
  }, [e, t]);
600
645
  }
601
- function Ue(e = {}, t = []) {
602
- const { id: n, selector: r } = e, i = z(), o = T(), a = n || i.annotation, s = V(
646
+ function De(e = {}, t = []) {
647
+ const { id: n, selector: r } = e, i = z(), o = O(), a = n || i.annotation, s = R(
603
648
  (d) => a ? d.iiif.entities.Annotation[a] : void 0,
604
649
  [a]
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) : [],
650
+ ), c = R(
651
+ (d) => s && s.body ? s.body.map((l) => l ? l.type === "SpecificResource" ? {
652
+ ...l,
653
+ source: o.get(l)
654
+ } : l ? d.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
610
655
  [s]
611
656
  );
612
657
  return y(() => {
@@ -614,11 +659,11 @@ function Ue(e = {}, t = []) {
614
659
  return;
615
660
  const d = {
616
661
  ...s,
617
- body: u,
662
+ body: c,
618
663
  target: le(s.target, { typeMap: o.getState().iiif.mapping })
619
664
  };
620
665
  return r ? r(d) : d;
621
- }, [s, r, u, ...t]);
666
+ }, [s, r, c, ...t]);
622
667
  }
623
668
  const _e = ({
624
669
  id: e,
@@ -626,9 +671,9 @@ const _e = ({
626
671
  className: n,
627
672
  interactive: r
628
673
  }) => {
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
- ut,
674
+ const i = De({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Ue(i, ["atlas"]), c = j(), d = y(() => ct(t, o), [t, o]);
675
+ return c && i && i.target && i.target.selector && i.target.selector.type === "BoxSelector" && i.target.source && (i.target.source.id === c.id || i.target.source === c.id) ? /* @__PURE__ */ u(
676
+ lt,
632
677
  {
633
678
  id: i.id,
634
679
  isEditing: !0,
@@ -645,8 +690,8 @@ const _e = ({
645
690
  }
646
691
  ) : null;
647
692
  };
648
- function sn(e = {}, t = []) {
649
- const { id: n, selector: r } = e, i = z(), o = n || i.annotationPage, a = V(
693
+ function cn(e = {}, t = []) {
694
+ const { id: n, selector: r } = e, i = z(), o = n || i.annotationPage, a = R(
650
695
  (s) => o ? s.iiif.entities.AnnotationPage[o] : void 0,
651
696
  [o]
652
697
  );
@@ -655,13 +700,13 @@ function sn(e = {}, t = []) {
655
700
  return r ? r(a) : a;
656
701
  }, [a, ...t]);
657
702
  }
658
- const fe = ({
703
+ const de = ({
659
704
  className: e,
660
705
  page: t
661
706
  }) => {
662
707
  var o;
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__ */ l(te, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ l(
708
+ const n = cn({ id: t.id }) || t, r = ne(n, "atlas"), i = ne(n, "html");
709
+ return R((a) => n.id ? a.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ u(te, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ u(
665
710
  _e,
666
711
  {
667
712
  id: a.id,
@@ -671,7 +716,7 @@ const fe = ({
671
716
  a.id
672
717
  )) });
673
718
  };
674
- function je({
719
+ function qe({
675
720
  id: e,
676
721
  image: t,
677
722
  thumbnail: n,
@@ -680,25 +725,25 @@ function je({
680
725
  y: o = 0,
681
726
  children: a,
682
727
  selector: s,
683
- onClick: u,
728
+ onClick: c,
684
729
  enableSizes: d
685
730
  }) {
686
- var f, p;
687
- const c = y(() => {
731
+ var f, v;
732
+ const l = y(() => {
688
733
  if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
689
734
  return s.spatial;
690
735
  }, [s]);
691
- return /* @__PURE__ */ l(
736
+ return /* @__PURE__ */ u(
692
737
  "world-object",
693
738
  {
694
739
  x: i + t.target.spatial.x,
695
740
  y: o + t.target.spatial.y,
696
741
  width: t.target.spatial.width,
697
742
  height: t.target.spatial.height,
698
- onClick: u,
699
- children: t.service ? /* @__PURE__ */ A(te, { children: [
700
- /* @__PURE__ */ l(
701
- ct,
743
+ onClick: c,
744
+ children: t.service ? /* @__PURE__ */ I(te, { children: [
745
+ /* @__PURE__ */ u(
746
+ dt,
702
747
  {
703
748
  tiles: {
704
749
  id: t.service.id || t.service["@id"] || "unknown",
@@ -711,23 +756,23 @@ function je({
711
756
  x: 0,
712
757
  y: 0,
713
758
  width: (f = t.target) == null ? void 0 : f.spatial.width,
714
- height: (p = t.target) == null ? void 0 : p.spatial.height,
715
- crop: c
759
+ height: (v = t.target) == null ? void 0 : v.spatial.height,
760
+ crop: l
716
761
  }
717
762
  ),
718
763
  a
719
- ] }, "service") : /* @__PURE__ */ A(te, { children: [
720
- /* @__PURE__ */ l(
764
+ ] }, "service") : /* @__PURE__ */ I(te, { children: [
765
+ /* @__PURE__ */ u(
721
766
  "world-image",
722
767
  {
723
- onClick: u,
768
+ onClick: c,
724
769
  uri: t.id,
725
770
  target: { x: 0, y: 0, width: t.target.spatial.width, height: t.target.spatial.height },
726
771
  display: t.width && t.height ? {
727
772
  width: t.width,
728
773
  height: t.height
729
774
  } : void 0,
730
- crop: c
775
+ crop: l
731
776
  }
732
777
  ),
733
778
  a
@@ -736,8 +781,8 @@ function je({
736
781
  e + (t.service ? "server" : "no-service")
737
782
  );
738
783
  }
739
- function qe(e, t) {
740
- const { selector: n, source: r } = dt(t);
784
+ function Be(e, t) {
785
+ const { selector: n, source: r } = ht(t);
741
786
  if (r.id !== e.id)
742
787
  return [null, r];
743
788
  const i = {
@@ -758,17 +803,17 @@ function qe(e, t) {
758
803
  r
759
804
  ];
760
805
  }
761
- const un = {
806
+ const ln = {
762
807
  makeChoice: () => {
763
808
  }
764
- }, ce = { type: "unknown" }, C = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), cn = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
765
- function ln(e, t) {
809
+ }, ce = { type: "unknown" }, E = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), dn = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
810
+ function fn(e, t) {
766
811
  var r;
767
812
  const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
768
813
  return n ? n.annotationPageManager : null;
769
814
  }
770
- function dn(e, t) {
771
- return V(
815
+ function hn(e, t) {
816
+ return R(
772
817
  (n) => {
773
818
  const r = [];
774
819
  if (!e)
@@ -776,7 +821,7 @@ function dn(e, t) {
776
821
  const i = Object.keys(n.iiif.entities.AnnotationPage);
777
822
  for (const o of i)
778
823
  if (!t || t.indexOf(o) !== -1) {
779
- const a = ln(n, o);
824
+ const a = fn(n, o);
780
825
  a && a.views && a.views[e] && r.push(o);
781
826
  }
782
827
  return r;
@@ -784,7 +829,7 @@ function dn(e, t) {
784
829
  [e, t]
785
830
  );
786
831
  }
787
- function fn({
832
+ function gn({
788
833
  canvas: e,
789
834
  manifest: t,
790
835
  all: n,
@@ -804,21 +849,21 @@ function fn({
804
849
  i.indexOf(o.id) === -1 && i.push(o.id);
805
850
  return i;
806
851
  }
807
- function hn(e, t) {
852
+ function mn(e, t) {
808
853
  var r;
809
854
  const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
810
855
  return n ? n.annotationPageManager : null;
811
856
  }
812
- function gn(e, t = {}) {
813
- const n = T(), r = K(), i = $(), o = Re(), a = y(() => fn({
857
+ function vn(e, t = {}) {
858
+ const n = O(), r = K(), i = j(), o = Re(), a = y(() => gn({
814
859
  all: t.all,
815
860
  manifest: r,
816
861
  canvas: i,
817
862
  canvases: o
818
- }), [t.all, i, o, r]), s = dn(e, t.all ? void 0 : a), u = P(
819
- (c) => {
863
+ }), [t.all, i, o, r]), s = hn(e, t.all ? void 0 : a), c = P(
864
+ (l) => {
820
865
  e && n.setMetaValue(
821
- [c, "annotationPageManager", "views"],
866
+ [l, "annotationPageManager", "views"],
822
867
  (f) => f && !f[e] ? f : {
823
868
  ...f || {},
824
869
  [e]: !1
@@ -827,67 +872,67 @@ function gn(e, t = {}) {
827
872
  },
828
873
  [e, n]
829
874
  ), d = P(
830
- (c, f = {}) => {
875
+ (l, f = {}) => {
831
876
  if (!e)
832
877
  return;
833
- const p = n.getState(), v = [];
878
+ const v = n.getState(), p = [];
834
879
  if (f != null && f.deselectOthers) {
835
- const m = Object.keys(p.iiif.entities.AnnotationPage);
880
+ const m = Object.keys(v.iiif.entities.AnnotationPage);
836
881
  for (const g of m) {
837
- const w = hn(p, g);
838
- w && w.views && w.views[e] && v.push(g);
882
+ const w = mn(v, g);
883
+ w && w.views && w.views[e] && p.push(g);
839
884
  }
840
885
  }
841
- for (const m of v)
842
- u(m);
886
+ for (const m of p)
887
+ c(m);
843
888
  n.setMetaValue(
844
- [c, "annotationPageManager", "views"],
889
+ [l, "annotationPageManager", "views"],
845
890
  (m) => m && m[e] ? m : {
846
891
  ...m || {},
847
892
  [e]: !0
848
893
  }
849
894
  );
850
895
  },
851
- [e, u, n]
896
+ [e, c, n]
852
897
  );
853
898
  return {
854
899
  availablePageIds: a,
855
900
  enabledPageIds: s,
856
901
  setPageEnabled: d,
857
- setPageDisabled: u
902
+ setPageDisabled: c
858
903
  };
859
904
  }
860
- function mn(e, t) {
861
- return V((n, r) => r.get(e.map((i) => ({ id: i, type: t }))), [e, t]);
905
+ function pn(e, t) {
906
+ return R((n, r) => r.get(e.map((i) => ({ id: i, type: t }))), [e, t]);
862
907
  }
863
- const pn = q.createContext(new ft());
864
- function $e() {
865
- return R(pn);
908
+ const yn = B.createContext(new gt());
909
+ function je() {
910
+ return T(yn);
866
911
  }
867
- function vn() {
868
- const e = $e(), [t, n] = L({}), r = j(!1);
912
+ function xn() {
913
+ const e = je(), [t, n] = L({}), r = q(!1);
869
914
  return N(() => () => {
870
915
  r.current = !0;
871
916
  }, []), [P(
872
917
  (o, { height: a, width: s }) => {
873
918
  if (o) {
874
- const u = o.id || o["@id"], d = e.loadServiceSync({
875
- id: u,
919
+ const c = o.id || o["@id"], d = e.loadServiceSync({
920
+ id: c,
876
921
  width: o.width || s,
877
922
  height: o.height || a,
878
923
  source: o
879
924
  });
880
- d ? o = d : t[u] || (r.current || n((c) => ({
881
- ...c,
882
- [u]: "loading"
925
+ d ? o = d : t[c] || (r.current || n((l) => ({
926
+ ...l,
927
+ [c]: "loading"
883
928
  })), e.loadService({
884
- id: u,
929
+ id: c,
885
930
  width: o.width || s,
886
931
  height: o.height || a
887
932
  }).then(() => {
888
- r.current || n((c) => ({
889
- ...c,
890
- [u]: "done"
933
+ r.current || n((l) => ({
934
+ ...l,
935
+ [c]: "done"
891
936
  }));
892
937
  }));
893
938
  }
@@ -896,9 +941,9 @@ function vn() {
896
941
  [e, t]
897
942
  ), t];
898
943
  }
899
- function yn(e = {}) {
900
- const t = Ue(), n = $(e.canvasId ? { id: e.canvasId } : void 0);
901
- return V(
944
+ function wn(e = {}) {
945
+ const t = De(), n = j(e.canvasId ? { id: e.canvasId } : void 0);
946
+ return R(
902
947
  (r, i) => {
903
948
  if (!n)
904
949
  return [];
@@ -912,15 +957,15 @@ function yn(e = {}) {
912
957
  [n]
913
958
  );
914
959
  }
915
- function xn(e) {
960
+ function Sn(e) {
916
961
  return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
917
962
  }
918
- const ee = {}, Be = {
963
+ const ee = {}, He = {
919
964
  get(e) {
920
965
  return e;
921
966
  },
922
967
  setMetaValue([e, t, n], r) {
923
- const i = Be.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
968
+ const i = He.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
924
969
  ee[e] = {
925
970
  ...ee[e] || {},
926
971
  [t]: {
@@ -935,44 +980,44 @@ const ee = {}, Be = {
935
980
  return t ? n[t] : n;
936
981
  }
937
982
  };
938
- function wn(e = Be) {
983
+ function Pn(e = He) {
939
984
  function t(i) {
940
985
  const o = i ? typeof i == "string" ? e.get(i) : i : null;
941
986
  if (!o)
942
987
  return [];
943
988
  const a = e.get(o.items, { parent: o }), s = [];
944
- for (const u of a)
945
- s.push(...e.get(u.items, { parent: u }));
989
+ for (const c of a)
990
+ s.push(...e.get(c.items, { parent: c }));
946
991
  return s;
947
992
  }
948
993
  function n(i, o = []) {
949
994
  const a = Array.isArray(i) ? i : t(i), s = [];
950
- let u = null;
995
+ let c = null;
951
996
  const d = [];
952
- for (const c of a) {
953
- if (c.type !== "Annotation")
997
+ for (const l of a) {
998
+ if (l.type !== "Annotation")
954
999
  throw new Error("getPaintables() accept either a canvas or list of annotations");
955
- const f = Array.from(Array.isArray(c.body) ? c.body : [c.body]);
956
- for (const p of f) {
957
- const [v, { selector: m }] = xn(p), g = e.get(v), w = (g.type || "unknown").toLowerCase();
1000
+ const f = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
1001
+ for (const v of f) {
1002
+ const [p, { selector: m }] = Sn(v), g = e.get(p), w = (g.type || "unknown").toLowerCase();
958
1003
  if (w === "choice") {
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]), u = {
1004
+ const x = e.get(g.items, { parent: g.id }), M = o.length ? o.map((b) => x.find((W) => W.id === b)).filter(Boolean) : [x[0]];
1005
+ M.length === 0 && M.push(x[0]), c = {
961
1006
  type: "single-choice",
962
1007
  items: x.map((b) => ({
963
1008
  id: b.id,
964
1009
  label: b.label,
965
- selected: I.indexOf(b) !== -1
1010
+ selected: M.indexOf(b) !== -1
966
1011
  })),
967
- label: v.label
968
- }, f.push(...I);
1012
+ label: p.label
1013
+ }, f.push(...M);
969
1014
  continue;
970
1015
  }
971
1016
  s.indexOf(w) === -1 && s.push(w), d.push({
972
1017
  type: w,
973
- annotationId: c.id,
1018
+ annotationId: l.id,
974
1019
  resource: g,
975
- target: c.target,
1020
+ target: l.target,
976
1021
  selector: m
977
1022
  });
978
1023
  }
@@ -980,7 +1025,7 @@ function wn(e = Be) {
980
1025
  return {
981
1026
  types: s,
982
1027
  items: d,
983
- choice: u
1028
+ choice: c
984
1029
  };
985
1030
  }
986
1031
  function r(i) {
@@ -993,18 +1038,18 @@ function wn(e = Be) {
993
1038
  extractChoices: r
994
1039
  };
995
1040
  }
996
- function Sn(e, t = []) {
997
- const n = T(), r = y(() => wn(n), []), i = yn({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = L((e == null ? void 0 : e.defaultChoices) || []), s = y(
1041
+ function bn(e, t = []) {
1042
+ const n = O(), r = y(() => Pn(n), []), i = wn({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = L((e == null ? void 0 : e.defaultChoices) || []), s = y(
998
1043
  () => r.getPaintables(i, o),
999
1044
  [n, i, o, ...t]
1000
1045
  ), d = { makeChoice: P(
1001
- (c, { deselectOthers: f = !0, deselect: p = !1 } = {}) => {
1046
+ (l, { deselectOthers: f = !0, deselect: v = !1 } = {}) => {
1002
1047
  if (s.choice) {
1003
1048
  if (s.choice.type !== "single-choice")
1004
1049
  throw new Error("Complex choice not supported yet");
1005
- a((v) => {
1006
- if (p) {
1007
- const g = v.filter((w) => w !== c);
1050
+ a((p) => {
1051
+ if (v) {
1052
+ const g = p.filter((w) => w !== l);
1008
1053
  if (g.length === 0) {
1009
1054
  const w = s.items[0].resource.id;
1010
1055
  return w ? [w] : [];
@@ -1012,13 +1057,13 @@ function Sn(e, t = []) {
1012
1057
  return g;
1013
1058
  }
1014
1059
  if (f)
1015
- return [c];
1016
- const m = [...v];
1060
+ return [l];
1061
+ const m = [...p];
1017
1062
  if (m.length === 0 && s.items.length) {
1018
1063
  const g = s.items[0].resource.id;
1019
1064
  g && m.push(g);
1020
1065
  }
1021
- return v.indexOf(c) !== -1 ? v : [...v, c];
1066
+ return p.indexOf(l) !== -1 ? p : [...p, l];
1022
1067
  });
1023
1068
  }
1024
1069
  },
@@ -1026,20 +1071,20 @@ function Sn(e, t = []) {
1026
1071
  ) };
1027
1072
  return [s, d];
1028
1073
  }
1029
- const Pn = ["model/gltf-binary"];
1030
- function bn(e, t) {
1074
+ const Cn = ["model/gltf-binary"];
1075
+ function En(e, t) {
1031
1076
  const r = t.items[0].resource;
1032
- return r.format ? Pn.indexOf(r.format) === -1 ? C(`3D format: ${r.format} is unsupported`) : {
1077
+ return r.format ? Cn.indexOf(r.format) === -1 ? E(`3D format: ${r.format} is unsupported`) : {
1033
1078
  type: "3d-model",
1034
1079
  model: r
1035
- } : C("Unknown format");
1080
+ } : E("Unknown format");
1036
1081
  }
1037
- function En(e, t) {
1082
+ function In(e, t) {
1038
1083
  var r;
1039
1084
  if (!e.duration)
1040
- return C("No duration on canvas");
1085
+ return E("No duration on canvas");
1041
1086
  if (t.items.length > 1)
1042
- return C("Only one audio source supported");
1087
+ return E("Only one audio source supported");
1043
1088
  const n = (r = t.items[0]) == null ? void 0 : r.resource;
1044
1089
  return n ? n.format ? {
1045
1090
  type: "media",
@@ -1067,18 +1112,18 @@ function En(e, t) {
1067
1112
  annotations: {
1068
1113
  pages: []
1069
1114
  }
1070
- } : C("Audio does not have format") : C("Unknown audio");
1115
+ } : E("Audio does not have format") : E("Unknown audio");
1071
1116
  }
1072
- function Cn(e, t, n) {
1117
+ function Mn(e, t, n) {
1073
1118
  const r = [];
1074
1119
  for (const i of t.items) {
1075
1120
  const o = i.resource && i.resource.type === "SpecificResource" ? i.resource.source : i.resource;
1076
1121
  if (!o.id)
1077
- return C("No resource Identifier");
1122
+ return E("No resource Identifier");
1078
1123
  let a;
1079
1124
  if (o.service) {
1080
- const v = ht(o);
1081
- v[0] && (a = n(v[0], e));
1125
+ const p = mt(o);
1126
+ p[0] && (a = n(p[0], e));
1082
1127
  }
1083
1128
  const s = {
1084
1129
  type: "BoxSelector",
@@ -1088,41 +1133,41 @@ function Cn(e, t, n) {
1088
1133
  width: Number(e.width),
1089
1134
  height: Number(e.height)
1090
1135
  }
1091
- }, [u, d] = qe(e, i.target);
1092
- if (d.id !== e.id)
1136
+ }, [c, d] = Be(e, i.target);
1137
+ if (!(d.id === e.id || decodeURIComponent(d.id || "") === (e.id || "")))
1093
1138
  continue;
1094
1139
  i.resource.width && i.resource.height && (i.resource.width, i.resource.height);
1095
- let c = i.resource.type === "SpecificResource" ? le(i.resource) : null;
1140
+ let l = i.resource.type === "SpecificResource" ? le(i.resource) : null;
1096
1141
  if (i.selector) {
1097
- const v = le({
1142
+ const p = le({
1098
1143
  type: "SpecificResource",
1099
1144
  source: i.resource,
1100
1145
  selector: i.selector
1101
1146
  });
1102
- v && (c = v);
1147
+ p && (l = p);
1103
1148
  }
1104
- const f = c && c.selector && (c.selector.type === "BoxSelector" || c.selector.type === "TemporalBoxSelector") ? {
1149
+ const f = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
1105
1150
  type: "BoxSelector",
1106
1151
  spatial: {
1107
- x: c.selector.spatial.x,
1108
- y: c.selector.spatial.y,
1109
- width: c.selector.spatial.width,
1110
- height: c.selector.spatial.height
1152
+ x: l.selector.spatial.x,
1153
+ y: l.selector.spatial.y,
1154
+ width: l.selector.spatial.width,
1155
+ height: l.selector.spatial.height
1111
1156
  }
1112
1157
  } : void 0;
1113
1158
  a && !a.id && (a.id = a["@id"]);
1114
- const p = {
1159
+ const v = {
1115
1160
  id: o.id,
1116
1161
  type: "Image",
1117
1162
  annotationId: i.annotationId,
1118
- width: Number(u || f ? o.width : e.width),
1119
- height: Number(u || f ? o.height : e.height),
1163
+ width: Number(c || f ? o.width : e.width),
1164
+ height: Number(c || f ? o.height : e.height),
1120
1165
  service: a,
1121
1166
  sizes: a && a.sizes ? a.sizes : o.width && o.height ? [{ width: o.width, height: o.height }] : [],
1122
- target: u && u.type !== "PointSelector" ? u : s,
1167
+ target: c && c.type !== "PointSelector" ? c : s,
1123
1168
  selector: f
1124
1169
  };
1125
- r.push(p);
1170
+ r.push(v);
1126
1171
  }
1127
1172
  return {
1128
1173
  type: "images",
@@ -1131,7 +1176,7 @@ function Cn(e, t, n) {
1131
1176
  choice: t.choice
1132
1177
  };
1133
1178
  }
1134
- function He(e, t = {}, n) {
1179
+ function $e(e, t = {}, n) {
1135
1180
  const r = e.language || n || "none";
1136
1181
  switch (e.type) {
1137
1182
  case "TextualBody": {
@@ -1141,7 +1186,7 @@ function He(e, t = {}, n) {
1141
1186
  case "List":
1142
1187
  case "Composite":
1143
1188
  case "Choice":
1144
- e.items && e.items.forEach((i) => He(i, t, r));
1189
+ e.items && e.items.forEach((i) => $e(i, t, r));
1145
1190
  }
1146
1191
  return t;
1147
1192
  }
@@ -1149,30 +1194,30 @@ function An(e, t) {
1149
1194
  const n = [];
1150
1195
  return t.items.forEach((r) => {
1151
1196
  if (r.resource) {
1152
- const [i] = qe(e, r.target);
1153
- n.push({ annotationId: r.annotationId, text: He(r.resource), target: i });
1197
+ const [i] = Be(e, r.target);
1198
+ n.push({ annotationId: r.annotationId, text: $e(r.resource), target: i });
1154
1199
  }
1155
1200
  }), {
1156
1201
  type: "textual-content",
1157
1202
  items: n
1158
1203
  };
1159
1204
  }
1160
- const In = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1161
- function Mn(e, t) {
1205
+ const Tn = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1206
+ function Rn(e, t) {
1162
1207
  var s;
1163
- const n = t.items.filter((u) => u.type === "video");
1208
+ const n = t.items.filter((c) => c.type === "video");
1164
1209
  let r = !1;
1165
1210
  if (e.duration || (r = !0), n.length > 1)
1166
- return C("Only one video source supported");
1211
+ return E("Only one video source supported");
1167
1212
  const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
1168
- (u) => (u.profile || "").includes("youtube.com")
1213
+ (c) => (c.profile || "").includes("youtube.com")
1169
1214
  );
1170
1215
  if (!o && r)
1171
- return C("Video does not have duration");
1216
+ return E("Video does not have duration");
1172
1217
  if (!i)
1173
- return C("Unknown video");
1218
+ return E("Unknown video");
1174
1219
  if ((!i.format || i.format === "text/html") && !o)
1175
- return C("Video does not have format");
1220
+ return E("Video does not have format");
1176
1221
  const a = {
1177
1222
  annotationId: t.items[0].annotationId,
1178
1223
  duration: e.duration,
@@ -1197,10 +1242,10 @@ function Mn(e, t) {
1197
1242
  };
1198
1243
  if (o) {
1199
1244
  a.type = "VideoYouTube";
1200
- const u = i.id.match(In);
1201
- if (!u[1])
1202
- return C("Video is not known youtube video");
1203
- a.youTubeId = u[1];
1245
+ const c = i.id.match(Tn);
1246
+ if (!c[1])
1247
+ return E("Video is not known youtube video");
1248
+ a.youTubeId = c[1];
1204
1249
  }
1205
1250
  return {
1206
1251
  type: "media",
@@ -1210,62 +1255,62 @@ function Mn(e, t) {
1210
1255
  }
1211
1256
  };
1212
1257
  }
1213
- function Tn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
1258
+ function Vn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
1214
1259
  if (!e)
1215
1260
  return console.log("No canvas"), ce;
1216
1261
  if (t.types.length === 0)
1217
- return n.indexOf("empty") !== -1 ? cn(e.width, e.height) : (console.log("No paintables"), ce);
1262
+ return n.indexOf("empty") !== -1 ? dn(e.width, e.height) : (console.log("No paintables"), ce);
1218
1263
  if (t.types.length !== 1)
1219
1264
  if (t.types.length === 2 && t.types.indexOf("text") !== -1)
1220
1265
  t.types = t.types.filter((o) => o !== "text");
1221
1266
  else
1222
- return n.indexOf("complex-timeline") === -1 ? C("Complex timeline not supported") : C("ComplexTimelineStrategy not yet supported");
1267
+ return n.indexOf("complex-timeline") === -1 ? E("Complex timeline not supported") : E("ComplexTimelineStrategy not yet supported");
1223
1268
  const i = t.types[0];
1224
- return i === "image" ? n.indexOf("images") === -1 ? C("Image not supported") : Cn(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? C("3D not supported") : bn(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? C("Textual content not supported") : An(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? C("Media not supported") : En(e, t) : i === "video" ? n.indexOf("media") === -1 ? C("Media not supported") : Mn(e, t) : ce;
1269
+ return i === "image" ? n.indexOf("images") === -1 ? E("Image not supported") : Mn(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? E("3D not supported") : En(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? E("Textual content not supported") : An(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? E("Media not supported") : In(e, t) : i === "video" ? n.indexOf("media") === -1 ? E("Media not supported") : Rn(e, t) : ce;
1225
1270
  }
1226
- function Rn(e) {
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), {
1271
+ function On(e) {
1272
+ const t = K(), n = j(), r = O(), [i, o] = xn(), { enabledPageIds: a } = vn((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
1228
1273
  all: !1
1229
- }), s = mn(a, "AnnotationPage"), u = (e == null ? void 0 : e.strategies) || [
1274
+ }), s = pn(a, "AnnotationPage"), c = (e == null ? void 0 : e.strategies) || [
1230
1275
  "empty",
1231
1276
  "images",
1232
1277
  "media",
1233
1278
  "textual-content",
1234
1279
  "complex-timeline"
1235
- ], [d, c] = Sn(e, [o]), f = y(() => Tn({ canvas: n, paintables: d, supports: u, loadImageService: i }), [n, d, r, c.makeChoice]);
1236
- return y(() => f.type === "unknown" ? [f, un] : [
1280
+ ], [d, l] = bn(e, [o]), f = y(() => Vn({ canvas: n, paintables: d, supports: c, loadImageService: i }), [n, d, r, l.makeChoice]);
1281
+ return y(() => f.type === "unknown" ? [f, ln] : [
1237
1282
  {
1238
1283
  ...f,
1239
1284
  annotations: { pages: s }
1240
1285
  },
1241
- c
1286
+ l
1242
1287
  ], [f, s]);
1243
1288
  }
1244
- const Vn = (e, t = []) => {
1245
- const n = T();
1289
+ const Ln = (e, t = []) => {
1290
+ const n = O();
1246
1291
  N(() => {
1247
1292
  e(n);
1248
1293
  }, [n, ...t]);
1249
1294
  };
1250
- function On(e, t, { canvasId: n, manifestId: r } = {}) {
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);
1252
- if (N(() => (p.current = !1, () => {
1253
- p.current = !0;
1295
+ function kn(e, t, { canvasId: n, manifestId: r } = {}) {
1296
+ const i = O(), o = je(), a = y(() => vt(i, { imageServiceLoader: o }), [i, o]), [s, c] = L(), d = K(r ? { id: r } : void 0), l = j(n ? { id: n } : void 0), f = l || d, v = q(!1);
1297
+ if (N(() => (v.current = !1, () => {
1298
+ v.current = !0;
1254
1299
  }), []), !f)
1255
1300
  throw new Error("Must be called under a manifest or canvas context.");
1256
- return Vn(
1257
- (v) => {
1301
+ return Ln(
1302
+ (p) => {
1258
1303
  a.getBestThumbnailAtSize(f, e, t).then((m) => {
1259
- m.best && !p.current && u(m.best);
1304
+ m.best && !v.current && c(m.best);
1260
1305
  });
1261
1306
  },
1262
1307
  [f]
1263
1308
  ), s;
1264
1309
  }
1265
- function Ln(e) {
1310
+ function Nn(e) {
1266
1311
  return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: e };
1267
1312
  }
1268
- function kn(e, t) {
1313
+ function Fn(e, t) {
1269
1314
  switch (t.type) {
1270
1315
  case "FINISHED":
1271
1316
  return { ...e, isFinished: !0, isPlaying: !1, playRequested: !1 };
@@ -1288,26 +1333,26 @@ function kn(e, t) {
1288
1333
  }
1289
1334
  return e;
1290
1335
  }
1291
- function Nn(e) {
1336
+ function Un(e) {
1292
1337
  const t = Math.round(e);
1293
1338
  return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
1294
1339
  }
1295
1340
  function pe(e) {
1296
- const [t, n] = rt(kn, Ln(e.duration)), r = j(null), i = j(null), o = j(null), a = j(!1), s = P(() => {
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" })));
1298
- }, [e.duration]), u = P(() => {
1341
+ const [t, n] = ot(Fn, Nn(e.duration)), r = q(null), i = q(null), o = q(null), a = q(!1), s = P(() => {
1342
+ i.current && r.current && (i.current.innerHTML = Un(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" })));
1343
+ }, [e.duration]), c = P(() => {
1299
1344
  r.current && (n({ type: "PLAY_REQUESTED" }), r.current.play().then(() => {
1300
1345
  n({ type: "PLAY" });
1301
1346
  }), s());
1302
1347
  }, [s]), d = P(() => {
1303
- r.current && (r.current.duration > 0 && r.current.paused ? u() : c());
1304
- }, [s]), c = P(() => {
1348
+ r.current && (r.current.duration > 0 && r.current.paused ? c() : l());
1349
+ }, [s]), l = P(() => {
1305
1350
  r.current && (r.current.pause(), n({ type: "PAUSE" }), s());
1306
1351
  }, [s]), f = P(() => {
1307
1352
  r.current && (r.current.muted = !r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
1308
- }, []), p = P(() => {
1309
- r.current && (r.current.muted = !0, n({ type: "MUTE" }));
1310
1353
  }, []), v = P(() => {
1354
+ r.current && (r.current.muted = !0, n({ type: "MUTE" }));
1355
+ }, []), p = P(() => {
1311
1356
  r.current && (r.current.muted = !1, n({ type: "UNMUTE" }));
1312
1357
  }, []), m = P((x) => {
1313
1358
  r.current && (r.current.muted = !1, r.current.volume = x / 100, n({ type: "SET_VOLUME", volume: x }));
@@ -1324,17 +1369,17 @@ function pe(e) {
1324
1369
  }, [s, e.duration]), N(() => {
1325
1370
  const x = () => {
1326
1371
  n({ type: "FINISHED" });
1327
- }, I = r.current;
1328
- return I == null || I.addEventListener("ended", x), () => I == null ? void 0 : I.removeEventListener("ended", x);
1372
+ }, M = r.current;
1373
+ return M == null || M.addEventListener("ended", x), () => M == null ? void 0 : M.removeEventListener("ended", x);
1329
1374
  }, []), [
1330
1375
  { element: r, currentTime: i, progress: o },
1331
1376
  t,
1332
1377
  {
1333
- play: u,
1334
- pause: c,
1378
+ play: c,
1379
+ pause: l,
1335
1380
  playPause: d,
1336
- mute: p,
1337
- unmute: v,
1381
+ mute: v,
1382
+ unmute: p,
1338
1383
  toggleMute: f,
1339
1384
  setVolume: m,
1340
1385
  setDurationPercent: g,
@@ -1342,7 +1387,7 @@ function pe(e) {
1342
1387
  }
1343
1388
  ];
1344
1389
  }
1345
- const Fn = U(null), Dn = U(null), Un = U(null);
1390
+ const Dn = F(null), _n = F(null), qn = F(null);
1346
1391
  function Ye({
1347
1392
  actions: e,
1348
1393
  state: t,
@@ -1351,11 +1396,11 @@ function Ye({
1351
1396
  progress: i,
1352
1397
  element: o
1353
1398
  }) {
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 }) }) });
1399
+ return /* @__PURE__ */ u(qn.Provider, { value: { currentTime: r, progress: i, element: o }, children: /* @__PURE__ */ u(_n.Provider, { value: e, children: /* @__PURE__ */ u(Dn.Provider, { value: t, children: n }) }) });
1355
1400
  }
1356
1401
  function ze({ media: e, children: t }) {
1357
1402
  const [{ element: n, currentTime: r, progress: i }, o, a] = pe({ duration: e.duration });
1358
- return /* @__PURE__ */ A(
1403
+ return /* @__PURE__ */ I(
1359
1404
  Ye,
1360
1405
  {
1361
1406
  state: o,
@@ -1364,7 +1409,7 @@ function ze({ media: e, children: t }) {
1364
1409
  progress: i,
1365
1410
  element: n,
1366
1411
  children: [
1367
- /* @__PURE__ */ l("audio", { ref: n, src: e.url }),
1412
+ /* @__PURE__ */ u("audio", { ref: n, src: e.url }),
1368
1413
  t
1369
1414
  ]
1370
1415
  }
@@ -1382,8 +1427,8 @@ function We({
1382
1427
  media: t,
1383
1428
  playPause: n
1384
1429
  }) {
1385
- return /* @__PURE__ */ A("div", { className: "video-container", part: "video-container", onClick: n, children: [
1386
- /* @__PURE__ */ l("style", { children: `
1430
+ return /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
1431
+ /* @__PURE__ */ u("style", { children: `
1387
1432
  .video-container {
1388
1433
  position: absolute;
1389
1434
  top: 0;
@@ -1397,7 +1442,7 @@ function We({
1397
1442
  pointer-events: visible;
1398
1443
  }
1399
1444
  ` }),
1400
- /* @__PURE__ */ l("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1445
+ /* @__PURE__ */ u("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1401
1446
  ] });
1402
1447
  }
1403
1448
  function Ge({
@@ -1426,8 +1471,8 @@ function Ge({
1426
1471
  ), null;
1427
1472
  }
1428
1473
  function Qe({ model: e }) {
1429
- return /* @__PURE__ */ A(H, { children: [
1430
- /* @__PURE__ */ l("style", { children: `
1474
+ return /* @__PURE__ */ I($, { children: [
1475
+ /* @__PURE__ */ u("style", { children: `
1431
1476
  .model-container {
1432
1477
  position: absolute;
1433
1478
  top: 0;
@@ -1441,7 +1486,7 @@ function Qe({ model: e }) {
1441
1486
  pointer-events: visible;
1442
1487
  }
1443
1488
  ` }),
1444
- /* @__PURE__ */ l("div", { className: "model-container", children: /* @__PURE__ */ l(
1489
+ /* @__PURE__ */ u("div", { className: "model-container", children: /* @__PURE__ */ u(
1445
1490
  "model-viewer",
1446
1491
  {
1447
1492
  "interaction-prompt": "none",
@@ -1457,8 +1502,8 @@ function Je({ model: e, name: t }) {
1457
1502
  return Y("overlay", `model-${t}`, Qe, { model: e }, [e]), null;
1458
1503
  }
1459
1504
  function Ze({ style: e }) {
1460
- const t = $();
1461
- return !t || !t.height || !t.width ? null : /* @__PURE__ */ l(
1505
+ const t = j();
1506
+ return !t || !t.height || !t.width ? null : /* @__PURE__ */ u(
1462
1507
  "box",
1463
1508
  {
1464
1509
  interactive: !1,
@@ -1467,18 +1512,18 @@ function Ze({ style: e }) {
1467
1512
  }
1468
1513
  );
1469
1514
  }
1470
- const _n = q.createContext("en");
1515
+ const Bn = B.createContext("en");
1471
1516
  function Xe() {
1472
- return q.useContext(_n);
1517
+ return B.useContext(Bn);
1473
1518
  }
1474
1519
  function Ee(e) {
1475
1520
  return e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : e;
1476
1521
  }
1477
1522
  function jn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
1478
1523
  const o = Xe();
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 });
1524
+ return y(() => Ee(o) === Ee(t), [o, t]) ? e ? /* @__PURE__ */ u(e, { ...i, children: n }) : /* @__PURE__ */ u("span", { ...i, children: n }) : e ? /* @__PURE__ */ u(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ u("span", { ...i, lang: t, dir: r, children: n });
1480
1525
  }
1481
- function qn(e, t, n) {
1526
+ function Hn(e, t, n) {
1482
1527
  if (t.length === 0)
1483
1528
  return;
1484
1529
  if (t.length === 1)
@@ -1497,58 +1542,65 @@ const $n = (e, t = []) => {
1497
1542
  const n = Xe();
1498
1543
  return y(() => {
1499
1544
  const r = e();
1500
- return qn(n, r, []);
1545
+ return Hn(n, r, []);
1501
1546
  }, [n, ...t]);
1502
1547
  };
1503
- function Bn(e, t) {
1504
- const n = $n(() => Object.keys(e || {}), [e]);
1548
+ function Yn(e, t, n = `
1549
+ `) {
1550
+ const r = $n(() => Object.keys(e || {}), [e]);
1505
1551
  return [
1506
1552
  y(() => {
1507
1553
  if (!e)
1508
1554
  return t || "";
1509
1555
  if (typeof e == "string")
1510
1556
  return e;
1511
- const r = n ? e[n] : void 0;
1512
- return r ? typeof r == "string" ? r : r.join(`
1513
- `) : "";
1514
- }, [n, t, e]),
1515
- n
1557
+ const i = r ? e[r] : void 0;
1558
+ return i ? typeof i == "string" ? i : i.join(n) : "";
1559
+ }, [r, t, e]),
1560
+ r
1516
1561
  ];
1517
1562
  }
1518
- const Hn = ({ as: e, defaultText: t, enableDangerouslySetInnerHTML: n, children: r, ...i }) => {
1519
- const [o, a] = Bn(r, t);
1520
- return a ? /* @__PURE__ */ l(
1563
+ function zn({
1564
+ as: e,
1565
+ defaultText: t,
1566
+ enableDangerouslySetInnerHTML: n,
1567
+ children: r,
1568
+ separator: i,
1569
+ ...o
1570
+ }) {
1571
+ const [a, s] = Yn(r, t, i);
1572
+ return s ? /* @__PURE__ */ u(
1521
1573
  jn,
1522
1574
  {
1523
- ...i,
1575
+ ...o,
1524
1576
  as: e,
1525
- language: a,
1526
- title: n ? void 0 : o,
1577
+ language: s,
1578
+ title: n ? void 0 : a,
1527
1579
  dangerouslySetInnerHTML: n ? {
1528
- __html: o
1580
+ __html: a
1529
1581
  } : void 0,
1530
- children: n ? void 0 : o
1582
+ children: n ? void 0 : a
1531
1583
  }
1532
- ) : e ? /* @__PURE__ */ l(e, { ...i, children: o }) : /* @__PURE__ */ l(
1584
+ ) : e ? /* @__PURE__ */ u(e, { ...o, children: a }) : /* @__PURE__ */ u(
1533
1585
  "span",
1534
1586
  {
1535
- ...i,
1536
- title: n ? void 0 : o,
1587
+ ...o,
1588
+ title: n ? void 0 : a,
1537
1589
  dangerouslySetInnerHTML: n ? {
1538
- __html: o
1590
+ __html: a
1539
1591
  } : void 0,
1540
- children: n ? void 0 : o
1592
+ children: n ? void 0 : a
1541
1593
  }
1542
1594
  );
1543
- };
1544
- function Yn({
1595
+ }
1596
+ function Kn({
1545
1597
  element: e,
1546
1598
  media: t,
1547
1599
  playPause: n
1548
1600
  }) {
1549
- const r = j(null);
1550
- return t.youTubeId ? /* @__PURE__ */ A("div", { className: "video-container", part: "video-container", onClick: n, children: [
1551
- /* @__PURE__ */ l("style", { children: `
1601
+ const r = q(null);
1602
+ return t.youTubeId ? /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
1603
+ /* @__PURE__ */ u("style", { children: `
1552
1604
  .video-container {
1553
1605
  position: absolute;
1554
1606
  top: 0;
@@ -1567,7 +1619,7 @@ function Yn({
1567
1619
  object-fit: contain;
1568
1620
  }
1569
1621
  ` }),
1570
- /* @__PURE__ */ l(
1622
+ /* @__PURE__ */ u(
1571
1623
  "iframe",
1572
1624
  {
1573
1625
  className: "video-yt",
@@ -1579,13 +1631,13 @@ function Yn({
1579
1631
  )
1580
1632
  ] }) : null;
1581
1633
  }
1582
- function zn({
1634
+ function Wn({
1583
1635
  media: e,
1584
1636
  mediaControlsDeps: t,
1585
1637
  children: n
1586
1638
  }) {
1587
1639
  const [{ element: r, currentTime: i, progress: o }, a, s] = pe({ duration: e.duration });
1588
- return Y("overlay", "video-element", Yn, {
1640
+ return Y("overlay", "video-element", Kn, {
1589
1641
  element: r,
1590
1642
  media: e,
1591
1643
  playPause: s.playPause
@@ -1600,29 +1652,29 @@ function et({
1600
1652
  isStatic: o,
1601
1653
  renderViewerControls: a,
1602
1654
  renderMediaControls: s,
1603
- viewControlsDeps: u,
1655
+ viewControlsDeps: c,
1604
1656
  mediaControlsDeps: d,
1605
- strategies: c,
1657
+ strategies: l,
1606
1658
  throwOnUnknown: f,
1607
- backgroundStyle: p,
1608
- alwaysShowBackground: v,
1659
+ backgroundStyle: v,
1660
+ alwaysShowBackground: p,
1609
1661
  keepCanvasScale: m = !1,
1610
1662
  enableSizes: g = !1,
1611
1663
  enableYouTube: w = !0,
1612
1664
  onClickPaintingAnnotation: x,
1613
- children: I
1665
+ children: M
1614
1666
  }) {
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"],
1667
+ const b = j(), W = Ue(b, ["deep-zoom"]), [Z] = tn(), C = on(), A = O(), k = y(() => Te(A), [A]), [h, D] = On({
1668
+ strategies: l || ["images"],
1617
1669
  defaultChoices: i == null ? void 0 : i.map(({ id: S }) => S)
1618
- }), ve = h.type === "images" ? h.choice : void 0, tt = y(() => m ? 1 : Math.max(
1670
+ }), ye = h.type === "images" ? h.choice : void 0, tt = y(() => m ? 1 : Math.max(
1619
1671
  1,
1620
1672
  ...h.type === "images" ? h.images.map((S) => {
1621
- var B;
1622
- return (S.width || 0) / ((B = S.target) == null ? void 0 : B.spatial.width);
1673
+ var H;
1674
+ return (S.width || 0) / ((H = S.target) == null ? void 0 : H.spatial.width);
1623
1675
  }) : []
1624
1676
  ), [m, h]);
1625
- rn(tt), N(() => {
1677
+ an(tt), N(() => {
1626
1678
  r && r(D);
1627
1679
  }, [h.annotations]), N(() => {
1628
1680
  if (i)
@@ -1630,22 +1682,22 @@ function et({
1630
1682
  typeof S.opacity < "u" && k.applyStyles({ id: S.id }, "atlas", {
1631
1683
  opacity: S.opacity
1632
1684
  });
1633
- }, [i]), Ce(() => {
1634
- n && n(ve);
1635
- }, [ve]), Y(
1636
- E && (h.type === "images" || h.type === "empty" || h.type === "textual-content" && a) ? "overlay" : "none",
1685
+ }, [i]), Ie(() => {
1686
+ n && n(ye);
1687
+ }, [ye]), Y(
1688
+ C && (h.type === "images" || h.type === "empty" || h.type === "textual-content" && a) ? "overlay" : "none",
1637
1689
  `canvas-portal-controls-${b == null ? void 0 : b.id}`,
1638
- me.Provider,
1690
+ ve.Provider,
1639
1691
  a ? {
1640
- value: E || null,
1692
+ value: C || null,
1641
1693
  children: a(h)
1642
1694
  } : {},
1643
- [b, E, h, ...u || []]
1695
+ [b, C, h, ...c || []]
1644
1696
  );
1645
- const _ = On({ maxWidth: 256, maxHeight: 256 });
1697
+ const _ = kn({ maxWidth: 256, maxHeight: 256 });
1646
1698
  if (!b)
1647
1699
  return null;
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(
1700
+ const xe = b.accompanyingCanvas, G = _ && _.type === "fixed" ? /* @__PURE__ */ u("world-object", { height: b.height, width: b.width, x: e, y: t, children: /* @__PURE__ */ u(
1649
1701
  "world-image",
1650
1702
  {
1651
1703
  uri: _.id,
@@ -1664,13 +1716,13 @@ function et({
1664
1716
  throw new Error(h.reason || "Unknown image strategy");
1665
1717
  return null;
1666
1718
  }
1667
- const xe = /* @__PURE__ */ A(te, { children: [
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,
1670
- I
1719
+ const we = /* @__PURE__ */ I(te, { children: [
1720
+ Z ? /* @__PURE__ */ u(de, { page: Z }) : null,
1721
+ h.annotations && h.annotations.pages ? h.annotations.pages.map((S) => /* @__PURE__ */ u(de, { page: S }, S.id)) : null,
1722
+ M
1671
1723
  ] }), nt = h.type === "images" ? h.images.length : 0;
1672
- return /* @__PURE__ */ A(H, { children: [
1673
- /* @__PURE__ */ A(
1724
+ return /* @__PURE__ */ I($, { children: [
1725
+ /* @__PURE__ */ I(
1674
1726
  "world-object",
1675
1727
  {
1676
1728
  height: b.height,
@@ -1679,50 +1731,50 @@ function et({
1679
1731
  y: t,
1680
1732
  ...W,
1681
1733
  children: [
1682
- h.type === "empty" || v ? /* @__PURE__ */ l(Ze, { style: p }) : null,
1683
- h.type === "textual-content" ? h.items.map((S, B) => {
1734
+ h.type === "empty" || p ? /* @__PURE__ */ u(Ze, { style: v }) : null,
1735
+ h.type === "textual-content" ? h.items.map((S, H) => {
1684
1736
  var Q;
1685
- return /* @__PURE__ */ A(H, { children: [
1686
- /* @__PURE__ */ l(
1687
- lt,
1737
+ return /* @__PURE__ */ I($, { children: [
1738
+ /* @__PURE__ */ u(
1739
+ ft,
1688
1740
  {
1689
- onClick: x ? (we) => {
1690
- we.stopPropagation(), x(S.annotationId, S, we);
1741
+ onClick: x ? (Se) => {
1742
+ Se.stopPropagation(), x(S.annotationId, S, Se);
1691
1743
  } : void 0,
1692
1744
  target: ((Q = S.target) == null ? void 0 : Q.spatial) || void 0,
1693
- children: /* @__PURE__ */ l("div", { "data-textual-content": !0, children: /* @__PURE__ */ l(Hn, { enableDangerouslySetInnerHTML: !0, children: S.text }) })
1745
+ children: /* @__PURE__ */ u("div", { "data-textual-content": !0, children: /* @__PURE__ */ u(zn, { enableDangerouslySetInnerHTML: !0, children: S.text }) })
1694
1746
  },
1695
- B
1747
+ H
1696
1748
  ),
1697
- xe
1749
+ we
1698
1750
  ] });
1699
1751
  }) : null,
1700
- h.type === "images" ? /* @__PURE__ */ A(H, { children: [
1701
- h.images.map((S, B) => /* @__PURE__ */ l(
1702
- je,
1752
+ h.type === "images" ? /* @__PURE__ */ I($, { children: [
1753
+ h.images.map((S, H) => /* @__PURE__ */ u(
1754
+ qe,
1703
1755
  {
1704
1756
  isStatic: o,
1705
1757
  image: S,
1706
1758
  id: S.id,
1707
- thumbnail: B === 0 ? _ : void 0,
1759
+ thumbnail: H === 0 ? _ : void 0,
1708
1760
  selector: S.selector,
1709
1761
  enableSizes: g,
1710
1762
  onClick: x ? (Q) => {
1711
1763
  Q.stopPropagation(), x(S.annotationId, S, Q);
1712
1764
  } : void 0
1713
1765
  },
1714
- S.id + B
1766
+ S.id + H
1715
1767
  )),
1716
- xe
1768
+ we
1717
1769
  ] }) : null,
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: [
1770
+ h.type === "3d-model" ? /* @__PURE__ */ u(Je, { model: h.model }) : null,
1771
+ h.type === "media" ? /* @__PURE__ */ u($, { children: h.media.type === "Sound" ? /* @__PURE__ */ I(Ke, { media: h.media, mediaControlsDeps: d, children: [
1720
1772
  G,
1721
1773
  s ? s(h) : null
1722
- ] }) : h.media.type === "Video" ? /* @__PURE__ */ A(Ge, { media: h.media, mediaControlsDeps: d, children: [
1774
+ ] }) : h.media.type === "Video" ? /* @__PURE__ */ I(Ge, { media: h.media, mediaControlsDeps: d, children: [
1723
1775
  G,
1724
1776
  s ? s(h) : null
1725
- ] }) : h.media.type === "VideoYouTube" && w ? /* @__PURE__ */ A(zn, { media: h.media, mediaControlsDeps: d, children: [
1777
+ ] }) : h.media.type === "VideoYouTube" && w ? /* @__PURE__ */ I(Wn, { media: h.media, mediaControlsDeps: d, children: [
1726
1778
  G,
1727
1779
  s ? s(h) : null
1728
1780
  ] }) : null }) : null
@@ -1730,33 +1782,29 @@ function et({
1730
1782
  },
1731
1783
  `${b.id}/${h.type}/${nt}`
1732
1784
  ),
1733
- h.type === "media" && h.media.type === "Sound" && ye ? /* @__PURE__ */ l(ge, { canvas: ye.id, children: /* @__PURE__ */ l(et, { renderViewerControls: a }) }) : null
1785
+ h.type === "media" && h.media.type === "Sound" && xe ? /* @__PURE__ */ u(me, { canvas: xe.id, children: /* @__PURE__ */ u(et, { renderViewerControls: a }) }) : null
1734
1786
  ] });
1735
1787
  }
1736
- function Kn() {
1737
- const e = R(ie);
1738
- return e && e.vault ? e.vault : Ie();
1739
- }
1740
- const Wn = Ae(function(t, n) {
1741
- const r = K(), i = Re(), o = Mt(), { ViewerControls: a, MediaControls: s } = t.components || {};
1742
- if (it(n, () => o, [o]), !r)
1743
- return /* @__PURE__ */ l("div", {});
1744
- let u = 0;
1745
- return /* @__PURE__ */ A(H, { children: [
1788
+ const Gn = Me(function(t, n) {
1789
+ const r = K(), i = Re(), o = Rt(), { ViewerControls: a, MediaControls: s } = t.components || {};
1790
+ if (at(n, () => o, [o]), !r)
1791
+ return /* @__PURE__ */ u("div", {});
1792
+ let c = 0;
1793
+ return /* @__PURE__ */ I($, { children: [
1746
1794
  t.header,
1747
- /* @__PURE__ */ l(
1748
- O.Viewer,
1795
+ /* @__PURE__ */ u(
1796
+ V.Viewer,
1749
1797
  {
1750
1798
  height: t.height,
1751
1799
  mode: t.mode,
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(
1755
- O.RenderCanvas,
1800
+ children: i.map((d, l) => {
1801
+ const f = c;
1802
+ return c += d.width + (t.spacing || 0), /* @__PURE__ */ u(me, { canvas: d.id, children: /* @__PURE__ */ u(
1803
+ V.RenderCanvas,
1756
1804
  {
1757
1805
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
1758
- renderViewerControls: c === 0 && a ? () => /* @__PURE__ */ l(a, {}) : void 0,
1759
- renderMediaControls: c === 0 && s ? () => /* @__PURE__ */ l(s, {}) : void 0,
1806
+ renderViewerControls: l === 0 && a ? () => /* @__PURE__ */ u(a, {}) : void 0,
1807
+ renderMediaControls: l === 0 && s ? () => /* @__PURE__ */ u(s, {}) : void 0,
1760
1808
  x: f,
1761
1809
  ...t.canvasProps || {},
1762
1810
  children: t.annotations
@@ -1769,36 +1817,37 @@ const Wn = Ae(function(t, n) {
1769
1817
  ),
1770
1818
  t.children
1771
1819
  ] });
1772
- }), O = Ae(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: u, ...d }, c) {
1773
- const f = Kn();
1774
- return /* @__PURE__ */ l(Te, { vault: f, children: /* @__PURE__ */ l(It, { ...d, children: /* @__PURE__ */ l(
1775
- Wn,
1820
+ }), V = Me(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: c, reuseAtlas: d, ...l }, f) {
1821
+ const v = ge();
1822
+ return /* @__PURE__ */ u(he, { vault: v, children: /* @__PURE__ */ u(Tt, { ...l, children: /* @__PURE__ */ u(
1823
+ Gn,
1776
1824
  {
1777
- ref: c,
1825
+ ref: f,
1778
1826
  height: n,
1779
1827
  components: s,
1780
1828
  spacing: o,
1781
1829
  canvasProps: i,
1782
1830
  annotations: r,
1783
1831
  header: a,
1784
- mode: u,
1832
+ mode: c,
1833
+ reuseAtlas: d,
1785
1834
  children: t
1786
1835
  }
1787
1836
  ) }) });
1788
1837
  });
1789
- O.RenderImage = je;
1790
- O.RenderCanvas = et;
1791
- O.RenderAnnotationPage = fe;
1792
- O.RenderAnnotation = _e;
1793
- O.Viewer = on;
1794
- O.CanvasBackground = Ze;
1795
- O.Audio = Ke;
1796
- O.Video = Ge;
1797
- O.Model = Je;
1798
- O.AudioHTML = ze;
1799
- O.VideoHTML = We;
1800
- O.ModelHTML = Qe;
1838
+ V.RenderImage = qe;
1839
+ V.RenderCanvas = et;
1840
+ V.RenderAnnotationPage = de;
1841
+ V.RenderAnnotation = _e;
1842
+ V.Viewer = sn;
1843
+ V.CanvasBackground = Ze;
1844
+ V.Audio = Ke;
1845
+ V.Video = Ge;
1846
+ V.Model = Je;
1847
+ V.AudioHTML = ze;
1848
+ V.VideoHTML = We;
1849
+ V.ModelHTML = Qe;
1801
1850
  export {
1802
- O as CanvasPanel
1851
+ V as CanvasPanel
1803
1852
  };
1804
1853
  //# sourceMappingURL=canvas-panel.mjs.map