react-iiif-vault 1.0.11 → 1.1.1

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 (134) hide show
  1. package/dist/bundle.d.ts +1059 -0
  2. package/dist/bundle.global.js +227 -0
  3. package/dist/canvas-panel.cjs +46 -0
  4. package/dist/canvas-panel.d.cts +11 -0
  5. package/dist/canvas-panel.d.ts +11 -0
  6. package/dist/canvas-panel.js +1 -0
  7. package/dist/chunk-DXFXJCXN.js +1 -0
  8. package/dist/chunk-VPKD2BBH.js +47 -0
  9. package/dist/index-BZirmhnp.d.cts +188 -0
  10. package/dist/index-Cxs6aAuK.d.ts +188 -0
  11. package/dist/index.cjs +47 -0
  12. package/dist/index.d.cts +722 -0
  13. package/dist/index.d.ts +722 -0
  14. package/dist/index.js +1 -0
  15. package/dist/useRenderingStrategy-Xj9yQm4y.d.cts +145 -0
  16. package/dist/useRenderingStrategy-Xj9yQm4y.d.ts +145 -0
  17. package/dist/utils.cjs +1 -0
  18. package/dist/utils.d.cts +32 -0
  19. package/dist/utils.d.ts +32 -0
  20. package/dist/utils.js +1 -0
  21. package/package.json +67 -70
  22. package/.build/types/canvas-panel/Viewer.d.ts +0 -14
  23. package/.build/types/canvas-panel/context/overlays.d.ts +0 -3
  24. package/.build/types/canvas-panel/context/world-size.d.ts +0 -2
  25. package/.build/types/canvas-panel/index.d.ts +0 -46
  26. package/.build/types/canvas-panel/render/Annotation.d.ts +0 -8
  27. package/.build/types/canvas-panel/render/AnnotationPage.d.ts +0 -7
  28. package/.build/types/canvas-panel/render/Audio.d.ts +0 -11
  29. package/.build/types/canvas-panel/render/Canvas.d.ts +0 -34
  30. package/.build/types/canvas-panel/render/CanvasBackground.d.ts +0 -4
  31. package/.build/types/canvas-panel/render/DefaultCanvasFallback.d.ts +0 -6
  32. package/.build/types/canvas-panel/render/Image.d.ts +0 -16
  33. package/.build/types/canvas-panel/render/Model.d.ts +0 -7
  34. package/.build/types/canvas-panel/render/Video.d.ts +0 -12
  35. package/.build/types/canvas-panel/render/VideoYouTube.d.ts +0 -12
  36. package/.build/types/components/CanvasAnnotations.d.ts +0 -10
  37. package/.build/types/components/CombinedMetadata.d.ts +0 -4
  38. package/.build/types/components/Image.d.ts +0 -15
  39. package/.build/types/components/ManifestMetadata.d.ts +0 -4
  40. package/.build/types/components/Metadata.d.ts +0 -39
  41. package/.build/types/components/SequenceThumbnails.d.ts +0 -29
  42. package/.build/types/components/SingleCanvasThumbnail.d.ts +0 -20
  43. package/.build/types/context/AnnotationContext.d.ts +0 -5
  44. package/.build/types/context/AnnotationPageContext.d.ts +0 -5
  45. package/.build/types/context/CanvasContext.d.ts +0 -5
  46. package/.build/types/context/CollectionContext.d.ts +0 -5
  47. package/.build/types/context/ContextBridge.d.ts +0 -14
  48. package/.build/types/context/ImageServiceLoaderContext.d.ts +0 -4
  49. package/.build/types/context/ManifestContext.d.ts +0 -5
  50. package/.build/types/context/MediaContext.d.ts +0 -17
  51. package/.build/types/context/RangeContext.d.ts +0 -5
  52. package/.build/types/context/ResourceContext.d.ts +0 -15
  53. package/.build/types/context/VaultContext.d.ts +0 -14
  54. package/.build/types/context/ViewerPresetContext.d.ts +0 -3
  55. package/.build/types/context/VisibleCanvasContext.d.ts +0 -4
  56. package/.build/types/demo/demo.d.ts +0 -1
  57. package/.build/types/demo/media-controls.d.ts +0 -1
  58. package/.build/types/demo/viewer-controls.d.ts +0 -1
  59. package/.build/types/features/rendering-strategy/3d-strategy.d.ts +0 -12
  60. package/.build/types/features/rendering-strategy/audio-strategy.d.ts +0 -3
  61. package/.build/types/features/rendering-strategy/get-rendering-strategy.d.ts +0 -11
  62. package/.build/types/features/rendering-strategy/image-strategy.d.ts +0 -12
  63. package/.build/types/features/rendering-strategy/rendering-utils.d.ts +0 -12
  64. package/.build/types/features/rendering-strategy/resource-types.d.ts +0 -55
  65. package/.build/types/features/rendering-strategy/strategies.d.ts +0 -31
  66. package/.build/types/features/rendering-strategy/textual-content-strategy.d.ts +0 -16
  67. package/.build/types/features/rendering-strategy/video-strategy.d.ts +0 -3
  68. package/.build/types/future-helpers/ranges.d.ts +0 -7
  69. package/.build/types/future-helpers/sequences.d.ts +0 -8
  70. package/.build/types/hooks/useAnnotation.d.ts +0 -8
  71. package/.build/types/hooks/useAnnotationPage.d.ts +0 -8
  72. package/.build/types/hooks/useAnnotationPageManager.d.ts +0 -10
  73. package/.build/types/hooks/useAnnotationsAtTime.d.ts +0 -4
  74. package/.build/types/hooks/useCanvas.d.ts +0 -8
  75. package/.build/types/hooks/useCanvasClock.d.ts +0 -1
  76. package/.build/types/hooks/useCanvasSelector.d.ts +0 -0
  77. package/.build/types/hooks/useCanvasSubset.d.ts +0 -2
  78. package/.build/types/hooks/useCanvasTimeline.d.ts +0 -0
  79. package/.build/types/hooks/useCollection.d.ts +0 -8
  80. package/.build/types/hooks/useDispatch.d.ts +0 -2
  81. package/.build/types/hooks/useEnabledAnnotationPageIds.d.ts +0 -1
  82. package/.build/types/hooks/useEventListener.d.ts +0 -4
  83. package/.build/types/hooks/useExistingVault.d.ts +0 -2
  84. package/.build/types/hooks/useExternalCollection.d.ts +0 -13
  85. package/.build/types/hooks/useExternalManifest.d.ts +0 -13
  86. package/.build/types/hooks/useExternalResource.d.ts +0 -16
  87. package/.build/types/hooks/useImage.d.ts +0 -10
  88. package/.build/types/hooks/useImageService.d.ts +0 -9
  89. package/.build/types/hooks/useImageTile.d.ts +0 -11
  90. package/.build/types/hooks/useLoadImageService.d.ts +0 -6
  91. package/.build/types/hooks/useManifest.d.ts +0 -8
  92. package/.build/types/hooks/usePaintables.d.ts +0 -9
  93. package/.build/types/hooks/usePaintingAnnotations.d.ts +0 -5
  94. package/.build/types/hooks/useRange.d.ts +0 -8
  95. package/.build/types/hooks/useRenderingStrategy.d.ts +0 -15
  96. package/.build/types/hooks/useResourceEvents.d.ts +0 -3
  97. package/.build/types/hooks/useResources.d.ts +0 -1
  98. package/.build/types/hooks/useSearchService.d.ts +0 -2
  99. package/.build/types/hooks/useSimpleMediaPlayer.d.ts +0 -32
  100. package/.build/types/hooks/useStyleHelper.d.ts +0 -1
  101. package/.build/types/hooks/useStyles.d.ts +0 -3
  102. package/.build/types/hooks/useThumbnail.d.ts +0 -5
  103. package/.build/types/hooks/useVault.d.ts +0 -2
  104. package/.build/types/hooks/useVaultEffect.d.ts +0 -2
  105. package/.build/types/hooks/useVaultSelector.d.ts +0 -2
  106. package/.build/types/hooks/useVirtualAnnotationPage.d.ts +0 -14
  107. package/.build/types/hooks/useVirtualAnnotationPageContext.d.ts +0 -671
  108. package/.build/types/hooks/useVirtualCanvas.d.ts +0 -0
  109. package/.build/types/index.d.ts +0 -72
  110. package/.build/types/utility/flatten-annotation-page-ids.d.ts +0 -7
  111. package/.build/types/utility/i18n-utils.d.ts +0 -30
  112. package/.build/types/utils.d.ts +0 -2
  113. package/.build/types/viewers/SimpleViewerContext.d.ts +0 -6
  114. package/.build/types/viewers/SimpleViewerContext.hooks.d.ts +0 -19
  115. package/.build/types/viewers/SimpleViewerContext.types.d.ts +0 -46
  116. package/.build/types/viewers/SingleCanvasContext.d.ts +0 -1
  117. package/dist/bundle/cjs/index.js +0 -49
  118. package/dist/bundle/cjs/index.js.map +0 -1
  119. package/dist/bundle/esm/index.mjs +0 -3319
  120. package/dist/bundle/esm/index.mjs.map +0 -1
  121. package/dist/canvas-panel/cjs/canvas-panel.js +0 -47
  122. package/dist/canvas-panel/cjs/canvas-panel.js.map +0 -1
  123. package/dist/canvas-panel/esm/canvas-panel.mjs +0 -1858
  124. package/dist/canvas-panel/esm/canvas-panel.mjs.map +0 -1
  125. package/dist/index.umd.js +0 -393
  126. package/dist/index.umd.js.map +0 -1
  127. package/dist/react17/cjs/index.js +0 -49
  128. package/dist/react17/cjs/index.js.map +0 -1
  129. package/dist/react17/esm/index.mjs +0 -3319
  130. package/dist/react17/esm/index.mjs.map +0 -1
  131. package/dist/utils/cjs/utils.js +0 -2
  132. package/dist/utils/cjs/utils.js.map +0 -1
  133. package/dist/utils/esm/utils.mjs +0 -238
  134. package/dist/utils/esm/utils.mjs.map +0 -1
