@manifest-editor/exhibition-preset 1.3.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 ADDED
@@ -0,0 +1,3515 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from2, except, desc) => {
11
+ if (from2 && typeof from2 === "object" || typeof from2 === "function") {
12
+ for (let key of __getOwnPropNames(from2))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../node_modules/.pnpm/shallowequal@1.1.0/node_modules/shallowequal/index.js
28
+ var require_shallowequal = __commonJS({
29
+ "../../node_modules/.pnpm/shallowequal@1.1.0/node_modules/shallowequal/index.js"(exports, module) {
30
+ "use strict";
31
+ module.exports = function shallowEqual(objA, objB, compare, compareContext) {
32
+ var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
33
+ if (ret !== void 0) {
34
+ return !!ret;
35
+ }
36
+ if (objA === objB) {
37
+ return true;
38
+ }
39
+ if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
40
+ return false;
41
+ }
42
+ var keysA = Object.keys(objA);
43
+ var keysB = Object.keys(objB);
44
+ if (keysA.length !== keysB.length) {
45
+ return false;
46
+ }
47
+ var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
48
+ for (var idx = 0; idx < keysA.length; idx++) {
49
+ var key = keysA[idx];
50
+ if (!bHasOwnProperty(key)) {
51
+ return false;
52
+ }
53
+ var valueA = objA[key];
54
+ var valueB = objB[key];
55
+ ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
56
+ if (ret === false || ret === void 0 && valueA !== valueB) {
57
+ return false;
58
+ }
59
+ }
60
+ return true;
61
+ };
62
+ }
63
+ });
64
+
65
+ // src/index.tsx
66
+ import * as ManifestPreset from "@manifest-editor/manifest-preset";
67
+ import { extendApp, mapApp } from "@manifest-editor/shell";
68
+
69
+ // src/annotations/TourStepAnnotations.tsx
70
+ import {
71
+ useAtlasStore,
72
+ useGenericEditor,
73
+ useLayoutState
74
+ } from "@manifest-editor/shell";
75
+ import {
76
+ AnnotationContext,
77
+ AnnotationPageContext,
78
+ useAnnotation,
79
+ useAnnotationPage,
80
+ useCanvas as useCanvas2
81
+ } from "react-iiif-vault";
82
+ import { useStore } from "zustand";
83
+
84
+ // src/components/AtlasRenderBoxSelector.tsx
85
+ import { jsx } from "react/jsx-runtime";
86
+ function AtlasRenderBoxSelector({
87
+ id,
88
+ target,
89
+ style,
90
+ onClick
91
+ }) {
92
+ const { x: x2, y: y2, width, height } = target.spatial;
93
+ return (
94
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
95
+ /* @__PURE__ */ jsx(
96
+ "box",
97
+ {
98
+ id,
99
+ relativeStyle: true,
100
+ relativeSize: false,
101
+ target: { x: x2, y: y2, width, height },
102
+ style: style || {
103
+ border: "2px solid rgba(255, 255, 255, 0.2)",
104
+ ":hover": {
105
+ backgroundColor: "rgba(255, 255, 255, 0.2)"
106
+ }
107
+ },
108
+ onClick
109
+ }
110
+ )
111
+ );
112
+ }
113
+
114
+ // src/components/AtlasRenderSVGSelector.tsx
115
+ import { useCanvas } from "react-iiif-vault";
116
+ import { jsx as jsx2 } from "react/jsx-runtime";
117
+ function AtlasRenderSVGSelector({
118
+ id,
119
+ target,
120
+ style,
121
+ onClick
122
+ }) {
123
+ const canvas = useCanvas();
124
+ if (!canvas)
125
+ return null;
126
+ return (
127
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
128
+ /* @__PURE__ */ jsx2(
129
+ "shape",
130
+ {
131
+ id,
132
+ points: target.points || [],
133
+ target: { x: 0, y: 0, width: canvas.width, height: canvas.height },
134
+ relativeStyle: true,
135
+ relativeSize: false,
136
+ style: style || {
137
+ border: "2px solid rgba(255, 255, 255, 0.2)",
138
+ ":hover": {
139
+ backgroundColor: "rgba(255, 255, 255, 0.2)"
140
+ }
141
+ },
142
+ onClick
143
+ }
144
+ )
145
+ );
146
+ }
147
+
148
+ // src/annotations/TourStepAnnotations.tsx
149
+ import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
150
+ var tourStepAnnotations = {
151
+ id: "@exhibition/tour-step-annotations",
152
+ label: "Tour steps",
153
+ render: () => /* @__PURE__ */ jsx3(TourStepAnnotations, {})
154
+ };
155
+ function TourStepAnnotations() {
156
+ const canvas = useCanvas2();
157
+ const store = useAtlasStore();
158
+ const tool = useStore(store, (s2) => s2.tool);
159
+ const { rightPanel } = useLayoutState();
160
+ const isRightPanel = rightPanel.current === "@manifest-editor/editor";
161
+ const isTour = isRightPanel && rightPanel.state?.currentTab?.startsWith("@exhibition/tour-steps");
162
+ const firstAnnotationPage = canvas?.annotations[0];
163
+ if (!isTour || !canvas || tool.enabled || !firstAnnotationPage) {
164
+ return null;
165
+ }
166
+ return /* @__PURE__ */ jsx3(Fragment, { children: /* @__PURE__ */ jsx3(AnnotationPageContext, { annotationPage: firstAnnotationPage.id, children: /* @__PURE__ */ jsx3(ViewAnnotationPage, {}) }) });
167
+ }
168
+ function ViewAnnotationPage() {
169
+ const page = useAnnotationPage();
170
+ return /* @__PURE__ */ jsx3(Fragment, { children: page?.items?.map((item) => {
171
+ return /* @__PURE__ */ jsx3(AnnotationContext, { annotation: item.id, children: /* @__PURE__ */ jsx3(ViewAnnotation, {}) }, item.id);
172
+ }) });
173
+ }
174
+ function ViewAnnotation() {
175
+ const annotation = useAnnotation();
176
+ const editor = useGenericEditor(annotation);
177
+ const target = editor.annotation.target.getParsedSelector();
178
+ if (!target || !annotation)
179
+ return null;
180
+ if (target.type === "BoxSelector") {
181
+ return /* @__PURE__ */ jsx3(AtlasRenderBoxSelector, { id: annotation.id, target });
182
+ }
183
+ if (target.type === "SvgSelector") {
184
+ return /* @__PURE__ */ jsx3(AtlasRenderSVGSelector, { id: annotation.id, target });
185
+ }
186
+ return null;
187
+ }
188
+
189
+ // src/canvas-editors/image-block-editor.tsx
190
+ import { ActionButton } from "@manifest-editor/components";
191
+ import {
192
+ CanvasPanelEditor,
193
+ useInStack
194
+ } from "@manifest-editor/editors";
195
+
196
+ // ../../packages/ui/madoc/use-local-storage.ts
197
+ import { useEffect, useRef, useState } from "react";
198
+
199
+ // ../../node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/dist/mitt.mjs
200
+ function mitt_default(n) {
201
+ return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
202
+ var i2 = n.get(t);
203
+ i2 ? i2.push(e) : n.set(t, [e]);
204
+ }, off: function(t, e) {
205
+ var i2 = n.get(t);
206
+ i2 && (e ? i2.splice(i2.indexOf(e) >>> 0, 1) : n.set(t, []));
207
+ }, emit: function(t, e) {
208
+ var i2 = n.get(t);
209
+ i2 && i2.slice().map(function(n2) {
210
+ n2(e);
211
+ }), (i2 = n.get("*")) && i2.slice().map(function(n2) {
212
+ n2(t, e);
213
+ });
214
+ } };
215
+ }
216
+
217
+ // ../../packages/ui/madoc/use-local-storage.ts
218
+ globalThis.MS_LS_EMITTER = globalThis.MS_LS_EMITTER || mitt_default();
219
+ var lsEmitter = globalThis.MS_LS_EMITTER;
220
+ function useLocalStorage(key, initialValue) {
221
+ const lastStoredValue = useRef();
222
+ if (!lastStoredValue.current && initialValue) {
223
+ lastStoredValue.current = JSON.stringify(initialValue);
224
+ }
225
+ const [storedValue, setStoredValue] = useState(() => {
226
+ try {
227
+ if (typeof window === "undefined" || typeof window.localStorage === "undefined") {
228
+ return initialValue;
229
+ }
230
+ const item = window.localStorage.getItem(key);
231
+ if (item) {
232
+ lastStoredValue.current = item;
233
+ }
234
+ return item ? JSON.parse(item) : initialValue;
235
+ } catch (error) {
236
+ console.log(error);
237
+ return initialValue;
238
+ }
239
+ });
240
+ const setValue = (value) => {
241
+ try {
242
+ if (typeof window !== "undefined" && typeof window.localStorage !== "undefined") {
243
+ let prev2 = initialValue;
244
+ try {
245
+ prev2 = typeof lastStoredValue.current === "undefined" ? initialValue : JSON.parse(lastStoredValue.current);
246
+ } catch (e) {
247
+ }
248
+ const valueToStore = value instanceof Function ? value(prev2) : value;
249
+ setStoredValue(valueToStore);
250
+ const valueJson = JSON.stringify(valueToStore);
251
+ window.localStorage.setItem(key, valueJson);
252
+ if (valueJson !== lastStoredValue.current) {
253
+ lastStoredValue.current = valueJson;
254
+ lsEmitter.emit(`change:${key}`, { valueJson });
255
+ }
256
+ }
257
+ } catch (error) {
258
+ console.log(error);
259
+ }
260
+ };
261
+ useEffect(() => {
262
+ const listener = ({ valueJson }) => {
263
+ if (valueJson && valueJson !== lastStoredValue.current) {
264
+ try {
265
+ setStoredValue(JSON.parse(valueJson));
266
+ lastStoredValue.current = valueJson;
267
+ } catch (e) {
268
+ }
269
+ }
270
+ };
271
+ lsEmitter.on(`change:${key}`, listener);
272
+ return () => {
273
+ lsEmitter.off(`change:${key}`, listener);
274
+ };
275
+ }, [key]);
276
+ return [storedValue, setValue, lastStoredValue];
277
+ }
278
+
279
+ // src/canvas-editors/image-block-editor.tsx
280
+ import {
281
+ CanvasContext,
282
+ LocaleString,
283
+ useCanvas as useCanvas3
284
+ } from "react-iiif-vault";
285
+ import { twMerge } from "tailwind-merge";
286
+
287
+ // src/helpers.ts
288
+ var heightMap = {
289
+ "h-1": "lg:min-h-[100px] row-span-1",
290
+ "h-2": "lg:min-h-[200px] row-span-2",
291
+ "h-3": "lg:min-h-[300px] row-span-3",
292
+ "h-4": "lg:min-h-[400px] row-span-4",
293
+ "h-5": "lg:min-h-[500px] row-span-5",
294
+ "h-6": "lg:min-h-[600px] row-span-6",
295
+ "h-7": "lg:min-h-[700px] row-span-7",
296
+ "h-8": "lg:min-h-[800px] row-span-8",
297
+ "h-9": "lg:min-h-[900px] row-span-9",
298
+ "h-10": "lg:min-h-[1000px] row-span-10",
299
+ "h-11": "lg:min-h-[1100px] row-span-11",
300
+ "h-12": "lg:min-h-[1200px] row-span-12"
301
+ };
302
+ var previewHeightMap = {
303
+ "h-1": "lg:min-h-[25px] row-span-1",
304
+ "h-2": "lg:min-h-[50px] row-span-2",
305
+ "h-3": "lg:min-h-[75px] row-span-3",
306
+ "h-4": "lg:min-h-[100px] row-span-4",
307
+ "h-5": "lg:min-h-[125px] row-span-5",
308
+ "h-6": "lg:min-h-[150px] row-span-6",
309
+ "h-7": "lg:min-h-[175px] row-span-7",
310
+ "h-8": "lg:min-h-[200px] row-span-8",
311
+ "h-9": "lg:min-h-[225px] row-span-9",
312
+ "h-10": "lg:min-h-[250px] row-span-10",
313
+ "h-11": "lg:min-h-[275px] row-span-11",
314
+ "h-12": "lg:min-h-[300px] row-span-12"
315
+ };
316
+ var widthMap = {
317
+ "w-1": "col-span-1",
318
+ "w-2": "col-span-2",
319
+ "w-3": "col-span-3",
320
+ "w-4": "col-span-4",
321
+ "w-5": "col-span-5",
322
+ "w-6": "col-span-6",
323
+ "w-7": "col-span-7",
324
+ "w-8": "col-span-8",
325
+ "w-9": "col-span-9",
326
+ "w-10": "col-span-10",
327
+ "w-11": "col-span-11",
328
+ "w-12": "col-span-12"
329
+ };
330
+ function getHeightWidthRatio(behavior) {
331
+ const { isLeft, isRight, isBottom } = getGridStats(behavior);
332
+ const h = behavior?.find((a2) => a2.includes("h-"));
333
+ const w2 = behavior?.find((a2) => a2.includes("w-"));
334
+ if (!h || !w2) {
335
+ return { h: 0, w: 0, ratio: 1 };
336
+ }
337
+ const ret = {
338
+ h: Number.parseInt(h.split("-")[1]),
339
+ w: Number.parseInt(w2.split("-")[1]),
340
+ ratio: 1
341
+ };
342
+ if (isLeft || isRight) {
343
+ ret.w *= 2 / 3;
344
+ }
345
+ if (isBottom) {
346
+ ret.h *= 2 / 3;
347
+ }
348
+ if (ret.h && ret.w) {
349
+ ret.ratio = ret.w / ret.h;
350
+ }
351
+ return ret;
352
+ }
353
+ function getClassName(b, firstInfo = false, preview = true) {
354
+ if (!b || b.length === 0) {
355
+ b = ["h-8", "w-8", "image"];
356
+ }
357
+ let h = b.find((a2) => a2.includes("h-"));
358
+ const w2 = b.find((a2) => a2.includes("w-"));
359
+ const classNames = [];
360
+ if (firstInfo && h === "h-4") {
361
+ h = "h-8";
362
+ }
363
+ classNames.push(preview ? previewHeightMap[h] : heightMap[h]);
364
+ classNames.push(widthMap[w2]);
365
+ return classNames.join(" ");
366
+ }
367
+ function getGridStats(behavior) {
368
+ const isRight = behavior?.includes("right");
369
+ const isLeft = behavior?.includes("left");
370
+ const isBottom = behavior?.includes("bottom");
371
+ const isTop = behavior?.includes("top");
372
+ const isInfo = behavior?.includes("info");
373
+ const isImage = behavior?.includes("image") || !isLeft && !isRight && !isBottom && !isTop;
374
+ return {
375
+ isRight,
376
+ isLeft,
377
+ isBottom,
378
+ isTop,
379
+ isInfo,
380
+ isImage
381
+ };
382
+ }
383
+ function isExhibitionItem(canvas) {
384
+ if (!canvas)
385
+ return false;
386
+ const behaviors = canvas.behavior || [];
387
+ if (behaviors.includes("image") || behaviors.includes("info")) {
388
+ return true;
389
+ }
390
+ for (const behavior of behaviors) {
391
+ if (behavior.startsWith("w-") || behavior.startsWith("h-")) {
392
+ return true;
393
+ }
394
+ }
395
+ return false;
396
+ }
397
+
398
+ // src/canvas-editors/image-block-editor.tsx
399
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
400
+ var imageBlockEditor = {
401
+ id: "image-block-editor",
402
+ label: "Image Block Editor",
403
+ component: (strategy) => /* @__PURE__ */ jsx4(ImageBlockEditor, { strategy }),
404
+ supports: {
405
+ strategy: (strategy, resource, vault) => {
406
+ if (strategy.type !== "images") {
407
+ return false;
408
+ }
409
+ const fullResource = vault.get(resource.resource);
410
+ if (fullResource.type !== "Canvas") {
411
+ return false;
412
+ }
413
+ const behaviors = fullResource.behavior || [];
414
+ let isImage = false;
415
+ for (const behaviour of behaviors) {
416
+ if (behaviour.startsWith("w-") || behaviour.startsWith("h-") || behaviour === "image") {
417
+ isImage = true;
418
+ }
419
+ }
420
+ return isImage;
421
+ }
422
+ }
423
+ };
424
+ function ImageBlockEditor({
425
+ strategy
426
+ }) {
427
+ const [isPreview, setIsPreview] = useLocalStorage("exhibition-preview-mode");
428
+ const canvas = useInStack("Canvas");
429
+ if (!canvas) {
430
+ return null;
431
+ }
432
+ return /* @__PURE__ */ jsxs(CanvasContext, { canvas: canvas.resource.source?.id, children: [
433
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center", children: [
434
+ "Switch view",
435
+ /* @__PURE__ */ jsx4(ActionButton, { onPress: () => setIsPreview(!isPreview), children: isPreview ? "Full canvas" : "Layout preview" })
436
+ ] }),
437
+ isPreview ? /* @__PURE__ */ jsx4("div", { className: "grid grid-cols-12 grid-rows-12 h-full bg-white", children: /* @__PURE__ */ jsx4(ImageBlockRenderer, {}) }) : /* @__PURE__ */ jsx4("div", { className: "h-full flex flex-1 min-h-0", children: /* @__PURE__ */ jsx4(CanvasPanelEditor, { asFallback: true }) })
438
+ ] });
439
+ }
440
+ function ImageBlockRenderer() {
441
+ const canvas = useCanvas3();
442
+ const behavior = canvas?.behavior || [];
443
+ const className = getClassName(behavior);
444
+ const { isBottom, isImage, isInfo, isLeft } = getGridStats(canvas?.behavior);
445
+ return /* @__PURE__ */ jsxs(
446
+ "div",
447
+ {
448
+ className: twMerge(
449
+ className,
450
+ "flex h-full max-h-full min-h-0",
451
+ isLeft ? "flex-row-reverse" : isBottom ? "flex-col" : "flex-row"
452
+ ),
453
+ children: [
454
+ /* @__PURE__ */ jsx4("div", { className: "flex-1 h-full flex min-w-0", children: /* @__PURE__ */ jsx4(CanvasPanelEditor, { asFallback: true }) }),
455
+ !isImage ? /* @__PURE__ */ jsxs(
456
+ "div",
457
+ {
458
+ className: `${isBottom ? "min-h-3 w-full" : "w-1/3"} flex-shrink-0 self-stretch text-white bg-black rounded p-8`,
459
+ children: [
460
+ /* @__PURE__ */ jsx4(LocaleString, { className: "block mb-4", children: canvas?.label }),
461
+ /* @__PURE__ */ jsx4(LocaleString, { children: canvas?.summary })
462
+ ]
463
+ }
464
+ ) : null
465
+ ]
466
+ }
467
+ );
468
+ }
469
+
470
+ // src/canvas-editors/info-block-editor.tsx
471
+ import { ActionButton as ActionButton3 } from "@manifest-editor/components";
472
+ import {
473
+ useGenericEditor as useGenericEditor3,
474
+ useInlineCreator
475
+ } from "@manifest-editor/shell";
476
+ import {
477
+ AnnotationContext as AnnotationContext2,
478
+ useAnnotation as useAnnotation2,
479
+ useCanvas as useCanvas4,
480
+ useVaultSelector
481
+ } from "react-iiif-vault";
482
+
483
+ // src/components/AnnotationBodyEditor.tsx
484
+ import { ActionButton as ActionButton2, HTMLEditor } from "@manifest-editor/components";
485
+ import { Input, Label } from "@manifest-editor/editors";
486
+ import { useGenericEditor as useGenericEditor2 } from "@manifest-editor/shell";
487
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
488
+ function AnnotationBodyEditor({
489
+ className,
490
+ resourceId,
491
+ onRemove
492
+ }) {
493
+ const editor = useGenericEditor2({
494
+ id: resourceId,
495
+ type: "ContentResource"
496
+ });
497
+ const { language, value } = editor.descriptive;
498
+ return /* @__PURE__ */ jsxs2("div", { className, children: [
499
+ /* @__PURE__ */ jsxs2("div", { className: "flex gap-4 mb-4 items-center", children: [
500
+ /* @__PURE__ */ jsx5(Label, { children: "Language" }),
501
+ /* @__PURE__ */ jsx5("div", { className: "w-32", children: /* @__PURE__ */ jsx5(
502
+ Input,
503
+ {
504
+ value: language.get() || "",
505
+ onChange: (newValue) => language.set(newValue.target.value)
506
+ }
507
+ ) }),
508
+ /* @__PURE__ */ jsx5(
509
+ ActionButton2,
510
+ {
511
+ onPress: () => {
512
+ if (confirm("Do you want to remove this body?")) {
513
+ onRemove();
514
+ }
515
+ },
516
+ children: "Remove"
517
+ }
518
+ )
519
+ ] }),
520
+ /* @__PURE__ */ jsx5("div", { className: "prose-xl", children: /* @__PURE__ */ jsx5(
521
+ HTMLEditor,
522
+ {
523
+ value: value.get() || "",
524
+ onChange: (newValue) => value.set(newValue)
525
+ }
526
+ ) })
527
+ ] });
528
+ }
529
+
530
+ // src/canvas-editors/info-block-editor.tsx
531
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
532
+ var infoBlockEditor = {
533
+ id: "info-block-editor",
534
+ label: "info Block Editor",
535
+ component: (strategy) => /* @__PURE__ */ jsx6(InfoBlockEditor, { strategy }),
536
+ supports: {
537
+ strategy: (strategy, resource, vault) => {
538
+ if (strategy.type !== "textual-content") {
539
+ return false;
540
+ }
541
+ return true;
542
+ }
543
+ }
544
+ };
545
+ function InfoBlockEditor(props) {
546
+ const canvas = useCanvas4();
547
+ const annotationPage = useVaultSelector(
548
+ (_2, vault) => (
549
+ // biome-ignore lint/style/noNonNullAssertion: Should always be present.
550
+ vault.get(canvas?.items[0])
551
+ )
552
+ );
553
+ const longSummaries = useVaultSelector(
554
+ (_2, vault) => canvas?.annotations[0] ? vault.get(canvas?.annotations[0]) : null
555
+ );
556
+ return /* @__PURE__ */ jsxs3("div", { className: "overflow-y-auto bg-white shadow", children: [
557
+ /* @__PURE__ */ jsx6("div", { className: "mb-12", children: annotationPage.items.map((annotation, key) => {
558
+ return /* @__PURE__ */ jsx6(
559
+ AnnotationContext2,
560
+ {
561
+ annotation: annotation.id,
562
+ children: /* @__PURE__ */ jsx6(AnnotationEditor, {})
563
+ },
564
+ annotation.id + key
565
+ );
566
+ }) }),
567
+ longSummaries ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
568
+ /* @__PURE__ */ jsx6("h2", { className: "text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4", children: "Long Summaries" }),
569
+ /* @__PURE__ */ jsx6("p", { className: "my-4 px-4", children: 'Long summaries are used to provide more detailed information about the canvas. They appear when the user clicks "read more" in the exhibition.' }),
570
+ longSummaries.items.map((annotation, key) => {
571
+ return /* @__PURE__ */ jsx6(
572
+ AnnotationContext2,
573
+ {
574
+ annotation: annotation.id,
575
+ children: /* @__PURE__ */ jsx6(AnnotationEditor, {})
576
+ },
577
+ annotation.id + key
578
+ );
579
+ })
580
+ ] }) : null
581
+ ] });
582
+ }
583
+ function AnnotationEditor() {
584
+ const annotation = useAnnotation2();
585
+ const creator = useInlineCreator();
586
+ const bodies = annotation?.body || [];
587
+ const editor = useGenericEditor3(annotation);
588
+ if (!annotation) {
589
+ return null;
590
+ }
591
+ return /* @__PURE__ */ jsxs3("div", { children: [
592
+ bodies.map((body, n) => {
593
+ return /* @__PURE__ */ jsx6(
594
+ AnnotationBodyEditor,
595
+ {
596
+ className: "p-4 hover:bg-me-100/40 focus-within:bg-me-100/40",
597
+ resourceId: body.id,
598
+ onRemove: () => editor.annotation.body.deleteAtIndex(n)
599
+ },
600
+ n
601
+ );
602
+ }),
603
+ /* @__PURE__ */ jsx6("div", { className: "p-4", children: /* @__PURE__ */ jsx6(
604
+ ActionButton3,
605
+ {
606
+ primary: true,
607
+ onPress: () => {
608
+ creator.create(
609
+ "@manifest-editor/html-body-creator",
610
+ { language: "en", value: "" },
611
+ {
612
+ targetType: "ContentResource",
613
+ parent: {
614
+ property: "body",
615
+ resource: {
616
+ id: annotation.id,
617
+ type: "Annotation"
618
+ }
619
+ },
620
+ initialData: {}
621
+ }
622
+ );
623
+ },
624
+ children: "Add new annotation"
625
+ }
626
+ ) })
627
+ ] });
628
+ }
629
+
630
+ // src/canvas-editors/youtube-editor.tsx
631
+ import { ActionButton as ActionButton4, LazyThumbnail } from "@manifest-editor/components";
632
+ import {
633
+ useGenericEditor as useGenericEditor4,
634
+ useLayoutActions
635
+ } from "@manifest-editor/shell";
636
+ import { useRef as useRef2 } from "react";
637
+ import {
638
+ LocaleString as LocaleString2,
639
+ useCanvas as useCanvas5,
640
+ useVaultSelector as useVaultSelector2
641
+ } from "react-iiif-vault";
642
+ import invariant from "tiny-invariant";
643
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
644
+ var youtubeMainEdtior = {
645
+ id: "youtube-main-editor",
646
+ label: "YouTube main editor",
647
+ component: (strategy) => strategy.type === "media" ? /* @__PURE__ */ jsx7(
648
+ YouTubeEditor,
649
+ {
650
+ strategy,
651
+ video: strategy.media
652
+ }
653
+ ) : null,
654
+ supports: {
655
+ strategy: (strategy, resource, vault) => {
656
+ console.log(strategy);
657
+ if (strategy.type !== "media") {
658
+ return false;
659
+ }
660
+ if (strategy.media.type !== "VideoYouTube") {
661
+ return false;
662
+ }
663
+ return true;
664
+ }
665
+ }
666
+ };
667
+ function YouTubeEditor({
668
+ strategy,
669
+ video
670
+ }) {
671
+ const { edit } = useLayoutActions();
672
+ const canvas = useCanvas5();
673
+ const annotationRef = useVaultSelector2((_2, v2) => {
674
+ const page = v2.get(canvas?.items[0]);
675
+ return page.items[0];
676
+ });
677
+ invariant(canvas && annotationRef);
678
+ const player = useRef2(null);
679
+ const annotation = useGenericEditor4(annotationRef);
680
+ const media = video;
681
+ const ar = (canvas.width || 1) / (canvas.height || 1);
682
+ const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/0.jpg`;
683
+ return /* @__PURE__ */ jsxs4("div", { className: "overflow-y-auto", children: [
684
+ /* @__PURE__ */ jsx7("div", { className: "p-8", children: /* @__PURE__ */ jsx7(
685
+ "div",
686
+ {
687
+ className: "bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto",
688
+ style: { aspectRatio: ar },
689
+ children: /* @__PURE__ */ jsx7(
690
+ "iframe",
691
+ {
692
+ title: "YouTube video",
693
+ className: "border-none w-full h-full object-contain",
694
+ ref: player,
695
+ src: `https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
696
+ referrerPolicy: "no-referrer",
697
+ sandbox: "allow-scripts allow-same-origin allow-presentation"
698
+ }
699
+ )
700
+ }
701
+ ) }),
702
+ /* @__PURE__ */ jsxs4("div", { className: "bg-white shadow w-full p-8 flex gap-8", children: [
703
+ /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(
704
+ "div",
705
+ {
706
+ className: "w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip",
707
+ style: { aspectRatio: ar },
708
+ children: canvas.thumbnail?.length ? /* @__PURE__ */ jsx7(LazyThumbnail, { cover: true }) : /* @__PURE__ */ jsx7("div", { className: "text-white/50 text-center py-16", children: "No thumbnail" })
709
+ }
710
+ ) }),
711
+ /* @__PURE__ */ jsxs4("div", { className: "flex-1", children: [
712
+ /* @__PURE__ */ jsx7(
713
+ LocaleString2,
714
+ {
715
+ as: "h3",
716
+ className: "text-2xl font-bold mt-4",
717
+ defaultText: /* @__PURE__ */ jsx7("span", { className: "text-black/30", children: "No Label" }),
718
+ children: annotation.descriptive.label.get()
719
+ }
720
+ ),
721
+ /* @__PURE__ */ jsx7(
722
+ LocaleString2,
723
+ {
724
+ as: "p",
725
+ className: "mt-2 mb-8",
726
+ defaultText: /* @__PURE__ */ jsx7("span", { className: "text-black/30", children: "No summary" }),
727
+ children: annotation.descriptive.summary.get()
728
+ }
729
+ ),
730
+ /* @__PURE__ */ jsx7(ActionButton4, { onPress: () => edit(annotation.ref()), children: "Edit properties" })
731
+ ] })
732
+ ] })
733
+ ] });
734
+ }
735
+
736
+ // src/creators/image-slide-creator.tsx
737
+ import { emptyAnnotationPage, emptyCanvas } from "@iiif/parser";
738
+ import { jsx as jsx8 } from "react/jsx-runtime";
739
+ var imageSlideCreator = {
740
+ id: "@exhibitions/image-slide-creator",
741
+ create: createImageSlide,
742
+ label: "Image",
743
+ summary: "An image with text.",
744
+ icon: /* @__PURE__ */ jsx8("div", { children: "IMAGE" }),
745
+ tags: ["exhibition-slide"],
746
+ resourceType: "Canvas",
747
+ resourceFields: ["id", "type", "label", "height", "width", "items"],
748
+ supports: {
749
+ parentTypes: ["Manifest"],
750
+ parentFields: ["items"]
751
+ }
752
+ };
753
+ var imageSlideLeftCreator = {
754
+ ...imageSlideCreator,
755
+ id: "@exhibitions/image-slide-creator-left",
756
+ label: "Image (Left)",
757
+ summary: "An image with text on the left.",
758
+ icon: /* @__PURE__ */ jsx8("div", { children: "IMAGE (LEFT)" }),
759
+ create: (payload, ctx) => createImageSlide({ ...payload, type: "left" }, ctx)
760
+ };
761
+ var imageSlideRightCreator = {
762
+ ...imageSlideCreator,
763
+ id: "@exhibitions/image-slide-creator-right",
764
+ label: "Image (Right)",
765
+ summary: "An image with text on the right.",
766
+ icon: /* @__PURE__ */ jsx8("div", { children: "IMAGE (RIGHT)" }),
767
+ create: (payload, ctx) => createImageSlide({ ...payload, type: "right" }, ctx)
768
+ };
769
+ var imageSlideBottomCreator = {
770
+ ...imageSlideCreator,
771
+ id: "@exhibitions/image-slide-creator-bottom",
772
+ label: "Image (Bottom)",
773
+ summary: "An image with text at the bottom.",
774
+ icon: /* @__PURE__ */ jsx8("div", { children: "IMAGE (BOTTOM)" }),
775
+ create: (payload, ctx) => createImageSlide({ ...payload, type: "bottom" }, ctx)
776
+ };
777
+ function createImageSlide(payload, ctx) {
778
+ const canvasId = ctx.generateId("Canvas");
779
+ const itemsPageId = ctx.generateId("AnnotationPage", {
780
+ id: canvasId,
781
+ type: "Canvas"
782
+ });
783
+ const annotationsPageId = ctx.generateId("AnnotationPage", {
784
+ id: canvasId,
785
+ type: "Canvas"
786
+ });
787
+ const behavior = ["w-12", "h-4"];
788
+ let width = 6e3;
789
+ switch (payload.type) {
790
+ case "left":
791
+ behavior.push("left");
792
+ width *= 2 / 3;
793
+ break;
794
+ case "right":
795
+ behavior.push("right");
796
+ width *= 2 / 3;
797
+ break;
798
+ case "bottom":
799
+ behavior.push("bottom");
800
+ break;
801
+ }
802
+ return ctx.embed({
803
+ ...emptyCanvas,
804
+ id: canvasId,
805
+ behavior,
806
+ label: payload.label || { en: ["Untitled"] },
807
+ height: payload.height || 2e3,
808
+ width: payload.width || width,
809
+ items: [
810
+ ctx.embed({
811
+ ...emptyAnnotationPage,
812
+ id: itemsPageId,
813
+ type: "AnnotationPage",
814
+ items: []
815
+ })
816
+ ],
817
+ annotations: [
818
+ ctx.embed({
819
+ ...emptyAnnotationPage,
820
+ id: annotationsPageId,
821
+ type: "AnnotationPage",
822
+ items: []
823
+ })
824
+ ]
825
+ });
826
+ }
827
+
828
+ // src/creators/info-box-creator.tsx
829
+ import { emptyAnnotation, emptyCanvas as emptyCanvas2 } from "@iiif/parser";
830
+ import { jsx as jsx9 } from "react/jsx-runtime";
831
+ var infoBoxCreator = {
832
+ id: "@exhibitions/info-box-creator",
833
+ create: createInfoBox,
834
+ label: "Info box",
835
+ summary: "A text panel for an exhibition",
836
+ icon: /* @__PURE__ */ jsx9(
837
+ "svg",
838
+ {
839
+ xmlns: "http://www.w3.org/2000/svg",
840
+ width: "1em",
841
+ height: "1em",
842
+ viewBox: "0 0 24 24",
843
+ children: /* @__PURE__ */ jsx9(
844
+ "path",
845
+ {
846
+ fill: "currentColor",
847
+ d: "M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"
848
+ }
849
+ )
850
+ }
851
+ ),
852
+ tags: ["exhibition-slide"],
853
+ resourceType: "Canvas",
854
+ resourceFields: ["id", "type", "label", "height", "width", "items"],
855
+ supports: {
856
+ parentTypes: ["Manifest"],
857
+ parentFields: ["items"]
858
+ }
859
+ };
860
+ async function createInfoBox(data, ctx) {
861
+ const canvasId = ctx.generateId("canvas");
862
+ const pageId = ctx.generateId("annotation-page", {
863
+ id: canvasId,
864
+ type: "Canvas"
865
+ });
866
+ const annotationsId = ctx.generateId("annotation-page", {
867
+ id: canvasId,
868
+ type: "Canvas"
869
+ });
870
+ const annotation = {
871
+ ...emptyAnnotation,
872
+ id: ctx.generateId("annotation", { id: canvasId, type: "Canvas" }),
873
+ type: "Annotation"
874
+ };
875
+ const bodies = [
876
+ await ctx.create(
877
+ "@manifest-editor/html-body-creator",
878
+ {
879
+ language: "en",
880
+ body: ""
881
+ },
882
+ { parent: { resource: annotation, property: "body" } }
883
+ )
884
+ ];
885
+ const annotationResource = ctx.embed({
886
+ ...annotation,
887
+ motivation: "painting",
888
+ body: bodies,
889
+ target: {
890
+ type: "SpecificResource",
891
+ source: { id: canvasId, type: "Canvas" }
892
+ }
893
+ });
894
+ const annotationLongId = ctx.generateId("annotation", {
895
+ id: canvasId,
896
+ type: "Canvas"
897
+ });
898
+ const longDescriptionResource = ctx.embed({
899
+ id: annotationLongId,
900
+ type: "Annotation",
901
+ motivation: "describing",
902
+ body: [
903
+ await ctx.create(
904
+ "@manifest-editor/html-body-creator",
905
+ {
906
+ language: "en",
907
+ body: ""
908
+ },
909
+ {
910
+ parent: {
911
+ resource: { id: annotationLongId, type: "Annotation" },
912
+ property: "body"
913
+ }
914
+ }
915
+ )
916
+ ],
917
+ target: {
918
+ type: "SpecificResource",
919
+ source: { id: canvasId, type: "Canvas" }
920
+ }
921
+ });
922
+ const page = ctx.embed({
923
+ id: pageId,
924
+ type: "AnnotationPage",
925
+ items: [annotationResource]
926
+ });
927
+ const annotations = ctx.embed({
928
+ id: annotationsId,
929
+ type: "AnnotationPage",
930
+ items: [longDescriptionResource]
931
+ });
932
+ return ctx.embed({
933
+ ...emptyCanvas2,
934
+ // bug with placeholder canvas.
935
+ id: canvasId,
936
+ type: "Canvas",
937
+ behavior: ["w-4", "h-4", "info"],
938
+ label: data.label || { en: ["Untitled info box"] },
939
+ height: data.height || 1e3,
940
+ width: data.width || 1e3,
941
+ items: [page],
942
+ annotations: [annotations]
943
+ });
944
+ }
945
+
946
+ // src/creators/youtube-slide-creator.tsx
947
+ import { emptyCanvas as emptyCanvas3 } from "@iiif/parser";
948
+ import { youTubeBodyCreator } from "@manifest-editor/creators";
949
+ import { getYouTubeId } from "@manifest-editor/editors";
950
+ var youtubeSlideCreator = {
951
+ ...youTubeBodyCreator,
952
+ id: "@exhibitions/youtube-creator",
953
+ create: createYoutube,
954
+ tags: ["video", "exhibition-slide"],
955
+ label: "YouTube",
956
+ summary: "A YouTube for an exhibition"
957
+ };
958
+ async function createYoutube(data, ctx) {
959
+ const ytId = getYouTubeId(data.youtubeUrl);
960
+ const canvasId = ctx.generateId("canvas");
961
+ const pageId = ctx.generateId("annotation-page", {
962
+ id: canvasId,
963
+ type: "Canvas"
964
+ });
965
+ const annotation = await ctx.create("@manifest-editor/youtube", data, {
966
+ target: {
967
+ id: canvasId,
968
+ type: "Canvas"
969
+ },
970
+ targetType: "Annotation",
971
+ parent: {
972
+ resource: { id: pageId, type: "AnnotationPage" },
973
+ property: "items"
974
+ }
975
+ });
976
+ const page = ctx.embed({
977
+ id: pageId,
978
+ type: "AnnotationPage",
979
+ items: [annotation]
980
+ });
981
+ const thumbnail = ctx.embed({
982
+ id: `https://img.youtube.com/vi/${ytId}/0.jpg`,
983
+ type: "Image",
984
+ format: "image/jpeg",
985
+ width: 480,
986
+ height: 360
987
+ });
988
+ return ctx.embed({
989
+ ...emptyCanvas3,
990
+ // bug with placeholder canvas.
991
+ id: canvasId,
992
+ type: "Canvas",
993
+ behavior: ["w-12", "h-8"],
994
+ label: data.label || { en: ["Untitled YouTube Video"] },
995
+ height: data.height || 1080,
996
+ width: data.width || 1920,
997
+ thumbnail: [thumbnail],
998
+ items: [page]
999
+ });
1000
+ }
1001
+
1002
+ // src/left-panels/ExhibitionGrid.tsx
1003
+ import { Sidebar, SidebarContent, SidebarHeader } from "@manifest-editor/components";
1004
+ import { useToggleList as useToggleList2 } from "@manifest-editor/editors";
1005
+ import { CanvasListView, CanvasListingIcon } from "@manifest-editor/manifest-preset/components";
1006
+ import { useCreator as useCreator3, useManifestEditor as useManifestEditor3 } from "@manifest-editor/shell";
1007
+
1008
+ // src/components/ExhibitionGrid.tsx
1009
+ import {
1010
+ useCreator,
1011
+ useLayoutActions as useLayoutActions3,
1012
+ useManifestEditor
1013
+ } from "@manifest-editor/shell";
1014
+ import { CanvasContext as CanvasContext2 } from "react-iiif-vault";
1015
+
1016
+ // src/components/ExhibitionContainer.tsx
1017
+ import { useLayoutActions as useLayoutActions2 } from "@manifest-editor/shell";
1018
+ import { Button } from "react-aria-components";
1019
+ import { LocaleString as LocaleString3, useManifest } from "react-iiif-vault";
1020
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1021
+ function ExhibitionContainer({
1022
+ children
1023
+ }) {
1024
+ const manifest = useManifest();
1025
+ const { edit } = useLayoutActions2();
1026
+ return /* @__PURE__ */ jsxs5("div", { className: "grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2", children: [
1027
+ /* @__PURE__ */ jsx10("div", { className: "col-span-4 row-span-4 text-black min-h-[100px] flex items-center justify-center", children: /* @__PURE__ */ jsx10(
1028
+ Button,
1029
+ {
1030
+ onPress: () => manifest && edit(manifest),
1031
+ className: "col-span-4 row-span-4 text-xs text-black bg-[rgb(250,204,21)] min-h-[100px] w-full flex items-center justify-center",
1032
+ children: /* @__PURE__ */ jsx10(LocaleString3, { children: manifest?.label })
1033
+ }
1034
+ ) }),
1035
+ children
1036
+ ] });
1037
+ }
1038
+
1039
+ // src/components/ExhibitionItem.tsx
1040
+ import { LazyThumbnail as LazyThumbnail2 } from "@manifest-editor/components";
1041
+ import { useInStack as useInStack2 } from "@manifest-editor/editors";
1042
+ import { forwardRef } from "react";
1043
+ import {
1044
+ LocaleString as LocaleString4,
1045
+ useCanvas as useCanvas6,
1046
+ useRenderingStrategy
1047
+ } from "react-iiif-vault";
1048
+ import { twMerge as twMerge2 } from "tailwind-merge";
1049
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1050
+ var ExhibitionItem = forwardRef(
1051
+ function ExhibitionItem2({ isFirst, item, children: divChildren, ...props }, ref) {
1052
+ const canvas = useCanvas6();
1053
+ const [strategy] = useRenderingStrategy();
1054
+ const behavior = canvas?.behavior || [];
1055
+ const currentCanvas = useInStack2("Canvas");
1056
+ const className = getClassName(canvas?.behavior, isFirst);
1057
+ const { isBottom, isImage, isInfo, isLeft } = getGridStats(
1058
+ canvas?.behavior
1059
+ );
1060
+ const isSelected = currentCanvas?.resource.source?.id === canvas?.id;
1061
+ let children = null;
1062
+ if (isInfo) {
1063
+ children = /* @__PURE__ */ jsx11("div", { className: "bg-black w-full h-full text-white max-h-40", children: /* @__PURE__ */ jsx11("div", { className: "p-1.5 text-[4px]", children: strategy.type === "textual-content" ? /* @__PURE__ */ jsx11(LocaleString4, { enableDangerouslySetInnerHTML: true, children: strategy.items[0]?.text }) : null }) });
1064
+ } else {
1065
+ children = /* @__PURE__ */ jsxs6(
1066
+ "div",
1067
+ {
1068
+ className: twMerge2(
1069
+ "flex h-full max-h-full min-h-0",
1070
+ isLeft ? "flex-row-reverse" : isBottom ? "flex-col" : "flex-row"
1071
+ ),
1072
+ children: [
1073
+ /* @__PURE__ */ jsx11("div", { className: "flex-1 overflow-hidden relative justify-self-stretch", children: /* @__PURE__ */ jsx11("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ jsx11(LazyThumbnail2, { cover: true, fade: false }) }) }),
1074
+ isImage ? null : /* @__PURE__ */ jsx11(
1075
+ "div",
1076
+ {
1077
+ className: `${isBottom ? "min-h-3 w-full" : "w-1/3"} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`,
1078
+ children: /* @__PURE__ */ jsxs6("div", { className: "p-1.5 text-[4px]", children: [
1079
+ /* @__PURE__ */ jsx11(LocaleString4, { className: "block mb-1 text-[5px]", children: canvas?.label }),
1080
+ /* @__PURE__ */ jsx11(LocaleString4, { children: canvas?.summary })
1081
+ ] })
1082
+ }
1083
+ )
1084
+ ]
1085
+ }
1086
+ );
1087
+ }
1088
+ return /* @__PURE__ */ jsxs6(
1089
+ "div",
1090
+ {
1091
+ ref,
1092
+ className: twMerge2(
1093
+ className,
1094
+ "bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative",
1095
+ isSelected ? "ring-2 ring-me-primary-500" : ""
1096
+ ),
1097
+ ...props,
1098
+ children: [
1099
+ children,
1100
+ divChildren
1101
+ ]
1102
+ }
1103
+ );
1104
+ }
1105
+ );
1106
+
1107
+ // src/components/ExhibitionGrid.tsx
1108
+ import { jsx as jsx12 } from "react/jsx-runtime";
1109
+ function ExhibitionGrid() {
1110
+ const { open } = useLayoutActions3();
1111
+ const { structural, technical } = useManifestEditor();
1112
+ const [, canvasActions] = useCreator(
1113
+ { id: technical.id.get(), type: "Manifest" },
1114
+ "items",
1115
+ "Manifest"
1116
+ );
1117
+ const items = structural.items.get();
1118
+ return /* @__PURE__ */ jsx12(ExhibitionContainer, { children: items.map((item, index) => /* @__PURE__ */ jsx12(CanvasContext2, { canvas: item.id, children: /* @__PURE__ */ jsx12(
1119
+ ExhibitionItem,
1120
+ {
1121
+ isFirst: index === 0,
1122
+ item,
1123
+ onClick: () => {
1124
+ open({ id: "current-canvas" });
1125
+ canvasActions.edit(item, index);
1126
+ }
1127
+ }
1128
+ ) }, index)) });
1129
+ }
1130
+
1131
+ // src/components/SortableExhibitionGrid.tsx
1132
+ import {
1133
+ DndContext,
1134
+ KeyboardSensor,
1135
+ PointerSensor,
1136
+ closestCenter,
1137
+ useSensor,
1138
+ useSensors
1139
+ } from "@dnd-kit/core";
1140
+ import { restrictToParentElement } from "@dnd-kit/modifiers";
1141
+ import {
1142
+ SortableContext,
1143
+ rectSortingStrategy,
1144
+ sortableKeyboardCoordinates
1145
+ } from "@dnd-kit/sortable";
1146
+ import {
1147
+ useCreator as useCreator2,
1148
+ useLayoutActions as useLayoutActions4,
1149
+ useManifestEditor as useManifestEditor2
1150
+ } from "@manifest-editor/shell";
1151
+ import { useCallback } from "react";
1152
+ import { CanvasContext as CanvasContext3 } from "react-iiif-vault";
1153
+
1154
+ // src/components/SortableExhibitionItem.tsx
1155
+ import { useSortable } from "@dnd-kit/sortable";
1156
+ import { CSS } from "@dnd-kit/utilities";
1157
+
1158
+ // src/icons/ResizeHandleIcon.tsx
1159
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1160
+ function ResizeHandleIcon(props) {
1161
+ return /* @__PURE__ */ jsxs7(
1162
+ "svg",
1163
+ {
1164
+ xmlns: "http://www.w3.org/2000/svg",
1165
+ viewBox: "0 0 24 24",
1166
+ height: "1em",
1167
+ width: "1em",
1168
+ ...props,
1169
+ children: [
1170
+ /* @__PURE__ */ jsx13("title", { children: "Rearrange" }),
1171
+ /* @__PURE__ */ jsx13("path", { fill: "none", d: "M0 0h24v24H0z" }),
1172
+ /* @__PURE__ */ jsx13("path", { d: "M20 9H4v2h16V9zM4 15h16v-2H4v2z" })
1173
+ ]
1174
+ }
1175
+ );
1176
+ }
1177
+
1178
+ // src/components/SortableExhibitionItem.tsx
1179
+ import { jsx as jsx14 } from "react/jsx-runtime";
1180
+ function SortableExhibitionItem({
1181
+ isFirst,
1182
+ onClick,
1183
+ item
1184
+ }) {
1185
+ const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
1186
+ id: item.id,
1187
+ transition: {
1188
+ duration: 150,
1189
+ easing: "cubic-bezier(0.25, 1, 0.5, 1)"
1190
+ }
1191
+ });
1192
+ const style = {
1193
+ transform: CSS.Translate.toString(transform),
1194
+ transition
1195
+ };
1196
+ return /* @__PURE__ */ jsx14(
1197
+ ExhibitionItem,
1198
+ {
1199
+ ref: setNodeRef,
1200
+ style,
1201
+ ...attributes,
1202
+ ...listeners,
1203
+ onClick,
1204
+ isFirst,
1205
+ item,
1206
+ children: /* @__PURE__ */ jsx14("div", { className: "absolute bg-white text-2xl p-1 top-0.5 right-0.5", children: /* @__PURE__ */ jsx14(ResizeHandleIcon, {}) })
1207
+ }
1208
+ );
1209
+ }
1210
+
1211
+ // src/components/SortableExhibitionGrid.tsx
1212
+ import { jsx as jsx15 } from "react/jsx-runtime";
1213
+ function SortableExhibitionGrid() {
1214
+ const { structural, technical } = useManifestEditor2();
1215
+ const items = structural.items.get();
1216
+ const { open } = useLayoutActions4();
1217
+ const sensors = useSensors(
1218
+ useSensor(PointerSensor, {
1219
+ activationConstraint: {
1220
+ distance: 5
1221
+ }
1222
+ }),
1223
+ useSensor(KeyboardSensor, {
1224
+ coordinateGetter: sortableKeyboardCoordinates
1225
+ })
1226
+ );
1227
+ const [, canvasActions] = useCreator2(
1228
+ { id: technical.id.get(), type: "Manifest" },
1229
+ "items",
1230
+ "Manifest"
1231
+ );
1232
+ const onDragEnd = useCallback(
1233
+ (result) => {
1234
+ const { active, over } = result;
1235
+ if (over && active.id !== over.id) {
1236
+ structural.items.reorder(
1237
+ items.findIndex((item) => item.id === active.id),
1238
+ items.findIndex((item) => item.id === over.id)
1239
+ );
1240
+ }
1241
+ },
1242
+ [items, structural.items]
1243
+ );
1244
+ return /* @__PURE__ */ jsx15(ExhibitionContainer, { children: /* @__PURE__ */ jsx15(
1245
+ DndContext,
1246
+ {
1247
+ sensors,
1248
+ collisionDetection: closestCenter,
1249
+ onDragEnd,
1250
+ modifiers: [restrictToParentElement],
1251
+ children: /* @__PURE__ */ jsx15(SortableContext, { items, strategy: rectSortingStrategy, children: items.map((item, idx) => {
1252
+ if (!item)
1253
+ return null;
1254
+ return /* @__PURE__ */ jsx15(CanvasContext3, { canvas: item.id, children: /* @__PURE__ */ jsx15(
1255
+ SortableExhibitionItem,
1256
+ {
1257
+ item,
1258
+ isFirst: idx === 0,
1259
+ onClick: () => {
1260
+ open({ id: "current-canvas" });
1261
+ canvasActions.edit(item, idx);
1262
+ }
1263
+ },
1264
+ item.id
1265
+ ) }, item.id);
1266
+ }) })
1267
+ }
1268
+ ) });
1269
+ }
1270
+
1271
+ // src/left-panels/ExhibitionGrid.tsx
1272
+ import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
1273
+ var exhibitionGridLeftPanel = {
1274
+ id: "canvas-listing",
1275
+ // We are overriding the default canvas listing panel
1276
+ label: "Exhibition grid",
1277
+ icon: /* @__PURE__ */ jsx16(ExhibitionGridIcon, {}),
1278
+ render: () => /* @__PURE__ */ jsx16(ExhibitionGridLeftPanel, {}),
1279
+ options: {
1280
+ minWidth: 350,
1281
+ maxWidth: 350
1282
+ }
1283
+ };
1284
+ function ExhibitionGridLeftPanel() {
1285
+ const { technical } = useManifestEditor3();
1286
+ const manifestId = technical.id.get();
1287
+ const manifest = { id: manifestId, type: "Manifest" };
1288
+ const [canCreateCanvas, canvasActions] = useCreator3(manifest, "items", "Canvas");
1289
+ const [toggled, toggle] = useToggleList2();
1290
+ return /* @__PURE__ */ jsxs8(Sidebar, { children: [
1291
+ /* @__PURE__ */ jsx16(
1292
+ SidebarHeader,
1293
+ {
1294
+ title: "Exhibition",
1295
+ actions: [
1296
+ {
1297
+ icon: toggled.list ? /* @__PURE__ */ jsx16(CanvasListingIcon, { className: "text-2xl" }) : /* @__PURE__ */ jsx16(ExhibitionGridIcon, {}),
1298
+ title: toggled.list ? "List view" : "Grid view",
1299
+ onClick: () => toggle("list")
1300
+ },
1301
+ {
1302
+ icon: /* @__PURE__ */ jsx16(ListEditIcon, {}),
1303
+ title: "Edit slides",
1304
+ toggled: toggled.editing,
1305
+ onClick: () => toggle("editing")
1306
+ },
1307
+ {
1308
+ icon: /* @__PURE__ */ jsx16(NewSlideIcon, {}),
1309
+ title: "Add new slide",
1310
+ disabled: !canCreateCanvas,
1311
+ onClick: () => canvasActions.createFiltered("exhibition-slide")
1312
+ }
1313
+ ]
1314
+ }
1315
+ ),
1316
+ /* @__PURE__ */ jsx16(SidebarContent, { children: toggled.list ? /* @__PURE__ */ jsx16(CanvasListView, { isEditing: toggled.editing }) : toggled.editing ? /* @__PURE__ */ jsx16(SortableExhibitionGrid, {}) : /* @__PURE__ */ jsx16(ExhibitionGrid, {}) })
1317
+ ] });
1318
+ }
1319
+ function ExhibitionGridIcon() {
1320
+ return /* @__PURE__ */ jsxs8("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "currentColor", viewBox: "0 -960 960 960", children: [
1321
+ /* @__PURE__ */ jsx16("title", { children: "Exhibition grid" }),
1322
+ /* @__PURE__ */ jsx16("path", { d: "M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z" })
1323
+ ] });
1324
+ }
1325
+ function ListEditIcon() {
1326
+ return /* @__PURE__ */ jsxs8("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", children: [
1327
+ /* @__PURE__ */ jsx16("title", { children: "Edit slides" }),
1328
+ /* @__PURE__ */ jsx16("path", { d: "M0 0h24v24H0V0z", fill: "none" }),
1329
+ /* @__PURE__ */ jsx16("path", { d: "M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z" })
1330
+ ] });
1331
+ }
1332
+ function NewSlideIcon() {
1333
+ return /* @__PURE__ */ jsxs8("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "currentColor", viewBox: "0 -960 960 960", children: [
1334
+ /* @__PURE__ */ jsx16("title", { children: "Add new slide" }),
1335
+ /* @__PURE__ */ jsx16("path", { d: "M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z" })
1336
+ ] });
1337
+ }
1338
+
1339
+ // src/right-panels/SlideBehaviours.tsx
1340
+ import { Sidebar as Sidebar2, SidebarContent as SidebarContent2, SidebarHeader as SidebarHeader2 } from "@manifest-editor/components";
1341
+ import {
1342
+ BehaviorEditor,
1343
+ DimensionsTriplet,
1344
+ InputContainer,
1345
+ useInStack as useInStack3
1346
+ } from "@manifest-editor/editors";
1347
+ import { useEditor } from "@manifest-editor/shell";
1348
+ import { useState as useState2 } from "react";
1349
+
1350
+ // src/components/AspectRatioWarning.tsx
1351
+ import { useCanvas as useCanvas7 } from "react-iiif-vault";
1352
+ import invariant2 from "tiny-invariant";
1353
+ import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
1354
+ function AspectRatioWarning() {
1355
+ const canvas = useCanvas7();
1356
+ invariant2(canvas);
1357
+ const ratio = canvas.width && canvas.height ? canvas.width / canvas.height : 0;
1358
+ const target = getHeightWidthRatio(canvas.behavior || []);
1359
+ if (Math.abs(ratio - target.ratio) < 0.01)
1360
+ return null;
1361
+ return /* @__PURE__ */ jsxs9("div", { className: "p-2 rounded bg-me-100", children: [
1362
+ /* @__PURE__ */ jsx17("div", { className: "text-me-700-500", children: "Aspect ratio warning" }),
1363
+ /* @__PURE__ */ jsxs9("div", { className: "text-sm text-black/60", children: [
1364
+ "The aspect ratio of this canvas is ",
1365
+ ratio.toFixed(2),
1366
+ " but the target aspect ratio is ",
1367
+ target.ratio.toFixed(2),
1368
+ ". Some parts of this image may be cropped.",
1369
+ /* @__PURE__ */ jsx17("div", { className: "relative h-32 w-full mt-2", children: /* @__PURE__ */ jsx17(
1370
+ "div",
1371
+ {
1372
+ className: "bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32",
1373
+ style: { aspectRatio: ratio.toFixed(2) },
1374
+ children: /* @__PURE__ */ jsx17(
1375
+ "div",
1376
+ {
1377
+ className: "asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32",
1378
+ style: { aspectRatio: target.ratio }
1379
+ }
1380
+ )
1381
+ }
1382
+ ) })
1383
+ ] })
1384
+ ] });
1385
+ }
1386
+
1387
+ // src/right-panels/SlideBehaviours.tsx
1388
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
1389
+ var customBehaviourEditor = {
1390
+ component: () => /* @__PURE__ */ jsx18(SlideBehavioursPanel, {}),
1391
+ supports: {
1392
+ edit: true,
1393
+ resourceTypes: ["Canvas"],
1394
+ properties: ["behavior"]
1395
+ },
1396
+ id: "slide-behaviors",
1397
+ label: "Layout",
1398
+ tabs: {
1399
+ showTitle: true
1400
+ }
1401
+ };
1402
+ var exhibitionConfigs = [
1403
+ {
1404
+ id: "layout",
1405
+ type: "choice",
1406
+ label: { en: ["Layout"] },
1407
+ initialOpen: true,
1408
+ items: [
1409
+ {
1410
+ label: { en: ["Text on left"] },
1411
+ value: "left"
1412
+ },
1413
+ {
1414
+ label: { en: ["Text on right"] },
1415
+ value: "right"
1416
+ },
1417
+ {
1418
+ label: { en: ["Text on bottom"] },
1419
+ value: "bottom"
1420
+ },
1421
+ {
1422
+ label: { en: ["Only image"] },
1423
+ value: "image"
1424
+ }
1425
+ ]
1426
+ },
1427
+ {
1428
+ id: "size",
1429
+ component: (existing, setBehaviors) => /* @__PURE__ */ jsx18(EditSize, { behaviors: existing, setBehaviors }),
1430
+ label: { en: ["Size"] },
1431
+ type: "custom",
1432
+ initialOpen: true,
1433
+ supports: (b) => b.startsWith("w-") || b.startsWith("h-")
1434
+ }
1435
+ ];
1436
+ function parseBehaviors(items) {
1437
+ let width = 0;
1438
+ let height = 0;
1439
+ for (const item of items) {
1440
+ if (item.startsWith("w-")) {
1441
+ width = Number.parseInt(item.slice(2));
1442
+ }
1443
+ if (item.startsWith("h-")) {
1444
+ height = Number.parseInt(item.slice(2));
1445
+ }
1446
+ }
1447
+ return {
1448
+ width,
1449
+ height
1450
+ };
1451
+ }
1452
+ function EditSize({ behaviors, setBehaviors }) {
1453
+ const { width, height } = parseBehaviors(behaviors);
1454
+ const [hoverPosition, setHoverPosition] = useState2({ x: -1, y: -1 });
1455
+ const setBehavior = (w2, h) => {
1456
+ const newBehaviors = behaviors.filter((b) => {
1457
+ return !b.startsWith("w-") && !b.startsWith("h-");
1458
+ });
1459
+ newBehaviors.push(`w-${w2}`);
1460
+ newBehaviors.push(`h-${h}`);
1461
+ setBehaviors(newBehaviors);
1462
+ };
1463
+ const cells = Array.from({ length: 144 }, (_2, i2) => {
1464
+ const x2 = i2 % 12;
1465
+ const y2 = Math.floor(i2 / 12);
1466
+ const hovered = hoverPosition.x >= x2 && hoverPosition.y >= y2;
1467
+ const selected = x2 < width && y2 < height;
1468
+ const hoveredAndSelected = hovered && selected;
1469
+ let bgClass = "bg-gray-200";
1470
+ if (hovered) {
1471
+ bgClass = "bg-me-200";
1472
+ }
1473
+ if (selected) {
1474
+ bgClass = "bg-me-500";
1475
+ }
1476
+ if (hoveredAndSelected) {
1477
+ bgClass = "bg-me-400";
1478
+ }
1479
+ return (
1480
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
1481
+ /* @__PURE__ */ jsx18(
1482
+ "div",
1483
+ {
1484
+ className: `flex aspect-square rounded cursor-se-resize items-center justify-center ${bgClass}`,
1485
+ onClick: () => setBehavior(x2 + 1, y2 + 1),
1486
+ onMouseUp: () => setBehavior(x2 + 1, y2 + 1),
1487
+ onMouseEnter: () => setHoverPosition({ x: x2, y: y2 })
1488
+ },
1489
+ i2
1490
+ )
1491
+ );
1492
+ });
1493
+ return /* @__PURE__ */ jsx18("div", { className: "grid grid-cols-12 grid-rows-12 gap-1", onMouseLeave: () => setHoverPosition({ x: -1, y: -1 }), children: cells });
1494
+ }
1495
+ function SlideBehavioursPanel() {
1496
+ const canvas = useInStack3("Canvas");
1497
+ const editor = useEditor();
1498
+ const { width, height } = editor.technical;
1499
+ if (!canvas || editor.technical.type !== "Canvas") {
1500
+ return /* @__PURE__ */ jsxs10(Sidebar2, { children: [
1501
+ /* @__PURE__ */ jsx18(SidebarHeader2, { title: "Slide behaviors" }),
1502
+ /* @__PURE__ */ jsx18("div", { children: "Please select canvas" })
1503
+ ] });
1504
+ }
1505
+ return /* @__PURE__ */ jsx18(Sidebar2, { children: /* @__PURE__ */ jsxs10(SidebarContent2, { children: [
1506
+ /* @__PURE__ */ jsx18("div", { className: "px-2", children: /* @__PURE__ */ jsxs10(InputContainer, { $wide: true, children: [
1507
+ /* @__PURE__ */ jsx18(
1508
+ DimensionsTriplet,
1509
+ {
1510
+ widthId: width.containerId(),
1511
+ width: width.get() || 0,
1512
+ changeWidth: (v2) => width.set(v2),
1513
+ heightId: height.containerId(),
1514
+ height: height.get() || 0,
1515
+ changeHeight: (v2) => height.set(v2)
1516
+ }
1517
+ ),
1518
+ /* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18(AspectRatioWarning, {}) })
1519
+ ] }) }),
1520
+ /* @__PURE__ */ jsx18(
1521
+ BehaviorEditor,
1522
+ {
1523
+ behavior: editor.technical.behavior.get() || [],
1524
+ onChange: (v2) => {
1525
+ editor.technical.behavior.set(v2);
1526
+ },
1527
+ configs: exhibitionConfigs
1528
+ }
1529
+ )
1530
+ ] }) });
1531
+ }
1532
+
1533
+ // src/right-panels/ExhibitionCanvasEditor.tsx
1534
+ import { Sidebar as Sidebar3, SidebarContent as SidebarContent3 } from "@manifest-editor/components";
1535
+ import {
1536
+ LanguageMapEditor,
1537
+ LinkingPropertyList,
1538
+ PaintingAnnotationList,
1539
+ createAppActions
1540
+ } from "@manifest-editor/editors";
1541
+ import { ResourceEditingProvider, useEditingResource, useEditor as useEditor3 } from "@manifest-editor/shell";
1542
+ import { AnnotationPageContext as AnnotationPageContext2, useCanvas as useCanvas8 } from "react-iiif-vault";
1543
+
1544
+ // src/components/ExhibitionItemConversion.tsx
1545
+ import { getValue } from "@iiif/helpers";
1546
+ import { ActionButton as ActionButton5 } from "@manifest-editor/components";
1547
+ import { useEditor as useEditor2 } from "@manifest-editor/shell";
1548
+ import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
1549
+ function ExhibitionItemConversion() {
1550
+ const editor = useEditor2();
1551
+ const applyDefaultSettings = () => {
1552
+ const canvasWidth = editor.technical.width.get();
1553
+ const canvasHeight = editor.technical.height.get();
1554
+ const summary = editor.descriptive.summary;
1555
+ const behaviors = editor.technical.behavior;
1556
+ const behaviorsToAdd = behaviors.get();
1557
+ behaviorsToAdd.push("w-12");
1558
+ const height = Math.max(1, Math.min(12, Math.round(canvasWidth / canvasHeight * 12)));
1559
+ behaviorsToAdd.push(`h-${height}`);
1560
+ if (!getValue(summary.get())) {
1561
+ summary.set({ en: ["Summary of image"] });
1562
+ }
1563
+ editor.technical.behavior.set(behaviorsToAdd);
1564
+ };
1565
+ return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded", children: [
1566
+ "This canvas was not created in the exhibition editor. Do you want to apply default settings?",
1567
+ /* @__PURE__ */ jsx19(ActionButton5, { onPress: () => applyDefaultSettings(), children: "Apply defaults" })
1568
+ ] });
1569
+ }
1570
+
1571
+ // src/right-panels/ExhibitionCanvasEditor.tsx
1572
+ import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
1573
+ var exhibitionCanvasEditor = {
1574
+ id: "@exhibition/right-panel-editor",
1575
+ supports: {
1576
+ edit: true,
1577
+ properties: ["label", "summary"],
1578
+ resourceTypes: ["Canvas"],
1579
+ custom: ({ resource }, vault) => {
1580
+ const full = vault.get(resource);
1581
+ const stats = getGridStats(full.behavior);
1582
+ if (full.type === "Canvas" && !stats.isInfo) {
1583
+ return true;
1584
+ }
1585
+ return false;
1586
+ }
1587
+ },
1588
+ label: "Exhibition",
1589
+ component: () => /* @__PURE__ */ jsx20(ExhibitionRightPanel, {})
1590
+ };
1591
+ function ExhibitionRightPanel() {
1592
+ const canvas = useCanvas8();
1593
+ const resource = useEditingResource();
1594
+ const { structural, technical, descriptive } = useEditor3();
1595
+ const { items } = structural;
1596
+ const { thumbnail } = descriptive;
1597
+ const { width, height } = technical;
1598
+ const pages = items.get();
1599
+ const page = pages[0];
1600
+ const isAnExhibitionCanvas = isExhibitionItem(canvas);
1601
+ if (!canvas || !page || !resource)
1602
+ return /* @__PURE__ */ jsx20("div", { className: "p-8", children: "Canvas, page, or resource not found" });
1603
+ return /* @__PURE__ */ jsx20(Sidebar3, { children: /* @__PURE__ */ jsx20(SidebarContent3, { padding: true, children: /* @__PURE__ */ jsxs12(ResourceEditingProvider, { resource: canvas, children: [
1604
+ !isAnExhibitionCanvas ? /* @__PURE__ */ jsx20(ExhibitionItemConversion, {}) : null,
1605
+ /* @__PURE__ */ jsx20(LanguageMapEditor, { dispatchType: "label", disableMultiline: true, disallowHTML: true }),
1606
+ /* @__PURE__ */ jsx20(
1607
+ LinkingPropertyList,
1608
+ {
1609
+ containerId: thumbnail.containerId(),
1610
+ label: "Thumbnail",
1611
+ property: "thumbnail",
1612
+ items: thumbnail.get(),
1613
+ singleMode: true,
1614
+ reorder: (ctx) => thumbnail.reorder(ctx.startIndex, ctx.endIndex),
1615
+ createActions: createAppActions(thumbnail),
1616
+ creationType: "ContentResource",
1617
+ emptyLabel: "No thumbnail",
1618
+ parent: resource?.resource
1619
+ }
1620
+ ),
1621
+ /* @__PURE__ */ jsx20(AnnotationPageContext2, { annotationPage: page.id, children: /* @__PURE__ */ jsx20(PaintingAnnotationList, { createFilter: "image" }) })
1622
+ ] }) }) });
1623
+ }
1624
+
1625
+ // src/right-panels/ExhibitionSummaryEditor.tsx
1626
+ import { Sidebar as Sidebar4, SidebarContent as SidebarContent4 } from "@manifest-editor/components";
1627
+ import { LanguageMapEditor as LanguageMapEditor2 } from "@manifest-editor/editors";
1628
+ import { ResourceEditingProvider as ResourceEditingProvider2 } from "@manifest-editor/shell";
1629
+ import { useCanvas as useCanvas9 } from "react-iiif-vault";
1630
+ import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
1631
+ var exhibitionSummaryEdtior = {
1632
+ id: "@exhibition/summary-editor",
1633
+ supports: {
1634
+ edit: true,
1635
+ properties: ["summary"],
1636
+ resourceTypes: ["Canvas"],
1637
+ custom: ({ resource }, vault) => {
1638
+ const full = vault.get(resource);
1639
+ const stats = getGridStats(full.behavior);
1640
+ if (full.type === "Canvas" && !stats.isInfo && !stats.isBottom) {
1641
+ return true;
1642
+ }
1643
+ return false;
1644
+ }
1645
+ },
1646
+ label: "Summary",
1647
+ component: () => /* @__PURE__ */ jsx21(ExhibitionRightPanel2, {})
1648
+ };
1649
+ function ExhibitionRightPanel2() {
1650
+ const canvas = useCanvas9();
1651
+ if (!canvas)
1652
+ return null;
1653
+ return /* @__PURE__ */ jsx21(Sidebar4, { children: /* @__PURE__ */ jsx21(SidebarContent4, { padding: true, children: /* @__PURE__ */ jsxs13(ResourceEditingProvider2, { resource: canvas, children: [
1654
+ /* @__PURE__ */ jsx21(LanguageMapEditor2, { dispatchType: "label" }),
1655
+ /* @__PURE__ */ jsx21(LanguageMapEditor2, { dispatchType: "summary" })
1656
+ ] }) }) });
1657
+ }
1658
+
1659
+ // src/right-panels/ExhibitionTourSteps.tsx
1660
+ import {
1661
+ ActionButton as ActionButton9,
1662
+ Sidebar as Sidebar5,
1663
+ SidebarContent as SidebarContent5
1664
+ } from "@manifest-editor/components";
1665
+ import { PromptToAddPaintingAnnotations } from "@manifest-editor/editors";
1666
+ import {
1667
+ ResourceEditingProvider as ResourceEditingProvider4,
1668
+ useGenericEditor as useGenericEditor9,
1669
+ useInlineCreator as useInlineCreator3,
1670
+ useRequestAnnotation as useRequestAnnotation2
1671
+ } from "@manifest-editor/shell";
1672
+ import { useState as useState5 } from "react";
1673
+ import { Button as Button2 } from "react-aria-components";
1674
+ import { AnnotationPageContext as AnnotationPageContext3, useCanvas as useCanvas10 } from "react-iiif-vault";
1675
+
1676
+ // src/components/TourAnnotationPageEditor.tsx
1677
+ import { ReorderList } from "@manifest-editor/editors";
1678
+ import { useGenericEditor as useGenericEditor8 } from "@manifest-editor/shell";
1679
+ import { AnnotationContext as AnnotationContext4, useAnnotationPage as useAnnotationPage4 } from "react-iiif-vault";
1680
+
1681
+ // src/components/TourAnnotationEditor.tsx
1682
+ import { useAnnotationInfo } from "@manifest-editor/editors";
1683
+ import { ResourceEditingProvider as ResourceEditingProvider3 } from "@manifest-editor/shell";
1684
+ import { useMemo } from "react";
1685
+ import { AnnotationContext as AnnotationContext3 } from "react-iiif-vault";
1686
+
1687
+ // src/components/TourNormalAnnotationEditor.tsx
1688
+ import { ActionButton as ActionButton7, DeleteForeverIcon } from "@manifest-editor/components";
1689
+ import { ListEditIcon as ListEditIcon2 } from "@manifest-editor/manifest-preset/components";
1690
+ import { useGenericEditor as useGenericEditor6, useRequestAnnotation } from "@manifest-editor/shell";
1691
+
1692
+ // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.es6.js
1693
+ var __assign = function() {
1694
+ __assign = Object.assign || function __assign2(t) {
1695
+ for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
1696
+ s2 = arguments[i2];
1697
+ for (var p2 in s2)
1698
+ if (Object.prototype.hasOwnProperty.call(s2, p2))
1699
+ t[p2] = s2[p2];
1700
+ }
1701
+ return t;
1702
+ };
1703
+ return __assign.apply(this, arguments);
1704
+ };
1705
+ function __spreadArray(to, from2, pack) {
1706
+ if (pack || arguments.length === 2)
1707
+ for (var i2 = 0, l2 = from2.length, ar; i2 < l2; i2++) {
1708
+ if (ar || !(i2 in from2)) {
1709
+ if (!ar)
1710
+ ar = Array.prototype.slice.call(from2, 0, i2);
1711
+ ar[i2] = from2[i2];
1712
+ }
1713
+ }
1714
+ return to.concat(ar || Array.prototype.slice.call(from2));
1715
+ }
1716
+
1717
+ // ../../node_modules/.pnpm/@emotion+memoize@0.8.1/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
1718
+ function memoize(fn) {
1719
+ var cache = /* @__PURE__ */ Object.create(null);
1720
+ return function(arg) {
1721
+ if (cache[arg] === void 0)
1722
+ cache[arg] = fn(arg);
1723
+ return cache[arg];
1724
+ };
1725
+ }
1726
+
1727
+ // ../../node_modules/.pnpm/@emotion+is-prop-valid@1.2.1/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
1728
+ var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
1729
+ var isPropValid = /* @__PURE__ */ memoize(
1730
+ function(prop) {
1731
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
1732
+ }
1733
+ /* Z+1 */
1734
+ );
1735
+
1736
+ // ../../node_modules/.pnpm/styled-components@6.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/styled-components/dist/styled-components.browser.esm.js
1737
+ var import_shallowequal = __toESM(require_shallowequal());
1738
+ import o, { useRef as r, useState as s, useMemo as i, useEffect as a, useContext as c, useDebugValue as l, createElement as u } from "react";
1739
+
1740
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Enum.js
1741
+ var MS = "-ms-";
1742
+ var MOZ = "-moz-";
1743
+ var WEBKIT = "-webkit-";
1744
+ var COMMENT = "comm";
1745
+ var RULESET = "rule";
1746
+ var DECLARATION = "decl";
1747
+ var IMPORT = "@import";
1748
+ var KEYFRAMES = "@keyframes";
1749
+ var LAYER = "@layer";
1750
+
1751
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Utility.js
1752
+ var abs = Math.abs;
1753
+ var from = String.fromCharCode;
1754
+ var assign = Object.assign;
1755
+ function hash(value, length2) {
1756
+ return charat(value, 0) ^ 45 ? (((length2 << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
1757
+ }
1758
+ function trim(value) {
1759
+ return value.trim();
1760
+ }
1761
+ function match(value, pattern) {
1762
+ return (value = pattern.exec(value)) ? value[0] : value;
1763
+ }
1764
+ function replace(value, pattern, replacement) {
1765
+ return value.replace(pattern, replacement);
1766
+ }
1767
+ function indexof(value, search, position2) {
1768
+ return value.indexOf(search, position2);
1769
+ }
1770
+ function charat(value, index) {
1771
+ return value.charCodeAt(index) | 0;
1772
+ }
1773
+ function substr(value, begin, end) {
1774
+ return value.slice(begin, end);
1775
+ }
1776
+ function strlen(value) {
1777
+ return value.length;
1778
+ }
1779
+ function sizeof(value) {
1780
+ return value.length;
1781
+ }
1782
+ function append(value, array) {
1783
+ return array.push(value), value;
1784
+ }
1785
+ function combine(array, callback) {
1786
+ return array.map(callback).join("");
1787
+ }
1788
+ function filter(array, pattern) {
1789
+ return array.filter(function(value) {
1790
+ return !match(value, pattern);
1791
+ });
1792
+ }
1793
+
1794
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Tokenizer.js
1795
+ var line = 1;
1796
+ var column = 1;
1797
+ var length = 0;
1798
+ var position = 0;
1799
+ var character = 0;
1800
+ var characters = "";
1801
+ function node(value, root, parent, type, props, children, length2, siblings) {
1802
+ return { value, root, parent, type, props, children, line, column, length: length2, return: "", siblings };
1803
+ }
1804
+ function copy(root, props) {
1805
+ return assign(node("", null, null, "", null, null, 0, root.siblings), root, { length: -root.length }, props);
1806
+ }
1807
+ function lift(root) {
1808
+ while (root.root)
1809
+ root = copy(root.root, { children: [root] });
1810
+ append(root, root.siblings);
1811
+ }
1812
+ function char() {
1813
+ return character;
1814
+ }
1815
+ function prev() {
1816
+ character = position > 0 ? charat(characters, --position) : 0;
1817
+ if (column--, character === 10)
1818
+ column = 1, line--;
1819
+ return character;
1820
+ }
1821
+ function next() {
1822
+ character = position < length ? charat(characters, position++) : 0;
1823
+ if (column++, character === 10)
1824
+ column = 1, line++;
1825
+ return character;
1826
+ }
1827
+ function peek() {
1828
+ return charat(characters, position);
1829
+ }
1830
+ function caret() {
1831
+ return position;
1832
+ }
1833
+ function slice(begin, end) {
1834
+ return substr(characters, begin, end);
1835
+ }
1836
+ function token(type) {
1837
+ switch (type) {
1838
+ case 0:
1839
+ case 9:
1840
+ case 10:
1841
+ case 13:
1842
+ case 32:
1843
+ return 5;
1844
+ case 33:
1845
+ case 43:
1846
+ case 44:
1847
+ case 47:
1848
+ case 62:
1849
+ case 64:
1850
+ case 126:
1851
+ case 59:
1852
+ case 123:
1853
+ case 125:
1854
+ return 4;
1855
+ case 58:
1856
+ return 3;
1857
+ case 34:
1858
+ case 39:
1859
+ case 40:
1860
+ case 91:
1861
+ return 2;
1862
+ case 41:
1863
+ case 93:
1864
+ return 1;
1865
+ }
1866
+ return 0;
1867
+ }
1868
+ function alloc(value) {
1869
+ return line = column = 1, length = strlen(characters = value), position = 0, [];
1870
+ }
1871
+ function dealloc(value) {
1872
+ return characters = "", value;
1873
+ }
1874
+ function delimit(type) {
1875
+ return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
1876
+ }
1877
+ function whitespace(type) {
1878
+ while (character = peek())
1879
+ if (character < 33)
1880
+ next();
1881
+ else
1882
+ break;
1883
+ return token(type) > 2 || token(character) > 3 ? "" : " ";
1884
+ }
1885
+ function escaping(index, count) {
1886
+ while (--count && next())
1887
+ if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
1888
+ break;
1889
+ return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
1890
+ }
1891
+ function delimiter(type) {
1892
+ while (next())
1893
+ switch (character) {
1894
+ case type:
1895
+ return position;
1896
+ case 34:
1897
+ case 39:
1898
+ if (type !== 34 && type !== 39)
1899
+ delimiter(character);
1900
+ break;
1901
+ case 40:
1902
+ if (type === 41)
1903
+ delimiter(type);
1904
+ break;
1905
+ case 92:
1906
+ next();
1907
+ break;
1908
+ }
1909
+ return position;
1910
+ }
1911
+ function commenter(type, index) {
1912
+ while (next())
1913
+ if (type + character === 47 + 10)
1914
+ break;
1915
+ else if (type + character === 42 + 42 && peek() === 47)
1916
+ break;
1917
+ return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
1918
+ }
1919
+ function identifier(index) {
1920
+ while (!token(peek()))
1921
+ next();
1922
+ return slice(index, position);
1923
+ }
1924
+
1925
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Parser.js
1926
+ function compile(value) {
1927
+ return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
1928
+ }
1929
+ function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
1930
+ var index = 0;
1931
+ var offset = 0;
1932
+ var length2 = pseudo;
1933
+ var atrule = 0;
1934
+ var property = 0;
1935
+ var previous = 0;
1936
+ var variable = 1;
1937
+ var scanning = 1;
1938
+ var ampersand = 1;
1939
+ var character2 = 0;
1940
+ var type = "";
1941
+ var props = rules;
1942
+ var children = rulesets;
1943
+ var reference = rule;
1944
+ var characters2 = type;
1945
+ while (scanning)
1946
+ switch (previous = character2, character2 = next()) {
1947
+ case 40:
1948
+ if (previous != 108 && charat(characters2, length2 - 1) == 58) {
1949
+ if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs(index ? points[index - 1] : 0)) != -1)
1950
+ ampersand = -1;
1951
+ break;
1952
+ }
1953
+ case 34:
1954
+ case 39:
1955
+ case 91:
1956
+ characters2 += delimit(character2);
1957
+ break;
1958
+ case 9:
1959
+ case 10:
1960
+ case 13:
1961
+ case 32:
1962
+ characters2 += whitespace(previous);
1963
+ break;
1964
+ case 92:
1965
+ characters2 += escaping(caret() - 1, 7);
1966
+ continue;
1967
+ case 47:
1968
+ switch (peek()) {
1969
+ case 42:
1970
+ case 47:
1971
+ append(comment(commenter(next(), caret()), root, parent, declarations), declarations);
1972
+ break;
1973
+ default:
1974
+ characters2 += "/";
1975
+ }
1976
+ break;
1977
+ case 123 * variable:
1978
+ points[index++] = strlen(characters2) * ampersand;
1979
+ case 125 * variable:
1980
+ case 59:
1981
+ case 0:
1982
+ switch (character2) {
1983
+ case 0:
1984
+ case 125:
1985
+ scanning = 0;
1986
+ case 59 + offset:
1987
+ if (ampersand == -1)
1988
+ characters2 = replace(characters2, /\f/g, "");
1989
+ if (property > 0 && strlen(characters2) - length2)
1990
+ append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2, declarations), declarations);
1991
+ break;
1992
+ case 59:
1993
+ characters2 += ";";
1994
+ default:
1995
+ append(reference = ruleset(characters2, root, parent, index, offset, rules, points, type, props = [], children = [], length2, rulesets), rulesets);
1996
+ if (character2 === 123)
1997
+ if (offset === 0)
1998
+ parse(characters2, root, reference, reference, props, rulesets, length2, points, children);
1999
+ else
2000
+ switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
2001
+ case 100:
2002
+ case 108:
2003
+ case 109:
2004
+ case 115:
2005
+ parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2, children), children), rules, children, length2, points, rule ? props : children);
2006
+ break;
2007
+ default:
2008
+ parse(characters2, reference, reference, reference, [""], children, 0, points, children);
2009
+ }
2010
+ }
2011
+ index = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
2012
+ break;
2013
+ case 58:
2014
+ length2 = 1 + strlen(characters2), property = previous;
2015
+ default:
2016
+ if (variable < 1) {
2017
+ if (character2 == 123)
2018
+ --variable;
2019
+ else if (character2 == 125 && variable++ == 0 && prev() == 125)
2020
+ continue;
2021
+ }
2022
+ switch (characters2 += from(character2), character2 * variable) {
2023
+ case 38:
2024
+ ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
2025
+ break;
2026
+ case 44:
2027
+ points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
2028
+ break;
2029
+ case 64:
2030
+ if (peek() === 45)
2031
+ characters2 += delimit(next());
2032
+ atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++;
2033
+ break;
2034
+ case 45:
2035
+ if (previous === 45 && strlen(characters2) == 2)
2036
+ variable = 0;
2037
+ }
2038
+ }
2039
+ return rulesets;
2040
+ }
2041
+ function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length2, siblings) {
2042
+ var post = offset - 1;
2043
+ var rule = offset === 0 ? rules : [""];
2044
+ var size = sizeof(rule);
2045
+ for (var i2 = 0, j2 = 0, k2 = 0; i2 < index; ++i2)
2046
+ for (var x2 = 0, y2 = substr(value, post + 1, post = abs(j2 = points[i2])), z2 = value; x2 < size; ++x2)
2047
+ if (z2 = trim(j2 > 0 ? rule[x2] + " " + y2 : replace(y2, /&\f/g, rule[x2])))
2048
+ props[k2++] = z2;
2049
+ return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2, siblings);
2050
+ }
2051
+ function comment(value, root, parent, siblings) {
2052
+ return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings);
2053
+ }
2054
+ function declaration(value, root, parent, length2, siblings) {
2055
+ return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2, siblings);
2056
+ }
2057
+
2058
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Prefixer.js
2059
+ function prefix(value, length2, children) {
2060
+ switch (hash(value, length2)) {
2061
+ case 5103:
2062
+ return WEBKIT + "print-" + value + value;
2063
+ case 5737:
2064
+ case 4201:
2065
+ case 3177:
2066
+ case 3433:
2067
+ case 1641:
2068
+ case 4457:
2069
+ case 2921:
2070
+ case 5572:
2071
+ case 6356:
2072
+ case 5844:
2073
+ case 3191:
2074
+ case 6645:
2075
+ case 3005:
2076
+ case 6391:
2077
+ case 5879:
2078
+ case 5623:
2079
+ case 6135:
2080
+ case 4599:
2081
+ case 4855:
2082
+ case 4215:
2083
+ case 6389:
2084
+ case 5109:
2085
+ case 5365:
2086
+ case 5621:
2087
+ case 3829:
2088
+ return WEBKIT + value + value;
2089
+ case 4789:
2090
+ return MOZ + value + value;
2091
+ case 5349:
2092
+ case 4246:
2093
+ case 4810:
2094
+ case 6968:
2095
+ case 2756:
2096
+ return WEBKIT + value + MOZ + value + MS + value + value;
2097
+ case 5936:
2098
+ switch (charat(value, length2 + 11)) {
2099
+ case 114:
2100
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
2101
+ case 108:
2102
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
2103
+ case 45:
2104
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
2105
+ }
2106
+ case 6828:
2107
+ case 4268:
2108
+ case 2903:
2109
+ return WEBKIT + value + MS + value + value;
2110
+ case 6165:
2111
+ return WEBKIT + value + MS + "flex-" + value + value;
2112
+ case 5187:
2113
+ return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
2114
+ case 5443:
2115
+ return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/g, "") + (!match(value, /flex-|baseline/) ? MS + "grid-row-" + replace(value, /flex-|-self/g, "") : "") + value;
2116
+ case 4675:
2117
+ return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/g, "") + value;
2118
+ case 5548:
2119
+ return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
2120
+ case 5292:
2121
+ return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
2122
+ case 6060:
2123
+ return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
2124
+ case 4554:
2125
+ return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
2126
+ case 6187:
2127
+ return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
2128
+ case 5495:
2129
+ case 3959:
2130
+ return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
2131
+ case 4968:
2132
+ return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
2133
+ case 4200:
2134
+ if (!match(value, /flex-|baseline/))
2135
+ return MS + "grid-column-align" + substr(value, length2) + value;
2136
+ break;
2137
+ case 2592:
2138
+ case 3360:
2139
+ return MS + replace(value, "template-", "") + value;
2140
+ case 4384:
2141
+ case 3616:
2142
+ if (children && children.some(function(element, index) {
2143
+ return length2 = index, match(element.props, /grid-\w+-end/);
2144
+ })) {
2145
+ return ~indexof(value + (children = children[length2].value), "span", 0) ? value : MS + replace(value, "-start", "") + value + MS + "grid-row-span:" + (~indexof(children, "span", 0) ? match(children, /\d+/) : +match(children, /\d+/) - +match(value, /\d+/)) + ";";
2146
+ }
2147
+ return MS + replace(value, "-start", "") + value;
2148
+ case 4896:
2149
+ case 4128:
2150
+ return children && children.some(function(element) {
2151
+ return match(element.props, /grid-\w+-start/);
2152
+ }) ? value : MS + replace(replace(value, "-end", "-span"), "span ", "") + value;
2153
+ case 4095:
2154
+ case 3583:
2155
+ case 4068:
2156
+ case 2532:
2157
+ return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
2158
+ case 8116:
2159
+ case 7059:
2160
+ case 5753:
2161
+ case 5535:
2162
+ case 5445:
2163
+ case 5701:
2164
+ case 4933:
2165
+ case 4677:
2166
+ case 5533:
2167
+ case 5789:
2168
+ case 5021:
2169
+ case 4765:
2170
+ if (strlen(value) - 1 - length2 > 6)
2171
+ switch (charat(value, length2 + 1)) {
2172
+ case 109:
2173
+ if (charat(value, length2 + 4) !== 45)
2174
+ break;
2175
+ case 102:
2176
+ return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length2 + 3) == 108 ? "$3" : "$2-$3")) + value;
2177
+ case 115:
2178
+ return ~indexof(value, "stretch", 0) ? prefix(replace(value, "stretch", "fill-available"), length2, children) + value : value;
2179
+ }
2180
+ break;
2181
+ case 5152:
2182
+ case 5920:
2183
+ return replace(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(_2, a2, b, c2, d, e, f2) {
2184
+ return MS + a2 + ":" + b + f2 + (c2 ? MS + a2 + "-span:" + (d ? e : +e - +b) + f2 : "") + value;
2185
+ });
2186
+ case 4949:
2187
+ if (charat(value, length2 + 6) === 121)
2188
+ return replace(value, ":", ":" + WEBKIT) + value;
2189
+ break;
2190
+ case 6444:
2191
+ switch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {
2192
+ case 120:
2193
+ return replace(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
2194
+ case 100:
2195
+ return replace(value, ":", ":" + MS) + value;
2196
+ }
2197
+ break;
2198
+ case 5719:
2199
+ case 2647:
2200
+ case 2135:
2201
+ case 3927:
2202
+ case 2391:
2203
+ return replace(value, "scroll-", "scroll-snap-") + value;
2204
+ }
2205
+ return value;
2206
+ }
2207
+
2208
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Serializer.js
2209
+ function serialize(children, callback) {
2210
+ var output = "";
2211
+ for (var i2 = 0; i2 < children.length; i2++)
2212
+ output += callback(children[i2], i2, children, callback) || "";
2213
+ return output;
2214
+ }
2215
+ function stringify(element, index, children, callback) {
2216
+ switch (element.type) {
2217
+ case LAYER:
2218
+ if (element.children.length)
2219
+ break;
2220
+ case IMPORT:
2221
+ case DECLARATION:
2222
+ return element.return = element.return || element.value;
2223
+ case COMMENT:
2224
+ return "";
2225
+ case KEYFRAMES:
2226
+ return element.return = element.value + "{" + serialize(element.children, callback) + "}";
2227
+ case RULESET:
2228
+ if (!strlen(element.value = element.props.join(",")))
2229
+ return "";
2230
+ }
2231
+ return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
2232
+ }
2233
+
2234
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Middleware.js
2235
+ function middleware(collection) {
2236
+ var length2 = sizeof(collection);
2237
+ return function(element, index, children, callback) {
2238
+ var output = "";
2239
+ for (var i2 = 0; i2 < length2; i2++)
2240
+ output += collection[i2](element, index, children, callback) || "";
2241
+ return output;
2242
+ };
2243
+ }
2244
+ function rulesheet(callback) {
2245
+ return function(element) {
2246
+ if (!element.root) {
2247
+ if (element = element.return)
2248
+ callback(element);
2249
+ }
2250
+ };
2251
+ }
2252
+ function prefixer(element, index, children, callback) {
2253
+ if (element.length > -1) {
2254
+ if (!element.return)
2255
+ switch (element.type) {
2256
+ case DECLARATION:
2257
+ element.return = prefix(element.value, element.length, children);
2258
+ return;
2259
+ case KEYFRAMES:
2260
+ return serialize([copy(element, { value: replace(element.value, "@", "@" + WEBKIT) })], callback);
2261
+ case RULESET:
2262
+ if (element.length)
2263
+ return combine(children = element.props, function(value) {
2264
+ switch (match(value, callback = /(::plac\w+|:read-\w+)/)) {
2265
+ case ":read-only":
2266
+ case ":read-write":
2267
+ lift(copy(element, { props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")] }));
2268
+ lift(copy(element, { props: [value] }));
2269
+ assign(element, { props: filter(children, callback) });
2270
+ break;
2271
+ case "::placeholder":
2272
+ lift(copy(element, { props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")] }));
2273
+ lift(copy(element, { props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")] }));
2274
+ lift(copy(element, { props: [replace(value, /:(plac\w+)/, MS + "input-$1")] }));
2275
+ lift(copy(element, { props: [value] }));
2276
+ assign(element, { props: filter(children, callback) });
2277
+ break;
2278
+ }
2279
+ return "";
2280
+ });
2281
+ }
2282
+ }
2283
+ }
2284
+
2285
+ // ../../node_modules/.pnpm/@emotion+unitless@0.8.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
2286
+ var unitlessKeys = {
2287
+ animationIterationCount: 1,
2288
+ borderImageOutset: 1,
2289
+ borderImageSlice: 1,
2290
+ borderImageWidth: 1,
2291
+ boxFlex: 1,
2292
+ boxFlexGroup: 1,
2293
+ boxOrdinalGroup: 1,
2294
+ columnCount: 1,
2295
+ columns: 1,
2296
+ flex: 1,
2297
+ flexGrow: 1,
2298
+ flexPositive: 1,
2299
+ flexShrink: 1,
2300
+ flexNegative: 1,
2301
+ flexOrder: 1,
2302
+ gridRow: 1,
2303
+ gridRowEnd: 1,
2304
+ gridRowSpan: 1,
2305
+ gridRowStart: 1,
2306
+ gridColumn: 1,
2307
+ gridColumnEnd: 1,
2308
+ gridColumnSpan: 1,
2309
+ gridColumnStart: 1,
2310
+ msGridRow: 1,
2311
+ msGridRowSpan: 1,
2312
+ msGridColumn: 1,
2313
+ msGridColumnSpan: 1,
2314
+ fontWeight: 1,
2315
+ lineHeight: 1,
2316
+ opacity: 1,
2317
+ order: 1,
2318
+ orphans: 1,
2319
+ tabSize: 1,
2320
+ widows: 1,
2321
+ zIndex: 1,
2322
+ zoom: 1,
2323
+ WebkitLineClamp: 1,
2324
+ // SVG-related properties
2325
+ fillOpacity: 1,
2326
+ floodOpacity: 1,
2327
+ stopOpacity: 1,
2328
+ strokeDasharray: 1,
2329
+ strokeDashoffset: 1,
2330
+ strokeMiterlimit: 1,
2331
+ strokeOpacity: 1,
2332
+ strokeWidth: 1
2333
+ };
2334
+ var emotion_unitless_esm_default = unitlessKeys;
2335
+
2336
+ // ../../node_modules/.pnpm/styled-components@6.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/styled-components/dist/styled-components.browser.esm.js
2337
+ var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
2338
+ var m = "active";
2339
+ var y = "data-styled-version";
2340
+ var v = "6.1.8";
2341
+ var g = "/*!sc*/\n";
2342
+ var S = "undefined" != typeof window && "HTMLElement" in window;
2343
+ var w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : true);
2344
+ var E = /invalid hook call/i;
2345
+ var N = /* @__PURE__ */ new Set();
2346
+ var P = function(t, n) {
2347
+ if (true) {
2348
+ var o2 = n ? ' with the id of "'.concat(n, '"') : "", s2 = "The component ".concat(t).concat(o2, " has been created dynamically.\n") + "You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.", i2 = console.error;
2349
+ try {
2350
+ var a2 = true;
2351
+ console.error = function(t2) {
2352
+ for (var n2 = [], o3 = 1; o3 < arguments.length; o3++)
2353
+ n2[o3 - 1] = arguments[o3];
2354
+ E.test(t2) ? (a2 = false, N.delete(s2)) : i2.apply(void 0, __spreadArray([t2], n2, false));
2355
+ }, r(), a2 && !N.has(s2) && (console.warn(s2), N.add(s2));
2356
+ } catch (e) {
2357
+ E.test(e.message) && N.delete(s2);
2358
+ } finally {
2359
+ console.error = i2;
2360
+ }
2361
+ }
2362
+ };
2363
+ var _ = Object.freeze([]);
2364
+ var C = Object.freeze({});
2365
+ function I(e, t, n) {
2366
+ return void 0 === n && (n = C), e.theme !== n.theme && e.theme || t || n.theme;
2367
+ }
2368
+ var A = /* @__PURE__ */ new Set(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]);
2369
+ var O = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g;
2370
+ var D = /(^-|-$)/g;
2371
+ function R(e) {
2372
+ return e.replace(O, "-").replace(D, "");
2373
+ }
2374
+ var T = /(a)(d)/gi;
2375
+ var k = 52;
2376
+ var j = function(e) {
2377
+ return String.fromCharCode(e + (e > 25 ? 39 : 97));
2378
+ };
2379
+ function x(e) {
2380
+ var t, n = "";
2381
+ for (t = Math.abs(e); t > k; t = t / k | 0)
2382
+ n = j(t % k) + n;
2383
+ return (j(t % k) + n).replace(T, "$1-$2");
2384
+ }
2385
+ var V;
2386
+ var F = 5381;
2387
+ var M = function(e, t) {
2388
+ for (var n = t.length; n; )
2389
+ e = 33 * e ^ t.charCodeAt(--n);
2390
+ return e;
2391
+ };
2392
+ var $ = function(e) {
2393
+ return M(F, e);
2394
+ };
2395
+ function z(e) {
2396
+ return x($(e) >>> 0);
2397
+ }
2398
+ function B(e) {
2399
+ return "string" == typeof e && e || e.displayName || e.name || "Component";
2400
+ }
2401
+ function L(e) {
2402
+ return "string" == typeof e && e.charAt(0) === e.charAt(0).toLowerCase();
2403
+ }
2404
+ var G = "function" == typeof Symbol && Symbol.for;
2405
+ var Y = G ? Symbol.for("react.memo") : 60115;
2406
+ var W = G ? Symbol.for("react.forward_ref") : 60112;
2407
+ var q = { childContextTypes: true, contextType: true, contextTypes: true, defaultProps: true, displayName: true, getDefaultProps: true, getDerivedStateFromError: true, getDerivedStateFromProps: true, mixins: true, propTypes: true, type: true };
2408
+ var H = { name: true, length: true, prototype: true, caller: true, callee: true, arguments: true, arity: true };
2409
+ var U = { $$typeof: true, compare: true, defaultProps: true, displayName: true, propTypes: true, type: true };
2410
+ var J = ((V = {})[W] = { $$typeof: true, render: true, defaultProps: true, displayName: true, propTypes: true }, V[Y] = U, V);
2411
+ function X(e) {
2412
+ return ("type" in (t = e) && t.type.$$typeof) === Y ? U : "$$typeof" in e ? J[e.$$typeof] : q;
2413
+ var t;
2414
+ }
2415
+ var Z = Object.defineProperty;
2416
+ var K = Object.getOwnPropertyNames;
2417
+ var Q = Object.getOwnPropertySymbols;
2418
+ var ee = Object.getOwnPropertyDescriptor;
2419
+ var te = Object.getPrototypeOf;
2420
+ var ne = Object.prototype;
2421
+ function oe(e, t, n) {
2422
+ if ("string" != typeof t) {
2423
+ if (ne) {
2424
+ var o2 = te(t);
2425
+ o2 && o2 !== ne && oe(e, o2, n);
2426
+ }
2427
+ var r2 = K(t);
2428
+ Q && (r2 = r2.concat(Q(t)));
2429
+ for (var s2 = X(e), i2 = X(t), a2 = 0; a2 < r2.length; ++a2) {
2430
+ var c2 = r2[a2];
2431
+ if (!(c2 in H || n && n[c2] || i2 && c2 in i2 || s2 && c2 in s2)) {
2432
+ var l2 = ee(t, c2);
2433
+ try {
2434
+ Z(e, c2, l2);
2435
+ } catch (e2) {
2436
+ }
2437
+ }
2438
+ }
2439
+ }
2440
+ return e;
2441
+ }
2442
+ function re(e) {
2443
+ return "function" == typeof e;
2444
+ }
2445
+ function se(e) {
2446
+ return "object" == typeof e && "styledComponentId" in e;
2447
+ }
2448
+ function ie(e, t) {
2449
+ return e && t ? "".concat(e, " ").concat(t) : e || t || "";
2450
+ }
2451
+ function ae(e, t) {
2452
+ if (0 === e.length)
2453
+ return "";
2454
+ for (var n = e[0], o2 = 1; o2 < e.length; o2++)
2455
+ n += t ? t + e[o2] : e[o2];
2456
+ return n;
2457
+ }
2458
+ function ce(e) {
2459
+ return null !== e && "object" == typeof e && e.constructor.name === Object.name && !("props" in e && e.$$typeof);
2460
+ }
2461
+ function le(e, t, n) {
2462
+ if (void 0 === n && (n = false), !n && !ce(e) && !Array.isArray(e))
2463
+ return t;
2464
+ if (Array.isArray(t))
2465
+ for (var o2 = 0; o2 < t.length; o2++)
2466
+ e[o2] = le(e[o2], t[o2]);
2467
+ else if (ce(t))
2468
+ for (var o2 in t)
2469
+ e[o2] = le(e[o2], t[o2]);
2470
+ return e;
2471
+ }
2472
+ function ue(e, t) {
2473
+ Object.defineProperty(e, "toString", { value: t });
2474
+ }
2475
+ var pe = true ? { 1: "Cannot create styled-component for component: %s.\n\n", 2: "Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n", 3: "Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n", 4: "The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n", 5: "The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n", 6: "Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n", 7: 'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n', 8: 'ThemeProvider: Please make your "theme" prop an object.\n\n', 9: "Missing document `<head>`\n\n", 10: "Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n", 11: "_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n", 12: "It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n", 13: "%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n", 14: 'ThemeProvider: "theme" prop is required.\n\n', 15: "A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n", 16: "Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n", 17: "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n", 18: "ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`" } : {};
2476
+ function de() {
2477
+ for (var e = [], t = 0; t < arguments.length; t++)
2478
+ e[t] = arguments[t];
2479
+ for (var n = e[0], o2 = [], r2 = 1, s2 = e.length; r2 < s2; r2 += 1)
2480
+ o2.push(e[r2]);
2481
+ return o2.forEach(function(e2) {
2482
+ n = n.replace(/%[a-z]/, e2);
2483
+ }), n;
2484
+ }
2485
+ function he(t) {
2486
+ for (var n = [], o2 = 1; o2 < arguments.length; o2++)
2487
+ n[o2 - 1] = arguments[o2];
2488
+ return false ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t, " for more information.").concat(n.length > 0 ? " Args: ".concat(n.join(", ")) : "")) : new Error(de.apply(void 0, __spreadArray([pe[t]], n, false)).trim());
2489
+ }
2490
+ var fe = function() {
2491
+ function e(e2) {
2492
+ this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = e2;
2493
+ }
2494
+ return e.prototype.indexOfGroup = function(e2) {
2495
+ for (var t = 0, n = 0; n < e2; n++)
2496
+ t += this.groupSizes[n];
2497
+ return t;
2498
+ }, e.prototype.insertRules = function(e2, t) {
2499
+ if (e2 >= this.groupSizes.length) {
2500
+ for (var n = this.groupSizes, o2 = n.length, r2 = o2; e2 >= r2; )
2501
+ if ((r2 <<= 1) < 0)
2502
+ throw he(16, "".concat(e2));
2503
+ this.groupSizes = new Uint32Array(r2), this.groupSizes.set(n), this.length = r2;
2504
+ for (var s2 = o2; s2 < r2; s2++)
2505
+ this.groupSizes[s2] = 0;
2506
+ }
2507
+ for (var i2 = this.indexOfGroup(e2 + 1), a2 = (s2 = 0, t.length); s2 < a2; s2++)
2508
+ this.tag.insertRule(i2, t[s2]) && (this.groupSizes[e2]++, i2++);
2509
+ }, e.prototype.clearGroup = function(e2) {
2510
+ if (e2 < this.length) {
2511
+ var t = this.groupSizes[e2], n = this.indexOfGroup(e2), o2 = n + t;
2512
+ this.groupSizes[e2] = 0;
2513
+ for (var r2 = n; r2 < o2; r2++)
2514
+ this.tag.deleteRule(n);
2515
+ }
2516
+ }, e.prototype.getGroup = function(e2) {
2517
+ var t = "";
2518
+ if (e2 >= this.length || 0 === this.groupSizes[e2])
2519
+ return t;
2520
+ for (var n = this.groupSizes[e2], o2 = this.indexOfGroup(e2), r2 = o2 + n, s2 = o2; s2 < r2; s2++)
2521
+ t += "".concat(this.tag.getRule(s2)).concat(g);
2522
+ return t;
2523
+ }, e;
2524
+ }();
2525
+ var me = /* @__PURE__ */ new Map();
2526
+ var ye = /* @__PURE__ */ new Map();
2527
+ var ve = 1;
2528
+ var ge = function(e) {
2529
+ if (me.has(e))
2530
+ return me.get(e);
2531
+ for (; ye.has(ve); )
2532
+ ve++;
2533
+ var t = ve++;
2534
+ if ((0 | t) < 0 || t > 1073741824)
2535
+ throw he(16, "".concat(t));
2536
+ return me.set(e, t), ye.set(t, e), t;
2537
+ };
2538
+ var Se = function(e, t) {
2539
+ ve = t + 1, me.set(e, t), ye.set(t, e);
2540
+ };
2541
+ var we = "style[".concat(f, "][").concat(y, '="').concat(v, '"]');
2542
+ var be = new RegExp("^".concat(f, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'));
2543
+ var Ee = function(e, t, n) {
2544
+ for (var o2, r2 = n.split(","), s2 = 0, i2 = r2.length; s2 < i2; s2++)
2545
+ (o2 = r2[s2]) && e.registerName(t, o2);
2546
+ };
2547
+ var Ne = function(e, t) {
2548
+ for (var n, o2 = (null !== (n = t.textContent) && void 0 !== n ? n : "").split(g), r2 = [], s2 = 0, i2 = o2.length; s2 < i2; s2++) {
2549
+ var a2 = o2[s2].trim();
2550
+ if (a2) {
2551
+ var c2 = a2.match(be);
2552
+ if (c2) {
2553
+ var l2 = 0 | parseInt(c2[1], 10), u2 = c2[2];
2554
+ 0 !== l2 && (Se(u2, l2), Ee(e, u2, c2[3]), e.getTag().insertRules(l2, r2)), r2.length = 0;
2555
+ } else
2556
+ r2.push(a2);
2557
+ }
2558
+ }
2559
+ };
2560
+ function Pe() {
2561
+ return "undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : null;
2562
+ }
2563
+ var _e = function(e) {
2564
+ var t = document.head, n = e || t, o2 = document.createElement("style"), r2 = function(e2) {
2565
+ var t2 = Array.from(e2.querySelectorAll("style[".concat(f, "]")));
2566
+ return t2[t2.length - 1];
2567
+ }(n), s2 = void 0 !== r2 ? r2.nextSibling : null;
2568
+ o2.setAttribute(f, m), o2.setAttribute(y, v);
2569
+ var i2 = Pe();
2570
+ return i2 && o2.setAttribute("nonce", i2), n.insertBefore(o2, s2), o2;
2571
+ };
2572
+ var Ce = function() {
2573
+ function e(e2) {
2574
+ this.element = _e(e2), this.element.appendChild(document.createTextNode("")), this.sheet = function(e3) {
2575
+ if (e3.sheet)
2576
+ return e3.sheet;
2577
+ for (var t = document.styleSheets, n = 0, o2 = t.length; n < o2; n++) {
2578
+ var r2 = t[n];
2579
+ if (r2.ownerNode === e3)
2580
+ return r2;
2581
+ }
2582
+ throw he(17);
2583
+ }(this.element), this.length = 0;
2584
+ }
2585
+ return e.prototype.insertRule = function(e2, t) {
2586
+ try {
2587
+ return this.sheet.insertRule(t, e2), this.length++, true;
2588
+ } catch (e3) {
2589
+ return false;
2590
+ }
2591
+ }, e.prototype.deleteRule = function(e2) {
2592
+ this.sheet.deleteRule(e2), this.length--;
2593
+ }, e.prototype.getRule = function(e2) {
2594
+ var t = this.sheet.cssRules[e2];
2595
+ return t && t.cssText ? t.cssText : "";
2596
+ }, e;
2597
+ }();
2598
+ var Ie = function() {
2599
+ function e(e2) {
2600
+ this.element = _e(e2), this.nodes = this.element.childNodes, this.length = 0;
2601
+ }
2602
+ return e.prototype.insertRule = function(e2, t) {
2603
+ if (e2 <= this.length && e2 >= 0) {
2604
+ var n = document.createTextNode(t);
2605
+ return this.element.insertBefore(n, this.nodes[e2] || null), this.length++, true;
2606
+ }
2607
+ return false;
2608
+ }, e.prototype.deleteRule = function(e2) {
2609
+ this.element.removeChild(this.nodes[e2]), this.length--;
2610
+ }, e.prototype.getRule = function(e2) {
2611
+ return e2 < this.length ? this.nodes[e2].textContent : "";
2612
+ }, e;
2613
+ }();
2614
+ var Ae = function() {
2615
+ function e(e2) {
2616
+ this.rules = [], this.length = 0;
2617
+ }
2618
+ return e.prototype.insertRule = function(e2, t) {
2619
+ return e2 <= this.length && (this.rules.splice(e2, 0, t), this.length++, true);
2620
+ }, e.prototype.deleteRule = function(e2) {
2621
+ this.rules.splice(e2, 1), this.length--;
2622
+ }, e.prototype.getRule = function(e2) {
2623
+ return e2 < this.length ? this.rules[e2] : "";
2624
+ }, e;
2625
+ }();
2626
+ var Oe = S;
2627
+ var De = { isServer: !S, useCSSOMInjection: !w };
2628
+ var Re = function() {
2629
+ function e(e2, n, o2) {
2630
+ void 0 === e2 && (e2 = C), void 0 === n && (n = {});
2631
+ var r2 = this;
2632
+ this.options = __assign(__assign({}, De), e2), this.gs = n, this.names = new Map(o2), this.server = !!e2.isServer, !this.server && S && Oe && (Oe = false, function(e3) {
2633
+ for (var t = document.querySelectorAll(we), n2 = 0, o3 = t.length; n2 < o3; n2++) {
2634
+ var r3 = t[n2];
2635
+ r3 && r3.getAttribute(f) !== m && (Ne(e3, r3), r3.parentNode && r3.parentNode.removeChild(r3));
2636
+ }
2637
+ }(this)), ue(this, function() {
2638
+ return function(e3) {
2639
+ for (var t = e3.getTag(), n2 = t.length, o3 = "", r3 = function(n3) {
2640
+ var r4 = function(e4) {
2641
+ return ye.get(e4);
2642
+ }(n3);
2643
+ if (void 0 === r4)
2644
+ return "continue";
2645
+ var s3 = e3.names.get(r4), i2 = t.getGroup(n3);
2646
+ if (void 0 === s3 || 0 === i2.length)
2647
+ return "continue";
2648
+ var a2 = "".concat(f, ".g").concat(n3, '[id="').concat(r4, '"]'), c2 = "";
2649
+ void 0 !== s3 && s3.forEach(function(e4) {
2650
+ e4.length > 0 && (c2 += "".concat(e4, ","));
2651
+ }), o3 += "".concat(i2).concat(a2, '{content:"').concat(c2, '"}').concat(g);
2652
+ }, s2 = 0; s2 < n2; s2++)
2653
+ r3(s2);
2654
+ return o3;
2655
+ }(r2);
2656
+ });
2657
+ }
2658
+ return e.registerId = function(e2) {
2659
+ return ge(e2);
2660
+ }, e.prototype.reconstructWithOptions = function(n, o2) {
2661
+ return void 0 === o2 && (o2 = true), new e(__assign(__assign({}, this.options), n), this.gs, o2 && this.names || void 0);
2662
+ }, e.prototype.allocateGSInstance = function(e2) {
2663
+ return this.gs[e2] = (this.gs[e2] || 0) + 1;
2664
+ }, e.prototype.getTag = function() {
2665
+ return this.tag || (this.tag = (e2 = function(e3) {
2666
+ var t = e3.useCSSOMInjection, n = e3.target;
2667
+ return e3.isServer ? new Ae(n) : t ? new Ce(n) : new Ie(n);
2668
+ }(this.options), new fe(e2)));
2669
+ var e2;
2670
+ }, e.prototype.hasNameForId = function(e2, t) {
2671
+ return this.names.has(e2) && this.names.get(e2).has(t);
2672
+ }, e.prototype.registerName = function(e2, t) {
2673
+ if (ge(e2), this.names.has(e2))
2674
+ this.names.get(e2).add(t);
2675
+ else {
2676
+ var n = /* @__PURE__ */ new Set();
2677
+ n.add(t), this.names.set(e2, n);
2678
+ }
2679
+ }, e.prototype.insertRules = function(e2, t, n) {
2680
+ this.registerName(e2, t), this.getTag().insertRules(ge(e2), n);
2681
+ }, e.prototype.clearNames = function(e2) {
2682
+ this.names.has(e2) && this.names.get(e2).clear();
2683
+ }, e.prototype.clearRules = function(e2) {
2684
+ this.getTag().clearGroup(ge(e2)), this.clearNames(e2);
2685
+ }, e.prototype.clearTag = function() {
2686
+ this.tag = void 0;
2687
+ }, e;
2688
+ }();
2689
+ var Te = /&/g;
2690
+ var ke = /^\s*\/\/.*$/gm;
2691
+ function je(e, t) {
2692
+ return e.map(function(e2) {
2693
+ return "rule" === e2.type && (e2.value = "".concat(t, " ").concat(e2.value), e2.value = e2.value.replaceAll(",", ",".concat(t, " ")), e2.props = e2.props.map(function(e3) {
2694
+ return "".concat(t, " ").concat(e3);
2695
+ })), Array.isArray(e2.children) && "@keyframes" !== e2.type && (e2.children = je(e2.children, t)), e2;
2696
+ });
2697
+ }
2698
+ function xe(e) {
2699
+ var t, n, o2, r2 = void 0 === e ? C : e, s2 = r2.options, i2 = void 0 === s2 ? C : s2, a2 = r2.plugins, c2 = void 0 === a2 ? _ : a2, l2 = function(e2, o3, r3) {
2700
+ return r3.startsWith(n) && r3.endsWith(n) && r3.replaceAll(n, "").length > 0 ? ".".concat(t) : e2;
2701
+ }, u2 = c2.slice();
2702
+ u2.push(function(e2) {
2703
+ e2.type === RULESET && e2.value.includes("&") && (e2.props[0] = e2.props[0].replace(Te, n).replace(o2, l2));
2704
+ }), i2.prefix && u2.push(prefixer), u2.push(stringify);
2705
+ var p2 = function(e2, r3, s3, a3) {
2706
+ void 0 === r3 && (r3 = ""), void 0 === s3 && (s3 = ""), void 0 === a3 && (a3 = "&"), t = a3, n = r3, o2 = new RegExp("\\".concat(n, "\\b"), "g");
2707
+ var c3 = e2.replace(ke, ""), l3 = compile(s3 || r3 ? "".concat(s3, " ").concat(r3, " { ").concat(c3, " }") : c3);
2708
+ i2.namespace && (l3 = je(l3, i2.namespace));
2709
+ var p3 = [];
2710
+ return serialize(l3, middleware(u2.concat(rulesheet(function(e3) {
2711
+ return p3.push(e3);
2712
+ })))), p3;
2713
+ };
2714
+ return p2.hash = c2.length ? c2.reduce(function(e2, t2) {
2715
+ return t2.name || he(15), M(e2, t2.name);
2716
+ }, F).toString() : "", p2;
2717
+ }
2718
+ var Ve = new Re();
2719
+ var Fe = xe();
2720
+ var Me = o.createContext({ shouldForwardProp: void 0, styleSheet: Ve, stylis: Fe });
2721
+ var $e = Me.Consumer;
2722
+ var ze = o.createContext(void 0);
2723
+ function Be() {
2724
+ return c(Me);
2725
+ }
2726
+ function Le(e) {
2727
+ var t = s(e.stylisPlugins), n = t[0], r2 = t[1], c2 = Be().styleSheet, l2 = i(function() {
2728
+ var t2 = c2;
2729
+ return e.sheet ? t2 = e.sheet : e.target && (t2 = t2.reconstructWithOptions({ target: e.target }, false)), e.disableCSSOMInjection && (t2 = t2.reconstructWithOptions({ useCSSOMInjection: false })), t2;
2730
+ }, [e.disableCSSOMInjection, e.sheet, e.target, c2]), u2 = i(function() {
2731
+ return xe({ options: { namespace: e.namespace, prefix: e.enableVendorPrefixes }, plugins: n });
2732
+ }, [e.enableVendorPrefixes, e.namespace, n]);
2733
+ a(function() {
2734
+ (0, import_shallowequal.default)(n, e.stylisPlugins) || r2(e.stylisPlugins);
2735
+ }, [e.stylisPlugins]);
2736
+ var d = i(function() {
2737
+ return { shouldForwardProp: e.shouldForwardProp, styleSheet: l2, stylis: u2 };
2738
+ }, [e.shouldForwardProp, l2, u2]);
2739
+ return o.createElement(Me.Provider, { value: d }, o.createElement(ze.Provider, { value: u2 }, e.children));
2740
+ }
2741
+ var Ge = function() {
2742
+ function e(e2, t) {
2743
+ var n = this;
2744
+ this.inject = function(e3, t2) {
2745
+ void 0 === t2 && (t2 = Fe);
2746
+ var o2 = n.name + t2.hash;
2747
+ e3.hasNameForId(n.id, o2) || e3.insertRules(n.id, o2, t2(n.rules, o2, "@keyframes"));
2748
+ }, this.name = e2, this.id = "sc-keyframes-".concat(e2), this.rules = t, ue(this, function() {
2749
+ throw he(12, String(n.name));
2750
+ });
2751
+ }
2752
+ return e.prototype.getName = function(e2) {
2753
+ return void 0 === e2 && (e2 = Fe), this.name + e2.hash;
2754
+ }, e;
2755
+ }();
2756
+ var Ye = function(e) {
2757
+ return e >= "A" && e <= "Z";
2758
+ };
2759
+ function We(e) {
2760
+ for (var t = "", n = 0; n < e.length; n++) {
2761
+ var o2 = e[n];
2762
+ if (1 === n && "-" === o2 && "-" === e[0])
2763
+ return e;
2764
+ Ye(o2) ? t += "-" + o2.toLowerCase() : t += o2;
2765
+ }
2766
+ return t.startsWith("ms-") ? "-" + t : t;
2767
+ }
2768
+ var qe = function(e) {
2769
+ return null == e || false === e || "" === e;
2770
+ };
2771
+ var He = function(t) {
2772
+ var n, o2, r2 = [];
2773
+ for (var s2 in t) {
2774
+ var i2 = t[s2];
2775
+ t.hasOwnProperty(s2) && !qe(i2) && (Array.isArray(i2) && i2.isCss || re(i2) ? r2.push("".concat(We(s2), ":"), i2, ";") : ce(i2) ? r2.push.apply(r2, __spreadArray(__spreadArray(["".concat(s2, " {")], He(i2), false), ["}"], false)) : r2.push("".concat(We(s2), ": ").concat((n = s2, null == (o2 = i2) || "boolean" == typeof o2 || "" === o2 ? "" : "number" != typeof o2 || 0 === o2 || n in emotion_unitless_esm_default || n.startsWith("--") ? String(o2).trim() : "".concat(o2, "px")), ";")));
2776
+ }
2777
+ return r2;
2778
+ };
2779
+ function Ue(e, t, n, o2) {
2780
+ if (qe(e))
2781
+ return [];
2782
+ if (se(e))
2783
+ return [".".concat(e.styledComponentId)];
2784
+ if (re(e)) {
2785
+ if (!re(s2 = e) || s2.prototype && s2.prototype.isReactComponent || !t)
2786
+ return [e];
2787
+ var r2 = e(t);
2788
+ return "object" != typeof r2 || Array.isArray(r2) || r2 instanceof Ge || ce(r2) || null === r2 || console.error("".concat(B(e), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), Ue(r2, t, n, o2);
2789
+ }
2790
+ var s2;
2791
+ return e instanceof Ge ? n ? (e.inject(n, o2), [e.getName(o2)]) : [e] : ce(e) ? He(e) : Array.isArray(e) ? Array.prototype.concat.apply(_, e.map(function(e2) {
2792
+ return Ue(e2, t, n, o2);
2793
+ })) : [e.toString()];
2794
+ }
2795
+ function Je(e) {
2796
+ for (var t = 0; t < e.length; t += 1) {
2797
+ var n = e[t];
2798
+ if (re(n) && !se(n))
2799
+ return false;
2800
+ }
2801
+ return true;
2802
+ }
2803
+ var Xe = $(v);
2804
+ var Ze = function() {
2805
+ function e(e2, t, n) {
2806
+ this.rules = e2, this.staticRulesId = "", this.isStatic = false, this.componentId = t, this.baseHash = M(Xe, t), this.baseStyle = n, Re.registerId(t);
2807
+ }
2808
+ return e.prototype.generateAndInjectStyles = function(e2, t, n) {
2809
+ var o2 = this.baseStyle ? this.baseStyle.generateAndInjectStyles(e2, t, n) : "";
2810
+ if (this.isStatic && !n.hash)
2811
+ if (this.staticRulesId && t.hasNameForId(this.componentId, this.staticRulesId))
2812
+ o2 = ie(o2, this.staticRulesId);
2813
+ else {
2814
+ var r2 = ae(Ue(this.rules, e2, t, n)), s2 = x(M(this.baseHash, r2) >>> 0);
2815
+ if (!t.hasNameForId(this.componentId, s2)) {
2816
+ var i2 = n(r2, ".".concat(s2), void 0, this.componentId);
2817
+ t.insertRules(this.componentId, s2, i2);
2818
+ }
2819
+ o2 = ie(o2, s2), this.staticRulesId = s2;
2820
+ }
2821
+ else {
2822
+ for (var a2 = M(this.baseHash, n.hash), c2 = "", l2 = 0; l2 < this.rules.length; l2++) {
2823
+ var u2 = this.rules[l2];
2824
+ if ("string" == typeof u2)
2825
+ c2 += u2, a2 = M(a2, u2);
2826
+ else if (u2) {
2827
+ var p2 = ae(Ue(u2, e2, t, n));
2828
+ a2 = M(a2, p2 + l2), c2 += p2;
2829
+ }
2830
+ }
2831
+ if (c2) {
2832
+ var d = x(a2 >>> 0);
2833
+ t.hasNameForId(this.componentId, d) || t.insertRules(this.componentId, d, n(c2, ".".concat(d), void 0, this.componentId)), o2 = ie(o2, d);
2834
+ }
2835
+ }
2836
+ return o2;
2837
+ }, e;
2838
+ }();
2839
+ var Ke = o.createContext(void 0);
2840
+ var Qe = Ke.Consumer;
2841
+ var nt = {};
2842
+ var ot = /* @__PURE__ */ new Set();
2843
+ function rt(e, r2, s2) {
2844
+ var i2 = se(e), a2 = e, c2 = !L(e), p2 = r2.attrs, d = void 0 === p2 ? _ : p2, h = r2.componentId, f2 = void 0 === h ? function(e2, t) {
2845
+ var n = "string" != typeof e2 ? "sc" : R(e2);
2846
+ nt[n] = (nt[n] || 0) + 1;
2847
+ var o2 = "".concat(n, "-").concat(z(v + n + nt[n]));
2848
+ return t ? "".concat(t, "-").concat(o2) : o2;
2849
+ }(r2.displayName, r2.parentComponentId) : h, m2 = r2.displayName, y2 = void 0 === m2 ? function(e2) {
2850
+ return L(e2) ? "styled.".concat(e2) : "Styled(".concat(B(e2), ")");
2851
+ }(e) : m2, g2 = r2.displayName && r2.componentId ? "".concat(R(r2.displayName), "-").concat(r2.componentId) : r2.componentId || f2, S2 = i2 && a2.attrs ? a2.attrs.concat(d).filter(Boolean) : d, w2 = r2.shouldForwardProp;
2852
+ if (i2 && a2.shouldForwardProp) {
2853
+ var b = a2.shouldForwardProp;
2854
+ if (r2.shouldForwardProp) {
2855
+ var E2 = r2.shouldForwardProp;
2856
+ w2 = function(e2, t) {
2857
+ return b(e2, t) && E2(e2, t);
2858
+ };
2859
+ } else
2860
+ w2 = b;
2861
+ }
2862
+ var N2 = new Ze(s2, g2, i2 ? a2.componentStyle : void 0);
2863
+ function O2(e2, r3) {
2864
+ return function(e3, r4, s3) {
2865
+ var i3 = e3.attrs, a3 = e3.componentStyle, c3 = e3.defaultProps, p3 = e3.foldedComponentIds, d2 = e3.styledComponentId, h2 = e3.target, f3 = o.useContext(Ke), m3 = Be(), y3 = e3.shouldForwardProp || m3.shouldForwardProp;
2866
+ l(d2);
2867
+ var v2 = I(r4, f3, c3) || C, g3 = function(e4, n, o2) {
2868
+ for (var r5, s4 = __assign(__assign({}, n), { className: void 0, theme: o2 }), i4 = 0; i4 < e4.length; i4 += 1) {
2869
+ var a4 = re(r5 = e4[i4]) ? r5(s4) : r5;
2870
+ for (var c4 in a4)
2871
+ s4[c4] = "className" === c4 ? ie(s4[c4], a4[c4]) : "style" === c4 ? __assign(__assign({}, s4[c4]), a4[c4]) : a4[c4];
2872
+ }
2873
+ return n.className && (s4.className = ie(s4.className, n.className)), s4;
2874
+ }(i3, r4, v2), S3 = g3.as || h2, w3 = {};
2875
+ for (var b2 in g3)
2876
+ void 0 === g3[b2] || "$" === b2[0] || "as" === b2 || "theme" === b2 && g3.theme === v2 || ("forwardedAs" === b2 ? w3.as = g3.forwardedAs : y3 && !y3(b2, S3) || (w3[b2] = g3[b2], y3 || false || isPropValid(b2) || ot.has(b2) || !A.has(S3) || (ot.add(b2), console.warn('styled-components: it looks like an unknown prop "'.concat(b2, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
2877
+ var E3 = function(e4, t) {
2878
+ var n = Be(), o2 = e4.generateAndInjectStyles(t, n.styleSheet, n.stylis);
2879
+ return l(o2), o2;
2880
+ }(a3, g3);
2881
+ e3.warnTooManyClasses && e3.warnTooManyClasses(E3);
2882
+ var N3 = ie(p3, d2);
2883
+ return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[L(S3) && !A.has(S3) ? "class" : "className"] = N3, w3.ref = s3, u(S3, w3);
2884
+ }(D2, e2, r3);
2885
+ }
2886
+ O2.displayName = y2;
2887
+ var D2 = o.forwardRef(O2);
2888
+ return D2.attrs = S2, D2.componentStyle = N2, D2.displayName = y2, D2.shouldForwardProp = w2, D2.foldedComponentIds = i2 ? ie(a2.foldedComponentIds, a2.styledComponentId) : "", D2.styledComponentId = g2, D2.target = i2 ? a2.target : e, Object.defineProperty(D2, "defaultProps", { get: function() {
2889
+ return this._foldedDefaultProps;
2890
+ }, set: function(e2) {
2891
+ this._foldedDefaultProps = i2 ? function(e3) {
2892
+ for (var t = [], n = 1; n < arguments.length; n++)
2893
+ t[n - 1] = arguments[n];
2894
+ for (var o2 = 0, r3 = t; o2 < r3.length; o2++)
2895
+ le(e3, r3[o2], true);
2896
+ return e3;
2897
+ }({}, a2.defaultProps, e2) : e2;
2898
+ } }), P(y2, g2), D2.warnTooManyClasses = /* @__PURE__ */ function(e2, t) {
2899
+ var n = {}, o2 = false;
2900
+ return function(r3) {
2901
+ if (!o2 && (n[r3] = true, Object.keys(n).length >= 200)) {
2902
+ var s3 = t ? ' with the id of "'.concat(t, '"') : "";
2903
+ console.warn("Over ".concat(200, " classes were generated for component ").concat(e2).concat(s3, ".\n") + "Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"), o2 = true, n = {};
2904
+ }
2905
+ };
2906
+ }(y2, g2), ue(D2, function() {
2907
+ return ".".concat(D2.styledComponentId);
2908
+ }), c2 && oe(D2, e, { attrs: true, componentStyle: true, displayName: true, foldedComponentIds: true, shouldForwardProp: true, styledComponentId: true, target: true }), D2;
2909
+ }
2910
+ function st(e, t) {
2911
+ for (var n = [e[0]], o2 = 0, r2 = t.length; o2 < r2; o2 += 1)
2912
+ n.push(t[o2], e[o2 + 1]);
2913
+ return n;
2914
+ }
2915
+ var it = function(e) {
2916
+ return Object.assign(e, { isCss: true });
2917
+ };
2918
+ function at(t) {
2919
+ for (var n = [], o2 = 1; o2 < arguments.length; o2++)
2920
+ n[o2 - 1] = arguments[o2];
2921
+ if (re(t) || ce(t))
2922
+ return it(Ue(st(_, __spreadArray([t], n, true))));
2923
+ var r2 = t;
2924
+ return 0 === n.length && 1 === r2.length && "string" == typeof r2[0] ? Ue(r2) : it(Ue(st(r2, n)));
2925
+ }
2926
+ function ct(n, o2, r2) {
2927
+ if (void 0 === r2 && (r2 = C), !o2)
2928
+ throw he(1, o2);
2929
+ var s2 = function(t) {
2930
+ for (var s3 = [], i2 = 1; i2 < arguments.length; i2++)
2931
+ s3[i2 - 1] = arguments[i2];
2932
+ return n(o2, r2, at.apply(void 0, __spreadArray([t], s3, false)));
2933
+ };
2934
+ return s2.attrs = function(e) {
2935
+ return ct(n, o2, __assign(__assign({}, r2), { attrs: Array.prototype.concat(r2.attrs, e).filter(Boolean) }));
2936
+ }, s2.withConfig = function(e) {
2937
+ return ct(n, o2, __assign(__assign({}, r2), e));
2938
+ }, s2;
2939
+ }
2940
+ var lt = function(e) {
2941
+ return ct(rt, e);
2942
+ };
2943
+ var ut = lt;
2944
+ A.forEach(function(e) {
2945
+ ut[e] = lt(e);
2946
+ });
2947
+ var pt = function() {
2948
+ function e(e2, t) {
2949
+ this.rules = e2, this.componentId = t, this.isStatic = Je(e2), Re.registerId(this.componentId + 1);
2950
+ }
2951
+ return e.prototype.createStyles = function(e2, t, n, o2) {
2952
+ var r2 = o2(ae(Ue(this.rules, t, n, o2)), ""), s2 = this.componentId + e2;
2953
+ n.insertRules(s2, s2, r2);
2954
+ }, e.prototype.removeStyles = function(e2, t) {
2955
+ t.clearRules(this.componentId + e2);
2956
+ }, e.prototype.renderStyles = function(e2, t, n, o2) {
2957
+ e2 > 2 && Re.registerId(this.componentId + e2), this.removeStyles(e2, n), this.createStyles(e2, t, n, o2);
2958
+ }, e;
2959
+ }();
2960
+ var mt = function() {
2961
+ function e() {
2962
+ var e2 = this;
2963
+ this._emitSheetCSS = function() {
2964
+ var t = e2.instance.toString(), n = Pe(), o2 = ae([n && 'nonce="'.concat(n, '"'), "".concat(f, '="true"'), "".concat(y, '="').concat(v, '"')].filter(Boolean), " ");
2965
+ return "<style ".concat(o2, ">").concat(t, "</style>");
2966
+ }, this.getStyleTags = function() {
2967
+ if (e2.sealed)
2968
+ throw he(2);
2969
+ return e2._emitSheetCSS();
2970
+ }, this.getStyleElement = function() {
2971
+ var n;
2972
+ if (e2.sealed)
2973
+ throw he(2);
2974
+ var r2 = ((n = {})[f] = "", n[y] = v, n.dangerouslySetInnerHTML = { __html: e2.instance.toString() }, n), s2 = Pe();
2975
+ return s2 && (r2.nonce = s2), [o.createElement("style", __assign({}, r2, { key: "sc-0-0" }))];
2976
+ }, this.seal = function() {
2977
+ e2.sealed = true;
2978
+ }, this.instance = new Re({ isServer: true }), this.sealed = false;
2979
+ }
2980
+ return e.prototype.collectStyles = function(e2) {
2981
+ if (this.sealed)
2982
+ throw he(2);
2983
+ return o.createElement(Le, { sheet: this.instance }, e2);
2984
+ }, e.prototype.interleaveWithNodeStream = function(e2) {
2985
+ throw he(3);
2986
+ }, e;
2987
+ }();
2988
+ "undefined" != typeof navigator && "ReactNative" === navigator.product && console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");
2989
+ var vt = "__sc-".concat(f, "__");
2990
+ "undefined" != typeof window && (window[vt] || (window[vt] = 0), 1 === window[vt] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[vt] += 1);
2991
+
2992
+ // ../../packages/ui/madoc/components/icons/CloseIcon.tsx
2993
+ import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
2994
+ var CloseIcon = ut((props) => /* @__PURE__ */ jsxs14("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", ...props, children: [
2995
+ /* @__PURE__ */ jsx22("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }),
2996
+ /* @__PURE__ */ jsx22("path", { d: "M0 0h24v24H0z", fill: "none" })
2997
+ ] }))`
2998
+ fill: rgba(0, 0, 0, 0.5);
2999
+ cursor: pointer;
3000
+ &:hover {
3001
+ fill: rgba(0, 0, 0, 1);
3002
+ }
3003
+ ${(props) => props.disabled ? at`
3004
+ pointer-events: none;
3005
+ opacity: 0.6;
3006
+ ` : ""}
3007
+
3008
+ ${(props) => props.$solid && at`
3009
+ fill: #000;
3010
+ `}
3011
+ `;
3012
+
3013
+ // src/components/TourNormalAnnotationEditor.tsx
3014
+ import { useState as useState3 } from "react";
3015
+ import { useAnnotation as useAnnotation5, useAnnotationPage as useAnnotationPage2 } from "react-iiif-vault";
3016
+
3017
+ // src/components/HTMLAnnotationBodyRender.tsx
3018
+ import { useAnnotation as useAnnotation3 } from "react-iiif-vault";
3019
+ import { jsx as jsx23 } from "react/jsx-runtime";
3020
+ function HTMLAnnotationBodyRender({
3021
+ className,
3022
+ locale
3023
+ }) {
3024
+ const annotation = useAnnotation3();
3025
+ const filteredBodies = locale && annotation ? annotation?.body.filter((body) => {
3026
+ const language = Array.isArray(body.language) ? body.language[0] : body.language;
3027
+ return language === locale;
3028
+ }) : annotation?.body || [];
3029
+ const bodiesToRender = filteredBodies.length ? filteredBodies : locale ? [(annotation?.body || [])[0]] : annotation?.body || [];
3030
+ return /* @__PURE__ */ jsx23("div", { className, children: bodiesToRender.map((body, idx) => {
3031
+ return /* @__PURE__ */ jsx23(
3032
+ "div",
3033
+ {
3034
+ className: "prose-headings:mt-1 prose-headings:mb-1 prose-sm leading-normal",
3035
+ children: /* @__PURE__ */ jsx23("div", { dangerouslySetInnerHTML: { __html: body.value } })
3036
+ },
3037
+ idx
3038
+ );
3039
+ }) });
3040
+ }
3041
+
3042
+ // src/components/HTMLAnnotationEditor.tsx
3043
+ import { ActionButton as ActionButton6 } from "@manifest-editor/components";
3044
+ import { useGenericEditor as useGenericEditor5, useInlineCreator as useInlineCreator2 } from "@manifest-editor/shell";
3045
+ import { useAnnotation as useAnnotation4 } from "react-iiif-vault";
3046
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
3047
+ function HTMLAnnotationEditor() {
3048
+ const annotation = useAnnotation4();
3049
+ const creator = useInlineCreator2();
3050
+ const bodies = annotation?.body || [];
3051
+ const editor = useGenericEditor5(annotation);
3052
+ if (!annotation) {
3053
+ return null;
3054
+ }
3055
+ return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4", children: [
3056
+ bodies.map((body, n) => {
3057
+ return /* @__PURE__ */ jsx24(
3058
+ AnnotationBodyEditor,
3059
+ {
3060
+ resourceId: body.id,
3061
+ onRemove: () => editor.annotation.body.deleteAtIndex(n)
3062
+ },
3063
+ n
3064
+ );
3065
+ }),
3066
+ /* @__PURE__ */ jsx24("div", { className: "", children: /* @__PURE__ */ jsx24(
3067
+ ActionButton6,
3068
+ {
3069
+ primary: true,
3070
+ onPress: () => {
3071
+ creator.create(
3072
+ "@manifest-editor/html-body-creator",
3073
+ { language: "en", value: "" },
3074
+ {
3075
+ targetType: "ContentResource",
3076
+ parent: {
3077
+ property: "body",
3078
+ resource: {
3079
+ id: annotation.id,
3080
+ type: "Annotation"
3081
+ }
3082
+ },
3083
+ initialData: {}
3084
+ }
3085
+ );
3086
+ },
3087
+ children: "Add new translation"
3088
+ }
3089
+ ) })
3090
+ ] });
3091
+ }
3092
+
3093
+ // src/components/TourNormalAnnotationEditor.tsx
3094
+ import { Fragment as Fragment3, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
3095
+ function TourNormalAnnotationEditor({
3096
+ highlightProps
3097
+ }) {
3098
+ const annotation = useAnnotation5();
3099
+ const editor = useGenericEditor6(annotation);
3100
+ const pageEditor = useGenericEditor6(useAnnotationPage2());
3101
+ const target = editor.annotation.target.getParsedSelector();
3102
+ const { requestAnnotation, isPending, cancelRequest, busy } = useRequestAnnotation({
3103
+ onSuccess: (resp) => {
3104
+ if (resp.target) {
3105
+ editor.annotation.target.setSelector(resp.target);
3106
+ }
3107
+ }
3108
+ });
3109
+ function requestAnnotationFromTarget() {
3110
+ if (target) {
3111
+ if (target.type === "SvgSelector") {
3112
+ return requestAnnotation({
3113
+ type: "polygon",
3114
+ open: false,
3115
+ points: target.points
3116
+ });
3117
+ }
3118
+ if (target.type === "PointSelector") {
3119
+ return requestAnnotation({
3120
+ type: "polygon",
3121
+ open: true,
3122
+ points: target.points
3123
+ });
3124
+ }
3125
+ if (target.type === "BoxSelector") {
3126
+ const p2 = target.spatial;
3127
+ return requestAnnotation({
3128
+ type: "polygon",
3129
+ open: false,
3130
+ points: [
3131
+ [p2.x, p2.y],
3132
+ [p2.x + p2.width, p2.y],
3133
+ [p2.x + p2.width, p2.y + p2.height],
3134
+ [p2.x, p2.y + p2.height]
3135
+ ]
3136
+ });
3137
+ }
3138
+ }
3139
+ return requestAnnotation({ type: "polygon", open: true, points: [] });
3140
+ }
3141
+ const deleteAnnotation = () => {
3142
+ if (annotation && confirm("Are you sure you want to delete this annotation?")) {
3143
+ const index = pageEditor.structural.items.getWithoutTracking().findIndex((item) => item.id === annotation.id);
3144
+ pageEditor.structural.items.deleteAtIndex(index);
3145
+ }
3146
+ };
3147
+ const [isOpen, setIsOpen] = useState3(false);
3148
+ return /* @__PURE__ */ jsxs16(
3149
+ "div",
3150
+ {
3151
+ ...highlightProps,
3152
+ className: "border border-gray-300 p-3 hover:border-me-500 shadow-sm rounded bg-white relative",
3153
+ children: [
3154
+ /* @__PURE__ */ jsxs16("div", { className: "absolute top-1 right-1 z-20 flex gap-2", children: [
3155
+ /* @__PURE__ */ jsx25(ActionButton7, { onPress: () => deleteAnnotation(), children: /* @__PURE__ */ jsx25(DeleteForeverIcon, {}) }),
3156
+ /* @__PURE__ */ jsx25(ActionButton7, { onPress: () => setIsOpen((o2) => !o2), children: isOpen ? /* @__PURE__ */ jsx25(CloseIcon, {}) : /* @__PURE__ */ jsx25(ListEditIcon2, {}) })
3157
+ ] }),
3158
+ /* @__PURE__ */ jsxs16("div", { className: "mb-2 relative", children: [
3159
+ isOpen ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
3160
+ /* @__PURE__ */ jsx25("h3", { className: "text-lg font-semibold border-b pt-1 pb-2 mb-2", children: "Edit step" }),
3161
+ /* @__PURE__ */ jsx25(HTMLAnnotationEditor, {})
3162
+ ] }) : /* @__PURE__ */ jsx25(Fragment3, { children: /* @__PURE__ */ jsx25(
3163
+ HTMLAnnotationBodyRender,
3164
+ {
3165
+ className: "line-clamp-3 prose-p:text-slate-600",
3166
+ locale: "en"
3167
+ }
3168
+ ) }),
3169
+ !isOpen ? /* @__PURE__ */ jsx25("div", { children: isPending ? /* @__PURE__ */ jsx25(ActionButton7, { onPress: cancelRequest, children: "Discard changes" }) : /* @__PURE__ */ jsx25(
3170
+ ActionButton7,
3171
+ {
3172
+ isDisabled: busy,
3173
+ onPress: requestAnnotationFromTarget,
3174
+ children: "Edit region"
3175
+ }
3176
+ ) }) : null
3177
+ ] }),
3178
+ /* @__PURE__ */ jsx25("div", { className: "absolute -bottom-5 h-5 border-l-2 border-gray-300 w-0" })
3179
+ ]
3180
+ }
3181
+ );
3182
+ }
3183
+
3184
+ // src/components/TourPaintingAnnotationEditor.tsx
3185
+ import { ActionButton as ActionButton8, DeleteForeverIcon as DeleteForeverIcon2 } from "@manifest-editor/components";
3186
+ import { LanguageMapEditor as LanguageMapEditor3 } from "@manifest-editor/editors";
3187
+ import { ListEditIcon as ListEditIcon3 } from "@manifest-editor/manifest-preset/components";
3188
+ import { useGenericEditor as useGenericEditor7, useLayoutActions as useLayoutActions5 } from "@manifest-editor/shell";
3189
+ import { useState as useState4 } from "react";
3190
+ import {
3191
+ LocaleString as LocaleString5,
3192
+ useAnnotation as useAnnotation6,
3193
+ useAnnotationPage as useAnnotationPage3
3194
+ } from "react-iiif-vault";
3195
+ import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
3196
+ function TourPaintingAnnotationEditor({
3197
+ originalAnnotationId,
3198
+ highlightProps
3199
+ }) {
3200
+ const page = useAnnotationPage3();
3201
+ const pageEditor = useGenericEditor7(page);
3202
+ const annotation = useAnnotation6();
3203
+ const { edit } = useLayoutActions5();
3204
+ const [isOpen, setIsOpen] = useState4(false);
3205
+ const deleteAnnotation = () => {
3206
+ if (originalAnnotationId && confirm("Are you sure you want to delete this annotation?")) {
3207
+ const index = pageEditor.structural.items.getWithoutTracking().findIndex((item) => item.id === originalAnnotationId);
3208
+ pageEditor.structural.items.deleteAtIndex(index);
3209
+ }
3210
+ };
3211
+ return /* @__PURE__ */ jsxs17(
3212
+ "div",
3213
+ {
3214
+ ...highlightProps,
3215
+ className: "border border-gray-300 hover:border-me-500 shadow-sm rounded p-3 bg-white relative",
3216
+ children: [
3217
+ /* @__PURE__ */ jsxs17("div", { className: "absolute top-1 right-1 z-20 flex gap-2", children: [
3218
+ /* @__PURE__ */ jsx26(ActionButton8, { onPress: () => deleteAnnotation(), children: /* @__PURE__ */ jsx26(DeleteForeverIcon2, {}) }),
3219
+ /* @__PURE__ */ jsx26(ActionButton8, { onPress: () => setIsOpen((o2) => !o2), children: isOpen ? /* @__PURE__ */ jsx26(CloseIcon, {}) : /* @__PURE__ */ jsx26(ListEditIcon3, {}) })
3220
+ ] }),
3221
+ /* @__PURE__ */ jsx26("div", { className: "flex gap-2 mb-2", children: /* @__PURE__ */ jsx26("div", { className: "flex-1 min-w-0", children: isOpen ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
3222
+ /* @__PURE__ */ jsx26("h3", { className: "text-lg font-semibold border-b pt-1 pb-2 mb-2", children: "Edit step" }),
3223
+ /* @__PURE__ */ jsx26(LanguageMapEditor3, { dispatchType: "label" }),
3224
+ /* @__PURE__ */ jsx26(LanguageMapEditor3, { dispatchType: "summary" })
3225
+ ] }) : /* @__PURE__ */ jsxs17(Fragment4, { children: [
3226
+ /* @__PURE__ */ jsx26(
3227
+ LocaleString5,
3228
+ {
3229
+ as: "div",
3230
+ className: "whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden",
3231
+ children: annotation?.label
3232
+ }
3233
+ ),
3234
+ /* @__PURE__ */ jsx26(
3235
+ LocaleString5,
3236
+ {
3237
+ className: "text-gray-500 text-sm bg-white line-clamp-2",
3238
+ as: "div",
3239
+ children: annotation?.label
3240
+ }
3241
+ )
3242
+ ] }) }) }),
3243
+ /* @__PURE__ */ jsx26(ActionButton8, { onPress: () => edit(annotation), children: "Edit target annotation" }),
3244
+ /* @__PURE__ */ jsx26("div", { className: "absolute -bottom-5 h-8 -z-10 border-l-2 border-gray-300 w-0" })
3245
+ ]
3246
+ }
3247
+ );
3248
+ }
3249
+
3250
+ // src/components/TourAnnotationEditor.tsx
3251
+ import { jsx as jsx27 } from "react/jsx-runtime";
3252
+ function TourAnnotationEditor() {
3253
+ const [annotation, { annotationTarget, highlightProps }] = useAnnotationInfo();
3254
+ const resource = useMemo(() => {
3255
+ if (annotationTarget) {
3256
+ return { id: annotationTarget, type: "Annotation" };
3257
+ }
3258
+ return { id: annotation?.id, type: "Annotation" };
3259
+ }, [annotation?.id, annotationTarget]);
3260
+ if (annotationTarget) {
3261
+ return /* @__PURE__ */ jsx27(ResourceEditingProvider3, { resource, children: /* @__PURE__ */ jsx27(AnnotationContext3, { annotation: annotationTarget, children: /* @__PURE__ */ jsx27(
3262
+ TourPaintingAnnotationEditor,
3263
+ {
3264
+ originalAnnotationId: annotation?.id,
3265
+ highlightProps
3266
+ }
3267
+ ) }) });
3268
+ }
3269
+ return /* @__PURE__ */ jsx27(ResourceEditingProvider3, { resource, children: /* @__PURE__ */ jsx27(TourNormalAnnotationEditor, { highlightProps }) });
3270
+ }
3271
+
3272
+ // src/components/TourAnnotationPageEditor.tsx
3273
+ import { Fragment as Fragment5, jsx as jsx28 } from "react/jsx-runtime";
3274
+ function TourAnnotationPageEditor({
3275
+ reorderable = false
3276
+ }) {
3277
+ const page = useAnnotationPage4();
3278
+ const editor = useGenericEditor8(page);
3279
+ if (!page) {
3280
+ return null;
3281
+ }
3282
+ if (!reorderable) {
3283
+ return /* @__PURE__ */ jsx28(Fragment5, { children: page.items.map((annotation) => /* @__PURE__ */ jsx28(AnnotationContext4, { annotation: annotation.id, children: /* @__PURE__ */ jsx28(TourAnnotationEditor, {}) }, annotation.id)) });
3284
+ }
3285
+ return /* @__PURE__ */ jsx28(Fragment5, { children: /* @__PURE__ */ jsx28(
3286
+ ReorderList,
3287
+ {
3288
+ id: page.id,
3289
+ marginBottom: "0.5em",
3290
+ items: page.items || [],
3291
+ inlineHandle: false,
3292
+ reorder: ({ startIndex, endIndex }) => editor.structural.items.reorder(startIndex, endIndex),
3293
+ renderItem: (ref, index) => /* @__PURE__ */ jsx28(AnnotationContext4, { annotation: ref.id, children: /* @__PURE__ */ jsx28(TourAnnotationEditor, {}) })
3294
+ }
3295
+ ) });
3296
+ }
3297
+
3298
+ // src/right-panels/ExhibitionTourSteps.tsx
3299
+ import { Fragment as Fragment6, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
3300
+ var exhibitionTourSteps = {
3301
+ id: "@exhibition/tour-steps",
3302
+ supports: {
3303
+ edit: true,
3304
+ properties: ["annotations"],
3305
+ resourceTypes: ["Canvas"],
3306
+ custom: ({ resource }, vault) => {
3307
+ const full = vault.get(resource);
3308
+ const stats = getGridStats(full.behavior);
3309
+ if (full.type === "Canvas" && !stats.isInfo && !stats.isBottom) {
3310
+ return true;
3311
+ }
3312
+ return false;
3313
+ }
3314
+ },
3315
+ label: "Tour steps",
3316
+ component: () => /* @__PURE__ */ jsx29(ExhibitionRightPanelOptionalPage, {})
3317
+ };
3318
+ function ExhibitionRightPanelOptionalPage() {
3319
+ const canvas = useCanvas10();
3320
+ const firstAnnotationPage = canvas?.annotations[0];
3321
+ const itemsAnnotationPage = canvas?.items[0];
3322
+ if (!firstAnnotationPage || !canvas || !itemsAnnotationPage) {
3323
+ return /* @__PURE__ */ jsx29(PromptCreationOfTourSteps, {});
3324
+ }
3325
+ return /* @__PURE__ */ jsx29(ExhibitionRightPanel3, {});
3326
+ }
3327
+ function PromptCreationOfTourSteps() {
3328
+ const canvas = useCanvas10();
3329
+ const creator = useInlineCreator3();
3330
+ const createEmptyAnnotationPage = () => {
3331
+ if (!canvas)
3332
+ return;
3333
+ creator.create(
3334
+ "@manifest-editor/empty-annotation-page",
3335
+ {
3336
+ label: { en: ["Tour steps"] }
3337
+ },
3338
+ {
3339
+ target: {
3340
+ id: canvas.id,
3341
+ type: "Canvas"
3342
+ },
3343
+ targetType: "AnnotationPage",
3344
+ parent: {
3345
+ property: "annotations",
3346
+ resource: {
3347
+ id: canvas.id,
3348
+ type: "Canvas"
3349
+ }
3350
+ }
3351
+ }
3352
+ );
3353
+ };
3354
+ return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center justify-center p-4", children: [
3355
+ /* @__PURE__ */ jsx29("div", { className: "p-4 opacity-50 text-center", children: "This image does not yet have a tour." }),
3356
+ /* @__PURE__ */ jsx29(
3357
+ Button2,
3358
+ {
3359
+ className: "border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500",
3360
+ onPress: () => createEmptyAnnotationPage(),
3361
+ children: "Create Tour"
3362
+ }
3363
+ )
3364
+ ] });
3365
+ }
3366
+ function ExhibitionRightPanel3() {
3367
+ const canvas = useCanvas10();
3368
+ const firstAnnotationPage = canvas?.annotations[0];
3369
+ const itemsAnnotationPage = canvas?.items[0];
3370
+ const editor = useGenericEditor9(firstAnnotationPage);
3371
+ const creator = useInlineCreator3();
3372
+ const [reorderable, setReorderable] = useState5(false);
3373
+ const { requestAnnotation, isPending, busy, cancelRequest, completeRequest } = useRequestAnnotation2({
3374
+ onSuccess: (resp) => {
3375
+ if (!resp.cancelled && resp.target && firstAnnotationPage) {
3376
+ creator.create(
3377
+ "@manifest-editor/html-annotation",
3378
+ {
3379
+ label: { en: ["Tour step"] },
3380
+ body: { en: ["<h2>New step</h2><p>Description</p>"] },
3381
+ motivation: "describing"
3382
+ },
3383
+ {
3384
+ target: {
3385
+ id: canvas.id,
3386
+ type: "Canvas"
3387
+ },
3388
+ targetType: "Annotation",
3389
+ parent: {
3390
+ property: "items",
3391
+ resource: {
3392
+ id: firstAnnotationPage.id,
3393
+ type: "AnnotationPage"
3394
+ }
3395
+ },
3396
+ initialData: {
3397
+ selector: resp.target.type === "SvgSelector" ? {
3398
+ type: "polygon",
3399
+ shape: resp.polygon
3400
+ } : resp.boundingBox
3401
+ }
3402
+ }
3403
+ );
3404
+ }
3405
+ }
3406
+ });
3407
+ if (!canvas)
3408
+ return null;
3409
+ if (!firstAnnotationPage) {
3410
+ return /* @__PURE__ */ jsx29("div", { children: "No annotation page - create one?" });
3411
+ }
3412
+ return /* @__PURE__ */ jsx29(Sidebar5, { children: /* @__PURE__ */ jsxs18(SidebarContent5, { padding: true, children: [
3413
+ /* @__PURE__ */ jsxs18("div", { className: "flex gap-4 border-b pt-4 pb-2 mb-2", children: [
3414
+ /* @__PURE__ */ jsx29("h2", { className: "text-lg font-semibold flex-1", children: "Tour steps" }),
3415
+ /* @__PURE__ */ jsx29(ActionButton9, { onPress: () => setReorderable((r2) => !r2), children: reorderable ? "Done" : "Reorder" })
3416
+ ] }),
3417
+ /* @__PURE__ */ jsx29(ResourceEditingProvider4, { resource: canvas, children: /* @__PURE__ */ jsxs18(AnnotationPageContext3, { annotationPage: firstAnnotationPage.id, children: [
3418
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4", children: [
3419
+ /* @__PURE__ */ jsx29(TourAnnotationPageEditor, { reorderable }),
3420
+ !busy ? isPending ? /* @__PURE__ */ jsxs18("div", { className: "border grid grid-cols-2 gap-2 disabled:opacity-50 border-gray-300 shadow-sm rounded p-1 bg-white relative text-black/40", children: [
3421
+ /* @__PURE__ */ jsx29(
3422
+ Button2,
3423
+ {
3424
+ onPress: cancelRequest,
3425
+ className: "text-black/80 rounded-sm p-3",
3426
+ children: "Cancel"
3427
+ }
3428
+ ),
3429
+ /* @__PURE__ */ jsx29(
3430
+ Button2,
3431
+ {
3432
+ onPress: completeRequest,
3433
+ className: "bg-me-100 text-me-500 rounded-sm p-3",
3434
+ children: "Save changes"
3435
+ }
3436
+ )
3437
+ ] }) : /* @__PURE__ */ jsx29(
3438
+ Button2,
3439
+ {
3440
+ onPress: () => requestAnnotation({ type: "polygon" }),
3441
+ className: "border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500",
3442
+ children: "+ Add new step"
3443
+ }
3444
+ ) : null
3445
+ ] }),
3446
+ itemsAnnotationPage ? /* @__PURE__ */ jsxs18(Fragment6, { children: [
3447
+ /* @__PURE__ */ jsx29("h3", { className: "text-md border-b pt-4 pb-2 mb-2", children: "Available tour steps from images" }),
3448
+ /* @__PURE__ */ jsx29(
3449
+ PromptToAddPaintingAnnotations,
3450
+ {
3451
+ painting: itemsAnnotationPage,
3452
+ page: editor.ref(),
3453
+ canvasId: canvas.id
3454
+ }
3455
+ )
3456
+ ] }) : null
3457
+ ] }) })
3458
+ ] }) });
3459
+ }
3460
+
3461
+ // src/index.tsx
3462
+ var exhibitionEditorPreset = extendApp(
3463
+ mapApp(ManifestPreset),
3464
+ {
3465
+ id: "exhibition-editor",
3466
+ title: "Exhibition Editor",
3467
+ project: true,
3468
+ projectType: "Manifest"
3469
+ },
3470
+ {
3471
+ config: {
3472
+ editorConfig: {
3473
+ Canvas: {
3474
+ hideTabs: [
3475
+ "@manifest-editor/overview",
3476
+ "@manifest-editor/technical-properties",
3477
+ "@manifest-editor/linking-properties",
3478
+ "@manifest-editor/nav-place-editor",
3479
+ "@manifest-editor/canvas-structural",
3480
+ "@manifest-editor/descriptive-properties",
3481
+ "@manifest-editor/overview-canvas-editor",
3482
+ "@manifest-editor/metadata"
3483
+ ]
3484
+ }
3485
+ }
3486
+ },
3487
+ leftPanels: [
3488
+ //
3489
+ exhibitionGridLeftPanel
3490
+ ],
3491
+ annotations: [
3492
+ //
3493
+ tourStepAnnotations
3494
+ ],
3495
+ leftPanelIds: ["left-panel-manifest"],
3496
+ canvasEditors: [
3497
+ //
3498
+ imageBlockEditor,
3499
+ youtubeMainEdtior,
3500
+ infoBlockEditor
3501
+ ],
3502
+ editors: [exhibitionCanvasEditor, customBehaviourEditor, exhibitionSummaryEdtior, exhibitionTourSteps],
3503
+ creators: [
3504
+ infoBoxCreator,
3505
+ imageSlideBottomCreator,
3506
+ imageSlideCreator,
3507
+ imageSlideLeftCreator,
3508
+ imageSlideRightCreator,
3509
+ youtubeSlideCreator
3510
+ ]
3511
+ }
3512
+ );
3513
+ export {
3514
+ exhibitionEditorPreset
3515
+ };