@adecore/agents-react 0.41.0 → 0.42.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/chat/actions.js +4 -0
- package/dist/chat/logic/lightbox.d.ts +31 -0
- package/dist/chat/logic/lightbox.js +61 -0
- package/dist/chat/logic/timeline.d.ts +1 -0
- package/dist/chat/logic/timeline.js +3 -0
- package/dist/chat/ui/AnsiOutput.d.ts +3 -2
- package/dist/chat/ui/AnsiOutput.js +26 -22
- package/dist/chat/ui/ImageView.d.ts +3 -0
- package/dist/chat/ui/ImageView.js +761 -437
- package/dist/chat/ui/intelligent-ui/renderers/content.js +4 -2
- package/dist/chat/ui/rows/MessageRows.js +10 -8
- package/dist/chat/ui/rows/Rows.js +42 -39
- package/dist/chat/ui/rows/WorkRows.d.ts +4 -2
- package/dist/chat/ui/rows/WorkRows.js +580 -211
- package/dist/chat/ui/rows/WorkflowRow.js +43 -41
- package/dist/host.d.ts +1 -0
- package/dist/locales/en/agent-chat.d.ts +9 -0
- package/dist/locales/en/agent-chat.js +11 -2
- package/dist/locales/nl/agent-chat.d.ts +9 -0
- package/dist/locales/nl/agent-chat.js +11 -2
- package/package.json +8 -8
- package/src/chat/actions.ts +1 -0
- package/src/chat/logic/lightbox.ts +88 -0
- package/src/chat/logic/timeline.ts +13 -2
- package/src/chat/ui/AnsiOutput.tsx +13 -2
- package/src/chat/ui/ImageView.tsx +255 -63
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +4 -2
- package/src/chat/ui/rows/MessageRows.tsx +10 -8
- package/src/chat/ui/rows/Rows.tsx +9 -1
- package/src/chat/ui/rows/WorkRows.tsx +127 -27
- package/src/chat/ui/rows/WorkflowRow.tsx +1 -1
- package/src/host.ts +2 -0
- package/src/locales/en/agent-chat.ts +11 -2
- package/src/locales/nl/agent-chat.ts +11 -2
|
@@ -1,480 +1,763 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { useRef, useState } from 'react';
|
|
2
|
+
import { createContext, useContext, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { ImageOff, Minus, Plus, RotateCcw } from 'lucide-react';
|
|
5
|
+
import { ChevronLeft, ChevronRight, ImageOff, Minus, Plus, RotateCcw } from 'lucide-react';
|
|
6
6
|
import { ButtonGroup, CloseButton, Dialog, Icon, IconButton, Tooltip } from '@adecore/ui';
|
|
7
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
8
|
+
import { BUTTON_STEP, clamped, MAX_SCALE, MIN_SCALE, START, stepped, wheeled, zoomed } from '../logic/lightbox.js';
|
|
7
9
|
import { DisplayImage } from './DisplayImage.js';
|
|
10
|
+
/* The pictures of one group in the order they stand on the page, which is the order the arrows walk. */
|
|
8
11
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
function createImageGroupStore() {
|
|
13
|
+
const images = new Map();
|
|
14
|
+
const listeners = new Set();
|
|
15
|
+
let snapshot = [];
|
|
16
|
+
const changed = () => {
|
|
17
|
+
snapshot = [...images.values()].sort((a, b) => {
|
|
18
|
+
if (a.element === null || b.element === null) {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
return a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
22
|
+
});
|
|
23
|
+
for (const listener of listeners) {
|
|
24
|
+
listener();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
set(image) {
|
|
29
|
+
const current = images.get(image.key);
|
|
30
|
+
if (current?.src === image.src && current.alt === image.alt && current.element === image.element) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
images.set(image.key, image);
|
|
34
|
+
changed();
|
|
35
|
+
},
|
|
36
|
+
remove(key) {
|
|
37
|
+
if (images.delete(key)) {
|
|
38
|
+
changed();
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
subscribe(listener) {
|
|
42
|
+
listeners.add(listener);
|
|
43
|
+
return () => {
|
|
44
|
+
listeners.delete(listener);
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
snapshot: () => snapshot
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const ImageGroupContext = createContext(null);
|
|
19
51
|
/*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `x` and `y` are offsets from the middle of the frame, so a scale of 1 is always centered.
|
|
52
|
+
* Thumbnails inside open one lightbox together, where the arrow keys walk from one to the next.
|
|
53
|
+
* A thumbnail with actions of its own, or one its caller opens from a control, stays on its own.
|
|
23
54
|
*/
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
55
|
+
export function ImageGroup(t0) {
|
|
56
|
+
const $ = _c(17);
|
|
57
|
+
const {
|
|
58
|
+
children
|
|
59
|
+
} = t0;
|
|
60
|
+
const [store] = useState(createImageGroupStore);
|
|
61
|
+
const images = useSyncExternalStore(store.subscribe, store.snapshot, store.snapshot);
|
|
62
|
+
let t1;
|
|
63
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t1 = {
|
|
65
|
+
key: null,
|
|
66
|
+
open: false
|
|
67
|
+
};
|
|
68
|
+
$[0] = t1;
|
|
69
|
+
} else {
|
|
70
|
+
t1 = $[0];
|
|
71
|
+
}
|
|
72
|
+
const [shown, setShown] = useState(t1);
|
|
73
|
+
let t2;
|
|
74
|
+
if ($[1] !== images || $[2] !== shown) {
|
|
75
|
+
let t3;
|
|
76
|
+
if ($[4] !== shown) {
|
|
77
|
+
t3 = image => image.key === shown.key;
|
|
78
|
+
$[4] = shown;
|
|
79
|
+
$[5] = t3;
|
|
80
|
+
} else {
|
|
81
|
+
t3 = $[5];
|
|
82
|
+
}
|
|
83
|
+
t2 = images.findIndex(t3);
|
|
84
|
+
$[1] = images;
|
|
85
|
+
$[2] = shown;
|
|
86
|
+
$[3] = t2;
|
|
87
|
+
} else {
|
|
88
|
+
t2 = $[3];
|
|
89
|
+
}
|
|
90
|
+
const index = t2;
|
|
91
|
+
let t3;
|
|
92
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
93
|
+
t3 = key => setShown({
|
|
94
|
+
key,
|
|
95
|
+
open: true
|
|
96
|
+
});
|
|
97
|
+
$[6] = t3;
|
|
98
|
+
} else {
|
|
99
|
+
t3 = $[6];
|
|
100
|
+
}
|
|
101
|
+
let t4;
|
|
102
|
+
if ($[7] !== store) {
|
|
103
|
+
t4 = {
|
|
104
|
+
store,
|
|
105
|
+
open: t3
|
|
106
|
+
};
|
|
107
|
+
$[7] = store;
|
|
108
|
+
$[8] = t4;
|
|
109
|
+
} else {
|
|
110
|
+
t4 = $[8];
|
|
111
|
+
}
|
|
112
|
+
let t5;
|
|
113
|
+
if ($[9] !== images || $[10] !== index || $[11] !== shown) {
|
|
114
|
+
t5 = index !== -1 && /*#__PURE__*/_jsx(Lightbox, {
|
|
115
|
+
images: images,
|
|
116
|
+
index: index,
|
|
117
|
+
open: shown.open,
|
|
118
|
+
onOpenChange: open => setShown(current => ({
|
|
119
|
+
...current,
|
|
120
|
+
open
|
|
121
|
+
})),
|
|
122
|
+
onIndexChange: next => setShown({
|
|
123
|
+
key: images[next]?.key ?? null,
|
|
124
|
+
open: true
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
$[9] = images;
|
|
128
|
+
$[10] = index;
|
|
129
|
+
$[11] = shown;
|
|
130
|
+
$[12] = t5;
|
|
131
|
+
} else {
|
|
132
|
+
t5 = $[12];
|
|
133
|
+
}
|
|
134
|
+
let t6;
|
|
135
|
+
if ($[13] !== children || $[14] !== t4 || $[15] !== t5) {
|
|
136
|
+
t6 = /*#__PURE__*/_jsxs(ImageGroupContext, {
|
|
137
|
+
value: t4,
|
|
138
|
+
children: [children, t5]
|
|
139
|
+
});
|
|
140
|
+
$[13] = children;
|
|
141
|
+
$[14] = t4;
|
|
142
|
+
$[15] = t5;
|
|
143
|
+
$[16] = t6;
|
|
144
|
+
} else {
|
|
145
|
+
t6 = $[16];
|
|
28
146
|
}
|
|
29
|
-
|
|
147
|
+
return t6;
|
|
148
|
+
}
|
|
149
|
+
/* A press on an arrow or a zoom button is the button's, never the start of a pan or a zoom of the stage. */
|
|
150
|
+
function onControl(target) {
|
|
151
|
+
return target instanceof Element && target.closest('button') !== null;
|
|
152
|
+
}
|
|
153
|
+
/* Where the pointer sits against the middle of the stage, which is what the transform counts from. */
|
|
154
|
+
function pointIn(stage, event) {
|
|
155
|
+
const rect = stage.getBoundingClientRect();
|
|
30
156
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
157
|
+
x: event.clientX - rect.left - rect.width / 2,
|
|
158
|
+
y: event.clientY - rect.top - rect.height / 2
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function boundsOf(stage) {
|
|
162
|
+
const picture = stage.querySelector('img');
|
|
163
|
+
return {
|
|
164
|
+
image: {
|
|
165
|
+
width: picture?.offsetWidth ?? 0,
|
|
166
|
+
height: picture?.offsetHeight ?? 0
|
|
167
|
+
},
|
|
168
|
+
frame: {
|
|
169
|
+
width: stage.clientWidth,
|
|
170
|
+
height: stage.clientHeight
|
|
171
|
+
}
|
|
34
172
|
};
|
|
35
173
|
}
|
|
36
|
-
/*
|
|
174
|
+
/* Pictures large and on their own: a pinch zooms, two fingers pan, the arrow keys walk the group, Escape closes. */
|
|
37
175
|
function Lightbox(t0) {
|
|
38
|
-
const $ = _c(
|
|
176
|
+
const $ = _c(112);
|
|
39
177
|
const {
|
|
40
|
-
|
|
41
|
-
|
|
178
|
+
images,
|
|
179
|
+
index,
|
|
42
180
|
open,
|
|
43
181
|
onOpenChange,
|
|
182
|
+
onIndexChange,
|
|
44
183
|
actions
|
|
45
184
|
} = t0;
|
|
46
185
|
const {
|
|
47
186
|
t
|
|
48
187
|
} = useTranslation("agent-chat");
|
|
49
188
|
const [view, setView] = useState(START);
|
|
189
|
+
const [viewed, setViewed] = useState(index);
|
|
190
|
+
const stageElementRef = useRef(null);
|
|
191
|
+
const dragRef = useRef(null);
|
|
192
|
+
const movedRef = useRef(false);
|
|
193
|
+
const image = images[index];
|
|
50
194
|
let t1;
|
|
51
|
-
if ($[0] !==
|
|
52
|
-
t1 =
|
|
53
|
-
$[0] =
|
|
54
|
-
$[1] =
|
|
195
|
+
if ($[0] !== images.length || $[1] !== index) {
|
|
196
|
+
t1 = stepped(index, images.length, -1);
|
|
197
|
+
$[0] = images.length;
|
|
198
|
+
$[1] = index;
|
|
199
|
+
$[2] = t1;
|
|
55
200
|
} else {
|
|
56
|
-
t1 = $[
|
|
201
|
+
t1 = $[2];
|
|
57
202
|
}
|
|
58
|
-
const
|
|
203
|
+
const previous = t1;
|
|
59
204
|
let t2;
|
|
60
|
-
if ($[
|
|
61
|
-
t2 =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
$[2] = name;
|
|
66
|
-
$[3] = t2;
|
|
205
|
+
if ($[3] !== images.length || $[4] !== index) {
|
|
206
|
+
t2 = stepped(index, images.length, 1);
|
|
207
|
+
$[3] = images.length;
|
|
208
|
+
$[4] = index;
|
|
209
|
+
$[5] = t2;
|
|
67
210
|
} else {
|
|
68
|
-
t2 = $[
|
|
211
|
+
t2 = $[5];
|
|
212
|
+
}
|
|
213
|
+
const next = t2;
|
|
214
|
+
if (viewed !== index) {
|
|
215
|
+
setViewed(index);
|
|
216
|
+
setView(START);
|
|
69
217
|
}
|
|
70
|
-
const title = t2;
|
|
71
|
-
const frameRef = useRef(null);
|
|
72
|
-
const dragRef = useRef(null);
|
|
73
218
|
if (!open && view !== START) {
|
|
74
219
|
setView(START);
|
|
75
220
|
}
|
|
221
|
+
if (image === undefined) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
76
224
|
let t3;
|
|
77
|
-
if ($[
|
|
78
|
-
t3 =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
x: 0,
|
|
83
|
-
y: 0
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
x: event.clientX - rect.left - rect.width / 2,
|
|
88
|
-
y: event.clientY - rect.top - rect.height / 2
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
$[4] = t3;
|
|
225
|
+
if ($[6] !== image.alt) {
|
|
226
|
+
t3 = image.alt.slice(image.alt.lastIndexOf("/") + 1);
|
|
227
|
+
$[6] = image.alt;
|
|
228
|
+
$[7] = t3;
|
|
92
229
|
} else {
|
|
93
|
-
t3 = $[
|
|
230
|
+
t3 = $[7];
|
|
94
231
|
}
|
|
95
|
-
const
|
|
232
|
+
const name = t3;
|
|
96
233
|
let t4;
|
|
97
|
-
if ($[
|
|
98
|
-
t4 =
|
|
99
|
-
|
|
234
|
+
if ($[8] !== name) {
|
|
235
|
+
t4 = /*#__PURE__*/_jsx("span", {
|
|
236
|
+
className: "min-w-0 truncate text-xs text-text",
|
|
237
|
+
children: name
|
|
238
|
+
});
|
|
239
|
+
$[8] = name;
|
|
240
|
+
$[9] = t4;
|
|
100
241
|
} else {
|
|
101
|
-
t4 = $[
|
|
242
|
+
t4 = $[9];
|
|
102
243
|
}
|
|
103
|
-
const
|
|
244
|
+
const title = t4;
|
|
104
245
|
let t5;
|
|
105
|
-
if ($[
|
|
106
|
-
t5 =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
246
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
247
|
+
t5 = stage => {
|
|
248
|
+
stageElementRef.current = stage;
|
|
249
|
+
if (stage === null) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const onWheel = event => {
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
const point = pointIn(stage, event);
|
|
255
|
+
const bounds = boundsOf(stage);
|
|
256
|
+
setView(current => wheeled(current, event, point, bounds));
|
|
257
|
+
};
|
|
258
|
+
stage.addEventListener("wheel", onWheel, {
|
|
259
|
+
passive: false
|
|
260
|
+
});
|
|
261
|
+
return () => stage.removeEventListener("wheel", onWheel);
|
|
262
|
+
};
|
|
263
|
+
$[10] = t5;
|
|
112
264
|
} else {
|
|
113
|
-
t5 = $[
|
|
265
|
+
t5 = $[10];
|
|
114
266
|
}
|
|
267
|
+
const stageRef = t5;
|
|
115
268
|
let t6;
|
|
116
|
-
if ($[
|
|
117
|
-
t6 =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
269
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
270
|
+
t6 = factor => {
|
|
271
|
+
const stage_0 = stageElementRef.current;
|
|
272
|
+
if (stage_0 !== null) {
|
|
273
|
+
const bounds_0 = boundsOf(stage_0);
|
|
274
|
+
setView(current_0 => zoomed(current_0, factor, {
|
|
275
|
+
x: 0,
|
|
276
|
+
y: 0
|
|
277
|
+
}, bounds_0));
|
|
278
|
+
}
|
|
279
|
+
};
|
|
124
280
|
$[11] = t6;
|
|
125
281
|
} else {
|
|
126
282
|
t6 = $[11];
|
|
127
283
|
}
|
|
284
|
+
const zoomButton = t6;
|
|
128
285
|
let t7;
|
|
129
|
-
if ($[12]
|
|
130
|
-
t7 =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
286
|
+
if ($[12] !== onIndexChange) {
|
|
287
|
+
t7 = to => {
|
|
288
|
+
if (to !== null) {
|
|
289
|
+
onIndexChange?.(to);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
$[12] = onIndexChange;
|
|
293
|
+
$[13] = t7;
|
|
134
294
|
} else {
|
|
135
|
-
t7 = $[
|
|
295
|
+
t7 = $[13];
|
|
136
296
|
}
|
|
297
|
+
const step = t7;
|
|
137
298
|
let t8;
|
|
138
|
-
if ($[
|
|
139
|
-
t8 =
|
|
140
|
-
|
|
141
|
-
|
|
299
|
+
if ($[14] !== next || $[15] !== previous || $[16] !== step) {
|
|
300
|
+
t8 = event_0 => {
|
|
301
|
+
if (event_0.altKey || event_0.ctrlKey || event_0.metaKey || event_0.shiftKey) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const to_0 = event_0.key === "ArrowLeft" ? previous : event_0.key === "ArrowRight" ? next : null;
|
|
305
|
+
if (to_0 !== null) {
|
|
306
|
+
event_0.preventDefault();
|
|
307
|
+
step(to_0);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
$[14] = next;
|
|
311
|
+
$[15] = previous;
|
|
312
|
+
$[16] = step;
|
|
313
|
+
$[17] = t8;
|
|
142
314
|
} else {
|
|
143
|
-
t8 = $[
|
|
315
|
+
t8 = $[17];
|
|
144
316
|
}
|
|
317
|
+
const onKeyDown = t8;
|
|
145
318
|
let t9;
|
|
146
|
-
if ($[
|
|
147
|
-
t9 = /*#__PURE__*/
|
|
148
|
-
className: "
|
|
149
|
-
children:
|
|
319
|
+
if ($[18] !== image.alt) {
|
|
320
|
+
t9 = /*#__PURE__*/_jsx(Dialog.Title, {
|
|
321
|
+
className: "sr-only",
|
|
322
|
+
children: image.alt
|
|
150
323
|
});
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
324
|
+
$[18] = image.alt;
|
|
325
|
+
$[19] = t9;
|
|
153
326
|
} else {
|
|
154
|
-
t9 = $[
|
|
327
|
+
t9 = $[19];
|
|
155
328
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
329
|
+
const t10 = view.scale * 100;
|
|
330
|
+
let t11;
|
|
331
|
+
if ($[20] !== t10) {
|
|
332
|
+
t11 = formatNumber(t10);
|
|
333
|
+
$[20] = t10;
|
|
334
|
+
$[21] = t11;
|
|
160
335
|
} else {
|
|
161
|
-
|
|
336
|
+
t11 = $[21];
|
|
162
337
|
}
|
|
163
|
-
let
|
|
164
|
-
if ($[
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
338
|
+
let t12;
|
|
339
|
+
if ($[22] !== t11) {
|
|
340
|
+
t12 = /*#__PURE__*/_jsxs("span", {
|
|
341
|
+
className: "tabular-nums text-xs text-text-faint",
|
|
342
|
+
children: [t11, "%"]
|
|
343
|
+
});
|
|
344
|
+
$[22] = t11;
|
|
345
|
+
$[23] = t12;
|
|
168
346
|
} else {
|
|
169
|
-
|
|
347
|
+
t12 = $[23];
|
|
170
348
|
}
|
|
171
|
-
const t12 = view.scale <= MIN_SCALE;
|
|
172
349
|
let t13;
|
|
173
|
-
if ($[
|
|
174
|
-
t13 = (
|
|
175
|
-
$[
|
|
350
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
351
|
+
t13 = /*#__PURE__*/_jsx("span", {});
|
|
352
|
+
$[24] = t13;
|
|
176
353
|
} else {
|
|
177
|
-
t13 = $[
|
|
354
|
+
t13 = $[24];
|
|
178
355
|
}
|
|
179
356
|
let t14;
|
|
180
|
-
if ($[
|
|
181
|
-
t14 =
|
|
357
|
+
if ($[25] !== t) {
|
|
358
|
+
t14 = t("image.zoomOut");
|
|
359
|
+
$[25] = t;
|
|
360
|
+
$[26] = t14;
|
|
361
|
+
} else {
|
|
362
|
+
t14 = $[26];
|
|
363
|
+
}
|
|
364
|
+
const t15 = view.scale <= MIN_SCALE;
|
|
365
|
+
let t16;
|
|
366
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
367
|
+
t16 = () => zoomButton(1 / BUTTON_STEP);
|
|
368
|
+
$[27] = t16;
|
|
369
|
+
} else {
|
|
370
|
+
t16 = $[27];
|
|
371
|
+
}
|
|
372
|
+
let t17;
|
|
373
|
+
if ($[28] !== t14 || $[29] !== t15) {
|
|
374
|
+
t17 = /*#__PURE__*/_jsx(IconButton, {
|
|
182
375
|
icon: Minus,
|
|
183
376
|
size: "sm",
|
|
184
|
-
label:
|
|
185
|
-
disabled:
|
|
186
|
-
onClick:
|
|
377
|
+
label: t14,
|
|
378
|
+
disabled: t15,
|
|
379
|
+
onClick: t16
|
|
187
380
|
});
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
381
|
+
$[28] = t14;
|
|
382
|
+
$[29] = t15;
|
|
383
|
+
$[30] = t17;
|
|
191
384
|
} else {
|
|
192
|
-
|
|
385
|
+
t17 = $[30];
|
|
193
386
|
}
|
|
194
|
-
let
|
|
195
|
-
if ($[
|
|
196
|
-
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
387
|
+
let t18;
|
|
388
|
+
if ($[31] !== t) {
|
|
389
|
+
t18 = t("image.zoomIn");
|
|
390
|
+
$[31] = t;
|
|
391
|
+
$[32] = t18;
|
|
199
392
|
} else {
|
|
200
|
-
|
|
393
|
+
t18 = $[32];
|
|
201
394
|
}
|
|
202
|
-
const
|
|
203
|
-
let
|
|
204
|
-
if ($[
|
|
205
|
-
|
|
206
|
-
$[
|
|
395
|
+
const t19 = view.scale >= MAX_SCALE;
|
|
396
|
+
let t20;
|
|
397
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
398
|
+
t20 = () => zoomButton(BUTTON_STEP);
|
|
399
|
+
$[33] = t20;
|
|
207
400
|
} else {
|
|
208
|
-
|
|
401
|
+
t20 = $[33];
|
|
209
402
|
}
|
|
210
|
-
let
|
|
211
|
-
if ($[
|
|
212
|
-
|
|
403
|
+
let t21;
|
|
404
|
+
if ($[34] !== t18 || $[35] !== t19) {
|
|
405
|
+
t21 = /*#__PURE__*/_jsx(IconButton, {
|
|
213
406
|
icon: Plus,
|
|
214
407
|
size: "sm",
|
|
215
|
-
label:
|
|
216
|
-
disabled:
|
|
217
|
-
onClick:
|
|
408
|
+
label: t18,
|
|
409
|
+
disabled: t19,
|
|
410
|
+
onClick: t20
|
|
218
411
|
});
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
412
|
+
$[34] = t18;
|
|
413
|
+
$[35] = t19;
|
|
414
|
+
$[36] = t21;
|
|
222
415
|
} else {
|
|
223
|
-
|
|
416
|
+
t21 = $[36];
|
|
224
417
|
}
|
|
225
|
-
let
|
|
226
|
-
if ($[
|
|
227
|
-
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
418
|
+
let t22;
|
|
419
|
+
if ($[37] !== t) {
|
|
420
|
+
t22 = t("image.reset");
|
|
421
|
+
$[37] = t;
|
|
422
|
+
$[38] = t22;
|
|
230
423
|
} else {
|
|
231
|
-
|
|
424
|
+
t22 = $[38];
|
|
232
425
|
}
|
|
233
|
-
const
|
|
234
|
-
let
|
|
235
|
-
if ($[
|
|
236
|
-
|
|
237
|
-
$[
|
|
426
|
+
const t23 = view.scale === MIN_SCALE;
|
|
427
|
+
let t24;
|
|
428
|
+
if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
|
|
429
|
+
t24 = () => setView(START);
|
|
430
|
+
$[39] = t24;
|
|
238
431
|
} else {
|
|
239
|
-
|
|
432
|
+
t24 = $[39];
|
|
240
433
|
}
|
|
241
|
-
let
|
|
242
|
-
if ($[
|
|
243
|
-
|
|
434
|
+
let t25;
|
|
435
|
+
if ($[40] !== t22 || $[41] !== t23) {
|
|
436
|
+
t25 = /*#__PURE__*/_jsx(IconButton, {
|
|
244
437
|
icon: RotateCcw,
|
|
245
438
|
size: "sm",
|
|
246
|
-
label:
|
|
247
|
-
disabled:
|
|
248
|
-
onClick:
|
|
439
|
+
label: t22,
|
|
440
|
+
disabled: t23,
|
|
441
|
+
onClick: t24
|
|
249
442
|
});
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
443
|
+
$[40] = t22;
|
|
444
|
+
$[41] = t23;
|
|
445
|
+
$[42] = t25;
|
|
253
446
|
} else {
|
|
254
|
-
|
|
447
|
+
t25 = $[42];
|
|
255
448
|
}
|
|
256
|
-
let
|
|
257
|
-
if ($[
|
|
258
|
-
|
|
259
|
-
render:
|
|
260
|
-
children: [
|
|
449
|
+
let t26;
|
|
450
|
+
if ($[43] !== t17 || $[44] !== t21 || $[45] !== t25) {
|
|
451
|
+
t26 = /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
452
|
+
render: t13,
|
|
453
|
+
children: [t17, t21, t25]
|
|
261
454
|
});
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
455
|
+
$[43] = t17;
|
|
456
|
+
$[44] = t21;
|
|
457
|
+
$[45] = t25;
|
|
458
|
+
$[46] = t26;
|
|
266
459
|
} else {
|
|
267
|
-
|
|
460
|
+
t26 = $[46];
|
|
268
461
|
}
|
|
269
|
-
let
|
|
270
|
-
if ($[
|
|
271
|
-
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
462
|
+
let t27;
|
|
463
|
+
if ($[47] !== t) {
|
|
464
|
+
t27 = t("common.action.close");
|
|
465
|
+
$[47] = t;
|
|
466
|
+
$[48] = t27;
|
|
274
467
|
} else {
|
|
275
|
-
|
|
468
|
+
t27 = $[48];
|
|
276
469
|
}
|
|
277
|
-
let
|
|
278
|
-
if ($[
|
|
279
|
-
|
|
280
|
-
label:
|
|
470
|
+
let t28;
|
|
471
|
+
if ($[49] !== t27) {
|
|
472
|
+
t28 = /*#__PURE__*/_jsx(CloseButton, {
|
|
473
|
+
label: t27,
|
|
281
474
|
kbd: "esc",
|
|
282
475
|
className: "ml-1",
|
|
283
476
|
dialog: true
|
|
284
477
|
});
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
478
|
+
$[49] = t27;
|
|
479
|
+
$[50] = t28;
|
|
287
480
|
} else {
|
|
288
|
-
|
|
481
|
+
t28 = $[50];
|
|
289
482
|
}
|
|
290
|
-
let
|
|
291
|
-
if ($[
|
|
292
|
-
|
|
293
|
-
className: "flex h-
|
|
294
|
-
children: [
|
|
483
|
+
let t29;
|
|
484
|
+
if ($[51] !== actions || $[52] !== t12 || $[53] !== t26 || $[54] !== t28) {
|
|
485
|
+
t29 = /*#__PURE__*/_jsxs("div", {
|
|
486
|
+
className: "lightbox-bar flex h-12 shrink-0 items-center justify-end gap-2 pl-3",
|
|
487
|
+
children: [t12, t26, actions, t28]
|
|
295
488
|
});
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[49] = t26;
|
|
489
|
+
$[51] = actions;
|
|
490
|
+
$[52] = t12;
|
|
491
|
+
$[53] = t26;
|
|
492
|
+
$[54] = t28;
|
|
493
|
+
$[55] = t29;
|
|
302
494
|
} else {
|
|
303
|
-
|
|
495
|
+
t29 = $[55];
|
|
304
496
|
}
|
|
305
|
-
const
|
|
306
|
-
let
|
|
307
|
-
if ($[
|
|
308
|
-
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
497
|
+
const t30 = view.scale > MIN_SCALE && "cursor-grab";
|
|
498
|
+
let t31;
|
|
499
|
+
if ($[56] !== t30) {
|
|
500
|
+
t31 = clsx("lightbox-stage relative grid min-h-0 grow place-items-center overflow-hidden", t30);
|
|
501
|
+
$[56] = t30;
|
|
502
|
+
$[57] = t31;
|
|
311
503
|
} else {
|
|
312
|
-
|
|
504
|
+
t31 = $[57];
|
|
313
505
|
}
|
|
314
|
-
let
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
setView(current_1 => current_1.scale > MIN_SCALE ? START : zoomed(current_1, 2, point_0.x, point_0.y));
|
|
506
|
+
let t32;
|
|
507
|
+
if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
|
|
508
|
+
t32 = e => {
|
|
509
|
+
if (onControl(e.target)) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
const point_0 = pointIn(e.currentTarget, e);
|
|
513
|
+
const bounds_1 = boundsOf(e.currentTarget);
|
|
514
|
+
setView(current_1 => current_1.scale > MIN_SCALE ? START : zoomed(current_1, 2, point_0, bounds_1));
|
|
324
515
|
};
|
|
325
|
-
$[
|
|
326
|
-
$[53] = t30;
|
|
516
|
+
$[58] = t32;
|
|
327
517
|
} else {
|
|
328
|
-
|
|
329
|
-
t30 = $[53];
|
|
518
|
+
t32 = $[58];
|
|
330
519
|
}
|
|
331
|
-
let
|
|
332
|
-
if ($[
|
|
333
|
-
|
|
334
|
-
|
|
520
|
+
let t33;
|
|
521
|
+
if ($[59] !== view.scale || $[60] !== view.x || $[61] !== view.y) {
|
|
522
|
+
t33 = e_0 => {
|
|
523
|
+
movedRef.current = false;
|
|
524
|
+
if (view.scale <= MIN_SCALE || onControl(e_0.target)) {
|
|
335
525
|
return;
|
|
336
526
|
}
|
|
337
|
-
|
|
527
|
+
e_0.currentTarget.setPointerCapture(e_0.pointerId);
|
|
338
528
|
dragRef.current = {
|
|
339
|
-
pointerId:
|
|
340
|
-
x:
|
|
341
|
-
y:
|
|
529
|
+
pointerId: e_0.pointerId,
|
|
530
|
+
x: e_0.clientX - view.x,
|
|
531
|
+
y: e_0.clientY - view.y
|
|
342
532
|
};
|
|
343
533
|
};
|
|
344
|
-
$[
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
347
|
-
$[
|
|
534
|
+
$[59] = view.scale;
|
|
535
|
+
$[60] = view.x;
|
|
536
|
+
$[61] = view.y;
|
|
537
|
+
$[62] = t33;
|
|
348
538
|
} else {
|
|
349
|
-
|
|
539
|
+
t33 = $[62];
|
|
350
540
|
}
|
|
351
|
-
let t32;
|
|
352
|
-
let t33;
|
|
353
541
|
let t34;
|
|
354
|
-
|
|
355
|
-
|
|
542
|
+
let t35;
|
|
543
|
+
let t36;
|
|
544
|
+
if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
|
|
545
|
+
t34 = e_1 => {
|
|
356
546
|
const drag = dragRef.current;
|
|
357
|
-
if (drag?.pointerId
|
|
358
|
-
|
|
359
|
-
...current_2,
|
|
360
|
-
x: e_2.clientX - drag.x,
|
|
361
|
-
y: e_2.clientY - drag.y
|
|
362
|
-
}));
|
|
547
|
+
if (drag?.pointerId !== e_1.pointerId) {
|
|
548
|
+
return;
|
|
363
549
|
}
|
|
550
|
+
movedRef.current = true;
|
|
551
|
+
const bounds_2 = boundsOf(e_1.currentTarget);
|
|
552
|
+
setView(current_2 => clamped({
|
|
553
|
+
...current_2,
|
|
554
|
+
x: e_1.clientX - drag.x,
|
|
555
|
+
y: e_1.clientY - drag.y
|
|
556
|
+
}, bounds_2));
|
|
364
557
|
};
|
|
365
|
-
|
|
558
|
+
t35 = () => {
|
|
366
559
|
dragRef.current = null;
|
|
367
560
|
};
|
|
368
|
-
|
|
561
|
+
t36 = () => {
|
|
369
562
|
dragRef.current = null;
|
|
370
563
|
};
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
564
|
+
$[63] = t34;
|
|
565
|
+
$[64] = t35;
|
|
566
|
+
$[65] = t36;
|
|
567
|
+
} else {
|
|
568
|
+
t34 = $[63];
|
|
569
|
+
t35 = $[64];
|
|
570
|
+
t36 = $[65];
|
|
571
|
+
}
|
|
572
|
+
let t37;
|
|
573
|
+
if ($[66] !== onOpenChange) {
|
|
574
|
+
t37 = e_2 => {
|
|
575
|
+
if (e_2.target === e_2.currentTarget && !movedRef.current) {
|
|
576
|
+
onOpenChange(false);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
$[66] = onOpenChange;
|
|
580
|
+
$[67] = t37;
|
|
374
581
|
} else {
|
|
375
|
-
|
|
376
|
-
t33 = $[59];
|
|
377
|
-
t34 = $[60];
|
|
582
|
+
t37 = $[67];
|
|
378
583
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
584
|
+
const t38 = image.key;
|
|
585
|
+
const t39 = image.src;
|
|
586
|
+
const t40 = image.alt;
|
|
587
|
+
let t41;
|
|
588
|
+
if ($[68] !== view.x) {
|
|
589
|
+
t41 = Math.round(view.x);
|
|
590
|
+
$[68] = view.x;
|
|
591
|
+
$[69] = t41;
|
|
384
592
|
} else {
|
|
385
|
-
|
|
593
|
+
t41 = $[69];
|
|
386
594
|
}
|
|
387
|
-
let
|
|
388
|
-
if ($[
|
|
389
|
-
|
|
390
|
-
$[
|
|
391
|
-
$[
|
|
392
|
-
} else {
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
const
|
|
396
|
-
let
|
|
397
|
-
if ($[
|
|
398
|
-
|
|
399
|
-
transform:
|
|
595
|
+
let t42;
|
|
596
|
+
if ($[70] !== view.y) {
|
|
597
|
+
t42 = Math.round(view.y);
|
|
598
|
+
$[70] = view.y;
|
|
599
|
+
$[71] = t42;
|
|
600
|
+
} else {
|
|
601
|
+
t42 = $[71];
|
|
602
|
+
}
|
|
603
|
+
const t43 = `translate(${t41}px, ${t42}px) scale(${view.scale})`;
|
|
604
|
+
let t44;
|
|
605
|
+
if ($[72] !== t43) {
|
|
606
|
+
t44 = {
|
|
607
|
+
transform: t43
|
|
400
608
|
};
|
|
401
|
-
$[
|
|
402
|
-
$[
|
|
609
|
+
$[72] = t43;
|
|
610
|
+
$[73] = t44;
|
|
403
611
|
} else {
|
|
404
|
-
|
|
612
|
+
t44 = $[73];
|
|
405
613
|
}
|
|
406
|
-
let
|
|
407
|
-
if ($[
|
|
408
|
-
|
|
409
|
-
src:
|
|
410
|
-
alt:
|
|
614
|
+
let t45;
|
|
615
|
+
if ($[74] !== image.alt || $[75] !== image.key || $[76] !== image.src || $[77] !== t44) {
|
|
616
|
+
t45 = /*#__PURE__*/_jsx(DisplayImage, {
|
|
617
|
+
src: t39,
|
|
618
|
+
alt: t40,
|
|
411
619
|
draggable: false,
|
|
412
620
|
className: "select-none",
|
|
413
|
-
style:
|
|
621
|
+
style: t44
|
|
622
|
+
}, t38);
|
|
623
|
+
$[74] = image.alt;
|
|
624
|
+
$[75] = image.key;
|
|
625
|
+
$[76] = image.src;
|
|
626
|
+
$[77] = t44;
|
|
627
|
+
$[78] = t45;
|
|
628
|
+
} else {
|
|
629
|
+
t45 = $[78];
|
|
630
|
+
}
|
|
631
|
+
let t46;
|
|
632
|
+
if ($[79] !== images.length || $[80] !== next || $[81] !== previous || $[82] !== step || $[83] !== t) {
|
|
633
|
+
t46 = images.length > 1 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
634
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
635
|
+
icon: ChevronLeft,
|
|
636
|
+
label: t("image.previous"),
|
|
637
|
+
kbd: "\u2190",
|
|
638
|
+
disabled: previous === null,
|
|
639
|
+
className: "absolute top-1/2 left-4 -translate-y-1/2",
|
|
640
|
+
onClick: () => step(previous)
|
|
641
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
642
|
+
icon: ChevronRight,
|
|
643
|
+
label: t("image.next"),
|
|
644
|
+
kbd: "\u2192",
|
|
645
|
+
disabled: next === null,
|
|
646
|
+
className: "absolute top-1/2 right-4 -translate-y-1/2",
|
|
647
|
+
onClick: () => step(next)
|
|
648
|
+
})]
|
|
649
|
+
});
|
|
650
|
+
$[79] = images.length;
|
|
651
|
+
$[80] = next;
|
|
652
|
+
$[81] = previous;
|
|
653
|
+
$[82] = step;
|
|
654
|
+
$[83] = t;
|
|
655
|
+
$[84] = t46;
|
|
656
|
+
} else {
|
|
657
|
+
t46 = $[84];
|
|
658
|
+
}
|
|
659
|
+
let t47;
|
|
660
|
+
if ($[85] !== t31 || $[86] !== t33 || $[87] !== t37 || $[88] !== t45 || $[89] !== t46) {
|
|
661
|
+
t47 = /*#__PURE__*/_jsxs("div", {
|
|
662
|
+
ref: stageRef,
|
|
663
|
+
className: t31,
|
|
664
|
+
onDoubleClick: t32,
|
|
665
|
+
onPointerDown: t33,
|
|
666
|
+
onPointerMove: t34,
|
|
667
|
+
onPointerUp: t35,
|
|
668
|
+
onPointerCancel: t36,
|
|
669
|
+
onClick: t37,
|
|
670
|
+
children: [t45, t46]
|
|
671
|
+
});
|
|
672
|
+
$[85] = t31;
|
|
673
|
+
$[86] = t33;
|
|
674
|
+
$[87] = t37;
|
|
675
|
+
$[88] = t45;
|
|
676
|
+
$[89] = t46;
|
|
677
|
+
$[90] = t47;
|
|
678
|
+
} else {
|
|
679
|
+
t47 = $[90];
|
|
680
|
+
}
|
|
681
|
+
let t48;
|
|
682
|
+
if ($[91] !== image.alt || $[92] !== name || $[93] !== title) {
|
|
683
|
+
t48 = name === image.alt ? title : /*#__PURE__*/_jsx(Tooltip, {
|
|
684
|
+
label: image.alt,
|
|
685
|
+
children: title
|
|
686
|
+
});
|
|
687
|
+
$[91] = image.alt;
|
|
688
|
+
$[92] = name;
|
|
689
|
+
$[93] = title;
|
|
690
|
+
$[94] = t48;
|
|
691
|
+
} else {
|
|
692
|
+
t48 = $[94];
|
|
693
|
+
}
|
|
694
|
+
let t49;
|
|
695
|
+
if ($[95] !== images.length || $[96] !== index || $[97] !== t) {
|
|
696
|
+
t49 = images.length > 1 && /*#__PURE__*/_jsx("span", {
|
|
697
|
+
className: "shrink-0 tabular-nums text-xs text-text-faint",
|
|
698
|
+
children: t("image.position", {
|
|
699
|
+
index: formatNumber(index + 1),
|
|
700
|
+
count: formatNumber(images.length)
|
|
701
|
+
})
|
|
414
702
|
});
|
|
415
|
-
$[
|
|
416
|
-
$[
|
|
417
|
-
$[
|
|
418
|
-
$[
|
|
419
|
-
} else {
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
let
|
|
423
|
-
if ($[
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
onWheel: t29,
|
|
428
|
-
onDoubleClick: t30,
|
|
429
|
-
onPointerDown: t31,
|
|
430
|
-
onPointerMove: t32,
|
|
431
|
-
onPointerUp: t33,
|
|
432
|
-
onPointerCancel: t34,
|
|
433
|
-
children: t39
|
|
703
|
+
$[95] = images.length;
|
|
704
|
+
$[96] = index;
|
|
705
|
+
$[97] = t;
|
|
706
|
+
$[98] = t49;
|
|
707
|
+
} else {
|
|
708
|
+
t49 = $[98];
|
|
709
|
+
}
|
|
710
|
+
let t50;
|
|
711
|
+
if ($[99] !== t48 || $[100] !== t49) {
|
|
712
|
+
t50 = /*#__PURE__*/_jsxs("div", {
|
|
713
|
+
className: "flex h-12 shrink-0 items-center justify-center gap-3 px-3",
|
|
714
|
+
children: [t48, t49]
|
|
434
715
|
});
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[74] = t40;
|
|
716
|
+
$[99] = t48;
|
|
717
|
+
$[100] = t49;
|
|
718
|
+
$[101] = t50;
|
|
439
719
|
} else {
|
|
440
|
-
|
|
720
|
+
t50 = $[101];
|
|
441
721
|
}
|
|
442
|
-
let
|
|
443
|
-
if ($[
|
|
444
|
-
|
|
722
|
+
let t51;
|
|
723
|
+
if ($[102] !== onKeyDown || $[103] !== t29 || $[104] !== t47 || $[105] !== t50 || $[106] !== t9) {
|
|
724
|
+
t51 = /*#__PURE__*/_jsxs(Dialog.Popup, {
|
|
445
725
|
backdropClassName: "lightbox-backdrop",
|
|
446
|
-
className: "
|
|
447
|
-
|
|
726
|
+
className: "lightbox",
|
|
727
|
+
onKeyDown: onKeyDown,
|
|
728
|
+
children: [t9, t29, t47, t50]
|
|
448
729
|
});
|
|
449
|
-
$[
|
|
450
|
-
$[
|
|
451
|
-
$[
|
|
452
|
-
$[
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
730
|
+
$[102] = onKeyDown;
|
|
731
|
+
$[103] = t29;
|
|
732
|
+
$[104] = t47;
|
|
733
|
+
$[105] = t50;
|
|
734
|
+
$[106] = t9;
|
|
735
|
+
$[107] = t51;
|
|
736
|
+
} else {
|
|
737
|
+
t51 = $[107];
|
|
738
|
+
}
|
|
739
|
+
let t52;
|
|
740
|
+
if ($[108] !== onOpenChange || $[109] !== open || $[110] !== t51) {
|
|
741
|
+
t52 = /*#__PURE__*/_jsx(Dialog.Root, {
|
|
459
742
|
open: open,
|
|
460
743
|
onOpenChange: onOpenChange,
|
|
461
|
-
children:
|
|
744
|
+
children: t51
|
|
462
745
|
});
|
|
463
|
-
$[
|
|
464
|
-
$[
|
|
465
|
-
$[
|
|
466
|
-
$[
|
|
746
|
+
$[108] = onOpenChange;
|
|
747
|
+
$[109] = open;
|
|
748
|
+
$[110] = t51;
|
|
749
|
+
$[111] = t52;
|
|
467
750
|
} else {
|
|
468
|
-
|
|
751
|
+
t52 = $[111];
|
|
469
752
|
}
|
|
470
|
-
return
|
|
753
|
+
return t52;
|
|
471
754
|
}
|
|
472
755
|
/*
|
|
473
756
|
* A thumbnail that opens the same image large. The button is the picture, so there is nothing to aim at.
|
|
474
757
|
* The image is bytes where the host keeps them; until they are here a quiet square stands in for it.
|
|
475
758
|
*/
|
|
476
759
|
export function ImageThumb(t0) {
|
|
477
|
-
const $ = _c(
|
|
760
|
+
const $ = _c(47);
|
|
478
761
|
const {
|
|
479
762
|
source,
|
|
480
763
|
alt,
|
|
@@ -484,161 +767,202 @@ export function ImageThumb(t0) {
|
|
|
484
767
|
open: openProp,
|
|
485
768
|
onOpenChange
|
|
486
769
|
} = t0;
|
|
770
|
+
const key = useId();
|
|
771
|
+
const buttonRef = useRef(null);
|
|
772
|
+
const context = useContext(ImageGroupContext);
|
|
773
|
+
const group = actions === undefined && openProp === undefined ? context : null;
|
|
487
774
|
const [ownOpen, setOwnOpen] = useState(false);
|
|
488
775
|
const open = openProp ?? ownOpen;
|
|
776
|
+
const {
|
|
777
|
+
url: src,
|
|
778
|
+
failure
|
|
779
|
+
} = source;
|
|
489
780
|
let t1;
|
|
490
|
-
if ($[0] !==
|
|
491
|
-
t1 =
|
|
492
|
-
|
|
493
|
-
onOpenChange?.(next);
|
|
781
|
+
if ($[0] !== aspect) {
|
|
782
|
+
t1 = aspect === undefined ? undefined : {
|
|
783
|
+
aspectRatio: aspect
|
|
494
784
|
};
|
|
495
|
-
$[0] =
|
|
785
|
+
$[0] = aspect;
|
|
496
786
|
$[1] = t1;
|
|
497
787
|
} else {
|
|
498
788
|
t1 = $[1];
|
|
499
789
|
}
|
|
500
|
-
const
|
|
501
|
-
const {
|
|
502
|
-
url: src,
|
|
503
|
-
failure
|
|
504
|
-
} = source;
|
|
790
|
+
const ratio = t1;
|
|
505
791
|
let t2;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
792
|
+
let t3;
|
|
793
|
+
if ($[2] !== alt || $[3] !== group || $[4] !== key || $[5] !== src) {
|
|
794
|
+
t2 = () => {
|
|
795
|
+
if (group === null || src === null) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
group.store.set({
|
|
799
|
+
key,
|
|
800
|
+
src,
|
|
801
|
+
alt,
|
|
802
|
+
element: buttonRef.current
|
|
803
|
+
});
|
|
804
|
+
return () => group.store.remove(key);
|
|
509
805
|
};
|
|
510
|
-
|
|
511
|
-
$[
|
|
806
|
+
t3 = [group, key, src, alt];
|
|
807
|
+
$[2] = alt;
|
|
808
|
+
$[3] = group;
|
|
809
|
+
$[4] = key;
|
|
810
|
+
$[5] = src;
|
|
811
|
+
$[6] = t2;
|
|
812
|
+
$[7] = t3;
|
|
813
|
+
} else {
|
|
814
|
+
t2 = $[6];
|
|
815
|
+
t3 = $[7];
|
|
816
|
+
}
|
|
817
|
+
useLayoutEffect(t2, t3);
|
|
818
|
+
let t4;
|
|
819
|
+
if ($[8] !== onOpenChange) {
|
|
820
|
+
t4 = next => {
|
|
821
|
+
setOwnOpen(next);
|
|
822
|
+
onOpenChange?.(next);
|
|
823
|
+
};
|
|
824
|
+
$[8] = onOpenChange;
|
|
825
|
+
$[9] = t4;
|
|
512
826
|
} else {
|
|
513
|
-
|
|
827
|
+
t4 = $[9];
|
|
514
828
|
}
|
|
515
|
-
const
|
|
829
|
+
const setOpen = t4;
|
|
516
830
|
if (src === null) {
|
|
517
|
-
const
|
|
518
|
-
let
|
|
519
|
-
if ($[
|
|
520
|
-
|
|
521
|
-
$[
|
|
522
|
-
$[
|
|
831
|
+
const t5 = aspect === undefined ? "size-16" : "w-full";
|
|
832
|
+
let t6;
|
|
833
|
+
if ($[10] !== t5) {
|
|
834
|
+
t6 = clsx("grid place-items-center rounded-lg border border-border bg-surface-sunken text-text-faint", t5);
|
|
835
|
+
$[10] = t5;
|
|
836
|
+
$[11] = t6;
|
|
523
837
|
} else {
|
|
524
|
-
|
|
838
|
+
t6 = $[11];
|
|
525
839
|
}
|
|
526
|
-
let
|
|
527
|
-
if ($[
|
|
528
|
-
|
|
840
|
+
let t7;
|
|
841
|
+
if ($[12] !== failure) {
|
|
842
|
+
t7 = failure !== null && /*#__PURE__*/_jsx(Tooltip, {
|
|
529
843
|
label: failure,
|
|
530
844
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
531
845
|
icon: ImageOff,
|
|
532
846
|
size: 14
|
|
533
847
|
})
|
|
534
848
|
});
|
|
535
|
-
$[
|
|
536
|
-
$[
|
|
849
|
+
$[12] = failure;
|
|
850
|
+
$[13] = t7;
|
|
537
851
|
} else {
|
|
538
|
-
|
|
852
|
+
t7 = $[13];
|
|
539
853
|
}
|
|
540
|
-
let
|
|
541
|
-
if ($[
|
|
542
|
-
|
|
543
|
-
className:
|
|
854
|
+
let t8;
|
|
855
|
+
if ($[14] !== ratio || $[15] !== t6 || $[16] !== t7) {
|
|
856
|
+
t8 = /*#__PURE__*/_jsx("span", {
|
|
857
|
+
className: t6,
|
|
544
858
|
style: ratio,
|
|
545
|
-
children:
|
|
859
|
+
children: t7
|
|
546
860
|
});
|
|
547
|
-
$[
|
|
548
|
-
$[
|
|
549
|
-
$[
|
|
550
|
-
$[
|
|
861
|
+
$[14] = ratio;
|
|
862
|
+
$[15] = t6;
|
|
863
|
+
$[16] = t7;
|
|
864
|
+
$[17] = t8;
|
|
551
865
|
} else {
|
|
552
|
-
|
|
866
|
+
t8 = $[17];
|
|
553
867
|
}
|
|
554
|
-
return
|
|
868
|
+
return t8;
|
|
555
869
|
}
|
|
556
|
-
const
|
|
557
|
-
let
|
|
558
|
-
if ($[
|
|
559
|
-
|
|
560
|
-
$[
|
|
561
|
-
$[
|
|
870
|
+
const t5 = aspect !== undefined && "w-full";
|
|
871
|
+
let t6;
|
|
872
|
+
if ($[18] !== t5) {
|
|
873
|
+
t6 = clsx("block overflow-hidden rounded-lg border border-border", t5);
|
|
874
|
+
$[18] = t5;
|
|
875
|
+
$[19] = t6;
|
|
562
876
|
} else {
|
|
563
|
-
|
|
877
|
+
t6 = $[19];
|
|
564
878
|
}
|
|
565
|
-
let
|
|
566
|
-
if ($[
|
|
567
|
-
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
879
|
+
let t7;
|
|
880
|
+
if ($[20] !== group || $[21] !== key || $[22] !== setOpen) {
|
|
881
|
+
t7 = () => group === null ? setOpen(true) : group.open(key);
|
|
882
|
+
$[20] = group;
|
|
883
|
+
$[21] = key;
|
|
884
|
+
$[22] = setOpen;
|
|
885
|
+
$[23] = t7;
|
|
570
886
|
} else {
|
|
571
|
-
|
|
887
|
+
t7 = $[23];
|
|
572
888
|
}
|
|
573
|
-
const
|
|
574
|
-
let
|
|
575
|
-
if ($[
|
|
576
|
-
|
|
577
|
-
$[
|
|
578
|
-
$[
|
|
579
|
-
$[
|
|
889
|
+
const t8 = aspect !== undefined && "size-full object-contain";
|
|
890
|
+
let t9;
|
|
891
|
+
if ($[24] !== className || $[25] !== t8) {
|
|
892
|
+
t9 = clsx(t8, className);
|
|
893
|
+
$[24] = className;
|
|
894
|
+
$[25] = t8;
|
|
895
|
+
$[26] = t9;
|
|
580
896
|
} else {
|
|
581
|
-
|
|
897
|
+
t9 = $[26];
|
|
582
898
|
}
|
|
583
|
-
let
|
|
584
|
-
if ($[
|
|
585
|
-
|
|
899
|
+
let t10;
|
|
900
|
+
if ($[27] !== alt || $[28] !== src || $[29] !== t9) {
|
|
901
|
+
t10 = /*#__PURE__*/_jsx(DisplayImage, {
|
|
586
902
|
src: src,
|
|
587
903
|
alt: alt,
|
|
588
|
-
className:
|
|
904
|
+
className: t9
|
|
589
905
|
});
|
|
590
|
-
$[
|
|
591
|
-
$[
|
|
592
|
-
$[
|
|
593
|
-
$[
|
|
906
|
+
$[27] = alt;
|
|
907
|
+
$[28] = src;
|
|
908
|
+
$[29] = t9;
|
|
909
|
+
$[30] = t10;
|
|
594
910
|
} else {
|
|
595
|
-
|
|
911
|
+
t10 = $[30];
|
|
596
912
|
}
|
|
597
|
-
let
|
|
598
|
-
if ($[
|
|
599
|
-
|
|
913
|
+
let t11;
|
|
914
|
+
if ($[31] !== ratio || $[32] !== t10 || $[33] !== t6 || $[34] !== t7) {
|
|
915
|
+
t11 = /*#__PURE__*/_jsx("button", {
|
|
916
|
+
ref: buttonRef,
|
|
600
917
|
type: "button",
|
|
601
|
-
className:
|
|
918
|
+
className: t6,
|
|
602
919
|
style: ratio,
|
|
603
|
-
onClick:
|
|
604
|
-
children:
|
|
920
|
+
onClick: t7,
|
|
921
|
+
children: t10
|
|
605
922
|
});
|
|
606
|
-
$[
|
|
607
|
-
$[
|
|
608
|
-
$[
|
|
609
|
-
$[
|
|
610
|
-
$[
|
|
611
|
-
} else {
|
|
612
|
-
|
|
613
|
-
}
|
|
614
|
-
let
|
|
615
|
-
if ($[
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
923
|
+
$[31] = ratio;
|
|
924
|
+
$[32] = t10;
|
|
925
|
+
$[33] = t6;
|
|
926
|
+
$[34] = t7;
|
|
927
|
+
$[35] = t11;
|
|
928
|
+
} else {
|
|
929
|
+
t11 = $[35];
|
|
930
|
+
}
|
|
931
|
+
let t12;
|
|
932
|
+
if ($[36] !== actions || $[37] !== alt || $[38] !== group || $[39] !== key || $[40] !== open || $[41] !== setOpen || $[42] !== src) {
|
|
933
|
+
t12 = group === null && /*#__PURE__*/_jsx(Lightbox, {
|
|
934
|
+
images: [{
|
|
935
|
+
key,
|
|
936
|
+
src,
|
|
937
|
+
alt,
|
|
938
|
+
element: null
|
|
939
|
+
}],
|
|
940
|
+
index: 0,
|
|
619
941
|
open: open,
|
|
620
942
|
onOpenChange: setOpen,
|
|
621
943
|
actions: actions
|
|
622
944
|
});
|
|
623
|
-
$[
|
|
624
|
-
$[
|
|
625
|
-
$[
|
|
626
|
-
$[
|
|
627
|
-
$[
|
|
628
|
-
$[
|
|
945
|
+
$[36] = actions;
|
|
946
|
+
$[37] = alt;
|
|
947
|
+
$[38] = group;
|
|
948
|
+
$[39] = key;
|
|
949
|
+
$[40] = open;
|
|
950
|
+
$[41] = setOpen;
|
|
951
|
+
$[42] = src;
|
|
952
|
+
$[43] = t12;
|
|
629
953
|
} else {
|
|
630
|
-
|
|
954
|
+
t12 = $[43];
|
|
631
955
|
}
|
|
632
|
-
let
|
|
633
|
-
if ($[
|
|
634
|
-
|
|
635
|
-
children: [
|
|
956
|
+
let t13;
|
|
957
|
+
if ($[44] !== t11 || $[45] !== t12) {
|
|
958
|
+
t13 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
959
|
+
children: [t11, t12]
|
|
636
960
|
});
|
|
637
|
-
$[
|
|
638
|
-
$[
|
|
639
|
-
$[
|
|
961
|
+
$[44] = t11;
|
|
962
|
+
$[45] = t12;
|
|
963
|
+
$[46] = t13;
|
|
640
964
|
} else {
|
|
641
|
-
|
|
965
|
+
t13 = $[46];
|
|
642
966
|
}
|
|
643
|
-
return
|
|
967
|
+
return t13;
|
|
644
968
|
}
|