@@ -1,3319 +0,0 @@
1
- import { jsx as d, jsxs as X, Fragment as Oe } from "react/jsx-runtime";
2
- import Ee, { createContext as Te, Component as wn, createElement as St, isValidElement as Pn, useContext as ue, useMemo as N, useState as ie, useEffect as be, useRef as xe, useCallback as Q, useLayoutEffect as st, Fragment as Ye, useReducer as On, forwardRef as ct, useImperativeHandle as Et } from "react";
3
- import { AtlasAuto as Sn, ModeContext as xn, mergeStyles as Tn, RegionHighlight as In, TileSet as En, HTMLPortal as Cn, useCanvas as jn } from "@atlas-viewer/atlas";
4
- import { globalVault as Ct, Vault as xt } from "@iiif/helpers/vault";
5
- import { createStylesHelper as ut } from "@iiif/helpers/styles";
6
- import { expandTarget as ot } from "@iiif/helpers/annotation-targets";
7
- export * from "@iiif/helpers/annotation-targets";
8
- import { expandTarget as Mn } from "@iiif/helpers";
9
- import { ImageServiceLoader as Rn, getImageServices as it, createImageServiceRequest as Ln, imageServiceRequestToString as An } from "@atlas-viewer/iiif-image-api";
10
- import { createThumbnailHelper as kn } from "@iiif/helpers/thumbnail";
11
- import Nn from "react-dom";
12
- const Vn = Te(null), tt = {
13
- didCatch: !1,
14
- error: null
15
- };
16
- class _n extends wn {
17
- constructor(t) {
18
- super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = tt;
19
- }
20
- static getDerivedStateFromError(t) {
21
- return {
22
- didCatch: !0,
23
- error: t
24
- };
25
- }
26
- resetErrorBoundary() {
27
- const {
28
- error: t
29
- } = this.state;
30
- if (t !== null) {
31
- for (var n, o, r = arguments.length, a = new Array(r), i = 0; i < r; i++)
32
- a[i] = arguments[i];
33
- (n = (o = this.props).onReset) === null || n === void 0 || n.call(o, {
34
- args: a,
35
- reason: "imperative-api"
36
- }), this.setState(tt);
37
- }
38
- }
39
- componentDidCatch(t, n) {
40
- var o, r;
41
- (o = (r = this.props).onError) === null || o === void 0 || o.call(r, t, n);
42
- }
43
- componentDidUpdate(t, n) {
44
- const {
45
- didCatch: o
46
- } = this.state, {
47
- resetKeys: r
48
- } = this.props;
49
- if (o && n.error !== null && Dn(t.resetKeys, r)) {
50
- var a, i;
51
- (a = (i = this.props).onReset) === null || a === void 0 || a.call(i, {
52
- next: r,
53
- prev: t.resetKeys,
54
- reason: "keys"
55
- }), this.setState(tt);
56
- }
57
- }
58
- render() {
59
- const {
60
- children: t,
61
- fallbackRender: n,
62
- FallbackComponent: o,
63
- fallback: r
64
- } = this.props, {
65
- didCatch: a,
66
- error: i
67
- } = this.state;
68
- let s = t;
69
- if (a) {
70
- const f = {
71
- error: i,
72
- resetErrorBoundary: this.resetErrorBoundary
73
- };
74
- if (typeof n == "function")
75
- s = n(f);
76
- else if (o)
77
- s = St(o, f);
78
- else if (r === null || Pn(r))
79
- s = r;
80
- else
81
- throw i;
82
- }
83
- return St(Vn.Provider, {
84
- value: {
85
- didCatch: a,
86
- error: i,
87
- resetErrorBoundary: this.resetErrorBoundary
88
- }
89
- }, s);
90
- }
91
- }
92
- function Dn() {
93
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
94
- return e.length !== t.length || e.some((n, o) => !Object.is(n, t[o]));
95
- }
96
- const Bn = {
97
- collection: void 0,
98
- manifest: void 0,
99
- range: void 0,
100
- canvas: void 0,
101
- annotation: void 0,
102
- annotationPage: void 0
103
- }, lt = Ee.createContext(Bn), je = () => ue(lt);
104
- function Le({ value: e, children: t }) {
105
- const n = je(), o = N(() => ({
106
- ...n,
107
- ...e
108
- }), [e, n]);
109
- return /* @__PURE__ */ d(lt.Provider, { value: o, children: t });
110
- }
111
- const Ke = Ee.createContext({
112
- vault: null,
113
- setVaultInstance: (e) => {
114
- }
115
- });
116
- function ft({
117
- vault: e,
118
- vaultOptions: t,
119
- useGlobal: n,
120
- resources: o,
121
- children: r
122
- }) {
123
- const [a, i] = ie(() => e || (n ? Ct(t) : t ? new xt(t) : new xt()));
124
- return /* @__PURE__ */ d(Ke.Provider, { value: { vault: a, setVaultInstance: i }, children: /* @__PURE__ */ d(Le, { value: o || {}, children: r }) });
125
- }
126
- function dt(e) {
127
- const t = ue(Ke);
128
- return e || (t && t.vault ? t.vault : Ct());
129
- }
130
- function jt(e, { noCache: t = !1 } = {}) {
131
- const n = typeof e == "string" ? e : e.id, o = dt(), [r, a] = ie(n), [i, s] = ie(void 0), f = N(() => o.get(n, { skipSelfReturn: !0 }) || void 0, [n, o]), [h, u] = ie(f);
132
- return be(() => {
133
- (async () => {
134
- try {
135
- const y = f && !t ? f : await o.load(n), x = y ? y.id || y["@id"] : null;
136
- y && r !== x && a(x), u(y);
137
- } catch (y) {
138
- s(y);
139
- }
140
- })();
141
- }, [n, t]), {
142
- isLoaded: !!h,
143
- id: r,
144
- requestId: n,
145
- error: i,
146
- resource: h,
147
- cached: !!(h && h === f)
148
- };
149
- }
150
- function qn(e, t) {
151
- const { id: n, isLoaded: o, error: r, resource: a, requestId: i, cached: s } = jt(
152
- e,
153
- t
154
- );
155
- return { id: n, isLoaded: o, error: r, manifest: a, requestId: i, cached: s };
156
- }
157
- function Fn({ manifest: e, children: t }) {
158
- return /* @__PURE__ */ d(Le, { value: { manifest: e }, children: t });
159
- }
160
- function Qe({ canvas: e, children: t }) {
161
- return /* @__PURE__ */ d(Le, { value: { canvas: e }, children: t });
162
- }
163
- const ae = () => {
164
- const { vault: e } = ue(Ke);
165
- if (e === null)
166
- throw new Error("Vault not found. Ensure you have your provider set up correctly.");
167
- return e;
168
- };
169
- function ye(e, t = []) {
170
- const n = ae(), [o, r] = ie(() => e(n.getState(), n));
171
- return be(() => n.subscribe(
172
- (a) => e(a, n),
173
- (a) => {
174
- r(a);
175
- },
176
- !1
177
- ), t), o;
178
- }
179
- const Ge = Ee.createContext([]);
180
- function Mt() {
181
- const e = ue(Ge);
182
- return ye(
183
- (t) => e.map((n) => t.iiif.entities.Canvas[n]).filter(Boolean),
184
- [e]
185
- );
186
- }
187
- function Ce(e = {}, t = []) {
188
- const { id: n, selector: o } = e, r = je();
189
- ae();
190
- const a = n || r.manifest, i = ye(
191
- (s) => a ? s.iiif.entities.Manifest[a] : void 0,
192
- [a]
193
- );
194
- return N(() => {
195
- if (i)
196
- return o ? o(i) : i;
197
- }, [i, o, ...t]);
198
- }
199
- function Un({ range: e, children: t }) {
200
- return /* @__PURE__ */ d(Le, { value: { range: e }, children: t });
201
- }
202
- function $n(e, t) {
203
- for (const n of t.items) {
204
- if (n.type === "Canvas")
205
- return n;
206
- if (n.type === "SpecificResource")
207
- return n.source;
208
- if (n.type === "Range") {
209
- const o = $n(e, e.get(n));
210
- if (o)
211
- return o;
212
- }
213
- }
214
- return null;
215
- }
216
- function Rt(e, t) {
217
- var o;
218
- const n = [];
219
- for (const r of t.items)
220
- if (r.type === "SpecificResource" && ((o = r.source) == null ? void 0 : o.type) === "Canvas" && (r.source.id.indexOf("#") !== -1 ? n.push({ id: r.source.id.split("#")[0], type: "Canvas" }) : n.push(r.source)), r.type === "Range" && n.push(...Rt(e, e.get(r))), r.type === "SpecificResource") {
221
- const a = typeof r.source == "string" ? r.source : r.source.id;
222
- n.push({ id: a, type: "Canvas" });
223
- }
224
- return n;
225
- }
226
- function Po(e, t, n) {
227
- for (const o of t.structures) {
228
- const r = Lt(e, e.get(o), n);
229
- if (r)
230
- return r;
231
- }
232
- return null;
233
- }
234
- function Lt(e, t, n) {
235
- var o, r, a;
236
- for (const i of t.items) {
237
- const s = (r = (o = i == null ? void 0 : i.source) == null ? void 0 : o.id) == null ? void 0 : r.split("#")[0];
238
- if (i.type === "SpecificResource" && i.source === n || i.type === "SpecificResource" && ((a = i.source) == null ? void 0 : a.type) === "Canvas" && n === s)
239
- return t;
240
- if (i.type === "Range") {
241
- const f = Lt(e, e.get(i), n);
242
- if (f)
243
- return f;
244
- }
245
- }
246
- return null;
247
- }
248
- function Oo(e, t, n, o = !1) {
249
- const r = t.behavior, a = n ? e.get(n) : null;
250
- if (!a)
251
- return [];
252
- const i = a.behavior, s = o ? !1 : r.includes("paged"), f = s ? !1 : r.includes("continuous"), h = s || f ? !1 : r.includes("individuals"), u = i.includes("facing-pages"), y = i.includes("non-paged");
253
- if (u || y || h || o)
254
- return [{ id: a.id, type: "Canvas" }];
255
- const [x, M] = At(e, t);
256
- if (f)
257
- return x;
258
- const C = x.findIndex((T) => T.id === n);
259
- if (C === -1)
260
- return [];
261
- for (const T of M)
262
- if (T.includes(C))
263
- return T.map((b) => x[b]);
264
- return [{ id: a.id, type: "Canvas" }];
265
- }
266
- function At(e, t, { disablePaging: n, skipNonPaged: o } = {}) {
267
- const r = t.behavior, a = r.includes("paged"), i = a ? !1 : r.includes("continuous"), s = a || i ? !1 : r.includes("individuals"), f = t.type === "Manifest" ? t.items : Rt(e, t);
268
- if (i)
269
- return [f, [f.map((C, T) => T)]];
270
- if (s || !a || n)
271
- return [f, f.map((C, T) => [T])];
272
- const h = [];
273
- let u = [];
274
- const y = () => {
275
- u.length && (h.push([...u]), u = []);
276
- };
277
- let x = 0, M = !1;
278
- for (let C = 0; C < f.length; C++) {
279
- const T = e.get(f[C]);
280
- if (T.behavior.includes("non-paged")) {
281
- C === x && x++, o || (y(), h.push([C]), y());
282
- continue;
283
- }
284
- if (C === x || T.behavior.includes("facing-pages")) {
285
- u.length && (M = !0), y(), h.push([C]), y();
286
- continue;
287
- }
288
- if (u.push(C), M) {
289
- y(), M = !1;
290
- continue;
291
- }
292
- u.length > 1 && y();
293
- }
294
- return u.length && y(), [f, h];
295
- }
296
- function kt(e = {}, t = []) {
297
- const { id: n, selector: o } = e, r = je(), a = n || r.range, i = ye((s) => a ? s.iiif.entities.Range[a] : void 0, [a]);
298
- return N(() => {
299
- if (i)
300
- return o ? o(i) : i;
301
- }, [i, o, ...t]);
302
- }
303
- function Wn({ startCanvas: e, disablePaging: t }) {
304
- var T;
305
- const n = ae(), o = Ce(), r = kt(), [a, i] = ie(void 0), s = r || o;
306
- if (!s)
307
- throw new Error("Nothing selected");
308
- const [f, h] = N(
309
- () => At(n, s, { disablePaging: t }),
310
- [n, s, t]
311
- ), u = xe(h);
312
- if (u.current !== h) {
313
- const E = u.current[a][0], L = h.findIndex((P) => P.includes(E));
314
- u.current = h, i(L);
315
- }
316
- const y = Q(
317
- (b) => {
318
- const E = h.findIndex((L) => L.includes(b));
319
- i(E === -1 ? 0 : E);
320
- },
321
- [f, h]
322
- ), x = Q(
323
- (b) => {
324
- const E = f.findIndex((L) => L.id === b);
325
- E !== -1 ? y(E) : i(0);
326
- },
327
- [f, h]
328
- ), M = Q(() => {
329
- i((b) => b >= h.length - 1 ? b : b + 1);
330
- }, [h]), C = Q(() => {
331
- i((b) => b <= 0 ? 0 : b - 1);
332
- }, [h]);
333
- return typeof a > "u" && (e ? x(e) : i(0)), {
334
- visibleItems: ((T = h[a]) == null ? void 0 : T.map((b) => f[b].id)) || [],
335
- cursor: a,
336
- items: f,
337
- sequence: h,
338
- hasPrevious: a > 0,
339
- hasNext: a < h.length - 1,
340
- setSequenceIndex: i,
341
- setCanvasIndex: y,
342
- setCanvasId: x,
343
- next: M,
344
- previous: C
345
- };
346
- }
347
- const De = () => {
348
- }, Xe = Te({
349
- setCurrentCanvasId: De,
350
- setCurrentCanvasIndex: De,
351
- nextCanvas: De,
352
- previousCanvas: De,
353
- items: [],
354
- sequence: [],
355
- setSequenceIndex: De,
356
- currentSequenceIndex: 0,
357
- hasNext: !1,
358
- hasPrevious: !1
359
- });
360
- function Hn(e) {
361
- const t = Ce(), {
362
- cursor: n,
363
- visibleItems: o,
364
- next: r,
365
- sequence: a,
366
- items: i,
367
- setCanvasIndex: s,
368
- setCanvasId: f,
369
- previous: h,
370
- setSequenceIndex: u,
371
- hasNext: y,
372
- hasPrevious: x
373
- } = Wn({
374
- startCanvas: e.startCanvas,
375
- disablePaging: e.pagingEnabled === !1
376
- }), M = N(
377
- () => ({
378
- sequence: a,
379
- items: i,
380
- // Extra functions.
381
- setCurrentCanvasId: f,
382
- nextCanvas: r,
383
- previousCanvas: h,
384
- totalCanvases: i.length,
385
- setCurrentCanvasIndex: s,
386
- setSequenceIndex: u,
387
- currentSequenceIndex: n,
388
- hasNext: y,
389
- hasPrevious: x
390
- }),
391
- [a, i, f, r, h, i, s, u, n]
392
- );
393
- return t ? o.length === 0 ? null : /* @__PURE__ */ d(Xe.Provider, { value: M, children: /* @__PURE__ */ d(Ge.Provider, { value: o, children: /* @__PURE__ */ d(Qe, { canvas: o[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ d("div", { children: "Sorry, something went wrong." }));
394
- }
395
- function Yn(e) {
396
- const t = dt(e.vault), n = qn(e.manifest);
397
- if (!n)
398
- return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ d("div", { children: "Sorry, something went wrong." });
399
- if (n.error)
400
- return /* @__PURE__ */ d("div", { children: n.error.toString() });
401
- if (!n.isLoaded)
402
- return /* @__PURE__ */ d("div", { children: "Loading..." });
403
- const o = /* @__PURE__ */ d(Hn, { ...e, children: e.children });
404
- return /* @__PURE__ */ d(ft, { vault: t, children: /* @__PURE__ */ d(Fn, { manifest: n.id, children: e.rangeId ? /* @__PURE__ */ d(Un, { range: e.rangeId, children: o }) : o }) });
405
- }
406
- function Nt() {
407
- return ue(Xe);
408
- }
409
- function zn() {
410
- return {
411
- VaultContext: ue(Ke),
412
- ResourceContext: ue(lt),
413
- SimpleViewerReactContext: ue(Xe),
414
- VisibleCanvasReactContext: ue(Ge)
415
- };
416
- }
417
- function Kn(e) {
418
- return /* @__PURE__ */ d(ft, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ d(Ge.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ d(Xe.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
419
- }
420
- const Ie = function(e) {
421
- return function() {
422
- const t = { type: e, getType: () => e, toString: () => e };
423
- return (n, o) => ({
424
- ...t,
425
- ...n !== void 0 && { payload: n },
426
- ...o !== void 0 && { meta: o }
427
- });
428
- };
429
- }, Qn = "@iiif/IMPORT_ENTITIES", Gn = "@iiif/MODIFY_ENTITY_FIELD", Xn = "@iiif/REORDER_ENTITY_FIELD", Jn = "@iiif/ADD_REFERENCE", Zn = "@iiif/UPDATE_REFERENCE", er = "@iiif/REMOVE_REFERENCE", tr = "@iiif/ADD_METADATA", nr = "@iiif/REMOVE_METADATA", rr = "@iiif/UPDATE_METADATA", or = "@iiif/REORDER_METADATA", ir = Ie(Qn)(), ar = Ie(Gn)(), sr = Ie(Xn)(), cr = Ie(Jn)(), ur = Ie(er)(), lr = Ie(Zn)(), fr = Ie(tr)(), dr = Ie(rr)(), pr = Ie(nr)(), hr = Ie(or)(), nt = {
430
- importEntities: ir,
431
- modifyEntityField: ar,
432
- reorderEntityField: sr,
433
- addReference: cr,
434
- removeReference: ur,
435
- updateReference: lr,
436
- addMetadata: fr,
437
- removeMetadata: pr,
438
- updateMetadata: dr,
439
- reorderMetadata: hr
440
- };
441
- function yr() {
442
- const t = ae().getStore();
443
- return N(() => (n) => t.dispatch(n), [t]);
444
- }
445
- function Tt(e) {
446
- return typeof e != "string" && e && e.bindToVault;
447
- }
448
- function gr() {
449
- const e = ae(), t = xe([]), n = yr(), o = N(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
450
- st(() => {
451
- const s = {
452
- id: o,
453
- type: "AnnotationPage",
454
- behavior: [],
455
- label: null,
456
- thumbnail: [],
457
- summary: null,
458
- requiredStatement: null,
459
- metadata: [],
460
- rights: null,
461
- provider: [],
462
- items: [],
463
- seeAlso: [],
464
- homepage: [],
465
- rendering: [],
466
- service: []
467
- };
468
- n(
469
- nt.importEntities({
470
- entities: {
471
- AnnotationPage: {
472
- [s.id]: s
473
- }
474
- }
475
- })
476
- );
477
- }, [o]);
478
- const r = ye(
479
- (s) => o ? s.iiif.entities.AnnotationPage[o] : null,
480
- [o]
481
- ), a = Q(
482
- (s, f) => {
483
- if (o) {
484
- if (Tt(s)) {
485
- const y = s;
486
- y.__vault || y.bindToVault(e), s = typeof y.source == "string" ? y.source : y.source.id, t.current[s] = y;
487
- } else
488
- typeof s != "string" && (s = s.id);
489
- const h = e.get({ id: o, type: "AnnotationPage" }), u = e.get({ id: s, type: "Annotation" });
490
- h && u && (h.items.find((y) => y.id === u.id) || n(
491
- nt.addReference({
492
- id: o,
493
- type: "AnnotationPage",
494
- key: "items",
495
- reference: {
496
- id: s,
497
- type: "Annotation"
498
- },
499
- index: f
500
- })
501
- ));
502
- }
503
- },
504
- [o]
505
- ), i = Q(
506
- (s) => {
507
- o && (Tt(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: o, type: "AnnotationPage" }) && n(
508
- nt.removeReference({
509
- id: o,
510
- type: "AnnotationPage",
511
- key: "items",
512
- reference: {
513
- id: s,
514
- type: "Annotation"
515
- }
516
- })
517
- ));
518
- },
519
- [o]
520
- );
521
- return [
522
- r,
523
- {
524
- addAnnotation: a,
525
- removeAnnotation: i
526
- }
527
- ];
528
- }
529
- const Vt = Te(null);
530
- function mr() {
531
- const e = ue(Vt);
532
- return [
533
- e.fullPage,
534
- {
535
- addAnnotation: e.addAnnotation,
536
- removeAnnotation: e.removeAnnotation
537
- }
538
- ];
539
- }
540
- function vr({ children: e }) {
541
- const [t, { addAnnotation: n, removeAnnotation: o }] = gr();
542
- return /* @__PURE__ */ d(
543
- Vt.Provider,
544
- {
545
- value: N(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: o }), [t]),
546
- children: e
547
- }
548
- );
549
- }
550
- function br({
551
- width: e,
552
- style: t,
553
- height: n,
554
- error: o,
555
- resetErrorBoundary: r
556
- }) {
557
- return /* @__PURE__ */ X("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
558
- /* @__PURE__ */ d("h3", { children: "Error occurred" }),
559
- /* @__PURE__ */ d("p", { children: o.message }),
560
- /* @__PURE__ */ d("button", { onClick: r, children: "Reset" })
561
- ] });
562
- }
563
- const pt = Te(null);
564
- function wr() {
565
- return ue(pt);
566
- }
567
- const _t = Te(
568
- () => {
569
- }
570
- ), Dt = Te(
571
- () => {
572
- }
573
- );
574
- function Ve(e, t, n, o, r = []) {
575
- const a = ue(e === "portal" ? Dt : _t);
576
- be(() => (e !== "none" && a(t, n, o), () => {
577
- a(t, null);
578
- }), [t, e, a, ...r]);
579
- }
580
- function Se(e = {}, t = []) {
581
- const { id: n, selector: o } = e, r = je(), a = n || r.canvas, i = ye((s) => a ? s.iiif.entities.Canvas[a] : void 0, [a]);
582
- return N(() => {
583
- if (i)
584
- return o ? o(i) : i;
585
- }, [i, o, ...t]);
586
- }
587
- const Bt = Te(() => {
588
- });
589
- function Pr(e) {
590
- const t = Se(), n = ue(Bt);
591
- be(() => t && t.id ? (n(t.id, e), () => n(t.id, -1)) : () => {
592
- }, [t, e]);
593
- }
594
- function Or({
595
- children: e,
596
- errorFallback: t,
597
- outerContainerProps: n = {},
598
- worldScale: o,
599
- ...r
600
- }) {
601
- const [a, i] = ie(), s = zn(), f = t || br, [h, u] = ie({}), y = Object.entries(h), [x, M] = ie({}), C = Object.entries(x), [T, b] = ie({}), E = N(() => o || Math.max(...Object.values(T)), [T]), L = N(() => ({ maxOverZoom: E || 1, ...r.runtimeOptions || {} }), [E, r.runtimeOptions]), P = Q((R, B) => {
602
- b((j) => {
603
- if (B === -1) {
604
- const { [R]: S, ...U } = j;
605
- return U;
606
- }
607
- return { ...j, [R]: B };
608
- });
609
- }, []), F = Q((R, B, j) => {
610
- u(({ [R]: S, ...U }) => B ? {
611
- ...U,
612
- [R]: { element: B, props: j }
613
- } : U);
614
- }, []), A = Q((R, B, j) => {
615
- M(({ [R]: S, ...U }) => B ? {
616
- ...U,
617
- [R]: { element: B, props: j }
618
- } : U);
619
- }, []);
620
- return /* @__PURE__ */ X(_n, { resetKeys: [], fallbackRender: (R) => /* @__PURE__ */ d(f, { ...r, ...R }), children: [
621
- /* @__PURE__ */ d(
622
- Sn,
623
- {
624
- ...r,
625
- containerProps: { style: { position: "relative" }, ...r.containerProps || {} },
626
- htmlChildren: /* @__PURE__ */ d(Oe, { children: y.map(([R, { element: B, props: j }]) => /* @__PURE__ */ d(Ee.Fragment, { children: /* @__PURE__ */ d(B, { ...j || {} }) }, R)) }),
627
- onCreated: (R) => {
628
- i(R), r.onCreated && r.onCreated(R);
629
- },
630
- runtimeOptions: L,
631
- children: /* @__PURE__ */ d(pt.Provider, { value: a, children: /* @__PURE__ */ d(Bt.Provider, { value: P, children: /* @__PURE__ */ d(_t.Provider, { value: F, children: /* @__PURE__ */ d(Dt.Provider, { value: A, children: /* @__PURE__ */ d(Kn, { bridge: s, children: /* @__PURE__ */ d(xn.Provider, { value: r.mode || "explore", children: /* @__PURE__ */ d(vr, { children: e }) }) }) }) }) }) })
632
- }
633
- ),
634
- /* @__PURE__ */ d("div", { children: C.map(([R, { element: B, props: j }]) => /* @__PURE__ */ d(Ee.Fragment, { children: /* @__PURE__ */ d(B, { ...j || {} }) }, R)) })
635
- ] });
636
- }
637
- const We = {}, qt = {
638
- get(e) {
639
- return e;
640
- },
641
- setMetaValue([e, t, n], o) {
642
- const r = qt.getResourceMeta(e, t), a = r ? r[n] : void 0, i = typeof o == "function" ? o(a) : o;
643
- We[e] = {
644
- ...We[e] || {},
645
- [t]: {
646
- ...(We[e] || {})[t] || {},
647
- [n]: i
648
- }
649
- };
650
- },
651
- getResourceMeta: (e, t) => {
652
- const n = We[e];
653
- if (n)
654
- return t ? n[t] : n;
655
- }
656
- };
657
- function Ft(e = qt) {
658
- return {
659
- addEventListener(t, n, o, r) {
660
- if (t)
661
- return e.setMetaValue(
662
- [t.id, "eventManager", n],
663
- (a) => {
664
- const i = a || [];
665
- for (const s of i)
666
- if (s.callback === o)
667
- return i;
668
- return [...i, { callback: o, scope: r }];
669
- }
670
- ), o;
671
- },
672
- removeEventListener(t, n, o) {
673
- t && e.setMetaValue(
674
- [t.id, "eventManager", n],
675
- (r) => (r || []).filter((a) => a.callback !== o)
676
- );
677
- },
678
- getListenersAsProps(t, n) {
679
- const o = typeof t == "string" ? { id: t } : t;
680
- if (!o || !o.id)
681
- return {};
682
- const r = e.getResourceMeta(o.id, "eventManager"), a = {};
683
- if (r && o)
684
- for (const i of Object.keys(r))
685
- a[i] = (s) => {
686
- const f = e.get(o);
687
- for (const { callback: h, scope: u } of r[i] || [])
688
- (!u || n && u.indexOf(n) !== -1) && h(s, f);
689
- };
690
- return a;
691
- }
692
- };
693
- }
694
- function Ut(e, t) {
695
- const n = ae(), o = N(() => Ft(n), [n]), r = ye(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
696
- return N(() => e ? o.getListenersAsProps(e, t) : {}, [r, e, n, t]);
697
- }
698
- function ze(e, t) {
699
- const n = ae(), o = N(() => ut(n), [n]);
700
- return ye(() => {
701
- if (!e)
702
- return null;
703
- const r = o.getAppliedStyles(e.id);
704
- return r ? t ? r[t] : r : void 0;
705
- }, [e, t]);
706
- }
707
- function $t(e = {}, t = []) {
708
- const { id: n, selector: o } = e, r = je(), a = ae(), i = n || r.annotation, s = ye(
709
- (h) => i ? h.iiif.entities.Annotation[i] : void 0,
710
- [i]
711
- ), f = ye(
712
- (h) => s && s.body ? s.body.map((u) => u ? u.type === "SpecificResource" ? {
713
- ...u,
714
- source: a.get(u)
715
- } : u ? h.iiif.entities[u.type][u.id] : null : null).filter(Boolean) : [],
716
- [s]
717
- );
718
- return N(() => {
719
- if (!s)
720
- return;
721
- const h = {
722
- ...s,
723
- body: f,
724
- target: ot(s.target, { typeMap: a.getState().iiif.mapping })
725
- };
726
- return o ? o(h) : h;
727
- }, [s, o, f, ...t]);
728
- }
729
- const Wt = ({
730
- id: e,
731
- style: t,
732
- className: n,
733
- interactive: o
734
- }) => {
735
- const r = $t({ id: e }), a = ze(r, "atlas"), i = ze(r, "html"), s = Ut(r, ["atlas"]), f = Se(), h = N(() => Tn(t, a), [t, a]);
736
- return f && r && r.target && r.target.selector && r.target.selector.type === "BoxSelector" && r.target.source && (r.target.source.id === f.id || r.target.source === f.id) ? /* @__PURE__ */ d(
737
- In,
738
- {
739
- id: r.id,
740
- isEditing: !0,
741
- region: r.target.selector.spatial,
742
- style: h,
743
- className: (i == null ? void 0 : i.className) || n,
744
- interactive: !!(i != null && i.href || o),
745
- href: (i == null ? void 0 : i.href) || null,
746
- title: (i == null ? void 0 : i.title) || null,
747
- hrefTarget: (i == null ? void 0 : i.target) || null,
748
- onClick: () => {
749
- },
750
- ...s
751
- }
752
- ) : null;
753
- };
754
- function Sr(e = {}, t = []) {
755
- const { id: n, selector: o } = e, r = je(), a = n || r.annotationPage, i = ye(
756
- (s) => a ? s.iiif.entities.AnnotationPage[a] : void 0,
757
- [a]
758
- );
759
- return N(() => {
760
- if (i)
761
- return o ? o(i) : i;
762
- }, [i, ...t]);
763
- }
764
- const at = ({
765
- className: e,
766
- page: t
767
- }) => {
768
- var a;
769
- const n = Sr({ id: t.id }) || t, o = ze(n, "atlas"), r = ze(n, "html");
770
- return ye((i) => n.id ? i.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ d(Ye, { children: (a = n.items) == null ? void 0 : a.map((i) => /* @__PURE__ */ d(
771
- Wt,
772
- {
773
- id: i.id,
774
- style: o,
775
- className: (r == null ? void 0 : r.className) || e
776
- },
777
- i.id
778
- )) });
779
- };
780
- function Ht({
781
- id: e,
782
- image: t,
783
- thumbnail: n,
784
- isStatic: o,
785
- x: r = 0,
786
- y: a = 0,
787
- children: i,
788
- selector: s,
789
- onClick: f,
790
- enableSizes: h
791
- }) {
792
- var y, x;
793
- const u = N(() => {
794
- if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
795
- return s.spatial;
796
- }, [s]);
797
- return /* @__PURE__ */ d(
798
- "world-object",
799
- {
800
- x: r + t.target.spatial.x,
801
- y: a + t.target.spatial.y,
802
- width: t.target.spatial.width,
803
- height: t.target.spatial.height,
804
- onClick: f,
805
- children: t.service ? /* @__PURE__ */ X(Ye, { children: [
806
- /* @__PURE__ */ d(
807
- En,
808
- {
809
- tiles: {
810
- id: t.service.id || t.service["@id"] || "unknown",
811
- height: t.height,
812
- width: t.width,
813
- imageService: t.service,
814
- thumbnail: n && n.type === "fixed" ? n : void 0
815
- },
816
- enableSizes: h,
817
- x: 0,
818
- y: 0,
819
- width: (y = t.target) == null ? void 0 : y.spatial.width,
820
- height: (x = t.target) == null ? void 0 : x.spatial.height,
821
- crop: u
822
- }
823
- ),
824
- i
825
- ] }, "service") : /* @__PURE__ */ X(Ye, { children: [
826
- /* @__PURE__ */ d(
827
- "world-image",
828
- {
829
- onClick: f,
830
- uri: t.id,
831
- target: { x: 0, y: 0, width: t.target.spatial.width, height: t.target.spatial.height },
832
- display: t.width && t.height ? {
833
- width: t.width,
834
- height: t.height
835
- } : void 0,
836
- crop: u
837
- }
838
- ),
839
- i
840
- ] }, "no-service")
841
- },
842
- e + (t.service ? "server" : "no-service")
843
- );
844
- }
845
- function So(e) {
846
- return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
847
- }
848
- function Yt(e, t) {
849
- const { selector: n, source: o } = Mn(t);
850
- if (o.id !== e.id)
851
- return [null, o];
852
- const r = {
853
- type: "BoxSelector",
854
- spatial: {
855
- x: 0,
856
- y: 0,
857
- width: Number(e.width),
858
- height: Number(e.height)
859
- }
860
- };
861
- return [
862
- n ? n.type === "TemporalSelector" ? {
863
- type: "TemporalBoxSelector",
864
- temporal: n.temporal,
865
- spatial: r.spatial
866
- } : n : null,
867
- o
868
- ];
869
- }
870
- const xr = {
871
- makeChoice: () => {
872
- }
873
- }, rt = { type: "unknown" }, ne = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), Tr = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
874
- function Ir(e, t) {
875
- var o;
876
- const n = (o = e == null ? void 0 : e.iiif) == null ? void 0 : o.meta[t];
877
- return n ? n.annotationPageManager : null;
878
- }
879
- function Er(e, t) {
880
- return ye(
881
- (n) => {
882
- const o = [];
883
- if (!e)
884
- return o;
885
- const r = Object.keys(n.iiif.entities.AnnotationPage);
886
- for (const a of r)
887
- if (!t || t.indexOf(a) !== -1) {
888
- const i = Ir(n, a);
889
- i && i.views && i.views[e] && o.push(a);
890
- }
891
- return o;
892
- },
893
- [e, t]
894
- );
895
- }
896
- function Cr({
897
- canvas: e,
898
- manifest: t,
899
- all: n,
900
- canvases: o
901
- }) {
902
- const r = [];
903
- if (t)
904
- for (const a of t.annotations)
905
- r.indexOf(a.id) === -1 && r.push(a.id);
906
- if (n) {
907
- if (o && o.length)
908
- for (const a of o)
909
- for (const i of a.annotations)
910
- r.indexOf(i.id) === -1 && r.push(i.id);
911
- } else if (e)
912
- for (const a of e.annotations)
913
- r.indexOf(a.id) === -1 && r.push(a.id);
914
- return r;
915
- }
916
- function jr(e, t) {
917
- var o;
918
- const n = (o = e == null ? void 0 : e.iiif) == null ? void 0 : o.meta[t];
919
- return n ? n.annotationPageManager : null;
920
- }
921
- function zt(e, t = {}) {
922
- const n = ae(), o = Ce(), r = Se(), a = Mt(), i = N(() => Cr({
923
- all: t.all,
924
- manifest: o,
925
- canvas: r,
926
- canvases: a
927
- }), [t.all, r, a, o]), s = Er(e, t.all ? void 0 : i), f = Q(
928
- (u) => {
929
- e && n.setMetaValue(
930
- [u, "annotationPageManager", "views"],
931
- (y) => y && !y[e] ? y : {
932
- ...y || {},
933
- [e]: !1
934
- }
935
- );
936
- },
937
- [e, n]
938
- ), h = Q(
939
- (u, y = {}) => {
940
- if (!e)
941
- return;
942
- const x = n.getState(), M = [];
943
- if (y != null && y.deselectOthers) {
944
- const C = Object.keys(x.iiif.entities.AnnotationPage);
945
- for (const T of C) {
946
- const b = jr(x, T);
947
- b && b.views && b.views[e] && M.push(T);
948
- }
949
- }
950
- for (const C of M)
951
- f(C);
952
- n.setMetaValue(
953
- [u, "annotationPageManager", "views"],
954
- (C) => C && C[e] ? C : {
955
- ...C || {},
956
- [e]: !0
957
- }
958
- );
959
- },
960
- [e, f, n]
961
- );
962
- return {
963
- availablePageIds: i,
964
- enabledPageIds: s,
965
- setPageEnabled: h,
966
- setPageDisabled: f
967
- };
968
- }
969
- function Mr(e, t) {
970
- return ye((n, o) => o.get(e.map((r) => ({ id: r, type: t }))), [e, t]);
971
- }
972
- const Rr = Ee.createContext(new Rn());
973
- function Je() {
974
- return ue(Rr);
975
- }
976
- function Lr() {
977
- const e = Je(), [t, n] = ie({}), o = xe(!1);
978
- return be(() => () => {
979
- o.current = !0;
980
- }, []), [Q(
981
- (a, { height: i, width: s }) => {
982
- if (a) {
983
- const f = a.id || a["@id"], h = e.loadServiceSync({
984
- id: f,
985
- width: a.width || s,
986
- height: a.height || i,
987
- source: a
988
- });
989
- h ? a = h : t[f] || (o.current || n((u) => ({
990
- ...u,
991
- [f]: "loading"
992
- })), e.loadService({
993
- id: f,
994
- width: a.width || s,
995
- height: a.height || i
996
- }).then(() => {
997
- o.current || n((u) => ({
998
- ...u,
999
- [f]: "done"
1000
- }));
1001
- }));
1002
- }
1003
- return a;
1004
- },
1005
- [e, t]
1006
- ), t];
1007
- }
1008
- function ht(e = {}) {
1009
- const t = $t(), n = Se(e.canvasId ? { id: e.canvasId } : void 0);
1010
- return ye(
1011
- (o, r) => {
1012
- if (!n)
1013
- return [];
1014
- if (t && e.enableSingleAnnotation)
1015
- return [t];
1016
- const a = r.get(n.items), i = [];
1017
- for (const s of a)
1018
- i.push(...r.get(s.items));
1019
- return i;
1020
- },
1021
- [n]
1022
- );
1023
- }
1024
- function Ar(e) {
1025
- return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
1026
- }
1027
- const He = {}, Kt = {
1028
- get(e) {
1029
- return e;
1030
- },
1031
- setMetaValue([e, t, n], o) {
1032
- const r = Kt.getResourceMeta(e, t), a = r ? r[n] : void 0, i = typeof o == "function" ? o(a) : o;
1033
- He[e] = {
1034
- ...He[e] || {},
1035
- [t]: {
1036
- ...(He[e] || {})[t] || {},
1037
- [n]: i
1038
- }
1039
- };
1040
- },
1041
- getResourceMeta: (e, t) => {
1042
- const n = He[e];
1043
- if (n)
1044
- return t ? n[t] : n;
1045
- }
1046
- };
1047
- function kr(e = Kt) {
1048
- function t(r) {
1049
- const a = r ? typeof r == "string" ? e.get(r) : r : null;
1050
- if (!a)
1051
- return [];
1052
- const i = e.get(a.items, { parent: a }), s = [];
1053
- for (const f of i)
1054
- s.push(...e.get(f.items, { parent: f }));
1055
- return s;
1056
- }
1057
- function n(r, a = []) {
1058
- const i = Array.isArray(r) ? r : t(r), s = [];
1059
- let f = null;
1060
- const h = [];
1061
- for (const u of i) {
1062
- if (u.type !== "Annotation")
1063
- throw new Error("getPaintables() accept either a canvas or list of annotations");
1064
- const y = Array.from(Array.isArray(u.body) ? u.body : [u.body]);
1065
- for (const x of y) {
1066
- const [M, { selector: C }] = Ar(x), T = e.get(M), b = (T.type || "unknown").toLowerCase();
1067
- if (b === "choice") {
1068
- const E = e.get(T.items, { parent: T.id }), L = a.length ? a.map((P) => E.find((F) => F.id === P)).filter(Boolean) : [E[0]];
1069
- L.length === 0 && L.push(E[0]), f = {
1070
- type: "single-choice",
1071
- items: E.map((P) => ({
1072
- id: P.id,
1073
- label: P.label,
1074
- selected: L.indexOf(P) !== -1
1075
- })),
1076
- label: M.label
1077
- }, y.push(...L);
1078
- continue;
1079
- }
1080
- s.indexOf(b) === -1 && s.push(b), h.push({
1081
- type: b,
1082
- annotationId: u.id,
1083
- resource: T,
1084
- target: u.target,
1085
- selector: C
1086
- });
1087
- }
1088
- }
1089
- return {
1090
- types: s,
1091
- items: h,
1092
- choice: f
1093
- };
1094
- }
1095
- function o(r) {
1096
- const { choice: a } = n(r);
1097
- return a;
1098
- }
1099
- return {
1100
- getAllPaintingAnnotations: t,
1101
- getPaintables: n,
1102
- extractChoices: o
1103
- };
1104
- }
1105
- function Nr(e, t = []) {
1106
- const n = ae(), o = N(() => kr(n), []), r = ht({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [a, i] = ie((e == null ? void 0 : e.defaultChoices) || []), s = N(
1107
- () => o.getPaintables(r, a),
1108
- [n, r, a, ...t]
1109
- ), h = { makeChoice: Q(
1110
- (u, { deselectOthers: y = !0, deselect: x = !1 } = {}) => {
1111
- if (s.choice) {
1112
- if (s.choice.type !== "single-choice")
1113
- throw new Error("Complex choice not supported yet");
1114
- i((M) => {
1115
- if (x) {
1116
- const T = M.filter((b) => b !== u);
1117
- if (T.length === 0) {
1118
- const b = s.items[0].resource.id;
1119
- return b ? [b] : [];
1120
- }
1121
- return T;
1122
- }
1123
- if (y)
1124
- return [u];
1125
- const C = [...M];
1126
- if (C.length === 0 && s.items.length) {
1127
- const T = s.items[0].resource.id;
1128
- T && C.push(T);
1129
- }
1130
- return M.indexOf(u) !== -1 ? M : [...M, u];
1131
- });
1132
- }
1133
- },
1134
- [s.choice]
1135
- ) };
1136
- return [s, h];
1137
- }
1138
- const Vr = ["model/gltf-binary"];
1139
- function _r(e, t) {
1140
- const o = t.items[0].resource;
1141
- return o.format ? Vr.indexOf(o.format) === -1 ? ne(`3D format: ${o.format} is unsupported`) : {
1142
- type: "3d-model",
1143
- model: o
1144
- } : ne("Unknown format");
1145
- }
1146
- function Dr(e, t) {
1147
- var o;
1148
- if (!e.duration)
1149
- return ne("No duration on canvas");
1150
- if (t.items.length > 1)
1151
- return ne("Only one audio source supported");
1152
- const n = (o = t.items[0]) == null ? void 0 : o.resource;
1153
- return n ? n.format ? {
1154
- type: "media",
1155
- media: {
1156
- annotationId: t.items[0].annotationId,
1157
- duration: e.duration,
1158
- url: n.id,
1159
- type: "Sound",
1160
- target: {
1161
- type: "TemporalSelector",
1162
- temporal: {
1163
- startTime: 0,
1164
- endTime: e.duration
1165
- }
1166
- },
1167
- format: n.format,
1168
- selector: {
1169
- type: "TemporalSelector",
1170
- temporal: {
1171
- startTime: 0,
1172
- endTime: e.duration
1173
- }
1174
- }
1175
- },
1176
- annotations: {
1177
- pages: []
1178
- }
1179
- } : ne("Audio does not have format") : ne("Unknown audio");
1180
- }
1181
- function Br(e, t, n) {
1182
- const o = [];
1183
- for (const r of t.items) {
1184
- const a = r.resource && r.resource.type === "SpecificResource" ? r.resource.source : r.resource;
1185
- if (!a.id)
1186
- return ne("No resource Identifier");
1187
- let i;
1188
- if (a.service) {
1189
- const M = it(a);
1190
- M[0] && (i = n(M[0], e));
1191
- }
1192
- const s = {
1193
- type: "BoxSelector",
1194
- spatial: {
1195
- x: 0,
1196
- y: 0,
1197
- width: Number(e.width),
1198
- height: Number(e.height)
1199
- }
1200
- }, [f, h] = Yt(e, r.target);
1201
- if (!(h.id === e.id || decodeURIComponent(h.id || "") === (e.id || "")))
1202
- continue;
1203
- r.resource.width && r.resource.height && (r.resource.width, r.resource.height);
1204
- let u = r.resource.type === "SpecificResource" ? ot(r.resource) : null;
1205
- if (r.selector) {
1206
- const M = ot({
1207
- type: "SpecificResource",
1208
- source: r.resource,
1209
- selector: r.selector
1210
- });
1211
- M && (u = M);
1212
- }
1213
- const y = u && u.selector && (u.selector.type === "BoxSelector" || u.selector.type === "TemporalBoxSelector") ? {
1214
- type: "BoxSelector",
1215
- spatial: {
1216
- x: u.selector.spatial.x,
1217
- y: u.selector.spatial.y,
1218
- width: u.selector.spatial.width,
1219
- height: u.selector.spatial.height
1220
- }
1221
- } : void 0;
1222
- i && !i.id && (i.id = i["@id"]);
1223
- const x = {
1224
- id: a.id,
1225
- type: "Image",
1226
- annotationId: r.annotationId,
1227
- width: Number(f || y ? a.width : e.width),
1228
- height: Number(f || y ? a.height : e.height),
1229
- service: i,
1230
- sizes: i && i.sizes ? i.sizes : a.width && a.height ? [{ width: a.width, height: a.height }] : [],
1231
- target: f && f.type !== "PointSelector" ? f : s,
1232
- selector: y
1233
- };
1234
- o.push(x);
1235
- }
1236
- return {
1237
- type: "images",
1238
- image: o[0],
1239
- images: o,
1240
- choice: t.choice
1241
- };
1242
- }
1243
- function Qt(e, t = {}, n) {
1244
- const o = e.language || n || "none";
1245
- switch (e.type) {
1246
- case "TextualBody": {
1247
- typeof e.value < "u" && (t[o] = e.value);
1248
- break;
1249
- }
1250
- case "List":
1251
- case "Composite":
1252
- case "Choice":
1253
- e.items && e.items.forEach((r) => Qt(r, t, o));
1254
- }
1255
- return t;
1256
- }
1257
- function qr(e, t) {
1258
- const n = [];
1259
- return t.items.forEach((o) => {
1260
- if (o.resource) {
1261
- const [r] = Yt(e, o.target);
1262
- n.push({ annotationId: o.annotationId, text: Qt(o.resource), target: r });
1263
- }
1264
- }), {
1265
- type: "textual-content",
1266
- items: n
1267
- };
1268
- }
1269
- const Fr = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1270
- function Ur(e, t) {
1271
- var s;
1272
- const n = t.items.filter((f) => f.type === "video");
1273
- let o = !1;
1274
- if (e.duration || (o = !0), n.length > 1)
1275
- return ne("Only one video source supported");
1276
- const r = (s = n[0]) == null ? void 0 : s.resource, a = !!(r.service || []).find(
1277
- (f) => (f.profile || "").includes("youtube.com")
1278
- );
1279
- if (!a && o)
1280
- return ne("Video does not have duration");
1281
- if (!r)
1282
- return ne("Unknown video");
1283
- if ((!r.format || r.format === "text/html") && !a)
1284
- return ne("Video does not have format");
1285
- const i = {
1286
- annotationId: t.items[0].annotationId,
1287
- duration: e.duration,
1288
- url: r.id,
1289
- type: "Video",
1290
- items: [],
1291
- target: {
1292
- type: "TemporalSelector",
1293
- temporal: {
1294
- startTime: 0,
1295
- endTime: e.duration
1296
- }
1297
- },
1298
- format: r.format,
1299
- selector: {
1300
- type: "TemporalSelector",
1301
- temporal: {
1302
- startTime: 0,
1303
- endTime: e.duration
1304
- }
1305
- }
1306
- };
1307
- if (a) {
1308
- i.type = "VideoYouTube";
1309
- const f = r.id.match(Fr);
1310
- if (!f[1])
1311
- return ne("Video is not known youtube video");
1312
- i.youTubeId = f[1];
1313
- }
1314
- return {
1315
- type: "media",
1316
- media: i,
1317
- annotations: {
1318
- pages: []
1319
- }
1320
- };
1321
- }
1322
- function $r({ canvas: e, paintables: t, supports: n, loadImageService: o }) {
1323
- if (!e)
1324
- return console.log("No canvas"), rt;
1325
- if (t.types.length === 0)
1326
- return n.indexOf("empty") !== -1 ? Tr(e.width, e.height) : (console.log("No paintables"), rt);
1327
- if (t.types.length !== 1)
1328
- if (t.types.length === 2 && t.types.indexOf("text") !== -1)
1329
- t.types = t.types.filter((a) => a !== "text");
1330
- else
1331
- return n.indexOf("complex-timeline") === -1 ? ne("Complex timeline not supported") : ne("ComplexTimelineStrategy not yet supported");
1332
- const r = t.types[0];
1333
- return r === "image" ? n.indexOf("images") === -1 ? ne("Image not supported") : Br(e, t, o) : r === "Model" || r === "model" ? n.indexOf("3d-model") === -1 ? ne("3D not supported") : _r(e, t) : r === "textualbody" ? n.indexOf("textual-content") === -1 ? ne("Textual content not supported") : qr(e, t) : r === "sound" || r === "audio" ? n.indexOf("media") === -1 ? ne("Media not supported") : Dr(e, t) : r === "video" ? n.indexOf("media") === -1 ? ne("Media not supported") : Ur(e, t) : rt;
1334
- }
1335
- function Wr(e) {
1336
- const t = Ce(), n = Se(), o = ae(), [r, a] = Lr(), { enabledPageIds: i } = zt((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
1337
- all: !1
1338
- }), s = Mr(i, "AnnotationPage"), f = (e == null ? void 0 : e.strategies) || [
1339
- "empty",
1340
- "images",
1341
- "media",
1342
- "textual-content",
1343
- "complex-timeline"
1344
- ], [h, u] = Nr(e, [a]), y = N(() => $r({ canvas: n, paintables: h, supports: f, loadImageService: r }), [n, h, o, u.makeChoice]);
1345
- return N(() => y.type === "unknown" ? [y, xr] : [
1346
- {
1347
- ...y,
1348
- annotations: { pages: s }
1349
- },
1350
- u
1351
- ], [y, s]);
1352
- }
1353
- const Hr = (e, t = []) => {
1354
- const n = ae();
1355
- be(() => {
1356
- e(n);
1357
- }, [n, ...t]);
1358
- };
1359
- function Gt(e, t, { canvasId: n, manifestId: o } = {}) {
1360
- const r = ae(), a = Je(), i = N(() => kn(r, { imageServiceLoader: a }), [r, a]), [s, f] = ie(), h = Ce(o ? { id: o } : void 0), u = Se(n ? { id: n } : void 0), y = u || h, x = xe(!1);
1361
- if (be(() => (x.current = !1, () => {
1362
- x.current = !0;
1363
- }), []), !y)
1364
- throw new Error("Must be called under a manifest or canvas context.");
1365
- return Hr(
1366
- (M) => {
1367
- i.getBestThumbnailAtSize(y, e, t).then((C) => {
1368
- C.best && !x.current && f(C.best);
1369
- });
1370
- },
1371
- [y]
1372
- ), s;
1373
- }
1374
- function Yr(e) {
1375
- return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: e };
1376
- }
1377
- function zr(e, t) {
1378
- switch (t.type) {
1379
- case "FINISHED":
1380
- return { ...e, isFinished: !0, isPlaying: !1, playRequested: !1 };
1381
- case "PLAY_PAUSE":
1382
- return { ...e, isFinished: !1, isPlaying: !e.isPlaying };
1383
- case "PLAY_REQUESTED":
1384
- return { ...e, isFinished: !1, playRequested: !0 };
1385
- case "PAUSE":
1386
- return { ...e, isPlaying: !1 };
1387
- case "PLAY":
1388
- return { ...e, isFinished: !1, playRequested: !1, isPlaying: !0 };
1389
- case "MUTE":
1390
- return { ...e, isMuted: !0 };
1391
- case "SET_VOLUME":
1392
- return { ...e, volume: t.volume, isMuted: t.volume === 0 };
1393
- case "TOGGLE_MUTE":
1394
- return { ...e, isMuted: !e.isMuted };
1395
- case "UNMUTE":
1396
- return { ...e, isMuted: !1 };
1397
- }
1398
- return e;
1399
- }
1400
- function Kr(e) {
1401
- const t = Math.round(e);
1402
- return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
1403
- }
1404
- function yt(e) {
1405
- const [t, n] = On(zr, Yr(e.duration)), o = xe(null), r = xe(null), a = xe(null), i = xe(!1), s = Q(() => {
1406
- r.current && o.current && (r.current.innerHTML = Kr(o.current.currentTime), a.current && (a.current.style.width = `${o.current.currentTime / e.duration * 100}%`), i.current !== o.current.muted && (i.current = o.current.muted, n(o.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
1407
- }, [e.duration]), f = Q(() => {
1408
- o.current && (n({ type: "PLAY_REQUESTED" }), o.current.play().then(() => {
1409
- n({ type: "PLAY" });
1410
- }), s());
1411
- }, [s]), h = Q(() => {
1412
- o.current && (o.current.duration > 0 && o.current.paused ? f() : u());
1413
- }, [s]), u = Q(() => {
1414
- o.current && (o.current.pause(), n({ type: "PAUSE" }), s());
1415
- }, [s]), y = Q(() => {
1416
- o.current && (o.current.muted = !o.current.muted, n(o.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
1417
- }, []), x = Q(() => {
1418
- o.current && (o.current.muted = !0, n({ type: "MUTE" }));
1419
- }, []), M = Q(() => {
1420
- o.current && (o.current.muted = !1, n({ type: "UNMUTE" }));
1421
- }, []), C = Q((E) => {
1422
- o.current && (o.current.muted = !1, o.current.volume = E / 100, n({ type: "SET_VOLUME", volume: E }));
1423
- }, []), T = Q((E) => {
1424
- o.current && (o.current.currentTime = Math.max(0, Math.min(E * e.duration, e.duration)), s());
1425
- }, []), b = Q((E) => {
1426
- o.current && (o.current.currentTime = Math.max(0, Math.min(E, e.duration)), s());
1427
- }, []);
1428
- return be(() => {
1429
- const E = setInterval(() => {
1430
- s();
1431
- }, 350);
1432
- return () => clearInterval(E);
1433
- }, [s, e.duration]), be(() => {
1434
- const E = () => {
1435
- n({ type: "FINISHED" });
1436
- }, L = o.current;
1437
- return L == null || L.addEventListener("ended", E), () => L == null ? void 0 : L.removeEventListener("ended", E);
1438
- }, []), [
1439
- { element: o, currentTime: r, progress: a },
1440
- t,
1441
- {
1442
- play: f,
1443
- pause: u,
1444
- playPause: h,
1445
- mute: x,
1446
- unmute: M,
1447
- toggleMute: y,
1448
- setVolume: C,
1449
- setDurationPercent: T,
1450
- setTime: b
1451
- }
1452
- ];
1453
- }
1454
- const Xt = Te(null), Jt = Te(null), Zt = Te(null);
1455
- function xo() {
1456
- const e = ue(Xt);
1457
- if (!e)
1458
- throw new Error("Ctx not found");
1459
- return e;
1460
- }
1461
- function To() {
1462
- const e = ue(Jt);
1463
- if (!e)
1464
- throw new Error("Ctx not found");
1465
- return e;
1466
- }
1467
- function Io() {
1468
- const e = ue(Zt);
1469
- if (!e)
1470
- throw new Error("Ctx not found");
1471
- return e;
1472
- }
1473
- function en({
1474
- actions: e,
1475
- state: t,
1476
- children: n,
1477
- currentTime: o,
1478
- progress: r,
1479
- element: a
1480
- }) {
1481
- return /* @__PURE__ */ d(Zt.Provider, { value: { currentTime: o, progress: r, element: a }, children: /* @__PURE__ */ d(Jt.Provider, { value: e, children: /* @__PURE__ */ d(Xt.Provider, { value: t, children: n }) }) });
1482
- }
1483
- function tn({ media: e, children: t }) {
1484
- const [{ element: n, currentTime: o, progress: r }, a, i] = yt({ duration: e.duration });
1485
- return /* @__PURE__ */ X(
1486
- en,
1487
- {
1488
- state: a,
1489
- actions: i,
1490
- currentTime: o,
1491
- progress: r,
1492
- element: n,
1493
- children: [
1494
- /* @__PURE__ */ d("audio", { ref: n, src: e.url }),
1495
- t
1496
- ]
1497
- }
1498
- );
1499
- }
1500
- function nn({
1501
- media: e,
1502
- mediaControlsDeps: t,
1503
- children: n
1504
- }) {
1505
- return Ve("portal", "audio", tn, { media: e, children: n }, [e, ...t || []]), null;
1506
- }
1507
- function rn({
1508
- element: e,
1509
- media: t,
1510
- playPause: n
1511
- }) {
1512
- return /* @__PURE__ */ X("div", { className: "video-container", part: "video-container", onClick: n, children: [
1513
- /* @__PURE__ */ d("style", { children: `
1514
- .video-container {
1515
- position: absolute;
1516
- top: 0;
1517
- bottom: 0;
1518
- left: 0;
1519
- right: 0;
1520
- background: #000;
1521
- z-index: 13;
1522
- display: flex;
1523
- justify-content: center;
1524
- pointer-events: visible;
1525
- }
1526
- ` }),
1527
- /* @__PURE__ */ d("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1528
- ] });
1529
- }
1530
- function on({
1531
- media: e,
1532
- mediaControlsDeps: t,
1533
- children: n
1534
- }) {
1535
- const [{ element: o, currentTime: r, progress: a }, i, s] = yt({ duration: e.duration });
1536
- return Ve("overlay", "video-element", rn, {
1537
- element: o,
1538
- media: e,
1539
- playPause: s.playPause
1540
- }), Ve(
1541
- "portal",
1542
- "custom-controls",
1543
- en,
1544
- {
1545
- state: i,
1546
- actions: s,
1547
- currentTime: r,
1548
- progress: a,
1549
- element: o,
1550
- children: n
1551
- },
1552
- [r, i, e, ...t || []]
1553
- ), null;
1554
- }
1555
- function an({ model: e }) {
1556
- return /* @__PURE__ */ X(Oe, { children: [
1557
- /* @__PURE__ */ d("style", { children: `
1558
- .model-container {
1559
- position: absolute;
1560
- top: 0;
1561
- bottom: 0;
1562
- left: 0;
1563
- right: 0;
1564
- background: #000;
1565
- z-index: 13;
1566
- display: flex;
1567
- justify-content: center;
1568
- pointer-events: visible;
1569
- }
1570
- ` }),
1571
- /* @__PURE__ */ d("div", { className: "model-container", children: /* @__PURE__ */ d(
1572
- "model-viewer",
1573
- {
1574
- "interaction-prompt": "none",
1575
- style: { width: "100%", height: "100%" },
1576
- "camera-controls": "",
1577
- "ar-status": "not-presenting",
1578
- src: e.id
1579
- }
1580
- ) })
1581
- ] });
1582
- }
1583
- function sn({ model: e, name: t }) {
1584
- return Ve("overlay", `model-${t}`, an, { model: e }, [e]), null;
1585
- }
1586
- function cn({ style: e }) {
1587
- const t = Se();
1588
- return !t || !t.height || !t.width ? null : /* @__PURE__ */ d(
1589
- "box",
1590
- {
1591
- interactive: !1,
1592
- target: { x: 0, y: 0, width: Number(t.width), height: Number(t.height) },
1593
- style: e
1594
- }
1595
- );
1596
- }
1597
- const un = Ee.createContext("en");
1598
- function Eo(e) {
1599
- return /* @__PURE__ */ d(un.Provider, { value: e.language, children: e.children });
1600
- }
1601
- function gt() {
1602
- return Ee.useContext(un);
1603
- }
1604
- function It(e) {
1605
- return e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : e;
1606
- }
1607
- function Qr({ as: e, language: t, children: n, viewingDirection: o, ...r }) {
1608
- const a = gt();
1609
- return N(() => It(a) === It(t), [a, t]) ? e ? /* @__PURE__ */ d(e, { ...r, children: n }) : /* @__PURE__ */ d("span", { ...r, children: n }) : e ? /* @__PURE__ */ d(e, { ...r, lang: t, dir: o, children: n }) : /* @__PURE__ */ d("span", { ...r, lang: t, dir: o, children: n });
1610
- }
1611
- function ln(e, t, n) {
1612
- if (t.length === 0)
1613
- return;
1614
- if (t.length === 1)
1615
- return t[0];
1616
- if (t.indexOf(e) !== -1)
1617
- return e;
1618
- const o = e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : null;
1619
- if (o && t.indexOf(o) !== -1)
1620
- return o;
1621
- for (const r of n)
1622
- if (t.indexOf(r) !== -1)
1623
- return r;
1624
- return t.indexOf("none") !== -1 ? "none" : t.indexOf("@none") !== -1 ? "@none" : t[0];
1625
- }
1626
- const Gr = (e, t = []) => {
1627
- const n = gt();
1628
- return N(() => {
1629
- const o = e();
1630
- return ln(n, o, []);
1631
- }, [n, ...t]);
1632
- };
1633
- function Xr(e, t, n = `
1634
- `) {
1635
- const o = Gr(() => Object.keys(e || {}), [e]);
1636
- return [
1637
- N(() => {
1638
- if (!e)
1639
- return t || "";
1640
- if (typeof e == "string")
1641
- return e;
1642
- const r = o ? e[o] : void 0;
1643
- return r ? typeof r == "string" ? r : r.join(n) : "";
1644
- }, [o, t, e]),
1645
- o
1646
- ];
1647
- }
1648
- function Co() {
1649
- const e = gt();
1650
- return function(n, o, r) {
1651
- const a = Object.keys(n || {}), i = ln(e, a, []);
1652
- if (!n)
1653
- return o || "";
1654
- if (typeof n == "string")
1655
- return n;
1656
- const s = i ? n[i] : void 0;
1657
- return s ? typeof s == "string" ? s : s.join(typeof r < "u" ? r : `
1658
- `) : "";
1659
- };
1660
- }
1661
- function Ne({
1662
- as: e,
1663
- defaultText: t,
1664
- enableDangerouslySetInnerHTML: n,
1665
- children: o,
1666
- separator: r,
1667
- ...a
1668
- }) {
1669
- const [i, s] = Xr(o, t, r);
1670
- return s ? /* @__PURE__ */ d(
1671
- Qr,
1672
- {
1673
- ...a,
1674
- as: e,
1675
- language: s,
1676
- title: n ? void 0 : i,
1677
- dangerouslySetInnerHTML: n ? {
1678
- __html: i
1679
- } : void 0,
1680
- children: n ? void 0 : i
1681
- }
1682
- ) : e ? /* @__PURE__ */ d(e, { ...a, children: i }) : /* @__PURE__ */ d(
1683
- "span",
1684
- {
1685
- ...a,
1686
- title: n ? void 0 : i,
1687
- dangerouslySetInnerHTML: n ? {
1688
- __html: i
1689
- } : void 0,
1690
- children: n ? void 0 : i
1691
- }
1692
- );
1693
- }
1694
- function Jr({
1695
- element: e,
1696
- media: t,
1697
- playPause: n
1698
- }) {
1699
- const o = xe(null);
1700
- return t.youTubeId ? /* @__PURE__ */ X("div", { className: "video-container", part: "video-container", onClick: n, children: [
1701
- /* @__PURE__ */ d("style", { children: `
1702
- .video-container {
1703
- position: absolute;
1704
- top: 0;
1705
- bottom: 0;
1706
- left: 0;
1707
- right: 0;
1708
- background: #000;
1709
- z-index: 13;
1710
- display: flex;
1711
- justify-content: center;
1712
- pointer-events: visible;
1713
- }
1714
- .video-yt {
1715
- border: none;
1716
- width: 100%;
1717
- object-fit: contain;
1718
- }
1719
- ` }),
1720
- /* @__PURE__ */ d(
1721
- "iframe",
1722
- {
1723
- className: "video-yt",
1724
- ref: o,
1725
- src: `https://www.youtube.com/embed/${t.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
1726
- referrerPolicy: "no-referrer",
1727
- sandbox: "allow-scripts allow-same-origin allow-presentation"
1728
- }
1729
- )
1730
- ] }) : null;
1731
- }
1732
- function Zr({
1733
- media: e,
1734
- mediaControlsDeps: t,
1735
- children: n
1736
- }) {
1737
- const [{ element: o, currentTime: r, progress: a }, i, s] = yt({ duration: e.duration });
1738
- return Ve("overlay", "video-element", Jr, {
1739
- element: o,
1740
- media: e,
1741
- playPause: s.playPause
1742
- }), null;
1743
- }
1744
- function fn({
1745
- x: e,
1746
- y: t,
1747
- onChoiceChange: n,
1748
- registerActions: o,
1749
- defaultChoices: r,
1750
- isStatic: a,
1751
- renderViewerControls: i,
1752
- renderMediaControls: s,
1753
- viewControlsDeps: f,
1754
- mediaControlsDeps: h,
1755
- strategies: u,
1756
- throwOnUnknown: y,
1757
- backgroundStyle: x,
1758
- alwaysShowBackground: M,
1759
- keepCanvasScale: C = !1,
1760
- enableSizes: T = !1,
1761
- enableYouTube: b = !0,
1762
- onClickPaintingAnnotation: E,
1763
- children: L
1764
- }) {
1765
- const P = Se(), F = Ut(P, ["deep-zoom"]), [A] = mr(), R = wr(), B = ae(), j = N(() => ut(B), [B]), [S, U] = Wr({
1766
- strategies: u || ["images"],
1767
- defaultChoices: r == null ? void 0 : r.map(({ id: V }) => V)
1768
- }), H = S.type === "images" ? S.choice : void 0, G = N(() => C ? 1 : Math.max(
1769
- 1,
1770
- ...S.type === "images" ? S.images.map((V) => {
1771
- var te;
1772
- return (V.width || 0) / ((te = V.target) == null ? void 0 : te.spatial.width);
1773
- }) : []
1774
- ), [C, S]);
1775
- Pr(G), be(() => {
1776
- o && o(U);
1777
- }, [S.annotations]), be(() => {
1778
- if (r)
1779
- for (const V of r)
1780
- typeof V.opacity < "u" && j.applyStyles({ id: V.id }, "atlas", {
1781
- opacity: V.opacity
1782
- });
1783
- }, [r]), st(() => {
1784
- n && n(H);
1785
- }, [H]), Ve(
1786
- R && (S.type === "images" || S.type === "empty" || S.type === "textual-content" && i) ? "overlay" : "none",
1787
- `canvas-portal-controls-${P == null ? void 0 : P.id}`,
1788
- pt.Provider,
1789
- i ? {
1790
- value: R || null,
1791
- children: i(S)
1792
- } : {},
1793
- [P, R, S, ...f || []]
1794
- );
1795
- const Y = Gt({ maxWidth: 256, maxHeight: 256 });
1796
- if (!P)
1797
- return null;
1798
- const Z = P.accompanyingCanvas, ee = Y && Y.type === "fixed" ? /* @__PURE__ */ d("world-object", { height: P.height, width: P.width, x: e, y: t, children: /* @__PURE__ */ d(
1799
- "world-image",
1800
- {
1801
- uri: Y.id,
1802
- target: { x: 0, y: 0, width: P.width, height: P.height },
1803
- display: Y.width && Y.height ? {
1804
- width: Y.width,
1805
- height: Y.height
1806
- } : void 0,
1807
- crop: void 0
1808
- }
1809
- ) }) : null;
1810
- if (S.type === "unknown") {
1811
- if (ee)
1812
- return ee;
1813
- if (y)
1814
- throw new Error(S.reason || "Unknown image strategy");
1815
- return null;
1816
- }
1817
- const se = /* @__PURE__ */ X(Ye, { children: [
1818
- A ? /* @__PURE__ */ d(at, { page: A }) : null,
1819
- S.annotations && S.annotations.pages ? S.annotations.pages.map((V) => /* @__PURE__ */ d(at, { page: V }, V.id)) : null,
1820
- L
1821
- ] }), me = S.type === "images" ? S.images.length : 0;
1822
- return /* @__PURE__ */ X(Oe, { children: [
1823
- /* @__PURE__ */ X(
1824
- "world-object",
1825
- {
1826
- height: P.height,
1827
- width: P.width,
1828
- x: e,
1829
- y: t,
1830
- ...F,
1831
- children: [
1832
- S.type === "empty" || M ? /* @__PURE__ */ d(cn, { style: x }) : null,
1833
- S.type === "textual-content" ? S.items.map((V, te) => {
1834
- var $;
1835
- return /* @__PURE__ */ X(Oe, { children: [
1836
- /* @__PURE__ */ d(
1837
- Cn,
1838
- {
1839
- onClick: E ? (le) => {
1840
- le.stopPropagation(), E(V.annotationId, V, le);
1841
- } : void 0,
1842
- target: (($ = V.target) == null ? void 0 : $.spatial) || void 0,
1843
- children: /* @__PURE__ */ d("div", { "data-textual-content": !0, children: /* @__PURE__ */ d(Ne, { enableDangerouslySetInnerHTML: !0, children: V.text }) })
1844
- },
1845
- te
1846
- ),
1847
- se
1848
- ] });
1849
- }) : null,
1850
- S.type === "images" ? /* @__PURE__ */ X(Oe, { children: [
1851
- S.images.map((V, te) => /* @__PURE__ */ d(
1852
- Ht,
1853
- {
1854
- isStatic: a,
1855
- image: V,
1856
- id: V.id,
1857
- thumbnail: te === 0 ? Y : void 0,
1858
- selector: V.selector,
1859
- enableSizes: T,
1860
- onClick: E ? ($) => {
1861
- $.stopPropagation(), E(V.annotationId, V, $);
1862
- } : void 0
1863
- },
1864
- V.id + te
1865
- )),
1866
- se
1867
- ] }) : null,
1868
- S.type === "3d-model" ? /* @__PURE__ */ d(sn, { model: S.model }) : null,
1869
- S.type === "media" ? /* @__PURE__ */ d(Oe, { children: S.media.type === "Sound" ? /* @__PURE__ */ X(nn, { media: S.media, mediaControlsDeps: h, children: [
1870
- ee,
1871
- s ? s(S) : null
1872
- ] }) : S.media.type === "Video" ? /* @__PURE__ */ X(on, { media: S.media, mediaControlsDeps: h, children: [
1873
- ee,
1874
- s ? s(S) : null
1875
- ] }) : S.media.type === "VideoYouTube" && b ? /* @__PURE__ */ X(Zr, { media: S.media, mediaControlsDeps: h, children: [
1876
- ee,
1877
- s ? s(S) : null
1878
- ] }) : null }) : null
1879
- ]
1880
- },
1881
- `${P.id}/${S.type}/${me}`
1882
- ),
1883
- S.type === "media" && S.media.type === "Sound" && Z ? /* @__PURE__ */ d(Qe, { canvas: Z.id, children: /* @__PURE__ */ d(fn, { renderViewerControls: i }) }) : null
1884
- ] });
1885
- }
1886
- const eo = ct(function(t, n) {
1887
- const o = Ce(), r = Mt(), a = Nt(), { ViewerControls: i, MediaControls: s } = t.components || {};
1888
- if (Et(n, () => a, [a]), !o)
1889
- return /* @__PURE__ */ d("div", {});
1890
- let f = 0;
1891
- return /* @__PURE__ */ X(Oe, { children: [
1892
- t.header,
1893
- /* @__PURE__ */ d(
1894
- ge.Viewer,
1895
- {
1896
- height: t.height,
1897
- mode: t.mode,
1898
- children: r.map((h, u) => {
1899
- const y = f;
1900
- return f += h.width + (t.spacing || 0), /* @__PURE__ */ d(Qe, { canvas: h.id, children: /* @__PURE__ */ d(
1901
- ge.RenderCanvas,
1902
- {
1903
- strategies: ["3d-model", "media", "images", "empty", "textual-content"],
1904
- renderViewerControls: u === 0 && i ? () => /* @__PURE__ */ d(i, {}) : void 0,
1905
- renderMediaControls: u === 0 && s ? () => /* @__PURE__ */ d(s, {}) : void 0,
1906
- x: y,
1907
- ...t.canvasProps || {},
1908
- children: t.annotations
1909
- },
1910
- h.id
1911
- ) }, h.id);
1912
- })
1913
- },
1914
- t.reuseAtlas ? "" : a.currentSequenceIndex
1915
- ),
1916
- t.children
1917
- ] });
1918
- }), ge = ct(function({ children: t, height: n, annotations: o, canvasProps: r, spacing: a, header: i, components: s, mode: f, reuseAtlas: h, ...u }, y) {
1919
- const x = dt();
1920
- return /* @__PURE__ */ d(ft, { vault: x, children: /* @__PURE__ */ d(Yn, { ...u, children: /* @__PURE__ */ d(
1921
- eo,
1922
- {
1923
- ref: y,
1924
- height: n,
1925
- components: s,
1926
- spacing: a,
1927
- canvasProps: r,
1928
- annotations: o,
1929
- header: i,
1930
- mode: f,
1931
- reuseAtlas: h,
1932
- children: t
1933
- }
1934
- ) }) });
1935
- });
1936
- ge.RenderImage = Ht;
1937
- ge.RenderCanvas = fn;
1938
- ge.RenderAnnotationPage = at;
1939
- ge.RenderAnnotation = Wt;
1940
- ge.Viewer = Or;
1941
- ge.CanvasBackground = cn;
1942
- ge.Audio = nn;
1943
- ge.Video = on;
1944
- ge.Model = sn;
1945
- ge.AudioHTML = tn;
1946
- ge.VideoHTML = rn;
1947
- ge.ModelHTML = an;
1948
- const jo = ct(
1949
- function({ canvasId: t }, n) {
1950
- const o = jn(), r = zt(t || (o == null ? void 0 : o.id)), a = ae();
1951
- return Et(n, () => r, [t, o]), !o || r.enabledPageIds.length === 0 ? null : /* @__PURE__ */ d(Oe, { children: r.enabledPageIds.map((i) => /* @__PURE__ */ d(ge.RenderAnnotationPage, { page: a.get(i) }, i)) });
1952
- }
1953
- );
1954
- function dn({
1955
- metadata: e = [],
1956
- config: t,
1957
- labelWidth: n = 16,
1958
- showEmptyMessage: o = !0,
1959
- allowHtml: r,
1960
- emptyFallback: a,
1961
- classes: i = {},
1962
- emptyMessage: s = "No metadata available",
1963
- emptyValueFallback: f = "No value",
1964
- emptyLabelFallback: h = "",
1965
- separator: u,
1966
- tableFooter: y,
1967
- tableHeader: x
1968
- }) {
1969
- const M = N(() => {
1970
- const T = (t || []).reduce((E, L) => [...E, ...L.keys], []), b = {};
1971
- for (const E of e) {
1972
- const L = E && E.label ? Object.values(E.label) : [];
1973
- for (const P of L)
1974
- if (P && P.length && (T.indexOf(`metadata.${P[0]}`) !== -1 || T.length === 0) && E) {
1975
- const F = `metadata.${P[0]}`;
1976
- b[F] = b[F] ? b[F] : [], b[F].push(E);
1977
- break;
1978
- }
1979
- }
1980
- return b;
1981
- }, [t, e]);
1982
- return Object.keys(M).length === 0 && o ? /* @__PURE__ */ d(Oe, { children: a }) || /* @__PURE__ */ d("div", { className: i.empty, children: s }) : t && t.length ? /* @__PURE__ */ X("table", { className: i.container, children: [
1983
- x,
1984
- /* @__PURE__ */ d("tbody", { children: t.map((T, b) => {
1985
- const E = [];
1986
- for (const L of T.keys)
1987
- for (const P of M[L] || [])
1988
- E.push(
1989
- /* @__PURE__ */ d(
1990
- Ne,
1991
- {
1992
- enableDangerouslySetInnerHTML: r,
1993
- defaultText: f,
1994
- separator: u,
1995
- children: P.value
1996
- },
1997
- b + "__" + L
1998
- )
1999
- );
2000
- return E.length === 0 ? null : /* @__PURE__ */ X("tr", { className: i.row, children: [
2001
- /* @__PURE__ */ d("td", { className: i.label, style: n ? { minWidth: n } : {}, children: /* @__PURE__ */ d(
2002
- Ne,
2003
- {
2004
- enableDangerouslySetInnerHTML: r,
2005
- separator: u,
2006
- defaultText: h,
2007
- children: T.label
2008
- }
2009
- ) }),
2010
- /* @__PURE__ */ d("td", { className: i.value, children: E })
2011
- ] }, b);
2012
- }) }),
2013
- y
2014
- ] }) : /* @__PURE__ */ X("table", { className: i.container, children: [
2015
- x,
2016
- /* @__PURE__ */ d("tbody", { children: e && e.length ? e.map((T, b) => T ? /* @__PURE__ */ X("tr", { className: i.row, children: [
2017
- /* @__PURE__ */ d("td", { className: i.label, style: n ? { minWidth: n } : {}, children: /* @__PURE__ */ d(
2018
- Ne,
2019
- {
2020
- enableDangerouslySetInnerHTML: r,
2021
- defaultText: f,
2022
- separator: u,
2023
- children: T.label
2024
- }
2025
- ) }),
2026
- /* @__PURE__ */ d("td", { className: i.value, children: /* @__PURE__ */ d(
2027
- Ne,
2028
- {
2029
- enableDangerouslySetInnerHTML: r,
2030
- defaultText: f,
2031
- separator: u,
2032
- children: T.value
2033
- }
2034
- ) })
2035
- ] }, b) : null) : null }),
2036
- y
2037
- ] });
2038
- }
2039
- function Mo(e) {
2040
- const t = Ce(), n = Se(), o = kt(), r = N(() => {
2041
- const a = (t == null ? void 0 : t.metadata) || [], i = (n == null ? void 0 : n.metadata) || [], s = (o == null ? void 0 : o.metadata) || [];
2042
- return [...a, ...i, ...s];
2043
- }, [t, n, o]);
2044
- return /* @__PURE__ */ d(dn, { metadata: r, ...e });
2045
- }
2046
- function pn(e, t = {}, n = []) {
2047
- return N(() => {
2048
- var i, s;
2049
- if (!e)
2050
- return null;
2051
- let o = t.quality;
2052
- e && e.extraQualities && t.quality && (e.extraQualities.includes(t.quality) || (console.log("Invalid quality", t.quality, e.extraQualities), o = "default"));
2053
- const r = Ln(e);
2054
- return An({
2055
- identifier: r.identifier,
2056
- server: r.server,
2057
- scheme: r.scheme,
2058
- type: "image",
2059
- size: {
2060
- max: !((i = t.size) != null && i.width) && !((s = t.size) != null && s.height),
2061
- confined: !1,
2062
- upscaled: !1,
2063
- ...t.size || {}
2064
- },
2065
- format: t.format || "jpg",
2066
- // This isn't how it should be modelled, always full,
2067
- // region: data.selector ? data.selector : { full: true },
2068
- region: t.region || { full: !0 },
2069
- rotation: t != null && t.rotation ? Number.isInteger(t.rotation) ? { angle: t.rotation } : t.rotation : { angle: 0 },
2070
- quality: o || "default",
2071
- prefix: r.prefix,
2072
- originalPath: r.originalPath
2073
- });
2074
- }, [...n]);
2075
- }
2076
- function to(e) {
2077
- const t = typeof e.src == "string" ? e.src : e.src.id, n = Je(), [o, r] = ie(!1);
2078
- let a;
2079
- if (t) {
2080
- const s = n.loadServiceSync({ id: t });
2081
- s && (a = s);
2082
- }
2083
- !a && !o && n.loadService({ id: t }).then(() => {
2084
- r(!0);
2085
- });
2086
- const i = pn(
2087
- a,
2088
- {
2089
- size: e.size,
2090
- selector: e.region,
2091
- rotation: e.rotation,
2092
- format: e.format,
2093
- region: e.region,
2094
- quality: e.quality
2095
- },
2096
- [o, e.src, e.size, e.region, e.rotation, e.format, e.region, e.quality]
2097
- );
2098
- return be(() => () => {
2099
- r(!1);
2100
- }, [t]), i ? /* @__PURE__ */ d("img", { src: i, alt: e.alt, className: e.className, style: e.style }) : /* @__PURE__ */ d(no, { ...e, fetchImageService: !1 });
2101
- }
2102
- function no(e) {
2103
- if (e.fetchImageService)
2104
- return /* @__PURE__ */ d(to, { ...e });
2105
- const t = typeof e.src == "string" ? { id: e.src, profile: "level0" } : e.src, n = pn(
2106
- t,
2107
- {
2108
- size: e.size,
2109
- selector: e.region,
2110
- rotation: e.rotation,
2111
- format: e.format,
2112
- region: e.region,
2113
- quality: e.quality
2114
- },
2115
- [e.src, e.size, e.region, e.rotation, e.format, e.region, e.quality]
2116
- );
2117
- return n ? /* @__PURE__ */ d("img", { src: n, alt: e.alt, className: e.className, style: e.style }) : null;
2118
- }
2119
- function Ro(e) {
2120
- const t = Ce();
2121
- return /* @__PURE__ */ d(dn, { metadata: (t == null ? void 0 : t.metadata) || [], ...e });
2122
- }
2123
- var hn = { exports: {} };
2124
- (() => {
2125
- var e = { 296: (r, a, i) => {
2126
- var s = /^\s+|\s+$/g, f = /^[-+]0x[0-9a-f]+$/i, h = /^0b[01]+$/i, u = /^0o[0-7]+$/i, y = parseInt, x = typeof i.g == "object" && i.g && i.g.Object === Object && i.g, M = typeof self == "object" && self && self.Object === Object && self, C = x || M || Function("return this")(), T = Object.prototype.toString, b = Math.max, E = Math.min, L = function() {
2127
- return C.Date.now();
2128
- };
2129
- function P(A) {
2130
- var R = typeof A;
2131
- return !!A && (R == "object" || R == "function");
2132
- }
2133
- function F(A) {
2134
- if (typeof A == "number")
2135
- return A;
2136
- if (function(j) {
2137
- return typeof j == "symbol" || /* @__PURE__ */ function(S) {
2138
- return !!S && typeof S == "object";
2139
- }(j) && T.call(j) == "[object Symbol]";
2140
- }(A))
2141
- return NaN;
2142
- if (P(A)) {
2143
- var R = typeof A.valueOf == "function" ? A.valueOf() : A;
2144
- A = P(R) ? R + "" : R;
2145
- }
2146
- if (typeof A != "string")
2147
- return A === 0 ? A : +A;
2148
- A = A.replace(s, "");
2149
- var B = h.test(A);
2150
- return B || u.test(A) ? y(A.slice(2), B ? 2 : 8) : f.test(A) ? NaN : +A;
2151
- }
2152
- r.exports = function(A, R, B) {
2153
- var j, S, U, H, G, Y, Z = 0, ee = !1, se = !1, me = !0;
2154
- if (typeof A != "function")
2155
- throw new TypeError("Expected a function");
2156
- function V(re) {
2157
- var oe = j, de = S;
2158
- return j = S = void 0, Z = re, H = A.apply(de, oe);
2159
- }
2160
- function te(re) {
2161
- var oe = re - Y;
2162
- return Y === void 0 || oe >= R || oe < 0 || se && re - Z >= U;
2163
- }
2164
- function $() {
2165
- var re = L();
2166
- if (te(re))
2167
- return le(re);
2168
- G = setTimeout($, function(oe) {
2169
- var de = R - (oe - Y);
2170
- return se ? E(de, U - (oe - Z)) : de;
2171
- }(re));
2172
- }
2173
- function le(re) {
2174
- return G = void 0, me && j ? V(re) : (j = S = void 0, H);
2175
- }
2176
- function fe() {
2177
- var re = L(), oe = te(re);
2178
- if (j = arguments, S = this, Y = re, oe) {
2179
- if (G === void 0)
2180
- return function(de) {
2181
- return Z = de, G = setTimeout($, R), ee ? V(de) : H;
2182
- }(Y);
2183
- if (se)
2184
- return G = setTimeout($, R), V(Y);
2185
- }
2186
- return G === void 0 && (G = setTimeout($, R)), H;
2187
- }
2188
- return R = F(R) || 0, P(B) && (ee = !!B.leading, U = (se = "maxWait" in B) ? b(F(B.maxWait) || 0, R) : U, me = "trailing" in B ? !!B.trailing : me), fe.cancel = function() {
2189
- G !== void 0 && clearTimeout(G), Z = 0, j = Y = S = G = void 0;
2190
- }, fe.flush = function() {
2191
- return G === void 0 ? H : le(L());
2192
- }, fe;
2193
- };
2194
- }, 96: (r, a, i) => {
2195
- var s = "Expected a function", f = NaN, h = "[object Symbol]", u = /^\s+|\s+$/g, y = /^[-+]0x[0-9a-f]+$/i, x = /^0b[01]+$/i, M = /^0o[0-7]+$/i, C = parseInt, T = typeof i.g == "object" && i.g && i.g.Object === Object && i.g, b = typeof self == "object" && self && self.Object === Object && self, E = T || b || Function("return this")(), L = Object.prototype.toString, P = Math.max, F = Math.min, A = function() {
2196
- return E.Date.now();
2197
- };
2198
- function R(j) {
2199
- var S = typeof j;
2200
- return !!j && (S == "object" || S == "function");
2201
- }
2202
- function B(j) {
2203
- if (typeof j == "number")
2204
- return j;
2205
- if (function(H) {
2206
- return typeof H == "symbol" || /* @__PURE__ */ function(G) {
2207
- return !!G && typeof G == "object";
2208
- }(H) && L.call(H) == h;
2209
- }(j))
2210
- return f;
2211
- if (R(j)) {
2212
- var S = typeof j.valueOf == "function" ? j.valueOf() : j;
2213
- j = R(S) ? S + "" : S;
2214
- }
2215
- if (typeof j != "string")
2216
- return j === 0 ? j : +j;
2217
- j = j.replace(u, "");
2218
- var U = x.test(j);
2219
- return U || M.test(j) ? C(j.slice(2), U ? 2 : 8) : y.test(j) ? f : +j;
2220
- }
2221
- r.exports = function(j, S, U) {
2222
- var H = !0, G = !0;
2223
- if (typeof j != "function")
2224
- throw new TypeError(s);
2225
- return R(U) && (H = "leading" in U ? !!U.leading : H, G = "trailing" in U ? !!U.trailing : G), function(Y, Z, ee) {
2226
- var se, me, V, te, $, le, fe = 0, re = !1, oe = !1, de = !0;
2227
- if (typeof Y != "function")
2228
- throw new TypeError(s);
2229
- function _e(pe) {
2230
- var ve = se, Pe = me;
2231
- return se = me = void 0, fe = pe, te = Y.apply(Pe, ve);
2232
- }
2233
- function Be(pe) {
2234
- var ve = pe - le;
2235
- return le === void 0 || ve >= Z || ve < 0 || oe && pe - fe >= V;
2236
- }
2237
- function we() {
2238
- var pe = A();
2239
- if (Be(pe))
2240
- return qe(pe);
2241
- $ = setTimeout(we, function(ve) {
2242
- var Pe = Z - (ve - le);
2243
- return oe ? F(Pe, V - (ve - fe)) : Pe;
2244
- }(pe));
2245
- }
2246
- function qe(pe) {
2247
- return $ = void 0, de && se ? _e(pe) : (se = me = void 0, te);
2248
- }
2249
- function Me() {
2250
- var pe = A(), ve = Be(pe);
2251
- if (se = arguments, me = this, le = pe, ve) {
2252
- if ($ === void 0)
2253
- return function(Pe) {
2254
- return fe = Pe, $ = setTimeout(we, Z), re ? _e(Pe) : te;
2255
- }(le);
2256
- if (oe)
2257
- return $ = setTimeout(we, Z), _e(le);
2258
- }
2259
- return $ === void 0 && ($ = setTimeout(we, Z)), te;
2260
- }
2261
- return Z = B(Z) || 0, R(ee) && (re = !!ee.leading, V = (oe = "maxWait" in ee) ? P(B(ee.maxWait) || 0, Z) : V, de = "trailing" in ee ? !!ee.trailing : de), Me.cancel = function() {
2262
- $ !== void 0 && clearTimeout($), fe = 0, se = le = me = $ = void 0;
2263
- }, Me.flush = function() {
2264
- return $ === void 0 ? te : qe(A());
2265
- }, Me;
2266
- }(j, S, { leading: H, maxWait: S, trailing: G });
2267
- };
2268
- }, 703: (r, a, i) => {
2269
- var s = i(414);
2270
- function f() {
2271
- }
2272
- function h() {
2273
- }
2274
- h.resetWarningCache = f, r.exports = function() {
2275
- function u(M, C, T, b, E, L) {
2276
- if (L !== s) {
2277
- var P = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
2278
- throw P.name = "Invariant Violation", P;
2279
- }
2280
- }
2281
- function y() {
2282
- return u;
2283
- }
2284
- u.isRequired = u;
2285
- var x = { array: u, bigint: u, bool: u, func: u, number: u, object: u, string: u, symbol: u, any: u, arrayOf: y, element: u, elementType: u, instanceOf: y, node: u, objectOf: y, oneOf: y, oneOfType: y, shape: y, exact: y, checkPropTypes: h, resetWarningCache: f };
2286
- return x.PropTypes = x, x;
2287
- };
2288
- }, 697: (r, a, i) => {
2289
- r.exports = i(703)();
2290
- }, 414: (r) => {
2291
- r.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
2292
- } }, t = {};
2293
- function n(r) {
2294
- var a = t[r];
2295
- if (a !== void 0)
2296
- return a.exports;
2297
- var i = t[r] = { exports: {} };
2298
- return e[r](i, i.exports, n), i.exports;
2299
- }
2300
- n.n = (r) => {
2301
- var a = r && r.__esModule ? () => r.default : () => r;
2302
- return n.d(a, { a }), a;
2303
- }, n.d = (r, a) => {
2304
- for (var i in a)
2305
- n.o(a, i) && !n.o(r, i) && Object.defineProperty(r, i, { enumerable: !0, get: a[i] });
2306
- }, n.g = function() {
2307
- if (typeof globalThis == "object")
2308
- return globalThis;
2309
- try {
2310
- return this || new Function("return this")();
2311
- } catch {
2312
- if (typeof window == "object")
2313
- return window;
2314
- }
2315
- }(), n.o = (r, a) => Object.prototype.hasOwnProperty.call(r, a), n.r = (r) => {
2316
- typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(r, "__esModule", { value: !0 });
2317
- };
2318
- var o = {};
2319
- (() => {
2320
- n.r(o), n.d(o, { LazyLoadComponent: () => mt, LazyLoadImage: () => bn, trackWindowScroll: () => le });
2321
- const r = Ee;
2322
- var a = n.n(r), i = n(697);
2323
- const s = Nn;
2324
- var f = n.n(s);
2325
- function h() {
2326
- return typeof window < "u" && "IntersectionObserver" in window && "isIntersecting" in window.IntersectionObserverEntry.prototype;
2327
- }
2328
- function u(g) {
2329
- return u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2330
- return typeof c;
2331
- } : function(c) {
2332
- return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2333
- }, u(g);
2334
- }
2335
- function y(g, c) {
2336
- var m = Object.keys(g);
2337
- if (Object.getOwnPropertySymbols) {
2338
- var v = Object.getOwnPropertySymbols(g);
2339
- c && (v = v.filter(function(k) {
2340
- return Object.getOwnPropertyDescriptor(g, k).enumerable;
2341
- })), m.push.apply(m, v);
2342
- }
2343
- return m;
2344
- }
2345
- function x(g, c, m) {
2346
- return (c = C(c)) in g ? Object.defineProperty(g, c, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : g[c] = m, g;
2347
- }
2348
- function M(g, c) {
2349
- for (var m = 0; m < c.length; m++) {
2350
- var v = c[m];
2351
- v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, C(v.key), v);
2352
- }
2353
- }
2354
- function C(g) {
2355
- var c = function(m, v) {
2356
- if (u(m) !== "object" || m === null)
2357
- return m;
2358
- var k = m[Symbol.toPrimitive];
2359
- if (k !== void 0) {
2360
- var _ = k.call(m, "string");
2361
- if (u(_) !== "object")
2362
- return _;
2363
- throw new TypeError("@@toPrimitive must return a primitive value.");
2364
- }
2365
- return String(m);
2366
- }(g);
2367
- return u(c) === "symbol" ? c : String(c);
2368
- }
2369
- function T(g, c) {
2370
- return T = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2371
- return m.__proto__ = v, m;
2372
- }, T(g, c);
2373
- }
2374
- function b(g) {
2375
- return b = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2376
- return c.__proto__ || Object.getPrototypeOf(c);
2377
- }, b(g);
2378
- }
2379
- var E = function(g) {
2380
- g.forEach(function(c) {
2381
- c.isIntersecting && c.target.onVisible();
2382
- });
2383
- }, L = {}, P = function(g) {
2384
- (function(l, p) {
2385
- if (typeof p != "function" && p !== null)
2386
- throw new TypeError("Super expression must either be null or a function");
2387
- l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && T(l, p);
2388
- })(q, g);
2389
- var c, m, v, k, _ = (v = q, k = function() {
2390
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2391
- return !1;
2392
- if (typeof Proxy == "function")
2393
- return !0;
2394
- try {
2395
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2396
- })), !0;
2397
- } catch {
2398
- return !1;
2399
- }
2400
- }(), function() {
2401
- var l, p = b(v);
2402
- if (k) {
2403
- var I = b(this).constructor;
2404
- l = Reflect.construct(p, arguments, I);
2405
- } else
2406
- l = p.apply(this, arguments);
2407
- return function(O, w) {
2408
- if (w && (u(w) === "object" || typeof w == "function"))
2409
- return w;
2410
- if (w !== void 0)
2411
- throw new TypeError("Derived constructors may only return object or undefined");
2412
- return function(D) {
2413
- if (D === void 0)
2414
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2415
- return D;
2416
- }(O);
2417
- }(this, l);
2418
- });
2419
- function q(l) {
2420
- var p;
2421
- if (function(O, w) {
2422
- if (!(O instanceof w))
2423
- throw new TypeError("Cannot call a class as a function");
2424
- }(this, q), (p = _.call(this, l)).supportsObserver = !l.scrollPosition && l.useIntersectionObserver && h(), p.supportsObserver) {
2425
- var I = l.threshold;
2426
- p.observer = function(O) {
2427
- return L[O] = L[O] || new IntersectionObserver(E, { rootMargin: O + "px" }), L[O];
2428
- }(I);
2429
- }
2430
- return p;
2431
- }
2432
- return c = q, m = [{ key: "componentDidMount", value: function() {
2433
- this.placeholder && this.observer && (this.placeholder.onVisible = this.props.onVisible, this.observer.observe(this.placeholder)), this.supportsObserver || this.updateVisibility();
2434
- } }, { key: "componentWillUnmount", value: function() {
2435
- this.observer && this.placeholder && this.observer.unobserve(this.placeholder);
2436
- } }, { key: "componentDidUpdate", value: function() {
2437
- this.supportsObserver || this.updateVisibility();
2438
- } }, { key: "getPlaceholderBoundingBox", value: function() {
2439
- var l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props.scrollPosition, p = this.placeholder.getBoundingClientRect(), I = f().findDOMNode(this.placeholder).style, O = parseInt(I.getPropertyValue("margin-left"), 10) || 0, w = parseInt(I.getPropertyValue("margin-top"), 10) || 0;
2440
- return { bottom: l.y + p.bottom + w, left: l.x + p.left + O, right: l.x + p.right + O, top: l.y + p.top + w };
2441
- } }, { key: "isPlaceholderInViewport", value: function() {
2442
- if (typeof window > "u" || !this.placeholder)
2443
- return !1;
2444
- var l = this.props, p = l.scrollPosition, I = l.threshold, O = this.getPlaceholderBoundingBox(p), w = p.y + window.innerHeight, D = p.x, z = p.x + window.innerWidth, K = p.y;
2445
- return K - I <= O.bottom && w + I >= O.top && D - I <= O.right && z + I >= O.left;
2446
- } }, { key: "updateVisibility", value: function() {
2447
- this.isPlaceholderInViewport() && this.props.onVisible();
2448
- } }, { key: "render", value: function() {
2449
- var l = this, p = this.props, I = p.className, O = p.height, w = p.placeholder, D = p.style, z = p.width;
2450
- if (w && typeof w.type != "function")
2451
- return a().cloneElement(w, { ref: function(W) {
2452
- return l.placeholder = W;
2453
- } });
2454
- var K = function(W) {
2455
- for (var ce = 1; ce < arguments.length; ce++) {
2456
- var J = arguments[ce] != null ? arguments[ce] : {};
2457
- ce % 2 ? y(Object(J), !0).forEach(function(he) {
2458
- x(W, he, J[he]);
2459
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(W, Object.getOwnPropertyDescriptors(J)) : y(Object(J)).forEach(function(he) {
2460
- Object.defineProperty(W, he, Object.getOwnPropertyDescriptor(J, he));
2461
- });
2462
- }
2463
- return W;
2464
- }({ display: "inline-block" }, D);
2465
- return z !== void 0 && (K.width = z), O !== void 0 && (K.height = O), a().createElement("span", { className: I, ref: function(W) {
2466
- return l.placeholder = W;
2467
- }, style: K }, w);
2468
- } }], m && M(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2469
- }(a().Component);
2470
- P.propTypes = { onVisible: i.PropTypes.func.isRequired, className: i.PropTypes.string, height: i.PropTypes.oneOfType([i.PropTypes.number, i.PropTypes.string]), placeholder: i.PropTypes.element, threshold: i.PropTypes.number, useIntersectionObserver: i.PropTypes.bool, scrollPosition: i.PropTypes.shape({ x: i.PropTypes.number.isRequired, y: i.PropTypes.number.isRequired }), width: i.PropTypes.oneOfType([i.PropTypes.number, i.PropTypes.string]) }, P.defaultProps = { className: "", placeholder: null, threshold: 100, useIntersectionObserver: !0 };
2471
- const F = P;
2472
- var A = n(296), R = n.n(A), B = n(96), j = n.n(B), S = function(g) {
2473
- var c = getComputedStyle(g, null);
2474
- return c.getPropertyValue("overflow") + c.getPropertyValue("overflow-y") + c.getPropertyValue("overflow-x");
2475
- };
2476
- const U = function(g) {
2477
- if (!(g instanceof HTMLElement))
2478
- return window;
2479
- for (var c = g; c && c instanceof HTMLElement; ) {
2480
- if (/(scroll|auto)/.test(S(c)))
2481
- return c;
2482
- c = c.parentNode;
2483
- }
2484
- return window;
2485
- };
2486
- function H(g) {
2487
- return H = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2488
- return typeof c;
2489
- } : function(c) {
2490
- return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2491
- }, H(g);
2492
- }
2493
- var G = ["delayMethod", "delayTime"];
2494
- function Y() {
2495
- return Y = Object.assign ? Object.assign.bind() : function(g) {
2496
- for (var c = 1; c < arguments.length; c++) {
2497
- var m = arguments[c];
2498
- for (var v in m)
2499
- Object.prototype.hasOwnProperty.call(m, v) && (g[v] = m[v]);
2500
- }
2501
- return g;
2502
- }, Y.apply(this, arguments);
2503
- }
2504
- function Z(g, c) {
2505
- for (var m = 0; m < c.length; m++) {
2506
- var v = c[m];
2507
- v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, (k = function(_, q) {
2508
- if (H(_) !== "object" || _ === null)
2509
- return _;
2510
- var l = _[Symbol.toPrimitive];
2511
- if (l !== void 0) {
2512
- var p = l.call(_, "string");
2513
- if (H(p) !== "object")
2514
- return p;
2515
- throw new TypeError("@@toPrimitive must return a primitive value.");
2516
- }
2517
- return String(_);
2518
- }(v.key), H(k) === "symbol" ? k : String(k)), v);
2519
- }
2520
- var k;
2521
- }
2522
- function ee(g, c) {
2523
- return ee = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2524
- return m.__proto__ = v, m;
2525
- }, ee(g, c);
2526
- }
2527
- function se(g, c) {
2528
- if (c && (H(c) === "object" || typeof c == "function"))
2529
- return c;
2530
- if (c !== void 0)
2531
- throw new TypeError("Derived constructors may only return object or undefined");
2532
- return me(g);
2533
- }
2534
- function me(g) {
2535
- if (g === void 0)
2536
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2537
- return g;
2538
- }
2539
- function V(g) {
2540
- return V = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2541
- return c.__proto__ || Object.getPrototypeOf(c);
2542
- }, V(g);
2543
- }
2544
- var te = function() {
2545
- return typeof window > "u" ? 0 : window.scrollX || window.pageXOffset;
2546
- }, $ = function() {
2547
- return typeof window > "u" ? 0 : window.scrollY || window.pageYOffset;
2548
- };
2549
- const le = function(g) {
2550
- var c = function(m) {
2551
- (function(I, O) {
2552
- if (typeof O != "function" && O !== null)
2553
- throw new TypeError("Super expression must either be null or a function");
2554
- I.prototype = Object.create(O && O.prototype, { constructor: { value: I, writable: !0, configurable: !0 } }), Object.defineProperty(I, "prototype", { writable: !1 }), O && ee(I, O);
2555
- })(p, m);
2556
- var v, k, _, q, l = (_ = p, q = function() {
2557
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2558
- return !1;
2559
- if (typeof Proxy == "function")
2560
- return !0;
2561
- try {
2562
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2563
- })), !0;
2564
- } catch {
2565
- return !1;
2566
- }
2567
- }(), function() {
2568
- var I, O = V(_);
2569
- if (q) {
2570
- var w = V(this).constructor;
2571
- I = Reflect.construct(O, arguments, w);
2572
- } else
2573
- I = O.apply(this, arguments);
2574
- return se(this, I);
2575
- });
2576
- function p(I) {
2577
- var O;
2578
- if (function(D, z) {
2579
- if (!(D instanceof z))
2580
- throw new TypeError("Cannot call a class as a function");
2581
- }(this, p), (O = l.call(this, I)).useIntersectionObserver = I.useIntersectionObserver && h(), O.useIntersectionObserver)
2582
- return se(O);
2583
- var w = O.onChangeScroll.bind(me(O));
2584
- return I.delayMethod === "debounce" ? O.delayedScroll = R()(w, I.delayTime) : I.delayMethod === "throttle" && (O.delayedScroll = j()(w, I.delayTime)), O.state = { scrollPosition: { x: te(), y: $() } }, O.baseComponentRef = a().createRef(), O;
2585
- }
2586
- return v = p, (k = [{ key: "componentDidMount", value: function() {
2587
- this.addListeners();
2588
- } }, { key: "componentWillUnmount", value: function() {
2589
- this.removeListeners();
2590
- } }, { key: "componentDidUpdate", value: function() {
2591
- typeof window > "u" || this.useIntersectionObserver || U(f().findDOMNode(this.baseComponentRef.current)) !== this.scrollElement && (this.removeListeners(), this.addListeners());
2592
- } }, { key: "addListeners", value: function() {
2593
- typeof window > "u" || this.useIntersectionObserver || (this.scrollElement = U(f().findDOMNode(this.baseComponentRef.current)), this.scrollElement.addEventListener("scroll", this.delayedScroll, { passive: !0 }), window.addEventListener("resize", this.delayedScroll, { passive: !0 }), this.scrollElement !== window && window.addEventListener("scroll", this.delayedScroll, { passive: !0 }));
2594
- } }, { key: "removeListeners", value: function() {
2595
- typeof window > "u" || this.useIntersectionObserver || (this.scrollElement.removeEventListener("scroll", this.delayedScroll), window.removeEventListener("resize", this.delayedScroll), this.scrollElement !== window && window.removeEventListener("scroll", this.delayedScroll));
2596
- } }, { key: "onChangeScroll", value: function() {
2597
- this.useIntersectionObserver || this.setState({ scrollPosition: { x: te(), y: $() } });
2598
- } }, { key: "render", value: function() {
2599
- var I = this.props, O = (I.delayMethod, I.delayTime, function(D, z) {
2600
- if (D == null)
2601
- return {};
2602
- var K, W, ce = function(he, ke) {
2603
- if (he == null)
2604
- return {};
2605
- var Re, $e, Pt = {}, Ot = Object.keys(he);
2606
- for ($e = 0; $e < Ot.length; $e++)
2607
- Re = Ot[$e], ke.indexOf(Re) >= 0 || (Pt[Re] = he[Re]);
2608
- return Pt;
2609
- }(D, z);
2610
- if (Object.getOwnPropertySymbols) {
2611
- var J = Object.getOwnPropertySymbols(D);
2612
- for (W = 0; W < J.length; W++)
2613
- K = J[W], z.indexOf(K) >= 0 || Object.prototype.propertyIsEnumerable.call(D, K) && (ce[K] = D[K]);
2614
- }
2615
- return ce;
2616
- }(I, G)), w = this.useIntersectionObserver ? null : this.state.scrollPosition;
2617
- return a().createElement(g, Y({ forwardRef: this.baseComponentRef, scrollPosition: w }, O));
2618
- } }]) && Z(v.prototype, k), Object.defineProperty(v, "prototype", { writable: !1 }), p;
2619
- }(a().Component);
2620
- return c.propTypes = { delayMethod: i.PropTypes.oneOf(["debounce", "throttle"]), delayTime: i.PropTypes.number, useIntersectionObserver: i.PropTypes.bool }, c.defaultProps = { delayMethod: "throttle", delayTime: 300, useIntersectionObserver: !0 }, c;
2621
- };
2622
- function fe(g) {
2623
- return fe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2624
- return typeof c;
2625
- } : function(c) {
2626
- return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2627
- }, fe(g);
2628
- }
2629
- function re(g, c) {
2630
- for (var m = 0; m < c.length; m++) {
2631
- var v = c[m];
2632
- v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, (k = function(_, q) {
2633
- if (fe(_) !== "object" || _ === null)
2634
- return _;
2635
- var l = _[Symbol.toPrimitive];
2636
- if (l !== void 0) {
2637
- var p = l.call(_, "string");
2638
- if (fe(p) !== "object")
2639
- return p;
2640
- throw new TypeError("@@toPrimitive must return a primitive value.");
2641
- }
2642
- return String(_);
2643
- }(v.key), fe(k) === "symbol" ? k : String(k)), v);
2644
- }
2645
- var k;
2646
- }
2647
- function oe(g, c) {
2648
- return oe = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2649
- return m.__proto__ = v, m;
2650
- }, oe(g, c);
2651
- }
2652
- function de(g) {
2653
- return de = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2654
- return c.__proto__ || Object.getPrototypeOf(c);
2655
- }, de(g);
2656
- }
2657
- var _e = function(g) {
2658
- (function(l, p) {
2659
- if (typeof p != "function" && p !== null)
2660
- throw new TypeError("Super expression must either be null or a function");
2661
- l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && oe(l, p);
2662
- })(q, g);
2663
- var c, m, v, k, _ = (v = q, k = function() {
2664
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2665
- return !1;
2666
- if (typeof Proxy == "function")
2667
- return !0;
2668
- try {
2669
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2670
- })), !0;
2671
- } catch {
2672
- return !1;
2673
- }
2674
- }(), function() {
2675
- var l, p = de(v);
2676
- if (k) {
2677
- var I = de(this).constructor;
2678
- l = Reflect.construct(p, arguments, I);
2679
- } else
2680
- l = p.apply(this, arguments);
2681
- return function(O, w) {
2682
- if (w && (fe(w) === "object" || typeof w == "function"))
2683
- return w;
2684
- if (w !== void 0)
2685
- throw new TypeError("Derived constructors may only return object or undefined");
2686
- return function(D) {
2687
- if (D === void 0)
2688
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2689
- return D;
2690
- }(O);
2691
- }(this, l);
2692
- });
2693
- function q(l) {
2694
- return function(p, I) {
2695
- if (!(p instanceof I))
2696
- throw new TypeError("Cannot call a class as a function");
2697
- }(this, q), _.call(this, l);
2698
- }
2699
- return c = q, (m = [{ key: "render", value: function() {
2700
- return a().createElement(F, this.props);
2701
- } }]) && re(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2702
- }(a().Component);
2703
- const Be = le(_e);
2704
- function we(g) {
2705
- return we = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2706
- return typeof c;
2707
- } : function(c) {
2708
- return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2709
- }, we(g);
2710
- }
2711
- function qe(g, c) {
2712
- for (var m = 0; m < c.length; m++) {
2713
- var v = c[m];
2714
- v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, (k = function(_, q) {
2715
- if (we(_) !== "object" || _ === null)
2716
- return _;
2717
- var l = _[Symbol.toPrimitive];
2718
- if (l !== void 0) {
2719
- var p = l.call(_, "string");
2720
- if (we(p) !== "object")
2721
- return p;
2722
- throw new TypeError("@@toPrimitive must return a primitive value.");
2723
- }
2724
- return String(_);
2725
- }(v.key), we(k) === "symbol" ? k : String(k)), v);
2726
- }
2727
- var k;
2728
- }
2729
- function Me(g, c) {
2730
- return Me = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2731
- return m.__proto__ = v, m;
2732
- }, Me(g, c);
2733
- }
2734
- function pe(g) {
2735
- if (g === void 0)
2736
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2737
- return g;
2738
- }
2739
- function ve(g) {
2740
- return ve = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2741
- return c.__proto__ || Object.getPrototypeOf(c);
2742
- }, ve(g);
2743
- }
2744
- var Pe = function(g) {
2745
- (function(l, p) {
2746
- if (typeof p != "function" && p !== null)
2747
- throw new TypeError("Super expression must either be null or a function");
2748
- l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && Me(l, p);
2749
- })(q, g);
2750
- var c, m, v, k, _ = (v = q, k = function() {
2751
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2752
- return !1;
2753
- if (typeof Proxy == "function")
2754
- return !0;
2755
- try {
2756
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2757
- })), !0;
2758
- } catch {
2759
- return !1;
2760
- }
2761
- }(), function() {
2762
- var l, p = ve(v);
2763
- if (k) {
2764
- var I = ve(this).constructor;
2765
- l = Reflect.construct(p, arguments, I);
2766
- } else
2767
- l = p.apply(this, arguments);
2768
- return function(O, w) {
2769
- if (w && (we(w) === "object" || typeof w == "function"))
2770
- return w;
2771
- if (w !== void 0)
2772
- throw new TypeError("Derived constructors may only return object or undefined");
2773
- return pe(O);
2774
- }(this, l);
2775
- });
2776
- function q(l) {
2777
- var p;
2778
- (function(z, K) {
2779
- if (!(z instanceof K))
2780
- throw new TypeError("Cannot call a class as a function");
2781
- })(this, q), p = _.call(this, l);
2782
- var I = l.afterLoad, O = l.beforeLoad, w = l.scrollPosition, D = l.visibleByDefault;
2783
- return p.state = { visible: D }, D && (O(), I()), p.onVisible = p.onVisible.bind(pe(p)), p.isScrollTracked = !!(w && Number.isFinite(w.x) && w.x >= 0 && Number.isFinite(w.y) && w.y >= 0), p;
2784
- }
2785
- return c = q, (m = [{ key: "componentDidUpdate", value: function(l, p) {
2786
- p.visible !== this.state.visible && this.props.afterLoad();
2787
- } }, { key: "onVisible", value: function() {
2788
- this.props.beforeLoad(), this.setState({ visible: !0 });
2789
- } }, { key: "render", value: function() {
2790
- if (this.state.visible)
2791
- return this.props.children;
2792
- var l = this.props, p = l.className, I = l.delayMethod, O = l.delayTime, w = l.height, D = l.placeholder, z = l.scrollPosition, K = l.style, W = l.threshold, ce = l.useIntersectionObserver, J = l.width;
2793
- return this.isScrollTracked || ce && h() ? a().createElement(F, { className: p, height: w, onVisible: this.onVisible, placeholder: D, scrollPosition: z, style: K, threshold: W, useIntersectionObserver: ce, width: J }) : a().createElement(Be, { className: p, delayMethod: I, delayTime: O, height: w, onVisible: this.onVisible, placeholder: D, style: K, threshold: W, width: J });
2794
- } }]) && qe(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2795
- }(a().Component);
2796
- Pe.propTypes = { afterLoad: i.PropTypes.func, beforeLoad: i.PropTypes.func, useIntersectionObserver: i.PropTypes.bool, visibleByDefault: i.PropTypes.bool }, Pe.defaultProps = { afterLoad: function() {
2797
- return {};
2798
- }, beforeLoad: function() {
2799
- return {};
2800
- }, useIntersectionObserver: !0, visibleByDefault: !1 };
2801
- const mt = Pe;
2802
- function Ae(g) {
2803
- return Ae = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2804
- return typeof c;
2805
- } : function(c) {
2806
- return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2807
- }, Ae(g);
2808
- }
2809
- var gn = ["afterLoad", "beforeLoad", "delayMethod", "delayTime", "effect", "placeholder", "placeholderSrc", "scrollPosition", "threshold", "useIntersectionObserver", "visibleByDefault", "wrapperClassName", "wrapperProps"];
2810
- function vt(g, c) {
2811
- var m = Object.keys(g);
2812
- if (Object.getOwnPropertySymbols) {
2813
- var v = Object.getOwnPropertySymbols(g);
2814
- c && (v = v.filter(function(k) {
2815
- return Object.getOwnPropertyDescriptor(g, k).enumerable;
2816
- })), m.push.apply(m, v);
2817
- }
2818
- return m;
2819
- }
2820
- function bt(g) {
2821
- for (var c = 1; c < arguments.length; c++) {
2822
- var m = arguments[c] != null ? arguments[c] : {};
2823
- c % 2 ? vt(Object(m), !0).forEach(function(v) {
2824
- mn(g, v, m[v]);
2825
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(g, Object.getOwnPropertyDescriptors(m)) : vt(Object(m)).forEach(function(v) {
2826
- Object.defineProperty(g, v, Object.getOwnPropertyDescriptor(m, v));
2827
- });
2828
- }
2829
- return g;
2830
- }
2831
- function mn(g, c, m) {
2832
- return (c = wt(c)) in g ? Object.defineProperty(g, c, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : g[c] = m, g;
2833
- }
2834
- function Fe() {
2835
- return Fe = Object.assign ? Object.assign.bind() : function(g) {
2836
- for (var c = 1; c < arguments.length; c++) {
2837
- var m = arguments[c];
2838
- for (var v in m)
2839
- Object.prototype.hasOwnProperty.call(m, v) && (g[v] = m[v]);
2840
- }
2841
- return g;
2842
- }, Fe.apply(this, arguments);
2843
- }
2844
- function vn(g, c) {
2845
- for (var m = 0; m < c.length; m++) {
2846
- var v = c[m];
2847
- v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, wt(v.key), v);
2848
- }
2849
- }
2850
- function wt(g) {
2851
- var c = function(m, v) {
2852
- if (Ae(m) !== "object" || m === null)
2853
- return m;
2854
- var k = m[Symbol.toPrimitive];
2855
- if (k !== void 0) {
2856
- var _ = k.call(m, "string");
2857
- if (Ae(_) !== "object")
2858
- return _;
2859
- throw new TypeError("@@toPrimitive must return a primitive value.");
2860
- }
2861
- return String(m);
2862
- }(g);
2863
- return Ae(c) === "symbol" ? c : String(c);
2864
- }
2865
- function Ze(g, c) {
2866
- return Ze = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2867
- return m.__proto__ = v, m;
2868
- }, Ze(g, c);
2869
- }
2870
- function Ue(g) {
2871
- return Ue = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2872
- return c.__proto__ || Object.getPrototypeOf(c);
2873
- }, Ue(g);
2874
- }
2875
- var et = function(g) {
2876
- (function(l, p) {
2877
- if (typeof p != "function" && p !== null)
2878
- throw new TypeError("Super expression must either be null or a function");
2879
- l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && Ze(l, p);
2880
- })(q, g);
2881
- var c, m, v, k, _ = (v = q, k = function() {
2882
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2883
- return !1;
2884
- if (typeof Proxy == "function")
2885
- return !0;
2886
- try {
2887
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2888
- })), !0;
2889
- } catch {
2890
- return !1;
2891
- }
2892
- }(), function() {
2893
- var l, p = Ue(v);
2894
- if (k) {
2895
- var I = Ue(this).constructor;
2896
- l = Reflect.construct(p, arguments, I);
2897
- } else
2898
- l = p.apply(this, arguments);
2899
- return function(O, w) {
2900
- if (w && (Ae(w) === "object" || typeof w == "function"))
2901
- return w;
2902
- if (w !== void 0)
2903
- throw new TypeError("Derived constructors may only return object or undefined");
2904
- return function(D) {
2905
- if (D === void 0)
2906
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2907
- return D;
2908
- }(O);
2909
- }(this, l);
2910
- });
2911
- function q(l) {
2912
- var p;
2913
- return function(I, O) {
2914
- if (!(I instanceof O))
2915
- throw new TypeError("Cannot call a class as a function");
2916
- }(this, q), (p = _.call(this, l)).state = { loaded: !1 }, p;
2917
- }
2918
- return c = q, (m = [{ key: "onImageLoad", value: function() {
2919
- var l = this;
2920
- return this.state.loaded ? null : function(p) {
2921
- l.props.onLoad(p), l.props.afterLoad(), l.setState({ loaded: !0 });
2922
- };
2923
- } }, { key: "getImg", value: function() {
2924
- var l = this.props, p = (l.afterLoad, l.beforeLoad, l.delayMethod, l.delayTime, l.effect, l.placeholder, l.placeholderSrc, l.scrollPosition, l.threshold, l.useIntersectionObserver, l.visibleByDefault, l.wrapperClassName, l.wrapperProps, function(I, O) {
2925
- if (I == null)
2926
- return {};
2927
- var w, D, z = function(W, ce) {
2928
- if (W == null)
2929
- return {};
2930
- var J, he, ke = {}, Re = Object.keys(W);
2931
- for (he = 0; he < Re.length; he++)
2932
- J = Re[he], ce.indexOf(J) >= 0 || (ke[J] = W[J]);
2933
- return ke;
2934
- }(I, O);
2935
- if (Object.getOwnPropertySymbols) {
2936
- var K = Object.getOwnPropertySymbols(I);
2937
- for (D = 0; D < K.length; D++)
2938
- w = K[D], O.indexOf(w) >= 0 || Object.prototype.propertyIsEnumerable.call(I, w) && (z[w] = I[w]);
2939
- }
2940
- return z;
2941
- }(l, gn));
2942
- return a().createElement("img", Fe({}, p, { onLoad: this.onImageLoad() }));
2943
- } }, { key: "getLazyLoadImage", value: function() {
2944
- var l = this.props, p = l.beforeLoad, I = l.className, O = l.delayMethod, w = l.delayTime, D = l.height, z = l.placeholder, K = l.scrollPosition, W = l.style, ce = l.threshold, J = l.useIntersectionObserver, he = l.visibleByDefault, ke = l.width;
2945
- return a().createElement(mt, { beforeLoad: p, className: I, delayMethod: O, delayTime: w, height: D, placeholder: z, scrollPosition: K, style: W, threshold: ce, useIntersectionObserver: J, visibleByDefault: he, width: ke }, this.getImg());
2946
- } }, { key: "getWrappedLazyLoadImage", value: function(l) {
2947
- var p = this.props, I = p.effect, O = p.height, w = p.placeholderSrc, D = p.width, z = p.wrapperClassName, K = p.wrapperProps, W = this.state.loaded, ce = W ? " lazy-load-image-loaded" : "", J = W || !w ? {} : { backgroundImage: "url(".concat(w, ")"), backgroundSize: "100% 100%" };
2948
- return a().createElement("span", Fe({ className: z + " lazy-load-image-background " + I + ce, style: bt(bt({}, J), {}, { color: "transparent", display: "inline-block", height: O, width: D }) }, K), l);
2949
- } }, { key: "render", value: function() {
2950
- var l = this.props, p = l.effect, I = l.placeholderSrc, O = l.visibleByDefault, w = l.wrapperClassName, D = l.wrapperProps, z = this.getLazyLoadImage();
2951
- return (p || I) && !O || w || D ? this.getWrappedLazyLoadImage(z) : z;
2952
- } }]) && vn(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2953
- }(a().Component);
2954
- et.propTypes = { onLoad: i.PropTypes.func, afterLoad: i.PropTypes.func, beforeLoad: i.PropTypes.func, delayMethod: i.PropTypes.string, delayTime: i.PropTypes.number, effect: i.PropTypes.string, placeholderSrc: i.PropTypes.string, threshold: i.PropTypes.number, useIntersectionObserver: i.PropTypes.bool, visibleByDefault: i.PropTypes.bool, wrapperClassName: i.PropTypes.string, wrapperProps: i.PropTypes.object }, et.defaultProps = { onLoad: function() {
2955
- }, afterLoad: function() {
2956
- return {};
2957
- }, beforeLoad: function() {
2958
- return {};
2959
- }, delayMethod: "throttle", delayTime: 300, effect: "", placeholderSrc: null, threshold: 100, useIntersectionObserver: !0, visibleByDefault: !1, wrapperClassName: "" };
2960
- const bn = et;
2961
- })(), hn.exports = o;
2962
- })();
2963
- var ro = hn.exports;
2964
- function oo(e, t, n = [], o = !1, r = []) {
2965
- if (r.length && (t = t.filter((i) => r.indexOf(i) === -1)), !t || t.length === 0)
2966
- return;
2967
- if (t.length === 1)
2968
- return t[0];
2969
- if (!e)
2970
- return t.indexOf("none") !== -1 ? "none" : t[0];
2971
- if (t.indexOf(e) !== -1)
2972
- return e;
2973
- const a = e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : null;
2974
- if (a && t.indexOf(a) !== -1)
2975
- return a;
2976
- for (const i of n)
2977
- if (t.indexOf(i) !== -1)
2978
- return i;
2979
- if (!o && e) {
2980
- const i = t.map((s) => s.indexOf("-") !== -1 ? s.slice(0, s.indexOf("-")) : null).indexOf(e);
2981
- if (i !== -1)
2982
- return t[i];
2983
- for (const s of n) {
2984
- const f = s.indexOf("-") !== -1 ? s.slice(0, s.indexOf("-")) : null, h = f ? t.indexOf(f) : -1;
2985
- if (h !== -1)
2986
- return t[h];
2987
- }
2988
- }
2989
- return t.indexOf("none") !== -1 ? "none" : t.indexOf("@none") !== -1 ? "@none" : t[0];
2990
- }
2991
- function yn(e, t, n = {}) {
2992
- const {
2993
- strictFallback: o = !1,
2994
- defaultText: r = "",
2995
- separator: a = `
2996
- `,
2997
- fallbackLanguages: i = [],
2998
- closest: s,
2999
- skipLanguages: f
3000
- } = n, h = Object.keys(e || {}), u = s ? t : oo(t, h, i, o, f);
3001
- if (!e)
3002
- return r;
3003
- if (typeof e == "string")
3004
- return e;
3005
- const y = u ? e[u] : void 0;
3006
- if (y && u) {
3007
- if (typeof y == "string")
3008
- return y;
3009
- if (y.length === 1 && y[0] === "") {
3010
- const x = n.skipLanguages || [];
3011
- return yn(e, t, {
3012
- ...n,
3013
- skipLanguages: [...x, u]
3014
- });
3015
- }
3016
- return y.join(a);
3017
- }
3018
- return "";
3019
- }
3020
- function io(e, t = {}) {
3021
- return yn(
3022
- e,
3023
- t.language || (typeof navigator < "u" ? navigator.language : "en"),
3024
- t
3025
- );
3026
- }
3027
- const ao = ro.LazyLoadComponent;
3028
- function so(e) {
3029
- const { size: t, visible: n, classes: o, canvasId: r, figure: a } = e, i = (t == null ? void 0 : t.width) || 128, s = (t == null ? void 0 : t.height) || (t == null ? void 0 : t.width) || 128, f = /* @__PURE__ */ d(co, { ...e }), h = /* @__PURE__ */ d(ao, { threshold: 300, style: { height: s, width: i }, visibleByDefault: n, children: r ? /* @__PURE__ */ d(Qe, { canvas: r, children: f }) : f });
3030
- return a ? /* @__PURE__ */ d("figure", { className: o == null ? void 0 : o.figure, children: h }) : h;
3031
- }
3032
- function co({ fallback: e, size: t, classes: n, showLabel: o, alt: r, dereference: a = !1 }) {
3033
- const i = Se(), s = (t == null ? void 0 : t.width) || 128, f = (t == null ? void 0 : t.height) || (t == null ? void 0 : t.width) || 128, h = r || io(i == null ? void 0 : i.label) || "", u = Gt({ width: s, height: f }, a);
3034
- return !u || u.type !== "fixed" ? /* @__PURE__ */ d(Oe, { children: e }) : /* @__PURE__ */ X(Oe, { children: [
3035
- /* @__PURE__ */ d("div", { className: n == null ? void 0 : n.imageWrapper, children: /* @__PURE__ */ d("img", { className: n == null ? void 0 : n.img, src: u.id, alt: h }) }),
3036
- o ? /* @__PURE__ */ d(Ne, { as: "figcaption", className: n == null ? void 0 : n.label, children: i == null ? void 0 : i.label }) : null
3037
- ] });
3038
- }
3039
- function Lo({ flat: e, size: t, classes: n = {}, showLabel: o, figure: r, fallback: a }) {
3040
- var M, C, T, b, E, L;
3041
- const i = xe(null), { items: s, sequence: f, currentSequenceIndex: h, setSequenceIndex: u } = Nt(), y = {
3042
- row: ((M = n.selected) == null ? void 0 : M.row) || n.row,
3043
- item: ((C = n.selected) == null ? void 0 : C.item) || n.item,
3044
- figure: ((T = n.selected) == null ? void 0 : T.figure) || n.figure,
3045
- img: ((b = n.selected) == null ? void 0 : b.img) || n.img,
3046
- label: ((E = n.selected) == null ? void 0 : E.label) || n.label,
3047
- imageWrapper: ((L = n.selected) == null ? void 0 : L.imageWrapper) || n.imageWrapper
3048
- };
3049
- st(() => {
3050
- if (!i.current)
3051
- return;
3052
- const P = i.current.querySelector("[data-selected=true]");
3053
- P && P.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
3054
- }, [h]);
3055
- const x = [];
3056
- for (const P of f) {
3057
- const F = [], A = f[h] === P;
3058
- for (const R of P) {
3059
- const B = s[R];
3060
- F.push(
3061
- /* @__PURE__ */ d("div", { className: A ? y.item : n.item, children: /* @__PURE__ */ d(
3062
- so,
3063
- {
3064
- classes: A ? y : n,
3065
- canvasId: B.id,
3066
- size: t,
3067
- showLabel: o,
3068
- figure: r,
3069
- placeholder: /* @__PURE__ */ d("div", { style: { height: 128, width: 128 } }),
3070
- fallback: a
3071
- }
3072
- ) }, R)
3073
- );
3074
- }
3075
- if (e) {
3076
- x.push(F);
3077
- continue;
3078
- }
3079
- x.push(
3080
- /* @__PURE__ */ d(
3081
- "div",
3082
- {
3083
- onClick: (R) => {
3084
- u(f.indexOf(P));
3085
- },
3086
- "data-selected": A,
3087
- className: A ? y.row : n.row,
3088
- children: F
3089
- }
3090
- )
3091
- );
3092
- }
3093
- return /* @__PURE__ */ d("div", { ref: i, className: n.container, children: x });
3094
- }
3095
- function Ao({ annotation: e, children: t }) {
3096
- return /* @__PURE__ */ d(Le, { value: { annotation: e }, children: t });
3097
- }
3098
- function ko({ annotationPage: e, children: t }) {
3099
- return /* @__PURE__ */ d(Le, { value: { annotationPage: e }, children: t });
3100
- }
3101
- function No({ collection: e, children: t }) {
3102
- return /* @__PURE__ */ d(Le, { value: { collection: e }, children: t });
3103
- }
3104
- function Vo(e, t = {}) {
3105
- return ht(t);
3106
- }
3107
- function _o(e, t = !1) {
3108
- }
3109
- function Do(e) {
3110
- const n = je().manifest, o = e ? e.map((r) => typeof r == "string" ? r : r == null ? void 0 : r.id) : [];
3111
- return ye(
3112
- (r) => {
3113
- const a = n ? r.iiif.entities.Manifest[n] : void 0, i = (a == null ? void 0 : a.items) || [];
3114
- if (typeof e > "u")
3115
- return i;
3116
- const s = [];
3117
- for (const f of (a == null ? void 0 : a.items) || [])
3118
- o.indexOf(f.id) !== -1 && s.push(f);
3119
- return s;
3120
- },
3121
- [o.join("/")]
3122
- );
3123
- }
3124
- function Bo(e, t = []) {
3125
- const { id: n, selector: o } = e, r = je(), a = n || r.collection, i = ye(
3126
- (s) => a ? s.iiif.entities.Collection[a] : void 0,
3127
- [a]
3128
- );
3129
- return N(() => {
3130
- if (i)
3131
- return o ? o(i) : i;
3132
- }, [i, o, ...t]);
3133
- }
3134
- function qo(e, t, n, o, r = []) {
3135
- const a = ae(), i = N(() => Ft(a), [a]);
3136
- be(() => {
3137
- const s = e;
3138
- return s ? (i.addEventListener(s, t, n, o), () => {
3139
- i.removeEventListener(s, t, n);
3140
- }) : () => {
3141
- };
3142
- }, [i, e, t, ...r]);
3143
- }
3144
- function Fo(e, t) {
3145
- const { id: n, isLoaded: o, error: r, resource: a, requestId: i, cached: s } = jt(
3146
- e,
3147
- t
3148
- );
3149
- return { id: n, isLoaded: o, error: r, manifest: a, requestId: i, cached: s };
3150
- }
3151
- function uo({ cacheKey: e } = {}) {
3152
- const t = Se(), n = ht(), o = ae(), r = Je(), [a, i] = ie(void 0), [s, f] = ie(!1), [h, u] = ie("idle"), [y, x] = ie(void 0), M = t ? t.id : "undefined", C = N(() => {
3153
- try {
3154
- if (t && n.length) {
3155
- const b = n[0], E = o.get(b.body[0]), P = it(E)[0];
3156
- return P && r.loadServiceSync({
3157
- id: P.id || P["@id"],
3158
- width: P.width || t.width,
3159
- height: P.height || t.height
3160
- }) || void 0;
3161
- }
3162
- } catch (b) {
3163
- console.error(b);
3164
- }
3165
- }, [M, e, t]), T = h === "success" && a ? a : C;
3166
- return be(() => {
3167
- (async () => {
3168
- try {
3169
- if (t && n.length) {
3170
- const b = n[0], E = o.get(b.body[0]), P = it(E)[0];
3171
- if (!P)
3172
- return;
3173
- f(!0), u("loading");
3174
- try {
3175
- const F = await r.loadService({
3176
- id: P.id || P["@id"],
3177
- width: P.width || t.width,
3178
- height: P.height || t.height
3179
- }) || void 0;
3180
- i(F), u("success"), f(!1);
3181
- } catch (F) {
3182
- u("error"), x(F);
3183
- }
3184
- }
3185
- } catch (b) {
3186
- u("error"), x(b);
3187
- }
3188
- })();
3189
- }, [M, e]), N(() => ({
3190
- data: T,
3191
- isFetching: s,
3192
- status: h,
3193
- error: y
3194
- }), [T, s, h, y]);
3195
- }
3196
- function Uo() {
3197
- const e = uo();
3198
- return {
3199
- isLoading: e.isFetching,
3200
- tile: e.data ? {
3201
- id: e.data.id || e.data["@id"],
3202
- width: e.data.width,
3203
- height: e.data.height,
3204
- imageService: e.data,
3205
- thumbnail: void 0
3206
- } : null
3207
- };
3208
- }
3209
- function $o() {
3210
- const e = Ce();
3211
- return e ? e.service.find(
3212
- (t) => t.profile === "SearchService1" || t.profile === "http://iiif.io/api/search/1/search"
3213
- ) : void 0;
3214
- }
3215
- function Wo() {
3216
- const e = ae();
3217
- return N(() => ut(e), [e]);
3218
- }
3219
- export {
3220
- Ao as AnnotationContext,
3221
- ko as AnnotationPageContext,
3222
- jo as CanvasAnnotations,
3223
- Qe as CanvasContext,
3224
- ge as CanvasPanel,
3225
- No as CollectionContext,
3226
- Mo as CombinedMetadata,
3227
- Kn as ContextBridge,
3228
- no as Image,
3229
- Rr as ImageServiceLoaderContext,
3230
- Hn as InnerViewerProvider,
3231
- Eo as LanguageProvider,
3232
- Qr as LanguageString,
3233
- Ne as LocaleString,
3234
- Fn as ManifestContext,
3235
- Ro as ManifestMetadata,
3236
- en as MediaPlayerProvider,
3237
- dn as Metadata,
3238
- Un as RangeContext,
3239
- Ke as ReactVaultContext,
3240
- Le as ResourceProvider,
3241
- lt as ResourceReactContext,
3242
- Lo as SequenceThumbnails,
3243
- Yn as SimpleViewerProvider,
3244
- Xe as SimpleViewerReactContext,
3245
- so as SingleCanvasThumbnail,
3246
- ft as VaultProvider,
3247
- pt as ViewerPresetContext,
3248
- vr as VirtualAnnotationProvider,
3249
- Ge as VisibleCanvasReactContext,
3250
- xr as emptyActions,
3251
- Tr as emptyStrategy,
3252
- Rt as findAllCanvasesInRange,
3253
- $n as findFirstCanvasFromRange,
3254
- Po as findManifestSelectedRange,
3255
- Lt as findSelectedRange,
3256
- Cr as flattenAnnotationPageIds,
3257
- Kr as formatTime,
3258
- _r as get3dStrategy,
3259
- Br as getImageStrategy,
3260
- At as getManifestSequence,
3261
- Yt as getParsedTargetSelector,
3262
- $r as getRenderingStrategy,
3263
- qr as getTextualContentStrategy,
3264
- Ur as getVideoStrategy,
3265
- Oo as getVisibleCanvasesFromCanvasId,
3266
- So as parseSpecificResource,
3267
- rt as unknownResponse,
3268
- ne as unsupportedStrategy,
3269
- $t as useAnnotation,
3270
- Sr as useAnnotationPage,
3271
- zt as useAnnotationPageManager,
3272
- Vo as useAnnotationsAtTime,
3273
- Se as useCanvas,
3274
- _o as useCanvasClock,
3275
- Wn as useCanvasSequence,
3276
- Do as useCanvasSubset,
3277
- Gr as useClosestLanguage,
3278
- Bo as useCollection,
3279
- zn as useContextBridge,
3280
- Co as useCreateLocaleString,
3281
- yr as useDispatch,
3282
- qo as useEventListener,
3283
- dt as useExistingVault,
3284
- Fo as useExternalCollection,
3285
- qn as useExternalManifest,
3286
- jt as useExternalResource,
3287
- gt as useIIIFLanguage,
3288
- pn as useImage,
3289
- uo as useImageService,
3290
- Je as useImageServiceLoader,
3291
- Uo as useImageTile,
3292
- Lr as useLoadImageService,
3293
- Xr as useLocaleString,
3294
- Ce as useManifest,
3295
- To as useMediaActions,
3296
- Io as useMediaElements,
3297
- xo as useMediaState,
3298
- Nr as usePaintables,
3299
- ht as usePaintingAnnotations,
3300
- kt as useRange,
3301
- Wr as useRenderingStrategy,
3302
- je as useResourceContext,
3303
- Ut as useResourceEvents,
3304
- Mr as useResources,
3305
- $o as useSearchService,
3306
- yt as useSimpleMediaPlayer,
3307
- Nt as useSimpleViewer,
3308
- Wo as useStyleHelper,
3309
- ze as useStyles,
3310
- Gt as useThumbnail,
3311
- ae as useVault,
3312
- Hr as useVaultEffect,
3313
- ye as useVaultSelector,
3314
- wr as useViewerPreset,
3315
- gr as useVirtualAnnotationPage,
3316
- mr as useVirtualAnnotationPageContext,
3317
- Mt as useVisibleCanvases
3318
- };
3319
- //# sourceMappingURL=index.mjs.map