cozy-iiif 0.1.0 → 0.1.2

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/dist/index.js CHANGED
@@ -1,19 +1,775 @@
1
- import { getImages as t, getThumbnailURL as g, normalizeServiceUrl as o } from "./src/core/canvas.js";
2
- import { getImageURLFromService as m, getRegionURL as i, getRegionURLFromService as l, isImageService as p, parseImageService as R } from "./src/core/image-service.js";
3
- import { getLabel as c, getMetadata as n, getPropertyValue as v, getStringValue as L } from "./src/core/resource.js";
4
- import { Cozy as f } from "./src/Cozy.js";
1
+ import { g as p, a as I, b as S } from "./resource-DS2brz47.js";
2
+ import { c as Pt } from "./resource-DS2brz47.js";
3
+ var te = "http://library.stanford.edu/iiif/image-api/compliance.html#level0", re = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", P = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", ie = "http://library.stanford.edu/iiif/image-api/conformance.html#level0", se = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", O = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", ne = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", ae = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", U = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", oe = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", ce = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", D = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", le = "http://iiif.io/api/image/1/level0.json", ve = "http://iiif.io/api/image/1/profiles/level0.json", pe = "http://iiif.io/api/image/1/level1.json", he = "http://iiif.io/api/image/1/profiles/level1.json", E = "http://iiif.io/api/image/1/level2.json", N = "http://iiif.io/api/image/1/profiles/level2.json", ue = "http://iiif.io/api/image/2/level0.json", fe = "http://iiif.io/api/image/2/profiles/level0.json", me = "http://iiif.io/api/image/2/level1.json", ge = "http://iiif.io/api/image/2/profiles/level1.json", q = "http://iiif.io/api/image/2/level2.json", _ = "http://iiif.io/api/image/2/profiles/level2.json", de = "level0", ye = "level1", V = "level2", Ae = "http://iiif.io/api/image/2/level0", Ce = "http://iiif.io/api/image/2/level1", F = "http://iiif.io/api/image/2/level2", be = [F, P, O, U, D, E, N, q, _, V], Re = [Ae, Ce, F, te, re, P, ie, se, O, ne, ae, U, oe, ce, D, le, ve, pe, he, E, N, ue, fe, me, ge, q, _, de, ye, V], Le = Re;
4
+ function v(t) {
5
+ for (let e in t) (typeof t[e] > "u" || t[e] === null) && delete t[e];
6
+ return t;
7
+ }
8
+ function g(t) {
9
+ return Array.isArray(t) ? t : t ? [t] : [];
10
+ }
11
+ var we = Object.defineProperty, Ie = (t, e, r) => e in t ? we(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, f = (t, e, r) => (Ie(t, typeof e != "symbol" ? e + "" : e, r), r), T = ["sc:Collection", "sc:Manifest", "sc:Canvas", "sc:AnnotationList", "oa:Annotation", "sc:Range", "sc:Layer", "sc:Sequence", "oa:Choice", "Service", "ContentResource"];
12
+ function Se(t) {
13
+ if (typeof t > "u" || t === null) throw new Error("Null or undefined is not a valid entity.");
14
+ if (Array.isArray(t)) throw new Error("Array is not a valid entity");
15
+ if (typeof t != "object") throw new Error(`${typeof t} is not a valid entity`);
16
+ if (typeof t["@type"] == "string") {
17
+ let e = T.indexOf(t["@type"]);
18
+ if (e !== -1) return T[e];
19
+ }
20
+ if (t.profile) return "Service";
21
+ if (t.format || t["@type"]) return "ContentResource";
22
+ throw new Error("Resource type is not known");
23
+ }
24
+ var Te = class W {
25
+ constructor(e, r = {}) {
26
+ f(this, "traversals"), f(this, "options"), this.traversals = { collection: [], manifest: [], canvas: [], annotationList: [], sequence: [], annotation: [], contentResource: [], choice: [], range: [], service: [], layer: [], ...e }, this.options = { convertPropsToArray: !0, mergeMemberProperties: !0, allowUndefinedReturn: !1, ...r };
27
+ }
28
+ static all(e) {
29
+ return new W({ collection: [e], manifest: [e], canvas: [e], annotationList: [e], sequence: [e], annotation: [e], contentResource: [e], choice: [e], range: [e], service: [e], layer: [e] });
30
+ }
31
+ traverseCollection(e) {
32
+ return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCollectionItems(e))), this.traversals.collection);
33
+ }
34
+ traverseCollectionItems(e) {
35
+ if (this.options.mergeMemberProperties) {
36
+ let r = [...(e.manifests || []).map((i) => typeof i == "string" ? { "@id": i, "@type": "sc:Manifest" } : i), ...(e.collections || []).map((i) => typeof i == "string" ? { "@id": i, "@type": "sc:Collection" } : i), ...e.members || []];
37
+ delete e.collections, delete e.manifests, e.members = r;
38
+ }
39
+ return e.manifests && (e.manifests = e.manifests.map((r) => this.traverseManifest(typeof r == "string" ? { "@id": r, "@type": "sc:Manifest" } : r))), e.collections && (e.collections = e.collections.map((r) => this.traverseCollection(typeof r == "string" ? { "@id": r, "@type": "sc:Collection" } : r))), e.members && (e.members = e.members.map((r) => typeof r == "string" ? r : this.traverseUnknown(r))), e;
40
+ }
41
+ traverseManifest(e) {
42
+ return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseManifestItems(e))), this.traversals.manifest);
43
+ }
44
+ traverseManifestItems(e) {
45
+ return e.sequences && (e.sequences = e.sequences.map((r) => this.traverseSequence(r))), e.structures && (e.structures = e.structures.map((r) => this.traverseRange(r))), e;
46
+ }
47
+ traverseSequence(e) {
48
+ return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseSequenceItems(e))), this.traversals.sequence);
49
+ }
50
+ traverseSequenceItems(e) {
51
+ return e.canvases && (e.canvases = e.canvases.map((r) => this.traverseCanvas(r))), e;
52
+ }
53
+ traverseCanvas(e) {
54
+ return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseCanvasItems(e))), this.traversals.canvas);
55
+ }
56
+ traverseCanvasItems(e) {
57
+ return e.images && (e.images = e.images.map((r) => this.traverseAnnotation(r))), e.otherContent && (e.otherContent = e.otherContent.map((r) => this.traverseAnnotationList(r))), e;
58
+ }
59
+ traverseRange(e) {
60
+ return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseRangeItems(e))), this.traversals.range);
61
+ }
62
+ traverseRangeItems(e) {
63
+ if (this.options.mergeMemberProperties) {
64
+ let r = [...(e.ranges || []).map((i) => typeof i == "string" ? { "@id": i, "@type": "sc:Range" } : i), ...(e.canvases || []).map((i) => typeof i == "string" ? { "@id": i, "@type": "sc:Canvas" } : i), ...e.members || []];
65
+ delete e.ranges, delete e.canvases, e.members = r.length ? r.map((i) => this.traverseUnknown(i)) : void 0;
66
+ }
67
+ return e;
68
+ }
69
+ traverseAnnotationList(e) {
70
+ let r = typeof e == "string" ? { "@id": e, "@type": "sc:AnnotationList" } : e;
71
+ return this.traverseType(this.traverseDescriptive(this.traverseAnnotationListItems(r)), this.traversals.annotationList);
72
+ }
73
+ traverseAnnotationListItems(e) {
74
+ return e.resources && (e.resources = e.resources.map((r) => this.traverseAnnotation(r))), e;
75
+ }
76
+ traverseAnnotation(e) {
77
+ return this.traverseType(this.traverseDescriptive(this.traverseLinking(this.traverseAnnotationItems(e))), this.traversals.annotation);
78
+ }
79
+ traverseAnnotationItems(e) {
80
+ return e.resource && (Array.isArray(e.resource) ? e.resource = e.resource.map((r) => this.traverseContentResource(r)) : e.resource = this.traverseContentResource(e.resource)), e.on, e;
81
+ }
82
+ traverseLayer(e) {
83
+ return this.traverseType(this.traverseLinking(this.traverseLayerItems(e)), this.traversals.layer);
84
+ }
85
+ traverseLayerItems(e) {
86
+ return e.otherContent && (e.otherContent = e.otherContent.map((r) => this.traverseAnnotationList(r))), e;
87
+ }
88
+ traverseChoice(e) {
89
+ return this.traverseType(this.traverseChoiceItems(e), this.traversals.choice);
90
+ }
91
+ traverseChoiceItems(e) {
92
+ return e.default && e.default !== "rdf:nil" && (e.default = this.traverseContentResource(e.default)), e.item && e.item !== "rdf:nil" && (e.item = e.item.map((r) => this.traverseContentResource(r))), e;
93
+ }
94
+ traverseService(e) {
95
+ return this.traverseType(this.traverseLinking(e), this.traversals.service);
96
+ }
97
+ traverseContentResource(e) {
98
+ return e["@type"] === "oa:Choice" ? this.traverseChoice(e) : this.traverseType(this.traverseDescriptive(this.traverseLinking(e)), this.traversals.contentResource);
99
+ }
100
+ traverseUnknown(e) {
101
+ if (!e["@type"] || typeof e == "string") return e;
102
+ switch (Se(e)) {
103
+ case "sc:Collection":
104
+ return this.traverseCollection(e);
105
+ case "sc:Manifest":
106
+ return this.traverseManifest(e);
107
+ case "sc:Canvas":
108
+ return this.traverseCanvas(e);
109
+ case "sc:Sequence":
110
+ return this.traverseSequence(e);
111
+ case "sc:Range":
112
+ return this.traverseRange(e);
113
+ case "oa:Annotation":
114
+ return this.traverseAnnotation(e);
115
+ case "sc:AnnotationList":
116
+ return this.traverseAnnotationList(e);
117
+ case "sc:Layer":
118
+ return this.traverseLayer(e);
119
+ case "Service":
120
+ return this.traverseService(e);
121
+ case "oa:Choice":
122
+ return this.traverseChoice(e);
123
+ case "ContentResource":
124
+ return this.traverseContentResource(e);
125
+ }
126
+ return e.profile ? this.traverseService(e) : e;
127
+ }
128
+ traverseImageResource(e) {
129
+ let r = Array.isArray(e), i = Array.isArray(e) ? e : [e], s = [];
130
+ for (let n of i) typeof n == "string" ? s.push(this.traverseContentResource({ "@id": n, "@type": "dctypes:Image" })) : s.push(this.traverseContentResource(n));
131
+ return !r && !this.options.convertPropsToArray ? s[0] : s;
132
+ }
133
+ traverseDescriptive(e) {
134
+ return e.thumbnail && (e.thumbnail = this.traverseImageResource(e.thumbnail)), e.logo && (e.logo = this.traverseImageResource(e.logo)), e;
135
+ }
136
+ traverseOneOrMoreServices(e) {
137
+ let r = Array.isArray(e), i = Array.isArray(e) ? e : [e], s = [];
138
+ for (let n of i) s.push(this.traverseService(n));
139
+ return !r && !this.options.convertPropsToArray ? s[0] : s;
140
+ }
141
+ traverseLinking(e) {
142
+ return e.related && (e.related = this.traverseOneOrManyType(e.related, this.traversals.contentResource)), e.rendering && (e.rendering = this.traverseOneOrManyType(e.rendering, this.traversals.contentResource)), e.service && (e.service = this.traverseOneOrMoreServices(e.service)), e.seeAlso && (e.seeAlso = this.traverseOneOrManyType(e.seeAlso, this.traversals.contentResource)), e.within && (typeof e.within == "string" || (e.within = this.traverseOneOrManyType(e.within, this.traversals.contentResource))), e.startCanvas && (typeof e.startCanvas == "string" ? e.startCanvas = this.traverseType({ "@id": e.startCanvas, "@type": "sc:Canvas" }, this.traversals.canvas) : e.startCanvas && this.traverseType(e.startCanvas, this.traversals.canvas)), e.contentLayer && (typeof e.contentLayer == "string" ? e.contentLayer = this.traverseLayer({ "@id": e.contentLayer, "@type": "sc:Layer" }) : e.contentLayer = this.traverseLayer(e.contentLayer)), e;
143
+ }
144
+ traverseOneOrManyType(e, r) {
145
+ if (!Array.isArray(e)) if (this.options.convertPropsToArray) e = [e];
146
+ else return this.traverseType(e, r);
147
+ return e.map((i) => this.traverseType(i, r));
148
+ }
149
+ traverseType(e, r) {
150
+ return r.reduce((i, s) => {
151
+ let n = s(i);
152
+ return typeof n > "u" && !this.options.allowUndefinedReturn ? i : n;
153
+ }, e);
154
+ }
155
+ }, xe = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", $e = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", je = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", Me = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", ke = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", Pe = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", Oe = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", Ue = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", De = "http://iiif.io/api/image/1/level1.json", Ee = "http://iiif.io/api/image/1/profiles/level1.json", Ne = "http://iiif.io/api/image/1/level2.json", qe = "http://iiif.io/api/image/1/profiles/level2.json", _e = "http://iiif.io/api/image/2/level1.json", Ve = "http://iiif.io/api/image/2/profiles/level1.json", Fe = "http://iiif.io/api/image/2/level2.json", We = "http://iiif.io/api/image/2/profiles/level2.json", He = "level1", Be = "level2", Je = "http://iiif.io/api/image/2/level1", Ge = "http://iiif.io/api/image/2/level2", ze = [Je, Ge, xe, $e, je, Me, ke, Pe, Oe, Ue, De, Ee, Ne, qe, _e, Ve, Fe, We, He, Be], R = { attributionLabel: "Attribution", providerId: "http://example.org/provider", providerName: "Unknown" };
156
+ function Ke(t) {
157
+ if (typeof t == "string") return [t];
158
+ if (!t) return [];
159
+ let e = Array.isArray(t) ? t : [t], r = [];
160
+ for (let i of e) {
161
+ if (typeof i == "string") {
162
+ r.push(i);
163
+ continue;
164
+ }
165
+ r.push({ "@language": i["@language"] || i.language, "@value": i["@value"] || i.value });
166
+ }
167
+ return r;
168
+ }
169
+ function d(t, e = "none") {
170
+ if (!t) return { none: [""] };
171
+ let r = Ke(t), i = {};
172
+ for (let s of r) {
173
+ if (typeof s == "string") {
174
+ i[e] = i[e] ? i[e] : [], i[e].push(s || "");
175
+ continue;
176
+ }
177
+ if (!s["@language"]) {
178
+ i[e] = i[e] ? i[e] : [], i[e].push(s["@value"] || "");
179
+ continue;
180
+ }
181
+ let n = s["@language"];
182
+ i[n] = i[n] ? i[n] : [], i[n].push(s["@value"] || "");
183
+ }
184
+ return Object.keys(i).length === 0 ? { none: [""] } : i;
185
+ }
186
+ function H(t) {
187
+ if (Array.isArray(t)) return H(t.find((e) => typeof e == "string"));
188
+ if (be.indexOf(t) !== -1) return "level2";
189
+ if (ze.indexOf(t) !== -1) return "level1";
190
+ if (Le.indexOf(t) !== -1) return "level0";
191
+ if (typeof t == "string") return t;
192
+ }
193
+ function Qe(t) {
194
+ let e = Array.isArray(t) ? t : [t];
195
+ for (let r of e) switch (r) {
196
+ case "http://iiif.io/api/image/2/context.json":
197
+ case "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2":
198
+ return "ImageService2";
199
+ case "http://iiif.io/api/image/1/context.json":
200
+ case "http://library.stanford.edu/iiif/image-api/1.1/context.json":
201
+ return "ImageService1";
202
+ case "http://iiif.io/api/annex/openannotation/context.json":
203
+ return "ImageApiSelector";
204
+ }
205
+ }
206
+ function Xe(t) {
207
+ switch (t) {
208
+ case "http://iiif.io/api/image/2/level0.json":
209
+ case "http://iiif.io/api/image/2/level1.json":
210
+ case "http://iiif.io/api/image/2/level2.json":
211
+ return "ImageService2";
212
+ case "http://iiif.io/api/auth/1/kiosk":
213
+ case "http://iiif.io/api/auth/1/login":
214
+ case "http://iiif.io/api/auth/1/clickthrough":
215
+ case "http://iiif.io/api/auth/1/external":
216
+ case "http://iiif.io/api/auth/0/kiosk":
217
+ case "http://iiif.io/api/auth/0/login":
218
+ case "http://iiif.io/api/auth/0/clickthrough":
219
+ case "http://iiif.io/api/auth/0/external":
220
+ return "AuthCookieService1";
221
+ case "http://iiif.io/api/auth/1/token":
222
+ case "http://iiif.io/api/auth/0/token":
223
+ return "AuthTokenService1";
224
+ case "http://iiif.io/api/auth/1/logout":
225
+ case "http://iiif.io/api/auth/0/logout":
226
+ return "AuthLogoutService1";
227
+ case "http://iiif.io/api/search/1/search":
228
+ case "http://iiif.io/api/search/0/search":
229
+ return "SearchService1";
230
+ case "http://iiif.io/api/search/1/autocomplete":
231
+ case "http://iiif.io/api/search/0/autocomplete":
232
+ return "AutoCompleteService1";
233
+ }
234
+ }
235
+ function x(t) {
236
+ for (let e of ["sc", "oa", "dcterms", "dctypes", "iiif"]) if (t.startsWith(`${e}:`)) return t.slice(e.length + 1);
237
+ return t;
238
+ }
239
+ var Ye = ["Collection", "Manifest", "Annotation", "AnnotationPage", "Range", "Service"];
240
+ function w(t) {
241
+ let e = t["@id"] || t.id, r = t["@type"] || t.type, i = t.profile || void 0, s = t["@context"] || void 0;
242
+ if (i) {
243
+ let n = Xe(i);
244
+ if (n) return n;
245
+ }
246
+ if (s) {
247
+ let n = Qe(s);
248
+ if (n) return n;
249
+ }
250
+ if (r) {
251
+ if (Array.isArray(r)) {
252
+ if (r.indexOf("oa:CssStylesheet") !== -1) return "CssStylesheet";
253
+ if (r.indexOf("cnt:ContentAsText") !== -1) return "TextualBody";
254
+ r = r[0];
255
+ }
256
+ for (let n of ["sc", "oa", "dcterms", "dctypes", "iiif"]) if (r.startsWith(`${n}:`)) {
257
+ r = r.slice(n.length + 1);
258
+ break;
259
+ }
260
+ switch (r) {
261
+ case "Layer":
262
+ return "AnnotationCollection";
263
+ case "AnnotationList":
264
+ return "AnnotationPage";
265
+ case "cnt:ContentAsText":
266
+ return "TextualBody";
267
+ }
268
+ }
269
+ if (r && Ye.indexOf(r) !== -1) return r;
270
+ if (t.format) {
271
+ if (t.format.startsWith("image/")) return "Image";
272
+ if (t.format.startsWith("text/") || t.format === "application/pdf") return "Text";
273
+ if (t.format.startsWith("application/")) return "Dataset";
274
+ }
275
+ return e && (e.endsWith(".jpg") || e.endsWith(".png") || e.endsWith(".jpeg")) ? "Image" : r || "unknown";
276
+ }
277
+ var Ze = /http(s)?:\/\/(creativecommons.org|rightsstatements.org)[^"'\\<\n]+/gm;
278
+ function et(t) {
279
+ let e = t.match(Ze);
280
+ return e ? e[0] : t;
281
+ }
282
+ function tt(t, e = "Rights/License", r = "none") {
283
+ let i = null, s = [], n = Array.isArray(t) ? t : [t];
284
+ for (let a of n) {
285
+ let o = a ? et(a) : void 0;
286
+ if (o && (o.indexOf("creativecommons.org") !== -1 || o.indexOf("rightsstatements.org") !== -1)) {
287
+ o.startsWith("https://") ? i = `http://${o.slice(8)}` : i = o;
288
+ continue;
289
+ }
290
+ o && s.push({ label: { [r]: [e] }, value: { [r]: [o] } });
291
+ }
292
+ return [i, s];
293
+ }
294
+ var rt = ["http://iiif.io/api/presentation/2/context.json", "http://iiif.io/api/image/2/context.json", "http://iiif.io/api/image/1/context.json", "http://library.stanford.edu/iiif/image-api/1.1/context.json", "http://iiif.io/api/search/1/context.json", "http://iiif.io/api/search/0/context.json", "http://iiif.io/api/auth/1/context.json", "http://iiif.io/api/auth/0/context.json", "http://iiif.io/api/annex/openannotation/context.json"];
295
+ function it(t) {
296
+ if (t) {
297
+ let e = Array.isArray(t) ? t : [t], r = [];
298
+ for (let i of e) i === "http://iiif.io/api/presentation/2/context.json" && r.push("http://iiif.io/api/presentation/3/context.json"), rt.indexOf(i) === -1 && r.push(i);
299
+ if (e.length) return r.length === 1 ? r[0] : r;
300
+ }
301
+ }
302
+ function st(t) {
303
+ return t ? t.map((e) => ({ label: d(e.label), value: d(e.value) })) : [];
304
+ }
305
+ var $ = 0;
306
+ function B(t, e) {
307
+ let r = encodeURI(t.id || t["@id"] || "").trim();
308
+ return r && e ? `${r}/${e}` : r || ($++, `http://example.org/${t["@type"]}${e ? `/${e}` : ""}/${$}`);
309
+ }
310
+ function h(t) {
311
+ let e = [...t.behavior || []];
312
+ t.viewingHint && e.push(t.viewingHint);
313
+ let r;
314
+ return Array.isArray(t.motivation) ? r = t.motivation.map(x) : t.motivation && (r = x(t.motivation)), { "@context": t["@context"] ? it(t["@context"]) : void 0, id: (t["@id"] || B(t)).trim(), type: w(t), behavior: e.length ? e : void 0, height: t.height ? t.height : void 0, width: t.width ? t.width : void 0, motivation: r, viewingDirection: t.viewingDirection, profile: t.profile, format: t.format ? t.format : void 0, duration: void 0, timeMode: void 0 };
315
+ }
316
+ function u(t) {
317
+ let [e, r] = tt(t.license), i = [...t.metadata ? st(t.metadata) : [], ...r];
318
+ return { rights: e, metadata: i.length ? i : void 0, label: t.label ? d(t.label) : void 0, requiredStatement: t.attribution ? { label: d(R.attributionLabel), value: d(t.attribution) } : void 0, navDate: t.navDate, summary: t.description ? d(t.description) : void 0, thumbnail: nt(t.thumbnail) };
319
+ }
320
+ function nt(t) {
321
+ return t && (Array.isArray(t) ? t : [t]).map((e) => typeof e == "string" ? { id: e, type: "Image" } : (e.type === "unknown" && (e.type = "Image"), e));
322
+ }
323
+ function at(t) {
324
+ if (!t.within) return;
325
+ let e = Array.isArray(t.within) ? t.within : [t.within], r = [];
326
+ for (let i of e) if (typeof i == "string") {
327
+ if (i) switch (t["@type"]) {
328
+ case "sc:Manifest":
329
+ r.push({ id: i, type: "Collection" });
330
+ break;
331
+ }
332
+ } else i["@id"] && r.push({ id: i["@id"], type: w(i) });
333
+ return r.length ? r : void 0;
334
+ }
335
+ function m(t) {
336
+ let e = t.related ? Array.isArray(t.related) ? t.related : [t.related] : [], r = t.contentLayer;
337
+ return { provider: t.logo || e.length ? [{ id: R.providerId, type: "Agent", homepage: e.length ? [e[0]] : void 0, logo: t.logo ? Array.isArray(t.logo) ? t.logo : [t.logo] : void 0, label: d(R.providerName) }] : void 0, partOf: at(t), rendering: t.rendering, seeAlso: t.seeAlso, start: t.startCanvas, service: t.service ? g(t.service) : void 0, supplementary: r ? [r] : void 0 };
338
+ }
339
+ function ot(t) {
340
+ return { chars: t.chars, format: t.format ? t.format : void 0, language: t.language };
341
+ }
342
+ function ct(t) {
343
+ return v({ ...h(t), ...u(t), ...m(t), items: t.members });
344
+ }
345
+ function lt(t) {
346
+ let e = [], r = [], i;
347
+ for (let n of t.sequences || []) n.canvases.length && e.push(...n.canvases), n.behavior && r.push(...n.behavior), n.startCanvas && (i = n.startCanvas);
348
+ let s = h(t);
349
+ return r.length && (s.behavior ? s.behavior.push(...r) : s.behavior = r), v({ ...s, ...u(t), ...m(t), start: i, items: e, structures: vt(t.structures) });
350
+ }
351
+ function vt(t) {
352
+ if (!t) return t;
353
+ let e = /* @__PURE__ */ new Map();
354
+ for (let i of t) e.set(i.id, i);
355
+ let r = [];
356
+ for (let i of t) if (i.items) {
357
+ let s = i.items.map((n) => typeof n == "string" ? (r.push(n), e.get(n) || n) : n && n.id ? (r.push(n.id), e.get(n.id) || n) : n);
358
+ i.items = s;
359
+ }
360
+ return t.filter((i) => r.indexOf(i.id) === -1);
361
+ }
362
+ function pt(t) {
363
+ return v({ ...h(t), ...u(t), ...m(t), annotations: t.otherContent && t.otherContent.length ? t.otherContent : void 0, items: t.images && t.images.length ? [{ id: B(t, "annotation-page"), type: "AnnotationPage", items: t.images }] : void 0 });
364
+ }
365
+ function ht(t) {
366
+ return v({ ...h(t), ...u(t), ...m(t), items: t.resources && t.resources.length ? t.resources : void 0 });
367
+ }
368
+ function ut(t) {
369
+ return !t.canvases || t.canvases.length === 0 ? { canvases: [], behavior: [] } : { canvases: t.canvases, behavior: t.viewingHint ? [t.viewingHint] : [], startCanvas: t.startCanvas };
370
+ }
371
+ function ft(t) {
372
+ function e(r) {
373
+ if (Array.isArray(r)) {
374
+ if (r.length > 1) return { type: "List", items: r.map(e) };
375
+ r = r[0];
376
+ }
377
+ if (typeof r == "string") return encodeURI(r).trim();
378
+ if ("@type" in r) {
379
+ let i;
380
+ if (typeof r.full == "string") i = r.full;
381
+ else if (r.full["@type"] === "dctypes:Image") i = { id: r.full["@id"], type: "Image" };
382
+ else if (r.full["@type"] === "sc:Canvas") i = { id: r.full["@id"], type: "Canvas" };
383
+ else throw new Error(`Unsupported source type on annotation: ${r.full["@type"]}`);
384
+ return { type: "SpecificResource", source: i, selector: L(r.selector) };
385
+ } else return encodeURI(r["@id"]).trim();
386
+ }
387
+ return v({ ...h(t), ...u(t), ...m(t), target: e(t.on), body: Array.isArray(t.resource) ? t.resource.map(j) : j(t.resource) });
388
+ }
389
+ function j(t) {
390
+ return t.type === "Choice" ? t : J(t);
391
+ }
392
+ function J(t) {
393
+ let e = t;
394
+ return v({ ...h(e), ...u(e), ...m(e), ...ot(e) });
395
+ }
396
+ function mt(t) {
397
+ let e = [];
398
+ return t.default && t.default !== "rdf:nil" && e.push(t.default), t.item && t.item !== "rdf:nil" && e.push(...t.item), v({ ...h(t), ...u(t), items: e });
399
+ }
400
+ function gt(t) {
401
+ return v({ ...h(t), ...u(t), ...m(t), items: t.members });
402
+ }
403
+ function dt(t) {
404
+ let { "@id": e, "@type": r, "@context": i, profile: s, ...n } = t, a = {};
405
+ return e && (a["@id"] = e), a["@type"] = w(t), a["@type"] === "unknown" && (i && i.length && (a["@context"] = i), a["@type"] = "Service"), s && (a.profile = H(s)), v({ ...a, ...n });
406
+ }
407
+ function yt(t) {
408
+ return v({ ...h(t), ...u(t), ...m(t) });
409
+ }
410
+ var At = new Te({ collection: [ct], manifest: [lt], canvas: [pt], annotationList: [ht], sequence: [ut], annotation: [ft], contentResource: [J], choice: [mt], range: [gt], service: [dt], layer: [yt] });
411
+ function Ct(t) {
412
+ return t && t["@context"] && (t["@context"] === "http://iiif.io/api/presentation/2/context.json" || t["@context"].indexOf("http://iiif.io/api/presentation/2/context.json") !== -1 || t["@context"] === "http://www.shared-canvas.org/ns/context.json") || t["@context"] === "http://iiif.io/api/image/2/context.json" ? At.traverseUnknown(t) : t;
413
+ }
414
+ function L(t) {
415
+ if ((Array.isArray(t["@type"]) && t["@type"].includes("oa:SvgSelector") || t["@type"] == "oa:SvgSelector") && ("chars" in t || "value" in t)) return { type: "SvgSelector", value: "chars" in t ? t.chars : t.value };
416
+ if (t["@type"] === "oa:FragmentSelector") return { type: "FragmentSelector", value: t.value };
417
+ if (t["@type"] === "oa:Choice") return [L(t.default), ...(Array.isArray(t.item) ? t.item : [t.item]).map(L)];
418
+ if (t["@type"] == "iiif:ImageApiSelector") return { type: "ImageApiSelector", region: "region" in t ? t.region : void 0, rotation: "rotation" in t ? t.rotation : void 0 };
419
+ throw new Error(`Unsupported selector type: ${t["@type"]}`);
420
+ }
421
+ function b(t) {
422
+ return typeof t == "string" ? !1 : t && !t.type && "source" in t ? (t.type = "SpecificResource", !0) : !!t && t.type === "SpecificResource";
423
+ }
424
+ function C(...t) {
425
+ return (e) => t.reduce((r, i) => i(r), e);
426
+ }
427
+ var M = ["Collection", "Manifest", "Canvas", "AnnotationPage", "AnnotationCollection", "Annotation", "ContentResource", "Range", "Service", "Selector", "Agent"];
428
+ function bt(t, e) {
429
+ if (typeof t > "u" || t === null) throw new Error("Null or undefined is not a valid entity.");
430
+ if (Array.isArray(t)) throw new Error("Array is not a valid entity");
431
+ if (typeof t != "object") {
432
+ if (e) return e;
433
+ throw new Error(`${typeof t} is not a valid entity`);
434
+ }
435
+ if (typeof t.type == "string") {
436
+ let r = M.indexOf(t.type);
437
+ if (r !== -1) return M[r];
438
+ }
439
+ if (t.profile) return "Service";
440
+ throw new Error("Resource type is not known");
441
+ }
442
+ var G = class z {
443
+ constructor(e, r = {}) {
444
+ f(this, "traversals"), f(this, "options"), f(this, "_traverseManifest", C(this.traverseManifestItems.bind(this), this.traverseLinking.bind(this), this.traverseDescriptive.bind(this), this.traverseLinkedCanvases.bind(this), this.traverseManifestStructures.bind(this), this.traverseInlineAnnotationPages.bind(this))), f(this, "_traverseCanvas", C(this.traverseCanvasItems.bind(this), this.traverseLinking.bind(this), this.traverseDescriptive.bind(this), this.traverseLinkedCanvases.bind(this), this.traverseInlineAnnotationPages.bind(this))), f(this, "_traverseAnnotationPage", C(this.traverseAnnotationPageItems.bind(this), this.traverseLinking.bind(this), this.traverseDescriptive.bind(this))), f(this, "_traverseRange", C(this.traverseRangeRanges.bind(this), this.traverseLinking.bind(this), this.traverseDescriptive.bind(this), this.traverseLinkedCanvases.bind(this))), this.traversals = { collection: [], manifest: [], canvas: [], annotationCollection: [], annotationPage: [], annotation: [], contentResource: [], choice: [], range: [], service: [], agent: [], specificResource: [], geoJson: [], ...e }, this.options = { allowUndefinedReturn: !1, ...r };
445
+ }
446
+ static all(e) {
447
+ return new z({ collection: [e], manifest: [e], canvas: [e], annotationCollection: [e], annotationPage: [e], annotation: [e], contentResource: [e], choice: [e], range: [e], service: [e], geoJson: [e], specificResource: [e], agent: [e] });
448
+ }
449
+ traverseDescriptive(e) {
450
+ return e.thumbnail && (e.thumbnail = g(e.thumbnail).map((r) => this.traverseType(r, { parent: e }, this.traversals.contentResource))), e.provider && (e.provider = e.provider.map((r) => this.traverseAgent(r, e))), e;
451
+ }
452
+ traverseLinking(e) {
453
+ return e.seeAlso && (e.seeAlso = e.seeAlso.map((r) => this.traverseType(r, { parent: e }, this.traversals.contentResource))), e.service && (e.service = g(e.service).map((r) => this.traverseService(r))), e.services && (e.services = g(e.services).map((r) => this.traverseService(r, e))), e.logo && (e.logo = e.logo.map((r) => this.traverseType(r, { parent: e }, this.traversals.contentResource))), e.homepage && (e.homepage = g(e.homepage).map((r) => this.traverseType(r, { parent: e }, this.traversals.contentResource))), e.partOf && (e.partOf = e.partOf.map((r) => typeof r == "string" || !r.type ? this.traverseType(r, { parent: e }, this.traversals.contentResource) : r.type === "Canvas" ? this.traverseType(r, { parent: e }, this.traversals.canvas) : r.type === "AnnotationCollection" ? this.traverseType(r, { parent: e }, this.traversals.annotationCollection) : r.type === "Collection" ? this.traverseType(r, { parent: e }, this.traversals.collection) : this.traverseType(r, { parent: e }, this.traversals.contentResource))), e.start && (b(e.start) ? e.start = this.traverseSpecificResource(e.start, "Canvas", e) : e.start = this.traverseType(e.start, { parent: e }, this.traversals.canvas)), e.rendering && (e.rendering = e.rendering.map((r) => this.traverseType(r, { parent: e }, this.traversals.contentResource))), e.supplementary && (e.supplementary = e.supplementary.map((r) => this.traverseType(r, { parent: e }, this.traversals.contentResource))), e;
454
+ }
455
+ traverseCollectionItems(e) {
456
+ return e.items && e.items.map((r) => r.type === "Collection" ? this.traverseCollection(r) : this.traverseManifest(r)), e;
457
+ }
458
+ traverseCollection(e, r) {
459
+ return this.traverseType(this.traverseDescriptive(this.traverseInlineAnnotationPages(this.traverseLinking(this.traverseLinkedCanvases(this.traverseCollectionItems(e))))), { parent: r }, this.traversals.collection);
460
+ }
461
+ traverseGeoJson(e, r) {
462
+ return this.traverseType(e, { parent: r }, this.traversals.geoJson);
463
+ }
464
+ traverseNavPlace(e) {
465
+ return e.navPlace && (e.navPlace = this.traverseGeoJson(e.navPlace, e)), e;
466
+ }
467
+ traverseManifestItems(e) {
468
+ return e.items && (e.items = e.items.map((r) => this.traverseCanvas(r))), e;
469
+ }
470
+ traverseManifestStructures(e) {
471
+ return e.structures && (e.structures = e.structures.map((r) => this.traverseRange(r))), e;
472
+ }
473
+ traverseManifest(e, r) {
474
+ return this.traverseType(this._traverseManifest(e), { parent: r }, this.traversals.manifest);
475
+ }
476
+ traverseCanvasItems(e) {
477
+ return e.items = (e.items || []).map((r) => this.traverseAnnotationPage(r, e)), e;
478
+ }
479
+ traverseInlineAnnotationPages(e) {
480
+ return typeof e == "string" || !e || e.annotations && (e.annotations = e.annotations.map((r) => this.traverseAnnotationPage(r, e))), e;
481
+ }
482
+ traverseCanvas(e, r) {
483
+ return this.traverseType(this._traverseCanvas(e), { parent: r }, this.traversals.canvas);
484
+ }
485
+ traverseAnnotationPageItems(e) {
486
+ return e.items && (e.items = e.items.map((r) => this.traverseAnnotation(r, e))), e;
487
+ }
488
+ traverseAnnotationPage(e, r) {
489
+ return this.traverseType(this._traverseAnnotationPage(e), { parent: r }, this.traversals.annotationPage);
490
+ }
491
+ traverseAnnotationBody(e) {
492
+ return Array.isArray(e.body) ? e.body = e.body.map((r) => this.traverseContentResource(r, e)) : e.body && (e.body = this.traverseContentResource(e.body, e)), e;
493
+ }
494
+ traverseLinkedCanvases(e) {
495
+ return e.placeholderCanvas && (e.placeholderCanvas = this.traverseCanvas(e.placeholderCanvas)), e.accompanyingCanvas && (e.accompanyingCanvas = this.traverseCanvas(e.accompanyingCanvas)), e;
496
+ }
497
+ traverseAnnotation(e, r) {
498
+ return this.traverseType(this.traverseLinking(this.traverseAnnotationBody(this.traverseDescriptive(e))), { parent: r }, this.traversals.annotation);
499
+ }
500
+ traverseContentResourceLinking(e) {
501
+ return typeof e == "string" || !e || e && e.service && (e.service = g(e.service || []).map((r) => this.traverseService(r, e))), e;
502
+ }
503
+ traverseContentResource(e, r) {
504
+ return e.type === "Choice" && (e.items = e.items.map((i) => this.traverseContentResource(i, e))), b(e) ? this.traverseSpecificResource(e, "ContentResource") : this.traverseType(this.traverseInlineAnnotationPages(this.traverseContentResourceLinking(e)), { parent: r }, this.traversals.contentResource);
505
+ }
506
+ traverseSpecificResource(e, r, i) {
507
+ let s = e.source;
508
+ return typeof e.source == "string" && (s = { id: e.source, type: r || "unknown" }), this.traverseType({ ...e, source: r === "Canvas" || s.type === "Canvas" ? this.traverseType(s, { parent: i }, this.traversals.canvas) : r === "ContentResource" ? this.traverseContentResource(s, { parent: i }) : this.traverseUnknown(s, { parent: i, typeHint: r }) }, { parent: i }, this.traversals.specificResource);
509
+ }
510
+ traverseRangeRanges(e) {
511
+ return e.items && (e.items = e.items.map((r) => typeof r == "string" ? this.traverseCanvas({ id: r, type: "Canvas" }, e) : b(r) ? this.traverseSpecificResource(r, "Canvas", e) : r.type === "Manifest" ? this.traverseManifest(r, e) : this.traverseRange(r, e))), e;
512
+ }
513
+ traverseRange(e, r) {
514
+ return this.traverseType(this._traverseRange(e), { parent: r }, this.traversals.range);
515
+ }
516
+ traverseAgent(e, r) {
517
+ return this.traverseType(this.traverseDescriptive(this.traverseLinking(e)), { parent: r }, this.traversals.agent);
518
+ }
519
+ traverseType(e, r, i) {
520
+ return i.reduce((s, n) => {
521
+ let a = n(s, r);
522
+ return typeof a > "u" && !this.options.allowUndefinedReturn ? s : a;
523
+ }, e);
524
+ }
525
+ traverseService(e, r) {
526
+ let i = Object.assign({}, e);
527
+ return i && i.service && (i.service = g(i.service).map((s) => this.traverseService(s))), this.traverseType(i, { parent: r }, this.traversals.service);
528
+ }
529
+ traverseUnknown(e, { parent: r, typeHint: i } = {}) {
530
+ let s = bt(e, i);
531
+ switch (s) {
532
+ case "Collection":
533
+ return this.traverseCollection(e, r);
534
+ case "Manifest":
535
+ return this.traverseManifest(e, r);
536
+ case "Canvas":
537
+ return this.traverseCanvas(e, r);
538
+ case "AnnotationPage":
539
+ return this.traverseAnnotationPage(e, r);
540
+ case "Annotation":
541
+ return this.traverseAnnotation(e, r);
542
+ case "ContentResource":
543
+ return this.traverseContentResource(e, r);
544
+ case "Range":
545
+ return this.traverseRange(e, r);
546
+ case "Service":
547
+ return this.traverseService(e, r);
548
+ case "Agent":
549
+ return this.traverseAgent(e, r);
550
+ default:
551
+ throw new Error(`Unknown or unsupported resource type of ${s}`);
552
+ }
553
+ }
554
+ };
555
+ const K = (t) => p(t, "type").startsWith("ImageService") || t.profile && t.profile.toString().includes("iiif.io/api/image/"), Q = (t) => {
556
+ const e = p(t, "type"), r = p(t, "context");
557
+ if (e === "ImageService2" || r != null && r.includes("image/2")) {
558
+ const i = t, s = ["level0", "level1", "level2"];
559
+ return { majorVersion: 2, profileLevel: (Array.isArray(i.profile) ? i.profile : [i.profile]).map((o) => s.findIndex((c) => o.toString().includes(c))).filter((o) => o > -1).sort((o, c) => c - o)[0] };
560
+ } else if (e || r)
561
+ return { majorVersion: 3, profileLevel: parseInt(t.profile) };
562
+ }, k = (t, e, r) => {
563
+ const i = p(t, "id"), s = t.profile || "";
564
+ if (typeof s == "string" && (s.includes("level0") || s.includes("level:0"))) {
565
+ if ("sizes" in t && Array.isArray(t.sizes)) {
566
+ const a = t.sizes.sort((o, c) => c.width * c.height - o.width * o.height).filter((o) => o.width * o.height >= e * r)[0];
567
+ if (a)
568
+ return `${i}/full/${a.width},${a.height}/0/default.jpg`;
569
+ }
570
+ return `${i}/full/full/0/default.jpg`;
571
+ }
572
+ return `${i}/full/!${e},${r}/0/default.jpg`;
573
+ }, Rt = (t, e, r) => {
574
+ const i = p(t, "id"), s = t.profile || "";
575
+ if (typeof s == "string" && (s.includes("level0") || s.includes("level:0"))) return;
576
+ const { x: a, y: o, w: c, h: l } = e, y = c / l, A = y < 1, Y = Math.ceil(A ? r / y : r), Z = Math.ceil(A ? r : r / y), ee = `${Math.round(a)},${Math.round(o)},${Math.round(c)},${Math.round(l)}`;
577
+ return `${i}/${ee}/!${Z},${Y}/0/default.jpg`;
578
+ }, Lt = (t) => (e, r = 400) => {
579
+ if (t.type === "dynamic")
580
+ return Rt(t.service, e, r);
581
+ console.error("Level 0 or static image canvas: unspported");
582
+ }, wt = (t, e = []) => (r = 400) => {
583
+ const { width: i, height: s } = t;
584
+ if (!i || !s) return;
585
+ const n = i / s, a = n < 1, o = Math.ceil(a ? r / n : r), c = Math.ceil(a ? r : r / n);
586
+ if (t.thumbnail && t.thumbnail.length > 0) {
587
+ const l = t.thumbnail[0];
588
+ if ("service" in l && Array.isArray(l.service)) {
589
+ const y = l.service.find((A) => K(A));
590
+ if (y)
591
+ return k(y, c, o);
592
+ }
593
+ if ("id" in l) return l.id;
594
+ }
595
+ for (const l of e) {
596
+ if (l.type === "dynamic" || l.type === "level0")
597
+ return k(l.service, c, o);
598
+ if (l.type === "static")
599
+ return l.url;
600
+ }
601
+ }, X = (t) => t.endsWith("/info.json") ? t : `${t.endsWith("/") ? t : `${t}/`}info.json`, It = (t) => {
602
+ const { format: e, height: r, width: i } = t, s = p(t, "id"), n = (t.service || []).find(K), a = n ? Q(n) : void 0;
603
+ if (a) {
604
+ const o = {
605
+ source: t,
606
+ type: a.profileLevel === 0 ? "level0" : "dynamic",
607
+ service: n,
608
+ width: i,
609
+ height: r,
610
+ majorVersion: a.majorVersion,
611
+ serviceUrl: X(p(n, "id"))
612
+ };
613
+ return a.profileLevel === 0 ? o : {
614
+ ...o,
615
+ getRegionURL: Lt(o)
616
+ };
617
+ } else
618
+ return {
619
+ source: t,
620
+ type: "static",
621
+ width: i,
622
+ height: r,
623
+ url: s,
624
+ format: e
625
+ };
626
+ }, St = (t) => {
627
+ const e = [];
628
+ return new G({
629
+ annotation: [(i) => {
630
+ if (i.motivation === "painting") {
631
+ const n = (i.body ? Array.isArray(i.body) ? i.body : [i.body] : []).filter((a) => a.type === "Image");
632
+ e.push(...n.map((a) => It(a)));
633
+ }
634
+ }]
635
+ }).traverseCanvas(t), e;
636
+ }, jt = {
637
+ parseURL: async (t) => {
638
+ try {
639
+ new URL(t);
640
+ } catch {
641
+ return {
642
+ type: "error",
643
+ code: "INVALID_URL",
644
+ message: "The provided input is not a valid URL"
645
+ };
646
+ }
647
+ let e;
648
+ try {
649
+ if (e = await fetch(t), !e.ok)
650
+ return {
651
+ type: "error",
652
+ code: "INVALID_HTTP_RESPONSE",
653
+ message: `Server responded: HTTP ${e.status} ${e.statusText ? `(${e.statusText})` : ""}`
654
+ };
655
+ } catch (i) {
656
+ return {
657
+ type: "error",
658
+ code: "FETCH_ERROR",
659
+ message: i instanceof Error ? i.message : "Failed to fetch resource"
660
+ };
661
+ }
662
+ const r = e.headers.get("content-type");
663
+ if (r != null && r.startsWith("image/"))
664
+ return {
665
+ type: "plain-image",
666
+ url: t
667
+ };
668
+ if (r != null && r.includes("text/html"))
669
+ return {
670
+ type: "webpage",
671
+ url: t
672
+ };
673
+ try {
674
+ const i = await e.json(), s = Array.isArray(i["@context"]) ? i["@context"].find((a) => a.includes("iiif.io/api/")) : i["@context"];
675
+ if (!s)
676
+ return {
677
+ type: "error",
678
+ code: "INVALID_MANIFEST",
679
+ message: "Missing @context"
680
+ };
681
+ if (!p(i, "id"))
682
+ return {
683
+ type: "error",
684
+ code: "INVALID_MANIFEST",
685
+ message: "Missing id property"
686
+ };
687
+ if (s.includes("presentation/2") || s.includes("presentation/3")) {
688
+ const a = s.includes("presentation/2") ? 2 : 3;
689
+ return {
690
+ type: "manifest",
691
+ url: t,
692
+ resource: Tt(i, a)
693
+ };
694
+ }
695
+ if (s.includes("image/2") || s.includes("image/3")) {
696
+ const a = xt(i);
697
+ return a ? {
698
+ type: "iiif-image",
699
+ url: t,
700
+ resource: a
701
+ } : {
702
+ type: "error",
703
+ code: "INVALID_MANIFEST",
704
+ message: "Invalid image service definition"
705
+ };
706
+ }
707
+ return {
708
+ type: "error",
709
+ code: "INVALID_MANIFEST",
710
+ message: "JSON resource is not a recognized IIIF format"
711
+ };
712
+ } catch {
713
+ return {
714
+ type: "error",
715
+ code: "UNSUPPORTED_FORMAT",
716
+ message: "Could not parse resource"
717
+ };
718
+ }
719
+ }
720
+ }, Tt = (t, e) => {
721
+ const r = (n) => {
722
+ const a = [];
723
+ return new G({
724
+ canvas: [(c) => {
725
+ c.items && a.push(c);
726
+ }]
727
+ }).traverseManifest(n), a.map((c) => {
728
+ const l = St(c);
729
+ return {
730
+ source: c,
731
+ id: c.id,
732
+ width: c.width,
733
+ height: c.height,
734
+ images: l,
735
+ getLabel: S(c),
736
+ getMetadata: I(c),
737
+ getThumbnailURL: wt(c, l)
738
+ };
739
+ });
740
+ }, i = e === 2 ? Ct(t) : t, s = r(i);
741
+ return {
742
+ source: i,
743
+ id: i.id,
744
+ majorVersion: e,
745
+ canvases: s,
746
+ getLabel: S(i),
747
+ getMetadata: I(i)
748
+ };
749
+ }, xt = (t) => {
750
+ const { width: e, height: r } = t, i = Q(t);
751
+ if (i)
752
+ return {
753
+ type: i.profileLevel === 0 ? "level0" : "dynamic",
754
+ service: t,
755
+ width: e,
756
+ height: r,
757
+ majorVersion: i.majorVersion,
758
+ serviceUrl: X(p(t, "id"))
759
+ };
760
+ };
5
761
  export {
6
- f as Cozy,
7
- m as getImageURLFromService,
8
- t as getImages,
9
- c as getLabel,
10
- n as getMetadata,
11
- v as getPropertyValue,
12
- i as getRegionURL,
13
- l as getRegionURLFromService,
14
- L as getStringValue,
15
- g as getThumbnailURL,
16
- p as isImageService,
17
- o as normalizeServiceUrl,
18
- R as parseImageService
762
+ jt as Cozy,
763
+ k as getImageURLFromService,
764
+ St as getImages,
765
+ S as getLabel,
766
+ I as getMetadata,
767
+ p as getPropertyValue,
768
+ Lt as getRegionURL,
769
+ Rt as getRegionURLFromService,
770
+ Pt as getStringValue,
771
+ wt as getThumbnailURL,
772
+ K as isImageService,
773
+ X as normalizeServiceUrl,
774
+ Q as parseImageService
19
775
  };