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