triiiceratops 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,42 +1,43 @@
1
- var ot = Object.defineProperty;
2
- var Ve = (i) => {
1
+ var ft = Object.defineProperty;
2
+ var qe = (i) => {
3
3
  throw TypeError(i);
4
4
  };
5
- var lt = (i, t, r) => t in i ? ot(i, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[t] = r;
6
- var $e = (i, t, r) => lt(i, typeof t != "symbol" ? t + "" : t, r), ct = (i, t, r) => t.has(i) || Ve("Cannot " + r);
7
- var A = (i, t, r) => (ct(i, t, "read from private field"), r ? r.call(i) : t.get(i)), K = (i, t, r) => t.has(i) ? Ve("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, r);
5
+ var ut = (i, t, r) => t in i ? ft(i, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[t] = r;
6
+ var Ne = (i, t, r) => ut(i, typeof t != "symbol" ? t + "" : t, r), gt = (i, t, r) => t.has(i) || qe("Cannot " + r);
7
+ var k = (i, t, r) => (gt(i, t, "read from private field"), r ? r.call(i) : t.get(i)), U = (i, t, r) => t.has(i) ? qe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, r);
8
8
  import "svelte/internal/disclose-version";
9
9
  import * as e from "svelte/internal/client";
10
- import { onMount as dt, getContext as oe, setContext as ft, onDestroy as ut } from "svelte";
11
- import * as gt from "manifesto.js";
12
- import Be from "openseadragon";
13
- import vt from "phosphor-svelte/lib/CaretLeft";
14
- import ht from "phosphor-svelte/lib/CaretRight";
15
- import { m as B, l as pt } from "./plugin-COh2S4OT.js";
16
- import { B as mi } from "./plugin-COh2S4OT.js";
17
- import mt from "phosphor-svelte/lib/CaretDown";
18
- import He from "phosphor-svelte/lib/Eye";
19
- import Ne from "phosphor-svelte/lib/EyeSlash";
20
- import qe from "phosphor-svelte/lib/X";
10
+ import { onMount as ht, getContext as fe, setContext as vt, onDestroy as pt } from "svelte";
11
+ import * as mt from "manifesto.js";
12
+ import Qe from "openseadragon";
13
+ import bt from "phosphor-svelte/lib/CaretLeft";
14
+ import _t from "phosphor-svelte/lib/CaretRight";
15
+ import { m as V, l as yt } from "./plugin-DMqSBxJD.js";
16
+ import { B as zi } from "./plugin-DMqSBxJD.js";
17
+ import wt from "phosphor-svelte/lib/CaretDown";
18
+ import We from "phosphor-svelte/lib/Eye";
19
+ import Ue from "phosphor-svelte/lib/EyeSlash";
20
+ import Be from "phosphor-svelte/lib/X";
21
21
  import "svelte/internal/flags/legacy";
22
- import bt from "phosphor-svelte/lib/ChatCenteredText";
23
- import _t from "phosphor-svelte/lib/CornersIn";
24
- import yt from "phosphor-svelte/lib/CornersOut";
25
- import wt from "phosphor-svelte/lib/Info";
26
- import Qe from "phosphor-svelte/lib/MagnifyingGlass";
27
- import xt from "phosphor-svelte/lib/List";
28
- import St from "phosphor-svelte/lib/Slideshow";
29
- import At from "phosphor-svelte/lib/PuzzlePiece";
30
- var de;
31
- class It {
22
+ import xt from "phosphor-svelte/lib/ChatCenteredText";
23
+ import St from "phosphor-svelte/lib/CornersIn";
24
+ import At from "phosphor-svelte/lib/CornersOut";
25
+ import It from "phosphor-svelte/lib/Info";
26
+ import Ze from "phosphor-svelte/lib/MagnifyingGlass";
27
+ import Ct from "phosphor-svelte/lib/List";
28
+ import kt from "phosphor-svelte/lib/Slideshow";
29
+ import Pt from "phosphor-svelte/lib/PuzzlePiece";
30
+ import "phosphor-svelte/lib/Spinner";
31
+ var ge;
32
+ class Mt {
32
33
  constructor() {
33
- K(this, de, e.state(e.proxy({})));
34
+ U(this, ge, e.state(e.proxy({})));
34
35
  }
35
36
  get manifests() {
36
- return e.get(A(this, de));
37
+ return e.get(k(this, ge));
37
38
  }
38
39
  set manifests(t) {
39
- e.set(A(this, de), t, !0);
40
+ e.set(k(this, ge), t, !0);
40
41
  }
41
42
  async fetchManifest(t) {
42
43
  if (!this.manifests[t]) {
@@ -45,7 +46,7 @@ class It {
45
46
  const r = await fetch(t);
46
47
  if (!r.ok)
47
48
  throw new Error(`HTTP error! status: ${r.status}`);
48
- const s = await r.json(), n = gt.parseManifest(s);
49
+ const s = await r.json(), n = mt.parseManifest(s);
49
50
  this.manifests[t] = { json: s, manifesto: n, isFetching: !1 };
50
51
  } catch (r) {
51
52
  this.manifests[t] = { error: r.message, isFetching: !1 };
@@ -87,171 +88,235 @@ class It {
87
88
  const n = s.getSequences()[0].getCanvasById(r);
88
89
  if (!n) return [];
89
90
  const a = n.__jsonld;
90
- let y = [];
91
- const I = (c) => c.resources || c.items || [];
92
- return a.otherContent && a.otherContent.forEach((c) => {
93
- const w = c["@id"] || c.id;
94
- if (w && !c.resources) {
95
- const k = this.manifests[w];
96
- if (k) {
97
- if (k.json) {
98
- const z = I(k.json);
99
- y.push(...z);
91
+ let S = [];
92
+ const P = (_) => _.resources || _.items || [];
93
+ return a.otherContent && a.otherContent.forEach((_) => {
94
+ const I = _["@id"] || _.id;
95
+ if (I && !_.resources) {
96
+ const u = this.manifests[I];
97
+ if (u) {
98
+ if (u.json) {
99
+ const R = P(u.json);
100
+ S.push(...R);
100
101
  }
101
102
  } else
102
- this.fetchAnnotationList(w);
103
- } else c.resources && y.push(...c.resources);
104
- }), a.annotations && a.annotations.forEach((c) => {
105
- const w = c.id || c["@id"];
106
- if (w && !c.items) {
107
- const k = this.manifests[w];
108
- if (k) {
109
- if (k.json) {
110
- const z = I(k.json);
111
- y.push(...z);
103
+ this.fetchAnnotationList(I);
104
+ } else _.resources && S.push(..._.resources);
105
+ }), a.annotations && a.annotations.forEach((_) => {
106
+ const I = _.id || _["@id"];
107
+ if (I && !_.items) {
108
+ const u = this.manifests[I];
109
+ if (u) {
110
+ if (u.json) {
111
+ const R = P(u.json);
112
+ S.push(...R);
112
113
  }
113
114
  } else
114
- this.fetchAnnotationList(w);
115
- } else c.items && y.push(...c.items);
116
- }), y;
115
+ this.fetchAnnotationList(I);
116
+ } else _.items && S.push(..._.items);
117
+ }), S;
117
118
  }
118
119
  }
119
- de = new WeakMap();
120
- const ae = new It();
121
- var fe, ue, ge, ve, he, pe, me, be, _e, ye, we, xe, Se, Ae, Ie, ke, Ce, Pe, Me, ze, Te, je, Le, Oe;
122
- class kt {
120
+ ge = new WeakMap();
121
+ const le = new Mt();
122
+ var he, ve, pe, me, be, _e, ye, we, xe, Se, Ae, Ie, Ce, ke, Pe, Me, Te, ze, je, Le, Re, De, Ee, Oe, Ge, Ve;
123
+ class Tt {
123
124
  constructor(t = null, r = null, s = []) {
124
- K(this, fe, e.state(null));
125
- K(this, ue, e.state(null));
126
- K(this, ge, e.state(!1));
127
- K(this, ve, e.state(!1));
128
- K(this, he, e.state(!1));
129
- K(this, pe, e.state(!1));
130
- K(this, me, e.state(!1));
131
- K(this, be, e.state(!1));
132
- K(this, _e, e.state("bottom"));
133
- K(this, ye, e.state(e.proxy(/* @__PURE__ */ new Set())));
134
- K(this, we, e.state(e.proxy({ x: 20, y: 100 })));
135
- K(this, xe, e.state(e.proxy({ width: 300, height: 400 })));
136
- K(this, Se, e.state(!1));
137
- K(this, Ae, e.state(e.proxy({ x: 0, y: 0 })));
138
- K(this, Ie, e.state(null));
139
- K(this, ke, e.state(""));
140
- K(this, Ce, e.state(e.proxy([])));
141
- K(this, Pe, e.state(!1));
142
- K(this, Me, e.state(!1));
143
- K(this, ze, e.state(e.proxy([])));
144
- K(
125
+ U(this, he, e.state(null));
126
+ U(this, ve, e.state(null));
127
+ U(this, pe, e.state(!1));
128
+ U(this, me, e.state(!1));
129
+ U(this, be, e.state(!1));
130
+ U(this, _e, e.state(!1));
131
+ U(this, ye, e.state(!1));
132
+ U(this, we, e.state(!1));
133
+ U(this, xe, e.state("bottom"));
134
+ U(this, Se, e.state(e.proxy(/* @__PURE__ */ new Set())));
135
+ U(this, Ae, e.state(e.proxy({})));
136
+ U(
145
137
  this,
146
- Te,
138
+ Ie,
139
+ // Gallery State (Lifted for persistence during re-docking)
140
+ e.state(e.proxy({ x: 20, y: 100 }))
141
+ );
142
+ U(this, Ce, e.state(e.proxy({ width: 300, height: 400 })));
143
+ U(this, ke, e.state(!1));
144
+ U(this, Pe, e.state(e.proxy({ x: 0, y: 0 })));
145
+ U(this, Me, e.state(null));
146
+ U(this, Te, e.state(null));
147
+ Ne(this, "eventTarget", null);
148
+ U(this, ze, e.state(""));
149
+ U(this, je, e.state(e.proxy([])));
150
+ U(this, Le, e.state(!1));
151
+ U(this, Re, e.state(!1));
152
+ U(this, De, e.state(e.proxy([])));
153
+ U(
154
+ this,
155
+ Ee,
147
156
  // ==================== PLUGIN STATE ====================
148
157
  /** Registered plugins */
149
158
  e.state(e.proxy([]))
150
159
  );
151
- K(this, je, e.state(e.proxy([])));
152
- K(this, Le, e.state(e.proxy([])));
153
- K(this, Oe, e.state(null));
154
- $e(this, "pluginEventHandlers", /* @__PURE__ */ new Map());
155
- this.manifestId = t || null, this.canvasId = r || null, this.manifestId && ae.fetchManifest(this.manifestId);
160
+ U(this, Oe, e.state(e.proxy([])));
161
+ U(this, Ge, e.state(e.proxy([])));
162
+ U(this, Ve, e.state(null));
163
+ Ne(this, "pluginEventHandlers", /* @__PURE__ */ new Map());
164
+ this.manifestId = t || null, this.canvasId = r || null, this.manifestId && le.fetchManifest(this.manifestId);
156
165
  for (const n of s)
157
166
  this.registerPlugin(n);
158
167
  }
159
168
  get manifestId() {
160
- return e.get(A(this, fe));
169
+ return e.get(k(this, he));
161
170
  }
162
171
  set manifestId(t) {
163
- e.set(A(this, fe), t, !0);
172
+ e.set(k(this, he), t, !0);
164
173
  }
165
174
  get canvasId() {
166
- return e.get(A(this, ue));
175
+ return e.get(k(this, ve));
167
176
  }
168
177
  set canvasId(t) {
169
- e.set(A(this, ue), t, !0);
178
+ e.set(k(this, ve), t, !0);
170
179
  }
171
180
  get showAnnotations() {
172
- return e.get(A(this, ge));
181
+ return e.get(k(this, pe));
173
182
  }
174
183
  set showAnnotations(t) {
175
- e.set(A(this, ge), t, !0);
184
+ e.set(k(this, pe), t, !0);
176
185
  }
177
186
  get showThumbnailGallery() {
178
- return e.get(A(this, ve));
187
+ return e.get(k(this, me));
179
188
  }
180
189
  set showThumbnailGallery(t) {
181
- e.set(A(this, ve), t, !0);
190
+ e.set(k(this, me), t, !0);
182
191
  }
183
192
  get isGalleryDockedBottom() {
184
- return e.get(A(this, he));
193
+ return e.get(k(this, be));
185
194
  }
186
195
  set isGalleryDockedBottom(t) {
187
- e.set(A(this, he), t, !0);
196
+ e.set(k(this, be), t, !0);
188
197
  }
189
198
  get isGalleryDockedRight() {
190
- return e.get(A(this, pe));
199
+ return e.get(k(this, _e));
191
200
  }
192
201
  set isGalleryDockedRight(t) {
193
- e.set(A(this, pe), t, !0);
202
+ e.set(k(this, _e), t, !0);
194
203
  }
195
204
  get isFullScreen() {
196
- return e.get(A(this, me));
205
+ return e.get(k(this, ye));
197
206
  }
198
207
  set isFullScreen(t) {
199
- e.set(A(this, me), t, !0);
208
+ e.set(k(this, ye), t, !0);
200
209
  }
201
210
  get showMetadataDialog() {
202
- return e.get(A(this, be));
211
+ return e.get(k(this, we));
203
212
  }
204
213
  set showMetadataDialog(t) {
205
- e.set(A(this, be), t, !0);
214
+ e.set(k(this, we), t, !0);
206
215
  }
207
216
  get dockSide() {
208
- return e.get(A(this, _e));
217
+ return e.get(k(this, xe));
209
218
  }
210
219
  set dockSide(t) {
211
- e.set(A(this, _e), t, !0);
220
+ e.set(k(this, xe), t, !0);
212
221
  }
213
222
  get visibleAnnotationIds() {
214
- return e.get(A(this, ye));
223
+ return e.get(k(this, Se));
215
224
  }
216
225
  set visibleAnnotationIds(t) {
217
- e.set(A(this, ye), t, !0);
226
+ e.set(k(this, Se), t, !0);
227
+ }
228
+ get config() {
229
+ return e.get(k(this, Ae));
230
+ }
231
+ set config(t) {
232
+ e.set(k(this, Ae), t, !0);
233
+ }
234
+ get showRightMenu() {
235
+ return this.config.showRightMenu ?? !0;
236
+ }
237
+ get showLeftMenu() {
238
+ return this.config.showLeftMenu ?? !0;
239
+ }
240
+ get showCanvasNav() {
241
+ return this.config.showCanvasNav ?? !0;
218
242
  }
219
243
  get galleryPosition() {
220
- return e.get(A(this, we));
244
+ return e.get(k(this, Ie));
221
245
  }
222
246
  set galleryPosition(t) {
223
- e.set(A(this, we), t, !0);
247
+ e.set(k(this, Ie), t, !0);
224
248
  }
225
249
  get gallerySize() {
226
- return e.get(A(this, xe));
250
+ return e.get(k(this, Ce));
227
251
  }
228
252
  set gallerySize(t) {
229
- e.set(A(this, xe), t, !0);
253
+ e.set(k(this, Ce), t, !0);
230
254
  }
231
255
  get isGalleryDragging() {
232
- return e.get(A(this, Se));
256
+ return e.get(k(this, ke));
233
257
  }
234
258
  set isGalleryDragging(t) {
235
- e.set(A(this, Se), t, !0);
259
+ e.set(k(this, ke), t, !0);
236
260
  }
237
261
  get galleryDragOffset() {
238
- return e.get(A(this, Ae));
262
+ return e.get(k(this, Pe));
239
263
  }
240
264
  set galleryDragOffset(t) {
241
- e.set(A(this, Ae), t, !0);
265
+ e.set(k(this, Pe), t, !0);
242
266
  }
243
267
  get dragOverSide() {
244
- return e.get(A(this, Ie));
268
+ return e.get(k(this, Me));
245
269
  }
246
270
  set dragOverSide(t) {
247
- e.set(A(this, Ie), t, !0);
271
+ e.set(k(this, Me), t, !0);
272
+ }
273
+ get galleryCenterPanelRect() {
274
+ return e.get(k(this, Te));
275
+ }
276
+ set galleryCenterPanelRect(t) {
277
+ e.set(k(this, Te), t, !0);
278
+ }
279
+ setEventTarget(t) {
280
+ this.eventTarget = t;
281
+ }
282
+ /**
283
+ * Get current state as a plain object snapshot.
284
+ * Safe to use outside Svelte's reactive system.
285
+ * NOTE: We calculate currentCanvasIndex inline to avoid triggering the canvases getter
286
+ * which can cause infinite loops when it auto-sets canvasId.
287
+ */
288
+ getSnapshot() {
289
+ let t = -1;
290
+ return this.manifestId && this.canvasId && (t = le.getCanvases(this.manifestId).findIndex((s) => s.id === this.canvasId)), {
291
+ manifestId: this.manifestId,
292
+ canvasId: this.canvasId,
293
+ currentCanvasIndex: t,
294
+ showAnnotations: this.showAnnotations,
295
+ showThumbnailGallery: this.showThumbnailGallery,
296
+ showSearchPanel: this.showSearchPanel,
297
+ isFullScreen: this.isFullScreen,
298
+ dockSide: this.dockSide
299
+ };
300
+ }
301
+ /**
302
+ * Dispatch a state change event to the web component.
303
+ * No-op if eventTarget is null (Svelte component usage).
304
+ *
305
+ * Uses queueMicrotask to dispatch asynchronously AFTER the current
306
+ * reactive cycle completes, preventing infinite update loops.
307
+ */
308
+ dispatchStateChange(t = "statechange") {
309
+ this.eventTarget && queueMicrotask(() => {
310
+ var r;
311
+ (r = this.eventTarget) == null || r.dispatchEvent(new CustomEvent(t, { detail: this.getSnapshot(), bubbles: !0, composed: !0 }));
312
+ });
248
313
  }
249
314
  get manifest() {
250
- return this.manifestId ? ae.getManifest(this.manifestId) : null;
315
+ return this.manifestId ? le.getManifest(this.manifestId) : null;
251
316
  }
252
317
  get canvases() {
253
318
  if (!this.manifestId) return [];
254
- const t = ae.getCanvases(this.manifestId);
319
+ const t = le.getCanvases(this.manifestId);
255
320
  return t.length > 0 && !this.canvasId && setTimeout(
256
321
  () => {
257
322
  !this.canvasId && t.length > 0 && (this.canvasId = t[0].id);
@@ -271,26 +336,29 @@ class kt {
271
336
  nextCanvas() {
272
337
  if (this.hasNext) {
273
338
  const t = this.currentCanvasIndex + 1, r = this.canvases[t];
274
- this.canvasId = r.id;
339
+ this.setCanvas(r.id);
275
340
  }
276
341
  }
277
342
  previousCanvas() {
278
343
  if (this.hasPrevious) {
279
344
  const t = this.currentCanvasIndex - 1, r = this.canvases[t];
280
- this.canvasId = r.id;
345
+ this.setCanvas(r.id);
281
346
  }
282
347
  }
283
348
  setManifest(t) {
284
- this.manifestId = t, this.canvasId = null, ae.fetchManifest(t);
349
+ this.manifestId = t, this.canvasId = null, le.fetchManifest(t), this.dispatchStateChange("manifestchange");
285
350
  }
286
351
  setCanvas(t) {
287
- this.canvasId = t;
352
+ this.canvasId = t, this.dispatchStateChange("canvaschange");
353
+ }
354
+ updateConfig(t) {
355
+ this.config = t, t.gallery && (t.gallery.open !== void 0 && (this.showThumbnailGallery = t.gallery.open), t.gallery.dockPosition !== void 0 && (this.dockSide = t.gallery.dockPosition)), t.search && t.search.open !== void 0 && (this.showSearchPanel = t.search.open), t.annotations && t.annotations.open !== void 0 && (this.showAnnotations = t.annotations.open);
288
356
  }
289
357
  toggleAnnotations() {
290
- this.showAnnotations = !this.showAnnotations;
358
+ this.showAnnotations = !this.showAnnotations, this.dispatchStateChange();
291
359
  }
292
360
  toggleThumbnailGallery() {
293
- this.showThumbnailGallery = !this.showThumbnailGallery;
361
+ this.showThumbnailGallery = !this.showThumbnailGallery, this.dispatchStateChange();
294
362
  }
295
363
  toggleFullScreen() {
296
364
  if (document.fullscreenElement)
@@ -306,37 +374,37 @@ class kt {
306
374
  this.showMetadataDialog = !this.showMetadataDialog;
307
375
  }
308
376
  get searchQuery() {
309
- return e.get(A(this, ke));
377
+ return e.get(k(this, ze));
310
378
  }
311
379
  set searchQuery(t) {
312
- e.set(A(this, ke), t, !0);
380
+ e.set(k(this, ze), t, !0);
313
381
  }
314
382
  get searchResults() {
315
- return e.get(A(this, Ce));
383
+ return e.get(k(this, je));
316
384
  }
317
385
  set searchResults(t) {
318
- e.set(A(this, Ce), t, !0);
386
+ e.set(k(this, je), t, !0);
319
387
  }
320
388
  get isSearching() {
321
- return e.get(A(this, Pe));
389
+ return e.get(k(this, Le));
322
390
  }
323
391
  set isSearching(t) {
324
- e.set(A(this, Pe), t, !0);
392
+ e.set(k(this, Le), t, !0);
325
393
  }
326
394
  get showSearchPanel() {
327
- return e.get(A(this, Me));
395
+ return e.get(k(this, Re));
328
396
  }
329
397
  set showSearchPanel(t) {
330
- e.set(A(this, Me), t, !0);
398
+ e.set(k(this, Re), t, !0);
331
399
  }
332
400
  toggleSearchPanel() {
333
- this.showSearchPanel = !this.showSearchPanel, this.showSearchPanel || (this.searchAnnotations = []);
401
+ this.showSearchPanel = !this.showSearchPanel, this.showSearchPanel || (this.searchAnnotations = []), this.dispatchStateChange();
334
402
  }
335
403
  get searchAnnotations() {
336
- return e.get(A(this, ze));
404
+ return e.get(k(this, De));
337
405
  }
338
406
  set searchAnnotations(t) {
339
- e.set(A(this, ze), t, !0);
407
+ e.set(k(this, De), t, !0);
340
408
  }
341
409
  get currentCanvasSearchAnnotations() {
342
410
  return this.canvasId ? this.searchAnnotations.filter((t) => t.canvasId === this.canvasId) : [];
@@ -349,81 +417,81 @@ class kt {
349
417
  const n = this.manifest;
350
418
  if (!n) throw new Error("No manifest loaded");
351
419
  let a = n.getService("http://iiif.io/api/search/1/search") || n.getService("http://iiif.io/api/search/0/search");
352
- if (a || n.__jsonld && n.__jsonld.service && (a = (Array.isArray(n.__jsonld.service) ? n.__jsonld.service : [n.__jsonld.service]).find((p) => p.profile === "http://iiif.io/api/search/1/search" || p.profile === "http://iiif.io/api/search/0/search")), !a) {
420
+ if (a || n.__jsonld && n.__jsonld.service && (a = (Array.isArray(n.__jsonld.service) ? n.__jsonld.service : [n.__jsonld.service]).find((C) => C.profile === "http://iiif.io/api/search/1/search" || C.profile === "http://iiif.io/api/search/0/search")), !a) {
353
421
  console.warn("No IIIF search service found in manifest"), this.isSearching = !1;
354
422
  return;
355
423
  }
356
- const I = `${a.id || a["@id"]}?q=${encodeURIComponent(t)}`, c = await fetch(I);
357
- if (!c.ok) throw new Error("Search request failed");
358
- const w = await c.json(), k = w.resources || [], z = [], d = (g) => {
359
- const p = typeof g == "string" ? g : g["@id"] || g.id;
360
- if (!p) return null;
361
- const f = p.split("#xywh=");
362
- if (f.length < 2) return null;
363
- const v = f[1].split(",").map(Number);
364
- return v.length === 4 ? v : null;
424
+ const P = `${a.id || a["@id"]}?q=${encodeURIComponent(t)}`, _ = await fetch(P);
425
+ if (!_.ok) throw new Error("Search request failed");
426
+ const I = await _.json(), u = I.resources || [], R = [], g = (v) => {
427
+ const C = typeof v == "string" ? v : v["@id"] || v.id;
428
+ if (!C) return null;
429
+ const h = C.split("#xywh=");
430
+ if (h.length < 2) return null;
431
+ const c = h[1].split(",").map(Number);
432
+ return c.length === 4 ? c : null;
365
433
  };
366
- if (w.hits)
367
- for (const g of w.hits) {
368
- const p = g.annotations || [];
369
- for (const f of p) {
370
- const v = k.find((o) => o["@id"] === f || o.id === f);
371
- if (v && v.on) {
372
- const o = typeof v.on == "string" ? v.on : v.on["@id"] || v.on.id, S = o.split("#")[0], G = d(o), L = this.canvases.findIndex((l) => l.id === S);
373
- if (L >= 0) {
374
- const l = this.canvases[L];
375
- let C = "Canvas " + (L + 1);
434
+ if (I.hits)
435
+ for (const v of I.hits) {
436
+ const C = v.annotations || [];
437
+ for (const h of C) {
438
+ const c = u.find((d) => d["@id"] === h || d.id === h);
439
+ if (c && c.on) {
440
+ const d = typeof c.on == "string" ? c.on : c.on["@id"] || c.on.id, z = d.split("#")[0], B = g(d), E = this.canvases.findIndex((p) => p.id === z);
441
+ if (E >= 0) {
442
+ const p = this.canvases[E];
443
+ let f = "Canvas " + (E + 1);
376
444
  try {
377
- if (l.getLabel) {
378
- const _ = l.getLabel();
379
- Array.isArray(_) && _.length > 0 ? C = _[0].value : typeof _ == "string" && (C = _);
380
- } else l.label && (typeof l.label == "string" ? C = l.label : Array.isArray(l.label) && (C = (r = l.label[0]) == null ? void 0 : r.value));
445
+ if (p.getLabel) {
446
+ const o = p.getLabel();
447
+ Array.isArray(o) && o.length > 0 ? f = o[0].value : typeof o == "string" && (f = o);
448
+ } else p.label && (typeof p.label == "string" ? f = p.label : Array.isArray(p.label) && (f = (r = p.label[0]) == null ? void 0 : r.value));
381
449
  } catch {
382
450
  }
383
- z.push({
451
+ R.push({
384
452
  type: "hit",
385
- before: g.before,
386
- match: g.match,
387
- after: g.after,
388
- canvasIndex: L,
389
- canvasLabel: String(C),
390
- bounds: G
453
+ before: v.before,
454
+ match: v.match,
455
+ after: v.after,
456
+ canvasIndex: E,
457
+ canvasLabel: String(f),
458
+ bounds: B
391
459
  });
392
460
  }
393
461
  }
394
462
  }
395
463
  }
396
- else if (k.length > 0)
397
- for (const g of k) {
398
- const p = typeof g.on == "string" ? g.on : g.on["@id"] || g.on.id, f = p.split("#")[0], v = d(p), o = this.canvases.findIndex((S) => S.id === f);
399
- if (o >= 0) {
400
- const S = this.canvases[o];
401
- let G = "Canvas " + (o + 1);
464
+ else if (u.length > 0)
465
+ for (const v of u) {
466
+ const C = typeof v.on == "string" ? v.on : v.on["@id"] || v.on.id, h = C.split("#")[0], c = g(C), d = this.canvases.findIndex((z) => z.id === h);
467
+ if (d >= 0) {
468
+ const z = this.canvases[d];
469
+ let B = "Canvas " + (d + 1);
402
470
  try {
403
- if (S.getLabel) {
404
- const L = S.getLabel();
405
- Array.isArray(L) && L.length > 0 ? G = L[0].value : typeof L == "string" && (G = L);
406
- } else S.label && (typeof S.label == "string" ? G = S.label : Array.isArray(S.label) && (G = (s = S.label[0]) == null ? void 0 : s.value));
471
+ if (z.getLabel) {
472
+ const E = z.getLabel();
473
+ Array.isArray(E) && E.length > 0 ? B = E[0].value : typeof E == "string" && (B = E);
474
+ } else z.label && (typeof z.label == "string" ? B = z.label : Array.isArray(z.label) && (B = (s = z.label[0]) == null ? void 0 : s.value));
407
475
  } catch {
408
476
  }
409
- z.push({
477
+ R.push({
410
478
  type: "resource",
411
- match: g.resource && g.resource.chars ? g.resource.chars : g.chars || "",
412
- canvasIndex: o,
413
- canvasLabel: String(G),
414
- bounds: v
479
+ match: v.resource && v.resource.chars ? v.resource.chars : v.chars || "",
480
+ canvasIndex: d,
481
+ canvasLabel: String(B),
482
+ bounds: c
415
483
  });
416
484
  }
417
485
  }
418
- this.searchResults = z, this.searchAnnotations = z.filter((g) => g.bounds).map((g, p) => {
419
- const f = this.canvases[g.canvasIndex], v = `${f.id}#xywh=${g.bounds.join(",")}`;
486
+ this.searchResults = R, this.searchAnnotations = R.filter((v) => v.bounds).map((v, C) => {
487
+ const h = this.canvases[v.canvasIndex], c = `${h.id}#xywh=${v.bounds.join(",")}`;
420
488
  return {
421
- "@id": `urn:search-hit:${p}`,
489
+ "@id": `urn:search-hit:${C}`,
422
490
  "@type": "oa:Annotation",
423
491
  motivation: "sc:painting",
424
- on: v,
425
- canvasId: f.id,
426
- resource: { "@type": "cnt:ContentAsText", chars: g.match },
492
+ on: c,
493
+ canvasId: h.id,
494
+ resource: { "@type": "cnt:ContentAsText", chars: v.match },
427
495
  // Flag to identify styling in Overlay?
428
496
  // Or just standard rendering.
429
497
  isSearchHit: !0
@@ -437,28 +505,28 @@ class kt {
437
505
  }
438
506
  }
439
507
  get plugins() {
440
- return e.get(A(this, Te));
508
+ return e.get(k(this, Ee));
441
509
  }
442
510
  set plugins(t) {
443
- e.set(A(this, Te), t, !0);
511
+ e.set(k(this, Ee), t, !0);
444
512
  }
445
513
  get pluginMenuButtons() {
446
- return e.get(A(this, je));
514
+ return e.get(k(this, Oe));
447
515
  }
448
516
  set pluginMenuButtons(t) {
449
- e.set(A(this, je), t, !0);
517
+ e.set(k(this, Oe), t, !0);
450
518
  }
451
519
  get pluginPanels() {
452
- return e.get(A(this, Le));
520
+ return e.get(k(this, Ge));
453
521
  }
454
522
  set pluginPanels(t) {
455
- e.set(A(this, Le), t, !0);
523
+ e.set(k(this, Ge), t, !0);
456
524
  }
457
525
  get osdViewer() {
458
- return e.get(A(this, Oe));
526
+ return e.get(k(this, Ve));
459
527
  }
460
528
  set osdViewer(t) {
461
- e.set(A(this, Oe), t, !0);
529
+ e.set(k(this, Ve), t, !0);
462
530
  }
463
531
  createPluginContext() {
464
532
  const t = this;
@@ -526,8 +594,8 @@ class kt {
526
594
  this.plugins = [], this.pluginMenuButtons = [], this.pluginPanels = [], this.pluginEventHandlers.clear();
527
595
  }
528
596
  }
529
- fe = new WeakMap(), ue = new WeakMap(), ge = new WeakMap(), ve = new WeakMap(), he = new WeakMap(), pe = new WeakMap(), me = new WeakMap(), be = new WeakMap(), _e = new WeakMap(), ye = new WeakMap(), we = new WeakMap(), xe = new WeakMap(), Se = new WeakMap(), Ae = new WeakMap(), Ie = new WeakMap(), ke = new WeakMap(), Ce = new WeakMap(), Pe = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), Te = new WeakMap(), je = new WeakMap(), Le = new WeakMap(), Oe = new WeakMap();
530
- const se = "triiiceratops:viewerState", Ct = [
597
+ he = new WeakMap(), ve = new WeakMap(), pe = new WeakMap(), me = new WeakMap(), be = new WeakMap(), _e = new WeakMap(), ye = new WeakMap(), we = new WeakMap(), xe = new WeakMap(), Se = new WeakMap(), Ae = new WeakMap(), Ie = new WeakMap(), Ce = new WeakMap(), ke = new WeakMap(), Pe = new WeakMap(), Me = new WeakMap(), Te = new WeakMap(), ze = new WeakMap(), je = new WeakMap(), Le = new WeakMap(), Re = new WeakMap(), De = new WeakMap(), Ee = new WeakMap(), Oe = new WeakMap(), Ge = new WeakMap(), Ve = new WeakMap();
598
+ const ce = "triiiceratops:viewerState", zt = [
531
599
  "light",
532
600
  "dark",
533
601
  "cupcake",
@@ -564,7 +632,7 @@ const se = "triiiceratops:viewerState", Ct = [
564
632
  "abyss",
565
633
  "silk"
566
634
  ];
567
- function Pt(i) {
635
+ function jt(i) {
568
636
  i = i.replace(/^#/, "");
569
637
  let t, r, s;
570
638
  if (i.length === 3)
@@ -575,76 +643,76 @@ function Pt(i) {
575
643
  return null;
576
644
  return isNaN(t) || isNaN(r) || isNaN(s) ? null : { r: t, g: r, b: s };
577
645
  }
578
- function Mt(i) {
646
+ function Lt(i) {
579
647
  const t = i.match(
580
648
  /rgba?\(\s*(\d+(?:\.\d+)?%?)\s*[,\s]\s*(\d+(?:\.\d+)?%?)\s*[,\s]\s*(\d+(?:\.\d+)?%?)(?:\s*[,/]\s*(\d*\.?\d+%?))?\s*\)/i
581
649
  );
582
650
  if (!t) return null;
583
- const r = (y) => y.endsWith("%") ? parseFloat(y) / 100 * 255 : parseFloat(y), s = r(t[1]), n = r(t[2]), a = r(t[3]);
651
+ const r = (S) => S.endsWith("%") ? parseFloat(S) / 100 * 255 : parseFloat(S), s = r(t[1]), n = r(t[2]), a = r(t[3]);
584
652
  return isNaN(s) || isNaN(n) || isNaN(a) ? null : { r: s, g: n, b: a };
585
653
  }
586
- function Ee(i) {
654
+ function He(i) {
587
655
  const t = i / 255;
588
656
  return t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
589
657
  }
590
- function zt(i, t, r) {
658
+ function Rt(i, t, r) {
591
659
  return {
592
660
  x: 0.4124564 * i + 0.3575761 * t + 0.1804375 * r,
593
661
  y: 0.2126729 * i + 0.7151522 * t + 0.072175 * r,
594
662
  z: 0.0193339 * i + 0.119192 * t + 0.9503041 * r
595
663
  };
596
664
  }
597
- function Tt(i, t, r) {
598
- const s = 0.8189330101 * i + 0.3618667424 * t - 0.1288597137 * r, n = 0.0329845436 * i + 0.9293118715 * t + 0.0361456387 * r, a = 0.0482003018 * i + 0.2643662691 * t + 0.633851707 * r, y = Math.cbrt(s), I = Math.cbrt(n), c = Math.cbrt(a);
665
+ function Dt(i, t, r) {
666
+ const s = 0.8189330101 * i + 0.3618667424 * t - 0.1288597137 * r, n = 0.0329845436 * i + 0.9293118715 * t + 0.0361456387 * r, a = 0.0482003018 * i + 0.2643662691 * t + 0.633851707 * r, S = Math.cbrt(s), P = Math.cbrt(n), _ = Math.cbrt(a);
599
667
  return {
600
- L: 0.2104542553 * y + 0.793617785 * I - 0.0040720468 * c,
601
- a: 1.9779984951 * y - 2.428592205 * I + 0.4505937099 * c,
602
- b: 0.0259040371 * y + 0.7827717662 * I - 0.808675766 * c
668
+ L: 0.2104542553 * S + 0.793617785 * P - 0.0040720468 * _,
669
+ a: 1.9779984951 * S - 2.428592205 * P + 0.4505937099 * _,
670
+ b: 0.0259040371 * S + 0.7827717662 * P - 0.808675766 * _
603
671
  };
604
672
  }
605
- function jt(i, t, r) {
673
+ function Et(i, t, r) {
606
674
  const s = Math.sqrt(t * t + r * r);
607
675
  let n = Math.atan2(r, t) * 180 / Math.PI;
608
676
  return n < 0 && (n += 360), { L: i, C: s, h: n };
609
677
  }
610
- function We(i, t, r) {
611
- const s = Ee(i), n = Ee(t), a = Ee(r), { x: y, y: I, z: c } = zt(s, n, a), { L: w, a: k, b: z } = Tt(y, I, c);
612
- return jt(w, k, z);
678
+ function et(i, t, r) {
679
+ const s = He(i), n = He(t), a = He(r), { x: S, y: P, z: _ } = Rt(s, n, a), { L: I, a: u, b: R } = Dt(S, P, _);
680
+ return Et(I, u, R);
613
681
  }
614
- function Ue(i, t, r) {
682
+ function tt(i, t, r) {
615
683
  const s = (i * 100).toFixed(2), n = t.toFixed(4), a = t < 1e-4 ? 0 : r.toFixed(2);
616
684
  return `oklch(${s}% ${n} ${a})`;
617
685
  }
618
- function Lt(i) {
686
+ function Ot(i) {
619
687
  return i.trim().toLowerCase().startsWith("oklch(");
620
688
  }
621
- function Ot(i) {
689
+ function Gt(i) {
622
690
  return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(
623
691
  i.trim()
624
692
  );
625
693
  }
626
- function Dt(i) {
694
+ function Vt(i) {
627
695
  return /^rgba?\s*\(/i.test(i.trim());
628
696
  }
629
- function Et(i) {
630
- const t = Pt(i);
697
+ function Ft(i) {
698
+ const t = jt(i);
631
699
  if (!t)
632
700
  return console.warn(`Invalid hex color: ${i}, returning as-is`), i;
633
- const { L: r, C: s, h: n } = We(t.r, t.g, t.b);
634
- return Ue(r, s, n);
701
+ const { L: r, C: s, h: n } = et(t.r, t.g, t.b);
702
+ return tt(r, s, n);
635
703
  }
636
- function Rt(i) {
637
- const t = Mt(i);
704
+ function Bt(i) {
705
+ const t = Lt(i);
638
706
  if (!t)
639
707
  return console.warn(`Invalid rgb color: ${i}, returning as-is`), i;
640
- const { L: r, C: s, h: n } = We(t.r, t.g, t.b);
641
- return Ue(r, s, n);
708
+ const { L: r, C: s, h: n } = et(t.r, t.g, t.b);
709
+ return tt(r, s, n);
642
710
  }
643
- function Gt(i) {
711
+ function $t(i) {
644
712
  const t = i.trim();
645
- return Lt(t) ? t : Ot(t) ? Et(t) : Dt(t) ? Rt(t) : (console.warn(`Unrecognized color format: ${i}, passing through as-is`), i);
713
+ return Ot(t) ? t : Gt(t) ? Ft(t) : Vt(t) ? Bt(t) : (console.warn(`Unrecognized color format: ${i}, passing through as-is`), i);
646
714
  }
647
- const Je = {
715
+ const rt = {
648
716
  // Semantic colors
649
717
  primary: "--color-primary",
650
718
  primaryContent: "--color-primary-content",
@@ -682,7 +750,7 @@ const Je = {
682
750
  noise: "--noise",
683
751
  // Color scheme (handled specially, not a CSS variable)
684
752
  colorScheme: "color-scheme"
685
- }, Ft = /* @__PURE__ */ new Set([
753
+ }, Nt = /* @__PURE__ */ new Set([
686
754
  "primary",
687
755
  "primaryContent",
688
756
  "secondary",
@@ -704,13 +772,13 @@ const Je = {
704
772
  "error",
705
773
  "errorContent"
706
774
  ]);
707
- function gi(i) {
708
- return Ct.includes(i);
775
+ function ki(i) {
776
+ return zt.includes(i);
709
777
  }
710
- function Vt(i, t) {
778
+ function Ht(i, t) {
711
779
  i.setAttribute("data-theme", t);
712
780
  }
713
- function $t(i, t) {
781
+ function Yt(i, t) {
714
782
  for (const [r, s] of Object.entries(t)) {
715
783
  if (s == null) continue;
716
784
  const n = r;
@@ -718,17 +786,17 @@ function $t(i, t) {
718
786
  i.style.colorScheme = s;
719
787
  continue;
720
788
  }
721
- const a = Je[n];
789
+ const a = rt[n];
722
790
  if (!a) continue;
723
- let y = String(s);
724
- Ft.has(n) && (y = Gt(y)), i.style.setProperty(a, y);
791
+ let S = String(s);
792
+ Nt.has(n) && (S = $t(S)), i.style.setProperty(a, S);
725
793
  }
726
794
  }
727
- function Bt(i) {
728
- for (const [t, r] of Object.entries(Je))
795
+ function Xt(i) {
796
+ for (const [t, r] of Object.entries(rt))
729
797
  t === "colorScheme" ? i.style.colorScheme = "" : i.style.removeProperty(r);
730
798
  }
731
- function vi(i) {
799
+ function Pi(i) {
732
800
  try {
733
801
  const t = JSON.parse(i);
734
802
  return typeof t == "object" && t !== null ? t : null;
@@ -736,13 +804,13 @@ function vi(i) {
736
804
  return null;
737
805
  }
738
806
  }
739
- function Ht(i, t, r) {
740
- t ? Vt(i, t) : i.removeAttribute("data-theme"), r ? $t(i, r) : Bt(i);
807
+ function qt(i, t, r) {
808
+ t ? Ht(i, t) : i.removeAttribute("data-theme"), r ? Yt(i, r) : Xt(i);
741
809
  }
742
- function Ke(i) {
810
+ function it(i) {
743
811
  return i.id || i["@id"] || (typeof i.getId == "function" ? i.getId() : "");
744
812
  }
745
- function Re(i) {
813
+ function Ye(i) {
746
814
  if (!i) return null;
747
815
  const t = i.match(/xywh=(\d+),(\d+),(\d+),(\d+)/);
748
816
  return t ? {
@@ -752,11 +820,11 @@ function Re(i) {
752
820
  h: parseInt(t[4], 10)
753
821
  } : null;
754
822
  }
755
- function Nt(i) {
756
- const t = Yt(i);
823
+ function Qt(i) {
824
+ const t = Wt(i);
757
825
  if (t)
758
- return Xt(t);
759
- const r = Ut(i);
826
+ return Ut(t);
827
+ const r = er(i);
760
828
  return r ? {
761
829
  type: "RECTANGLE",
762
830
  x: r.x,
@@ -765,58 +833,58 @@ function Nt(i) {
765
833
  h: r.h
766
834
  } : null;
767
835
  }
768
- function Yt(i) {
836
+ function Wt(i) {
769
837
  var r, s;
770
838
  if (typeof i.getTarget == "function") {
771
839
  const n = ((r = i.__jsonld) == null ? void 0 : r.on) || ((s = i.__jsonld) == null ? void 0 : s.target);
772
840
  if (n)
773
- return Ye(n);
841
+ return Je(n);
774
842
  }
775
843
  const t = i.target || i.on;
776
- return t ? Ye(t) : null;
844
+ return t ? Je(t) : null;
777
845
  }
778
- function Ye(i) {
846
+ function Je(i) {
779
847
  if (!i) return null;
780
848
  if (Array.isArray(i))
781
849
  for (const t of i) {
782
- const r = Xe(t);
850
+ const r = Ke(t);
783
851
  if (r) return r;
784
852
  }
785
853
  else
786
- return Xe(i);
854
+ return Ke(i);
787
855
  return null;
788
856
  }
789
- function Xe(i) {
857
+ function Ke(i) {
790
858
  var r;
791
859
  if (!i) return null;
792
860
  const t = i.selector || i;
793
861
  return (t == null ? void 0 : t.type) === "SvgSelector" && t.value ? t.value : ((r = t == null ? void 0 : t.item) == null ? void 0 : r.type) === "SvgSelector" && t.item.value ? t.item.value : null;
794
862
  }
795
- function Xt(i) {
863
+ function Ut(i) {
796
864
  try {
797
865
  const r = new DOMParser().parseFromString(i, "image/svg+xml");
798
866
  if (r.documentElement.nodeName === "parsererror")
799
867
  return console.warn("Failed to parse SVG selector:", i), null;
800
868
  const s = [], n = r.querySelectorAll("polygon");
801
- for (const I of n) {
802
- const c = I.getAttribute("points");
803
- if (c) {
804
- const w = qt(c);
805
- s.push(...w);
869
+ for (const P of n) {
870
+ const _ = P.getAttribute("points");
871
+ if (_) {
872
+ const I = Jt(_);
873
+ s.push(...I);
806
874
  }
807
875
  }
808
876
  const a = r.querySelectorAll("path");
809
- for (const I of a) {
810
- const c = I.getAttribute("d");
811
- if (c) {
812
- const w = Qt(c);
813
- s.push(...w);
877
+ for (const P of a) {
878
+ const _ = P.getAttribute("d");
879
+ if (_) {
880
+ const I = Kt(_);
881
+ s.push(...I);
814
882
  }
815
883
  }
816
- const y = r.querySelectorAll("circle");
817
- for (const I of y) {
818
- const c = parseFloat(I.getAttribute("cx") || "0"), w = parseFloat(I.getAttribute("cy") || "0"), k = parseFloat(I.getAttribute("r") || "0"), z = Wt(c, w, k);
819
- s.push(...z);
884
+ const S = r.querySelectorAll("circle");
885
+ for (const P of S) {
886
+ const _ = parseFloat(P.getAttribute("cx") || "0"), I = parseFloat(P.getAttribute("cy") || "0"), u = parseFloat(P.getAttribute("r") || "0"), R = Zt(_, I, u);
887
+ s.push(...R);
820
888
  }
821
889
  return s.length === 0 ? null : {
822
890
  type: "POLYGON",
@@ -826,15 +894,15 @@ function Xt(i) {
826
894
  return console.warn("Failed to convert SVG to polygon:", t), null;
827
895
  }
828
896
  }
829
- function qt(i) {
897
+ function Jt(i) {
830
898
  const t = [], r = i.trim().split(/\s+/);
831
899
  for (const s of r) {
832
- const [n, a] = s.split(",").map((y) => parseFloat(y));
900
+ const [n, a] = s.split(",").map((S) => parseFloat(S));
833
901
  !isNaN(n) && !isNaN(a) && t.push([n, a]);
834
902
  }
835
903
  return t;
836
904
  }
837
- function Qt(i) {
905
+ function Kt(i) {
838
906
  const t = [], r = /[ML]\s*([\d.]+)[,\s]+([\d.]+)/g;
839
907
  let s;
840
908
  for (; (s = r.exec(i)) !== null; ) {
@@ -843,57 +911,57 @@ function Qt(i) {
843
911
  }
844
912
  return t;
845
913
  }
846
- function Wt(i, t, r, s = 8) {
914
+ function Zt(i, t, r, s = 8) {
847
915
  const n = [];
848
916
  for (let a = 0; a < s; a++) {
849
- const y = a / s * Math.PI * 2, I = i + r * Math.cos(y), c = t + r * Math.sin(y);
850
- n.push([I, c]);
917
+ const S = a / s * Math.PI * 2, P = i + r * Math.cos(S), _ = t + r * Math.sin(S);
918
+ n.push([P, _]);
851
919
  }
852
920
  return n;
853
921
  }
854
- function Ut(i) {
922
+ function er(i) {
855
923
  var r;
856
924
  if (typeof i.getTarget == "function") {
857
925
  const s = i.getTarget();
858
926
  if (typeof s == "string" && s.includes("xywh="))
859
- return Re(s);
927
+ return Ye(s);
860
928
  const n = (r = i.__jsonld) == null ? void 0 : r.on;
861
929
  if (n) {
862
- const a = Ge(n);
930
+ const a = Xe(n);
863
931
  if (a) return a;
864
932
  }
865
933
  }
866
934
  const t = i.target || i.on;
867
- return t ? Ge(t) : null;
935
+ return t ? Xe(t) : null;
868
936
  }
869
- function Ge(i) {
937
+ function Xe(i) {
870
938
  if (!i) return null;
871
939
  if (Array.isArray(i))
872
940
  for (const t of i) {
873
- const r = Ge(t);
941
+ const r = Xe(t);
874
942
  if (r) return r;
875
943
  }
876
944
  if (typeof i == "string" && i.includes("xywh="))
877
- return Re(i);
945
+ return Ye(i);
878
946
  if (i.selector) {
879
947
  const t = i.selector, r = t.item || t;
880
948
  if (r.value && typeof r.value == "string" && r.value.includes("xywh="))
881
- return Re(r.value);
949
+ return Ye(r.value);
882
950
  }
883
951
  return null;
884
952
  }
885
- function Jt(i) {
953
+ function tr(i) {
886
954
  let t = "", r = !1;
887
955
  if (typeof i.getBody == "function") {
888
956
  const s = i.getBody();
889
957
  if (s && Array.isArray(s)) {
890
958
  const n = [];
891
959
  for (const a of s) {
892
- const y = a.getValue ? a.getValue() : "";
893
- if (y) {
894
- n.push(y);
895
- const I = a.getFormat ? a.getFormat() : "";
896
- (I === "text/html" || I === "application/html") && (r = !0);
960
+ const S = a.getValue ? a.getValue() : "";
961
+ if (S) {
962
+ n.push(S);
963
+ const P = a.getFormat ? a.getFormat() : "";
964
+ (P === "text/html" || P === "application/html") && (r = !0);
897
965
  }
898
966
  }
899
967
  t = n.join(" ");
@@ -910,11 +978,11 @@ function Jt(i) {
910
978
  }
911
979
  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: r };
912
980
  }
913
- function Kt(i, t, r = !1) {
914
- const s = Ke(i) || `anno-${t}`, n = Nt(i);
981
+ function rr(i, t, r = !1) {
982
+ const s = it(i) || `anno-${t}`, n = Qt(i);
915
983
  if (!n)
916
984
  return null;
917
- const a = Jt(i);
985
+ const a = tr(i);
918
986
  return {
919
987
  id: s,
920
988
  geometry: n,
@@ -922,78 +990,78 @@ function Kt(i, t, r = !1) {
922
990
  isSearchHit: r
923
991
  };
924
992
  }
925
- function Zt(i, t = /* @__PURE__ */ new Set()) {
993
+ function ir(i, t = /* @__PURE__ */ new Set()) {
926
994
  return i.map((r, s) => {
927
- const n = t.has(Ke(r));
928
- return Kt(r, s, n);
995
+ const n = t.has(it(r));
996
+ return rr(r, s, n);
929
997
  }).filter((r) => r !== null);
930
998
  }
931
- var er = e.from_html("<div></div>"), tr = e.from_svg('<svg class="absolute pointer-events-auto"><title> </title><polygon stroke-width="2"></polygon></svg>'), rr = e.from_html('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');
932
- function Ze(i, t) {
999
+ var sr = e.from_html("<div></div>"), nr = e.from_svg('<svg class="absolute pointer-events-auto"><title> </title><polygon stroke-width="2"></polygon></svg>'), ar = e.from_html('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');
1000
+ function st(i, t) {
933
1001
  e.push(t, !0);
934
- let r = e.prop(t, "tileSources", 7), s = e.prop(t, "viewerState", 7), n = e.state(void 0), a = e.state(void 0), y = e.state(0), I = e.derived(() => {
1002
+ let r = e.prop(t, "tileSources", 7), s = e.prop(t, "viewerState", 7), n = e.state(void 0), a = e.state(void 0), S = e.state(0), P = e.derived(() => {
935
1003
  if (!s().manifestId || !s().canvasId)
936
1004
  return [];
937
- const f = ae.getAnnotations(s().manifestId, s().canvasId), v = s().currentCanvasSearchAnnotations;
938
- return [...f, ...v];
939
- }), c = e.derived(() => {
940
- const f = /* @__PURE__ */ new Set();
941
- return s().currentCanvasSearchAnnotations.forEach((v) => {
942
- const o = v.id || v["@id"];
943
- o && f.add(o);
944
- }), f;
945
- }), w = e.derived(() => Zt(e.get(I), e.get(c))), k = e.derived(() => {
946
- if (e.get(y), !e.get(a) || !e.get(w).length)
1005
+ const h = le.getAnnotations(s().manifestId, s().canvasId), c = s().currentCanvasSearchAnnotations;
1006
+ return [...h, ...c];
1007
+ }), _ = e.derived(() => {
1008
+ const h = /* @__PURE__ */ new Set();
1009
+ return s().currentCanvasSearchAnnotations.forEach((c) => {
1010
+ const d = c.id || c["@id"];
1011
+ d && h.add(d);
1012
+ }), h;
1013
+ }), I = e.derived(() => ir(e.get(P), e.get(_))), u = e.derived(() => {
1014
+ if (e.get(S), !e.get(a) || !e.get(I).length)
947
1015
  return [];
948
- const f = e.get(a).world.getItemAt(0);
949
- if (!f)
1016
+ const h = e.get(a).world.getItemAt(0);
1017
+ if (!h)
950
1018
  return [];
951
- const v = [];
952
- for (const o of e.get(w)) {
953
- if (!o.isSearchHit) if (s().showAnnotations) {
954
- if (!s().visibleAnnotationIds.has(o.id))
1019
+ const c = [];
1020
+ for (const d of e.get(I)) {
1021
+ if (!d.isSearchHit) if (s().showAnnotations) {
1022
+ if (!s().visibleAnnotationIds.has(d.id))
955
1023
  continue;
956
1024
  } else continue;
957
- if (o.geometry.type === "RECTANGLE") {
958
- const S = f.imageToViewportRectangle(o.geometry.x, o.geometry.y, o.geometry.w, o.geometry.h), G = e.get(a).viewport.viewportToViewerElementRectangle(S);
959
- v.push({
960
- id: o.id,
1025
+ if (d.geometry.type === "RECTANGLE") {
1026
+ const z = h.imageToViewportRectangle(d.geometry.x, d.geometry.y, d.geometry.w, d.geometry.h), B = e.get(a).viewport.viewportToViewerElementRectangle(z);
1027
+ c.push({
1028
+ id: d.id,
961
1029
  type: "RECTANGLE",
962
1030
  rect: {
963
- x: G.x,
964
- y: G.y,
965
- width: G.width,
966
- height: G.height
1031
+ x: B.x,
1032
+ y: B.y,
1033
+ width: B.width,
1034
+ height: B.height
967
1035
  },
968
- isSearchHit: o.isSearchHit,
969
- tooltip: o.body.value
1036
+ isSearchHit: d.isSearchHit,
1037
+ tooltip: d.body.value
970
1038
  });
971
- } else if (o.geometry.type === "POLYGON") {
972
- const S = o.geometry.points.map((x) => {
973
- const D = f.imageToViewportCoordinates(new Be.Point(x[0], x[1])), b = e.get(a).viewport.viewportToViewerElementCoordinates(D);
974
- return [b.x, b.y];
1039
+ } else if (d.geometry.type === "POLYGON") {
1040
+ const z = d.geometry.points.map((M) => {
1041
+ const y = h.imageToViewportCoordinates(new Qe.Point(M[0], M[1])), w = e.get(a).viewport.viewportToViewerElementCoordinates(y);
1042
+ return [w.x, w.y];
975
1043
  });
976
- let G = 1 / 0, L = 1 / 0, l = -1 / 0, C = -1 / 0;
977
- for (const [x, D] of S)
978
- G = Math.min(G, x), L = Math.min(L, D), l = Math.max(l, x), C = Math.max(C, D);
979
- const _ = S.map(([x, D]) => [x - G, D - L]);
980
- v.push({
981
- id: o.id,
1044
+ let B = 1 / 0, E = 1 / 0, p = -1 / 0, f = -1 / 0;
1045
+ for (const [M, y] of z)
1046
+ B = Math.min(B, M), E = Math.min(E, y), p = Math.max(p, M), f = Math.max(f, y);
1047
+ const o = z.map(([M, y]) => [M - B, y - E]);
1048
+ c.push({
1049
+ id: d.id,
982
1050
  type: "POLYGON",
983
- bounds: { x: G, y: L, width: l - G, height: C - L },
984
- points: _,
985
- isSearchHit: o.isSearchHit,
986
- tooltip: o.body.value
1051
+ bounds: { x: B, y: E, width: p - B, height: f - E },
1052
+ points: o,
1053
+ isSearchHit: d.isSearchHit,
1054
+ tooltip: d.body.value
987
1055
  });
988
1056
  }
989
1057
  }
990
- return v;
1058
+ return c;
991
1059
  });
992
- dt(() => {
1060
+ ht(() => {
993
1061
  if (e.get(n))
994
1062
  return e.set(
995
1063
  a,
996
- Be({
1064
+ Qe({
997
1065
  element: e.get(n),
998
1066
  tileSources: null,
999
1067
  // Will be set via effect
@@ -1011,1214 +1079,1384 @@ function Ze(i, t) {
1011
1079
  }),
1012
1080
  !0
1013
1081
  ), s().notifyOSDReady(e.get(a)), () => {
1014
- var f;
1015
- (f = e.get(a)) == null || f.destroy(), s().osdViewer = null;
1082
+ var h;
1083
+ (h = e.get(a)) == null || h.destroy(), s().osdViewer = null;
1016
1084
  };
1017
1085
  }), e.user_effect(() => {
1018
1086
  if (!e.get(a)) return;
1019
- const f = () => {
1020
- e.update(y);
1087
+ const h = () => {
1088
+ e.update(S);
1021
1089
  };
1022
- return e.get(a).addHandler("open", f), e.get(a).addHandler("animation", f), e.get(a).addHandler("resize", f), e.get(a).addHandler("rotate", f), e.get(a).world.addHandler("add-item", f), e.get(a).world.addHandler("remove-item", f), () => {
1023
- e.get(a).removeHandler("open", f), e.get(a).removeHandler("animation", f), e.get(a).removeHandler("resize", f), e.get(a).removeHandler("rotate", f), e.get(a).world.removeHandler("add-item", f), e.get(a).world.removeHandler("remove-item", f);
1090
+ return e.get(a).addHandler("open", h), e.get(a).addHandler("animation", h), e.get(a).addHandler("resize", h), e.get(a).addHandler("rotate", h), e.get(a).world.addHandler("add-item", h), e.get(a).world.addHandler("remove-item", h), () => {
1091
+ e.get(a).removeHandler("open", h), e.get(a).removeHandler("animation", h), e.get(a).removeHandler("resize", h), e.get(a).removeHandler("rotate", h), e.get(a).world.removeHandler("add-item", h), e.get(a).world.removeHandler("remove-item", h);
1024
1092
  };
1025
1093
  }), e.user_effect(() => {
1026
1094
  !e.get(a) || !r() || e.get(a).open(r());
1027
1095
  });
1028
- var z = {
1096
+ var R = {
1029
1097
  get tileSources() {
1030
1098
  return r();
1031
1099
  },
1032
- set tileSources(f) {
1033
- r(f), e.flush();
1100
+ set tileSources(h) {
1101
+ r(h), e.flush();
1034
1102
  },
1035
1103
  get viewerState() {
1036
1104
  return s();
1037
1105
  },
1038
- set viewerState(f) {
1039
- s(f), e.flush();
1106
+ set viewerState(h) {
1107
+ s(h), e.flush();
1040
1108
  }
1041
- }, d = rr(), g = e.child(d);
1042
- e.bind_this(g, (f) => e.set(n, f), () => e.get(n));
1043
- var p = e.sibling(g, 2);
1044
- return e.each(p, 17, () => e.get(k), (f) => f.id, (f, v) => {
1045
- var o = e.comment(), S = e.first_child(o);
1109
+ }, g = ar(), v = e.child(g);
1110
+ e.bind_this(v, (h) => e.set(n, h), () => e.get(n));
1111
+ var C = e.sibling(v, 2);
1112
+ return e.each(C, 17, () => e.get(u), (h) => h.id, (h, c) => {
1113
+ var d = e.comment(), z = e.first_child(d);
1046
1114
  {
1047
- var G = (l) => {
1048
- var C = er();
1115
+ var B = (p) => {
1116
+ var f = sr();
1049
1117
  e.template_effect(() => {
1050
- e.set_class(C, 1, `absolute border-2 transition-colors cursor-pointer pointer-events-auto ${e.get(v).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(C, `
1051
- left: ${e.get(v).rect.x ?? ""}px;
1052
- top: ${e.get(v).rect.y ?? ""}px;
1053
- width: ${e.get(v).rect.width ?? ""}px;
1054
- height: ${e.get(v).rect.height ?? ""}px;
1055
- `), e.set_attribute(C, "title", e.get(v).tooltip);
1056
- }), e.append(l, C);
1057
- }, L = (l) => {
1058
- var C = e.comment(), _ = e.first_child(C);
1118
+ e.set_class(f, 1, `absolute border-2 transition-colors cursor-pointer pointer-events-auto ${e.get(c).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(f, `
1119
+ left: ${e.get(c).rect.x ?? ""}px;
1120
+ top: ${e.get(c).rect.y ?? ""}px;
1121
+ width: ${e.get(c).rect.width ?? ""}px;
1122
+ height: ${e.get(c).rect.height ?? ""}px;
1123
+ `), e.set_attribute(f, "title", e.get(c).tooltip);
1124
+ }), e.append(p, f);
1125
+ }, E = (p) => {
1126
+ var f = e.comment(), o = e.first_child(f);
1059
1127
  {
1060
- var x = (D) => {
1061
- var b = tr(), h = e.child(b), H = e.child(h, !0);
1062
- e.reset(h);
1063
- var W = e.sibling(h);
1064
- e.reset(b), e.template_effect(
1128
+ var M = (y) => {
1129
+ var w = nr(), T = e.child(w), L = e.child(T, !0);
1130
+ e.reset(T);
1131
+ var A = e.sibling(T);
1132
+ e.reset(w), e.template_effect(
1065
1133
  (m) => {
1066
- e.set_style(b, `
1067
- left: ${e.get(v).bounds.x ?? ""}px;
1068
- top: ${e.get(v).bounds.y ?? ""}px;
1069
- width: ${e.get(v).bounds.width ?? ""}px;
1070
- height: ${e.get(v).bounds.height ?? ""}px;
1071
- `), e.set_text(H, e.get(v).tooltip), e.set_attribute(W, "points", m), e.set_class(W, 0, `cursor-pointer transition-colors ${e.get(v).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"}`);
1134
+ e.set_style(w, `
1135
+ left: ${e.get(c).bounds.x ?? ""}px;
1136
+ top: ${e.get(c).bounds.y ?? ""}px;
1137
+ width: ${e.get(c).bounds.width ?? ""}px;
1138
+ height: ${e.get(c).bounds.height ?? ""}px;
1139
+ `), e.set_text(L, e.get(c).tooltip), e.set_attribute(A, "points", m), e.set_class(A, 0, `cursor-pointer transition-colors ${e.get(c).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"}`);
1072
1140
  },
1073
- [() => e.get(v).points.map((m) => m.join(",")).join(" ")]
1074
- ), e.append(D, b);
1141
+ [() => e.get(c).points.map((m) => m.join(",")).join(" ")]
1142
+ ), e.append(y, w);
1075
1143
  };
1076
1144
  e.if(
1077
- _,
1078
- (D) => {
1079
- e.get(v).type === "POLYGON" && D(x);
1145
+ o,
1146
+ (y) => {
1147
+ e.get(c).type === "POLYGON" && y(M);
1080
1148
  },
1081
1149
  !0
1082
1150
  );
1083
1151
  }
1084
- e.append(l, C);
1152
+ e.append(p, f);
1085
1153
  };
1086
- e.if(S, (l) => {
1087
- e.get(v).type === "RECTANGLE" ? l(G) : l(L, !1);
1154
+ e.if(z, (p) => {
1155
+ e.get(c).type === "RECTANGLE" ? p(B) : p(E, !1);
1088
1156
  });
1089
1157
  }
1090
- e.append(f, o);
1091
- }), e.reset(d), e.append(i, d), e.pop(z);
1158
+ e.append(h, d);
1159
+ }), e.reset(g), e.append(i, g), e.pop(R);
1092
1160
  }
1093
- e.create_custom_element(Ze, { tileSources: {}, viewerState: {} }, [], [], !0);
1094
- var ir = e.from_html('<div class="select-none 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 bottom-4"><button class="btn btn-circle btn-sm btn-ghost"><!></button> <span class="text-sm font-mono tabular-nums text-nowrap"> </span> <button class="btn btn-circle btn-sm btn-ghost"><!></button></div>');
1095
- function et(i, t) {
1161
+ e.create_custom_element(st, { tileSources: {}, viewerState: {} }, [], [], !0);
1162
+ var or = e.from_html('<div class="select-none absolute left-1/2 -translate-x-1/2 bg-base-200/90 backdrop-blur rounded-full shadow-lg flex items-center gap-4 z-10 border border-base-300 transition-all duration-200 bottom-4"><button class="btn btn-circle btn-sm btn-ghost"><!></button> <span class="text-sm font-mono tabular-nums text-nowrap"> </span> <button class="btn btn-circle btn-sm btn-ghost"><!></button></div>');
1163
+ function nt(i, t) {
1096
1164
  e.push(t, !0);
1097
1165
  let r = e.prop(t, "viewerState", 7);
1098
1166
  var s = {
1099
1167
  get viewerState() {
1100
1168
  return r();
1101
1169
  },
1102
- set viewerState(z) {
1103
- r(z), e.flush();
1170
+ set viewerState(R) {
1171
+ r(R), e.flush();
1104
1172
  }
1105
- }, n = ir(), a = e.child(n);
1173
+ }, n = or(), a = e.child(n);
1106
1174
  a.__click = () => r().previousCanvas();
1107
- var y = e.child(a);
1108
- vt(y, { size: 20, weight: "bold" }), e.reset(a);
1109
- var I = e.sibling(a, 2), c = e.child(I);
1110
- e.reset(I);
1111
- var w = e.sibling(I, 2);
1112
- w.__click = () => r().nextCanvas();
1113
- var k = e.child(w);
1114
- return ht(k, { size: 20, weight: "bold" }), e.reset(w), e.reset(n), e.template_effect(
1115
- (z, d) => {
1116
- a.disabled = !r().hasPrevious, e.set_attribute(a, "aria-label", z), e.set_text(c, `${r().currentCanvasIndex + 1} / ${r().canvases.length ?? ""}`), w.disabled = !r().hasNext, e.set_attribute(w, "aria-label", d);
1175
+ var S = e.child(a);
1176
+ bt(S, { size: 20, weight: "bold" }), e.reset(a);
1177
+ var P = e.sibling(a, 2), _ = e.child(P);
1178
+ e.reset(P);
1179
+ var I = e.sibling(P, 2);
1180
+ I.__click = () => r().nextCanvas();
1181
+ var u = e.child(I);
1182
+ return _t(u, { size: 20, weight: "bold" }), e.reset(I), e.reset(n), e.template_effect(
1183
+ (R, g) => {
1184
+ a.disabled = !r().hasPrevious, e.set_attribute(a, "aria-label", R), e.set_text(_, `${r().currentCanvasIndex + 1} / ${r().canvases.length ?? ""}`), I.disabled = !r().hasNext, e.set_attribute(I, "aria-label", g);
1117
1185
  },
1118
- [() => B.previous_canvas(), () => B.next_canvas()]
1186
+ [() => V.previous_canvas(), () => V.next_canvas()]
1119
1187
  ), e.append(i, n), e.pop(s);
1120
1188
  }
1121
1189
  e.delegate(["click"]);
1122
- e.create_custom_element(et, { viewerState: {} }, [], [], !0);
1123
- var sr = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), nr = 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>'), ar = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations available.</div>'), or = e.from_html('<div class="absolute top-4 right-4 z-500 pointer-events-auto transition-all duration-300"><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>');
1124
- function tt(i, t) {
1190
+ e.create_custom_element(nt, { viewerState: {} }, [], [], !0);
1191
+ var lr = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), cr = 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>'), dr = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations available.</div>'), fr = e.from_html('<div class="absolute top-4 right-4 z-40 pointer-events-auto transition-all duration-300"><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>');
1192
+ function at(i, t) {
1125
1193
  e.push(t, !0);
1126
- const r = oe(se);
1194
+ const r = fe(ce);
1127
1195
  let s = e.derived(() => {
1128
1196
  if (!r.manifestId || !r.canvasId)
1129
1197
  return [];
1130
- const d = ae.getAnnotations(r.manifestId, r.canvasId), g = r.currentCanvasSearchAnnotations;
1131
- return [...d, ...g];
1198
+ const g = le.getAnnotations(r.manifestId, r.canvasId), v = r.currentCanvasSearchAnnotations;
1199
+ return [...g, ...v];
1132
1200
  });
1133
- function n(d) {
1134
- return d.id || d["@id"] || (typeof d.getId == "function" ? d.getId() : "") || "";
1201
+ function n(g) {
1202
+ return g.id || g["@id"] || (typeof g.getId == "function" ? g.getId() : "") || "";
1135
1203
  }
1136
1204
  e.user_effect(() => {
1137
- if (e.get(s).length > 0) {
1138
- const d = /* @__PURE__ */ new Set();
1139
- e.get(s).forEach((g) => {
1140
- const p = n(g);
1141
- p && d.add(p);
1142
- }), r.visibleAnnotationIds = d;
1143
- } else
1205
+ var g;
1206
+ if (e.get(s).length > 0)
1207
+ if (((g = r.config.annotations) == null ? void 0 : g.visible) ?? !0) {
1208
+ const C = /* @__PURE__ */ new Set();
1209
+ e.get(s).forEach((h) => {
1210
+ const c = n(h);
1211
+ c && C.add(c);
1212
+ }), r.visibleAnnotationIds = C;
1213
+ } else
1214
+ r.visibleAnnotationIds = /* @__PURE__ */ new Set();
1215
+ else
1144
1216
  r.visibleAnnotationIds = /* @__PURE__ */ new Set();
1145
1217
  });
1146
- let a = e.derived(() => e.get(s).length === 0 ? !1 : e.get(s).every((d) => {
1147
- const g = n(d);
1148
- return !g || r.visibleAnnotationIds.has(g);
1218
+ let a = e.derived(() => e.get(s).length === 0 ? !1 : e.get(s).every((g) => {
1219
+ const v = n(g);
1220
+ return !v || r.visibleAnnotationIds.has(v);
1149
1221
  }));
1150
- function y(d) {
1151
- r.visibleAnnotationIds.has(d) ? r.visibleAnnotationIds.delete(d) : r.visibleAnnotationIds.add(d), r.visibleAnnotationIds = new Set(r.visibleAnnotationIds);
1222
+ function S(g) {
1223
+ r.visibleAnnotationIds.has(g) ? r.visibleAnnotationIds.delete(g) : r.visibleAnnotationIds.add(g), r.visibleAnnotationIds = new Set(r.visibleAnnotationIds);
1152
1224
  }
1153
- function I() {
1225
+ function P() {
1154
1226
  if (e.get(a))
1155
1227
  r.visibleAnnotationIds = /* @__PURE__ */ new Set();
1156
1228
  else {
1157
- const d = /* @__PURE__ */ new Set();
1158
- e.get(s).forEach((g) => {
1159
- const p = n(g);
1160
- p && d.add(p);
1161
- }), r.visibleAnnotationIds = d;
1229
+ const g = /* @__PURE__ */ new Set();
1230
+ e.get(s).forEach((v) => {
1231
+ const C = n(v);
1232
+ C && g.add(C);
1233
+ }), r.visibleAnnotationIds = g;
1162
1234
  }
1163
1235
  }
1164
- let c = e.derived(() => e.get(s).length ? e.get(s).map((d) => {
1165
- let g = "", p = !1;
1166
- if (typeof d.getBody == "function") {
1167
- const f = d.getBody();
1168
- if (f && f.length) {
1169
- const v = (o) => {
1170
- const S = o.getValue ? o.getValue() : null;
1171
- return S || "";
1236
+ let _ = e.derived(() => e.get(s).length ? e.get(s).map((g) => {
1237
+ let v = "", C = !1;
1238
+ if (typeof g.getBody == "function") {
1239
+ const h = g.getBody();
1240
+ if (h && h.length) {
1241
+ const c = (d) => {
1242
+ const z = d.getValue ? d.getValue() : null;
1243
+ return z || "";
1172
1244
  };
1173
- g = f.map((o) => v(o)).filter(Boolean).join(" "), p = f.some((o) => {
1174
- const S = o.getFormat ? o.getFormat() : "";
1175
- return S === "text/html" || S === "application/html";
1245
+ v = h.map((d) => c(d)).filter(Boolean).join(" "), C = h.some((d) => {
1246
+ const z = d.getFormat ? d.getFormat() : "";
1247
+ return z === "text/html" || z === "application/html";
1176
1248
  });
1177
1249
  }
1178
- if (!g && typeof d.getLabel == "function") {
1179
- const v = d.getLabel();
1180
- v && (g = v);
1250
+ if (!v && typeof g.getLabel == "function") {
1251
+ const c = g.getLabel();
1252
+ c && (v = c);
1181
1253
  }
1182
1254
  } else {
1183
- const f = (o) => o && (o.chars || o.value || o["cnt:chars"]) || "", v = (o) => o ? o.format === "text/html" || o.type === "TextualBody" : !1;
1184
- if (d.resource ? Array.isArray(d.resource) ? (g = d.resource.map((o) => f(o)).join(" "), d.resource.some((o) => v(o)) && (p = !0)) : (g = f(d.resource), v(d.resource) && (p = !0)) : d.body && (Array.isArray(d.body) ? (g = d.body.map((o) => f(o)).join(" "), d.body.some((o) => v(o)) && (p = !0)) : (g = f(d.body), v(d.body) && (p = !0))), !g) {
1185
- const o = d.label || d.name || d.title;
1186
- o && (g = Array.isArray(o) ? o.join(" ") : o);
1255
+ const h = (d) => d && (d.chars || d.value || d["cnt:chars"]) || "", c = (d) => d ? d.format === "text/html" || d.type === "TextualBody" : !1;
1256
+ if (g.resource ? Array.isArray(g.resource) ? (v = g.resource.map((d) => h(d)).join(" "), g.resource.some((d) => c(d)) && (C = !0)) : (v = h(g.resource), c(g.resource) && (C = !0)) : g.body && (Array.isArray(g.body) ? (v = g.body.map((d) => h(d)).join(" "), g.body.some((d) => c(d)) && (C = !0)) : (v = h(g.body), c(g.body) && (C = !0))), !v) {
1257
+ const d = g.label || g.name || g.title;
1258
+ d && (v = Array.isArray(d) ? d.join(" ") : d);
1187
1259
  }
1188
1260
  }
1189
1261
  return {
1190
- id: n(d),
1191
- content: g,
1192
- isHtml: p,
1193
- label: (typeof d.getLabel == "function" ? d.getLabel() : d.label) || ""
1262
+ id: n(g),
1263
+ content: v,
1264
+ isHtml: C,
1265
+ label: (typeof g.getLabel == "function" ? g.getLabel() : g.label) || ""
1194
1266
  };
1195
1267
  }) : []);
1196
- var w = e.comment(), k = e.first_child(w);
1268
+ var I = e.comment(), u = e.first_child(I);
1197
1269
  {
1198
- var z = (d) => {
1199
- var g = or(), p = e.child(g), f = e.child(p), v = e.child(f);
1200
- v.__click = (b) => {
1201
- b.preventDefault(), I();
1270
+ var R = (g) => {
1271
+ var v = fr(), C = e.child(v), h = e.child(C), c = e.child(h);
1272
+ c.__click = (w) => {
1273
+ w.preventDefault(), P();
1202
1274
  };
1203
- var o = e.child(v);
1275
+ var d = e.child(c);
1204
1276
  {
1205
- var S = (b) => {
1206
- He(b, { size: 16, weight: "bold" });
1207
- }, G = (b) => {
1208
- Ne(b, { size: 16, weight: "bold" });
1277
+ var z = (w) => {
1278
+ We(w, { size: 16, weight: "bold" });
1279
+ }, B = (w) => {
1280
+ Ue(w, { size: 16, weight: "bold" });
1209
1281
  };
1210
- e.if(o, (b) => {
1211
- e.get(a) ? b(S) : b(G, !1);
1282
+ e.if(d, (w) => {
1283
+ e.get(a) ? w(z) : w(B, !1);
1212
1284
  });
1213
1285
  }
1214
- e.reset(v);
1215
- var L = e.sibling(v, 2), l = e.child(L), C = e.sibling(l), _ = e.child(C, !0);
1216
- e.reset(C), e.reset(L);
1217
- var x = e.sibling(L, 2);
1218
- mt(x, {
1286
+ e.reset(c);
1287
+ var E = e.sibling(c, 2), p = e.child(E), f = e.sibling(p), o = e.child(f, !0);
1288
+ e.reset(f), e.reset(E);
1289
+ var M = e.sibling(E, 2);
1290
+ wt(M, {
1219
1291
  size: 16,
1220
1292
  weight: "bold",
1221
1293
  class: "group-open:rotate-180 transition-transform opacity-80"
1222
- }), e.reset(f);
1223
- var D = e.sibling(f, 2);
1294
+ }), e.reset(h);
1295
+ var y = e.sibling(h, 2);
1224
1296
  e.each(
1225
- D,
1297
+ y,
1226
1298
  21,
1227
- () => e.get(c),
1299
+ () => e.get(_),
1228
1300
  e.index,
1229
- (b, h, H) => {
1230
- const W = e.derived(() => r.visibleAnnotationIds.has(e.get(h).id));
1231
- var m = nr();
1232
- m.__click = (R) => {
1233
- R.preventDefault(), y(e.get(h).id);
1301
+ (w, T, L) => {
1302
+ const A = e.derived(() => r.visibleAnnotationIds.has(e.get(T).id));
1303
+ var m = cr();
1304
+ m.__click = (l) => {
1305
+ l.preventDefault(), S(e.get(T).id);
1234
1306
  };
1235
- var P = e.child(m), O = e.child(P);
1307
+ var O = e.child(m), x = e.child(O);
1236
1308
  {
1237
- var Q = (R) => {
1238
- He(R, { size: 16, weight: "bold" });
1239
- }, U = (R) => {
1240
- Ne(R, { size: 16, weight: "bold" });
1309
+ var $ = (l) => {
1310
+ We(l, { size: 16, weight: "bold" });
1311
+ }, W = (l) => {
1312
+ Ue(l, { size: 16, weight: "bold" });
1241
1313
  };
1242
- e.if(O, (R) => {
1243
- e.get(W) ? R(Q) : R(U, !1);
1314
+ e.if(x, (l) => {
1315
+ e.get(A) ? l($) : l(W, !1);
1244
1316
  });
1245
1317
  }
1246
- e.reset(P);
1247
- var $ = e.sibling(P, 2), F = e.child($), q = e.child(F);
1248
- q.textContent = `#${H + 1}`;
1249
- var J = e.sibling(q, 2);
1318
+ e.reset(O);
1319
+ var Q = e.sibling(O, 2), j = e.child(Q), G = e.child(j);
1320
+ G.textContent = `#${L + 1}`;
1321
+ var q = e.sibling(G, 2);
1250
1322
  {
1251
- var ie = (R) => {
1252
- var j = sr(), M = e.child(j, !0);
1253
- e.reset(j), e.template_effect(() => e.set_text(M, e.get(h).label)), e.append(R, j);
1323
+ var te = (l) => {
1324
+ var b = lr(), N = e.child(b, !0);
1325
+ e.reset(b), e.template_effect(() => e.set_text(N, e.get(T).label)), e.append(l, b);
1254
1326
  };
1255
- e.if(J, (R) => {
1256
- e.get(h).label && e.get(h).label !== e.get(h).content && R(ie);
1327
+ e.if(q, (l) => {
1328
+ e.get(T).label && e.get(T).label !== e.get(T).content && l(te);
1257
1329
  });
1258
1330
  }
1259
- e.reset(F);
1260
- var u = e.sibling(F, 2), T = e.child(u);
1331
+ e.reset(j);
1332
+ var se = e.sibling(j, 2), ne = e.child(se);
1261
1333
  {
1262
- var N = (R) => {
1263
- var j = e.comment(), M = e.first_child(j);
1264
- e.html(M, () => e.get(h).content), e.append(R, j);
1265
- }, E = (R) => {
1266
- var j = e.text();
1267
- e.template_effect(() => e.set_text(j, e.get(h).content || "(No content)")), e.append(R, j);
1334
+ var ae = (l) => {
1335
+ var b = e.comment(), N = e.first_child(b);
1336
+ e.html(N, () => e.get(T).content), e.append(l, b);
1337
+ }, oe = (l) => {
1338
+ var b = e.text();
1339
+ e.template_effect(() => e.set_text(b, e.get(T).content || "(No content)")), e.append(l, b);
1268
1340
  };
1269
- e.if(T, (R) => {
1270
- e.get(h).isHtml ? R(N) : R(E, !1);
1341
+ e.if(ne, (l) => {
1342
+ e.get(T).isHtml ? l(ae) : l(oe, !1);
1271
1343
  });
1272
1344
  }
1273
- e.reset(u), e.reset($), e.reset(m), e.template_effect(() => e.set_class(u, 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(W) ? "" : "opacity-50"}`)), e.append(b, m);
1345
+ e.reset(se), e.reset(Q), e.reset(m), e.template_effect(() => e.set_class(se, 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(w, m);
1274
1346
  },
1275
- (b) => {
1276
- var h = ar();
1277
- e.append(b, h);
1347
+ (w) => {
1348
+ var T = dr();
1349
+ e.append(w, T);
1278
1350
  }
1279
- ), e.reset(D), e.reset(p), e.reset(g), e.template_effect(
1280
- (b, h, H) => {
1281
- e.set_attribute(v, "title", b), e.set_text(l, `${h ?? ""} `), e.set_text(_, H);
1351
+ ), e.reset(y), e.reset(C), e.reset(v), e.template_effect(
1352
+ (w, T, L) => {
1353
+ e.set_attribute(c, "title", w), e.set_text(p, `${T ?? ""} `), e.set_text(o, L);
1282
1354
  },
1283
1355
  [
1284
- () => e.get(a) ? B.hide_all_annotations() : B.show_all_annotations(),
1285
- () => B.annotations_count({ count: e.get(s).length }),
1286
- () => B.visible_count({ count: r.visibleAnnotationIds.size })
1356
+ () => e.get(a) ? V.hide_all_annotations() : V.show_all_annotations(),
1357
+ () => V.annotations_count({ count: e.get(s).length }),
1358
+ () => V.visible_count({ count: r.visibleAnnotationIds.size })
1287
1359
  ]
1288
- ), e.append(d, g);
1360
+ ), e.append(g, v);
1289
1361
  };
1290
- e.if(k, (d) => {
1291
- r.showAnnotations && d(z);
1362
+ e.if(u, (g) => {
1363
+ r.showAnnotations && g(R);
1292
1364
  });
1293
1365
  }
1294
- e.append(i, w), e.pop();
1366
+ e.append(i, I), e.pop();
1295
1367
  }
1296
1368
  e.delegate(["click"]);
1297
- e.create_custom_element(tt, {}, [], [], !0);
1298
- var lr = e.from_html('<img class="object-contain w-full h-full" loading="lazy" draggable="false"/>'), cr = e.from_html('<span class="opacity-20 text-4xl">?</span>'), dr = 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>'), fr = 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>'), ur = 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), gr = 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);
1299
- function ne(i, t) {
1369
+ e.create_custom_element(at, {}, [], [], !0);
1370
+ var ur = e.from_html('<button class="absolute top-1 right-1 btn btn-error btn-xs btn-circle z-20" aria-label="Close Gallery"><!></button>'), gr = e.from_html('<div><div role="button" tabindex="0" aria-label="Drag Gallery"><div></div></div></div>'), hr = e.from_html('<img class="object-contain w-full h-full" loading="lazy" draggable="false"/>'), vr = e.from_html('<span class="opacity-20 text-4xl">?</span>'), pr = 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>'), mr = 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>'), br = 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), _r = e.from_html("<div><!> <!> <div><div></div></div> <!></div> <!>", 1);
1371
+ function de(i, t) {
1300
1372
  e.push(t, !0);
1301
- const r = oe(se);
1302
- let s = e.prop(t, "canvases", 7), n = e.state(!1), a = { x: 0, y: 0, w: 0, h: 0 }, y = e.state(null), I = e.derived(() => !s() || !Array.isArray(s()) ? [] : s().map((l, C) => {
1303
- let _ = "";
1373
+ const r = fe(ce);
1374
+ let s = e.derived(() => {
1375
+ var o;
1376
+ return ((o = r.config.gallery) == null ? void 0 : o.draggable) ?? !0;
1377
+ }), n = e.derived(() => {
1378
+ var o;
1379
+ return ((o = r.config.gallery) == null ? void 0 : o.showCloseButton) ?? !0;
1380
+ }), a = e.prop(t, "canvases", 7), S = e.state(!1), P = { x: 0, y: 0, w: 0, h: 0 }, _ = e.state(null), I = e.derived(() => !a() || !Array.isArray(a()) ? [] : a().map((o, M) => {
1381
+ let y = "";
1304
1382
  try {
1305
- if (l.getThumbnail) {
1306
- const x = l.getThumbnail();
1307
- x && (_ = typeof x == "string" ? x : x.id || x["@id"]);
1383
+ if (o.getThumbnail) {
1384
+ const w = o.getThumbnail();
1385
+ w && (y = typeof w == "string" ? w : w.id || w["@id"]);
1308
1386
  }
1309
- } catch (x) {
1310
- console.warn("Error getting thumbnail", x);
1387
+ } catch (w) {
1388
+ console.warn("Error getting thumbnail", w);
1311
1389
  }
1312
- if (!_) {
1313
- let x = l.getImages();
1314
- if ((!x || !x.length) && l.getContent && (x = l.getContent()), x && x.length > 0) {
1315
- const D = x[0];
1316
- let b = D.getResource ? D.getResource() : null;
1317
- if (!b && D.getBody) {
1318
- const h = D.getBody();
1319
- Array.isArray(h) && h.length > 0 ? b = h[0] : h && (b = h);
1390
+ if (!y) {
1391
+ let w = o.getImages();
1392
+ if ((!w || !w.length) && o.getContent && (w = o.getContent()), w && w.length > 0) {
1393
+ const T = w[0];
1394
+ let L = T.getResource ? T.getResource() : null;
1395
+ if (!L && T.getBody) {
1396
+ const A = T.getBody();
1397
+ Array.isArray(A) && A.length > 0 ? L = A[0] : A && (L = A);
1320
1398
  }
1321
- if (b && !b.id && !b.__jsonld && (!b.getServices || b.getServices().length === 0) && (b = null), !b) {
1322
- const h = D.__jsonld || D;
1323
- h.body && (b = Array.isArray(h.body) ? h.body[0] : h.body);
1399
+ if (L && !L.id && !L.__jsonld && (!L.getServices || L.getServices().length === 0) && (L = null), !L) {
1400
+ const A = T.__jsonld || T;
1401
+ A.body && (L = Array.isArray(A.body) ? A.body[0] : A.body);
1324
1402
  }
1325
- if (b) {
1326
- const H = (() => {
1327
- let m = [];
1328
- if (b.getServices && (m = b.getServices()), !m || m.length === 0) {
1329
- const P = b.__jsonld || b;
1330
- P.service && (m = Array.isArray(P.service) ? P.service : [P.service]);
1403
+ if (L) {
1404
+ const m = (() => {
1405
+ let x = [];
1406
+ if (L.getServices && (x = L.getServices()), !x || x.length === 0) {
1407
+ const $ = L.__jsonld || L;
1408
+ $.service && (x = Array.isArray($.service) ? $.service : [$.service]);
1331
1409
  }
1332
- return m;
1410
+ return x;
1333
1411
  })();
1334
- let W = !1;
1335
- if (H.length > 0) {
1336
- const m = H[0];
1337
- let P = "";
1412
+ let O = !1;
1413
+ if (m.length > 0) {
1414
+ const x = m[0];
1415
+ let $ = "";
1338
1416
  try {
1339
- if (P = m.getProfile ? m.getProfile() : m.profile || "", typeof P == "object" && P) {
1340
- const U = P;
1341
- P = U.value || U.id || U["@id"] || JSON.stringify(U);
1417
+ if ($ = x.getProfile ? x.getProfile() : x.profile || "", typeof $ == "object" && $) {
1418
+ const j = $;
1419
+ $ = j.value || j.id || j["@id"] || JSON.stringify(j);
1342
1420
  }
1343
1421
  } catch {
1344
1422
  }
1345
- const O = String(P ?? "").toLowerCase();
1346
- (O.includes("level0") || O.includes("level-0")) && (W = !0);
1347
- const Q = m.id || m["@id"];
1348
- W || (_ = `${Q}/full/200,/0/default.jpg`);
1423
+ const W = String($ ?? "").toLowerCase();
1424
+ (W.includes("level0") || W.includes("level-0")) && (O = !0);
1425
+ const Q = x.id || x["@id"];
1426
+ O || (y = `${Q}/full/200,/0/default.jpg`);
1349
1427
  }
1350
- if (!_ && (_ = b.id || b["@id"], !_)) {
1351
- let m = null;
1352
- if (D.__jsonld && D.__jsonld.body ? m = D.__jsonld.body : D.body && (m = D.body), m) {
1353
- const P = Array.isArray(m) ? m[0] : m;
1354
- _ = P.id || P["@id"];
1428
+ if (!y && (y = L.id || L["@id"], !y)) {
1429
+ let x = null;
1430
+ if (T.__jsonld && T.__jsonld.body ? x = T.__jsonld.body : T.body && (x = T.body), x) {
1431
+ const $ = Array.isArray(x) ? x[0] : x;
1432
+ y = $.id || $["@id"];
1355
1433
  }
1356
1434
  }
1357
1435
  }
1358
1436
  }
1359
1437
  }
1360
1438
  return {
1361
- id: l.id,
1362
- label: l.getLabel().length ? l.getLabel()[0].value : `Canvas ${C + 1}`,
1363
- src: _,
1364
- index: C
1439
+ id: o.id,
1440
+ label: o.getLabel().length ? o.getLabel()[0].value : `Canvas ${M + 1}`,
1441
+ src: y,
1442
+ index: M
1365
1443
  };
1366
1444
  }));
1367
- function c(l) {
1445
+ function u(o) {
1368
1446
  if (!r.isGalleryDragging) return;
1369
- let C = l.clientX - r.galleryDragOffset.x, _ = l.clientY - r.galleryDragOffset.y;
1370
- const x = Math.max(0, window.innerWidth - r.gallerySize.width), D = Math.max(0, window.innerHeight - r.gallerySize.height);
1371
- C = Math.max(0, Math.min(C, x)), _ = Math.max(0, Math.min(_, D)), r.galleryPosition = { x: C, y: _ };
1372
- const b = document.getElementById("triiiceratops-center-panel");
1373
- if (b) {
1374
- const h = b.getBoundingClientRect(), H = l.clientX, W = l.clientY, m = 60;
1375
- r.dragOverSide = null, H >= h.left && H <= h.left + m ? r.dragOverSide = "left" : H <= h.right && H >= h.right - m ? r.dragOverSide = "right" : W >= h.top && W <= h.top + m ? r.dragOverSide = "top" : W <= h.bottom && W >= h.bottom - m && (r.dragOverSide = "bottom");
1447
+ let M = o.clientX - r.galleryDragOffset.x, y = o.clientY - r.galleryDragOffset.y;
1448
+ const w = Math.max(0, window.innerWidth - r.gallerySize.width), T = Math.max(0, window.innerHeight - r.gallerySize.height);
1449
+ M = Math.max(0, Math.min(M, w)), y = Math.max(0, Math.min(y, T)), r.galleryPosition = { x: M, y };
1450
+ const L = r.galleryCenterPanelRect;
1451
+ if (!L) {
1452
+ console.warn("[Gallery] No center panel rect available");
1453
+ return;
1376
1454
  }
1455
+ const A = o.clientX, m = o.clientY, O = 60;
1456
+ r.dragOverSide = null, A >= L.left && A <= L.left + O ? r.dragOverSide = "left" : A <= L.right && A >= L.right - O ? r.dragOverSide = "right" : m >= L.top && m <= L.top + O ? r.dragOverSide = "top" : m <= L.bottom && m >= L.bottom - O && (r.dragOverSide = "bottom");
1377
1457
  }
1378
- function w() {
1379
- const l = r.dragOverSide;
1380
- r.isGalleryDragging = !1, r.dragOverSide = null, window.removeEventListener("mousemove", c), window.removeEventListener("mouseup", w), l && (r.dockSide = l);
1458
+ function R() {
1459
+ const o = r.dragOverSide;
1460
+ console.log("[Gallery] stopDrag. dropTarget:", o), r.isGalleryDragging = !1, r.dragOverSide = null, window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", R), o && (r.dockSide = o);
1381
1461
  }
1382
- function k(l) {
1383
- l.stopPropagation(), e.set(n, !0), a = {
1384
- x: l.clientX,
1385
- y: l.clientY,
1462
+ function g(o) {
1463
+ o.stopPropagation(), e.set(S, !0), P = {
1464
+ x: o.clientX,
1465
+ y: o.clientY,
1386
1466
  w: r.gallerySize.width,
1387
1467
  h: r.gallerySize.height
1388
- }, window.addEventListener("mousemove", z), window.addEventListener("mouseup", d);
1468
+ }, window.addEventListener("mousemove", v), window.addEventListener("mouseup", C);
1389
1469
  }
1390
- function z(l) {
1391
- if (!e.get(n)) return;
1392
- const C = l.clientX - a.x, _ = l.clientY - a.y;
1470
+ function v(o) {
1471
+ if (!e.get(S)) return;
1472
+ const M = o.clientX - P.x, y = o.clientY - P.y;
1393
1473
  r.gallerySize = {
1394
- width: Math.max(200, a.w + C),
1395
- height: Math.max(200, a.h + _)
1474
+ width: Math.max(200, P.w + M),
1475
+ height: Math.max(200, P.h + y)
1396
1476
  };
1397
1477
  }
1398
- function d() {
1399
- e.set(n, !1), window.removeEventListener("mousemove", z), window.removeEventListener("mouseup", d);
1478
+ function C() {
1479
+ e.set(S, !1), window.removeEventListener("mousemove", v), window.removeEventListener("mouseup", C);
1400
1480
  }
1401
- function g(l) {
1402
- r.canvasId = l;
1481
+ function h(o) {
1482
+ r.canvasId = o;
1403
1483
  }
1404
- let p = e.state(e.proxy(r.dockSide));
1484
+ let c = e.state(e.proxy(r.dockSide));
1405
1485
  e.user_effect(() => {
1406
- const l = r.dockSide;
1407
- e.set(p, l === "none" || l === "top" || l === "bottom" || l === "left" || l === "right" ? l : "none", !0);
1486
+ const o = r.dockSide;
1487
+ e.set(c, o === "none" || o === "top" || o === "bottom" || o === "left" || o === "right" ? o : "none", !0);
1408
1488
  }), e.user_effect(() => {
1409
- r.dockSide !== e.get(p) && (r.dockSide = e.get(p), r.isGalleryDockedBottom = e.get(p) === "bottom", r.isGalleryDockedRight = e.get(p) === "right");
1489
+ r.dockSide !== e.get(c) && (r.dockSide = e.get(c), r.isGalleryDockedBottom = e.get(c) === "bottom", r.isGalleryDockedRight = e.get(c) === "right");
1410
1490
  });
1411
- let f = e.derived(() => e.get(p) === "top" || e.get(p) === "bottom" || e.get(p) === "none" && r.gallerySize.height < 320);
1412
- function v(l) {
1413
- if (!l.target.closest(".resize-handle")) {
1414
- if (e.get(p) !== "none") {
1415
- let C = Math.max(0, l.clientX - 150), _ = Math.max(0, l.clientY - 20);
1416
- const x = Math.max(0, window.innerWidth - 300), D = Math.max(0, window.innerHeight - 400);
1417
- C = Math.min(C, x), _ = Math.min(_, D), r.galleryPosition = { x: C, y: _ }, r.galleryDragOffset = { x: l.clientX - C, y: l.clientY - _ }, e.set(p, "none");
1418
- } else
1419
- r.galleryDragOffset = {
1420
- x: l.clientX - r.galleryPosition.x,
1421
- y: l.clientY - r.galleryPosition.y
1422
- };
1423
- r.isGalleryDragging = !0, window.addEventListener("mousemove", c), window.addEventListener("mouseup", w);
1424
- }
1491
+ let d = e.derived(() => e.get(c) === "top" || e.get(c) === "bottom" || e.get(c) === "none" && r.gallerySize.height < 320);
1492
+ function z(o) {
1493
+ var T, L;
1494
+ if (!e.get(
1495
+ s
1496
+ // Dragging disabled in config
1497
+ ) || o.target.closest(".resize-handle")) return;
1498
+ const M = e.get(c) !== "none";
1499
+ if (M) {
1500
+ let A = Math.max(0, o.clientX - 150), m = Math.max(0, o.clientY - 20);
1501
+ const O = Math.max(0, window.innerWidth - 300), x = Math.max(0, window.innerHeight - 400);
1502
+ A = Math.min(A, O), m = Math.min(m, x), r.galleryPosition = { x: A, y: m }, r.galleryDragOffset = { x: o.clientX - A, y: o.clientY - m };
1503
+ } else
1504
+ r.galleryDragOffset = {
1505
+ x: o.clientX - r.galleryPosition.x,
1506
+ y: o.clientY - r.galleryPosition.y
1507
+ };
1508
+ const y = (T = e.get(_)) == null ? void 0 : T.getRootNode(), w = ((L = y == null ? void 0 : y.getElementById) == null ? void 0 : L.call(y, "triiiceratops-center-panel")) ?? document.getElementById("triiiceratops-center-panel");
1509
+ w ? (r.galleryCenterPanelRect = w.getBoundingClientRect(), console.log("[Gallery] Captured center panel rect:", r.galleryCenterPanelRect)) : console.warn("[Gallery] Could not find center panel in startDrag"), r.isGalleryDragging = !0, window.addEventListener("mousemove", u), window.addEventListener("mouseup", R), M && e.set(c, "none");
1425
1510
  }
1426
- var o = {
1511
+ var B = {
1427
1512
  get canvases() {
1428
- return s();
1513
+ return a();
1429
1514
  },
1430
- set canvases(l) {
1431
- s(l), e.flush();
1515
+ set canvases(o) {
1516
+ a(o), e.flush();
1432
1517
  }
1433
- }, S = e.comment(), G = e.first_child(S);
1518
+ }, E = e.comment(), p = e.first_child(E);
1434
1519
  {
1435
- var L = (l) => {
1436
- var C = gr(), _ = e.first_child(C), x = e.child(_);
1437
- x.__click = () => r.toggleThumbnailGallery();
1438
- var D = e.child(x);
1439
- qe(D, { size: 16, weight: "bold" }), e.reset(x);
1440
- var b = e.sibling(x, 2), h = e.child(b);
1441
- h.__mousedown = v;
1442
- var H = e.child(h);
1443
- e.reset(h), e.reset(b);
1444
- var W = e.sibling(b, 2), m = e.child(W);
1445
- e.each(m, 21, () => e.get(I), e.index, ($, F) => {
1446
- var q = dr();
1447
- q.__click = () => g(e.get(F).id);
1448
- var J = e.child(q), ie = e.child(J);
1520
+ var f = (o) => {
1521
+ var M = _r(), y = e.first_child(M), w = e.child(y);
1522
+ {
1523
+ var T = (j) => {
1524
+ var G = ur();
1525
+ G.__click = () => r.toggleThumbnailGallery();
1526
+ var q = e.child(G);
1527
+ Be(q, { size: 16, weight: "bold" }), e.reset(G), e.append(j, G);
1528
+ };
1529
+ e.if(w, (j) => {
1530
+ e.get(n) && j(T);
1531
+ });
1532
+ }
1533
+ var L = e.sibling(w, 2);
1534
+ {
1535
+ var A = (j) => {
1536
+ var G = gr(), q = e.child(G);
1537
+ q.__mousedown = z;
1538
+ var te = e.child(q);
1539
+ e.reset(q), e.reset(G), e.template_effect(() => {
1540
+ e.set_class(G, 1, "bg-base-100 flex shrink-0 select-none relative " + (e.get(c) === "bottom" || e.get(c) === "top" ? "flex-row h-full items-center border-r border-base-200" : "flex-col w-full border-b border-base-200")), e.set_class(q, 1, "cursor-move flex items-center justify-center hover:bg-base-200/50 active:bg-base-200 transition-colors " + (e.get(c) === "bottom" || e.get(c) === "top" ? "w-8 h-full" : "h-6 w-full")), e.set_class(te, 1, "bg-base-300 rounded-full " + (e.get(c) === "bottom" || e.get(c) === "top" ? "w-1.5 h-12" : "w-12 h-1.5"));
1541
+ }), e.append(j, G);
1542
+ };
1543
+ e.if(L, (j) => {
1544
+ (e.get(s) || e.get(c) === "none") && j(A);
1545
+ });
1546
+ }
1547
+ var m = e.sibling(L, 2), O = e.child(m);
1548
+ e.each(O, 21, () => e.get(I), e.index, (j, G) => {
1549
+ var q = pr();
1550
+ q.__click = () => h(e.get(G).id);
1551
+ var te = e.child(q), se = e.child(te);
1449
1552
  {
1450
- var u = (M) => {
1451
- var Y = lr();
1553
+ var ne = (F) => {
1554
+ var ee = hr();
1452
1555
  e.template_effect(() => {
1453
- e.set_attribute(Y, "src", e.get(F).src), e.set_attribute(Y, "alt", e.get(F).label);
1454
- }), e.append(M, Y);
1455
- }, T = (M) => {
1456
- var Y = cr();
1457
- e.append(M, Y);
1556
+ e.set_attribute(ee, "src", e.get(G).src), e.set_attribute(ee, "alt", e.get(G).label);
1557
+ }), e.append(F, ee);
1558
+ }, ae = (F) => {
1559
+ var ee = vr();
1560
+ e.append(F, ee);
1458
1561
  };
1459
- e.if(ie, (M) => {
1460
- e.get(F).src ? M(u) : M(T, !1);
1562
+ e.if(se, (F) => {
1563
+ e.get(G).src ? F(ne) : F(ae, !1);
1461
1564
  });
1462
1565
  }
1463
- e.reset(J);
1464
- var N = e.sibling(J, 2), E = e.child(N), R = e.child(E);
1465
- e.reset(E);
1466
- var j = e.sibling(E);
1467
- e.reset(N), e.reset(q), e.template_effect(() => {
1468
- 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(f) ? "w-[140px]" : ""} ${r.canvasId === e.get(F).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(q, "aria-label", `Select canvas ${e.get(F).label ?? ""}`), e.set_text(R, `${e.get(F).index + 1}.`), e.set_text(j, ` ${e.get(F).label ?? ""}`);
1469
- }), e.append($, q);
1470
- }), e.reset(m), e.reset(W);
1471
- var P = e.sibling(W, 2);
1566
+ e.reset(te);
1567
+ var oe = e.sibling(te, 2), l = e.child(oe), b = e.child(l);
1568
+ e.reset(l);
1569
+ var N = e.sibling(l);
1570
+ e.reset(oe), e.reset(q), e.template_effect(() => {
1571
+ 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(d) ? "w-[140px]" : ""} ${r.canvasId === e.get(G).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(q, "aria-label", `Select canvas ${e.get(G).label ?? ""}`), e.set_text(b, `${e.get(G).index + 1}.`), e.set_text(N, ` ${e.get(G).label ?? ""}`);
1572
+ }), e.append(j, q);
1573
+ }), e.reset(O), e.reset(m);
1574
+ var x = e.sibling(m, 2);
1472
1575
  {
1473
- var O = ($) => {
1474
- var F = fr();
1475
- F.__mousedown = k, e.append($, F);
1576
+ var $ = (j) => {
1577
+ var G = mr();
1578
+ G.__mousedown = g, e.append(j, G);
1476
1579
  };
1477
- e.if(P, ($) => {
1478
- e.get(p) === "none" && $(O);
1580
+ e.if(x, (j) => {
1581
+ e.get(c) === "none" && j($);
1479
1582
  });
1480
1583
  }
1481
- e.reset(_), e.bind_this(_, ($) => e.set(y, $), () => e.get(y));
1482
- var Q = e.sibling(_, 2);
1584
+ e.reset(y), e.bind_this(y, (j) => e.set(_, j), () => e.get(_));
1585
+ var W = e.sibling(y, 2);
1483
1586
  {
1484
- var U = ($) => {
1485
- var F = ur(), q = e.first_child(F), J = e.sibling(q, 2), ie = e.sibling(J, 2), u = e.sibling(ie, 2);
1587
+ var Q = (j) => {
1588
+ var G = br(), q = e.first_child(G), te = e.sibling(q, 2), se = e.sibling(te, 2), ne = e.sibling(se, 2);
1486
1589
  e.template_effect(() => {
1487
- 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 ${r.dragOverSide === "top" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(J, 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 ${r.dragOverSide === "bottom" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(ie, 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 ${r.dragOverSide === "left" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(u, 1, `absolute top-2 bottom-2 right-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-300 ${r.dragOverSide === "right" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`);
1488
- }), e.append($, F);
1590
+ e.set_class(q, 1, `absolute top-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-999 pointer-events-none flex items-center justify-center transition-all duration-200 ${r.dragOverSide === "top" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(te, 1, `absolute bottom-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-999 pointer-events-none flex items-center justify-center transition-all duration-200 ${r.dragOverSide === "bottom" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(se, 1, `absolute top-2 bottom-2 left-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-999 pointer-events-none flex items-center justify-center transition-all duration-200 ${r.dragOverSide === "left" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(ne, 1, `absolute top-2 bottom-2 right-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-999 pointer-events-none flex items-center justify-center transition-all duration-300 ${r.dragOverSide === "right" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`);
1591
+ }), e.append(j, G);
1489
1592
  };
1490
- e.if(Q, ($) => {
1491
- r.isGalleryDragging && $(U);
1593
+ e.if(W, (j) => {
1594
+ r.isGalleryDragging && j(Q);
1492
1595
  });
1493
1596
  }
1494
1597
  e.template_effect(() => {
1495
- e.set_class(_, 1, (e.get(p) !== "none" ? `relative z-50 bg-base-100 shadow-xl border-base-300 flex transition-all duration-200 select-none w-full h-full
1496
- ${e.get(p) === "bottom" || e.get(p) === "top" ? "flex-row border-t" : ""}
1497
- ${e.get(p) === "left" || e.get(p) === "right" ? "flex-col border-x" : ""}` : "fixed z-900 bg-base-100 shadow-2xl rounded-lg flex flex-col border border-base-300 overflow-hidden select-none") + (r.isGalleryDragging ? " pointer-events-none opacity-80" : "")), e.set_style(_, e.get(p) !== "none" ? "" : `left: ${r.galleryPosition.x}px; top: ${r.galleryPosition.y}px; width: ${r.gallerySize.width}px; height: ${r.gallerySize.height}px;`), e.set_class(b, 1, "bg-base-100 flex shrink-0 select-none relative " + (e.get(p) === "bottom" || e.get(p) === "top" ? "flex-row h-full items-center border-r border-base-200" : "flex-col w-full border-b border-base-200")), e.set_class(h, 1, "cursor-move flex items-center justify-center hover:bg-base-200/50 active:bg-base-200 transition-colors " + (e.get(p) === "bottom" || e.get(p) === "top" ? "w-8 h-full" : "h-6 w-full")), e.set_class(H, 1, "bg-base-300 rounded-full " + (e.get(p) === "bottom" || e.get(p) === "top" ? "w-1.5 h-12" : "w-12 h-1.5")), e.set_class(W, 1, `flex-1 p-1 bg-base-100 ${e.get(f) ? "overflow-x-auto overflow-y-hidden" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(m, 1, e.clsx(e.get(f) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(m, e.get(f) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
1498
- }), e.append(l, C);
1598
+ e.set_class(y, 1, (e.get(c) !== "none" ? `relative z-50 bg-base-100 shadow-xl border-base-300 flex transition-all duration-200 select-none w-full h-full
1599
+ ${e.get(c) === "bottom" || e.get(c) === "top" ? "flex-row border-t" : ""}
1600
+ ${e.get(c) === "left" || e.get(c) === "right" ? "flex-col border-x" : ""}` : "fixed z-900 bg-base-100 shadow-2xl rounded-lg flex flex-col border border-base-300 overflow-hidden select-none") + (r.isGalleryDragging ? " pointer-events-none opacity-80" : "")), e.set_style(y, e.get(c) !== "none" ? "" : `left: ${r.galleryPosition.x}px; top: ${r.galleryPosition.y}px; width: ${r.gallerySize.width}px; height: ${r.gallerySize.height}px;`), e.set_class(m, 1, `flex-1 p-1 bg-base-100 ${e.get(d) ? "overflow-x-auto overflow-y-hidden h-full" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(O, 1, e.clsx(e.get(d) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(O, e.get(d) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
1601
+ }), e.append(o, M);
1499
1602
  };
1500
- e.if(G, (l) => {
1501
- r.showThumbnailGallery && l(L);
1603
+ e.if(p, (o) => {
1604
+ r.showThumbnailGallery && o(f);
1502
1605
  });
1503
1606
  }
1504
- return e.append(i, S), e.pop(o);
1607
+ return e.append(i, E), e.pop(B);
1505
1608
  }
1506
1609
  e.delegate(["click", "mousedown"]);
1507
- e.create_custom_element(ne, { canvases: {} }, [], [], !0);
1508
- var vr = e.from_html('<div class="fab fab-flower fab-top-left absolute z-600 pointer-events-auto flex-col items-end transition-all duration-300 bottom-6 right-6"><div class="tooltip tooltip-left"><div tabindex="0" role="button" class="btn btn-lg btn-primary btn-circle shadow-xl"><span class="sr-only"> </span> <!></div></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>');
1509
- function rt(i, t) {
1610
+ e.create_custom_element(de, { canvases: {} }, [], [], !0);
1611
+ var yr = e.from_html("<button><!></button>"), wr = e.from_html('<button class="btn btn-circle btn-lg btn-neutral shadow-lg"><!></button>'), xr = e.from_html('<div class="tooltip tooltip-left"><button><!></button></div>'), Sr = e.from_html('<div class="tooltip tooltip-left"><button><!></button></div>'), Ar = e.from_html('<div class="tooltip tooltip-top"><button><!></button></div>'), Ir = e.from_html('<div class="tooltip tooltip-top"><button><!></button></div>'), Cr = e.from_html('<div class="fab fab-flower fab-top-left absolute z-600 pointer-events-auto flex-col items-end transition-all duration-300 bottom-6 right-6"><div class="tooltip tooltip-left"><div tabindex="0" role="button" class="btn btn-lg btn-primary btn-circle shadow-xl"><span class="sr-only"> </span> <!></div></div> <div class="fab-close tooltip tooltip-top"><!></div> <!> <!> <!> <!></div>');
1612
+ function ot(i, t) {
1510
1613
  e.push(t, !1);
1511
- const r = oe(se);
1614
+ const r = fe(ce);
1512
1615
  e.init();
1513
- var s = vr(), n = e.child(s), a = e.child(n), y = e.child(a), I = e.child(y, !0);
1514
- e.reset(y);
1515
- var c = e.sibling(y, 2);
1516
- xt(c, { size: 32, weight: "bold" }), e.reset(a), e.reset(n);
1517
- var w = e.sibling(n, 2), k = e.child(w);
1518
- k.__click = () => r.toggleSearchPanel();
1519
- var z = e.child(k);
1520
- Qe(z, { size: 28, weight: "bold" }), e.reset(k), e.reset(w);
1521
- var d = e.sibling(w, 2), g = e.child(d);
1522
- g.__click = () => r.toggleThumbnailGallery();
1523
- var p = e.child(g);
1524
- St(p, { size: 28, weight: "bold" }), e.reset(g), e.reset(d);
1525
- var f = e.sibling(d, 2), v = e.child(f);
1526
- v.__click = () => r.toggleFullScreen();
1527
- var o = e.child(v);
1616
+ var s = Cr(), n = e.child(s), a = e.child(n), S = e.child(a), P = e.child(S, !0);
1617
+ e.reset(S);
1618
+ var _ = e.sibling(S, 2);
1619
+ Ct(_, { size: 32, weight: "bold" }), e.reset(a), e.reset(n);
1620
+ var I = e.sibling(n, 2), u = e.child(I);
1528
1621
  {
1529
- var S = (b) => {
1530
- _t(b, { size: 28, weight: "bold" });
1531
- }, G = (b) => {
1532
- yt(b, { size: 28, weight: "bold" });
1622
+ var R = (p) => {
1623
+ var f = yr();
1624
+ f.__click = () => r.toggleSearchPanel();
1625
+ var o = e.child(f);
1626
+ Ze(o, { size: 28, weight: "bold" }), e.reset(f), e.template_effect(
1627
+ (M) => {
1628
+ e.set_attribute(f, "aria-label", M), e.set_class(f, 1, e.clsx([
1629
+ "btn btn-circle btn-lg shadow-lg",
1630
+ r.showSearchPanel && "btn-primary",
1631
+ !r.showSearchPanel && "btn-neutral"
1632
+ ]));
1633
+ },
1634
+ [() => V.toggle_search()]
1635
+ ), e.append(p, f);
1636
+ }, g = (p) => {
1637
+ var f = wr();
1638
+ f.__click = (M) => {
1639
+ document.activeElement instanceof HTMLElement && document.activeElement.blur();
1640
+ };
1641
+ var o = e.child(f);
1642
+ Be(o, { size: 28, weight: "bold" }), e.reset(f), e.template_effect((M) => e.set_attribute(f, "aria-label", M), [() => V.close_menu()]), e.append(p, f);
1533
1643
  };
1534
- e.if(o, (b) => {
1535
- r.isFullScreen ? b(S) : b(G, !1);
1644
+ e.if(u, (p) => {
1645
+ var f;
1646
+ ((f = r.config.rightMenu) == null ? void 0 : f.showSearch) !== !1 ? p(R) : p(g, !1);
1536
1647
  });
1537
1648
  }
1538
- e.reset(v), e.reset(f);
1539
- var L = e.sibling(f, 2), l = e.child(L);
1540
- l.__click = () => r.toggleAnnotations();
1541
- var C = e.child(l);
1542
- bt(C, { size: 28, weight: "bold" }), e.reset(l), e.reset(L);
1543
- var _ = e.sibling(L, 2), x = e.child(_);
1544
- x.__click = () => r.toggleMetadataDialog();
1545
- var D = e.child(x);
1546
- wt(D, { size: 28, weight: "bold" }), e.reset(x), e.reset(_), e.reset(s), e.template_effect(
1547
- (b, h, H, W, m, P, O, Q, U, $, F) => {
1548
- e.set_attribute(n, "data-tip", b), e.set_text(I, h), e.set_attribute(w, "data-tip", H), e.set_attribute(k, "aria-label", W), e.set_class(k, 1, e.clsx([
1549
- "btn btn-circle btn-lg shadow-lg",
1550
- r.showSearchPanel && "btn-primary",
1551
- !r.showSearchPanel && "btn-neutral"
1552
- ])), e.set_attribute(d, "data-tip", m), e.set_attribute(g, "aria-label", P), e.set_class(g, 1, `btn btn-lg btn-circle shadow-lg ${r.showThumbnailGallery ? "btn-info" : "btn-neutral"}`), e.set_attribute(f, "data-tip", O), e.set_class(v, 1, `btn btn-circle btn-lg shadow-lg transition-all duration-300 ease-out ${r.isFullScreen ? "btn-warning" : "btn-neutral"}`), e.set_attribute(L, "data-tip", Q), e.set_attribute(l, "aria-label", U), e.set_class(l, 1, `btn btn-lg btn-circle shadow-lg ${r.showAnnotations ? "btn-error" : "btn-neutral"}`), e.set_attribute(_, "data-tip", $), e.set_attribute(x, "aria-label", F), e.set_class(x, 1, `btn btn-lg btn-circle shadow-lg ${r.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
1649
+ e.reset(I);
1650
+ var v = e.sibling(I, 2);
1651
+ {
1652
+ var C = (p) => {
1653
+ var f = xr(), o = e.child(f);
1654
+ o.__click = () => r.toggleThumbnailGallery();
1655
+ var M = e.child(o);
1656
+ kt(M, { size: 28, weight: "bold" }), e.reset(o), e.reset(f), e.template_effect(
1657
+ (y, w) => {
1658
+ e.set_attribute(f, "data-tip", y), e.set_attribute(o, "aria-label", w), e.set_class(o, 1, `btn btn-lg btn-circle shadow-lg ${r.showThumbnailGallery ? "btn-info" : "btn-neutral"}`);
1659
+ },
1660
+ [
1661
+ () => r.showThumbnailGallery ? V.hide_gallery() : V.show_gallery(),
1662
+ () => r.showThumbnailGallery ? V.hide_gallery() : V.show_gallery()
1663
+ ]
1664
+ ), e.append(p, f);
1665
+ };
1666
+ e.if(v, (p) => {
1667
+ var f;
1668
+ ((f = r.config.rightMenu) == null ? void 0 : f.showGallery) !== !1 && p(C);
1669
+ });
1670
+ }
1671
+ var h = e.sibling(v, 2);
1672
+ {
1673
+ var c = (p) => {
1674
+ var f = Sr(), o = e.child(f);
1675
+ o.__click = () => r.toggleFullScreen();
1676
+ var M = e.child(o);
1677
+ {
1678
+ var y = (T) => {
1679
+ St(T, { size: 28, weight: "bold" });
1680
+ }, w = (T) => {
1681
+ At(T, { size: 28, weight: "bold" });
1682
+ };
1683
+ e.if(M, (T) => {
1684
+ r.isFullScreen ? T(y) : T(w, !1);
1685
+ });
1686
+ }
1687
+ e.reset(o), e.reset(f), e.template_effect(
1688
+ (T) => {
1689
+ e.set_attribute(f, "data-tip", T), e.set_class(o, 1, `btn btn-circle btn-lg shadow-lg transition-all duration-300 ease-out ${r.isFullScreen ? "btn-warning" : "btn-neutral"}`);
1690
+ },
1691
+ [
1692
+ () => r.isFullScreen ? V.exit_full_screen() : V.enter_full_screen()
1693
+ ]
1694
+ ), e.append(p, f);
1695
+ };
1696
+ e.if(h, (p) => {
1697
+ var f;
1698
+ ((f = r.config.rightMenu) == null ? void 0 : f.showFullscreen) !== !1 && p(c);
1699
+ });
1700
+ }
1701
+ var d = e.sibling(h, 2);
1702
+ {
1703
+ var z = (p) => {
1704
+ var f = Ar(), o = e.child(f);
1705
+ o.__click = () => r.toggleAnnotations();
1706
+ var M = e.child(o);
1707
+ xt(M, { size: 28, weight: "bold" }), e.reset(o), e.reset(f), e.template_effect(
1708
+ (y, w) => {
1709
+ e.set_attribute(f, "data-tip", y), e.set_attribute(o, "aria-label", w), e.set_class(o, 1, `btn btn-lg btn-circle shadow-lg ${r.showAnnotations ? "btn-error" : "btn-neutral"}`);
1710
+ },
1711
+ [
1712
+ () => r.showAnnotations ? V.hide_annotations() : V.show_annotations(),
1713
+ () => V.toggle_annotations()
1714
+ ]
1715
+ ), e.append(p, f);
1716
+ };
1717
+ e.if(d, (p) => {
1718
+ var f;
1719
+ ((f = r.config.rightMenu) == null ? void 0 : f.showAnnotations) !== !1 && p(z);
1720
+ });
1721
+ }
1722
+ var B = e.sibling(d, 2);
1723
+ {
1724
+ var E = (p) => {
1725
+ var f = Ir(), o = e.child(f);
1726
+ o.__click = () => r.toggleMetadataDialog();
1727
+ var M = e.child(o);
1728
+ It(M, { size: 28, weight: "bold" }), e.reset(o), e.reset(f), e.template_effect(
1729
+ (y, w) => {
1730
+ e.set_attribute(f, "data-tip", y), e.set_attribute(o, "aria-label", w), e.set_class(o, 1, `btn btn-lg btn-circle shadow-lg ${r.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
1731
+ },
1732
+ [() => V.metadata(), () => V.toggle_metadata()]
1733
+ ), e.append(p, f);
1734
+ };
1735
+ e.if(B, (p) => {
1736
+ var f;
1737
+ ((f = r.config.rightMenu) == null ? void 0 : f.showInfo) !== !1 && p(E);
1738
+ });
1739
+ }
1740
+ e.reset(s), e.template_effect(
1741
+ (p, f, o) => {
1742
+ e.set_attribute(n, "data-tip", p), e.set_text(P, f), e.set_attribute(I, "data-tip", o);
1553
1743
  },
1554
1744
  [
1555
- () => B.menu(),
1556
- () => B.menu(),
1557
- () => B.search(),
1558
- () => B.toggle_search(),
1559
- () => r.showThumbnailGallery ? B.hide_gallery() : B.show_gallery(),
1560
- () => r.showThumbnailGallery ? B.hide_gallery() : B.show_gallery(),
1561
- () => r.isFullScreen ? B.exit_full_screen() : B.enter_full_screen(),
1562
- () => r.showAnnotations ? B.hide_annotations() : B.show_annotations(),
1563
- () => B.toggle_annotations(),
1564
- () => B.metadata(),
1565
- () => B.toggle_metadata()
1745
+ () => V.menu(),
1746
+ () => V.menu(),
1747
+ () => {
1748
+ var p;
1749
+ return ((p = r.config.rightMenu) == null ? void 0 : p.showSearch) === !1 ? V.close_menu() : V.search();
1750
+ }
1566
1751
  ]
1567
1752
  ), e.append(i, s), e.pop();
1568
1753
  }
1569
1754
  e.delegate(["click"]);
1570
- e.create_custom_element(rt, {}, [], [], !0);
1571
- var hr = e.from_html('<div class="tooltip tooltip-right"><button><!></button></div>'), pr = e.from_html('<div class="absolute left-6 bottom-6 z-50 pointer-events-auto flex flex-col items-start transition-all duration-300"><div></div> <div class="tooltip tooltip-right"><button><!></button></div></div>');
1572
- function it(i, t) {
1755
+ e.create_custom_element(ot, {}, [], [], !0);
1756
+ var kr = e.from_html('<div class="tooltip tooltip-right"><button><!></button></div>'), Pr = e.from_html('<div class="absolute left-6 bottom-6 z-50 pointer-events-auto flex flex-col items-start transition-all duration-300"><div></div> <div class="tooltip tooltip-right"><button><!></button></div></div>');
1757
+ function lt(i, t) {
1573
1758
  e.push(t, !0);
1574
- const r = oe(se);
1575
- let s = e.derived(() => [...r.pluginMenuButtons].sort((w, k) => (w.order ?? 100) - (k.order ?? 100))), n = e.state(!1);
1759
+ const r = fe(ce);
1760
+ let s = e.derived(() => [...r.pluginMenuButtons].sort((I, u) => (I.order ?? 100) - (u.order ?? 100))), n = e.state(!1);
1576
1761
  function a() {
1577
1762
  e.set(n, !e.get(n));
1578
1763
  }
1579
- var y = e.comment(), I = e.first_child(y);
1764
+ var S = e.comment(), P = e.first_child(S);
1580
1765
  {
1581
- var c = (w) => {
1582
- var k = pr(), z = e.child(k);
1583
- e.each(z, 21, () => e.get(s), (o) => o.id, (o, S) => {
1584
- const G = e.derived(() => e.get(S).icon);
1585
- var L = hr(), l = e.child(L);
1586
- l.__click = () => {
1587
- e.get(S).onClick(), e.set(n, !1);
1766
+ var _ = (I) => {
1767
+ var u = Pr(), R = e.child(u);
1768
+ e.each(R, 21, () => e.get(s), (d) => d.id, (d, z) => {
1769
+ const B = e.derived(() => e.get(z).icon);
1770
+ var E = kr(), p = e.child(E);
1771
+ p.__click = () => {
1772
+ e.get(z).onClick(), e.set(n, !1);
1588
1773
  };
1589
- var C = e.child(l);
1590
- e.component(C, () => e.get(G), (_, x) => {
1591
- x(_, { size: 28, weight: "bold" });
1592
- }), e.reset(l), e.reset(L), e.template_effect(
1593
- (_) => {
1594
- e.set_attribute(L, "data-tip", e.get(S).tooltip), e.set_attribute(l, "aria-label", e.get(S).tooltip), e.set_class(l, 1, `btn btn-lg btn-circle shadow-lg ${_ ?? ""}`);
1774
+ var f = e.child(p);
1775
+ e.component(f, () => e.get(B), (o, M) => {
1776
+ M(o, { size: 28, weight: "bold" });
1777
+ }), e.reset(p), e.reset(E), e.template_effect(
1778
+ (o) => {
1779
+ e.set_attribute(E, "data-tip", e.get(z).tooltip), e.set_attribute(p, "aria-label", e.get(z).tooltip), e.set_class(p, 1, `btn btn-lg btn-circle shadow-lg ${o ?? ""}`);
1595
1780
  },
1596
1781
  [
1597
1782
  () => {
1598
- var _, x;
1599
- return (x = (_ = e.get(S)).isActive) != null && x.call(_) ? e.get(S).activeClass ?? "btn-primary" : "btn-neutral";
1783
+ var o, M;
1784
+ return (M = (o = e.get(z)).isActive) != null && M.call(o) ? e.get(z).activeClass ?? "btn-primary" : "btn-neutral";
1600
1785
  }
1601
1786
  ]
1602
- ), e.append(o, L);
1603
- }), e.reset(z);
1604
- var d = e.sibling(z, 2), g = e.child(d);
1605
- g.__click = a;
1606
- var p = e.child(g);
1787
+ ), e.append(d, E);
1788
+ }), e.reset(R);
1789
+ var g = e.sibling(R, 2), v = e.child(g);
1790
+ v.__click = a;
1791
+ var C = e.child(v);
1607
1792
  {
1608
- var f = (o) => {
1609
- qe(o, { size: 28, weight: "bold" });
1610
- }, v = (o) => {
1611
- At(o, { size: 28, weight: "bold" });
1793
+ var h = (d) => {
1794
+ Be(d, { size: 28, weight: "bold" });
1795
+ }, c = (d) => {
1796
+ Pt(d, { size: 28, weight: "bold" });
1612
1797
  };
1613
- e.if(p, (o) => {
1614
- e.get(n) ? o(f) : o(v, !1);
1798
+ e.if(C, (d) => {
1799
+ e.get(n) ? d(h) : d(c, !1);
1615
1800
  });
1616
1801
  }
1617
- e.reset(g), e.reset(d), e.reset(k), e.template_effect(
1618
- (o, S) => {
1619
- e.set_class(z, 1, `flex flex-col-reverse gap-3 mb-3 transition-all duration-300 origin-bottom ${e.get(n) ? "opacity-100 translate-y-0 scale-100" : "opacity-0 translate-y-4 scale-90 pointer-events-none"}`), e.set_attribute(d, "data-tip", o), e.set_class(g, 1, `btn btn-lg btn-secondary btn-circle shadow-xl transition-transform duration-300 ${e.get(n) ? "rotate-90" : ""}`), e.set_attribute(g, "aria-label", S);
1802
+ e.reset(v), e.reset(g), e.reset(u), e.template_effect(
1803
+ (d, z) => {
1804
+ e.set_class(R, 1, `flex flex-col-reverse gap-3 mb-3 transition-all duration-300 origin-bottom ${e.get(n) ? "opacity-100 translate-y-0 scale-100" : "opacity-0 translate-y-4 scale-90 pointer-events-none"}`), e.set_attribute(g, "data-tip", d), e.set_class(v, 1, `btn btn-lg btn-secondary btn-circle shadow-xl transition-transform duration-300 ${e.get(n) ? "rotate-90" : ""}`), e.set_attribute(v, "aria-label", z);
1620
1805
  },
1621
- [() => B.plugins_tooltip(), () => B.plugins_tooltip()]
1622
- ), e.append(w, k);
1806
+ [() => V.plugins_tooltip(), () => V.plugins_tooltip()]
1807
+ ), e.append(I, u);
1623
1808
  };
1624
- e.if(I, (w) => {
1625
- e.get(s).length > 0 && w(c);
1809
+ e.if(P, (I) => {
1810
+ e.get(s).length > 0 && I(_);
1626
1811
  });
1627
1812
  }
1628
- e.append(i, y), e.pop();
1813
+ e.append(i, S), e.pop();
1629
1814
  }
1630
1815
  e.delegate(["click"]);
1631
- e.create_custom_element(it, {}, [], [], !0);
1632
- var mr = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), br = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), _r = 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), yr = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), wr = e.from_html('<dialog class="modal"><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>');
1633
- function st(i, t) {
1816
+ e.create_custom_element(lt, {}, [], [], !0);
1817
+ var Mr = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), Tr = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), zr = 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), jr = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), Lr = e.from_html('<dialog class="modal"><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>');
1818
+ function ct(i, t) {
1634
1819
  e.push(t, !0);
1635
- const r = oe(se);
1820
+ const r = fe(ce);
1636
1821
  let s = e.derived(() => r.manifest), n = e.derived(() => {
1637
- const m = pt.current;
1822
+ const m = yt.current;
1638
1823
  if (!e.get(s)) return [];
1639
- const P = e.get(s).getMetadata();
1640
- return P ? P.map((O) => {
1641
- let Q = "", U = "";
1642
- const $ = (F) => {
1643
- if (typeof F == "string") return F;
1644
- if (Array.isArray(F)) {
1645
- let q = F.find((J) => J.locale === m || J.language === m);
1646
- return q || (q = F.find((J) => J.locale === "en" || J.language === "en")), q || (q = F.find((J) => !J.locale && !J.language)), q || (q = F[0]), q ? q.value : "";
1824
+ const O = e.get(s).getMetadata();
1825
+ return O ? O.map((x) => {
1826
+ let $ = "", W = "";
1827
+ const Q = (j) => {
1828
+ if (typeof j == "string") return j;
1829
+ if (Array.isArray(j)) {
1830
+ let G = j.find((q) => q.locale === m || q.language === m);
1831
+ return G || (G = j.find((q) => q.locale === "en" || q.language === "en")), G || (G = j.find((q) => !q.locale && !q.language)), G || (G = j[0]), G ? G.value : "";
1647
1832
  }
1648
- return String(F);
1833
+ return String(j);
1649
1834
  };
1650
- return O.getLabel ? Q = $(O.getLabel()) : O.label && (Q = $(O.label)), O.getValue ? U = $(O.getValue()) : O.value && (U = $(O.value)), { label: Q, value: U };
1835
+ return x.getLabel ? $ = Q(x.getLabel()) : x.label && ($ = Q(x.label)), x.getValue ? W = Q(x.getValue()) : x.value && (W = Q(x.value)), { label: $, value: W };
1651
1836
  }) : [];
1652
- }), a = e.derived(() => e.get(s) ? e.get(s).getDescription() : ""), y = e.derived(() => {
1837
+ }), a = e.derived(() => e.get(s) ? e.get(s).getDescription() : ""), S = e.derived(() => {
1653
1838
  var m;
1654
1839
  return e.get(s) ? (m = e.get(s).getRequiredStatement()) == null ? void 0 : m.getValue() : "";
1655
- }), I = e.derived(() => e.get(s) ? e.get(s).getLicense() : "");
1656
- var c = wr(), w = e.child(c), k = e.child(w), z = e.child(k);
1657
- z.__click = () => r.toggleMetadataDialog(), e.reset(k);
1658
- var d = e.sibling(k, 2), g = e.child(d, !0);
1659
- e.reset(d);
1660
- var p = e.sibling(d, 2), f = e.child(p);
1840
+ }), P = e.derived(() => e.get(s) ? e.get(s).getLicense() : "");
1841
+ var _ = Lr(), I = e.child(_), u = e.child(I), R = e.child(u);
1842
+ R.__click = () => r.toggleMetadataDialog(), e.reset(u);
1843
+ var g = e.sibling(u, 2), v = e.child(g, !0);
1844
+ e.reset(g);
1845
+ var C = e.sibling(g, 2), h = e.child(C);
1661
1846
  {
1662
- var v = (m) => {
1663
- var P = mr(), O = e.child(P), Q = e.child(O);
1664
- e.html(Q, () => e.get(a)), e.reset(O), e.reset(P), e.append(m, P);
1847
+ var c = (m) => {
1848
+ var O = Mr(), x = e.child(O), $ = e.child(x);
1849
+ e.html($, () => e.get(a)), e.reset(x), e.reset(O), e.append(m, O);
1665
1850
  };
1666
- e.if(f, (m) => {
1667
- e.get(a) && m(v);
1851
+ e.if(h, (m) => {
1852
+ e.get(a) && m(c);
1668
1853
  });
1669
1854
  }
1670
- var o = e.sibling(f, 2), S = e.child(o);
1855
+ var d = e.sibling(h, 2), z = e.child(d);
1671
1856
  {
1672
- var G = (m) => {
1673
- var P = br(), O = e.first_child(P), Q = e.child(O, !0);
1674
- e.reset(O);
1675
- var U = e.sibling(O, 2), $ = e.child(U);
1676
- e.html($, () => e.get(y)), e.reset(U), e.template_effect((F) => e.set_text(Q, F), [() => B.attribution()]), e.append(m, P);
1857
+ var B = (m) => {
1858
+ var O = Tr(), x = e.first_child(O), $ = e.child(x, !0);
1859
+ e.reset(x);
1860
+ var W = e.sibling(x, 2), Q = e.child(W);
1861
+ e.html(Q, () => e.get(S)), e.reset(W), e.template_effect((j) => e.set_text($, j), [() => V.attribution()]), e.append(m, O);
1677
1862
  };
1678
- e.if(S, (m) => {
1679
- e.get(y) && m(G);
1863
+ e.if(z, (m) => {
1864
+ e.get(S) && m(B);
1680
1865
  });
1681
1866
  }
1682
- var L = e.sibling(S, 2);
1867
+ var E = e.sibling(z, 2);
1683
1868
  {
1684
- var l = (m) => {
1685
- var P = _r(), O = e.first_child(P), Q = e.child(O, !0);
1686
- e.reset(O);
1687
- var U = e.sibling(O, 2), $ = e.child(U), F = e.child($, !0);
1688
- e.reset($), e.reset(U), e.template_effect(
1689
- (q) => {
1690
- e.set_text(Q, q), e.set_attribute($, "href", e.get(I)), e.set_text(F, e.get(I));
1869
+ var p = (m) => {
1870
+ var O = zr(), x = e.first_child(O), $ = e.child(x, !0);
1871
+ e.reset(x);
1872
+ var W = e.sibling(x, 2), Q = e.child(W), j = e.child(Q, !0);
1873
+ e.reset(Q), e.reset(W), e.template_effect(
1874
+ (G) => {
1875
+ e.set_text($, G), e.set_attribute(Q, "href", e.get(P)), e.set_text(j, e.get(P));
1691
1876
  },
1692
- [() => B.license()]
1693
- ), e.append(m, P);
1877
+ [() => V.license()]
1878
+ ), e.append(m, O);
1694
1879
  };
1695
- e.if(L, (m) => {
1696
- e.get(I) && m(l);
1880
+ e.if(E, (m) => {
1881
+ e.get(P) && m(p);
1697
1882
  });
1698
1883
  }
1699
- var C = e.sibling(L, 2);
1700
- e.each(C, 17, () => e.get(n), e.index, (m, P) => {
1701
- var O = yr(), Q = e.first_child(O), U = e.child(Q, !0);
1702
- e.reset(Q);
1703
- var $ = e.sibling(Q, 2), F = e.child($);
1704
- e.html(F, () => e.get(P).value), e.reset($), e.template_effect(() => e.set_text(U, e.get(P).label)), e.append(m, O);
1705
- }), e.reset(o), e.reset(p);
1706
- var _ = e.sibling(p, 2), x = e.child(_), D = e.child(x);
1707
- D.__click = () => r.toggleMetadataDialog();
1708
- var b = e.child(D, !0);
1709
- e.reset(D), e.reset(x), e.reset(_), e.reset(w);
1710
- var h = e.sibling(w, 2), H = e.child(h);
1711
- H.__click = () => r.toggleMetadataDialog();
1712
- var W = e.child(H, !0);
1713
- e.reset(H), e.reset(h), e.reset(c), e.template_effect(
1714
- (m, P, O) => {
1715
- c.open = r.showMetadataDialog, e.set_text(g, m), e.set_text(b, P), e.set_text(W, O);
1884
+ var f = e.sibling(E, 2);
1885
+ e.each(f, 17, () => e.get(n), e.index, (m, O) => {
1886
+ var x = jr(), $ = e.first_child(x), W = e.child($, !0);
1887
+ e.reset($);
1888
+ var Q = e.sibling($, 2), j = e.child(Q);
1889
+ e.html(j, () => e.get(O).value), e.reset(Q), e.template_effect(() => e.set_text(W, e.get(O).label)), e.append(m, x);
1890
+ }), e.reset(d), e.reset(C);
1891
+ var o = e.sibling(C, 2), M = e.child(o), y = e.child(M);
1892
+ y.__click = () => r.toggleMetadataDialog();
1893
+ var w = e.child(y, !0);
1894
+ e.reset(y), e.reset(M), e.reset(o), e.reset(I);
1895
+ var T = e.sibling(I, 2), L = e.child(T);
1896
+ L.__click = () => r.toggleMetadataDialog();
1897
+ var A = e.child(L, !0);
1898
+ e.reset(L), e.reset(T), e.reset(_), e.template_effect(
1899
+ (m, O, x) => {
1900
+ _.open = r.showMetadataDialog, e.set_text(v, m), e.set_text(w, O), e.set_text(A, x);
1716
1901
  },
1717
1902
  [
1718
- () => e.get(s) ? e.get(s).getLabel().length && e.get(s).getLabel()[0] ? e.get(s).getLabel()[0].value : B.metadata_label_fallback() : B.loading(),
1719
- () => B.close(),
1720
- () => B.close()
1903
+ () => e.get(s) ? e.get(s).getLabel().length && e.get(s).getLabel()[0] ? e.get(s).getLabel()[0].value : V.metadata_label_fallback() : V.loading(),
1904
+ () => V.close(),
1905
+ () => V.close()
1721
1906
  ]
1722
- ), e.append(i, c), e.pop();
1907
+ ), e.append(i, _), e.pop();
1723
1908
  }
1724
1909
  e.delegate(["click"]);
1725
- e.create_custom_element(st, {}, [], [], !0);
1726
- var xr = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), Sr = e.from_html('<div class="flex justify-center p-8"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Ar = e.from_html('<div class="text-center opacity-50 p-4"> </div>'), Ir = e.from_html('<div class="text-center opacity-50 p-4 text-sm"> </div>'), kr = 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>'), Cr = e.from_html('<div class="leading-relaxed"> </div>'), Pr = 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>'), Mr = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), zr = e.from_html('<div class="h-full w-80 bg-base-200 shadow-2xl z-100 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>');
1727
- function nt(i, t) {
1910
+ e.create_custom_element(ct, {}, [], [], !0);
1911
+ var Rr = e.from_html('<button class="btn btn-sm btn-circle btn-ghost"><!></button>'), Dr = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), Er = e.from_html('<div class="flex justify-center p-8"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Or = e.from_html('<div class="text-center opacity-50 p-4"> </div>'), Gr = e.from_html('<div class="text-center opacity-50 p-4 text-sm"> </div>'), Vr = 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>'), Fr = e.from_html('<div class="leading-relaxed"> </div>'), Br = 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>'), $r = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), Nr = e.from_html('<div class="h-full w-80 bg-base-200 shadow-2xl z-100 flex flex-col border-l border-base-300" role="dialog"><div class="flex items-center justify-between p-4 border-b border-base-300"><h2 class="font-bold text-lg"> </h2> <!></div> <div class="p-4 border-b border-base-300 shrink-0"><div class="relative w-full"><input type="text" class="input input-bordered w-full pr-12"/> <button class="btn btn-primary absolute right-0 top-0 h-full rounded-l-none"><!></button></div></div> <div class="flex-1 overflow-y-auto p-4 space-y-4"><!></div></div>');
1912
+ function dt(i, t) {
1728
1913
  e.push(t, !0);
1729
- const r = oe(se);
1730
- let s = e.state(e.proxy(r.searchQuery));
1731
- function n() {
1914
+ const r = fe(ce);
1915
+ let s = e.state(""), n = e.derived(() => {
1916
+ var R;
1917
+ return ((R = r.config.search) == null ? void 0 : R.showCloseButton) ?? !0;
1918
+ });
1919
+ function a() {
1732
1920
  r.search(e.get(s));
1733
1921
  }
1734
- function a(k) {
1735
- k.key === "Enter" && n();
1922
+ function S(R) {
1923
+ R.key === "Enter" && a();
1736
1924
  }
1737
- function y(k) {
1738
- const z = r.canvases[k.canvasIndex];
1739
- z && (r.canvasId = z.id);
1925
+ function P(R) {
1926
+ const g = r.canvases[R.canvasIndex];
1927
+ g && (r.canvasId = g.id);
1740
1928
  }
1741
- var I = e.comment(), c = e.first_child(I);
1929
+ var _ = e.comment(), I = e.first_child(_);
1742
1930
  {
1743
- var w = (k) => {
1744
- var z = zr(), d = e.child(z), g = e.child(d), p = e.child(g, !0);
1745
- e.reset(g);
1746
- var f = e.sibling(g, 2);
1747
- f.__click = () => r.toggleSearchPanel(), e.reset(d);
1748
- var v = e.sibling(d, 2), o = e.child(v), S = e.child(o);
1749
- e.remove_input_defaults(S), S.__keydown = a;
1750
- var G = e.sibling(S, 2);
1751
- G.__click = n;
1752
- var L = e.child(G);
1931
+ var u = (R) => {
1932
+ var g = Nr(), v = e.child(g), C = e.child(v), h = e.child(C, !0);
1933
+ e.reset(C);
1934
+ var c = e.sibling(C, 2);
1935
+ {
1936
+ var d = (A) => {
1937
+ var m = Rr();
1938
+ m.__click = () => r.toggleSearchPanel();
1939
+ var O = e.child(m);
1940
+ Be(O, { size: 20, weight: "bold" }), e.reset(m), e.template_effect((x) => e.set_attribute(m, "aria-label", x), [() => V.close_search()]), e.append(A, m);
1941
+ };
1942
+ e.if(c, (A) => {
1943
+ e.get(n) && A(d);
1944
+ });
1945
+ }
1946
+ e.reset(v);
1947
+ var z = e.sibling(v, 2), B = e.child(z), E = e.child(B);
1948
+ e.remove_input_defaults(E), E.__keydown = S;
1949
+ var p = e.sibling(E, 2);
1950
+ p.__click = a;
1951
+ var f = e.child(p);
1753
1952
  {
1754
- var l = (h) => {
1755
- var H = xr();
1756
- e.append(h, H);
1757
- }, C = (h) => {
1758
- Qe(h, { size: 20, weight: "bold" });
1953
+ var o = (A) => {
1954
+ var m = Dr();
1955
+ e.append(A, m);
1956
+ }, M = (A) => {
1957
+ Ze(A, { size: 20, weight: "bold" });
1759
1958
  };
1760
- e.if(L, (h) => {
1761
- r.isSearching ? h(l) : h(C, !1);
1959
+ e.if(f, (A) => {
1960
+ r.isSearching ? A(o) : A(M, !1);
1762
1961
  });
1763
1962
  }
1764
- e.reset(G), e.reset(o), e.reset(v);
1765
- var _ = e.sibling(v, 2), x = e.child(_);
1963
+ e.reset(p), e.reset(B), e.reset(z);
1964
+ var y = e.sibling(z, 2), w = e.child(y);
1766
1965
  {
1767
- var D = (h) => {
1768
- var H = Sr();
1769
- e.append(h, H);
1770
- }, b = (h) => {
1771
- var H = e.comment(), W = e.first_child(H);
1966
+ var T = (A) => {
1967
+ var m = Er();
1968
+ e.append(A, m);
1969
+ }, L = (A) => {
1970
+ var m = e.comment(), O = e.first_child(m);
1772
1971
  {
1773
- var m = (O) => {
1774
- var Q = Ar(), U = e.child(Q, !0);
1775
- e.reset(Q), e.template_effect(($) => e.set_text(U, $), [
1776
- () => B.search_panel_no_results({ query: r.searchQuery })
1777
- ]), e.append(O, Q);
1778
- }, P = (O) => {
1779
- var Q = e.comment(), U = e.first_child(Q);
1972
+ var x = (W) => {
1973
+ var Q = Or(), j = e.child(Q, !0);
1974
+ e.reset(Q), e.template_effect((G) => e.set_text(j, G), [
1975
+ () => V.search_panel_no_results({ query: r.searchQuery })
1976
+ ]), e.append(W, Q);
1977
+ }, $ = (W) => {
1978
+ var Q = e.comment(), j = e.first_child(Q);
1780
1979
  {
1781
- var $ = (q) => {
1782
- var J = Ir(), ie = e.child(J, !0);
1783
- e.reset(J), e.template_effect((u) => e.set_text(ie, u), [() => B.search_panel_instruction()]), e.append(q, J);
1784
- }, F = (q) => {
1785
- var J = Mr(), ie = e.first_child(J), u = e.child(ie, !0);
1786
- e.reset(ie);
1787
- var T = e.sibling(ie, 2);
1788
- e.each(T, 17, () => r.searchResults, e.index, (N, E) => {
1789
- var R = Pr();
1790
- R.__click = () => y(e.get(E));
1791
- var j = e.child(R), M = e.child(j), Y = e.child(M, !0);
1792
- e.reset(M), e.reset(j);
1793
- var Z = e.sibling(j, 2);
1980
+ var G = (te) => {
1981
+ var se = Gr(), ne = e.child(se, !0);
1982
+ e.reset(se), e.template_effect((ae) => e.set_text(ne, ae), [() => V.search_panel_instruction()]), e.append(te, se);
1983
+ }, q = (te) => {
1984
+ var se = $r(), ne = e.first_child(se), ae = e.child(ne, !0);
1985
+ e.reset(ne);
1986
+ var oe = e.sibling(ne, 2);
1987
+ e.each(oe, 17, () => r.searchResults, e.index, (l, b) => {
1988
+ var N = Br();
1989
+ N.__click = () => P(e.get(b));
1990
+ var F = e.child(N), ee = e.child(F), X = e.child(ee, !0);
1991
+ e.reset(ee), e.reset(F);
1992
+ var H = e.sibling(F, 2);
1794
1993
  {
1795
- var te = (X) => {
1796
- var ee = kr(), re = e.child(ee), le = e.child(re);
1797
- e.html(le, () => e.get(E).before), e.reset(re);
1798
- var ce = e.sibling(re, 2), De = e.child(ce);
1799
- e.html(De, () => e.get(E).match), e.reset(ce);
1800
- var Fe = e.sibling(ce, 2), at = e.child(Fe);
1801
- e.html(at, () => e.get(E).after), e.reset(Fe), e.reset(ee), e.append(X, ee);
1802
- }, V = (X) => {
1803
- var ee = Cr(), re = e.child(ee, !0);
1804
- e.reset(ee), e.template_effect(() => e.set_text(re, e.get(E).match)), e.append(X, ee);
1994
+ var J = (Z) => {
1995
+ var D = Vr(), Y = e.child(D), re = e.child(Y);
1996
+ e.html(re, () => e.get(b).before), e.reset(Y);
1997
+ var ie = e.sibling(Y, 2), ue = e.child(ie);
1998
+ e.html(ue, () => e.get(b).match), e.reset(ie);
1999
+ var Fe = e.sibling(ie, 2), $e = e.child(Fe);
2000
+ e.html($e, () => e.get(b).after), e.reset(Fe), e.reset(D), e.append(Z, D);
2001
+ }, K = (Z) => {
2002
+ var D = Fr(), Y = e.child(D, !0);
2003
+ e.reset(D), e.template_effect(() => e.set_text(Y, e.get(b).match)), e.append(Z, D);
1805
2004
  };
1806
- e.if(Z, (X) => {
1807
- e.get(E).type === "hit" ? X(te) : X(V, !1);
2005
+ e.if(H, (Z) => {
2006
+ e.get(b).type === "hit" ? Z(J) : Z(K, !1);
1808
2007
  });
1809
2008
  }
1810
- e.reset(R), e.template_effect(() => e.set_text(Y, e.get(E).canvasLabel)), e.append(N, R);
1811
- }), e.template_effect((N) => e.set_text(u, N), [
1812
- () => B.search_panel_results_count({ count: r.searchResults.length })
1813
- ]), e.append(q, J);
2009
+ e.reset(N), e.template_effect(() => e.set_text(X, e.get(b).canvasLabel)), e.append(l, N);
2010
+ }), e.template_effect((l) => e.set_text(ae, l), [
2011
+ () => V.search_panel_results_count({ count: r.searchResults.length })
2012
+ ]), e.append(te, se);
1814
2013
  };
1815
2014
  e.if(
1816
- U,
1817
- (q) => {
1818
- r.searchResults.length === 0 && !r.searchQuery ? q($) : q(F, !1);
2015
+ j,
2016
+ (te) => {
2017
+ r.searchResults.length === 0 && !r.searchQuery ? te(G) : te(q, !1);
1819
2018
  },
1820
2019
  !0
1821
2020
  );
1822
2021
  }
1823
- e.append(O, Q);
2022
+ e.append(W, Q);
1824
2023
  };
1825
2024
  e.if(
1826
- W,
1827
- (O) => {
1828
- r.searchResults.length === 0 && r.searchQuery ? O(m) : O(P, !1);
2025
+ O,
2026
+ (W) => {
2027
+ r.searchResults.length === 0 && r.searchQuery ? W(x) : W($, !1);
1829
2028
  },
1830
2029
  !0
1831
2030
  );
1832
2031
  }
1833
- e.append(h, H);
2032
+ e.append(A, m);
1834
2033
  };
1835
- e.if(x, (h) => {
1836
- r.isSearching ? h(D) : h(b, !1);
2034
+ e.if(w, (A) => {
2035
+ r.isSearching ? A(T) : A(L, !1);
1837
2036
  });
1838
2037
  }
1839
- e.reset(_), e.reset(z), e.template_effect(
1840
- (h, H, W, m, P) => {
1841
- e.set_attribute(z, "aria-label", h), e.set_text(p, H), e.set_attribute(f, "aria-label", W), e.set_attribute(S, "placeholder", m), e.set_attribute(G, "aria-label", P);
2038
+ e.reset(y), e.reset(g), e.template_effect(
2039
+ (A, m, O, x) => {
2040
+ e.set_attribute(g, "aria-label", A), e.set_text(h, m), e.set_attribute(E, "placeholder", O), e.set_attribute(p, "aria-label", x);
1842
2041
  },
1843
2042
  [
1844
- () => B.search_panel_title(),
1845
- () => B.search_panel_title(),
1846
- () => B.search_panel_close(),
1847
- () => B.search_panel_placeholder(),
1848
- () => B.search_panel_title()
2043
+ () => V.search_panel_title(),
2044
+ () => V.search(),
2045
+ () => V.search_panel_placeholder(),
2046
+ () => V.search_panel_title()
1849
2047
  ]
1850
- ), e.bind_value(S, () => e.get(s), (h) => e.set(s, h)), e.append(k, z);
2048
+ ), e.bind_value(E, () => e.get(s), (A) => e.set(s, A)), e.append(R, g);
1851
2049
  };
1852
- e.if(c, (k) => {
1853
- r.showSearchPanel && k(w);
2050
+ e.if(I, (R) => {
2051
+ r.showSearchPanel && R(u);
1854
2052
  });
1855
2053
  }
1856
- e.append(i, I), e.pop();
2054
+ e.append(i, _), e.pop();
1857
2055
  }
1858
2056
  e.delegate(["click", "keydown"]);
1859
- e.create_custom_element(nt, {}, [], [], !0);
1860
- var Tr = e.from_html('<div class="h-full w-[200px] pointer-events-auto relative"><!></div>'), jr = e.from_html('<div class="h-full relative pointer-events-auto"><!></div>'), Lr = e.from_html('<div class="flex-none flex flex-row z-20 bg-base-200 border-r border-base-300 transition-all"><!> <!></div>'), Or = e.from_html('<div class="flex-none h-[140px] w-full pointer-events-auto relative z-20"><!></div>'), Dr = e.from_html('<div class="w-full h-full flex items-center justify-center"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Er = e.from_html('<div class="w-full h-full flex items-center justify-center text-error"> </div>'), Rr = e.from_html('<div class="w-full h-full flex items-center justify-center text-base-content/50">No image found</div>'), Gr = e.from_html('<div class="absolute inset-0 z-40 pointer-events-none"><!></div>'), Fr = e.from_html('<div class="flex-none h-[140px] w-full pointer-events-auto relative z-20"><!></div>'), Vr = e.from_html('<div class="relative w-full z-40 pointer-events-auto"><!></div>'), $r = e.from_html('<div class="h-full relative pointer-events-auto"><!></div>'), Br = e.from_html('<div class="h-full w-[200px] pointer-events-auto relative"><!></div>'), Hr = e.from_html('<div class="h-full relative pointer-events-auto"><!></div>'), Nr = e.from_html('<div class="flex-none flex flex-row z-20 bg-base-200 border-l border-base-300 transition-all"><!> <!> <!></div>'), Yr = e.from_html('<div id="triiiceratops-viewer" class="flex w-full h-full relative bg-base-100 overflow-hidden"><!> <div id="triiiceratops-center-panel" class="flex-1 relative min-w-0 flex flex-col"><!> <div class="flex-1 relative min-h-0 w-full h-full bg-base-100"><!> <!> <!> <!> <!> <!> <!> <!></div> <!> <!></div> <!></div>');
1861
- function Xr(i, t) {
2057
+ e.create_custom_element(dt, {}, [], [], !0);
2058
+ var Hr = e.from_html('<div class="h-full w-[200px] pointer-events-auto relative"><!></div>'), Yr = e.from_html('<div class="h-full relative pointer-events-auto"><!></div>'), Xr = e.from_html('<div class="flex-none flex flex-row z-20 bg-base-200 border-r border-base-300 transition-all"><!> <!></div>'), qr = e.from_html('<div class="flex-none h-[140px] w-full pointer-events-auto relative z-20"><!></div>'), Qr = e.from_html('<div class="w-full h-full flex items-center justify-center"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Wr = e.from_html('<div class="w-full h-full flex items-center justify-center text-error"> </div>'), Ur = e.from_html('<div class="w-full h-full flex items-center justify-center text-base-content/50"> </div>'), Jr = e.from_html('<div class="absolute inset-0 z-40 pointer-events-none"><!></div>'), Kr = e.from_html('<div class="flex-none h-[140px] w-full pointer-events-auto relative z-20"><!></div>'), Zr = e.from_html('<div class="relative w-full z-40 pointer-events-auto"><!></div>'), ei = e.from_html('<div class="h-full relative pointer-events-auto"><!></div>'), ti = e.from_html('<div class="h-full w-[200px] pointer-events-auto relative"><!></div>'), ri = e.from_html('<div class="h-full relative pointer-events-auto"><!></div>'), ii = e.from_html('<div class="flex-none flex flex-row z-20 bg-base-200 border-l border-base-300 transition-all"><!> <!> <!></div>'), si = e.from_html('<div id="triiiceratops-viewer" class="flex w-full h-full relative bg-base-100 overflow-hidden"><!> <div id="triiiceratops-center-panel" class="flex-1 relative min-w-0 flex flex-col"><!> <div class="flex-1 relative min-h-0 w-full h-full bg-base-100"><!> <!> <!> <!> <!> <!> <!> <!></div> <!> <!></div> <!></div>');
2059
+ function ni(i, t) {
1862
2060
  e.push(t, !0);
1863
- let r = e.prop(t, "manifestId", 7), s = e.prop(t, "canvasId", 7), n = e.prop(t, "plugins", 23, () => []), a = e.prop(t, "theme", 7), y = e.prop(t, "themeConfig", 7), I = e.state(void 0);
2061
+ let r = e.prop(t, "manifestId", 7), s = e.prop(t, "canvasId", 7), n = e.prop(t, "plugins", 23, () => []), a = e.prop(t, "theme", 7), S = e.prop(t, "themeConfig", 7), P = e.prop(t, "config", 23, () => ({})), _ = e.prop(t, "viewerState", 15), I = e.state(void 0);
1864
2062
  e.user_effect(() => {
1865
- e.get(I) && Ht(e.get(I), a(), y());
2063
+ e.get(I) && qt(e.get(I), a(), S());
1866
2064
  });
1867
- const c = new kt(null, s(), n());
1868
- ft(se, c), ut(() => {
1869
- c.destroyAllPlugins();
2065
+ const u = new Tt(null, void 0, []);
2066
+ _(
2067
+ u
2068
+ // Expose via bindable prop
2069
+ ), vt(ce, u), pt(() => {
2070
+ u.destroyAllPlugins();
2071
+ }), e.user_effect(() => {
2072
+ r() && u.setManifest(r());
1870
2073
  }), e.user_effect(() => {
1871
- r() && c.setManifest(r());
2074
+ s() && u.setCanvas(s());
1872
2075
  }), e.user_effect(() => {
1873
- s() && c.setCanvas(s());
2076
+ P() && (console.log("[Viewer] updateConfig called with:", P()), u.updateConfig(P()));
1874
2077
  }), e.user_effect(() => {
1875
- const u = () => {
1876
- c.isFullScreen = !!document.fullscreenElement;
2078
+ for (const l of n())
2079
+ u.registerPlugin(l);
2080
+ }), e.user_effect(() => {
2081
+ const l = () => {
2082
+ u.isFullScreen = !!document.fullscreenElement;
1877
2083
  };
1878
- return document.addEventListener("fullscreenchange", u), () => {
1879
- document.removeEventListener("fullscreenchange", u);
2084
+ return document.addEventListener("fullscreenchange", l), () => {
2085
+ document.removeEventListener("fullscreenchange", l);
1880
2086
  };
1881
2087
  });
1882
- let w = e.derived(() => c.showThumbnailGallery && c.dockSide === "left" || c.pluginPanels.some((u) => u.position === "left" && u.isVisible())), k = e.derived(() => c.showSearchPanel || c.showThumbnailGallery && c.dockSide === "right" || c.pluginPanels.some((u) => u.position === "right" && u.isVisible())), z = e.derived(() => c.manifest), d = e.derived(() => c.canvases), g = e.derived(() => c.currentCanvasIndex), p = e.derived(() => {
1883
- var Z, te;
1884
- if (!e.get(d) || e.get(g) === -1 || !e.get(d)[e.get(g)])
1885
- return (Z = e.get(z)) != null && Z.isFetching || console.log("TriiiceratopsViewer: No canvas found"), null;
1886
- const u = e.get(d)[e.get(g)];
1887
- let T = u.getImages();
1888
- if ((!T || !T.length) && u.getContent && (T = u.getContent()), !T || !T.length)
1889
- return u.__jsonld && u.__jsonld.items, (te = e.get(z)) != null && te.isFetching || console.log("TriiiceratopsViewer: No images/content in canvas"), null;
1890
- const N = T[0];
1891
- let E = N.getResource ? N.getResource() : null;
1892
- if (!E && N.getBody) {
1893
- const V = N.getBody();
1894
- Array.isArray(V) && V.length > 0 ? E = V[0] : V && (E = V);
2088
+ let R = e.derived(() => u.showThumbnailGallery && u.dockSide === "left" || u.pluginPanels.some((l) => l.position === "left" && l.isVisible())), g = e.derived(() => u.showSearchPanel || u.showThumbnailGallery && u.dockSide === "right" || u.pluginPanels.some((l) => l.position === "right" && l.isVisible())), v = e.derived(() => u.manifest), C = e.derived(() => u.canvases), h = e.derived(() => u.currentCanvasIndex), c = e.derived(() => {
2089
+ var K, Z;
2090
+ if (!e.get(C) || e.get(h) === -1 || !e.get(C)[e.get(h)])
2091
+ return (K = e.get(v)) != null && K.isFetching || console.log("TriiiceratopsViewer: No canvas found"), null;
2092
+ const l = e.get(C)[e.get(h)];
2093
+ let b = l.getImages();
2094
+ if ((!b || !b.length) && l.getContent && (b = l.getContent()), !b || !b.length)
2095
+ return l.__jsonld && l.__jsonld.items, (Z = e.get(v)) != null && Z.isFetching || console.log("TriiiceratopsViewer: No images/content in canvas"), null;
2096
+ const N = b[0];
2097
+ let F = N.getResource ? N.getResource() : null;
2098
+ if (!F && N.getBody) {
2099
+ const D = N.getBody();
2100
+ Array.isArray(D) && D.length > 0 ? F = D[0] : D && (F = D);
1895
2101
  }
1896
- if (E && !E.id && !E.__jsonld && (!E.getServices || E.getServices().length === 0) && (E = null), !E) {
1897
- const V = N.__jsonld || N;
1898
- V.body && (E = Array.isArray(V.body) ? V.body[0] : V.body);
2102
+ if (F && !F.id && !F.__jsonld && (!F.getServices || F.getServices().length === 0) && (F = null), !F) {
2103
+ const D = N.__jsonld || N;
2104
+ D.body && (F = Array.isArray(D.body) ? D.body[0] : D.body);
1899
2105
  }
1900
- if (!E)
2106
+ if (!F)
1901
2107
  return null;
1902
- const R = (V) => V.id || V["@id"];
1903
- let j = [];
1904
- if (E.getServices && (j = E.getServices()), !j.length) {
1905
- const V = E.__jsonld || E;
1906
- V.service && (j = Array.isArray(V.service) ? V.service : [V.service]);
2108
+ const ee = (D) => D.id || D["@id"];
2109
+ let X = [];
2110
+ if (F.getServices && (X = F.getServices()), !X.length) {
2111
+ const D = F.__jsonld || F;
2112
+ D.service && (X = Array.isArray(D.service) ? D.service : [D.service]);
1907
2113
  }
1908
- if (j.length > 0) {
1909
- const V = j.find((X) => {
1910
- const ee = X.getType ? X.getType() : X.type || "", re = X.getProfile ? X.getProfile() : X.profile || "";
1911
- return ee === "ImageService1" || ee === "ImageService2" || ee === "ImageService3" || typeof re == "string" && re.includes("http://iiif.io/api/image") || typeof re == "string" && re === "level0";
2114
+ if (X.length > 0) {
2115
+ const D = X.find((Y) => {
2116
+ const re = Y.getType ? Y.getType() : Y.type || "", ie = Y.getProfile ? Y.getProfile() : Y.profile || "";
2117
+ return re === "ImageService1" || re === "ImageService2" || re === "ImageService3" || typeof ie == "string" && ie.includes("http://iiif.io/api/image") || typeof ie == "string" && ie === "level0";
1912
2118
  });
1913
- if (V) {
1914
- let X = R(V);
1915
- return X && !X.endsWith("/info.json") && (X = `${X}/info.json`), X;
2119
+ if (D) {
2120
+ let Y = ee(D);
2121
+ return Y && !Y.endsWith("/info.json") && (Y = `${Y}/info.json`), Y;
1916
2122
  }
1917
2123
  }
1918
- const M = R(E);
1919
- if (M && M.includes("/iiif/")) {
1920
- const V = M.split("/"), X = V.findIndex((ee) => ee === "full" || ee.match(/^\d+,\d+,\d+,\d+$/));
1921
- if (X > 0)
1922
- return `${V.slice(0, X).join("/")}/info.json`;
2124
+ const H = ee(F);
2125
+ if (H && H.includes("/iiif/")) {
2126
+ const D = H.split("/"), Y = D.findIndex((re) => re === "full" || re.match(/^\d+,\d+,\d+,\d+$/));
2127
+ if (Y > 0)
2128
+ return `${D.slice(0, Y).join("/")}/info.json`;
1923
2129
  }
1924
- return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: M };
2130
+ return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: H };
1925
2131
  });
1926
- var f = {
2132
+ var d = {
1927
2133
  get manifestId() {
1928
2134
  return r();
1929
2135
  },
1930
- set manifestId(u) {
1931
- r(u), e.flush();
2136
+ set manifestId(l) {
2137
+ r(l), e.flush();
1932
2138
  },
1933
2139
  get canvasId() {
1934
2140
  return s();
1935
2141
  },
1936
- set canvasId(u) {
1937
- s(u), e.flush();
2142
+ set canvasId(l) {
2143
+ s(l), e.flush();
1938
2144
  },
1939
2145
  get plugins() {
1940
2146
  return n();
1941
2147
  },
1942
- set plugins(u = []) {
1943
- n(u), e.flush();
2148
+ set plugins(l = []) {
2149
+ n(l), e.flush();
1944
2150
  },
1945
2151
  get theme() {
1946
2152
  return a();
1947
2153
  },
1948
- set theme(u) {
1949
- a(u), e.flush();
2154
+ set theme(l) {
2155
+ a(l), e.flush();
1950
2156
  },
1951
2157
  get themeConfig() {
1952
- return y();
2158
+ return S();
2159
+ },
2160
+ set themeConfig(l) {
2161
+ S(l), e.flush();
2162
+ },
2163
+ get config() {
2164
+ return P();
1953
2165
  },
1954
- set themeConfig(u) {
1955
- y(u), e.flush();
2166
+ set config(l = {}) {
2167
+ P(l), e.flush();
2168
+ },
2169
+ get viewerState() {
2170
+ return _();
2171
+ },
2172
+ set viewerState(l) {
2173
+ _(l), e.flush();
1956
2174
  }
1957
- }, v = Yr(), o = e.child(v);
2175
+ }, z = si(), B = e.child(z);
1958
2176
  {
1959
- var S = (u) => {
1960
- var T = Lr(), N = e.child(T);
2177
+ var E = (l) => {
2178
+ var b = Xr(), N = e.child(b);
1961
2179
  {
1962
- var E = (j) => {
1963
- var M = Tr(), Y = e.child(M);
1964
- ne(Y, {
2180
+ var F = (X) => {
2181
+ var H = Hr(), J = e.child(H);
2182
+ de(J, {
1965
2183
  get canvases() {
1966
- return e.get(d);
2184
+ return e.get(C);
1967
2185
  }
1968
- }), e.reset(M), e.append(j, M);
2186
+ }), e.reset(H), e.append(X, H);
1969
2187
  };
1970
- e.if(N, (j) => {
1971
- c.showThumbnailGallery && c.dockSide === "left" && j(E);
2188
+ e.if(N, (X) => {
2189
+ u.showThumbnailGallery && u.dockSide === "left" && X(F);
1972
2190
  });
1973
2191
  }
1974
- var R = e.sibling(N, 2);
1975
- e.each(R, 17, () => c.pluginPanels, (j) => j.id, (j, M) => {
1976
- var Y = e.comment(), Z = e.first_child(Y);
2192
+ var ee = e.sibling(N, 2);
2193
+ e.each(ee, 17, () => u.pluginPanels, (X) => X.id, (X, H) => {
2194
+ var J = e.comment(), K = e.first_child(J);
1977
2195
  {
1978
- var te = (V) => {
1979
- var X = jr(), ee = e.child(X);
1980
- e.component(ee, () => e.get(M).component, (re, le) => {
1981
- le(re, e.spread_props(() => e.get(M).props ?? {}));
1982
- }), e.reset(X), e.append(V, X);
2196
+ var Z = (D) => {
2197
+ var Y = Yr(), re = e.child(Y);
2198
+ e.component(re, () => e.get(H).component, (ie, ue) => {
2199
+ ue(ie, e.spread_props(() => e.get(H).props ?? {}));
2200
+ }), e.reset(Y), e.append(D, Y);
1983
2201
  };
1984
- e.if(Z, (V) => {
1985
- e.get(M).isVisible() && e.get(M).position === "left" && V(te);
2202
+ e.if(K, (D) => {
2203
+ e.get(H).isVisible() && e.get(H).position === "left" && D(Z);
1986
2204
  });
1987
2205
  }
1988
- e.append(j, Y);
1989
- }), e.reset(T), e.append(u, T);
2206
+ e.append(X, J);
2207
+ }), e.reset(b), e.append(l, b);
1990
2208
  };
1991
- e.if(o, (u) => {
1992
- e.get(w) && u(S);
2209
+ e.if(B, (l) => {
2210
+ e.get(R) && l(E);
1993
2211
  });
1994
2212
  }
1995
- var G = e.sibling(o, 2), L = e.child(G);
2213
+ var p = e.sibling(B, 2), f = e.child(p);
1996
2214
  {
1997
- var l = (u) => {
1998
- var T = Or(), N = e.child(T);
1999
- ne(N, {
2215
+ var o = (l) => {
2216
+ var b = qr(), N = e.child(b);
2217
+ de(N, {
2000
2218
  get canvases() {
2001
- return e.get(d);
2219
+ return e.get(C);
2002
2220
  }
2003
- }), e.reset(T), e.append(u, T);
2221
+ }), e.reset(b), e.append(l, b);
2004
2222
  };
2005
- e.if(L, (u) => {
2006
- c.showThumbnailGallery && c.dockSide === "top" && u(l);
2223
+ e.if(f, (l) => {
2224
+ u.showThumbnailGallery && u.dockSide === "top" && l(o);
2007
2225
  });
2008
2226
  }
2009
- var C = e.sibling(L, 2), _ = e.child(C);
2227
+ var M = e.sibling(f, 2), y = e.child(M);
2010
2228
  {
2011
- var x = (u) => {
2012
- var T = Dr();
2013
- e.append(u, T);
2014
- }, D = (u) => {
2015
- var T = e.comment(), N = e.first_child(T);
2229
+ var w = (l) => {
2230
+ var b = Qr();
2231
+ e.append(l, b);
2232
+ }, T = (l) => {
2233
+ var b = e.comment(), N = e.first_child(b);
2016
2234
  {
2017
- var E = (j) => {
2018
- var M = Er(), Y = e.child(M);
2019
- e.reset(M), e.template_effect(() => e.set_text(Y, `Error: ${e.get(z).error ?? ""}`)), e.append(j, M);
2020
- }, R = (j) => {
2021
- var M = e.comment(), Y = e.first_child(M);
2235
+ var F = (X) => {
2236
+ var H = Wr(), J = e.child(H);
2237
+ e.reset(H), e.template_effect(
2238
+ (K) => e.set_text(J, `${K ?? ""}
2239
+ ${e.get(v).error ?? ""}`),
2240
+ [() => V.error_prefix()]
2241
+ ), e.append(X, H);
2242
+ }, ee = (X) => {
2243
+ var H = e.comment(), J = e.first_child(H);
2022
2244
  {
2023
- var Z = (V) => {
2024
- var X = e.comment(), ee = e.first_child(X);
2025
- e.key(ee, () => e.get(p), (re) => {
2026
- Ze(re, {
2245
+ var K = (D) => {
2246
+ var Y = e.comment(), re = e.first_child(Y);
2247
+ e.key(re, () => e.get(c), (ie) => {
2248
+ st(ie, {
2027
2249
  get tileSources() {
2028
- return e.get(p);
2250
+ return e.get(c);
2029
2251
  },
2030
2252
  get viewerState() {
2031
- return c;
2253
+ return u;
2032
2254
  }
2033
2255
  });
2034
- }), e.append(V, X);
2035
- }, te = (V) => {
2036
- var X = Rr();
2037
- e.append(V, X);
2256
+ }), e.append(D, Y);
2257
+ }, Z = (D) => {
2258
+ var Y = Ur(), re = e.child(Y, !0);
2259
+ e.reset(Y), e.template_effect((ie) => e.set_text(re, ie), [() => V.no_image_found()]), e.append(D, Y);
2038
2260
  };
2039
2261
  e.if(
2040
- Y,
2041
- (V) => {
2042
- e.get(p) ? V(Z) : V(te, !1);
2262
+ J,
2263
+ (D) => {
2264
+ e.get(c) ? D(K) : D(Z, !1);
2043
2265
  },
2044
2266
  !0
2045
2267
  );
2046
2268
  }
2047
- e.append(j, M);
2269
+ e.append(X, H);
2048
2270
  };
2049
2271
  e.if(
2050
2272
  N,
2051
- (j) => {
2052
- var M;
2053
- (M = e.get(z)) != null && M.error ? j(E) : j(R, !1);
2273
+ (X) => {
2274
+ var H;
2275
+ (H = e.get(v)) != null && H.error ? X(F) : X(ee, !1);
2054
2276
  },
2055
2277
  !0
2056
2278
  );
2057
2279
  }
2058
- e.append(u, T);
2280
+ e.append(l, b);
2281
+ };
2282
+ e.if(y, (l) => {
2283
+ var b;
2284
+ (b = e.get(v)) != null && b.isFetching ? l(w) : l(T, !1);
2285
+ });
2286
+ }
2287
+ var L = e.sibling(y, 2);
2288
+ at(L, {});
2289
+ var A = e.sibling(L, 2);
2290
+ ct(A, {});
2291
+ var m = e.sibling(A, 2);
2292
+ {
2293
+ var O = (l) => {
2294
+ ot(l, {});
2295
+ };
2296
+ e.if(m, (l) => {
2297
+ u.showRightMenu && l(O);
2298
+ });
2299
+ }
2300
+ var x = e.sibling(m, 2);
2301
+ {
2302
+ var $ = (l) => {
2303
+ lt(l, {});
2059
2304
  };
2060
- e.if(_, (u) => {
2061
- var T;
2062
- (T = e.get(z)) != null && T.isFetching ? u(x) : u(D, !1);
2305
+ e.if(x, (l) => {
2306
+ u.showLeftMenu && l($);
2063
2307
  });
2064
2308
  }
2065
- var b = e.sibling(_, 2);
2066
- tt(b, {});
2067
- var h = e.sibling(b, 2);
2068
- st(h, {});
2069
- var H = e.sibling(h, 2);
2070
- rt(H, {});
2071
- var W = e.sibling(H, 2);
2072
- it(W, {});
2073
- var m = e.sibling(W, 2);
2074
- e.each(m, 17, () => c.pluginPanels, (u) => u.id, (u, T) => {
2075
- var N = e.comment(), E = e.first_child(N);
2309
+ var W = e.sibling(x, 2);
2310
+ e.each(W, 17, () => u.pluginPanels, (l) => l.id, (l, b) => {
2311
+ var N = e.comment(), F = e.first_child(N);
2076
2312
  {
2077
- var R = (j) => {
2078
- var M = Gr(), Y = e.child(M);
2079
- e.component(Y, () => e.get(T).component, (Z, te) => {
2080
- te(Z, e.spread_props(() => e.get(T).props ?? {}));
2081
- }), e.reset(M), e.append(j, M);
2313
+ var ee = (X) => {
2314
+ var H = Jr(), J = e.child(H);
2315
+ e.component(J, () => e.get(b).component, (K, Z) => {
2316
+ Z(K, e.spread_props(() => e.get(b).props ?? {}));
2317
+ }), e.reset(H), e.append(X, H);
2082
2318
  };
2083
- e.if(E, (j) => {
2084
- e.get(T).isVisible() && e.get(T).position === "overlay" && j(R);
2319
+ e.if(F, (X) => {
2320
+ e.get(b).isVisible() && e.get(b).position === "overlay" && X(ee);
2085
2321
  });
2086
2322
  }
2087
- e.append(u, N);
2323
+ e.append(l, N);
2088
2324
  });
2089
- var P = e.sibling(m, 2);
2325
+ var Q = e.sibling(W, 2);
2090
2326
  {
2091
- var O = (u) => {
2092
- et(u, {
2327
+ var j = (l) => {
2328
+ nt(l, {
2093
2329
  get viewerState() {
2094
- return c;
2330
+ return u;
2095
2331
  }
2096
2332
  });
2097
2333
  };
2098
- e.if(P, (u) => {
2099
- e.get(d).length > 1 && u(O);
2334
+ e.if(Q, (l) => {
2335
+ e.get(C).length > 1 && u.showCanvasNav && l(j);
2100
2336
  });
2101
2337
  }
2102
- var Q = e.sibling(P, 2);
2338
+ var G = e.sibling(Q, 2);
2103
2339
  {
2104
- var U = (u) => {
2105
- ne(u, {
2340
+ var q = (l) => {
2341
+ de(l, {
2106
2342
  get canvases() {
2107
- return e.get(d);
2343
+ return e.get(C);
2108
2344
  }
2109
2345
  });
2110
2346
  };
2111
- e.if(Q, (u) => {
2112
- c.showThumbnailGallery && c.dockSide === "none" && u(U);
2347
+ e.if(G, (l) => {
2348
+ u.showThumbnailGallery && u.dockSide === "none" && l(q);
2113
2349
  });
2114
2350
  }
2115
- e.reset(C);
2116
- var $ = e.sibling(C, 2);
2351
+ e.reset(M);
2352
+ var te = e.sibling(M, 2);
2117
2353
  {
2118
- var F = (u) => {
2119
- var T = Fr(), N = e.child(T);
2120
- ne(N, {
2354
+ var se = (l) => {
2355
+ var b = Kr(), N = e.child(b);
2356
+ de(N, {
2121
2357
  get canvases() {
2122
- return e.get(d);
2358
+ return e.get(C);
2123
2359
  }
2124
- }), e.reset(T), e.append(u, T);
2360
+ }), e.reset(b), e.append(l, b);
2125
2361
  };
2126
- e.if($, (u) => {
2127
- c.showThumbnailGallery && c.dockSide === "bottom" && u(F);
2362
+ e.if(te, (l) => {
2363
+ u.showThumbnailGallery && u.dockSide === "bottom" && l(se);
2128
2364
  });
2129
2365
  }
2130
- var q = e.sibling($, 2);
2131
- e.each(q, 17, () => c.pluginPanels, (u) => u.id, (u, T) => {
2132
- var N = e.comment(), E = e.first_child(N);
2366
+ var ne = e.sibling(te, 2);
2367
+ e.each(ne, 17, () => u.pluginPanels, (l) => l.id, (l, b) => {
2368
+ var N = e.comment(), F = e.first_child(N);
2133
2369
  {
2134
- var R = (j) => {
2135
- var M = Vr(), Y = e.child(M);
2136
- e.component(Y, () => e.get(T).component, (Z, te) => {
2137
- te(Z, e.spread_props(() => e.get(T).props ?? {}));
2138
- }), e.reset(M), e.append(j, M);
2370
+ var ee = (X) => {
2371
+ var H = Zr(), J = e.child(H);
2372
+ e.component(J, () => e.get(b).component, (K, Z) => {
2373
+ Z(K, e.spread_props(() => e.get(b).props ?? {}));
2374
+ }), e.reset(H), e.append(X, H);
2139
2375
  };
2140
- e.if(E, (j) => {
2141
- e.get(T).isVisible() && e.get(T).position === "bottom" && j(R);
2376
+ e.if(F, (X) => {
2377
+ e.get(b).isVisible() && e.get(b).position === "bottom" && X(ee);
2142
2378
  });
2143
2379
  }
2144
- e.append(u, N);
2145
- }), e.reset(G);
2146
- var J = e.sibling(G, 2);
2380
+ e.append(l, N);
2381
+ }), e.reset(p);
2382
+ var ae = e.sibling(p, 2);
2147
2383
  {
2148
- var ie = (u) => {
2149
- var T = Nr(), N = e.child(T);
2384
+ var oe = (l) => {
2385
+ var b = ii(), N = e.child(b);
2150
2386
  {
2151
- var E = (Y) => {
2152
- var Z = $r(), te = e.child(Z);
2153
- nt(te, {}), e.reset(Z), e.append(Y, Z);
2387
+ var F = (J) => {
2388
+ var K = ei(), Z = e.child(K);
2389
+ dt(Z, {}), e.reset(K), e.append(J, K);
2154
2390
  };
2155
- e.if(N, (Y) => {
2156
- c.showSearchPanel && Y(E);
2391
+ e.if(N, (J) => {
2392
+ u.showSearchPanel && J(F);
2157
2393
  });
2158
2394
  }
2159
- var R = e.sibling(N, 2);
2395
+ var ee = e.sibling(N, 2);
2160
2396
  {
2161
- var j = (Y) => {
2162
- var Z = Br(), te = e.child(Z);
2163
- ne(te, {
2397
+ var X = (J) => {
2398
+ var K = ti(), Z = e.child(K);
2399
+ de(Z, {
2164
2400
  get canvases() {
2165
- return e.get(d);
2401
+ return e.get(C);
2166
2402
  }
2167
- }), e.reset(Z), e.append(Y, Z);
2403
+ }), e.reset(K), e.append(J, K);
2168
2404
  };
2169
- e.if(R, (Y) => {
2170
- c.showThumbnailGallery && c.dockSide === "right" && Y(j);
2405
+ e.if(ee, (J) => {
2406
+ u.showThumbnailGallery && u.dockSide === "right" && J(X);
2171
2407
  });
2172
2408
  }
2173
- var M = e.sibling(R, 2);
2174
- e.each(M, 17, () => c.pluginPanels, (Y) => Y.id, (Y, Z) => {
2175
- var te = e.comment(), V = e.first_child(te);
2409
+ var H = e.sibling(ee, 2);
2410
+ e.each(H, 17, () => u.pluginPanels, (J) => J.id, (J, K) => {
2411
+ var Z = e.comment(), D = e.first_child(Z);
2176
2412
  {
2177
- var X = (ee) => {
2178
- var re = Hr(), le = e.child(re);
2179
- e.component(le, () => e.get(Z).component, (ce, De) => {
2180
- De(ce, e.spread_props(() => e.get(Z).props ?? {}));
2181
- }), e.reset(re), e.append(ee, re);
2413
+ var Y = (re) => {
2414
+ var ie = ri(), ue = e.child(ie);
2415
+ e.component(ue, () => e.get(K).component, (Fe, $e) => {
2416
+ $e(Fe, e.spread_props(() => e.get(K).props ?? {}));
2417
+ }), e.reset(ie), e.append(re, ie);
2182
2418
  };
2183
- e.if(V, (ee) => {
2184
- e.get(Z).isVisible() && e.get(Z).position === "right" && ee(X);
2419
+ e.if(D, (re) => {
2420
+ e.get(K).isVisible() && e.get(K).position === "right" && re(Y);
2185
2421
  });
2186
2422
  }
2187
- e.append(Y, te);
2188
- }), e.reset(T), e.append(u, T);
2423
+ e.append(J, Z);
2424
+ }), e.reset(b), e.append(l, b);
2189
2425
  };
2190
- e.if(J, (u) => {
2191
- e.get(k) && u(ie);
2426
+ e.if(ae, (l) => {
2427
+ e.get(g) && l(oe);
2192
2428
  });
2193
2429
  }
2194
- return e.reset(v), e.bind_this(v, (u) => e.set(I, u), () => e.get(I)), e.append(i, v), e.pop(f);
2430
+ return e.reset(z), e.bind_this(z, (l) => e.set(I, l), () => e.get(I)), e.append(i, z), e.pop(d);
2195
2431
  }
2196
2432
  e.create_custom_element(
2197
- Xr,
2433
+ ni,
2198
2434
  {
2199
2435
  manifestId: {},
2200
2436
  canvasId: {},
2201
2437
  plugins: {},
2202
2438
  theme: {},
2203
- themeConfig: {}
2439
+ themeConfig: {},
2440
+ config: {},
2441
+ viewerState: {}
2204
2442
  },
2205
2443
  [],
2206
2444
  [],
2207
2445
  !0
2208
2446
  );
2209
2447
  export {
2210
- mi as BasePlugin,
2211
- Ct as DAISYUI_THEMES,
2212
- It as ManifestsState,
2213
- Xr as TriiiceratopsViewer,
2214
- se as VIEWER_STATE_KEY,
2215
- kt as ViewerState,
2216
- Vt as applyBuiltInTheme,
2217
- Ht as applyTheme,
2218
- $t as applyThemeConfig,
2219
- Bt as clearThemeConfig,
2220
- Et as hexToOklch,
2221
- gi as isBuiltInTheme,
2222
- Gt as normalizeColor,
2223
- vi as parseThemeConfig
2448
+ zi as BasePlugin,
2449
+ zt as DAISYUI_THEMES,
2450
+ Mt as ManifestsState,
2451
+ ni as TriiiceratopsViewer,
2452
+ ce as VIEWER_STATE_KEY,
2453
+ Tt as ViewerState,
2454
+ Ht as applyBuiltInTheme,
2455
+ qt as applyTheme,
2456
+ Yt as applyThemeConfig,
2457
+ Xt as clearThemeConfig,
2458
+ Ft as hexToOklch,
2459
+ ki as isBuiltInTheme,
2460
+ $t as normalizeColor,
2461
+ Pi as parseThemeConfig
2224
2462
  };