triiiceratops 0.2.0 → 0.3.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.
@@ -1,37 +1,37 @@
1
- var Ae = (i) => {
2
- throw TypeError(i);
1
+ var ke = (a) => {
2
+ throw TypeError(a);
3
3
  };
4
- var Pe = (i, t, s) => t.has(i) || Ae("Cannot " + s);
5
- var L = (i, t, s) => (Pe(i, t, "read from private field"), s ? s.call(i) : t.get(i)), H = (i, t, s) => t.has(i) ? Ae("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s);
4
+ var Oe = (a, t, s) => t.has(a) || ke("Cannot " + s);
5
+ var G = (a, t, s) => (Oe(a, t, "read from private field"), s ? s.call(a) : t.get(a)), Y = (a, t, s) => t.has(a) ? ke("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s);
6
6
  import "svelte/internal/disclose-version";
7
7
  import * as e from "svelte/internal/client";
8
- import { onMount as Re, getContext as me, setContext as De } from "svelte";
9
- import * as Fe from "manifesto.js";
10
- import Ie from "openseadragon";
11
- import He from "phosphor-svelte/lib/CaretLeft";
12
- import Ne from "phosphor-svelte/lib/CaretRight";
13
- import Ve from "phosphor-svelte/lib/CaretDown";
14
- import ke from "phosphor-svelte/lib/Eye";
15
- import Ce from "phosphor-svelte/lib/EyeSlash";
16
- import Oe from "phosphor-svelte/lib/X";
8
+ import { onMount as qe, getContext as xe, setContext as Ye } from "svelte";
9
+ import * as Xe from "manifesto.js";
10
+ import Ce from "openseadragon";
11
+ import Qe from "phosphor-svelte/lib/CaretLeft";
12
+ import Ue from "phosphor-svelte/lib/CaretRight";
13
+ import Ke from "phosphor-svelte/lib/CaretDown";
14
+ import je from "phosphor-svelte/lib/Eye";
15
+ import Le from "phosphor-svelte/lib/EyeSlash";
16
+ import We from "phosphor-svelte/lib/X";
17
17
  import "svelte/internal/flags/legacy";
18
- import Be from "phosphor-svelte/lib/ChatCenteredText";
19
- import Ye from "phosphor-svelte/lib/CornersIn";
20
- import Xe from "phosphor-svelte/lib/CornersOut";
21
- import qe from "phosphor-svelte/lib/Info";
22
- import Me from "phosphor-svelte/lib/MagnifyingGlass";
23
- import $e from "phosphor-svelte/lib/Plus";
24
- import Qe from "phosphor-svelte/lib/Slideshow";
25
- var te;
26
- class Ue {
18
+ import Je from "phosphor-svelte/lib/ChatCenteredText";
19
+ import Ze from "phosphor-svelte/lib/CornersIn";
20
+ import et from "phosphor-svelte/lib/CornersOut";
21
+ import tt from "phosphor-svelte/lib/Info";
22
+ import Ge from "phosphor-svelte/lib/MagnifyingGlass";
23
+ import st from "phosphor-svelte/lib/Plus";
24
+ import at from "phosphor-svelte/lib/Slideshow";
25
+ var re;
26
+ class nt {
27
27
  constructor() {
28
- H(this, te, e.state(e.proxy({})));
28
+ Y(this, re, e.state(e.proxy({})));
29
29
  }
30
30
  get manifests() {
31
- return e.get(L(this, te));
31
+ return e.get(G(this, re));
32
32
  }
33
33
  set manifests(t) {
34
- e.set(L(this, te), t, !0);
34
+ e.set(G(this, re), t, !0);
35
35
  }
36
36
  async fetchManifest(t) {
37
37
  if (!this.manifests[t]) {
@@ -40,8 +40,8 @@ class Ue {
40
40
  const s = await fetch(t);
41
41
  if (!s.ok)
42
42
  throw new Error(`HTTP error! status: ${s.status}`);
43
- const r = await s.json(), l = Fe.parseManifest(r);
44
- this.manifests[t] = { json: r, manifesto: l, isFetching: !1 };
43
+ const n = await s.json(), c = Xe.parseManifest(n);
44
+ this.manifests[t] = { json: n, manifesto: c, isFetching: !1 };
45
45
  } catch (s) {
46
46
  this.manifests[t] = { error: s.message, isFetching: !1 };
47
47
  }
@@ -56,8 +56,8 @@ class Ue {
56
56
  try {
57
57
  const s = await fetch(t);
58
58
  if (s.ok) {
59
- const r = await s.json();
60
- this.manifests[t] = { json: r };
59
+ const n = await s.json();
60
+ this.manifests[t] = { json: n };
61
61
  } else
62
62
  console.error(`Failed to fetch annotation list: ${t}`);
63
63
  } catch (s) {
@@ -68,137 +68,137 @@ class Ue {
68
68
  const s = this.getManifest(t);
69
69
  if (!s)
70
70
  return [];
71
- const r = s.getSequences();
72
- return !r || !r.length ? [] : r[0].getCanvases();
71
+ const n = s.getSequences();
72
+ return !n || !n.length ? [] : n[0].getCanvases();
73
73
  }
74
74
  getAnnotations(t, s) {
75
- const r = this.getManifest(t);
76
- return r ? r.getSequences()[0].getCanvasById(s) ? this.manualGetAnnotations(t, s) : [] : [];
75
+ const n = this.getManifest(t);
76
+ return n ? n.getSequences()[0].getCanvasById(s) ? this.manualGetAnnotations(t, s) : [] : [];
77
77
  }
78
78
  // We can refactor this to use Manifesto's resource handling later if needed.
79
79
  manualGetAnnotations(t, s) {
80
- const r = this.getManifest(t);
81
- if (!r) return [];
82
- const l = r.getSequences()[0].getCanvasById(s);
83
- if (!l) return [];
84
- const c = l.__jsonld;
80
+ const n = this.getManifest(t);
81
+ if (!n) return [];
82
+ const c = n.getSequences()[0].getCanvasById(s);
83
+ if (!c) return [];
84
+ const g = c.__jsonld;
85
85
  let C = [];
86
- const m = (u) => u.resources || u.items || [];
87
- return c.otherContent && c.otherContent.forEach((u) => {
88
- const _ = u["@id"] || u.id;
89
- if (_ && !u.resources) {
90
- const I = this.manifests[_];
91
- if (I) {
92
- if (I.json) {
93
- const E = m(I.json);
94
- C.push(...E);
86
+ const y = (b) => b.resources || b.items || [];
87
+ return g.otherContent && g.otherContent.forEach((b) => {
88
+ const S = b["@id"] || b.id;
89
+ if (S && !b.resources) {
90
+ const k = this.manifests[S];
91
+ if (k) {
92
+ if (k.json) {
93
+ const P = y(k.json);
94
+ C.push(...P);
95
95
  }
96
96
  } else
97
- this.fetchAnnotationList(_);
98
- } else u.resources && C.push(...u.resources);
99
- }), c.annotations && c.annotations.forEach((u) => {
100
- const _ = u.id || u["@id"];
101
- if (_ && !u.items) {
102
- const I = this.manifests[_];
103
- if (I) {
104
- if (I.json) {
105
- const E = m(I.json);
106
- C.push(...E);
97
+ this.fetchAnnotationList(S);
98
+ } else b.resources && C.push(...b.resources);
99
+ }), g.annotations && g.annotations.forEach((b) => {
100
+ const S = b.id || b["@id"];
101
+ if (S && !b.items) {
102
+ const k = this.manifests[S];
103
+ if (k) {
104
+ if (k.json) {
105
+ const P = y(k.json);
106
+ C.push(...P);
107
107
  }
108
108
  } else
109
- this.fetchAnnotationList(_);
110
- } else u.items && C.push(...u.items);
109
+ this.fetchAnnotationList(S);
110
+ } else b.items && C.push(...b.items);
111
111
  }), C;
112
112
  }
113
113
  }
114
- te = new WeakMap();
115
- const Z = new Ue();
116
- var se, re, ie, ae, ne, oe, le, ce, de, fe, ge, he, ve, ue, pe;
117
- class We {
114
+ re = new WeakMap();
115
+ const se = new nt();
116
+ var ie, oe, le, ce, de, ge, ue, fe, he, ve, pe, me, be, _e, ye;
117
+ class rt {
118
118
  constructor(t) {
119
- H(this, se, e.state(null));
120
- H(this, re, e.state(null));
121
- H(this, ie, e.state(!1));
122
- H(this, ae, e.state(!1));
123
- H(this, ne, e.state(!1));
124
- H(this, oe, e.state(!1));
125
- H(this, le, e.state(!1));
126
- H(this, ce, e.state(!1));
127
- H(this, de, e.state("none"));
128
- H(this, fe, e.state(e.proxy(/* @__PURE__ */ new Set())));
129
- H(this, ge, e.state(""));
130
- H(this, he, e.state(e.proxy([])));
131
- H(this, ve, e.state(!1));
132
- H(this, ue, e.state(!1));
133
- H(this, pe, e.state(e.proxy([])));
134
- this.manifestId = t || null, this.manifestId && Z.fetchManifest(this.manifestId);
119
+ Y(this, ie, e.state(null));
120
+ Y(this, oe, e.state(null));
121
+ Y(this, le, e.state(!1));
122
+ Y(this, ce, e.state(!1));
123
+ Y(this, de, e.state(!1));
124
+ Y(this, ge, e.state(!1));
125
+ Y(this, ue, e.state(!1));
126
+ Y(this, fe, e.state(!1));
127
+ Y(this, he, e.state("none"));
128
+ Y(this, ve, e.state(e.proxy(/* @__PURE__ */ new Set())));
129
+ Y(this, pe, e.state(""));
130
+ Y(this, me, e.state(e.proxy([])));
131
+ Y(this, be, e.state(!1));
132
+ Y(this, _e, e.state(!1));
133
+ Y(this, ye, e.state(e.proxy([])));
134
+ this.manifestId = t || null, this.manifestId && se.fetchManifest(this.manifestId);
135
135
  }
136
136
  get manifestId() {
137
- return e.get(L(this, se));
137
+ return e.get(G(this, ie));
138
138
  }
139
139
  set manifestId(t) {
140
- e.set(L(this, se), t, !0);
140
+ e.set(G(this, ie), t, !0);
141
141
  }
142
142
  get canvasId() {
143
- return e.get(L(this, re));
143
+ return e.get(G(this, oe));
144
144
  }
145
145
  set canvasId(t) {
146
- e.set(L(this, re), t, !0);
146
+ e.set(G(this, oe), t, !0);
147
147
  }
148
148
  get showAnnotations() {
149
- return e.get(L(this, ie));
149
+ return e.get(G(this, le));
150
150
  }
151
151
  set showAnnotations(t) {
152
- e.set(L(this, ie), t, !0);
152
+ e.set(G(this, le), t, !0);
153
153
  }
154
154
  get showThumbnailGallery() {
155
- return e.get(L(this, ae));
155
+ return e.get(G(this, ce));
156
156
  }
157
157
  set showThumbnailGallery(t) {
158
- e.set(L(this, ae), t, !0);
158
+ e.set(G(this, ce), t, !0);
159
159
  }
160
160
  get isGalleryDockedBottom() {
161
- return e.get(L(this, ne));
161
+ return e.get(G(this, de));
162
162
  }
163
163
  set isGalleryDockedBottom(t) {
164
- e.set(L(this, ne), t, !0);
164
+ e.set(G(this, de), t, !0);
165
165
  }
166
166
  get isGalleryDockedRight() {
167
- return e.get(L(this, oe));
167
+ return e.get(G(this, ge));
168
168
  }
169
169
  set isGalleryDockedRight(t) {
170
- e.set(L(this, oe), t, !0);
170
+ e.set(G(this, ge), t, !0);
171
171
  }
172
172
  get isFullScreen() {
173
- return e.get(L(this, le));
173
+ return e.get(G(this, ue));
174
174
  }
175
175
  set isFullScreen(t) {
176
- e.set(L(this, le), t, !0);
176
+ e.set(G(this, ue), t, !0);
177
177
  }
178
178
  get showMetadataDialog() {
179
- return e.get(L(this, ce));
179
+ return e.get(G(this, fe));
180
180
  }
181
181
  set showMetadataDialog(t) {
182
- e.set(L(this, ce), t, !0);
182
+ e.set(G(this, fe), t, !0);
183
183
  }
184
184
  get dockSide() {
185
- return e.get(L(this, de));
185
+ return e.get(G(this, he));
186
186
  }
187
187
  set dockSide(t) {
188
- e.set(L(this, de), t, !0);
188
+ e.set(G(this, he), t, !0);
189
189
  }
190
190
  get visibleAnnotationIds() {
191
- return e.get(L(this, fe));
191
+ return e.get(G(this, ve));
192
192
  }
193
193
  set visibleAnnotationIds(t) {
194
- e.set(L(this, fe), t, !0);
194
+ e.set(G(this, ve), t, !0);
195
195
  }
196
196
  get manifest() {
197
- return this.manifestId ? Z.getManifest(this.manifestId) : null;
197
+ return this.manifestId ? se.getManifest(this.manifestId) : null;
198
198
  }
199
199
  get canvases() {
200
200
  if (!this.manifestId) return [];
201
- const t = Z.getCanvases(this.manifestId);
201
+ const t = se.getCanvases(this.manifestId);
202
202
  return t.length > 0 && !this.canvasId && setTimeout(
203
203
  () => {
204
204
  !this.canvasId && t.length > 0 && (this.canvasId = t[0].id);
@@ -228,7 +228,7 @@ class We {
228
228
  }
229
229
  }
230
230
  setManifest(t) {
231
- this.manifestId = t, this.canvasId = null, Z.fetchManifest(t);
231
+ this.manifestId = t, this.canvasId = null, se.fetchManifest(t);
232
232
  }
233
233
  setCanvas(t) {
234
234
  this.canvasId = t;
@@ -253,145 +253,145 @@ class We {
253
253
  this.showMetadataDialog = !this.showMetadataDialog;
254
254
  }
255
255
  get searchQuery() {
256
- return e.get(L(this, ge));
256
+ return e.get(G(this, pe));
257
257
  }
258
258
  set searchQuery(t) {
259
- e.set(L(this, ge), t, !0);
259
+ e.set(G(this, pe), t, !0);
260
260
  }
261
261
  get searchResults() {
262
- return e.get(L(this, he));
262
+ return e.get(G(this, me));
263
263
  }
264
264
  set searchResults(t) {
265
- e.set(L(this, he), t, !0);
265
+ e.set(G(this, me), t, !0);
266
266
  }
267
267
  get isSearching() {
268
- return e.get(L(this, ve));
268
+ return e.get(G(this, be));
269
269
  }
270
270
  set isSearching(t) {
271
- e.set(L(this, ve), t, !0);
271
+ e.set(G(this, be), t, !0);
272
272
  }
273
273
  get showSearchPanel() {
274
- return e.get(L(this, ue));
274
+ return e.get(G(this, _e));
275
275
  }
276
276
  set showSearchPanel(t) {
277
- e.set(L(this, ue), t, !0);
277
+ e.set(G(this, _e), t, !0);
278
278
  }
279
279
  toggleSearchPanel() {
280
280
  this.showSearchPanel = !this.showSearchPanel, this.showSearchPanel || (this.searchAnnotations = []);
281
281
  }
282
282
  get searchAnnotations() {
283
- return e.get(L(this, pe));
283
+ return e.get(G(this, ye));
284
284
  }
285
285
  set searchAnnotations(t) {
286
- e.set(L(this, pe), t, !0);
286
+ e.set(G(this, ye), t, !0);
287
287
  }
288
288
  get currentCanvasSearchAnnotations() {
289
289
  return this.canvasId ? this.searchAnnotations.filter((t) => t.canvasId === this.canvasId) : [];
290
290
  }
291
291
  async search(t) {
292
- var s, r;
292
+ var s, n;
293
293
  if (t.trim()) {
294
294
  this.isSearching = !0, this.searchQuery = t, this.searchResults = [];
295
295
  try {
296
- const l = this.manifest;
297
- if (!l) throw new Error("No manifest loaded");
298
- let c = l.getService("http://iiif.io/api/search/1/search") || l.getService("http://iiif.io/api/search/0/search");
299
- if (c || l.__jsonld && l.__jsonld.service && (c = (Array.isArray(l.__jsonld.service) ? l.__jsonld.service : [l.__jsonld.service]).find((f) => f.profile === "http://iiif.io/api/search/1/search" || f.profile === "http://iiif.io/api/search/0/search")), !c) {
296
+ const c = this.manifest;
297
+ if (!c) throw new Error("No manifest loaded");
298
+ let g = c.getService("http://iiif.io/api/search/1/search") || c.getService("http://iiif.io/api/search/0/search");
299
+ if (g || c.__jsonld && c.__jsonld.service && (g = (Array.isArray(c.__jsonld.service) ? c.__jsonld.service : [c.__jsonld.service]).find((u) => u.profile === "http://iiif.io/api/search/1/search" || u.profile === "http://iiif.io/api/search/0/search")), !g) {
300
300
  console.warn("No IIIF search service found in manifest"), this.isSearching = !1;
301
301
  return;
302
302
  }
303
- const m = `${c.id || c["@id"]}?q=${encodeURIComponent(t)}`, u = await fetch(m);
304
- if (!u.ok) throw new Error("Search request failed");
305
- const _ = await u.json(), I = _.resources || [], E = [], n = (o) => {
306
- const f = typeof o == "string" ? o : o["@id"] || o.id;
307
- if (!f) return null;
308
- const b = f.split("#xywh=");
309
- if (b.length < 2) return null;
310
- const h = b[1].split(",").map(Number);
311
- return h.length === 4 ? h : null;
303
+ const y = `${g.id || g["@id"]}?q=${encodeURIComponent(t)}`, b = await fetch(y);
304
+ if (!b.ok) throw new Error("Search request failed");
305
+ const S = await b.json(), k = S.resources || [], P = [], i = (l) => {
306
+ const u = typeof l == "string" ? l : l["@id"] || l.id;
307
+ if (!u) return null;
308
+ const T = u.split("#xywh=");
309
+ if (T.length < 2) return null;
310
+ const v = T[1].split(",").map(Number);
311
+ return v.length === 4 ? v : null;
312
312
  };
313
- if (_.hits)
314
- for (const o of _.hits) {
315
- const f = o.annotations || [];
316
- for (const b of f) {
317
- const h = I.find((a) => a["@id"] === b || a.id === b);
318
- if (h && h.on) {
319
- const a = typeof h.on == "string" ? h.on : h.on["@id"] || h.on.id, d = a.split("#")[0], j = n(a), w = this.canvases.findIndex((k) => k.id === d);
320
- if (w >= 0) {
321
- const k = this.canvases[w];
322
- let T = "Canvas " + (w + 1);
313
+ if (S.hits)
314
+ for (const l of S.hits) {
315
+ const u = l.annotations || [];
316
+ for (const T of u) {
317
+ const v = k.find((r) => r["@id"] === T || r.id === T);
318
+ if (v && v.on) {
319
+ const r = typeof v.on == "string" ? v.on : v.on["@id"] || v.on.id, d = r.split("#")[0], w = i(r), m = this.canvases.findIndex((j) => j.id === d);
320
+ if (m >= 0) {
321
+ const j = this.canvases[m];
322
+ let L = "Canvas " + (m + 1);
323
323
  try {
324
- if (k.getLabel) {
325
- const S = k.getLabel();
326
- Array.isArray(S) && S.length > 0 ? T = S[0].value : typeof S == "string" && (T = S);
327
- } else k.label && (typeof k.label == "string" ? T = k.label : Array.isArray(k.label) && (T = (s = k.label[0]) == null ? void 0 : s.value));
324
+ if (j.getLabel) {
325
+ const x = j.getLabel();
326
+ Array.isArray(x) && x.length > 0 ? L = x[0].value : typeof x == "string" && (L = x);
327
+ } else j.label && (typeof j.label == "string" ? L = j.label : Array.isArray(j.label) && (L = (s = j.label[0]) == null ? void 0 : s.value));
328
328
  } catch {
329
329
  }
330
- E.push({
330
+ P.push({
331
331
  type: "hit",
332
- before: o.before,
333
- match: o.match,
334
- after: o.after,
335
- canvasIndex: w,
336
- canvasLabel: String(T),
337
- bounds: j
332
+ before: l.before,
333
+ match: l.match,
334
+ after: l.after,
335
+ canvasIndex: m,
336
+ canvasLabel: String(L),
337
+ bounds: w
338
338
  });
339
339
  }
340
340
  }
341
341
  }
342
342
  }
343
- else if (I.length > 0)
344
- for (const o of I) {
345
- const f = typeof o.on == "string" ? o.on : o.on["@id"] || o.on.id, b = f.split("#")[0], h = n(f), a = this.canvases.findIndex((d) => d.id === b);
346
- if (a >= 0) {
347
- const d = this.canvases[a];
348
- let j = "Canvas " + (a + 1);
343
+ else if (k.length > 0)
344
+ for (const l of k) {
345
+ const u = typeof l.on == "string" ? l.on : l.on["@id"] || l.on.id, T = u.split("#")[0], v = i(u), r = this.canvases.findIndex((d) => d.id === T);
346
+ if (r >= 0) {
347
+ const d = this.canvases[r];
348
+ let w = "Canvas " + (r + 1);
349
349
  try {
350
350
  if (d.getLabel) {
351
- const w = d.getLabel();
352
- Array.isArray(w) && w.length > 0 ? j = w[0].value : typeof w == "string" && (j = w);
353
- } else d.label && (typeof d.label == "string" ? j = d.label : Array.isArray(d.label) && (j = (r = d.label[0]) == null ? void 0 : r.value));
351
+ const m = d.getLabel();
352
+ Array.isArray(m) && m.length > 0 ? w = m[0].value : typeof m == "string" && (w = m);
353
+ } else d.label && (typeof d.label == "string" ? w = d.label : Array.isArray(d.label) && (w = (n = d.label[0]) == null ? void 0 : n.value));
354
354
  } catch {
355
355
  }
356
- E.push({
356
+ P.push({
357
357
  type: "resource",
358
- match: o.resource && o.resource.chars ? o.resource.chars : o.chars || "",
359
- canvasIndex: a,
360
- canvasLabel: String(j),
361
- bounds: h
358
+ match: l.resource && l.resource.chars ? l.resource.chars : l.chars || "",
359
+ canvasIndex: r,
360
+ canvasLabel: String(w),
361
+ bounds: v
362
362
  });
363
363
  }
364
364
  }
365
- this.searchResults = E, this.searchAnnotations = E.filter((o) => o.bounds).map((o, f) => {
366
- const b = this.canvases[o.canvasIndex], h = `${b.id}#xywh=${o.bounds.join(",")}`;
365
+ this.searchResults = P, this.searchAnnotations = P.filter((l) => l.bounds).map((l, u) => {
366
+ const T = this.canvases[l.canvasIndex], v = `${T.id}#xywh=${l.bounds.join(",")}`;
367
367
  return {
368
- "@id": `urn:search-hit:${f}`,
368
+ "@id": `urn:search-hit:${u}`,
369
369
  "@type": "oa:Annotation",
370
370
  motivation: "sc:painting",
371
- on: h,
372
- canvasId: b.id,
373
- resource: { "@type": "cnt:ContentAsText", chars: o.match },
371
+ on: v,
372
+ canvasId: T.id,
373
+ resource: { "@type": "cnt:ContentAsText", chars: l.match },
374
374
  // Flag to identify styling in Overlay?
375
375
  // Or just standard rendering.
376
376
  isSearchHit: !0
377
377
  };
378
378
  });
379
- } catch (l) {
380
- console.error("Search error:", l);
379
+ } catch (c) {
380
+ console.error("Search error:", c);
381
381
  } finally {
382
382
  this.isSearching = !1;
383
383
  }
384
384
  }
385
385
  }
386
386
  }
387
- 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(), ge = new WeakMap(), he = new WeakMap(), ve = new WeakMap(), ue = new WeakMap(), pe = new WeakMap();
388
- const J = "triiiceratops:viewerState";
389
- function Le(i) {
390
- return i.id || i["@id"] || (typeof i.getId == "function" ? i.getId() : "");
387
+ ie = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), ge = new WeakMap(), ue = new WeakMap(), fe = new WeakMap(), he = new WeakMap(), ve = new WeakMap(), pe = new WeakMap(), me = new WeakMap(), be = new WeakMap(), _e = new WeakMap(), ye = new WeakMap();
388
+ const ae = "triiiceratops:viewerState";
389
+ function Pe(a) {
390
+ return a.id || a["@id"] || (typeof a.getId == "function" ? a.getId() : "");
391
391
  }
392
- function xe(i) {
393
- if (!i) return null;
394
- const t = i.match(/xywh=(\d+),(\d+),(\d+),(\d+)/);
392
+ function Ie(a) {
393
+ if (!a) return null;
394
+ const t = a.match(/xywh=(\d+),(\d+),(\d+),(\d+)/);
395
395
  return t ? {
396
396
  x: parseInt(t[1], 10),
397
397
  y: parseInt(t[2], 10),
@@ -399,11 +399,11 @@ function xe(i) {
399
399
  h: parseInt(t[4], 10)
400
400
  } : null;
401
401
  }
402
- function Ke(i) {
403
- const t = Ze(i);
402
+ function it(a) {
403
+ const t = ot(a);
404
404
  if (t)
405
- return Je(t);
406
- const s = rt(i);
405
+ return lt(t);
406
+ const s = ut(a);
407
407
  return s ? {
408
408
  type: "RECTANGLE",
409
409
  x: s.x,
@@ -412,235 +412,235 @@ function Ke(i) {
412
412
  h: s.h
413
413
  } : null;
414
414
  }
415
- function Ze(i) {
416
- var s, r;
417
- if (typeof i.getTarget == "function") {
418
- const l = ((s = i.__jsonld) == null ? void 0 : s.on) || ((r = i.__jsonld) == null ? void 0 : r.target);
419
- if (l)
420
- return je(l);
421
- }
422
- const t = i.target || i.on;
423
- return t ? je(t) : null;
415
+ function ot(a) {
416
+ var s, n;
417
+ if (typeof a.getTarget == "function") {
418
+ const c = ((s = a.__jsonld) == null ? void 0 : s.on) || ((n = a.__jsonld) == null ? void 0 : n.target);
419
+ if (c)
420
+ return Me(c);
421
+ }
422
+ const t = a.target || a.on;
423
+ return t ? Me(t) : null;
424
424
  }
425
- function je(i) {
426
- if (!i) return null;
427
- if (Array.isArray(i))
428
- for (const t of i) {
429
- const s = Te(t);
425
+ function Me(a) {
426
+ if (!a) return null;
427
+ if (Array.isArray(a))
428
+ for (const t of a) {
429
+ const s = Ee(t);
430
430
  if (s) return s;
431
431
  }
432
432
  else
433
- return Te(i);
433
+ return Ee(a);
434
434
  return null;
435
435
  }
436
- function Te(i) {
436
+ function Ee(a) {
437
437
  var s;
438
- if (!i) return null;
439
- const t = i.selector || i;
438
+ if (!a) return null;
439
+ const t = a.selector || a;
440
440
  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;
441
441
  }
442
- function Je(i) {
442
+ function lt(a) {
443
443
  try {
444
- const s = new DOMParser().parseFromString(i, "image/svg+xml");
444
+ const s = new DOMParser().parseFromString(a, "image/svg+xml");
445
445
  if (s.documentElement.nodeName === "parsererror")
446
- return console.warn("Failed to parse SVG selector:", i), null;
447
- const r = [], l = s.querySelectorAll("polygon");
448
- for (const m of l) {
449
- const u = m.getAttribute("points");
450
- if (u) {
451
- const _ = et(u);
452
- r.push(..._);
446
+ return console.warn("Failed to parse SVG selector:", a), null;
447
+ const n = [], c = s.querySelectorAll("polygon");
448
+ for (const y of c) {
449
+ const b = y.getAttribute("points");
450
+ if (b) {
451
+ const S = ct(b);
452
+ n.push(...S);
453
453
  }
454
454
  }
455
- const c = s.querySelectorAll("path");
456
- for (const m of c) {
457
- const u = m.getAttribute("d");
458
- if (u) {
459
- const _ = tt(u);
460
- r.push(..._);
455
+ const g = s.querySelectorAll("path");
456
+ for (const y of g) {
457
+ const b = y.getAttribute("d");
458
+ if (b) {
459
+ const S = dt(b);
460
+ n.push(...S);
461
461
  }
462
462
  }
463
463
  const C = s.querySelectorAll("circle");
464
- for (const m of C) {
465
- const u = parseFloat(m.getAttribute("cx") || "0"), _ = parseFloat(m.getAttribute("cy") || "0"), I = parseFloat(m.getAttribute("r") || "0"), E = st(u, _, I);
466
- r.push(...E);
464
+ for (const y of C) {
465
+ const b = parseFloat(y.getAttribute("cx") || "0"), S = parseFloat(y.getAttribute("cy") || "0"), k = parseFloat(y.getAttribute("r") || "0"), P = gt(b, S, k);
466
+ n.push(...P);
467
467
  }
468
- return r.length === 0 ? null : {
468
+ return n.length === 0 ? null : {
469
469
  type: "POLYGON",
470
- points: r
470
+ points: n
471
471
  };
472
472
  } catch (t) {
473
473
  return console.warn("Failed to convert SVG to polygon:", t), null;
474
474
  }
475
475
  }
476
- function et(i) {
477
- const t = [], s = i.trim().split(/\s+/);
478
- for (const r of s) {
479
- const [l, c] = r.split(",").map((C) => parseFloat(C));
480
- !isNaN(l) && !isNaN(c) && t.push([l, c]);
476
+ function ct(a) {
477
+ const t = [], s = a.trim().split(/\s+/);
478
+ for (const n of s) {
479
+ const [c, g] = n.split(",").map((C) => parseFloat(C));
480
+ !isNaN(c) && !isNaN(g) && t.push([c, g]);
481
481
  }
482
482
  return t;
483
483
  }
484
- function tt(i) {
484
+ function dt(a) {
485
485
  const t = [], s = /[ML]\s*([\d.]+)[,\s]+([\d.]+)/g;
486
- let r;
487
- for (; (r = s.exec(i)) !== null; ) {
488
- const l = parseFloat(r[1]), c = parseFloat(r[2]);
489
- !isNaN(l) && !isNaN(c) && t.push([l, c]);
486
+ let n;
487
+ for (; (n = s.exec(a)) !== null; ) {
488
+ const c = parseFloat(n[1]), g = parseFloat(n[2]);
489
+ !isNaN(c) && !isNaN(g) && t.push([c, g]);
490
490
  }
491
491
  return t;
492
492
  }
493
- function st(i, t, s, r = 8) {
494
- const l = [];
495
- for (let c = 0; c < r; c++) {
496
- const C = c / r * Math.PI * 2, m = i + s * Math.cos(C), u = t + s * Math.sin(C);
497
- l.push([m, u]);
493
+ function gt(a, t, s, n = 8) {
494
+ const c = [];
495
+ for (let g = 0; g < n; g++) {
496
+ const C = g / n * Math.PI * 2, y = a + s * Math.cos(C), b = t + s * Math.sin(C);
497
+ c.push([y, b]);
498
498
  }
499
- return l;
499
+ return c;
500
500
  }
501
- function rt(i) {
501
+ function ut(a) {
502
502
  var s;
503
- if (typeof i.getTarget == "function") {
504
- const r = i.getTarget();
505
- if (typeof r == "string" && r.includes("xywh="))
506
- return xe(r);
507
- const l = (s = i.__jsonld) == null ? void 0 : s.on;
508
- if (l) {
509
- const c = we(l);
510
- if (c) return c;
503
+ if (typeof a.getTarget == "function") {
504
+ const n = a.getTarget();
505
+ if (typeof n == "string" && n.includes("xywh="))
506
+ return Ie(n);
507
+ const c = (s = a.__jsonld) == null ? void 0 : s.on;
508
+ if (c) {
509
+ const g = Te(c);
510
+ if (g) return g;
511
511
  }
512
512
  }
513
- const t = i.target || i.on;
514
- return t ? we(t) : null;
513
+ const t = a.target || a.on;
514
+ return t ? Te(t) : null;
515
515
  }
516
- function we(i) {
517
- if (!i) return null;
518
- if (Array.isArray(i))
519
- for (const t of i) {
520
- const s = we(t);
516
+ function Te(a) {
517
+ if (!a) return null;
518
+ if (Array.isArray(a))
519
+ for (const t of a) {
520
+ const s = Te(t);
521
521
  if (s) return s;
522
522
  }
523
- if (typeof i == "string" && i.includes("xywh="))
524
- return xe(i);
525
- if (i.selector) {
526
- const t = i.selector, s = t.item || t;
523
+ if (typeof a == "string" && a.includes("xywh="))
524
+ return Ie(a);
525
+ if (a.selector) {
526
+ const t = a.selector, s = t.item || t;
527
527
  if (s.value && typeof s.value == "string" && s.value.includes("xywh="))
528
- return xe(s.value);
528
+ return Ie(s.value);
529
529
  }
530
530
  return null;
531
531
  }
532
- function it(i) {
532
+ function ft(a) {
533
533
  let t = "", s = !1;
534
- if (typeof i.getBody == "function") {
535
- const r = i.getBody();
536
- if (r && Array.isArray(r)) {
537
- const l = [];
538
- for (const c of r) {
539
- const C = c.getValue ? c.getValue() : "";
534
+ if (typeof a.getBody == "function") {
535
+ const n = a.getBody();
536
+ if (n && Array.isArray(n)) {
537
+ const c = [];
538
+ for (const g of n) {
539
+ const C = g.getValue ? g.getValue() : "";
540
540
  if (C) {
541
- l.push(C);
542
- const m = c.getFormat ? c.getFormat() : "";
543
- (m === "text/html" || m === "application/html") && (s = !0);
541
+ c.push(C);
542
+ const y = g.getFormat ? g.getFormat() : "";
543
+ (y === "text/html" || y === "application/html") && (s = !0);
544
544
  }
545
545
  }
546
- t = l.join(" ");
546
+ t = c.join(" ");
547
547
  }
548
548
  } else {
549
- const r = (c) => c && (c.chars || c.value || c["cnt:chars"]) || "", l = (c) => c ? c.format === "text/html" || c.type === "TextualBody" : !1;
550
- if (i.resource) {
551
- const c = Array.isArray(i.resource) ? i.resource : [i.resource];
552
- t = c.map(r).filter(Boolean).join(" "), s = c.some(l);
553
- } else if (i.body) {
554
- const c = Array.isArray(i.body) ? i.body : [i.body];
555
- t = c.map(r).filter(Boolean).join(" "), s = c.some(l);
549
+ const n = (g) => g && (g.chars || g.value || g["cnt:chars"]) || "", c = (g) => g ? g.format === "text/html" || g.type === "TextualBody" : !1;
550
+ if (a.resource) {
551
+ const g = Array.isArray(a.resource) ? a.resource : [a.resource];
552
+ t = g.map(n).filter(Boolean).join(" "), s = g.some(c);
553
+ } else if (a.body) {
554
+ const g = Array.isArray(a.body) ? a.body : [a.body];
555
+ t = g.map(n).filter(Boolean).join(" "), s = g.some(c);
556
556
  }
557
557
  }
558
- return t || (typeof i.getLabel == "function" ? t = i.getLabel() || "" : i.label && (t = Array.isArray(i.label) ? i.label.join(" ") : i.label)), { value: t || "Annotation", isHtml: s };
558
+ return t || (typeof a.getLabel == "function" ? t = a.getLabel() || "" : a.label && (t = Array.isArray(a.label) ? a.label.join(" ") : a.label)), { value: t || "Annotation", isHtml: s };
559
559
  }
560
- function at(i, t, s = !1) {
561
- const r = Le(i) || `anno-${t}`, l = Ke(i);
562
- if (!l)
560
+ function ht(a, t, s = !1) {
561
+ const n = Pe(a) || `anno-${t}`, c = it(a);
562
+ if (!c)
563
563
  return null;
564
- const c = it(i);
564
+ const g = ft(a);
565
565
  return {
566
- id: r,
567
- geometry: l,
568
- body: c,
566
+ id: n,
567
+ geometry: c,
568
+ body: g,
569
569
  isSearchHit: s
570
570
  };
571
571
  }
572
- function nt(i, t = /* @__PURE__ */ new Set()) {
573
- return i.map((s, r) => {
574
- const l = t.has(Le(s));
575
- return at(s, r, l);
572
+ function vt(a, t = /* @__PURE__ */ new Set()) {
573
+ return a.map((s, n) => {
574
+ const c = t.has(Pe(s));
575
+ return ht(s, n, c);
576
576
  }).filter((s) => s !== null);
577
577
  }
578
- var ot = e.from_html("<div></div>"), lt = e.from_svg('<svg class="absolute pointer-events-auto"><title> </title><polygon stroke-width="2"></polygon></svg>'), ct = e.from_html('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');
579
- function dt(i, t) {
578
+ var pt = e.from_html("<div></div>"), mt = e.from_svg('<svg class="absolute pointer-events-auto"><title> </title><polygon stroke-width="2"></polygon></svg>'), bt = e.from_html('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');
579
+ function _t(a, t) {
580
580
  e.push(t, !0);
581
- let s = e.state(void 0), r = e.state(void 0), l = e.state(0), c = e.derived(() => {
581
+ let s = e.state(void 0), n = e.state(void 0), c = e.state(0), g = e.derived(() => {
582
582
  if (!t.viewerState.manifestId || !t.viewerState.canvasId)
583
583
  return [];
584
- const n = Z.getAnnotations(t.viewerState.manifestId, t.viewerState.canvasId), o = t.viewerState.currentCanvasSearchAnnotations;
585
- return [...n, ...o];
584
+ const i = se.getAnnotations(t.viewerState.manifestId, t.viewerState.canvasId), l = t.viewerState.currentCanvasSearchAnnotations;
585
+ return [...i, ...l];
586
586
  }), C = e.derived(() => {
587
- const n = /* @__PURE__ */ new Set();
588
- return t.viewerState.currentCanvasSearchAnnotations.forEach((o) => {
589
- const f = o.id || o["@id"];
590
- f && n.add(f);
591
- }), n;
592
- }), m = e.derived(() => nt(e.get(c), e.get(C))), u = e.derived(() => {
593
- if (e.get(l), !e.get(r) || !e.get(m).length)
587
+ const i = /* @__PURE__ */ new Set();
588
+ return t.viewerState.currentCanvasSearchAnnotations.forEach((l) => {
589
+ const u = l.id || l["@id"];
590
+ u && i.add(u);
591
+ }), i;
592
+ }), y = e.derived(() => vt(e.get(g), e.get(C))), b = e.derived(() => {
593
+ if (e.get(c), !e.get(n) || !e.get(y).length)
594
594
  return [];
595
- const n = e.get(r).world.getItemAt(0);
596
- if (!n)
595
+ const i = e.get(n).world.getItemAt(0);
596
+ if (!i)
597
597
  return [];
598
- const o = [];
599
- for (const f of e.get(m)) {
600
- if (!f.isSearchHit) if (t.viewerState.showAnnotations) {
601
- if (!t.viewerState.visibleAnnotationIds.has(f.id))
598
+ const l = [];
599
+ for (const u of e.get(y)) {
600
+ if (!u.isSearchHit) if (t.viewerState.showAnnotations) {
601
+ if (!t.viewerState.visibleAnnotationIds.has(u.id))
602
602
  continue;
603
603
  } else continue;
604
- if (f.geometry.type === "RECTANGLE") {
605
- const b = n.imageToViewportRectangle(f.geometry.x, f.geometry.y, f.geometry.w, f.geometry.h), h = e.get(r).viewport.viewportToViewerElementRectangle(b);
606
- o.push({
607
- id: f.id,
604
+ if (u.geometry.type === "RECTANGLE") {
605
+ const T = i.imageToViewportRectangle(u.geometry.x, u.geometry.y, u.geometry.w, u.geometry.h), v = e.get(n).viewport.viewportToViewerElementRectangle(T);
606
+ l.push({
607
+ id: u.id,
608
608
  type: "RECTANGLE",
609
609
  rect: {
610
- x: h.x,
611
- y: h.y,
612
- width: h.width,
613
- height: h.height
610
+ x: v.x,
611
+ y: v.y,
612
+ width: v.width,
613
+ height: v.height
614
614
  },
615
- isSearchHit: f.isSearchHit,
616
- tooltip: f.body.value
615
+ isSearchHit: u.isSearchHit,
616
+ tooltip: u.body.value
617
617
  });
618
- } else if (f.geometry.type === "POLYGON") {
619
- const b = f.geometry.points.map((k) => {
620
- const T = n.imageToViewportCoordinates(new Ie.Point(k[0], k[1])), S = e.get(r).viewport.viewportToViewerElementCoordinates(T);
621
- return [S.x, S.y];
618
+ } else if (u.geometry.type === "POLYGON") {
619
+ const T = u.geometry.points.map((j) => {
620
+ const L = i.imageToViewportCoordinates(new Ce.Point(j[0], j[1])), x = e.get(n).viewport.viewportToViewerElementCoordinates(L);
621
+ return [x.x, x.y];
622
622
  });
623
- let h = 1 / 0, a = 1 / 0, d = -1 / 0, j = -1 / 0;
624
- for (const [k, T] of b)
625
- h = Math.min(h, k), a = Math.min(a, T), d = Math.max(d, k), j = Math.max(j, T);
626
- const w = b.map(([k, T]) => [k - h, T - a]);
627
- o.push({
628
- id: f.id,
623
+ let v = 1 / 0, r = 1 / 0, d = -1 / 0, w = -1 / 0;
624
+ for (const [j, L] of T)
625
+ v = Math.min(v, j), r = Math.min(r, L), d = Math.max(d, j), w = Math.max(w, L);
626
+ const m = T.map(([j, L]) => [j - v, L - r]);
627
+ l.push({
628
+ id: u.id,
629
629
  type: "POLYGON",
630
- bounds: { x: h, y: a, width: d - h, height: j - a },
631
- points: w,
632
- isSearchHit: f.isSearchHit,
633
- tooltip: f.body.value
630
+ bounds: { x: v, y: r, width: d - v, height: w - r },
631
+ points: m,
632
+ isSearchHit: u.isSearchHit,
633
+ tooltip: u.body.value
634
634
  });
635
635
  }
636
636
  }
637
- return o;
637
+ return l;
638
638
  });
639
- Re(() => {
639
+ qe(() => {
640
640
  if (e.get(s))
641
641
  return e.set(
642
- r,
643
- Ie({
642
+ n,
643
+ Ce({
644
644
  element: e.get(s),
645
645
  tileSources: null,
646
646
  // Will be set via effect
@@ -658,720 +658,992 @@ function dt(i, t) {
658
658
  }),
659
659
  !0
660
660
  ), () => {
661
- var n;
662
- (n = e.get(r)) == null || n.destroy();
661
+ var i;
662
+ (i = e.get(n)) == null || i.destroy();
663
663
  };
664
664
  }), e.user_effect(() => {
665
- if (!e.get(r)) return;
666
- const n = () => {
667
- e.update(l);
665
+ if (!e.get(n)) return;
666
+ const i = () => {
667
+ e.update(c);
668
668
  };
669
- return e.get(r).addHandler("open", n), e.get(r).addHandler("animation", n), e.get(r).addHandler("resize", n), e.get(r).addHandler("rotate", n), e.get(r).world.addHandler("add-item", n), e.get(r).world.addHandler("remove-item", n), () => {
670
- e.get(r).removeHandler("open", n), e.get(r).removeHandler("animation", n), e.get(r).removeHandler("resize", n), e.get(r).removeHandler("rotate", n), e.get(r).world.removeHandler("add-item", n), e.get(r).world.removeHandler("remove-item", n);
669
+ return e.get(n).addHandler("open", i), e.get(n).addHandler("animation", i), e.get(n).addHandler("resize", i), e.get(n).addHandler("rotate", i), e.get(n).world.addHandler("add-item", i), e.get(n).world.addHandler("remove-item", i), () => {
670
+ e.get(n).removeHandler("open", i), e.get(n).removeHandler("animation", i), e.get(n).removeHandler("resize", i), e.get(n).removeHandler("rotate", i), e.get(n).world.removeHandler("add-item", i), e.get(n).world.removeHandler("remove-item", i);
671
671
  };
672
672
  }), e.user_effect(() => {
673
- !e.get(r) || !t.tileSources || e.get(r).open(t.tileSources);
673
+ !e.get(n) || !t.tileSources || e.get(n).open(t.tileSources);
674
674
  });
675
- var _ = ct(), I = e.child(_);
676
- e.bind_this(I, (n) => e.set(s, n), () => e.get(s));
677
- var E = e.sibling(I, 2);
678
- e.each(E, 17, () => e.get(u), (n) => n.id, (n, o) => {
679
- var f = e.comment(), b = e.first_child(f);
675
+ var S = bt(), k = e.child(S);
676
+ e.bind_this(k, (i) => e.set(s, i), () => e.get(s));
677
+ var P = e.sibling(k, 2);
678
+ e.each(P, 17, () => e.get(b), (i) => i.id, (i, l) => {
679
+ var u = e.comment(), T = e.first_child(u);
680
680
  {
681
- var h = (d) => {
682
- var j = ot();
681
+ var v = (d) => {
682
+ var w = pt();
683
683
  e.template_effect(() => {
684
- e.set_class(j, 1, `absolute border-2 transition-colors cursor-pointer pointer-events-auto ${e.get(o).isSearchHit ? "border-yellow-400 bg-yellow-400/40 hover:bg-yellow-400/60" : "border-red-500 bg-red-500/20 hover:bg-red-500/40"}`), e.set_style(j, `
685
- left: ${e.get(o).rect.x ?? ""}px;
686
- top: ${e.get(o).rect.y ?? ""}px;
687
- width: ${e.get(o).rect.width ?? ""}px;
688
- height: ${e.get(o).rect.height ?? ""}px;
689
- `), e.set_attribute(j, "title", e.get(o).tooltip);
690
- }), e.append(d, j);
691
- }, a = (d) => {
692
- var j = e.comment(), w = e.first_child(j);
684
+ e.set_class(w, 1, `absolute border-2 transition-colors cursor-pointer pointer-events-auto ${e.get(l).isSearchHit ? "border-yellow-400 bg-yellow-400/40 hover:bg-yellow-400/60" : "border-red-500 bg-red-500/20 hover:bg-red-500/40"}`), e.set_style(w, `
685
+ left: ${e.get(l).rect.x ?? ""}px;
686
+ top: ${e.get(l).rect.y ?? ""}px;
687
+ width: ${e.get(l).rect.width ?? ""}px;
688
+ height: ${e.get(l).rect.height ?? ""}px;
689
+ `), e.set_attribute(w, "title", e.get(l).tooltip);
690
+ }), e.append(d, w);
691
+ }, r = (d) => {
692
+ var w = e.comment(), m = e.first_child(w);
693
693
  {
694
- var k = (T) => {
695
- var S = lt(), g = e.child(S), x = e.child(g, !0);
696
- e.reset(g);
697
- var v = e.sibling(g);
698
- e.reset(S), e.template_effect(
699
- (p) => {
700
- e.set_style(S, `
701
- left: ${e.get(o).bounds.x ?? ""}px;
702
- top: ${e.get(o).bounds.y ?? ""}px;
703
- width: ${e.get(o).bounds.width ?? ""}px;
704
- height: ${e.get(o).bounds.height ?? ""}px;
705
- `), e.set_text(x, e.get(o).tooltip), e.set_attribute(v, "points", p), e.set_class(v, 0, `cursor-pointer transition-colors ${e.get(o).isSearchHit ? "fill-yellow-400/40 stroke-yellow-400 hover:fill-yellow-400/60" : "fill-red-500/20 stroke-red-500 hover:fill-red-500/40"}`);
694
+ var j = (L) => {
695
+ var x = mt(), _ = e.child(x), z = e.child(_, !0);
696
+ e.reset(_);
697
+ var p = e.sibling(_);
698
+ e.reset(x), e.template_effect(
699
+ (o) => {
700
+ e.set_style(x, `
701
+ left: ${e.get(l).bounds.x ?? ""}px;
702
+ top: ${e.get(l).bounds.y ?? ""}px;
703
+ width: ${e.get(l).bounds.width ?? ""}px;
704
+ height: ${e.get(l).bounds.height ?? ""}px;
705
+ `), e.set_text(z, e.get(l).tooltip), e.set_attribute(p, "points", o), e.set_class(p, 0, `cursor-pointer transition-colors ${e.get(l).isSearchHit ? "fill-yellow-400/40 stroke-yellow-400 hover:fill-yellow-400/60" : "fill-red-500/20 stroke-red-500 hover:fill-red-500/40"}`);
706
706
  },
707
- [() => e.get(o).points.map((p) => p.join(",")).join(" ")]
708
- ), e.append(T, S);
707
+ [() => e.get(l).points.map((o) => o.join(",")).join(" ")]
708
+ ), e.append(L, x);
709
709
  };
710
710
  e.if(
711
- w,
712
- (T) => {
713
- e.get(o).type === "POLYGON" && T(k);
711
+ m,
712
+ (L) => {
713
+ e.get(l).type === "POLYGON" && L(j);
714
714
  },
715
715
  !0
716
716
  );
717
717
  }
718
- e.append(d, j);
718
+ e.append(d, w);
719
719
  };
720
- e.if(b, (d) => {
721
- e.get(o).type === "RECTANGLE" ? d(h) : d(a, !1);
720
+ e.if(T, (d) => {
721
+ e.get(l).type === "RECTANGLE" ? d(v) : d(r, !1);
722
722
  });
723
723
  }
724
- e.append(n, f);
725
- }), e.reset(_), e.append(i, _), e.pop();
724
+ e.append(i, u);
725
+ }), e.reset(S), e.append(a, S), e.pop();
726
726
  }
727
- var ft = 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>');
728
- function gt(i, t) {
727
+ const yt = "en";
728
+ let M = () => yt;
729
+ const xt = /* @__NO_SIDE_EFFECTS__ */ () => "Hello World", wt = /* @__NO_SIDE_EFFECTS__ */ () => "Search", St = /* @__NO_SIDE_EFFECTS__ */ () => "Close Search", At = /* @__NO_SIDE_EFFECTS__ */ () => "Search content...", It = /* @__NO_SIDE_EFFECTS__ */ (a) => `No results found for "${a.query}"`, Tt = /* @__NO_SIDE_EFFECTS__ */ () => "Enter a search term to find occurrences within this manifest.", $t = /* @__NO_SIDE_EFFECTS__ */ (a) => `${a.count} Results`, kt = /* @__NO_SIDE_EFFECTS__ */ () => "Manifest Metadata", Ct = /* @__NO_SIDE_EFFECTS__ */ () => "Loading...", jt = /* @__NO_SIDE_EFFECTS__ */ () => "Attribution", Lt = /* @__NO_SIDE_EFFECTS__ */ () => "License", Mt = /* @__NO_SIDE_EFFECTS__ */ () => "Close", Et = /* @__NO_SIDE_EFFECTS__ */ () => "Menu", Gt = /* @__NO_SIDE_EFFECTS__ */ () => "Search", Pt = /* @__NO_SIDE_EFFECTS__ */ () => "Toggle Search", zt = /* @__NO_SIDE_EFFECTS__ */ () => "Hide Gallery", Rt = /* @__NO_SIDE_EFFECTS__ */ () => "Show Gallery", Ft = /* @__NO_SIDE_EFFECTS__ */ () => "Exit Full Screen", Dt = /* @__NO_SIDE_EFFECTS__ */ () => "Enter Full Screen", Ht = /* @__NO_SIDE_EFFECTS__ */ () => "Hide Annotations", Nt = /* @__NO_SIDE_EFFECTS__ */ () => "Show Annotations", Vt = /* @__NO_SIDE_EFFECTS__ */ () => "Toggle Annotations", Bt = /* @__NO_SIDE_EFFECTS__ */ () => "Metadata", Ot = /* @__NO_SIDE_EFFECTS__ */ () => "Toggle Metadata", qt = /* @__NO_SIDE_EFFECTS__ */ () => "Hide All Annotations", Yt = /* @__NO_SIDE_EFFECTS__ */ () => "Show All Annotations", Xt = /* @__NO_SIDE_EFFECTS__ */ (a) => `${a.count} Annotations`, Qt = /* @__NO_SIDE_EFFECTS__ */ (a) => `(${a.count} visible)`, Ut = /* @__NO_SIDE_EFFECTS__ */ () => "(No content)", Kt = /* @__NO_SIDE_EFFECTS__ */ () => "No annotations available.", Wt = /* @__NO_SIDE_EFFECTS__ */ () => "Previous Canvas", Jt = /* @__NO_SIDE_EFFECTS__ */ () => "Next Canvas", Zt = /* @__NO_SIDE_EFFECTS__ */ () => "Docs", es = /* @__NO_SIDE_EFFECTS__ */ () => "IIIF Manifest:", ts = /* @__NO_SIDE_EFFECTS__ */ () => "Enter IIIF manifest URL", ss = /* @__NO_SIDE_EFFECTS__ */ () => "Load", as = /* @__NO_SIDE_EFFECTS__ */ () => "GitHub", ns = /* @__NO_SIDE_EFFECTS__ */ () => "Hallo Welt", rs = /* @__NO_SIDE_EFFECTS__ */ () => "Suche", is = /* @__NO_SIDE_EFFECTS__ */ () => "Suche schließen", os = /* @__NO_SIDE_EFFECTS__ */ () => "Inhalt durchsuchen...", ls = /* @__NO_SIDE_EFFECTS__ */ (a) => `Keine Ergebnisse für "${a.query}" gefunden`, cs = /* @__NO_SIDE_EFFECTS__ */ () => "Geben Sie einen Suchbegriff ein, um Vorkommen in diesem Manifest zu finden.", ds = /* @__NO_SIDE_EFFECTS__ */ (a) => `${a.count} Ergebnisse`, gs = /* @__NO_SIDE_EFFECTS__ */ () => "Manifest-Metadaten", us = /* @__NO_SIDE_EFFECTS__ */ () => "Lädt...", fs = /* @__NO_SIDE_EFFECTS__ */ () => "Quellenangabe", hs = /* @__NO_SIDE_EFFECTS__ */ () => "Lizenz", vs = /* @__NO_SIDE_EFFECTS__ */ () => "Schließen", ps = /* @__NO_SIDE_EFFECTS__ */ () => "Menü", ms = /* @__NO_SIDE_EFFECTS__ */ () => "Suche", bs = /* @__NO_SIDE_EFFECTS__ */ () => "Suche umschalten", _s = /* @__NO_SIDE_EFFECTS__ */ () => "Galerie ausblenden", ys = /* @__NO_SIDE_EFFECTS__ */ () => "Galerie einblenden", xs = /* @__NO_SIDE_EFFECTS__ */ () => "Vollbildmodus beenden", ws = /* @__NO_SIDE_EFFECTS__ */ () => "Vollbildmodus", Ss = /* @__NO_SIDE_EFFECTS__ */ () => "Annotationen ausblenden", As = /* @__NO_SIDE_EFFECTS__ */ () => "Annotationen einblenden", Is = /* @__NO_SIDE_EFFECTS__ */ () => "Annotationen umschalten", Ts = /* @__NO_SIDE_EFFECTS__ */ () => "Metadaten", $s = /* @__NO_SIDE_EFFECTS__ */ () => "Metadaten umschalten", ks = /* @__NO_SIDE_EFFECTS__ */ () => "Alle Annotationen ausblenden", Cs = /* @__NO_SIDE_EFFECTS__ */ () => "Alle Annotationen einblenden", js = /* @__NO_SIDE_EFFECTS__ */ (a) => `${a.count} Annotationen`, Ls = /* @__NO_SIDE_EFFECTS__ */ (a) => `(${a.count} sichtbar)`, Ms = /* @__NO_SIDE_EFFECTS__ */ () => "(Kein Inhalt)", Es = /* @__NO_SIDE_EFFECTS__ */ () => "Keine Annotationen verfügbar.", Gs = /* @__NO_SIDE_EFFECTS__ */ () => "Vorheriges Canvas", Ps = /* @__NO_SIDE_EFFECTS__ */ () => "Nächstes Canvas", zs = /* @__NO_SIDE_EFFECTS__ */ () => "Doku", Rs = /* @__NO_SIDE_EFFECTS__ */ () => "IIIF-Manifest:", Fs = /* @__NO_SIDE_EFFECTS__ */ () => "IIIF-Manifest-URL eingeben", Ds = /* @__NO_SIDE_EFFECTS__ */ () => "Laden", Hs = /* @__NO_SIDE_EFFECTS__ */ () => "GitHub", Ns = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
730
+ de: ns,
731
+ en: xt
732
+ })[t.languageTag ?? M()](), Vs = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
733
+ de: rs,
734
+ en: wt
735
+ })[t.languageTag ?? M()](), Bs = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
736
+ de: is,
737
+ en: St
738
+ })[t.languageTag ?? M()](), Os = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
739
+ de: os,
740
+ en: At
741
+ })[t.languageTag ?? M()](), qs = /* @__NO_SIDE_EFFECTS__ */ (a, t = {}) => ({
742
+ de: ls,
743
+ en: It
744
+ })[t.languageTag ?? M()](a), Ys = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
745
+ de: cs,
746
+ en: Tt
747
+ })[t.languageTag ?? M()](), Xs = /* @__NO_SIDE_EFFECTS__ */ (a, t = {}) => ({
748
+ de: ds,
749
+ en: $t
750
+ })[t.languageTag ?? M()](a), Qs = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
751
+ de: gs,
752
+ en: kt
753
+ })[t.languageTag ?? M()](), Us = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
754
+ de: us,
755
+ en: Ct
756
+ })[t.languageTag ?? M()](), Ks = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
757
+ de: fs,
758
+ en: jt
759
+ })[t.languageTag ?? M()](), Ws = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
760
+ de: hs,
761
+ en: Lt
762
+ })[t.languageTag ?? M()](), Js = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
763
+ de: vs,
764
+ en: Mt
765
+ })[t.languageTag ?? M()](), Zs = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
766
+ de: ps,
767
+ en: Et
768
+ })[t.languageTag ?? M()](), ea = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
769
+ de: ms,
770
+ en: Gt
771
+ })[t.languageTag ?? M()](), ta = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
772
+ de: bs,
773
+ en: Pt
774
+ })[t.languageTag ?? M()](), sa = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
775
+ de: _s,
776
+ en: zt
777
+ })[t.languageTag ?? M()](), aa = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
778
+ de: ys,
779
+ en: Rt
780
+ })[t.languageTag ?? M()](), na = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
781
+ de: xs,
782
+ en: Ft
783
+ })[t.languageTag ?? M()](), ra = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
784
+ de: ws,
785
+ en: Dt
786
+ })[t.languageTag ?? M()](), ia = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
787
+ de: Ss,
788
+ en: Ht
789
+ })[t.languageTag ?? M()](), oa = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
790
+ de: As,
791
+ en: Nt
792
+ })[t.languageTag ?? M()](), la = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
793
+ de: Is,
794
+ en: Vt
795
+ })[t.languageTag ?? M()](), ca = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
796
+ de: Ts,
797
+ en: Bt
798
+ })[t.languageTag ?? M()](), da = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
799
+ de: $s,
800
+ en: Ot
801
+ })[t.languageTag ?? M()](), ze = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
802
+ de: ks,
803
+ en: qt
804
+ })[t.languageTag ?? M()](), Re = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
805
+ de: Cs,
806
+ en: Yt
807
+ })[t.languageTag ?? M()](), Fe = /* @__NO_SIDE_EFFECTS__ */ (a, t = {}) => ({
808
+ de: js,
809
+ en: Xt
810
+ })[t.languageTag ?? M()](a), De = /* @__NO_SIDE_EFFECTS__ */ (a, t = {}) => ({
811
+ de: Ls,
812
+ en: Qt
813
+ })[t.languageTag ?? M()](a), ga = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
814
+ de: Ms,
815
+ en: Ut
816
+ })[t.languageTag ?? M()](), ua = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
817
+ de: Es,
818
+ en: Kt
819
+ })[t.languageTag ?? M()](), fa = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
820
+ de: Gs,
821
+ en: Wt
822
+ })[t.languageTag ?? M()](), ha = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
823
+ de: Ps,
824
+ en: Jt
825
+ })[t.languageTag ?? M()](), va = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
826
+ de: zs,
827
+ en: Zt
828
+ })[t.languageTag ?? M()](), pa = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
829
+ de: Rs,
830
+ en: es
831
+ })[t.languageTag ?? M()](), ma = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
832
+ de: Fs,
833
+ en: ts
834
+ })[t.languageTag ?? M()](), ba = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
835
+ de: Ds,
836
+ en: ss
837
+ })[t.languageTag ?? M()](), _a = /* @__NO_SIDE_EFFECTS__ */ (a = {}, t = {}) => ({
838
+ de: Hs,
839
+ en: as
840
+ })[t.languageTag ?? M()](), ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
841
+ __proto__: null,
842
+ annotations_count: Fe,
843
+ attribution: Ks,
844
+ close: Js,
845
+ docs: va,
846
+ enter_full_screen: ra,
847
+ exit_full_screen: na,
848
+ github: _a,
849
+ hello_world: Ns,
850
+ hide_all_annotations: ze,
851
+ hide_annotations: ia,
852
+ hide_gallery: sa,
853
+ iiif_manifest_label: pa,
854
+ license: Ws,
855
+ load: ba,
856
+ loading: Us,
857
+ manifest_placeholder: ma,
858
+ menu: Zs,
859
+ metadata: ca,
860
+ metadata_label_fallback: Qs,
861
+ next_canvas: ha,
862
+ no_annotations_available: ua,
863
+ no_content: ga,
864
+ previous_canvas: fa,
865
+ search: ea,
866
+ search_panel_close: Bs,
867
+ search_panel_instruction: Ys,
868
+ search_panel_no_results: qs,
869
+ search_panel_placeholder: Os,
870
+ search_panel_results_count: Xs,
871
+ search_panel_title: Vs,
872
+ show_all_annotations: Re,
873
+ show_annotations: oa,
874
+ show_gallery: aa,
875
+ toggle_annotations: la,
876
+ toggle_metadata: da,
877
+ toggle_search: ta,
878
+ visible_count: De
879
+ }, Symbol.toStringTag, { value: "Module" }));
880
+ let He = e.state(e.proxy(M()));
881
+ const xa = {
882
+ get current() {
883
+ return e.get(He);
884
+ }
885
+ }, F = new Proxy(ya, {
886
+ get(a, t, s) {
887
+ return e.get(He), Reflect.get(a, t, s);
888
+ }
889
+ });
890
+ var wa = e.from_html('<div><button class="btn btn-circle btn-sm btn-ghost"><!></button> <span class="text-sm font-mono tabular-nums"> </span> <button class="btn btn-circle btn-sm btn-ghost"><!></button></div>');
891
+ function Sa(a, t) {
729
892
  e.push(t, !0);
730
- var s = ft(), r = e.child(s);
731
- r.__click = () => t.viewerState.previousCanvas();
732
- var l = e.child(r);
733
- He(l, { size: 20, weight: "bold" }), e.reset(r);
734
- var c = e.sibling(r, 2), C = e.child(c);
735
- e.reset(c);
736
- var m = e.sibling(c, 2);
737
- m.__click = () => t.viewerState.nextCanvas();
738
- var u = e.child(m);
739
- Ne(u, { size: 20, weight: "bold" }), e.reset(m), e.reset(s), e.template_effect(() => {
740
- 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(C, `${t.viewerState.currentCanvasIndex + 1} / ${t.viewerState.canvases.length ?? ""}`), m.disabled = !t.viewerState.hasNext;
741
- }), e.append(i, s), e.pop();
893
+ var s = wa(), n = e.child(s);
894
+ n.__click = () => t.viewerState.previousCanvas();
895
+ var c = e.child(n);
896
+ Qe(c, { size: 20, weight: "bold" }), e.reset(n);
897
+ var g = e.sibling(n, 2), C = e.child(g);
898
+ e.reset(g);
899
+ var y = e.sibling(g, 2);
900
+ y.__click = () => t.viewerState.nextCanvas();
901
+ var b = e.child(y);
902
+ Ue(b, { size: 20, weight: "bold" }), e.reset(y), e.reset(s), e.template_effect(
903
+ (S, k) => {
904
+ 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"}`), n.disabled = !t.viewerState.hasPrevious, e.set_attribute(n, "aria-label", S), e.set_text(C, `${t.viewerState.currentCanvasIndex + 1} / ${t.viewerState.canvases.length ?? ""}`), y.disabled = !t.viewerState.hasNext, e.set_attribute(y, "aria-label", k);
905
+ },
906
+ [() => F.previous_canvas(), () => F.next_canvas()]
907
+ ), e.append(a, s), e.pop();
742
908
  }
743
909
  e.delegate(["click"]);
744
- var ht = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), vt = 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>'), ut = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations available.</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>');
745
- function mt(i, t) {
910
+ var Aa = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), Ia = 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>'), Ta = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations available.</div>'), $a = 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>');
911
+ function ka(a, t) {
746
912
  e.push(t, !0);
747
- const s = me(J);
748
- let r = e.derived(() => {
913
+ const s = xe(ae);
914
+ let n = e.derived(() => {
749
915
  if (!s.manifestId || !s.canvasId)
750
916
  return [];
751
- const n = Z.getAnnotations(s.manifestId, s.canvasId), o = s.currentCanvasSearchAnnotations;
752
- return [...n, ...o];
917
+ const i = se.getAnnotations(s.manifestId, s.canvasId), l = s.currentCanvasSearchAnnotations;
918
+ return [...i, ...l];
753
919
  });
754
- function l(n) {
755
- return n.id || n["@id"] || (typeof n.getId == "function" ? n.getId() : "") || "";
920
+ function c(i) {
921
+ return i.id || i["@id"] || (typeof i.getId == "function" ? i.getId() : "") || "";
756
922
  }
757
923
  e.user_effect(() => {
758
- if (e.get(r).length > 0) {
759
- const n = /* @__PURE__ */ new Set();
760
- e.get(r).forEach((o) => {
761
- const f = l(o);
762
- f && n.add(f);
763
- }), s.visibleAnnotationIds = n;
924
+ if (e.get(n).length > 0) {
925
+ const i = /* @__PURE__ */ new Set();
926
+ e.get(n).forEach((l) => {
927
+ const u = c(l);
928
+ u && i.add(u);
929
+ }), s.visibleAnnotationIds = i;
764
930
  } else
765
931
  s.visibleAnnotationIds = /* @__PURE__ */ new Set();
766
932
  });
767
- let c = e.derived(() => e.get(r).length === 0 ? !1 : e.get(r).every((n) => {
768
- const o = l(n);
769
- return !o || s.visibleAnnotationIds.has(o);
933
+ let g = e.derived(() => e.get(n).length === 0 ? !1 : e.get(n).every((i) => {
934
+ const l = c(i);
935
+ return !l || s.visibleAnnotationIds.has(l);
770
936
  }));
771
- function C(n) {
772
- s.visibleAnnotationIds.has(n) ? s.visibleAnnotationIds.delete(n) : s.visibleAnnotationIds.add(n), s.visibleAnnotationIds = new Set(s.visibleAnnotationIds);
937
+ function C(i) {
938
+ s.visibleAnnotationIds.has(i) ? s.visibleAnnotationIds.delete(i) : s.visibleAnnotationIds.add(i), s.visibleAnnotationIds = new Set(s.visibleAnnotationIds);
773
939
  }
774
- function m() {
775
- if (e.get(c))
940
+ function y() {
941
+ if (e.get(g))
776
942
  s.visibleAnnotationIds = /* @__PURE__ */ new Set();
777
943
  else {
778
- const n = /* @__PURE__ */ new Set();
779
- e.get(r).forEach((o) => {
780
- const f = l(o);
781
- f && n.add(f);
782
- }), s.visibleAnnotationIds = n;
944
+ const i = /* @__PURE__ */ new Set();
945
+ e.get(n).forEach((l) => {
946
+ const u = c(l);
947
+ u && i.add(u);
948
+ }), s.visibleAnnotationIds = i;
783
949
  }
784
950
  }
785
- let u = e.derived(() => e.get(r).length ? e.get(r).map((n) => {
786
- let o = "", f = !1;
787
- if (typeof n.getBody == "function") {
788
- const b = n.getBody();
789
- if (b && b.length) {
790
- const h = (a) => {
791
- const d = a.getValue ? a.getValue() : null;
951
+ let b = e.derived(() => e.get(n).length ? e.get(n).map((i) => {
952
+ let l = "", u = !1;
953
+ if (typeof i.getBody == "function") {
954
+ const T = i.getBody();
955
+ if (T && T.length) {
956
+ const v = (r) => {
957
+ const d = r.getValue ? r.getValue() : null;
792
958
  return d || "";
793
959
  };
794
- o = b.map((a) => h(a)).filter(Boolean).join(" "), f = b.some((a) => {
795
- const d = a.getFormat ? a.getFormat() : "";
960
+ l = T.map((r) => v(r)).filter(Boolean).join(" "), u = T.some((r) => {
961
+ const d = r.getFormat ? r.getFormat() : "";
796
962
  return d === "text/html" || d === "application/html";
797
963
  });
798
964
  }
799
- if (!o && typeof n.getLabel == "function") {
800
- const h = n.getLabel();
801
- h && (o = h);
965
+ if (!l && typeof i.getLabel == "function") {
966
+ const v = i.getLabel();
967
+ v && (l = v);
802
968
  }
803
969
  } else {
804
- const b = (a) => a && (a.chars || a.value || a["cnt:chars"]) || "", h = (a) => a ? a.format === "text/html" || a.type === "TextualBody" : !1;
805
- if (n.resource ? Array.isArray(n.resource) ? (o = n.resource.map((a) => b(a)).join(" "), n.resource.some((a) => h(a)) && (f = !0)) : (o = b(n.resource), h(n.resource) && (f = !0)) : n.body && (Array.isArray(n.body) ? (o = n.body.map((a) => b(a)).join(" "), n.body.some((a) => h(a)) && (f = !0)) : (o = b(n.body), h(n.body) && (f = !0))), !o) {
806
- const a = n.label || n.name || n.title;
807
- a && (o = Array.isArray(a) ? a.join(" ") : a);
970
+ const T = (r) => r && (r.chars || r.value || r["cnt:chars"]) || "", v = (r) => r ? r.format === "text/html" || r.type === "TextualBody" : !1;
971
+ if (i.resource ? Array.isArray(i.resource) ? (l = i.resource.map((r) => T(r)).join(" "), i.resource.some((r) => v(r)) && (u = !0)) : (l = T(i.resource), v(i.resource) && (u = !0)) : i.body && (Array.isArray(i.body) ? (l = i.body.map((r) => T(r)).join(" "), i.body.some((r) => v(r)) && (u = !0)) : (l = T(i.body), v(i.body) && (u = !0))), !l) {
972
+ const r = i.label || i.name || i.title;
973
+ r && (l = Array.isArray(r) ? r.join(" ") : r);
808
974
  }
809
975
  }
810
976
  return {
811
- id: l(n),
812
- content: o,
813
- isHtml: f,
814
- label: (typeof n.getLabel == "function" ? n.getLabel() : n.label) || ""
977
+ id: c(i),
978
+ content: l,
979
+ isHtml: u,
980
+ label: (typeof i.getLabel == "function" ? i.getLabel() : i.label) || ""
815
981
  };
816
982
  }) : []);
817
- var _ = e.comment(), I = e.first_child(_);
983
+ var S = e.comment(), k = e.first_child(S);
818
984
  {
819
- var E = (n) => {
820
- var o = pt(), f = e.child(o), b = e.child(f), h = e.child(b);
821
- h.__click = (v) => {
822
- v.preventDefault(), m();
985
+ var P = (i) => {
986
+ var l = $a(), u = e.child(l), T = e.child(u), v = e.child(T);
987
+ v.__click = (p) => {
988
+ p.preventDefault(), y();
823
989
  };
824
- var a = e.child(h);
990
+ var r = e.child(v);
825
991
  {
826
- var d = (v) => {
827
- ke(v, { size: 16, weight: "bold" });
828
- }, j = (v) => {
829
- Ce(v, { size: 16, weight: "bold" });
992
+ var d = (p) => {
993
+ je(p, { size: 16, weight: "bold" });
994
+ }, w = (p) => {
995
+ Le(p, { size: 16, weight: "bold" });
830
996
  };
831
- e.if(a, (v) => {
832
- e.get(c) ? v(d) : v(j, !1);
997
+ e.if(r, (p) => {
998
+ e.get(g) ? p(d) : p(w, !1);
833
999
  });
834
1000
  }
835
- e.reset(h);
836
- var w = e.sibling(h, 2), k = e.child(w), T = e.sibling(k), S = e.child(T);
837
- e.reset(T), e.reset(w);
838
- var g = e.sibling(w, 2);
839
- Ve(g, {
1001
+ e.reset(v);
1002
+ var m = e.sibling(v, 2), j = e.child(m), L = e.sibling(j), x = e.child(L, !0);
1003
+ e.reset(L), e.reset(m);
1004
+ var _ = e.sibling(m, 2);
1005
+ Ke(_, {
840
1006
  size: 16,
841
1007
  weight: "bold",
842
1008
  class: "group-open:rotate-180 transition-transform opacity-80"
843
- }), e.reset(b);
844
- var x = e.sibling(b, 2);
1009
+ }), e.reset(T);
1010
+ var z = e.sibling(T, 2);
845
1011
  e.each(
846
- x,
1012
+ z,
847
1013
  21,
848
- () => e.get(u),
1014
+ () => e.get(b),
849
1015
  e.index,
850
- (v, p, A) => {
851
- const y = e.derived(() => s.visibleAnnotationIds.has(e.get(p).id));
852
- var M = vt();
853
- M.__click = (P) => {
854
- P.preventDefault(), C(e.get(p).id);
1016
+ (p, o, h) => {
1017
+ const A = e.derived(() => s.visibleAnnotationIds.has(e.get(o).id));
1018
+ var f = Ia();
1019
+ f.__click = (H) => {
1020
+ H.preventDefault(), C(e.get(o).id);
855
1021
  };
856
- var G = e.child(M), z = e.child(G);
1022
+ var R = e.child(f), $ = e.child(R);
857
1023
  {
858
- var N = (P) => {
859
- ke(P, { size: 16, weight: "bold" });
860
- }, K = (P) => {
861
- Ce(P, { size: 16, weight: "bold" });
1024
+ var I = (H) => {
1025
+ je(H, { size: 16, weight: "bold" });
1026
+ }, E = (H) => {
1027
+ Le(H, { size: 16, weight: "bold" });
862
1028
  };
863
- e.if(z, (P) => {
864
- e.get(y) ? P(N) : P(K, !1);
1029
+ e.if($, (H) => {
1030
+ e.get(A) ? H(I) : H(E, !1);
865
1031
  });
866
1032
  }
867
- e.reset(G);
868
- var q = e.sibling(G, 2), Q = e.child(q), W = e.child(Q);
869
- W.textContent = `#${A + 1}`;
870
- var V = e.sibling(W, 2);
1033
+ e.reset(R);
1034
+ var N = e.sibling(R, 2), V = e.child(N), B = e.child(V);
1035
+ B.textContent = `#${h + 1}`;
1036
+ var D = e.sibling(B, 2);
871
1037
  {
872
- var R = (P) => {
873
- var O = ht(), U = e.child(O, !0);
874
- e.reset(O), e.template_effect(() => e.set_text(U, e.get(p).label)), e.append(P, O);
1038
+ var O = (H) => {
1039
+ var X = Aa(), W = e.child(X, !0);
1040
+ e.reset(X), e.template_effect(() => e.set_text(W, e.get(o).label)), e.append(H, X);
875
1041
  };
876
- e.if(V, (P) => {
877
- e.get(p).label && e.get(p).label !== e.get(p).content && P(R);
1042
+ e.if(D, (H) => {
1043
+ e.get(o).label && e.get(o).label !== e.get(o).content && H(O);
878
1044
  });
879
1045
  }
880
- e.reset(Q);
881
- var F = e.sibling(Q, 2), D = e.child(F);
1046
+ e.reset(V);
1047
+ var q = e.sibling(V, 2), U = e.child(q);
882
1048
  {
883
- var B = (P) => {
884
- var O = e.comment(), U = e.first_child(O);
885
- e.html(U, () => e.get(p).content), e.append(P, O);
886
- }, $ = (P) => {
887
- var O = e.text();
888
- e.template_effect(() => e.set_text(O, e.get(p).content || "(No content)")), e.append(P, O);
1049
+ var K = (H) => {
1050
+ var X = e.comment(), W = e.first_child(X);
1051
+ e.html(W, () => e.get(o).content), e.append(H, X);
1052
+ }, Q = (H) => {
1053
+ var X = e.text();
1054
+ e.template_effect(() => e.set_text(X, e.get(o).content || "(No content)")), e.append(H, X);
889
1055
  };
890
- e.if(D, (P) => {
891
- e.get(p).isHtml ? P(B) : P($, !1);
1056
+ e.if(U, (H) => {
1057
+ e.get(o).isHtml ? H(K) : H(Q, !1);
892
1058
  });
893
1059
  }
894
- e.reset(F), e.reset(q), e.reset(M), e.template_effect(() => e.set_class(F, 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(y) ? "" : "opacity-50"}`)), e.append(v, M);
1060
+ e.reset(q), e.reset(N), e.reset(f), e.template_effect(() => e.set_class(q, 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(A) ? "" : "opacity-50"}`)), e.append(p, f);
895
1061
  },
896
- (v) => {
897
- var p = ut();
898
- e.append(v, p);
1062
+ (p) => {
1063
+ var o = Ta();
1064
+ e.append(p, o);
899
1065
  }
900
- ), e.reset(x), e.reset(f), e.reset(o), e.template_effect(() => {
901
- e.set_attribute(h, "title", e.get(c) ? "Hide All Annotations" : "Show All Annotations"), e.set_text(k, `${e.get(r).length ?? ""} Annotations `), e.set_text(S, `(${s.visibleAnnotationIds.size ?? ""} visible)`);
902
- }), e.append(n, o);
1066
+ ), e.reset(z), e.reset(u), e.reset(l), e.template_effect(
1067
+ (p, o, h) => {
1068
+ e.set_attribute(v, "title", p), e.set_text(j, `${o ?? ""} `), e.set_text(x, h);
1069
+ },
1070
+ [
1071
+ () => e.get(g) ? /* @__PURE__ */ ze() : /* @__PURE__ */ Re(),
1072
+ () => /* @__PURE__ */ Fe({ count: e.get(n).length }),
1073
+ () => /* @__PURE__ */ De({ count: s.visibleAnnotationIds.size })
1074
+ ]
1075
+ ), e.append(i, l);
903
1076
  };
904
- e.if(I, (n) => {
905
- s.showAnnotations && n(E);
1077
+ e.if(k, (i) => {
1078
+ s.showAnnotations && i(P);
906
1079
  });
907
1080
  }
908
- e.append(i, _), e.pop();
1081
+ e.append(a, S), e.pop();
909
1082
  }
910
1083
  e.delegate(["click"]);
911
- var bt = e.from_html('<img class="object-contain w-full h-full" loading="lazy"/>'), _t = e.from_html('<span class="opacity-20 text-4xl">?</span>'), yt = 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>'), xt = 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>'), wt = 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), St = 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);
912
- function At(i, t) {
1084
+ var Ca = e.from_html('<img class="object-contain w-full h-full" loading="lazy"/>'), ja = e.from_html('<span class="opacity-20 text-4xl">?</span>'), La = 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>'), Ma = 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>'), Ea = 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), Ga = 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);
1085
+ function Pa(a, t) {
913
1086
  e.push(t, !0);
914
- const s = me(J);
915
- let r = e.state(e.proxy({ x: 20, y: 100 })), l = e.state(e.proxy({ width: 300, height: 400 })), c = e.state(!1), C = e.state(!1), m = { x: 0, y: 0 }, u = { x: 0, y: 0, w: 0, h: 0 }, _ = e.state(void 0), I = e.derived(() => t.canvases ? t.canvases.map((g, x) => {
916
- let v = "";
1087
+ const s = xe(ae);
1088
+ let n = e.state(e.proxy({ x: 20, y: 100 })), c = e.state(e.proxy({ width: 300, height: 400 })), g = e.state(!1), C = e.state(!1), y = { x: 0, y: 0 }, b = { x: 0, y: 0, w: 0, h: 0 }, S = e.state(void 0), k = e.derived(() => t.canvases ? t.canvases.map((_, z) => {
1089
+ let p = "";
917
1090
  try {
918
- if (g.getCanonicalImageUri)
919
- v = g.getCanonicalImageUri(200);
920
- else if (g.getThumbnail) {
921
- const p = g.getThumbnail();
922
- p && (v = typeof p == "string" ? p : p.id || p["@id"]);
1091
+ if (_.getThumbnail) {
1092
+ const o = _.getThumbnail();
1093
+ o && (p = typeof o == "string" ? o : o.id || o["@id"]);
923
1094
  }
924
- } catch (p) {
925
- console.warn("Error getting thumbnail", p);
1095
+ } catch (o) {
1096
+ console.warn("Error getting thumbnail", o);
926
1097
  }
927
- if (!v) {
928
- const p = g.getImages();
929
- if (p && p.length > 0) {
930
- const A = p[0].getResource();
931
- A && A.getServices().length > 0 ? v = `${A.getServices()[0].id}/full/200,/0/default.jpg` : A && A.id && (v = A.id);
1098
+ if (!p) {
1099
+ let o = _.getImages();
1100
+ if ((!o || !o.length) && _.getContent && (o = _.getContent()), o && o.length > 0) {
1101
+ const h = o[0];
1102
+ let A = h.getResource ? h.getResource() : null;
1103
+ if (!A && h.getBody) {
1104
+ const f = h.getBody();
1105
+ Array.isArray(f) && f.length > 0 ? A = f[0] : f && (A = f);
1106
+ }
1107
+ if (A && !A.id && !A.__jsonld && (!A.getServices || A.getServices().length === 0) && (A = null), !A) {
1108
+ const f = h.__jsonld || h;
1109
+ f.body && (A = Array.isArray(f.body) ? f.body[0] : f.body);
1110
+ }
1111
+ if (A) {
1112
+ const R = (() => {
1113
+ let I = [];
1114
+ if (A.getServices && (I = A.getServices()), !I || I.length === 0) {
1115
+ const E = A.__jsonld || A;
1116
+ E.service && (I = Array.isArray(E.service) ? E.service : [E.service]);
1117
+ }
1118
+ return I;
1119
+ })();
1120
+ let $ = !1;
1121
+ if (R.length > 0) {
1122
+ const I = R[0];
1123
+ let E = "";
1124
+ try {
1125
+ E = I.getProfile ? I.getProfile() : I.profile || "", typeof E == "object" && E !== null && (E = E.value || E.id || E["@id"] || JSON.stringify(E));
1126
+ } catch {
1127
+ }
1128
+ const N = String(E).toLowerCase();
1129
+ (N.includes("level0") || N.includes("level-0")) && ($ = !0);
1130
+ const V = I.id || I["@id"];
1131
+ $ || (p = `${V}/full/200,/0/default.jpg`);
1132
+ }
1133
+ if (!p && (p = A.id || A["@id"], !p)) {
1134
+ let I = null;
1135
+ if (h.__jsonld && h.__jsonld.body ? I = h.__jsonld.body : h.body && (I = h.body), I) {
1136
+ const E = Array.isArray(I) ? I[0] : I;
1137
+ p = E.id || E["@id"];
1138
+ }
1139
+ }
1140
+ }
932
1141
  }
933
1142
  }
934
1143
  return {
935
- id: g.id,
936
- label: g.getLabel().length ? g.getLabel()[0].value : `Canvas ${x + 1}`,
937
- src: v,
938
- index: x
1144
+ id: _.id,
1145
+ label: _.getLabel().length ? _.getLabel()[0].value : `Canvas ${z + 1}`,
1146
+ src: p,
1147
+ index: z
939
1148
  };
940
1149
  }) : []);
941
- function E(g) {
942
- if (!e.get(c)) return;
943
- let x = g.clientX - m.x, v = g.clientY - m.y;
944
- if (e.get(_) && e.get(_).parentElement) {
945
- const p = e.get(_).parentElement, A = Math.max(0, p.clientWidth - e.get(l).width), y = Math.max(0, p.clientHeight - e.get(l).height);
946
- x = Math.max(0, Math.min(x, A)), v = Math.max(0, Math.min(v, y));
1150
+ function P(_) {
1151
+ if (!e.get(g)) return;
1152
+ let z = _.clientX - y.x, p = _.clientY - y.y;
1153
+ if (e.get(S) && e.get(S).parentElement) {
1154
+ const o = e.get(S).parentElement, h = Math.max(0, o.clientWidth - e.get(c).width), A = Math.max(0, o.clientHeight - e.get(c).height);
1155
+ z = Math.max(0, Math.min(z, h)), p = Math.max(0, Math.min(p, A));
947
1156
  }
948
- e.get(r).x = x, e.get(r).y = v;
1157
+ e.get(n).x = z, e.get(n).y = p;
949
1158
  }
950
- function n() {
951
- const g = e.get(d);
952
- e.set(c, !1), e.set(d, null), window.removeEventListener("mousemove", E), window.removeEventListener("mouseup", n), g && e.set(a, g, !0);
1159
+ function i() {
1160
+ const _ = e.get(d);
1161
+ e.set(g, !1), e.set(d, null), window.removeEventListener("mousemove", P), window.removeEventListener("mouseup", i), _ && e.set(r, _, !0);
953
1162
  }
954
- function o(g) {
955
- g.stopPropagation(), e.set(C, !0), u = {
956
- x: g.clientX,
957
- y: g.clientY,
958
- w: e.get(l).width,
959
- h: e.get(l).height
960
- }, window.addEventListener("mousemove", f), window.addEventListener("mouseup", b);
1163
+ function l(_) {
1164
+ _.stopPropagation(), e.set(C, !0), b = {
1165
+ x: _.clientX,
1166
+ y: _.clientY,
1167
+ w: e.get(c).width,
1168
+ h: e.get(c).height
1169
+ }, window.addEventListener("mousemove", u), window.addEventListener("mouseup", T);
961
1170
  }
962
- function f(g) {
1171
+ function u(_) {
963
1172
  if (!e.get(C)) return;
964
- const x = g.clientX - u.x, v = g.clientY - u.y;
965
- e.get(l).width = Math.max(200, u.w + x), e.get(l).height = Math.max(200, u.h + v);
1173
+ const z = _.clientX - b.x, p = _.clientY - b.y;
1174
+ e.get(c).width = Math.max(200, b.w + z), e.get(c).height = Math.max(200, b.h + p);
966
1175
  }
967
- function b() {
968
- e.set(C, !1), window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", b);
1176
+ function T() {
1177
+ e.set(C, !1), window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", T);
969
1178
  }
970
- function h(g) {
971
- s.canvasId = g;
1179
+ function v(_) {
1180
+ s.canvasId = _;
972
1181
  }
973
- let a = e.state("bottom"), d = e.state(null);
1182
+ let r = e.state("bottom"), d = e.state(null);
974
1183
  e.user_effect(() => {
975
- s.dockSide = e.get(a), s.isGalleryDockedBottom = e.get(a) === "bottom", s.isGalleryDockedRight = e.get(a) === "right";
1184
+ s.dockSide = e.get(r), s.isGalleryDockedBottom = e.get(r) === "bottom", s.isGalleryDockedRight = e.get(r) === "right";
976
1185
  });
977
- let j = e.derived(() => e.get(a) === "top" || e.get(a) === "bottom" || e.get(a) === "none" && e.get(l).height < 320);
978
- function w(g) {
979
- var x, v;
980
- if (!g.target.closest(".resize-handle")) {
981
- if (e.get(a) !== "none") {
982
- e.set(a, "none");
983
- const p = ((v = (x = e.get(_)) == null ? void 0 : x.parentElement) == null ? void 0 : v.getBoundingClientRect()) || { left: 0, top: 0 };
984
- e.set(l, { width: 300, height: 400 }, !0), e.set(
985
- r,
1186
+ let w = e.derived(() => e.get(r) === "top" || e.get(r) === "bottom" || e.get(r) === "none" && e.get(c).height < 320);
1187
+ function m(_) {
1188
+ var z, p;
1189
+ if (!_.target.closest(".resize-handle")) {
1190
+ if (e.get(r) !== "none") {
1191
+ e.set(r, "none");
1192
+ const o = ((p = (z = e.get(S)) == null ? void 0 : z.parentElement) == null ? void 0 : p.getBoundingClientRect()) || { left: 0, top: 0 };
1193
+ e.set(c, { width: 300, height: 400 }, !0), e.set(
1194
+ n,
986
1195
  {
987
- x: g.clientX - p.left - 150,
1196
+ x: _.clientX - o.left - 150,
988
1197
  // Center width
989
- y: g.clientY - p.top - 20
1198
+ y: _.clientY - o.top - 20
990
1199
  // Offset slightly from top
991
1200
  },
992
1201
  !0
993
1202
  );
994
1203
  }
995
- e.set(c, !0), m = {
996
- x: g.clientX - e.get(r).x,
997
- y: g.clientY - e.get(r).y
998
- }, window.addEventListener("mousemove", E), window.addEventListener("mouseup", n);
1204
+ e.set(g, !0), y = {
1205
+ x: _.clientX - e.get(n).x,
1206
+ y: _.clientY - e.get(n).y
1207
+ }, window.addEventListener("mousemove", P), window.addEventListener("mouseup", i);
999
1208
  }
1000
1209
  }
1001
- var k = e.comment(), T = e.first_child(k);
1210
+ var j = e.comment(), L = e.first_child(j);
1002
1211
  {
1003
- var S = (g) => {
1004
- var x = St(), v = e.first_child(x), p = e.child(v);
1005
- p.__click = () => s.toggleThumbnailGallery();
1006
- var A = e.child(p);
1007
- Oe(A, { size: 16, weight: "bold" }), e.reset(p);
1008
- var y = e.sibling(p, 2), M = e.child(y);
1009
- M.__mousedown = w;
1010
- var G = e.child(M);
1011
- e.reset(M), e.reset(y);
1012
- var z = e.sibling(y, 2), N = e.child(z);
1013
- e.each(N, 21, () => e.get(I), e.index, (V, R) => {
1014
- var F = yt();
1015
- F.__click = () => h(e.get(R).id);
1016
- var D = e.child(F), B = e.child(D);
1212
+ var x = (_) => {
1213
+ var z = Ga(), p = e.first_child(z), o = e.child(p);
1214
+ o.__click = () => s.toggleThumbnailGallery();
1215
+ var h = e.child(o);
1216
+ We(h, { size: 16, weight: "bold" }), e.reset(o);
1217
+ var A = e.sibling(o, 2), f = e.child(A);
1218
+ f.__mousedown = m;
1219
+ var R = e.child(f);
1220
+ e.reset(f), e.reset(A);
1221
+ var $ = e.sibling(A, 2), I = e.child($);
1222
+ e.each(I, 21, () => e.get(k), e.index, (D, O) => {
1223
+ var q = La();
1224
+ q.__click = () => v(e.get(O).id);
1225
+ var U = e.child(q), K = e.child(U);
1017
1226
  {
1018
- var $ = (Y) => {
1019
- var X = bt();
1227
+ var Q = (J) => {
1228
+ var Z = Ca();
1020
1229
  e.template_effect(() => {
1021
- e.set_attribute(X, "src", e.get(R).src), e.set_attribute(X, "alt", e.get(R).label);
1022
- }), e.append(Y, X);
1023
- }, P = (Y) => {
1024
- var X = _t();
1025
- e.append(Y, X);
1230
+ e.set_attribute(Z, "src", e.get(O).src), e.set_attribute(Z, "alt", e.get(O).label);
1231
+ }), e.append(J, Z);
1232
+ }, H = (J) => {
1233
+ var Z = ja();
1234
+ e.append(J, Z);
1026
1235
  };
1027
- e.if(B, (Y) => {
1028
- e.get(R).src ? Y($) : Y(P, !1);
1236
+ e.if(K, (J) => {
1237
+ e.get(O).src ? J(Q) : J(H, !1);
1029
1238
  });
1030
1239
  }
1031
- e.reset(D);
1032
- var O = e.sibling(D, 2), U = e.child(O), be = e.child(U);
1033
1240
  e.reset(U);
1034
- var _e = e.sibling(U);
1035
- e.reset(O), e.reset(F), e.template_effect(() => {
1036
- e.set_class(F, 1, `group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 ${e.get(j) ? "w-[140px]" : ""} ${s.canvasId === e.get(R).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(F, "aria-label", `Select canvas ${e.get(R).label ?? ""}`), e.set_text(be, `${e.get(R).index + 1}.`), e.set_text(_e, ` ${e.get(R).label ?? ""}`);
1037
- }), e.append(V, F);
1038
- }), e.reset(N), e.reset(z);
1039
- var K = e.sibling(z, 2);
1241
+ var X = e.sibling(U, 2), W = e.child(X), we = e.child(W);
1242
+ e.reset(W);
1243
+ var Se = e.sibling(W);
1244
+ e.reset(X), e.reset(q), e.template_effect(() => {
1245
+ e.set_class(q, 1, `group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 ${e.get(w) ? "w-[140px]" : ""} ${s.canvasId === e.get(O).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(q, "aria-label", `Select canvas ${e.get(O).label ?? ""}`), e.set_text(we, `${e.get(O).index + 1}.`), e.set_text(Se, ` ${e.get(O).label ?? ""}`);
1246
+ }), e.append(D, q);
1247
+ }), e.reset(I), e.reset($);
1248
+ var E = e.sibling($, 2);
1040
1249
  {
1041
- var q = (V) => {
1042
- var R = xt();
1043
- R.__mousedown = o, e.append(V, R);
1250
+ var N = (D) => {
1251
+ var O = Ma();
1252
+ O.__mousedown = l, e.append(D, O);
1044
1253
  };
1045
- e.if(K, (V) => {
1046
- e.get(a) === "none" && V(q);
1254
+ e.if(E, (D) => {
1255
+ e.get(r) === "none" && D(N);
1047
1256
  });
1048
1257
  }
1049
- e.reset(v), e.bind_this(v, (V) => e.set(_, V), () => e.get(_));
1050
- var Q = e.sibling(v, 2);
1258
+ e.reset(p), e.bind_this(p, (D) => e.set(S, D), () => e.get(S));
1259
+ var V = e.sibling(p, 2);
1051
1260
  {
1052
- var W = (V) => {
1053
- var R = wt(), F = e.first_child(R), D = e.sibling(F, 2), B = e.sibling(D, 2), $ = e.sibling(B, 2);
1261
+ var B = (D) => {
1262
+ var O = Ea(), q = e.first_child(O), U = e.sibling(q, 2), K = e.sibling(U, 2), Q = e.sibling(K, 2);
1054
1263
  e.template_effect(() => {
1055
- e.set_class(F, 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(D, 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($, 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"}`);
1056
- }), e.event("mouseenter", F, () => e.set(d, "top")), e.event("mouseleave", F, () => e.set(d, null)), e.event("mouseenter", D, () => e.set(d, "bottom")), e.event("mouseleave", D, () => e.set(d, null)), e.event("mouseenter", B, () => e.set(d, "left")), e.event("mouseleave", B, () => e.set(d, null)), e.event("mouseenter", $, () => e.set(d, "right")), e.event("mouseleave", $, () => e.set(d, null)), e.append(V, R);
1264
+ e.set_class(q, 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(U, 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(K, 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"}`);
1265
+ }), e.event("mouseenter", q, () => e.set(d, "top")), e.event("mouseleave", q, () => e.set(d, null)), e.event("mouseenter", U, () => e.set(d, "bottom")), e.event("mouseleave", U, () => e.set(d, null)), e.event("mouseenter", K, () => e.set(d, "left")), e.event("mouseleave", K, () => e.set(d, null)), e.event("mouseenter", Q, () => e.set(d, "right")), e.event("mouseleave", Q, () => e.set(d, null)), e.append(D, O);
1057
1266
  };
1058
- e.if(Q, (V) => {
1059
- e.get(c) && V(W);
1267
+ e.if(V, (D) => {
1268
+ e.get(g) && D(B);
1060
1269
  });
1061
1270
  }
1062
1271
  e.template_effect(() => {
1063
- 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
1064
- ${e.get(a) === "bottom" ? "flex-row bottom-0 left-0 right-0 h-[140px] border-t" : ""}
1065
- ${e.get(a) === "top" ? "flex-row top-0 left-0 right-0 h-[140px] border-b" : ""}
1066
- ${e.get(a) === "left" ? "flex-col left-0 top-0 bottom-0 w-[200px] border-r" : ""}
1067
- ${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(c) ? " 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(l).width}px; height: ${e.get(l).height}px;`), e.set_class(y, 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(M, 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(G, 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(z, 1, `flex-1 p-1 bg-base-100 ${e.get(j) ? "overflow-x-auto overflow-y-hidden" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(N, 1, e.clsx(e.get(j) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(N, e.get(j) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
1068
- }), e.append(g, x);
1272
+ e.set_class(p, 1, (e.get(r) !== "none" ? `absolute z-900 bg-base-100 shadow-xl border-base-300 flex transition-all duration-200
1273
+ ${e.get(r) === "bottom" ? "flex-row bottom-0 left-0 right-0 h-[140px] border-t" : ""}
1274
+ ${e.get(r) === "top" ? "flex-row top-0 left-0 right-0 h-[140px] border-b" : ""}
1275
+ ${e.get(r) === "left" ? "flex-col left-0 top-0 bottom-0 w-[200px] border-r" : ""}
1276
+ ${e.get(r) === "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(g) ? " pointer-events-none opacity-80" : "")), e.set_style(p, e.get(r) !== "none" ? "" : `left: ${e.get(n).x}px; top: ${e.get(n).y}px; width: ${e.get(c).width}px; height: ${e.get(c).height}px;`), e.set_class(A, 1, "bg-base-100 flex shrink-0 select-none relative " + (e.get(r) === "bottom" || e.get(r) === "top" ? "flex-row h-full items-center border-r border-base-200" : "flex-col w-full border-b border-base-200")), e.set_class(f, 1, "cursor-move flex items-center justify-center hover:bg-base-200/50 active:bg-base-200 transition-colors " + (e.get(r) === "bottom" || e.get(r) === "top" ? "w-8 h-full" : "h-6 w-full")), e.set_class(R, 1, "bg-base-300 rounded-full " + (e.get(r) === "bottom" || e.get(r) === "top" ? "w-1.5 h-12" : "w-12 h-1.5")), e.set_class($, 1, `flex-1 p-1 bg-base-100 ${e.get(w) ? "overflow-x-auto overflow-y-hidden" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(I, 1, e.clsx(e.get(w) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(I, e.get(w) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
1277
+ }), e.append(_, z);
1069
1278
  };
1070
- e.if(T, (g) => {
1071
- s.showThumbnailGallery && g(S);
1279
+ e.if(L, (_) => {
1280
+ s.showThumbnailGallery && _(x);
1072
1281
  });
1073
1282
  }
1074
- e.append(i, k), e.pop();
1283
+ e.append(a, j), e.pop();
1075
1284
  }
1076
1285
  e.delegate(["click", "mousedown"]);
1077
- var It = 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>');
1078
- function kt(i, t) {
1286
+ var za = e.from_html('<div><div tabindex="0" role="button" class="btn btn-lg btn-primary btn-circle shadow-xl"><!></div> <div class="fab-close tooltip tooltip-top"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-top"><button><!></button></div> <div class="tooltip tooltip-top"><button><!></button></div></div>');
1287
+ function Ra(a, t) {
1079
1288
  e.push(t, !1);
1080
- const s = me(J);
1289
+ const s = xe(ae);
1081
1290
  e.init();
1082
- var r = It(), l = e.child(r), c = e.child(l);
1083
- $e(c, { size: 32, weight: "bold" }), e.reset(l);
1084
- var C = e.sibling(l, 2), m = e.child(C);
1085
- m.__click = () => s.toggleSearchPanel();
1086
- var u = e.child(m);
1087
- Me(u, { size: 28, weight: "bold" }), e.reset(m), e.reset(C);
1088
- var _ = e.sibling(C, 2), I = e.child(_);
1089
- I.__click = () => s.toggleThumbnailGallery();
1090
- var E = e.child(I);
1091
- Qe(E, { size: 28, weight: "bold" }), e.reset(I), e.reset(_);
1092
- var n = e.sibling(_, 2), o = e.child(n);
1093
- o.__click = () => s.toggleFullScreen();
1094
- var f = e.child(o);
1291
+ var n = za(), c = e.child(n), g = e.child(c);
1292
+ st(g, { size: 32, weight: "bold" }), e.reset(c);
1293
+ var C = e.sibling(c, 2), y = e.child(C);
1294
+ y.__click = () => s.toggleSearchPanel();
1295
+ var b = e.child(y);
1296
+ Ge(b, { size: 28, weight: "bold" }), e.reset(y), e.reset(C);
1297
+ var S = e.sibling(C, 2), k = e.child(S);
1298
+ k.__click = () => s.toggleThumbnailGallery();
1299
+ var P = e.child(k);
1300
+ at(P, { size: 28, weight: "bold" }), e.reset(k), e.reset(S);
1301
+ var i = e.sibling(S, 2), l = e.child(i);
1302
+ l.__click = () => s.toggleFullScreen();
1303
+ var u = e.child(l);
1095
1304
  {
1096
- var b = (S) => {
1097
- Ye(S, { size: 28, weight: "bold" });
1098
- }, h = (S) => {
1099
- Xe(S, { size: 28, weight: "bold" });
1305
+ var T = (x) => {
1306
+ Ze(x, { size: 28, weight: "bold" });
1307
+ }, v = (x) => {
1308
+ et(x, { size: 28, weight: "bold" });
1100
1309
  };
1101
- e.if(f, (S) => {
1102
- s.isFullScreen ? S(b) : S(h, !1);
1310
+ e.if(u, (x) => {
1311
+ s.isFullScreen ? x(T) : x(v, !1);
1103
1312
  });
1104
1313
  }
1105
- e.reset(o), e.reset(n);
1106
- var a = e.sibling(n, 2), d = e.child(a);
1314
+ e.reset(l), e.reset(i);
1315
+ var r = e.sibling(i, 2), d = e.child(r);
1107
1316
  d.__click = () => s.toggleAnnotations();
1108
- var j = e.child(d);
1109
- Be(j, { size: 28, weight: "bold" }), e.reset(d), e.reset(a);
1110
- var w = e.sibling(a, 2), k = e.child(w);
1111
- k.__click = () => s.toggleMetadataDialog();
1112
- var T = e.child(k);
1113
- qe(T, { size: 28, weight: "bold" }), e.reset(k), e.reset(w), e.reset(r), e.template_effect(() => {
1114
- 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(m, 1, e.clsx([
1115
- "btn btn-circle btn-lg shadow-lg",
1116
- s.showSearchPanel && "btn-primary",
1117
- !s.showSearchPanel && "btn-neutral"
1118
- ])), e.set_attribute(_, "data-tip", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_attribute(I, "aria-label", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_class(I, 1, `btn btn-lg btn-circle shadow-lg ${s.showThumbnailGallery ? "btn-info" : "btn-neutral"}`), e.set_attribute(n, "data-tip", s.isFullScreen ? "Exit Full Screen" : "Enter Full Screen"), e.set_class(o, 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(k, 1, `btn btn-lg btn-circle shadow-lg ${s.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
1119
- }), e.append(i, r), e.pop();
1317
+ var w = e.child(d);
1318
+ Je(w, { size: 28, weight: "bold" }), e.reset(d), e.reset(r);
1319
+ var m = e.sibling(r, 2), j = e.child(m);
1320
+ j.__click = () => s.toggleMetadataDialog();
1321
+ var L = e.child(j);
1322
+ tt(L, { size: 28, weight: "bold" }), e.reset(j), e.reset(m), e.reset(n), e.template_effect(
1323
+ (x, _, z, p, o, h, A, f, R, $) => {
1324
+ e.set_class(n, 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_attribute(n, "data-tip", x), e.set_attribute(C, "data-tip", _), e.set_attribute(y, "aria-label", z), e.set_class(y, 1, e.clsx([
1325
+ "btn btn-circle btn-lg shadow-lg",
1326
+ s.showSearchPanel && "btn-primary",
1327
+ !s.showSearchPanel && "btn-neutral"
1328
+ ])), e.set_attribute(S, "data-tip", p), e.set_attribute(k, "aria-label", o), e.set_class(k, 1, `btn btn-lg btn-circle shadow-lg ${s.showThumbnailGallery ? "btn-info" : "btn-neutral"}`), e.set_attribute(i, "data-tip", h), e.set_class(l, 1, `btn btn-circle btn-lg shadow-lg transition-all duration-300 ease-out ${s.isFullScreen ? "btn-warning" : "btn-neutral"}`), e.set_attribute(r, "data-tip", A), e.set_attribute(d, "aria-label", f), e.set_class(d, 1, `btn btn-lg btn-circle shadow-lg ${s.showAnnotations ? "btn-error" : "btn-neutral"}`), e.set_attribute(m, "data-tip", R), e.set_attribute(j, "aria-label", $), e.set_class(j, 1, `btn btn-lg btn-circle shadow-lg ${s.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
1329
+ },
1330
+ [
1331
+ () => F.menu(),
1332
+ () => F.search(),
1333
+ () => F.toggle_search(),
1334
+ () => s.showThumbnailGallery ? F.hide_gallery() : F.show_gallery(),
1335
+ () => s.showThumbnailGallery ? F.hide_gallery() : F.show_gallery(),
1336
+ () => s.isFullScreen ? F.exit_full_screen() : F.enter_full_screen(),
1337
+ () => s.showAnnotations ? F.hide_annotations() : F.show_annotations(),
1338
+ () => F.toggle_annotations(),
1339
+ () => F.metadata(),
1340
+ () => F.toggle_metadata()
1341
+ ]
1342
+ ), e.append(a, n), e.pop();
1120
1343
  }
1121
1344
  e.delegate(["click"]);
1122
- var Ct = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), jt = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6">Attribution</dt> <dd class="text-sm ps-2"><!></dd>', 1), Tt = 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), Mt = 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>');
1123
- function Et(i, t) {
1345
+ var Fa = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), Da = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), Ha = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><a target="_blank" rel="noreferrer" class="link link-primary break-all"> </a></dd>', 1), Na = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), Va = 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"> </button></form></div></div> <form method="dialog" class="modal-backdrop"><button> </button></form></dialog>');
1346
+ function Ba(a, t) {
1124
1347
  e.push(t, !0);
1125
- const s = me(J);
1126
- let r = e.derived(() => s.manifest), l = e.derived(() => {
1127
- if (!e.get(r)) return [];
1128
- const A = e.get(r).getMetadata();
1129
- return A ? A.map((y) => {
1130
- let M = "", G = "";
1131
- if (y.getLabel) {
1132
- const z = y.getLabel();
1133
- Array.isArray(z) ? M = z.map((N) => N.value).join(" ") : M = z;
1134
- } else y.label && (typeof y.label == "string" ? M = y.label : Array.isArray(y.label) ? M = y.label.map((z) => z.value).join(" ") : M = String(y.label));
1135
- if (y.getValue) {
1136
- const z = y.getValue();
1137
- Array.isArray(z) ? G = z.map((N) => N.value).join(" ") : G = z;
1138
- } else y.value && (typeof y.value == "string" ? G = y.value : Array.isArray(y.value) ? G = y.value.map((z) => z.value).join(" ") : G = String(y.value));
1139
- return { label: M, value: G };
1348
+ const s = xe(ae);
1349
+ let n = e.derived(() => s.manifest), c = e.derived(() => {
1350
+ const f = xa.current;
1351
+ if (!e.get(n)) return [];
1352
+ const R = e.get(n).getMetadata();
1353
+ return R ? R.map(($) => {
1354
+ let I = "", E = "";
1355
+ const N = (V) => {
1356
+ if (typeof V == "string") return V;
1357
+ if (Array.isArray(V)) {
1358
+ let B = V.find((D) => D.locale === f || D.language === f);
1359
+ return B || (B = V.find((D) => D.locale === "en" || D.language === "en")), B || (B = V.find((D) => !D.locale && !D.language)), B || (B = V[0]), B ? B.value : "";
1360
+ }
1361
+ return String(V);
1362
+ };
1363
+ return $.getLabel ? I = N($.getLabel()) : $.label && (I = N($.label)), $.getValue ? E = N($.getValue()) : $.value && (E = N($.value)), { label: I, value: E };
1140
1364
  }) : [];
1141
- }), c = e.derived(() => e.get(r) ? e.get(r).getDescription() : ""), C = e.derived(() => {
1142
- var A;
1143
- return e.get(r) ? (A = e.get(r).getRequiredStatement()) == null ? void 0 : A.getValue() : "";
1144
- }), m = e.derived(() => e.get(r) ? e.get(r).getLicense() : "");
1145
- var u = Lt(), _ = e.child(u), I = e.child(_), E = e.child(I);
1146
- E.__click = () => s.toggleMetadataDialog(), e.reset(I);
1147
- var n = e.sibling(I, 2), o = e.child(n, !0);
1148
- e.reset(n);
1149
- var f = e.sibling(n, 2), b = e.child(f);
1365
+ }), g = e.derived(() => e.get(n) ? e.get(n).getDescription() : ""), C = e.derived(() => {
1366
+ var f;
1367
+ return e.get(n) ? (f = e.get(n).getRequiredStatement()) == null ? void 0 : f.getValue() : "";
1368
+ }), y = e.derived(() => e.get(n) ? e.get(n).getLicense() : "");
1369
+ var b = Va(), S = e.child(b), k = e.child(S), P = e.child(k);
1370
+ P.__click = () => s.toggleMetadataDialog(), e.reset(k);
1371
+ var i = e.sibling(k, 2), l = e.child(i, !0);
1372
+ e.reset(i);
1373
+ var u = e.sibling(i, 2), T = e.child(u);
1150
1374
  {
1151
- var h = (A) => {
1152
- var y = Ct(), M = e.child(y), G = e.child(M);
1153
- e.html(G, () => e.get(c)), e.reset(M), e.reset(y), e.append(A, y);
1375
+ var v = (f) => {
1376
+ var R = Fa(), $ = e.child(R), I = e.child($);
1377
+ e.html(I, () => e.get(g)), e.reset($), e.reset(R), e.append(f, R);
1154
1378
  };
1155
- e.if(b, (A) => {
1156
- e.get(c) && A(h);
1379
+ e.if(T, (f) => {
1380
+ e.get(g) && f(v);
1157
1381
  });
1158
1382
  }
1159
- var a = e.sibling(b, 2), d = e.child(a);
1383
+ var r = e.sibling(T, 2), d = e.child(r);
1160
1384
  {
1161
- var j = (A) => {
1162
- var y = jt(), M = e.sibling(e.first_child(y), 2), G = e.child(M);
1163
- e.html(G, () => e.get(C)), e.reset(M), e.append(A, y);
1385
+ var w = (f) => {
1386
+ var R = Da(), $ = e.first_child(R), I = e.child($, !0);
1387
+ e.reset($);
1388
+ var E = e.sibling($, 2), N = e.child(E);
1389
+ e.html(N, () => e.get(C)), e.reset(E), e.template_effect((V) => e.set_text(I, V), [() => F.attribution()]), e.append(f, R);
1164
1390
  };
1165
- e.if(d, (A) => {
1166
- e.get(C) && A(j);
1391
+ e.if(d, (f) => {
1392
+ e.get(C) && f(w);
1167
1393
  });
1168
1394
  }
1169
- var w = e.sibling(d, 2);
1395
+ var m = e.sibling(d, 2);
1170
1396
  {
1171
- var k = (A) => {
1172
- var y = Tt(), M = e.sibling(e.first_child(y), 2), G = e.child(M), z = e.child(G, !0);
1173
- e.reset(G), e.reset(M), e.template_effect(() => {
1174
- e.set_attribute(G, "href", e.get(m)), e.set_text(z, e.get(m));
1175
- }), e.append(A, y);
1397
+ var j = (f) => {
1398
+ var R = Ha(), $ = e.first_child(R), I = e.child($, !0);
1399
+ e.reset($);
1400
+ var E = e.sibling($, 2), N = e.child(E), V = e.child(N, !0);
1401
+ e.reset(N), e.reset(E), e.template_effect(
1402
+ (B) => {
1403
+ e.set_text(I, B), e.set_attribute(N, "href", e.get(y)), e.set_text(V, e.get(y));
1404
+ },
1405
+ [() => F.license()]
1406
+ ), e.append(f, R);
1176
1407
  };
1177
- e.if(w, (A) => {
1178
- e.get(m) && A(k);
1408
+ e.if(m, (f) => {
1409
+ e.get(y) && f(j);
1179
1410
  });
1180
1411
  }
1181
- var T = e.sibling(w, 2);
1182
- e.each(T, 17, () => e.get(l), e.index, (A, y) => {
1183
- var M = Mt(), G = e.first_child(M), z = e.child(G, !0);
1184
- e.reset(G);
1185
- var N = e.sibling(G, 2), K = e.child(N);
1186
- e.html(K, () => e.get(y).value), e.reset(N), e.template_effect(() => e.set_text(z, e.get(y).label)), e.append(A, M);
1187
- }), e.reset(a), e.reset(f);
1188
- var S = e.sibling(f, 2), g = e.child(S), x = e.child(g);
1189
- x.__click = () => s.toggleMetadataDialog(), e.reset(g), e.reset(S), e.reset(_);
1190
- var v = e.sibling(_, 2), p = e.child(v);
1191
- p.__click = () => s.toggleMetadataDialog(), e.reset(v), e.reset(u), e.template_effect(
1192
- (A) => {
1193
- u.open = s.showMetadataDialog, e.set_text(o, A);
1412
+ var L = e.sibling(m, 2);
1413
+ e.each(L, 17, () => e.get(c), e.index, (f, R) => {
1414
+ var $ = Na(), I = e.first_child($), E = e.child(I, !0);
1415
+ e.reset(I);
1416
+ var N = e.sibling(I, 2), V = e.child(N);
1417
+ e.html(V, () => e.get(R).value), e.reset(N), e.template_effect(() => e.set_text(E, e.get(R).label)), e.append(f, $);
1418
+ }), e.reset(r), e.reset(u);
1419
+ var x = e.sibling(u, 2), _ = e.child(x), z = e.child(_);
1420
+ z.__click = () => s.toggleMetadataDialog();
1421
+ var p = e.child(z, !0);
1422
+ e.reset(z), e.reset(_), e.reset(x), e.reset(S);
1423
+ var o = e.sibling(S, 2), h = e.child(o);
1424
+ h.__click = () => s.toggleMetadataDialog();
1425
+ var A = e.child(h, !0);
1426
+ e.reset(h), e.reset(o), e.reset(b), e.template_effect(
1427
+ (f, R, $) => {
1428
+ b.open = s.showMetadataDialog, e.set_text(l, f), e.set_text(p, R), e.set_text(A, $);
1194
1429
  },
1195
1430
  [
1196
- () => e.get(r) ? e.get(r).getLabel().length ? e.get(r).getLabel()[0].value : "Manifest Metadata" : "Loading..."
1431
+ () => e.get(n) ? e.get(n).getLabel().length && e.get(n).getLabel()[0] ? e.get(n).getLabel()[0].value : F.metadata_label_fallback() : F.loading(),
1432
+ () => F.close(),
1433
+ () => F.close()
1197
1434
  ]
1198
- ), e.append(i, u), e.pop();
1435
+ ), e.append(a, b), e.pop();
1199
1436
  }
1200
1437
  e.delegate(["click"]);
1201
- var Gt = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), zt = 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>'), Dt = 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>'), Ft = e.from_html('<div class="leading-relaxed"> </div>'), Ht = 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>'), Nt = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), Vt = 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>');
1202
- function Ot(i, t) {
1438
+ var Oa = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), qa = e.from_html('<div class="flex justify-center p-8"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Ya = e.from_html('<div class="text-center opacity-50 p-4"> </div>'), Xa = e.from_html('<div class="text-center opacity-50 p-4 text-sm"> </div>'), Qa = 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>'), Ua = e.from_html('<div class="leading-relaxed"> </div>'), Ka = 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>'), Wa = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), Ja = 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"><div class="p-4 bg-base-300 flex justify-between items-center shrink-0"><h2 class="font-bold text-lg"> </h2> <button class="btn btn-sm btn-circle btn-ghost">✕</button></div> <div class="p-4 border-b border-base-300 shrink-0"><div class="join w-full"><input type="text" class="input input-bordered join-item w-full"/> <button class="btn btn-primary join-item"><!></button></div></div> <div class="flex-1 overflow-y-auto p-4 space-y-4"><!></div></div>');
1439
+ function Za(a, t) {
1203
1440
  e.push(t, !0);
1204
- const s = me(J);
1205
- let r = e.state(e.proxy(s.searchQuery));
1206
- function l() {
1207
- s.search(e.get(r));
1441
+ const s = xe(ae);
1442
+ let n = e.state(e.proxy(s.searchQuery));
1443
+ function c() {
1444
+ s.search(e.get(n));
1208
1445
  }
1209
- function c(I) {
1210
- I.key === "Enter" && l();
1446
+ function g(k) {
1447
+ k.key === "Enter" && c();
1211
1448
  }
1212
- function C(I) {
1213
- const E = s.canvases[I.canvasIndex];
1214
- E && (s.canvasId = E.id);
1449
+ function C(k) {
1450
+ const P = s.canvases[k.canvasIndex];
1451
+ P && (s.canvasId = P.id);
1215
1452
  }
1216
- var m = e.comment(), u = e.first_child(m);
1453
+ var y = e.comment(), b = e.first_child(y);
1217
1454
  {
1218
- var _ = (I) => {
1219
- var E = Vt(), n = e.child(E), o = e.sibling(e.child(n), 2);
1220
- o.__click = () => s.toggleSearchPanel(), e.reset(n);
1221
- var f = e.sibling(n, 2), b = e.child(f), h = e.child(b);
1222
- e.remove_input_defaults(h), h.__keydown = c;
1223
- var a = e.sibling(h, 2);
1224
- a.__click = l;
1225
- var d = e.child(a);
1455
+ var S = (k) => {
1456
+ var P = Ja(), i = e.child(P), l = e.child(i), u = e.child(l, !0);
1457
+ e.reset(l);
1458
+ var T = e.sibling(l, 2);
1459
+ T.__click = () => s.toggleSearchPanel(), e.reset(i);
1460
+ var v = e.sibling(i, 2), r = e.child(v), d = e.child(r);
1461
+ e.remove_input_defaults(d), d.__keydown = g;
1462
+ var w = e.sibling(d, 2);
1463
+ w.__click = c;
1464
+ var m = e.child(w);
1226
1465
  {
1227
- var j = (x) => {
1228
- var v = Gt();
1229
- e.append(x, v);
1230
- }, w = (x) => {
1231
- Me(x, { size: 20, weight: "bold" });
1466
+ var j = (o) => {
1467
+ var h = Oa();
1468
+ e.append(o, h);
1469
+ }, L = (o) => {
1470
+ Ge(o, { size: 20, weight: "bold" });
1232
1471
  };
1233
- e.if(d, (x) => {
1234
- s.isSearching ? x(j) : x(w, !1);
1472
+ e.if(m, (o) => {
1473
+ s.isSearching ? o(j) : o(L, !1);
1235
1474
  });
1236
1475
  }
1237
- e.reset(a), e.reset(b), e.reset(f);
1238
- var k = e.sibling(f, 2), T = e.child(k);
1476
+ e.reset(w), e.reset(r), e.reset(v);
1477
+ var x = e.sibling(v, 2), _ = e.child(x);
1239
1478
  {
1240
- var S = (x) => {
1241
- var v = zt();
1242
- e.append(x, v);
1243
- }, g = (x) => {
1244
- var v = e.comment(), p = e.first_child(v);
1479
+ var z = (o) => {
1480
+ var h = qa();
1481
+ e.append(o, h);
1482
+ }, p = (o) => {
1483
+ var h = e.comment(), A = e.first_child(h);
1245
1484
  {
1246
- var A = (M) => {
1247
- var G = Pt(), z = e.child(G);
1248
- e.reset(G), e.template_effect(() => e.set_text(z, `No results found for "${s.searchQuery ?? ""}"`)), e.append(M, G);
1249
- }, y = (M) => {
1250
- var G = e.comment(), z = e.first_child(G);
1485
+ var f = ($) => {
1486
+ var I = Ya(), E = e.child(I, !0);
1487
+ e.reset(I), e.template_effect((N) => e.set_text(E, N), [
1488
+ () => F.search_panel_no_results({ query: s.searchQuery })
1489
+ ]), e.append($, I);
1490
+ }, R = ($) => {
1491
+ var I = e.comment(), E = e.first_child(I);
1251
1492
  {
1252
- var N = (q) => {
1253
- var Q = Rt();
1254
- e.append(q, Q);
1255
- }, K = (q) => {
1256
- var Q = Nt(), W = e.first_child(Q), V = e.child(W);
1257
- e.reset(W);
1258
- var R = e.sibling(W, 2);
1259
- e.each(R, 17, () => s.searchResults, e.index, (F, D) => {
1260
- var B = Ht();
1261
- B.__click = () => C(e.get(D));
1262
- var $ = e.child(B), P = e.child($), O = e.child(P, !0);
1263
- e.reset(P), e.reset($);
1264
- var U = e.sibling($, 2);
1493
+ var N = (B) => {
1494
+ var D = Xa(), O = e.child(D, !0);
1495
+ e.reset(D), e.template_effect((q) => e.set_text(O, q), [() => F.search_panel_instruction()]), e.append(B, D);
1496
+ }, V = (B) => {
1497
+ var D = Wa(), O = e.first_child(D), q = e.child(O, !0);
1498
+ e.reset(O);
1499
+ var U = e.sibling(O, 2);
1500
+ e.each(U, 17, () => s.searchResults, e.index, (K, Q) => {
1501
+ var H = Ka();
1502
+ H.__click = () => C(e.get(Q));
1503
+ var X = e.child(H), W = e.child(X), we = e.child(W, !0);
1504
+ e.reset(W), e.reset(X);
1505
+ var Se = e.sibling(X, 2);
1265
1506
  {
1266
- var be = (Y) => {
1267
- var X = Dt(), ee = e.child(X), Ee = e.child(ee);
1268
- e.html(Ee, () => e.get(D).before), e.reset(ee);
1269
- var ye = e.sibling(ee, 2), Ge = e.child(ye);
1270
- e.html(Ge, () => e.get(D).match), e.reset(ye);
1271
- var Se = e.sibling(ye, 2), ze = e.child(Se);
1272
- e.html(ze, () => e.get(D).after), e.reset(Se), e.reset(X), e.append(Y, X);
1273
- }, _e = (Y) => {
1274
- var X = Ft(), ee = e.child(X, !0);
1275
- e.reset(X), e.template_effect(() => e.set_text(ee, e.get(D).match)), e.append(Y, X);
1507
+ var J = (te) => {
1508
+ var ee = Qa(), ne = e.child(ee), Ne = e.child(ne);
1509
+ e.html(Ne, () => e.get(Q).before), e.reset(ne);
1510
+ var Ae = e.sibling(ne, 2), Ve = e.child(Ae);
1511
+ e.html(Ve, () => e.get(Q).match), e.reset(Ae);
1512
+ var $e = e.sibling(Ae, 2), Be = e.child($e);
1513
+ e.html(Be, () => e.get(Q).after), e.reset($e), e.reset(ee), e.append(te, ee);
1514
+ }, Z = (te) => {
1515
+ var ee = Ua(), ne = e.child(ee, !0);
1516
+ e.reset(ee), e.template_effect(() => e.set_text(ne, e.get(Q).match)), e.append(te, ee);
1276
1517
  };
1277
- e.if(U, (Y) => {
1278
- e.get(D).type === "hit" ? Y(be) : Y(_e, !1);
1518
+ e.if(Se, (te) => {
1519
+ e.get(Q).type === "hit" ? te(J) : te(Z, !1);
1279
1520
  });
1280
1521
  }
1281
- e.reset(B), e.template_effect(() => e.set_text(O, e.get(D).canvasLabel)), e.append(F, B);
1282
- }), e.template_effect(() => e.set_text(V, `${s.searchResults.length ?? ""} Results`)), e.append(q, Q);
1522
+ e.reset(H), e.template_effect(() => e.set_text(we, e.get(Q).canvasLabel)), e.append(K, H);
1523
+ }), e.template_effect((K) => e.set_text(q, K), [
1524
+ () => F.search_panel_results_count({ count: s.searchResults.length })
1525
+ ]), e.append(B, D);
1283
1526
  };
1284
1527
  e.if(
1285
- z,
1286
- (q) => {
1287
- s.searchResults.length === 0 && !s.searchQuery ? q(N) : q(K, !1);
1528
+ E,
1529
+ (B) => {
1530
+ s.searchResults.length === 0 && !s.searchQuery ? B(N) : B(V, !1);
1288
1531
  },
1289
1532
  !0
1290
1533
  );
1291
1534
  }
1292
- e.append(M, G);
1535
+ e.append($, I);
1293
1536
  };
1294
1537
  e.if(
1295
- p,
1296
- (M) => {
1297
- s.searchResults.length === 0 && s.searchQuery ? M(A) : M(y, !1);
1538
+ A,
1539
+ ($) => {
1540
+ s.searchResults.length === 0 && s.searchQuery ? $(f) : $(R, !1);
1298
1541
  },
1299
1542
  !0
1300
1543
  );
1301
1544
  }
1302
- e.append(x, v);
1545
+ e.append(o, h);
1303
1546
  };
1304
- e.if(T, (x) => {
1305
- s.isSearching ? x(S) : x(g, !1);
1547
+ e.if(_, (o) => {
1548
+ s.isSearching ? o(z) : o(p, !1);
1306
1549
  });
1307
1550
  }
1308
- e.reset(k), e.reset(E), e.bind_value(h, () => e.get(r), (x) => e.set(r, x)), e.append(I, E);
1551
+ e.reset(x), e.reset(P), e.template_effect(
1552
+ (o, h, A, f, R) => {
1553
+ e.set_attribute(P, "aria-label", o), e.set_text(u, h), e.set_attribute(T, "aria-label", A), e.set_attribute(d, "placeholder", f), e.set_attribute(w, "aria-label", R);
1554
+ },
1555
+ [
1556
+ () => F.search_panel_title(),
1557
+ () => F.search_panel_title(),
1558
+ () => F.search_panel_close(),
1559
+ () => F.search_panel_placeholder(),
1560
+ () => F.search_panel_title()
1561
+ ]
1562
+ ), e.bind_value(d, () => e.get(n), (o) => e.set(n, o)), e.append(k, P);
1309
1563
  };
1310
- e.if(u, (I) => {
1311
- s.showSearchPanel && I(_);
1564
+ e.if(b, (k) => {
1565
+ s.showSearchPanel && k(S);
1312
1566
  });
1313
1567
  }
1314
- e.append(i, m), e.pop();
1568
+ e.append(a, y), e.pop();
1315
1569
  }
1316
1570
  e.delegate(["click", "keydown"]);
1317
- var Bt = e.from_html('<span class="loading loading-spinner loading-lg text-primary"></span>'), Yt = e.from_html('<div class="text-error"> </div>'), Xt = e.from_html('<div class="text-base-content/50">No image found</div>'), qt = e.from_html("<!> <!>", 1), $t = e.from_html('<div id="triiiceratops-viewer" class="w-full h-full relative bg-base-100 flex items-center justify-center"><!> <!> <!> <!> <!> <!></div>');
1318
- function gs(i, t) {
1571
+ var en = e.from_html('<span class="loading loading-spinner loading-lg text-primary"></span>'), tn = e.from_html('<div class="text-error"> </div>'), sn = e.from_html('<div class="text-base-content/50">No image found</div>'), an = e.from_html("<!> <!>", 1), nn = e.from_html('<div id="triiiceratops-viewer" class="w-full h-full relative bg-base-100 flex items-center justify-center"><!> <!> <!> <!> <!> <!></div>');
1572
+ function An(a, t) {
1319
1573
  e.push(t, !0);
1320
- const s = new We();
1321
- De(J, s), e.user_effect(() => {
1574
+ const s = new rt();
1575
+ Ye(ae, s), e.user_effect(() => {
1322
1576
  t.manifestId && s.setManifest(t.manifestId);
1323
1577
  }), e.user_effect(() => {
1324
- const a = () => {
1578
+ const r = () => {
1325
1579
  s.isFullScreen = !!document.fullscreenElement;
1326
1580
  };
1327
- return document.addEventListener("fullscreenchange", a), () => {
1328
- document.removeEventListener("fullscreenchange", a);
1581
+ return document.addEventListener("fullscreenchange", r), () => {
1582
+ document.removeEventListener("fullscreenchange", r);
1329
1583
  };
1330
1584
  });
1331
- let r = e.derived(() => s.manifest), l = e.derived(() => s.canvases), c = e.derived(() => s.currentCanvasIndex), C = e.derived(() => {
1332
- if (!e.get(l) || e.get(c) === -1 || !e.get(l)[e.get(c)])
1333
- return console.log("TriiiceratopsViewer: No canvas found"), null;
1334
- const d = e.get(l)[e.get(c)].getImages();
1335
- if (!d || !d.length)
1336
- return console.log("TriiiceratopsViewer: No images in canvas"), null;
1337
- const w = d[0].getResource();
1338
- if (!w)
1339
- return console.log("TriiiceratopsViewer: No resource in annotation"), null;
1340
- const k = w.getService();
1341
- if (k) {
1342
- let g = k.id;
1343
- return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
1585
+ let n = e.derived(() => s.manifest), c = e.derived(() => s.canvases), g = e.derived(() => s.currentCanvasIndex), C = e.derived(() => {
1586
+ var z, p;
1587
+ if (!e.get(c) || e.get(g) === -1 || !e.get(c)[e.get(g)])
1588
+ return (z = e.get(n)) != null && z.isFetching || console.log("TriiiceratopsViewer: No canvas found"), null;
1589
+ const r = e.get(c)[e.get(g)];
1590
+ let d = r.getImages();
1591
+ if ((!d || !d.length) && r.getContent && (d = r.getContent()), !d || !d.length)
1592
+ return r.__jsonld && r.__jsonld.items, (p = e.get(n)) != null && p.isFetching || console.log("TriiiceratopsViewer: No images/content in canvas"), null;
1593
+ const w = d[0];
1594
+ let m = w.getResource ? w.getResource() : null;
1595
+ if (!m && w.getBody) {
1596
+ const o = w.getBody();
1597
+ Array.isArray(o) && o.length > 0 ? m = o[0] : o && (m = o);
1598
+ }
1599
+ if (m && !m.id && !m.__jsonld && (!m.getServices || m.getServices().length === 0) && (m = null), !m) {
1600
+ const o = w.__jsonld || w;
1601
+ o.body && (m = Array.isArray(o.body) ? o.body[0] : o.body);
1602
+ }
1603
+ if (!m)
1604
+ return null;
1605
+ const j = (o) => o.id || o["@id"];
1606
+ let L = [];
1607
+ if (m.getServices && (L = m.getServices()), !L.length) {
1608
+ const o = m.__jsonld || m;
1609
+ o.service && (L = Array.isArray(o.service) ? o.service : [o.service]);
1344
1610
  }
1345
- const T = w.getServices();
1346
- if (T && T.length > 0) {
1347
- let g = T[0].id;
1348
- return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
1611
+ if (L.length > 0) {
1612
+ const o = L.find((h) => {
1613
+ const A = h.getType ? h.getType() : h.type || "", f = h.getProfile ? h.getProfile() : h.profile || "";
1614
+ return A === "ImageService1" || A === "ImageService2" || A === "ImageService3" || typeof f == "string" && f.includes("http://iiif.io/api/image") || typeof f == "string" && f === "level0";
1615
+ });
1616
+ if (o) {
1617
+ let h = j(o);
1618
+ return h && !h.endsWith("/info.json") && (h = `${h}/info.json`), h;
1619
+ }
1349
1620
  }
1350
- if (w.id && w.id.includes("/iiif/")) {
1351
- const g = w.id.split("/"), x = g.findIndex((v) => v === "full" || v.match(/^\d+,\d+,\d+,\d+$/));
1352
- if (x > 0)
1353
- return `${g.slice(0, x).join("/")}/info.json`;
1621
+ const x = j(m);
1622
+ if (x && x.includes("/iiif/")) {
1623
+ const o = x.split("/"), h = o.findIndex((A) => A === "full" || A.match(/^\d+,\d+,\d+,\d+$/));
1624
+ if (h > 0)
1625
+ return `${o.slice(0, h).join("/")}/info.json`;
1354
1626
  }
1355
- return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: w.id };
1627
+ return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: x };
1356
1628
  });
1357
- var m = $t(), u = e.child(m);
1629
+ var y = nn(), b = e.child(y);
1358
1630
  {
1359
- var _ = (a) => {
1360
- var d = Bt();
1361
- e.append(a, d);
1362
- }, I = (a) => {
1363
- var d = e.comment(), j = e.first_child(d);
1631
+ var S = (r) => {
1632
+ var d = en();
1633
+ e.append(r, d);
1634
+ }, k = (r) => {
1635
+ var d = e.comment(), w = e.first_child(d);
1364
1636
  {
1365
- var w = (T) => {
1366
- var S = Yt(), g = e.child(S);
1367
- e.reset(S), e.template_effect(() => e.set_text(g, `Error: ${e.get(r).error ?? ""}`)), e.append(T, S);
1368
- }, k = (T) => {
1369
- var S = e.comment(), g = e.first_child(S);
1637
+ var m = (L) => {
1638
+ var x = tn(), _ = e.child(x);
1639
+ e.reset(x), e.template_effect(() => e.set_text(_, `Error: ${e.get(n).error ?? ""}`)), e.append(L, x);
1640
+ }, j = (L) => {
1641
+ var x = e.comment(), _ = e.first_child(x);
1370
1642
  {
1371
- var x = (p) => {
1372
- var A = e.comment(), y = e.first_child(A);
1373
- e.key(y, () => e.get(C), (M) => {
1374
- dt(M, {
1643
+ var z = (o) => {
1644
+ var h = e.comment(), A = e.first_child(h);
1645
+ e.key(A, () => e.get(C), (f) => {
1646
+ _t(f, {
1375
1647
  get tileSources() {
1376
1648
  return e.get(C);
1377
1649
  },
@@ -1379,69 +1651,69 @@ function gs(i, t) {
1379
1651
  return s;
1380
1652
  }
1381
1653
  });
1382
- }), e.append(p, A);
1383
- }, v = (p) => {
1384
- var A = Xt();
1385
- e.append(p, A);
1654
+ }), e.append(o, h);
1655
+ }, p = (o) => {
1656
+ var h = sn();
1657
+ e.append(o, h);
1386
1658
  };
1387
1659
  e.if(
1388
- g,
1389
- (p) => {
1390
- e.get(C) ? p(x) : p(v, !1);
1660
+ _,
1661
+ (o) => {
1662
+ e.get(C) ? o(z) : o(p, !1);
1391
1663
  },
1392
1664
  !0
1393
1665
  );
1394
1666
  }
1395
- e.append(T, S);
1667
+ e.append(L, x);
1396
1668
  };
1397
1669
  e.if(
1398
- j,
1399
- (T) => {
1400
- var S;
1401
- (S = e.get(r)) != null && S.error ? T(w) : T(k, !1);
1670
+ w,
1671
+ (L) => {
1672
+ var x;
1673
+ (x = e.get(n)) != null && x.error ? L(m) : L(j, !1);
1402
1674
  },
1403
1675
  !0
1404
1676
  );
1405
1677
  }
1406
- e.append(a, d);
1678
+ e.append(r, d);
1407
1679
  };
1408
- e.if(u, (a) => {
1680
+ e.if(b, (r) => {
1409
1681
  var d;
1410
- (d = e.get(r)) != null && d.isFetching ? a(_) : a(I, !1);
1682
+ (d = e.get(n)) != null && d.isFetching ? r(S) : r(k, !1);
1411
1683
  });
1412
1684
  }
1413
- var E = e.sibling(u, 2);
1685
+ var P = e.sibling(b, 2);
1414
1686
  {
1415
- var n = (a) => {
1416
- var d = qt(), j = e.first_child(d);
1417
- gt(j, {
1687
+ var i = (r) => {
1688
+ var d = an(), w = e.first_child(d);
1689
+ Sa(w, {
1418
1690
  get viewerState() {
1419
1691
  return s;
1420
1692
  }
1421
1693
  });
1422
- var w = e.sibling(j, 2);
1423
- At(w, {
1694
+ var m = e.sibling(w, 2);
1695
+ Pa(m, {
1424
1696
  get canvases() {
1425
- return e.get(l);
1697
+ return e.get(c);
1426
1698
  }
1427
- }), e.append(a, d);
1699
+ }), e.append(r, d);
1428
1700
  };
1429
- e.if(E, (a) => {
1430
- e.get(l).length > 1 && a(n);
1701
+ e.if(P, (r) => {
1702
+ e.get(c).length > 1 && r(i);
1431
1703
  });
1432
1704
  }
1433
- var o = e.sibling(E, 2);
1434
- mt(o, {});
1435
- var f = e.sibling(o, 2);
1436
- Et(f, {});
1437
- var b = e.sibling(f, 2);
1438
- Ot(b, {});
1439
- var h = e.sibling(b, 2);
1440
- kt(h, {}), e.reset(m), e.append(i, m), e.pop();
1705
+ var l = e.sibling(P, 2);
1706
+ ka(l, {});
1707
+ var u = e.sibling(l, 2);
1708
+ Ba(u, {});
1709
+ var T = e.sibling(u, 2);
1710
+ Za(T, {});
1711
+ var v = e.sibling(T, 2);
1712
+ Ra(v, {}), e.reset(y), e.append(a, y), e.pop();
1441
1713
  }
1442
1714
  export {
1443
- Ue as ManifestsState,
1444
- gs as TriiiceratopsViewer,
1445
- J as VIEWER_STATE_KEY,
1446
- We as ViewerState
1715
+ nt as ManifestsState,
1716
+ An as TriiiceratopsViewer,
1717
+ ae as VIEWER_STATE_KEY,
1718
+ rt as ViewerState
1447
1719
  };