triiiceratops 0.1.0
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/README.md +78 -0
- package/dist/favicon.ico +0 -0
- package/dist/src/lib/components/AnnotationOverlay.svelte.d.ts +1 -0
- package/dist/src/lib/components/CanvasNavigation.svelte.d.ts +1 -0
- package/dist/src/lib/components/FloatingMenu.svelte.d.ts +1 -0
- package/dist/src/lib/components/MetadataDialog.svelte.d.ts +1 -0
- package/dist/src/lib/components/OSDViewer.svelte.d.ts +1 -0
- package/dist/src/lib/components/SearchPanel.svelte.d.ts +1 -0
- package/dist/src/lib/components/ThumbnailGallery.svelte.d.ts +1 -0
- package/dist/src/lib/components/TriiiceratopsViewer.svelte.d.ts +1 -0
- package/dist/src/lib/custom-element.d.ts +0 -0
- package/dist/src/lib/index.d.ts +3 -0
- package/dist/src/lib/paraglide/messages/en.d.ts +1 -0
- package/dist/src/lib/paraglide/messages.d.ts +3 -0
- package/dist/src/lib/paraglide/runtime.d.ts +52 -0
- package/dist/src/lib/state/manifests.svelte.d.ts +18 -0
- package/dist/src/lib/state/viewer.svelte.d.ts +40 -0
- package/dist/src/lib/utils/annotationAdapter.d.ts +9 -0
- package/dist/triiiceratops-element.css +1 -0
- package/dist/triiiceratops-element.iife.js +1227 -0
- package/dist/triiiceratops-element.js +51795 -0
- package/dist/triiiceratops.js +1498 -0
- package/package.json +72 -0
|
@@ -0,0 +1,1498 @@
|
|
|
1
|
+
var ke = (n) => {
|
|
2
|
+
throw TypeError(n);
|
|
3
|
+
};
|
|
4
|
+
var Ge = (n, t, s) => t.has(n) || ke("Cannot " + s);
|
|
5
|
+
var C = (n, t, s) => (Ge(n, t, "read from private field"), s ? s.call(n) : t.get(n)), G = (n, t, s) => t.has(n) ? ke("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s);
|
|
6
|
+
import "svelte/internal/disclose-version";
|
|
7
|
+
import * as e from "svelte/internal/client";
|
|
8
|
+
import { onMount as Pe, getContext as _e, setContext as Re } from "svelte";
|
|
9
|
+
import * as Ne from "manifesto.js";
|
|
10
|
+
import Oe from "openseadragon";
|
|
11
|
+
import { createOSDAnnotator as Ve } from "@annotorious/openseadragon";
|
|
12
|
+
import "@annotorious/openseadragon/annotorious-openseadragon.css";
|
|
13
|
+
import Xe from "phosphor-svelte/lib/CaretLeft";
|
|
14
|
+
import Be from "phosphor-svelte/lib/CaretRight";
|
|
15
|
+
import Ye from "phosphor-svelte/lib/CaretDown";
|
|
16
|
+
import Ce from "phosphor-svelte/lib/Eye";
|
|
17
|
+
import Me from "phosphor-svelte/lib/EyeSlash";
|
|
18
|
+
import He from "phosphor-svelte/lib/X";
|
|
19
|
+
import "svelte/internal/flags/legacy";
|
|
20
|
+
import qe from "phosphor-svelte/lib/ChatCenteredText";
|
|
21
|
+
import Qe from "phosphor-svelte/lib/CornersIn";
|
|
22
|
+
import Ue from "phosphor-svelte/lib/CornersOut";
|
|
23
|
+
import We from "phosphor-svelte/lib/Info";
|
|
24
|
+
import Fe from "phosphor-svelte/lib/MagnifyingGlass";
|
|
25
|
+
import Je from "phosphor-svelte/lib/Plus";
|
|
26
|
+
import Ke from "phosphor-svelte/lib/Slideshow";
|
|
27
|
+
var te;
|
|
28
|
+
class Ze {
|
|
29
|
+
constructor() {
|
|
30
|
+
G(this, te, e.state(e.proxy({})));
|
|
31
|
+
}
|
|
32
|
+
get manifests() {
|
|
33
|
+
return e.get(C(this, te));
|
|
34
|
+
}
|
|
35
|
+
set manifests(t) {
|
|
36
|
+
e.set(C(this, te), t, !0);
|
|
37
|
+
}
|
|
38
|
+
async fetchManifest(t) {
|
|
39
|
+
if (!this.manifests[t]) {
|
|
40
|
+
this.manifests[t] = { isFetching: !0 };
|
|
41
|
+
try {
|
|
42
|
+
const s = await fetch(t);
|
|
43
|
+
if (!s.ok)
|
|
44
|
+
throw new Error(`HTTP error! status: ${s.status}`);
|
|
45
|
+
const r = await s.json(), i = Ne.parseManifest(r);
|
|
46
|
+
this.manifests[t] = { json: r, manifesto: i, isFetching: !1 };
|
|
47
|
+
} catch (s) {
|
|
48
|
+
this.manifests[t] = { error: s.message, isFetching: !1 };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
getManifest(t) {
|
|
53
|
+
const s = this.manifests[t];
|
|
54
|
+
return s == null ? void 0 : s.manifesto;
|
|
55
|
+
}
|
|
56
|
+
async fetchAnnotationList(t) {
|
|
57
|
+
if (!this.manifests[t])
|
|
58
|
+
try {
|
|
59
|
+
const s = await fetch(t);
|
|
60
|
+
if (s.ok) {
|
|
61
|
+
const r = await s.json();
|
|
62
|
+
this.manifests[t] = { json: r };
|
|
63
|
+
} else
|
|
64
|
+
console.error(`Failed to fetch annotation list: ${t}`);
|
|
65
|
+
} catch (s) {
|
|
66
|
+
console.error(`Error fetching annotation list: ${t}`, s);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
getCanvases(t) {
|
|
70
|
+
const s = this.getManifest(t);
|
|
71
|
+
if (!s)
|
|
72
|
+
return [];
|
|
73
|
+
const r = s.getSequences();
|
|
74
|
+
return !r || !r.length ? [] : r[0].getCanvases();
|
|
75
|
+
}
|
|
76
|
+
getAnnotations(t, s) {
|
|
77
|
+
const r = this.getManifest(t);
|
|
78
|
+
return r ? r.getSequences()[0].getCanvasById(s) ? this.manualGetAnnotations(t, s) : [] : [];
|
|
79
|
+
}
|
|
80
|
+
// We can refactor this to use Manifesto's resource handling later if needed.
|
|
81
|
+
manualGetAnnotations(t, s) {
|
|
82
|
+
const r = this.getManifest(t);
|
|
83
|
+
if (!r) return [];
|
|
84
|
+
const i = r.getSequences()[0].getCanvasById(s);
|
|
85
|
+
if (!i) return [];
|
|
86
|
+
const f = i.__jsonld;
|
|
87
|
+
let S = [];
|
|
88
|
+
const A = (h) => h.resources || h.items || [];
|
|
89
|
+
return f.otherContent && f.otherContent.forEach((h) => {
|
|
90
|
+
const m = h["@id"] || h.id;
|
|
91
|
+
if (m && !h.resources) {
|
|
92
|
+
const y = this.manifests[m];
|
|
93
|
+
if (y) {
|
|
94
|
+
if (y.json) {
|
|
95
|
+
const M = A(y.json);
|
|
96
|
+
S.push(...M);
|
|
97
|
+
}
|
|
98
|
+
} else
|
|
99
|
+
this.fetchAnnotationList(m);
|
|
100
|
+
} else h.resources && S.push(...h.resources);
|
|
101
|
+
}), f.annotations && f.annotations.forEach((h) => {
|
|
102
|
+
const m = h.id || h["@id"];
|
|
103
|
+
if (m && !h.items) {
|
|
104
|
+
const y = this.manifests[m];
|
|
105
|
+
if (y) {
|
|
106
|
+
if (y.json) {
|
|
107
|
+
const M = A(y.json);
|
|
108
|
+
S.push(...M);
|
|
109
|
+
}
|
|
110
|
+
} else
|
|
111
|
+
this.fetchAnnotationList(m);
|
|
112
|
+
} else h.items && S.push(...h.items);
|
|
113
|
+
}), S;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
te = new WeakMap();
|
|
117
|
+
const Z = new Ze();
|
|
118
|
+
var se, re, ie, ae, ne, oe, le, ce, de, fe, ue, ge, he, ve, me, be, pe;
|
|
119
|
+
class $e {
|
|
120
|
+
constructor(t) {
|
|
121
|
+
G(this, se, e.state(null));
|
|
122
|
+
G(this, re, e.state(null));
|
|
123
|
+
G(this, ie, e.state(!1));
|
|
124
|
+
G(this, ae, e.state(!1));
|
|
125
|
+
G(this, ne, e.state(!1));
|
|
126
|
+
G(this, oe, e.state(!1));
|
|
127
|
+
G(this, le, e.state(!1));
|
|
128
|
+
G(this, ce, e.state(!1));
|
|
129
|
+
G(this, de, e.state("none"));
|
|
130
|
+
G(this, fe, e.state(e.proxy(/* @__PURE__ */ new Set())));
|
|
131
|
+
G(this, ue, e.state(e.proxy({})));
|
|
132
|
+
G(this, ge, e.state(!1));
|
|
133
|
+
G(this, he, e.state(""));
|
|
134
|
+
G(this, ve, e.state(e.proxy([])));
|
|
135
|
+
G(this, me, e.state(!1));
|
|
136
|
+
G(this, be, e.state(!1));
|
|
137
|
+
G(this, pe, e.state(e.proxy([])));
|
|
138
|
+
this.manifestId = t || null, this.manifestId && Z.fetchManifest(this.manifestId);
|
|
139
|
+
}
|
|
140
|
+
get manifestId() {
|
|
141
|
+
return e.get(C(this, se));
|
|
142
|
+
}
|
|
143
|
+
set manifestId(t) {
|
|
144
|
+
e.set(C(this, se), t, !0);
|
|
145
|
+
}
|
|
146
|
+
get canvasId() {
|
|
147
|
+
return e.get(C(this, re));
|
|
148
|
+
}
|
|
149
|
+
set canvasId(t) {
|
|
150
|
+
e.set(C(this, re), t, !0);
|
|
151
|
+
}
|
|
152
|
+
get showAnnotations() {
|
|
153
|
+
return e.get(C(this, ie));
|
|
154
|
+
}
|
|
155
|
+
set showAnnotations(t) {
|
|
156
|
+
e.set(C(this, ie), t, !0);
|
|
157
|
+
}
|
|
158
|
+
get showThumbnailGallery() {
|
|
159
|
+
return e.get(C(this, ae));
|
|
160
|
+
}
|
|
161
|
+
set showThumbnailGallery(t) {
|
|
162
|
+
e.set(C(this, ae), t, !0);
|
|
163
|
+
}
|
|
164
|
+
get isGalleryDockedBottom() {
|
|
165
|
+
return e.get(C(this, ne));
|
|
166
|
+
}
|
|
167
|
+
set isGalleryDockedBottom(t) {
|
|
168
|
+
e.set(C(this, ne), t, !0);
|
|
169
|
+
}
|
|
170
|
+
get isGalleryDockedRight() {
|
|
171
|
+
return e.get(C(this, oe));
|
|
172
|
+
}
|
|
173
|
+
set isGalleryDockedRight(t) {
|
|
174
|
+
e.set(C(this, oe), t, !0);
|
|
175
|
+
}
|
|
176
|
+
get isFullScreen() {
|
|
177
|
+
return e.get(C(this, le));
|
|
178
|
+
}
|
|
179
|
+
set isFullScreen(t) {
|
|
180
|
+
e.set(C(this, le), t, !0);
|
|
181
|
+
}
|
|
182
|
+
get showMetadataDialog() {
|
|
183
|
+
return e.get(C(this, ce));
|
|
184
|
+
}
|
|
185
|
+
set showMetadataDialog(t) {
|
|
186
|
+
e.set(C(this, ce), t, !0);
|
|
187
|
+
}
|
|
188
|
+
get dockSide() {
|
|
189
|
+
return e.get(C(this, de));
|
|
190
|
+
}
|
|
191
|
+
set dockSide(t) {
|
|
192
|
+
e.set(C(this, de), t, !0);
|
|
193
|
+
}
|
|
194
|
+
get visibleAnnotationIds() {
|
|
195
|
+
return e.get(C(this, fe));
|
|
196
|
+
}
|
|
197
|
+
set visibleAnnotationIds(t) {
|
|
198
|
+
e.set(C(this, fe), t, !0);
|
|
199
|
+
}
|
|
200
|
+
get createdAnnotations() {
|
|
201
|
+
return e.get(C(this, ue));
|
|
202
|
+
}
|
|
203
|
+
set createdAnnotations(t) {
|
|
204
|
+
e.set(C(this, ue), t, !0);
|
|
205
|
+
}
|
|
206
|
+
get isCreatingAnnotation() {
|
|
207
|
+
return e.get(C(this, ge));
|
|
208
|
+
}
|
|
209
|
+
set isCreatingAnnotation(t) {
|
|
210
|
+
e.set(C(this, ge), t, !0);
|
|
211
|
+
}
|
|
212
|
+
get manifest() {
|
|
213
|
+
return this.manifestId ? Z.getManifest(this.manifestId) : null;
|
|
214
|
+
}
|
|
215
|
+
get canvases() {
|
|
216
|
+
if (!this.manifestId) return [];
|
|
217
|
+
const t = Z.getCanvases(this.manifestId);
|
|
218
|
+
return t.length > 0 && !this.canvasId && setTimeout(
|
|
219
|
+
() => {
|
|
220
|
+
!this.canvasId && t.length > 0 && (this.canvasId = t[0].id);
|
|
221
|
+
},
|
|
222
|
+
0
|
|
223
|
+
), t;
|
|
224
|
+
}
|
|
225
|
+
get currentCanvasIndex() {
|
|
226
|
+
return this.canvasId ? this.canvases.findIndex((t) => t.id === this.canvasId) : this.canvases.length > 0 ? 0 : -1;
|
|
227
|
+
}
|
|
228
|
+
get hasNext() {
|
|
229
|
+
return this.currentCanvasIndex < this.canvases.length - 1;
|
|
230
|
+
}
|
|
231
|
+
get hasPrevious() {
|
|
232
|
+
return this.currentCanvasIndex > 0;
|
|
233
|
+
}
|
|
234
|
+
nextCanvas() {
|
|
235
|
+
if (this.hasNext) {
|
|
236
|
+
const t = this.currentCanvasIndex + 1, s = this.canvases[t];
|
|
237
|
+
this.canvasId = s.id;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
previousCanvas() {
|
|
241
|
+
if (this.hasPrevious) {
|
|
242
|
+
const t = this.currentCanvasIndex - 1, s = this.canvases[t];
|
|
243
|
+
this.canvasId = s.id;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
setManifest(t) {
|
|
247
|
+
this.manifestId = t, this.canvasId = null, Z.fetchManifest(t);
|
|
248
|
+
}
|
|
249
|
+
setCanvas(t) {
|
|
250
|
+
this.canvasId = t, this.loadAnnotationsFromStorage(t);
|
|
251
|
+
}
|
|
252
|
+
toggleCreationMode(t) {
|
|
253
|
+
typeof t == "boolean" ? this.isCreatingAnnotation = t : this.isCreatingAnnotation = !this.isCreatingAnnotation;
|
|
254
|
+
}
|
|
255
|
+
loadAnnotationsFromStorage(t) {
|
|
256
|
+
if (typeof localStorage > "u") return;
|
|
257
|
+
const s = `triiiceratops-annotations-${t}`, r = localStorage.getItem(s);
|
|
258
|
+
if (r)
|
|
259
|
+
try {
|
|
260
|
+
const i = JSON.parse(r);
|
|
261
|
+
Array.isArray(i) && (this.createdAnnotations[t] = i);
|
|
262
|
+
} catch (i) {
|
|
263
|
+
console.error("Failed to parse stored annotations", i);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
addAnnotation(t, s) {
|
|
267
|
+
if (s && (this.createdAnnotations[s] || (this.createdAnnotations[s] = []), this.createdAnnotations[s] = [...this.createdAnnotations[s], t], typeof localStorage < "u")) {
|
|
268
|
+
const r = `triiiceratops-annotations-${s}`;
|
|
269
|
+
localStorage.setItem(r, JSON.stringify(this.createdAnnotations[s]));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
toggleAnnotations() {
|
|
273
|
+
this.showAnnotations = !this.showAnnotations;
|
|
274
|
+
}
|
|
275
|
+
toggleThumbnailGallery() {
|
|
276
|
+
this.showThumbnailGallery = !this.showThumbnailGallery;
|
|
277
|
+
}
|
|
278
|
+
toggleFullScreen() {
|
|
279
|
+
if (document.fullscreenElement)
|
|
280
|
+
document.exitFullscreen();
|
|
281
|
+
else {
|
|
282
|
+
const t = document.getElementById("triiiceratops-viewer");
|
|
283
|
+
t && t.requestFullscreen().catch((s) => {
|
|
284
|
+
console.warn("Fullscreen request failed", s);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
toggleMetadataDialog() {
|
|
289
|
+
this.showMetadataDialog = !this.showMetadataDialog;
|
|
290
|
+
}
|
|
291
|
+
get searchQuery() {
|
|
292
|
+
return e.get(C(this, he));
|
|
293
|
+
}
|
|
294
|
+
set searchQuery(t) {
|
|
295
|
+
e.set(C(this, he), t, !0);
|
|
296
|
+
}
|
|
297
|
+
get searchResults() {
|
|
298
|
+
return e.get(C(this, ve));
|
|
299
|
+
}
|
|
300
|
+
set searchResults(t) {
|
|
301
|
+
e.set(C(this, ve), t, !0);
|
|
302
|
+
}
|
|
303
|
+
get isSearching() {
|
|
304
|
+
return e.get(C(this, me));
|
|
305
|
+
}
|
|
306
|
+
set isSearching(t) {
|
|
307
|
+
e.set(C(this, me), t, !0);
|
|
308
|
+
}
|
|
309
|
+
get showSearchPanel() {
|
|
310
|
+
return e.get(C(this, be));
|
|
311
|
+
}
|
|
312
|
+
set showSearchPanel(t) {
|
|
313
|
+
e.set(C(this, be), t, !0);
|
|
314
|
+
}
|
|
315
|
+
toggleSearchPanel() {
|
|
316
|
+
this.showSearchPanel = !this.showSearchPanel, this.showSearchPanel || (this.searchAnnotations = []);
|
|
317
|
+
}
|
|
318
|
+
get searchAnnotations() {
|
|
319
|
+
return e.get(C(this, pe));
|
|
320
|
+
}
|
|
321
|
+
set searchAnnotations(t) {
|
|
322
|
+
e.set(C(this, pe), t, !0);
|
|
323
|
+
}
|
|
324
|
+
get currentCanvasSearchAnnotations() {
|
|
325
|
+
return this.canvasId ? this.searchAnnotations.filter((t) => t.canvasId === this.canvasId) : [];
|
|
326
|
+
}
|
|
327
|
+
async search(t) {
|
|
328
|
+
var s, r;
|
|
329
|
+
if (t.trim()) {
|
|
330
|
+
this.isSearching = !0, this.searchQuery = t, this.searchResults = [];
|
|
331
|
+
try {
|
|
332
|
+
const i = this.manifest;
|
|
333
|
+
if (!i) throw new Error("No manifest loaded");
|
|
334
|
+
let f = i.getService("http://iiif.io/api/search/1/search") || i.getService("http://iiif.io/api/search/0/search");
|
|
335
|
+
if (f || i.__jsonld && i.__jsonld.service && (f = (Array.isArray(i.__jsonld.service) ? i.__jsonld.service : [i.__jsonld.service]).find((b) => b.profile === "http://iiif.io/api/search/1/search" || b.profile === "http://iiif.io/api/search/0/search")), !f) {
|
|
336
|
+
console.warn("No IIIF search service found in manifest"), this.isSearching = !1;
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const A = `${f.id || f["@id"]}?q=${encodeURIComponent(t)}`, h = await fetch(A);
|
|
340
|
+
if (!h.ok) throw new Error("Search request failed");
|
|
341
|
+
const m = await h.json(), y = m.resources || [], M = [], o = (u) => {
|
|
342
|
+
const b = typeof u == "string" ? u : u["@id"] || u.id;
|
|
343
|
+
if (!b) return null;
|
|
344
|
+
const l = b.split("#xywh=");
|
|
345
|
+
if (l.length < 2) return null;
|
|
346
|
+
const c = l[1].split(",").map(Number);
|
|
347
|
+
return c.length === 4 ? c : null;
|
|
348
|
+
};
|
|
349
|
+
if (m.hits)
|
|
350
|
+
for (const u of m.hits) {
|
|
351
|
+
const b = u.annotations || [];
|
|
352
|
+
for (const l of b) {
|
|
353
|
+
const c = y.find((a) => a["@id"] === l || a.id === l);
|
|
354
|
+
if (c && c.on) {
|
|
355
|
+
const a = typeof c.on == "string" ? c.on : c.on["@id"] || c.on.id, d = a.split("#")[0], D = o(a), I = this.canvases.findIndex((F) => F.id === d);
|
|
356
|
+
if (I >= 0) {
|
|
357
|
+
const F = this.canvases[I];
|
|
358
|
+
let L = "Canvas " + (I + 1);
|
|
359
|
+
try {
|
|
360
|
+
if (F.getLabel) {
|
|
361
|
+
const j = F.getLabel();
|
|
362
|
+
Array.isArray(j) && j.length > 0 ? L = j[0].value : typeof j == "string" && (L = j);
|
|
363
|
+
} else F.label && (typeof F.label == "string" ? L = F.label : Array.isArray(F.label) && (L = (s = F.label[0]) == null ? void 0 : s.value));
|
|
364
|
+
} catch {
|
|
365
|
+
}
|
|
366
|
+
M.push({
|
|
367
|
+
type: "hit",
|
|
368
|
+
before: u.before,
|
|
369
|
+
match: u.match,
|
|
370
|
+
after: u.after,
|
|
371
|
+
canvasIndex: I,
|
|
372
|
+
canvasLabel: String(L),
|
|
373
|
+
bounds: D
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else if (y.length > 0)
|
|
380
|
+
for (const u of y) {
|
|
381
|
+
const b = typeof u.on == "string" ? u.on : u.on["@id"] || u.on.id, l = b.split("#")[0], c = o(b), a = this.canvases.findIndex((d) => d.id === l);
|
|
382
|
+
if (a >= 0) {
|
|
383
|
+
const d = this.canvases[a];
|
|
384
|
+
let D = "Canvas " + (a + 1);
|
|
385
|
+
try {
|
|
386
|
+
if (d.getLabel) {
|
|
387
|
+
const I = d.getLabel();
|
|
388
|
+
Array.isArray(I) && I.length > 0 ? D = I[0].value : typeof I == "string" && (D = I);
|
|
389
|
+
} else d.label && (typeof d.label == "string" ? D = d.label : Array.isArray(d.label) && (D = (r = d.label[0]) == null ? void 0 : r.value));
|
|
390
|
+
} catch {
|
|
391
|
+
}
|
|
392
|
+
M.push({
|
|
393
|
+
type: "resource",
|
|
394
|
+
match: u.resource && u.resource.chars ? u.resource.chars : u.chars || "",
|
|
395
|
+
canvasIndex: a,
|
|
396
|
+
canvasLabel: String(D),
|
|
397
|
+
bounds: c
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
this.searchResults = M, this.searchAnnotations = M.filter((u) => u.bounds).map((u, b) => {
|
|
402
|
+
const l = this.canvases[u.canvasIndex], c = `${l.id}#xywh=${u.bounds.join(",")}`;
|
|
403
|
+
return {
|
|
404
|
+
"@id": `urn:search-hit:${b}`,
|
|
405
|
+
"@type": "oa:Annotation",
|
|
406
|
+
motivation: "sc:painting",
|
|
407
|
+
on: c,
|
|
408
|
+
canvasId: l.id,
|
|
409
|
+
resource: { "@type": "cnt:ContentAsText", chars: u.match },
|
|
410
|
+
// Flag to identify styling in Overlay?
|
|
411
|
+
// Or just standard rendering.
|
|
412
|
+
isSearchHit: !0
|
|
413
|
+
};
|
|
414
|
+
});
|
|
415
|
+
} catch (i) {
|
|
416
|
+
console.error("Search error:", i);
|
|
417
|
+
} finally {
|
|
418
|
+
this.isSearching = !1;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
se = new WeakMap(), re = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), ne = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), ue = new WeakMap(), ge = new WeakMap(), he = new WeakMap(), ve = new WeakMap(), me = new WeakMap(), be = new WeakMap(), pe = new WeakMap();
|
|
424
|
+
const $ = "triiiceratops:viewerState";
|
|
425
|
+
function De(n) {
|
|
426
|
+
return n.id || n["@id"] || (typeof n.getId == "function" ? n.getId() : "");
|
|
427
|
+
}
|
|
428
|
+
function Se(n) {
|
|
429
|
+
if (!n) return null;
|
|
430
|
+
const t = n.match(/xywh=(\d+),(\d+),(\d+),(\d+)/);
|
|
431
|
+
return t ? {
|
|
432
|
+
x: parseInt(t[1], 10),
|
|
433
|
+
y: parseInt(t[2], 10),
|
|
434
|
+
w: parseInt(t[3], 10),
|
|
435
|
+
h: parseInt(t[4], 10)
|
|
436
|
+
} : null;
|
|
437
|
+
}
|
|
438
|
+
function et(n) {
|
|
439
|
+
const t = tt(n);
|
|
440
|
+
if (t)
|
|
441
|
+
return st(t);
|
|
442
|
+
const s = nt(n);
|
|
443
|
+
return s ? {
|
|
444
|
+
type: "RECTANGLE",
|
|
445
|
+
geometry: {
|
|
446
|
+
x: s.x,
|
|
447
|
+
y: s.y,
|
|
448
|
+
w: s.w,
|
|
449
|
+
h: s.h,
|
|
450
|
+
bounds: {
|
|
451
|
+
minX: s.x,
|
|
452
|
+
minY: s.y,
|
|
453
|
+
maxX: s.x + s.w,
|
|
454
|
+
maxY: s.y + s.h
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
} : null;
|
|
458
|
+
}
|
|
459
|
+
function tt(n) {
|
|
460
|
+
var s, r;
|
|
461
|
+
if (typeof n.getTarget == "function") {
|
|
462
|
+
const i = ((s = n.__jsonld) == null ? void 0 : s.on) || ((r = n.__jsonld) == null ? void 0 : r.target);
|
|
463
|
+
if (i)
|
|
464
|
+
return je(i);
|
|
465
|
+
}
|
|
466
|
+
const t = n.target || n.on;
|
|
467
|
+
return t ? je(t) : null;
|
|
468
|
+
}
|
|
469
|
+
function je(n) {
|
|
470
|
+
if (!n) return null;
|
|
471
|
+
if (Array.isArray(n))
|
|
472
|
+
for (const t of n) {
|
|
473
|
+
const s = Te(t);
|
|
474
|
+
if (s) return s;
|
|
475
|
+
}
|
|
476
|
+
else
|
|
477
|
+
return Te(n);
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
function Te(n) {
|
|
481
|
+
var s;
|
|
482
|
+
if (!n) return null;
|
|
483
|
+
const t = n.selector || n;
|
|
484
|
+
return (t == null ? void 0 : t.type) === "SvgSelector" && t.value ? t.value : ((s = t == null ? void 0 : t.item) == null ? void 0 : s.type) === "SvgSelector" && t.item.value ? t.item.value : null;
|
|
485
|
+
}
|
|
486
|
+
function st(n) {
|
|
487
|
+
try {
|
|
488
|
+
const s = new DOMParser().parseFromString(n, "image/svg+xml");
|
|
489
|
+
if (s.documentElement.nodeName === "parsererror")
|
|
490
|
+
return console.warn("Failed to parse SVG selector:", n), null;
|
|
491
|
+
const r = [];
|
|
492
|
+
let i = { minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
493
|
+
const f = s.querySelectorAll("polygon");
|
|
494
|
+
for (const h of f) {
|
|
495
|
+
const m = h.getAttribute("points");
|
|
496
|
+
if (m) {
|
|
497
|
+
const y = rt(m);
|
|
498
|
+
r.push(...y);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const S = s.querySelectorAll("path");
|
|
502
|
+
for (const h of S) {
|
|
503
|
+
const m = h.getAttribute("d");
|
|
504
|
+
if (m) {
|
|
505
|
+
const y = it(m);
|
|
506
|
+
r.push(...y);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
const A = s.querySelectorAll("circle");
|
|
510
|
+
for (const h of A) {
|
|
511
|
+
const m = parseFloat(h.getAttribute("cx") || "0"), y = parseFloat(h.getAttribute("cy") || "0"), M = parseFloat(h.getAttribute("r") || "0"), o = at(m, y, M);
|
|
512
|
+
r.push(...o);
|
|
513
|
+
}
|
|
514
|
+
for (const [h, m] of r)
|
|
515
|
+
i.minX = Math.min(i.minX, h), i.minY = Math.min(i.minY, m), i.maxX = Math.max(i.maxX, h), i.maxY = Math.max(i.maxY, m);
|
|
516
|
+
return r.length === 0 ? null : {
|
|
517
|
+
type: "POLYGON",
|
|
518
|
+
geometry: {
|
|
519
|
+
points: r,
|
|
520
|
+
bounds: i
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
} catch (t) {
|
|
524
|
+
return console.warn("Failed to convert SVG to polygon:", t), null;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function rt(n) {
|
|
528
|
+
const t = [], s = n.trim().split(/\s+/);
|
|
529
|
+
for (const r of s) {
|
|
530
|
+
const [i, f] = r.split(",").map((S) => parseFloat(S));
|
|
531
|
+
!isNaN(i) && !isNaN(f) && t.push([i, f]);
|
|
532
|
+
}
|
|
533
|
+
return t;
|
|
534
|
+
}
|
|
535
|
+
function it(n) {
|
|
536
|
+
const t = [], s = /[ML]\s*([\d.]+)[,\s]+([\d.]+)/g;
|
|
537
|
+
let r;
|
|
538
|
+
for (; (r = s.exec(n)) !== null; ) {
|
|
539
|
+
const i = parseFloat(r[1]), f = parseFloat(r[2]);
|
|
540
|
+
!isNaN(i) && !isNaN(f) && t.push([i, f]);
|
|
541
|
+
}
|
|
542
|
+
return t;
|
|
543
|
+
}
|
|
544
|
+
function at(n, t, s, r = 8) {
|
|
545
|
+
const i = [];
|
|
546
|
+
for (let f = 0; f < r; f++) {
|
|
547
|
+
const S = f / r * Math.PI * 2, A = n + s * Math.cos(S), h = t + s * Math.sin(S);
|
|
548
|
+
i.push([A, h]);
|
|
549
|
+
}
|
|
550
|
+
return i;
|
|
551
|
+
}
|
|
552
|
+
function nt(n) {
|
|
553
|
+
var s;
|
|
554
|
+
if (typeof n.getTarget == "function") {
|
|
555
|
+
const r = n.getTarget();
|
|
556
|
+
if (typeof r == "string" && r.includes("xywh="))
|
|
557
|
+
return Se(r);
|
|
558
|
+
const i = (s = n.__jsonld) == null ? void 0 : s.on;
|
|
559
|
+
if (i) {
|
|
560
|
+
const f = Ae(i);
|
|
561
|
+
if (f) return f;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
const t = n.target || n.on;
|
|
565
|
+
return t ? Ae(t) : null;
|
|
566
|
+
}
|
|
567
|
+
function Ae(n) {
|
|
568
|
+
if (!n) return null;
|
|
569
|
+
if (Array.isArray(n))
|
|
570
|
+
for (const t of n) {
|
|
571
|
+
const s = Ae(t);
|
|
572
|
+
if (s) return s;
|
|
573
|
+
}
|
|
574
|
+
if (typeof n == "string" && n.includes("xywh="))
|
|
575
|
+
return Se(n);
|
|
576
|
+
if (n.selector) {
|
|
577
|
+
const t = n.selector, s = t.item || t;
|
|
578
|
+
if (s.value && typeof s.value == "string" && s.value.includes("xywh="))
|
|
579
|
+
return Se(s.value);
|
|
580
|
+
}
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
function ot(n) {
|
|
584
|
+
const t = [];
|
|
585
|
+
if (typeof n.getBody == "function") {
|
|
586
|
+
const s = n.getBody();
|
|
587
|
+
if (s && Array.isArray(s))
|
|
588
|
+
for (const r of s) {
|
|
589
|
+
const i = r.getValue ? r.getValue() : "";
|
|
590
|
+
r.getFormat && r.getFormat(), i && t.push({
|
|
591
|
+
purpose: "commenting",
|
|
592
|
+
value: i
|
|
593
|
+
// Note: Don't include format, Annotorious doesn't track it
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
} else {
|
|
597
|
+
const s = (r) => r && (r.chars || r.value || r["cnt:chars"]) || "";
|
|
598
|
+
if (n.resource) {
|
|
599
|
+
const r = Array.isArray(n.resource) ? n.resource : [n.resource];
|
|
600
|
+
for (const i of r) {
|
|
601
|
+
const f = s(i);
|
|
602
|
+
f && t.push({
|
|
603
|
+
purpose: "commenting",
|
|
604
|
+
value: f
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
} else if (n.body) {
|
|
608
|
+
const r = Array.isArray(n.body) ? n.body : [n.body];
|
|
609
|
+
for (const i of r) {
|
|
610
|
+
const f = s(i);
|
|
611
|
+
f && t.push({
|
|
612
|
+
purpose: "commenting",
|
|
613
|
+
value: f
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
if (t.length === 0) {
|
|
619
|
+
let s = "";
|
|
620
|
+
typeof n.getLabel == "function" ? s = n.getLabel() : n.label && (s = Array.isArray(n.label) ? n.label.join(" ") : n.label), s && t.push({
|
|
621
|
+
purpose: "commenting",
|
|
622
|
+
value: s
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
return t;
|
|
626
|
+
}
|
|
627
|
+
function lt(n, t, s = !1) {
|
|
628
|
+
const r = De(n) || `anno-${t}`, i = et(n);
|
|
629
|
+
if (!i)
|
|
630
|
+
return null;
|
|
631
|
+
const f = ot(n);
|
|
632
|
+
return s && f.push({
|
|
633
|
+
purpose: "search-hit",
|
|
634
|
+
value: "search-hit"
|
|
635
|
+
}), {
|
|
636
|
+
id: r,
|
|
637
|
+
target: {
|
|
638
|
+
selector: i
|
|
639
|
+
},
|
|
640
|
+
bodies: f
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
function ct(n, t = /* @__PURE__ */ new Set()) {
|
|
644
|
+
return n.map((s, r) => {
|
|
645
|
+
const i = t.has(De(s));
|
|
646
|
+
return lt(s, r, i);
|
|
647
|
+
}).filter((s) => s !== null);
|
|
648
|
+
}
|
|
649
|
+
var dt = e.from_html('<div class="absolute bg-base-200 text-base-content px-3 py-2 rounded-lg shadow-lg text-sm max-w-xs pointer-events-none z-1000"> </div>'), ft = e.from_html('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');
|
|
650
|
+
function ut(n, t) {
|
|
651
|
+
e.push(t, !0);
|
|
652
|
+
let s = e.state(void 0), r = e.state(void 0), i = e.state(void 0), f = e.state(null), S = e.state(e.proxy({ x: 0, y: 0 })), A = e.derived(() => {
|
|
653
|
+
if (!t.viewerState.manifestId || !t.viewerState.canvasId)
|
|
654
|
+
return [];
|
|
655
|
+
const l = Z.getAnnotations(t.viewerState.manifestId, t.viewerState.canvasId), c = t.viewerState.currentCanvasSearchAnnotations, a = t.viewerState.createdAnnotations[t.viewerState.canvasId] || [];
|
|
656
|
+
return [
|
|
657
|
+
...l,
|
|
658
|
+
...c,
|
|
659
|
+
...a
|
|
660
|
+
];
|
|
661
|
+
}), h = e.derived(() => {
|
|
662
|
+
const l = /* @__PURE__ */ new Set();
|
|
663
|
+
return t.viewerState.currentCanvasSearchAnnotations.forEach((c) => {
|
|
664
|
+
const a = c.id || c["@id"];
|
|
665
|
+
a && l.add(a);
|
|
666
|
+
}), l;
|
|
667
|
+
}), m = e.derived(() => ct(e.get(A), e.get(h)));
|
|
668
|
+
Pe(() => {
|
|
669
|
+
if (e.get(s))
|
|
670
|
+
return e.set(
|
|
671
|
+
r,
|
|
672
|
+
Oe({
|
|
673
|
+
element: e.get(s),
|
|
674
|
+
tileSources: null,
|
|
675
|
+
// Will be set via effect
|
|
676
|
+
prefixUrl: "",
|
|
677
|
+
// No navigation UI images needed
|
|
678
|
+
showNavigationControl: !1,
|
|
679
|
+
showHomeControl: !1,
|
|
680
|
+
showFullPageControl: !1,
|
|
681
|
+
showSequenceControl: !1,
|
|
682
|
+
showZoomControl: !1,
|
|
683
|
+
showRotationControl: !1,
|
|
684
|
+
animationTime: 0.5,
|
|
685
|
+
springStiffness: 7,
|
|
686
|
+
zoomPerClick: 2
|
|
687
|
+
}),
|
|
688
|
+
!0
|
|
689
|
+
), e.set(
|
|
690
|
+
i,
|
|
691
|
+
Ve(e.get(r), {
|
|
692
|
+
drawingEnabled: !1,
|
|
693
|
+
// @ts-ignore
|
|
694
|
+
readOnly: !0,
|
|
695
|
+
// @ts-ignore
|
|
696
|
+
disableSelect: !0
|
|
697
|
+
// We will manually manage selection if needed, or toggle this
|
|
698
|
+
}),
|
|
699
|
+
!0
|
|
700
|
+
), e.get(i).on("createAnnotation", (l) => {
|
|
701
|
+
const c = {
|
|
702
|
+
...l,
|
|
703
|
+
id: l.id || crypto.randomUUID(),
|
|
704
|
+
// Ensure ID
|
|
705
|
+
motivation: "commenting",
|
|
706
|
+
target: {
|
|
707
|
+
...l.target,
|
|
708
|
+
source: t.viewerState.canvasId
|
|
709
|
+
// Enforce canvas ID
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
t.viewerState.addAnnotation(c, t.viewerState.canvasId);
|
|
713
|
+
}), t.viewerState.canvasId && t.viewerState.loadAnnotationsFromStorage(t.viewerState.canvasId), e.get(i).on("selectionChanged", (l) => {
|
|
714
|
+
l && l.length > 0 && e.get(i) && e.get(i).cancelSelected();
|
|
715
|
+
}), e.get(i).on("mouseEnterAnnotation", (l) => {
|
|
716
|
+
e.set(f, l, !0);
|
|
717
|
+
}), e.get(i).on("mouseLeaveAnnotation", () => {
|
|
718
|
+
e.set(f, null);
|
|
719
|
+
}), e.get(s) && e.get(s).addEventListener("pointermove", (l) => {
|
|
720
|
+
const c = e.get(s).getBoundingClientRect();
|
|
721
|
+
e.set(S, { x: l.clientX - c.left, y: l.clientY - c.top }, !0);
|
|
722
|
+
}), () => {
|
|
723
|
+
var l, c;
|
|
724
|
+
(l = e.get(i)) == null || l.destroy(), (c = e.get(r)) == null || c.destroy();
|
|
725
|
+
};
|
|
726
|
+
}), e.user_effect(() => {
|
|
727
|
+
!e.get(r) || !t.tileSources || e.get(r).open(t.tileSources);
|
|
728
|
+
}), e.user_effect(() => {
|
|
729
|
+
e.get(i) && e.get(i).setAnnotations(e.get(m));
|
|
730
|
+
}), e.user_effect(() => {
|
|
731
|
+
e.get(i) && e.get(i).setStyle((l) => {
|
|
732
|
+
var a;
|
|
733
|
+
const c = (a = l.bodies) == null ? void 0 : a.some((d) => d.purpose === "search-hit");
|
|
734
|
+
return {
|
|
735
|
+
fill: c ? "#facc15" : "#ef4444",
|
|
736
|
+
fillOpacity: c ? 0.4 : 0.2,
|
|
737
|
+
stroke: c ? "#facc15" : "#ef4444",
|
|
738
|
+
strokeWidth: c ? 1 : 2
|
|
739
|
+
};
|
|
740
|
+
});
|
|
741
|
+
}), e.user_effect(() => {
|
|
742
|
+
e.get(i) && (e.get(i).setDrawingEnabled(t.viewerState.isCreatingAnnotation), t.viewerState.isCreatingAnnotation && e.get(i).setDrawingTool("rect"));
|
|
743
|
+
}), e.user_effect(() => {
|
|
744
|
+
t.viewerState.canvasId && t.viewerState.loadAnnotationsFromStorage(t.viewerState.canvasId);
|
|
745
|
+
}), e.user_effect(() => {
|
|
746
|
+
if (!e.get(i)) return;
|
|
747
|
+
const l = t.viewerState.showAnnotations, c = t.viewerState.visibleAnnotationIds;
|
|
748
|
+
e.get(i).setFilter((a) => {
|
|
749
|
+
var d;
|
|
750
|
+
return (d = a.bodies) != null && d.some((D) => D.purpose === "search-hit") ? !0 : l ? c.has(a.id) : !1;
|
|
751
|
+
});
|
|
752
|
+
});
|
|
753
|
+
function y(l) {
|
|
754
|
+
if (!l.bodies || l.bodies.length === 0)
|
|
755
|
+
return "Annotation";
|
|
756
|
+
const c = l.bodies.find((a) => a.purpose === "commenting");
|
|
757
|
+
return (c == null ? void 0 : c.value) || "Annotation";
|
|
758
|
+
}
|
|
759
|
+
var M = ft(), o = e.child(M);
|
|
760
|
+
e.bind_this(o, (l) => e.set(s, l), () => e.get(s));
|
|
761
|
+
var u = e.sibling(o, 2);
|
|
762
|
+
{
|
|
763
|
+
var b = (l) => {
|
|
764
|
+
var c = dt(), a = e.child(c, !0);
|
|
765
|
+
e.reset(c), e.template_effect(
|
|
766
|
+
(d) => {
|
|
767
|
+
e.set_style(c, `left: ${e.get(S).x + 15}px; top: ${e.get(S).y + 15}px;`), e.set_text(a, d);
|
|
768
|
+
},
|
|
769
|
+
[() => y(e.get(f))]
|
|
770
|
+
), e.append(l, c);
|
|
771
|
+
};
|
|
772
|
+
e.if(u, (l) => {
|
|
773
|
+
e.get(f) && t.viewerState.showAnnotations && l(b);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
e.reset(M), e.append(n, M), e.pop();
|
|
777
|
+
}
|
|
778
|
+
var gt = e.from_html('<div><button class="btn btn-circle btn-sm btn-ghost" aria-label="Previous Canvas"><!></button> <span class="text-sm font-mono tabular-nums"> </span> <button class="btn btn-circle btn-sm btn-ghost" aria-label="Next Canvas"><!></button></div>');
|
|
779
|
+
function ht(n, t) {
|
|
780
|
+
e.push(t, !0);
|
|
781
|
+
var s = gt(), r = e.child(s);
|
|
782
|
+
r.__click = () => t.viewerState.previousCanvas();
|
|
783
|
+
var i = e.child(r);
|
|
784
|
+
Xe(i, { size: 20, weight: "bold" }), e.reset(r);
|
|
785
|
+
var f = e.sibling(r, 2), S = e.child(f);
|
|
786
|
+
e.reset(f);
|
|
787
|
+
var A = e.sibling(f, 2);
|
|
788
|
+
A.__click = () => t.viewerState.nextCanvas();
|
|
789
|
+
var h = e.child(A);
|
|
790
|
+
Be(h, { size: 20, weight: "bold" }), e.reset(A), e.reset(s), e.template_effect(() => {
|
|
791
|
+
e.set_class(s, 1, `absolute left-1/2 -translate-x-1/2 bg-base-200/90 backdrop-blur rounded-full shadow-lg px-4 py-2 flex items-center gap-4 z-10 border border-base-300 transition-all duration-200 ${t.viewerState.showThumbnailGallery && t.viewerState.isGalleryDockedBottom ? "bottom-40" : "bottom-4"}`), r.disabled = !t.viewerState.hasPrevious, e.set_text(S, `${t.viewerState.currentCanvasIndex + 1} / ${t.viewerState.canvases.length ?? ""}`), A.disabled = !t.viewerState.hasNext;
|
|
792
|
+
}), e.append(n, s), e.pop();
|
|
793
|
+
}
|
|
794
|
+
e.delegate(["click"]);
|
|
795
|
+
var vt = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), mt = e.from_html('<button class="w-full text-left p-3 hover:bg-base-300 transition-colors cursor-pointer flex gap-3 group/item items-start focus:outline-none focus:bg-base-300"><div class="btn btn-xs btn-circle btn-ghost mt-0.5 shrink-0 pointer-events-none"><!></div> <div class="flex-1 min-w-0"><div class="flex items-start justify-between"><span class="font-bold text-sm text-primary"></span> <!></div> <div><!></div></div></button>'), bt = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations yet. Click the pencil to draw.</div>'), pt = e.from_html('<div class="absolute top-4 right-4 z-500 pointer-events-auto"><details class="group relative"><summary class="flex items-center gap-2 bg-base-200/90 backdrop-blur shadow-lg rounded-full px-4 py-2 cursor-pointer list-none hover:bg-base-200 transition-all select-none border border-base-300 pointer-events-auto"><button class="btn btn-xs btn-circle btn-ghost"><!></button> <span class="text-sm font-medium"> <span class="opacity-50 text-xs font-normal ml-1"> </span></span> <!></summary> <div class="absolute right-0 mt-2 w-96 bg-base-200/95 backdrop-blur shadow-xl rounded-box p-0 max-h-[60vh] overflow-y-auto border border-base-300 flex flex-col divide-y divide-base-300"></div></details></div>');
|
|
796
|
+
function _t(n, t) {
|
|
797
|
+
e.push(t, !0);
|
|
798
|
+
const s = _e($);
|
|
799
|
+
let r = e.derived(() => {
|
|
800
|
+
if (!s.manifestId || !s.canvasId)
|
|
801
|
+
return [];
|
|
802
|
+
const o = Z.getAnnotations(s.manifestId, s.canvasId), u = s.currentCanvasSearchAnnotations;
|
|
803
|
+
return [...o, ...u];
|
|
804
|
+
});
|
|
805
|
+
function i(o) {
|
|
806
|
+
return o.id || o["@id"] || (typeof o.getId == "function" ? o.getId() : "") || "";
|
|
807
|
+
}
|
|
808
|
+
e.user_effect(() => {
|
|
809
|
+
if (e.get(r).length > 0) {
|
|
810
|
+
const o = /* @__PURE__ */ new Set();
|
|
811
|
+
e.get(r).forEach((u) => {
|
|
812
|
+
const b = i(u);
|
|
813
|
+
b && o.add(b);
|
|
814
|
+
}), s.visibleAnnotationIds = o;
|
|
815
|
+
} else
|
|
816
|
+
s.visibleAnnotationIds = /* @__PURE__ */ new Set();
|
|
817
|
+
});
|
|
818
|
+
let f = e.derived(() => e.get(r).length === 0 ? !1 : e.get(r).every((o) => {
|
|
819
|
+
const u = i(o);
|
|
820
|
+
return !u || s.visibleAnnotationIds.has(u);
|
|
821
|
+
}));
|
|
822
|
+
function S(o) {
|
|
823
|
+
s.visibleAnnotationIds.has(o) ? s.visibleAnnotationIds.delete(o) : s.visibleAnnotationIds.add(o), s.visibleAnnotationIds = new Set(s.visibleAnnotationIds);
|
|
824
|
+
}
|
|
825
|
+
function A() {
|
|
826
|
+
if (e.get(f))
|
|
827
|
+
s.visibleAnnotationIds = /* @__PURE__ */ new Set();
|
|
828
|
+
else {
|
|
829
|
+
const o = /* @__PURE__ */ new Set();
|
|
830
|
+
e.get(r).forEach((u) => {
|
|
831
|
+
const b = i(u);
|
|
832
|
+
b && o.add(b);
|
|
833
|
+
}), s.visibleAnnotationIds = o;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
let h = e.derived(() => e.get(r).length ? e.get(r).map((o) => {
|
|
837
|
+
let u = "", b = !1;
|
|
838
|
+
if (typeof o.getBody == "function") {
|
|
839
|
+
const l = o.getBody();
|
|
840
|
+
if (l && l.length) {
|
|
841
|
+
const c = (a) => {
|
|
842
|
+
const d = a.getValue ? a.getValue() : null;
|
|
843
|
+
return d || "";
|
|
844
|
+
};
|
|
845
|
+
u = l.map((a) => c(a)).filter(Boolean).join(" "), b = l.some((a) => {
|
|
846
|
+
const d = a.getFormat ? a.getFormat() : "";
|
|
847
|
+
return d === "text/html" || d === "application/html";
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
if (!u && typeof o.getLabel == "function") {
|
|
851
|
+
const c = o.getLabel();
|
|
852
|
+
c && (u = c);
|
|
853
|
+
}
|
|
854
|
+
} else {
|
|
855
|
+
const l = (a) => a && (a.chars || a.value || a["cnt:chars"]) || "", c = (a) => a ? a.format === "text/html" || a.type === "TextualBody" : !1;
|
|
856
|
+
if (o.resource ? Array.isArray(o.resource) ? (u = o.resource.map((a) => l(a)).join(" "), o.resource.some((a) => c(a)) && (b = !0)) : (u = l(o.resource), c(o.resource) && (b = !0)) : o.body && (Array.isArray(o.body) ? (u = o.body.map((a) => l(a)).join(" "), o.body.some((a) => c(a)) && (b = !0)) : (u = l(o.body), c(o.body) && (b = !0))), !u) {
|
|
857
|
+
const a = o.label || o.name || o.title;
|
|
858
|
+
a && (u = Array.isArray(a) ? a.join(" ") : a);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
return {
|
|
862
|
+
id: i(o),
|
|
863
|
+
content: u,
|
|
864
|
+
isHtml: b,
|
|
865
|
+
label: (typeof o.getLabel == "function" ? o.getLabel() : o.label) || ""
|
|
866
|
+
};
|
|
867
|
+
}) : []);
|
|
868
|
+
var m = e.comment(), y = e.first_child(m);
|
|
869
|
+
{
|
|
870
|
+
var M = (o) => {
|
|
871
|
+
var u = pt(), b = e.child(u), l = e.child(b), c = e.child(l);
|
|
872
|
+
c.__click = (v) => {
|
|
873
|
+
v.preventDefault(), A();
|
|
874
|
+
};
|
|
875
|
+
var a = e.child(c);
|
|
876
|
+
{
|
|
877
|
+
var d = (v) => {
|
|
878
|
+
Ce(v, { size: 16, weight: "bold" });
|
|
879
|
+
}, D = (v) => {
|
|
880
|
+
Me(v, { size: 16, weight: "bold" });
|
|
881
|
+
};
|
|
882
|
+
e.if(a, (v) => {
|
|
883
|
+
e.get(f) ? v(d) : v(D, !1);
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
e.reset(c);
|
|
887
|
+
var I = e.sibling(c, 2), F = e.child(I), L = e.sibling(F), j = e.child(L);
|
|
888
|
+
e.reset(L), e.reset(I);
|
|
889
|
+
var g = e.sibling(I, 2);
|
|
890
|
+
Ye(g, {
|
|
891
|
+
size: 16,
|
|
892
|
+
weight: "bold",
|
|
893
|
+
class: "group-open:rotate-180 transition-transform opacity-80"
|
|
894
|
+
}), e.reset(l);
|
|
895
|
+
var w = e.sibling(l, 2);
|
|
896
|
+
e.each(
|
|
897
|
+
w,
|
|
898
|
+
21,
|
|
899
|
+
() => e.get(h),
|
|
900
|
+
e.index,
|
|
901
|
+
(v, p, x) => {
|
|
902
|
+
const _ = e.derived(() => s.visibleAnnotationIds.has(e.get(p).id));
|
|
903
|
+
var k = mt();
|
|
904
|
+
k.__click = (z) => {
|
|
905
|
+
z.preventDefault(), S(e.get(p).id);
|
|
906
|
+
};
|
|
907
|
+
var T = e.child(k), E = e.child(T);
|
|
908
|
+
{
|
|
909
|
+
var O = (z) => {
|
|
910
|
+
Ce(z, { size: 16, weight: "bold" });
|
|
911
|
+
}, K = (z) => {
|
|
912
|
+
Me(z, { size: 16, weight: "bold" });
|
|
913
|
+
};
|
|
914
|
+
e.if(E, (z) => {
|
|
915
|
+
e.get(_) ? z(O) : z(K, !1);
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
e.reset(T);
|
|
919
|
+
var q = e.sibling(T, 2), U = e.child(q), J = e.child(U);
|
|
920
|
+
J.textContent = `#${x + 1}`;
|
|
921
|
+
var V = e.sibling(J, 2);
|
|
922
|
+
{
|
|
923
|
+
var P = (z) => {
|
|
924
|
+
var X = vt(), W = e.child(X, !0);
|
|
925
|
+
e.reset(X), e.template_effect(() => e.set_text(W, e.get(p).label)), e.append(z, X);
|
|
926
|
+
};
|
|
927
|
+
e.if(V, (z) => {
|
|
928
|
+
e.get(p).label && e.get(p).label !== e.get(p).content && z(P);
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
e.reset(U);
|
|
932
|
+
var N = e.sibling(U, 2), R = e.child(N);
|
|
933
|
+
{
|
|
934
|
+
var B = (z) => {
|
|
935
|
+
var X = e.comment(), W = e.first_child(X);
|
|
936
|
+
e.html(W, () => e.get(p).content), e.append(z, X);
|
|
937
|
+
}, Q = (z) => {
|
|
938
|
+
var X = e.text();
|
|
939
|
+
e.template_effect(() => e.set_text(X, e.get(p).content || "(No content)")), e.append(z, X);
|
|
940
|
+
};
|
|
941
|
+
e.if(R, (z) => {
|
|
942
|
+
e.get(p).isHtml ? z(B) : z(Q, !1);
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
e.reset(N), e.reset(q), e.reset(k), e.template_effect(() => e.set_class(N, 1, `text-sm prose prose-sm max-w-none prose-p:my-0 prose-a:text-blue-500 wrap-break-word text-left ${e.get(_) ? "" : "opacity-50"}`)), e.append(v, k);
|
|
946
|
+
},
|
|
947
|
+
(v) => {
|
|
948
|
+
var p = bt();
|
|
949
|
+
e.append(v, p);
|
|
950
|
+
}
|
|
951
|
+
), e.reset(w), e.reset(b), e.reset(u), e.template_effect(() => {
|
|
952
|
+
e.set_attribute(c, "title", e.get(f) ? "Hide All Annotations" : "Show All Annotations"), e.set_text(F, `${e.get(r).length ?? ""} Annotations `), e.set_text(j, `(${s.visibleAnnotationIds.size ?? ""} visible)`);
|
|
953
|
+
}), e.append(o, u);
|
|
954
|
+
};
|
|
955
|
+
e.if(y, (o) => {
|
|
956
|
+
s.showAnnotations && o(M);
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
e.append(n, m), e.pop();
|
|
960
|
+
}
|
|
961
|
+
e.delegate(["click"]);
|
|
962
|
+
var yt = e.from_html('<img class="object-contain w-full h-full" loading="lazy"/>'), xt = e.from_html('<span class="opacity-20 text-4xl">?</span>'), wt = e.from_html('<button><div class="aspect-4/3 bg-base-300 rounded overflow-hidden relative w-full flex items-center justify-center"><!></div> <div class="text-xs font-medium truncate w-full opacity-70 group-hover:opacity-100"><span class="font-bold mr-1"> </span> </div></button>'), St = e.from_html('<div class="absolute bottom-0 right-0 w-6 h-6 cursor-se-resize resize-handle bg-accent hover:bg-accent-focus transition-colors z-50" style="clip-path: polygon(100% 0, 0 100%, 100% 100%);" role="button" tabindex="0" aria-label="Resize"></div>'), At = e.from_html('<div role="group"><span class="font-bold text-primary opacity-50">Dock Top</span></div> <div role="group"><span class="font-bold text-primary opacity-50">Dock Bottom</span></div> <div role="group"><span class="font-bold text-primary opacity-50 vertical-rl rotate-180" style="writing-mode: vertical-rl;">Dock Left</span></div> <div role="group"><span class="font-bold text-primary opacity-50 vertical-rl rotate-180" style="writing-mode: vertical-rl;">Dock Right</span></div>', 1), It = e.from_html('<div><button class="absolute top-1 right-1 btn btn-error btn-xs btn-circle z-20" aria-label="Close Gallery"><!></button> <div><div role="button" tabindex="0" aria-label="Drag Gallery"><div></div></div></div> <div><div></div></div> <!></div> <!>', 1);
|
|
963
|
+
function kt(n, t) {
|
|
964
|
+
e.push(t, !0);
|
|
965
|
+
const s = _e($);
|
|
966
|
+
let r = e.state(e.proxy({ x: 20, y: 100 })), i = e.state(e.proxy({ width: 300, height: 400 })), f = e.state(!1), S = e.state(!1), A = { x: 0, y: 0 }, h = { x: 0, y: 0, w: 0, h: 0 }, m = e.state(void 0), y = e.derived(() => t.canvases ? t.canvases.map((g, w) => {
|
|
967
|
+
let v = "";
|
|
968
|
+
try {
|
|
969
|
+
if (g.getCanonicalImageUri)
|
|
970
|
+
v = g.getCanonicalImageUri(200);
|
|
971
|
+
else if (g.getThumbnail) {
|
|
972
|
+
const p = g.getThumbnail();
|
|
973
|
+
p && (v = typeof p == "string" ? p : p.id || p["@id"]);
|
|
974
|
+
}
|
|
975
|
+
} catch (p) {
|
|
976
|
+
console.warn("Error getting thumbnail", p);
|
|
977
|
+
}
|
|
978
|
+
if (!v) {
|
|
979
|
+
const p = g.getImages();
|
|
980
|
+
if (p && p.length > 0) {
|
|
981
|
+
const x = p[0].getResource();
|
|
982
|
+
x && x.getServices().length > 0 ? v = `${x.getServices()[0].id}/full/200,/0/default.jpg` : x && x.id && (v = x.id);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
return {
|
|
986
|
+
id: g.id,
|
|
987
|
+
label: g.getLabel().length ? g.getLabel()[0].value : `Canvas ${w + 1}`,
|
|
988
|
+
src: v,
|
|
989
|
+
index: w
|
|
990
|
+
};
|
|
991
|
+
}) : []);
|
|
992
|
+
function M(g) {
|
|
993
|
+
if (!e.get(f)) return;
|
|
994
|
+
let w = g.clientX - A.x, v = g.clientY - A.y;
|
|
995
|
+
if (e.get(m) && e.get(m).parentElement) {
|
|
996
|
+
const p = e.get(m).parentElement, x = Math.max(0, p.clientWidth - e.get(i).width), _ = Math.max(0, p.clientHeight - e.get(i).height);
|
|
997
|
+
w = Math.max(0, Math.min(w, x)), v = Math.max(0, Math.min(v, _));
|
|
998
|
+
}
|
|
999
|
+
e.get(r).x = w, e.get(r).y = v;
|
|
1000
|
+
}
|
|
1001
|
+
function o() {
|
|
1002
|
+
const g = e.get(d);
|
|
1003
|
+
e.set(f, !1), e.set(d, null), window.removeEventListener("mousemove", M), window.removeEventListener("mouseup", o), g && e.set(a, g, !0);
|
|
1004
|
+
}
|
|
1005
|
+
function u(g) {
|
|
1006
|
+
g.stopPropagation(), e.set(S, !0), h = {
|
|
1007
|
+
x: g.clientX,
|
|
1008
|
+
y: g.clientY,
|
|
1009
|
+
w: e.get(i).width,
|
|
1010
|
+
h: e.get(i).height
|
|
1011
|
+
}, window.addEventListener("mousemove", b), window.addEventListener("mouseup", l);
|
|
1012
|
+
}
|
|
1013
|
+
function b(g) {
|
|
1014
|
+
if (!e.get(S)) return;
|
|
1015
|
+
const w = g.clientX - h.x, v = g.clientY - h.y;
|
|
1016
|
+
e.get(i).width = Math.max(200, h.w + w), e.get(i).height = Math.max(200, h.h + v);
|
|
1017
|
+
}
|
|
1018
|
+
function l() {
|
|
1019
|
+
e.set(S, !1), window.removeEventListener("mousemove", b), window.removeEventListener("mouseup", l);
|
|
1020
|
+
}
|
|
1021
|
+
function c(g) {
|
|
1022
|
+
s.canvasId = g;
|
|
1023
|
+
}
|
|
1024
|
+
let a = e.state("bottom"), d = e.state(null);
|
|
1025
|
+
e.user_effect(() => {
|
|
1026
|
+
s.dockSide = e.get(a), s.isGalleryDockedBottom = e.get(a) === "bottom", s.isGalleryDockedRight = e.get(a) === "right";
|
|
1027
|
+
});
|
|
1028
|
+
let D = e.derived(() => e.get(a) === "top" || e.get(a) === "bottom" || e.get(a) === "none" && e.get(i).height < 320);
|
|
1029
|
+
function I(g) {
|
|
1030
|
+
var w, v;
|
|
1031
|
+
if (!g.target.closest(".resize-handle")) {
|
|
1032
|
+
if (e.get(a) !== "none") {
|
|
1033
|
+
e.set(a, "none");
|
|
1034
|
+
const p = ((v = (w = e.get(m)) == null ? void 0 : w.parentElement) == null ? void 0 : v.getBoundingClientRect()) || { left: 0, top: 0 };
|
|
1035
|
+
e.set(i, { width: 300, height: 400 }, !0), e.set(
|
|
1036
|
+
r,
|
|
1037
|
+
{
|
|
1038
|
+
x: g.clientX - p.left - 150,
|
|
1039
|
+
// Center width
|
|
1040
|
+
y: g.clientY - p.top - 20
|
|
1041
|
+
// Offset slightly from top
|
|
1042
|
+
},
|
|
1043
|
+
!0
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
e.set(f, !0), A = {
|
|
1047
|
+
x: g.clientX - e.get(r).x,
|
|
1048
|
+
y: g.clientY - e.get(r).y
|
|
1049
|
+
}, window.addEventListener("mousemove", M), window.addEventListener("mouseup", o);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
var F = e.comment(), L = e.first_child(F);
|
|
1053
|
+
{
|
|
1054
|
+
var j = (g) => {
|
|
1055
|
+
var w = It(), v = e.first_child(w), p = e.child(v);
|
|
1056
|
+
p.__click = () => s.toggleThumbnailGallery();
|
|
1057
|
+
var x = e.child(p);
|
|
1058
|
+
He(x, { size: 16, weight: "bold" }), e.reset(p);
|
|
1059
|
+
var _ = e.sibling(p, 2), k = e.child(_);
|
|
1060
|
+
k.__mousedown = I;
|
|
1061
|
+
var T = e.child(k);
|
|
1062
|
+
e.reset(k), e.reset(_);
|
|
1063
|
+
var E = e.sibling(_, 2), O = e.child(E);
|
|
1064
|
+
e.each(O, 21, () => e.get(y), e.index, (V, P) => {
|
|
1065
|
+
var N = wt();
|
|
1066
|
+
N.__click = () => c(e.get(P).id);
|
|
1067
|
+
var R = e.child(N), B = e.child(R);
|
|
1068
|
+
{
|
|
1069
|
+
var Q = (Y) => {
|
|
1070
|
+
var H = yt();
|
|
1071
|
+
e.template_effect(() => {
|
|
1072
|
+
e.set_attribute(H, "src", e.get(P).src), e.set_attribute(H, "alt", e.get(P).label);
|
|
1073
|
+
}), e.append(Y, H);
|
|
1074
|
+
}, z = (Y) => {
|
|
1075
|
+
var H = xt();
|
|
1076
|
+
e.append(Y, H);
|
|
1077
|
+
};
|
|
1078
|
+
e.if(B, (Y) => {
|
|
1079
|
+
e.get(P).src ? Y(Q) : Y(z, !1);
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
e.reset(R);
|
|
1083
|
+
var X = e.sibling(R, 2), W = e.child(X), ye = e.child(W);
|
|
1084
|
+
e.reset(W);
|
|
1085
|
+
var xe = e.sibling(W);
|
|
1086
|
+
e.reset(X), e.reset(N), e.template_effect(() => {
|
|
1087
|
+
e.set_class(N, 1, `group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 ${e.get(D) ? "w-[140px]" : ""} ${s.canvasId === e.get(P).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(N, "aria-label", `Select canvas ${e.get(P).label ?? ""}`), e.set_text(ye, `${e.get(P).index + 1}.`), e.set_text(xe, ` ${e.get(P).label ?? ""}`);
|
|
1088
|
+
}), e.append(V, N);
|
|
1089
|
+
}), e.reset(O), e.reset(E);
|
|
1090
|
+
var K = e.sibling(E, 2);
|
|
1091
|
+
{
|
|
1092
|
+
var q = (V) => {
|
|
1093
|
+
var P = St();
|
|
1094
|
+
P.__mousedown = u, e.append(V, P);
|
|
1095
|
+
};
|
|
1096
|
+
e.if(K, (V) => {
|
|
1097
|
+
e.get(a) === "none" && V(q);
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
e.reset(v), e.bind_this(v, (V) => e.set(m, V), () => e.get(m));
|
|
1101
|
+
var U = e.sibling(v, 2);
|
|
1102
|
+
{
|
|
1103
|
+
var J = (V) => {
|
|
1104
|
+
var P = At(), N = e.first_child(P), R = e.sibling(N, 2), B = e.sibling(R, 2), Q = e.sibling(B, 2);
|
|
1105
|
+
e.template_effect(() => {
|
|
1106
|
+
e.set_class(N, 1, `absolute top-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${e.get(d) === "top" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(R, 1, `absolute bottom-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${e.get(d) === "bottom" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(B, 1, `absolute top-2 bottom-2 left-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${e.get(d) === "left" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(Q, 1, `absolute top-2 bottom-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-300 ${s.showSearchPanel ? "right-[328px]" : "right-2"} ${e.get(d) === "right" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`);
|
|
1107
|
+
}), e.event("mouseenter", N, () => e.set(d, "top")), e.event("mouseleave", N, () => e.set(d, null)), e.event("mouseenter", R, () => e.set(d, "bottom")), e.event("mouseleave", R, () => e.set(d, null)), e.event("mouseenter", B, () => e.set(d, "left")), e.event("mouseleave", B, () => e.set(d, null)), e.event("mouseenter", Q, () => e.set(d, "right")), e.event("mouseleave", Q, () => e.set(d, null)), e.append(V, P);
|
|
1108
|
+
};
|
|
1109
|
+
e.if(U, (V) => {
|
|
1110
|
+
e.get(f) && V(J);
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
e.template_effect(() => {
|
|
1114
|
+
e.set_class(v, 1, (e.get(a) !== "none" ? `absolute z-900 bg-base-100 shadow-xl border-base-300 flex transition-all duration-200
|
|
1115
|
+
${e.get(a) === "bottom" ? "flex-row bottom-0 left-0 right-0 h-[140px] border-t" : ""}
|
|
1116
|
+
${e.get(a) === "top" ? "flex-row top-0 left-0 right-0 h-[140px] border-b" : ""}
|
|
1117
|
+
${e.get(a) === "left" ? "flex-col left-0 top-0 bottom-0 w-[200px] border-r" : ""}
|
|
1118
|
+
${e.get(a) === "right" ? `flex-col top-0 bottom-0 w-[200px] border-l ${s.showSearchPanel ? "right-80" : "right-0"}` : ""}` : "absolute z-900 bg-base-100 shadow-2xl rounded-lg flex flex-col border border-base-300 overflow-hidden") + (e.get(f) ? " pointer-events-none opacity-80" : "")), e.set_style(v, e.get(a) !== "none" ? "" : `left: ${e.get(r).x}px; top: ${e.get(r).y}px; width: ${e.get(i).width}px; height: ${e.get(i).height}px;`), e.set_class(_, 1, "bg-base-100 flex shrink-0 select-none relative " + (e.get(a) === "bottom" || e.get(a) === "top" ? "flex-row h-full items-center border-r border-base-200" : "flex-col w-full border-b border-base-200")), e.set_class(k, 1, "cursor-move flex items-center justify-center hover:bg-base-200/50 active:bg-base-200 transition-colors " + (e.get(a) === "bottom" || e.get(a) === "top" ? "w-8 h-full" : "h-6 w-full")), e.set_class(T, 1, "bg-base-300 rounded-full " + (e.get(a) === "bottom" || e.get(a) === "top" ? "w-1.5 h-12" : "w-12 h-1.5")), e.set_class(E, 1, `flex-1 p-1 bg-base-100 ${e.get(D) ? "overflow-x-auto overflow-y-hidden" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(O, 1, e.clsx(e.get(D) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(O, e.get(D) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
|
|
1119
|
+
}), e.append(g, w);
|
|
1120
|
+
};
|
|
1121
|
+
e.if(L, (g) => {
|
|
1122
|
+
s.showThumbnailGallery && g(j);
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
e.append(n, F), e.pop();
|
|
1126
|
+
}
|
|
1127
|
+
e.delegate(["click", "mousedown"]);
|
|
1128
|
+
var Ct = e.from_html('<div data-tip="Menu"><div tabindex="0" role="button" class="btn btn-lg btn-primary btn-circle shadow-xl"><!></div> <div class="fab-close tooltip tooltip-top" data-tip="Search"><button aria-label="Toggle Search"><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-top"><button aria-label="Toggle Annotations"><!></button></div> <div class="tooltip tooltip-top" data-tip="Metadata"><button aria-label="Toggle Metadata"><!></button></div></div>');
|
|
1129
|
+
function Mt(n, t) {
|
|
1130
|
+
e.push(t, !1);
|
|
1131
|
+
const s = _e($);
|
|
1132
|
+
e.init();
|
|
1133
|
+
var r = Ct(), i = e.child(r), f = e.child(i);
|
|
1134
|
+
Je(f, { size: 32, weight: "bold" }), e.reset(i);
|
|
1135
|
+
var S = e.sibling(i, 2), A = e.child(S);
|
|
1136
|
+
A.__click = () => s.toggleSearchPanel();
|
|
1137
|
+
var h = e.child(A);
|
|
1138
|
+
Fe(h, { size: 28, weight: "bold" }), e.reset(A), e.reset(S);
|
|
1139
|
+
var m = e.sibling(S, 2), y = e.child(m);
|
|
1140
|
+
y.__click = () => s.toggleThumbnailGallery();
|
|
1141
|
+
var M = e.child(y);
|
|
1142
|
+
Ke(M, { size: 28, weight: "bold" }), e.reset(y), e.reset(m);
|
|
1143
|
+
var o = e.sibling(m, 2), u = e.child(o);
|
|
1144
|
+
u.__click = () => s.toggleFullScreen();
|
|
1145
|
+
var b = e.child(u);
|
|
1146
|
+
{
|
|
1147
|
+
var l = (j) => {
|
|
1148
|
+
Qe(j, { size: 28, weight: "bold" });
|
|
1149
|
+
}, c = (j) => {
|
|
1150
|
+
Ue(j, { size: 28, weight: "bold" });
|
|
1151
|
+
};
|
|
1152
|
+
e.if(b, (j) => {
|
|
1153
|
+
s.isFullScreen ? j(l) : j(c, !1);
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
e.reset(u), e.reset(o);
|
|
1157
|
+
var a = e.sibling(o, 2), d = e.child(a);
|
|
1158
|
+
d.__click = () => s.toggleAnnotations();
|
|
1159
|
+
var D = e.child(d);
|
|
1160
|
+
qe(D, { size: 28, weight: "bold" }), e.reset(d), e.reset(a);
|
|
1161
|
+
var I = e.sibling(a, 2), F = e.child(I);
|
|
1162
|
+
F.__click = () => s.toggleMetadataDialog();
|
|
1163
|
+
var L = e.child(F);
|
|
1164
|
+
We(L, { size: 28, weight: "bold" }), e.reset(F), e.reset(I), e.reset(r), e.template_effect(() => {
|
|
1165
|
+
e.set_class(r, 1, `fab fab-flower fab-top-left absolute z-600 pointer-events-auto flex-col items-end transition-all duration-300 ${s.showSearchPanel ? s.showThumbnailGallery && s.isGalleryDockedRight ? "right-[540px]" : "right-[344px]" : s.showThumbnailGallery && s.isGalleryDockedRight ? "right-[220px]" : "right-6"} ${s.showThumbnailGallery && s.dockSide === "bottom" ? "bottom-40" : "bottom-6"}`), e.set_class(A, 1, e.clsx([
|
|
1166
|
+
"btn btn-circle btn-lg shadow-lg",
|
|
1167
|
+
s.showSearchPanel && "btn-primary",
|
|
1168
|
+
!s.showSearchPanel && "btn-neutral"
|
|
1169
|
+
])), e.set_attribute(m, "data-tip", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_attribute(y, "aria-label", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_class(y, 1, `btn btn-lg btn-circle shadow-lg ${s.showThumbnailGallery ? "btn-info" : "btn-neutral"}`), e.set_attribute(o, "data-tip", s.isFullScreen ? "Exit Full Screen" : "Enter Full Screen"), e.set_class(u, 1, `btn btn-circle btn-lg shadow-lg transition-all duration-300 ease-out ${s.isFullScreen ? "btn-warning" : "btn-neutral"}`), e.set_attribute(a, "data-tip", s.showAnnotations ? "Hide Annotations" : "Show Annotations"), e.set_class(d, 1, `btn btn-lg btn-circle shadow-lg ${s.showAnnotations ? "btn-error" : "btn-neutral"}`), e.set_class(F, 1, `btn btn-lg btn-circle shadow-lg ${s.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
|
|
1170
|
+
}), e.append(n, r), e.pop();
|
|
1171
|
+
}
|
|
1172
|
+
e.delegate(["click"]);
|
|
1173
|
+
var jt = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), Tt = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6">Attribution</dt> <dd class="text-sm ps-2"><!></dd>', 1), Ft = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6">License</dt> <dd class="text-sm ps-2"><a target="_blank" rel="noreferrer" class="link link-primary break-all"> </a></dd>', 1), Dt = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), Lt = e.from_html('<dialog class="modal absolute" style="position: absolute;"><div class="modal-box w-11/12 max-w-5xl"><form method="dialog"><button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button></form> <h3 class="font-bold text-lg mb-4"> </h3> <div class="py-4 overflow-y-auto max-h-[70vh]"><!> <dl class="grid grid-cols-1 md:grid-cols-[200px_1fr]"><!> <!> <!></dl></div> <div class="modal-action"><form method="dialog"><button class="btn">Close</button></form></div></div> <form method="dialog" class="modal-backdrop"><button>close</button></form></dialog>');
|
|
1174
|
+
function Et(n, t) {
|
|
1175
|
+
e.push(t, !0);
|
|
1176
|
+
const s = _e($);
|
|
1177
|
+
let r = e.derived(() => s.manifest), i = e.derived(() => {
|
|
1178
|
+
if (!e.get(r)) return [];
|
|
1179
|
+
const x = e.get(r).getMetadata();
|
|
1180
|
+
return x ? x.map((_) => {
|
|
1181
|
+
let k = "", T = "";
|
|
1182
|
+
if (_.getLabel) {
|
|
1183
|
+
const E = _.getLabel();
|
|
1184
|
+
Array.isArray(E) ? k = E.map((O) => O.value).join(" ") : k = E;
|
|
1185
|
+
} else _.label && (typeof _.label == "string" ? k = _.label : Array.isArray(_.label) ? k = _.label.map((E) => E.value).join(" ") : k = String(_.label));
|
|
1186
|
+
if (_.getValue) {
|
|
1187
|
+
const E = _.getValue();
|
|
1188
|
+
Array.isArray(E) ? T = E.map((O) => O.value).join(" ") : T = E;
|
|
1189
|
+
} else _.value && (typeof _.value == "string" ? T = _.value : Array.isArray(_.value) ? T = _.value.map((E) => E.value).join(" ") : T = String(_.value));
|
|
1190
|
+
return { label: k, value: T };
|
|
1191
|
+
}) : [];
|
|
1192
|
+
}), f = e.derived(() => e.get(r) ? e.get(r).getDescription() : ""), S = e.derived(() => {
|
|
1193
|
+
var x;
|
|
1194
|
+
return e.get(r) ? (x = e.get(r).getRequiredStatement()) == null ? void 0 : x.getValue() : "";
|
|
1195
|
+
}), A = e.derived(() => e.get(r) ? e.get(r).getLicense() : "");
|
|
1196
|
+
var h = Lt(), m = e.child(h), y = e.child(m), M = e.child(y);
|
|
1197
|
+
M.__click = () => s.toggleMetadataDialog(), e.reset(y);
|
|
1198
|
+
var o = e.sibling(y, 2), u = e.child(o, !0);
|
|
1199
|
+
e.reset(o);
|
|
1200
|
+
var b = e.sibling(o, 2), l = e.child(b);
|
|
1201
|
+
{
|
|
1202
|
+
var c = (x) => {
|
|
1203
|
+
var _ = jt(), k = e.child(_), T = e.child(k);
|
|
1204
|
+
e.html(T, () => e.get(f)), e.reset(k), e.reset(_), e.append(x, _);
|
|
1205
|
+
};
|
|
1206
|
+
e.if(l, (x) => {
|
|
1207
|
+
e.get(f) && x(c);
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
var a = e.sibling(l, 2), d = e.child(a);
|
|
1211
|
+
{
|
|
1212
|
+
var D = (x) => {
|
|
1213
|
+
var _ = Tt(), k = e.sibling(e.first_child(_), 2), T = e.child(k);
|
|
1214
|
+
e.html(T, () => e.get(S)), e.reset(k), e.append(x, _);
|
|
1215
|
+
};
|
|
1216
|
+
e.if(d, (x) => {
|
|
1217
|
+
e.get(S) && x(D);
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
var I = e.sibling(d, 2);
|
|
1221
|
+
{
|
|
1222
|
+
var F = (x) => {
|
|
1223
|
+
var _ = Ft(), k = e.sibling(e.first_child(_), 2), T = e.child(k), E = e.child(T, !0);
|
|
1224
|
+
e.reset(T), e.reset(k), e.template_effect(() => {
|
|
1225
|
+
e.set_attribute(T, "href", e.get(A)), e.set_text(E, e.get(A));
|
|
1226
|
+
}), e.append(x, _);
|
|
1227
|
+
};
|
|
1228
|
+
e.if(I, (x) => {
|
|
1229
|
+
e.get(A) && x(F);
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
var L = e.sibling(I, 2);
|
|
1233
|
+
e.each(L, 17, () => e.get(i), e.index, (x, _) => {
|
|
1234
|
+
var k = Dt(), T = e.first_child(k), E = e.child(T, !0);
|
|
1235
|
+
e.reset(T);
|
|
1236
|
+
var O = e.sibling(T, 2), K = e.child(O);
|
|
1237
|
+
e.html(K, () => e.get(_).value), e.reset(O), e.template_effect(() => e.set_text(E, e.get(_).label)), e.append(x, k);
|
|
1238
|
+
}), e.reset(a), e.reset(b);
|
|
1239
|
+
var j = e.sibling(b, 2), g = e.child(j), w = e.child(g);
|
|
1240
|
+
w.__click = () => s.toggleMetadataDialog(), e.reset(g), e.reset(j), e.reset(m);
|
|
1241
|
+
var v = e.sibling(m, 2), p = e.child(v);
|
|
1242
|
+
p.__click = () => s.toggleMetadataDialog(), e.reset(v), e.reset(h), e.template_effect(
|
|
1243
|
+
(x) => {
|
|
1244
|
+
h.open = s.showMetadataDialog, e.set_text(u, x);
|
|
1245
|
+
},
|
|
1246
|
+
[
|
|
1247
|
+
() => e.get(r) ? e.get(r).getLabel().length ? e.get(r).getLabel()[0].value : "Manifest Metadata" : "Loading..."
|
|
1248
|
+
]
|
|
1249
|
+
), e.append(n, h), e.pop();
|
|
1250
|
+
}
|
|
1251
|
+
e.delegate(["click"]);
|
|
1252
|
+
var zt = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), Gt = e.from_html('<div class="flex justify-center p-8"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Pt = e.from_html('<div class="text-center opacity-50 p-4"> </div>'), Rt = e.from_html('<div class="text-center opacity-50 p-4 text-sm">Enter a search term to find occurrences within this manifest.</div>'), Nt = e.from_html('<div class="leading-relaxed"><span><!></span> <span class="bg-yellow-200 text-yellow-900 font-bold px-0.5 rounded"><!></span> <span><!></span></div>'), Ot = e.from_html('<div class="leading-relaxed"> </div>'), Vt = e.from_html('<button class="w-full text-left card bg-base-100 shadow hover:shadow-md transition-all p-4 text-sm group border border-transparent hover:border-primary focus:outline-none focus:ring-2 focus:ring-primary"><div class="flex justify-between items-baseline mb-1"><span class="font-bold text-xs opacity-70 bg-base-200 px-1.5 py-0.5 rounded"> </span></div> <!></button>'), Xt = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), Bt = e.from_html('<div class="absolute top-0 right-0 h-full w-80 bg-base-200 shadow-2xl z-1000 transform transition-transform duration-300 flex flex-col border-l border-base-300" role="dialog" aria-label="Search Panel"><div class="p-4 bg-base-300 flex justify-between items-center shrink-0"><h2 class="font-bold text-lg">Search</h2> <button class="btn btn-sm btn-circle btn-ghost" aria-label="Close Search">✕</button></div> <div class="p-4 border-b border-base-300 shrink-0"><div class="join w-full"><input type="text" placeholder="Search content..." class="input input-bordered join-item w-full"/> <button class="btn btn-primary join-item" aria-label="Search"><!></button></div></div> <div class="flex-1 overflow-y-auto p-4 space-y-4"><!></div></div>');
|
|
1253
|
+
function Yt(n, t) {
|
|
1254
|
+
e.push(t, !0);
|
|
1255
|
+
const s = _e($);
|
|
1256
|
+
let r = e.state(e.proxy(s.searchQuery));
|
|
1257
|
+
function i() {
|
|
1258
|
+
s.search(e.get(r));
|
|
1259
|
+
}
|
|
1260
|
+
function f(y) {
|
|
1261
|
+
y.key === "Enter" && i();
|
|
1262
|
+
}
|
|
1263
|
+
function S(y) {
|
|
1264
|
+
const M = s.canvases[y.canvasIndex];
|
|
1265
|
+
M && (s.canvasId = M.id);
|
|
1266
|
+
}
|
|
1267
|
+
var A = e.comment(), h = e.first_child(A);
|
|
1268
|
+
{
|
|
1269
|
+
var m = (y) => {
|
|
1270
|
+
var M = Bt(), o = e.child(M), u = e.sibling(e.child(o), 2);
|
|
1271
|
+
u.__click = () => s.toggleSearchPanel(), e.reset(o);
|
|
1272
|
+
var b = e.sibling(o, 2), l = e.child(b), c = e.child(l);
|
|
1273
|
+
e.remove_input_defaults(c), c.__keydown = f;
|
|
1274
|
+
var a = e.sibling(c, 2);
|
|
1275
|
+
a.__click = i;
|
|
1276
|
+
var d = e.child(a);
|
|
1277
|
+
{
|
|
1278
|
+
var D = (w) => {
|
|
1279
|
+
var v = zt();
|
|
1280
|
+
e.append(w, v);
|
|
1281
|
+
}, I = (w) => {
|
|
1282
|
+
Fe(w, { size: 20, weight: "bold" });
|
|
1283
|
+
};
|
|
1284
|
+
e.if(d, (w) => {
|
|
1285
|
+
s.isSearching ? w(D) : w(I, !1);
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
e.reset(a), e.reset(l), e.reset(b);
|
|
1289
|
+
var F = e.sibling(b, 2), L = e.child(F);
|
|
1290
|
+
{
|
|
1291
|
+
var j = (w) => {
|
|
1292
|
+
var v = Gt();
|
|
1293
|
+
e.append(w, v);
|
|
1294
|
+
}, g = (w) => {
|
|
1295
|
+
var v = e.comment(), p = e.first_child(v);
|
|
1296
|
+
{
|
|
1297
|
+
var x = (k) => {
|
|
1298
|
+
var T = Pt(), E = e.child(T);
|
|
1299
|
+
e.reset(T), e.template_effect(() => e.set_text(E, `No results found for "${s.searchQuery ?? ""}"`)), e.append(k, T);
|
|
1300
|
+
}, _ = (k) => {
|
|
1301
|
+
var T = e.comment(), E = e.first_child(T);
|
|
1302
|
+
{
|
|
1303
|
+
var O = (q) => {
|
|
1304
|
+
var U = Rt();
|
|
1305
|
+
e.append(q, U);
|
|
1306
|
+
}, K = (q) => {
|
|
1307
|
+
var U = Xt(), J = e.first_child(U), V = e.child(J);
|
|
1308
|
+
e.reset(J);
|
|
1309
|
+
var P = e.sibling(J, 2);
|
|
1310
|
+
e.each(P, 17, () => s.searchResults, e.index, (N, R) => {
|
|
1311
|
+
var B = Vt();
|
|
1312
|
+
B.__click = () => S(e.get(R));
|
|
1313
|
+
var Q = e.child(B), z = e.child(Q), X = e.child(z, !0);
|
|
1314
|
+
e.reset(z), e.reset(Q);
|
|
1315
|
+
var W = e.sibling(Q, 2);
|
|
1316
|
+
{
|
|
1317
|
+
var ye = (Y) => {
|
|
1318
|
+
var H = Nt(), ee = e.child(H), Le = e.child(ee);
|
|
1319
|
+
e.html(Le, () => e.get(R).before), e.reset(ee);
|
|
1320
|
+
var we = e.sibling(ee, 2), Ee = e.child(we);
|
|
1321
|
+
e.html(Ee, () => e.get(R).match), e.reset(we);
|
|
1322
|
+
var Ie = e.sibling(we, 2), ze = e.child(Ie);
|
|
1323
|
+
e.html(ze, () => e.get(R).after), e.reset(Ie), e.reset(H), e.append(Y, H);
|
|
1324
|
+
}, xe = (Y) => {
|
|
1325
|
+
var H = Ot(), ee = e.child(H, !0);
|
|
1326
|
+
e.reset(H), e.template_effect(() => e.set_text(ee, e.get(R).match)), e.append(Y, H);
|
|
1327
|
+
};
|
|
1328
|
+
e.if(W, (Y) => {
|
|
1329
|
+
e.get(R).type === "hit" ? Y(ye) : Y(xe, !1);
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
e.reset(B), e.template_effect(() => e.set_text(X, e.get(R).canvasLabel)), e.append(N, B);
|
|
1333
|
+
}), e.template_effect(() => e.set_text(V, `${s.searchResults.length ?? ""} Results`)), e.append(q, U);
|
|
1334
|
+
};
|
|
1335
|
+
e.if(
|
|
1336
|
+
E,
|
|
1337
|
+
(q) => {
|
|
1338
|
+
s.searchResults.length === 0 && !s.searchQuery ? q(O) : q(K, !1);
|
|
1339
|
+
},
|
|
1340
|
+
!0
|
|
1341
|
+
);
|
|
1342
|
+
}
|
|
1343
|
+
e.append(k, T);
|
|
1344
|
+
};
|
|
1345
|
+
e.if(
|
|
1346
|
+
p,
|
|
1347
|
+
(k) => {
|
|
1348
|
+
s.searchResults.length === 0 && s.searchQuery ? k(x) : k(_, !1);
|
|
1349
|
+
},
|
|
1350
|
+
!0
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
e.append(w, v);
|
|
1354
|
+
};
|
|
1355
|
+
e.if(L, (w) => {
|
|
1356
|
+
s.isSearching ? w(j) : w(g, !1);
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
e.reset(F), e.reset(M), e.bind_value(c, () => e.get(r), (w) => e.set(r, w)), e.append(y, M);
|
|
1360
|
+
};
|
|
1361
|
+
e.if(h, (y) => {
|
|
1362
|
+
s.showSearchPanel && y(m);
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
e.append(n, A), e.pop();
|
|
1366
|
+
}
|
|
1367
|
+
e.delegate(["click", "keydown"]);
|
|
1368
|
+
var Ht = e.from_html('<span class="loading loading-spinner loading-lg text-primary"></span>'), qt = e.from_html('<div class="text-error"> </div>'), Qt = e.from_html('<div class="text-base-content/50">No image found</div>'), Ut = e.from_html("<!> <!>", 1), Wt = e.from_html('<div id="triiiceratops-viewer" class="w-full h-full relative bg-base-100 flex items-center justify-center"><!> <!> <!> <!> <!> <!></div>');
|
|
1369
|
+
function ms(n, t) {
|
|
1370
|
+
e.push(t, !0);
|
|
1371
|
+
const s = new $e();
|
|
1372
|
+
Re($, s), e.user_effect(() => {
|
|
1373
|
+
t.manifestId && s.setManifest(t.manifestId);
|
|
1374
|
+
}), e.user_effect(() => {
|
|
1375
|
+
const a = () => {
|
|
1376
|
+
s.isFullScreen = !!document.fullscreenElement;
|
|
1377
|
+
};
|
|
1378
|
+
return document.addEventListener("fullscreenchange", a), () => {
|
|
1379
|
+
document.removeEventListener("fullscreenchange", a);
|
|
1380
|
+
};
|
|
1381
|
+
});
|
|
1382
|
+
let r = e.derived(() => s.manifest), i = e.derived(() => s.canvases), f = e.derived(() => s.currentCanvasIndex), S = e.derived(() => {
|
|
1383
|
+
if (!e.get(i) || e.get(f) === -1 || !e.get(i)[e.get(f)])
|
|
1384
|
+
return console.log("TriiiceratopsViewer: No canvas found"), null;
|
|
1385
|
+
const d = e.get(i)[e.get(f)].getImages();
|
|
1386
|
+
if (!d || !d.length)
|
|
1387
|
+
return console.log("TriiiceratopsViewer: No images in canvas"), null;
|
|
1388
|
+
const I = d[0].getResource();
|
|
1389
|
+
if (!I)
|
|
1390
|
+
return console.log("TriiiceratopsViewer: No resource in annotation"), null;
|
|
1391
|
+
const F = I.getService();
|
|
1392
|
+
if (F) {
|
|
1393
|
+
let g = F.id;
|
|
1394
|
+
return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
|
|
1395
|
+
}
|
|
1396
|
+
const L = I.getServices();
|
|
1397
|
+
if (L && L.length > 0) {
|
|
1398
|
+
let g = L[0].id;
|
|
1399
|
+
return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
|
|
1400
|
+
}
|
|
1401
|
+
if (I.id && I.id.includes("/iiif/")) {
|
|
1402
|
+
const g = I.id.split("/"), w = g.findIndex((v) => v === "full" || v.match(/^\d+,\d+,\d+,\d+$/));
|
|
1403
|
+
if (w > 0)
|
|
1404
|
+
return `${g.slice(0, w).join("/")}/info.json`;
|
|
1405
|
+
}
|
|
1406
|
+
return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: I.id };
|
|
1407
|
+
});
|
|
1408
|
+
var A = Wt(), h = e.child(A);
|
|
1409
|
+
{
|
|
1410
|
+
var m = (a) => {
|
|
1411
|
+
var d = Ht();
|
|
1412
|
+
e.append(a, d);
|
|
1413
|
+
}, y = (a) => {
|
|
1414
|
+
var d = e.comment(), D = e.first_child(d);
|
|
1415
|
+
{
|
|
1416
|
+
var I = (L) => {
|
|
1417
|
+
var j = qt(), g = e.child(j);
|
|
1418
|
+
e.reset(j), e.template_effect(() => e.set_text(g, `Error: ${e.get(r).error ?? ""}`)), e.append(L, j);
|
|
1419
|
+
}, F = (L) => {
|
|
1420
|
+
var j = e.comment(), g = e.first_child(j);
|
|
1421
|
+
{
|
|
1422
|
+
var w = (p) => {
|
|
1423
|
+
var x = e.comment(), _ = e.first_child(x);
|
|
1424
|
+
e.key(_, () => e.get(S), (k) => {
|
|
1425
|
+
ut(k, {
|
|
1426
|
+
get tileSources() {
|
|
1427
|
+
return e.get(S);
|
|
1428
|
+
},
|
|
1429
|
+
get viewerState() {
|
|
1430
|
+
return s;
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
}), e.append(p, x);
|
|
1434
|
+
}, v = (p) => {
|
|
1435
|
+
var x = Qt();
|
|
1436
|
+
e.append(p, x);
|
|
1437
|
+
};
|
|
1438
|
+
e.if(
|
|
1439
|
+
g,
|
|
1440
|
+
(p) => {
|
|
1441
|
+
e.get(S) ? p(w) : p(v, !1);
|
|
1442
|
+
},
|
|
1443
|
+
!0
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
e.append(L, j);
|
|
1447
|
+
};
|
|
1448
|
+
e.if(
|
|
1449
|
+
D,
|
|
1450
|
+
(L) => {
|
|
1451
|
+
var j;
|
|
1452
|
+
(j = e.get(r)) != null && j.error ? L(I) : L(F, !1);
|
|
1453
|
+
},
|
|
1454
|
+
!0
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
e.append(a, d);
|
|
1458
|
+
};
|
|
1459
|
+
e.if(h, (a) => {
|
|
1460
|
+
var d;
|
|
1461
|
+
(d = e.get(r)) != null && d.isFetching ? a(m) : a(y, !1);
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
var M = e.sibling(h, 2);
|
|
1465
|
+
{
|
|
1466
|
+
var o = (a) => {
|
|
1467
|
+
var d = Ut(), D = e.first_child(d);
|
|
1468
|
+
ht(D, {
|
|
1469
|
+
get viewerState() {
|
|
1470
|
+
return s;
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
var I = e.sibling(D, 2);
|
|
1474
|
+
kt(I, {
|
|
1475
|
+
get canvases() {
|
|
1476
|
+
return e.get(i);
|
|
1477
|
+
}
|
|
1478
|
+
}), e.append(a, d);
|
|
1479
|
+
};
|
|
1480
|
+
e.if(M, (a) => {
|
|
1481
|
+
e.get(i).length > 1 && a(o);
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
var u = e.sibling(M, 2);
|
|
1485
|
+
_t(u, {});
|
|
1486
|
+
var b = e.sibling(u, 2);
|
|
1487
|
+
Et(b, {});
|
|
1488
|
+
var l = e.sibling(b, 2);
|
|
1489
|
+
Yt(l, {});
|
|
1490
|
+
var c = e.sibling(l, 2);
|
|
1491
|
+
Mt(c, {}), e.reset(A), e.append(n, A), e.pop();
|
|
1492
|
+
}
|
|
1493
|
+
export {
|
|
1494
|
+
Ze as ManifestsState,
|
|
1495
|
+
ms as TriiiceratopsViewer,
|
|
1496
|
+
$ as VIEWER_STATE_KEY,
|
|
1497
|
+
$e as ViewerState
|
|
1498
|
+
};
|