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